iboot-http-client 1.2.6 → 1.2.8

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.
@@ -1,2 +1,9 @@
1
- (function(a,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("pino"),require("pino-pretty"),require("js-md5"),require("crypto-js")):typeof define=="function"&&define.amd?define(["exports","pino","pino-pretty","js-md5","crypto-js"],w):(a=typeof globalThis<"u"?globalThis:a||self,w(a["iboot-http-client"]={},a.pino,a.PinoPretty,a.md5,a.CryptoJS))})(this,(function(a,w,C,L,I){"use strict";const H={GENERAL:0,PHONE:1,EMAIL:2},p={TYPE_MGT:0,TYPE_C:1,TYPE_B:2},j={FROM_WEB:1,FROM_PC:2,FROM_WX_MINI_PRO:3,FROM_WX_PLU:4,FROM_WX_E:5,FROM_APP:6,FROM_DEVICE:7},D={unknown:0,male:1,female:2},W=C({colorize:!0,destination:process.stdout,translateTime:"SYS:yyyy-mm-dd HH:MM:ss",ignore:"pid,hostname",messageFormat:"{msg}",singleLine:!0}),f=w({name:process.env.APP_NAME??"iBoot",level:process.env.APP_ENV==="production"?"info":"debug",nestedKey:"payload"},W),O=s=>Array.isArray(s)||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Array]",_=s=>{const e=s||32,t="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",r=t.length;let n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*r));return n},P=(s,e)=>{const t={};return s.split("&").forEach(n=>{const o=n.split("=");o[1]&&(!e||e.indexOf(o[0])==-1)&&(t[o[0]]=o[1])}),t},y=s=>!s||s==""||s.length==0?"":encodeURIComponent(s).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\'/g,"%27").replace(/\!/g,"%21").replace(/\~/g,"%7E"),$=(s,e)=>{const t={"M+":s.getMonth()+1,"d+":s.getDate(),"h+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};if(/(y+)/.test(e)){const n=new RegExp(/(y+)/).exec(e);let o=0;n&&n.length>0&&(o=n[0].length),e=e.replace(/(y+)/,s.getFullYear()+"").substring(4-o)}for(const r in t){const n="("+r+")",o=new RegExp(n);if(o.test(e)){const i=o.exec(e);let c=0;i&&i.length>0&&(c=i[0].length),e=e.replace(o,c==1?t[r].toString():("00"+t[r]).substring(t[r].toString().length))}}return e},K="zh-CN",v="_device_id_key",N="_current_website_key",A="Get request error!",b="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"},T={DEVICE_ID:"Device-Id",LANG:"Lang",WEBSITE_ID:"Website-Id",WEBSITE_NO:"Website-No"},R=s=>{if(!s.get)throw new Error("The get method of IStorage has not been implemented.");const e=s.get(v)??"",t=s.get(N),r=t!=null?JSON.parse(t):null,n={};return e.length>0&&(n["Device-Id"]=e),r&&(n.Lang=r.language,r.websiteId&&(n["Website-Id"]=r.websiteId),r.websiteNo&&(n["Website-No"]=r.websiteNo)),n},G=({deviceId:s,website:e},t)=>{if(!t.set)throw new Error("The set method of IStorage has not been implemented.");t.set(v,s),e&&t.set(N,JSON.stringify(e))},U=async(s,e)=>{if(e?.data){const i=new URLSearchParams(e.data);s.indexOf("?")!=-1?s+=`&${i}`:s+=`?${i}`}const t=e&&e.storage&&e.storage.get?R(e.storage):{},r=e?.headers;if(r)for(const i in r){const c=r[i];c&&(t[i]=c)}f.info({url:s,headers:t},"GET");const n=await fetch(s,{method:"GET",headers:t,cache:e?.useCache?"force-cache":"default"});if(n.ok){const i=Object.fromEntries(n.headers.entries()),c={...await n.json(),headers:i};return f.debug(c,"GET_RESULT"),c}const o={code:n.status,success:!1,msg:n.statusText};return f.error(o),o},S=async(s,e)=>{const t=e?.data??{},r=e?.headers;let n;const o=e&&e.storage&&e.storage.get?R(e.storage):{},i=new Headers(o);if(t instanceof FormData?n=t:(n=JSON.stringify(t),i.set("Content-Type","application/json")),r)for(let l in r){const h=r[l];h&&i.set(l,h)}f.info({url:s,headers:i},"POST");const c=await fetch(s,{method:"POST",headers:i,body:n});if(c.ok){const l=Object.fromEntries(c.headers.entries()),h={...await c.json(),headers:l};return f.debug(h,"POST_RESULT"),h}const d={code:c.status,success:!1,msg:c.statusText};return f.error(d),d},F=async(s,e)=>{const t=await U(s,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??A);return}throw Error(t.msg??A)},k=async(s,e)=>{const t=await S(s,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??b);return}throw Error(t.msg??b)},Y=async(s,e)=>{const t=await S(s,e);return t.success?(e?.showSuccess&&e.showSuccess(t.msg??"SUCCESS"),!0):(e?.showError&&e.showError(t.msg??b),!1)},V=s=>{if(s.get){const e=s.get(T.DEVICE_ID),t=s.get(T.LANG),r=s.get(T.WEBSITE_ID),n=s.get(T.WEBSITE_NO),o={};return e&&e.length>0&&(o.deviceId=e),t&&t.length>0&&(o.lang=t),r&&r.length>0&&(o.websiteId=r),n&&n.length>0&&(o.websiteNo=n),o}throw new Error("The get method of IStorage has not been implemented.")},q=(s,e)=>{if(s.set)e.deviceId&&s.set(T.DEVICE_ID,e.deviceId),e.lang&&s.set(T.LANG,e.lang),e.websiteId&&s.set(T.WEBSITE_ID,e.websiteId),e.websiteNo&&s.set(T.WEBSITE_NO,e.websiteNo);else throw new Error("The set method of IStorage has not been implemented.")},X=s=>{if(s.get){const e=s.get(u.IBOOT_DEVICE_ID),t=s.get(u.IBOOT_LANG),r=s.get(u.IBOOT_WEBSITE_ID),n=s.get(u.IBOOT_WEBSITE_NO),o={};return e&&e.length>0&&(o.deviceId=e),t&&t.length>0&&(o.lang=t),r&&r.length>0&&(o.websiteId=r),n&&n.length>0&&(o.websiteNo=n),o}throw new Error("The get method of ICookies has not been implemented.")},J=(s,e)=>{if(s.set)e.deviceId&&s.set(u.IBOOT_DEVICE_ID,e.deviceId),e.lang&&s.set(u.IBOOT_LANG,e.lang),e.websiteId&&s.set(u.IBOOT_WEBSITE_ID,e.websiteId),e.websiteNo&&s.set(u.IBOOT_WEBSITE_NO,e.websiteNo);else throw new Error("The set method of ICookies has not been implemented.")},z=s=>{if(s.get){const e=s.get(u.IBOOT_USER);if(e&&e.length>0)return JSON.parse(e)}},Q=s=>{if(s.get){const e=s.get(u.IBOOT_USER);if(e&&e.length>0){const t=JSON.parse(e),r=t.username,n=t.userType.toString(),o=s.get(u.IBOOT_TOKEN);if(o)return{username:r,utype:n,token:o}}}},Z=(s,e)=>{const{id:t,name:r,username:n,nickname:o,headImg:i,token:c,lastLoginTime:d,deviceId:l,userType:h,mustChangePwd:m}=s,g={id:t,name:r,username:n,nickname:o||r,headImg:i,lastLoginTime:d,deviceId:l,userType:h,accountType:0,needToReview:!1,socketOnline:!1,mustChangePwd:m};if(!e.set)throw new Error("cookies set function is undefined");e.set(u.IBOOT_TOKEN,c,{path:"/",secure:process.env.APP_ENV==="production",httpOnly:!0,sameSite:"strict"}),e.set(u.IBOOT_USER,JSON.stringify(g))},x=s=>{if(!s.set)throw new Error("cookies set function is undefined");if(s.set(u.IBOOT_TOKEN,"",{maxAge:-1,httpOnly:!0,path:"/"}),s.set(u.IBOOT_USER,"",{maxAge:-1,httpOnly:!0,path:"/"}),!s.delete)throw new Error("cookies delete function is undefined");s.delete(u.IBOOT_TOKEN),s.delete(u.IBOOT_USER)};class ee{baseUrl;helloMethod;apiKey;userType;userFrom;deviceId;version="1";lang;websiteId;websiteNo;constructor(e){process.env.APP_ENV==="production"||f.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??p.TYPE_MGT,this.deviceId=e.deviceId??_(10),this.lang=e.lang??K,this.websiteId=e.websiteId,this.websiteNo=e.websiteNo}encrypt(e){const t=I.enc.Utf8.parse(this.apiKey);return I.AES.encrypt(e,t).toString()}decrypt(e){const t=I.enc.Utf8.parse(this.apiKey);return I.AES.decrypt(e,t,{mode:I.mode.ECB}).toString(I.enc.Utf8)}convertUrlParameter(e){const t=[];for(const r in e){let n=e[r];if(n&&typeof n=="string")n=n.trim();else if(n&&typeof n=="object"){if(O(n)){if(n.length===0)continue;for(let o=0;o<n.length;o++){const i=n[o];for(const c in i){const d=i[c]??void 0;if(d){if(typeof d=="object")O(d)&&d.forEach((l,h)=>{if(l)for(const m in l){const g=l[m];if(g&&g.toString().length>0){const E=`[${o.toString()}].${c+`[${h.toString()}].${m}`}=${y(g)}`;t.push(r+E)}}});else if(d.toString().length>0){const l=`[${o.toString()}].${c}=${y(d.toString())}`;t.push(r+l)}}}}}else for(const o in n){const i=n[o];if(i!=null&&i!=""&&i.length!=0){const c=`.${o}=${y(i)}`;t.push(r+c)}}continue}else n&&typeof n=="function"&&(n=null);n!=null&&n!=""&&n.length!=0&&t.push(r+"="+y(n))}return t&&t.join("&")}async sign(e){const t="&key="+await this.helloIboot(),r=[];for(const d in e)r.push(d);r.sort((d,l)=>d.toLowerCase().localeCompare(l.toLowerCase()));const n=[];r.forEach(d=>{let l=e[d];typeof l=="object"&&(l=JSON.stringify(l)),n.push(d+"="+l)});const o=n.join("&"),i=L.md5((o+t).toLocaleUpperCase()),c={params:o,md5:i};return f.debug(c,"API_SIGN"),i}assemblyParameter(e,t){const r=e??{};return r.timestamp=Date.now()+"",r.echostr=_(10),r.version=this.version,r.deviceId=this.deviceId,r.webid=this.websiteId,r.apiKey=this.apiKey,t&&t.length>0&&(r.username=t),r}async assemblyHeader({urlParams:e,token:t}){const r={"Content-Type":"application/x-www-form-urlencoded","Res-Type":"json","Device-Id":this.deviceId,"User-Type":t?.utype.toString()??this.userType.toString(),"User-From":this.userFrom,"Api-Key":this.apiKey};this.lang&&this.lang.length>0&&(r.Lang=this.lang),this.websiteId&&this.websiteId.length>0&&(r["Web-Id"]=this.websiteId),this.websiteNo&&this.websiteNo.length>0&&(r["Web-No"]=this.websiteNo),t&&(t.token&&t.token.length>0&&t.username&&t.username.length>0&&(r.Authorization=t.token,r.Username=t.username),t.xcsrf&&(r[t.xcsrf.csrfHeader]=t.xcsrf.csrfToken));const n=P(e),o=await this.sign(n);return r.Sign=o,r}async helloIboot(){if(this.helloMethod.length<=0)return this.apiKey;const e=this.getApiUrl(this.helloMethod),t={"Content-Type":"application/x-www-form-urlencoded","Res-Type":"json","Api-Key":this.apiKey},r={url:e,headers:t};f.debug(r,"HELLO");const n=await fetch(e,{method:"GET",headers:t,credentials:"include",cache:"force-cache"});if(n.ok){const o=await n.json();return f.debug(o.data,"HELLO RESULT"),o.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:r,cache:n="default"}){const o=this.assemblyParameter(t),i=this.convertUrlParameter(o),c=await this.assemblyHeader({urlParams:i,token:r}),d=`${this.getApiUrl(e)}?${i.toString()}`,l={url:d,headers:c};f.info(l,"GET");const h=await fetch(d,{method:"GET",headers:c,credentials:"include",cache:n});if(h.ok){const g=Object.fromEntries(h.headers.entries()),E={...await h.json(),headers:g};return f.debug(E,"GET_RESULT"),E}const m={code:h.status,success:!1,msg:h.statusText};return f.error(m),m}async post({url:e,data:t,token:r,cache:n="default"}){t=t?{...t}:{};const o=t.buffer??void 0,i=t.boundary??void 0;o&&delete t.buffer,i&&delete t.boundary;const c=this.assemblyParameter(t),d=this.convertUrlParameter(c),l=await this.assemblyHeader({urlParams:d,token:r});o&&i&&(l["Content-Type"]=`multipart/form-data; boundary=${i}`);const h=this.getApiUrl(e),m={url:h,headers:l,params:c};f.info(m,"POST");const g=o?`${h}?${d}`:h,E=await fetch(g,{method:"POST",headers:l,body:o||d.toString(),credentials:"include",cache:n});if(E.ok){const te=Object.fromEntries(E.headers.entries()),B={...await E.json(),headers:te};return f.debug(B,"POST_RESULT"),B}const M={code:E.status,success:!1,msg:E.statusText};return f.error(M),M}async stream({url:e,data:t,token:r}){t=t?{...t}:{};const n=t.buffer??void 0,o=t.boundary??void 0;n&&delete t.buffer,o&&delete t.boundary;const i=this.assemblyParameter(t),c=this.convertUrlParameter(i),d=await this.assemblyHeader({urlParams:c,token:r});n&&o&&(d["Content-Type"]=`multipart/form-data; boundary=${o}`),d.Connection="keep-alive",d["X-Accel-Buffering"]="no",d["Cache-Control"]="no-cache";const l=this.getApiUrl(e);try{const h=n?`${l}?${c}`:l,m={url:l,headers:d,params:i};f.info(m,"STREAM");const g=await fetch(h,{method:"POST",headers:d,body:n||c.toString(),credentials:"include"});if(!g.ok)throw new Error(`HTTP error! status: ${g.status}`);if(!g.body)throw new Error("No response body");const E=Object.fromEntries(g.headers.entries());return new Response(g.body,{headers:E})}catch(h){throw h}}}a.ACCOUNT_TYPE_MAP=H,a.HttpClient=ee,a.USER_FORM_MAP=j,a.USER_SEX_MAP=D,a.USER_TYPE_MAP=p,a.cleanToken=x,a.dateFormat=$,a.get=U,a.getLoginUser=z,a.getServerHttpCookies=X,a.getServerHttpOpts=V,a.getToken=Q,a.iGet=F,a.iPost=k,a.iPostSuccess=Y,a.isArray=O,a.logger=f,a.post=S,a.randomString=_,a.setClientRequestHeader=G,a.setServerHttpCookies=J,a.setServerHttpHeaders=q,a.setToken=Z,a.urlEncode=y,a.urlParamToJson=P,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(A,oe){typeof exports=="object"&&typeof module<"u"?oe(exports,require("pino"),require("pino-pretty"),require("js-md5"),require("crypto-js")):typeof define=="function"&&define.amd?define(["exports","pino","pino-pretty","js-md5","crypto-js"],oe):(A=typeof globalThis<"u"?globalThis:A||self,oe(A["iboot-http-client"]={},A.pino,A.PinoPretty,A.md5,A.CryptoJS))})(this,(function(A,oe,Qt,Zt,Q){"use strict";const er={GENERAL:0,PHONE:1,EMAIL:2},ye={TYPE_MGT:0,TYPE_C:1,TYPE_B:2},tr={FROM_WEB:1,FROM_PC:2,FROM_WX_MINI_PRO:3,FROM_WX_PLU:4,FROM_WX_E:5,FROM_APP:6,FROM_DEVICE:7},rr={unknown:0,male:1,female:2},nr=Qt({colorize:!0,destination:process.stdout,translateTime:"SYS:yyyy-mm-dd HH:MM:ss",ignore:"pid,hostname",messageFormat:"{msg}",singleLine:!0}),U=oe({name:process.env.APP_NAME??"iBoot",level:process.env.APP_ENV==="production"?"info":"debug",nestedKey:"payload"},nr),Te=i=>Array.isArray(i)||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Array]",Se=i=>{const e=i||32,t="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",o=t.length;let n="";for(let a=0;a<e;a++)n+=t.charAt(Math.floor(Math.random()*o));return n},pe=(i,e)=>{const t={};return i.split("&").forEach(n=>{const a=n.split("=");a[1]&&(!e||e.indexOf(a[0])==-1)&&(t[a[0]]=a[1])}),t},se=i=>!i||i==""||i.length==0?"":encodeURIComponent(i).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\'/g,"%27").replace(/\!/g,"%21").replace(/\~/g,"%7E"),ir=(i,e)=>{const t={"M+":i.getMonth()+1,"d+":i.getDate(),"h+":i.getHours(),"m+":i.getMinutes(),"s+":i.getSeconds(),"q+":Math.floor((i.getMonth()+3)/3),S:i.getMilliseconds()};if(/(y+)/.test(e)){const n=new RegExp(/(y+)/).exec(e);let a=0;n&&n.length>0&&(a=n[0].length),e=e.replace(/(y+)/,i.getFullYear()+"").substring(4-a)}for(const o in t){const n="("+o+")",a=new RegExp(n);if(a.test(e)){const c=a.exec(e);let r=0;c&&c.length>0&&(r=c[0].length),e=e.replace(a,r==1?t[o].toString():("00"+t[o]).substring(t[o].toString().length))}}return e};var me={exports:{}},Ae={},Ie={},Oe={},ut;function or(){return ut||(ut=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"detectDomainLocale",{enumerable:!0,get:function(){return e}});function e(t,o,n){if(t){n&&(n=n.toLowerCase());for(const r of t){var a,c;const d=(a=r.domain)==null?void 0:a.split(":",1)[0].toLowerCase();if(o===d||n===r.defaultLocale.toLowerCase()||(c=r.locales)!=null&&c.some(g=>g.toLowerCase()===n))return r}}}})(Oe)),Oe}var Ne={},xe={},ct;function sr(){return ct||(ct=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"removeTrailingSlash",{enumerable:!0,get:function(){return e}});function e(t){return t.replace(/\/$/,"")||"/"}})(xe)),xe}var Ce={},Le={},lt;function ke(){return lt||(lt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"parsePath",{enumerable:!0,get:function(){return e}});function e(t){const o=t.indexOf("#"),n=t.indexOf("?"),a=n>-1&&(o<0||n<o);return a||o>-1?{pathname:t.substring(0,a?n:o),query:a?t.substring(n,o>-1?o:void 0):"",hash:o>-1?t.slice(o):""}:{pathname:t,query:"",hash:""}}})(Le)),Le}var dt;function ht(){return dt||(dt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"addPathPrefix",{enumerable:!0,get:function(){return t}});const e=ke();function t(o,n){if(!o.startsWith("/")||!n)return o;const{pathname:a,query:c,hash:r}=(0,e.parsePath)(o);return""+n+a+c+r}})(Ce)),Ce}var Ue={},ft;function ar(){return ft||(ft=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"addPathSuffix",{enumerable:!0,get:function(){return t}});const e=ke();function t(o,n){if(!o.startsWith("/")||!n)return o;const{pathname:a,query:c,hash:r}=(0,e.parsePath)(o);return""+a+n+c+r}})(Ue)),Ue}var De={},Me={},pt;function je(){return pt||(pt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"pathHasPrefix",{enumerable:!0,get:function(){return t}});const e=ke();function t(o,n){if(typeof o!="string")return!1;const{pathname:a}=(0,e.parsePath)(o);return a===n||a.startsWith(n+"/")}})(Me)),Me}var mt;function ur(){return mt||(mt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"addLocale",{enumerable:!0,get:function(){return o}});const e=ht(),t=je();function o(n,a,c,r){if(!a||a===c)return n;const d=n.toLowerCase();return!r&&((0,t.pathHasPrefix)(d,"/api")||(0,t.pathHasPrefix)(d,"/"+a.toLowerCase()))?n:(0,e.addPathPrefix)(n,"/"+a)}})(De)),De}var _t;function cr(){return _t||(_t=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"formatNextPathnameInfo",{enumerable:!0,get:function(){return a}});const e=sr(),t=ht(),o=ar(),n=ur();function a(c){let r=(0,n.addLocale)(c.pathname,c.locale,c.buildId?void 0:c.defaultLocale,c.ignorePrefix);return(c.buildId||!c.trailingSlash)&&(r=(0,e.removeTrailingSlash)(r)),c.buildId&&(r=(0,o.addPathSuffix)((0,t.addPathPrefix)(r,"/_next/data/"+c.buildId),c.pathname==="/"?"index.json":".json")),r=(0,t.addPathPrefix)(r,c.basePath),!c.buildId&&c.trailingSlash?r.endsWith("/")?r:(0,o.addPathSuffix)(r,"/"):(0,e.removeTrailingSlash)(r)}})(Ne)),Ne}var qe={},gt;function lr(){return gt||(gt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"getHostname",{enumerable:!0,get:function(){return e}});function e(t,o){let n;if(o?.host&&!Array.isArray(o.host))n=o.host.toString().split(":",1)[0];else if(t.hostname)n=t.hostname;else return;return n.toLowerCase()}})(qe)),qe}var He={},Fe={},bt;function dr(){return bt||(bt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"normalizeLocalePath",{enumerable:!0,get:function(){return e}});function e(t,o){let n;const a=t.split("/");return(o||[]).some(c=>a[1]&&a[1].toLowerCase()===c.toLowerCase()?(n=c,a.splice(1,1),t=a.join("/")||"/",!0):!1),{pathname:t,detectedLocale:n}}})(Fe)),Fe}var Ge={},wt;function hr(){return wt||(wt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"removePathPrefix",{enumerable:!0,get:function(){return t}});const e=je();function t(o,n){if(!(0,e.pathHasPrefix)(o,n))return o;const a=o.slice(n.length);return a.startsWith("/")?a:"/"+a}})(Ge)),Ge}var Et;function fr(){return Et||(Et=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"getNextPathnameInfo",{enumerable:!0,get:function(){return n}});const e=dr(),t=hr(),o=je();function n(a,c){var r;const{basePath:d,i18n:g,trailingSlash:u}=(r=c.nextConfig)!=null?r:{},_={pathname:a,trailingSlash:a!=="/"?a.endsWith("/"):u};d&&(0,o.pathHasPrefix)(_.pathname,d)&&(_.pathname=(0,t.removePathPrefix)(_.pathname,d),_.basePath=d);let p=_.pathname;if(_.pathname.startsWith("/_next/data/")&&_.pathname.endsWith(".json")){const T=_.pathname.replace(/^\/_next\/data\//,"").replace(/\.json$/,"").split("/"),x=T[0];_.buildId=x,p=T[1]!=="index"?"/"+T.slice(1).join("/"):"/",c.parseData===!0&&(_.pathname=p)}if(g){let T=c.i18nProvider?c.i18nProvider.analyze(_.pathname):(0,e.normalizeLocalePath)(_.pathname,g.locales);_.locale=T.detectedLocale;var R;_.pathname=(R=T.pathname)!=null?R:_.pathname,!T.detectedLocale&&_.buildId&&(T=c.i18nProvider?c.i18nProvider.analyze(p):(0,e.normalizeLocalePath)(p,g.locales),T.detectedLocale&&(_.locale=T.detectedLocale))}return _}})(He)),He}var vt;function Rt(){return vt||(vt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"NextURL",{enumerable:!0,get:function(){return d}});const e=or(),t=cr(),o=lr(),n=fr(),a=/(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|\[::1\]|localhost)/;function c(g,u){return new URL(String(g).replace(a,"localhost"),u&&String(u).replace(a,"localhost"))}const r=Symbol("NextURLInternal");class d{constructor(u,_,p){let R,T;typeof _=="object"&&"pathname"in _||typeof _=="string"?(R=_,T=p||{}):T=p||_||{},this[r]={url:c(u,R??T.base),options:T,basePath:""},this.analyze()}analyze(){var u,_,p,R,T;const x=(0,n.getNextPathnameInfo)(this[r].url.pathname,{nextConfig:this[r].options.nextConfig,parseData:!process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE,i18nProvider:this[r].options.i18nProvider}),l=(0,o.getHostname)(this[r].url,this[r].options.headers);this[r].domainLocale=this[r].options.i18nProvider?this[r].options.i18nProvider.detectDomainLocale(l):(0,e.detectDomainLocale)((_=this[r].options.nextConfig)==null||(u=_.i18n)==null?void 0:u.domains,l);const b=((p=this[r].domainLocale)==null?void 0:p.defaultLocale)||((T=this[r].options.nextConfig)==null||(R=T.i18n)==null?void 0:R.defaultLocale);this[r].url.pathname=x.pathname,this[r].defaultLocale=b,this[r].basePath=x.basePath??"",this[r].buildId=x.buildId,this[r].locale=x.locale??b,this[r].trailingSlash=x.trailingSlash}formatPathname(){return(0,t.formatNextPathnameInfo)({basePath:this[r].basePath,buildId:this[r].buildId,defaultLocale:this[r].options.forceLocale?void 0:this[r].defaultLocale,locale:this[r].locale,pathname:this[r].url.pathname,trailingSlash:this[r].trailingSlash})}formatSearch(){return this[r].url.search}get buildId(){return this[r].buildId}set buildId(u){this[r].buildId=u}get locale(){return this[r].locale??""}set locale(u){var _,p;if(!this[r].locale||!(!((p=this[r].options.nextConfig)==null||(_=p.i18n)==null)&&_.locales.includes(u)))throw new TypeError(`The NextURL configuration includes no locale "${u}"`);this[r].locale=u}get defaultLocale(){return this[r].defaultLocale}get domainLocale(){return this[r].domainLocale}get searchParams(){return this[r].url.searchParams}get host(){return this[r].url.host}set host(u){this[r].url.host=u}get hostname(){return this[r].url.hostname}set hostname(u){this[r].url.hostname=u}get port(){return this[r].url.port}set port(u){this[r].url.port=u}get protocol(){return this[r].url.protocol}set protocol(u){this[r].url.protocol=u}get href(){const u=this.formatPathname(),_=this.formatSearch();return`${this.protocol}//${this.host}${u}${_}${this.hash}`}set href(u){this[r].url=c(u),this.analyze()}get origin(){return this[r].url.origin}get pathname(){return this[r].url.pathname}set pathname(u){this[r].url.pathname=u}get hash(){return this[r].url.hash}set hash(u){this[r].url.hash=u}get search(){return this[r].url.search}set search(u){this[r].url.search=u}get password(){return this[r].url.password}set password(u){this[r].url.password=u}get username(){return this[r].url.username}set username(u){this[r].url.username=u}get basePath(){return this[r].basePath}set basePath(u){this[r].basePath=u.startsWith("/")?u:`/${u}`}toString(){return this.href}toJSON(){return this.href}[Symbol.for("edge-runtime.inspect.custom")](){return{href:this.href,origin:this.origin,protocol:this.protocol,username:this.username,password:this.password,host:this.host,hostname:this.hostname,port:this.port,pathname:this.pathname,search:this.search,searchParams:this.searchParams,hash:this.hash}}clone(){return new d(String(this),this[r].options)}}})(Ie)),Ie}var Be={},Xe={},Pt;function pr(){return Pt||(Pt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(ve,Re){for(var J in Re)Object.defineProperty(ve,J,{enumerable:!0,get:Re[J]})}e(i,{ACTION_SUFFIX:function(){return d},APP_DIR_ALIAS:function(){return j},CACHE_ONE_YEAR:function(){return E},DOT_NEXT_ALIAS:function(){return P},ESLINT_DEFAULT_DIRS:function(){return ne},GSP_NO_RETURNED_VALUE:function(){return ue},GSSP_COMPONENT_MEMBER_ERROR:function(){return re},GSSP_NO_RETURNED_VALUE:function(){return ce},INSTRUMENTATION_HOOK_FILENAME:function(){return f},MIDDLEWARE_FILENAME:function(){return s},MIDDLEWARE_LOCATION_REGEXP:function(){return v},NEXT_BODY_SUFFIX:function(){return _},NEXT_CACHE_IMPLICIT_TAG_ID:function(){return m},NEXT_CACHE_REVALIDATED_TAGS_HEADER:function(){return T},NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER:function(){return x},NEXT_CACHE_SOFT_TAGS_HEADER:function(){return R},NEXT_CACHE_SOFT_TAG_MAX_LENGTH:function(){return h},NEXT_CACHE_TAGS_HEADER:function(){return p},NEXT_CACHE_TAG_MAX_ITEMS:function(){return l},NEXT_CACHE_TAG_MAX_LENGTH:function(){return b},NEXT_DATA_SUFFIX:function(){return g},NEXT_INTERCEPTION_MARKER_PREFIX:function(){return o},NEXT_META_SUFFIX:function(){return u},NEXT_QUERY_PARAM_PREFIX:function(){return t},NON_STANDARD_NODE_ENV:function(){return le},PAGES_DIR_ALIAS:function(){return w},PRERENDER_REVALIDATE_HEADER:function(){return n},PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER:function(){return a},PUBLIC_DIR_MIDDLEWARE_CONFLICT:function(){return B},ROOT_DIR_ALIAS:function(){return C},RSC_ACTION_CLIENT_WRAPPER_ALIAS:function(){return ee},RSC_ACTION_ENCRYPTION_ALIAS:function(){return Z},RSC_ACTION_PROXY_ALIAS:function(){return q},RSC_ACTION_VALIDATE_ALIAS:function(){return G},RSC_MOD_REF_PROXY_ALIAS:function(){return M},RSC_PREFETCH_SUFFIX:function(){return c},RSC_SUFFIX:function(){return r},SERVER_PROPS_EXPORT_ERROR:function(){return _e},SERVER_PROPS_GET_INIT_PROPS_CONFLICT:function(){return ae},SERVER_PROPS_SSG_CONFLICT:function(){return K},SERVER_RUNTIME:function(){return de},SSG_FALLBACK_EXPORT_ERROR:function(){return be},SSG_GET_INITIAL_PROPS_CONFLICT:function(){return Y},STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR:function(){return te},UNSTABLE_REVALIDATE_RENAME_ERROR:function(){return ge},WEBPACK_LAYERS:function(){return we},WEBPACK_RESOURCE_QUERIES:function(){return Ee}});const t="nxtP",o="nxtI",n="x-prerender-revalidate",a="x-prerender-revalidate-if-generated",c=".prefetch.rsc",r=".rsc",d=".action",g=".json",u=".meta",_=".body",p="x-next-cache-tags",R="x-next-cache-soft-tags",T="x-next-revalidated-tags",x="x-next-revalidate-tag-token",l=128,b=256,h=1024,m="_N_T_",E=31536e3,s="middleware",v=`(?:src/)?${s}`,f="instrumentation",w="private-next-pages",P="private-dot-next",C="private-next-root-dir",j="private-next-app-dir",M="private-next-rsc-mod-ref-proxy",G="private-next-rsc-action-validate",q="private-next-rsc-server-reference",Z="private-next-rsc-action-encryption",ee="private-next-rsc-action-client-wrapper",B="You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict",Y="You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps",ae="You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.",K="You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps",te="can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props",_e="pages with `getServerSideProps` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export",ue="Your `getStaticProps` function did not return an object. Did you forget to add a `return`?",ce="Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?",ge="The `unstable_revalidate` property is available for general use.\nPlease use `revalidate` instead.",re="can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member",le='You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env',be="Pages with `fallback` enabled in `getStaticPaths` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export",ne=["app","pages","components","lib","src"],de={edge:"edge",experimentalEdge:"experimental-edge",nodejs:"nodejs"},k={shared:"shared",reactServerComponents:"rsc",serverSideRendering:"ssr",actionBrowser:"action-browser",api:"api",middleware:"middleware",instrument:"instrument",edgeAsset:"edge-asset",appPagesBrowser:"app-pages-browser",appMetadataRoute:"app-metadata-route",appRouteHandler:"app-route-handler"},we={...k,GROUP:{serverOnly:[k.reactServerComponents,k.actionBrowser,k.appMetadataRoute,k.appRouteHandler,k.instrument],clientOnly:[k.serverSideRendering,k.appPagesBrowser],nonClientServerTarget:[k.middleware,k.api],app:[k.reactServerComponents,k.actionBrowser,k.appMetadataRoute,k.appRouteHandler,k.serverSideRendering,k.appPagesBrowser,k.shared,k.instrument]}},Ee={edgeSSREntry:"__next_edge_ssr_entry__",metadata:"__next_metadata__",metadataRoute:"__next_metadata_route__",metadataImageMeta:"__next_metadata_image_meta__"}})(Xe)),Xe}var yt;function Tt(){return yt||(yt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(d,g){for(var u in g)Object.defineProperty(d,u,{enumerable:!0,get:g[u]})}e(i,{fromNodeOutgoingHttpHeaders:function(){return o},normalizeNextQueryParam:function(){return r},splitCookiesString:function(){return n},toNodeOutgoingHttpHeaders:function(){return a},validateURL:function(){return c}});const t=pr();function o(d){const g=new Headers;for(let[u,_]of Object.entries(d)){const p=Array.isArray(_)?_:[_];for(let R of p)typeof R>"u"||(typeof R=="number"&&(R=R.toString()),g.append(u,R))}return g}function n(d){var g=[],u=0,_,p,R,T,x;function l(){for(;u<d.length&&/\s/.test(d.charAt(u));)u+=1;return u<d.length}function b(){return p=d.charAt(u),p!=="="&&p!==";"&&p!==","}for(;u<d.length;){for(_=u,x=!1;l();)if(p=d.charAt(u),p===","){for(R=u,u+=1,l(),T=u;u<d.length&&b();)u+=1;u<d.length&&d.charAt(u)==="="?(x=!0,u=T,g.push(d.substring(_,R)),_=u):u=R+1}else u+=1;(!x||u>=d.length)&&g.push(d.substring(_,d.length))}return g}function a(d){const g={},u=[];if(d)for(const[_,p]of d.entries())_.toLowerCase()==="set-cookie"?(u.push(...n(p)),g[_]=u.length===1?u[0]:u):g[_]=p;return g}function c(d){try{return String(new URL(String(d)))}catch(g){throw new Error(`URL is malformed "${String(d)}". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`,{cause:g})}}function r(d,g){const u=[t.NEXT_QUERY_PARAM_PREFIX,t.NEXT_INTERCEPTION_MARKER_PREFIX];for(const _ of u)if(d!==_&&d.startsWith(_)){const p=d.substring(_.length);g(p)}}})(Be)),Be}var We={},St;function mr(){return St||(St=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(a,c){for(var r in c)Object.defineProperty(a,r,{enumerable:!0,get:c[r]})}e(i,{PageSignatureError:function(){return t},RemovedPageError:function(){return o},RemovedUAError:function(){return n}});class t extends Error{constructor({page:c}){super(`The middleware "${c}" accepts an async API directly with the form:
2
+
3
+ export function middleware(request, event) {
4
+ return NextResponse.redirect('/new-location')
5
+ }
6
+
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 ")}}})(We)),We}var ze={},Ve,At;function _r(){if(At)return Ve;At=1;var i=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(s,v)=>{for(var f in v)i(s,f,{get:v[f],enumerable:!0})},a=(s,v,f,w)=>{if(v&&typeof v=="object"||typeof v=="function")for(let P of t(v))!o.call(s,P)&&P!==f&&i(s,P,{get:()=>v[P],enumerable:!(w=e(v,P))||w.enumerable});return s},c=s=>a(i({},"__esModule",{value:!0}),s),r={};n(r,{RequestCookies:()=>b,ResponseCookies:()=>h,parseCookie:()=>g,parseSetCookie:()=>u,stringifyCookie:()=>d}),Ve=c(r);function d(s){var v;const f=["path"in s&&s.path&&`Path=${s.path}`,"expires"in s&&(s.expires||s.expires===0)&&`Expires=${(typeof s.expires=="number"?new Date(s.expires):s.expires).toUTCString()}`,"maxAge"in s&&typeof s.maxAge=="number"&&`Max-Age=${s.maxAge}`,"domain"in s&&s.domain&&`Domain=${s.domain}`,"secure"in s&&s.secure&&"Secure","httpOnly"in s&&s.httpOnly&&"HttpOnly","sameSite"in s&&s.sameSite&&`SameSite=${s.sameSite}`,"partitioned"in s&&s.partitioned&&"Partitioned","priority"in s&&s.priority&&`Priority=${s.priority}`].filter(Boolean),w=`${s.name}=${encodeURIComponent((v=s.value)!=null?v:"")}`;return f.length===0?w:`${w}; ${f.join("; ")}`}function g(s){const v=new Map;for(const f of s.split(/; */)){if(!f)continue;const w=f.indexOf("=");if(w===-1){v.set(f,"true");continue}const[P,C]=[f.slice(0,w),f.slice(w+1)];try{v.set(P,decodeURIComponent(C??"true"))}catch{}}return v}function u(s){if(!s)return;const[[v,f],...w]=g(s),{domain:P,expires:C,httponly:j,maxage:M,path:G,samesite:q,secure:Z,partitioned:ee,priority:B}=Object.fromEntries(w.map(([ae,K])=>[ae.toLowerCase(),K])),Y={name:v,value:decodeURIComponent(f),domain:P,...C&&{expires:new Date(C)},...j&&{httpOnly:!0},...typeof M=="string"&&{maxAge:Number(M)},path:G,...q&&{sameSite:R(q)},...Z&&{secure:!0},...B&&{priority:x(B)},...ee&&{partitioned:!0}};return _(Y)}function _(s){const v={};for(const f in s)s[f]&&(v[f]=s[f]);return v}var p=["strict","lax","none"];function R(s){return s=s.toLowerCase(),p.includes(s)?s:void 0}var T=["low","medium","high"];function x(s){return s=s.toLowerCase(),T.includes(s)?s:void 0}function l(s){if(!s)return[];var v=[],f=0,w,P,C,j,M;function G(){for(;f<s.length&&/\s/.test(s.charAt(f));)f+=1;return f<s.length}function q(){return P=s.charAt(f),P!=="="&&P!==";"&&P!==","}for(;f<s.length;){for(w=f,M=!1;G();)if(P=s.charAt(f),P===","){for(C=f,f+=1,G(),j=f;f<s.length&&q();)f+=1;f<s.length&&s.charAt(f)==="="?(M=!0,f=j,v.push(s.substring(w,C)),w=f):f=C+1}else f+=1;(!M||f>=s.length)&&v.push(s.substring(w,s.length))}return v}var b=class{constructor(s){this._parsed=new Map,this._headers=s;const v=s.get("cookie");if(v){const f=g(v);for(const[w,P]of f)this._parsed.set(w,{name:w,value:P})}}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...s){const v=typeof s[0]=="string"?s[0]:s[0].name;return this._parsed.get(v)}getAll(...s){var v;const f=Array.from(this._parsed);if(!s.length)return f.map(([P,C])=>C);const w=typeof s[0]=="string"?s[0]:(v=s[0])==null?void 0:v.name;return f.filter(([P])=>P===w).map(([P,C])=>C)}has(s){return this._parsed.has(s)}set(...s){const[v,f]=s.length===1?[s[0].name,s[0].value]:s,w=this._parsed;return w.set(v,{name:v,value:f}),this._headers.set("cookie",Array.from(w).map(([P,C])=>d(C)).join("; ")),this}delete(s){const v=this._parsed,f=Array.isArray(s)?s.map(w=>v.delete(w)):v.delete(s);return this._headers.set("cookie",Array.from(v).map(([w,P])=>d(P)).join("; ")),f}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(s=>`${s.name}=${encodeURIComponent(s.value)}`).join("; ")}},h=class{constructor(s){this._parsed=new Map;var v,f,w;this._headers=s;const P=(w=(f=(v=s.getSetCookie)==null?void 0:v.call(s))!=null?f:s.get("set-cookie"))!=null?w:[],C=Array.isArray(P)?P:l(P);for(const j of C){const M=u(j);M&&this._parsed.set(M.name,M)}}get(...s){const v=typeof s[0]=="string"?s[0]:s[0].name;return this._parsed.get(v)}getAll(...s){var v;const f=Array.from(this._parsed.values());if(!s.length)return f;const w=typeof s[0]=="string"?s[0]:(v=s[0])==null?void 0:v.name;return f.filter(P=>P.name===w)}has(s){return this._parsed.has(s)}set(...s){const[v,f,w]=s.length===1?[s[0].name,s[0].value,s[0]]:s,P=this._parsed;return P.set(v,E({name:v,value:f,...w})),m(P,this._headers),this}delete(...s){const[v,f,w]=typeof s[0]=="string"?[s[0]]:[s[0].name,s[0].path,s[0].domain];return this.set({name:v,path:f,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(d).join("; ")}};function m(s,v){v.delete("set-cookie");for(const[,f]of s){const w=d(f);v.append("set-cookie",w)}}function E(s={name:"",value:""}){return typeof s.expires=="number"&&(s.expires=new Date(s.expires)),s.maxAge&&(s.expires=new Date(Date.now()+s.maxAge*1e3)),(s.path===null||s.path===void 0)&&(s.path="/"),s}return Ve}var It;function Ye(){return It||(It=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(o,n){for(var a in n)Object.defineProperty(o,a,{enumerable:!0,get:n[a]})}e(i,{RequestCookies:function(){return t.RequestCookies},ResponseCookies:function(){return t.ResponseCookies},stringifyCookie:function(){return t.stringifyCookie}});const t=_r()})(ze)),ze}var Ot;function gr(){return Ot||(Ot=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(d,g){for(var u in g)Object.defineProperty(d,u,{enumerable:!0,get:g[u]})}e(i,{INTERNALS:function(){return c},NextRequest:function(){return r}});const t=Rt(),o=Tt(),n=mr(),a=Ye(),c=Symbol("internal request");class r extends Request{constructor(g,u={}){const _=typeof g!="string"&&"url"in g?g.url:String(g);(0,o.validateURL)(_),g instanceof Request?super(g,u):super(_,u);const p=new t.NextURL(_,{headers:(0,o.toNodeOutgoingHttpHeaders)(this.headers),nextConfig:u.nextConfig});this[c]={cookies:new a.RequestCookies(this.headers),geo:u.geo||{},ip:u.ip,nextUrl:p,url:process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE?_:p.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[c].cookies}get geo(){return this[c].geo}get ip(){return this[c].ip}get nextUrl(){return this[c].nextUrl}get page(){throw new n.RemovedPageError}get ua(){throw new n.RemovedUAError}get url(){return this[c].url}}})(Ae)),Ae}var Ke={},$e={},Nt;function br(){return Nt||(Nt=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,a){const c=Reflect.get(o,n,a);return typeof c=="function"?c.bind(o):c}static set(o,n,a,c){return Reflect.set(o,n,a,c)}static has(o,n){return Reflect.has(o,n)}static deleteProperty(o,n){return Reflect.deleteProperty(o,n)}}})($e)),$e}var xt;function wr(){return xt||(xt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"NextResponse",{enumerable:!0,get:function(){return g}});const e=Ye(),t=Rt(),o=Tt(),n=br(),a=Ye(),c=Symbol("internal response"),r=new Set([301,302,303,307,308]);function d(u,_){var p;if(!(u==null||(p=u.request)==null)&&p.headers){if(!(u.request.headers instanceof Headers))throw new Error("request.headers must be an instance of Headers");const R=[];for(const[T,x]of u.request.headers)_.set("x-middleware-request-"+T,x),R.push(T);_.set("x-middleware-override-headers",R.join(","))}}class g extends Response{constructor(_,p={}){super(_,p);const R=this.headers,T=new a.ResponseCookies(R),x=new Proxy(T,{get(l,b,h){switch(b){case"delete":case"set":return(...m)=>{const E=Reflect.apply(l[b],l,m),s=new Headers(R);return E instanceof a.ResponseCookies&&R.set("x-middleware-set-cookie",E.getAll().map(v=>(0,e.stringifyCookie)(v)).join(",")),d(p,s),E};default:return n.ReflectAdapter.get(l,b,h)}}});this[c]={cookies:x,url:p.url?new t.NextURL(p.url,{headers:(0,o.toNodeOutgoingHttpHeaders)(R),nextConfig:p.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[c].cookies}static json(_,p){const R=Response.json(_,p);return new g(R.body,R)}static redirect(_,p){const R=typeof p=="number"?p:p?.status??307;if(!r.has(R))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');const T=typeof p=="object"?p:{},x=new Headers(T?.headers);return x.set("Location",(0,o.validateURL)(_)),new g(null,{...T,headers:x,status:R})}static rewrite(_,p){const R=new Headers(p?.headers);return R.set("x-middleware-rewrite",(0,o.validateURL)(_)),d(p,R),new g(null,{...p,headers:R})}static next(_){const p=new Headers(_?.headers);return p.set("x-middleware-next","1"),d(_,p),new g(null,{..._,headers:p})}}})(Ke)),Ke}var Je={},Ct;function Er(){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')}})(Je)),Je}var Qe={},Ze={exports:{}},Lt;function vr(){return Lt||(Lt=1,(()=>{var i={226:function(n,a){(function(c,r){var d="1.0.35",g="",u="?",_="function",p="undefined",R="object",T="string",x="major",l="model",b="name",h="type",m="vendor",E="version",s="architecture",v="console",f="mobile",w="tablet",P="smarttv",C="wearable",j="embedded",M=350,G="Amazon",q="Apple",Z="ASUS",ee="BlackBerry",B="Browser",Y="Chrome",ae="Edge",K="Firefox",te="Google",_e="Huawei",ue="LG",ce="Microsoft",ge="Motorola",re="Opera",le="Samsung",be="Sharp",ne="Sony",de="Xiaomi",k="Zebra",we="Facebook",Ee="Chromium OS",ve="Mac OS",Re=function(I,N){var S={};for(var L in I)N[L]&&N[L].length%2===0?S[L]=N[L].concat(I[L]):S[L]=I[L];return S},J=function(I){for(var N={},S=0;S<I.length;S++)N[I[S].toUpperCase()]=I[S];return N},Yt=function(I,N){return typeof I===T?he(N).indexOf(he(I))!==-1:!1},he=function(I){return I.toLowerCase()},Mr=function(I){return typeof I===T?I.replace(/[^\d\.]/g,g).split(".")[0]:r},ot=function(I,N){if(typeof I===T)return I=I.replace(/^\s\s*/,g),typeof N===p?I:I.substring(0,M)},fe=function(I,N){for(var S=0,L,$,X,O,y,W;S<N.length&&!y;){var at=N[S],Jt=N[S+1];for(L=$=0;L<at.length&&!y&&at[L];)if(y=at[L++].exec(I),y)for(X=0;X<Jt.length;X++)W=y[++$],O=Jt[X],typeof O===R&&O.length>0?O.length===2?typeof O[1]==_?this[O[0]]=O[1].call(this,W):this[O[0]]=O[1]:O.length===3?typeof O[1]===_&&!(O[1].exec&&O[1].test)?this[O[0]]=W?O[1].call(this,W,O[2]):r:this[O[0]]=W?W.replace(O[1],O[2]):r:O.length===4&&(this[O[0]]=W?O[3].call(this,W.replace(O[1],O[2])):r):this[O]=W||r;S+=2}},st=function(I,N){for(var S in N)if(typeof N[S]===R&&N[S].length>0){for(var L=0;L<N[S].length;L++)if(Yt(N[S][L],I))return S===u?r:S}else if(Yt(N[S],I))return S===u?r:S;return I},jr={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Kt={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"},$t={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[E,[b,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[E,[b,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[b,E],[/opios[\/ ]+([\w\.]+)/i],[E,[b,re+" Mini"]],[/\bopr\/([\w\.]+)/i],[E,[b,re]],[/(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],[b,E],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[E,[b,"UC"+B]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[E,[b,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[E,[b,"WeChat"]],[/konqueror\/([\w\.]+)/i],[E,[b,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[E,[b,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[E,[b,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[b,/(.+)/,"$1 Secure "+B],E],[/\bfocus\/([\w\.]+)/i],[E,[b,K+" Focus"]],[/\bopt\/([\w\.]+)/i],[E,[b,re+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[E,[b,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[E,[b,"Dolphin"]],[/coast\/([\w\.]+)/i],[E,[b,re+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[E,[b,"MIUI "+B]],[/fxios\/([-\w\.]+)/i],[E,[b,K]],[/\bqihu|(qi?ho?o?|360)browser/i],[[b,"360 "+B]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[b,/(.+)/,"$1 "+B],E],[/(comodo_dragon)\/([\w\.]+)/i],[[b,/_/g," "],E],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[b,E],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[b],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[b,we],E],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[b,E],[/\bgsa\/([\w\.]+) .*safari\//i],[E,[b,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[E,[b,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[E,[b,Y+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[b,Y+" WebView"],E],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[E,[b,"Android "+B]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[b,E],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[E,[b,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[E,b],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[b,[E,st,jr]],[/(webkit|khtml)\/([\w\.]+)/i],[b,E],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[b,"Netscape"],E],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[E,[b,K+" 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],[b,E],[/(cobalt)\/([\w\.]+)/i],[b,[E,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[s,"amd64"]],[/(ia32(?=;))/i],[[s,he]],[/((?:i[346]|x)86)[;\)]/i],[[s,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[s,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[s,"armhf"]],[/windows (ce|mobile); ppc;/i],[[s,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[s,/ower/,g,he]],[/(sun4\w)[;\)]/i],[[s,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[s,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],[l,[m,le],[h,w]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[m,le],[h,f]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[m,q],[h,f]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[m,q],[h,w]],[/(macintosh);/i],[l,[m,q]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[m,be],[h,f]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[m,_e],[h,w]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[m,_e],[h,f]],[/\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],[[l,/_/g," "],[m,de],[h,f]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[m,de],[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],[l,[m,"OPPO"],[h,f]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[m,"Vivo"],[h,f]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[l,[m,"Realme"],[h,f]],[/\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],[l,[m,ge],[h,f]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[m,ge],[h,w]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[m,ue],[h,w]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[m,ue],[h,f]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[m,"Lenovo"],[h,w]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[m,"Nokia"],[h,f]],[/(pixel c)\b/i],[l,[m,te],[h,w]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[m,te],[h,f]],[/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],[l,[m,ne],[h,f]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[m,ne],[h,w]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[m,"OnePlus"],[h,f]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[m,G],[h,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[m,G],[h,f]],[/(playbook);[-\w\),; ]+(rim)/i],[l,m,[h,w]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[m,ee],[h,f]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[m,Z],[h,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[m,Z],[h,f]],[/(nexus 9)/i],[l,[m,"HTC"],[h,w]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[m,[l,/_/g," "],[h,f]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[m,"Acer"],[h,w]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[m,"Meizu"],[h,f]],[/(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],[m,l,[h,f]],[/(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],[m,l,[h,w]],[/(surface duo)/i],[l,[m,ce],[h,w]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[m,"Fairphone"],[h,f]],[/(u304aa)/i],[l,[m,"AT&T"],[h,f]],[/\bsie-(\w*)/i],[l,[m,"Siemens"],[h,f]],[/\b(rct\w+) b/i],[l,[m,"RCA"],[h,w]],[/\b(venue[\d ]{2,7}) b/i],[l,[m,"Dell"],[h,w]],[/\b(q(?:mv|ta)\w+) b/i],[l,[m,"Verizon"],[h,w]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[m,"Barnes & Noble"],[h,w]],[/\b(tm\d{3}\w+) b/i],[l,[m,"NuVision"],[h,w]],[/\b(k88) b/i],[l,[m,"ZTE"],[h,w]],[/\b(nx\d{3}j) b/i],[l,[m,"ZTE"],[h,f]],[/\b(gen\d{3}) b.+49h/i],[l,[m,"Swiss"],[h,f]],[/\b(zur\d{3}) b/i],[l,[m,"Swiss"],[h,w]],[/\b((zeki)?tb.*\b) b/i],[l,[m,"Zeki"],[h,w]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[m,"Dragon Touch"],l,[h,w]],[/\b(ns-?\w{0,9}) b/i],[l,[m,"Insignia"],[h,w]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[m,"NextBook"],[h,w]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[m,"Voice"],l,[h,f]],[/\b(lvtel\-)?(v1[12]) b/i],[[m,"LvTel"],l,[h,f]],[/\b(ph-1) /i],[l,[m,"Essential"],[h,f]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[m,"Envizen"],[h,w]],[/\b(trio[-\w\. ]+) b/i],[l,[m,"MachSpeed"],[h,w]],[/\btu_(1491) b/i],[l,[m,"Rotor"],[h,w]],[/(shield[\w ]+) b/i],[l,[m,"Nvidia"],[h,w]],[/(sprint) (\w+)/i],[m,l,[h,f]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[m,ce],[h,f]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[m,k],[h,w]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[m,k],[h,f]],[/smart-tv.+(samsung)/i],[m,[h,P]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[m,le],[h,P]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[m,ue],[h,P]],[/(apple) ?tv/i],[m,[l,q+" TV"],[h,P]],[/crkey/i],[[l,Y+"cast"],[m,te],[h,P]],[/droid.+aft(\w)( bui|\))/i],[l,[m,G],[h,P]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[m,be],[h,P]],[/(bravia[\w ]+)( bui|\))/i],[l,[m,ne],[h,P]],[/(mitv-\w{5}) bui/i],[l,[m,de],[h,P]],[/Hbbtv.*(technisat) (.*);/i],[m,l,[h,P]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[m,ot],[l,ot],[h,P]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[h,P]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[m,l,[h,v]],[/droid.+; (shield) bui/i],[l,[m,"Nvidia"],[h,v]],[/(playstation [345portablevi]+)/i],[l,[m,ne],[h,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[m,ce],[h,v]],[/((pebble))app/i],[m,l,[h,C]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[m,q],[h,C]],[/droid.+; (glass) \d/i],[l,[m,te],[h,C]],[/droid.+; (wt63?0{2,3})\)/i],[l,[m,k],[h,C]],[/(quest( 2| pro)?)/i],[l,[m,we],[h,C]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[m,[h,j]],[/(aeobc)\b/i],[l,[m,G],[h,j]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[l,[h,f]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[h,w]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[h,w]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[h,f]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[m,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[E,[b,ae+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[E,[b,"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],[b,E],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[E,b]],os:[[/microsoft (windows) (vista|xp)/i],[b,E],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[b,[E,st,Kt]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[b,"Windows"],[E,st,Kt]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[E,/_/g,"."],[b,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[b,ve],[E,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[E,b],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[b,E],[/\(bb(10);/i],[E,[b,ee]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[E,[b,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[E,[b,K+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[E,[b,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[E,[b,"watchOS"]],[/crkey\/([\d\.]+)/i],[E,[b,Y+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[b,Ee],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],[b,E],[/(sunos) ?([\w\.\d]*)/i],[[b,"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],[b,E]]},H=function(I,N){if(typeof I===R&&(N=I,I=r),!(this instanceof H))return new H(I,N).getResult();var S=typeof c!==p&&c.navigator?c.navigator:r,L=I||(S&&S.userAgent?S.userAgent:g),$=S&&S.userAgentData?S.userAgentData:r,X=N?Re($t,N):$t,O=S&&S.userAgent==L;return this.getBrowser=function(){var y={};return y[b]=r,y[E]=r,fe.call(y,L,X.browser),y[x]=Mr(y[E]),O&&S&&S.brave&&typeof S.brave.isBrave==_&&(y[b]="Brave"),y},this.getCPU=function(){var y={};return y[s]=r,fe.call(y,L,X.cpu),y},this.getDevice=function(){var y={};return y[m]=r,y[l]=r,y[h]=r,fe.call(y,L,X.device),O&&!y[h]&&$&&$.mobile&&(y[h]=f),O&&y[l]=="Macintosh"&&S&&typeof S.standalone!==p&&S.maxTouchPoints&&S.maxTouchPoints>2&&(y[l]="iPad",y[h]=w),y},this.getEngine=function(){var y={};return y[b]=r,y[E]=r,fe.call(y,L,X.engine),y},this.getOS=function(){var y={};return y[b]=r,y[E]=r,fe.call(y,L,X.os),O&&!y[b]&&$&&$.platform!="Unknown"&&(y[b]=$.platform.replace(/chrome os/i,Ee).replace(/macos/i,ve)),y},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(y){return L=typeof y===T&&y.length>M?ot(y,M):y,this},this.setUA(L),this};H.VERSION=d,H.BROWSER=J([b,E,x]),H.CPU=J([s]),H.DEVICE=J([l,m,h,v,f,P,w,C,j]),H.ENGINE=H.OS=J([b,E]),typeof a!==p?(n.exports&&(a=n.exports=H),a.UAParser=H):typeof c!==p&&(c.UAParser=H);var ie=typeof c!==p&&(c.jQuery||c.Zepto);if(ie&&!ie.ua){var Pe=new H;ie.ua=Pe.getResult(),ie.ua.get=function(){return Pe.getUA()},ie.ua.set=function(I){Pe.setUA(I);var N=Pe.getResult();for(var S in N)ie.ua[S]=N[S]}}})(typeof window=="object"?window:this)}},e={};function t(n){var a=e[n];if(a!==void 0)return a.exports;var c=e[n]={exports:{}},r=!0;try{i[n].call(c.exports,c,c.exports,t),r=!1}finally{r&&delete e[n]}return c.exports}typeof t<"u"&&(t.ab=__dirname+"/");var o=t(226);Ze.exports=o})()),Ze.exports}var kt;function Ut(){return kt||(kt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(r,d){for(var g in d)Object.defineProperty(r,g,{enumerable:!0,get:d[g]})}e(i,{isBot:function(){return n},userAgent:function(){return c},userAgentFromString:function(){return a}});const t=o(vr());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 a(r){return{...(0,t.default)(r),isBot:r===void 0?!1:n(r)}}function c({headers:r}){return a(r.get("user-agent")||void 0)}})(Qe)),Qe}var et={},Dt;function Rr(){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})(et)),et}var Mt;function Pr(){return Mt||(Mt=1,(function(i,e){const t={NextRequest:gr().NextRequest,NextResponse:wr().NextResponse,ImageResponse:Er().ImageResponse,userAgentFromString:Ut().userAgentFromString,userAgent:Ut().userAgent,URLPattern:Rr().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})(me,me.exports)),me.exports}var yr=Pr();class Tr{async parseRequest(e){const t=new URL(e.url);let o,n;if(e.method!=="GET"){const r=e.headers.get(z)||"";if(r.includes(F.applicationJson))try{o=await e.json()}catch{U.warn("request body is null!")}else if(r.includes(F.multipartFormData))n=await e.formData();else if(r.includes(F.applicationXwwwFormUrlencoded)){const d=await e.text();o=pe(d)}}const a=e.headers,c={};return e.cookies.getAll().forEach(r=>{c[r.name]=r.value}),{url:t,headers:a,body:o,formData:n,cookies:c,raw:e,clone(){return e.clone()}}}createResponse(e){const t=yr.NextResponse.json(e.body,{status:e.status,headers:e.headers});return 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)}),t}setCookie(e,t,o,n){e.cookies[t]={value:o,options:n}}}var tt=(i=>(i[i.login=0]="login",i[i.logout=1]="logout",i))(tt||{});const rt={login:"login",logout:"logout",unknown:""},z="Content-Type",F={applicationJson:"application/json",multipartFormData:"multipart/form-data",applicationXwwwFormUrlencoded:"application/x-www-form-urlencoded"};class Sr{config;http;cookies;adapter;constructor({config:e,adapter:t,storage:o,cookies:n}){this.config=e;const a=Bt(o);this.http=new Vt({...a,userType:ye.TYPE_C}),this.cookies=n,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){console.error("Router error:",t);const o={};o[z]=F.applicationJson;const n={status:500,headers:o,cookies:{},body:{code:500,success:!1,msg:"Internal server error"}};return this.adapter.createResponse(n)}}async processRequest(e){const t=e.url.searchParams,o=t.get("m")??"unknown",a={...rt,...this.config.APIMAP}[o];if(!a||a.length===0)return this.createErrorResponse(404,"API not found");let c;if((a.startsWith("admin/")||a.startsWith("api/"))&&(c=Xt(this.cookies),!c||c.username.length===0||c.token.length===0))return this.createErrorResponse(409,"Authentication required");let r;const d=e.clone(),g=d.method,u=e.headers.get(z)||"";try{if(g==="GET"){const p=pe(t.toString(),["m"]);r=await this.http.get({url:a,data:p,token:c})}else if(g==="POST"){let p;if(u.includes(F.applicationJson)||u.includes(F.applicationXwwwFormUrlencoded))p=e.body;else if(u.includes(F.multipartFormData)){const R=u.match(/boundary=([^\s;]+)/);if(!R)return this.createErrorResponse(411,"Missing boundary in form data");const T=await d.arrayBuffer();p={boundary:R[1],buffer:Buffer.from(T)};const l=e.formData;if(l)for(const[b,h]of Object.entries(l))b!=="file"&&(p[b]=h)}else return this.createErrorResponse(410,"Unsupported content type");r=await this.http.post({url:a,data:p,token:c})}else return this.createErrorResponse(405,"Method not allowed, only supported GET or POST")}catch(p){return U.error({"error:":p},"API request error"),this.createErrorResponse(500,"API request failed")}const _={status:r.success?200:r.code,headers:{CONTENT_TYPE_KEY:u},cookies:{},body:r};if(r.success)switch(a){case rt[tt[0]]:const p=r.data;Wt(p,this.cookies);break;case rt[tt[1]]:zt(this.cookies);break}return _}createErrorResponse(e,t){return{status:e,headers:{"content-type":"application/json"},cookies:{},body:{code:e,success:!1,msg:t}}}}const Ar="zh-CN",jt="_device_id_key",qt="_current_website_key",Ht="Get request error!",nt="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"},V={DEVICE_ID:"Device-Id",LANG:"Lang",WEBSITE_ID:"Website-Id",WEBSITE_NO:"Website-No"},Ft=i=>{if(!i.get)throw new Error("The get method of IStorage has not been implemented.");const e=i.get(jt)??"",t=i.get(qt),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},Ir=({deviceId:i,website:e},t)=>{if(!t.set)throw new Error("The set method of IStorage has not been implemented.");t.set(jt,i),e&&t.set(qt,JSON.stringify(e))},Or=i=>`${process.env.BASE_URL||"/api/services"}?m=${i}`,Gt=async(i,e)=>{let t=Or(i);if(e?.data){const r=new URLSearchParams(e.data);t+=`&${r}`}const o=e&&e.storage&&e.storage.get?Ft(e.storage):{},n=e?.headers;if(n)for(const r in n){const d=n[r];d&&(o[r]=d)}U.info({url:t,headers:o},"GET");const a=await fetch(t,{method:"GET",headers:o,cache:e?.useCache?"force-cache":"default"});if(a.ok){const r=Object.fromEntries(a.headers.entries()),d={...await a.json(),headers:r};return U.debug(d,"GET_RESULT"),d}const c={code:a.status,success:!1,msg:a.statusText};return U.error(c),c},it=async(i,e)=>{const t=e?.data??{},o=e?.headers;let n;const a=e&&e.storage&&e.storage.get?Ft(e.storage):{},c=new Headers(a);if(t instanceof FormData?n=t:(n=JSON.stringify(t),c.set(z,F.applicationJson)),o)for(let g in o){const u=o[g];u&&c.set(g,u)}U.info({url:i,headers:c},"POST");const r=await fetch(i,{method:"POST",headers:c,body:n});if(r.ok){const g=Object.fromEntries(r.headers.entries()),u={...await r.json(),headers:g};return U.debug(u,"POST_RESULT"),u}const d={code:r.status,success:!1,msg:r.statusText};return U.error(d),d},Nr=async(i,e)=>{const t=await Gt(i,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??Ht);return}throw Error(t.msg??Ht)},xr=async(i,e)=>{const t=await it(i,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??nt);return}throw Error(t.msg??nt)},Cr=async(i,e)=>{const t=await it(i,e);return t.success?(e?.showSuccess&&e.showSuccess(t.msg??"SUCCESS"),!0):(e?.showError&&e.showError(t.msg??nt),!1)},Bt=i=>{if(i.get){const e=i.get(V.DEVICE_ID),t=i.get(V.LANG),o=i.get(V.WEBSITE_ID),n=i.get(V.WEBSITE_NO),a={};return e&&e.length>0&&(a.deviceId=e),t&&t.length>0&&(a.lang=t),o&&o.length>0&&(a.websiteId=o),n&&n.length>0&&(a.websiteNo=n),a}throw new Error("The get method of IStorage has not been implemented.")},Lr=(i,e)=>{if(i.set)e.deviceId&&i.set(V.DEVICE_ID,e.deviceId),e.lang&&i.set(V.LANG,e.lang),e.websiteId&&i.set(V.WEBSITE_ID,e.websiteId),e.websiteNo&&i.set(V.WEBSITE_NO,e.websiteNo);else throw new Error("The set method of IStorage has not been implemented.")},kr=i=>{if(i.get){const e=i.get(D.IBOOT_DEVICE_ID),t=i.get(D.IBOOT_LANG),o=i.get(D.IBOOT_WEBSITE_ID),n=i.get(D.IBOOT_WEBSITE_NO),a={};return e&&e.length>0&&(a.deviceId=e),t&&t.length>0&&(a.lang=t),o&&o.length>0&&(a.websiteId=o),n&&n.length>0&&(a.websiteNo=n),a}throw new Error("The get method of ICookies has not been implemented.")},Ur=(i,e)=>{if(i.set)e.deviceId&&i.set(D.IBOOT_DEVICE_ID,e.deviceId),e.lang&&i.set(D.IBOOT_LANG,e.lang),e.websiteId&&i.set(D.IBOOT_WEBSITE_ID,e.websiteId),e.websiteNo&&i.set(D.IBOOT_WEBSITE_NO,e.websiteNo);else throw new Error("The set method of ICookies has not been implemented.")},Dr=i=>{if(i.get){const e=i.get(D.IBOOT_USER);if(e&&e.length>0)return JSON.parse(e)}},Xt=i=>{if(i.get){const e=i.get(D.IBOOT_USER);if(e&&e.length>0){const t=JSON.parse(e),o=t.username,n=t.userType.toString(),a=i.get(D.IBOOT_TOKEN);if(a)return{username:o,utype:n,token:a}}}},Wt=(i,e)=>{const{id:t,name:o,username:n,nickname:a,headImg:c,token:r,lastLoginTime:d,deviceId:g,userType:u,mustChangePwd:_}=i,p={id:t,name:o,username:n,nickname:a||o,headImg:c,lastLoginTime:d,deviceId:g,userType:u,accountType:0,needToReview:!1,socketOnline:!1,mustChangePwd:_};if(!e.set)throw new Error("cookies set function is undefined");e.set(D.IBOOT_TOKEN,r,{path:"/",secure:process.env.APP_ENV==="production",httpOnly:!0,sameSite:"strict"}),e.set(D.IBOOT_USER,JSON.stringify(p))},zt=i=>{if(!i.set)throw new Error("cookies set function is undefined");if(i.set(D.IBOOT_TOKEN,"",{maxAge:-1,httpOnly:!0,path:"/"}),i.set(D.IBOOT_USER,"",{maxAge:-1,httpOnly:!0,path:"/"}),!i.delete)throw new Error("cookies delete function is undefined");i.delete(D.IBOOT_TOKEN),i.delete(D.IBOOT_USER)};class Vt{baseUrl;helloMethod;apiKey;userType;userFrom;deviceId;version="1";lang;websiteId;websiteNo;constructor(e){process.env.APP_ENV==="production"||U.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??ye.TYPE_MGT,this.deviceId=e.deviceId??Se(10),this.lang=e.lang??Ar,this.websiteId=e.websiteId,this.websiteNo=e.websiteNo}encrypt(e){const t=Q.enc.Utf8.parse(this.apiKey);return Q.AES.encrypt(e,t).toString()}decrypt(e){const t=Q.enc.Utf8.parse(this.apiKey);return Q.AES.decrypt(e,t,{mode:Q.mode.ECB}).toString(Q.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(Te(n)){if(n.length===0)continue;for(let a=0;a<n.length;a++){const c=n[a];for(const r in c){const d=c[r]??void 0;if(d){if(typeof d=="object")Te(d)&&d.forEach((g,u)=>{if(g)for(const _ in g){const p=g[_];if(p&&p.toString().length>0){const R=`[${a.toString()}].${r+`[${u.toString()}].${_}`}=${se(p)}`;t.push(o+R)}}});else if(d.toString().length>0){const g=`[${a.toString()}].${r}=${se(d.toString())}`;t.push(o+g)}}}}}else for(const a in n){const c=n[a];if(c!=null&&c!=""&&c.length!=0){const r=`.${a}=${se(c)}`;t.push(o+r)}}continue}else n&&typeof n=="function"&&(n=null);n!=null&&n!=""&&n.length!=0&&t.push(o+"="+se(n))}return t&&t.join("&")}async sign(e){const t="&key="+await this.helloIboot(),o=[];for(const d in e)o.push(d);o.sort((d,g)=>d.toLowerCase().localeCompare(g.toLowerCase()));const n=[];o.forEach(d=>{let g=e[d];typeof g=="object"&&(g=JSON.stringify(g)),n.push(d+"="+g)});const a=n.join("&"),c=Zt.md5((a+t).toLocaleUpperCase()),r={params:a,md5:c};return U.debug(r,"API_SIGN"),c}assemblyParameter(e,t){const o=e??{};return o.timestamp=Date.now()+"",o.echostr=Se(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[z]=F.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),a=await this.sign(n);return o.Sign=a,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[z]=F.applicationXwwwFormUrlencoded;const o={url:e,headers:t};U.debug(o,"HELLO");const n=await fetch(e,{method:"GET",headers:t,credentials:"include",cache:"force-cache"});if(n.ok){const a=await n.json();return U.debug(a.data,"HELLO RESULT"),a.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 a=this.assemblyParameter(t),c=this.convertUrlParameter(a),r=await this.assemblyHeader({urlParams:c,token:o}),d=`${this.getApiUrl(e)}?${c.toString()}`,g={url:d,headers:r};U.info(g,"GET");const u=await fetch(d,{method:"GET",headers:r,credentials:"include",cache:n});if(u.ok){const p=Object.fromEntries(u.headers.entries()),R={...await u.json(),headers:p};return U.debug(R,"GET_RESULT"),R}const _={code:u.status,success:!1,msg:u.statusText};return U.error(_),_}async post({url:e,data:t,token:o,cache:n="default"}){t=t?{...t}:{};const a=t.buffer??void 0,c=t.boundary??void 0;a&&delete t.buffer,c&&delete t.boundary;const r=this.assemblyParameter(t),d=this.convertUrlParameter(r),g=await this.assemblyHeader({urlParams:d,token:o});a&&c&&(g[z]=`multipart/form-data; boundary=${c}`);const u=this.getApiUrl(e),_={url:u,headers:g,params:r};U.info(_,"POST");const p=a?`${u}?${d}`:u,R=await fetch(p,{method:"POST",headers:g,body:a||d.toString(),credentials:"include",cache:n});if(R.ok){const x=Object.fromEntries(R.headers.entries()),l={...await R.json(),headers:x};return U.debug(l,"POST_RESULT"),l}const T={code:R.status,success:!1,msg:R.statusText};return U.error(T),T}async stream({url:e,data:t,token:o}){t=t?{...t}:{};const n=t.buffer??void 0,a=t.boundary??void 0;n&&delete t.buffer,a&&delete t.boundary;const c=this.assemblyParameter(t),r=this.convertUrlParameter(c),d=await this.assemblyHeader({urlParams:r,token:o});n&&a&&(d[z]=`multipart/form-data; boundary=${a}`),d.Connection="keep-alive",d["X-Accel-Buffering"]="no",d["Cache-Control"]="no-cache";const g=this.getApiUrl(e);try{const u=n?`${g}?${r}`:g,_={url:g,headers:d,params:c};U.info(_,"STREAM");const p=await fetch(u,{method:"POST",headers:d,body:n||r.toString(),credentials:"include"});if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);if(!p.body)throw new Error("No response body");const R=Object.fromEntries(p.headers.entries());return new Response(p.body,{headers:R})}catch(u){throw u}}}A.ACCOUNT_TYPE_MAP=er,A.CONTENT_TYPE_KEY=z,A.CONTENT_TYPE_MAP=F,A.HTTPRouter=Sr,A.HttpClient=Vt,A.NextJsAdapter=Tr,A.USER_FORM_MAP=tr,A.USER_SEX_MAP=rr,A.USER_TYPE_MAP=ye,A.cleanToken=zt,A.dateFormat=ir,A.get=Gt,A.getLoginUser=Dr,A.getServerHttpCookies=kr,A.getServerHttpOpts=Bt,A.getToken=Xt,A.iGet=Nr,A.iPost=xr,A.iPostSuccess=Cr,A.isArray=Te,A.logger=U,A.post=it,A.randomString=Se,A.setClientRequestHeader=Ir,A.setServerHttpCookies=Ur,A.setServerHttpHeaders=Lr,A.setToken=Wt,A.urlEncode=se,A.urlParamToJson=pe,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
2
9
  //# sourceMappingURL=iboot-http-client.umd.js.map