@coze/cli 0.1.4 → 0.1.6-alpha.8e848b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- "use strict";const e=require("mitt"),t=require("crypto"),s=require("form-data"),r=require("url"),n=require("http"),o=require("https"),i=require("http2"),a=require("util"),c=require("stream"),l=require("assert"),u=require("tty"),h=require("os"),d=require("zlib"),p=require("events"),_=require("path"),f=require("fs"),m=require("fs/promises"),g=require("lodash"),E=require("undici");var T;!function(e){e.SendMessage="sendMessage";e.ResumeMessage="resumeMessage";e.GetMessage="getMessage";e.ClearHistory="clearHistory";e.ClearMessageContext="clearMessageContext";e.DeleteMessage="deleteMessage";e.BreakMessage="breakMessage";e.ReportMessage="reportMessage";e.ChatASR="chatASR";e.ChatReconnect="chatReconnect";e.ChatRetrieve="chatRetrieve"}(T||(T={}));let R,A,S=(e=21)=>{var s;s=e-=0,!R||R.length<s?(R=Buffer.allocUnsafe(128*s),t.randomFillSync(R),A=0):A+s>R.length&&(t.randomFillSync(R),A=0),A+=s;let r="";for(let t=A-e;t<A;t++)r+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&R[t]];return r};var L="object"==typeof global&&global&&global.Object===Object&&global,y="object"==typeof self&&self&&self.Object===Object&&self,b=L||y||Function("return this")(),v=b.Symbol,C=Object.prototype,O=C.hasOwnProperty,I=C.toString,N=v?v.toStringTag:void 0;var M=Object.prototype.toString;var w=v?v.toStringTag:void 0;function U(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?function(e){var t=O.call(e,N),s=e[N];try{e[N]=void 0;var r=!0}catch(e){}var n=I.call(e);return r&&(t?e[N]=s:delete e[N]),n}(e):function(e){return M.call(e)}(e)}function P(e){return null!=e&&"object"==typeof e}function B(e){return"symbol"==typeof e||P(e)&&"[object Symbol]"==U(e)}function k(e,t){for(var s=-1,r=null==e?0:e.length,n=Array(r);++s<r;)n[s]=t(e[s],s,e);return n}var j=Array.isArray,D=v?v.prototype:void 0,x=D?D.toString:void 0;function F(e){if("string"==typeof e)return e;if(j(e))return k(e,F)+"";if(B(e))return x?x.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function q(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function G(e){return e}function H(e){if(!q(e))return!1;var t=U(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var z,W=b["__core-js_shared__"],$=(z=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||""))?"Symbol(src)_1."+z:"";var V=Function.prototype.toString;function K(e){if(null!=e){try{return V.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var J=/^\[object .+?Constructor\]$/,Q=Function.prototype,Y=Object.prototype,Z=Q.toString,X=Y.hasOwnProperty,ee=RegExp("^"+Z.call(X).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function te(e){return!(!q(e)||(t=e,$&&$ in t))&&(H(e)?ee:J).test(K(e));var t}function se(e,t){var s=function(e,t){return null==e?void 0:e[t]}(e,t);return te(s)?s:void 0}var re=se(b,"WeakMap"),ne=Object.create,oe=function(){function e(){}return function(t){if(!q(t))return{};if(ne)return ne(t);e.prototype=t;var s=new e;return e.prototype=void 0,s}}();function ie(){}var ae=Date.now;var ce,le,ue,he=function(){try{var e=se(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),de=he?function(e,t){return he(e,"toString",{configurable:!0,enumerable:!1,value:(s=t,function(){return s}),writable:!0});var s}:G,pe=(ce=de,le=0,ue=0,function(){var e=ae(),t=16-(e-ue);if(ue=e,t>0){if(++le>=800)return arguments[0]}else le=0;return ce.apply(void 0,arguments)});var _e=/^(?:0|[1-9]\d*)$/;function fe(e,t){var s=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==s||"symbol"!=s&&_e.test(e))&&e>-1&&e%1==0&&e<t}function me(e,t,s){"__proto__"==t&&he?he(e,t,{configurable:!0,enumerable:!0,value:s,writable:!0}):e[t]=s}function ge(e,t){return e===t||e!=e&&t!=t}var Ee=Object.prototype.hasOwnProperty;function Te(e,t,s){var r=e[t];Ee.call(e,t)&&ge(r,s)&&(void 0!==s||t in e)||me(e,t,s)}var Re=Math.max;function Ae(e,t){return pe(function(e,t,s){return t=Re(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,o=Re(r.length-t,0),i=Array(o);++n<o;)i[n]=r[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=r[n];return a[t]=s(i),function(e,t,s){switch(s.length){case 0:return e.call(t);case 1:return e.call(t,s[0]);case 2:return e.call(t,s[0],s[1]);case 3:return e.call(t,s[0],s[1],s[2])}return e.apply(t,s)}(e,this,a)}}(e,t,G),e+"")}function Se(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Le(e){return null!=e&&Se(e.length)&&!H(e)}function ye(e){return Ae((function(t,s){var r=-1,n=s.length,o=n>1?s[n-1]:void 0,i=n>2?s[2]:void 0;for(o=e.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(e,t,s){if(!q(s))return!1;var r=typeof t;return!!("number"==r?Le(s)&&fe(t,s.length):"string"==r&&t in s)&&ge(s[t],e)}(s[0],s[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++r<n;){var a=s[r];a&&e(t,a,r,o)}return t}))}var be=Object.prototype;function ve(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||be)}function Ce(e){return P(e)&&"[object Arguments]"==U(e)}var Oe=Object.prototype,Ie=Oe.hasOwnProperty,Ne=Oe.propertyIsEnumerable,Me=Ce(function(){return arguments}())?Ce:function(e){return P(e)&&Ie.call(e,"callee")&&!Ne.call(e,"callee")};var we="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ue=we&&"object"==typeof module&&module&&!module.nodeType&&module,Pe=Ue&&Ue.exports===we?b.Buffer:void 0,Be=(Pe?Pe.isBuffer:void 0)||function(){return!1},ke={};function je(e){return function(t){return e(t)}}ke["[object Float32Array]"]=ke["[object Float64Array]"]=ke["[object Int8Array]"]=ke["[object Int16Array]"]=ke["[object Int32Array]"]=ke["[object Uint8Array]"]=ke["[object Uint8ClampedArray]"]=ke["[object Uint16Array]"]=ke["[object Uint32Array]"]=!0,ke["[object Arguments]"]=ke["[object Array]"]=ke["[object ArrayBuffer]"]=ke["[object Boolean]"]=ke["[object DataView]"]=ke["[object Date]"]=ke["[object Error]"]=ke["[object Function]"]=ke["[object Map]"]=ke["[object Number]"]=ke["[object Object]"]=ke["[object RegExp]"]=ke["[object Set]"]=ke["[object String]"]=ke["[object WeakMap]"]=!1;var De="object"==typeof exports&&exports&&!exports.nodeType&&exports,xe=De&&"object"==typeof module&&module&&!module.nodeType&&module,Fe=xe&&xe.exports===De&&L.process,qe=function(){try{var e=xe&&xe.require&&xe.require("util").types;return e||Fe&&Fe.binding&&Fe.binding("util")}catch(e){}}(),Ge=qe&&qe.isTypedArray,He=Ge?je(Ge):function(e){return P(e)&&Se(e.length)&&!!ke[U(e)]},ze=Object.prototype.hasOwnProperty;function We(e,t){var s=j(e),r=!s&&Me(e),n=!s&&!r&&Be(e),o=!s&&!r&&!n&&He(e),i=s||r||n||o,a=i?function(e,t){for(var s=-1,r=Array(e);++s<e;)r[s]=t(s);return r}(e.length,String):[],c=a.length;for(var l in e)!t&&!ze.call(e,l)||i&&("length"==l||n&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||fe(l,c))||a.push(l);return a}function $e(e,t){return function(s){return e(t(s))}}var Ve=$e(Object.keys,Object),Ke=Object.prototype.hasOwnProperty;function Je(e){return Le(e)?We(e):function(e){if(!ve(e))return Ve(e);var t=[];for(var s in Object(e))Ke.call(e,s)&&"constructor"!=s&&t.push(s);return t}(e)}var Qe=Object.prototype.hasOwnProperty;function Ye(e){if(!q(e))return function(e){var t=[];if(null!=e)for(var s in Object(e))t.push(s);return t}(e);var t=ve(e),s=[];for(var r in e)("constructor"!=r||!t&&Qe.call(e,r))&&s.push(r);return s}function Ze(e){return Le(e)?We(e,!0):Ye(e)}var Xe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,et=/^\w*$/;function tt(e,t){if(j(e))return!1;var s=typeof e;return!("number"!=s&&"symbol"!=s&&"boolean"!=s&&null!=e&&!B(e))||(et.test(e)||!Xe.test(e)||null!=t&&e in Object(t))}var st=se(Object,"create");var rt=Object.prototype.hasOwnProperty;var nt=Object.prototype.hasOwnProperty;function ot(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}function it(e,t){for(var s=e.length;s--;)if(ge(e[s][0],t))return s;return-1}ot.prototype.clear=function(){this.__data__=st?st(null):{},this.size=0},ot.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ot.prototype.get=function(e){var t=this.__data__;if(st){var s=t[e];return"__lodash_hash_undefined__"===s?void 0:s}return rt.call(t,e)?t[e]:void 0},ot.prototype.has=function(e){var t=this.__data__;return st?void 0!==t[e]:nt.call(t,e)},ot.prototype.set=function(e,t){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=st&&void 0===t?"__lodash_hash_undefined__":t,this};var at=Array.prototype.splice;function ct(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}ct.prototype.clear=function(){this.__data__=[],this.size=0},ct.prototype.delete=function(e){var t=this.__data__,s=it(t,e);return!(s<0)&&(s==t.length-1?t.pop():at.call(t,s,1),--this.size,!0)},ct.prototype.get=function(e){var t=this.__data__,s=it(t,e);return s<0?void 0:t[s][1]},ct.prototype.has=function(e){return it(this.__data__,e)>-1},ct.prototype.set=function(e,t){var s=this.__data__,r=it(s,e);return r<0?(++this.size,s.push([e,t])):s[r][1]=t,this};var lt=se(b,"Map");function ut(e,t){var s,r,n=e.__data__;return("string"==(r=typeof(s=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==s:null===s)?n["string"==typeof t?"string":"hash"]:n.map}function ht(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}ht.prototype.clear=function(){this.size=0,this.__data__={hash:new ot,map:new(lt||ct),string:new ot}},ht.prototype.delete=function(e){var t=ut(this,e).delete(e);return this.size-=t?1:0,t},ht.prototype.get=function(e){return ut(this,e).get(e)},ht.prototype.has=function(e){return ut(this,e).has(e)},ht.prototype.set=function(e,t){var s=ut(this,e),r=s.size;return s.set(e,t),this.size+=s.size==r?0:1,this};function dt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var s=function(){var r=arguments,n=t?t.apply(this,r):r[0],o=s.cache;if(o.has(n))return o.get(n);var i=e.apply(this,r);return s.cache=o.set(n,i)||o,i};return s.cache=new(dt.Cache||ht),s}dt.Cache=ht;var pt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_t=/\\(\\)?/g,ft=function(e){var t=dt(e,(function(e){return 500===s.size&&s.clear(),e})),s=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(pt,(function(e,s,r,n){t.push(r?n.replace(_t,"$1"):s||e)})),t}));function mt(e,t){return j(e)?e:tt(e,t)?[e]:ft(function(e){return null==e?"":F(e)}(e))}function gt(e){if("string"==typeof e||B(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Et(e,t){for(var s=0,r=(t=mt(t,e)).length;null!=e&&s<r;)e=e[gt(t[s++])];return s&&s==r?e:void 0}function Tt(e,t,s){var r=null==e?void 0:Et(e,t);return void 0===r?s:r}function Rt(e,t){for(var s=-1,r=t.length,n=e.length;++s<r;)e[n+s]=t[s];return e}var At=$e(Object.getPrototypeOf,Object),St=Function.prototype,Lt=Object.prototype,yt=St.toString,bt=Lt.hasOwnProperty,vt=yt.call(Object);function Ct(e){var t=this.__data__=new ct(e);this.size=t.size}Ct.prototype.clear=function(){this.__data__=new ct,this.size=0},Ct.prototype.delete=function(e){var t=this.__data__,s=t.delete(e);return this.size=t.size,s},Ct.prototype.get=function(e){return this.__data__.get(e)},Ct.prototype.has=function(e){return this.__data__.has(e)},Ct.prototype.set=function(e,t){var s=this.__data__;if(s instanceof ct){var r=s.__data__;if(!lt||r.length<199)return r.push([e,t]),this.size=++s.size,this;s=this.__data__=new ht(r)}return s.set(e,t),this.size=s.size,this};var Ot="object"==typeof exports&&exports&&!exports.nodeType&&exports,It=Ot&&"object"==typeof module&&module&&!module.nodeType&&module,Nt=It&&It.exports===Ot?b.Buffer:void 0,Mt=Nt?Nt.allocUnsafe:void 0;function wt(e,t){if(t)return e.slice();var s=e.length,r=Mt?Mt(s):new e.constructor(s);return e.copy(r),r}function Ut(){return[]}var Pt=Object.prototype.propertyIsEnumerable,Bt=Object.getOwnPropertySymbols,kt=Bt?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var s=-1,r=null==e?0:e.length,n=0,o=[];++s<r;){var i=e[s];t(i,s,e)&&(o[n++]=i)}return o}(Bt(e),(function(t){return Pt.call(e,t)})))}:Ut,jt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Rt(t,kt(e)),e=At(e);return t}:Ut;function Dt(e,t,s){var r=t(e);return j(e)?r:Rt(r,s(e))}function xt(e){return Dt(e,Je,kt)}var Ft=se(b,"DataView"),qt=se(b,"Promise"),Gt=se(b,"Set"),Ht="[object Map]",zt="[object Promise]",Wt="[object Set]",$t="[object WeakMap]",Vt="[object DataView]",Kt=K(Ft),Jt=K(lt),Qt=K(qt),Yt=K(Gt),Zt=K(re),Xt=U;(Ft&&Xt(new Ft(new ArrayBuffer(1)))!=Vt||lt&&Xt(new lt)!=Ht||qt&&Xt(qt.resolve())!=zt||Gt&&Xt(new Gt)!=Wt||re&&Xt(new re)!=$t)&&(Xt=function(e){var t=U(e),s="[object Object]"==t?e.constructor:void 0,r=s?K(s):"";if(r)switch(r){case Kt:return Vt;case Jt:return Ht;case Qt:return zt;case Yt:return Wt;case Zt:return $t}return t});var es=Object.prototype.hasOwnProperty;var ts=b.Uint8Array;function ss(e){var t=new e.constructor(e.byteLength);return new ts(t).set(new ts(e)),t}var rs=/\w*$/;var ns=v?v.prototype:void 0,os=ns?ns.valueOf:void 0;function is(e,t){var s=t?ss(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}function as(e,t,s){var r,n,o,i,a,c=e.constructor;switch(t){case"[object ArrayBuffer]":return ss(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return a=ss((i=e).buffer),new i.constructor(a,i.byteOffset,i.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return is(e,s);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return(o=new(n=e).constructor(n.source,rs.exec(n))).lastIndex=n.lastIndex,o;case"[object Symbol]":return r=e,os?Object(os.call(r)):{}}}function cs(e){return"function"!=typeof e.constructor||ve(e)?{}:oe(At(e))}var ls=qe&&qe.isMap,us=ls?je(ls):function(e){return P(e)&&"[object Map]"==Xt(e)};var hs=qe&&qe.isSet,ds=hs?je(hs):function(e){return P(e)&&"[object Set]"==Xt(e)},ps="[object Arguments]",_s="[object Function]",fs="[object Object]",ms={};function gs(e,t,s,r,n,o){var i,a=1&t;if(void 0!==i)return i;if(!q(e))return e;var c=j(e);if(c)i=function(e){var t=e.length,s=new e.constructor(t);return t&&"string"==typeof e[0]&&es.call(e,"index")&&(s.index=e.index,s.input=e.input),s}(e);else{var l=Xt(e),u=l==_s||"[object GeneratorFunction]"==l;if(Be(e))return wt(e,a);if(l==fs||l==ps||u&&!n)i=u?{}:cs(e);else{if(!ms[l])return n?e:{};i=as(e,l,a)}}o||(o=new Ct);var h=o.get(e);if(h)return h;o.set(e,i),ds(e)?e.forEach((function(r){i.add(gs(r,t,s,r,e,o))})):us(e)&&e.forEach((function(r,n){i.set(n,gs(r,t,s,n,e,o))}));var d=c?void 0:xt(e);return function(e,t){for(var s=-1,r=null==e?0:e.length;++s<r&&!1!==t(e[s],s,e););}(d||e,(function(r,n){d&&(r=e[n=r]),Te(i,n,gs(r,t,s,n,e,o))})),i}ms[ps]=ms["[object Array]"]=ms["[object ArrayBuffer]"]=ms["[object DataView]"]=ms["[object Boolean]"]=ms["[object Date]"]=ms["[object Float32Array]"]=ms["[object Float64Array]"]=ms["[object Int8Array]"]=ms["[object Int16Array]"]=ms["[object Int32Array]"]=ms["[object Map]"]=ms["[object Number]"]=ms[fs]=ms["[object RegExp]"]=ms["[object Set]"]=ms["[object String]"]=ms["[object Symbol]"]=ms["[object Uint8Array]"]=ms["[object Uint8ClampedArray]"]=ms["[object Uint16Array]"]=ms["[object Uint32Array]"]=!0,ms["[object Error]"]=ms[_s]=ms["[object WeakMap]"]=!1;function Es(e){return gs(e,5)}function Ts(e){var t=-1,s=null==e?0:e.length;for(this.__data__=new ht;++t<s;)this.add(e[t])}function Rs(e,t){for(var s=-1,r=null==e?0:e.length;++s<r;)if(t(e[s],s,e))return!0;return!1}Ts.prototype.add=Ts.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Ts.prototype.has=function(e){return this.__data__.has(e)};function As(e,t,s,r,n,o){var i=1&s,a=e.length,c=t.length;if(a!=c&&!(i&&c>a))return!1;var l=o.get(e),u=o.get(t);if(l&&u)return l==t&&u==e;var h=-1,d=!0,p=2&s?new Ts:void 0;for(o.set(e,t),o.set(t,e);++h<a;){var _=e[h],f=t[h];if(r)var m=i?r(f,_,h,t,e,o):r(_,f,h,e,t,o);if(void 0!==m){if(m)continue;d=!1;break}if(p){if(!Rs(t,(function(e,t){if(i=t,!p.has(i)&&(_===e||n(_,e,s,r,o)))return p.push(t);var i}))){d=!1;break}}else if(_!==f&&!n(_,f,s,r,o)){d=!1;break}}return o.delete(e),o.delete(t),d}function Ss(e){var t=-1,s=Array(e.size);return e.forEach((function(e,r){s[++t]=[r,e]})),s}function Ls(e){var t=-1,s=Array(e.size);return e.forEach((function(e){s[++t]=e})),s}var ys=v?v.prototype:void 0,bs=ys?ys.valueOf:void 0;var vs=Object.prototype.hasOwnProperty;var Cs="[object Arguments]",Os="[object Array]",Is="[object Object]",Ns=Object.prototype.hasOwnProperty;function Ms(e,t,s,r,n,o){var i=j(e),a=j(t),c=i?Os:Xt(e),l=a?Os:Xt(t),u=(c=c==Cs?Is:c)==Is,h=(l=l==Cs?Is:l)==Is,d=c==l;if(d&&Be(e)){if(!Be(t))return!1;i=!0,u=!1}if(d&&!u)return o||(o=new Ct),i||He(e)?As(e,t,s,r,n,o):function(e,t,s,r,n,o,i){switch(s){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!o(new ts(e),new ts(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ge(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Ss;case"[object Set]":var c=1&r;if(a||(a=Ls),e.size!=t.size&&!c)return!1;var l=i.get(e);if(l)return l==t;r|=2,i.set(e,t);var u=As(a(e),a(t),r,n,o,i);return i.delete(e),u;case"[object Symbol]":if(bs)return bs.call(e)==bs.call(t)}return!1}(e,t,c,s,r,n,o);if(!(1&s)){var p=u&&Ns.call(e,"__wrapped__"),_=h&&Ns.call(t,"__wrapped__");if(p||_){var f=p?e.value():e,m=_?t.value():t;return o||(o=new Ct),n(f,m,s,r,o)}}return!!d&&(o||(o=new Ct),function(e,t,s,r,n,o){var i=1&s,a=xt(e),c=a.length;if(c!=xt(t).length&&!i)return!1;for(var l=c;l--;){var u=a[l];if(!(i?u in t:vs.call(t,u)))return!1}var h=o.get(e),d=o.get(t);if(h&&d)return h==t&&d==e;var p=!0;o.set(e,t),o.set(t,e);for(var _=i;++l<c;){var f=e[u=a[l]],m=t[u];if(r)var g=i?r(m,f,u,t,e,o):r(f,m,u,e,t,o);if(!(void 0===g?f===m||n(f,m,s,r,o):g)){p=!1;break}_||(_="constructor"==u)}if(p&&!_){var E=e.constructor,T=t.constructor;E==T||!("constructor"in e)||!("constructor"in t)||"function"==typeof E&&E instanceof E&&"function"==typeof T&&T instanceof T||(p=!1)}return o.delete(e),o.delete(t),p}(e,t,s,r,n,o))}function ws(e,t,s,r,n){return e===t||(null==e||null==t||!P(e)&&!P(t)?e!=e&&t!=t:Ms(e,t,s,r,ws,n))}function Us(e){return e==e&&!q(e)}function Ps(e,t){return function(s){return null!=s&&(s[e]===t&&(void 0!==t||e in Object(s)))}}function Bs(e){var t=function(e){for(var t=Je(e),s=t.length;s--;){var r=t[s],n=e[r];t[s]=[r,n,Us(n)]}return t}(e);return 1==t.length&&t[0][2]?Ps(t[0][0],t[0][1]):function(s){return s===e||function(e,t,s,r){var n=s.length,o=n;if(null==e)return!o;for(e=Object(e);n--;){var i=s[n];if(i[2]?i[1]!==e[i[0]]:!(i[0]in e))return!1}for(;++n<o;){var a=(i=s[n])[0],c=e[a],l=i[1];if(i[2]){if(void 0===c&&!(a in e))return!1}else if(!ws(l,c,3,r,new Ct))return!1}return!0}(s,0,t)}}function ks(e,t){return null!=e&&t in Object(e)}function js(e,t){return null!=e&&function(e,t,s){for(var r=-1,n=(t=mt(t,e)).length,o=!1;++r<n;){var i=gt(t[r]);if(!(o=null!=e&&s(e,i)))break;e=e[i]}return o||++r!=n?o:!!(n=null==e?0:e.length)&&Se(n)&&fe(i,n)&&(j(e)||Me(e))}(e,t,ks)}function Ds(e){return tt(e)?(t=gt(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return Et(t,e)}}(e);var t}function xs(e){return"function"==typeof e?e:null==e?G:"object"==typeof e?j(e)?function(e,t){return tt(e)&&Us(t)?Ps(gt(e),t):function(s){var r=Tt(s,e);return void 0===r&&r===t?js(s,e):ws(t,r,3)}}(e[0],e[1]):Bs(e):Ds(e)}var Fs=function(e,t,s){for(var r=-1,n=Object(e),o=s(e),i=o.length;i--;){var a=o[++r];if(!1===t(n[a],a,n))break}return e};function qs(e,t,s){(void 0!==s&&!ge(e[t],s)||void 0===s&&!(t in e))&&me(e,t,s)}function Gs(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function Hs(e){return function(e,t,s){var r=!s;s||(s={});for(var n=-1,o=t.length;++n<o;){var i=t[n],a=void 0;void 0===a&&(a=e[i]),r?me(s,i,a):Te(s,i,a)}return s}(e,Ze(e))}function zs(e,t,s,r,n,o,i){var a=Gs(e,s),c=Gs(t,s),l=i.get(c);if(l)qs(e,s,l);else{var u,h=o?o(a,c,s+"",e,t,i):void 0,d=void 0===h;if(d){var p=j(c),_=!p&&Be(c),f=!p&&!_&&He(c);h=c,p||_||f?j(a)?h=a:P(u=a)&&Le(u)?h=function(e,t){var s=-1,r=e.length;for(t||(t=Array(r));++s<r;)t[s]=e[s];return t}(a):_?(d=!1,h=wt(c,!0)):f?(d=!1,h=is(c,!0)):h=[]:function(e){if(!P(e)||"[object Object]"!=U(e))return!1;var t=At(e);if(null===t)return!0;var s=bt.call(t,"constructor")&&t.constructor;return"function"==typeof s&&s instanceof s&&yt.call(s)==vt}(c)||Me(c)?(h=a,Me(a)?h=Hs(a):q(a)&&!H(a)||(h=cs(c))):d=!1}d&&(i.set(c,h),n(h,c,r,o,i),i.delete(c)),qs(e,s,h)}}function Ws(e,t,s,r,n){e!==t&&Fs(t,(function(o,i){if(n||(n=new Ct),q(o))zs(e,t,i,s,Ws,r,n);else{var a=r?r(Gs(e,i),o,i+"",e,t,n):void 0;void 0===a&&(a=o),qs(e,i,a)}}),Ze)}var $s=ye((function(e,t,s,r){Ws(e,t,s,r)}));function Vs(e){return void 0===e}var Ks=ye((function(e,t,s){Ws(e,t,s)}));function Js(e,t,s,r){if(!q(e))return e;for(var n=-1,o=(t=mt(t,e)).length,i=o-1,a=e;null!=a&&++n<o;){var c=gt(t[n]),l=s;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(n!=i){var u=a[c];void 0===(l=void 0)&&(l=q(u)?u:fe(t[n+1])?[]:{})}Te(a,c,l),a=a[c]}return e}function Qs(e,t){if(null==e)return{};var s=k(function(e){return Dt(e,Ze,jt)}(e),(function(e){return[e]}));return t=xs(t),function(e,t,s){for(var r=-1,n=t.length,o={};++r<n;){var i=t[r],a=Et(e,i);s(a,i)&&Js(o,mt(i,e),a)}return o}(e,s,(function(e,s){return t(e,s[0])}))}function Ys(e,t,s){return null==e?e:Js(e,t,s)}function Zs(e,t,s){return null==e?e:function(e,t,s){return Js(e,t,s(Et(e,t)))}(e,t,"function"==typeof(r=s)?r:G);var r}class Xs{createQueryMessage(e,t){return{content:e,session_id:t.session_id,type:"query",project_id:t.project_id,conversation_id:t.conversation_id,context:t.context,local_msg_id:S()}}createRetryMessage(e,t){return{content:e,session_id:t.session_id,type:"retry",project_id:t.project_id,conversation_id:t.conversation_id,context:t.context,local_msg_id:S()}}createEditMessage(e,t){const s=S();return{content:Ks(e,{edit:{local_msg_id:s}}),session_id:t.session_id,type:"edit",project_id:t.project_id,conversation_id:t.conversation_id,context:t.context,local_msg_id:s}}createInputMessage(e,t){return{content:e,session_id:t.session_id,type:"input",project_id:t.project_id,conversation_id:t.conversation_id,context:t.context,local_msg_id:S()}}createCancelMessage(e,t){return{content:e,session_id:t.session_id,type:"cancel",project_id:t.project_id,conversation_id:t.conversation_id,context:t.context,local_msg_id:S()}}}const er=(...e)=>$s(...e,((e,t)=>{if(j(e))return e.concat(t)}));function tr(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}class sr extends Error{constructor(e,t={}){super(e),this.name="HttpError",this.status=t.status,this.code=t.code,this.config=t.config,this.response=t.response,this.data=t.data,Error.captureStackTrace&&Error.captureStackTrace(this,sr)}toString(){const e=[];let t=this.name;if(this.status||this.code){const e=[];this.status&&e.push(String(this.status)),this.code&&e.push(String(this.code)),t+=` [${e.join(" ")}]`}if(t+=`: ${this.message}`,e.push(t),this.config){const t=tr([this,"access",e=>e.config,"access",e=>e.method,"optionalAccess",e=>e.toUpperCase,"call",e=>e()])||"GET",s=this.config.url||"unknown",r=(this.config.baseURL?`${this.config.baseURL}`:"")+s;e.push(` URL: ${t} ${r}`)}if(this.data)try{const t=JSON.stringify(this.data);t.length<200?e.push(` Data: ${t}`):e.push(` Data: [${t.length} bytes]`)}catch(t){const s=t instanceof Error?t.constructor.name:"unknown";e.push(` Data: [non-serializable: ${s}]`)}return e.join("\n")}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code,data:this.data,url:tr([this,"access",e=>e.config,"optionalAccess",e=>e.url]),method:tr([this,"access",e=>e.config,"optionalAccess",e=>e.method]),baseURL:tr([this,"access",e=>e.config,"optionalAccess",e=>e.baseURL])}}}function rr(e,t){return function(){return e.apply(t,arguments)}}const{toString:nr}=Object.prototype,{getPrototypeOf:or}=Object,{iterator:ir,toStringTag:ar}=Symbol,cr=(lr=Object.create(null),e=>{const t=nr.call(e);return lr[t]||(lr[t]=t.slice(8,-1).toLowerCase())});var lr;const ur=e=>(e=e.toLowerCase(),t=>cr(t)===e),hr=e=>t=>typeof t===e,{isArray:dr}=Array,pr=hr("undefined");function _r(e){return null!==e&&!pr(e)&&null!==e.constructor&&!pr(e.constructor)&&gr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const fr=ur("ArrayBuffer");const mr=hr("string"),gr=hr("function"),Er=hr("number"),Tr=e=>null!==e&&"object"==typeof e,Rr=e=>{if("object"!==cr(e))return!1;const t=or(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||ar in e||ir in e)},Ar=ur("Date"),Sr=ur("File"),Lr=ur("Blob"),yr=ur("FileList");const br="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},vr=void 0!==br.FormData?br.FormData:void 0,Cr=ur("URLSearchParams"),[Or,Ir,Nr,Mr]=["ReadableStream","Request","Response","Headers"].map(ur);function wr(e,t,{allOwnKeys:s=!1}={}){if(null==e)return;let r,n;if("object"!=typeof e&&(e=[e]),dr(e))for(r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else{if(_r(e))return;const n=s?Object.getOwnPropertyNames(e):Object.keys(e),o=n.length;let i;for(r=0;r<o;r++)i=n[r],t.call(null,e[i],i,e)}}function Ur(e,t){if(_r(e))return null;t=t.toLowerCase();const s=Object.keys(e);let r,n=s.length;for(;n-- >0;)if(r=s[n],t===r.toLowerCase())return r;return null}const Pr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Br=e=>!pr(e)&&e!==Pr;const kr=(jr="undefined"!=typeof Uint8Array&&or(Uint8Array),e=>jr&&e instanceof jr);var jr;const Dr=ur("HTMLFormElement"),xr=(({hasOwnProperty:e})=>(t,s)=>e.call(t,s))(Object.prototype),Fr=ur("RegExp"),qr=(e,t)=>{const s=Object.getOwnPropertyDescriptors(e),r={};wr(s,((s,n)=>{let o;!1!==(o=t(s,n,e))&&(r[n]=o||s)})),Object.defineProperties(e,r)};const Gr=ur("AsyncFunction"),Hr=(zr="function"==typeof setImmediate,Wr=gr(Pr.postMessage),zr?setImmediate:Wr?($r=`axios@${Math.random()}`,Vr=[],Pr.addEventListener("message",(({source:e,data:t})=>{e===Pr&&t===$r&&Vr.length&&Vr.shift()()}),!1),e=>{Vr.push(e),Pr.postMessage($r,"*")}):e=>setTimeout(e));var zr,Wr,$r,Vr;const Kr="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Pr):"undefined"!=typeof process&&process.nextTick||Hr,Jr={isArray:dr,isArrayBuffer:fr,isBuffer:_r,isFormData:e=>{let t;return e&&(vr&&e instanceof vr||gr(e.append)&&("formdata"===(t=cr(e))||"object"===t&&gr(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&fr(e.buffer),t},isString:mr,isNumber:Er,isBoolean:e=>!0===e||!1===e,isObject:Tr,isPlainObject:Rr,isEmptyObject:e=>{if(!Tr(e)||_r(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Or,isRequest:Ir,isResponse:Nr,isHeaders:Mr,isUndefined:pr,isDate:Ar,isFile:Sr,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Lr,isRegExp:Fr,isFunction:gr,isStream:e=>Tr(e)&&gr(e.pipe),isURLSearchParams:Cr,isTypedArray:kr,isFileList:yr,forEach:wr,merge:function e(){const{caseless:t,skipUndefined:s}=Br(this)&&this||{},r={},n=(n,o)=>{if("__proto__"===o||"constructor"===o||"prototype"===o)return;const i=t&&Ur(r,o)||o;Rr(r[i])&&Rr(n)?r[i]=e(r[i],n):Rr(n)?r[i]=e({},n):dr(n)?r[i]=n.slice():s&&pr(n)||(r[i]=n)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&wr(arguments[e],n);return r},extend:(e,t,s,{allOwnKeys:r}={})=>(wr(t,((t,r)=>{s&&gr(t)?Object.defineProperty(e,r,{value:rr(t,s),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,s,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),s&&Object.assign(e.prototype,s)},toFlatObject:(e,t,s,r)=>{let n,o,i;const a={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),o=n.length;o-- >0;)i=n[o],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==s&&or(e)}while(e&&(!s||s(e,t))&&e!==Object.prototype);return t},kindOf:cr,kindOfTest:ur,endsWith:(e,t,s)=>{e=String(e),(void 0===s||s>e.length)&&(s=e.length),s-=t.length;const r=e.indexOf(t,s);return-1!==r&&r===s},toArray:e=>{if(!e)return null;if(dr(e))return e;let t=e.length;if(!Er(t))return null;const s=new Array(t);for(;t-- >0;)s[t]=e[t];return s},forEachEntry:(e,t)=>{const s=(e&&e[ir]).call(e);let r;for(;(r=s.next())&&!r.done;){const s=r.value;t.call(e,s[0],s[1])}},matchAll:(e,t)=>{let s;const r=[];for(;null!==(s=e.exec(t));)r.push(s);return r},isHTMLForm:Dr,hasOwnProperty:xr,hasOwnProp:xr,reduceDescriptors:qr,freezeMethods:e=>{qr(e,((t,s)=>{if(gr(e)&&-1!==["arguments","caller","callee"].indexOf(s))return!1;const r=e[s];gr(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")}))}))},toObjectSet:(e,t)=>{const s={},r=e=>{e.forEach((e=>{s[e]=!0}))};return dr(e)?r(e):r(String(e).split(t)),s},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,s){return t.toUpperCase()+s})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Ur,global:Pr,isContextDefined:Br,isSpecCompliantForm:function(e){return!!(e&&gr(e.append)&&"FormData"===e[ar]&&e[ir])},toJSONObject:e=>{const t=new Array(10),s=(e,r)=>{if(Tr(e)){if(t.indexOf(e)>=0)return;if(_r(e))return e;if(!("toJSON"in e)){t[r]=e;const n=dr(e)?[]:{};return wr(e,((e,t)=>{const o=s(e,r+1);!pr(o)&&(n[t]=o)})),t[r]=void 0,n}}return e};return s(e,0)},isAsyncFn:Gr,isThenable:e=>e&&(Tr(e)||gr(e))&&gr(e.then)&&gr(e.catch),setImmediate:Hr,asap:Kr,isIterable:e=>null!=e&&gr(e[ir])};let Qr=class e extends Error{static from(t,s,r,n,o,i){const a=new e(t.message,s||t.code,r,n,o);return a.cause=t,a.name=t.name,null!=t.status&&null==a.status&&(a.status=t.status),i&&Object.assign(a,i),a}constructor(e,t,s,r,n){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),s&&(this.config=s),r&&(this.request=r),n&&(this.response=n,this.status=n.status)}toJSON(){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:Jr.toJSONObject(this.config),code:this.code,status:this.status}}};function Yr(e){return Jr.isPlainObject(e)||Jr.isArray(e)}function Zr(e){return Jr.endsWith(e,"[]")?e.slice(0,-2):e}function Xr(e,t,s){return e?e.concat(t).map((function(e,t){return e=Zr(e),!s&&t?"["+e+"]":e})).join(s?".":""):t}Qr.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Qr.ERR_BAD_OPTION="ERR_BAD_OPTION",Qr.ECONNABORTED="ECONNABORTED",Qr.ETIMEDOUT="ETIMEDOUT",Qr.ERR_NETWORK="ERR_NETWORK",Qr.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Qr.ERR_DEPRECATED="ERR_DEPRECATED",Qr.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Qr.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Qr.ERR_CANCELED="ERR_CANCELED",Qr.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Qr.ERR_INVALID_URL="ERR_INVALID_URL";const en=Jr.toFlatObject(Jr,{},null,(function(e){return/^is[A-Z]/.test(e)}));function tn(e,t,r){if(!Jr.isObject(e))throw new TypeError("target must be an object");t=t||new(s||FormData);const n=(r=Jr.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Jr.isUndefined(t[e])}))).metaTokens,o=r.visitor||u,i=r.dots,a=r.indexes,c=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Jr.isSpecCompliantForm(t);if(!Jr.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Jr.isDate(e))return e.toISOString();if(Jr.isBoolean(e))return e.toString();if(!c&&Jr.isBlob(e))throw new Qr("Blob is not supported. Use a Buffer instead.");return Jr.isArrayBuffer(e)||Jr.isTypedArray(e)?c&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,s,r){let o=e;if(Jr.isReactNative(t)&&Jr.isReactNativeBlob(e))return t.append(Xr(r,s,i),l(e)),!1;if(e&&!r&&"object"==typeof e)if(Jr.endsWith(s,"{}"))s=n?s:s.slice(0,-2),e=JSON.stringify(e);else if(Jr.isArray(e)&&function(e){return Jr.isArray(e)&&!e.some(Yr)}(e)||(Jr.isFileList(e)||Jr.endsWith(s,"[]"))&&(o=Jr.toArray(e)))return s=Zr(s),o.forEach((function(e,r){!Jr.isUndefined(e)&&null!==e&&t.append(!0===a?Xr([s],r,i):null===a?s:s+"[]",l(e))})),!1;return!!Yr(e)||(t.append(Xr(r,s,i),l(e)),!1)}const h=[],d=Object.assign(en,{defaultVisitor:u,convertValue:l,isVisitable:Yr});if(!Jr.isObject(e))throw new TypeError("data must be an object");return function e(s,r){if(!Jr.isUndefined(s)){if(-1!==h.indexOf(s))throw Error("Circular reference detected in "+r.join("."));h.push(s),Jr.forEach(s,(function(s,n){!0===(!(Jr.isUndefined(s)||null===s)&&o.call(t,s,Jr.isString(n)?n.trim():n,r,d))&&e(s,r?r.concat(n):[n])})),h.pop()}}(e),t}function sn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function rn(e,t){this._pairs=[],e&&tn(e,this,t)}const nn=rn.prototype;function on(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function an(e,t,s){if(!t)return e;const r=s&&s.encode||on,n=Jr.isFunction(s)?{serialize:s}:s,o=n&&n.serialize;let i;if(i=o?o(t,n):Jr.isURLSearchParams(t)?t.toString():new rn(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}nn.append=function(e,t){this._pairs.push([e,t])},nn.toString=function(e){const t=e?function(t){return e.call(this,t,sn)}:sn;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class cn{constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!s&&s.synchronous,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Jr.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}const ln={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},un=r.URLSearchParams,hn="abcdefghijklmnopqrstuvwxyz",dn="0123456789",pn={DIGIT:dn,ALPHA:hn,ALPHA_DIGIT:hn+hn.toUpperCase()+dn},_n={isNode:!0,classes:{URLSearchParams:un,FormData:s,Blob:"undefined"!=typeof Blob&&Blob||null},ALPHABET:pn,generateString:(e=16,s=pn.ALPHA_DIGIT)=>{let r="";const{length:n}=s,o=new Uint32Array(e);t.randomFillSync(o);for(let t=0;t<e;t++)r+=s[o[t]%n];return r},protocols:["http","https","file","data"]},fn="undefined"!=typeof window&&"undefined"!=typeof document,mn="object"==typeof navigator&&navigator||void 0,gn=fn&&(!mn||["ReactNative","NativeScript","NS"].indexOf(mn.product)<0),En="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Tn=fn&&window.location.href||"http://localhost",Rn={...Object.freeze({__proto__:null,hasBrowserEnv:fn,hasStandardBrowserEnv:gn,hasStandardBrowserWebWorkerEnv:En,navigator:mn,origin:Tn}),..._n};function An(e){function t(e,s,r,n){let o=e[n++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=n>=e.length;if(o=!o&&Jr.isArray(r)?r.length:o,a)return Jr.hasOwnProp(r,o)?r[o]=[r[o],s]:r[o]=s,!i;r[o]&&Jr.isObject(r[o])||(r[o]=[]);return t(e,s,r[o],n)&&Jr.isArray(r[o])&&(r[o]=function(e){const t={},s=Object.keys(e);let r;const n=s.length;let o;for(r=0;r<n;r++)o=s[r],t[o]=e[o];return t}(r[o])),!i}if(Jr.isFormData(e)&&Jr.isFunction(e.entries)){const s={};return Jr.forEachEntry(e,((e,r)=>{t(function(e){return Jr.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,s,0)})),s}return null}const Sn={transitional:ln,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const s=t.getContentType()||"",r=s.indexOf("application/json")>-1,n=Jr.isObject(e);n&&Jr.isHTMLForm(e)&&(e=new FormData(e));if(Jr.isFormData(e))return r?JSON.stringify(An(e)):e;if(Jr.isArrayBuffer(e)||Jr.isBuffer(e)||Jr.isStream(e)||Jr.isFile(e)||Jr.isBlob(e)||Jr.isReadableStream(e))return e;if(Jr.isArrayBufferView(e))return e.buffer;if(Jr.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(s.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return tn(e,new Rn.classes.URLSearchParams,{visitor:function(e,t,s,r){return Rn.isNode&&Jr.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=Jr.isFileList(e))||s.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return tn(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),function(e,t,s){if(Jr.isString(e))try{return(t||JSON.parse)(e),Jr.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(s||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Sn.transitional,s=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Jr.isResponse(e)||Jr.isReadableStream(e))return e;if(e&&Jr.isString(e)&&(s&&!this.responseType||r)){const s=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(s){if("SyntaxError"===e.name)throw Qr.from(e,Qr.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Rn.classes.FormData,Blob:Rn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Jr.forEach(["delete","get","head","post","put","patch"],(e=>{Sn.headers[e]={}}));const Ln=Jr.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"]),yn=Symbol("internals");function bn(e){return e&&String(e).trim().toLowerCase()}function vn(e){return!1===e||null==e?e:Jr.isArray(e)?e.map(vn):String(e).replace(/[\r\n]+$/,"")}function Cn(e,t,s,r,n){return Jr.isFunction(r)?r.call(this,t,s):(n&&(t=s),Jr.isString(t)?Jr.isString(r)?-1!==t.indexOf(r):Jr.isRegExp(r)?r.test(t):void 0:void 0)}let On=class{constructor(e){e&&this.set(e)}set(e,t,s){const r=this;function n(e,t,s){const n=bn(t);if(!n)throw new Error("header name must be a non-empty string");const o=Jr.findKey(r,n);(!o||void 0===r[o]||!0===s||void 0===s&&!1!==r[o])&&(r[o||t]=vn(e))}const o=(e,t)=>Jr.forEach(e,((e,s)=>n(e,s,t)));if(Jr.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Jr.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let s,r,n;return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),s=e.substring(0,n).trim().toLowerCase(),r=e.substring(n+1).trim(),!s||t[s]&&Ln[s]||("set-cookie"===s?t[s]?t[s].push(r):t[s]=[r]:t[s]=t[s]?t[s]+", "+r:r)})),t})(e),t);else if(Jr.isObject(e)&&Jr.isIterable(e)){let s,r,n={};for(const t of e){if(!Jr.isArray(t))throw TypeError("Object iterator must return a key-value pair");n[r=t[0]]=(s=n[r])?Jr.isArray(s)?[...s,t[1]]:[s,t[1]]:t[1]}o(n,t)}else null!=e&&n(t,e,s);return this}get(e,t){if(e=bn(e)){const s=Jr.findKey(this,e);if(s){const e=this[s];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=s.exec(e);)t[r[1]]=r[2];return t}(e);if(Jr.isFunction(t))return t.call(this,e,s);if(Jr.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=bn(e)){const s=Jr.findKey(this,e);return!(!s||void 0===this[s]||t&&!Cn(0,this[s],s,t))}return!1}delete(e,t){const s=this;let r=!1;function n(e){if(e=bn(e)){const n=Jr.findKey(s,e);!n||t&&!Cn(0,s[n],n,t)||(delete s[n],r=!0)}}return Jr.isArray(e)?e.forEach(n):n(e),r}clear(e){const t=Object.keys(this);let s=t.length,r=!1;for(;s--;){const n=t[s];e&&!Cn(0,this[n],n,e,!0)||(delete this[n],r=!0)}return r}normalize(e){const t=this,s={};return Jr.forEach(this,((r,n)=>{const o=Jr.findKey(s,n);if(o)return t[o]=vn(r),void delete t[n];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,s)=>t.toUpperCase()+s))}(n):String(n).trim();i!==n&&delete t[n],t[i]=vn(r),s[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Jr.forEach(this,((s,r)=>{null!=s&&!1!==s&&(t[r]=e&&Jr.isArray(s)?s.join(", "):s)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach((e=>s.set(e))),s}static accessor(e){const t=(this[yn]=this[yn]={accessors:{}}).accessors,s=this.prototype;function r(e){const r=bn(e);t[r]||(!function(e,t){const s=Jr.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+s,{value:function(e,s,n){return this[r].call(this,t,e,s,n)},configurable:!0})}))}(s,e),t[r]=!0)}return Jr.isArray(e)?e.forEach(r):r(e),this}};function In(e,t){const s=this||Sn,r=t||s,n=On.from(r.headers);let o=r.data;return Jr.forEach(e,(function(e){o=e.call(s,o,n.normalize(),t?t.status:void 0)})),n.normalize(),o}function Nn(e){return!(!e||!e.__CANCEL__)}On.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Jr.reduceDescriptors(On.prototype,(({value:e},t)=>{let s=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[s]=e}}})),Jr.freezeMethods(On);let Mn=class extends Qr{constructor(e,t,s){super(null==e?"canceled":e,Qr.ERR_CANCELED,t,s),this.name="CanceledError",this.__CANCEL__=!0}};function wn(e,t,s){const r=s.config.validateStatus;s.status&&r&&!r(s.status)?t(new Qr("Request failed with status code "+s.status,[Qr.ERR_BAD_REQUEST,Qr.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s)):e(s)}function Un(e,t,s){let r=!function(e){return"string"==typeof e&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(r||0==s)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Pn={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function Bn(e){var t=("string"==typeof e?function(e){try{return new URL(e)}catch(e){return null}}(e):e)||{},s=t.protocol,r=t.host,n=t.port;if("string"!=typeof r||!r||"string"!=typeof s)return"";if(s=s.split(":",1)[0],!function(e,t){var s=kn("no_proxy").toLowerCase();if(!s)return!0;if("*"===s)return!1;return s.split(/[,\s]/).every((function(s){if(!s)return!0;var r=s.match(/^(.+):(\d+)$/),n=r?r[1]:s,o=r?parseInt(r[2]):0;return!(!o||o===t)||(/^[.*]/.test(n)?("*"===n.charAt(0)&&(n=n.slice(1)),!e.endsWith(n)):e!==n)}))}(r=r.replace(/:\d*$/,""),n=parseInt(n)||Pn[s]||0))return"";var o=kn(s+"_proxy")||kn("all_proxy");return o&&-1===o.indexOf("://")&&(o=s+"://"+o),o}function kn(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}function jn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Dn,xn,Fn,qn,Gn,Hn={exports:{}},zn={exports:{}},Wn={exports:{}};function $n(){if(xn)return Dn;xn=1;var e=1e3,t=60*e,s=60*t,r=24*s,n=7*r,o=365.25*r;function i(e,t,s,r){var n=t>=1.5*s;return Math.round(e/s)+" "+r+(n?"s":"")}return Dn=function(a,c){c=c||{};var l=typeof a;if("string"===l&&a.length>0)return function(i){if((i=String(i)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*n;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*s;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===l&&isFinite(a))return c.long?function(n){var o=Math.abs(n);if(o>=r)return i(n,o,r,"day");if(o>=s)return i(n,o,s,"hour");if(o>=t)return i(n,o,t,"minute");if(o>=e)return i(n,o,e,"second");return n+" ms"}(a):function(n){var o=Math.abs(n);if(o>=r)return Math.round(n/r)+"d";if(o>=s)return Math.round(n/s)+"h";if(o>=t)return Math.round(n/t)+"m";if(o>=e)return Math.round(n/e)+"s";return n+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}function Vn(){if(qn)return Fn;return qn=1,Fn=function(e){function t(e){let r,n,o,i=null;function a(...e){if(!a.enabled)return;const s=a,n=Number(new Date),o=n-(r||n);s.diff=o,s.prev=r,s.curr=n,r=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,n)=>{if("%%"===r)return"%";i++;const o=t.formatters[n];if("function"==typeof o){const t=e[i];r=o.call(s,t),e.splice(i,1),i--}return r})),t.formatArgs.call(s,e);(s.log||t.log).apply(s,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=s,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(n!==t.namespaces&&(n=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function s(e,s){const r=t(this.namespace+(void 0===s?":":s)+e);return r.log=this.log,r}function r(e,t){let s=0,r=0,n=-1,o=0;for(;s<e.length;)if(r<t.length&&(t[r]===e[s]||"*"===t[r]))"*"===t[r]?(n=r,o=s,r++):(s++,r++);else{if(-1===n)return!1;r=n+1,o++,s=o}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const s=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of s)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const s of t.skips)if(r(e,s))return!1;for(const s of t.names)if(r(e,s))return!0;return!1},t.humanize=$n(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((s=>{t[s]=e[s]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let s=0;for(let t=0;t<e.length;t++)s=(s<<5)-s+e.charCodeAt(t),s|=0;return t.colors[Math.abs(s)%t.colors.length]},t.enable(t.load()),t},Fn}var Kn,Jn,Qn,Yn,Zn,Xn,eo,to,so,ro={exports:{}};function no(){return Jn?Kn:(Jn=1,Kn=(e,t)=>{t=t||process.argv;const s=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(s+e),n=t.indexOf("--");return-1!==r&&(-1===n||r<n)})}function oo(){if(Yn)return Qn;Yn=1;const e=h,t=no(),{env:s}=process;let r;function n(n){const o=function(n){if(0===r)return 0;if(t("color=16m")||t("color=full")||t("color=truecolor"))return 3;if(t("color=256"))return 2;if(n&&!n.isTTY&&void 0===r)return 0;const o=r||0;if("dumb"===s.TERM)return o;if("win32"===process.platform){const t=e.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("true"in s)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in s))||"codeship"===s.CI_NAME?1:o;if("TEAMCITY_VERSION"in s)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(s.TEAMCITY_VERSION)?1:0;if("truecolor"===s.COLORTERM)return 3;if("TERM_PROGRAM"in s){const e=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(s.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(s.TERM)||"COLORTERM"in s?1:o}(n);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return t("no-color")||t("no-colors")||t("color=false")||t("color=never")?r=0:(t("color")||t("colors")||t("color=true")||t("color=always"))&&(r=1),"FORCE_COLOR"in s&&(r=!0===s.FORCE_COLOR||"true"===s.FORCE_COLOR?1:!1===s.FORCE_COLOR||"false"===s.FORCE_COLOR?0:0===s.FORCE_COLOR.length?1:Math.min(parseInt(s.FORCE_COLOR,10),3)),Qn={supportsColor:n,stdout:n(process.stdout),stderr:n(process.stderr)}}function io(){return Zn||(Zn=1,function(e,t){const s=u,r=a;t.init=function(e){e.inspectOpts={};const s=Object.keys(t.inspectOpts);for(let r=0;r<s.length;r++)e.inspectOpts[s[r]]=t.inspectOpts[s[r]]},t.log=function(...e){return process.stderr.write(r.formatWithOptions(t.inspectOpts,...e)+"\n")},t.formatArgs=function(s){const{namespace:r,useColors:n}=this;if(n){const t=this.color,n="[3"+(t<8?t:"8;5;"+t),o=` ${n};1m${r} `;s[0]=o+s[0].split("\n").join("\n"+o),s.push(n+"m+"+e.exports.humanize(this.diff)+"")}else s[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+r+" "+s[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):s.isatty(process.stderr.fd)},t.destroy=r.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=oo();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const s=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[s]=r,e}),{}),e.exports=Vn()(t);const{formatters:n}=e.exports;n.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},n.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(ro,ro.exports)),ro.exports}function ao(){return Xn||(Xn=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?zn.exports=(Gn||(Gn=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;t.splice(1,0,s,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(n=r))})),t.splice(n,0,s)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Vn()(t);const{formatters:s}=e.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Wn,Wn.exports)),Wn.exports):zn.exports=io()),zn.exports}var co=function(){if(so)return Hn.exports;so=1;var e,t,s,i=r,a=i.URL,u=n,h=o,d=c.Writable,p=l,_=function(){return to||(to=1,eo=function(){if(!e){try{e=ao()("follow-redirects")}catch(e){}"function"!=typeof e&&(e=function(){})}e.apply(null,arguments)}),eo;var e}();e="undefined"!=typeof process,t="undefined"!=typeof window&&"undefined"!=typeof document,s=B(Error.captureStackTrace),e||!t&&s||console.warn("The follow-redirects package should be excluded from browser builds.");var f=!1;try{p(new a(""))}catch(e){f="ERR_INVALID_URL"===e.code}var m=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],g=["abort","aborted","connect","error","socket","timeout"],E=Object.create(null);g.forEach((function(e){E[e]=function(t,s,r){this._redirectable.emit(e,t,s,r)}}));var T=w("ERR_INVALID_URL","Invalid URL",TypeError),R=w("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),A=w("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",R),S=w("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),L=w("ERR_STREAM_WRITE_AFTER_END","write after end"),y=d.prototype.destroy||C;function b(e,t){d.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var s=this;this._onNativeResponse=function(e){try{s._processResponse(e)}catch(e){s.emit("error",e instanceof R?e:new R({cause:e}))}},this._performRequest()}function v(e){var t={maxRedirects:21,maxBodyLength:10485760},s={};return Object.keys(e).forEach((function(r){var n=r+":",o=s[n]=e[r],i=t[r]=Object.create(o);Object.defineProperties(i,{request:{value:function(e,r,o){var i;return i=e,a&&i instanceof a?e=N(e):P(e)?e=N(O(e)):(o=r,r=I(e),e={protocol:n}),B(r)&&(o=r,r=null),(r=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,r)).nativeProtocols=s,P(r.host)||P(r.hostname)||(r.hostname="::1"),p.equal(r.protocol,n,"protocol mismatch"),_("options",r),new b(r,o)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,s){var r=i.request(e,t,s);return r.end(),r},configurable:!0,enumerable:!0,writable:!0}})})),t}function C(){}function O(e){var t;if(f)t=new a(e);else if(!P((t=I(i.parse(e))).protocol))throw new T({input:e});return t}function I(e){if(/^\[/.test(e.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(e.hostname))throw new T({input:e.href||e});if(/^\[/.test(e.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(e.host))throw new T({input:e.href||e});return e}function N(e,t){var s=t||{};for(var r of m)s[r]=e[r];return s.hostname.startsWith("[")&&(s.hostname=s.hostname.slice(1,-1)),""!==s.port&&(s.port=Number(s.port)),s.path=s.search?s.pathname+s.search:s.pathname,s}function M(e,t){var s;for(var r in t)e.test(r)&&(s=t[r],delete t[r]);return null==s?void 0:String(s).trim()}function w(e,t,s){function r(s){B(Error.captureStackTrace)&&Error.captureStackTrace(this,this.constructor),Object.assign(this,s||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return r.prototype=new(s||Error),Object.defineProperties(r.prototype,{constructor:{value:r,enumerable:!1},name:{value:"Error ["+e+"]",enumerable:!1}}),r}function U(e,t){for(var s of g)e.removeListener(s,E[s]);e.on("error",C),e.destroy(t)}function P(e){return"string"==typeof e||e instanceof String}function B(e){return"function"==typeof e}return b.prototype=Object.create(d.prototype),b.prototype.abort=function(){U(this._currentRequest),this._currentRequest.abort(),this.emit("abort")},b.prototype.destroy=function(e){return U(this._currentRequest,e),y.call(this,e),this},b.prototype.write=function(e,t,s){if(this._ending)throw new L;if(!P(e)&&("object"!=typeof(r=e)||!("length"in r)))throw new TypeError("data should be a string, Buffer or Uint8Array");var r;B(t)&&(s=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,s)):(this.emit("error",new S),this.abort()):s&&s()},b.prototype.end=function(e,t,s){if(B(e)?(s=e,e=t=null):B(t)&&(s=t,t=null),e){var r=this,n=this._currentRequest;this.write(e,t,(function(){r._ended=!0,n.end(null,null,s)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,s)},b.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},b.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},b.prototype.setTimeout=function(e,t){var s=this;function r(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function n(t){s._timeout&&clearTimeout(s._timeout),s._timeout=setTimeout((function(){s.emit("timeout"),o()}),e),r(t)}function o(){s._timeout&&(clearTimeout(s._timeout),s._timeout=null),s.removeListener("abort",o),s.removeListener("error",o),s.removeListener("response",o),s.removeListener("close",o),t&&s.removeListener("timeout",t),s.socket||s._currentRequest.removeListener("socket",n)}return t&&this.on("timeout",t),this.socket?n(this.socket):this._currentRequest.once("socket",n),this.on("socket",r),this.on("abort",o),this.on("error",o),this.on("response",o),this.on("close",o),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){b.prototype[e]=function(t,s){return this._currentRequest[e](t,s)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(b.prototype,e,{get:function(){return this._currentRequest[e]}})})),b.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},b.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(!t)throw new TypeError("Unsupported protocol "+e);if(this._options.agents){var s=e.slice(0,-1);this._options.agent=this._options.agents[s]}var r=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var n of(r._redirectable=this,g))r.on(n,E[n]);if(this._currentUrl=/^\//.test(this._options.path)?i.format(this._options):this._options.path,this._isRedirect){var o=0,a=this,c=this._requestBodyBuffers;!function e(t){if(r===a._currentRequest)if(t)a.emit("error",t);else if(o<c.length){var s=c[o++];r.finished||r.write(s.data,s.encoding,e)}else a._ended&&r.end()}()}},b.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var s,r=e.headers.location;if(!r||!1===this._options.followRedirects||t<300||t>=400)return e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),void(this._requestBodyBuffers=[]);if(U(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)throw new A;var n=this._options.beforeRedirect;n&&(s=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var o=this._options.method;((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],M(/^content-/i,this._options.headers));var c,l,u=M(/^host$/i,this._options.headers),h=O(this._currentUrl),d=u||h.host,m=/^\w+:/.test(r)?this._currentUrl:i.format(Object.assign(h,{host:d})),g=(c=r,l=m,f?new a(c,l):O(i.resolve(l,c)));if(_("redirecting to",g.href),this._isRedirect=!0,N(g,this._options),(g.protocol!==h.protocol&&"https:"!==g.protocol||g.host!==d&&!function(e,t){p(P(e)&&P(t));var s=e.length-t.length-1;return s>0&&"."===e[s]&&e.endsWith(t)}(g.host,d))&&M(/^(?:(?:proxy-)?authorization|cookie)$/i,this._options.headers),B(n)){var E={headers:e.headers,statusCode:t},T={url:m,method:o,headers:s};n(this._options,E,T),this._sanitizeOptions(this._options)}this._performRequest()},Hn.exports=v({http:u,https:h}),Hn.exports.wrap=v,Hn.exports}();const lo=jn(co),uo="1.14.0";function ho(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const po=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;const _o=Symbol("internals");class fo extends c.Transform{constructor(e){super({readableHighWaterMark:(e=Jr.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!Jr.isUndefined(t[e])))).chunkSize});const t=this[_o]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",(e=>{"progress"===e&&(t.isCaptured||(t.isCaptured=!0))}))}_read(e){const t=this[_o];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,s){const r=this[_o],n=r.maxRate,o=this.readableHighWaterMark,i=r.timeWindow,a=n/(1e3/i),c=!1!==r.minChunkSize?Math.max(r.minChunkSize,.01*a):0,l=(e,t)=>{const s=Buffer.byteLength(e);r.bytesSeen+=s,r.bytes+=s,r.isCaptured&&this.emit("progress",r.bytesSeen),this.push(e)?process.nextTick(t):r.onReadCallback=()=>{r.onReadCallback=null,process.nextTick(t)}},u=(e,t)=>{const s=Buffer.byteLength(e);let u,h=null,d=o,p=0;if(n){const e=Date.now();(!r.ts||(p=e-r.ts)>=i)&&(r.ts=e,u=a-r.bytes,r.bytes=u<0?-u:0,p=0),u=a-r.bytes}if(n){if(u<=0)return setTimeout((()=>{t(null,e)}),i-p);u<d&&(d=u)}d&&s>d&&s-d>c&&(h=e.subarray(d),e=e.subarray(0,d)),l(e,h?()=>{process.nextTick(t,null,h)}:t)};u(e,(function e(t,r){if(t)return s(t);r?u(r,e):s(null)}))}}const{asyncIterator:mo}=Symbol,go=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[mo]?yield*e[mo]():yield e},Eo=Rn.ALPHABET.ALPHA_DIGIT+"-_",To="function"==typeof TextEncoder?new TextEncoder:new a.TextEncoder,Ro="\r\n",Ao=To.encode(Ro);class So{constructor(e,t){const{escapeName:s}=this.constructor,r=Jr.isString(t);let n=`Content-Disposition: form-data; name="${s(e)}"${!r&&t.name?`; filename="${s(t.name)}"`:""}${Ro}`;r?t=To.encode(String(t).replace(/\r?\n|\r\n?/g,Ro)):n+=`Content-Type: ${t.type||"application/octet-stream"}${Ro}`,this.headers=To.encode(n+Ro),this.contentLength=r?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+2,this.name=e,this.value=t}async*encode(){yield this.headers;const{value:e}=this;Jr.isTypedArray(e)?yield e:yield*go(e),yield Ao}static escapeName(e){return String(e).replace(/[\r\n"]/g,(e=>({"\r":"%0D","\n":"%0A",'"':"%22"}[e])))}}class Lo extends c.Transform{__transform(e,t,s){this.push(e),s()}_transform(e,t,s){if(0!==e.length&&(this._transform=this.__transform,120!==e[0])){const e=Buffer.alloc(2);e[0]=120,e[1]=156,this.push(e,t)}this.__transform(e,t,s)}}const yo=(e,t)=>Jr.isAsyncFn(e)?function(...s){const r=s.pop();e.apply(this,s).then((e=>{try{t?r(null,...t(e)):r(null,e)}catch(e){r(e)}}),r)}:e;const bo=(e,t,s=3)=>{let r=0;const n=function(e,t){e=e||10;const s=new Array(e),r=new Array(e);let n,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[i];n||(n=c),s[o]=a,r[o]=c;let u=i,h=0;for(;u!==o;)h+=s[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-n<t)return;const d=l&&c-l;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let s,r,n=0,o=1e3/t;const i=(t,o=Date.now())=>{n=o,s=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-n;a>=o?i(e,t):(s=e,r||(r=setTimeout((()=>{r=null,i(s)}),o-a)))},()=>s&&i(s)]}((s=>{const o=s.loaded,i=s.lengthComputable?s.total:void 0,a=o-r,c=n(a);r=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:s,lengthComputable:null!=i,[t?"download":"upload"]:!0})}),s)},vo=(e,t)=>{const s=null!=e;return[r=>t[0]({lengthComputable:s,total:e,loaded:r}),t[1]]},Co=e=>(...t)=>Jr.asap((()=>e(...t)));const Oo={flush:d.constants.Z_SYNC_FLUSH,finishFlush:d.constants.Z_SYNC_FLUSH},Io={flush:d.constants.BROTLI_OPERATION_FLUSH,finishFlush:d.constants.BROTLI_OPERATION_FLUSH},No=Jr.isFunction(d.createBrotliDecompress),{http:Mo,https:wo}=lo,Uo=/https:?/,Po=Rn.protocols.map((e=>e+":")),Bo=(e,[t,s])=>(e.on("end",s).on("error",s),t);const ko=new class{constructor(){this.sessions=Object.create(null)}getSession(e,t){t=Object.assign({sessionTimeout:1e3},t);let s=this.sessions[e];if(s){let e=s.length;for(let r=0;r<e;r++){const[e,n]=s[r];if(!e.destroyed&&!e.closed&&a.isDeepStrictEqual(n,t))return e}}const r=i.connect(e,t);let n;const o=()=>{if(n)return;n=!0;let t=s,o=t.length,i=o;for(;i--;)if(t[i][0]===r)return 1===o?delete this.sessions[e]:t.splice(i,1),void(r.closed||r.close())},c=r.request,{sessionTimeout:l}=t;if(null!=l){let e,t=0;r.request=function(){const s=c.apply(this,arguments);return t++,e&&(clearTimeout(e),e=null),s.once("close",(()=>{--t||(e=setTimeout((()=>{e=null,o()}),l))})),s}}r.once("close",o);let u=[r,t];return s?s.push(u):s=this.sessions[e]=[u],r}};function jo(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function Do(e,t,s){let r=t;if(!r&&!1!==r){const e=Bn(s);e&&(r=new URL(e))}if(r){if(r.username&&(r.auth=(r.username||"")+":"+(r.password||"")),r.auth){if(Boolean(r.auth.username||r.auth.password))r.auth=(r.auth.username||"")+":"+(r.auth.password||"");else if("object"==typeof r.auth)throw new Qr("Invalid proxy authorization",Qr.ERR_BAD_OPTION,{proxy:r});const t=Buffer.from(r.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=r.hostname||r.host;e.hostname=t,e.host=t,e.port=r.port,e.path=s,r.protocol&&(e.protocol=r.protocol.includes(":")?r.protocol:`${r.protocol}:`)}e.beforeRedirects.proxy=function(e){Do(e,t,e.href)}}const xo="undefined"!=typeof process&&"process"===Jr.kindOf(process),Fo=(e,t)=>(({address:e,family:t})=>{if(!Jr.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}})(Jr.isObject(e)?e:{address:e,family:t}),qo={request(e,t){const s=e.protocol+"//"+e.hostname+":"+(e.port||("https:"===e.protocol?443:80)),{http2Options:r,headers:n}=e,o=ko.getSession(s,r),{HTTP2_HEADER_SCHEME:a,HTTP2_HEADER_METHOD:c,HTTP2_HEADER_PATH:l,HTTP2_HEADER_STATUS:u}=i.constants,h={[a]:e.protocol.replace(":",""),[c]:e.method,[l]:e.path};Jr.forEach(n,((e,t)=>{":"!==t.charAt(0)&&(h[t]=e)}));const d=o.request(h);return d.once("response",(e=>{const s=d,r=(e=Object.assign({},e))[u];delete e[u],s.headers=e,s.statusCode=+r,t(s)})),d}},Go=xo&&function(e){return t=async function(t,s,r){let{data:i,lookup:l,family:u,httpVersion:h=1,http2Options:_}=e;const{responseType:f,responseEncoding:m}=e,g=e.method.toUpperCase();let E,T,R=!1;if(h=+h,Number.isNaN(h))throw TypeError(`Invalid protocol version: '${e.httpVersion}' is not a number`);if(1!==h&&2!==h)throw TypeError(`Unsupported protocol version '${h}'`);const A=2===h;if(l){const e=yo(l,(e=>Jr.isArray(e)?e:[e]));l=(t,s,r)=>{e(t,s,((e,t,n)=>{if(e)return r(e);const o=Jr.isArray(t)?t.map((e=>Fo(e))):[Fo(t,n)];s.all?r(e,o):r(e,o[0].address,o[0].family)}))}}const S=new p.EventEmitter;function L(t){try{S.emit("abort",!t||t.type?new Mn(null,e,T):t)}catch(e){console.warn("emit error",e)}}S.once("abort",s);const y=()=>{e.cancelToken&&e.cancelToken.unsubscribe(L),e.signal&&e.signal.removeEventListener("abort",L),S.removeAllListeners()};(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(L),e.signal&&(e.signal.aborted?L():e.signal.addEventListener("abort",L))),r(((e,t)=>{if(E=!0,t)return R=!0,void y();const{data:s}=e;if(s instanceof c.Readable||s instanceof c.Duplex){const e=c.finished(s,(()=>{e(),y()}))}else y()}));const b=Un(e.baseURL,e.url,e.allowAbsoluteUrls),v=new URL(b,Rn.hasBrowserEnv?Rn.origin:void 0),C=v.protocol||Po[0];if("data:"===C){if(e.maxContentLength>-1){const t=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const s=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(s)){let e=r.length;const t=r.length;for(let s=0;s<t;s++)if(37===r.charCodeAt(s)&&s+2<t){const t=r.charCodeAt(s+1),n=r.charCodeAt(s+2);(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102)&&(e-=2,s+=2)}let s=0,n=t-1;const o=e=>e>=2&&37===r.charCodeAt(e-2)&&51===r.charCodeAt(e-1)&&(68===r.charCodeAt(e)||100===r.charCodeAt(e));n>=0&&(61===r.charCodeAt(n)?(s++,n--):o(n)&&(s++,n-=3)),1===s&&n>=0&&(61===r.charCodeAt(n)||o(n))&&s++;const i=3*Math.floor(e/4)-(s||0);return i>0?i:0}return Buffer.byteLength(r,"utf8")}(String(e.url||b||""));if(t>e.maxContentLength)return s(new Qr("maxContentLength size of "+e.maxContentLength+" exceeded",Qr.ERR_BAD_RESPONSE,e))}let r;if("GET"!==g)return wn(t,s,{status:405,statusText:"method not allowed",headers:{},config:e});try{r=function(e,t,s){const r=s&&s.Blob||Rn.classes.Blob,n=ho(e);if(void 0===t&&r&&(t=!0),"data"===n){e=n.length?e.slice(n.length+1):e;const s=po.exec(e);if(!s)throw new Qr("Invalid URL",Qr.ERR_INVALID_URL);const o=s[1],i=s[2],a=s[3],c=Buffer.from(decodeURIComponent(a),i?"base64":"utf8");if(t){if(!r)throw new Qr("Blob is not supported",Qr.ERR_NOT_SUPPORT);return new r([c],{type:o})}return c}throw new Qr("Unsupported protocol "+n,Qr.ERR_NOT_SUPPORT)}(e.url,"blob"===f,{Blob:e.env&&e.env.Blob})}catch(t){throw Qr.from(t,Qr.ERR_BAD_REQUEST,e)}return"text"===f?(r=r.toString(m),m&&"utf8"!==m||(r=Jr.stripBOM(r))):"stream"===f&&(r=c.Readable.from(r)),wn(t,s,{data:r,status:200,statusText:"OK",headers:new On,config:e})}if(-1===Po.indexOf(C))return s(new Qr("Unsupported protocol "+C,Qr.ERR_BAD_REQUEST,e));const O=On.from(e.headers).normalize();O.set("User-Agent","axios/"+uo,!1);const{onUploadProgress:I,onDownloadProgress:N}=e,M=e.maxRate;let w,U;if(Jr.isSpecCompliantForm(i)){const e=O.getContentType(/boundary=([-_\w\d]{10,70})/i);i=((e,t,s)=>{const{tag:r="form-data-boundary",size:n=25,boundary:o=r+"-"+Rn.generateString(n,Eo)}=s||{};if(!Jr.isFormData(e))throw TypeError("FormData instance required");if(o.length<1||o.length>70)throw Error("boundary must be 10-70 characters long");const i=To.encode("--"+o+Ro),a=To.encode("--"+o+"--"+Ro);let l=a.byteLength;const u=Array.from(e.entries()).map((([e,t])=>{const s=new So(e,t);return l+=s.size,s}));l+=i.byteLength*u.length,l=Jr.toFiniteNumber(l);const h={"Content-Type":`multipart/form-data; boundary=${o}`};return Number.isFinite(l)&&(h["Content-Length"]=l),t&&t(h),c.Readable.from(async function*(){for(const e of u)yield i,yield*e.encode();yield a}())})(i,(e=>{O.set(e)}),{tag:`axios-${uo}-boundary`,boundary:e&&e[1]||void 0})}else if(Jr.isFormData(i)&&Jr.isFunction(i.getHeaders)){if(O.set(i.getHeaders()),!O.hasContentLength())try{const e=await a.promisify(i.getLength).call(i);Number.isFinite(e)&&e>=0&&O.setContentLength(e)}catch(e){}}else if(Jr.isBlob(i)||Jr.isFile(i))i.size&&O.setContentType(i.type||"application/octet-stream"),O.setContentLength(i.size||0),i=c.Readable.from(go(i));else if(i&&!Jr.isStream(i)){if(Buffer.isBuffer(i));else if(Jr.isArrayBuffer(i))i=Buffer.from(new Uint8Array(i));else{if(!Jr.isString(i))return s(new Qr("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Qr.ERR_BAD_REQUEST,e));i=Buffer.from(i,"utf-8")}if(O.setContentLength(i.length,!1),e.maxBodyLength>-1&&i.length>e.maxBodyLength)return s(new Qr("Request body larger than maxBodyLength limit",Qr.ERR_BAD_REQUEST,e))}const P=Jr.toFiniteNumber(O.getContentLength());let B,k;Jr.isArray(M)?(w=M[0],U=M[1]):w=U=M,i&&(I||w)&&(Jr.isStream(i)||(i=c.Readable.from(i,{objectMode:!1})),i=c.pipeline([i,new fo({maxRate:Jr.toFiniteNumber(w)})],Jr.noop),I&&i.on("progress",Bo(i,vo(P,bo(Co(I),!1,3))))),e.auth&&(B=(e.auth.username||"")+":"+(e.auth.password||"")),!B&&v.username&&(B=v.username+":"+v.password),B&&O.delete("authorization");try{k=an(v.pathname+v.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const r=new Error(t.message);return r.config=e,r.url=e.url,r.exists=!0,s(r)}O.set("Accept-Encoding","gzip, compress, deflate"+(No?", br":""),!1);const j={path:k,method:g,headers:O.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:B,protocol:C,family:u,beforeRedirect:jo,beforeRedirects:{},http2Options:_};let D;!Jr.isUndefined(l)&&(j.lookup=l),e.socketPath?j.socketPath=e.socketPath:(j.hostname=v.hostname.startsWith("[")?v.hostname.slice(1,-1):v.hostname,j.port=v.port,Do(j,e.proxy,C+"//"+v.hostname+(v.port?":"+v.port:"")+j.path));const x=Uo.test(j.protocol);if(j.agent=x?e.httpsAgent:e.httpAgent,A?D=qo:e.transport?D=e.transport:0===e.maxRedirects?D=x?o:n:(e.maxRedirects&&(j.maxRedirects=e.maxRedirects),e.beforeRedirect&&(j.beforeRedirects.config=e.beforeRedirect),D=x?wo:Mo),e.maxBodyLength>-1?j.maxBodyLength=e.maxBodyLength:j.maxBodyLength=1/0,e.insecureHTTPParser&&(j.insecureHTTPParser=e.insecureHTTPParser),T=D.request(j,(function(r){if(T.destroyed)return;const n=[r],o=Jr.toFiniteNumber(r.headers["content-length"]);if(N||U){const e=new fo({maxRate:Jr.toFiniteNumber(U)});N&&e.on("progress",Bo(e,vo(o,bo(Co(N),!0,3)))),n.push(e)}let i=r;const a=r.req||T;if(!1!==e.decompress&&r.headers["content-encoding"])switch("HEAD"!==g&&204!==r.statusCode||delete r.headers["content-encoding"],(r.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":n.push(d.createUnzip(Oo)),delete r.headers["content-encoding"];break;case"deflate":n.push(new Lo),n.push(d.createUnzip(Oo)),delete r.headers["content-encoding"];break;case"br":No&&(n.push(d.createBrotliDecompress(Io)),delete r.headers["content-encoding"])}i=n.length>1?c.pipeline(n,Jr.noop):n[0];const l={status:r.statusCode,statusText:r.statusMessage,headers:new On(r.headers),config:e,request:a};if("stream"===f)l.data=i,wn(t,s,l);else{const r=[];let n=0;i.on("data",(function(t){r.push(t),n+=t.length,e.maxContentLength>-1&&n>e.maxContentLength&&(R=!0,i.destroy(),L(new Qr("maxContentLength size of "+e.maxContentLength+" exceeded",Qr.ERR_BAD_RESPONSE,e,a)))})),i.on("aborted",(function(){if(R)return;const t=new Qr("stream has been aborted",Qr.ERR_BAD_RESPONSE,e,a);i.destroy(t),s(t)})),i.on("error",(function(t){T.destroyed||s(Qr.from(t,null,e,a))})),i.on("end",(function(){try{let e=1===r.length?r[0]:Buffer.concat(r);"arraybuffer"!==f&&(e=e.toString(m),m&&"utf8"!==m||(e=Jr.stripBOM(e))),l.data=e}catch(t){return s(Qr.from(t,null,e,l.request,l))}wn(t,s,l)}))}S.once("abort",(e=>{i.destroyed||(i.emit("error",e),i.destroy())}))})),S.once("abort",(e=>{T.close?T.close():T.destroy(e)})),T.on("error",(function(t){s(Qr.from(t,null,e,T))})),T.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(Number.isNaN(t))return void L(new Qr("error trying to parse `config.timeout` to int",Qr.ERR_BAD_OPTION_VALUE,e,T));T.setTimeout(t,(function(){if(E)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const s=e.transitional||ln;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),L(new Qr(t,s.clarifyTimeoutError?Qr.ETIMEDOUT:Qr.ECONNABORTED,e,T))}))}else T.setTimeout(0);if(Jr.isStream(i)){let t=!1,s=!1;i.on("end",(()=>{t=!0})),i.once("error",(e=>{s=!0,T.destroy(e)})),i.on("close",(()=>{t||s||L(new Mn("Request stream has been aborted",e,T))})),i.pipe(T)}else i&&T.write(i),T.end()},new Promise(((e,s)=>{let r,n;const o=(e,t)=>{n||(n=!0,r&&r(e,t))},i=e=>{o(e,!0),s(e)};t((t=>{o(t),e(t)}),i,(e=>r=e)).catch(i)}));var t},Ho=Rn.hasStandardBrowserEnv?((e,t)=>s=>(s=new URL(s,Rn.origin),e.protocol===s.protocol&&e.host===s.host&&(t||e.port===s.port)))(new URL(Rn.origin),Rn.navigator&&/(msie|trident)/i.test(Rn.navigator.userAgent)):()=>!0,zo=Rn.hasStandardBrowserEnv?{write(e,t,s,r,n,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Jr.isNumber(s)&&a.push(`expires=${new Date(s).toUTCString()}`),Jr.isString(r)&&a.push(`path=${r}`),Jr.isString(n)&&a.push(`domain=${n}`),!0===o&&a.push("secure"),Jr.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}},Wo=e=>e instanceof On?{...e}:e;function $o(e,t){t=t||{};const s={};function r(e,t,s,r){return Jr.isPlainObject(e)&&Jr.isPlainObject(t)?Jr.merge.call({caseless:r},e,t):Jr.isPlainObject(t)?Jr.merge({},t):Jr.isArray(t)?t.slice():t}function n(e,t,s,n){return Jr.isUndefined(t)?Jr.isUndefined(e)?void 0:r(void 0,e,0,n):r(e,t,0,n)}function o(e,t){if(!Jr.isUndefined(t))return r(void 0,t)}function i(e,t){return Jr.isUndefined(t)?Jr.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(s,n,o){return o in t?r(s,n):o in e?r(void 0,s):void 0}const c={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:(e,t,s)=>n(Wo(e),Wo(t),0,!0)};return Jr.forEach(Object.keys({...e,...t}),(function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const o=Jr.hasOwnProp(c,r)?c[r]:n,i=o(e[r],t[r],r);Jr.isUndefined(i)&&o!==a||(s[r]=i)})),s}const Vo=e=>{const t=$o({},e);let{data:s,withXSRFToken:r,xsrfHeaderName:n,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=On.from(i),t.url=an(Un(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Jr.isFormData(s))if(Rn.hasStandardBrowserEnv||Rn.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(Jr.isFunction(s.getHeaders)){const e=s.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach((([e,s])=>{t.includes(e.toLowerCase())&&i.set(e,s)}))}if(Rn.hasStandardBrowserEnv&&(r&&Jr.isFunction(r)&&(r=r(t)),r||!1!==r&&Ho(t.url))){const e=n&&o&&zo.read(o);e&&i.set(n,e)}return t},Ko="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,s){const r=Vo(e);let n=r.data;const o=On.from(r.headers).normalize();let i,a,c,l,u,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function _(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let f=new XMLHttpRequest;function m(){if(!f)return;const r=On.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());wn((function(e){t(e),_()}),(function(e){s(e),_()}),{data:h&&"text"!==h&&"json"!==h?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:r,config:e,request:f}),f=null}f.open(r.method.toUpperCase(),r.url,!0),f.timeout=r.timeout,"onloadend"in f?f.onloadend=m:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(m)},f.onabort=function(){f&&(s(new Qr("Request aborted",Qr.ECONNABORTED,e,f)),f=null)},f.onerror=function(t){const r=t&&t.message?t.message:"Network Error",n=new Qr(r,Qr.ERR_NETWORK,e,f);n.event=t||null,s(n),f=null},f.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const n=r.transitional||ln;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),s(new Qr(t,n.clarifyTimeoutError?Qr.ETIMEDOUT:Qr.ECONNABORTED,e,f)),f=null},void 0===n&&o.setContentType(null),"setRequestHeader"in f&&Jr.forEach(o.toJSON(),(function(e,t){f.setRequestHeader(t,e)})),Jr.isUndefined(r.withCredentials)||(f.withCredentials=!!r.withCredentials),h&&"json"!==h&&(f.responseType=r.responseType),p&&([c,u]=bo(p,!0),f.addEventListener("progress",c)),d&&f.upload&&([a,l]=bo(d),f.upload.addEventListener("progress",a),f.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{f&&(s(!t||t.type?new Mn(null,e,f):t),f.abort(),f=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const g=ho(r.url);g&&-1===Rn.protocols.indexOf(g)?s(new Qr("Unsupported protocol "+g+":",Qr.ERR_BAD_REQUEST,e)):f.send(n||null)}))},Jo=(e,t)=>{const{length:s}=e=e?e.filter(Boolean):[];if(t||s){let s,r=new AbortController;const n=function(e){if(!s){s=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Qr?t:new Mn(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,n(new Qr(`timeout of ${t}ms exceeded`,Qr.ETIMEDOUT))}),t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(n):e.removeEventListener("abort",n)})),e=null)};e.forEach((e=>e.addEventListener("abort",n)));const{signal:a}=r;return a.unsubscribe=()=>Jr.asap(i),a}},Qo=function*(e,t){let s=e.byteLength;if(s<t)return void(yield e);let r,n=0;for(;n<s;)r=n+t,yield e.slice(n,r),n=r},Yo=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:s}=await t.read();if(e)break;yield s}}finally{await t.cancel()}},Zo=(e,t,s,r)=>{const n=async function*(e,t){for await(const s of Yo(e))yield*Qo(s,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await n.next();if(t)return a(),void e.close();let o=r.byteLength;if(s){let e=i+=o;s(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),n.return())},{highWaterMark:2})},{isFunction:Xo}=Jr,ei=(({Request:e,Response:t})=>({Request:e,Response:t}))(Jr.global),{ReadableStream:ti,TextEncoder:si}=Jr.global,ri=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},ni=e=>{e=Jr.merge.call({skipUndefined:!0},ei,e);const{fetch:t,Request:s,Response:r}=e,n=t?Xo(t):"function"==typeof fetch,o=Xo(s),i=Xo(r);if(!n)return!1;const a=n&&Xo(ti),c=n&&("function"==typeof si?(l=new si,e=>l.encode(e)):async e=>new Uint8Array(await new s(e).arrayBuffer()));var l;const u=o&&a&&ri((()=>{let e=!1;const t=new ti,r=new s(Rn.origin,{body:t,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return t.cancel(),e&&!r})),h=i&&a&&ri((()=>Jr.isReadableStream(new r("").body))),d={stream:h&&(e=>e.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!d[e]&&(d[e]=(t,s)=>{let r=t&&t[e];if(r)return r.call(t);throw new Qr(`Response type '${e}' is not supported`,Qr.ERR_NOT_SUPPORT,s)})}));const p=async(e,t)=>{const r=Jr.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Jr.isBlob(e))return e.size;if(Jr.isSpecCompliantForm(e)){const t=new s(Rn.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Jr.isArrayBufferView(e)||Jr.isArrayBuffer(e)?e.byteLength:(Jr.isURLSearchParams(e)&&(e+=""),Jr.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:n,method:i,data:a,signal:c,cancelToken:l,timeout:_,onDownloadProgress:f,onUploadProgress:m,responseType:g,headers:E,withCredentials:T="same-origin",fetchOptions:R}=Vo(e),A=t||fetch;g=g?(g+"").toLowerCase():"text";let S=Jo([c,l&&l.toAbortSignal()],_),L=null;const y=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let b;try{if(m&&u&&"get"!==i&&"head"!==i&&0!==(b=await p(E,a))){let e,t=new s(n,{method:"POST",body:a,duplex:"half"});if(Jr.isFormData(a)&&(e=t.headers.get("content-type"))&&E.setContentType(e),t.body){const[e,s]=vo(b,bo(Co(m)));a=Zo(t.body,65536,e,s)}}Jr.isString(T)||(T=T?"include":"omit");const t=o&&"credentials"in s.prototype,c={...R,signal:S,method:i.toUpperCase(),headers:E.normalize().toJSON(),body:a,duplex:"half",credentials:t?T:void 0};L=o&&new s(n,c);let l=await(o?A(L,R):A(n,c));const _=h&&("stream"===g||"response"===g);if(h&&(f||_&&y)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=l[t]}));const t=Jr.toFiniteNumber(l.headers.get("content-length")),[s,n]=f&&vo(t,bo(Co(f),!0))||[];l=new r(Zo(l.body,65536,s,(()=>{n&&n(),y&&y()})),e)}g=g||"text";let v=await d[Jr.findKey(d,g)||"text"](l,e);return!_&&y&&y(),await new Promise(((t,s)=>{wn(t,s,{data:v,headers:On.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:L})}))}catch(t){if(y&&y(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Qr("Network Error",Qr.ERR_NETWORK,e,L,t&&t.response),{cause:t.cause||t});throw Qr.from(t,t&&t.code,e,L,t&&t.response)}}},oi=new Map,ii=e=>{let t=e&&e.env||{};const{fetch:s,Request:r,Response:n}=t,o=[r,n,s];let i,a,c=o.length,l=oi;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:ni(t)),l=a;return a};ii();const ai={http:Go,xhr:Ko,fetch:{get:ii}};Jr.forEach(ai,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const ci=e=>`- ${e}`,li=e=>Jr.isFunction(e)||null===e||!1===e;const ui={getAdapter:function(e,t){e=Jr.isArray(e)?e:[e];const{length:s}=e;let r,n;const o={};for(let i=0;i<s;i++){let s;if(r=e[i],n=r,!li(r)&&(n=ai[(s=String(r)).toLowerCase()],void 0===n))throw new Qr(`Unknown adapter '${s}'`);if(n&&(Jr.isFunction(n)||(n=n.get(t))))break;o[s||"#"+i]=n}if(!n){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));let t=s?e.length>1?"since :\n"+e.map(ci).join("\n"):" "+ci(e[0]):"as no adapter specified";throw new Qr("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return n},adapters:ai};function hi(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Mn(null,e)}function di(e){hi(e),e.headers=On.from(e.headers),e.data=In.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ui.getAdapter(e.adapter||Sn.adapter,e)(e).then((function(t){return hi(e),t.data=In.call(e,e.transformResponse,t),t.headers=On.from(t.headers),t}),(function(t){return Nn(t)||(hi(e),t&&t.response&&(t.response.data=In.call(e,e.transformResponse,t.response),t.response.headers=On.from(t.response.headers))),Promise.reject(t)}))}const pi={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{pi[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}}));const _i={};pi.transitional=function(e,t,s){function r(e,t){return"[Axios v"+uo+"] Transitional option '"+e+"'"+t+(s?". "+s:"")}return(s,n,o)=>{if(!1===e)throw new Qr(r(n," has been removed"+(t?" in "+t:"")),Qr.ERR_DEPRECATED);return t&&!_i[n]&&(_i[n]=!0,console.warn(r(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(s,n,o)}},pi.spelling=function(e){return(t,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)};const fi={assertOptions:function(e,t,s){if("object"!=typeof e)throw new Qr("options must be an object",Qr.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let n=r.length;for(;n-- >0;){const o=r[n],i=t[o];if(i){const t=e[o],s=void 0===t||i(t,o,e);if(!0!==s)throw new Qr("option "+o+" must be "+s,Qr.ERR_BAD_OPTION_VALUE)}else if(!0!==s)throw new Qr("Unknown option "+o,Qr.ERR_BAD_OPTION)}},validators:pi},mi=fi.validators;let gi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new cn,response:new cn}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const s=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?s&&!String(e.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+s):e.stack=s}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=$o(this.defaults,t);const{transitional:s,paramsSerializer:r,headers:n}=t;void 0!==s&&fi.assertOptions(s,{silentJSONParsing:mi.transitional(mi.boolean),forcedJSONParsing:mi.transitional(mi.boolean),clarifyTimeoutError:mi.transitional(mi.boolean),legacyInterceptorReqResOrdering:mi.transitional(mi.boolean)},!1),null!=r&&(Jr.isFunction(r)?t.paramsSerializer={serialize:r}:fi.assertOptions(r,{encode:mi.function,serialize:mi.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),fi.assertOptions(t,{baseUrl:mi.spelling("baseURL"),withXsrfToken:mi.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=n&&Jr.merge(n.common,n[t.method]);n&&Jr.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete n[e]})),t.headers=On.concat(o,n);const i=[];let a=!0;this.interceptors.request.forEach((function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const s=t.transitional||ln;s&&s.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(e.fulfilled,e.rejected)}));const c=[];let l;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,h=0;if(!a){const e=[di.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);h<u;)l=l.then(e[h++],e[h++]);return l}u=i.length;let d=t;for(;h<u;){const e=i[h++],t=i[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{l=di.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,u=c.length;h<u;)l=l.then(c[h++],c[h++]);return l}getUri(e){return an(Un((e=$o(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Jr.forEach(["delete","get","head","options"],(function(e){gi.prototype[e]=function(t,s){return this.request($o(s||{},{method:e,url:t,data:(s||{}).data}))}})),Jr.forEach(["post","put","patch"],(function(e){function t(t){return function(s,r,n){return this.request($o(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:s,data:r}))}}gi.prototype[e]=t(),gi.prototype[e+"Form"]=t(!0)}));const Ei={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ei).forEach((([e,t])=>{Ei[t]=e}));const Ti=function e(t){const s=new gi(t),r=rr(gi.prototype.request,s);return Jr.extend(r,gi.prototype,s,{allOwnKeys:!0}),Jr.extend(r,s,null,{allOwnKeys:!0}),r.create=function(s){return e($o(t,s))},r}(Sn);Ti.Axios=gi,Ti.CanceledError=Mn,Ti.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const s=this;this.promise.then((e=>{if(!s._listeners)return;let t=s._listeners.length;for(;t-- >0;)s._listeners[t](e);s._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{s.subscribe(e),t=e})).then(e);return r.cancel=function(){s.unsubscribe(t)},r},e((function(e,r,n){s.reason||(s.reason=new Mn(e,r,n),t(s.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}},Ti.isCancel=Nn,Ti.VERSION=uo,Ti.toFormData=tn,Ti.AxiosError=Qr,Ti.Cancel=Ti.CanceledError,Ti.all=function(e){return Promise.all(e)},Ti.spread=function(e){return function(t){return e.apply(null,t)}},Ti.isAxiosError=function(e){return Jr.isObject(e)&&!0===e.isAxiosError},Ti.mergeConfig=$o,Ti.AxiosHeaders=On,Ti.formToJSON=e=>An(Jr.isHTMLForm(e)?new FormData(e):e),Ti.getAdapter=ui.getAdapter,Ti.HttpStatusCode=Ei,Ti.default=Ti;const{Axios:Ri,AxiosError:Ai,CanceledError:Si,isCancel:Li,CancelToken:yi,VERSION:bi,all:vi,Cancel:Ci,isAxiosError:Oi,spread:Ii,toFormData:Ni,AxiosHeaders:Mi,HttpStatusCode:wi,formToJSON:Ui,getAdapter:Pi,mergeConfig:Bi}=Ti;function ki(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}function ji(){return function(e={}){const{isSuccess:t=e=>0===e,getCode:s=e=>ki([e,"access",e=>e.data,"optionalAccess",e=>e.code]),getMessage:r=e=>ki([e,"access",e=>e.data,"optionalAccess",e=>e.message])||ki([e,"access",e=>e.data,"optionalAccess",e=>e.msg]),getData:n=e=>ki([e,"access",e=>e.data,"optionalAccess",e=>e.data]),throwOnError:o=!0,onError:i}=e;return{name:"response-validator",onResponse:e=>{const a=s(e);if(void 0===a)return e;if(t(a))return n(e);const c=r(e)||"Request failed";if(i&&!1===i(a,c,e))return e;if(o)throw new sr(c,{status:e.status,code:a,config:e.config,response:e,data:e.data});return e}}}({isSuccess:e=>0===e,getCode:e=>ki([e,"access",e=>e.data,"optionalAccess",e=>e.code]),getMessage:e=>ki([e,"access",e=>e.data,"optionalAccess",e=>e.message])||ki([e,"access",e=>e.data,"optionalAccess",e=>e.msg]),getData:e=>e.data})}function Di(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}const xi={"/api/marketplace/trade/benefit/user/extra/create":{fields:["extra_benefit.item_info.start_at","extra_benefit.item_info.end_at"]},"/api/memory/volcano_database/list_instance":{fields:["page_num","page_size"]},"/api/memory/volcano_database/list_database":{fields:["page_num","page_size"]},"/api/memory/volcano_database/list_table":{fields:["page_num","page_size"]}};function Fi(e){const{config:t}=e;return{name:"i64-transform",onRequest:e=>{const s=function(e,t){return s=t[e],r=()=>null,null!=s?s:r();var s,r}(e.url||"",t);return s?(e.data&&(e.data=function(e,t){if(null==e)return e;const s=Es(e);for(const e of t){const t=Tt(s,e);if("string"==typeof t){const r=Number(t);Number.isInteger(r)&&Ys(s,e,r)}else Array.isArray(t)&&Ys(s,e,t.map((e=>{if("string"==typeof e){const t=Number(e);if(Number.isInteger(t))return t}return e})))}return s}(e.data,s.fields)),e):e}}}function qi(e={}){const t=Ti.create({baseURL:e.baseURL,timeout:e.timeout,headers:e.headers,...e.axiosConfig}),s=[];return!1!==e.useDefaultPlugins&&s.push(function(e={}){const{xRequestedWith:t="XMLHttpRequest",autoContentTypeMethods:s=["post","get"],contentType:r="application/json",setEmptyDataForContentType:n=!0}=e;return{name:"request-headers",onRequest:e=>{const o=(t,s)=>{"function"==typeof Di([e,"access",e=>e.headers,"optionalAccess",e=>e.set])?e.headers.set(t,s):e.headers&&(e.headers[t]=s)};!1!==t&&o("x-requested-with",t);const i=Di([e,"access",e=>e.method,"optionalAccess",e=>e.toLowerCase,"call",e=>e()])||"get";var a;return s.includes(i)&&(a="content-type",!("function"==typeof Di([e,"access",e=>e.headers,"optionalAccess",e=>e.get])?e.headers.get(a):Di([e,"access",e=>e.headers,"optionalAccess",e=>e[a]])))&&(o("content-type",r),n&&!e.data&&(e.data={})),e}}}(),Fi({config:xi}),ji(),function(e={}){const t=new Set(e.interceptors||[]);return{plugin:{name:"interceptor-chain",onResponse:e=>{let s=e;for(const e of t)s=e(s);return s}},add:e=>(t.add(e),()=>{t.delete(e)}),remove:e=>{t.delete(e)},clear:()=>{t.clear()},size:()=>t.size}}().plugin),e.plugins&&e.plugins.length>0&&s.push(...e.plugins),s.forEach((e=>{e.onRequest&&t.interceptors.request.use(e.onRequest,e.onError),(e.onResponse||e.onError)&&t.interceptors.response.use(e.onResponse,e.onError)})),t}const Gi=qi({baseURL:"/",headers:{"Agw-Js-Conv":"str"}}),Hi=Gi,zi=(e,t)=>Hi({...e,...t});var Wi,$i,Vi,Ki,Ji,Qi,Yi,Zi,Xi,ea,ta,sa,ra,na,oa,ia,aa,ca,la;function ua(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}!function(e){e[e.OpenClawChannelTypeLark=1]="OpenClawChannelTypeLark";e[e.OpenClawChannelTypeWeixin=2]="OpenClawChannelTypeWeixin";e[e.OpenClawChannelTypeWeCom=3]="OpenClawChannelTypeWeCom"}(Wi||(Wi={})),function(e){e[e.OpenClawLarkAuthStatusAuthorized=1]="OpenClawLarkAuthStatusAuthorized";e[e.OpenClawLarkAuthStatusUnauthorized=2]="OpenClawLarkAuthStatusUnauthorized"}($i||($i={})),function(e){e[e.OpenClawLarkConfigStatusNotCreated=1]="OpenClawLarkConfigStatusNotCreated";e[e.OpenClawLarkConfigStatusCreated=2]="OpenClawLarkConfigStatusCreated";e[e.OpenClawLarkConfigStatusConfigured=3]="OpenClawLarkConfigStatusConfigured"}(Vi||(Vi={})),function(e){e[e.OpenClawUpdateStatusNoUpdate=1]="OpenClawUpdateStatusNoUpdate";e[e.OpenClawUpdateStatusPending=2]="OpenClawUpdateStatusPending";e[e.OpenClawUpdateStatusUpdating=3]="OpenClawUpdateStatusUpdating"}(Ki||(Ki={})),function(e){e[e.OpenClawVersionTypeFull=1]="OpenClawVersionTypeFull";e[e.OpenClawVersionTypeLite=2]="OpenClawVersionTypeLite"}(Ji||(Ji={})),function(e){e[e.RequirementsNotMet=1]="RequirementsNotMet";e[e.FunctionDefect=2]="FunctionDefect";e[e.PoorDesign=3]="PoorDesign";e[e.InteractionIssue=4]="InteractionIssue";e[e.LongTimeWait=5]="LongTimeWait";e[e.RequirementsMisunderstood=6]="RequirementsMisunderstood";e[e.BadPlanning=7]="BadPlanning";e[e.ExecutionFailed=8]="ExecutionFailed";e[e.UnstableExecution=9]="UnstableExecution"}(Qi||(Qi={})),function(e){e[e.Unknown=0]="Unknown";e[e.Like=1]="Like";e[e.Dislike=2]="Dislike"}(Yi||(Yi={})),function(e){e[e.Wait=0]="Wait";e[e.Done=1]="Done"}(Zi||(Zi={})),function(e){e[e.RoleTypeUnknown=0]="RoleTypeUnknown";e[e.RoleTypeUser=1]="RoleTypeUser";e[e.RoleTypeAssistant=2]="RoleTypeAssistant"}(Xi||(Xi={})),function(e){e[e.Agent=0]="Agent";e[e.Ask=1]="Ask";e[e.DangerousConfirm=2]="DangerousConfirm";e[e.Plan=4]="Plan"}(ea||(ea={})),function(e){e[e.Idle=0]="Idle";e[e.Running=1]="Running";e[e.Interrupted=2]="Interrupted"}(ta||(ta={})),function(e){e[e.AddAttributes=1]="AddAttributes";e[e.RemoveAttributes=2]="RemoveAttributes"}(sa||(sa={})),function(e){e[e.CloseConnection=1]="CloseConnection"}(ra||(ra={})),function(e){e[e.ON_LINE=0]="ON_LINE";e[e.OFF_LINE=1]="OFF_LINE";e[e.TOUCH=2]="TOUCH"}(na||(na={})),function(e){e[e.AddGroups=1]="AddGroups";e[e.RemoveGroups=2]="RemoveGroups";e[e.ReplaceWithGroups=3]="ReplaceWithGroups"}(oa||(oa={})),function(e){e[e.App=0]="App";e[e.Service=1]="Service";e[e.Method=2]="Method"}(ia||(ia={})),function(e){e[e.ApiKey=1]="ApiKey";e[e.WechatOfficialAccount=2]="WechatOfficialAccount";e[e.OAuth=3]="OAuth"}(aa||(aa={})),function(e){e[e.PROJECT_COPY=1]="PROJECT_COPY";e[e.SKILL_STORE=2]="SKILL_STORE"}(ca||(ca={})),function(e){e[e.PENDING=1]="PENDING";e[e.SUCCESS=2]="SUCCESS";e[e.FAILED=3]="FAILED"}(la||(la={}));class ha{__init(){this.request=zi}__init2(){this.baseURL=""}constructor(e){ha.prototype.__init.call(this),ha.prototype.__init2.call(this),this.request=ua([e,"optionalAccess",e=>e.request])||this.request,this.baseURL=ua([e,"optionalAccess",e=>e.baseURL])||this.baseURL}genBaseURL(e){return"string"==typeof this.baseURL?this.baseURL+e:this.baseURL(e)}GetHistory(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/chat/history`),n={before:s.before,limit:s.limit,after:s.after,conversation_id:s.conversation_id};return this.request({url:r,method:"GET",params:n},t)}ReplyFeedback(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/chat/feedback`),n={reply_id:s.reply_id,type:s.type,session_id:s.session_id,feedback_detail:s.feedback_detail};return this.request({url:r,method:"POST",data:n},t)}TestChat(e,t){const s=e,r=this.genBaseURL("/v1/api/project/:project_id/chat/mock"),n={msg:s.msg};return this.request({url:r,method:"POST",data:n},t)}GetCanvasInfo(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/agent/canvas`),n={space_id:s.space_id,commit_id:s.commit_id};return this.request({url:r,method:"POST",data:n},t)}ExplainNode(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/agent/explain_node`),n={node_ids:s.node_ids,schema:s.schema};return this.request({url:r,method:"POST",data:n},t)}GetInOutSchema(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/agent/inout_schema`),n={space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}GetSkillMeta(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/skill/meta`);return this.request({url:r,method:"POST"},t)}ListSpans(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/list_spans`),n={workspace_id:s.workspace_id,start_time:s.start_time,end_time:s.end_time,filters:s.filters,page_size:s.page_size,order_bys:s.order_bys,page_token:s.page_token,platform_type:s.platform_type,span_list_type:s.span_list_type};return this.request({url:r,method:"POST",data:n},t)}GetModelList(e,t){const s=e||{},r=this.genBaseURL("/v1/api/project/model_list"),n={project_id:s.project_id,project_type:s.project_type,space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}GetCommercialInfo(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/chat/commercial_info`),n={reply_id_list:s.reply_id_list};return this.request({url:r,method:"POST",data:n},t)}PackSkill(e,t){const s=e,r=this.genBaseURL("/v1/api/project/:project_id/skill/pack"),n={project_id:s.project_id};return this.request({url:r,method:"POST",data:n},t)}GetSkillOAuthUrl(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/skill/oauth_url`),n={checkpoint_id:s.checkpoint_id,credential_name:s.credential_name,platform_oauth_info:s.platform_oauth_info,custom_oauth_info:s.custom_oauth_info,credential_tips:s.credential_tips};return this.request({url:r,method:"POST",data:n},t)}GetTools(e,t){const s=this.genBaseURL("/v1/api/project/tools");return this.request({url:s,method:"GET"},t)}CanvasSubmit(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/agent/canvas_submit`),n={after_canvas:s.after_canvas};return this.request({url:r,method:"POST",data:n},t)}UpdateOpenClawSettings(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/assistant/openclaw/update_setting`),n={selected_model_id:s.selected_model_id,version:s.version,channels:s.channels};return this.request({url:r,method:"POST",data:n},t)}CreateOpenClawLarkApp(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/assistant/openclaw/create_lark_app`),n={app_name:s.app_name,recreate:s.recreate};return this.request({url:r,method:"POST",data:n},t)}GetOpenClawSettings(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/assistant/openclaw/settings`);return this.request({url:r,method:"GET"},t)}CancelChatCLIMessage(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/chat/message/cancel`),n={conversation_id:s.conversation_id};return this.request({url:r,method:"POST",data:n},t)}GetChatCLIMessageStatus(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/chat/message/status`),n={conversation_id:s.conversation_id};return this.request({url:r,method:"GET",params:n},t)}ChatCLISendMessage(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/chat/message/send`),n={message:s.message,device_id:s.device_id};return this.request({url:r,method:"POST",data:n},t)}GetChatCLIMessageResultContent(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/chat/message/result`),n={conversation_id:s.conversation_id};return this.request({url:r,method:"GET",params:n},t)}CreateOpenClawWeixinQRCode(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/assistant/openclaw/create_weixin_qrcode`);return this.request({url:r,method:"POST"},t)}GetOpenClawUpdateStatus(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/assistant/openclaw/update_status`);return this.request({url:r,method:"GET"},t)}TriggerOpenClawUpdate(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/assistant/openclaw/trigger_update`);return this.request({url:r,method:"POST"},t)}ConnectOpenClawFeishu(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/assistant/openclaw/connect_feishu`),n={app_name:s.app_name,recreate:s.recreate,avatar_url:s.avatar_url};return this.request({url:r,method:"POST",data:n},t)}ConnectOpenClawWeChat(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/assistant/openclaw/connect_wechat`);return this.request({url:r,method:"POST"},t)}GetProjectQueue(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/queue`),n={conversation_id:s.conversation_id};return this.request({url:r,method:"GET",params:n},t)}ReorderProjectQueue(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/queue/reorder`),n={ordered_message_ids:s.ordered_message_ids,conversation_id:s.conversation_id};return this.request({url:r,method:"POST",data:n},t)}EnqueueMessage(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/queue/enqueue`),n={message:s.message,device_id:s.device_id,conversation_id:s.conversation_id};return this.request({url:r,method:"POST",data:n},t)}PauseProjectQueue(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/queue/pause`),n={conversation_id:s.conversation_id};return this.request({url:r,method:"POST",data:n},t)}EditQueueMessage(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/queue/edit`),n={message_id:s.message_id,message:s.message,conversation_id:s.conversation_id};return this.request({url:r,method:"POST",data:n},t)}ResumeProjectQueue(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/queue/resume`),n={conversation_id:s.conversation_id};return this.request({url:r,method:"POST",data:n},t)}DeleteQueueMessage(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/queue/delete`),n={message_id:s.message_id,conversation_id:s.conversation_id};return this.request({url:r,method:"POST",data:n},t)}ClearProjectQueue(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/queue/clear`),n={conversation_id:s.conversation_id};return this.request({url:r,method:"POST",data:n},t)}GetConversation(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/conversation/${s.conversation_id}`);return this.request({url:r,method:"GET"},t)}CreateConversation(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/conversation/create`),n={title:s.title,new_worktree:s.new_worktree,source_conversation_id:s.source_conversation_id,source_message_id:s.source_message_id};return this.request({url:r,method:"POST",data:n},t)}UpdateConversationSetting(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/conversation/${s.conversation_id}/update_setting`),n={model_setting:s.model_setting,skill_setting:s.skill_setting,mode:s.mode,wizards:s.wizards,agent_tools:s.agent_tools};return this.request({url:r,method:"POST",data:n},t)}DeleteConversation(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/conversation/${s.conversation_id}/delete`);return this.request({url:r,method:"POST"},t)}UpdateConversation(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/conversation/${s.conversation_id}/update`),n={title:s.title,is_pinned:s.is_pinned,ack_sequence_id:s.ack_sequence_id};return this.request({url:r,method:"POST",data:n},t)}ListConversations(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/conversation/list`),n={before:s.before,after:s.after,limit:s.limit};return this.request({url:r,method:"GET",params:n},t)}ConnectOpenClawWeCom(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/assistant/openclaw/connect_wecom`),n={bot_id:s.bot_id,secret:s.secret};return this.request({url:r,method:"POST",data:n},t)}ExtractStyle(e,t){const s=e,r=this.genBaseURL("/v1/api/project/style/extract"),n={url:s.url};return this.request({url:r,method:"POST",data:n},t)}BatchGetStyleDetail(e,t){const s=e,r=this.genBaseURL("/v1/api/project/style/detail"),n={style_ids:s.style_ids};return this.request({url:r,method:"POST",data:n},t)}ListRecommendStyles(e,t){const s=this.genBaseURL("/v1/api/project/style/list");return this.request({url:s,method:"GET"},t)}GetFrontierConnectionParams(e,t){const s=e||{},r=this.genBaseURL("/v1/api/project/frontier/connection-params"),n={device_id:s.device_id},o={Host:s.Host};return this.request({url:r,method:"GET",params:n,headers:o},t)}}ha.prototype.GetProjectQueue=function(e,t){const s=e,r=this.genBaseURL(`/v1/api/project/${s.project_id}/queue`),n={conversation_id:s.conversation_id};return this.request({url:r,method:"GET",params:n},t)};const da=new ha({});class pa{constructor({options:e,reportLog:t}){this.mergedBaseOptions=er({scenes:{[T.GetMessage]:async(...e)=>await da.GetHistory(...e)}},e),this.reportLog=t,this.reportLogWithScope=this.reportLog.createLoggerWith({scope:"RequestManager"}),this.reportLogWithScope.info({message:"RequestManager is initialized",meta:{...this.mergedBaseOptions}})}appendRequestOptions(e){this.mergedBaseOptions=er(this.mergedBaseOptions,e)}getSceneConfig(e){const{scenes:t}=this.mergedBaseOptions;return t[e]}}class _a{constructor(){_a.prototype.__init.call(this)}__init(){this.preSendLocalMessageEvents=e()}on(e,t){this.preSendLocalMessageEvents.on(e,t)}off(e,t){this.preSendLocalMessageEvents.off(e,t)}once(e,t){const s=r=>{t(r),this.preSendLocalMessageEvents.off(e,s)};this.preSendLocalMessageEvents.on(e,s)}emit(e,t){this.preSendLocalMessageEvents.emit(e,t)}destroy(){this.preSendLocalMessageEvents.all.clear()}}class fa{getSendChatMessageStructure(e,t){const s=Ks(e,function(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}([t,"optionalAccess",e=>e.extendFields]));return Qs(s,(e=>null!=e&&""!==e))}}function ma(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}const ga=["console","file","text"],Ea="generate_image";function Ta(e,t){return null!=e?e:t()}function Ra(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}const Aa=(e,t)=>{const s=t.at(0);if(!s)return e;if("message_start"===s.type||"message_end"===s.type)return Es(s);const r=Es(e||s),n=e?t:t.slice(1);if(0===n.length)return r;const o=n.filter((e=>e.type===r.type));if("answer"===r.type){const e=o.map((e=>Ta(e.content.answer,(()=>""))));r.content.answer=Ta(r.content.answer,(()=>""))+e.join("")}else if("thinking"===r.type){const e=o.map((e=>Ta(e.content.thinking,(()=>""))));r.content.thinking=Ta(r.content.thinking,(()=>""))+e.join("")}else if("tool_request"===r.type&&r.content.tool_request){const e=o.map((e=>Ta(Ra([e,"access",e=>e.content,"access",e=>e.tool_request,"optionalAccess",e=>e.stream_parameters]),(()=>""))));r.content.tool_request.stream_parameters=Ta(r.content.tool_request.stream_parameters,(()=>""))+e.join("")}else if("tool_process"===r.type){const e=o.map((e=>Ra([e,"access",e=>e.content,"access",e=>e.tool_process,"optionalAccess",e=>e.data,"access",e=>e.content]))),t=function(e,t){const s={};let r=!1;const n=t.map((e=>ma([e,"optionalAccess",e=>e[Ea],"optionalAccess",e=>e.images])||[])).flat();return(n.length>0||!Vs(ma([e,"optionalAccess",e=>e[Ea]])))&&(s[Ea]={images:(ma([e,"optionalAccess",e=>e[Ea],"optionalAccess",e=>e.images])||[]).concat(n)},r=!0),ga.forEach((n=>{const o=t.filter((e=>!Vs(ma([e,"optionalAccess",e=>e[n]])))).map((e=>ma([e,"optionalAccess",e=>e[n]])||""));(o.length>0||!Vs(ma([e,"optionalAccess",e=>e[n]])))&&(s[n]=(ma([e,"optionalAccess",e=>e[n]])||"")+o.join(""),r=!0)})),r?s:e||{}}(Ra([r,"access",e=>e.content,"access",e=>e.tool_process,"optionalAccess",e=>e.data,"access",e=>e.content]),e);r.content.tool_process&&(r.content.tool_process.data.content=t)}const i=t.at(-1);return i&&(r.sequence_id=i.sequence_id,r.finish=i.finish),r};function Sa(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}class La{__init(){this.streamBufferSnapshot=null}constructor(e){La.prototype.__init.call(this),La.prototype.__init2.call(this),La.prototype.__init3.call(this),this.key=e.key}__init2(){this.getBufferMeta=e=>{return{query_msg_id:(t=Sa([e,"access",e=>e.at,"call",e=>e(0),"optionalAccess",e=>e.query_msg_id]),s=()=>"",null!=t?t:s()),timestamp:Date.now(),key:this.key};var t,s}}__init3(){this.recordStreamBuffer=e=>{const{streamMessageBuffer:t,streamChunkBuffer:s}=e;this.streamBufferSnapshot={streamMessageBuffer:[...t],streamChunkBuffer:[...s],...this.getBufferMeta(t)}}}getStreamBufferSnapshot(){return this.streamBufferSnapshot}clear(){this.streamBufferSnapshot=null}}class ya{__init(){this.timeoutMs=3e4}__init2(){this.debugLogTimer=null}__init3(){this.debugTimeoutTimer=null}__init4(){this.currentQueryMsgId=""}__init5(){this.logInterval=3e3}get isDebugging(){return null!==this.debugLogTimer||null!==this.debugTimeoutTimer}constructor(e){ya.prototype.__init.call(this),ya.prototype.__init2.call(this),ya.prototype.__init3.call(this),ya.prototype.__init4.call(this),ya.prototype.__init5.call(this),this.reportLogWithScope=e.reportLogWithScope,this.getEnableDebug=e.getEnableDebug,this.getLogPayload=e.getLogPayload,this.mark=e.mark}startDebugLog(e){this.getEnableDebug()&&this.currentQueryMsgId!==e&&(this.clearAllTimers(),this.currentQueryMsgId=e,this.debugLogTimer=setInterval((()=>{this.clearTimeoutTimer(),this.reportLogWithScope.info({message:`${this.mark} Debug - Pulling`,meta:{query_msg_id:this.currentQueryMsgId,payload:this.getLogPayload()}}),this.startTimeout(e)}),this.logInterval))}stopDebugLog(){this.getEnableDebug()&&(this.debugLogTimer||this.debugTimeoutTimer)&&(this.clearAllTimers(),this.reportLogWithScope.info({message:`${this.mark} Debug - Final`,meta:{query_msg_id:this.currentQueryMsgId,payload:this.getLogPayload()}}))}destroy(){this.clearAllTimers(),this.currentQueryMsgId=""}clearAllTimers(){this.debugLogTimer&&(clearInterval(this.debugLogTimer),this.debugLogTimer=null),this.clearTimeoutTimer()}startTimeout(e){this.debugTimeoutTimer=setTimeout((()=>{this.reportLogWithScope.info({message:`${this.mark} Debug - Timeout兜底触发`,meta:{query_msg_id:e,payload:this.getLogPayload(),timeoutMs:this.timeoutMs}}),this.clearAllTimers(),this.currentQueryMsgId=""}),this.timeoutMs)}clearTimeoutTimer(){this.debugTimeoutTimer&&(clearTimeout(this.debugTimeoutTimer),this.debugTimeoutTimer=null)}}var ba;!function(e){e[e.BACKSPACE=8]="BACKSPACE",e[e.FORM_FEED=12]="FORM_FEED",e[e.NEWLINE=10]="NEWLINE",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.TAB=9]="TAB",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.NUMBER_SIGN=35]="NUMBER_SIGN",e[e.DOLLAR_SIGN=36]="DOLLAR_SIGN",e[e.PERCENT_SIGN=37]="PERCENT_SIGN",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.LEFT_PARENTHESIS=40]="LEFT_PARENTHESIS",e[e.RIGHT_PARENTHESIS=41]="RIGHT_PARENTHESIS",e[e.ASTERISK=42]="ASTERISK",e[e.PLUS_SIGN=43]="PLUS_SIGN",e[e.COMMA=44]="COMMA",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.FULL_STOP=46]="FULL_STOP",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_ZERO=48]="DIGIT_ZERO",e[e.DIGIT_ONE=49]="DIGIT_ONE",e[e.DIGIT_TWO=50]="DIGIT_TWO",e[e.DIGIT_THREE=51]="DIGIT_THREE",e[e.DIGIT_FOUR=52]="DIGIT_FOUR",e[e.DIGIT_FIVE=53]="DIGIT_FIVE",e[e.DIGIT_SIX=54]="DIGIT_SIX",e[e.DIGIT_SEVEN=55]="DIGIT_SEVEN",e[e.DIGIT_EIGHT=56]="DIGIT_EIGHT",e[e.DIGIT_NINE=57]="DIGIT_NINE",e[e.COLON=58]="COLON",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.COMMERCIAL_AT=64]="COMMERCIAL_AT",e[e.LATIN_CAPITAL_LETTER_A=65]="LATIN_CAPITAL_LETTER_A",e[e.LATIN_CAPITAL_LETTER_B=66]="LATIN_CAPITAL_LETTER_B",e[e.LATIN_CAPITAL_LETTER_C=67]="LATIN_CAPITAL_LETTER_C",e[e.LATIN_CAPITAL_LETTER_D=68]="LATIN_CAPITAL_LETTER_D",e[e.LATIN_CAPITAL_LETTER_E=69]="LATIN_CAPITAL_LETTER_E",e[e.LATIN_CAPITAL_LETTER_F=70]="LATIN_CAPITAL_LETTER_F",e[e.LATIN_CAPITAL_LETTER_G=71]="LATIN_CAPITAL_LETTER_G",e[e.LATIN_CAPITAL_LETTER_H=72]="LATIN_CAPITAL_LETTER_H",e[e.LATIN_CAPITAL_LETTER_I=73]="LATIN_CAPITAL_LETTER_I",e[e.LATIN_CAPITAL_LETTER_J=74]="LATIN_CAPITAL_LETTER_J",e[e.LATIN_CAPITAL_LETTER_K=75]="LATIN_CAPITAL_LETTER_K",e[e.LATIN_CAPITAL_LETTER_L=76]="LATIN_CAPITAL_LETTER_L",e[e.LATIN_CAPITAL_LETTER_M=77]="LATIN_CAPITAL_LETTER_M",e[e.LATIN_CAPITAL_LETTER_N=78]="LATIN_CAPITAL_LETTER_N",e[e.LATIN_CAPITAL_LETTER_O=79]="LATIN_CAPITAL_LETTER_O",e[e.LATIN_CAPITAL_LETTER_P=80]="LATIN_CAPITAL_LETTER_P",e[e.LATIN_CAPITAL_LETTER_Q=81]="LATIN_CAPITAL_LETTER_Q",e[e.LATIN_CAPITAL_LETTER_R=82]="LATIN_CAPITAL_LETTER_R",e[e.LATIN_CAPITAL_LETTER_S=83]="LATIN_CAPITAL_LETTER_S",e[e.LATIN_CAPITAL_LETTER_T=84]="LATIN_CAPITAL_LETTER_T",e[e.LATIN_CAPITAL_LETTER_U=85]="LATIN_CAPITAL_LETTER_U",e[e.LATIN_CAPITAL_LETTER_V=86]="LATIN_CAPITAL_LETTER_V",e[e.LATIN_CAPITAL_LETTER_W=87]="LATIN_CAPITAL_LETTER_W",e[e.LATIN_CAPITAL_LETTER_X=88]="LATIN_CAPITAL_LETTER_X",e[e.LATIN_CAPITAL_LETTER_Y=89]="LATIN_CAPITAL_LETTER_Y",e[e.LATIN_CAPITAL_LETTER_Z=90]="LATIN_CAPITAL_LETTER_Z",e[e.LEFT_SQUARE_BRACKET=91]="LEFT_SQUARE_BRACKET",e[e.REVERSE_SOLIDUS=92]="REVERSE_SOLIDUS",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.CIRCUMFLEX_ACCENT=94]="CIRCUMFLEX_ACCENT",e[e.LOW_LINE=95]="LOW_LINE",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_LETTER_A=97]="LATIN_SMALL_LETTER_A",e[e.LATIN_SMALL_LETTER_B=98]="LATIN_SMALL_LETTER_B",e[e.LATIN_SMALL_LETTER_C=99]="LATIN_SMALL_LETTER_C",e[e.LATIN_SMALL_LETTER_D=100]="LATIN_SMALL_LETTER_D",e[e.LATIN_SMALL_LETTER_E=101]="LATIN_SMALL_LETTER_E",e[e.LATIN_SMALL_LETTER_F=102]="LATIN_SMALL_LETTER_F",e[e.LATIN_SMALL_LETTER_G=103]="LATIN_SMALL_LETTER_G",e[e.LATIN_SMALL_LETTER_H=104]="LATIN_SMALL_LETTER_H",e[e.LATIN_SMALL_LETTER_I=105]="LATIN_SMALL_LETTER_I",e[e.LATIN_SMALL_LETTER_J=106]="LATIN_SMALL_LETTER_J",e[e.LATIN_SMALL_LETTER_K=107]="LATIN_SMALL_LETTER_K",e[e.LATIN_SMALL_LETTER_L=108]="LATIN_SMALL_LETTER_L",e[e.LATIN_SMALL_LETTER_M=109]="LATIN_SMALL_LETTER_M",e[e.LATIN_SMALL_LETTER_N=110]="LATIN_SMALL_LETTER_N",e[e.LATIN_SMALL_LETTER_O=111]="LATIN_SMALL_LETTER_O",e[e.LATIN_SMALL_LETTER_P=112]="LATIN_SMALL_LETTER_P",e[e.LATIN_SMALL_LETTER_Q=113]="LATIN_SMALL_LETTER_Q",e[e.LATIN_SMALL_LETTER_R=114]="LATIN_SMALL_LETTER_R",e[e.LATIN_SMALL_LETTER_S=115]="LATIN_SMALL_LETTER_S",e[e.LATIN_SMALL_LETTER_T=116]="LATIN_SMALL_LETTER_T",e[e.LATIN_SMALL_LETTER_U=117]="LATIN_SMALL_LETTER_U",e[e.LATIN_SMALL_LETTER_V=118]="LATIN_SMALL_LETTER_V",e[e.LATIN_SMALL_LETTER_W=119]="LATIN_SMALL_LETTER_W",e[e.LATIN_SMALL_LETTER_X=120]="LATIN_SMALL_LETTER_X",e[e.LATIN_SMALL_LETTER_Y=121]="LATIN_SMALL_LETTER_Y",e[e.LATIN_SMALL_LETTER_Z=122]="LATIN_SMALL_LETTER_Z",e[e.LEFT_CURLY_BRACKET=123]="LEFT_CURLY_BRACKET",e[e.VERTICAL_LINE=124]="VERTICAL_LINE",e[e.RIGHT_CURLY_BRACKET=125]="RIGHT_CURLY_BRACKET",e[e.TILDE=126]="TILDE"}(ba||(ba={}));const va={[ba.QUOTATION_MARK]:ba.QUOTATION_MARK,[ba.REVERSE_SOLIDUS]:ba.REVERSE_SOLIDUS,[ba.SOLIDUS]:ba.SOLIDUS,[ba.LATIN_SMALL_LETTER_B]:ba.BACKSPACE,[ba.LATIN_SMALL_LETTER_F]:ba.FORM_FEED,[ba.LATIN_SMALL_LETTER_N]:ba.NEWLINE,[ba.LATIN_SMALL_LETTER_R]:ba.CARRIAGE_RETURN,[ba.LATIN_SMALL_LETTER_T]:ba.TAB};class Ca{constructor(){this.decoder=new TextDecoder("utf-8"),this.strings=[],this.byteLength=0}appendChar(e){this.strings.push(String.fromCharCode(e)),this.byteLength+=1}appendBuf(e,t=0,s=e.length){this.strings.push(this.decoder.decode(e.subarray(t,s))),this.byteLength+=s-t}reset(){this.strings=[],this.byteLength=0}toString(){return this.strings.join("")}}class Oa{constructor(e){this.decoder=new TextDecoder("utf-8"),this.bufferOffset=0,this.string="",this.byteLength=0,this.buffer=new Uint8Array(e)}appendChar(e){this.bufferOffset>=this.buffer.length&&this.flushStringBuffer(),this.buffer[this.bufferOffset++]=e,this.byteLength+=1}appendBuf(e,t=0,s=e.length){const r=s-t;this.bufferOffset+r>this.buffer.length&&this.flushStringBuffer(),this.buffer.set(e.subarray(t,s),this.bufferOffset),this.bufferOffset+=r,this.byteLength+=r}flushStringBuffer(){this.string+=this.decoder.decode(this.buffer.subarray(0,this.bufferOffset)),this.bufferOffset=0}reset(){this.string="",this.bufferOffset=0,this.byteLength=0}toString(){return this.flushStringBuffer(),this.string}}var Ia,Na;function Ma(e){return["START","ENDED","ERROR","TRUE1","TRUE2","TRUE3","FALSE1","FALSE2","FALSE3","FALSE4","NULL1","NULL2","NULL3","STRING_DEFAULT","STRING_AFTER_BACKSLASH","STRING_UNICODE_DIGIT_1","STRING_UNICODE_DIGIT_2","STRING_UNICODE_DIGIT_3","STRING_UNICODE_DIGIT_4","STRING_INCOMPLETE_CHAR","NUMBER_AFTER_INITIAL_MINUS","NUMBER_AFTER_INITIAL_ZERO","NUMBER_AFTER_INITIAL_NON_ZERO","NUMBER_AFTER_FULL_STOP","NUMBER_AFTER_DECIMAL","NUMBER_AFTER_E","NUMBER_AFTER_E_AND_SIGN","NUMBER_AFTER_E_AND_DIGIT","SEPARATOR","BOM_OR_START","BOM"][e]}!function(e){e[e.LEFT_BRACE=0]="LEFT_BRACE",e[e.RIGHT_BRACE=1]="RIGHT_BRACE",e[e.LEFT_BRACKET=2]="LEFT_BRACKET",e[e.RIGHT_BRACKET=3]="RIGHT_BRACKET",e[e.COLON=4]="COLON",e[e.COMMA=5]="COMMA",e[e.TRUE=6]="TRUE",e[e.FALSE=7]="FALSE",e[e.NULL=8]="NULL",e[e.STRING=9]="STRING",e[e.NUMBER=10]="NUMBER",e[e.SEPARATOR=11]="SEPARATOR"}(Ia||(Ia={})),function(e){e[e.START=0]="START",e[e.ENDED=1]="ENDED",e[e.ERROR=2]="ERROR",e[e.TRUE1=3]="TRUE1",e[e.TRUE2=4]="TRUE2",e[e.TRUE3=5]="TRUE3",e[e.FALSE1=6]="FALSE1",e[e.FALSE2=7]="FALSE2",e[e.FALSE3=8]="FALSE3",e[e.FALSE4=9]="FALSE4",e[e.NULL1=10]="NULL1",e[e.NULL2=11]="NULL2",e[e.NULL3=12]="NULL3",e[e.STRING_DEFAULT=13]="STRING_DEFAULT",e[e.STRING_AFTER_BACKSLASH=14]="STRING_AFTER_BACKSLASH",e[e.STRING_UNICODE_DIGIT_1=15]="STRING_UNICODE_DIGIT_1",e[e.STRING_UNICODE_DIGIT_2=16]="STRING_UNICODE_DIGIT_2",e[e.STRING_UNICODE_DIGIT_3=17]="STRING_UNICODE_DIGIT_3",e[e.STRING_UNICODE_DIGIT_4=18]="STRING_UNICODE_DIGIT_4",e[e.STRING_INCOMPLETE_CHAR=19]="STRING_INCOMPLETE_CHAR",e[e.NUMBER_AFTER_INITIAL_MINUS=20]="NUMBER_AFTER_INITIAL_MINUS",e[e.NUMBER_AFTER_INITIAL_ZERO=21]="NUMBER_AFTER_INITIAL_ZERO",e[e.NUMBER_AFTER_INITIAL_NON_ZERO=22]="NUMBER_AFTER_INITIAL_NON_ZERO",e[e.NUMBER_AFTER_FULL_STOP=23]="NUMBER_AFTER_FULL_STOP",e[e.NUMBER_AFTER_DECIMAL=24]="NUMBER_AFTER_DECIMAL",e[e.NUMBER_AFTER_E=25]="NUMBER_AFTER_E",e[e.NUMBER_AFTER_E_AND_SIGN=26]="NUMBER_AFTER_E_AND_SIGN",e[e.NUMBER_AFTER_E_AND_DIGIT=27]="NUMBER_AFTER_E_AND_DIGIT",e[e.SEPARATOR=28]="SEPARATOR",e[e.BOM_OR_START=29]="BOM_OR_START",e[e.BOM=30]="BOM"}(Na||(Na={}));const wa={stringBufferSize:0,numberBufferSize:0,separator:void 0,emitPartialTokens:!1};class Ua extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Ua.prototype)}}class Pa{constructor(e){this.state=Na.BOM_OR_START,this.bomIndex=0,this.separatorIndex=0,this.escapedCharsByteLength=0,this.bytes_remaining=0,this.bytes_in_sequence=0,this.char_split_buffer=new Uint8Array(4),this.encoder=new TextEncoder,this.offset=-1,e=Object.assign(Object.assign({},wa),e),this.emitPartialTokens=!0===e.emitPartialTokens,this.bufferedString=e.stringBufferSize&&e.stringBufferSize>4?new Oa(e.stringBufferSize):new Ca,this.bufferedNumber=e.numberBufferSize&&e.numberBufferSize>0?new Oa(e.numberBufferSize):new Ca,this.separator=e.separator,this.separatorBytes=e.separator?this.encoder.encode(e.separator):void 0}get isEnded(){return this.state===Na.ENDED}write(e){try{let t;if(e instanceof Uint8Array)t=e;else if("string"==typeof e)t=this.encoder.encode(e);else if(Array.isArray(e))t=Uint8Array.from(e);else{if(!ArrayBuffer.isView(e))throw new TypeError("Unexpected type. The `write` function only accepts Arrays, TypedArrays and Strings.");t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}for(let s=0;s<t.length;s+=1){const r=t[s];switch(this.state){case Na.BOM_OR_START:if(e instanceof Uint8Array&&239===r){this.bom=[239,187,191],this.bomIndex+=1,this.state=Na.BOM;continue}if(e instanceof Uint16Array){if(254===r){this.bom=[254,255],this.bomIndex+=1,this.state=Na.BOM;continue}if(255===r){this.bom=[255,254],this.bomIndex+=1,this.state=Na.BOM;continue}}if(e instanceof Uint32Array){if(0===r){this.bom=[0,0,254,255],this.bomIndex+=1,this.state=Na.BOM;continue}if(255===r){this.bom=[255,254,0,0],this.bomIndex+=1,this.state=Na.BOM;continue}}case Na.START:if(this.offset+=1,this.separatorBytes&&r===this.separatorBytes[0]){if(1===this.separatorBytes.length){this.state=Na.START,this.onToken({token:Ia.SEPARATOR,value:this.separator,offset:this.offset+this.separatorBytes.length-1});continue}this.state=Na.SEPARATOR;continue}if(r===ba.SPACE||r===ba.NEWLINE||r===ba.CARRIAGE_RETURN||r===ba.TAB)continue;if(r===ba.LEFT_CURLY_BRACKET){this.onToken({token:Ia.LEFT_BRACE,value:"{",offset:this.offset});continue}if(r===ba.RIGHT_CURLY_BRACKET){this.onToken({token:Ia.RIGHT_BRACE,value:"}",offset:this.offset});continue}if(r===ba.LEFT_SQUARE_BRACKET){this.onToken({token:Ia.LEFT_BRACKET,value:"[",offset:this.offset});continue}if(r===ba.RIGHT_SQUARE_BRACKET){this.onToken({token:Ia.RIGHT_BRACKET,value:"]",offset:this.offset});continue}if(r===ba.COLON){this.onToken({token:Ia.COLON,value:":",offset:this.offset});continue}if(r===ba.COMMA){this.onToken({token:Ia.COMMA,value:",",offset:this.offset});continue}if(r===ba.LATIN_SMALL_LETTER_T){this.state=Na.TRUE1;continue}if(r===ba.LATIN_SMALL_LETTER_F){this.state=Na.FALSE1;continue}if(r===ba.LATIN_SMALL_LETTER_N){this.state=Na.NULL1;continue}if(r===ba.QUOTATION_MARK){this.bufferedString.reset(),this.escapedCharsByteLength=0,this.state=Na.STRING_DEFAULT;continue}if(r>=ba.DIGIT_ONE&&r<=ba.DIGIT_NINE){this.bufferedNumber.reset(),this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_INITIAL_NON_ZERO;continue}if(r===ba.DIGIT_ZERO){this.bufferedNumber.reset(),this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_INITIAL_ZERO;continue}if(r===ba.HYPHEN_MINUS){this.bufferedNumber.reset(),this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_INITIAL_MINUS;continue}break;case Na.STRING_DEFAULT:if(r===ba.QUOTATION_MARK){const e=this.bufferedString.toString();this.state=Na.START,this.onToken({token:Ia.STRING,value:e,offset:this.offset}),this.offset+=this.escapedCharsByteLength+this.bufferedString.byteLength+1;continue}if(r===ba.REVERSE_SOLIDUS){this.state=Na.STRING_AFTER_BACKSLASH;continue}if(r>=128){if(this.bytes_in_sequence=r>=194&&r<=223?2:r<=239?3:4,this.bytes_in_sequence<=t.length-s){this.bufferedString.appendBuf(t,s,s+this.bytes_in_sequence),s+=this.bytes_in_sequence-1;continue}this.bytes_remaining=s+this.bytes_in_sequence-t.length,this.char_split_buffer.set(t.subarray(s)),s=t.length-1,this.state=Na.STRING_INCOMPLETE_CHAR;continue}if(r>=ba.SPACE){this.bufferedString.appendChar(r);continue}break;case Na.STRING_INCOMPLETE_CHAR:this.char_split_buffer.set(t.subarray(s,s+this.bytes_remaining),this.bytes_in_sequence-this.bytes_remaining),this.bufferedString.appendBuf(this.char_split_buffer,0,this.bytes_in_sequence),s=this.bytes_remaining-1,this.state=Na.STRING_DEFAULT;continue;case Na.STRING_AFTER_BACKSLASH:const n=va[r];if(n){this.bufferedString.appendChar(n),this.escapedCharsByteLength+=1,this.state=Na.STRING_DEFAULT;continue}if(r===ba.LATIN_SMALL_LETTER_U){this.unicode="",this.state=Na.STRING_UNICODE_DIGIT_1;continue}break;case Na.STRING_UNICODE_DIGIT_1:case Na.STRING_UNICODE_DIGIT_2:case Na.STRING_UNICODE_DIGIT_3:if(r>=ba.DIGIT_ZERO&&r<=ba.DIGIT_NINE||r>=ba.LATIN_CAPITAL_LETTER_A&&r<=ba.LATIN_CAPITAL_LETTER_F||r>=ba.LATIN_SMALL_LETTER_A&&r<=ba.LATIN_SMALL_LETTER_F){this.unicode+=String.fromCharCode(r),this.state+=1;continue}break;case Na.STRING_UNICODE_DIGIT_4:if(r>=ba.DIGIT_ZERO&&r<=ba.DIGIT_NINE||r>=ba.LATIN_CAPITAL_LETTER_A&&r<=ba.LATIN_CAPITAL_LETTER_F||r>=ba.LATIN_SMALL_LETTER_A&&r<=ba.LATIN_SMALL_LETTER_F){const e=parseInt(this.unicode+String.fromCharCode(r),16);let t;if(void 0===this.highSurrogate){if(e>=55296&&e<=56319){this.highSurrogate=e,this.state=Na.STRING_DEFAULT;continue}t=String.fromCharCode(e)}else t=e>=56320&&e<=57343?String.fromCharCode(this.highSurrogate,e):String.fromCharCode(this.highSurrogate),this.highSurrogate=void 0;const s=this.encoder.encode(t);this.bufferedString.appendBuf(s),this.escapedCharsByteLength+=6-s.byteLength,this.state=Na.STRING_DEFAULT;continue}break;case Na.NUMBER_AFTER_INITIAL_MINUS:if(r===ba.DIGIT_ZERO){this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_INITIAL_ZERO;continue}if(r>=ba.DIGIT_ONE&&r<=ba.DIGIT_NINE){this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_INITIAL_NON_ZERO;continue}break;case Na.NUMBER_AFTER_INITIAL_ZERO:if(r===ba.FULL_STOP){this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_FULL_STOP;continue}if(r===ba.LATIN_SMALL_LETTER_E||r===ba.LATIN_CAPITAL_LETTER_E){this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_E;continue}s-=1,this.state=Na.START,this.emitNumber();continue;case Na.NUMBER_AFTER_INITIAL_NON_ZERO:if(r>=ba.DIGIT_ZERO&&r<=ba.DIGIT_NINE){this.bufferedNumber.appendChar(r);continue}if(r===ba.FULL_STOP){this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_FULL_STOP;continue}if(r===ba.LATIN_SMALL_LETTER_E||r===ba.LATIN_CAPITAL_LETTER_E){this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_E;continue}s-=1,this.state=Na.START,this.emitNumber();continue;case Na.NUMBER_AFTER_FULL_STOP:if(r>=ba.DIGIT_ZERO&&r<=ba.DIGIT_NINE){this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_DECIMAL;continue}break;case Na.NUMBER_AFTER_DECIMAL:if(r>=ba.DIGIT_ZERO&&r<=ba.DIGIT_NINE){this.bufferedNumber.appendChar(r);continue}if(r===ba.LATIN_SMALL_LETTER_E||r===ba.LATIN_CAPITAL_LETTER_E){this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_E;continue}s-=1,this.state=Na.START,this.emitNumber();continue;case Na.NUMBER_AFTER_E:if(r===ba.PLUS_SIGN||r===ba.HYPHEN_MINUS){this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_E_AND_SIGN;continue}case Na.NUMBER_AFTER_E_AND_SIGN:if(r>=ba.DIGIT_ZERO&&r<=ba.DIGIT_NINE){this.bufferedNumber.appendChar(r),this.state=Na.NUMBER_AFTER_E_AND_DIGIT;continue}break;case Na.NUMBER_AFTER_E_AND_DIGIT:if(r>=ba.DIGIT_ZERO&&r<=ba.DIGIT_NINE){this.bufferedNumber.appendChar(r);continue}s-=1,this.state=Na.START,this.emitNumber();continue;case Na.TRUE1:if(r===ba.LATIN_SMALL_LETTER_R){this.state=Na.TRUE2;continue}break;case Na.TRUE2:if(r===ba.LATIN_SMALL_LETTER_U){this.state=Na.TRUE3;continue}break;case Na.TRUE3:if(r===ba.LATIN_SMALL_LETTER_E){this.state=Na.START,this.onToken({token:Ia.TRUE,value:!0,offset:this.offset}),this.offset+=3;continue}break;case Na.FALSE1:if(r===ba.LATIN_SMALL_LETTER_A){this.state=Na.FALSE2;continue}break;case Na.FALSE2:if(r===ba.LATIN_SMALL_LETTER_L){this.state=Na.FALSE3;continue}break;case Na.FALSE3:if(r===ba.LATIN_SMALL_LETTER_S){this.state=Na.FALSE4;continue}break;case Na.FALSE4:if(r===ba.LATIN_SMALL_LETTER_E){this.state=Na.START,this.onToken({token:Ia.FALSE,value:!1,offset:this.offset}),this.offset+=4;continue}break;case Na.NULL1:if(r===ba.LATIN_SMALL_LETTER_U){this.state=Na.NULL2;continue}break;case Na.NULL2:if(r===ba.LATIN_SMALL_LETTER_L){this.state=Na.NULL3;continue}break;case Na.NULL3:if(r===ba.LATIN_SMALL_LETTER_L){this.state=Na.START,this.onToken({token:Ia.NULL,value:null,offset:this.offset}),this.offset+=3;continue}break;case Na.SEPARATOR:if(this.separatorIndex+=1,!this.separatorBytes||r!==this.separatorBytes[this.separatorIndex])break;this.separatorIndex===this.separatorBytes.length-1&&(this.state=Na.START,this.onToken({token:Ia.SEPARATOR,value:this.separator,offset:this.offset+this.separatorIndex}),this.separatorIndex=0);continue;case Na.BOM:if(r===this.bom[this.bomIndex]){if(this.bomIndex===this.bom.length-1){this.state=Na.START,this.bom=void 0,this.bomIndex=0;continue}this.bomIndex+=1;continue}break;case Na.ENDED:if(r===ba.SPACE||r===ba.NEWLINE||r===ba.CARRIAGE_RETURN||r===ba.TAB)continue}throw new Ua(`Unexpected "${String.fromCharCode(r)}" at position "${s}" in state ${Ma(this.state)}`)}if(this.emitPartialTokens)switch(this.state){case Na.TRUE1:case Na.TRUE2:case Na.TRUE3:this.onToken({token:Ia.TRUE,value:!0,offset:this.offset,partial:!0});break;case Na.FALSE1:case Na.FALSE2:case Na.FALSE3:case Na.FALSE4:this.onToken({token:Ia.FALSE,value:!1,offset:this.offset,partial:!0});break;case Na.NULL1:case Na.NULL2:case Na.NULL3:this.onToken({token:Ia.NULL,value:null,offset:this.offset,partial:!0});break;case Na.STRING_DEFAULT:{const e=this.bufferedString.toString();this.onToken({token:Ia.STRING,value:e,offset:this.offset,partial:!0});break}case Na.NUMBER_AFTER_INITIAL_ZERO:case Na.NUMBER_AFTER_INITIAL_NON_ZERO:case Na.NUMBER_AFTER_DECIMAL:case Na.NUMBER_AFTER_E_AND_DIGIT:try{this.onToken({token:Ia.NUMBER,value:this.parseNumber(this.bufferedNumber.toString()),offset:this.offset,partial:!0})}catch(e){}}}catch(e){this.error(e)}}emitNumber(){this.onToken({token:Ia.NUMBER,value:this.parseNumber(this.bufferedNumber.toString()),offset:this.offset}),this.offset+=this.bufferedNumber.byteLength-1}parseNumber(e){return Number(e)}error(e){this.state!==Na.ENDED&&(this.state=Na.ERROR),this.onError(e)}end(){switch(this.state){case Na.NUMBER_AFTER_INITIAL_ZERO:case Na.NUMBER_AFTER_INITIAL_NON_ZERO:case Na.NUMBER_AFTER_DECIMAL:case Na.NUMBER_AFTER_E_AND_DIGIT:this.state=Na.ENDED,this.emitNumber(),this.onEnd();break;case Na.BOM_OR_START:case Na.START:case Na.ERROR:case Na.SEPARATOR:this.state=Na.ENDED,this.onEnd();break;default:this.error(new Ua(`Tokenizer ended in the middle of a token (state: ${Ma(this.state)}). Either not all the data was received or the data was invalid.`))}}onToken(e){throw new Ua('Can\'t emit tokens before the "onToken" callback has been set up.')}onError(e){throw e}onEnd(){}}var Ba,ka;function ja(e){return["VALUE","KEY","COLON","COMMA","ENDED","ERROR","SEPARATOR"][e]}!function(e){e[e.OBJECT=0]="OBJECT",e[e.ARRAY=1]="ARRAY"}(Ba||(Ba={})),function(e){e[e.VALUE=0]="VALUE",e[e.KEY=1]="KEY",e[e.COLON=2]="COLON",e[e.COMMA=3]="COMMA",e[e.ENDED=4]="ENDED",e[e.ERROR=5]="ERROR",e[e.SEPARATOR=6]="SEPARATOR"}(ka||(ka={}));const Da={paths:void 0,keepStack:!0,separator:void 0,emitPartialValues:!1};class xa extends Error{constructor(e){super(e),Object.setPrototypeOf(this,xa.prototype)}}class Fa{constructor(e){this.state=ka.VALUE,this.mode=void 0,this.key=void 0,this.value=void 0,this.stack=[],(e=Object.assign(Object.assign({},Da),e)).paths&&(this.paths=e.paths.map((e=>{if(void 0===e||"$*"===e)return;if(!e.startsWith("$"))throw new xa(`Invalid selector "${e}". Should start with "$".`);const t=e.split(".").slice(1);if(t.includes(""))throw new xa(`Invalid selector "${e}". ".." syntax not supported.`);return t}))),this.keepStack=e.keepStack||!1,this.separator=e.separator,e.emitPartialValues||(this.emitPartial=()=>{})}shouldEmit(){return!this.paths||this.paths.some((e=>{var t;if(void 0===e)return!0;if(e.length!==this.stack.length)return!1;for(let t=0;t<e.length-1;t++){const s=e[t],r=this.stack[t+1].key;if("*"!==s&&s!==(null==r?void 0:r.toString()))return!1}const s=e[e.length-1];return"*"===s||s===(null===(t=this.key)||void 0===t?void 0:t.toString())}))}push(){this.stack.push({key:this.key,value:this.value,mode:this.mode,emit:this.shouldEmit()})}pop(){const e=this.value;let t;({key:this.key,value:this.value,mode:this.mode,emit:t}=this.stack.pop()),this.state=void 0!==this.mode?ka.COMMA:ka.VALUE,this.emit(e,t)}emit(e,t){!this.keepStack&&this.value&&this.stack.every((e=>!e.emit))&&delete this.value[this.key],t&&this.onValue({value:e,key:this.key,parent:this.value,stack:this.stack}),0===this.stack.length&&(this.separator?this.state=ka.SEPARATOR:void 0===this.separator&&this.end())}emitPartial(e){this.shouldEmit()&&(this.state!==ka.KEY?this.onValue({value:e,key:this.key,parent:this.value,stack:this.stack,partial:!0}):this.onValue({value:void 0,key:e,parent:this.value,stack:this.stack,partial:!0}))}get isEnded(){return this.state===ka.ENDED}write({token:e,value:t,partial:s}){try{if(s)return void this.emitPartial(t);if(this.state===ka.VALUE){if(e===Ia.STRING||e===Ia.NUMBER||e===Ia.TRUE||e===Ia.FALSE||e===Ia.NULL)return this.mode===Ba.OBJECT?(this.value[this.key]=t,this.state=ka.COMMA):this.mode===Ba.ARRAY&&(this.value.push(t),this.state=ka.COMMA),void this.emit(t,this.shouldEmit());if(e===Ia.LEFT_BRACE){if(this.push(),this.mode===Ba.OBJECT)this.value=this.value[this.key]={};else if(this.mode===Ba.ARRAY){const e={};this.value.push(e),this.value=e}else this.value={};return this.mode=Ba.OBJECT,this.state=ka.KEY,this.key=void 0,void this.emitPartial()}if(e===Ia.LEFT_BRACKET){if(this.push(),this.mode===Ba.OBJECT)this.value=this.value[this.key]=[];else if(this.mode===Ba.ARRAY){const e=[];this.value.push(e),this.value=e}else this.value=[];return this.mode=Ba.ARRAY,this.state=ka.VALUE,this.key=0,void this.emitPartial()}if(this.mode===Ba.ARRAY&&e===Ia.RIGHT_BRACKET&&0===this.value.length)return void this.pop()}if(this.state===ka.KEY){if(e===Ia.STRING)return this.key=t,this.state=ka.COLON,void this.emitPartial();if(e===Ia.RIGHT_BRACE&&0===Object.keys(this.value).length)return void this.pop()}if(this.state===ka.COLON&&e===Ia.COLON)return void(this.state=ka.VALUE);if(this.state===ka.COMMA){if(e===Ia.COMMA){if(this.mode===Ba.ARRAY)return this.state=ka.VALUE,void(this.key+=1);if(this.mode===Ba.OBJECT)return void(this.state=ka.KEY)}if(e===Ia.RIGHT_BRACE&&this.mode===Ba.OBJECT||e===Ia.RIGHT_BRACKET&&this.mode===Ba.ARRAY)return void this.pop()}if(this.state===ka.SEPARATOR&&e===Ia.SEPARATOR&&t===this.separator)return void(this.state=ka.VALUE);if(e===Ia.SEPARATOR&&this.state!==ka.SEPARATOR&&Array.from(t).map((e=>e.charCodeAt(0))).every((e=>e===ba.SPACE||e===ba.NEWLINE||e===ba.CARRIAGE_RETURN||e===ba.TAB)))return;throw new xa(`Unexpected ${Ia[e]} (${JSON.stringify(t)}) in state ${ja(this.state)}`)}catch(e){this.error(e)}}error(e){this.state!==ka.ENDED&&(this.state=ka.ERROR),this.onError(e)}end(){this.state!==ka.VALUE&&this.state!==ka.SEPARATOR||this.stack.length>0?this.error(new Error(`Parser ended in mid-parsing (state: ${ja(this.state)}). Either not all the data was received or the data was invalid.`)):(this.state=ka.ENDED,this.onEnd())}onValue(e){throw new xa('Can\'t emit data before the "onValue" callback has been set up.')}onError(e){throw e}onEnd(){}}class qa{constructor(e={}){this.tokenizer=new Pa(e),this.tokenParser=new Fa(e),this.tokenizer.onToken=this.tokenParser.write.bind(this.tokenParser),this.tokenizer.onEnd=()=>{this.tokenParser.isEnded||this.tokenParser.end()},this.tokenParser.onError=this.tokenizer.error.bind(this.tokenizer),this.tokenParser.onEnd=()=>{this.tokenizer.isEnded||this.tokenizer.end()}}get isEnded(){return this.tokenizer.isEnded&&this.tokenParser.isEnded}write(e){this.tokenizer.write(e)}end(){this.tokenizer.end()}set onToken(e){this.tokenizer.onToken=t=>{e(t),this.tokenParser.write(t)}}set onValue(e){this.tokenParser.onValue=e}set onError(e){this.tokenizer.onError=e}set onEnd(e){this.tokenParser.onEnd=()=>{this.tokenizer.isEnded||this.tokenizer.end(),e.call(this.tokenParser)}}}var Ga;function Ha(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}(Ga||(Ga={})).STREAM_PARSER_JSON_ERROR="chat_sdk_pull_stream_parser_error";class za{__init(){this.parserOptions={emitPartialValues:!0,emitPartialTokens:!0,keepStack:!0}}__init2(){this.jsonParserMap={}}__init3(){this.jsonParserMetaMap={}}constructor(e){za.prototype.__init.call(this),za.prototype.__init2.call(this),za.prototype.__init3.call(this),za.prototype.__init4.call(this),za.prototype.__init5.call(this),za.prototype.__init6.call(this),za.prototype.__init7.call(this),za.prototype.__init8.call(this);const{reportLogWithScope:t}=e;this.reportLogWithScope=t}__init4(){this.getJsonParser=e=>{if(this.jsonParserMap[e])return this.jsonParserMap[e];const t=new qa(this.parserOptions);return this.jsonParserMap[e]=t,this.jsonParserMetaMap[e]={isError:!1},this.jsonParserMap[e]}}__init5(){this.updateJsonParserMeta=(e,t)=>{Zs(this.jsonParserMetaMap,e,t)}}__init6(){this.write=(e,t,{onValue:s,onError:r,onEnd:n,onToken:o})=>{const i=this.getJsonParser(e);Ha([this,"access",e=>e.jsonParserMetaMap,"access",t=>t[e],"optionalAccess",e=>e.isError])||i.isEnded||(i.onValue=s,i.onError=t=>{this.updateJsonParserMeta(e,(e=>({...e,isError:!0}))),Ha([r,"optionalCall",e=>e(t)]),this.reportLogWithScope.slardarErrorEvent({error:t,eventName:Ga.STREAM_PARSER_JSON_ERROR,meta:{msgId:e}})},i.onEnd=()=>{this.clearByMsgId(e),Ha([n,"optionalCall",e=>e()])},o&&(i.onToken=o),i.write(t))}}__init7(){this.clearParserCallback=e=>{e.onValue=ie,e.onError=ie,e.onEnd=ie,e.onToken=ie}}__init8(){this.clearByMsgId=e=>{const t=this.jsonParserMap[e];t&&this.clearParserCallback(t),delete this.jsonParserMap[e],delete this.jsonParserMetaMap[e]}}destroy(){Object.values(this.jsonParserMap).forEach(this.clearParserCallback),this.jsonParserMap={},this.jsonParserMetaMap={}}}const Wa={toolRequestStreamingParameters:!1},$a={v1:{toolRequestStreamingParameters:!0}},Va=e=>{return"tool_request"===e.type&&(t=e.version,t&&$a[t]||Wa).toolRequestStreamingParameters;var t};function Ka(e,t){return null!=e?e:t()}function Ja(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}class Qa{constructor(e){const{initMessageBuffer:t=[],reportLogWithScope:s}=e;this.streamMessageBuffer=Es(t),this.streamChunkBuffer=Es(t),this.streamParserJson=new za({reportLogWithScope:s}),this.streamMessageBuffer.forEach((e=>{Va(e)&&this.streamParserJson.write(e.msg_id,Ja([e,"access",e=>e.content,"access",e=>e.tool_request,"optionalAccess",e=>e.stream_parameters])||"",{onValue:ie})}))}pushChunk(e){this.streamChunkBuffer.push(e)}clearMessageBuffer(){this.streamMessageBuffer=[],this.streamChunkBuffer=[],this.streamParserJson.destroy()}getChunkByMessageId(e){return this.streamChunkBuffer.filter((t=>t.msg_id===e))}concatBatchAndUpdateMessage(e){const{msgId:t,chunks:s}=e;if(0===s.length)return;s.forEach((e=>{this.streamChunkBuffer.push(e)}));const r=s.at(0),n=this.streamMessageBuffer.findIndex((e=>r?""!==t?e.msg_id===t:""===e.msg_id&&e.type===r.type&&e.query_msg_id===r.query_msg_id:e.msg_id===t)),o=-1!==n?this.streamMessageBuffer[n]:void 0,i=Aa(o,s);if(!i)return;const a=Va(i);return a&&s.forEach((e=>{this.streamParserJson.write(e.msg_id,Ja([e,"access",e=>e.content,"access",e=>e.tool_request,"optionalAccess",e=>e.stream_parameters])||"",{onValue:(...e)=>{const t=(e=>{const{key:t,value:s,stack:r,partial:n,parent:o}=e,i=r.slice(1),a=i.at(0);if(Vs(t)||Vs(s))return;const c=Es(o),l=Es(s);if(!a){if(!n)return c||l;if(!c)return;return c[t]=l,c}const u=Es(a.value);return n?(Zs(u,i.map((e=>e.key)).filter((e=>!Vs(e))).concat(t),(()=>l)),u):u})(...e);t&&(i.streamParametersContent=t)}})})),!i.streamParametersContent&&a&&o&&(i.streamParametersContent=o.streamParametersContent),-1===n?this.streamMessageBuffer.push(i):this.streamMessageBuffer.splice(n,1,i),i}}const Ya=1073741823;class Za{__init(){this.shallowCloneStreamBuffer=()=>({streamMessageBuffer:[...this.streamBuffer.streamMessageBuffer],streamChunkBuffer:[...this.streamBuffer.streamChunkBuffer]})}__init2(){this.getStreamBuffer=()=>this.shallowCloneStreamBuffer()}__init3(){this.getStreamBufferWithMeta=()=>{const e=this.shallowCloneStreamBuffer();return{...e,...this.simpleMessageDump.getBufferMeta(e.streamMessageBuffer)}}}__init4(){this.getStreamBufferSnapshot=()=>this.simpleMessageDump.getStreamBufferSnapshot()}constructor(e){Za.prototype.__init.call(this),Za.prototype.__init2.call(this),Za.prototype.__init3.call(this),Za.prototype.__init4.call(this),Za.prototype.__init5.call(this),Za.prototype.__init6.call(this),Za.prototype.__init7.call(this),Za.prototype.__init8.call(this);const{getEnableDebug:t,key:s,reportLogWithScope:r,initMaxSequenceId:n}=e;this.getEnableDebug=t,this.maxSequenceId=Ka(n,(()=>0)),this.enableChunkProcessedCheck=Ka(e.enableChunkProcessedCheck,(()=>!1)),this.streamBuffer=new Qa(e),this.debugLogger=new ya({reportLogWithScope:r,getEnableDebug:t,getLogPayload:()=>this.getStreamBuffer(),mark:"ChunkProcessor"}),this.simpleMessageDump=new La({key:s})}__init5(){this.startDebugLog=e=>{this.debugLogger.isDebugging||this.debugLogger.startDebugLog(e)}}__init6(){this.stopDebugLog=()=>{this.debugLogger.stopDebugLog()}}isStreamBufferEmpty(){return 0===this.streamBuffer.streamChunkBuffer.length&&0===this.streamBuffer.streamMessageBuffer.length}__init7(){this.clearMessageBuffer=()=>{this.stopDebugLog(),this.simpleMessageDump.recordStreamBuffer(this.shallowCloneStreamBuffer()),this.streamBuffer.clearMessageBuffer()}}addBatchAndProcess(e){const t=e.chunks.at(0);if(t)return this.startDebugLog(t.query_msg_id),this.streamBuffer.concatBatchAndUpdateMessage(e)}checkInBufferProcessed(e){return""===e.msg_id?this.streamBuffer.streamMessageBuffer.some((t=>""===t.msg_id&&t.type===e.type&&t.query_msg_id===e.query_msg_id&&t.sequence_id>=e.sequence_id)):this.streamBuffer.streamMessageBuffer.some((t=>t.msg_id===e.msg_id&&t.sequence_id>=e.sequence_id))}checkMessageHasProcessed(e){if(this.checkInBufferProcessed(e))return!0;if(!this.enableChunkProcessedCheck)return!1;if(0===this.maxSequenceId)return this.maxSequenceId=e.sequence_id,!1;const t=this.maxSequenceId,s=e.sequence_id,r=t>Ya,n=s>Ya;return r&&!n?(this.maxSequenceId=s,!1):!(r||!n)||(!(s>=t)||(this.maxSequenceId=s,!1))}getProcessedMessageByChunk(e){return this.streamBuffer.streamMessageBuffer.find((t=>t.msg_id===e.msg_id))}getProcessedMessageByMessageId(e){return this.streamBuffer.streamMessageBuffer.find((t=>t.msg_id===e))}getAckMessageByLocalMessageId(e){return this.streamBuffer.streamMessageBuffer.find((t=>Ja([t,"access",e=>e.content,"access",e=>e.message_start,"optionalAccess",e=>e.local_msg_id])===e&&"message_start"===t.type))}getFirstReplyMessageByChunk(e){if(this.streamBuffer.streamMessageBuffer.some((t=>"message_start"===t.type&&t.query_msg_id===e.query_msg_id)))return this.streamBuffer.streamMessageBuffer.find((t=>"message_start"!==t.type&&t.query_msg_id===e.query_msg_id))}getAckMessage(){return this.streamBuffer.streamMessageBuffer.find((e=>"message_start"===e.type))}isFirstReplyMessage(e){return!!this.getAckMessage()&&!this.getFirstReplyMessageByChunk(e)}getReplyMessagesByQueryMsgId(e){return this.streamBuffer.streamMessageBuffer.filter((t=>"message_start"!==t.type&&t.query_msg_id===e))}__init8(){this.destroy=()=>{this.debugLogger.destroy(),this.clearMessageBuffer(),this.simpleMessageDump.clear()}}}var Xa,ec,tc;!function(e){e.MESSAGE_RECEIVED_AND_UPDATE="message_received_and_update";e.MESSAGE_PULLING_STATUS="message_pulling_status";e.SEND_MESSAGE_ERROR="send_message_error";e.CHANNEL_STATUS="channel_status";e.CONTEXT_CHANGE="context_change";e.SESSION_CHANGED="session_changed"}(Xa||(Xa={})),function(e){e[e.Unknown=0]="Unknown";e[e.Prev=1]="Prev";e[e.Next=2]="Next"}(ec||(ec={}));class sc{__init(){this.timer=null}__init2(){this.timeoutMs=12e4}constructor(e){sc.prototype.__init.call(this),sc.prototype.__init2.call(this),this.reportLogWithScope=e.reportLogWithScope,e.timeoutMs&&(this.timeoutMs=e.timeoutMs),this.getChannelOptions=e.getChannelOptions}flushMessage(e){this.timer&&clearTimeout(this.timer),this.timer=setTimeout((()=>{this.reportLogWithScope.slardarErrorEvent({eventName:`${this.getChannelOptions().channelName}_OnMessageTimeout`,error:new Error("OnMessageTimeout - 超时未收到消息"),meta:{...this.getChannelOptions(),log_id:e.log_id,query_msg_id:e.query_msg_id,lastMessage:e}}),this.timer=null}),this.timeoutMs)}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}}function rc(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}function nc(e,t,s){let r,n;if(2===arguments.length?t&&"object"==typeof t&&("onError"in t||"validate"in t||"throwOnValidationError"in t)?(n=t,r=void 0):(r=t,n=void 0):3===arguments.length&&(r=t,n=s),"object"==typeof e&&null!==e)return e;try{const t=JSON.parse(String(e));if(rc([n,"optionalAccess",e=>e.validate])){if(n.validate(t))return t;{const t=new Error("JSON validation failed");if(rc([n,"access",e=>e.onError,"optionalCall",s=>s(t,e)]),n.throwOnValidationError)throw t;return r}}return t}catch(t){if(t instanceof Error&&"JSON validation failed"===t.message&&rc([n,"optionalAccess",e=>e.throwOnValidationError]))throw t;return rc([n,"optionalAccess",e=>e.onError,"optionalCall",s=>s(t,e)]),r}}!function(e){e.MESSAGE_END="message_end";e.MESSAGE_SEND_SUCCESS="message_send_success";e.MESSAGE_SEND_AND_RECEIVE_ERROR="message_send_and_receive_error";e.MESSAGE_SEND_TIMEOUT="message_send_timeout"}(tc||(tc={}));class oc{__init(){this.state="pending"}constructor(){oc.prototype.__init.call(this),this.promise=new Promise(((e,t)=>{this.resolve=(...t)=>{this.state="fulfilled",e(...t)},this.reject=(...e)=>{this.state="rejected",t(...e)}})),this.then=this.promise.then.bind(this.promise)}}function ic(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}const ac={message_start:!0,answer:!0,thinking:!0,tool_request:!0,tool_process:!0,tool_response:!0,message_end:!0,deploy:!0,version:!0,context:!0,session_changed:!0,error:!0,message_enqueued:!0},cc=e=>{const{type:t}=e;return(e=>e in ac)(t)?Va({type:t,version:e.version})?{...e,role:"assistant",type:t,streamParametersContent:(n=ic([e,"access",e=>e.content,"access",e=>e.tool_request,"optionalAccess",e=>e.stream_parameters]),o=()=>"",s=null!=n?n:o(),nc(s,void 0,{onError:r}))}:{...e,role:"assistant",type:t}:((e=>{throw new Error(`[chat-area] ${e}`)})(`invalid server message type: ${t}`),{...e,role:"assistant"});var s,r,n,o};class lc extends Error{constructor(e,t){super(e),lc.prototype.__init.call(this),this.name="chatCoreError",this.ext=t||{}}__init(){this.flatten=()=>{const{message:e,ext:t}=this;return{message:e,...t}}}}function uc(e,t){return null!=e?e:t()}function hc(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}const dc=e=>{const{content:t,type:s}=e;switch(s){case"answer":return uc(hc([t,"access",e=>e.answer,"optionalAccess",e=>e.length]),(()=>0));case"thinking":return uc(hc([t,"access",e=>e.thinking,"optionalAccess",e=>e.length]),(()=>0));case"tool_request":return uc(hc([t,"access",e=>e.tool_request,"optionalAccess",e=>e.stream_parameters,"optionalAccess",e=>e.length]),(()=>0));case"tool_process":return(e=>{const t=hc([e,"access",e=>e.content,"access",e=>e.tool_process,"optionalAccess",e=>e.data,"access",e=>e.content]);return ga.reduce(((e,s)=>{const r=hc([t,"optionalAccess",e=>e[s]]);return"string"!=typeof r?e:e+r.length}),0)})(e);case"tool_response":return uc(hc([t,"access",e=>e.tool_response,"optionalAccess",e=>e.result,"access",e=>e.length]),(()=>0));default:return 0}};class pc{__init(){this.bufferMap=new Map}constructor(e,t){pc.prototype.__init.call(this),pc.prototype.__init2.call(this),pc.prototype.__init3.call(this),pc.prototype.__init4.call(this),pc.prototype.__init5.call(this),pc.prototype.__init6.call(this),pc.prototype.__init7.call(this),pc.prototype.__init8.call(this),pc.prototype.__init9.call(this),pc.prototype.__init10.call(this),this.onFlush=e,this.config={lengthThreshold:uc(hc([t,"optionalAccess",e=>e.lengthThreshold]),(()=>4096)),maxWaitMs:uc(hc([t,"optionalAccess",e=>e.maxWaitMs]),(()=>500))}}__init2(){this.createEntry=(e,t)=>({msgId:e,chunks:[],totalLength:0,startSeq:t.sequence_id,maxWaitTimerId:null,hasFirstFlushed:!1})}__init3(){this.enqueue=e=>{const{msg_id:t}=e;let s=this.bufferMap.get(t);if(!s)return s=this.createEntry(t,e),this.bufferMap.set(t,s),this.onFlush({msgId:t,chunks:[e],startSeq:e.sequence_id,reason:"firstChunk"}),void(s.hasFirstFlushed=!0);0===s.chunks.length&&(s.startSeq=e.sequence_id),s.chunks.push(e),s.totalLength+=dc(e),s.totalLength>=this.config.lengthThreshold?this.flush(t,"length"):e.finish?this.flush(t,"finish"):this.armMaxWaitTimer(t)}}__init4(){this.flush=(e,t)=>{const s=this.bufferMap.get(e);if(!s||0===s.chunks.length)return;this.cancelMaxWaitTimer(e);const r=this.buildBatch(s,t);this.onFlush(r),s.chunks=[],s.totalLength=0}}__init5(){this.buildBatch=(e,t)=>({msgId:e.msgId,chunks:[...e.chunks],startSeq:e.startSeq,reason:t})}__init6(){this.armMaxWaitTimer=e=>{const t=this.bufferMap.get(e);t&&(t.maxWaitTimerId||(t.maxWaitTimerId=setTimeout((()=>{this.flush(e,"maxWait")}),this.config.maxWaitMs)))}}__init7(){this.cancelMaxWaitTimer=e=>{const t=this.bufferMap.get(e);hc([t,"optionalAccess",e=>e.maxWaitTimerId])&&(clearTimeout(t.maxWaitTimerId),t.maxWaitTimerId=null)}}__init8(){this.forceFlush=e=>{this.flush(e,"force"),this.bufferMap.delete(e)}}__init9(){this.forceFlushAll=()=>{Array.from(this.bufferMap.keys()).forEach((e=>this.forceFlush(e)))}}__init10(){this.destroy=()=>{this.bufferMap.forEach(((e,t)=>{this.cancelMaxWaitTimer(t)})),this.bufferMap.clear()}}}function _c(e,t){return null!=e?e:t()}function fc(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}class mc{__init(){this.bufferManager=null}constructor({channel:e,reportLogWithScope:t,chunkProcessor:s,preSendLocalMessageEventsManager:r,chatSdkEventEmit:n,chatSdkEventBus:o,reportEventsTracer:i,manualInitChannel:a,enableBuffer:c=!1}){mc.prototype.__init.call(this),mc.prototype.__init2.call(this),mc.prototype.__init3.call(this),mc.prototype.__init4.call(this),mc.prototype.__init5.call(this),mc.prototype.__init6.call(this),mc.prototype.__init7.call(this),mc.prototype.__init8.call(this),mc.prototype.__init9.call(this),mc.prototype.__init10.call(this),mc.prototype.__init11.call(this),mc.prototype.__init12.call(this),mc.prototype.__init13.call(this),mc.prototype.__init14.call(this),mc.prototype.__init15.call(this),this.channel=e,this.reportLogWithScope=t,this.chunkProcessor=s,this.preSendLocalMessageEventsManager=r,this.chatSdkEventEmit=n,this.reportEventsTracer=i,this.chatSdkEventBus=o,this.enableBuffer=c,this.onMessageMonitor=new sc({reportLogWithScope:t,getChannelOptions:()=>({..._c(fc([this,"access",e=>e.channel,"access",e=>e.getChannelOptions,"optionalCall",e=>e()]),(()=>({}))),channelName:this.channel.channelName}),timeoutMs:12e4}),c&&(this.bufferManager=new pc(this.processChunkBatchAndEmit,void 0)),a||this.initChannel()}onChannelEvents(){this.channel.addEventListener("onmessage",this.handleChannelMessage),this.channel.addEventListener("onerror",this.handleWebSocketChannelError),this.channel.addEventListener("onopen",this.handleChannelOpen),this.channel.addEventListener("onclose",this.handleChannelClose)}offChannelEvents(){this.channel.removeEventListener("onmessage",this.handleChannelMessage),this.channel.removeEventListener("onerror",this.handleWebSocketChannelError),this.channel.removeEventListener("onopen",this.handleChannelOpen),this.channel.removeEventListener("onclose",this.handleChannelClose)}__init2(){this.handleChannelMessage=e=>{const t=cc(e);this.onMessageMonitor.flushMessage(t);const{type:s}=t;return"context"===s&&t.content.context?this.handleContextChange(t.content.context):"session_changed"===s&&t.content.session_changed?this.handleSessionChange(t.content.session_changed):this.handleChatMessage(t)}}__init3(){this.handleContextChange=e=>{this.reportLogWithScope.info({message:"context 更新",meta:{context:e}}),this.chatSdkEventEmit(Xa.CONTEXT_CHANGE,{name:Xa.CONTEXT_CHANGE,data:e})}}__init4(){this.handleSessionChange=e=>{this.reportLogWithScope.info({message:"session 更新",meta:{session:e}}),this.chatSdkEventEmit(Xa.SESSION_CHANGED,{name:Xa.SESSION_CHANGED,data:e})}}__init5(){this.handleChatFinish=()=>{fc([this,"access",e=>e.bufferManager,"optionalAccess",e=>e.forceFlushAll,"call",e=>e()]),this.chunkProcessor.clearMessageBuffer(),this.onMessageMonitor.destroy()}}__init6(){this.createSingleChunkBatch=e=>({msgId:e.msg_id,chunks:[e],startSeq:e.sequence_id,reason:"force"})}__init7(){this.processChunkBatchAndEmit=e=>{const{chunks:t}=e;if(0===t.length)return;const s=t.at(0);if(!s)return;const{query_msg_id:r,log_id:n,content:o}=s,i=_c(fc([o,"access",e=>e.message_start,"optionalAccess",e=>e.local_msg_id]),(()=>""));this.chunkProcessor.isFirstReplyMessage(s)&&fc([this,"access",e=>e.reportEventsTracer,"optionalAccess",e=>e.pullStreamTracer,"optionalAccess",e=>e.receiveFirstAnsChunk,"call",e=>e(i,{log_id:n})]);const a=this.chunkProcessor.addBatchAndProcess(e);if(!a)throw new lc("processedMessage is undefined",{local_msg_id:i});this.chatSdkEventEmit(Xa.MESSAGE_PULLING_STATUS,{name:Xa.MESSAGE_PULLING_STATUS,data:{pullingStatus:"pulling",local_msg_id:i,query_msg_id:r,conversation_id:s.conversation_id}}),this.chatSdkEventEmit(Xa.MESSAGE_RECEIVED_AND_UPDATE,{name:Xa.MESSAGE_RECEIVED_AND_UPDATE,data:[a]})}}__init8(){this.handleChatMessage=e=>{const{content:t,type:s}=e,r=_c(fc([t,"access",e=>e.message_start,"optionalAccess",e=>e.local_msg_id]),(()=>""));if(!this.chunkProcessor.checkMessageHasProcessed(e))if("message_end"!==s)if("message_start"!==s)if("error"!==s)this.enableBuffer&&this.bufferManager?this.bufferManager.enqueue(e):this.processChunkBatchAndEmit(this.createSingleChunkBatch(e));else{fc([this,"access",e=>e.bufferManager,"optionalAccess",e=>e.forceFlushAll,"call",e=>e()]);const t=this.chunkProcessor.addBatchAndProcess(this.createSingleChunkBatch(e));if(!t)throw new lc("processedMessage is undefined",{local_msg_id:r});this.handleMessageError(t)}else{const t=this.chunkProcessor.addBatchAndProcess(this.createSingleChunkBatch(e));if(!t)throw new lc("processedMessage is undefined",{local_msg_id:r});this.handleMessageStart(t)}else{fc([this,"access",e=>e.bufferManager,"optionalAccess",e=>e.forceFlushAll,"call",e=>e()]);const t=this.chunkProcessor.addBatchAndProcess(this.createSingleChunkBatch(e));if(!t)throw new lc("processedMessage is undefined",{local_msg_id:r});this.handleMessageEnd(t)}}}__init9(){this.handleWebSocketChannelError=e=>{!e.ext.willClose&&e.ext.isQosError||(this.onMessageMonitor.destroy(),this.reportLogWithScope.error({message:"信道异常",error:e}),this.chatSdkEventEmit(Xa.MESSAGE_PULLING_STATUS,{name:Xa.MESSAGE_PULLING_STATUS,data:{pullingStatus:"channel_error",wsError:e}}),this.chatSdkEventEmit(Xa.CHANNEL_STATUS,{name:Xa.CHANNEL_STATUS,data:{channelStatus:"disconnected",message:e.message}}),this.handleChatFinish())}}__init10(){this.handleMessageEnd=e=>{const{query_msg_id:t,reply_id:s,content:r}=e,n=this.chunkProcessor.getReplyMessagesByQueryMsgId(t);fc([this,"access",e=>e.reportEventsTracer,"optionalAccess",e=>e.pullStreamTracer,"optionalAccess",e=>e.success,"call",e=>e(t,{replyMessageCount:n})]),this.reportLogWithScope.info({message:"拉取回复完成",meta:{query_msg_id:t,message:e}});const o=r.message_end;switch(fc([o,"optionalAccess",e=>e.code])){case"0":this.chatSdkEventEmit(Xa.MESSAGE_PULLING_STATUS,{name:Xa.MESSAGE_PULLING_STATUS,data:{pullingStatus:"success",query_msg_id:t,reply_id:s,messageEndDetail:r.message_end,conversation_id:e.conversation_id}});break;case"1":this.chatSdkEventEmit(Xa.MESSAGE_PULLING_STATUS,{name:Xa.MESSAGE_PULLING_STATUS,data:{pullingStatus:"cancel",query_msg_id:t,messageEndDetail:r.message_end,reply_id:s,conversation_id:e.conversation_id}});break;default:this.chatSdkEventEmit(Xa.MESSAGE_PULLING_STATUS,{name:Xa.MESSAGE_PULLING_STATUS,data:{pullingStatus:"error",query_msg_id:t,messageEndDetail:r.message_end,reply_id:s,code:fc([o,"optionalAccess",e=>e.code]),message:fc([o,"optionalAccess",e=>e.message]),conversation_id:e.conversation_id}})}this.preSendLocalMessageEventsManager.emit(tc.MESSAGE_END,e),this.handleChatFinish()}}__init11(){this.handleMessageError=e=>{const{query_msg_id:t,content:s}=e,r=fc([s,"access",e=>e.error,"optionalAccess",e=>e.local_msg_id]),n=_c(fc([s,"access",e=>e.error,"optionalAccess",e=>e.error_msg]),(()=>"")),o=new lc(n,{query_msg_id:t,local_msg_id:r,code:fc([s,"access",e=>e.error,"optionalAccess",e=>e.code])});fc([this,"access",e=>e.reportEventsTracer,"optionalAccess",e=>e.pullStreamTracer,"optionalAccess",e=>e.error,"call",e=>e(o)]),this.reportLogWithScope.error({error:o,message:"收到错误消息",meta:{query_msg_id:t,local_msg_id:r,errorMessage:n}}),this.preSendLocalMessageEventsManager.emit(tc.MESSAGE_SEND_AND_RECEIVE_ERROR,o),this.chatSdkEventEmit(Xa.SEND_MESSAGE_ERROR,{name:Xa.SEND_MESSAGE_ERROR,data:{error:o}}),this.handleChatFinish()}}__init12(){this.handleMessageStart=e=>{const{content:t,query_msg_id:s,log_id:r}=e,n=t.message_start,o=fc([n,"optionalAccess",e=>e.local_msg_id]);fc([this,"access",e=>e.reportEventsTracer,"optionalAccess",e=>e.pullStreamTracer,"optionalAccess",e=>e.start,"call",e=>e(s,{logId:r})]),this.reportLogWithScope.info({message:"开始拉取回复",meta:{local_msg_id:o,query_msg_id:s,log_id:r}}),this.preSendLocalMessageEventsManager.emit(tc.MESSAGE_SEND_SUCCESS,e),this.chatSdkEventEmit(Xa.MESSAGE_PULLING_STATUS,{name:Xa.MESSAGE_PULLING_STATUS,data:{pullingStatus:"start",local_msg_id:o,query_msg_id:s,messageStartContent:fc([n,"optionalAccess",e=>e.content]),conversation_id:e.conversation_id}})}}__init13(){this.handleChannelOpen=()=>{this.reportLogWithScope.info({message:"信道连接成功"}),this.chatSdkEventEmit(Xa.CHANNEL_STATUS,{name:Xa.CHANNEL_STATUS,data:{channelStatus:"connected"}})}}__init14(){this.handleChannelClose=({code:e,reason:t})=>{this.onMessageMonitor.destroy(),this.reportLogWithScope.info({message:"信道关闭",meta:{code:e,reason:t}}),this.chatSdkEventEmit(Xa.CHANNEL_STATUS,{name:Xa.CHANNEL_STATUS,data:{channelStatus:"disconnected",message:t}})}}__init15(){this.initChannel=async()=>{this.channel.isChannelOpen()||await this.channel.connect()}}destroy(){fc([this,"access",e=>e.bufferManager,"optionalAccess",e=>e.destroy,"call",e=>e()]),this.offChannelEvents(),this.chatSdkEventBus.all.clear()}}function gc(e,t){return null!=e?e:t()}function Ec(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}class Tc{constructor({preSendLocalMessageFactory:e,channel:t,preSendLocalMessageEventsManager:s,reportLogWithScope:r,reportEventsTracer:n,chatSdkEventEmit:o}){Tc.prototype.__init.call(this),this.preSendLocalMessageFactory=e,this.channel=t,this.preSendLocalMessageEventsManager=s,this.reportLogWithScope=r,this.reportEventsTracer=n,this.chatSdkEventEmit=o}createChannelErrorHandler(e){return()=>{const t=new lc("Error: during send message channel onerror",{local_msg_id:e});throw Ec([this,"access",e=>e.reportEventsTracer,"optionalAccess",e=>e.sendMessageTracer,"access",e=>e.error,"call",e=>e(t)]),t}}__init(){this.createAckErrorHandler=e=>t=>{if("0"===t.code)return;const s=new lc(t.msg,{local_msg_id:e});throw this.chatSdkEventEmit(Xa.SEND_MESSAGE_ERROR,{name:Xa.SEND_MESSAGE_ERROR,data:{error:s}}),Ec([this,"access",e=>e.reportEventsTracer,"optionalAccess",e=>e.sendMessageTracer,"access",e=>e.error,"call",e=>e(s)]),s}}startMessageTracing(e,t){Ec([this,"access",e=>e.reportEventsTracer,"optionalAccess",e=>e.sendMessageTracer,"access",e=>e.start,"call",s=>s(e,{local_msg_id:e,...t})])}completeMessageTracing(e,t){Ec([this,"access",e=>e.reportEventsTracer,"optionalAccess",e=>e.sendMessageTracer,"access",e=>e.success,"call",s=>s(e,t)])}traceMessageError(e,t){Ec([this,"access",e=>e.reportEventsTracer,"optionalAccess",e=>e.sendMessageTracer,"access",e=>e.error,"call",e=>e(t)])}async sendCommandMessage(e){this.reportLogWithScope.info({message:"开始发送命令消息",meta:{message:e}}),await this.executeCommandMessage(e)}async executeCommandMessage(e){const{local_msg_id:t,type:s}=e;return this.startMessageTracing(t),new Promise(((r,n)=>{const o=this.createCommandContext(e,r,n);this.setupCommandEventListeners(o),this.sendMessageWithChannel(e,t).then((()=>this.handleCommandSendSuccess(s,t,o.promiseHandlers.resolve))).catch((e=>this.handleCommandSendError(e,t,o.promiseHandlers.reject)))}))}createCommandContext(e,t,s){const r={resolve:()=>{a(),t()},reject:e=>{a(),s(e)}},{local_msg_id:n,type:o}=e,i=[],a=()=>{i.forEach((e=>e()))};return{localMsgId:n,type:o,eventCleanup:i,cleanup:a,handleMessageEnd:e=>{"cancel"===o&&(this.completeMessageTracing(n,{logId:e.log_id}),r.resolve())},promiseHandlers:r}}setupCommandEventListeners(e){const{localMsgId:t,type:s,eventCleanup:r,handleMessageEnd:n}=e,o=this.createChannelErrorHandler(t),i=this.createAckErrorHandler(t),a=()=>{try{o()}catch(t){e.promiseHandlers.reject(t)}},c=t=>{try{i(t)}catch(t){e.promiseHandlers.reject(t)}};this.channel.addEventListener("onerror",a),this.channel.addEventListener("onack",c),r.push((()=>this.channel.removeEventListener("onerror",a))),r.push((()=>this.channel.removeEventListener("onack",c))),"cancel"===s&&(this.preSendLocalMessageEventsManager.on(tc.MESSAGE_END,n),r.push((()=>this.preSendLocalMessageEventsManager.off(tc.MESSAGE_END,n))))}handleCommandSendSuccess(e,t,s){"input"===e&&(this.completeMessageTracing(t),s())}handleCommandSendError(e,t,s){const r=new lc(`Error: channel send command message error: ${String(e)}`,{local_msg_id:t});this.traceMessageError(t,r),s(r)}async sendChatMessage(e,t){this.reportLogWithScope.info({message:"开始发送聊天消息",meta:{message:e}});const s=this.preSendLocalMessageFactory.getSendChatMessageStructure(e,t);return await this.executeChatMessage(s,t)}executeChatMessage(e,t){const{local_msg_id:s}=e,r=gc(Ec([t,"optionalAccess",e=>e.sendTimeout]),(()=>6e4));return new Promise(((t,n)=>{const o=this.createChatContext(e,t,n);this.setupChatEventListeners(o,r),this.startMessageTracing(s),this.sendMessageWithChannel(e,s).catch((e=>this.handleChatSendError(e,s,o.promiseHandlers.reject)))}))}createChatContext(e,t,s){const r={resolve:e=>{i(),t(e)},reject:e=>{i(),s(e)}},{local_msg_id:n}=e,o=[],i=()=>{o.forEach((e=>e()))};return{localMsgId:n,message:e,eventCleanup:o,cleanup:i,promiseHandlers:r}}setupChatEventListeners(e,t){const{localMsgId:s,eventCleanup:r,promiseHandlers:n}=e,o=this.setupTimeoutHandler(s,t,n.reject);r.push((()=>clearTimeout(o)));const i=this.createChannelErrorHandler(s),a=this.createAckErrorHandler(s),c=()=>{try{i()}catch(e){n.reject(e)}},l=e=>{try{a(e)}catch(e){n.reject(e)}};this.channel.addEventListener("onerror",c),this.channel.addEventListener("onack",l),r.push((()=>this.channel.removeEventListener("onerror",c))),r.push((()=>this.channel.removeEventListener("onack",l)));const u=this.createMessageSuccessHandler(e);this.preSendLocalMessageEventsManager.on(tc.MESSAGE_SEND_SUCCESS,u),r.push((()=>this.preSendLocalMessageEventsManager.off(tc.MESSAGE_SEND_SUCCESS,u)));const h=this.createMessageFailedHandler(s,n.reject);this.preSendLocalMessageEventsManager.on(tc.MESSAGE_SEND_AND_RECEIVE_ERROR,h),r.push((()=>this.preSendLocalMessageEventsManager.off(tc.MESSAGE_SEND_AND_RECEIVE_ERROR,h)))}setupTimeoutHandler(e,t,s){return setTimeout((()=>{Ec([this,"access",e=>e.reportEventsTracer,"optionalAccess",e=>e.sendMessageTracer,"access",e=>e.timeout,"call",t=>t(e)]);const t=new lc("send chat message timeout",{local_msg_id:e});this.preSendLocalMessageEventsManager.emit(tc.MESSAGE_SEND_TIMEOUT,t),s(t)}),t)}createMessageSuccessHandler(e){const{localMsgId:t,message:s,promiseHandlers:r}=e;return e=>{const n=Ec([e,"access",e=>e.content,"access",e=>e.message_start,"optionalAccess",e=>e.local_msg_id]),o=Ec([e,"access",e=>e.content,"access",e=>e.message_start,"optionalAccess",e=>e.msg_id]);if(n!==t)return;this.completeMessageTracing(t,{logId:e.log_id});const i={...s,msg_id:gc(o,(()=>"")),role:"user"};r.resolve({message:i,status:"message_start"})}}createMessageFailedHandler(e,t){return s=>{s.ext.local_msg_id===e&&(this.traceMessageError(e,s),t(s))}}handleChatSendError(e,t,s){const r=new lc(`Error: channel send chat message error: ${String(e)}`,{local_msg_id:t});this.traceMessageError(t,r),s(e)}async sendMessageWithChannel(e,t){try{await this.ensureChannelReadyAndSend(e)}catch(e){const s=new lc((e=>e instanceof Error?e.message:"object"==typeof e?JSON.stringify(e):String(e))(e),{local_msg_id:t});throw this.traceMessageError(t,s),s}}async ensureChannelReadyAndSend(e){return this.channel.isChannelOpenPromise?await this.channel.isChannelOpenPromise:this.channel.isChannelOpen()||await this.channel.connect(),await this.channel.send(e)}}function Rc(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}var Ac;!function(e){e.SDK_INIT="chat_sdk_init";e.SDK_MESSAGE_UPLOAD_FAIL="chat_sdk_message_upload_fail";e.SDK_BREAK_MESSAGE="chat_sdk_break_message";e.SDK_MESSAGE_SEND_TRACER="chat_sdk_message_send_tracer";e.SDK_PULL_STREAM_TRACER="chat_sdk_pull_stream_tracer"}(Ac||(Ac={}));class Sc{__init(){this.eventTracers=new Map}constructor(e){Sc.prototype.__init.call(this),Sc.prototype.__init2.call(this),Sc.prototype.__init3.call(this),this.reporter=e}__init2(){this.sendMessageTracer={start:(e,t)=>{const{trace:s}=this.createTracer(Ac.SDK_MESSAGE_SEND_TRACER);this.setTracer(e,Ac.SDK_MESSAGE_SEND_TRACER,{trace:s}),Rc([s,"optionalCall",e=>e("start",{meta:t})])},success:(e,t)=>{const{trace:s}=this.getTracer(e,Ac.SDK_MESSAGE_SEND_TRACER);Rc([s,"optionalCall",e=>e("success",{meta:t})]),this.deleteTracer(e,Ac.SDK_MESSAGE_SEND_TRACER),this.pullStreamTracer.start(e,t)},inqueue:(e,t)=>{const{trace:s}=this.getTracer(e,Ac.SDK_MESSAGE_SEND_TRACER);Rc([s,"optionalCall",e=>e("inqueue",{meta:t})]),this.deleteTracer(e,Ac.SDK_MESSAGE_SEND_TRACER)},error:e=>{const{local_msg_id:t}=e.ext;if(!t)return;const{trace:s}=this.getTracer(t,Ac.SDK_MESSAGE_SEND_TRACER);Rc([s,"optionalCall",t=>t("error",{meta:e.flatten(),error:e})]),this.deleteTracer(t,Ac.SDK_MESSAGE_SEND_TRACER)},timeout:e=>{const{trace:t}=this.getTracer(e,Ac.SDK_MESSAGE_SEND_TRACER);Rc([t,"optionalCall",e=>e("timeout")]),this.deleteTracer(e,Ac.SDK_MESSAGE_SEND_TRACER)}}}__init3(){this.pullStreamTracer={start:(e,t)=>{const{trace:s}=this.createTracer(Ac.SDK_PULL_STREAM_TRACER);this.setTracer(e,Ac.SDK_PULL_STREAM_TRACER,{trace:s,meta:t}),Rc([s,"optionalCall",e=>e("start",{meta:t})])},success:(e,t)=>{const{trace:s}=this.getTracer(e,Ac.SDK_PULL_STREAM_TRACER);Rc([s,"optionalCall",e=>e("success",{meta:t})]),this.deleteTracer(e,Ac.SDK_PULL_STREAM_TRACER)},break:(e,t)=>{const{trace:s}=this.getTracer(e,Ac.SDK_PULL_STREAM_TRACER);Rc([s,"optionalCall",e=>e("success",{meta:t})]),this.deleteTracer(e,Ac.SDK_PULL_STREAM_TRACER)},error:(e,t)=>{const{query_msg_id:s}=e.ext;if(!s)return;const{trace:r}=this.getTracer(s,Ac.SDK_PULL_STREAM_TRACER);Rc([r,"optionalCall",s=>s("error",{meta:{...e.flatten(),...t},error:e})]),this.deleteTracer(s,Ac.SDK_PULL_STREAM_TRACER)},timeout:e=>{const{query_msg_id:t}=e.ext;if(!t)return;const{trace:s}=this.getTracer(t,Ac.SDK_PULL_STREAM_TRACER);Rc([s,"optionalCall",t=>t("timeout",{meta:e.flatten(),error:e})]),this.deleteTracer(t,Ac.SDK_PULL_STREAM_TRACER)},receiveFirstAnsChunk:(e,t)=>{const{trace:s}=this.getTracer(e,Ac.SDK_PULL_STREAM_TRACER);Rc([s,"optionalCall",e=>e("first_ans_chunk",{meta:t})])}}}static getUniqueKey(e,t){return`${e}_${t}`}getTracer(e,t){return this.eventTracers.get(Sc.getUniqueKey(e,t))||{trace:void 0}}setTracer(e,t,s){const{trace:r,meta:n}=s;this.eventTracers.set(Sc.getUniqueKey(e,t),{trace:r,meta:n})}deleteTracer(e,t){this.eventTracers.delete(Sc.getUniqueKey(e,t))}createTracer(e){return this.reporter.slardarTracer({eventName:e})}}class Lc{static __initStatic(){this.instances=new Map}static __initStatic2(){this.EVENTS=Xa}__init(){this.enableDebug=!1}__init2(){this.eventBus=e()}constructor(e){Lc.prototype.__init.call(this),Lc.prototype.__init2.call(this),Lc.prototype.__init3.call(this),Lc.prototype.__init4.call(this),Lc.prototype.__init5.call(this),Lc.prototype.__init6.call(this),Lc.prototype.__init7.call(this),Lc.prototype.__init8.call(this),Lc.prototype.__init9.call(this),Lc.prototype.__init10.call(this);const{enableDebug:t,logLevel:s,env:r,key:n}=e;this.key=n,this.enableDebug=Boolean(t),this.logLevel=s||"error",this.env=r,this.reportLog=e.reportLog,this.reportLog.init(),this.reportLogWithScope=this.reportLog.createLoggerWith({scope:"chat-sdk",meta:{key:n}}),this.reportEventsTracer=new Sc(this.reportLogWithScope),this.requestManager=new pa({options:e.requestManagerOptions,reportLog:this.reportLog}),this.preSendLocalMessageEventsManager=new _a,this.preSendLocalMessageFactory=new fa,this.chunkProcessor=new Za({getEnableDebug:()=>this.enableDebug,initMessageBuffer:e.initMessageBuffer,initMaxSequenceId:e.initMaxSequenceId,enableChunkProcessedCheck:e.enableChunkProcessedCheck,reportLogWithScope:this.reportLogWithScope,key:n}),this.channel=e.channel,this.createMessageService=new Xs,this.sendMessageService=new Tc({preSendLocalMessageFactory:this.preSendLocalMessageFactory,channel:this.channel,preSendLocalMessageEventsManager:this.preSendLocalMessageEventsManager,reportLogWithScope:this.reportLogWithScope,reportEventsTracer:this.reportEventsTracer,chatSdkEventEmit:this.emit}),this.websocketService=new mc({channel:this.channel,reportLogWithScope:this.reportLogWithScope,chunkProcessor:this.chunkProcessor,preSendLocalMessageEventsManager:this.preSendLocalMessageEventsManager,chatSdkEventEmit:this.emit,chatSdkEventBus:this.eventBus,reportEventsTracer:this.reportEventsTracer,manualInitChannel:Boolean(e.manualInitChannel),enableBuffer:Boolean(e.enableBuffer)}),this.onEvents(),this.reportLogWithScope.slardarEvent({eventName:Ac.SDK_INIT,meta:{...e}}),this.reportLogWithScope.info({message:"SDK 初始化完成"})}static create(e){const{key:t}=e;if(Lc.instances.has(t))return console.error("duplicate chat core instance error"),Lc.instances.get(t);const s=new Lc(e);return Lc.instances.set(t,s),s}onEvents(){this.websocketService.onChannelEvents()}destroy(){this.websocketService.destroy(),this.eventBus.all.clear(),this.chunkProcessor.destroy(),Lc.instances.delete(this.key),this.preSendLocalMessageEventsManager.destroy(),this.reportLogWithScope.info({message:"SDK销毁"})}__init3(){this.on=(e,t,s)=>(this.eventBus.all.has(e)&&!s&&this.reportLogWithScope.slardarError({message:"重复监听事件",error:new Error("重复监听"),meta:{event:e}}),this.eventBus.on(e,t),()=>{this.eventBus.off(e,t)})}__init4(){this.off=(e,t)=>{this.eventBus.off(e,t)}}__init5(){this.emit=(e,t)=>{this.eventBus.emit(e,t)}}createQueryMessage(...e){return this.createMessageService.createQueryMessage(...e)}createRetryMessage(...e){return this.createMessageService.createRetryMessage(...e)}createEditMessage(...e){return this.createMessageService.createEditMessage(...e)}createInterruptMessage(...e){return this.createMessageService.createInputMessage(...e)}createCancelMessage(...e){return this.createMessageService.createCancelMessage(...e)}sendChatMessage(e,t){return this.sendMessageService.sendChatMessage(e,t)}sendCommandMessage(e){return this.sendMessageService.sendCommandMessage(e)}__init6(){this.getHistoryMessage=(...e)=>this.requestManager.getSceneConfig(T.GetMessage)(...e)}__init7(){this.isChannelOpen=()=>this.channel.isChannelOpenPromise?"connecting":this.channel.isChannelOpen()?"connected":"disconnected"}__init8(){this.initChannel=()=>this.websocketService.initChannel()}__init9(){this.captureStreamBuffer=()=>this.chunkProcessor.getStreamBufferWithMeta()}__init10(){this.captureStreamBufferSnapshot=()=>this.chunkProcessor.getStreamBufferSnapshot()}}Lc.__initStatic(),Lc.__initStatic2();const yc={E1000:"E1000",E1001:"E1001",E1002:"E1002",E1003:"E1003",E1004:"E1004",E1005:"E1005",E1006:"E1006",E1100:"E1100",E1101:"E1101",E1102:"E1102",E1103:"E1103",E2001:"E2001",E2002:"E2002",E2003:"E2003",E3000:"E3000",E3001:"E3001",E3002:"E3002",E3003:"E3003",E3004:"E3004",E3005:"E3005",E3006:"E3006",E3007:"E3007",E3008:"E3008",E3009:"E3009",E4001:"E4001",E5000:"E5000",E5001:"E5001",E5002:"E5002",E5003:"E5003"},bc={E1000:"INVALID_ARGUMENT",E1001:"MISSING_PROJECT_ID",E1002:"MISSING_MESSAGE",E1003:"MISSING_SPACE_ID",E1004:"INVALID_DOMAIN",E1005:"INVALID_PROJECT_TYPE",E1006:"UNSUPPORTED_PROJECT_TYPE",E1100:"UNKNOWN_OPTION",E1101:"UNKNOWN_COMMAND",E1102:"MISSING_ARGUMENT",E1103:"MISSING_OPTION",E2001:"AUTH_FAILED",E2002:"MINIPROGRAM_NOT_AUTHORIZED",E2003:"PERMISSION_DENIED",E3000:"RESOURCE_NOT_FOUND",E3001:"PROJECT_NOT_FOUND",E3002:"SKILL_NOT_FOUND",E3003:"SECRET_NOT_FOUND",E3004:"SKILL_NOT_INSTALLED",E3005:"DELETE_FAILED",E3006:"NO_DEPLOYMENT_HISTORY",E3007:"MISSING_COMMIT_HASH",E3008:"SKILL_PROJECT_NOT_SUPPORTED",E3009:"CONFLICT",E4001:"QUOTA_EXCEEDED",E5000:"UNEXPECTED_ERROR",E5001:"NETWORK_ERROR",E5002:"SERVER_ERROR",E5003:"TIMEOUT"};function vc(e,t){return null!=e?e:t()}function Cc(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}exports.ExitCode=void 0,function(e){e[e.SUCCESS=0]="SUCCESS";e[e.FAILURE=1]="FAILURE";e[e.AUTH_ERROR=2]="AUTH_ERROR";e[e.INPUT_ERROR=4]="INPUT_ERROR"}(exports.ExitCode||(exports.ExitCode={}));class Oc extends Error{constructor(e,t,s,r){const n=vc(bc[e],(()=>"UNKNOWN_ERROR")),o=vc(t,(()=>n));super(o),this.name="CozeError",this.code=e,this.errorName=n,this.desc=o,this.details=s,this.trigger=Cc([r,"optionalAccess",e=>e.trigger]),this.fix=Cc([r,"optionalAccess",e=>e.fix]),this.example=Cc([r,"optionalAccess",e=>e.example]),this.isMessageExplicit=void 0!==t,Object.setPrototypeOf(this,Oc.prototype)}}class Ic{constructor(){Ic.prototype.__init.call(this)}__init(){this.headers={}}setHeaders(e){this.headers=g.merge({},this.headers,e)}getHeaders(){return this.headers}resetHeaders(){this.headers={}}setDispatcher(e){this.dispatcher=e}clearDispatcher(){this.dispatcher=void 0}async fetch(e,t){const s=g.merge({},this.headers,function(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}([t,"optionalAccess",e=>e.headers]));return E.fetch(e,{...t,headers:s,dispatcher:this.dispatcher})}}const Nc=new Ic;var Mc,wc,Uc,Pc,Bc,kc,jc,Dc,xc,Fc,qc,Gc,Hc,zc,Wc,$c,Vc,Kc,Jc,Qc,Yc,Zc,Xc,el,tl,sl,rl,nl,ol,il,al,cl;function ll(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}!function(e){e.ASRMessageTypeAudio="audio";e.ASRMessageTypeConfig="config";e.ASRMessageTypeStop="stop"}(Mc||(Mc={})),function(e){e[e.Unknown=0]="Unknown";e[e.Organization=1]="Organization";e[e.Personal=2]="Personal"}(wc||(wc={})),function(e){e.ASRServerMessageTypeError="asr_error";e.ASRServerMessageTypeResult="asr_result"}(Uc||(Uc={})),function(e){e[e.develop=0]="develop";e[e.product=1]="product"}(Pc||(Pc={})),function(e){e[e.restoring=0]="restoring";e[e.success=1]="success";e[e.failed=2]="failed"}(Bc||(Bc={})),function(e){e[e.active=0]="active";e[e.creating=1]="creating"}(kc||(kc={})),function(e){e[e.postgre=0]="postgre";e[e.supabase=1]="supabase"}(jc||(jc={})),function(e){e[e.SQL=1]="SQL";e[e.REPORT=2]="REPORT";e[e.LOG_SQL=3]="LOG_SQL"}(Dc||(Dc={})),function(e){e[e.NAME=1]="NAME";e[e.INSERTED_AT=2]="INSERTED_AT"}(xc||(xc={})),function(e){e[e.ASC=1]="ASC";e[e.DESC=2]="DESC"}(Fc||(Fc={})),function(e){e[e.USER=1]="USER";e[e.PROJECT=2]="PROJECT";e[e.ORG=3]="ORG";e[e.PUBLIC=4]="PUBLIC"}(qc||(qc={})),function(e){e[e.AddAttributes=1]="AddAttributes";e[e.RemoveAttributes=2]="RemoveAttributes"}(Gc||(Gc={})),function(e){e[e.CloseConnection=1]="CloseConnection"}(Hc||(Hc={})),function(e){e[e.ON_LINE=0]="ON_LINE";e[e.OFF_LINE=1]="OFF_LINE";e[e.TOUCH=2]="TOUCH"}(zc||(zc={})),function(e){e[e.AddGroups=1]="AddGroups";e[e.RemoveGroups=2]="RemoveGroups";e[e.ReplaceWithGroups=3]="ReplaceWithGroups"}(Wc||(Wc={})),function(e){e[e.App=0]="App";e[e.Service=1]="Service";e[e.Method=2]="Method"}($c||($c={})),function(e){e.FileBatchDelete="file.batch_delete";e.FileBatchMove="file.batch_move";e.FileChanged="file.changed";e.FileCreate="file.create";e.FileDelete="file.delete";e.FileExist="file.exist";e.FileGrep="file.grep";e.FileList="file.list";e.FileMove="file.move";e.FilePack="file.pack";e.FilePatch="file.patch";e.FileRead="file.read";e.FileReplace="file.replace";e.FileSearch="file.search";e.FileStat="file.stat";e.FileWrite="file.write";e.GetAppLog="log.get_app_log";e.GetCurrentCanvas="canvas.get_current";e.GetExecuteLog="test.get_execute_log";e.GetInOutSchema="canvas.get_inout_schema";e.GetSourceCode="canvas.get_source_code";e.LspCompletion="lsp.completion";e.LspCompletionItemResolve="lsp.completionItemResolve";e.LspDefinition="lsp.definition";e.LspDidChange="lsp.didChange";e.LspDidClose="lsp.didClose";e.LspDidOpen="lsp.didOpen";e.LspGetDiagnosticsCli="lsp.getDiagnosticsCli";e.LspHover="lsp.hover";e.LspOnNotification="lsp.onNotification";e.LspReferences="lsp.references";e.LspRestart="lsp.restart";e.LspSignatureHelp="lsp.signatureHelp";e.NodeDebug="node.debug";e.PageRouterGetPage="page_router.get_routes";e.PreviewReload="preview.reload";e.RepoCommitCreate="repo_version.commit.create";e.RepoCommitFileDiff="repo_version.commit.file.diff";e.RepoCommitFileRead="repo_version.commit.file.read";e.RepoCommitList="repo_version.commit.list";e.RepoCommitRetrieve="repo_version.commit.retrieve";e.RepoCommitSearch="repo_version.commit.search";e.RepoCommitStatus="repo_version.commit.status";e.RepoCommitVersionDiff="repo_version.commit.diff";e.RepoCommitVersions="repo_version.commit.versions";e.RepoVersionCodeStage="repo_version.commit.stage";e.RepoVersionCodeUnstage="repo_version.commit.restore";e.RepoVersionConflictResolve="repo_version.conflict.resolve";e.RepoVersionEvent="repo_version.event";e.RepoVersionFileRead="repo_version.file.read";e.RepoVersionLatest="repo_version.commit.version.latest";e.RepoVersionNotify="repo_version.notify";e.RepoVersionRemoteAdd="repo_version.remote.add";e.RepoVersionRemoteFetch="repo_version.remote.fetch";e.RepoVersionRemoteOutgoingCommits="repo_version.remote.outgoing_commits";e.RepoVersionRemotePull="repo_version.remote.pull";e.RepoVersionRemotePush="repo_version.remote.push";e.RepoVersionRemoteRemove="repo_version.remote.remove";e.SandboxBroadcast="sandbox.broadcast";e.SandboxPing="sandbox.ping";e.SandboxProjectStatus="sandbox.project_status";e.SandboxProjectStatusNotify="sandbox.project_status_notify";e.SandboxVersion="sandbox.version";e.ShellClose="shell.close";e.ShellCreate="shell.create";e.ShellExecute="shell.execute";e.ShellExited="shell.exited";e.ShellInput="shell.input";e.ShellOutput="shell.output";e.ShellResize="shell.resize";e.TestRun="test.run";e.TestValidate="test.validate";e.WebIsServerStart="web.is_server_start";e.WebStartServer="web.start_server"}(Vc||(Vc={})),function(e){e[e.text=0]="text";e[e.url=1]="url";e[e.uri=2]="uri"}(Kc||(Kc={})),(Jc||(Jc={})).PdfTargetFileType="pdf",function(e){e.TabAuthentication="Authentication"}(Qc||(Qc={})),function(e){e.FeatureApp="app";e.FeatureAssistantAgent="assistantagent";e.FeatureGeneral="general";e.FeatureSkill="skill";e.FeatureWechatMiniProgram="wechatminiprogram"}(Yc||(Yc={})),function(e){e.ScenePredefinedQuery="PredefinedQuery";e.SceneRecommendProjectCases="RecommendProjectCases";e.SceneSubmitWorkPoint="SubmitWorkPoint"}(Zc||(Zc={})),function(e){e[e.CozeSpace=1]="CozeSpace";e[e.Ark=2]="Ark"}(Xc||(Xc={})),function(e){e[e.LocalFile=1]="LocalFile";e[e.GithubRepo=2]="GithubRepo"}(el||(el={})),function(e){e.ProjectTypeAgent="Agent";e.ProjectTypeApp="App";e.ProjectTypeAssistantAgent="AssistantAgent";e.ProjectTypeAutomation="Automation";e.ProjectTypeGeneral="General";e.ProjectTypeGeneralWeb="GeneralWeb";e.ProjectTypeSkill="Skill";e.ProjectTypeWechatMiniProgram="WechatMiniProgram"}(tl||(tl={})),function(e){e[e.Agent=0]="Agent";e[e.Ask=1]="Ask";e[e.DangerousConfirm=2]="DangerousConfirm";e[e.Plan=4]="Plan"}(sl||(sl={})),exports.VibeProjectType=void 0,function(e){e[e.Agent=1]="Agent";e[e.Automation=2]="Automation";e[e.WebApp=3]="WebApp";e[e.App=4]="App";e[e.Skill=5]="Skill";e[e.GeneralWeb=6]="GeneralWeb";e[e.WechatMiniProgram=7]="WechatMiniProgram";e[e.AssistantAgent=8]="AssistantAgent";e[e.General=9]="General";e[e.CLIBilling=101]="CLIBilling"}(exports.VibeProjectType||(exports.VibeProjectType={})),function(e){e[e.UnAuth=1]="UnAuth";e[e.AuthButNoBind=2]="AuthButNoBind";e[e.AuthAndBind=3]="AuthAndBind"}(rl||(rl={})),function(e){e[e.Inactive=1]="Inactive";e[e.Active=2]="Active"}(nl||(nl={})),function(e){e[e.Unknown=0]="Unknown";e[e.String=1]="String";e[e.Boolean=2]="Boolean";e[e.StringList=11]="StringList";e[e.BooleanList=12]="BooleanList"}(ol||(ol={})),function(e){e[e.Account=1]="Account";e[e.Workspace=2]="Workspace";e[e.VibeProject=38]="VibeProject";e[e.PostgresDatabase=39]="PostgresDatabase";e[e.Storage=40]="Storage"}(il||(il={})),function(e){e.PdfTargetFileType="pdf";e.XlsxTargetFileType="xlsx"}(al||(al={})),function(e){e[e.move=0]="move";e[e.copy=1]="copy"}(cl||(cl={}));class ul{__init(){this.request=zi}__init2(){this.baseURL=""}constructor(e){ul.prototype.__init.call(this),ul.prototype.__init2.call(this),this.request=ll([e,"optionalAccess",e=>e.request])||this.request,this.baseURL=ll([e,"optionalAccess",e=>e.baseURL])||this.baseURL}genBaseURL(e){return"string"==typeof this.baseURL?this.baseURL+e:this.baseURL(e)}GetVibeGlobalSettings(e,t){const s=this.genBaseURL("/api/ideserver_api/project/get_vibe_global_settings");return this.request({url:s,method:"POST"},t)}UpdateVibeGlobalSettings(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/update_vibe_global_settings"),n={global_settings:s.global_settings};return this.request({url:r,method:"POST",data:n},t)}GetVibeProjectCases(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/get_vibe_project_cases"),n={project_type:s.project_type};return this.request({url:r,method:"POST",data:n},t)}UpdateVibeProject(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/project/update_vibe_project"),n={project_id:s.project_id,name:s.name,description:s.description,icon_uri:s.icon_uri,project_settings:s.project_settings};return this.request({url:r,method:"POST",data:n},t)}CopyVibeProject(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/project/copy_vibe_project"),n={project_id:s.project_id,name:s.name,description:s.description,icon_uri:s.icon_uri,icon_url:s.icon_url,target_space_id:s.target_space_id};return this.request({url:r,method:"POST",data:n},t)}ChatCreateVibeProject(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/project/create_vibe_project"),n={space_id:s.space_id,user_query:s.user_query,project_type:s.project_type,agent_tools:s.agent_tools,project_settings:s.project_settings};return this.request({url:r,method:"POST",data:n},t)}UploadFile(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/upload_file"),n={data:s.data},o={"Content-Type":s["Content-Type"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}GetVibeProject(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/project/get_vibe_project"),n={project_id:s.project_id};return this.request({url:r,method:"POST",data:n},t)}CreatePostgresqlDatabase(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/postgresql"),n={project_id:s.project_id,user_id:s.user_id,space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}CreateStorageBucket(e,t){const s=e,r=this.genBaseURL("/api/memory/storage/create"),n={project_id:s.project_id,user_id:s.user_id,bucket_name:s.bucket_name,space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}ListStorageBucket(e,t){const s=e||{},r=this.genBaseURL("/api/memory/storage/list"),n={project_id:s.project_id,bucket_ids:s.bucket_ids,env:s.env};return this.request({url:r,method:"POST",data:n},t)}ListPostgresqlDatabase(e,t){const s=e||{},r=this.genBaseURL("/api/memory/databases/postgresql/list"),n={project_id:s.project_id,database_ids:s.database_ids,env:s.env};return this.request({url:r,method:"POST",data:n},t)}RestorePostgresqlDatabase(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/postgresql/restore"),n={project_id:s.project_id,database_ids:s.database_ids,env:s.env,timestamp:s.timestamp};return this.request({url:r,method:"POST",data:n},t)}DeleteStorageBucket(e,t){const s=e||{},r=this.genBaseURL("/api/memory/storage/delete"),n={project_id:s.project_id,bucket_ids:s.bucket_ids};return this.request({url:r,method:"POST",data:n},t)}DeletePostgresqlDatabase(e,t){const s=e||{},r=this.genBaseURL("/api/memory/databases/postgresql/delete"),n={project_id:s.project_id,database_ids:s.database_ids};return this.request({url:r,method:"POST",data:n},t)}CheckRestorePossibility(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/postgresql/restore/check"),n={project_id:s.project_id,database_ids:s.database_ids,env:s.env,timestamp:s.timestamp};return this.request({url:r,method:"POST",data:n},t)}CreateStorageFolder(e,t){const s=e,r=this.genBaseURL(`/api/memory/storage/${s.bucket_id}/folder/create`),n={folder_name:s.folder_name};return this.request({url:r,method:"POST",data:n},t)}GetFileURL(e,t){const s=e,r=this.genBaseURL(`/api/memory/storage/${s.bucket_id}/file/get_url`),n={uri_list:s.uri_list,expired_time:s.expired_time};return this.request({url:r,method:"POST",data:n},t)}StorageFileMigrate(e,t){const s=e,r=this.genBaseURL(`/api/memory/storage/${s.bucket_id}/file/migrate`),n={folder_name_list:s.folder_name_list,obj_name_list:s.obj_name_list,target_folder:s.target_folder,action:s.action};return this.request({url:r,method:"POST",data:n},t)}UploadStorageFile(e,t){const s=e,r=this.genBaseURL(`/api/memory/storage/${s.bucket_id}/file/upload`),n={body:s.body},o={"Content-Type":s["Content-Type"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}StorageFileRename(e,t){const s=e,r=this.genBaseURL(`/api/memory/storage/${s.bucket_id}/file/rename`),n={rename_list:s.rename_list};return this.request({url:r,method:"POST",data:n},t)}DeleteStorageFile(e,t){const s=e,r=this.genBaseURL(`/api/memory/storage/${s.bucket_id}/file/delete`),n={folder_name_list:s.folder_name_list,obj_name_list:s.obj_name_list};return this.request({url:r,method:"POST",data:n},t)}ListStorageObjects(e,t){const s=e,r=this.genBaseURL(`/api/memory/storage/${s.bucket_id}/file/list`),n={prefix:s.prefix,page_size:s.page_size,page_token:s.page_token,search_key:s.search_key};return this.request({url:r,method:"POST",data:n},t)}CreateContent(e,t){const s=e||{},r=this.genBaseURL(`/api/memory/databases/${s.database_id}/content`),n={id:s.id,name:s.name,type:s.type,visibility:s.visibility,description:s.description,favorite:s.favorite,folder_id:s.folder_id,owner_id:s.owner_id,content_json:s.content_json};return this.request({url:r,method:"POST",data:n},t)}UpdateWholeContent(e,t){const s=e||{},r=this.genBaseURL(`/api/memory/databases/${s.database_id}/content`),n={id:s.id,name:s.name,type:s.type,visibility:s.visibility,description:s.description,favorite:s.favorite,folder_id:s.folder_id,owner_id:s.owner_id,content_json:s.content_json};return this.request({url:r,method:"PUT",data:n},t)}DeleteContents(e,t){const s=e||{},r=this.genBaseURL(`/api/memory/databases/${s.database_id}/content`),n={ids:s.ids};return this.request({url:r,method:"DELETE",data:n},t)}GetContentById(e,t){const s=e||{},r=this.genBaseURL(`/api/memory/databases/${s.database_id}/content/${s.item_id}`);return this.request({url:r,method:"GET"},t)}GetContent(e,t){const s=e||{},r=this.genBaseURL(`/api/memory/databases/${s.database_id}/content`),n={cursor:s.cursor,favorite:s.favorite,limit:s.limit,name:s.name,sort_by:s.sort_by,sort_order:s.sort_order,type:s.type,visibility:s.visibility};return this.request({url:r,method:"GET",params:n},t)}UploadProjectFile(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/sandbox/file/upload"),n={body:s.body},o={"Content-Type":s["Content-Type"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}InitSandbox(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/sandbox/init_sandbox"),n={project_id:s.project_id},o={"x-devbox-cli-env":s["x-devbox-cli-env"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}GetProjectFileUrl(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/sandbox/file/get_url"),n={file_path:s.file_path,project_id:s.project_id};return this.request({url:r,method:"GET",params:n},t)}UpdateRestoreRetention(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/postgresql/restore/retention"),n={database_id:s.database_id,retention_hours:s.retention_hours};return this.request({url:r,method:"POST",data:n},t)}RestoreRepoVersion(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/repository/restore"),n={ProjectID:s.ProjectID,CommitID:s.CommitID,NoConfirm:s.NoConfirm,ConfirmInfos:s.ConfirmInfos,ConversationID:s.ConversationID};return this.request({url:r,method:"POST",data:n},t)}RefreshVibeProjectCases(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/refresh_vibe_project_cases"),n={refresh_token:s.refresh_token};return this.request({url:r,method:"POST",data:n},t)}GetUserQueryForCreate(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/get_user_query_for_create"),n={query_id:s.query_id,scene:s.scene},o={Cookie:s.Cookie};return this.request({url:r,method:"POST",data:n,headers:o},t)}DeleteVibeProject(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/project/delete_vibe_project"),n={project_id:s.project_id};return this.request({url:r,method:"POST",data:n},t)}CheckUserFeature(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/check_user_feature"),n={feature_keys:s.feature_keys};return this.request({url:r,method:"POST",data:n},t)}UpsertVibeProjectShare(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/upsert_share_info"),n={project_id:s.project_id,is_public_share:s.is_public_share,relative_expired_time:s.relative_expired_time};return this.request({url:r,method:"POST",data:n},t)}GetVibeProjectShare(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/get_share_info"),n={project_id:s.project_id};return this.request({url:r,method:"POST",data:n},t)}GetProtectSchemaList(e,t){const s=this.genBaseURL("/api/memory/databases/postgresql/get_protect_schema");return this.request({url:s,method:"POST"},t)}BatchImportData(e,t){const s=e,r=this.genBaseURL("/v1/knowledge_base/batch_import"),n={dataset:s.dataset,data:s.data,chunk_config:s.chunk_config},o={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}GetSchemaTables(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/postgresql/get_schema_tables"),n={project_id:s.project_id,database_env:s.database_env,schema:s.schema};return this.request({url:r,method:"POST",data:n},t)}ConvertFile(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/sandbox/file/convert"),n={file_path:s.file_path,project_id:s.project_id,target_file_type:s.target_file_type};return this.request({url:r,method:"GET",params:n},t)}GetDatabaseSupportVector(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/postgresql/get_support_vector"),n={database_id:s.database_id};return this.request({url:r,method:"POST",data:n},t)}RecallData(e,t){const s=e,r=this.genBaseURL("/v1/knowledge_base/recall"),n={dataset:s.dataset,query:s.query,top_k:s.top_k,min_score:s.min_score},o={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}GetFileInterfaceConfig(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/sandbox/file/get_interface_config"),n={project_id:s.project_id};return this.request({url:r,method:"GET",params:n},t)}UpsertProjectCopyType(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/upsert_copy_type"),n={project_id:s.project_id,enable_cross_space_copy:s.enable_cross_space_copy};return this.request({url:r,method:"POST",data:n},t)}OpenGetVibeProjectInfo(e,t){const s=e||{},r=this.genBaseURL(`/v1/vibe_projects/${s.project_id}`);return this.request({url:r,method:"GET"},t)}ImportSpaceDevAgent(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/project/import_space_dev_agent"),n={task_id:s.task_id,space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}CreateCommit(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/repository/create_commit"),n={ProjectID:s.ProjectID,message:s.message};return this.request({url:r,method:"POST",data:n},t)}ListBuckets(e,t){const s=e,r=this.genBaseURL("/v1/supabase/buckets/list"),n={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",headers:n},t)}DeleteBucket(e,t){const s=e,r=this.genBaseURL("/v1/supabase/buckets/delete"),n={bucket_id:s.bucket_id},o={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}GetEdgeFunction(e,t){const s=e,r=this.genBaseURL("/v1/supabase/functions/get"),n={slug:s.slug},o={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}DeleteEdgeFunction(e,t){const s=e,r=this.genBaseURL("/v1/supabase/functions/delete"),n={slug:s.slug},o={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}ListEdgeFunctions(e,t){const s=e,r=this.genBaseURL("/v1/supabase/functions/list"),n={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",headers:n},t)}UpdateAuthConfig(e,t){const s=e,r=this.genBaseURL("/v1/supabase/auth/config/update"),n={config:s.config},o={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}GetBucket(e,t){const s=e,r=this.genBaseURL("/v1/supabase/buckets/get"),n={bucket_id:s.bucket_id},o={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}GetAuthConfig(e,t){const s=e,r=this.genBaseURL("/v1/supabase/auth/config/get"),n={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",headers:n},t)}UpdateBucket(e,t){const s=e,r=this.genBaseURL("/v1/supabase/buckets/update"),n={bucket_id:s.bucket_id,public:s.public,file_size_limit:s.file_size_limit,allowed_mime_types:s.allowed_mime_types},o={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}DeployEdgeFunction(e,t){const s=e,r=this.genBaseURL("/v1/supabase/functions/deploy"),n={slug:s.slug,code:s.code,files:s.files,name:s.name,entrypoint:s.entrypoint,verify_jwt:s.verify_jwt},o={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}CreateBucket(e,t){const s=e,r=this.genBaseURL("/v1/supabase/buckets/create"),n={bucket_id:s.bucket_id,name:s.name,public:s.public,file_size_limit:s.file_size_limit,allowed_mime_types:s.allowed_mime_types},o={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}OpenConvertFile(e,t){const s=e||{},r=this.genBaseURL("/v1/vibe_projects/files/convert"),n={project_id:s.project_id,file_url:s.file_url,target_file_type:s.target_file_type};return this.request({url:r,method:"POST",data:n},t)}OpenUploadFile(e,t){const s=e||{},r=this.genBaseURL("/v1/vibe_projects/files/upload"),n={body:s.body},o={"Content-Type":s["Content-Type"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}GetUserAssistantAttrs(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/get_user_assistant_attrs"),n={space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}GetProjectArtifactShare(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/get_artifact_share"),n={project_id:s.project_id};return this.request({url:r,method:"POST",data:n},t)}UpsertProjectArtifactShare(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/upsert_artifact_share"),n={project_id:s.project_id,is_artifact_share:s.is_artifact_share,relative_expired_time:s.relative_expired_time};return this.request({url:r,method:"POST",data:n},t)}GetUserProjectNum(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/get_user_project_num"),n={enterprise_id:s.enterprise_id,organization_id:s.organization_id};return this.request({url:r,method:"POST",data:n},t)}GetLarkTableContent(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/get_content"),n={scene:s.scene};return this.request({url:r,method:"POST",data:n},t)}GetProjectStatus(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/sandbox/project_status"),n={project_id:s.project_id};return this.request({url:r,method:"GET",params:n},t)}UpdateProjectSkillSetting(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/update_project_skill_setting"),n={project_id:s.project_id,add_skills:s.add_skills,remove_skills:s.remove_skills};return this.request({url:r,method:"POST",data:n},t)}ProxySandboxMessage(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/repository/proxy_sandbox_message"),n={ProjectID:s.ProjectID,Method:s.Method,Params:s.Params};return this.request({url:r,method:"POST",data:n},t)}GetOauthStatus(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/repository/integration/oauth/status"),n={integration_id:s.integration_id,space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}SearchRepo(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/repository/integration/search_repo"),n={space_id:s.space_id,name_search:s.name_search,per_page:s.per_page,page:s.page};return this.request({url:r,method:"POST",data:n},t)}AddRemote(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/repository/integration/add_remote"),n={project_id:s.project_id,integration_id:s.integration_id,repo_full_name:s.repo_full_name,has_add_in_devbox:s.has_add_in_devbox};return this.request({url:r,method:"POST",data:n},t)}RemoveRemote(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/repository/integration/remove_remote"),n={project_id:s.project_id};return this.request({url:r,method:"POST",data:n},t)}ListIntegration(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/repository/integration/list"),n={space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}CreateRepo(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/repository/integration/create_repo"),n={space_id:s.space_id,name:s.name,private:s.private};return this.request({url:r,method:"POST",data:n},t)}CancelOauth(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/repository/integration/oauth/cancel"),n={integration_id:s.integration_id,space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}GetOauthConfig(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/repository/integration/oauth/oauth_config"),n={integration_id:s.integration_id,space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}ListDatabaseRestoreHistory(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/postgresql/restore/history"),n={project_id:s.project_id,commit_id:s.commit_id,env:s.env,limit:s.limit,cursor:s.cursor};return this.request({url:r,method:"POST",data:n},t)}ImportProject(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/import_project"),n={space_id:s.space_id,import_source:s.import_source,data:s.data,git_url:s.git_url,git_repo_name:s.git_repo_name},o={"Content-Type":s["Content-Type"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}GetUser(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/repository/integration/user"),n={space_id:s.space_id,integration_id:s.integration_id};return this.request({url:r,method:"POST",data:n},t)}GetRemote(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/repository/integration/get_remote"),n={project_id:s.project_id};return this.request({url:r,method:"POST",data:n},t)}DiagnoseDatabaseHTTP(e,t){const s=e,r=this.genBaseURL("/v1/supabase/database/diagnose"),n={env:s.env},o={"x-coze-token":s["x-coze-token"]};return this.request({url:r,method:"POST",data:n,headers:o},t)}GetProjectDisplayTabInfo(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/get_display_tab_info"),n={project_id:s.project_id};return this.request({url:r,method:"POST",data:n},t)}GetOrCreateBillingProject(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/get_or_create_billing_project"),n={space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}UpdatePermissionSetting(e,t){const s=e,r=this.genBaseURL("/api/ideserver_api/project/update_permission_setting"),n={project_id:s.project_id,add_commands:s.add_commands,remove_commands:s.remove_commands};return this.request({url:r,method:"POST",data:n},t)}OptimizeQuery(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/optimize_query"),n={query:s.query,project_type:s.project_type};return this.request({url:r,method:"POST",data:n},t)}CreateSpaceDatabase(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/space/create"),n={space_id:s.space_id};return this.request({url:r,method:"POST",data:n},t)}GetSpaceDatabase(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/space/get"),n={space_id:s.space_id,database_id:s.database_id};return this.request({url:r,method:"POST",data:n},t)}ListSpaceDatabase(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/space/list"),n={space_id:s.space_id,cursor_id:s.cursor_id,limit:s.limit};return this.request({url:r,method:"POST",data:n},t)}GetSpaceDatabaseStatus(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/space/status"),n={space_id:s.space_id,database_id:s.database_id};return this.request({url:r,method:"POST",data:n},t)}DeleteSpaceDatabase(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/space/delete"),n={space_id:s.space_id,database_id:s.database_id};return this.request({url:r,method:"POST",data:n},t)}RollbackSpaceDatabase(e,t){const s=e,r=this.genBaseURL("/api/memory/databases/space/rollback"),n={space_id:s.space_id,database_id:s.database_id,timestamp:s.timestamp};return this.request({url:r,method:"POST",data:n},t)}}ul.prototype.UploadProjectFile=function(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/sandbox/file/upload"),n=s.body;return this.request({url:r,method:"POST",data:n},t)},ul.prototype.UploadFile=function(e,t){const s=e||{},r=this.genBaseURL("/api/ideserver_api/project/upload_file"),n=s.data;return this.request({url:r,method:"POST",data:n},t)};const hl=new ul({});function dl(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}const pl=/(?<![\w`])@(\.?[^\s`,.]*(?:\.[^\s`,.]+)*)/g;class _l{constructor(){_l.prototype.__init.call(this),_l.prototype.__init2.call(this),_l.prototype.__init3.call(this),_l.prototype.__init4.call(this),_l.prototype.__init5.call(this),_l.prototype.__init6.call(this),_l.prototype.__init7.call(this),_l.prototype.__init8.call(this),_l.prototype.__init9.call(this),_l.prototype.__init10.call(this),_l.prototype.__init11.call(this),_l.prototype.__init12.call(this)}__init(){this.ctx={options:{},get:()=>({})}}__init2(){this.init=g.noop}__init3(){this.createLoggerWith=()=>new _l}__init4(){this.info=g.noop}__init5(){this.error=g.noop}__init6(){this.slardarInfo=g.noop}__init7(){this.slardarSuccess=g.noop}__init8(){this.slardarError=g.noop}__init9(){this.slardarEvent=g.noop}__init10(){this.slardarSuccessEvent=g.noop}__init11(){this.slardarErrorEvent=g.noop}__init12(){this.slardarTracer=()=>({trace:g.noop})}}function fl(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}const ml=e=>{const{onData:t}=e,s=e.buffered.split(/\n\n/),r=(n=s.pop(),o=()=>"",null!=n?n:o());var n,o;for(const e of s){const s=e.split(/\r?\n/),r=[];for(const e of s)e.startsWith("data:")&&r.push(e.slice(5).trimStart());if(0===r.length)continue;const n=r.join("\n").trim();n&&"[DONE]"!==n&&t(n)}return{buffered:r}},gl=async e=>{const{apiBaseUrl:t,request:s,onStart:r,onMessage:n,signal:o,totalTimeoutMs:i,onTotalTimeout:a,betweenChunkTimeoutMs:c,onBetweenChunkTimeout:l}=e,u=new AbortController;((e,t)=>{t&&(t.aborted?e.abort():t.addEventListener("abort",(()=>e.abort()),{once:!0}))})(u,o);const h=(e=>{const{controller:t,timeoutMs:s,onTimeout:r}=e;if(!s||s<=0)return()=>{};const n=setTimeout((()=>{fl([r,"optionalCall",e=>e()]),t.abort()}),s);return()=>clearTimeout(n)})({controller:u,timeoutMs:i,onTimeout:a}),d=(e=>{const{controller:t,timeoutMs:s,onTimeout:r}=e;if(!s||s<=0)return{refresh:()=>{},clear:()=>{}};let n=null;const o=()=>{n&&(clearTimeout(n),n=null)};return{refresh:()=>{o(),n=setTimeout((()=>{fl([r,"optionalCall",e=>e()]),t.abort()}),s)},clear:o}})({controller:u,timeoutMs:c,onTimeout:l});try{const e=new URL(`/v1/api/project/${s.project_id}/chat/message/send`,t),o=await Nc.fetch(e.toString(),{method:"POST",signal:u.signal,body:JSON.stringify({message:s.message,device_id:s.device_id,project_id:s.project_id})});if(!o.ok)throw new Error(`ChatCLISendMessage failed: ${o.status} ${o.statusText}`);if(!o.body)throw new Error("ChatCLISendMessage response body is empty");await fl([r,"optionalCall",e=>e(o)]);const i=new TextDecoder("utf-8"),a=o.body.getReader();let c="";for(d.refresh();;){const{done:e,value:t}=await a.read();if(e)break;d.refresh(),c+=i.decode(t,{stream:!0});c=ml({buffered:c,onData:e=>{const t=JSON.parse(e);n(t)}}).buffered}c+=i.decode(),ml({buffered:c,onData:e=>{const t=JSON.parse(e);n(t)}})}catch(e){if((e=>!(!e||"object"!=typeof e)&&"AbortError"===e.name)(e))return;throw e}finally{h(),d.clear()}};function El(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}class Tl extends Error{constructor(e,t){super(e),Tl.prototype.__init.call(this),this.name="ChatCLIChannelError",this.ext=t}__init(){this.flatten=()=>{const{message:e,ext:t}=this;return{message:e,...t}}}}const Rl=e=>!(!e||"object"!=typeof e)&&"AbortError"===e.name;class Al{__init2(){this.channelName="ChatCLI"}__init3(){this.isChannelOpenPromise=null}__init4(){this.opened=!1}__init5(){this.destroyed=!1}__init6(){this.abortController=null}__init7(){this.eventBus=e()}constructor(e){Al.prototype.__init2.call(this),Al.prototype.__init3.call(this),Al.prototype.__init4.call(this),Al.prototype.__init5.call(this),Al.prototype.__init6.call(this),Al.prototype.__init7.call(this),Al.prototype.__init8.call(this),Al.prototype.__init9.call(this),Al.prototype.__init10.call(this),Al.prototype.__init11.call(this),Al.prototype.__init12.call(this),Al.prototype.__init13.call(this),Al.prototype.__init14.call(this),Al.prototype.__init15.call(this),Al.prototype.__init16.call(this),this.apiBaseUrl=e.apiBaseUrl,this.deviceId=e.deviceId,this.totalTimeoutMs=e.totalTimeoutMs,this.betweenChunkTimeoutMs=e.betweenChunkTimeoutMs}__init8(){this.getChannelOptions=()=>({apiBaseUrl:this.apiBaseUrl})}__init9(){this.connect=async()=>{this.destroyed||(this.opened=!0,this.isChannelOpenPromise=Promise.resolve(),this.eventBus.emit("onopen",void 0))}}__init10(){this.reconnect=async()=>{await this.connect()}}__init11(){this.isChannelOpen=()=>this.opened}__init12(){this.addEventListener=(e,t)=>{this.eventBus.on(e,t)}}__init13(){this.removeEventListener=(e,t)=>{this.eventBus.off(e,t)}}__init14(){this.send=async e=>{if(this.destroyed)throw new Error("ChatCLIChannel is destroyed");this.opened||await this.connect(),El([this,"access",e=>e.abortController,"optionalAccess",e=>e.abort,"call",e=>e()]);const t=new AbortController;this.abortController=t;const s=e,r={project_id:s.project_id,message:s,device_id:(n=this.deviceId,o=()=>{},null!=n?n:o())};var n,o;let i=!1,a=null;const c=new Promise((e=>{gl({apiBaseUrl:this.apiBaseUrl,request:r,signal:t.signal,totalTimeoutMs:this.totalTimeoutMs,betweenChunkTimeoutMs:this.betweenChunkTimeoutMs,onTotalTimeout:()=>{this.eventBus.emit("onerror",new Tl("ChatCLISendMessage total timeout",{willClose:!0}))},onBetweenChunkTimeout:()=>{this.eventBus.emit("onerror",new Tl("ChatCLISendMessage between-chunk timeout",{willClose:!0}))},onStart:()=>{i=!0,this.eventBus.emit("onack",{code:"0",msg:""}),e()},onMessage:e=>{this.eventBus.emit("onmessage",e)}}).then((()=>{this.eventBus.emit("onclose",{code:0,reason:"eof"})})).catch((t=>{if(!i)return a=t,void e();Rl(t)?this.eventBus.emit("onclose",{code:1e3,reason:"aborted"}):(this.eventBus.emit("onerror",new Tl(`ChatCLISendMessage stream error: ${String(t)}`,{willClose:!0,rawError:t})),this.eventBus.emit("onclose",{code:1,reason:String(t)}))})).finally((()=>{this.abortController===t&&(this.abortController=null)}))}));if(await c,a){if(Rl(a))return;throw this.eventBus.emit("onerror",new Tl(`ChatCLISendMessage request error: ${String(a)}`,{willClose:!0,rawError:a})),a}}}__init15(){this.close=()=>{El([this,"access",e=>e.abortController,"optionalAccess",e=>e.abort,"call",e=>e()]),this.abortController=null,this.opened=!1}}__init16(){this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.close(),this.eventBus.all.clear())}}}function Sl(e){let t,s=e[0],r=1;for(;r<e.length;){const n=e[r],o=e[r+1];if(r+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=o(s)):"call"!==n&&"optionalCall"!==n||(s=o(((...e)=>s.call(t,...e))),t=void 0)}return s}const Ll=e=>{const{key:t,apiBaseUrl:s,totalTimeoutMs:r,betweenChunkTimeoutMs:n}=e,o=new Al({apiBaseUrl:s,totalTimeoutMs:r,betweenChunkTimeoutMs:n});return new Lc({key:t,env:"production",logLevel:"error",channel:o,reportLog:new _l})};exports.BuildAgentApi=da,exports.ChatCoreError=lc,exports.CozeError=Oc,exports.ErrorCode=yc,exports.ErrorNameByCode=bc,exports.HttpError=sr,exports.IdeApi=hl,exports.axiosInstance=Gi,exports.createChatCore=Ll,exports.createRequestClient=qi,exports.customFetch=Nc,exports.exitCodeForError=function(e){const t=Number.parseInt(e.slice(1),10);return t>=1e3&&t<2e3?exports.ExitCode.INPUT_ERROR:t>=2e3&&t<3e3?exports.ExitCode.AUTH_ERROR:exports.ExitCode.FAILURE},exports.getDefaultExportFromCjs=jn,exports.isHttpError=function(e){return e instanceof sr},exports.request=zi,exports.requireSrc=ao,exports.safeJsonParse=nc,exports.sendProjectChatMessage=async e=>{const{projectId:t,prompt:r,apiBaseUrl:n,sessionId:o="",key:i=`coze-coding-cli:chat:${t}`,totalTimeoutMs:a,betweenChunkTimeoutMs:c,onMessageItem:l,onWarn:u,waitForResponse:h=!0}=e,d=Ll({key:i,apiBaseUrl:n,totalTimeoutMs:a,betweenChunkTimeoutMs:c}),p=new oc;let g=!1;const E=e=>{g||(g=!0,e())};let T;const R=d.on(Xa.MESSAGE_RECEIVED_AND_UPDATE,(({data:e})=>{for(const t of e)if(Sl([l,"optionalCall",e=>e(t)]),"answer"===t.type&&t.content.answer&&(T=t),"message_end"===t.type&&t.finish){const e=Sl([t,"access",e=>e.content,"access",e=>e.message_end,"optionalAccess",e=>e.code]);if(e&&"0"!==e){E((()=>{p.reject(new Oc(yc.E5002,`Conversation ended with error code: ${e}`,{message_end:t.content.message_end}))}));continue}E((()=>{p.resolve()}))}}),!0),A=d.on(Xa.SEND_MESSAGE_ERROR,(e=>{E((()=>{p.reject(e.data.error)}))}),!0),S=d.on(Xa.MESSAGE_PULLING_STATUS,(({data:e,error:t})=>{const s=e.pullingStatus;"error"!==s&&"channel_error"!==s||E((()=>{p.reject(t)})),("success"===s||"cancel"===s||!h&&"start"===s)&&E((()=>{p.resolve()}))}),!0);try{const e=await(async(e,t,s,r)=>{const n=[],o=[...e.matchAll(pl)];if(0===o.length)return[{type:"text",content:{text:e}}];let i=0;for(const a of o){const o=a.index,c=a[0],l=a[1];o>i&&n.push({type:"text",content:{text:e.slice(i,o)}});const u=_.resolve(t,l);let h=!1;if(u.startsWith(_.resolve(t)))try{(await m.stat(u)).isFile()?h=!0:dl([r,"optionalCall",e=>e(`Uploading directories is not supported: ${l}`)])}catch(e){dl([r,"optionalCall",e=>e(`File not found: ${l}`)])}if(h)try{const e=await s(u);n.push({type:"upload_file",content:{upload_file:e}})}catch(e){dl([r,"optionalCall",t=>t(`Failed to upload file: ${l}, ${String(e)}`)]),n.push({type:"text",content:{text:c}})}else n.push({type:"text",content:{text:c}});i=o+c.length}return i<e.length&&n.push({type:"text",content:{text:e.slice(i)}}),n})(r,process.cwd(),(e=>async t=>{const r=_.basename(t),n=new s;n.append("project_id",e),n.append("file_name",r),n.append("file_content",f.createReadStream(t));const o=await hl.UploadProjectFile({body:n},{headers:{...n.getHeaders()}});if(!o.file)throw new Error(`Upload failed for file: ${t}`);return{file_name:o.file.name,file_path:o.file.file_path,url:o.file.url}})(t),u),n=d.createQueryMessage({query:{prompt:e}},{session_id:o,project_id:t,conversation_id:void 0});return await d.sendChatMessage(n),await p.promise,{lastAnswerMessage:T}}finally{R(),A(),S(),d.destroy()}};