teams-bots/composer-bot-extensions/composer-bot-extensions/content.js

7 lines
53 KiB
JavaScript

const F={GET_CONVERSATIONS:"messages.get-conversations",GET_CONVERSATION:"messages.get-conversation",RECEIVE_CONVERSATIONS:"messages.receive-conversations",RECEIVE_CONVERSATION:"messages.receive-conversation",SEND_MESSAGE:"messages.send-messsage",REPLY_MESSAGE:"messages.reply-messsage"};function ut(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var se={exports:{}},Ee;function ft(){return Ee||(Ee=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(f,c,u){this.fn=f,this.context=c,this.once=u||!1}function o(f,c,u,d,m){if(typeof u!="function")throw new TypeError("The listener must be a function");var g=new s(u,d||f,m),p=n?n+c:c;return f._events[p]?f._events[p].fn?f._events[p]=[f._events[p],g]:f._events[p].push(g):(f._events[p]=g,f._eventsCount++),f}function i(f,c){--f._eventsCount===0?f._events=new r:delete f._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,d;if(this._eventsCount===0)return c;for(d in u=this._events)e.call(u,d)&&c.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=n?n+c:c,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var m=0,g=d.length,p=new Array(g);m<g;m++)p[m]=d[m].fn;return p},a.prototype.listenerCount=function(c){var u=n?n+c:c,d=this._events[u];return d?d.fn?1:d.length:0},a.prototype.emit=function(c,u,d,m,g,p){var y=n?n+c:c;if(!this._events[y])return!1;var h=this._events[y],b=arguments.length,S,E;if(h.fn){switch(h.once&&this.removeListener(c,h.fn,void 0,!0),b){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,u),!0;case 3:return h.fn.call(h.context,u,d),!0;case 4:return h.fn.call(h.context,u,d,m),!0;case 5:return h.fn.call(h.context,u,d,m,g),!0;case 6:return h.fn.call(h.context,u,d,m,g,p),!0}for(E=1,S=new Array(b-1);E<b;E++)S[E-1]=arguments[E];h.fn.apply(h.context,S)}else{var v=h.length,R;for(E=0;E<v;E++)switch(h[E].once&&this.removeListener(c,h[E].fn,void 0,!0),b){case 1:h[E].fn.call(h[E].context);break;case 2:h[E].fn.call(h[E].context,u);break;case 3:h[E].fn.call(h[E].context,u,d);break;case 4:h[E].fn.call(h[E].context,u,d,m);break;default:if(!S)for(R=1,S=new Array(b-1);R<b;R++)S[R-1]=arguments[R];h[E].fn.apply(h[E].context,S)}}return!0},a.prototype.on=function(c,u,d){return o(this,c,u,d,!1)},a.prototype.once=function(c,u,d){return o(this,c,u,d,!0)},a.prototype.removeListener=function(c,u,d,m){var g=n?n+c:c;if(!this._events[g])return this;if(!u)return i(this,g),this;var p=this._events[g];if(p.fn)p.fn===u&&(!m||p.once)&&(!d||p.context===d)&&i(this,g);else{for(var y=0,h=[],b=p.length;y<b;y++)(p[y].fn!==u||m&&!p[y].once||d&&p[y].context!==d)&&h.push(p[y]);h.length?this._events[g]=h.length===1?h[0]:h:i(this,g)}return this},a.prototype.removeAllListeners=function(c){var u;return c?(u=n?n+c:c,this._events[u]&&i(this,u)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a}(se)),se.exports}var dt=ft();const ht=ut(dt);class Be extends Error{constructor(e){super(e),this.name="TimeoutError"}}class pt extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const be=t=>globalThis.DOMException===void 0?new pt(t):new DOMException(t),Se=t=>{const e=t.reason===void 0?be("This operation was aborted."):t.reason;return e instanceof Error?e:be(e)};function mt(t,e){const{milliseconds:n,fallback:r,message:s,customTimers:o={setTimeout,clearTimeout}}=e;let i,a;const c=new Promise((u,d)=>{if(typeof n!="number"||Math.sign(n)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(e.signal){const{signal:g}=e;g.aborted&&d(Se(g)),a=()=>{d(Se(g))},g.addEventListener("abort",a,{once:!0})}if(n===Number.POSITIVE_INFINITY){t.then(u,d);return}const m=new Be;i=o.setTimeout.call(void 0,()=>{if(r){try{u(r())}catch(g){d(g)}return}typeof t.cancel=="function"&&t.cancel(),s===!1?u():s instanceof Error?d(s):(m.message=s??`Promise timed out after ${n} milliseconds`,d(m))},n),(async()=>{try{u(await t)}catch(g){d(g)}})()}).finally(()=>{c.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return c.clear=()=>{o.clearTimeout.call(void 0,i),i=void 0},c}function yt(t,e,n){let r=0,s=t.length;for(;s>0;){const o=Math.trunc(s/2);let i=r+o;n(t[i],e)<=0?(r=++i,s-=o+1):s=o}return r}class gt{#e=[];enqueue(e,n){n={priority:0,...n};const r={priority:n.priority,id:n.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=n.priority){this.#e.push(r);return}const s=yt(this.#e,r,(o,i)=>i.priority-o.priority);this.#e.splice(s,0,r)}setPriority(e,n){const r=this.#e.findIndex(o=>o.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[s]=this.#e.splice(r,1);this.enqueue(s.run,{priority:n,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(n=>n.priority===e.priority).map(n=>n.run)}get size(){return this.#e.length}}class wt extends ht{#e;#i;#o=0;#h;#a;#p=0;#n;#c;#t;#m;#r=0;#l;#s;#y;#E=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:gt,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#i=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#h=e.intervalCap,this.#a=e.interval,this.#t=new e.queueClass,this.#m=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#y=e.throwOnTimeout===!0,this.#s=e.autoStart===!1}get#b(){return this.#i||this.#o<this.#h}get#S(){return this.#r<this.#l}#T(){this.#r--,this.#u(),this.emit("next")}#R(){this.#w(),this.#g(),this.#c=void 0}get#_(){const e=Date.now();if(this.#n===void 0){const n=this.#p-e;if(n<0)this.#o=this.#e?this.#r:0;else return this.#c===void 0&&(this.#c=setTimeout(()=>{this.#R()},n)),!0}return!1}#u(){if(this.#t.size===0)return this.#n&&clearInterval(this.#n),this.#n=void 0,this.emit("empty"),this.#r===0&&this.emit("idle"),!1;if(!this.#s){const e=!this.#_;if(this.#b&&this.#S){const n=this.#t.dequeue();return n?(this.emit("active"),n(),e&&this.#g(),!0):!1}}return!1}#g(){this.#i||this.#n!==void 0||(this.#n=setInterval(()=>{this.#w()},this.#a),this.#p=Date.now()+this.#a)}#w(){this.#o===0&&this.#r===0&&this.#n&&(clearInterval(this.#n),this.#n=void 0),this.#o=this.#e?this.#r:0,this.#f()}#f(){for(;this.#u(););}get concurrency(){return this.#l}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#l=e,this.#f()}async#A(e){return new Promise((n,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,n){this.#t.setPriority(e,n)}async add(e,n={}){return n.id??=(this.#E++).toString(),n={timeout:this.timeout,throwOnTimeout:this.#y,...n},new Promise((r,s)=>{this.#t.enqueue(async()=>{this.#r++,this.#o++;try{n.signal?.throwIfAborted();let o=e({signal:n.signal});n.timeout&&(o=mt(Promise.resolve(o),{milliseconds:n.timeout})),n.signal&&(o=Promise.race([o,this.#A(n.signal)]));const i=await o;r(i),this.emit("completed",i)}catch(o){if(o instanceof Be&&!n.throwOnTimeout){r();return}s(o),this.emit("error",o)}finally{this.#T()}},n),this.emit("add"),this.#u()})}async addAll(e,n){return Promise.all(e.map(async r=>this.add(r,n)))}start(){return this.#s?(this.#s=!1,this.#f(),this):this}pause(){this.#s=!0}clear(){this.#t=new this.#m}async onEmpty(){this.#t.size!==0&&await this.#d("empty")}async onSizeLessThan(e){this.#t.size<e||await this.#d("next",()=>this.#t.size<e)}async onIdle(){this.#r===0&&this.#t.size===0||await this.#d("idle")}async#d(e,n){return new Promise(r=>{const s=()=>{n&&!n()||(this.off(e,s),r())};this.on(e,s)})}get size(){return this.#t.size}sizeBy(e){return this.#t.filter(e).length}get pending(){return this.#r}get isPaused(){return this.#s}}const q=new wt({concurrency:1});function De(t,e){return function(){return t.apply(e,arguments)}}const{toString:Et}=Object.prototype,{getPrototypeOf:me}=Object,{iterator:Y,toStringTag:qe}=Symbol,Q=(t=>e=>{const n=Et.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),C=t=>(t=t.toLowerCase(),e=>Q(e)===t),Z=t=>e=>typeof e===t,{isArray:B}=Array,H=Z("undefined");function bt(t){return t!==null&&!H(t)&&t.constructor!==null&&!H(t.constructor)&&A(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ue=C("ArrayBuffer");function St(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ue(t.buffer),e}const Tt=Z("string"),A=Z("function"),je=Z("number"),ee=t=>t!==null&&typeof t=="object",Rt=t=>t===!0||t===!1,J=t=>{if(Q(t)!=="object")return!1;const e=me(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(qe in t)&&!(Y in t)},_t=C("Date"),At=C("File"),Ot=C("Blob"),vt=C("FileList"),Ct=t=>ee(t)&&A(t.pipe),xt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||A(t.append)&&((e=Q(t))==="formdata"||e==="object"&&A(t.toString)&&t.toString()==="[object FormData]"))},Nt=C("URLSearchParams"),[Pt,It,Mt,kt]=["ReadableStream","Request","Response","Headers"].map(C),Lt=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function $(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),B(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{const o=n?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let a;for(r=0;r<i;r++)a=o[r],e.call(null,t[a],a,t)}}function He(t,e){e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const M=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$e=t=>!H(t)&&t!==M;function ce(){const{caseless:t}=$e(this)&&this||{},e={},n=(r,s)=>{const o=t&&He(e,s)||s;J(e[o])&&J(r)?e[o]=ce(e[o],r):J(r)?e[o]=ce({},r):B(r)?e[o]=r.slice():e[o]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&$(arguments[r],n);return e}const Ft=(t,e,n,{allOwnKeys:r}={})=>($(e,(s,o)=>{n&&A(s)?t[o]=De(s,n):t[o]=s},{allOwnKeys:r}),t),Bt=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Dt=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},qt=(t,e,n,r)=>{let s,o,i;const a={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!r||r(i,t,e))&&!a[i]&&(e[i]=t[i],a[i]=!0);t=n!==!1&&me(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Ut=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},jt=t=>{if(!t)return null;if(B(t))return t;let e=t.length;if(!je(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Ht=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&me(Uint8Array)),$t=(t,e)=>{const r=(t&&t[Y]).call(t);let s;for(;(s=r.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},zt=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Vt=C("HTMLFormElement"),Jt=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Te=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Kt=C("RegExp"),ze=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};$(n,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(r[o]=i||s)}),Object.defineProperties(t,r)},Wt=t=>{ze(t,(e,n)=>{if(A(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(A(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Gt=(t,e)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return B(t)?r(t):r(String(t).split(e)),n},Xt=()=>{},Yt=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Qt(t){return!!(t&&A(t.append)&&t[qe]==="FormData"&&t[Y])}const Zt=t=>{const e=new Array(10),n=(r,s)=>{if(ee(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[s]=r;const o=B(r)?[]:{};return $(r,(i,a)=>{const f=n(i,s+1);!H(f)&&(o[a]=f)}),e[s]=void 0,o}}return r};return n(t,0)},en=C("AsyncFunction"),tn=t=>t&&(ee(t)||A(t))&&A(t.then)&&A(t.catch),Ve=((t,e)=>t?setImmediate:e?((n,r)=>(M.addEventListener("message",({source:s,data:o})=>{s===M&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),M.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",A(M.postMessage)),nn=typeof queueMicrotask<"u"?queueMicrotask.bind(M):typeof process<"u"&&process.nextTick||Ve,rn=t=>t!=null&&A(t[Y]),l={isArray:B,isArrayBuffer:Ue,isBuffer:bt,isFormData:xt,isArrayBufferView:St,isString:Tt,isNumber:je,isBoolean:Rt,isObject:ee,isPlainObject:J,isReadableStream:Pt,isRequest:It,isResponse:Mt,isHeaders:kt,isUndefined:H,isDate:_t,isFile:At,isBlob:Ot,isRegExp:Kt,isFunction:A,isStream:Ct,isURLSearchParams:Nt,isTypedArray:Ht,isFileList:vt,forEach:$,merge:ce,extend:Ft,trim:Lt,stripBOM:Bt,inherits:Dt,toFlatObject:qt,kindOf:Q,kindOfTest:C,endsWith:Ut,toArray:jt,forEachEntry:$t,matchAll:zt,isHTMLForm:Vt,hasOwnProperty:Te,hasOwnProp:Te,reduceDescriptors:ze,freezeMethods:Wt,toObjectSet:Gt,toCamelCase:Jt,noop:Xt,toFiniteNumber:Yt,findKey:He,global:M,isContextDefined:$e,isSpecCompliantForm:Qt,toJSONObject:Zt,isAsyncFn:en,isThenable:tn,setImmediate:Ve,asap:nn,isIterable:rn};function w(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}l.inherits(w,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:l.toJSONObject(this.config),code:this.code,status:this.status}}});const Je=w.prototype,Ke={};["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(t=>{Ke[t]={value:t}});Object.defineProperties(w,Ke);Object.defineProperty(Je,"isAxiosError",{value:!0});w.from=(t,e,n,r,s,o)=>{const i=Object.create(Je);return l.toFlatObject(t,i,function(f){return f!==Error.prototype},a=>a!=="isAxiosError"),w.call(i,t.message,e,n,r,s),i.cause=t,i.name=t.name,o&&Object.assign(i,o),i};const sn=null;function le(t){return l.isPlainObject(t)||l.isArray(t)}function We(t){return l.endsWith(t,"[]")?t.slice(0,-2):t}function Re(t,e,n){return t?t.concat(e).map(function(s,o){return s=We(s),!n&&o?"["+s+"]":s}).join(n?".":""):e}function on(t){return l.isArray(t)&&!t.some(le)}const an=l.toFlatObject(l,{},null,function(e){return/^is[A-Z]/.test(e)});function te(t,e,n){if(!l.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=l.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,h){return!l.isUndefined(h[y])});const r=n.metaTokens,s=n.visitor||u,o=n.dots,i=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&l.isSpecCompliantForm(e);if(!l.isFunction(s))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(l.isDate(p))return p.toISOString();if(l.isBoolean(p))return p.toString();if(!f&&l.isBlob(p))throw new w("Blob is not supported. Use a Buffer instead.");return l.isArrayBuffer(p)||l.isTypedArray(p)?f&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function u(p,y,h){let b=p;if(p&&!h&&typeof p=="object"){if(l.endsWith(y,"{}"))y=r?y:y.slice(0,-2),p=JSON.stringify(p);else if(l.isArray(p)&&on(p)||(l.isFileList(p)||l.endsWith(y,"[]"))&&(b=l.toArray(p)))return y=We(y),b.forEach(function(E,v){!(l.isUndefined(E)||E===null)&&e.append(i===!0?Re([y],v,o):i===null?y:y+"[]",c(E))}),!1}return le(p)?!0:(e.append(Re(h,y,o),c(p)),!1)}const d=[],m=Object.assign(an,{defaultVisitor:u,convertValue:c,isVisitable:le});function g(p,y){if(!l.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(p),l.forEach(p,function(b,S){(!(l.isUndefined(b)||b===null)&&s.call(e,b,l.isString(S)?S.trim():S,y,m))===!0&&g(b,y?y.concat(S):[S])}),d.pop()}}if(!l.isObject(t))throw new TypeError("data must be an object");return g(t),e}function _e(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function ye(t,e){this._pairs=[],t&&te(t,this,e)}const Ge=ye.prototype;Ge.append=function(e,n){this._pairs.push([e,n])};Ge.toString=function(e){const n=e?function(r){return e.call(this,r,_e)}:_e;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function cn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Xe(t,e,n){if(!e)return t;const r=n&&n.encode||cn;l.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(s?o=s(e,n):o=l.isURLSearchParams(e)?e.toString():new ye(e,n).toString(r),o){const i=t.indexOf("#");i!==-1&&(t=t.slice(0,i)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class Ae{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){l.forEach(this.handlers,function(r){r!==null&&e(r)})}}const Ye={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ln=typeof URLSearchParams<"u"?URLSearchParams:ye,un=typeof FormData<"u"?FormData:null,fn=typeof Blob<"u"?Blob:null,dn={isBrowser:!0,classes:{URLSearchParams:ln,FormData:un,Blob:fn},protocols:["http","https","file","blob","url","data"]},ge=typeof window<"u"&&typeof document<"u",ue=typeof navigator=="object"&&navigator||void 0,hn=ge&&(!ue||["ReactNative","NativeScript","NS"].indexOf(ue.product)<0),pn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",mn=ge&&window.location.href||"http://localhost",yn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ge,hasStandardBrowserEnv:hn,hasStandardBrowserWebWorkerEnv:pn,navigator:ue,origin:mn},Symbol.toStringTag,{value:"Module"})),_={...yn,...dn};function gn(t,e){return te(t,new _.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,o){return _.isNode&&l.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function wn(t){return l.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function En(t){const e={},n=Object.keys(t);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],e[o]=t[o];return e}function Qe(t){function e(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),f=o>=n.length;return i=!i&&l.isArray(s)?s.length:i,f?(l.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!a):((!s[i]||!l.isObject(s[i]))&&(s[i]=[]),e(n,r,s[i],o)&&l.isArray(s[i])&&(s[i]=En(s[i])),!a)}if(l.isFormData(t)&&l.isFunction(t.entries)){const n={};return l.forEachEntry(t,(r,s)=>{e(wn(r),s,n,0)}),n}return null}function bn(t,e,n){if(l.isString(t))try{return(e||JSON.parse)(t),l.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const z={transitional:Ye,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=l.isObject(e);if(o&&l.isHTMLForm(e)&&(e=new FormData(e)),l.isFormData(e))return s?JSON.stringify(Qe(e)):e;if(l.isArrayBuffer(e)||l.isBuffer(e)||l.isStream(e)||l.isFile(e)||l.isBlob(e)||l.isReadableStream(e))return e;if(l.isArrayBufferView(e))return e.buffer;if(l.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return gn(e,this.formSerializer).toString();if((a=l.isFileList(e))||r.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return te(a?{"files[]":e}:e,f&&new f,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),bn(e)):e}],transformResponse:[function(e){const n=this.transitional||z.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(l.isResponse(e)||l.isReadableStream(e))return e;if(e&&l.isString(e)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(a){if(i)throw a.name==="SyntaxError"?w.from(a,w.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_.classes.FormData,Blob:_.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};l.forEach(["delete","get","head","post","put","patch"],t=>{z.headers[t]={}});const Sn=l.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"]),Tn=t=>{const e={};let n,r,s;return t&&t.split(`
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||e[n]&&Sn[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Oe=Symbol("internals");function U(t){return t&&String(t).trim().toLowerCase()}function K(t){return t===!1||t==null?t:l.isArray(t)?t.map(K):String(t)}function Rn(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const _n=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function oe(t,e,n,r,s){if(l.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!l.isString(e)){if(l.isString(r))return e.indexOf(r)!==-1;if(l.isRegExp(r))return r.test(e)}}function An(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function On(t,e){const n=l.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,o,i){return this[r].call(this,e,s,o,i)},configurable:!0})})}let O=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function o(a,f,c){const u=U(f);if(!u)throw new Error("header name must be a non-empty string");const d=l.findKey(s,u);(!d||s[d]===void 0||c===!0||c===void 0&&s[d]!==!1)&&(s[d||f]=K(a))}const i=(a,f)=>l.forEach(a,(c,u)=>o(c,u,f));if(l.isPlainObject(e)||e instanceof this.constructor)i(e,n);else if(l.isString(e)&&(e=e.trim())&&!_n(e))i(Tn(e),n);else if(l.isObject(e)&&l.isIterable(e)){let a={},f,c;for(const u of e){if(!l.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(f=a[c])?l.isArray(f)?[...f,u[1]]:[f,u[1]]:u[1]}i(a,n)}else e!=null&&o(n,e,r);return this}get(e,n){if(e=U(e),e){const r=l.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return Rn(s);if(l.isFunction(n))return n.call(this,s,r);if(l.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=U(e),e){const r=l.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||oe(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function o(i){if(i=U(i),i){const a=l.findKey(r,i);a&&(!n||oe(r,r[a],a,n))&&(delete r[a],s=!0)}}return l.isArray(e)?e.forEach(o):o(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!e||oe(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){const n=this,r={};return l.forEach(this,(s,o)=>{const i=l.findKey(r,o);if(i){n[i]=K(s),delete n[o];return}const a=e?An(o):String(o).trim();a!==o&&delete n[o],n[a]=K(s),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return l.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&l.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`)}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,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[Oe]=this[Oe]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=U(i);r[a]||(On(s,i),r[a]=!0)}return l.isArray(e)?e.forEach(o):o(e),this}};O.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);l.reduceDescriptors(O.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});l.freezeMethods(O);function ie(t,e){const n=this||z,r=e||n,s=O.from(r.headers);let o=r.data;return l.forEach(t,function(a){o=a.call(n,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function Ze(t){return!!(t&&t.__CANCEL__)}function D(t,e,n){w.call(this,t??"canceled",w.ERR_CANCELED,e,n),this.name="CanceledError"}l.inherits(D,w,{__CANCEL__:!0});function et(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new w("Request failed with status code "+n.status,[w.ERR_BAD_REQUEST,w.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function vn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Cn(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(f){const c=Date.now(),u=r[o];i||(i=c),n[s]=f,r[s]=c;let d=o,m=0;for(;d!==s;)m+=n[d++],d=d%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),c-i<e)return;const g=u&&c-u;return g?Math.round(m*1e3/g):void 0}}function xn(t,e){let n=0,r=1e3/e,s,o;const i=(c,u=Date.now())=>{n=u,s=null,o&&(clearTimeout(o),o=null),t.apply(null,c)};return[(...c)=>{const u=Date.now(),d=u-n;d>=r?i(c,u):(s=c,o||(o=setTimeout(()=>{o=null,i(s)},r-d)))},()=>s&&i(s)]}const G=(t,e,n=3)=>{let r=0;const s=Cn(50,250);return xn(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,f=i-r,c=s(f),u=i<=a;r=i;const d={loaded:i,total:a,progress:a?i/a:void 0,bytes:f,rate:c||void 0,estimated:c&&a&&u?(a-i)/c:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(d)},n)},ve=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Ce=t=>(...e)=>l.asap(()=>t(...e)),Nn=_.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,_.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(_.origin),_.navigator&&/(msie|trident)/i.test(_.navigator.userAgent)):()=>!0,Pn=_.hasStandardBrowserEnv?{write(t,e,n,r,s,o){const i=[t+"="+encodeURIComponent(e)];l.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),l.isString(r)&&i.push("path="+r),l.isString(s)&&i.push("domain="+s),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function In(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Mn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function tt(t,e,n){let r=!In(e);return t&&(r||n==!1)?Mn(t,e):e}const xe=t=>t instanceof O?{...t}:t;function L(t,e){e=e||{};const n={};function r(c,u,d,m){return l.isPlainObject(c)&&l.isPlainObject(u)?l.merge.call({caseless:m},c,u):l.isPlainObject(u)?l.merge({},u):l.isArray(u)?u.slice():u}function s(c,u,d,m){if(l.isUndefined(u)){if(!l.isUndefined(c))return r(void 0,c,d,m)}else return r(c,u,d,m)}function o(c,u){if(!l.isUndefined(u))return r(void 0,u)}function i(c,u){if(l.isUndefined(u)){if(!l.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in e)return r(c,u);if(d in t)return r(void 0,c)}const f={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(c,u,d)=>s(xe(c),xe(u),d,!0)};return l.forEach(Object.keys(Object.assign({},t,e)),function(u){const d=f[u]||s,m=d(t[u],e[u],u);l.isUndefined(m)&&d!==a||(n[u]=m)}),n}const nt=t=>{const e=L({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=e;e.headers=i=O.from(i),e.url=Xe(tt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let f;if(l.isFormData(n)){if(_.hasStandardBrowserEnv||_.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((f=i.getContentType())!==!1){const[c,...u]=f?f.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([c||"multipart/form-data",...u].join("; "))}}if(_.hasStandardBrowserEnv&&(r&&l.isFunction(r)&&(r=r(e)),r||r!==!1&&Nn(e.url))){const c=s&&o&&Pn.read(o);c&&i.set(s,c)}return e},kn=typeof XMLHttpRequest<"u",Ln=kn&&function(t){return new Promise(function(n,r){const s=nt(t);let o=s.data;const i=O.from(s.headers).normalize();let{responseType:a,onUploadProgress:f,onDownloadProgress:c}=s,u,d,m,g,p;function y(){g&&g(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function b(){if(!h)return;const E=O.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),R={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:E,config:t,request:h};et(function(P){n(P),y()},function(P){r(P),y()},R),h=null}"onloadend"in h?h.onloadend=b:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(b)},h.onabort=function(){h&&(r(new w("Request aborted",w.ECONNABORTED,t,h)),h=null)},h.onerror=function(){r(new w("Network Error",w.ERR_NETWORK,t,h)),h=null},h.ontimeout=function(){let v=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const R=s.transitional||Ye;s.timeoutErrorMessage&&(v=s.timeoutErrorMessage),r(new w(v,R.clarifyTimeoutError?w.ETIMEDOUT:w.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&l.forEach(i.toJSON(),function(v,R){h.setRequestHeader(R,v)}),l.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),a&&a!=="json"&&(h.responseType=s.responseType),c&&([m,p]=G(c,!0),h.addEventListener("progress",m)),f&&h.upload&&([d,g]=G(f),h.upload.addEventListener("progress",d),h.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(u=E=>{h&&(r(!E||E.type?new D(null,t,h):E),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const S=vn(s.url);if(S&&_.protocols.indexOf(S)===-1){r(new w("Unsupported protocol "+S+":",w.ERR_BAD_REQUEST,t));return}h.send(o||null)})},Fn=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const o=function(c){if(!s){s=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof w?u:new D(u instanceof Error?u.message:u))}};let i=e&&setTimeout(()=>{i=null,o(new w(`timeout ${e} of ms exceeded`,w.ETIMEDOUT))},e);const a=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(o):c.removeEventListener("abort",o)}),t=null)};t.forEach(c=>c.addEventListener("abort",o));const{signal:f}=r;return f.unsubscribe=()=>l.asap(a),f}},Bn=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},Dn=async function*(t,e){for await(const n of qn(t))yield*Bn(n,e)},qn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},Ne=(t,e,n,r)=>{const s=Dn(t,e);let o=0,i,a=f=>{i||(i=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:c,value:u}=await s.next();if(c){a(),f.close();return}let d=u.byteLength;if(n){let m=o+=d;n(m)}f.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(f){return a(f),s.return()}},{highWaterMark:2})},ne=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",rt=ne&&typeof ReadableStream=="function",Un=ne&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),st=(t,...e)=>{try{return!!t(...e)}catch{return!1}},jn=rt&&st(()=>{let t=!1;const e=new Request(_.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Pe=64*1024,fe=rt&&st(()=>l.isReadableStream(new Response("").body)),X={stream:fe&&(t=>t.body)};ne&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!X[e]&&(X[e]=l.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new w(`Response type '${e}' is not supported`,w.ERR_NOT_SUPPORT,r)})})})(new Response);const Hn=async t=>{if(t==null)return 0;if(l.isBlob(t))return t.size;if(l.isSpecCompliantForm(t))return(await new Request(_.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(l.isArrayBufferView(t)||l.isArrayBuffer(t))return t.byteLength;if(l.isURLSearchParams(t)&&(t=t+""),l.isString(t))return(await Un(t)).byteLength},$n=async(t,e)=>{const n=l.toFiniteNumber(t.getContentLength());return n??Hn(e)},zn=ne&&(async t=>{let{url:e,method:n,data:r,signal:s,cancelToken:o,timeout:i,onDownloadProgress:a,onUploadProgress:f,responseType:c,headers:u,withCredentials:d="same-origin",fetchOptions:m}=nt(t);c=c?(c+"").toLowerCase():"text";let g=Fn([s,o&&o.toAbortSignal()],i),p;const y=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let h;try{if(f&&jn&&n!=="get"&&n!=="head"&&(h=await $n(u,r))!==0){let R=new Request(e,{method:"POST",body:r,duplex:"half"}),N;if(l.isFormData(r)&&(N=R.headers.get("content-type"))&&u.setContentType(N),R.body){const[P,V]=ve(h,G(Ce(f)));r=Ne(R.body,Pe,P,V)}}l.isString(d)||(d=d?"include":"omit");const b="credentials"in Request.prototype;p=new Request(e,{...m,signal:g,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",credentials:b?d:void 0});let S=await fetch(p,m);const E=fe&&(c==="stream"||c==="response");if(fe&&(a||E&&y)){const R={};["status","statusText","headers"].forEach(we=>{R[we]=S[we]});const N=l.toFiniteNumber(S.headers.get("content-length")),[P,V]=a&&ve(N,G(Ce(a),!0))||[];S=new Response(Ne(S.body,Pe,P,()=>{V&&V(),y&&y()}),R)}c=c||"text";let v=await X[l.findKey(X,c)||"text"](S,t);return!E&&y&&y(),await new Promise((R,N)=>{et(R,N,{data:v,headers:O.from(S.headers),status:S.status,statusText:S.statusText,config:t,request:p})})}catch(b){throw y&&y(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new w("Network Error",w.ERR_NETWORK,t,p),{cause:b.cause||b}):w.from(b,b&&b.code,t,p)}}),de={http:sn,xhr:Ln,fetch:zn};l.forEach(de,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Ie=t=>`- ${t}`,Vn=t=>l.isFunction(t)||t===null||t===!1,ot={getAdapter:t=>{t=l.isArray(t)?t:[t];const{length:e}=t;let n,r;const s={};for(let o=0;o<e;o++){n=t[o];let i;if(r=n,!Vn(n)&&(r=de[(i=String(n)).toLowerCase()],r===void 0))throw new w(`Unknown adapter '${i}'`);if(r)break;s[i||"#"+o]=r}if(!r){const o=Object.entries(s).map(([a,f])=>`adapter ${a} `+(f===!1?"is not supported by the environment":"is not available in the build"));let i=e?o.length>1?`since :
`+o.map(Ie).join(`
`):" "+Ie(o[0]):"as no adapter specified";throw new w("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:de};function ae(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new D(null,t)}function Me(t){return ae(t),t.headers=O.from(t.headers),t.data=ie.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),ot.getAdapter(t.adapter||z.adapter)(t).then(function(r){return ae(t),r.data=ie.call(t,t.transformResponse,r),r.headers=O.from(r.headers),r},function(r){return Ze(r)||(ae(t),r&&r.response&&(r.response.data=ie.call(t,t.transformResponse,r.response),r.response.headers=O.from(r.response.headers))),Promise.reject(r)})}const it="1.10.0",re={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{re[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const ke={};re.transitional=function(e,n,r){function s(o,i){return"[Axios v"+it+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,a)=>{if(e===!1)throw new w(s(i," has been removed"+(n?" in "+n:"")),w.ERR_DEPRECATED);return n&&!ke[i]&&(ke[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,i,a):!0}};re.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function Jn(t,e,n){if(typeof t!="object")throw new w("options must be an object",w.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const o=r[s],i=e[o];if(i){const a=t[o],f=a===void 0||i(a,o,t);if(f!==!0)throw new w("option "+o+" must be "+f,w.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new w("Unknown option "+o,w.ERR_BAD_OPTION)}}const W={assertOptions:Jn,validators:re},x=W.validators;let k=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ae,response:new Ae}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
`+o):r.stack=o}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=L(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&W.assertOptions(r,{silentJSONParsing:x.transitional(x.boolean),forcedJSONParsing:x.transitional(x.boolean),clarifyTimeoutError:x.transitional(x.boolean)},!1),s!=null&&(l.isFunction(s)?n.paramsSerializer={serialize:s}:W.assertOptions(s,{encode:x.function,serialize:x.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),W.assertOptions(n,{baseUrl:x.spelling("baseURL"),withXsrfToken:x.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&l.merge(o.common,o[n.method]);o&&l.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=O.concat(i,o);const a=[];let f=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(f=f&&y.synchronous,a.unshift(y.fulfilled,y.rejected))});const c=[];this.interceptors.response.forEach(function(y){c.push(y.fulfilled,y.rejected)});let u,d=0,m;if(!f){const p=[Me.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,c),m=p.length,u=Promise.resolve(n);d<m;)u=u.then(p[d++],p[d++]);return u}m=a.length;let g=n;for(d=0;d<m;){const p=a[d++],y=a[d++];try{g=p(g)}catch(h){y.call(this,h);break}}try{u=Me.call(this,g)}catch(p){return Promise.reject(p)}for(d=0,m=c.length;d<m;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=L(this.defaults,e);const n=tt(e.baseURL,e.url,e.allowAbsoluteUrls);return Xe(n,e.params,e.paramsSerializer)}};l.forEach(["delete","get","head","options"],function(e){k.prototype[e]=function(n,r){return this.request(L(r||{},{method:e,url:n,data:(r||{}).data}))}});l.forEach(["post","put","patch"],function(e){function n(r){return function(o,i,a){return this.request(L(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}k.prototype[e]=n(),k.prototype[e+"Form"]=n(!0)});let Kn=class at{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(a=>{r.subscribe(a),o=a}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},e(function(o,i,a){r.reason||(r.reason=new D(o,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new at(function(s){e=s}),cancel:e}}};function Wn(t){return function(n){return t.apply(null,n)}}function Gn(t){return l.isObject(t)&&t.isAxiosError===!0}const he={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(he).forEach(([t,e])=>{he[e]=t});function ct(t){const e=new k(t),n=De(k.prototype.request,e);return l.extend(n,k.prototype,e,{allOwnKeys:!0}),l.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return ct(L(t,s))},n}const T=ct(z);T.Axios=k;T.CanceledError=D;T.CancelToken=Kn;T.isCancel=Ze;T.VERSION=it;T.toFormData=te;T.AxiosError=w;T.Cancel=T.CanceledError;T.all=function(e){return Promise.all(e)};T.spread=Wn;T.isAxiosError=Gn;T.mergeConfig=L;T.AxiosHeaders=O;T.formToJSON=t=>Qe(l.isHTMLForm(t)?new FormData(t):t);T.getAdapter=ot.getAdapter;T.HttpStatusCode=he;T.default=T;const{Axios:nr,AxiosError:rr,CanceledError:sr,isCancel:or,CancelToken:ir,VERSION:ar,all:cr,Cancel:lr,isAxiosError:ur,spread:fr,toFormData:dr,AxiosHeaders:hr,HttpStatusCode:pr,formToJSON:mr,getAdapter:yr,mergeConfig:gr}=T,Le=T.create({baseURL:"https://notable-recently-seagull.ngrok-free.app/api/v1/",headers:{"Content-Type":"application/json"}});class Xn{async sendSingleMessage(e){try{const{data:n}=await Le.post("/messages",e);return console.log("[NestJS] Response (single):",n),n}catch(n){throw console.error("[NestJS] Error (single):",n),n}}async sendBulkMessages(e){try{const{data:n}=await Le.post("/messages/bulk",{data:e});return console.log("[NestJS] Response (bulk):",n),n}catch(n){throw console.error("[NestJS] Error (bulk):",n),n}}}const pe=new Xn;class Yn{MY_NAME="Apactech com";lastMessage;initialHistories=[];elTags={container_scroll:"/html/body/div[1]/div/div/div/div[5]/div[1]/div[1]/div[2]/div[1]/div[1]/div",conatainer_conversations:"/html/body/div[1]/div/div/div/div[5]/div[1]/div[1]/div[2]/div[1]/div[1]/div/div[1]",container_chat:'[data-testid="message-wrapper"]',root_id:'[aria-selected="true"] [id^="chat-list-item"]',room_name:'[data-tid="chat-title"]',close_reply_btn:'[data-track-action-scenario="messageQuotedReplyDismissed"]',reply_btn:'[aria-label="Reply"]',chat_input:'[placeholder="Type a message"]'};getCurrentRoomInfo(){const e=document.querySelector(this.elTags.root_id)?.id?.replace("chat-list-item_",""),n=document.querySelector(this.elTags.room_name)?.innerText;return{room_id:e,room_name:n}}_getMessageByEl(e){if(!e)return"";let n=e.innerText||"";const r=e.querySelector("img[data-gallery-src]");if(r)return r.getAttribute("data-gallery-src")||"";const o=Array.from(e.querySelectorAll("img[itemtype]")).map(i=>i.getAttribute("alt")||"").filter(Boolean);return o.length&&(n+=o.join("")),n.trim()}parseMessageElement(e,n=!1){const r=e.querySelector(n?".fui-ChatMyMessage__timestamp":".fui-ChatMessage__timestamp"),s=e.querySelector(n?".fui-ChatMyMessage__author":".fui-ChatMessage__author");if(!r)return null;const o=r.getAttribute("datetime");if(!o)return null;const i=Number.isNaN(r.id.replace("timestamp-",""))?new Date(o).getTime():Number(r.id.replace("timestamp-","")),a=document.querySelector(`#content-${i}`),{room_id:f,room_name:c}=this.getCurrentRoomInfo();return{name:s?.innerText,message:this._getMessageByEl(a),time:i,room_id:f,room_name:c,date_time:new Date(o).getTime()}}extractAllMessages(){const e=Array.from(document.querySelectorAll(".fui-ChatMyMessage")).map(r=>this.parseMessageElement(r,!0)).filter(r=>r!==null),n=Array.from(document.querySelectorAll(".fui-ChatMessage")).map(r=>this.parseMessageElement(r,!1)).filter(r=>r!==null);return console.log({myMessages:e,otherMessages:n}),[...e,...n].sort((r,s)=>r.time-s.time)}handleNewMessage(e){console.log("%c[New incoming message]","color: #007acc;",e)}async detectNewMessages(){const e=this.extractAllMessages(),n=e.findIndex(o=>o.time===this.lastMessage?.time),r=e.slice(n+1);if(r.length===0){console.log("[Monitor] No new messages...");return}const s=r[0];s.name===this.MY_NAME?(console.log("[Monitor] My new message:",s),await pe.sendSingleMessage(s)):(console.log("[Monitor] New incoming message:",s),this.handleNewMessage(s),pe.sendSingleMessage(s)),this.lastMessage=e.pop()}async start(e=1e4){console.log("[Monitor] Starting..."),this.initialHistories=this.extractAllMessages(),this.lastMessage=this.initialHistories.pop(),setInterval(async()=>await this.detectNewMessages(),e)}async _getConversationsInfo(e=this.elTags.conatainer_conversations){const n=document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;return n?Array.from(n.children).filter(o=>o.getAttribute("role")==="none").map(o=>{const i=o.id||null,a=`title-chat-list-item_${i}`,c=document.getElementById(a)?.innerText||null;let u=null;return i?.includes("@thread.skype")?u="group":i?.includes("@oneToOne.skype")?u="personal":u="group",{id:i,name:c,type:u}}):(console.log("Không tìm thấy phần tử theo XPath."),[])}async _scrollToBottomByXPath(e=this.elTags.container_scroll,n){const{maxStableRounds:r=5,delay:s=300,maxScrolls:o=100}=n||{},i=document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;if(!i){console.warn("❌ Không tìm thấy phần tử với XPath:",e);return}return new Promise(a=>{let f=-1,c=0,u=0;const d=setInterval(()=>{const m=i.scrollHeight;i.scrollTop=m,m===f?c++:(c=0,f=m),u++,(c>=r||u>=o)&&(clearInterval(d),a())},s)})}async handleGetConversations(){return await this._scrollToBottomByXPath(),this._getConversationsInfo()}}class Qn{axios=null;constructor(){this.axios=T.create({baseURL:"MyCoolApp",headers:{"Content-Type":"application/json"}})}async send(e){if(!this.axios)return null;const{data:n}=await this.axios({method:"POST",url:"type",data:{message:e}});return n}}const Fe=new Qn;function j(t){return new Promise(e=>setTimeout(e,t))}class Zn{service;port;constructor(e){this.service=new Yn,this.port=e}_forceHeightObserver;getElementByXPath(e){return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}forceHeight(e,n="100px"){if(!e)return;e.style.setProperty("height",n,"important"),e.style.setProperty("resize","none","important");const r=()=>{e.style.setProperty("height",n,"important")};e.addEventListener("focus",r),e.addEventListener("input",r),e.addEventListener("blur",r);const s=new MutationObserver(()=>{e.style.setProperty("height",n,"important")});s.observe(e,{attributes:!0,attributeFilter:["style"]}),this._forceHeightObserver=s}_clickToConversation(e){const n=document.getElementById(`chat-list-item_${e}`);return n&&(n.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>n.click(),200)),n?.click()}async _waitForMessagesToAppear(e=1e4){return new Promise((n,r)=>{const s=document.getElementById("chat-pane-list");let o=null;if(!s)return r(new Error("#chat-pane-list not found"));const i=()=>Array.from(s.children),a=()=>{const c=i();c.length>0&&(f.disconnect(),o&&clearTimeout(o),n(c))},f=new MutationObserver(()=>{a()});f.observe(s,{childList:!0,subtree:!0}),a(),o=setTimeout(()=>{f.disconnect(),r(new Error("Timeout waiting for chat messages to appear"))},e)})}async _waitForNewMessages(e,n=1e4){return new Promise((r,s)=>{const o=document.getElementById("chat-pane-list");if(!o)return s(new Error("#chat-pane-list not found"));const i=()=>Array.from(o.children),a=new Set(e);let f=null;const c=new MutationObserver(()=>{const d=i().filter(m=>!a.has(m));d.length>0&&(c.disconnect(),f&&clearTimeout(f),r(d))});c.observe(o,{childList:!0,subtree:!0}),f=setTimeout(()=>{c.disconnect(),s(new Error("Timeout waiting for new messages"))},n)})}async _waitToloadMessages(e=300){return new Promise(n=>{const r=document.getElementById("chat-pane-list");if(!r)throw new Error("#chat-pane-list not found");let s=null,o=[];const i=new MutationObserver(()=>{s&&clearTimeout(s),o=Array.from(r.children),s=setTimeout(()=>{i.disconnect(),n(o)},e)});i.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0})})}_getTypeGeo(){const e=document.querySelector(".ck-placeholder");if(e){const n=e.getBoundingClientRect();return{top:n.top,left:n.left,right:n.right,bottom:n.bottom,width:n.width,height:n.height}}return null}async _rightClickMessage(e){const n=this.service.elTags.container_chat,r=`content-${e}`,s=30,o=200;let i=0,a=document.querySelector(n);if(!a){console.error("Wrapper not found:",n);return}let f=document.querySelector(`#${r}`);for(;!f&&i<s;){const d=a,m=d.scrollTop;if(d.scrollTop=Math.max(0,d.scrollTop-o),await j(200),a=document.querySelector(n),!a||(f=a.querySelector(`#${r}`),d.scrollTop===m))break;i++}if(!f){console.log({element:f}),console.error("Không tìm thấy phần tử:",r);return}f.scrollIntoView({behavior:"auto",block:"center"}),await j(100);const c=f.getBoundingClientRect(),u=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,view:window,button:2,buttons:2,clientX:c.left+c.width/2,clientY:c.top+c.height/2});f.dispatchEvent(u)}_clickIfExists(e){return new Promise(n=>{const r=document.querySelector(e);r?(r.scrollIntoView({behavior:"auto",block:"center"}),setTimeout(()=>{r?.click(),n(!0)},100)):(console.warn("Không tìm thấy phần tử:",e),n(!1))})}async getConversations(e){q.add(async()=>{console.log("[Queue] Handling GET_CONVERSATIONS");const n=await this.service.handleGetConversations();this.port.postMessage({type:"socket-response",event:F.RECEIVE_CONVERSATIONS,data:n})})}async getConversation(e){q.add(async()=>{if(console.log("[Queue] Handling GET_CONVERSATION"),!e.data?.id)return;const{room_id:n}=this.service.getCurrentRoomInfo();n!=e.data.id&&(this._clickToConversation(e.data.id),await this._waitForMessagesToAppear(),await this._waitToloadMessages());const r=this.service.extractAllMessages();this.port.postMessage({type:"socket-response",event:F.RECEIVE_CONVERSATION,data:r})})}async sendMessage({data:{conversation_id:e,message:n}}){q.add(async()=>{console.log("[Queue] Handling SEND_MESSAGE");const{room_id:r}=this.service.getCurrentRoomInfo();r!=e&&this._clickToConversation(e),await j(200),await Fe.send(n)})}async replyMessage({data:{conversation_id:e,message:n,time:r}}){q.add(async()=>{console.log("[Queue] Handling REPLY_MESSAGE");const{room_id:s}=this.service.getCurrentRoomInfo();s!=e&&(this._clickToConversation(e),await this._waitForMessagesToAppear(),await this._waitToloadMessages()),await this._clickIfExists(this.service.elTags.close_reply_btn),await this._rightClickMessage(r);const o=document.querySelector(this.service.elTags.reply_btn);o&&o.click(),await j(200),console.log({message:n}),await Fe.send(n)})}fixedHeightChatInput(e=20,n=1e3){(()=>{const s=document.querySelector(this.service.elTags.chat_input);s?(this.forceHeight(s,"100px"),console.log("✔ Fixed height applied to chat input")):e>0?setTimeout(()=>this.fixedHeightChatInput(e-1,n),n):console.warn("✘ Element not found with provided XPath after retries")})()}async detectNewMessage(e=2e3){console.log("[Monitor] Starting..."),setInterval(async()=>{const n=document.querySelector('[aria-labelledby^="cn-normal-notification-main-content-"]')?.getAttribute("aria-labelledby");if(!n){console.log("No new message...");return}const r=n.split(" ")[0].replaceAll("cn-normal-notification-main-content-","");r&&(console.log({room_id:r,aria_value:n}),q.add(async()=>{console.log("[Queue] Handling SYNC NEW MESSAGE"),this._clickToConversation(r),await j(2e3);const o=this.service.extractAllMessages().at(-1);o&&await pe.sendSingleMessage(o)}))},e)}startSyncConversations(){setInterval(()=>this.getConversations(),2e4)}}const lt=chrome.runtime.connect({name:"message"}),I=new Zn(lt);lt.onMessage.addListener(t=>{if(console.log({msg:t}),I.fixedHeightChatInput(),t.type==="socket")switch(t.event){case F.GET_CONVERSATIONS:{I.getConversations(t);break}case F.GET_CONVERSATION:{I.getConversation(t);break}case F.SEND_MESSAGE:{I.sendMessage(t);break}case F.REPLY_MESSAGE:{I.replyMessage(t);break}}});I.detectNewMessage();I.startSyncConversations();