listing-facebook/auto-listing-facebook-marke.../composer-bot-extensions/content.js

7 lines
53 KiB
JavaScript

const L={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,a,u){this.fn=f,this.context=a,this.once=u||!1}function i(f,a,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+a:a;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 o(f,a){--f._eventsCount===0?f._events=new r:delete f._events[a]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var a=[],u,d;if(this._eventsCount===0)return a;for(d in u=this._events)e.call(u,d)&&a.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(u)):a},l.prototype.listeners=function(a){var u=n?n+a:a,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},l.prototype.listenerCount=function(a){var u=n?n+a:a,d=this._events[u];return d?d.fn?1:d.length:0},l.prototype.emit=function(a,u,d,m,g,p){var y=n?n+a:a;if(!this._events[y])return!1;var h=this._events[y],b=arguments.length,S,E;if(h.fn){switch(h.once&&this.removeListener(a,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 A=h.length,v;for(E=0;E<A;E++)switch(h[E].once&&this.removeListener(a,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(v=1,S=new Array(b-1);v<b;v++)S[v-1]=arguments[v];h[E].fn.apply(h[E].context,S)}}return!0},l.prototype.on=function(a,u,d){return i(this,a,u,d,!1)},l.prototype.once=function(a,u,d){return i(this,a,u,d,!0)},l.prototype.removeListener=function(a,u,d,m){var g=n?n+a:a;if(!this._events[g])return this;if(!u)return o(this,g),this;var p=this._events[g];if(p.fn)p.fn===u&&(!m||p.once)&&(!d||p.context===d)&&o(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:o(this,g)}return this},l.prototype.removeAllListeners=function(a){var u;return a?(u=n?n+a:a,this._events[u]&&o(this,u)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l}(se)),se.exports}var dt=ft();const ht=ut(dt);class De 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:i={setTimeout,clearTimeout}}=e;let o,l;const a=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)),l=()=>{d(Se(g))},g.addEventListener("abort",l,{once:!0})}if(n===Number.POSITIVE_INFINITY){t.then(u,d);return}const m=new De;o=i.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(()=>{a.clear(),l&&e.signal&&e.signal.removeEventListener("abort",l)});return a.clear=()=>{i.clearTimeout.call(void 0,o),o=void 0},a}function yt(t,e,n){let r=0,s=t.length;for(;s>0;){const i=Math.trunc(s/2);let o=r+i;n(t[o],e)<=0?(r=++o,s-=i+1):s=i}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,(i,o)=>o.priority-i.priority);this.#e.splice(s,0,r)}setPriority(e,n){const r=this.#e.findIndex(i=>i.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;#o;#i=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.#o=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.#o||this.#i<this.#h}get#S(){return this.#r<this.#l}#T(){this.#r--,this.#u(),this.emit("next")}#v(){this.#w(),this.#g(),this.#c=void 0}get#R(){const e=Date.now();if(this.#n===void 0){const n=this.#p-e;if(n<0)this.#i=this.#e?this.#r:0;else return this.#c===void 0&&(this.#c=setTimeout(()=>{this.#v()},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.#R;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.#o||this.#n!==void 0||(this.#n=setInterval(()=>{this.#w()},this.#a),this.#p=Date.now()+this.#a)}#w(){this.#i===0&&this.#r===0&&this.#n&&(clearInterval(this.#n),this.#n=void 0),this.#i=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#_(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.#i++;try{n.signal?.throwIfAborted();let i=e({signal:n.signal});n.timeout&&(i=mt(Promise.resolve(i),{milliseconds:n.timeout})),n.signal&&(i=Promise.race([i,this.#_(n.signal)]));const o=await i;r(o),this.emit("completed",o)}catch(i){if(i instanceof De&&!n.throwOnTimeout){r();return}s(i),this.emit("error",i)}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 $=new wt({concurrency:1});function Be(t,e){return function(){return t.apply(e,arguments)}}const{toString:Et}=Object.prototype,{getPrototypeOf:me}=Object,{iterator:Y,toStringTag:Ue}=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:F}=Array,q=Z("undefined");function bt(t){return t!==null&&!q(t)&&t.constructor!==null&&!q(t.constructor)&&_(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const qe=C("ArrayBuffer");function St(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&qe(t.buffer),e}const Tt=Z("string"),_=Z("function"),je=Z("number"),ee=t=>t!==null&&typeof t=="object",vt=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)&&!(Ue in t)&&!(Y in t)},Rt=C("Date"),_t=C("File"),Ot=C("Blob"),At=C("FileList"),Ct=t=>ee(t)&&_(t.pipe),xt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||_(t.append)&&((e=Q(t))==="formdata"||e==="object"&&_(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 j(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),F(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let l;for(r=0;r<o;r++)l=i[r],e.call(null,t[l],l,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 I=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ve=t=>!q(t)&&t!==I;function le(){const{caseless:t}=Ve(this)&&this||{},e={},n=(r,s)=>{const i=t&&He(e,s)||s;J(e[i])&&J(r)?e[i]=le(e[i],r):J(r)?e[i]=le({},r):F(r)?e[i]=r.slice():e[i]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&j(arguments[r],n);return e}const Ft=(t,e,n,{allOwnKeys:r}={})=>(j(e,(s,i)=>{n&&_(s)?t[i]=Be(s,n):t[i]=s},{allOwnKeys:r}),t),Dt=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Bt=(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)},Ut=(t,e,n,r)=>{let s,i,o;const l={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)o=s[i],(!r||r(o,t,e))&&!l[o]&&(e[o]=t[o],l[o]=!0);t=n!==!1&&me(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},qt=(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(F(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)),Vt=(t,e)=>{const r=(t&&t[Y]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},$t=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},zt=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),Xt=C("RegExp"),$e=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};j(n,(s,i)=>{let o;(o=e(s,i,t))!==!1&&(r[i]=o||s)}),Object.defineProperties(t,r)},Kt=t=>{$e(t,(e,n)=>{if(_(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(_(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+"'")})}})},Wt=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return F(t)?r(t):r(String(t).split(e)),n},Gt=()=>{},Yt=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Qt(t){return!!(t&&_(t.append)&&t[Ue]==="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 i=F(r)?[]:{};return j(r,(o,l)=>{const f=n(o,s+1);!q(f)&&(i[l]=f)}),e[s]=void 0,i}}return r};return n(t,0)},en=C("AsyncFunction"),tn=t=>t&&(ee(t)||_(t))&&_(t.then)&&_(t.catch),ze=((t,e)=>t?setImmediate:e?((n,r)=>(I.addEventListener("message",({source:s,data:i})=>{s===I&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),I.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",_(I.postMessage)),nn=typeof queueMicrotask<"u"?queueMicrotask.bind(I):typeof process<"u"&&process.nextTick||ze,rn=t=>t!=null&&_(t[Y]),c={isArray:F,isArrayBuffer:qe,isBuffer:bt,isFormData:xt,isArrayBufferView:St,isString:Tt,isNumber:je,isBoolean:vt,isObject:ee,isPlainObject:J,isReadableStream:Pt,isRequest:It,isResponse:Mt,isHeaders:kt,isUndefined:q,isDate:Rt,isFile:_t,isBlob:Ot,isRegExp:Xt,isFunction:_,isStream:Ct,isURLSearchParams:Nt,isTypedArray:Ht,isFileList:At,forEach:j,merge:le,extend:Ft,trim:Lt,stripBOM:Dt,inherits:Bt,toFlatObject:Ut,kindOf:Q,kindOfTest:C,endsWith:qt,toArray:jt,forEachEntry:Vt,matchAll:$t,isHTMLForm:zt,hasOwnProperty:Te,hasOwnProp:Te,reduceDescriptors:$e,freezeMethods:Kt,toObjectSet:Wt,toCamelCase:Jt,noop:Gt,toFiniteNumber:Yt,findKey:He,global:I,isContextDefined:Ve,isSpecCompliantForm:Qt,toJSONObject:Zt,isAsyncFn:en,isThenable:tn,setImmediate:ze,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)}c.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:c.toJSONObject(this.config),code:this.code,status:this.status}}});const Je=w.prototype,Xe={};["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=>{Xe[t]={value:t}});Object.defineProperties(w,Xe);Object.defineProperty(Je,"isAxiosError",{value:!0});w.from=(t,e,n,r,s,i)=>{const o=Object.create(Je);return c.toFlatObject(t,o,function(f){return f!==Error.prototype},l=>l!=="isAxiosError"),w.call(o,t.message,e,n,r,s),o.cause=t,o.name=t.name,i&&Object.assign(o,i),o};const sn=null;function ue(t){return c.isPlainObject(t)||c.isArray(t)}function Ke(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function ve(t,e,n){return t?t.concat(e).map(function(s,i){return s=Ke(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function on(t){return c.isArray(t)&&!t.some(ue)}const an=c.toFlatObject(c,{},null,function(e){return/^is[A-Z]/.test(e)});function te(t,e,n){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=c.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,h){return!c.isUndefined(h[y])});const r=n.metaTokens,s=n.visitor||u,i=n.dots,o=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(e);if(!c.isFunction(s))throw new TypeError("visitor must be a function");function a(p){if(p===null)return"";if(c.isDate(p))return p.toISOString();if(c.isBoolean(p))return p.toString();if(!f&&c.isBlob(p))throw new w("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(p)||c.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(c.endsWith(y,"{}"))y=r?y:y.slice(0,-2),p=JSON.stringify(p);else if(c.isArray(p)&&on(p)||(c.isFileList(p)||c.endsWith(y,"[]"))&&(b=c.toArray(p)))return y=Ke(y),b.forEach(function(E,A){!(c.isUndefined(E)||E===null)&&e.append(o===!0?ve([y],A,i):o===null?y:y+"[]",a(E))}),!1}return ue(p)?!0:(e.append(ve(h,y,i),a(p)),!1)}const d=[],m=Object.assign(an,{defaultVisitor:u,convertValue:a,isVisitable:ue});function g(p,y){if(!c.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(p),c.forEach(p,function(b,S){(!(c.isUndefined(b)||b===null)&&s.call(e,b,c.isString(S)?S.trim():S,y,m))===!0&&g(b,y?y.concat(S):[S])}),d.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return g(t),e}function Re(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 We=ye.prototype;We.append=function(e,n){this._pairs.push([e,n])};We.toString=function(e){const n=e?function(r){return e.call(this,r,Re)}:Re;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 Ge(t,e,n){if(!e)return t;const r=n&&n.encode||cn;c.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=c.isURLSearchParams(e)?e.toString():new ye(e,n).toString(r),i){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class _e{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){c.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",fe=typeof navigator=="object"&&navigator||void 0,hn=ge&&(!fe||["ReactNative","NativeScript","NS"].indexOf(fe.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:fe,origin:mn},Symbol.toStringTag,{value:"Module"})),R={...yn,...dn};function gn(t,e){return te(t,new R.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,i){return R.isNode&&c.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function wn(t){return c.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 i;for(r=0;r<s;r++)i=n[r],e[i]=t[i];return e}function Qe(t){function e(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),f=i>=n.length;return o=!o&&c.isArray(s)?s.length:o,f?(c.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!c.isObject(s[o]))&&(s[o]=[]),e(n,r,s[o],i)&&c.isArray(s[o])&&(s[o]=En(s[o])),!l)}if(c.isFormData(t)&&c.isFunction(t.entries)){const n={};return c.forEachEntry(t,(r,s)=>{e(wn(r),s,n,0)}),n}return null}function bn(t,e,n){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const H={transitional:Ye,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=c.isObject(e);if(i&&c.isHTMLForm(e)&&(e=new FormData(e)),c.isFormData(e))return s?JSON.stringify(Qe(e)):e;if(c.isArrayBuffer(e)||c.isBuffer(e)||c.isStream(e)||c.isFile(e)||c.isBlob(e)||c.isReadableStream(e))return e;if(c.isArrayBufferView(e))return e.buffer;if(c.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return gn(e,this.formSerializer).toString();if((l=c.isFileList(e))||r.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return te(l?{"files[]":e}:e,f&&new f,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),bn(e)):e}],transformResponse:[function(e){const n=this.transitional||H.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(c.isResponse(e)||c.isReadableStream(e))return e;if(e&&c.isString(e)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(l){if(o)throw l.name==="SyntaxError"?w.from(l,w.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:R.classes.FormData,Blob:R.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch"],t=>{H.headers[t]={}});const Sn=c.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(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.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 B(t){return t&&String(t).trim().toLowerCase()}function X(t){return t===!1||t==null?t:c.isArray(t)?t.map(X):String(t)}function vn(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 Rn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function ie(t,e,n,r,s){if(c.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!c.isString(e)){if(c.isString(r))return e.indexOf(r)!==-1;if(c.isRegExp(r))return r.test(e)}}function _n(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function On(t,e){const n=c.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}let O=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(l,f,a){const u=B(f);if(!u)throw new Error("header name must be a non-empty string");const d=c.findKey(s,u);(!d||s[d]===void 0||a===!0||a===void 0&&s[d]!==!1)&&(s[d||f]=X(l))}const o=(l,f)=>c.forEach(l,(a,u)=>i(a,u,f));if(c.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(c.isString(e)&&(e=e.trim())&&!Rn(e))o(Tn(e),n);else if(c.isObject(e)&&c.isIterable(e)){let l={},f,a;for(const u of e){if(!c.isArray(u))throw TypeError("Object iterator must return a key-value pair");l[a=u[0]]=(f=l[a])?c.isArray(f)?[...f,u[1]]:[f,u[1]]:u[1]}o(l,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=B(e),e){const r=c.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return vn(s);if(c.isFunction(n))return n.call(this,s,r);if(c.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=B(e),e){const r=c.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||ie(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(o){if(o=B(o),o){const l=c.findKey(r,o);l&&(!n||ie(r,r[l],l,n))&&(delete r[l],s=!0)}}return c.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||ie(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return c.forEach(this,(s,i)=>{const o=c.findKey(r,i);if(o){n[o]=X(s),delete n[i];return}const l=e?_n(i):String(i).trim();l!==i&&delete n[i],n[l]=X(s),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return c.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&c.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 i(o){const l=B(o);r[l]||(On(s,o),r[l]=!0)}return c.isArray(e)?e.forEach(i):i(e),this}};O.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);c.reduceDescriptors(O.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});c.freezeMethods(O);function oe(t,e){const n=this||H,r=e||n,s=O.from(r.headers);let i=r.data;return c.forEach(t,function(l){i=l.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}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"}c.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 An(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,i=0,o;return e=e!==void 0?e:1e3,function(f){const a=Date.now(),u=r[i];o||(o=a),n[s]=f,r[s]=a;let d=i,m=0;for(;d!==s;)m+=n[d++],d=d%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),a-o<e)return;const g=u&&a-u;return g?Math.round(m*1e3/g):void 0}}function xn(t,e){let n=0,r=1e3/e,s,i;const o=(a,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),t.apply(null,a)};return[(...a)=>{const u=Date.now(),d=u-n;d>=r?o(a,u):(s=a,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}const W=(t,e,n=3)=>{let r=0;const s=Cn(50,250);return xn(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,f=o-r,a=s(f),u=o<=l;r=o;const d={loaded:o,total:l,progress:l?o/l:void 0,bytes:f,rate:a||void 0,estimated:a&&l&&u?(l-o)/a:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(d)},n)},Ae=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Ce=t=>(...e)=>c.asap(()=>t(...e)),Nn=R.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,R.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(R.origin),R.navigator&&/(msie|trident)/i.test(R.navigator.userAgent)):()=>!0,Pn=R.hasStandardBrowserEnv?{write(t,e,n,r,s,i){const o=[t+"="+encodeURIComponent(e)];c.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),c.isString(r)&&o.push("path="+r),c.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.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 k(t,e){e=e||{};const n={};function r(a,u,d,m){return c.isPlainObject(a)&&c.isPlainObject(u)?c.merge.call({caseless:m},a,u):c.isPlainObject(u)?c.merge({},u):c.isArray(u)?u.slice():u}function s(a,u,d,m){if(c.isUndefined(u)){if(!c.isUndefined(a))return r(void 0,a,d,m)}else return r(a,u,d,m)}function i(a,u){if(!c.isUndefined(u))return r(void 0,u)}function o(a,u){if(c.isUndefined(u)){if(!c.isUndefined(a))return r(void 0,a)}else return r(void 0,u)}function l(a,u,d){if(d in e)return r(a,u);if(d in t)return r(void 0,a)}const f={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(a,u,d)=>s(xe(a),xe(u),d,!0)};return c.forEach(Object.keys(Object.assign({},t,e)),function(u){const d=f[u]||s,m=d(t[u],e[u],u);c.isUndefined(m)&&d!==l||(n[u]=m)}),n}const nt=t=>{const e=k({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=e;e.headers=o=O.from(o),e.url=Ge(tt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let f;if(c.isFormData(n)){if(R.hasStandardBrowserEnv||R.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((f=o.getContentType())!==!1){const[a,...u]=f?f.split(";").map(d=>d.trim()).filter(Boolean):[];o.setContentType([a||"multipart/form-data",...u].join("; "))}}if(R.hasStandardBrowserEnv&&(r&&c.isFunction(r)&&(r=r(e)),r||r!==!1&&Nn(e.url))){const a=s&&i&&Pn.read(i);a&&o.set(s,a)}return e},kn=typeof XMLHttpRequest<"u",Ln=kn&&function(t){return new Promise(function(n,r){const s=nt(t);let i=s.data;const o=O.from(s.headers).normalize();let{responseType:l,onUploadProgress:f,onDownloadProgress:a}=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()),v={data:!l||l==="text"||l==="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()},v),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 A=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const v=s.transitional||Ye;s.timeoutErrorMessage&&(A=s.timeoutErrorMessage),r(new w(A,v.clarifyTimeoutError?w.ETIMEDOUT:w.ECONNABORTED,t,h)),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&c.forEach(o.toJSON(),function(A,v){h.setRequestHeader(v,A)}),c.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),l&&l!=="json"&&(h.responseType=s.responseType),a&&([m,p]=W(a,!0),h.addEventListener("progress",m)),f&&h.upload&&([d,g]=W(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=An(s.url);if(S&&R.protocols.indexOf(S)===-1){r(new w("Unsupported protocol "+S+":",w.ERR_BAD_REQUEST,t));return}h.send(i||null)})},Fn=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(a){if(!s){s=!0,l();const u=a instanceof Error?a:this.reason;r.abort(u instanceof w?u:new D(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,i(new w(`timeout ${e} of ms exceeded`,w.ETIMEDOUT))},e);const l=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(a=>{a.unsubscribe?a.unsubscribe(i):a.removeEventListener("abort",i)}),t=null)};t.forEach(a=>a.addEventListener("abort",i));const{signal:f}=r;return f.unsubscribe=()=>c.asap(l),f}},Dn=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},Bn=async function*(t,e){for await(const n of Un(t))yield*Dn(n,e)},Un=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=Bn(t,e);let i=0,o,l=f=>{o||(o=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:a,value:u}=await s.next();if(a){l(),f.close();return}let d=u.byteLength;if(n){let m=i+=d;n(m)}f.enqueue(new Uint8Array(u))}catch(a){throw l(a),a}},cancel(f){return l(f),s.return()}},{highWaterMark:2})},ne=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",rt=ne&&typeof ReadableStream=="function",qn=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(R.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Pe=64*1024,de=rt&&st(()=>c.isReadableStream(new Response("").body)),G={stream:de&&(t=>t.body)};ne&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!G[e]&&(G[e]=c.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(c.isBlob(t))return t.size;if(c.isSpecCompliantForm(t))return(await new Request(R.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(c.isArrayBufferView(t)||c.isArrayBuffer(t))return t.byteLength;if(c.isURLSearchParams(t)&&(t=t+""),c.isString(t))return(await qn(t)).byteLength},Vn=async(t,e)=>{const n=c.toFiniteNumber(t.getContentLength());return n??Hn(e)},$n=ne&&(async t=>{let{url:e,method:n,data:r,signal:s,cancelToken:i,timeout:o,onDownloadProgress:l,onUploadProgress:f,responseType:a,headers:u,withCredentials:d="same-origin",fetchOptions:m}=nt(t);a=a?(a+"").toLowerCase():"text";let g=Fn([s,i&&i.toAbortSignal()],o),p;const y=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let h;try{if(f&&jn&&n!=="get"&&n!=="head"&&(h=await Vn(u,r))!==0){let v=new Request(e,{method:"POST",body:r,duplex:"half"}),N;if(c.isFormData(r)&&(N=v.headers.get("content-type"))&&u.setContentType(N),v.body){const[P,V]=Ae(h,W(Ce(f)));r=Ne(v.body,Pe,P,V)}}c.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=de&&(a==="stream"||a==="response");if(de&&(l||E&&y)){const v={};["status","statusText","headers"].forEach(we=>{v[we]=S[we]});const N=c.toFiniteNumber(S.headers.get("content-length")),[P,V]=l&&Ae(N,W(Ce(l),!0))||[];S=new Response(Ne(S.body,Pe,P,()=>{V&&V(),y&&y()}),v)}a=a||"text";let A=await G[c.findKey(G,a)||"text"](S,t);return!E&&y&&y(),await new Promise((v,N)=>{et(v,N,{data:A,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)}}),he={http:sn,xhr:Ln,fetch:$n};c.forEach(he,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Ie=t=>`- ${t}`,zn=t=>c.isFunction(t)||t===null||t===!1,it={getAdapter:t=>{t=c.isArray(t)?t:[t];const{length:e}=t;let n,r;const s={};for(let i=0;i<e;i++){n=t[i];let o;if(r=n,!zn(n)&&(r=he[(o=String(n)).toLowerCase()],r===void 0))throw new w(`Unknown adapter '${o}'`);if(r)break;s[o||"#"+i]=r}if(!r){const i=Object.entries(s).map(([l,f])=>`adapter ${l} `+(f===!1?"is not supported by the environment":"is not available in the build"));let o=e?i.length>1?`since :
`+i.map(Ie).join(`
`):" "+Ie(i[0]):"as no adapter specified";throw new w("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:he};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=oe.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),it.getAdapter(t.adapter||H.adapter)(t).then(function(r){return ae(t),r.data=oe.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=oe.call(t,t.transformResponse,r.response),r.response.headers=O.from(r.response.headers))),Promise.reject(r)})}const ot="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(i,o){return"[Axios v"+ot+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,l)=>{if(e===!1)throw new w(s(o," has been removed"+(n?" in "+n:"")),w.ERR_DEPRECATED);return n&&!ke[o]&&(ke[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,o,l):!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 i=r[s],o=e[i];if(o){const l=t[i],f=l===void 0||o(l,i,t);if(f!==!0)throw new w("option "+i+" must be "+f,w.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new w("Unknown option "+i,w.ERR_BAD_OPTION)}}const K={assertOptions:Jn,validators:re},x=K.validators;let M=class{constructor(e){this.defaults=e||{},this.interceptors={request:new _e,response:new _e}}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 i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=k(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&K.assertOptions(r,{silentJSONParsing:x.transitional(x.boolean),forcedJSONParsing:x.transitional(x.boolean),clarifyTimeoutError:x.transitional(x.boolean)},!1),s!=null&&(c.isFunction(s)?n.paramsSerializer={serialize:s}:K.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),K.assertOptions(n,{baseUrl:x.spelling("baseURL"),withXsrfToken:x.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&c.merge(i.common,i[n.method]);i&&c.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),n.headers=O.concat(o,i);const l=[];let f=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(f=f&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});const a=[];this.interceptors.response.forEach(function(y){a.push(y.fulfilled,y.rejected)});let u,d=0,m;if(!f){const p=[Me.bind(this),void 0];for(p.unshift.apply(p,l),p.push.apply(p,a),m=p.length,u=Promise.resolve(n);d<m;)u=u.then(p[d++],p[d++]);return u}m=l.length;let g=n;for(d=0;d<m;){const p=l[d++],y=l[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=a.length;d<m;)u=u.then(a[d++],a[d++]);return u}getUri(e){e=k(this.defaults,e);const n=tt(e.baseURL,e.url,e.allowAbsoluteUrls);return Ge(n,e.params,e.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(e){M.prototype[e]=function(n,r){return this.request(k(r||{},{method:e,url:n,data:(r||{}).data}))}});c.forEach(["post","put","patch"],function(e){function n(r){return function(i,o,l){return this.request(k(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}M.prototype[e]=n(),M.prototype[e+"Form"]=n(!0)});let Xn=class at{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,l){r.reason||(r.reason=new D(i,o,l),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 Kn(t){return function(n){return t.apply(null,n)}}function Wn(t){return c.isObject(t)&&t.isAxiosError===!0}const pe={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(pe).forEach(([t,e])=>{pe[e]=t});function ct(t){const e=new M(t),n=Be(M.prototype.request,e);return c.extend(n,M.prototype,e,{allOwnKeys:!0}),c.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return ct(k(t,s))},n}const T=ct(H);T.Axios=M;T.CanceledError=D;T.CancelToken=Xn;T.isCancel=Ze;T.VERSION=ot;T.toFormData=te;T.AxiosError=w;T.Cancel=T.CanceledError;T.all=function(e){return Promise.all(e)};T.spread=Kn;T.isAxiosError=Wn;T.mergeConfig=k;T.AxiosHeaders=O;T.formToJSON=t=>Qe(c.isHTMLForm(t)?new FormData(t):t);T.getAdapter=it.getAdapter;T.HttpStatusCode=pe;T.default=T;const{Axios:nr,AxiosError:rr,CanceledError:sr,isCancel:ir,CancelToken:or,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 Gn{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 ce=new Gn;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:"/html/body/div[1]/div/div/div/div[6]/div[4]/div/div[1]/div/div[1]/div/div/div/div[1]/div/div/div[4]",root_id:'[aria-selected="true"] [id^="chat-list-item"]',room_name:'[data-tid="chat-title"]',close_reply_btn:"/html/body/div[1]/div/div/div/div[6]/div[4]/div/div[1]/div/div[3]/div/div[3]/div/div[2]/div/div[2]/div/div/card/div/div/div[2]/div/div[1]/button",reply_btn:'[aria-label="Reply"]',chat_input:"/html/body/div[1]/div/div/div/div[6]/div[4]/div/div[1]/div/div[3]/div/div[3]/div/div[2]/div/div[2]/div[1]/div"};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 i=Array.from(e.querySelectorAll("img[itemtype]")).map(o=>o.getAttribute("alt")||"").filter(Boolean);return i.length&&(n+=i.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 i=r.getAttribute("datetime");if(!i)return null;const o=Number.isNaN(r.id.replace("timestamp-",""))?new Date(i).getTime():Number(r.id.replace("timestamp-","")),l=document.querySelector(`#content-${o}`),{room_id:f,room_name:a}=this.getCurrentRoomInfo();return{name:s?.innerText,message:this._getMessageByEl(l),time:o,room_id:f,room_name:a,date_time:new Date(i).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(i=>i.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 ce.sendSingleMessage(s)):(console.log("[Monitor] New incoming message:",s),this.handleNewMessage(s),ce.sendSingleMessage(s)),this.lastMessage=e.pop()}async start(e=1e4){console.log("[Monitor] Starting..."),this.initialHistories=this.extractAllMessages(),this.lastMessage=this.initialHistories.pop(),await ce.sendBulkMessages(this.initialHistories),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(i=>i.getAttribute("role")==="none").map(i=>{const o=i.id||null,l=`title-chat-list-item_${o}`,a=document.getElementById(l)?.innerText||null;let u=null;return o?.includes("@thread.skype")?u="group":o?.includes("@oneToOne.skype")?u="personal":u="group",{id:o,name:a,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:i=100}=n||{},o=document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;if(!o){console.warn("❌ Không tìm thấy phần tử với XPath:",e);return}return new Promise(l=>{let f=-1,a=0,u=0;const d=setInterval(()=>{const m=o.scrollHeight;o.scrollTop=m,m===f?a++:(a=0,f=m),u++,(a>=r||u>=i)&&(clearInterval(d),l())},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 z(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 i=null;if(!s)return r(new Error("#chat-pane-list not found"));const o=()=>Array.from(s.children),l=()=>{const a=o();a.length>0&&(f.disconnect(),i&&clearTimeout(i),n(a))},f=new MutationObserver(()=>{l()});f.observe(s,{childList:!0,subtree:!0}),l(),i=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 i=document.getElementById("chat-pane-list");if(!i)return s(new Error("#chat-pane-list not found"));const o=()=>Array.from(i.children),l=new Set(e);let f=null;const a=new MutationObserver(()=>{const d=o().filter(m=>!l.has(m));d.length>0&&(a.disconnect(),f&&clearTimeout(f),r(d))});a.observe(i,{childList:!0,subtree:!0}),f=setTimeout(()=>{a.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,i=[];const o=new MutationObserver(()=>{s&&clearTimeout(s),i=Array.from(r.children),s=setTimeout(()=>{o.disconnect(),n(i)},e)});o.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=m=>document.evaluate(m,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue,i=30,o=200;let l=0,f=s(n);if(!f){console.error("Wrapper not found:",n);return}let a=f.querySelector(`#${r}`);for(;!a&&l<i;){const m=f,g=m.scrollTop;if(m.scrollTop=Math.max(0,m.scrollTop-o),await z(200),f=s(n),!f||(a=f.querySelector(`#${r}`),m.scrollTop===g))break;l++}if(!a){console.error("Không tìm thấy phần tử:",r);return}a.scrollIntoView({behavior:"auto",block:"center"}),await z(100);const u=a.getBoundingClientRect(),d=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,view:window,button:2,buttons:2,clientX:u.left+u.width/2,clientY:u.top+u.height/2});a.dispatchEvent(d)}_clickIfExists(e){return new Promise(n=>{const s=document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;s?(s.scrollIntoView({behavior:"auto",block:"center"}),setTimeout(()=>{s.click(),n(!0)},100)):(console.warn("Không tìm thấy phần tử:",e),n(!1))})}async getConversations(e){$.add(async()=>{console.log("[Queue] Handling GET_CONVERSATIONS");const n=await this.service.handleGetConversations();this.port.postMessage({type:"socket-response",event:L.RECEIVE_CONVERSATIONS,data:n})})}async getConversation(e){$.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:L.RECEIVE_CONVERSATION,data:r})})}async sendMessage({data:{conversation_id:e,message:n}}){$.add(async()=>{console.log("[Queue] Handling SEND_MESSAGE");const{room_id:r}=this.service.getCurrentRoomInfo();r!=e&&this._clickToConversation(e),await z(200),await Fe.send(n)})}async replyMessage({data:{conversation_id:e,message:n,time:r}}){$.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()),this._clickIfExists(this.service.elTags.close_reply_btn),await this._rightClickMessage(r);const i=document.querySelector(this.service.elTags.reply_btn);i&&i.click(),await z(200),console.log({message:n}),await Fe.send(n)})}fixedHeightChatInput(e=20,n=1e3){(()=>{const s=this.getElementByXPath(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")})()}}const lt=chrome.runtime.connect({name:"message"}),U=new Zn(lt);lt.onMessage.addListener(t=>{if(console.log({msg:t}),U.fixedHeightChatInput(),t.type==="socket")switch(t.event){case L.GET_CONVERSATIONS:{U.getConversations(t);break}case L.GET_CONVERSATION:{U.getConversation(t);break}case L.SEND_MESSAGE:{U.sendMessage(t);break}case L.REPLY_MESSAGE:{U.replyMessage(t);break}}});