UNPKG

@amityco/ts-sdk

Version:

Amity Social Cloud Typescript SDK

1 lines • 1.08 MB
var Amity=function(e){"use strict";var t;e.MembershipAcceptanceTypeEnum=void 0,(t=e.MembershipAcceptanceTypeEnum||(e.MembershipAcceptanceTypeEnum={})).AUTOMATIC="automatic",t.INVITATION="invitation";const n=Object.freeze({FILE:"file",IMAGE:"image",VIDEO:"video"}),r=Object.freeze({"1080P":"1080p","720P":"720p","480P":"480p","360P":"360p",ORIGINAL:"original"}),s=Object.freeze({UPLOADED:"uploaded",TRANSCODING:"transcoding",TRANSCODED:"transcoded",TRANSCODE_FAILED:"transcodeFailed"}),i=Object.freeze({LOW:"low",MEDIUM:"medium",HIGH:"high",ORIGINAL:"original"});var a;e.FileAccessTypeEnum=void 0,(a=e.FileAccessTypeEnum||(e.FileAccessTypeEnum={})).PUBLIC="public",a.NETWORK="network";const o=Object.freeze({ONLY_ADMIN_CAN_POST:"ONLY_ADMIN_CAN_POST",ADMIN_REVIEW_POST_REQUIRED:"ADMIN_REVIEW_POST_REQUIRED",ANYONE_CAN_POST:"ANYONE_CAN_POST"}),l=Object.freeze({ONLY_ADMIN_CAN_POST:{needApprovalOnPostCreation:!1,onlyAdminCanPost:!0},ADMIN_REVIEW_POST_REQUIRED:{needApprovalOnPostCreation:!0,onlyAdminCanPost:!1},ANYONE_CAN_POST:{needApprovalOnPostCreation:!1,onlyAdminCanPost:!1}}),c="ONLY_ADMIN_CAN_POST",d=Object.freeze({STORY:"story",CLIP:"clip",CHAT:"chat",POST:"post",MESSAGE:"message"});var u;e.ContentFlagReasonEnum=void 0,(u=e.ContentFlagReasonEnum||(e.ContentFlagReasonEnum={})).CommunityGuidelines="Against community guidelines",u.HarassmentOrBullying="Harassment or bullying",u.SelfHarmOrSuicide="Self-harm or suicide",u.ViolenceOrThreateningContent="Violence or threatening content",u.SellingRestrictedItems="Selling and promoting restricted items",u.SexualContentOrNudity="Sexual message or nudity",u.SpamOrScams="Spam or scams",u.FalseInformation="False information or misinformation",u.Others="Others";const h=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",AUDIO:"audio",CUSTOM:"custom"}),f=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",LIVESTREAM:"liveStream",POLL:"poll"});var p,g,m,y,v;e.InvitationTypeEnum=void 0,(p=e.InvitationTypeEnum||(e.InvitationTypeEnum={})).CommunityMemberInvite="communityMemberInvite",p.LivestreamInvite="livestreamInvite",e.InvitationStatusEnum=void 0,(g=e.InvitationStatusEnum||(e.InvitationStatusEnum={})).Pending="pending",g.Approved="approved",g.Rejected="rejected",g.Cancelled="cancelled",e.InvitationSortByEnum=void 0,(m=e.InvitationSortByEnum||(e.InvitationSortByEnum={})).FirstCreated="firstCreated",m.LastCreated="lastCreated",e.JoinRequestStatusEnum=void 0,(y=e.JoinRequestStatusEnum||(e.JoinRequestStatusEnum={})).Pending="pending",y.Approved="approved",y.Rejected="rejected",y.Cancelled="cancelled",e.JoinResultStatusEnum=void 0,(v=e.JoinResultStatusEnum||(e.JoinResultStatusEnum={})).Success="success",v.Pending="pending";const b=function(){try{return"v7.6.0-umd"}catch(e){return"__dev__"}}(),w=5,S="cache_then_server",C="For using Live Collection feature you need to enable Cache!",T="Observing unsynced object is not supported by Live Object.",E=-5,I=1e3,k=6e5,A="dead",_=6e4,R=e=>JSON.stringify(e,((e,t)=>{return"object"==typeof t?(n=t,Object.keys(n).sort().reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:n[t]})),{})):t;var n})),O=e=>JSON.parse(e),L=(e,t)=>e===t||!(!e||!t)&&("object"==typeof e&&Object.keys(e).every((n=>L(e[n],t[n])))),D=e=>[400400,400300].includes(e),x="function"==typeof atob,P="function"==typeof btoa,M="function"==typeof Buffer,F="function"==typeof TextDecoder?new TextDecoder:void 0,U="function"==typeof TextEncoder?new TextEncoder:void 0,N=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),B=(e=>{let t={};return e.forEach(((e,n)=>t[e]=n)),t})(N),j=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,q=String.fromCharCode.bind(String),$="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),K=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),G=P?e=>btoa(e):M?e=>Buffer.from(e,"binary").toString("base64"):e=>{let t,n,r,s,i="";const a=e.length%3;for(let a=0;a<e.length;){if((n=e.charCodeAt(a++))>255||(r=e.charCodeAt(a++))>255||(s=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|s,i+=N[t>>18&63]+N[t>>12&63]+N[t>>6&63]+N[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},H=M?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(q.apply(null,e.subarray(n,n+4096)));return G(t.join(""))},V=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?q(192|t>>>6)+q(128|63&t):q(224|t>>>12&15)+q(128|t>>>6&63)+q(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return q(240|t>>>18&7)+q(128|t>>>12&63)+q(128|t>>>6&63)+q(128|63&t)},z=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,W=M?e=>Buffer.from(e,"utf8").toString("base64"):U?e=>H(U.encode(e)):e=>G(e.replace(z,V)),Y=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Q=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return q(55296+(t>>>10))+q(56320+(1023&t));case 3:return q((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return q((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},J=x?e=>atob(K(e)):M?e=>Buffer.from(e,"base64").toString("binary"):e=>{if(e=e.replace(/\s+/g,""),!j.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,n,r,s="";for(let i=0;i<e.length;)t=B[e.charAt(i++)]<<18|B[e.charAt(i++)]<<12|(n=B[e.charAt(i++)])<<6|(r=B[e.charAt(i++)]),s+=64===n?q(t>>16&255):64===r?q(t>>16&255,t>>8&255):q(t>>16&255,t>>8&255,255&t);return s},X=M?e=>$(Buffer.from(e,"base64")):e=>$(J(e),(e=>e.charCodeAt(0))),Z=M?e=>Buffer.from(e,"base64").toString("utf8"):F?e=>F.decode(X(e)):e=>J(e).replace(Y,Q),ee=e=>Z(K(e.replace(/[-_]/g,(e=>"-"==e?"+":"/")))),te=e=>["skip"].some((t=>t in e)),ne=e=>["after","before","first","last","limit"].some((t=>t in e)),re=e=>"limit"in e,se=e=>(null==e?void 0:e.hasOwnProperty("data"))&&(null==e?void 0:e.hasOwnProperty("nextPage"))&&(null==e?void 0:e.hasOwnProperty("prevPage")),ie=(e,t)=>{var n;if(!e||!Object.keys(e).length)return;let r={};return"skiplimit"===t?r={skip:null!==(n=e.after)&&void 0!==n?n:0,limit:e.limit}:"afterbefore"===t&&ne(e)?((null==e?void 0:e.before)&&(r=Object.assign(Object.assign({},r),{before:e.before})),(null==e?void 0:e.after)&&(r=Object.assign(Object.assign({},r),{after:e.after})),Number.isNaN(Number(null==e?void 0:e.limit))||(r=Object.assign(Object.assign({},r),{limit:e.limit}))):"afterbeforeraw"===t&&(r=e),Object.keys(r).length?((e,t=!1)=>t?(e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_")))(W(e)):W(e))(JSON.stringify(r)):void 0},ae=e=>{if(!e)return;const t=JSON.parse(ee(e));if(te(t))return{after:t.skip,limit:t.limit};if(ne(t)){if("before"in t)return{before:t.before,limit:t.last};if("after"in t)return{after:t.after,limit:t.first}}},oe=e=>"locally"in e,le=e=>"optimistically"in e,ce=e=>oe(e)||le(e),de=e=>null==e?void 0:e.hasOwnProperty("cachedAt"),ue=(e,t=6e4)=>{var n;return Date.now()-(null!==(n=null==e?void 0:e.cachedAt)&&void 0!==n?n:0)<=t},he=(e,...t)=>({func:e,args:t}),fe=(e,t=6e4)=>"cache_only"===e?{lifeSpan:1/0}:{lifeSpan:t<_?_:t},pe=({func:e,args:t},n,r=fe("cache_then_server"))=>{let s;const{lifeSpan:i}=fe("cache_then_server",r.lifeSpan);if(ce(e)){try{s=le(e)?e.optimistically(...t):e.locally(...t)}catch(e){null==n||n(ge(void 0,{origin:"local",loading:!1,error:e}))}const r=de(s)&&ue(s,i);if(null==n||n(ge(s,{origin:"local",loading:!(oe(e)&&r)})),r)return}else null==n||n(ge(void 0,{origin:"local",loading:!0}));e(...t).then((e=>{null==n||n(ge(e,{origin:"server",loading:!1}))})).catch((e=>{null==n||n(ge(void 0,{origin:"server",loading:!1,error:e}))}))};function ge(e,t){return se(e)||de(e)?Object.assign(Object.assign({},t),e):Object.assign(Object.assign({},t),{data:e})}const me={user:({userId:e})=>e,file:({fileId:e})=>e,role:({roleId:e})=>e,channel:({channelInternalId:e})=>e,subChannel:({subChannelId:e})=>e,channelUsers:({channelId:e,userId:t})=>`${e}#${t}`,message:({messageId:e,referenceId:t})=>null!=t?t:e,messagePreviewChannel:({channelId:e})=>`${e}`,messagePreviewSubChannel:({subChannelId:e})=>`${e}`,channelUnreadInfo:({channelId:e})=>e,subChannelUnreadInfo:({subChannelId:e})=>e,channelUnread:({channelId:e})=>e,channelMarker:({entityId:e,userId:t})=>`${e}#${t}`,subChannelMarker:({entityId:e,feedId:t,userId:n})=>`${e}#${t}#${n}`,messageMarker:({feedId:e,contentId:t,creatorId:n})=>`${e}#${t}#${n}`,feedMarker:({feedId:e,entityId:t})=>`${e}#${t}`,userMarker:({userId:e})=>e,community:({communityId:e})=>e,category:({categoryId:e})=>e,communityUsers:({communityId:e,userId:t})=>`${e}#${t}`,post:({postId:e})=>e,comment:({commentId:e})=>e,commentChildren:({commentId:e})=>e,poll:({pollId:e})=>e,reaction:({referenceType:e,referenceId:t})=>`${e}#${t}`,reactor:({reactionId:e})=>e,stream:({streamId:e})=>e,streamModeration:({streamId:e})=>e,follow:({from:e,to:t})=>`${e}#${t}`,followInfo:({userId:e})=>e,followCount:({userId:e})=>e,feed:({targetId:e,feedId:t})=>`${e}#${t}`,story:({referenceId:e})=>e,storyTarget:({targetId:e})=>e,ad:({adId:e})=>e,advertiser:({advertiserId:e})=>e,pin:({placement:e,referenceId:t})=>`${e}#${t}`,pinTarget:({targetId:e})=>e,notificationTrayItem:({_id:e})=>e,notificationTraySeen:({userId:e})=>e,invitation:({_id:e})=>e,joinRequest:({joinRequestId:e})=>e},ye=e=>me[e],ve={users:"user",files:"file",roles:"role",stories:"story",storyTargets:"storyTarget",channels:"channel",messageFeeds:"subChannel",channelUsers:"channelUsers",messages:"message",messagePreviewChannel:"messagePreviewChannel",messagePreviewSubChannel:"messagePreviewSubChannel",channelUnreadInfo:"channelUnreadInfo",subChannelUnreadInfo:"subChannelUnreadInfo",userEntityMarkers:"channelMarker",userFeedMarkers:"subChannelMarker",contentMarkers:"messageMarker",feedMarkers:"feedMarker",userMarkers:"userMarker",communities:"community",categories:"category",communityUsers:"communityUsers",posts:"post",postChildren:"post",comments:"comment",commentChildren:"comment",polls:"poll",reactors:"reactor",reactions:"reaction",videoStreamings:"stream",videoStreamModerations:"streamModeration",follows:"follow",followCounts:"followCount",feeds:"feed",ads:"ad",advertisers:"advertiser",pinTargets:"pinTarget",pins:"pin",notificationTrayItems:"notificationTrayItem",invitations:"invitation",joinRequests:"joinRequest"};function be(e=(new Date).toISOString()){return new Date(new Date(e).getTime()+1).toISOString()}class we extends Error{constructor(e,t,n){super(`Amity SDK (${t}): ${e}`),this.code=t,this.level=n,this.type="ASC",this.timestamp=Date.now(),Error.captureStackTrace&&Error.captureStackTrace(this,we)}}class Se extends we{constructor(e,t,n){super(e,t,n)}}class Ce extends we{constructor(e=8e5,t="fatal"){super("Unexpected error",e,t)}}class Te extends we{constructor(e,t="SDK client is having connection issues"){super(`${t} (${e})`,"disconnected"===e?800211:800210,"error"),this.event=e}}let Ee=null;const Ie=()=>{if(!Ee)throw new we("There is no active client",8e5,"fatal");return Ee},ke=e=>{Ee=e},Ae=e=>{const{log:t,cache:n}=Ie();if(n)return t("cache/api/queryCache",{key:e}),Object.keys(n.data).filter((t=>{const n=O(t);return L(e,n)})).map((e=>n.data[e]))},_e=e=>{const{log:t,cache:n}=Ie();if(!n)return;t("cache/api/pullFromCache",e);const r=R(e);return n.data[r]?n.data[r]:void 0},Re=(e,t,n={cachedAt:Date.now()})=>{const{log:r,cache:s}=Ie();if(!s)return!1;r("cache/api/pushToCache",{key:e,data:t,options:n}),!(null==n?void 0:n.hasOwnProperty("offline"))&&s.persistIf&&(n.offline=s.persistIf(e,t));const i=R(e);return s.data[i]=Object.assign({key:e,data:t},n),!0},Oe=(e,t,n)=>{const{log:r,cache:s}=Ie();if(!s)return!1;r("cache/api/mergeInCache",{key:e,mutation:t});const i=_e(e);if(!i)return!1;const a="function"==typeof t?t(i.data):Object.assign(Object.assign({},i.data),t);return o=i.data,!("updatedAt"in(l=a)&&"updatedAt"in l&&new Date(l.updatedAt)<new Date(o.updatedAt))&&(Re(e,a,n),!0);var o,l},Le=(e,t,n={cachedAt:Date.now()})=>{const{log:r,cache:s}=Ie();if(!s)return!1;r("cache/api/upsertInCache",{key:e,data:t,options:n});return _e(e)?Oe(e,t,n):Re(e,t,n)},De=(e,t=!1)=>{const{log:n,cache:r}=Ie();if(!r)return!1;if(n("cache/api/dropFromCache",{key:e,exact:t}),!t)return Object.keys(r.data).map((e=>O(e))).filter((t=>L(e,t))).map((e=>De(e,!0))).every((e=>e));const s=R(e);return s in r.data&&(delete r.data[s],!0)},xe=(e,t,n)=>void 0!==n?e.filter((e=>JSON.stringify(e[t])===JSON.stringify(n))):e,Pe=(e,t,n)=>void 0!==n?e.filter((e=>"string"==typeof e[t]&&"string"==typeof n&&String(e[t]).toLowerCase().match(n.toLowerCase()))):e,Me=(e,t,n)=>(null==n?void 0:n.length)?e.filter((e=>Array.isArray(e[t])&&n.some((n=>e[t].includes(n))))):e,Fe=(e,t,n)=>"all"===t?e:e.filter((e=>{var r;if("community"===e.type)return!0;const s=ye("channelUsers")({channelId:e.channelPublicId,userId:n}),i=null===(r=_e(["channelUsers","get",s]))||void 0===r?void 0:r.data;return"member"===t?i&&"none"!==i.membership:!i||"none"===i.membership})),Ue=(e,t)=>e.filter((({targetId:e,feedId:n})=>{var r;const s=null===(r=_e(["feed","get",ye("feed")({targetId:e,feedId:n})]))||void 0===r?void 0:r.data;return s&&s.feedType===t})),Ne=(e,t,n)=>"all"===t?e:e.filter((e=>{var r;const s=ye("communityUsers")({communityId:e.communityId,userId:n}),i=null===(r=_e(["communityUsers","get",s]))||void 0===r?void 0:r.data;return"member"===t?i&&"member"===i.communityMembership:!i||"none"!==i.communityMembership})),Be=(e,t)=>e.reduce(((e,n)=>{var r;if(null==t?void 0:t.includes(n.dataType))return[...e,n];if(((null==n?void 0:n.children)||[]).length>0){const s=null===(r=_e(["post","get",n.children[0]]))||void 0===r?void 0:r.data;return(null==t?void 0:t.includes(null==s?void 0:s.dataType))?e:[...e,n]}return e}),[]),je=(e,t)=>{const n=new RegExp(t,"i");return e.filter((e=>{var t;return!!e.userId.match(n)||e.user&&(null===(t=e.user.displayName)||void 0===t?void 0:t.match(n))}))},qe=({displayName:e},{displayName:t})=>e&&t?e.localeCompare(t):e?-1:1,$e=({name:e},{name:t})=>e&&t?e.localeCompare(t):e?-1:1,Ke=({createdAt:e},{createdAt:t})=>new Date(e).valueOf()-new Date(t).valueOf(),Ge=({localSortingDate:e},{localSortingDate:t})=>new Date(t).getTime()-new Date(e).getTime(),He=({createdAt:e},{createdAt:t})=>new Date(t).valueOf()-new Date(e).valueOf(),Ve=({updatedAt:e=0},{updatedAt:t=0})=>new Date(e).valueOf()-new Date(t).valueOf(),ze=({updatedAt:e=0},{updatedAt:t=0})=>new Date(t).valueOf()-new Date(e).valueOf(),We=({lastActivity:e},{lastActivity:t})=>new Date(t).valueOf()-new Date(e).valueOf();let Ye=null;const Qe=()=>{if(!Ye)throw new we("Connect client first",8e5,"fatal");return Ye},Je=e=>{Ye={_id:e._id,userId:e.userId,path:e.path}};let Xe,Ze=[];const et=e=>{clearTimeout(Xe),Ze.push(e),Xe=setTimeout((()=>{Ze.forEach((e=>e())),Ze=[]}),0)},tt=["disconnected","error","connect_error","reconnect_error","reconnect_failed","sessionStateChange","tokenExpired"],nt=["connect","message","disconnect","error","close","end","reconnect","video-streaming.didStart","video-streaming.didRecord","video-streaming.didStop","video-streaming.didFlag","video-streaming.didTerminate"],rt=()=>function(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map((function(e){e(n)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,n)}))}}}(),st=(e,t)=>{tt.forEach((n=>{null==e||e.on(n,(e=>{t.emit(n,e)}))}))},it=(e,t,n,r)=>{const{log:s,emitter:i}=e,a=Date.now();s(`${t}(tmpid: ${a}) > listen`);const o=(...e)=>{s(`${t}(tmpid: ${a}) > trigger`,e);try{r(...e)}catch(e){s(`${t}(tmpid: ${a}) > error`,e)}};return i.on(n,o),()=>{s(`${t}(tmpid: ${a}) > dispose`),i.off(n,o)}},at=(e,t)=>{const{emitter:n}=Ie();et((()=>{n.emit(e,t)}))};let ot,lt;async function ct(){var e;const{mqtt:t,emitter:n,token:r}=Ie();if(!t)return;const s=null!==(e=null==r?void 0:r.accessToken)&&void 0!==e?e:"",i=Qe();ot===s&&lt===i._id||(ot=s,lt=i._id,await t.connect({accessToken:ot,userId:lt}),((e,t)=>{nt.forEach((n=>{null==e||e.on(n,((...e)=>{t.emit(n,1===e.length?e[0]:e)}))})),e.on("message",((e,n)=>{const r=JSON.parse(n.toString());t.emit(r.eventType,r.data)}))})(t,n))}var dt;e.SubscriptionLevels=void 0,(dt=e.SubscriptionLevels||(e.SubscriptionLevels={})).COMMUNITY="community",dt.POST="post",dt.COMMENT="comment",dt.POST_AND_COMMENT="post_and_comment",dt.USER="user";const ut=(e,t)=>{switch(t){case"post":return`${e}/post/+`;case"comment":return`${e}/post/+/comment/+`;case"post_and_comment":return`${e}/post/#`;default:return e}},ht=e=>e.path.split("/user/")[0],ft=({path:t},n=e.SubscriptionLevels.USER)=>ut(n===e.SubscriptionLevels.USER?t:t.replace(/^(\w*)/,"$1/social"),n),pt=({channelId:e,subChannelId:t})=>{const n=Qe();return`${ht(n)}/marker/channel/${e}/message/${t}`},gt=()=>{const e=Qe();return`${ht(e)}/marker/user/${e._id}`},mt=()=>ht(Qe()),yt=()=>{const e=Qe();return`${ht(e)}/smartfeed/${e._id}/channels`},vt=()=>{const e=Qe();return`${ht(e)}/smartfeed/${e._id}/messagefeeds`},bt=()=>{const e=Qe();return`${ht(e)}/smartfeed/${e._id}/messages`};function wt(e,t){const{mqtt:n}=Ie();return n?(ct(),n.subscribe(e,t)):()=>null}const St=()=>{const e=Qe();return`${ht(e)}/videostreaming`};var Ct="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Tt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Et(e){var t=e.default;if("function"==typeof t){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var It,kt,At={exports:{}};function _t(){if(kt)return It;kt=1;var e=1e3,t=60*e,n=60*t,r=24*n,s=7*r,i=365.25*r;function a(e,t,n,r){var s=t>=1.5*n;return Math.round(e/n)+" "+r+(s?"s":"")}return It=function(o,l){l=l||{};var c=typeof o;if("string"===c&&o.length>0)return function(a){if((a=String(a)).length>100)return;var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(!o)return;var l=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*i;case"weeks":case"week":case"w":return l*s;case"days":case"day":case"d":return l*r;case"hours":case"hour":case"hrs":case"hr":case"h":return l*n;case"minutes":case"minute":case"mins":case"min":case"m":return l*t;case"seconds":case"second":case"secs":case"sec":case"s":return l*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}(o);if("number"===c&&isFinite(o))return l.long?function(s){var i=Math.abs(s);if(i>=r)return a(s,i,r,"day");if(i>=n)return a(s,i,n,"hour");if(i>=t)return a(s,i,t,"minute");if(i>=e)return a(s,i,e,"second");return s+" ms"}(o):function(s){var i=Math.abs(s);if(i>=r)return Math.round(s/r)+"d";if(i>=n)return Math.round(s/n)+"h";if(i>=t)return Math.round(s/t)+"m";if(i>=e)return Math.round(s/e)+"s";return s+"ms"}(o);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(o))},It}var Rt=function(e){function t(e){let r,s,i,a=null;function o(...e){if(!o.enabled)return;const n=o,s=Number(new Date),i=s-(r||s);n.diff=i,n.prev=r,n.curr=s,r=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,s)=>{if("%%"===r)return"%";a++;const i=t.formatters[s];if("function"==typeof i){const t=e[a];r=i.call(n,t),e.splice(a,1),a--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=n,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(s!==t.namespaces&&(s=t.namespaces,i=t.enabled(e)),i),set:e=>{a=e}}),"function"==typeof t.init&&t.init(o),o}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(n=0;n<s;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=_t(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t};!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))})),t.splice(s,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Rt(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(At,At.exports);var Ot,Lt=At.exports;const Dt="object"==typeof globalThis?globalThis:"object"==typeof global?global:window,{process:xt={}}=Dt,Pt="production"===(null===(Ot=xt.env)||void 0===Ot?void 0:Ot.NODE_ENV),Mt={EU:"eu",SG:"sg",US:"us"},Ft={http:"https://apix.{region}.amity.co",upload:"https://upload.{region}.amity.co",mqtt:"wss://sse.{region}.amity.co:443/mqtt"};function Ut(e,t){return Ft[e].replace("{region}",t)}function Nt(e,t){return function(){return e.apply(t,arguments)}}const{toString:Bt}=Object.prototype,{getPrototypeOf:jt}=Object,qt=($t=Object.create(null),e=>{const t=Bt.call(e);return $t[t]||($t[t]=t.slice(8,-1).toLowerCase())});var $t;const Kt=e=>(e=e.toLowerCase(),t=>qt(t)===e),Gt=e=>t=>typeof t===e,{isArray:Ht}=Array,Vt=Gt("undefined");const zt=Kt("ArrayBuffer");const Wt=Gt("string"),Yt=Gt("function"),Qt=Gt("number"),Jt=e=>null!==e&&"object"==typeof e,Xt=e=>{if("object"!==qt(e))return!1;const t=jt(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Zt=Kt("Date"),en=Kt("File"),tn=Kt("Blob"),nn=Kt("FileList"),rn=Kt("URLSearchParams");function sn(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),Ht(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{const s=n?Object.getOwnPropertyNames(e):Object.keys(e),i=s.length;let a;for(r=0;r<i;r++)a=s[r],t.call(null,e[a],a,e)}}function an(e,t){t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const on="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,ln=e=>!Vt(e)&&e!==on;const cn=(dn="undefined"!=typeof Uint8Array&&jt(Uint8Array),e=>dn&&e instanceof dn);var dn;const un=Kt("HTMLFormElement"),hn=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),fn=Kt("RegExp"),pn=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};sn(n,((n,s)=>{!1!==t(n,s,e)&&(r[s]=n)})),Object.defineProperties(e,r)};var gn={isArray:Ht,isArrayBuffer:zt,isBuffer:function(e){return null!==e&&!Vt(e)&&null!==e.constructor&&!Vt(e.constructor)&&Yt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{const t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||Bt.call(e)===t||Yt(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&zt(e.buffer),t},isString:Wt,isNumber:Qt,isBoolean:e=>!0===e||!1===e,isObject:Jt,isPlainObject:Xt,isUndefined:Vt,isDate:Zt,isFile:en,isBlob:tn,isRegExp:fn,isFunction:Yt,isStream:e=>Jt(e)&&Yt(e.pipe),isURLSearchParams:rn,isTypedArray:cn,isFileList:nn,forEach:sn,merge:function e(){const{caseless:t}=ln(this)&&this||{},n={},r=(r,s)=>{const i=t&&an(n,s)||s;Xt(n[i])&&Xt(r)?n[i]=e(n[i],r):Xt(r)?n[i]=e({},r):Ht(r)?n[i]=r.slice():n[i]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&sn(arguments[e],r);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(sn(t,((t,r)=>{n&&Yt(t)?e[r]=Nt(t,n):e[r]=t}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let s,i,a;const o={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],r&&!r(a,e,t)||o[a]||(t[a]=e[a],o[a]=!0);e=!1!==n&&jt(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:qt,kindOfTest:Kt,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Ht(e))return e;let t=e.length;if(!Qt(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:un,hasOwnProperty:hn,hasOwnProp:hn,reduceDescriptors:pn,freezeMethods:e=>{pn(e,((t,n)=>{if(Yt(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Yt(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return Ht(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:an,global:on,isContextDefined:ln,toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Jt(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const s=Ht(e)?[]:{};return sn(e,((e,t)=>{const i=n(e,r+1);!Vt(i)&&(s[t]=i)})),t[r]=void 0,s}}return e};return n(e,0)}};function mn(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s)}gn.inherits(mn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:gn.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const yn=mn.prototype,vn={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{vn[e]={value:e}})),Object.defineProperties(mn,vn),Object.defineProperty(yn,"isAxiosError",{value:!0}),mn.from=(e,t,n,r,s,i)=>{const a=Object.create(yn);return gn.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),mn.call(a,e.message,t,n,r,s),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};var bn="object"==typeof self?self.FormData:window.FormData;function wn(e){return gn.isPlainObject(e)||gn.isArray(e)}function Sn(e){return gn.endsWith(e,"[]")?e.slice(0,-2):e}function Cn(e,t,n){return e?e.concat(t).map((function(e,t){return e=Sn(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const Tn=gn.toFlatObject(gn,{},null,(function(e){return/^is[A-Z]/.test(e)}));function En(e,t,n){if(!gn.isObject(e))throw new TypeError("target must be an object");t=t||new(bn||FormData);const r=(n=gn.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!gn.isUndefined(t[e])}))).metaTokens,s=n.visitor||d,i=n.dots,a=n.indexes,o=(n.Blob||"undefined"!=typeof Blob&&Blob)&&((l=t)&&gn.isFunction(l.append)&&"FormData"===l[Symbol.toStringTag]&&l[Symbol.iterator]);var l;if(!gn.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(gn.isDate(e))return e.toISOString();if(!o&&gn.isBlob(e))throw new mn("Blob is not supported. Use a Buffer instead.");return gn.isArrayBuffer(e)||gn.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,n,s){let o=e;if(e&&!s&&"object"==typeof e)if(gn.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(gn.isArray(e)&&function(e){return gn.isArray(e)&&!e.some(wn)}(e)||gn.isFileList(e)||gn.endsWith(n,"[]")&&(o=gn.toArray(e)))return n=Sn(n),o.forEach((function(e,r){!gn.isUndefined(e)&&null!==e&&t.append(!0===a?Cn([n],r,i):null===a?n:n+"[]",c(e))})),!1;return!!wn(e)||(t.append(Cn(s,n,i),c(e)),!1)}const u=[],h=Object.assign(Tn,{defaultVisitor:d,convertValue:c,isVisitable:wn});if(!gn.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!gn.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),gn.forEach(n,(function(n,i){!0===(!(gn.isUndefined(n)||null===n)&&s.call(t,n,gn.isString(i)?i.trim():i,r,h))&&e(n,r?r.concat(i):[i])})),u.pop()}}(e),t}function In(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function kn(e,t){this._pairs=[],e&&En(e,this,t)}const An=kn.prototype;function _n(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Rn(e,t,n){if(!t)return e;const r=n&&n.encode||_n,s=n&&n.serialize;let i;if(i=s?s(t,n):gn.isURLSearchParams(t)?t.toString():new kn(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}An.append=function(e,t){this._pairs.push([e,t])},An.toString=function(e){const t=e?function(t){return e.call(this,t,In)}:In;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class On{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){gn.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Ln={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Dn="undefined"!=typeof URLSearchParams?URLSearchParams:kn,xn=FormData;const Pn=(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),Mn="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var Fn={isBrowser:!0,classes:{URLSearchParams:Dn,FormData:xn,Blob:Blob},isStandardBrowserEnv:Pn,isStandardBrowserWebWorkerEnv:Mn,protocols:["http","https","file","blob","url","data"]};function Un(e){function t(e,n,r,s){let i=e[s++];const a=Number.isFinite(+i),o=s>=e.length;if(i=!i&&gn.isArray(r)?r.length:i,o)return gn.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a;r[i]&&gn.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],s)&&gn.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}(r[i])),!a}if(gn.isFormData(e)&&gn.isFunction(e.entries)){const n={};return gn.forEachEntry(e,((e,r)=>{t(function(e){return gn.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const Nn={"Content-Type":void 0};const Bn={transitional:Ln,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=gn.isObject(e);s&&gn.isHTMLForm(e)&&(e=new FormData(e));if(gn.isFormData(e))return r&&r?JSON.stringify(Un(e)):e;if(gn.isArrayBuffer(e)||gn.isBuffer(e)||gn.isStream(e)||gn.isFile(e)||gn.isBlob(e))return e;if(gn.isArrayBufferView(e))return e.buffer;if(gn.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return En(e,new Fn.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return Fn.isNode&&gn.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=gn.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return En(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(gn.isString(e))try{return(t||JSON.parse)(e),gn.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Bn.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(e&&gn.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw mn.from(e,mn.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Fn.classes.FormData,Blob:Fn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};gn.forEach(["delete","get","head"],(function(e){Bn.headers[e]={}})),gn.forEach(["post","put","patch"],(function(e){Bn.headers[e]=gn.merge(Nn)}));const jn=gn.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const qn=Symbol("internals");function $n(e){return e&&String(e).trim().toLowerCase()}function Kn(e){return!1===e||null==e?e:gn.isArray(e)?e.map(Kn):String(e)}function Gn(e,t,n,r){return gn.isFunction(r)?r.call(this,t,n):gn.isString(t)?gn.isString(r)?-1!==t.indexOf(r):gn.isRegExp(r)?r.test(t):void 0:void 0}class Hn{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=$n(t);if(!s)throw new Error("header name must be a non-empty string");const i=gn.findKey(r,s);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Kn(e))}const i=(e,t)=>gn.forEach(e,((e,n)=>s(e,n,t)));return gn.isPlainObject(e)||e instanceof this.constructor?i(e,t):gn.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?i((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&jn[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t):null!=e&&s(t,e,n),this}get(e,t){if(e=$n(e)){const n=gn.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(gn.isFunction(t))return t.call(this,e,n);if(gn.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=$n(e)){const n=gn.findKey(this,e);return!(!n||t&&!Gn(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=$n(e)){const s=gn.findKey(n,e);!s||t&&!Gn(0,n[s],s,t)||(delete n[s],r=!0)}}return gn.isArray(e)?e.forEach(s):s(e),r}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,n={};return gn.forEach(this,((r,s)=>{const i=gn.findKey(n,s);if(i)return t[i]=Kn(r),void delete t[s];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(s):String(s).trim();a!==s&&delete t[s],t[a]=Kn(r),n[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return gn.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&gn.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[qn]=this[qn]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=$n(e);t[r]||(!function(e,t){const n=gn.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})}))}(n,e),t[r]=!0)}return gn.isArray(e)?e.forEach(r):r(e),this}}function Vn(e,t){const n=this||Bn,r=t||n,s=Hn.from(r.headers);let i=r.data;return gn.forEach(e,(function(e){i=e.call(n,i,s.normalize(),t?t.status:void 0)})),s.normalize(),i}function zn(e){return!(!e||!e.__CANCEL__)}function Wn(e,t,n){mn.call(this,null==e?"canceled":e,mn.ERR_CANCELED,t,n),this.name="CanceledError"}Hn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),gn.freezeMethods(Hn.prototype),gn.freezeMethods(Hn),gn.inherits(Wn,mn,{__CANCEL__:!0});var Yn=Fn.isStandardBrowserEnv?{write:function(e,t,n,r,s,i){const a=[];a.push(e+"="+encodeURIComponent(t)),gn.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),gn.isString(r)&&a.push("path="+r),gn.isString(s)&&a.push("domain="+s),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Qn(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Jn=Fn.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=gn.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function Xn(e,t){let n=0;const r=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,i=0,a=0;return t=void 0!==t?t:1e3,function(o){const l=Date.now(),c=r[a];s||(s=l),n[i]=o,r[i]=l;let d=a,u=0;for(;d!==i;)u+=n[d++],d%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),l-s<t)return;const h=c&&l-c;return h?Math.round(1e3*u/h):void 0}}(50,250);return s=>{const i=s.loaded,a=s.lengthComputable?s.total:void 0,o=i-n,l=r(o);n=i;const c={loaded:i,total:a,progress:a?i/a:void 0,bytes:o,rate:l||void 0,estimated:l&&a&&i<=a?(a-i)/l:void 0,event:s};c[t?"download":"upload"]=!0,e(c)}}var Zn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let r=e.data;const s=Hn.from(e.headers).normalize(),i=e.responseType;let a;function o(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}gn.isFormData(r)&&(Fn.isStandardBrowserEnv||Fn.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let l=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+n))}const c=Qn(e.baseURL,e.url);function d(){if(!l)return;const r=Hn.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders());!function(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new mn("Request failed with status code "+n.status,[mn.ERR_BAD_REQUEST,mn.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),o()}),(function(e){n(e),o()}),{data:i&&"text"!==i&&"json"!==i?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:r,config:e,request:l}),l=null}if(l.open(e.method.toUpperCase(),Rn(c,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=d:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(d)},l.onabort=function(){l&&(n(new mn("Request aborted",mn.ECONNABORTED,e,l)),l=null)},l.onerror=function(){n(new mn("Network Error",mn.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const r=e.transitional||Ln;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new mn(t,r.clarifyTimeoutError?mn.ETIMEDOUT:mn.ECONNABORTED,e,l)),l=null},Fn.isStandardBrowserEnv){const t=(e.withCredentials||Jn(c))&&e.xsrfCookieName&&Yn.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===r&&s.setContentType(null),"setRequestHeader"in l&&gn.forEach(s.toJSON(),(function(e,t){l.setRequestHeader(t,e)})),gn.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),i&&"json"!==i&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",Xn(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",Xn(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=t=>{l&&(n(!t||t.type?new Wn(null,e,l):t),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const u=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(c);u&&-1===Fn.protocols.indexOf(u)?n(new mn("Unsupported protocol "+u+":",mn.ERR_BAD_REQUEST,e)):l.send(r||null)}))};const er={http:null,xhr:Zn};gn.forEach(er,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var tr=e=>{e=gn.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let s=0;s<t&&(n=e[s],!(r=gn.isString(n)?er[n.toLowerCase()]:n));s++);if(!r){if(!1===r)throw new mn(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(gn.hasOwnProp(er,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`)}if(!gn.isFunction(r))throw new TypeError("adapter is not a function");return r};function nr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Wn(null,e)}function rr(e){nr(e),e.headers=Hn.from(e.headers),e.data=Vn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return tr(e.adapter||Bn.adapter)(e).then((function(t){return nr(e),t.data=Vn.call(e,e.transformResponse,t),t.headers=Hn.from(t.headers),t}),(function(t){return zn(t)||(nr(e),t&&t.response&&(t.response.data=Vn.call(e,e.transformResponse,t.response),t.response.headers=Hn.from(t.response.headers))),Promise.reject(t)}))}const sr=e=>e instanceof Hn?e.toJSON():e;function ir(e,t){t=t||{};const n={};function r(e,t,n){return gn.isPlainObject(e)&&gn.isPlainObject(t)?gn.merge.call({caseless:n},e,t):gn.isPlainObject(t)?gn.merge({},t):gn.isArray(t)?t.slice():t}function s(e,t,n){return gn.isUndefined(t)?gn.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function i(e,t){if(!gn.isUndefined(t))return r(void 0,t)}function a(e,t){return gn.isUndefined(t)?gn.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function o(n,s,i){return i in t?r(n,s):i in e?r(void 0,n):void 0}const l={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(e,t)=>s(sr(e),sr(t),!0)};return gn.forEach(Object.keys(e).concat(Object.keys(t)),(function(r){const i=l[r]||s,a=i(e[r],t[r],r);gn.isUndefined(a)&&i!==o||(n[r]=a)})),n}const ar="1.2.3",or={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{or[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const lr={};or.transitional=function(e,t,n){function r(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,i)=>{if(!1===e)throw new mn(r(s," has been removed"+(t?" in "+t:"")),mn.ERR_DEPRECATED);return t&&!lr[s]&&(lr[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,i)}};var cr={assertOptions:function(e,t,n){if("object"!=typeof e)throw new mn("options must be an object",mn.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],a=t[i];if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new mn("option "+i+" must be "+n,mn.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new mn("Unknown option "+i,mn.ERR_BAD_OPTION)}},validators:or};const dr=cr.validators;class ur{constructor(e){this.defaults=e,this.interceptors={request:new On,response:new On}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ir(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;let i;void 0!==n&&cr.assertOptions(n,{silentJSONParsing:dr.transitional(dr.boolean),forcedJSONParsing:dr.transitional(dr.boolean),clarifyTimeoutError:dr.transitional(dr.boolean)},!1),void 0!==r&&cr.assertOptions(r,{encode:dr.function,serialize:dr.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),i=s&&gn.merge(s.common,s[t.method]),i&&gn.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=Hn.concat(i,s);const a=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const l=[];let c;this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)}));let d,u=0;if(!o){const e=[rr.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,l),d=e.length,c=Promise.resolve(t);u<d;)c=c.then(e[u++],e[u++]);return c}d=a.length;let h=t;for(u=0;u<d;){const e=a[u++],t=a[u++];try{h=e(h)}catch(e){t.call(this,e);break}}try{c=rr.call(this,h)}catch(e){return Promise.reject(e)}for(u=0,d=l.length;u<d;)c=c.then(l[u++],l[u++]);return c}getUri(e){return Rn(Qn((e=ir(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}gn.forEach(["delete","get","head","options"],(function(e){ur.prototype[e]=function(t,n){return this.request(ir(n||{},{method:e,url:t,data:(n||{}).data}))}})),gn.forEach(["post","put","patch"],(function(e){function t(t){return function(n,r,s){return this.request(ir(s||{},{method:e,headers:t?{"Content-Type":"multi