UNPKG

@mxlabs/okxnotify

Version:

OKX notification package with Feishu, Cloudflare Workers, and Gemini AI agent integration - Complete bundle

2 lines 1.11 MB
/*! For license information please see index.mjs.LICENSE.txt */ var __webpack_modules__={186:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateV7State=void 0;const n=r(83052),i=r(56536),a={};function o(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,0===e.seq&&e.msecs++),e}function s(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(n){if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`)}else n=new Uint8Array(16),i=0;return t??=Date.now(),r??=127*e[6]<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=255&t,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|3&e[10],n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}t.updateV7State=o,t.default=function(e,t,r){let c;if(e)c=s(e.random??e.rng?.()??(0,n.default)(),e.msecs,e.seq,t,r);else{const e=Date.now(),i=(0,n.default)();o(a,e,i),c=s(i,a.msecs,a.seq,t,r)}return t??(0,i.unsafeStringify)(c)}},250:e=>{e.exports=Math.pow},448:(e,t,r)=>{e.exports=r(23037)},491:(e,t,r)=>{var n=r(39886),i=function(){return!!n};i.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},623:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseNativeEnumDef=void 0,t.parseNativeEnumDef=function(e){const t=e.values,r=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),n=Array.from(new Set(r.map(e=>typeof e)));return{type:1===n.length?"string"===n[0]?"string":"number":["string","number"],enum:r}}},670:(e,t,r)=>{var n=r(91193),i=r(56608).Buffer,a=r(78639),o=i.alloc(128),s=64;function c(e,t){a.call(this,"digest"),"string"==typeof t&&(t=i.from(t)),this._alg=e,this._key=t,t.length>s?t=e(t):t.length<s&&(t=i.concat([t,o],s));for(var r=this._ipad=i.allocUnsafe(s),n=this._opad=i.allocUnsafe(s),c=0;c<s;c++)r[c]=54^t[c],n[c]=92^t[c];this._hash=[r]}n(c,a),c.prototype._update=function(e){this._hash.push(e)},c.prototype._final=function(){var e=this._alg(i.concat(this._hash));return this._alg(i.concat([this._opad,e]))},e.exports=c},769:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(80381);class i extends n.EventEmitter{constructor(){super(),this.tools=[]}on(e,t){return super.on(e,t),this}async processToolCall(e,t){const r=[];for(const n of e){const e=this.tools.find(e=>e.name===n.name);if(e){const i=await e.invoke({...n.args,...t});r.push({tool:n.name,result:i})}}return r}}t.default=i},774:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0,t.default=function(e,t,r){function n(e,n,o,s){var c;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=(0,a.default)(n)),16!==(null===(c=n)||void 0===c?void 0:c.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var u=new Uint8Array(16+e.length);if(u.set(n),u.set(e,n.length),(u=r(u))[6]=15&u[6]|t,u[8]=63&u[8]|128,o){s=s||0;for(var l=0;l<16;++l)o[s+l]=u[l];return o}return(0,i.unsafeStringify)(u)}try{n.name=e}catch(e){}return n.DNS=o,n.URL=s,n};var n,i=r(18561),a=(n=r(72031))&&n.__esModule?n:{default:n},o=t.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",s=t.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8"},796:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseDefaultDef=void 0;const n=r(81626);t.parseDefaultDef=function(e,t){return{...(0,n.parseDef)(e.innerType._def,t),default:e.defaultValue()}}},808:(e,t,r)=>{var n=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,a=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,o=r(51804),s=r(15007),c=r(56608).Buffer;e.exports=function(e,t){var r,u=e.toString(),l=u.match(n);if(l){var d="aes"+l[1],f=c.from(l[2],"hex"),h=c.from(l[3].replace(/[\r\n]/g,""),"base64"),p=o(t,f.slice(0,8),parseInt(l[1],10)).key,m=[],g=s.createDecipheriv(d,p,f);m.push(g.update(h)),m.push(g.final()),r=c.concat(m)}else{var b=u.match(a);r=c.from(b[2].replace(/[\r\n]/g,""),"base64")}return{tag:u.match(i)[1],data:r}}},1061:function(e,t,r){var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)},s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o<r.length;o++)"default"!==r[o]&&i(t,e,r[o]);return a(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.gemini=t.feishu=void 0,o(r(66557),t),t.feishu=s(r(84864)),o(r(19438),t),t.gemini=s(r(38725))},1139:(e,t,r)=>{const n=r(82727);class i extends Error{constructor(e){super(e),this.name="TimeoutError"}}const a=(e,t,r)=>new Promise((a,o)=>{if("number"!=typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0)return void a(e);const s=setTimeout(()=>{if("function"==typeof r){try{a(r())}catch(e){o(e)}return}const n=r instanceof Error?r:new i("string"==typeof r?r:`Promise timed out after ${t} milliseconds`);"function"==typeof e.cancel&&e.cancel(),o(n)},t);n(e.then(a,o),()=>{clearTimeout(s)})});e.exports=a,e.exports.default=a,e.exports.TimeoutError=i},1273:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ucs2length=function(e){let t,r=0,n=e.length,i=0;for(;i<n;)r++,t=e.charCodeAt(i++),t>=55296&&t<=56319&&i<n&&(t=e.charCodeAt(i),56320==(64512&t)&&i++);return r}},1459:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.replyFeishuRobotPostMessage=t.replyFeishuRobotTextMessage=void 0;const n=r(42952),i=r(66958);t.replyFeishuRobotTextMessage=async({userId:e,text:t})=>{const{tenant_access_token:r}=await(0,i.getFeishuRobotToken)();return(await(0,n.httpRequest)("https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=user_id",{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8",Authorization:`Bearer ${r}`},params:{msg_type:"text",content:JSON.stringify({text:t}),receive_id:e}})).data},t.replyFeishuRobotPostMessage=async({title:e,userId:t,richList:r})=>{const{tenant_access_token:a}=await(0,i.getFeishuRobotToken)(),o={msg_type:"post",receive_id:t,content:JSON.stringify({zh_cn:{title:e,content:[[{tag:"hr"},{tag:"md",text:r.join("\n")}]]}})};return(await(0,n.httpRequest)("https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=user_id",{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8",Authorization:`Bearer ${a}`},params:o})).data}},1658:function(e,t,r){var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),o=0;o<r.length;o++)"default"!==r[o]&&i(t,e,r[o]);return a(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.getUniBalance=t.getUniAccount=t.getWalletBalance=t.getUniUMPositionRisk=void 0;const s=r(46974),c=o(r(22669));t.getUniUMPositionRisk=async(e={timestamp:Date.now()})=>c.get("/papi/v1/um/positionRisk",e,{baseURL:s.UNI_BASE_URL}),t.getWalletBalance=async(e={timestamp:Date.now()})=>c.get("/sapi/v1/asset/wallet/balance",e),t.getUniAccount=async(e={timestamp:Date.now()})=>c.get("/papi/v1/account",e,{baseURL:s.UNI_BASE_URL}),t.getUniBalance=async(e={timestamp:Date.now()})=>c.get("/papi/v1/balance",e,{baseURL:s.UNI_BASE_URL})},1728:(e,t,r)=>{var n=r(87196),i=r(64379),a=r(17695),o=r(98801),s=r(25667),c=r(14252),u=o("Object.prototype.toString"),l=r(77185)(),d="undefined"==typeof globalThis?r.g:globalThis,f=i(),h=o("String.prototype.slice"),p=o("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},m={__proto__:null};n(f,l&&s&&c?function(e){var t=new d[e];if(Symbol.toStringTag in t&&c){var r=c(t),n=s(r,Symbol.toStringTag);if(!n&&r){var i=c(r);n=s(i,Symbol.toStringTag)}m["$"+e]=a(n.get)}}:function(e){var t=new d[e],r=t.slice||t.set;r&&(m["$"+e]=a(r))}),e.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!l){var t=h(u(e),8,-1);return p(f,t)>-1?t:"Object"===t&&function(e){var t=!1;return n(m,function(r,n){if(!t)try{r(e),t=h(n,1)}catch(e){}}),t}(e)}return s?function(e){var t=!1;return n(m,function(r,n){if(!t)try{"$"+r(e)===n&&(t=h(n,1))}catch(e){}}),t}(e):null}},1790:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isTracingEnabled=void 0;const n=r(71823);t.isTracingEnabled=e=>void 0!==e?e:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(e=>"true"===(0,n.getEnvironmentVariable)(e))},2033:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.OkxUtils=void 0;const i=n(r(40932)),a=r(42314),o=r(57195);t.OkxUtils=class{static cleanParams(e){if(!e)return{};const t=Object.entries(e).reduce((e,[t,r])=>(null!=r&&""!==r&&(e[t]=r),e),{});return JSON.parse(JSON.stringify(t))}static buildUrl(e,t={}){let r=a.BASE_URL+e;if(Object.keys(t).length>0){const e=new URLSearchParams;Object.entries(t).forEach(([t,r])=>{e.append(t,String(r))}),r+="?"+e.toString()}return r}static buildHeaders(e,t,r){const n=Object.keys(r).length>0?"?"+new URLSearchParams(r).toString():"";return{...(0,o.signRequest)(e,t+n),"Content-Type":"application/json"}}static async request(e,t,r){const n=this.cleanParams(r),a=this.buildUrl(t,n),o=this.buildHeaders(e,t,n);try{const t=await(0,i.default)({method:e,url:a,headers:o,..."POST"===e?{data:JSON.parse(JSON.stringify(n))}:{}});if(!t.data)throw new Error("Empty response from OKX API");if("0"!==t.data.code)throw new Error(`OKX API Error: ${t.data.code} - ${t.data.msg}`);return t.data.data}catch(e){throw this.handleError(e,t),e}}static handleError(e,t){var r,n,a,o;if(i.default.isAxiosError(e)){const i=e,s=null===(r=i.response)||void 0===r?void 0:r.data,c=null===(n=i.response)||void 0===n?void 0:n.status;console.error(`OKX API Error in ${t}:`,{status:c,data:s,message:i.message,url:null===(a=i.config)||void 0===a?void 0:a.url,method:null===(o=i.config)||void 0===o?void 0:o.method})}else console.error(`Unexpected error in ${t}:`,e)}}},2213:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a(r(774)),i=a(r(16020));function a(e){return e&&e.__esModule?e:{default:e}}var o=(0,n.default)("v3",48,i.default);t.default=o},2589:(e,t,r)=>{const n=r(50244);e.exports=(e,t,r)=>0===n(e,t,r)},2954:(e,t,r)=>{var n=r(91193),i=r(3366),a=r(56608).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function c(){this.init(),this._w=s,i.call(this,64,56)}function u(e){return e<<5|e>>>27}function l(e){return e<<30|e>>>2}function d(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(c,i),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,a=0|this._d,s=0|this._e,c=0;c<16;++c)t[c]=e.readInt32BE(4*c);for(;c<80;++c)t[c]=t[c-3]^t[c-8]^t[c-14]^t[c-16];for(var f=0;f<80;++f){var h=~~(f/20),p=u(r)+d(h,n,i,a)+s+t[f]+o[h]|0;s=a,a=i,i=l(n),n=r,r=p}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},c.prototype._hash=function(){var e=a.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=c},3349:e=>{e.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},3366:(e,t,r)=>{var n=r(56608).Buffer;function i(e,t){this._block=n.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=n.from(e,t));for(var r=this._block,i=this._blockSize,a=e.length,o=this._len,s=0;s<a;){for(var c=o%i,u=Math.min(a-s,i-c),l=0;l<u;l++)r[c+l]=e[s+l];s+=u,(o+=u)%i===0&&this._update(r)}return this._len+=a,this},i.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var a=this._hash();return e?a.toString(e):a},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},3495:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.consumeAsyncIterableInContext=t.consumeIteratorInContext=t.isAsyncIterable=t.isIterator=t.isIterableIterator=void 0;const n=r(64031),i=r(58031);t.isIterableIterator=function(e){return"object"==typeof e&&null!==e&&"function"==typeof e[Symbol.iterator]&&"function"==typeof e.next},t.isIterator=e=>null!=e&&"object"==typeof e&&"next"in e&&"function"==typeof e.next,t.isAsyncIterable=function(e){return"object"==typeof e&&null!==e&&"function"==typeof e[Symbol.asyncIterator]},t.consumeIteratorInContext=function*(e,t){for(;;){const{value:r,done:a}=n.AsyncLocalStorageProviderSingleton.runWithConfig((0,i.pickRunnableConfigKeys)(e),t.next.bind(t),!0);if(a)break;yield r}},t.consumeAsyncIterableInContext=async function*(e,t){const r=t[Symbol.asyncIterator]();for(;;){const{value:a,done:o}=await n.AsyncLocalStorageProviderSingleton.runWithConfig((0,i.pickRunnableConfigKeys)(e),r.next.bind(t),!0);if(o)break;yield a}}},3909:(e,t,r)=>{var n=r(19979),i=r(82869),a=r(18955),o=r(28929),s=r(67794),c=r(96509),u=r(47390),l=r(38538),d=r(56608).Buffer;e.exports=function(e,t,r){var f;f=e.padding?e.padding:r?1:4;var h,p=n(e);if(4===f)h=function(e,t){var r=e.modulus.byteLength(),n=t.length,u=a("sha1").update(d.alloc(0)).digest(),l=u.length,f=2*l;if(n>r-f-2)throw new Error("message too long");var h=d.alloc(r-n-f-2),p=r-l-1,m=i(l),g=s(d.concat([u,h,d.alloc(1,1),t],p),o(m,p)),b=s(m,o(g,l));return new c(d.concat([d.alloc(1),b,g],r))}(p,t);else if(1===f)h=function(e,t,r){var n,a=t.length,o=e.modulus.byteLength();if(a>o-11)throw new Error("message too long");return n=r?d.alloc(o-a-3,255):function(e){for(var t,r=d.allocUnsafe(e),n=0,a=i(2*e),o=0;n<e;)o===a.length&&(a=i(2*e),o=0),(t=a[o++])&&(r[n++]=t);return r}(o-a-3),new c(d.concat([d.from([0,r?1:2]),n,d.alloc(1),t],o))}(p,t,r);else{if(3!==f)throw new Error("unknown padding");if((h=new c(t)).cmp(p.modulus)>=0)throw new Error("data too long for modulus")}return r?l(h,p):u(h,p)}},3911:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(20718),i=r(83052),a=r(56536);t.default=function(e,t,r){if(n.default.randomUUID&&!t&&!e)return n.default.randomUUID();const o=(e=e||{}).random??e.rng?.()??(0,i.default)();if(o.length<16)throw new Error("Random bytes length must be >= 16");if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=o[e];return t}return(0,a.unsafeStringify)(o)}},4029:(e,t,r)=>{var n=r(36622);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=n._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=n._reverse(t.tag)},4133:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseSetDef=void 0;const n=r(5796),i=r(81626);t.parseSetDef=function(e,t){const r={type:"array",uniqueItems:!0,items:(0,i.parseDef)(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(0,n.setResponseValueAndErrors)(r,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&(0,n.setResponseValueAndErrors)(r,"maxItems",e.maxSize.value,e.maxSize.message,t),r}},4297:(e,t,r)=>{e=r.nmd(e);const n=(e=0)=>t=>`[${38+e};5;${t}m`,i=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`;Object.defineProperty(e,"exports",{enumerable:!0,get:function(){const e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(const[r,n]of Object.entries(t)){for(const[r,i]of Object.entries(n))t[r]={open:`[${i[0]}m`,close:`[${i[1]}m`},n[r]=t[r],e.set(i[0],i[1]);Object.defineProperty(t,r,{value:n,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="",t.bgColor.close="",t.color.ansi256=n(),t.color.ansi16m=i(),t.bgColor.ansi256=n(10),t.bgColor.ansi16m=i(10),Object.defineProperties(t,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:e=>{const t=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(e.toString(16));if(!t)return[0,0,0];let{colorString:r}=t.groups;3===r.length&&(r=r.split("").map(e=>e+e).join(""));const n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>t.rgbToAnsi256(...t.hexToRgb(e)),enumerable:!1}}),t}})},4371:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseReadonlyDef=void 0;const n=r(81626);t.parseReadonlyDef=(e,t)=>(0,n.parseDef)(e.innerType._def,t)},4516:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LangChainTracer=void 0;const n=r(92889),i=r(68696),a=r(71823),o=r(75550),s=r(62838);class c extends o.BaseTracer{constructor(e={}){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"langchain_tracer"}),Object.defineProperty(this,"projectName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const{exampleId:t,projectName:r,client:n}=e;this.projectName=r??(0,a.getEnvironmentVariable)("LANGCHAIN_PROJECT")??(0,a.getEnvironmentVariable)("LANGCHAIN_SESSION"),this.exampleId=t,this.client=n??(0,s.getDefaultLangChainClientSingleton)();const i=c.getTraceableRunTree();i&&this.updateFromRunTree(i)}async _convertToCreate(e,t=void 0){return{...e,extra:{...e.extra,runtime:await(0,a.getRuntimeEnvironment)()},child_runs:void 0,session_name:this.projectName,reference_example_id:e.parent_run_id?void 0:t}}async persistRun(e){}async onRunCreate(e){const t=await this._convertToCreate(e,this.exampleId);await this.client.createRun(t)}async onRunUpdate(e){const t={end_time:e.end_time,error:e.error,outputs:e.outputs,events:e.events,inputs:e.inputs,trace_id:e.trace_id,dotted_order:e.dotted_order,parent_run_id:e.parent_run_id,extra:e.extra,session_name:this.projectName};await this.client.updateRun(e.id,t)}getRun(e){return this.runMap.get(e)}updateFromRunTree(e){let t=e;const r=new Set;for(;t.parent_run&&!r.has(t.id)&&(r.add(t.id),t.parent_run);)t=t.parent_run;r.clear();const n=[t];for(;n.length>0;){const e=n.shift();e&&!r.has(e.id)&&(r.add(e.id),this.runMap.set(e.id,e),e.child_runs&&n.push(...e.child_runs))}this.client=e.client??this.client,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}convertToRunTree(e){const t={},r=[];for(const[e,i]of this.runMap){const a=new n.RunTree({...i,child_runs:[],parent_run:void 0,client:this.client,project_name:this.projectName,reference_example_id:this.exampleId,tracingEnabled:!0});t[e]=a,r.push([e,i.dotted_order])}r.sort((e,t)=>e[1]&&t[1]?e[1].localeCompare(t[1]):0);for(const[e]of r){const r=this.runMap.get(e),n=t[e];if(r&&n&&r.parent_run_id){const e=t[r.parent_run_id];e&&(e.child_runs.push(n),n.parent_run=e)}}return t[e]}static getTraceableRunTree(){try{return i.getCurrentRunTree(!0)}catch{return}}}t.LangChainTracer=c},4806:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.errorUtil=void 0,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(r||(t.errorUtil=r={}))},5244:(e,t,r)=>{var n=e.exports=function(e){e=e.toLowerCase();var t=n[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};n.sha=r(2954),n.sha1=r(16375),n.sha224=r(64012),n.sha256=r(28729),n.sha384=r(91453),n.sha512=r(21756)},5527:(e,t,r)=>{var n=r(10460),i=r(56608).Buffer,a=r(56696);function o(e){var t=e._cipher.encryptBlockRaw(e._prev);return a(e._prev),t}t.encrypt=function(e,t){var r=Math.ceil(t.length/16),a=e._cache.length;e._cache=i.concat([e._cache,i.allocUnsafe(16*r)]);for(var s=0;s<r;s++){var c=o(e),u=a+16*s;e._cache.writeUInt32BE(c[0],u+0),e._cache.writeUInt32BE(c[1],u+4),e._cache.writeUInt32BE(c[2],u+8),e._cache.writeUInt32BE(c[3],u+12)}var l=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),n(t,l)}},5666:(e,t,r)=>{var n=r(96509),i=r(9185).assert;function a(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=a,a.fromPublic=function(e,t,r){return t instanceof a?t:new a(e,{pub:t,pubEnc:r})},a.fromPrivate=function(e,t,r){return t instanceof a?t:new a(e,{priv:t,privEnc:r})},a.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},a.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},a.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},a.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},a.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},a.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},a.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},a.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},a.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},5796:(e,t)=>{function r(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}Object.defineProperty(t,"__esModule",{value:!0}),t.setResponseValueAndErrors=t.addErrorMessage=void 0,t.addErrorMessage=r,t.setResponseValueAndErrors=function(e,t,n,i,a){e[t]=n,r(e,t,i,a)}},6054:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFundingRateByInstId=async function(e){return await n.OkxUtils.request("GET","/api/v5/public/funding-rate",e)},t.getFundingRateHistory=async function(e){return await n.OkxUtils.request("GET","/api/v5/public/funding-rate-history",e)};const n=r(2033)},6280:(e,t,r)=>{const n=r(18244),{MAX_LENGTH:i,MAX_SAFE_INTEGER:a}=r(97374),{safeRe:o,safeSrc:s,t:c}=r(60722),u=r(90327),{compareIdentifiers:l}=r(42847);class d{constructor(e,t){if(t=u(t),e instanceof d){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);n("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[c.LOOSE]:o[c.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>a||this.major<0)throw new TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<a)return t}return e}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(n("SemVer.compare",this.version,this.options,e),!(e instanceof d)){if("string"==typeof e&&e===this.version)return 0;e=new d(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof d||(e=new d(e,this.options)),l(this.major,e.major)||l(this.minor,e.minor)||l(this.patch,e.patch)}comparePre(e){if(e instanceof d||(e=new d(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const r=this.prerelease[t],i=e.prerelease[t];if(n("prerelease compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return l(r,i)}while(++t)}compareBuild(e){e instanceof d||(e=new d(e,this.options));let t=0;do{const r=this.build[t],i=e.build[t];if(n("build compare",t,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return l(r,i)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=new RegExp(`^${this.options.loose?s[c.PRERELEASELOOSE]:s[c.PRERELEASE]}$`),r=`-${t}`.match(e);if(!r||r[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===l(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=d},6609:(e,t,r)=>{e.exports=r(54919)},7196:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(r(89278));i(r(89278),t),t.default=o.default},7253:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t._areEquals=t.validate=t.validator=t.applyReducer=t.applyPatch=t.applyOperation=t.getValueByPointer=t.deepClone=t.JsonPatchError=void 0;const n=r(8179);t.JsonPatchError=n.PatchError,t.deepClone=n._deepClone;const i={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){let i=o(r,this.path);i&&(i=(0,n._deepClone)(i));const a=s(r,{op:"remove",path:this.from}).removed;return s(r,{op:"add",path:this.path,value:a}),{newDocument:r,removed:i}},copy:function(e,t,r){const i=o(r,this.from);return s(r,{op:"add",path:this.path,value:(0,n._deepClone)(i)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:d(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}};var a={add:function(e,t,r){return(0,n.isInteger)(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){return{newDocument:r,removed:e.splice(t,1)[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:i.move,copy:i.copy,test:i.test,_get:i._get};function o(e,t){if(""==t)return e;var r={op:"_get",path:t};return s(e,r),r.value}function s(e,r,s=!1,c=!0,l=!0,f=0){if(s&&("function"==typeof s?s(r,0,e,r.path):u(r,0)),""===r.path){let n={newDocument:e};if("add"===r.op)return n.newDocument=r.value,n;if("replace"===r.op)return n.newDocument=r.value,n.removed=e,n;if("move"===r.op||"copy"===r.op)return n.newDocument=o(e,r.from),"move"===r.op&&(n.removed=e),n;if("test"===r.op){if(n.test=d(e,r.value),!1===n.test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",f,r,e);return n.newDocument=e,n}if("remove"===r.op)return n.removed=e,n.newDocument=null,n;if("_get"===r.op)return r.value=e,n;if(s)throw new t.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",f,r,e);return n}{c||(e=(0,n._deepClone)(e));const o=(r.path||"").split("/");let d,h,p,m=e,g=1,b=o.length;for(p="function"==typeof s?s:u;;){if(h=o[g],h&&-1!=h.indexOf("~")&&(h=(0,n.unescapePathComponent)(h)),l&&("__proto__"==h||"prototype"==h&&g>0&&"constructor"==o[g-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(s&&void 0===d&&(void 0===m[h]?d=o.slice(0,g).join("/"):g==b-1&&(d=r.path),void 0!==d&&p(r,0,e,d)),g++,Array.isArray(m)){if("-"===h)h=m.length;else{if(s&&!(0,n.isInteger)(h))throw new t.JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",f,r,e);(0,n.isInteger)(h)&&(h=~~h)}if(g>=b){if(s&&"add"===r.op&&h>m.length)throw new t.JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",f,r,e);const n=a[r.op].call(r,m,h,e);if(!1===n.test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",f,r,e);return n}}else if(g>=b){const n=i[r.op].call(r,m,h,e);if(!1===n.test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",f,r,e);return n}if(m=m[h],s&&g<b&&(!m||"object"!=typeof m))throw new t.JsonPatchError("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",f,r,e)}}}function c(e,r,i,a=!0,o=!0){if(i&&!Array.isArray(r))throw new t.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");a||(e=(0,n._deepClone)(e));const c=new Array(r.length);for(let t=0,n=r.length;t<n;t++)c[t]=s(e,r[t],i,!0,o,t),e=c[t].newDocument;return c.newDocument=e,c}function u(e,r,a,o){if("object"!=typeof e||null===e||Array.isArray(e))throw new t.JsonPatchError("Operation is not an object","OPERATION_NOT_AN_OBJECT",r,e,a);if(!i[e.op])throw new t.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",r,e,a);if("string"!=typeof e.path)throw new t.JsonPatchError("Operation `path` property is not a string","OPERATION_PATH_INVALID",r,e,a);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new t.JsonPatchError('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",r,e,a);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new t.JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",r,e,a);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new t.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",r,e,a);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&(0,n.hasUndefined)(e.value))throw new t.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",r,e,a);if(a)if("add"==e.op){var s=e.path.split("/").length,c=o.split("/").length;if(s!==c+1&&s!==c)throw new t.JsonPatchError("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",r,e,a)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==o)throw new t.JsonPatchError("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",r,e,a)}else if("move"===e.op||"copy"===e.op){var u=l([{op:"_get",path:e.from,value:void 0}],a);if(u&&"OPERATION_PATH_UNRESOLVABLE"===u.name)throw new t.JsonPatchError("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",r,e,a)}}function l(e,r,i){try{if(!Array.isArray(e))throw new t.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(r)c((0,n._deepClone)(r),(0,n._deepClone)(e),i||!0);else{i=i||u;for(var a=0;a<e.length;a++)i(e[a],a,r,void 0)}}catch(e){if(e instanceof t.JsonPatchError)return e;throw e}}function d(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var r,n,i,a=Array.isArray(e),o=Array.isArray(t);if(a&&o){if((n=e.length)!=t.length)return!1;for(r=n;0!==r--;)if(!d(e[r],t[r]))return!1;return!0}if(a!=o)return!1;var s=Object.keys(e);if((n=s.length)!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!t.hasOwnProperty(s[r]))return!1;for(r=n;0!==r--;)if(!d(e[i=s[r]],t[i]))return!1;return!0}return e!=e&&t!=t}t.getValueByPointer=o,t.applyOperation=s,t.applyPatch=c,t.applyReducer=function(e,r,n){const i=s(e,r);if(!1===i.test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",n,r,e);return i.newDocument},t.validator=u,t.validate=l,t._areEquals=d},7274:e=>{e.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},7325:(e,t,r)=>{var n=r(35578),i=r(91193),a=r(26012),o=r(96242);function s(){this.tmp=new Array(2),this.keys=null}function c(e){o.call(this,e);var t=new s;this._desState=t,this.deriveKeys(t,e.key)}i(c,o),e.exports=c,c.create=function(e){return new c(e)};var u=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];c.prototype.deriveKeys=function(e,t){e.keys=new Array(32),n.equal(t.length,this.blockSize,"Invalid key length");var r=a.readUInt32BE(t,0),i=a.readUInt32BE(t,4);a.pc1(r,i,e.tmp,0),r=e.tmp[0],i=e.tmp[1];for(var o=0;o<e.keys.length;o+=2){var s=u[o>>>1];r=a.r28shl(r,s),i=a.r28shl(i,s),a.pc2(r,i,e.keys,o)}},c.prototype._update=function(e,t,r,n){var i=this._desState,o=a.readUInt32BE(e,t),s=a.readUInt32BE(e,t+4);a.ip(o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,s,i.tmp,0):this._decrypt(i,o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],a.writeUInt32BE(r,o,n),a.writeUInt32BE(r,s,n+4)},c.prototype._pad=function(e,t){if(!1===this.padding)return!1;for(var r=e.length-t,n=t;n<e.length;n++)e[n]=r;return!0},c.prototype._unpad=function(e){if(!1===this.padding)return e;for(var t=e[e.length-1],r=e.length-t;r<e.length;r++)n.equal(e[r],t);return e.slice(0,e.length-t)},c.prototype._encrypt=function(e,t,r,n,i){for(var o=t,s=r,c=0;c<e.keys.length;c+=2){var u=e.keys[c],l=e.keys[c+1];a.expand(s,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var d=a.substitute(u,l),f=s;s=(o^a.permute(d))>>>0,o=f}a.rip(s,o,n,i)},c.prototype._decrypt=function(e,t,r,n,i){for(var o=r,s=t,c=e.keys.length-2;c>=0;c-=2){var u=e.keys[c],l=e.keys[c+1];a.expand(o,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var d=a.substitute(u,l),f=o;o=(s^a.permute(d))>>>0,s=f}a.rip(o,s,n,i)}},7571:(e,t)=>{function r(e){return e.replace(/[^a-zA-Z-_0-9]/g,"_")}Object.defineProperty(t,"__esModule",{value:!0}),t.drawMermaidPng=t.drawMermaid=void 0;const n=["*","_","`"];t.drawMermaid=function(e,t,i){const{firstNode:a,lastNode:o,nodeColors:s,withStyles:c=!0,curveStyle:u="linear",wrapLabelNWords:l=9}=i??{};let d=c?`%%{init: {'flowchart': {'curve': '${u}'}}}%%\ngraph TD;\n`:"graph TD;\n";if(c){const t="default",i={[t]:"{0}({1})"};void 0!==a&&(i[a]="{0}([{1}]):::first"),void 0!==o&&(i[o]="{0}([{1}]):::last");for(const[a,o]of Object.entries(e)){const e=o.name.split(":").pop()??"";let s=n.some(t=>e.startsWith(t)&&e.endsWith(t))?`<p>${e}</p>`:e;Object.keys(o.metadata??{}).length&&(s+=`<hr/><small><em>${Object.entries(o.metadata??{}).map(([e,t])=>`${e} = ${t}`).join("\n")}</em></small>`);const c=(i[a]??i[t]).replace("{0}",r(a)).replace("{1}",s);d+=`\t${c}\n`}}const f={};for(const e of t){const t=e.source.split(":"),r=e.target.split(":"),n=t.filter((e,t)=>e===r[t]).join(":");f[n]||(f[n]=[]),f[n].push(e)}const h=new Set;function p(e,t){const n=1===e.length&&e[0].source===e[0].target;if(t&&!n){const e=t.split(":").pop();if(h.has(e))throw new Error(`Found duplicate subgraph '${e}' -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);h.add(e),d+=`\tsubgraph ${e}\n`}for(const t of e){const{source:e,target:n,data:i,conditional:a}=t;let o="";if(void 0!==i){let e=i;const t=e.split(" ");t.length>l&&(e=Array.from({length:Math.ceil(t.length/l)},(e,r)=>t.slice(r*l,(r+1)*l).join(" ")).join("&nbsp;<br>&nbsp;")),o=a?` -. &nbsp;${e}&nbsp; .-> `:` -- &nbsp;${e}&nbsp; --\x3e `}else o=a?" -.-> ":" --\x3e ";d+=`\t${r(e)}${o}${r(n)};\n`}for(const e in f)e.startsWith(`${t}:`)&&e!==t&&p(f[e],e);t&&!n&&(d+="\tend\n")}p(f[""]??[],"");for(const e in f)e.includes(":")||""===e||p(f[e],e);return c&&(d+=function(e){let t="";for(const[r,n]of Object.entries(e))t+=`\tclassDef ${r} ${n};\n`;return t}(s??{})),d},t.drawMermaidPng=async function(e,t){let{backgroundColor:r="white"}=t??{};const n=btoa(e);void 0!==r&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));const i=`https://mermaid.ink/img/${n}?bgColor=${r}`,a=await fetch(i);if(!a.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${a.status}`,`Status text: ${a.statusText}`].join("\n"));return await a.blob()}},7603:(e,t,r)=>{var n=r(56608).Buffer,i=r(99829),a=r(23071).ec,o=r(19979),s=r(99729);function c(e,t){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(t)>=0)throw new Error("invalid sig")}e.exports=function(e,t,r,u,l){var d=o(r);if("ec"===d.type){if("ecdsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");return function(e,t,r){var n=s[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new a(n),o=r.data.subjectPrivateKey.data;return i.verify(t,e,o)}(e,t,d)}if("dsa"===d.type){if("dsa"!==u)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,a=r.data.q,s=r.data.g,u=r.data.pub_key,l=o.signature.decode(e,"der"),d=l.s,f=l.r;c(d,a),c(f,a);var h=i.mont(n),p=d.invm(a);return 0===s.toRed(h).redPow(new i(t).mul(p).mod(a)).fromRed().mul(u.toRed(h).redPow(f.mul(p).mod(a)).fromRed()).mod(n).mod(a).cmp(f)}(e,t,d)}if("rsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong public key type");t=n.concat([l,t]);for(var f=d.modulus.byteLength(),h=[1],p=0;t.length+h.length+2<f;)h.push(255),p+=1;h.push(0);for(var m=-1;++m<t.length;)h.push(t[m]);h=n.from(h);var g=i.mont(d.modulus);e=(e=new i(e).toRed(g)).redPow(new i(d.publicExponent)),e=n.from(e.fromRed().toArray());var b=p<8?1:0;for(f=Math.min(e.length,h.length),e.length!==h.length&&(b=1),m=-1;++m<f;)b|=e[m]^h[m];return 0===b}},7755:(e,t,r)=>{var n=r(49336),i=r(20022),a=r(491)(),o=r(25667),s=r(71102),c=n("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||c(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,u=!0;if("length"in e&&o){var l=o(e,"length");l&&!l.configurable&&(n=!1),l&&!l.writable&&(u=!1)}return(n||u||!r)&&(a?i(e,"length",t,!0,!0):i(e,"length",t)),e}},8179:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PatchError=t.hasUndefined=t.getPath=t._getPathRecursive=t.unescapePathComponent=t.escapePathComponent=t.isInteger=t._deepClone=t._objectKeys=t.hasOwnProperty=void 0;const r=Object.prototype.hasOwnProperty;function n(e,t){return r.call(e,t)}function i(e){if(Array.isArray(e)){const t=new Array(e.length);for(let e=0;e<t.length;e++)t[e]=""+e;return t}if(Object.keys)return Object.keys(e);let t=[];for(let r in e)n(e,r)&&t.push(r);return t}function a(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function o(e,t){let r;for(let i in e)if(n(e,i)){if(e[i]===t)return a(i)+"/";if("object"==typeof e[i]&&(r=o(e[i],t),""!=r))return a(i)+"/"+r}return""}function s(e,t){const r=[e];for(const e in t){const n="object"==typeof t[e]?JSON.stringify(t[e],null,2):t[e];void 0!==n&&r.push(`${e}: ${n}`)}return r.join("\n")}t.hasOwnProperty=n,t._objectKeys=i,t._deepClone=function(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}},t.isInteger=function(e){let t=0;const r=e.length;let n;for(;t<r;){if(n=e.charCodeAt(t),!(n>=48&&n<=57))return!1;t++}return!0},t.escapePathComponent=a,t.unescapePathComponent=function(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")},t._getPathRecursive=o,t.getPath=function(e,t){if(e===t)return"/";const r=o(e,t);if(""===r)throw new Error("Object not found in root");return`/${r}`},t.hasUndefined=function e(t){if(void 0===t)return!0;if(t)if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(e(t[r]))return!0}else if("object"==typeof t){const n=i(t),a=n.length;for(var r=0;r<a;r++)if(e(t[n[r]]))return!0}return!1};class c extends Error{constructor(e,t,r,n,i){super(s(e,{name:t,index:r,operation:n,tree:i})),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"operation",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"tree",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.setPrototypeOf(this,new.target.prototype),this.message=s(e,{name:t,index:r,operation:n,tree:i})}}t.PatchError=c},8235:(e,t,r)=>{e.exports=o;var n=r(76357),i=Object.create(r(41166));function a(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function o(e){if(!(this instanceof o))return new o(e);n.call(this,e),this._transformState={afterTransform:a.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",s)}function s(){var e=this;"function"==typeof this._flush?this._flush(function(t,r){c(e,t,r)}):c(this,null,null)}function c(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}i.inherits=r(91193),i.inherits(o,n),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},o.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},o.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},o.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},o.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,function(e){t(e),r.emit("close")})}},8252:(e,t,r)=>{var n=r(56608).Buffer,i=r(16111),a=r(68460),o=ArrayBuffer.isView||function(e){try{return a(e),!0}catch(e){return!1}},s="undefined"!=typeof Uint8Array,c="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,u=c&&(n.prototype instanceof Uint8Array||n.TYPED_ARRAY_SUPPORT);e.exports=function(e,t){if(e instanceof n)return e;if("string"==typeof e)return n.from(e,t);if(c&&o(e)){if(0===e.byteLength)return n.alloc(0);if(u){var r=n.from(e.buffer,e.byteOffset,e.byteLength);if