UNPKG

@amityco/ts-sdk

Version:

Amity Social Cloud Typescript SDK

1 lines 1.14 MB
var Amity=function(e){"use strict";var t,n,r,s;e.MembershipAcceptanceTypeEnum=void 0,(t=e.MembershipAcceptanceTypeEnum||(e.MembershipAcceptanceTypeEnum={})).AUTOMATIC="automatic",t.INVITATION="invitation",e.AmityAutoSubscription=void 0,(n=e.AmityAutoSubscription||(e.AmityAutoSubscription={})).CHAT="chat",n.NETWORK="network",n.LIVESTREAM="livestream",n.BLOCK="block",e.UserTypeEnum=void 0,(r=e.UserTypeEnum||(e.UserTypeEnum={})).SIGNED_IN="signed-in",r.VISITOR="visitor",r.BOT="bot",e.SearchUsersByEnum=void 0,(s=e.SearchUsersByEnum||(e.SearchUsersByEnum={})).DISPLAY_NAME="displayName",s.PROFILE_HANDLE="profileHandle",s.USER_ID="userId";const i=Object.freeze({FILE:"file",IMAGE:"image",VIDEO:"video",CLIP:"clip",AUDIO:"audio"}),a=Object.freeze({"1080P":"1080p","720P":"720p","480P":"480p","360P":"360p",ORIGINAL:"original"}),o=Object.freeze({UPLOADED:"uploaded",TRANSCODING:"transcoding",TRANSCODED:"transcoded",TRANSCODE_FAILED:"transcodeFailed"}),l=Object.freeze({LOW:"low",MEDIUM:"medium",HIGH:"high",ORIGINAL:"original"});var c,d;e.FileAccessTypeEnum=void 0,(c=e.FileAccessTypeEnum||(e.FileAccessTypeEnum={})).PUBLIC="public",c.NETWORK="network",e.AmityChannelNotificationModeEnum=void 0,(d=e.AmityChannelNotificationModeEnum||(e.AmityChannelNotificationModeEnum={})).Default="default",d.Silent="silent",d.Subscribe="subscribe";const u=Object.freeze({ONLY_ADMIN_CAN_POST:"ONLY_ADMIN_CAN_POST",ADMIN_REVIEW_POST_REQUIRED:"ADMIN_REVIEW_POST_REQUIRED",ANYONE_CAN_POST:"ANYONE_CAN_POST"}),h=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}}),f="ONLY_ADMIN_CAN_POST";var p;e.AmityCommunityType=void 0,(p=e.AmityCommunityType||(e.AmityCommunityType={})).Default="default",p.Event="event";const g=Object.freeze({STORY:"story",CLIP:"clip",CHAT:"chat",POST:"post",MESSAGE:"message"});var m;e.ContentFlagReasonEnum=void 0,(m=e.ContentFlagReasonEnum||(e.ContentFlagReasonEnum={})).CommunityGuidelines="Against community guidelines",m.HarassmentOrBullying="Harassment or bullying",m.SelfHarmOrSuicide="Self-harm or suicide",m.ViolenceOrThreateningContent="Violence or threatening content",m.SellingRestrictedItems="Selling and promoting restricted items",m.SexualContentOrNudity="Sexual content or nudity",m.SpamOrScams="Spam or scams",m.FalseInformation="False information or misinformation",m.Others="Others";const y=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",AUDIO:"audio",CUSTOM:"custom"}),v=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",LIVESTREAM:"liveStream",POLL:"poll",CLIP:"clip",AUDIO:"audio",ROOM:"room"}),b=Object.freeze({TEXT:"text",IMAGE:"image",VIDEO:"video",FILE:"file",AUDIO:"audio",MIXED:"mixed"});var w,S,T,I,C,E,A,k,R,_,O,D,P,L,x,M,U,F,N,B,j,q;e.InvitationTypeEnum=void 0,(w=e.InvitationTypeEnum||(e.InvitationTypeEnum={})).CommunityMemberInvite="communityMemberInvite",w.LivestreamCohostInvite="livestreamCohostInvite",e.InvitationStatusEnum=void 0,(S=e.InvitationStatusEnum||(e.InvitationStatusEnum={})).Pending="pending",S.Approved="approved",S.Rejected="rejected",S.Cancelled="cancelled",e.InvitationSortByEnum=void 0,(T=e.InvitationSortByEnum||(e.InvitationSortByEnum={})).FirstCreated="firstCreated",T.LastCreated="lastCreated",e.InvitationTargetTypeEnum=void 0,(I=e.InvitationTargetTypeEnum||(e.InvitationTargetTypeEnum={})).Community="community",I.Room="room",e.JoinRequestStatusEnum=void 0,(C=e.JoinRequestStatusEnum||(e.JoinRequestStatusEnum={})).Pending="pending",C.Approved="approved",C.Rejected="rejected",C.Cancelled="cancelled",e.JoinResultStatusEnum=void 0,(E=e.JoinResultStatusEnum||(e.JoinResultStatusEnum={})).Success="success",E.Pending="pending",e.FeedDataTypeEnum=void 0,(A=e.FeedDataTypeEnum||(e.FeedDataTypeEnum={})).Text="text",A.Video="video",A.Image="image",A.File="file",A.Audio="audio",A.LiveStream="liveStream",A.Clip="clip",A.Poll="poll",A.Room="room",e.FeedSortByEnum=void 0,(k=e.FeedSortByEnum||(e.FeedSortByEnum={})).LastCreated="lastCreated",k.FirstCreated="firstCreated",k.LastUpdated="lastUpdated",k.FirstUpdated="firstUpdated",e.FeedSourceEnum=void 0,(R=e.FeedSourceEnum||(e.FeedSourceEnum={})).Community="community",R.User="user",e.FeedTypeEnum=void 0,(_=e.FeedTypeEnum||(e.FeedTypeEnum={})).Reviewing="reviewing",_.Published="published",_.Declined="declined",e.AmityEventType=void 0,(O=e.AmityEventType||(e.AmityEventType={})).Virtual="virtual",O.InPerson="in_person",e.AmityEventOriginType=void 0,(D=e.AmityEventOriginType||(e.AmityEventOriginType={})).Community="community",D.User="user",e.AmityEventStatus=void 0,(P=e.AmityEventStatus||(e.AmityEventStatus={})).Scheduled="scheduled",P.Live="live",P.Ended="ended",P.Cancelled="cancelled",e.AmityEventResponseStatus=void 0,(L=e.AmityEventResponseStatus||(e.AmityEventResponseStatus={})).Going="going",L.NotGoing="not_going",e.AmityEventSortOption=void 0,(x=e.AmityEventSortOption||(e.AmityEventSortOption={})).StartTime="startTime",x.CreatedAt="createdAt",e.AmityEventOrderOption=void 0,(M=e.AmityEventOrderOption||(e.AmityEventOrderOption={})).Ascending="asc",M.Descending="desc",e.AmitySharableContentType=void 0,(U=e.AmitySharableContentType||(e.AmitySharableContentType={})).POST="post",U.COMMUNITY="community",U.USER="user",U.LIVESTREAM="livestream",U.EVENT="event",e.AnalyticsSourceTypeEnum=void 0,(F=e.AnalyticsSourceTypeEnum||(e.AnalyticsSourceTypeEnum={})).POST="post",F.ROOM="room",e.UserNotificationModuleNameEnum=void 0,(N=e.UserNotificationModuleNameEnum||(e.UserNotificationModuleNameEnum={})).CHAT="chat",N.SOCIAL="social",N.VIDEO_STREAMING="video-streaming",e.CommunityNotificationEventNameEnum=void 0,(B=e.CommunityNotificationEventNameEnum||(e.CommunityNotificationEventNameEnum={})).POST_CREATED="post.created",B.POST_REACTED="post.reacted",B.COMMENT_CREATED="comment.created",B.COMMENT_REPLIED="comment.replied",B.COMMENT_REACTED="comment.reacted",B.STORY_CREATED="story.created",B.STORY_REACTED="story.reacted",B.STORY_COMMENT_CREATED="story-comment.created",B.LIVESTREAM_START="video-streaming.didStart",e.NotificationSettingsLevelEnum=void 0,(j=e.NotificationSettingsLevelEnum||(e.NotificationSettingsLevelEnum={})).USER="user",j.COMMUNITY="community",j.CHANNEL="channel",e.NotificationRolesFilterTypeEnum=void 0,(q=e.NotificationRolesFilterTypeEnum||(e.NotificationRolesFilterTypeEnum={})).ALL="all",q.ONLY="only";const $=function(){try{return"v7.23.0-umd"}catch(e){return"__dev__"}}(),K=5,G=20,V="cache_then_server",H="For using Live Collection feature you need to enable Cache!",z="Observing unsynced object is not supported by Live Object.",W=-5,Y=1e3,Q=6e5,J="/api/v1/feeds/for-you",X="dead",Z=6e4,ee=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})),te=e=>JSON.parse(e),ne=(e,t)=>e===t||!(!e||!t)&&("object"==typeof e&&Object.keys(e).every((n=>ne(e[n],t[n])))),re=e=>[400400,400300].includes(e),se="function"==typeof atob,ie="function"==typeof btoa,ae="function"==typeof Buffer,oe="function"==typeof TextDecoder?new TextDecoder:void 0,le="function"==typeof TextEncoder?new TextEncoder:void 0,ce=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),de=(e=>{let t={};return e.forEach(((e,n)=>t[e]=n)),t})(ce),ue=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,he=String.fromCharCode.bind(String),fe="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),pe=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),ge=ie?e=>btoa(e):ae?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+=ce[t>>18&63]+ce[t>>12&63]+ce[t>>6&63]+ce[63&t]}return a?i.slice(0,a-3)+"===".substring(a):i},me=ae?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(he.apply(null,e.subarray(n,n+4096)));return ge(t.join(""))},ye=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?he(192|t>>>6)+he(128|63&t):he(224|t>>>12&15)+he(128|t>>>6&63)+he(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return he(240|t>>>18&7)+he(128|t>>>12&63)+he(128|t>>>6&63)+he(128|63&t)},ve=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,be=ae?e=>Buffer.from(e,"utf8").toString("base64"):le?e=>me(le.encode(e)):e=>ge(e.replace(ve,ye)),we=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Se=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 he(55296+(t>>>10))+he(56320+(1023&t));case 3:return he((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return he((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},Te=se?e=>atob(pe(e)):ae?e=>Buffer.from(e,"base64").toString("binary"):e=>{if(e=e.replace(/\s+/g,""),!ue.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=de[e.charAt(i++)]<<18|de[e.charAt(i++)]<<12|(n=de[e.charAt(i++)])<<6|(r=de[e.charAt(i++)]),s+=64===n?he(t>>16&255):64===r?he(t>>16&255,t>>8&255):he(t>>16&255,t>>8&255,255&t);return s},Ie=ae?e=>fe(Buffer.from(e,"base64")):e=>fe(Te(e),(e=>e.charCodeAt(0))),Ce=ae?e=>Buffer.from(e,"base64").toString("utf8"):oe?e=>oe.decode(Ie(e)):e=>Te(e).replace(we,Se),Ee=e=>Ce(pe(e.replace(/[-_]/g,(e=>"-"==e?"+":"/")))),Ae=e=>["skip"].some((t=>t in e)),ke=e=>["after","before","first","last","limit"].some((t=>t in e)),Re=e=>"limit"in e,_e=e=>(null==e?void 0:e.hasOwnProperty("data"))&&(null==e?void 0:e.hasOwnProperty("nextPage"))&&(null==e?void 0:e.hasOwnProperty("prevPage")),Oe=(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&&ke(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?"-":"_")))(be(e)):be(e))(JSON.stringify(r)):void 0},De=e=>{if(!e)return;const t=JSON.parse(Ee(e));if(Ae(t))return{after:t.skip,limit:t.limit};if(ke(t)){if("before"in t)return{before:t.before,limit:t.last};if("after"in t)return{after:t.after,limit:t.first}}},Pe=e=>"locally"in e,Le=e=>"optimistically"in e,xe=e=>Pe(e)||Le(e),Me=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},Fe=(e,...t)=>({func:e,args:t}),Ne=(e,t=6e4)=>"cache_only"===e?{lifeSpan:1/0}:{lifeSpan:t<Z?Z:t},Be=({func:e,args:t},n,r=Ne("cache_then_server"))=>{let s;const{lifeSpan:i}=Ne("cache_then_server",r.lifeSpan);if(xe(e)){try{s=Le(e)?e.optimistically(...t):e.locally(...t)}catch(e){null==n||n(je(void 0,{origin:"local",loading:!1,error:e}))}const r=Me(s)&&Ue(s,i);if(null==n||n(je(s,{origin:"local",loading:!(Pe(e)&&r)})),r)return}else null==n||n(je(void 0,{origin:"local",loading:!0}));e(...t).then((e=>{null==n||n(je(e,{origin:"server",loading:!1}))})).catch((e=>{null==n||n(je(void 0,{origin:"server",loading:!1,error:e}))}))};function je(e,t){return _e(e)||Me(e)?Object.assign(Object.assign({},t),e):Object.assign(Object.assign({},t),{data:e})}class qe 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,qe)}}class $e extends qe{constructor(e,t,n){super(e,t,n)}}class Ke extends qe{constructor(e=8e5,t="fatal"){super("Unexpected error",e,t)}}class Ge extends qe{constructor(e,t="SDK client is having connection issues"){super(`${t} (${e})`,"disconnected"===e?800211:800210,"error"),this.event=e}}let Ve=null;const He=()=>{if(!Ve)throw new qe("There is no active client",8e5,"fatal");return Ve},ze=e=>{Ve=e},We={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}`,archivedChannel:({channelId:e})=>e,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,room:({roomId:e})=>e,viewer:({userId:e})=>e,event:({eventId:e})=>e,eventResponse:({userId:e})=>e,product:({productId:e})=>e,feedMetadata:({postId:e})=>e},Ye=e=>We[e],Qe={users:"user",files:"file",roles:"role",stories:"story",storyTargets:"storyTarget",channels:"channel",messageFeeds:"subChannel",channelUsers:"channelUsers",archives:"archivedChannel",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",videoStreamingChildren:"stream",videoStreamModerations:"streamModeration",follows:"follow",followCounts:"followCount",feeds:"feed",ads:"ad",advertisers:"advertiser",pinTargets:"pinTarget",pins:"pin",notificationTrayItems:"notificationTrayItem",invitations:"invitation",joinRequests:"joinRequest",rooms:"room",events:"event",viewers:"viewer",eventResponses:"eventResponse",products:"product",feedMetadata:"feedMetadata"};function Je(e=(new Date).toISOString()){return new Date(new Date(e).getTime()+1).toISOString()}const Xe=e=>{const{log:t,cache:n}=He();if(n)return t("cache/api/queryCache",{key:e}),Object.keys(n.data).filter((t=>{const n=te(t);return ne(e,n)})).map((e=>n.data[e]))},Ze=e=>{const{log:t,cache:n}=He();if(!n)return;t("cache/api/pullFromCache",e);const r=ee(e);return n.data[r]?n.data[r]:void 0},et=(e,t,n={cachedAt:Date.now()})=>{const{log:r,cache:s}=He();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=ee(e);return s.data[i]=Object.assign({key:e,data:t},n),!0},tt=(e,t,n)=>{const{log:r,cache:s}=He();if(!s)return!1;r("cache/api/mergeInCache",{key:e,mutation:t});const i=Ze(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 o&&new Date(l.updatedAt)<new Date(o.updatedAt))&&(et(e,a,n),!0);var o,l},nt=(e,t,n={cachedAt:Date.now()})=>{const{log:r,cache:s}=He();if(!s)return!1;r("cache/api/upsertInCache",{key:e,data:t,options:n});return Ze(e)?tt(e,t,n):et(e,t,n)},rt=(e,t=!1)=>{const{log:n,cache:r}=He();if(!r)return!1;if(n("cache/api/dropFromCache",{key:e,exact:t}),!t)return Object.keys(r.data).map((e=>te(e))).filter((t=>ne(e,t))).map((e=>rt(e,!0))).every((e=>e));const s=ee(e);return s in r.data&&(delete r.data[s],!0)},st=(e,t,n)=>void 0!==n?e.filter((e=>JSON.stringify(e[t])===JSON.stringify(n))):e,it=(e,t,n)=>void 0!==n?e.filter((e=>"string"==typeof e[t]&&"string"==typeof n&&String(e[t]).toLowerCase().match(n.toLowerCase()))):e,at=(e,t,n)=>(null==n?void 0:n.length)?e.filter((e=>Array.isArray(e[t])&&n.some((n=>e[t].includes(n))))):e,ot=(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=Ze(["channelUsers","get",s]))||void 0===r?void 0:r.data;return"member"===t?i&&"none"!==i.membership:!i||"none"===i.membership})),lt=(e,t)=>e.filter((({targetId:e,feedId:n})=>{var r;const s=null===(r=Ze(["feed","get",Ye("feed")({targetId:e,feedId:n})]))||void 0===r?void 0:r.data;return s&&s.feedType===t})),ct=(e,t,n)=>"all"===t?e:e.filter((e=>{var r;const s=Ye("communityUsers")({communityId:e.communityId,userId:n}),i=null===(r=Ze(["communityUsers","get",s]))||void 0===r?void 0:r.data;return"member"===t?i&&"member"===i.communityMembership:!i||"none"!==i.communityMembership})),dt=(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=Ze(["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}),[]),ut=(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))}))},ht=()=>{var e;const{userId:t}=He(),n=new Set;return(null!==(e=Xe(["follow","get"]))&&void 0!==e?e:[]).map((e=>e.data)).filter((e=>"blocked"===(null==e?void 0:e.status)&&(e.from===t||e.to===t))).forEach((e=>{n.add(e.from===t?e.to:e.from)})),n},ft=e=>{const t=ht();return 0===t.size?e:e.filter((e=>{var n,r;if(t.has(e.postedUserId))return!1;return!(null!==(r=null===(n=e.mentionees)||void 0===n?void 0:n.flatMap((e=>"user"===e.type?e.userIds:[])))&&void 0!==r?r:[]).some((e=>t.has(e)))}))},pt=e=>{const t=ht();return 0===t.size?e:e.filter((e=>!t.has(e.userId)))},gt=({displayName:e},{displayName:t})=>e&&t?e.localeCompare(t):e?-1:1,mt=({name:e},{name:t})=>e&&t?e.localeCompare(t):e?-1:1,yt=({createdAt:e},{createdAt:t})=>new Date(e).valueOf()-new Date(t).valueOf(),vt=({localSortingDate:e},{localSortingDate:t})=>new Date(t).getTime()-new Date(e).getTime(),bt=({createdAt:e},{createdAt:t})=>new Date(t).valueOf()-new Date(e).valueOf(),wt=({updatedAt:e=0},{updatedAt:t=0})=>new Date(e).valueOf()-new Date(t).valueOf(),St=({updatedAt:e=0},{updatedAt:t=0})=>new Date(t).valueOf()-new Date(e).valueOf(),Tt=({lastActivity:e},{lastActivity:t})=>new Date(t).valueOf()-new Date(e).valueOf(),It=e=>{if(void 0===e)return;const t=new Date(e).valueOf();if(!Number.isNaN(t))return e;console.warn("untilAt is an invalid Date — ignoring, pagination will not be bounded")},Ct=(e,t,n)=>{const r=new Date(e).valueOf(),s=new Date(t).valueOf();return"firstCreated"===n?r>=s:r<=s};let Et=null;const At=()=>{if(!Et)throw new qe("Connect client first",8e5,"fatal");return Et},kt=e=>{Et={_id:e._id,userId:e.userId,path:e.path}};let Rt,_t=[];const Ot=e=>{clearTimeout(Rt),_t.push(e),Rt=setTimeout((()=>{_t.forEach((e=>e())),_t=[]}),0)},Dt=["connect","message","disconnect","error","close","end","reconnect","video-streaming.didStart","video-streaming.didRecord","video-streaming.didStop","video-streaming.didFlag","video-streaming.didTerminate","video-streaming.viewerDidBan","video-streaming.viewerDidUnban","liveReaction.created"],Pt=()=>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)}))}}}(),Lt=(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)}},xt=(e,t)=>{const{emitter:n}=He();Ot((()=>{n.emit(e,t)}))};let Mt,Ut;async function Ft(){var e;const{mqtt:t,emitter:n,token:r}=He();if(!t)return;const s=null!==(e=null==r?void 0:r.accessToken)&&void 0!==e?e:"",i=At();Mt===s&&Ut===i._id||(Mt=s,Ut=i._id,await t.connect({accessToken:Mt,userId:Ut}),((e,t)=>{Dt.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))}const Nt=e=>Object.assign(Object.assign({},e),{get avatar(){var t;if(!e.avatarFileId)return;return null===(t=Ze(["file","get",`${e.avatarFileId}`]))||void 0===t?void 0:t.data}}),Bt=()=>{var e;const t=He();if(!t)throw new qe("Connect client first",8e5,"fatal");const n=null===(e=Ze(["user","get",t.userId]))||void 0===e?void 0:e.data;return n?Nt(n):null};var jt;e.SubscriptionLevels=void 0,(jt=e.SubscriptionLevels||(e.SubscriptionLevels={})).COMMUNITY="community",jt.POST="post",jt.COMMENT="comment",jt.POST_AND_COMMENT="post_and_comment",jt.USER="user";const qt=(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}},$t=e=>e.path.split("/user/")[0],Kt=()=>{const e=At();return`${$t(e)}/membership/${e._id}/+/+`},Gt=()=>{const e=At();return`${$t(e)}/membership/+/${e._id}/+`},Vt=({channelId:e,subChannelId:t})=>{const n=At();return`${$t(n)}/marker/channel/${e}/message/${t}`},Ht=()=>$t(At()),zt=()=>{const e=At();return`${$t(e)}/smartfeed/${e._id}/channels`},Wt=()=>{const e=At();return`${$t(e)}/smartfeed/${e._id}/messagefeeds`},Yt=()=>{const e=At();return`${$t(e)}/smartfeed/${e._id}/messages`},Qt=()=>{const e=At();return`${$t(e)}/videostreaming`};function Jt(e,t){const{mqtt:n}=He();return n?(Ft(),n.subscribe(e,t)):()=>null}var Xt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Zt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var en,tn,nn={exports:{}};function rn(){if(tn)return en;tn=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 en=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))},en}var sn=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=rn(),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=sn(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(nn,nn.exports);var an,on=nn.exports;const ln="object"==typeof globalThis?globalThis:"object"==typeof global?global:window,{process:cn={}}=ln,dn="production"===(null===(an=cn.env)||void 0===an?void 0:an.NODE_ENV),un={EU:"eu",SG:"sg",US:"us"},hn={http:"https://apix.{region}.amity.co",upload:"https://upload.{region}.amity.co",mqtt:"wss://sse.{region}.amity.co:443/mqtt"};function fn(e,t){return hn[e].replace("{region}",t)}function pn(e,t){return function(){return e.apply(t,arguments)}}const{toString:gn}=Object.prototype,{getPrototypeOf:mn}=Object,{iterator:yn,toStringTag:vn}=Symbol,bn=(wn=Object.create(null),e=>{const t=gn.call(e);return wn[t]||(wn[t]=t.slice(8,-1).toLowerCase())});var wn;const Sn=e=>(e=e.toLowerCase(),t=>bn(t)===e),Tn=e=>t=>typeof t===e,{isArray:In}=Array,Cn=Tn("undefined");function En(e){return null!==e&&!Cn(e)&&null!==e.constructor&&!Cn(e.constructor)&&Rn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const An=Sn("ArrayBuffer");const kn=Tn("string"),Rn=Tn("function"),_n=Tn("number"),On=e=>null!==e&&"object"==typeof e,Dn=e=>{if("object"!==bn(e))return!1;const t=mn(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||vn in e||yn in e)},Pn=Sn("Date"),Ln=Sn("File"),xn=Sn("Blob"),Mn=Sn("FileList"),Un=Sn("URLSearchParams"),[Fn,Nn,Bn,jn]=["ReadableStream","Request","Response","Headers"].map(Sn);function qn(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),In(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(En(e))return;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 $n(e,t){if(En(e))return null;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 Kn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Gn=e=>!Cn(e)&&e!==Kn;const Vn=(Hn="undefined"!=typeof Uint8Array&&mn(Uint8Array),e=>Hn&&e instanceof Hn);var Hn;const zn=Sn("HTMLFormElement"),Wn=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Yn=Sn("RegExp"),Qn=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};qn(n,((n,s)=>{let i;!1!==(i=t(n,s,e))&&(r[s]=i||n)})),Object.defineProperties(e,r)};const Jn=Sn("AsyncFunction"),Xn=(Zn="function"==typeof setImmediate,er=Rn(Kn.postMessage),Zn?setImmediate:er?((e,t)=>(Kn.addEventListener("message",(({source:n,data:r})=>{n===Kn&&r===e&&t.length&&t.shift()()}),!1),n=>{t.push(n),Kn.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e));var Zn,er;const tr="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Kn):"undefined"!=typeof process&&process.nextTick||Xn;var nr={isArray:In,isArrayBuffer:An,isBuffer:En,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Rn(e.append)&&("formdata"===(t=bn(e))||"object"===t&&Rn(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&An(e.buffer),t},isString:kn,isNumber:_n,isBoolean:e=>!0===e||!1===e,isObject:On,isPlainObject:Dn,isEmptyObject:e=>{if(!On(e)||En(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Fn,isRequest:Nn,isResponse:Bn,isHeaders:jn,isUndefined:Cn,isDate:Pn,isFile:Ln,isBlob:xn,isRegExp:Yn,isFunction:Rn,isStream:e=>On(e)&&Rn(e.pipe),isURLSearchParams:Un,isTypedArray:Vn,isFileList:Mn,forEach:qn,merge:function e(){const{caseless:t,skipUndefined:n}=Gn(this)&&this||{},r={},s=(s,i)=>{const a=t&&$n(r,i)||i;Dn(r[a])&&Dn(s)?r[a]=e(r[a],s):Dn(s)?r[a]=e({},s):In(s)?r[a]=s.slice():n&&Cn(s)||(r[a]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&qn(arguments[e],s);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(qn(t,((t,r)=>{n&&Rn(t)?e[r]=pn(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&&mn(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:bn,kindOfTest:Sn,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(In(e))return e;let t=e.length;if(!_n(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[yn]).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:zn,hasOwnProperty:Wn,hasOwnProp:Wn,reduceDescriptors:Qn,freezeMethods:e=>{Qn(e,((t,n)=>{if(Rn(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Rn(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 In(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)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:$n,global:Kn,isContextDefined:Gn,isSpecCompliantForm:function(e){return!!(e&&Rn(e.append)&&"FormData"===e[vn]&&e[yn])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(On(e)){if(t.indexOf(e)>=0)return;if(En(e))return e;if(!("toJSON"in e)){t[r]=e;const s=In(e)?[]:{};return qn(e,((e,t)=>{const i=n(e,r+1);!Cn(i)&&(s[t]=i)})),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:Jn,isThenable:e=>e&&(On(e)||Rn(e))&&Rn(e.then)&&Rn(e.catch),setImmediate:Xn,asap:tr,isIterable:e=>null!=e&&Rn(e[yn])};function rr(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,this.status=s.status?s.status:null)}nr.inherits(rr,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:nr.toJSONObject(this.config),code:this.code,status:this.status}}});const sr=rr.prototype,ir={};["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=>{ir[e]={value:e}})),Object.defineProperties(rr,ir),Object.defineProperty(sr,"isAxiosError",{value:!0}),rr.from=(e,t,n,r,s,i)=>{const a=Object.create(sr);nr.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e));const o=e&&e.message?e.message:"Error",l=null==t&&e?e.code:t;return rr.call(a,o,l,n,r,s),e&&null==a.cause&&Object.defineProperty(a,"cause",{value:e,configurable:!0}),a.name=e&&e.name||"Error",i&&Object.assign(a,i),a};function ar(e){return nr.isPlainObject(e)||nr.isArray(e)}function or(e){return nr.endsWith(e,"[]")?e.slice(0,-2):e}function lr(e,t,n){return e?e.concat(t).map((function(e,t){return e=or(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const cr=nr.toFlatObject(nr,{},null,(function(e){return/^is[A-Z]/.test(e)}));function dr(e,t,n){if(!nr.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=nr.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!nr.isUndefined(t[e])}))).metaTokens,s=n.visitor||c,i=n.dots,a=n.indexes,o=(n.Blob||"undefined"!=typeof Blob&&Blob)&&nr.isSpecCompliantForm(t);if(!nr.isFunction(s))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(nr.isDate(e))return e.toISOString();if(nr.isBoolean(e))return e.toString();if(!o&&nr.isBlob(e))throw new rr("Blob is not supported. Use a Buffer instead.");return nr.isArrayBuffer(e)||nr.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,s){let o=e;if(e&&!s&&"object"==typeof e)if(nr.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(nr.isArray(e)&&function(e){return nr.isArray(e)&&!e.some(ar)}(e)||(nr.isFileList(e)||nr.endsWith(n,"[]"))&&(o=nr.toArray(e)))return n=or(n),o.forEach((function(e,r){!nr.isUndefined(e)&&null!==e&&t.append(!0===a?lr([n],r,i):null===a?n:n+"[]",l(e))})),!1;return!!ar(e)||(t.append(lr(s,n,i),l(e)),!1)}const d=[],u=Object.assign(cr,{defaultVisitor:c,convertValue:l,isVisitable:ar});if(!nr.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!nr.isUndefined(n)){if(-1!==d.indexOf(n))throw Error("Circular reference detected in "+r.join("."));d.push(n),nr.forEach(n,(function(n,i){!0===(!(nr.isUndefined(n)||null===n)&&s.call(t,n,nr.isString(i)?i.trim():i,r,u))&&e(n,r?r.concat(i):[i])})),d.pop()}}(e),t}function ur(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function hr(e,t){this._pairs=[],e&&dr(e,this,t)}const fr=hr.prototype;function pr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function gr(e,t,n){if(!t)return e;const r=n&&n.encode||pr;nr.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(i=s?s(t,n):nr.isURLSearchParams(t)?t.toString():new hr(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}fr.append=function(e,t){this._pairs.push([e,t])},fr.toString=function(e){const t=e?function(t){return e.call(this,t,ur)}:ur;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class mr{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){nr.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var yr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},vr={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:hr,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const br="undefined"!=typeof window&&"undefined"!=typeof document,wr="object"==typeof navigator&&navigator||void 0,Sr=br&&(!wr||["ReactNative","NativeScript","NS"].indexOf(wr.product)<0),Tr="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ir=br&&window.location.href||"http://localhost";var Cr={...Object.freeze({__proto__:null,hasBrowserEnv:br,hasStandardBrowserWebWorkerEnv:Tr,hasStandardBrowserEnv:Sr,navigator:wr,origin:Ir}),...vr};function Er(e){function t(e,n,r,s){let i=e[s++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),o=s>=e.length;if(i=!i&&nr.isArray(r)?r.length:i,o)return nr.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a;r[i]&&nr.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],s)&&nr.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(nr.isFormData(e)&&nr.isFunction(e.entries)){const n={};return nr.forEachEntry(e,((e,r)=>{t(function(e){return nr.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const Ar={transitional:yr,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=nr.isObject(e);s&&nr.isHTMLForm(e)&&(e=new FormData(e));if(nr.isFormData(e))return r?JSON.stringify(Er(e)):e;if(nr.isArrayBuffer(e)||nr.isBuffer(e)||nr.isStream(e)||nr.isFile(e)||nr.isBlob(e)||nr.isReadableStream(e))return e;if(nr.isArrayBufferView(e))return e.buffer;if(nr.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 dr(e,new Cr.classes.URLSearchParams,{visitor:function(e,t,n,r){return Cr.isNode&&nr.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=nr.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return dr(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(nr.isString(e))try{return(t||JSON.parse)(e),nr.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ar.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(nr.isResponse(e)||nr.isReadableStream(e))return e;if(e&&nr.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw rr.from(e,rr.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:Cr.classes.FormData,Blob:Cr.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};nr.forEach(["delete","get","head","post","put","patch"],(e=>{Ar.headers[e]={}}));const kr=nr.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 Rr=Symbol("internals");function _r(e){return e&&String(e).trim().toLowerCase()}function Or(e){return!1===e||null==e?e:nr.isArray(e)?e.map(Or):String(e)}function Dr(e,t,n,r,s){return nr.isFunction(r)?r.call(this,t,n):(s&&(t=n),nr.isString(t)?nr.isString(r)?-1!==t.indexOf(r):nr.isRegExp(r)?r.test(t):void 0:void 0)}class Pr{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=_r(t);if(!s)throw new Error("header name must be a non-empty string");const i=nr.findKey(r,s);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Or(e))}const i=(e,t)=>nr.forEach(e,((e,n)=>s(e,n,t)));if(nr.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(nr.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.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]&&kr[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t);else if(nr.isObject(e)&&nr.isIterable(e)){let n,r,s={};for(const t of e){if(!nr.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?nr.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(s,t)}else null!=e&&s(t,e,n);return this}get(e,t){if(e=_r(e)){const n=nr.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(nr.isFunction(t))return t.call(this,e,n);if(nr.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=_r(e)){const n=nr.findKey(this,e);return!(!n||void 0===this[n]||t&&!Dr(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=_r(e)){const s=nr.findKey(n,e);!s||t&&!Dr(0,n[s],s,t)||(delete n[s],r=!0)}}return nr.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const s=t[n];e&&!Dr(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return nr.forEach(this,((r,s)=>{const i=nr.findKey(n,s);if(i)return t[i]=Or(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]=Or(r),n[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return nr.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&nr.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")}getSetCookie(){return this.get("set-cookie")||[]}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[Rr]=this[Rr]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=_r(e);t[r]||(!function(e,t){const n=nr.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 nr.isArray(e)?e.forEach(r):r(e),this}}function Lr(e,t){const n=this||Ar,r=t||n,s=Pr.from(r.headers);let i=r.data;return nr.forEach(e,(function(e){i=e.call(n,i,s.normalize(),t?t.status:void 0)})),s.normalize(),i}function xr(e){return!(!e||!e.__CANCEL__)}function Mr(e,t,n){rr.call(this,null==e?"canceled":e,rr.ERR_CANCELED,t,n),this.name="CanceledError"}function Ur(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new rr("Request failed with status code "+n.status,[rr.ERR_BAD_REQUEST,rr.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Pr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),nr.reduceDescriptors(Pr.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),nr.freezeMethods(Pr),nr.inherits(Mr,rr,{__CANCEL__:!0});const Fr=(e,t,n=3)=>{let r=0;const s=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 function(e,t){let n,r,s=0,i=1e3/t;const a=(t,i=Date.now())=>{s=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),o=t-s;o>=i?a(e,t):(n=e,r||(r=setTimeout((()=>{r=null,a(n)}),i-o)))},()=>n&&a(n)]}((n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,o=i-r,l=s(o);r=i;e({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:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})}),n)},Nr=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Br=e=>(...t)=>nr.asap((()=>e(...t)));var jr=Cr.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Cr.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Cr.origin),Cr.navigator&&/(msie|trident)/i.test(Cr.navigator.userAgent)):()=>!0,qr=Cr.hasStandardBrowserEnv?{write(e,t,n,r,s,i){const a=[e+"="+encodeURIComponent(t)];nr.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),nr.isString(r)&&a.push("path="+r),nr.isString(s)&&a.push("domain="+s),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function $r(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Kr=e=>e instanceof Pr?{...e}:e;function Gr(e,t){t=t||{};const n={};function r(e,t,n,r){return nr.isPlainObject(e)&&nr.isPlainObject(t)?nr.merge.call({caseless:r},e,t):nr.isPlainObject(t)?nr.merge({},t):nr.isArray(t)?t.slice():t}function s(e,t,n,s){return nr.isUndefined(t)?nr.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function i(e,t){if(!nr.isUndefined(t))return r(void 0,t)}function a(e,t){return nr.isUndefined(t)?nr.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,withXSRFToken: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,