filecat 5.23.11 → 5.23.13
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.
- package/build/dist/{214.9e6f0f2def74011c8490.js → 214.d76bdae58c76d429f6ec.js} +2 -2
- package/build/dist/247.c250bd9262830d278075.js +2 -0
- package/build/dist/325.e1f1b6d260baa3127489.js +2 -0
- package/build/dist/{402.18ca38bad35cd811bbde.js → 402.1d6bde60700fb0b42129.js} +2 -2
- package/build/dist/523.bd45384c60496aaa0fd8.js +2 -0
- package/build/dist/654.43ec0dfba2da4a2261dc.js +1 -0
- package/build/dist/{661.1de974db830d39e3226f.js → 661.f71bb2fcdb45c0333f07.js} +2 -2
- package/build/dist/704.28d379344790855c1c1b.js +2 -0
- package/build/dist/759.7e32f38374a01f5957ff.js +2 -0
- package/build/dist/{943.d9ab61469e713025ba47.js → 943.0849679bea91b2d4276f.js} +2 -2
- package/build/dist/{963.4a7c8fe0dce67f1fbc98.js → 963.130fc19dfabbf4a344bd.js} +2 -2
- package/build/dist/{998.7f48da68620db19b31eb.js → 998.c7a143ba96506bab9e07.js} +2 -2
- package/build/dist/index.html +1 -1
- package/build/dist/main.6b1807315f81112ae97b.js +2 -0
- package/build/main.js +1 -1
- package/build/threads.work.filecat.js +1 -1
- package/env +2 -0
- package/package.json +1 -1
- package/build/dist/247.dd7184fc54027c51f8bc.js +0 -2
- package/build/dist/325.eb6c95e4fd8d1b0b43e0.js +0 -2
- package/build/dist/523.7de072ac46794f3971b8.js +0 -2
- package/build/dist/654.b38d105e827a98183928.js +0 -1
- package/build/dist/704.34dad7edba053566d627.js +0 -2
- package/build/dist/759.ac0d69796668d718026d.js +0 -2
- package/build/dist/main.b9283af1351f67829df2.js +0 -2
- /package/build/dist/{214.9e6f0f2def74011c8490.js.LICENSE.txt → 214.d76bdae58c76d429f6ec.js.LICENSE.txt} +0 -0
- /package/build/dist/{247.dd7184fc54027c51f8bc.js.LICENSE.txt → 247.c250bd9262830d278075.js.LICENSE.txt} +0 -0
- /package/build/dist/{325.eb6c95e4fd8d1b0b43e0.js.LICENSE.txt → 325.e1f1b6d260baa3127489.js.LICENSE.txt} +0 -0
- /package/build/dist/{402.18ca38bad35cd811bbde.js.LICENSE.txt → 402.1d6bde60700fb0b42129.js.LICENSE.txt} +0 -0
- /package/build/dist/{523.7de072ac46794f3971b8.js.LICENSE.txt → 523.bd45384c60496aaa0fd8.js.LICENSE.txt} +0 -0
- /package/build/dist/{661.1de974db830d39e3226f.js.LICENSE.txt → 661.f71bb2fcdb45c0333f07.js.LICENSE.txt} +0 -0
- /package/build/dist/{704.34dad7edba053566d627.js.LICENSE.txt → 704.28d379344790855c1c1b.js.LICENSE.txt} +0 -0
- /package/build/dist/{759.ac0d69796668d718026d.js.LICENSE.txt → 759.7e32f38374a01f5957ff.js.LICENSE.txt} +0 -0
- /package/build/dist/{943.d9ab61469e713025ba47.js.LICENSE.txt → 943.0849679bea91b2d4276f.js.LICENSE.txt} +0 -0
- /package/build/dist/{963.4a7c8fe0dce67f1fbc98.js.LICENSE.txt → 963.130fc19dfabbf4a344bd.js.LICENSE.txt} +0 -0
- /package/build/dist/{998.7f48da68620db19b31eb.js.LICENSE.txt → 998.c7a143ba96506bab9e07.js.LICENSE.txt} +0 -0
- /package/build/dist/{main.b9283af1351f67829df2.js.LICENSE.txt → main.6b1807315f81112ae97b.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see threads.work.filecat.js.LICENSE.txt */
|
|
2
|
-
(()=>{var __webpack_modules__={3054(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.start_ai_agent_agent=function(){(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_init,async e=>{const{index_storage_type:t,db_path:i}=e.data;w=t,"memory"===t&&(S||(S=new o.default.Index({tokenize:"strict"}),_=new o.default.Index({tokenize:"strict"}))),"sqlite"===t&&(C=new h(i,{nativeBinding:u}),C.exec("\n CREATE VIRTUAL TABLE IF NOT EXISTS docs USING fts5(\n file_path UNINDEXED,\n content,\n mtime UNINDEXED,\n tokenize = 'unicode61'\n );\n \n CREATE VIRTUAL TABLE IF NOT EXISTS doc_names USING fts5(\n file_path UNINDEXED,\n name,\n mtime UNINDEXED,\n tokenize = 'unicode61'\n );\n "),y=C.prepare("\n SELECT mtime FROM docs WHERE file_path = ? LIMIT 1\n "),b=C.prepare("\n SELECT mtime FROM doc_names WHERE file_path = ? LIMIT 1\n "),d=C.prepare("INSERT INTO docs (file_path, content, mtime) VALUES (?, ?, ?)"),f=C.prepare("INSERT INTO doc_names (file_path, name, mtime) VALUES (?, ?, ?)"),p=C.prepare("DELETE FROM docs WHERE file_path = ?"),g=C.prepare("DELETE FROM doc_names WHERE file_path = ?"),m=C.prepare("\n SELECT file_path\n FROM docs\n WHERE docs MATCH ?\n ORDER BY bm25(docs)\n LIMIT 50\n "),v=C.prepare("\n SELECT file_path\n FROM doc_names\n WHERE doc_names MATCH ?\n ORDER BY bm25(doc_names)\n LIMIT 50\n "))}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_add,async e=>{let t,i,{use_zh_segmentation:n,file_path:r,mtime:s}=e.data;if("sqlite"===w&&C){s=s??(await c.FileUtil.statSync(r)).mtime;const e=y.get(r);if(e&&e.mtime===s)return{char_num:0};t=`${r} ${(await c.FileUtil.readFileSync(r)).toString()}。`,i=t.length;let o=t,l=r;n&&(o=(0,a.cut)(t,!0).join(" "),l=(0,a.cut)(r,!0).join(" ")),p.run(r),g.run(r),d.run(r,o,s),f.run(r,l,s)}if("memory"===w){t=`${r} ${(await c.FileUtil.readFileSync(r)).toString()}。`,i=t.length;let e=t.toLowerCase(),s=r.toLowerCase();n&&(e=(0,a.cut)(t,!0).join(" ").toLowerCase(),s=(0,a.cut)(r,!0).join(" ").toLowerCase()),S?.add(r,e),_?.add(r,s)}return{char_num:i}}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_del,async e=>{const{file_path:t}=e.data;"memory"===w&&(S?.remove(t),_?.remove(t)),"sqlite"===w&&C&&(p.run(t),g.run(t))}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_search,async e=>{const{key:t,use_zh_segmentation:i}=e.data;let n=t;if(i){n=(0,a.cut)(t,!0).map(e=>e+"*").join(" OR ")}if("memory"===w){const e={suggest:!0,resolution:9,context:!0,limit:50};return{ids:S?.search(n,e)||[],names_ids:_?.search(n,e)||[]}}if("sqlite"===w&&C){const e=(0,a.cut)(n,!0).filter(e=>""!==e.trim()).map(e=>e+"*").join(" OR "),t=m.all(e),i=v.all(e);return{ids:t.map(e=>e.file_path),names_ids:i.map(e=>e.file_path)}}return{ids:[],names_ids:[]}}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_close,async()=>{"memory"===w&&(S?.clear(),_?.clear(),S=null,_=null),"sqlite"===w&&C&&(C.close(),C=null)})};const r=i(324),s=i(7525),o=n(i(5474)),a=i(2880),l=i(3917),c=i(1776),u=(0,l.get_bin_dependency)("sqlite3"),h=(0,l.get_bin_dependency)("better-sqlite3");let d,f,p,g,m,v,y,b,S=null,_=null,C=null,w="memory"},3917(__unused_webpack_module,exports,__webpack_require__){"use strict";function get_bin_dependency(module,auto_throw=!1){try{if("sqlite3"===module)return __webpack_require__(9642);if("exe"===process.env.run_env)switch(module){case"@xiaobaidadada/dockerode":return __webpack_require__(8608);case"@xiaobaidadada/node-pty-prebuilt":return __webpack_require__(6087);case"@xiaobaidadada/ssh2-prebuilt":return __webpack_require__(1217);case"node-process-watcher":return __webpack_require__(4505);case"@xiaobaidadada/node-tuntap2-wintun":return __webpack_require__(2710);case"better-sqlite3":return __webpack_require__(7550);default:throw{message:"不存在的包"}}return eval("require")(module)}catch(e){if(console.log(`${process.env.run_env} 模块没有加载失败,请手动安装 npm 依赖( -g 安装的就尝试全局安装,本地仓库安装的就在仓库内安装):${module} error ${e.message}`),auto_throw)throw e}return{}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.get_bin_dependency=get_bin_dependency},1776(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FileUtil=void 0;const r=n(i(9896)),s=n(i(6928));t.FileUtil=class{static async statSync(e){return r.default.promises.stat(e)}static async readdirSync(e){return r.default.promises.readdir(e)}static async readFileSync(e){return r.default.promises.readFile(e)}static async open(e,t,i){return r.default.promises.open(e,t,i)}static async access(e){try{return await r.default.promises.access(e,r.default.constants.F_OK),!0}catch{return!1}}static async appendFileSync(e,t,i){return r.default.promises.appendFile(e,t,i)}static async writeFileSync(e,t){return r.default.promises.writeFile(e,t)}static async truncateSync(e){return r.default.promises.truncate(e)}static async unlinkSync(e){return r.default.promises.unlink(e)}static async mkdirSync(e,t){return r.default.promises.mkdir(e,t)}static async renameSync(e,t){return r.default.promises.rename(e,t)}static async getUniqueFileName(e){const t=s.default.dirname(e),i=s.default.extname(e),n=s.default.basename(e,i);let r=e,o=1;for(;await this.access(r);)r=s.default.join(t,`${n}(${o})${i}`),o++;return r}static async get_exe_path_by_env_dir(e,t){if(!await this.access(e))return null;const i=await this.readdirSync(e);for(const n of i)if(n.startsWith(t))return s.default.join(e,`${n}`);return null}}},3285(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.file_search_start=function(){(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search,async e=>{const{start:t,end:i,file_path:c,query_text_buffer:u,ram_id:h}=e.data;let d=0,f=Buffer.alloc(0);const p=s.openSync(c,"r");let g=0;for(;d<i&&!l[h];){const e=Buffer.alloc(2097152);let t=s.readSync(p,e,0,e.length,d);if(0===t)break;d+=t,f=Buffer.concat([f,e.subarray(0,t)]),(0,n.threads_send)({type:r.threads_msg_type.search_file_progress,data:{progress:(100*d/i).toFixed(0),ram_id:h}});const l=[];if(a(f,u,l),l.length>0){for(let e=0;e<l.length;e++)l[e]+=g;(0,n.threads_send)({type:r.threads_msg_type.search_file_index,data:{find_index:l,ram_id:h}})}g+=f.length-u.length,f=o(f,f.length-u.length,f.length)}return(0,n.threads_send)({type:r.threads_msg_type.search_file_end,data:{ram_id:h}}),s.closeSync(p),"ok"}),(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search_close,async e=>{const{ram_id:t}=e.data;return l[t]=!0,"ok"}),(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search_start,async e=>{const{ram_id:t}=e.data;return delete l[t],"ok"})};const n=i(324),r=i(7525),s=i(9896);function o(e,t,i){const n=i-t,r=Buffer.alloc(n);return e.copy(r,0,t,i),r}function a(e,t,i){const n=function(e){const t={},i=e.length;for(let n=0;n<i;n++)t[e[n]]=n;return t}(t),r=e.length,s=t.length,o=r-s;let a=0;for(;a<=o;){let o=s-1;for(;o>=0&&e[a+o]===t[o];)o--;if(o<0)i.push(a),a+=a+s<r?s-n[e[a+s]]||s:1;else{const t=n[e[a+o]],i=void 0!==t?o-t:o+1;a+=Math.max(i,1)}}}const l={}},7525(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.threads_msg_type=void 0,function(e){e[e.hello=1]="hello",e[e.file_search_start=2]="file_search_start",e[e.file_search=3]="file_search",e[e.file_search_close=4]="file_search_close",e[e.search_file_index=5]="search_file_index",e[e.search_file_progress=6]="search_file_progress",e[e.search_file_end=7]="search_file_end",e[e.docs_init=8]="docs_init",e[e.docs_add=9]="docs_add",e[e.docs_del=10]="docs_del",e[e.docs_close=11]="docs_close",e[e.docs_search=12]="docs_search"}(i||(t.threads_msg_type=i={}))},324(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.register_threads_worker_handler=o,t.threads_send=a;const n=i(8167),r=i(7525);console.log("[worker] 子线程启动, workerData=",n.workerData);const s=new Map;function o(e,t){s.set(e,t)}function a(e){try{n.parentPort?.postMessage(e)}catch(e){console.error("[worker] send failed:",e)}}n.parentPort?.on("message",e=>{(async function(e){try{const t=s.get(e.type);if(!t)return void a({id:e.id,type:e.type,data:`unknown type ${e.type}`});const i=await t(e);a({id:e.id,type:e.type,data:i})}catch(t){a({id:e.id,type:e.type,data:null,error:t?.message||String(t)}),console.error("[worker] task error:",t)}})(e).catch(console.error)}),o(r.threads_msg_type.hello,async e=>new Promise((t,i)=>setTimeout(()=>{if(Math.random()<.05)return i(new Error("模拟错误"));t(`done:${e.data}`)},500))),console.log("[worker] ready and waiting for messages..."),process.on("uncaughtException",e=>{console.error("子线程全局未捕获异常:",e)}),process.on("unhandledRejection",e=>{console.error("子线程未处理的 Promise 拒绝:",e)})},3065(e,t,i){"use strict";const n=i(6928),r=e=>new c(e);function s(e){return Array.isArray(e)?e:[e]}r.default=r,e.exports=r;const o="\\"===n.sep?/(?<=.)\\$/:/(?<=.)\/$/,a="undefined"!=typeof Symbol?Symbol.for("dockerignore"):"dockerignore";function l(e){return n.normalize(e).replace(o,"")}class c{constructor({ignorecase:e=!0}={}){this._rules=[],this._ignorecase=e,this[a]=!0,this._initCache()}_initCache(){this._cache={}}add(e){return this._added=!1,"string"==typeof e&&(e=e.split(/\r?\n/g)),s(e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_addPattern(e){if(e&&e[a])return this._rules=this._rules.concat(e._rules),void(this._added=!0);if(this._checkPattern(e)){const t=this._createRule(e.trim());null!==t&&(this._added=!0,this._rules.push(t))}}_checkPattern(e){return e&&"string"==typeof e&&0!==e.indexOf("#")&&""!==e.trim()}filter(e){return s(e).filter(e=>this._filter(e))}createFilter(){return e=>this._filter(e)}ignores(e){return!this._filter(e)}_createRule(e){const t=e;let i=!1;var r;if("!"===e[0]&&(i=!0,e=e.substring(1).trim()),e.length>0&&(e=l(e),r=e,(e="/"===n.sep?r:r.replace(/\\/g,"/")).length>1&&"/"===e[0]&&(e=e.slice(1))),i&&(e="!"+e),""===(e=e.trim()))return null;if("!"===(e=l(e))[0]){if(1===e.length)return null;i=!0,e=e.substring(1)}else i=!1;return{origin:t,pattern:e,dirs:e.split(n.sep),negative:i}}_filter(e){return!!e&&(e in this._cache?this._cache[e]:this._cache[e]=this._test(e))}_test(e){e=function(e){return"/"===n.sep?e:e.replace(/\//g,n.sep)}(e);const t=l(n.dirname(e)),i=t.split(n.sep);let r=!1;return this._rules.forEach(s=>{let o=this._match(e,s);if(!o&&"."!==t)if(s.dirs.includes("**"))for(let e=s.dirs.filter(e=>"**"!==e).length;e<=i.length;e++)o=o||this._match(i.slice(0,e).join(n.sep),s);else s.dirs.length<=i.length&&(o=this._match(i.slice(0,s.dirs.length).join(n.sep),s));o&&(r=!s.negative)}),!r}_match(e,t){return this._compile(t).regexp.test(e)}_compile(e){if(e.regexp)return e;let t="^",i="\\"===n.sep?"\\\\":n.sep;for(let r=0;r<e.pattern.length;r++){const s=e.pattern[r];if("*"===s)"*"===e.pattern[r+1]?(r++,e.pattern[r+1]===n.sep&&r++,void 0===e.pattern[r+1]?t+=".*":t+=`(.*${i})?`):t+=`[^${i}]*`;else if("?"===s)t+=`[^${i}]`;else if("."===s||"$"===s)t+=`\\${s}`;else if("\\"===s){if("\\"===n.sep){t+=i;continue}void 0!==e.pattern[r+1]?(t+="\\"+e.pattern[r+1],r++):t+="\\"}else t+=s}return t+="$",e.regexp=new RegExp(t,this._ignorecase?"i":""),e}}},2661(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerAdminService=function(e,t){i.push({getServiceDefinition:e,getHandlers:t})},t.addAdminServicesToServer=function(e){for(const{getServiceDefinition:t,getHandlers:n}of i)e.addService(t(),n())};const i=[]},3956(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BackoffTimeout=void 0;const n=i(131),r=i(267);class s{constructor(e,t){this.callback=e,this.initialDelay=1e3,this.multiplier=1.6,this.maxDelay=12e4,this.jitter=.2,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=s.getNextId(),t&&(t.initialDelay&&(this.initialDelay=t.initialDelay),t.multiplier&&(this.multiplier=t.multiplier),t.jitter&&(this.jitter=t.jitter),t.maxDelay&&(this.maxDelay=t.maxDelay)),this.trace("constructed initialDelay="+this.initialDelay+" multiplier="+this.multiplier+" jitter="+this.jitter+" maxDelay="+this.maxDelay),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}static getNextId(){return this.nextId++}trace(e){r.trace(n.LogVerbosity.DEBUG,"backoff","{"+this.id+"} "+e)}runTimer(e){var t,i;this.trace("runTimer(delay="+e+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+e),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},e),this.hasRef||null===(i=(t=this.timerId).unref)||void 0===i||i.call(t)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);const e=Math.min(this.nextDelay*this.multiplier,this.maxDelay),t=e*this.jitter;var i,n;this.nextDelay=e+(i=-t,n=t,Math.random()*(n-i)+i)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){const e=new Date,t=this.startTime;t.setMilliseconds(t.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),e<t?this.runTimer(t.getTime()-e.getTime()):this.running=!1}}isRunning(){return this.running}ref(){var e,t;this.hasRef=!0,null===(t=(e=this.timerId).ref)||void 0===t||t.call(e)}unref(){var e,t;this.hasRef=!1,null===(t=(e=this.timerId).unref)||void 0===t||t.call(e)}getEndTime(){return this.endTime}}t.BackoffTimeout=s,s.nextId=0},2267(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CallCredentials=void 0;const n=i(4097);class r{static createFromMetadataGenerator(e){return new o(e)}static createFromGoogleCredential(e){return r.createFromMetadataGenerator((t,i)=>{let r;var s;r="getRequestHeaders"in(s=e)&&"function"==typeof s.getRequestHeaders?e.getRequestHeaders(t.service_url):new Promise((i,n)=>{e.getRequestMetadata(t.service_url,(e,t)=>{e?n(e):t?i(t):n(new Error("Headers not set by metadata plugin"))})}),r.then(e=>{const t=new n.Metadata;for(const i of Object.keys(e))t.add(i,e[i]);i(null,t)},e=>{i(e)})})}static createEmpty(){return new a}}t.CallCredentials=r;class s extends r{constructor(e){super(),this.creds=e}async generateMetadata(e){const t=new n.Metadata,i=await Promise.all(this.creds.map(t=>t.generateMetadata(e)));for(const e of i)t.merge(e);return t}compose(e){return new s(this.creds.concat([e]))}_equals(e){return this===e||e instanceof s&&this.creds.every((t,i)=>t._equals(e.creds[i]))}}class o extends r{constructor(e){super(),this.metadataGenerator=e}generateMetadata(e){return new Promise((t,i)=>{this.metadataGenerator(e,(e,n)=>{void 0!==n?t(n):i(e)})})}compose(e){return new s([this,e])}_equals(e){return this===e||e instanceof o&&this.metadataGenerator===e.metadataGenerator}}class a extends r{generateMetadata(e){return Promise.resolve(new n.Metadata)}compose(e){return e}_equals(e){return e instanceof a}}},5034(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InterceptingListenerImpl=void 0,t.statusOrFromValue=function(e){return{ok:!0,value:e}},t.statusOrFromError=function(e){var t;return{ok:!1,error:Object.assign(Object.assign({},e),{metadata:null!==(t=e.metadata)&&void 0!==t?t:new n.Metadata})}},t.isInterceptingListener=function(e){return void 0!==e.onReceiveMetadata&&1===e.onReceiveMetadata.length};const n=i(4097);t.InterceptingListenerImpl=class{constructor(e,t){this.listener=e,this.nextListener=t,this.processingMetadata=!1,this.hasPendingMessage=!1,this.processingMessage=!1,this.pendingStatus=null}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingStatus(){this.pendingStatus&&this.nextListener.onReceiveStatus(this.pendingStatus)}onReceiveMetadata(e){this.processingMetadata=!0,this.listener.onReceiveMetadata(e,e=>{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(e),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(e){this.processingMessage=!0,this.listener.onReceiveMessage(e,e=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=e,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(e),this.processPendingStatus())})}onReceiveStatus(e){this.listener.onReceiveStatus(e,e=>{this.processingMetadata||this.processingMessage?this.pendingStatus=e:this.nextListener.onReceiveStatus(e)})}}},5572(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNextCallNumber=function(){return i++};let i=0},1544(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClientDuplexStreamImpl=t.ClientWritableStreamImpl=t.ClientReadableStreamImpl=t.ClientUnaryCallImpl=void 0,t.callErrorFromStatus=function(e,t){const i=`${e.code} ${s.Status[e.code]}: ${e.details}`,n=`${new Error(i).stack}\nfor call at\n${t}`;return Object.assign(new Error(i),e,{stack:n})};const n=i(4434),r=i(2203),s=i(131);class o extends n.EventEmitter{constructor(){super()}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}}t.ClientUnaryCallImpl=o;class a extends r.Readable{constructor(e){super({objectMode:!0}),this.deserialize=e}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_read(e){var t;null===(t=this.call)||void 0===t||t.startRead()}}t.ClientReadableStreamImpl=a;class l extends r.Writable{constructor(e){super({objectMode:!0}),this.serialize=e}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_write(e,t,i){var n;const r={callback:i},s=Number(t);Number.isNaN(s)||(r.flags=s),null===(n=this.call)||void 0===n||n.sendMessageWithContext(r,e)}_final(e){var t;null===(t=this.call)||void 0===t||t.halfClose(),e()}}t.ClientWritableStreamImpl=l;class c extends r.Duplex{constructor(e,t){super({objectMode:!0}),this.serialize=e,this.deserialize=t}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_read(e){var t;null===(t=this.call)||void 0===t||t.startRead()}_write(e,t,i){var n;const r={callback:i},s=Number(t);Number.isNaN(s)||(r.flags=s),null===(n=this.call)||void 0===n||n.sendMessageWithContext(r,e)}_final(e){var t;null===(t=this.call)||void 0===t||t.halfClose(),e()}}t.ClientDuplexStreamImpl=c},5819(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileWatcherCertificateProvider=void 0;const n=i(9896),r=i(267),s=i(131),o=i(9023);function a(e){r.trace(s.LogVerbosity.DEBUG,"certificate_provider",e)}const l=(0,o.promisify)(n.readFile);t.FileWatcherCertificateProvider=class{constructor(e){if(this.config=e,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,void 0===e.certificateFile!=(void 0===e.privateKeyFile))throw new Error("certificateFile and privateKeyFile must be set or unset together");if(void 0===e.certificateFile&&void 0===e.caCertificateFile)throw new Error("At least one of certificateFile and caCertificateFile must be set");a("File watcher constructed with config "+JSON.stringify(e))}updateCertificates(){this.fileResultPromise||(this.fileResultPromise=Promise.allSettled([this.config.certificateFile?l(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?l(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?l(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([e,t,i])=>{if(this.refreshTimer){a("File watcher read certificates certificate "+e.status+", privateKey "+t.status+", CA certificate "+i.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,"fulfilled"===e.status&&"fulfilled"===t.status?this.latestIdentityUpdate={certificate:e.value,privateKey:t.value}:this.latestIdentityUpdate=null,"fulfilled"===i.status?this.latestCaUpdate={caCertificate:i.value}:this.latestCaUpdate=null;for(const e of this.identityListeners)e(this.latestIdentityUpdate);for(const e of this.caListeners)e(this.latestCaUpdate)}}),a("File watcher initiated certificate update"))}maybeStartWatchingFiles(){if(!this.refreshTimer){const e=this.lastUpdateTime?(new Date).getTime()-this.lastUpdateTime.getTime():1/0;e>this.config.refreshIntervalMs&&this.updateCertificates(),e>2*this.config.refreshIntervalMs&&(this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0),this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),a("File watcher started watching")}}maybeStopWatchingFiles(){0===this.caListeners.size&&0===this.identityListeners.size&&(this.fileResultPromise=null,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null))}addCaCertificateListener(e){this.caListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestCaUpdate&&process.nextTick(e,this.latestCaUpdate)}removeCaCertificateListener(e){this.caListeners.delete(e),this.maybeStopWatchingFiles()}addIdentityCertificateListener(e){this.identityListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestIdentityUpdate&&process.nextTick(e,this.latestIdentityUpdate)}removeIdentityCertificateListener(e){this.identityListeners.delete(e),this.maybeStopWatchingFiles()}}},7434(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelCredentials=void 0,t.createCertificateProviderChannelCredentials=function(e,t,i){return new m(e,t,null!=i?i:{})};const n=i(4756),r=i(2267),s=i(9167),o=i(3822),a=i(9302),l=i(267),c=i(131);function u(e,t){if(e&&!(e instanceof Buffer))throw new TypeError(`${t}, if provided, must be a Buffer.`)}class h{compose(e){return new v(this,e)}static createSsl(e,t,i,r){var o;if(u(e,"Root certificate"),u(t,"Private key"),u(i,"Certificate chain"),t&&!i)throw new Error("Private key must be given with accompanying certificate chain");if(!t&&i)throw new Error("Certificate chain must be given with accompanying private key");const a=(0,n.createSecureContext)({ca:null!==(o=null!=e?e:(0,s.getDefaultRootsData)())&&void 0!==o?o:void 0,key:null!=t?t:void 0,cert:null!=i?i:void 0,ciphers:s.CIPHER_SUITES});return new g(a,null!=r?r:{})}static createFromSecureContext(e,t){return new g(e,null!=t?t:{})}static createInsecure(){return new d}}t.ChannelCredentials=h;class d extends h{constructor(){super()}compose(e){throw new Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(e){return e instanceof d}_createSecureConnector(e,t,i){return{connect:e=>Promise.resolve({socket:e,secure:!1}),waitForReady:()=>Promise.resolve(),getCallCredentials:()=>null!=i?i:r.CallCredentials.createEmpty(),destroy(){}}}}function f(e,t,i,r){var s,l;const c={secureContext:e};let u=i;if("grpc.http_connect_target"in r){const e=(0,o.parseUri)(r["grpc.http_connect_target"]);e&&(u=e)}const h=(0,a.getDefaultAuthority)(u),d=(0,o.splitHostPort)(h),f=null!==(s=null==d?void 0:d.host)&&void 0!==s?s:h;if(c.host=f,t.checkServerIdentity&&(c.checkServerIdentity=t.checkServerIdentity),void 0!==t.rejectUnauthorized&&(c.rejectUnauthorized=t.rejectUnauthorized),c.ALPNProtocols=["h2"],r["grpc.ssl_target_name_override"]){const e=r["grpc.ssl_target_name_override"],t=null!==(l=c.checkServerIdentity)&&void 0!==l?l:n.checkServerIdentity;c.checkServerIdentity=(i,n)=>t(e,n),c.servername=e}else c.servername=f;return r["grpc-node.tls_enable_trace"]&&(c.enableTrace=!0),c}class p{constructor(e,t){this.connectionOptions=e,this.callCredentials=t}connect(e){const t=Object.assign({socket:e},this.connectionOptions);return new Promise((e,i)=>{const r=(0,n.connect)(t,()=>{var t;null!==(t=this.connectionOptions.rejectUnauthorized)&&void 0!==t&&!t||r.authorized?e({socket:r,secure:!0}):i(r.authorizationError)});r.on("error",e=>{i(e)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}}class g extends h{constructor(e,t){super(),this.secureContext=e,this.verifyOptions=t}_isSecure(){return!0}_equals(e){return this===e||e instanceof g&&(this.secureContext===e.secureContext&&this.verifyOptions.checkServerIdentity===e.verifyOptions.checkServerIdentity)}_createSecureConnector(e,t,i){const n=f(this.secureContext,this.verifyOptions,e,t);return new p(n,null!=i?i:r.CallCredentials.createEmpty())}}class m extends h{constructor(e,t,i){super(),this.caCertificateProvider=e,this.identityCertificateProvider=t,this.verifyOptions=i,this.refcount=0,this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this),this.secureContextWatchers=[]}_isSecure(){return!0}_equals(e){var t,i;return this===e||e instanceof m&&(this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&(null===(t=this.verifyOptions)||void 0===t?void 0:t.checkServerIdentity)===(null===(i=e.verifyOptions)||void 0===i?void 0:i.checkServerIdentity))}ref(){var e;0===this.refcount&&(this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),null===(e=this.identityCertificateProvider)||void 0===e||e.addIdentityCertificateListener(this.identityCertificateUpdateListener)),this.refcount+=1}unref(){var e;this.refcount-=1,0===this.refcount&&(this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),null===(e=this.identityCertificateProvider)||void 0===e||e.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_createSecureConnector(e,t,i){return this.ref(),new m.SecureConnectorImpl(this,e,t,null!=i?i:r.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(const e of this.secureContextWatchers)e(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.maybeUpdateWatchers()}hasReceivedUpdates(){return void 0!==this.latestCaUpdate&&(!this.identityCertificateProvider||void 0!==this.latestIdentityUpdate)}getSecureContext(){return this.hasReceivedUpdates()?Promise.resolve(this.getLatestSecureContext()):new Promise(e=>{this.secureContextWatchers.push(e)})}getLatestSecureContext(){var e,t;if(!this.latestCaUpdate)return null;if(null!==this.identityCertificateProvider&&!this.latestIdentityUpdate)return null;try{return(0,n.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:null===(e=this.latestIdentityUpdate)||void 0===e?void 0:e.privateKey,cert:null===(t=this.latestIdentityUpdate)||void 0===t?void 0:t.certificate,ciphers:s.CIPHER_SUITES})}catch(e){return(0,l.log)(c.LogVerbosity.ERROR,"Failed to createSecureContext with error "+e.message),null}}}m.SecureConnectorImpl=class{constructor(e,t,i,n){this.parent=e,this.channelTarget=t,this.options=i,this.callCredentials=n}connect(e){return new Promise((t,i)=>{const r=this.parent.getLatestSecureContext();if(!r)return void i(new Error("Failed to load credentials"));e.closed&&i(new Error("Socket closed while loading credentials"));const s=f(r,this.parent.verifyOptions,this.channelTarget,this.options),o=Object.assign({socket:e},s),a=()=>{i(new Error("Socket closed"))},l=e=>{i(e)},c=(0,n.connect)(o,()=>{var e;c.removeListener("close",a),c.removeListener("error",l),null!==(e=this.parent.verifyOptions.rejectUnauthorized)&&void 0!==e&&!e||c.authorized?t({socket:c,secure:!0}):i(c.authorizationError)});c.once("close",a),c.once("error",l)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};class v extends h{constructor(e,t){if(super(),this.channelCredentials=e,this.callCredentials=t,!e._isSecure())throw new Error("Cannot compose insecure credentials")}compose(e){const t=this.callCredentials.compose(e);return new v(this.channelCredentials,t)}_isSecure(){return!0}_equals(e){return this===e||e instanceof v&&(this.channelCredentials._equals(e.channelCredentials)&&this.callCredentials._equals(e.callCredentials))}_createSecureConnector(e,t,i){const n=this.callCredentials.compose(null!=i?i:r.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(e,t,n)}}},6998(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.recognizedOptions=void 0,t.channelOptionsEqual=function(e,t){const i=Object.keys(e).sort(),n=Object.keys(t).sort();if(i.length!==n.length)return!1;for(let r=0;r<i.length;r+=1){if(i[r]!==n[r])return!1;if(e[i[r]]!==t[n[r]])return!1}return!0},t.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc.enable_retries":!0,"grpc.per_rpc_retry_buffer_size":!0,"grpc.retry_buffer_size":!0,"grpc.max_connection_age_ms":!0,"grpc.max_connection_age_grace_ms":!0,"grpc-node.max_session_memory":!0,"grpc.service_config_disable_resolution":!0,"grpc.client_idle_timeout_ms":!0,"grpc-node.tls_enable_trace":!0,"grpc.lb.ring_hash.ring_size_cap":!0,"grpc-node.retry_max_attempts_limit":!0,"grpc-node.flow_control_window":!0,"grpc.server_call_metric_recording":!0}},3653(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelImplementation=void 0;const n=i(7434),r=i(8899);t.ChannelImplementation=class{constructor(e,t,i){if("string"!=typeof e)throw new TypeError("Channel target must be a string");if(!(t instanceof n.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(i&&"object"!=typeof i)throw new TypeError("Channel options must be an object");this.internalChannel=new r.InternalChannel(e,t,i)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(e){return this.internalChannel.getConnectivityState(e)}watchConnectivityState(e,t,i){this.internalChannel.watchConnectivityState(e,t,i)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(e,t,i,n,r){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(e,t,i,n,r)}}},9503(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerChannelzSocket=t.registerChannelzServer=t.registerChannelzSubchannel=t.registerChannelzChannel=t.ChannelzCallTrackerStub=t.ChannelzCallTracker=t.ChannelzChildrenTrackerStub=t.ChannelzChildrenTracker=t.ChannelzTrace=t.ChannelzTraceStub=void 0,t.unregisterChannelzRef=function(e){g[e.kind].eraseElementByKey(e.id)},t.getChannelzHandlers=N,t.getChannelzServiceDefinition=M,t.setup=function(){(0,l.registerAdminService)(M,N)};const n=i(9278),r=i(6787),s=i(463),o=i(131),a=i(8996),l=i(2661),c=i(4056);function u(e){return{channel_id:e.id,name:e.name}}function h(e){return{subchannel_id:e.id,name:e.name}}function d(e){return{socket_id:e.id,name:e.name}}t.ChannelzTraceStub=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:_(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};t.ChannelzTrace=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,t,i){const n=new Date;this.events.push({description:t,severity:e,timestamp:n,childChannel:"channel"===(null==i?void 0:i.kind)?i:void 0,childSubchannel:"subchannel"===(null==i?void 0:i.kind)?i:void 0}),this.events.length>=64&&(this.events=this.events.slice(32)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:_(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:_(e.timestamp),channel_ref:e.childChannel?u(e.childChannel):null,subchannel_ref:e.childSubchannel?h(e.childSubchannel):null}))}}};class f{constructor(){this.channelChildren=new r.OrderedMap,this.subchannelChildren=new r.OrderedMap,this.socketChildren=new r.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){const t=this.trackerMap[e.kind],i=t.find(e.id);i.equals(t.end())?t.setElement(e.id,{ref:e,count:1},i):i.pointer[1].count+=1}unrefChild(e){const t=this.trackerMap[e.kind],i=t.getElementByKey(e.id);void 0!==i&&(i.count-=1,0===i.count&&t.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}}t.ChannelzChildrenTracker=f;t.ChannelzChildrenTrackerStub=class extends f{refChild(){}unrefChild(){}};class p{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}}t.ChannelzCallTracker=p;t.ChannelzCallTrackerStub=class extends p{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};const g={channel:new r.OrderedMap,subchannel:new r.OrderedMap,server:new r.OrderedMap,socket:new r.OrderedMap},m=e=>{let t=1;const i=g[e];return(n,r,s)=>{const o=t++,a={id:o,name:n,kind:e};return s&&i.setElement(o,{ref:a,getInfo:r}),a}};function v(e){if(""===e)return[];const t=e.split(":").map(e=>function(e){const t=Number.parseInt(e,16);return[t/256|0,t%256]}(e));return[].concat(...t)}function y(e){return Buffer.from(Uint8Array.from(e.split(".").map(e=>Number.parseInt(e))))}function b(e){if((0,n.isIPv4)(e))return y(e);if(function(e){return(0,n.isIPv6)(e)&&e.toLowerCase().startsWith("::ffff:")&&(0,n.isIPv4)(e.substring(7))}(e))return y(e.substring(7));if((0,n.isIPv6)(e)){let t,i;const n=e.indexOf("::");-1===n?(t=e,i=""):(t=e.substring(0,n),i=e.substring(n+2));const r=Buffer.from(v(t)),s=Buffer.from(v(i)),o=Buffer.alloc(16-r.length-s.length,0);return Buffer.concat([r,o,s])}return null}function S(e){switch(e){case s.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case s.ConnectivityState.IDLE:return{state:"IDLE"};case s.ConnectivityState.READY:return{state:"READY"};case s.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case s.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function _(e){if(!e)return null;const t=e.getTime();return{seconds:t/1e3|0,nanos:t%1e3*1e6}}function C(e){const t=e.getInfo(),i=[],n=[];return t.children.channels.forEach(e=>{i.push(u(e[1].ref))}),t.children.subchannels.forEach(e=>{n.push(h(e[1].ref))}),{ref:u(e.ref),data:{target:t.target,state:S(t.state),calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:_(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},channel_ref:i,subchannel_ref:n}}function w(e,t){const i=parseInt(e.request.channel_id,10),n=g.channel.getElementByKey(i);void 0!==n?t(null,{channel:C(n)}):t({code:o.Status.NOT_FOUND,details:"No channel data found for id "+i})}function E(e,t){const i=parseInt(e.request.max_results,10)||100,n=[],r=parseInt(e.request.start_channel_id,10),s=g.channel;let o;for(o=s.lowerBound(r);!o.equals(s.end())&&n.length<i;o=o.next())n.push(C(o.pointer[1]));t(null,{channel:n,end:o.equals(s.end())})}function T(e){const t=e.getInfo(),i=[];return t.listenerChildren.sockets.forEach(e=>{i.push(d(e[1].ref))}),{ref:(n=e.ref,{server_id:n.id}),data:{calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:_(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},listen_socket:i};var n}function k(e,t){const i=parseInt(e.request.server_id,10),n=g.server.getElementByKey(i);void 0!==n?t(null,{server:T(n)}):t({code:o.Status.NOT_FOUND,details:"No server data found for id "+i})}function R(e,t){const i=parseInt(e.request.max_results,10)||100,n=parseInt(e.request.start_server_id,10),r=g.server,s=[];let o;for(o=r.lowerBound(n);!o.equals(r.end())&&s.length<i;o=o.next())s.push(T(o.pointer[1]));t(null,{server:s,end:o.equals(r.end())})}function O(e,t){const i=parseInt(e.request.subchannel_id,10),n=g.subchannel.getElementByKey(i);if(void 0===n)return void t({code:o.Status.NOT_FOUND,details:"No subchannel data found for id "+i});const r=n.getInfo(),s=[];r.children.sockets.forEach(e=>{s.push(d(e[1].ref))});t(null,{subchannel:{ref:h(n.ref),data:{target:r.target,state:S(r.state),calls_started:r.callTracker.callsStarted,calls_succeeded:r.callTracker.callsSucceeded,calls_failed:r.callTracker.callsFailed,last_call_started_timestamp:_(r.callTracker.lastCallStartedTimestamp),trace:r.trace.getTraceMessage()},socket_ref:s}})}function P(e){var t;return(0,a.isTcpSubchannelAddress)(e)?{address:"tcpip_address",tcpip_address:{ip_address:null!==(t=b(e.host))&&void 0!==t?t:void 0,port:e.port}}:{address:"uds_address",uds_address:{filename:e.path}}}function A(e,t){var i,n,r,s,a;const l=parseInt(e.request.socket_id,10),c=g.socket.getElementByKey(l);if(void 0===c)return void t({code:o.Status.NOT_FOUND,details:"No socket data found for id "+l});const u=c.getInfo(),h=u.security?{model:"tls",tls:{cipher_suite:u.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:null!==(i=u.security.cipherSuiteStandardName)&&void 0!==i?i:void 0,other_name:null!==(n=u.security.cipherSuiteOtherName)&&void 0!==n?n:void 0,local_certificate:null!==(r=u.security.localCertificate)&&void 0!==r?r:void 0,remote_certificate:null!==(s=u.security.remoteCertificate)&&void 0!==s?s:void 0}}:null;t(null,{socket:{ref:d(c.ref),local:u.localAddress?P(u.localAddress):null,remote:u.remoteAddress?P(u.remoteAddress):null,remote_name:null!==(a=u.remoteName)&&void 0!==a?a:void 0,security:h,data:{keep_alives_sent:u.keepAlivesSent,streams_started:u.streamsStarted,streams_succeeded:u.streamsSucceeded,streams_failed:u.streamsFailed,last_local_stream_created_timestamp:_(u.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:_(u.lastRemoteStreamCreatedTimestamp),messages_received:u.messagesReceived,messages_sent:u.messagesSent,last_message_received_timestamp:_(u.lastMessageReceivedTimestamp),last_message_sent_timestamp:_(u.lastMessageSentTimestamp),local_flow_control_window:u.localFlowControlWindow?{value:u.localFlowControlWindow}:null,remote_flow_control_window:u.remoteFlowControlWindow?{value:u.remoteFlowControlWindow}:null}}})}function x(e,t){const i=parseInt(e.request.server_id,10),n=g.server.getElementByKey(i);if(void 0===n)return void t({code:o.Status.NOT_FOUND,details:"No server data found for id "+i});const r=parseInt(e.request.start_socket_id,10),s=parseInt(e.request.max_results,10)||100,a=n.getInfo().sessionChildren.sockets,l=[];let c;for(c=a.lowerBound(r);!c.equals(a.end())&&l.length<s;c=c.next())l.push(d(c.pointer[1].ref));t(null,{socket_ref:l,end:c.equals(a.end())})}function N(){return{GetChannel:w,GetTopChannels:E,GetServer:k,GetServers:R,GetSubchannel:O,GetSocket:A,GetServerSockets:x}}t.registerChannelzChannel=m("channel"),t.registerChannelzSubchannel=m("subchannel"),t.registerChannelzServer=m("server"),t.registerChannelzSocket=m("socket");let I=null;function M(){if(I)return I;const e=(0,i(5085).Yi)("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]}),t=(0,c.loadPackageDefinition)(e);return I=t.grpc.channelz.v1.Channelz.service,I}},3952(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InterceptingCall=t.RequesterBuilder=t.ListenerBuilder=t.InterceptorConfigurationError=void 0,t.getInterceptingCall=function(e,t,i,n){if(e.clientInterceptors.length>0&&e.clientInterceptorProviders.length>0)throw new a("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(e.callInterceptors.length>0&&e.callInterceptorProviders.length>0)throw new a("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let r=[];r=e.callInterceptors.length>0||e.callInterceptorProviders.length>0?[].concat(e.callInterceptors,e.callInterceptorProviders.map(e=>e(t))).filter(e=>e):[].concat(e.clientInterceptors,e.clientInterceptorProviders.map(e=>e(t))).filter(e=>e);const s=Object.assign({},i,{method_definition:t}),o=r.reduceRight((e,t)=>i=>t(i,e),e=>f(n,e,t));return o(s)};const n=i(4097),r=i(5034),s=i(131),o=i(9752);class a extends Error{constructor(e){super(e),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,a)}}t.InterceptorConfigurationError=a;t.ListenerBuilder=class{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveStatus(e){return this.status=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}};t.RequesterBuilder=class{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(e){return this.start=e,this}withSendMessage(e){return this.message=e,this}withHalfClose(e){return this.halfClose=e,this}withCancel(e){return this.cancel=e,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}};const l={onReceiveMetadata:(e,t)=>{t(e)},onReceiveMessage:(e,t)=>{t(e)},onReceiveStatus:(e,t)=>{t(e)}},c={start:(e,t,i)=>{i(e,t)},sendMessage:(e,t)=>{t(e)},halfClose:e=>{e()},cancel:e=>{e()}};t.InterceptingCall=class{constructor(e,t){var i,n,r,s;this.nextCall=e,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,this.requester=t?{start:null!==(i=t.start)&&void 0!==i?i:c.start,sendMessage:null!==(n=t.sendMessage)&&void 0!==n?n:c.sendMessage,halfClose:null!==(r=t.halfClose)&&void 0!==r?r:c.halfClose,cancel:null!==(s=t.cancel)&&void 0!==s?s:c.cancel}:c}cancelWithStatus(e,t){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(e,t)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){this.pendingMessageContext&&(this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null)}processPendingHalfClose(){this.pendingHalfClose&&this.nextCall.halfClose()}start(e,t){var i,n,s,o,a,c;const u={onReceiveMetadata:null!==(n=null===(i=null==t?void 0:t.onReceiveMetadata)||void 0===i?void 0:i.bind(t))&&void 0!==n?n:e=>{},onReceiveMessage:null!==(o=null===(s=null==t?void 0:t.onReceiveMessage)||void 0===s?void 0:s.bind(t))&&void 0!==o?o:e=>{},onReceiveStatus:null!==(c=null===(a=null==t?void 0:t.onReceiveStatus)||void 0===a?void 0:a.bind(t))&&void 0!==c?c:e=>{}};this.processingMetadata=!0,this.requester.start(e,u,(e,t)=>{var i,n,s;let o;if(this.processingMetadata=!1,(0,r.isInterceptingListener)(t))o=t;else{const e={onReceiveMetadata:null!==(i=t.onReceiveMetadata)&&void 0!==i?i:l.onReceiveMetadata,onReceiveMessage:null!==(n=t.onReceiveMessage)&&void 0!==n?n:l.onReceiveMessage,onReceiveStatus:null!==(s=t.onReceiveStatus)&&void 0!==s?s:l.onReceiveStatus};o=new r.InterceptingListenerImpl(e,u)}this.nextCall.start(e,o),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(e,t){this.processingMessage=!0,this.requester.sendMessage(t,i=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessageContext=e,this.pendingMessage=t):(this.nextCall.sendMessageWithContext(e,i),this.processPendingHalfClose())})}sendMessage(e){this.sendMessageWithContext({},e)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{this.processingMetadata||this.processingMessage?this.pendingHalfClose=!0:this.nextCall.halfClose()})}getAuthContext(){return this.nextCall.getAuthContext()}};class u{constructor(e,t){this.call=e,this.methodDefinition=t}cancelWithStatus(e,t){this.call.cancelWithStatus(e,t)}getPeer(){return this.call.getPeer()}sendMessageWithContext(e,t){let i;try{i=this.methodDefinition.requestSerialize(t)}catch(e){return void this.call.cancelWithStatus(s.Status.INTERNAL,`Request message serialization failure: ${(0,o.getErrorMessage)(e)}`)}this.call.sendMessageWithContext(e,i)}sendMessage(e){this.sendMessageWithContext({},e)}start(e,t){let i=null;this.call.start(e,{onReceiveMetadata:e=>{var i;null===(i=null==t?void 0:t.onReceiveMetadata)||void 0===i||i.call(t,e)},onReceiveMessage:e=>{var r;let a;try{a=this.methodDefinition.responseDeserialize(e)}catch(e){return i={code:s.Status.INTERNAL,details:`Response message parsing error: ${(0,o.getErrorMessage)(e)}`,metadata:new n.Metadata},void this.call.cancelWithStatus(i.code,i.details)}null===(r=null==t?void 0:t.onReceiveMessage)||void 0===r||r.call(t,a)},onReceiveStatus:e=>{var n,r;i?null===(n=null==t?void 0:t.onReceiveStatus)||void 0===n||n.call(t,i):null===(r=null==t?void 0:t.onReceiveStatus)||void 0===r||r.call(t,e)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}getAuthContext(){return this.call.getAuthContext()}}class h extends u{constructor(e,t){super(e,t)}start(e,t){var i,n;let r=!1;const s={onReceiveMetadata:null!==(n=null===(i=null==t?void 0:t.onReceiveMetadata)||void 0===i?void 0:i.bind(t))&&void 0!==n?n:e=>{},onReceiveMessage:e=>{var i;r=!0,null===(i=null==t?void 0:t.onReceiveMessage)||void 0===i||i.call(t,e)},onReceiveStatus:e=>{var i,n;r||null===(i=null==t?void 0:t.onReceiveMessage)||void 0===i||i.call(t,null),null===(n=null==t?void 0:t.onReceiveStatus)||void 0===n||n.call(t,e)}};super.start(e,s),this.call.startRead()}}class d extends u{}function f(e,t,i){const n=function(e,t,i){var n,r;const s=null!==(n=i.deadline)&&void 0!==n?n:1/0,o=i.host,a=null!==(r=i.parent)&&void 0!==r?r:null,l=i.propagate_flags,c=i.credentials,u=e.createCall(t,s,o,a,l);return c&&u.setCredentials(c),u}(e,i.path,t);return i.responseStream?new d(n,i):new h(n,i)}},5563(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0;const n=i(1544),r=i(3653),s=i(463),o=i(131),a=i(4097),l=i(3952),c=Symbol(),u=Symbol(),h=Symbol(),d=Symbol();function f(e){return"function"==typeof e}function p(e){var t;return(null===(t=e.stack)||void 0===t?void 0:t.split("\n").slice(1).join("\n"))||"no stack trace available"}t.Client=class{constructor(e,t,i={}){var n,s;if(i=Object.assign({},i),this[u]=null!==(n=i.interceptors)&&void 0!==n?n:[],delete i.interceptors,this[h]=null!==(s=i.interceptor_providers)&&void 0!==s?s:[],delete i.interceptor_providers,this[u].length>0&&this[h].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[d]=i.callInvocationTransformer,delete i.callInvocationTransformer,i.channelOverride)this[c]=i.channelOverride;else if(i.channelFactoryOverride){const n=i.channelFactoryOverride;delete i.channelFactoryOverride,this[c]=n(e,t,i)}else this[c]=new r.ChannelImplementation(e,t,i)}close(){this[c].close()}getChannel(){return this[c]}waitForReady(e,t){const i=n=>{if(n)return void t(new Error("Failed to connect before the deadline"));let r;try{r=this[c].getConnectivityState(!0)}catch(e){return void t(new Error("The channel has been closed"))}if(r===s.ConnectivityState.READY)t();else try{this[c].watchConnectivityState(r,e,i)}catch(e){t(new Error("The channel has been closed"))}};setImmediate(i)}checkOptionalUnaryResponseArguments(e,t,i){if(f(e))return{metadata:new a.Metadata,options:{},callback:e};if(f(t))return e instanceof a.Metadata?{metadata:e,options:{},callback:t}:{metadata:new a.Metadata,options:e,callback:t};if(!(e instanceof a.Metadata&&t instanceof Object&&f(i)))throw new Error("Incorrect arguments passed");return{metadata:e,options:t,callback:i}}makeUnaryRequest(e,t,i,r,s,a,f){var g,m;const v=this.checkOptionalUnaryResponseArguments(s,a,f),y={path:e,requestStream:!1,responseStream:!1,requestSerialize:t,responseDeserialize:i};let b={argument:r,metadata:v.metadata,call:new n.ClientUnaryCallImpl,channel:this[c],methodDefinition:y,callOptions:v.options,callback:v.callback};this[d]&&(b=this[d](b));const S=b.call,_={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(g=b.callOptions.interceptors)&&void 0!==g?g:[],callInterceptorProviders:null!==(m=b.callOptions.interceptor_providers)&&void 0!==m?m:[]},C=(0,l.getInterceptingCall)(_,b.methodDefinition,b.callOptions,b.channel);S.call=C;let w=null,E=!1,T=new Error;return C.start(b.metadata,{onReceiveMetadata:e=>{S.emit("metadata",e)},onReceiveMessage(e){null!==w&&C.cancelWithStatus(o.Status.UNIMPLEMENTED,"Too many responses received"),w=e},onReceiveStatus(e){if(!E){if(E=!0,e.code===o.Status.OK)if(null===w){const t=p(T);b.callback((0,n.callErrorFromStatus)({code:o.Status.UNIMPLEMENTED,details:"No message received",metadata:e.metadata},t))}else b.callback(null,w);else{const t=p(T);b.callback((0,n.callErrorFromStatus)(e,t))}T=null,S.emit("status",e)}}}),C.sendMessage(r),C.halfClose(),S}makeClientStreamRequest(e,t,i,r,s,a){var f,g;const m=this.checkOptionalUnaryResponseArguments(r,s,a),v={path:e,requestStream:!0,responseStream:!1,requestSerialize:t,responseDeserialize:i};let y={metadata:m.metadata,call:new n.ClientWritableStreamImpl(t),channel:this[c],methodDefinition:v,callOptions:m.options,callback:m.callback};this[d]&&(y=this[d](y));const b=y.call,S={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(f=y.callOptions.interceptors)&&void 0!==f?f:[],callInterceptorProviders:null!==(g=y.callOptions.interceptor_providers)&&void 0!==g?g:[]},_=(0,l.getInterceptingCall)(S,y.methodDefinition,y.callOptions,y.channel);b.call=_;let C=null,w=!1,E=new Error;return _.start(y.metadata,{onReceiveMetadata:e=>{b.emit("metadata",e)},onReceiveMessage(e){null!==C&&_.cancelWithStatus(o.Status.UNIMPLEMENTED,"Too many responses received"),C=e,_.startRead()},onReceiveStatus(e){if(!w){if(w=!0,e.code===o.Status.OK)if(null===C){const t=p(E);y.callback((0,n.callErrorFromStatus)({code:o.Status.UNIMPLEMENTED,details:"No message received",metadata:e.metadata},t))}else y.callback(null,C);else{const t=p(E);y.callback((0,n.callErrorFromStatus)(e,t))}E=null,b.emit("status",e)}}}),b}checkMetadataAndOptions(e,t){let i,n;return e instanceof a.Metadata?(i=e,n=t||{}):(n=e||{},i=new a.Metadata),{metadata:i,options:n}}makeServerStreamRequest(e,t,i,r,s,a){var f,g;const m=this.checkMetadataAndOptions(s,a),v={path:e,requestStream:!1,responseStream:!0,requestSerialize:t,responseDeserialize:i};let y={argument:r,metadata:m.metadata,call:new n.ClientReadableStreamImpl(i),channel:this[c],methodDefinition:v,callOptions:m.options};this[d]&&(y=this[d](y));const b=y.call,S={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(f=y.callOptions.interceptors)&&void 0!==f?f:[],callInterceptorProviders:null!==(g=y.callOptions.interceptor_providers)&&void 0!==g?g:[]},_=(0,l.getInterceptingCall)(S,y.methodDefinition,y.callOptions,y.channel);b.call=_;let C=!1,w=new Error;return _.start(y.metadata,{onReceiveMetadata(e){b.emit("metadata",e)},onReceiveMessage(e){b.push(e)},onReceiveStatus(e){if(!C){if(C=!0,b.push(null),e.code!==o.Status.OK){const t=p(w);b.emit("error",(0,n.callErrorFromStatus)(e,t))}w=null,b.emit("status",e)}}}),_.sendMessage(r),_.halfClose(),b}makeBidiStreamRequest(e,t,i,r,s){var a,f;const g=this.checkMetadataAndOptions(r,s),m={path:e,requestStream:!0,responseStream:!0,requestSerialize:t,responseDeserialize:i};let v={metadata:g.metadata,call:new n.ClientDuplexStreamImpl(t,i),channel:this[c],methodDefinition:m,callOptions:g.options};this[d]&&(v=this[d](v));const y=v.call,b={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(a=v.callOptions.interceptors)&&void 0!==a?a:[],callInterceptorProviders:null!==(f=v.callOptions.interceptor_providers)&&void 0!==f?f:[]},S=(0,l.getInterceptingCall)(b,v.methodDefinition,v.callOptions,v.channel);y.call=S;let _=!1,C=new Error;return S.start(v.metadata,{onReceiveMetadata(e){y.emit("metadata",e)},onReceiveMessage(e){y.push(e)},onReceiveStatus(e){if(!_){if(_=!0,y.push(null),e.code!==o.Status.OK){const t=p(C);y.emit("error",(0,n.callErrorFromStatus)(e,t))}C=null,y.emit("status",e)}}}),y}}},5179(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.CompressionAlgorithms=void 0,function(e){e[e.identity=0]="identity",e[e.deflate=1]="deflate",e[e.gzip=2]="gzip"}(i||(t.CompressionAlgorithms=i={}))},4987(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompressionFilterFactory=t.CompressionFilter=void 0;const n=i(3106),r=i(5179),s=i(131),o=i(2558),a=i(267);class l{async writeMessage(e,t){let i=e;t&&(i=await this.compressMessage(i));const n=Buffer.allocUnsafe(i.length+5);return n.writeUInt8(t?1:0,0),n.writeUInt32BE(i.length,1),i.copy(n,5),n}async readMessage(e){const t=1===e.readUInt8(0);let i=e.slice(5);return t&&(i=await this.decompressMessage(i)),i}}class c extends l{async compressMessage(e){return e}async writeMessage(e,t){const i=Buffer.allocUnsafe(e.length+5);return i.writeUInt8(0,0),i.writeUInt32BE(e.length,1),e.copy(i,5),i}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}}class u extends l{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,i)=>{n.deflate(e,(e,n)=>{e?i(e):t(n)})})}decompressMessage(e){return new Promise((t,i)=>{let r=0;const o=[],a=n.createInflate();a.on("data",e=>{o.push(e),r+=e.byteLength,-1!==this.maxRecvMessageLength&&r>this.maxRecvMessageLength&&(a.destroy(),i({code:s.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),a.on("end",()=>{t(Buffer.concat(o))}),a.write(e),a.end()})}}class h extends l{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,i)=>{n.gzip(e,(e,n)=>{e?i(e):t(n)})})}decompressMessage(e){return new Promise((t,i)=>{let r=0;const o=[],a=n.createGunzip();a.on("data",e=>{o.push(e),r+=e.byteLength,-1!==this.maxRecvMessageLength&&r>this.maxRecvMessageLength&&(a.destroy(),i({code:s.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),a.on("end",()=>{t(Buffer.concat(o))}),a.write(e),a.end()})}}class d extends l{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}}function f(e,t){switch(e){case"identity":return new c;case"deflate":return new u(t);case"gzip":return new h(t);default:return new d(e)}}class p extends o.BaseFilter{constructor(e,t){var i,n,o;super(),this.sharedFilterConfig=t,this.sendCompression=new c,this.receiveCompression=new c,this.currentCompressionAlgorithm="identity";const l=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=null!==(i=e["grpc.max_receive_message_length"])&&void 0!==i?i:s.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=null!==(n=e["grpc.max_send_message_length"])&&void 0!==n?n:s.DEFAULT_MAX_SEND_MESSAGE_LENGTH,void 0!==l)if("number"==typeof(u=l)&&"string"==typeof r.CompressionAlgorithms[u]){const e=r.CompressionAlgorithms[l],i=null===(o=t.serverSupportedEncodingHeader)||void 0===o?void 0:o.split(",");i&&!i.includes(e)||(this.currentCompressionAlgorithm=e,this.sendCompression=f(this.currentCompressionAlgorithm,-1))}else a.log(s.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${l}`);var u}async sendMetadata(e){const t=await e;return t.set("grpc-accept-encoding","identity,deflate,gzip"),t.set("accept-encoding","identity"),"identity"===this.currentCompressionAlgorithm?t.remove("grpc-encoding"):t.set("grpc-encoding",this.currentCompressionAlgorithm),t}receiveMetadata(e){const t=e.get("grpc-encoding");if(t.length>0){const e=t[0];"string"==typeof e&&(this.receiveCompression=f(e,this.maxReceiveMessageLength))}e.remove("grpc-encoding");const i=e.get("grpc-accept-encoding")[0];if(i){this.sharedFilterConfig.serverSupportedEncodingHeader=i;i.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new c,this.currentCompressionAlgorithm="identity")}return e.remove("grpc-accept-encoding"),e}async sendMessage(e){var t;const i=await e;if(-1!==this.maxSendMessageLength&&i.message.length>this.maxSendMessageLength)throw{code:s.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let n;return n=!(this.sendCompression instanceof c)&&!(2&(null!==(t=i.flags)&&void 0!==t?t:0)),{message:await this.sendCompression.writeMessage(i.message,n),flags:i.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}}t.CompressionFilter=p;t.CompressionFilterFactory=class{constructor(e,t){this.options=t,this.sharedFilterConfig={}}createFilter(){return new p(this.options,this.sharedFilterConfig)}}},463(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectivityState=void 0,function(e){e[e.IDLE=0]="IDLE",e[e.CONNECTING=1]="CONNECTING",e[e.READY=2]="READY",e[e.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",e[e.SHUTDOWN=4]="SHUTDOWN"}(i||(t.ConnectivityState=i={}))},131(e,t){"use strict";var i,n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=t.DEFAULT_MAX_SEND_MESSAGE_LENGTH=t.Propagate=t.LogVerbosity=t.Status=void 0,function(e){e[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.ALREADY_EXISTS=6]="ALREADY_EXISTS",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",e[e.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",e[e.ABORTED=10]="ABORTED",e[e.OUT_OF_RANGE=11]="OUT_OF_RANGE",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.DATA_LOSS=15]="DATA_LOSS",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED"}(i||(t.Status=i={})),function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.ERROR=2]="ERROR",e[e.NONE=3]="NONE"}(n||(t.LogVerbosity=n={})),function(e){e[e.DEADLINE=1]="DEADLINE",e[e.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",e[e.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",e[e.CANCELLATION=8]="CANCELLATION",e[e.DEFAULTS=65535]="DEFAULTS"}(r||(t.Propagate=r={})),t.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1,t.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4194304},6067(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.restrictControlPlaneStatusCode=function(e,t){return r.includes(e)?{code:n.Status.INTERNAL,details:`Invalid status from control plane: ${e} ${n.Status[e]} ${t}`}:{code:e,details:t}};const n=i(131),r=[n.Status.OK,n.Status.INVALID_ARGUMENT,n.Status.NOT_FOUND,n.Status.ALREADY_EXISTS,n.Status.FAILED_PRECONDITION,n.Status.ABORTED,n.Status.OUT_OF_RANGE,n.Status.DATA_LOSS]},6308(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.minDeadline=function(...e){let t=1/0;for(const i of e){const e=i instanceof Date?i.getTime():i;e<t&&(t=e)}return t},t.getDeadlineTimeoutString=function(e){const t=(new Date).getTime();e instanceof Date&&(e=e.getTime());const n=Math.max(e-t,0);for(const[e,t]of i){const i=n/t;if(i<1e8)return String(Math.ceil(i))+e}throw new Error("Deadline is too far in the future")},t.getRelativeTimeout=function(e){const t=e instanceof Date?e.getTime():e,i=(new Date).getTime(),n=t-i;return n<0?0:n>2147483647?1/0:n},t.deadlineToString=function(e){if(e instanceof Date)return e.toISOString();{const t=new Date(e);return Number.isNaN(t.getTime())?""+e:t.toISOString()}},t.formatDateDifference=function(e,t){return((t.getTime()-e.getTime())/1e3).toFixed(3)+"s"};const i=[["m",1],["S",1e3],["M",6e4],["H",36e5]]},4700(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.durationMessageToDuration=function(e){return{seconds:Number.parseInt(e.seconds),nanos:e.nanos}},t.msToDuration=function(e){return{seconds:e/1e3|0,nanos:e%1e3*1e6|0}},t.durationToMs=function(e){return 1e3*e.seconds+e.nanos/1e6|0},t.isDuration=function(e){return"number"==typeof e.seconds&&"number"==typeof e.nanos},t.isDurationMessage=function(e){return"string"==typeof e.seconds&&"number"==typeof e.nanos},t.parseDuration=function(e){const t=e.match(i);if(!t)return null;return{seconds:Number.parseInt(t[1],10),nanos:t[2]?Number.parseInt(t[2].padEnd(9,"0"),10):0}},t.durationToString=function(e){if(0===e.nanos)return`${e.seconds}s`;let t;t=e.nanos%1e6==0?1e6:e.nanos%1e3==0?1e3:1;return`${e.seconds}.${e.nanos/t}s`};const i=/^(\d+)(?:\.(\d+))?s$/},883(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0,t.GRPC_NODE_USE_ALTERNATIVE_RESOLVER="true"===(null!==(i=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)&&void 0!==i?i:"false")},9752(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorMessage=function(e){return e instanceof Error?e.message:String(e)},t.getErrorCode=function(e){return"object"==typeof e&&null!==e&&"code"in e&&"number"==typeof e.code?e.code:null}},342(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=t.createCertificateProviderChannelCredentials=t.FileWatcherCertificateProvider=t.createCertificateProviderServerCredentials=t.createServerCredentialsWithInterceptors=t.BaseSubchannelWrapper=t.registerAdminService=t.FilterStackFactory=t.BaseFilter=t.statusOrFromError=t.statusOrFromValue=t.PickResultType=t.QueuePicker=t.UnavailablePicker=t.ChildLoadBalancerHandler=t.EndpointMap=t.endpointHasAddress=t.endpointToString=t.subchannelAddressToString=t.LeafLoadBalancer=t.isLoadBalancerNameRegistered=t.parseLoadBalancingConfig=t.selectLbConfigFromList=t.registerLoadBalancerType=t.createChildChannelControlHelper=t.BackoffTimeout=t.parseDuration=t.durationToMs=t.splitHostPort=t.uriToString=t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=t.createResolver=t.registerResolver=t.log=t.trace=void 0;var n=i(267);Object.defineProperty(t,"trace",{enumerable:!0,get:function(){return n.trace}}),Object.defineProperty(t,"log",{enumerable:!0,get:function(){return n.log}});var r=i(9302);Object.defineProperty(t,"registerResolver",{enumerable:!0,get:function(){return r.registerResolver}}),Object.defineProperty(t,"createResolver",{enumerable:!0,get:function(){return r.createResolver}}),Object.defineProperty(t,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return r.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var s=i(3822);Object.defineProperty(t,"uriToString",{enumerable:!0,get:function(){return s.uriToString}}),Object.defineProperty(t,"splitHostPort",{enumerable:!0,get:function(){return s.splitHostPort}});var o=i(4700);Object.defineProperty(t,"durationToMs",{enumerable:!0,get:function(){return o.durationToMs}}),Object.defineProperty(t,"parseDuration",{enumerable:!0,get:function(){return o.parseDuration}});var a=i(3956);Object.defineProperty(t,"BackoffTimeout",{enumerable:!0,get:function(){return a.BackoffTimeout}});var l=i(8923);Object.defineProperty(t,"createChildChannelControlHelper",{enumerable:!0,get:function(){return l.createChildChannelControlHelper}}),Object.defineProperty(t,"registerLoadBalancerType",{enumerable:!0,get:function(){return l.registerLoadBalancerType}}),Object.defineProperty(t,"selectLbConfigFromList",{enumerable:!0,get:function(){return l.selectLbConfigFromList}}),Object.defineProperty(t,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return l.parseLoadBalancingConfig}}),Object.defineProperty(t,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return l.isLoadBalancerNameRegistered}});var c=i(6486);Object.defineProperty(t,"LeafLoadBalancer",{enumerable:!0,get:function(){return c.LeafLoadBalancer}});var u=i(8996);Object.defineProperty(t,"subchannelAddressToString",{enumerable:!0,get:function(){return u.subchannelAddressToString}}),Object.defineProperty(t,"endpointToString",{enumerable:!0,get:function(){return u.endpointToString}}),Object.defineProperty(t,"endpointHasAddress",{enumerable:!0,get:function(){return u.endpointHasAddress}}),Object.defineProperty(t,"EndpointMap",{enumerable:!0,get:function(){return u.EndpointMap}});var h=i(533);Object.defineProperty(t,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return h.ChildLoadBalancerHandler}});var d=i(178);Object.defineProperty(t,"UnavailablePicker",{enumerable:!0,get:function(){return d.UnavailablePicker}}),Object.defineProperty(t,"QueuePicker",{enumerable:!0,get:function(){return d.QueuePicker}}),Object.defineProperty(t,"PickResultType",{enumerable:!0,get:function(){return d.PickResultType}});var f=i(5034);Object.defineProperty(t,"statusOrFromValue",{enumerable:!0,get:function(){return f.statusOrFromValue}}),Object.defineProperty(t,"statusOrFromError",{enumerable:!0,get:function(){return f.statusOrFromError}});var p=i(2558);Object.defineProperty(t,"BaseFilter",{enumerable:!0,get:function(){return p.BaseFilter}});var g=i(1703);Object.defineProperty(t,"FilterStackFactory",{enumerable:!0,get:function(){return g.FilterStackFactory}});var m=i(2661);Object.defineProperty(t,"registerAdminService",{enumerable:!0,get:function(){return m.registerAdminService}});var v=i(2379);Object.defineProperty(t,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return v.BaseSubchannelWrapper}});var y=i(8692);Object.defineProperty(t,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return y.createServerCredentialsWithInterceptors}}),Object.defineProperty(t,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return y.createCertificateProviderServerCredentials}});var b=i(5819);Object.defineProperty(t,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return b.FileWatcherCertificateProvider}});var S=i(7434);Object.defineProperty(t,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return S.createCertificateProviderChannelCredentials}});var _=i(8899);Object.defineProperty(t,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return _.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})},1703(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilterStackFactory=t.FilterStack=void 0;class i{constructor(e){this.filters=e}sendMetadata(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMetadata(t);return t}receiveMetadata(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMetadata(t);return t}sendMessage(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMessage(t);return t}receiveMessage(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMessage(t);return t}receiveTrailers(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveTrailers(t);return t}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}}t.FilterStack=i;class n{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new n([...this.factories])}createFilter(){return new i(this.factories.map(e=>e.createFilter()))}}t.FilterStackFactory=n},2558(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseFilter=void 0;t.BaseFilter=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}}},7803(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseCIDR=f,t.mapProxyName=function(e,t){var i;const o={target:e,extraOptions:{}};if(0===(null!==(i=t["grpc.enable_http_proxy"])&&void 0!==i?i:1))return o;if("unix"===e.scheme)return o;const a=function(){let e,t="",i="";if(process.env.grpc_proxy)i="grpc_proxy",t=process.env.grpc_proxy;else if(process.env.https_proxy)i="https_proxy",t=process.env.https_proxy;else{if(!process.env.http_proxy)return{};i="http_proxy",t=process.env.http_proxy}try{e=new u.URL(t)}catch(e){return(0,n.log)(r.LogVerbosity.ERROR,`cannot parse value of "${i}" env var`),{}}if("http:"!==e.protocol)return(0,n.log)(r.LogVerbosity.ERROR,`"${e.protocol}" scheme not supported in proxy URI`),{};let s=null;e.username&&(e.password?((0,n.log)(r.LogVerbosity.INFO,"userinfo found in proxy URI"),s=decodeURIComponent(`${e.username}:${e.password}`)):s=e.username);const o=e.hostname;let a=e.port;""===a&&(a="80");const l={address:`${o}:${a}`};s&&(l.creds=s);return d("Proxy server "+l.address+" set by environment variable "+i),l}();if(!a.address)return o;const l=(0,c.splitHostPort)(e.path);if(!l)return o;if(function(e){for(const t of function(){let e=process.env.no_grpc_proxy,t="no_grpc_proxy";e||(e=process.env.no_proxy,t="no_proxy");return e?(d("No proxy server list set by environment variable "+t),e.split(",")):[]}()){const i=f(t);if((0,s.isIPv4)(e)&&i&&g(i,e))return!0;if(e.endsWith(t))return!0}return!1}(l.host))return d("Not using proxy for target in no_proxy list: "+(0,c.uriToString)(e)),o;const h={"grpc.http_connect_target":(0,c.uriToString)(e)};a.creds&&(h["grpc.http_connect_creds"]=a.creds);return{target:{scheme:"dns",path:a.address},extraOptions:h}},t.getProxiedConnection=function(e,t){var i;if(!("grpc.http_connect_target"in t))return Promise.resolve(null);const s=t["grpc.http_connect_target"],a=(0,c.parseUri)(s);if(null===a)return Promise.resolve(null);const u=(0,c.splitHostPort)(a.path);if(null===u)return Promise.resolve(null);const f=`${u.host}:${null!==(i=u.port)&&void 0!==i?i:h.DEFAULT_PORT}`,p={method:"CONNECT",path:f},g={Host:f};(0,l.isTcpSubchannelAddress)(e)?(p.host=e.host,p.port=e.port):p.socketPath=e.path;"grpc.http_connect_creds"in t&&(g["Proxy-Authorization"]="Basic "+Buffer.from(t["grpc.http_connect_creds"]).toString("base64"));p.headers=g;const m=(0,l.subchannelAddressToString)(e);return d("Using proxy "+m+" to connect to "+p.path),new Promise((e,t)=>{const i=o.request(p);i.once("connect",(s,o,a)=>{i.removeAllListeners(),o.removeAllListeners(),200===s.statusCode?(d("Successfully connected to "+p.path+" through proxy "+m),a.length>0&&o.unshift(a),d("Successfully established a plaintext connection to "+p.path+" through proxy "+m),e(o)):((0,n.log)(r.LogVerbosity.ERROR,"Failed to connect to "+p.path+" through proxy "+m+" with status "+s.statusCode),t())}),i.once("error",e=>{i.removeAllListeners(),(0,n.log)(r.LogVerbosity.ERROR,"Failed to connect to proxy "+m+" with error "+e.message),t()}),i.end()})};const n=i(267),r=i(131),s=i(9278),o=i(8611),a=i(267),l=i(8996),c=i(3822),u=i(7016),h=i(6700);function d(e){a.trace(r.LogVerbosity.DEBUG,"proxy",e)}function f(e){const t=e.split("/");if(2!==t.length)return null;const i=parseInt(t[1],10);return!(0,s.isIPv4)(t[0])||Number.isNaN(i)||i<0||i>32?null:{ip:p(t[0]),prefixLength:i}}function p(e){return e.split(".").reduce((e,t)=>(e<<8)+parseInt(t,10),0)}function g(e,t){const i=e.ip,n=-1<<32-e.prefixLength;return(p(t)&n)===(i&n)}},674(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.experimental=t.ServerMetricRecorder=t.ServerInterceptingCall=t.ResponderBuilder=t.ServerListenerBuilder=t.addAdminServicesToServer=t.getChannelzHandlers=t.getChannelzServiceDefinition=t.InterceptorConfigurationError=t.InterceptingCall=t.RequesterBuilder=t.ListenerBuilder=t.StatusBuilder=t.getClientChannel=t.ServerCredentials=t.Server=t.setLogVerbosity=t.setLogger=t.load=t.loadObject=t.CallCredentials=t.ChannelCredentials=t.waitForClientReady=t.closeClient=t.Channel=t.makeGenericClientConstructor=t.makeClientConstructor=t.loadPackageDefinition=t.Client=t.compressionAlgorithms=t.propagate=t.connectivityState=t.status=t.logVerbosity=t.Metadata=t.credentials=void 0;const n=i(2267);Object.defineProperty(t,"CallCredentials",{enumerable:!0,get:function(){return n.CallCredentials}});const r=i(3653);Object.defineProperty(t,"Channel",{enumerable:!0,get:function(){return r.ChannelImplementation}});const s=i(5179);Object.defineProperty(t,"compressionAlgorithms",{enumerable:!0,get:function(){return s.CompressionAlgorithms}});const o=i(463);Object.defineProperty(t,"connectivityState",{enumerable:!0,get:function(){return o.ConnectivityState}});const a=i(7434);Object.defineProperty(t,"ChannelCredentials",{enumerable:!0,get:function(){return a.ChannelCredentials}});const l=i(5563);Object.defineProperty(t,"Client",{enumerable:!0,get:function(){return l.Client}});const c=i(131);Object.defineProperty(t,"logVerbosity",{enumerable:!0,get:function(){return c.LogVerbosity}}),Object.defineProperty(t,"status",{enumerable:!0,get:function(){return c.Status}}),Object.defineProperty(t,"propagate",{enumerable:!0,get:function(){return c.Propagate}});const u=i(267),h=i(4056);Object.defineProperty(t,"loadPackageDefinition",{enumerable:!0,get:function(){return h.loadPackageDefinition}}),Object.defineProperty(t,"makeClientConstructor",{enumerable:!0,get:function(){return h.makeClientConstructor}}),Object.defineProperty(t,"makeGenericClientConstructor",{enumerable:!0,get:function(){return h.makeClientConstructor}});const d=i(4097);Object.defineProperty(t,"Metadata",{enumerable:!0,get:function(){return d.Metadata}});const f=i(5943);Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return f.Server}});const p=i(8692);Object.defineProperty(t,"ServerCredentials",{enumerable:!0,get:function(){return p.ServerCredentials}});const g=i(2284);Object.defineProperty(t,"StatusBuilder",{enumerable:!0,get:function(){return g.StatusBuilder}}),t.credentials={combineChannelCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),combineCallCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),createInsecure:a.ChannelCredentials.createInsecure,createSsl:a.ChannelCredentials.createSsl,createFromSecureContext:a.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:n.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:n.CallCredentials.createFromGoogleCredential,createEmpty:n.CallCredentials.createEmpty};t.closeClient=e=>e.close();t.waitForClientReady=(e,t,i)=>e.waitForReady(t,i);t.loadObject=(e,t)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};t.load=(e,t,i)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};t.setLogger=e=>{u.setLogger(e)};t.setLogVerbosity=e=>{u.setLoggerVerbosity(e)};t.getClientChannel=e=>l.Client.prototype.getChannel.call(e);var m=i(3952);Object.defineProperty(t,"ListenerBuilder",{enumerable:!0,get:function(){return m.ListenerBuilder}}),Object.defineProperty(t,"RequesterBuilder",{enumerable:!0,get:function(){return m.RequesterBuilder}}),Object.defineProperty(t,"InterceptingCall",{enumerable:!0,get:function(){return m.InterceptingCall}}),Object.defineProperty(t,"InterceptorConfigurationError",{enumerable:!0,get:function(){return m.InterceptorConfigurationError}});var v=i(9503);Object.defineProperty(t,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return v.getChannelzServiceDefinition}}),Object.defineProperty(t,"getChannelzHandlers",{enumerable:!0,get:function(){return v.getChannelzHandlers}});var y=i(2661);Object.defineProperty(t,"addAdminServicesToServer",{enumerable:!0,get:function(){return y.addAdminServicesToServer}});var b=i(4892);Object.defineProperty(t,"ServerListenerBuilder",{enumerable:!0,get:function(){return b.ServerListenerBuilder}}),Object.defineProperty(t,"ResponderBuilder",{enumerable:!0,get:function(){return b.ResponderBuilder}}),Object.defineProperty(t,"ServerInterceptingCall",{enumerable:!0,get:function(){return b.ServerInterceptingCall}});var S=i(2921);Object.defineProperty(t,"ServerMetricRecorder",{enumerable:!0,get:function(){return S.ServerMetricRecorder}});const _=i(342);t.experimental=_;const C=i(6700),w=i(305),E=i(82),T=i(6486),k=i(1563),R=i(9012),O=i(4117),P=i(9503);C.setup(),w.setup(),E.setup(),T.setup(),k.setup(),R.setup(),O.setup(),P.setup()},8899(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InternalChannel=t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;const n=i(7434),r=i(4973),s=i(5716),o=i(178),a=i(4097),l=i(131),c=i(1703),u=i(4987),h=i(9302),d=i(267),f=i(7803),p=i(3822),g=i(463),m=i(9503),v=i(2611),y=i(6308),b=i(8446),S=i(5572),_=i(6067),C=i(3135),w=i(2379),E=new Map;class T extends w.BaseSubchannelWrapper{constructor(e,t){super(e),this.channel=t,this.refCount=0,this.subchannelStateListener=(e,i,n,r)=>{t.throttleKeepalive(r)}}ref(){0===this.refCount&&(this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this)),this.child.ref(),this.refCount+=1}unref(){this.child.unref(),this.refCount-=1,this.refCount<=0&&(this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this))}}class k{pick(e){return{pickResultType:o.PickResultType.DROP,status:{code:l.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new a.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}}t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";class R{constructor(e){this.target=e,this.trace=new m.ChannelzTrace,this.callTracker=new m.ChannelzCallTracker,this.childrenTracker=new m.ChannelzChildrenTracker,this.state=g.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>({target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()})}}t.InternalChannel=class{constructor(e,i,a){var v,y,b,S,w,k;if(this.credentials=i,this.options=a,this.connectivityState=g.ConnectivityState.IDLE,this.currentPicker=new o.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.callRefTimer=null,this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),"string"!=typeof e)throw new TypeError("Channel target must be a string");if(!(i instanceof n.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(a&&"object"!=typeof a)throw new TypeError("Channel options must be an object");this.channelzInfoTracker=new R(e);const O=(0,p.parseUri)(e);if(null===O)throw new Error(`Could not parse target name "${e}"`);const P=(0,h.mapUriDefaultScheme)(O);if(null===P)throw new Error(`Could not find a default scheme for target name "${e}"`);0===this.options["grpc.enable_channelz"]&&(this.channelzEnabled=!1),this.channelzRef=(0,m.registerChannelzChannel)(e,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=(0,h.getDefaultAuthority)(P);const A=(0,f.mapProxyName)(P,a);this.target=A.target,this.options=Object.assign({},this.options,A.extraOptions),this.subchannelPool=(0,s.getSubchannelPool)(0===(null!==(v=this.options["grpc.use_local_subchannel_pool"])&&void 0!==v?v:0)),this.retryBufferTracker=new C.MessageBufferTracker(null!==(y=this.options["grpc.retry_buffer_size"])&&void 0!==y?y:16777216,null!==(b=this.options["grpc.per_rpc_retry_buffer_size"])&&void 0!==b?b:1048576),this.keepaliveTime=null!==(S=this.options["grpc.keepalive_time_ms"])&&void 0!==S?S:-1,this.idleTimeoutMs=Math.max(null!==(w=this.options["grpc.client_idle_timeout_ms"])&&void 0!==w?w:18e5,1e3);const x={createSubchannel:(e,i)=>{const n={};for(const[e,r]of Object.entries(i))e.startsWith(t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX)||(n[e]=r);const r=this.subchannelPool.getOrCreateSubchannel(this.target,e,n,this.credentials);r.throttleKeepalive(this.keepaliveTime),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",r.getChannelzRef());return new T(r,this)},updateState:(e,t)=>{this.currentPicker=t;const i=this.pickQueue.slice();this.pickQueue=[],i.length>0&&this.callRefTimerUnref();for(const e of i)e.doPick();this.updateState(e)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.refChild(e)},removeChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.unrefChild(e)}};this.resolvingLoadBalancer=new r.ResolvingLoadBalancer(this.target,x,this.options,(e,t)=>{var i;e.retryThrottling?E.set(this.getTarget(),new C.RetryThrottler(e.retryThrottling.maxTokens,e.retryThrottling.tokenRatio,E.get(this.getTarget()))):E.delete(this.getTarget()),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded"),null===(i=this.configSelector)||void 0===i||i.unref(),this.configSelector=t,this.currentResolutionError=null,process.nextTick(()=>{const e=this.configSelectionQueue;this.configSelectionQueue=[],e.length>0&&this.callRefTimerUnref();for(const t of e)t.getConfig()})},e=>{this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+e.code+' and details "'+e.details+'"'),this.configSelectionQueue.length>0&&this.trace("Name resolution failed with calls queued for config selection"),null===this.configSelector&&(this.currentResolutionError=Object.assign(Object.assign({},(0,_.restrictControlPlaneStatusCode)(e.code,e.details)),{metadata:e.metadata}));const t=this.configSelectionQueue;this.configSelectionQueue=[],t.length>0&&this.callRefTimerUnref();for(const i of t)i.reportResolverError(e)}),this.filterStackFactory=new c.FilterStackFactory([new u.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(a,void 0,2));const N=new Error;(0,d.isTracerEnabled)("channel_stacktrace")&&(0,d.trace)(l.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+") Channel constructed \n"+(null===(k=N.stack)||void 0===k?void 0:k.substring(N.stack.indexOf("\n")+1))),this.lastActivityTimestamp=new Date}trace(e,t){(0,d.trace)(null!=t?t:l.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,p.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,t,i,n;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},2147483647)),(null===(t=(e=this.callRefTimer).hasRef)||void 0===t?void 0:t.call(e))||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(n=(i=this.callRefTimer).ref)||void 0===n||n.call(i))}callRefTimerUnref(){var e,t,i;(null===(e=this.callRefTimer)||void 0===e?void 0:e.hasRef)&&!this.callRefTimer.hasRef()||(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(i=null===(t=this.callRefTimer)||void 0===t?void 0:t.unref)||void 0===i||i.call(t))}removeConnectivityStateWatcher(e){const t=this.connectivityStateWatchers.findIndex(t=>t===e);t>=0&&this.connectivityStateWatchers.splice(t,1)}updateState(e){(0,d.trace)(l.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,p.uriToString)(this.target)+" "+g.ConnectivityState[this.connectivityState]+" -> "+g.ConnectivityState[e]),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+g.ConnectivityState[e]),this.connectivityState=e,this.channelzInfoTracker.state=e;const t=this.connectivityStateWatchers.slice();for(const i of t)e!==i.currentState&&(i.timer&&clearTimeout(i.timer),this.removeConnectivityStateWatcher(i),i.callback());e!==g.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(e){if(e>this.keepaliveTime){this.keepaliveTime=e;for(const t of this.wrappedSubchannels)t.throttleKeepalive(e)}}addWrappedSubchannel(e){this.wrappedSubchannels.add(e)}removeWrappedSubchannel(e){this.wrappedSubchannels.delete(e)}doPick(e,t){return this.currentPicker.pick({metadata:e,extraPickInfo:t})}queueCallForPick(e){this.pickQueue.push(e),this.callRefTimerRef()}getConfig(e,t){return this.connectivityState!==g.ConnectivityState.SHUTDOWN&&this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector.invoke(e,t,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(e){this.configSelectionQueue.push(e),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(g.ConnectivityState.IDLE),this.currentPicker=new o.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.callRefTimer&&(clearInterval(this.callRefTimer),this.callRefTimer=null)}startIdleTimeout(e){var t,i;this.idleTimer=setTimeout(()=>{if(this.callCount>0)return void this.startIdleTimeout(this.idleTimeoutMs);const e=(new Date).valueOf()-this.lastActivityTimestamp.valueOf();e>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-e)},e),null===(i=(t=this.idleTimer).unref)||void 0===i||i.call(t)}maybeStartIdleTimer(){this.connectivityState===g.ConnectivityState.SHUTDOWN||this.idleTimer||this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.channelzInfoTracker.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(e){this.channelzEnabled&&(e.code===l.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(e,t,i,n,r){const s=(0,S.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+s+'] method="'+t+'"'),new v.LoadBalancingCall(this,e,t,i,n,r,s)}createRetryingCall(e,t,i,n,r){const s=(0,S.getNextCallNumber)();return this.trace("createRetryingCall ["+s+'] method="'+t+'"'),new C.RetryingCall(this,e,t,i,n,r,s,this.retryBufferTracker,E.get(this.getTarget()))}createResolvingCall(e,t,i,n,r){const s=(0,S.getNextCallNumber)();this.trace("createResolvingCall ["+s+'] method="'+e+'", deadline='+(0,y.deadlineToString)(t));const o={deadline:t,flags:null!=r?r:l.Propagate.DEFAULTS,host:null!=i?i:this.defaultAuthority,parentCall:n},a=new b.ResolvingCall(this,e,o,this.filterStackFactory.clone(),s);return this.onCallStart(),a.addStatusWatcher(e=>{this.onCallEnd(e)}),a}close(){var e;this.resolvingLoadBalancer.destroy(),this.updateState(g.ConnectivityState.SHUTDOWN),this.currentPicker=new k;for(const e of this.configSelectionQueue)e.cancelWithStatus(l.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(const e of this.pickQueue)e.cancelWithStatus(l.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue=[],this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,m.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),null===(e=this.configSelector)||void 0===e||e.unref(),this.configSelector=null}getTarget(){return(0,p.uriToString)(this.target)}getConnectivityState(e){const t=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),t}watchConnectivityState(e,t,i){if(this.connectivityState===g.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let n=null;if(t!==1/0){const e=t instanceof Date?t:new Date(t),s=new Date;if(t===-1/0||e<=s)return void process.nextTick(i,new Error("Deadline passed without connectivity state change"));n=setTimeout(()=>{this.removeConnectivityStateWatcher(r),i(new Error("Deadline passed without connectivity state change"))},e.getTime()-s.getTime())}const r={currentState:e,callback:i,timer:n};this.connectivityStateWatchers.push(r)}getChannelzRef(){return this.channelzRef}createCall(e,t,i,n,r){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===g.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(e,t,i,n,r)}getOptions(){return this.options}}},533(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChildLoadBalancerHandler=void 0;const n=i(8923),r=i(463);t.ChildLoadBalancerHandler=class{constructor(e){this.channelControlHelper=e,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(e){this.parent=e,this.child=null}createSubchannel(e,t){return this.parent.channelControlHelper.createSubchannel(e,t)}updateState(e,t,i){var n;if(this.calledByPendingChild()){if(e===r.ConnectivityState.CONNECTING)return;null===(n=this.parent.currentChild)||void 0===n||n.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(e,t,i)}requestReresolution(){var e;const t=null!==(e=this.parent.pendingChild)&&void 0!==e?e:this.parent.currentChild;this.child===t&&this.parent.channelControlHelper.requestReresolution()}setChild(e){this.child=e}addChannelzChild(e){this.parent.channelControlHelper.addChannelzChild(e)}removeChannelzChild(e){this.parent.channelControlHelper.removeChannelzChild(e)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(e,t){return e.getLoadBalancerName()!==t.getLoadBalancerName()}updateAddressList(e,t,i,r){let s;if(null===this.currentChild||null===this.latestConfig||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,t)){const e=new this.ChildPolicyHelper(this),i=(0,n.createLoadBalancer)(t,e);e.setChild(i),null===this.currentChild?(this.currentChild=i,s=this.currentChild):(this.pendingChild&&this.pendingChild.destroy(),this.pendingChild=i,s=this.pendingChild)}else s=null===this.pendingChild?this.currentChild:this.pendingChild;return this.latestConfig=t,s.updateAddressList(e,t,i,r)}exitIdle(){this.currentChild&&(this.currentChild.exitIdle(),this.pendingChild&&this.pendingChild.exitIdle())}resetBackoff(){this.currentChild&&(this.currentChild.resetBackoff(),this.pendingChild&&this.pendingChild.resetBackoff())}destroy(){this.currentChild&&(this.currentChild.destroy(),this.currentChild=null),this.pendingChild&&(this.pendingChild.destroy(),this.pendingChild=null)}getTypeName(){return"child_load_balancer_helper"}}},9012(e,t,i){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.OutlierDetectionLoadBalancer=t.OutlierDetectionLoadBalancingConfig=void 0,t.setup=function(){m&&(0,a.registerLoadBalancerType)(g,k,C)};const r=i(463),s=i(131),o=i(4700),a=i(342),l=i(8923),c=i(533),u=i(178),h=i(8996),d=i(2379),f=i(267);function p(e){f.trace(s.LogVerbosity.DEBUG,"outlier_detection",e)}const g="outlier_detection",m="true"===(null!==(n=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)&&void 0!==n?n:"true"),v={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},y={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function b(e,t,i,n){if(t in e&&void 0!==e[t]&&typeof e[t]!==i){throw new Error(`outlier detection config ${n?`${n}.${t}`:t} parse error: expected ${i}, got ${typeof e[t]}`)}}function S(e,t,i){const n=i?`${i}.${t}`:t;if(t in e&&void 0!==e[t]){if(!(0,o.isDuration)(e[t]))throw new Error(`outlier detection config ${n} parse error: expected Duration, got ${typeof e[t]}`);if(!(e[t].seconds>=0&&e[t].seconds<=315576e6&&e[t].nanos>=0&&e[t].nanos<=999999999))throw new Error(`outlier detection config ${n} parse error: values out of range for non-negative Duaration`)}}function _(e,t,i){const n=i?`${i}.${t}`:t;if(b(e,t,"number",i),t in e&&void 0!==e[t]&&!(e[t]>=0&&e[t]<=100))throw new Error(`outlier detection config ${n} parse error: value out of range for percentage (0-100)`)}class C{constructor(e,t,i,n,r,s,o){if(this.childPolicy=o,"pick_first"===o.getLoadBalancerName())throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=null!=e?e:1e4,this.baseEjectionTimeMs=null!=t?t:3e4,this.maxEjectionTimeMs=null!=i?i:3e5,this.maxEjectionPercent=null!=n?n:10,this.successRateEjection=r?Object.assign(Object.assign({},v),r):null,this.failurePercentageEjection=s?Object.assign(Object.assign({},y),s):null}getLoadBalancerName(){return g}toJsonObject(){var e,t;return{outlier_detection:{interval:(0,o.msToDuration)(this.intervalMs),base_ejection_time:(0,o.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,o.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:null!==(e=this.successRateEjection)&&void 0!==e?e:void 0,failure_percentage_ejection:null!==(t=this.failurePercentageEjection)&&void 0!==t?t:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(e){var t;if(S(e,"interval"),S(e,"base_ejection_time"),S(e,"max_ejection_time"),_(e,"max_ejection_percent"),"success_rate_ejection"in e&&void 0!==e.success_rate_ejection){if("object"!=typeof e.success_rate_ejection)throw new Error("outlier detection config success_rate_ejection must be an object");b(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),_(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),b(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),b(e.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in e&&void 0!==e.failure_percentage_ejection){if("object"!=typeof e.failure_percentage_ejection)throw new Error("outlier detection config failure_percentage_ejection must be an object");_(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),_(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),b(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),b(e.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in e)||!Array.isArray(e.child_policy))throw new Error("outlier detection config child_policy must be an array");const i=(0,l.selectLbConfigFromList)(e.child_policy);if(!i)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new C(e.interval?(0,o.durationToMs)(e.interval):null,e.base_ejection_time?(0,o.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,o.durationToMs)(e.max_ejection_time):null,null!==(t=e.max_ejection_percent)&&void 0!==t?t:null,e.success_rate_ejection,e.failure_percentage_ejection,i)}}t.OutlierDetectionLoadBalancingConfig=C;class w extends d.BaseSubchannelWrapper{constructor(e,t){super(e),this.mapEntry=t,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){const e=this.mapEntry.subchannelWrappers.indexOf(this);e>=0&&this.mapEntry.subchannelWrappers.splice(e,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}}class E{constructor(){this.activeBucket={success:0,failure:0},this.inactiveBucket={success:0,failure:0}}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket={success:0,failure:0}}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}}class T{constructor(e,t){this.wrappedPicker=e,this.countCalls=t}pick(e){const t=this.wrappedPicker.pick(e);if(t.pickResultType===u.PickResultType.COMPLETE){const e=t.subchannel,i=e.getMapEntry();if(i){let n=t.onCallEnded;return this.countCalls&&(n=(e,n,r)=>{var o;e===s.Status.OK?i.counter.addSuccess():i.counter.addFailure(),null===(o=t.onCallEnded)||void 0===o||o.call(t,e,n,r)}),Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel(),onCallEnded:n})}return Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel()})}return t}}class k{constructor(e){this.entryMap=new h.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new c.ChildLoadBalancerHandler((0,a.createChildChannelControlHelper)(e,{createSubchannel:(t,i)=>{const n=e.createSubchannel(t,i),r=this.entryMap.getForSubchannelAddress(t),s=new w(n,r);return null!==(null==r?void 0:r.currentEjectionTimestamp)&&s.eject(),null==r||r.subchannelWrappers.push(s),s},updateState:(t,i,n)=>{t===r.ConnectivityState.READY?e.updateState(t,new T(i,this.isCountingEnabled()),n):e.updateState(t,i,n)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return null!==this.latestConfig&&(null!==this.latestConfig.getSuccessRateEjectionConfig()||null!==this.latestConfig.getFailurePercentageEjectionConfig())}getCurrentEjectionPercent(){let e=0;for(const t of this.entryMap.values())null!==t.currentEjectionTimestamp&&(e+=1);return 100*e/this.entryMap.size}runSuccessRateCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getSuccessRateEjectionConfig();if(!t)return;p("Running success rate check");const i=t.request_volume;let n=0;const r=[];for(const[e,t]of this.entryMap.entries()){const s=t.counter.getLastSuccesses(),o=t.counter.getLastFailures();p("Stats for "+(0,h.endpointToString)(e)+": successes="+s+" failures="+o+" targetRequestVolume="+i),s+o>=i&&(n+=1,r.push(s/(s+o)))}if(p("Found "+n+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+r+"]"),n<t.minimum_hosts)return;const s=r.reduce((e,t)=>e+t)/r.length;let o=0;for(const e of r){const t=e-s;o+=t*t}const a=o/r.length,l=Math.sqrt(a),c=s-l*(t.stdev_factor/1e3);p("stdev="+l+" ejectionThreshold="+c);for(const[n,r]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const s=r.counter.getLastSuccesses(),o=r.counter.getLastFailures();if(s+o<i)continue;const a=s/(s+o);if(p("Checking candidate "+n+" successRate="+a),a<c){const i=100*Math.random();p("Candidate "+n+" randomNumber="+i+" enforcement_percentage="+t.enforcement_percentage),i<t.enforcement_percentage&&(p("Ejecting candidate "+n),this.eject(r,e))}}}runFailurePercentageCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getFailurePercentageEjectionConfig();if(!t)return;p("Running failure percentage check. threshold="+t.threshold+" request volume threshold="+t.request_volume);let i=0;for(const e of this.entryMap.values()){e.counter.getLastSuccesses()+e.counter.getLastFailures()>=t.request_volume&&(i+=1)}if(!(i<t.minimum_hosts))for(const[i,n]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const r=n.counter.getLastSuccesses(),s=n.counter.getLastFailures();if(p("Candidate successes="+r+" failures="+s),r+s<t.request_volume)continue;if(100*s/(s+r)>t.threshold){const r=100*Math.random();p("Candidate "+i+" randomNumber="+r+" enforcement_percentage="+t.enforcement_percentage),r<t.enforcement_percentage&&(p("Ejecting candidate "+i),this.eject(n,e))}}}eject(e,t){e.currentEjectionTimestamp=new Date,e.ejectionTimeMultiplier+=1;for(const t of e.subchannelWrappers)t.eject()}uneject(e){e.currentEjectionTimestamp=null;for(const t of e.subchannelWrappers)t.uneject()}switchAllBuckets(){for(const e of this.entryMap.values())e.counter.switchBuckets()}startTimer(e){var t,i;this.ejectionTimer=setTimeout(()=>this.runChecks(),e),null===(i=(t=this.ejectionTimer).unref)||void 0===i||i.call(t)}runChecks(){const e=new Date;if(p("Ejection timer running"),this.switchAllBuckets(),this.latestConfig){this.timerStartTime=e,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(e),this.runFailurePercentageCheck(e);for(const[e,t]of this.entryMap.entries())if(null===t.currentEjectionTimestamp)t.ejectionTimeMultiplier>0&&(t.ejectionTimeMultiplier-=1);else{const i=this.latestConfig.getBaseEjectionTimeMs(),n=this.latestConfig.getMaxEjectionTimeMs(),r=new Date(t.currentEjectionTimestamp.getTime());r.setMilliseconds(r.getMilliseconds()+Math.min(i*t.ejectionTimeMultiplier,Math.max(i,n))),r<new Date&&(p("Unejecting "+e),this.uneject(t))}}}updateAddressList(e,t,i,n){if(!(t instanceof C))return!1;if(p("Received update with config: "+JSON.stringify(t.toJsonObject(),void 0,2)),e.ok){for(const t of e.value)this.entryMap.has(t)||(p("Adding map entry for "+(0,h.endpointToString)(t)),this.entryMap.set(t,{counter:new E,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));this.entryMap.deleteMissing(e.value)}const r=t.getChildPolicy();if(this.childBalancer.updateAddressList(e,r,i,n),t.getSuccessRateEjectionConfig()||t.getFailurePercentageEjectionConfig())if(this.timerStartTime){p("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);const e=t.getIntervalMs()-((new Date).getTime()-this.timerStartTime.getTime());this.startTimer(e)}else p("Starting new timer"),this.timerStartTime=new Date,this.startTimer(t.getIntervalMs()),this.switchAllBuckets();else{p("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(const e of this.entryMap.values())this.uneject(e),e.ejectionTimeMultiplier=0}return this.latestConfig=t,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return g}}t.OutlierDetectionLoadBalancer=k},6486(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LeafLoadBalancer=t.PickFirstLoadBalancer=t.PickFirstLoadBalancingConfig=void 0,t.shuffled=m,t.setup=function(){(0,n.registerLoadBalancerType)(f,y,p),(0,n.registerDefaultLoadBalancerType)(f)};const n=i(8923),r=i(463),s=i(178),o=i(8996),a=i(267),l=i(131),c=i(8996),u=i(9278),h=i(5034);function d(e){a.trace(l.LogVerbosity.DEBUG,"pick_first",e)}const f="pick_first";class p{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return f}toJsonObject(){return{[f]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(e){if("shuffleAddressList"in e&&"boolean"!=typeof e.shuffleAddressList)throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new p(!0===e.shuffleAddressList)}}t.PickFirstLoadBalancingConfig=p;class g{constructor(e){this.subchannel=e}pick(e){return{pickResultType:s.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}}function m(e){const t=e.slice();for(let e=t.length-1;e>1;e--){const i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t}const v="grpc-node.internal.pick-first.report_health_status";class y{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=r.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(e,t,i,n,r)=>{this.onSubchannelStateUpdate(e,t,i,r)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every(e=>e.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every(e=>e.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var e;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){const e=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(r.ConnectivityState.READY,new g(this.currentPick),null);else if(0===(null===(e=this.latestAddressList)||void 0===e?void 0:e.length)){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else if(0===this.children.length)this.updateState(r.ConnectivityState.IDLE,new s.QueuePicker(this),null);else if(this.stickyTransientFailureMode){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(r.ConnectivityState.CONNECTING,new s.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF())if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode)this.calculateAndReportNewState();else{this.stickyTransientFailureMode=!0;for(const{subchannel:e}of this.children)e.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){null!==this.currentPick&&(this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null)}onSubchannelStateUpdate(e,t,i,n){var s;if(null===(s=this.currentPick)||void 0===s?void 0:s.realSubchannelEquals(e))i!==r.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState());else for(const[t,s]of this.children.entries())if(e.realSubchannelEquals(s.subchannel))return i===r.ConnectivityState.READY&&this.pickSubchannel(s.subchannel),i===r.ConnectivityState.TRANSIENT_FAILURE&&(s.hasReportedTransientFailure=!0,n&&(this.lastError=n),this.maybeEnterStickyTransientFailureMode(),t===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(t+1)),void s.subchannel.startConnecting()}startNextSubchannelConnecting(e){clearTimeout(this.connectionDelayTimeout);for(const[t,i]of this.children.entries())if(t>=e){const e=i.subchannel.getConnectivityState();if(e===r.ConnectivityState.IDLE||e===r.ConnectivityState.CONNECTING)return void this.startConnecting(t)}this.maybeEnterStickyTransientFailureMode()}startConnecting(e){var t,i;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=e,this.children[e].subchannel.getConnectivityState()===r.ConnectivityState.IDLE&&(d("Start connecting to subchannel with address "+this.children[e].subchannel.getAddress()),process.nextTick(()=>{var t;null===(t=this.children[e])||void 0===t||t.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(e+1)},250),null===(i=(t=this.connectionDelayTimeout).unref)||void 0===i||i.call(t)}pickSubchannel(e){d("Pick subchannel with address "+e.getAddress()),this.stickyTransientFailureMode=!1,e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),e.addConnectivityStateListener(this.subchannelStateListener),e.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=e,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(e,t,i){d(r.ConnectivityState[this.currentState]+" -> "+r.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,t,i)}resetSubchannelList(){for(const e of this.children)e.subchannel.removeConnectivityStateListener(this.subchannelStateListener),e.subchannel.unref(),this.channelControlHelper.removeChannelzChild(e.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(e,t){d("connectToAddressList(["+e.map(e=>(0,o.subchannelAddressToString)(e))+"])");const i=e.map(e=>({subchannel:this.channelControlHelper.createSubchannel(e,t),hasReportedTransientFailure:!1}));for(const{subchannel:e}of i)if(e.getConnectivityState()===r.ConnectivityState.READY)return void this.pickSubchannel(e);for(const{subchannel:e}of i)e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef());this.resetSubchannelList(),this.children=i;for(const{subchannel:e}of this.children)e.addConnectivityStateListener(this.subchannelStateListener);for(const e of this.children)e.subchannel.getConnectivityState()===r.ConnectivityState.TRANSIENT_FAILURE&&(e.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(e,t,i,n){if(!(t instanceof p))return!1;if(!e.ok)return 0===this.children.length&&null===this.currentPick&&this.channelControlHelper.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker(e.error),e.error.details),!0;let a=e.value;this.reportHealthStatus=i[v],t.getShuffleAddressList()&&(a=m(a));const l=[].concat(...a.map(e=>e.addresses));d("updateAddressList(["+l.map(e=>(0,o.subchannelAddressToString)(e))+"])");const h=function(e){if(0===e.length)return[];const t=[],i=[],n=[],r=(0,c.isTcpSubchannelAddress)(e[0])&&(0,u.isIPv6)(e[0].host);for(const t of e)(0,c.isTcpSubchannelAddress)(t)&&(0,u.isIPv6)(t.host)?i.push(t):n.push(t);const s=r?i:n,o=r?n:i;for(let e=0;e<Math.max(s.length,o.length);e++)e<s.length&&t.push(s[e]),e<o.length&&t.push(o[e]);return t}(l);return this.latestAddressList=h,this.latestOptions=i,this.connectToAddressList(h,i),this.latestResolutionNote=n,l.length>0||(this.lastError="No addresses resolved",!1)}exitIdle(){this.currentState===r.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return f}}t.PickFirstLoadBalancer=y;const b=new p(!1);t.LeafLoadBalancer=class{constructor(e,t,i,o){this.endpoint=e,this.options=i,this.resolutionNote=o,this.latestState=r.ConnectivityState.IDLE;const a=(0,n.createChildChannelControlHelper)(t,{updateState:(e,i,n)=>{this.latestState=e,this.latestPicker=i,t.updateState(e,i,n)}});this.pickFirstBalancer=new y(a),this.latestPicker=new s.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,h.statusOrFromValue)([this.endpoint]),b,Object.assign(Object.assign({},this.options),{[v]:!0}),this.resolutionNote)}updateEndpoint(e,t){this.options=t,this.endpoint=e,this.latestState!==r.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}}},1563(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RoundRobinLoadBalancer=void 0,t.setup=function(){(0,n.registerLoadBalancerType)(h,p,d)};const n=i(8923),r=i(463),s=i(178),o=i(267),a=i(131),l=i(8996),c=i(6486);function u(e){o.trace(a.LogVerbosity.DEBUG,"round_robin",e)}const h="round_robin";class d{getLoadBalancerName(){return h}constructor(){}toJsonObject(){return{[h]:{}}}static createFromJson(e){return new d}}class f{constructor(e,t=0){this.children=e,this.nextIndex=t}pick(e){const t=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,t.pick(e)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}}class p{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=r.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,n.createChildChannelControlHelper)(e,{updateState:(e,t,i)=>{this.currentState===r.ConnectivityState.READY&&e!==r.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),i&&(this.lastError=i),this.calculateAndUpdateState()}})}countChildrenWithState(e){return this.children.filter(t=>t.getConnectivityState()===e).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(r.ConnectivityState.READY)>0){const e=this.children.filter(e=>e.getConnectivityState()===r.ConnectivityState.READY);let t=0;if(null!==this.currentReadyPicker){const i=this.currentReadyPicker.peekNextEndpoint();t=e.findIndex(e=>(0,l.endpointEqual)(e.getEndpoint(),i)),t<0&&(t=0)}this.updateState(r.ConnectivityState.READY,new f(e.map(e=>({endpoint:e.getEndpoint(),picker:e.getPicker()})),t),null)}else if(this.countChildrenWithState(r.ConnectivityState.CONNECTING)>0)this.updateState(r.ConnectivityState.CONNECTING,new s.QueuePicker(this),null);else if(this.countChildrenWithState(r.ConnectivityState.TRANSIENT_FAILURE)>0){const e=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(r.ConnectivityState.IDLE,new s.QueuePicker(this),null);for(const e of this.children)e.getConnectivityState()===r.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,t,i){u(r.ConnectivityState[this.currentState]+" -> "+r.ConnectivityState[e]),e===r.ConnectivityState.READY?this.currentReadyPicker=t:this.currentReadyPicker=null,this.currentState=e,this.channelControlHelper.updateState(e,t,i)}resetSubchannelList(){for(const e of this.children)e.destroy();this.children=[]}updateAddressList(e,t,i,n){if(!(t instanceof d))return!1;if(!e.ok)return 0===this.children.length&&this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker(e.error),e.error.details),!0;const o=Math.random()*e.value.length|0,a=function(e,t){return[...e.slice(t),...e.slice(0,t)]}(e.value,o);if(this.resetSubchannelList(),0===a.length){const e=`No addresses resolved. Resolution note: ${n}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}u("Connect to endpoint list "+a.map(l.endpointToString)),this.updatesPaused=!0,this.children=a.map(e=>new c.LeafLoadBalancer(e,this.childChannelControlHelper,i,n));for(const e of this.children)e.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return h}}t.RoundRobinLoadBalancer=p},4117(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WeightedRoundRobinLoadBalancingConfig=void 0,t.setup=function(){(0,o.registerLoadBalancerType)(p,b,v)};const n=i(463),r=i(131),s=i(4700),o=i(8923),a=i(6486),l=i(267),c=i(2921),u=i(178),h=i(222),d=i(8996);function f(e){l.trace(r.LogVerbosity.DEBUG,"weighted_round_robin",e)}const p="weighted_round_robin";function g(e,t,i){if(t in e&&void 0!==e[t]&&typeof e[t]!==i)throw new Error(`weighted round robin config ${t} parse error: expected ${i}, got ${typeof e[t]}`)}function m(e,t){if(t in e&&void 0!==e[t]&&null!==e[t]){let i;if((0,s.isDuration)(e[t]))i=e[t];else if((0,s.isDurationMessage)(e[t]))i=(0,s.durationMessageToDuration)(e[t]);else{if("string"!=typeof e[t])throw new Error(`weighted round robin config ${t}: expected duration, got ${typeof e[t]}`);{const n=(0,s.parseDuration)(e[t]);if(!n)throw new Error(`weighted round robin config ${t}: failed to parse duration string ${e[t]}`);i=n}}return(0,s.durationToMs)(i)}return null}class v{constructor(e,t,i,n,r,s){this.enableOobLoadReport=null!=e&&e,this.oobLoadReportingPeriodMs=null!=t?t:1e4,this.blackoutPeriodMs=null!=i?i:1e4,this.weightExpirationPeriodMs=null!=n?n:18e4,this.weightUpdatePeriodMs=Math.max(null!=r?r:1e3,100),this.errorUtilizationPenalty=null!=s?s:1}getLoadBalancerName(){return p}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,s.durationToString)((0,s.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,s.durationToString)((0,s.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,s.durationToString)((0,s.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,s.durationToString)((0,s.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(e){if(g(e,"enable_oob_load_report","boolean"),g(e,"error_utilization_penalty","number"),e.error_utilization_penalty<0)throw new Error("weighted round robin config error_utilization_penalty < 0");return new v(e.enable_oob_load_report,m(e,"oob_load_reporting_period"),m(e,"blackout_period"),m(e,"weight_expiration_period"),m(e,"weight_update_period"),e.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}}t.WeightedRoundRobinLoadBalancingConfig=v;class y{constructor(e,t){this.metricsHandler=t,this.queue=new h.PriorityQueue((e,t)=>e.deadline<t.deadline);const i=e.filter(e=>e.weight>0);let n;if(i.length<2)n=1;else{let e=0;for(const{weight:t}of i)e+=t;n=e/i.length}for(const t of e){const e=t.weight>0?1/t.weight:n;this.queue.push({endpointName:t.endpointName,picker:t.picker,period:e,deadline:Math.random()*e})}}pick(e){const t=this.queue.pop();this.queue.push(Object.assign(Object.assign({},t),{deadline:t.deadline+t.period}));const i=t.picker.pick(e);if(i.pickResultType===u.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},i),{onCallEnded:(0,c.createMetricsReader)(e=>this.metricsHandler(e,t.endpointName),i.onCallEnded)});{const e=i.subchannel;return Object.assign(Object.assign({},i),{subchannel:e.getWrappedSubchannel()})}}return i}}class b{constructor(e){this.channelControlHelper=e,this.latestConfig=null,this.children=new Map,this.currentState=n.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(e){let t=0;for(const i of this.children.values())i.child.getConnectivityState()===e&&(t+=1);return t}updateWeight(e,t){var i,n;const r=t.rps_fractional;let s=t.application_utilization;s>0&&r>0&&(s+=t.eps/r*(null!==(n=null===(i=this.latestConfig)||void 0===i?void 0:i.getErrorUtilizationPenalty())&&void 0!==n?n:0));const o=0===s?0:r/s;if(0===o)return;const a=new Date;null===e.nonEmptySince&&(e.nonEmptySince=a),e.lastUpdated=a,e.weight=o}getWeight(e){if(!this.latestConfig)return 0;const t=(new Date).getTime();if(t-e.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return e.nonEmptySince=null,0;const i=this.latestConfig.getBlackoutPeriodMs();return i>0&&(null===e.nonEmptySince||t-e.nonEmptySince.getTime()<i)?0:e.weight}calculateAndUpdateState(){if(!this.updatesPaused&&this.latestConfig){if(this.countChildrenWithState(n.ConnectivityState.READY)>0){const e=[];for(const[t,i]of this.children)i.child.getConnectivityState()===n.ConnectivityState.READY&&e.push({endpointName:t,picker:i.child.getPicker(),weight:this.getWeight(i)});let t;f("Created picker with weights: "+e.map(e=>e.endpointName+":"+e.weight).join(",")),t=this.latestConfig.getEnableOobLoadReport()?null:(e,t)=>{const i=this.children.get(t);i&&this.updateWeight(i,e)},this.updateState(n.ConnectivityState.READY,new y(e,t),null)}else if(this.countChildrenWithState(n.ConnectivityState.CONNECTING)>0)this.updateState(n.ConnectivityState.CONNECTING,new u.QueuePicker(this),null);else if(this.countChildrenWithState(n.ConnectivityState.TRANSIENT_FAILURE)>0){const e=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(n.ConnectivityState.TRANSIENT_FAILURE,new u.UnavailablePicker({details:e}),e)}else this.updateState(n.ConnectivityState.IDLE,new u.QueuePicker(this),null);for(const{child:e}of this.children.values())e.getConnectivityState()===n.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,t,i){f(n.ConnectivityState[this.currentState]+" -> "+n.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,t,i)}updateAddressList(e,t,i,r){var s,l;if(!(t instanceof v))return!1;if(!e.ok)return 0===this.children.size&&this.updateState(n.ConnectivityState.TRANSIENT_FAILURE,new u.UnavailablePicker(e.error),e.error.details),!0;if(0===e.value.length){const e=`No addresses resolved. Resolution note: ${r}`;return this.updateState(n.ConnectivityState.TRANSIENT_FAILURE,new u.UnavailablePicker({details:e}),e),!1}f("Connect to endpoint list "+e.value.map(d.endpointToString));const h=new Date,p=new Set;this.updatesPaused=!0,this.latestConfig=t;for(const s of e.value){const e=(0,d.endpointToString)(s);p.add(e);let l=this.children.get(e);l||(l={child:new a.LeafLoadBalancer(s,(0,o.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(e,t,i)=>{this.currentState===n.ConnectivityState.READY&&e!==n.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),e===n.ConnectivityState.READY&&(l.nonEmptySince=null),i&&(this.lastError=i),this.calculateAndUpdateState()},createSubchannel:(e,t)=>{const i=this.channelControlHelper.createSubchannel(e,t);return(null==l?void 0:l.oobMetricsListener)?new c.OrcaOobMetricsSubchannelWrapper(i,l.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs()):i}}),i,r),lastUpdated:h,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(e,l)),t.getEnableOobLoadReport()?l.oobMetricsListener=e=>{this.updateWeight(l,e)}:l.oobMetricsListener=null}for(const[e,t]of this.children)p.has(e)?t.child.startConnecting():(t.child.destroy(),this.children.delete(e));return this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer),this.weightUpdateTimer=null===(l=(s=setInterval(()=>{this.currentState===n.ConnectivityState.READY&&this.calculateAndUpdateState()},t.getWeightUpdatePeriodMs())).unref)||void 0===l?void 0:l.call(s),!0}exitIdle(){}resetBackoff(){}destroy(){for(const e of this.children.values())e.child.destroy();this.children.clear(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer)}getTypeName(){return p}}},8923(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createChildChannelControlHelper=function(e,t){var i,n,r,s,o,a,l,c,u,h;return{createSubchannel:null!==(n=null===(i=t.createSubchannel)||void 0===i?void 0:i.bind(t))&&void 0!==n?n:e.createSubchannel.bind(e),updateState:null!==(s=null===(r=t.updateState)||void 0===r?void 0:r.bind(t))&&void 0!==s?s:e.updateState.bind(e),requestReresolution:null!==(a=null===(o=t.requestReresolution)||void 0===o?void 0:o.bind(t))&&void 0!==a?a:e.requestReresolution.bind(e),addChannelzChild:null!==(c=null===(l=t.addChannelzChild)||void 0===l?void 0:l.bind(t))&&void 0!==c?c:e.addChannelzChild.bind(e),removeChannelzChild:null!==(h=null===(u=t.removeChannelzChild)||void 0===u?void 0:u.bind(t))&&void 0!==h?h:e.removeChannelzChild.bind(e)}},t.registerLoadBalancerType=function(e,t,i){s[e]={LoadBalancer:t,LoadBalancingConfig:i}},t.registerDefaultLoadBalancerType=function(e){o=e},t.createLoadBalancer=function(e,t){const i=e.getLoadBalancerName();return i in s?new s[i].LoadBalancer(t):null},t.isLoadBalancerNameRegistered=function(e){return e in s},t.parseLoadBalancingConfig=a,t.getDefaultConfig=function(){if(!o)throw new Error("No default load balancer type registered");return new s[o].LoadBalancingConfig},t.selectLbConfigFromList=function(e,t=!1){for(const t of e)try{return a(t)}catch(e){(0,n.log)(r.LogVerbosity.DEBUG,"Config parsing failed with error",e.message);continue}return t&&o?new s[o].LoadBalancingConfig:null};const n=i(267),r=i(131);const s={};let o=null;function a(e){const t=Object.keys(e);if(1!==t.length)throw new Error("Provided load balancing config has multiple conflicting entries");const i=t[0];if(!(i in s))throw new Error(`Unrecognized load balancing config name ${i}`);try{return s[i].LoadBalancingConfig.createFromJson(e[i])}catch(e){throw new Error(`${i}: ${e.message}`)}}},2611(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoadBalancingCall=void 0;const n=i(463),r=i(131),s=i(6308),o=i(4097),a=i(178),l=i(3822),c=i(267),u=i(6067),h=i(5675);t.LoadBalancingCall=class{constructor(e,t,i,n,r,s,o){var a,c;this.channel=e,this.callConfig=t,this.methodName=i,this.host=n,this.credentials=r,this.deadline=s,this.callNumber=o,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.metadata=null,this.listener=null,this.onCallEnded=null,this.childStartTime=null;const u=this.methodName.split("/");let h="";u.length>=2&&(h=u[1]);const d=null!==(c=null===(a=(0,l.splitHostPort)(this.host))||void 0===a?void 0:a.host)&&void 0!==c?c:"localhost";this.serviceUrl=`https://${d}/${h}`,this.startTime=new Date}getDeadlineInfo(){var e,t;const i=[];return this.childStartTime?(this.childStartTime>this.startTime&&((null===(e=this.metadata)||void 0===e?void 0:e.getOptions().waitForReady)&&i.push("wait_for_ready"),i.push(`LB pick: ${(0,s.formatDateDifference)(this.startTime,this.childStartTime)}`)),i.push(...this.child.getDeadlineInfo()),i):((null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)&&i.push("wait_for_ready"),i.push("Waiting for LB pick"),i)}trace(e){c.trace(r.LogVerbosity.DEBUG,"load_balancing_call","["+this.callNumber+"] "+e)}outputStatus(e,t){var i,n;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString());const r=Object.assign(Object.assign({},e),{progress:t});null===(i=this.listener)||void 0===i||i.onReceiveStatus(r),null===(n=this.onCallEnded)||void 0===n||n.call(this,r.code,r.details,r.metadata)}}doPick(){var e,t;if(this.ended)return;if(!this.metadata)throw new Error("doPick called before start");this.trace("Pick called");const i=this.metadata.clone(),l=this.channel.doPick(i,this.callConfig.pickInformation),c=l.subchannel?"("+l.subchannel.getChannelzRef().id+") "+l.subchannel.getAddress():""+l.subchannel;switch(this.trace("Pick result: "+a.PickResultType[l.pickResultType]+" subchannel: "+c+" status: "+(null===(e=l.status)||void 0===e?void 0:e.code)+" "+(null===(t=l.status)||void 0===t?void 0:t.details)),l.pickResultType){case a.PickResultType.COMPLETE:this.credentials.compose(l.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then(e=>{var t;if(this.ended)this.trace("Credentials metadata generation finished after call ended");else{if(i.merge(e),i.get("authorization").length>1&&this.outputStatus({code:r.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new o.Metadata},"PROCESSED"),l.subchannel.getConnectivityState()!==n.ConnectivityState.READY)return this.trace("Picked subchannel "+c+" has state "+n.ConnectivityState[l.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),void this.doPick();this.deadline!==1/0&&i.set("grpc-timeout",(0,s.getDeadlineTimeoutString)(this.deadline));try{this.child=l.subchannel.getRealSubchannel().createCall(i,this.host,this.methodName,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(e)},onReceiveMessage:e=>{this.trace("Received message"),this.listener.onReceiveMessage(e)},onReceiveStatus:e=>{this.trace("Received status"),e.rstCode===h.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(e,"REFUSED"):this.outputStatus(e,"PROCESSED")}}),this.childStartTime=new Date}catch(e){return this.trace("Failed to start call on picked subchannel "+c+" with error "+e.message),void this.outputStatus({code:r.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+e.message,metadata:new o.Metadata},"NOT_STARTED")}null===(t=l.onCallStarted)||void 0===t||t.call(l),this.onCallEnded=l.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending&&this.child.startRead(),this.pendingMessage&&this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.pendingHalfClose&&this.child.halfClose()}},e=>{const{code:t,details:i}=(0,u.restrictControlPlaneStatusCode)("number"==typeof e.code?e.code:r.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${e.message}`);this.outputStatus({code:t,details:i,metadata:new o.Metadata},"PROCESSED")});break;case a.PickResultType.DROP:const{code:e,details:t}=(0,u.restrictControlPlaneStatusCode)(l.status.code,l.status.details);setImmediate(()=>{this.outputStatus({code:e,details:t,metadata:l.status.metadata},"DROP")});break;case a.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{const{code:e,details:t}=(0,u.restrictControlPlaneStatusCode)(l.status.code,l.status.details);setImmediate(()=>{this.outputStatus({code:e,details:t,metadata:l.status.metadata},"PROCESSED")})}break;case a.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(e,t){var i;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(i=this.child)||void 0===i||i.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new o.Metadata},"PROCESSED")}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.listener=t,this.metadata=e,this.doPick()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.child.sendMessageWithContext(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){throw new Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}}},267(e,t,i){"use strict";var n,r,s,o;Object.defineProperty(t,"__esModule",{value:!0}),t.log=t.setLoggerVerbosity=t.setLogger=t.getLogger=void 0,t.trace=function(e,i,n){m(i)&&(0,t.log)(e,(new Date).toISOString()+" | v"+c+" "+l.pid+" | "+i+" | "+n)},t.isTracerEnabled=m;const a=i(131),l=i(932),c=i(9943).rE;let u={error:(e,...t)=>{console.error("E "+e,...t)},info:(e,...t)=>{console.error("I "+e,...t)},debug:(e,...t)=>{console.error("D "+e,...t)}},h=a.LogVerbosity.ERROR;switch((null!==(r=null!==(n=process.env.GRPC_NODE_VERBOSITY)&&void 0!==n?n:process.env.GRPC_VERBOSITY)&&void 0!==r?r:"").toUpperCase()){case"DEBUG":h=a.LogVerbosity.DEBUG;break;case"INFO":h=a.LogVerbosity.INFO;break;case"ERROR":h=a.LogVerbosity.ERROR;break;case"NONE":h=a.LogVerbosity.NONE}t.getLogger=()=>u;t.setLogger=e=>{u=e};t.setLoggerVerbosity=e=>{h=e};t.log=(e,...t)=>{let i;if(e>=h){switch(e){case a.LogVerbosity.DEBUG:i=u.debug;break;case a.LogVerbosity.INFO:i=u.info;break;case a.LogVerbosity.ERROR:i=u.error}i||(i=u.error),i&&i.bind(u)(...t)}};const d=null!==(o=null!==(s=process.env.GRPC_NODE_TRACE)&&void 0!==s?s:process.env.GRPC_TRACE)&&void 0!==o?o:"",f=new Set,p=new Set;for(const e of d.split(","))e.startsWith("-")?p.add(e.substring(1)):f.add(e);const g=f.has("all");function m(e){return!p.has(e)&&(g||f.has(e))}},4056(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeClientConstructor=o,t.loadPackageDefinition=function(e){const t={};for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i],r=i.split(".");if(r.some(e=>s(e)))continue;const l=r[r.length-1];let c=t;for(const e of r.slice(0,-1))c[e]||(c[e]={}),c=c[e];a(n)?c[l]=n:c[l]=o(n,l,{})}return t};const n=i(5563),r={unary:n.Client.prototype.makeUnaryRequest,server_stream:n.Client.prototype.makeServerStreamRequest,client_stream:n.Client.prototype.makeClientStreamRequest,bidi:n.Client.prototype.makeBidiStreamRequest};function s(e){return["__proto__","prototype","constructor"].includes(e)}function o(e,t,i){i||(i={});class o extends n.Client{}return Object.keys(e).forEach(t=>{if(s(t))return;const i=e[t];let n;if("string"==typeof t&&"$"===t.charAt(0))throw new Error("Method names cannot start with $");n=i.requestStream?i.responseStream?"bidi":"client_stream":i.responseStream?"server_stream":"unary";const a=i.requestSerialize,l=i.responseDeserialize,c=function(e,t,i,n){return function(...r){return e.call(this,t,i,n,...r)}}(r[n],i.path,a,l);o.prototype[t]=c,Object.assign(o.prototype[t],i),i.originalName&&!s(i.originalName)&&(o.prototype[i.originalName]=o.prototype[t])}),o.service=e,o.serviceName=t,o}function a(e){return"format"in e}},4097(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;const n=i(267),r=i(131),s=i(9752),o=/^[:0-9a-z_.-]+$/,a=/^[ -~]*$/;function l(e){return e.endsWith("-bin")}function c(e){return!e.startsWith("grpc-")}function u(e){return e.toLowerCase()}function h(e,t){if(!function(e){return o.test(e)}(e))throw new Error('Metadata key "'+e+'" contains illegal characters');if(null!=t)if(l(e)){if(!Buffer.isBuffer(t))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(t))throw new Error("keys that don't end with '-bin' must have String values");if(!function(e){return a.test(e)}(t))throw new Error('Metadata string value "'+t+'" contains illegal characters')}}class d{constructor(e={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=e}set(e,t){h(e=u(e),t),this.internalRepr.set(e,[t])}add(e,t){h(e=u(e),t);const i=this.internalRepr.get(e);void 0===i?this.internalRepr.set(e,[t]):i.push(t)}remove(e){e=u(e),this.internalRepr.delete(e)}get(e){return e=u(e),this.internalRepr.get(e)||[]}getMap(){const e={};for(const[t,i]of this.internalRepr)if(i.length>0){const n=i[0];e[t]=Buffer.isBuffer(n)?Buffer.from(n):n}return e}clone(){const e=new d(this.options),t=e.internalRepr;for(const[e,i]of this.internalRepr){const n=i.map(e=>Buffer.isBuffer(e)?Buffer.from(e):e);t.set(e,n)}return e}merge(e){for(const[t,i]of e.internalRepr){const e=(this.internalRepr.get(t)||[]).concat(i);this.internalRepr.set(t,e)}}setOptions(e){this.options=e}getOptions(){return this.options}toHttp2Headers(){const e={};for(const[t,i]of this.internalRepr)t.startsWith(":")||(e[t]=i.map(f));return e}toJSON(){const e={};for(const[t,i]of this.internalRepr)e[t]=i;return e}setOpaque(e,t){this.opaqueData.set(e,t)}getOpaque(e){return this.opaqueData.get(e)}static fromHttp2Headers(e){const t=new d;for(const i of Object.keys(e)){if(":"===i.charAt(0))continue;const o=e[i];try{l(i)?Array.isArray(o)?o.forEach(e=>{t.add(i,Buffer.from(e,"base64"))}):void 0!==o&&(c(i)?o.split(",").forEach(e=>{t.add(i,Buffer.from(e.trim(),"base64"))}):t.add(i,Buffer.from(o,"base64"))):Array.isArray(o)?o.forEach(e=>{t.add(i,e)}):void 0!==o&&t.add(i,o)}catch(e){const t=`Failed to add metadata entry ${i}: ${o}. ${(0,s.getErrorMessage)(e)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,n.log)(r.LogVerbosity.ERROR,t)}}return t}}t.Metadata=d;const f=e=>Buffer.isBuffer(e)?e.toString("base64"):e},2921(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OrcaOobMetricsSubchannelWrapper=t.GRPC_METRICS_HEADER=t.ServerMetricRecorder=t.PerRequestMetricRecorder=void 0,t.createOrcaClient=h,t.createMetricsReader=function(e,i){return(n,r,s)=>{let o=s.getOpaque(d);if(o)e(o);else{const i=s.get(t.GRPC_METRICS_HEADER);if(i.length>0){o=u().xds.data.orca.v3.OrcaLoadReport.deserialize(i[0]),e(o),s.setOpaque(d,o)}}i&&i(n,r,s)}};const n=i(4056),r=i(4700),s=i(7434),o=i(2379),a=i(131),l=i(3956),c=i(463);function u(){const e=(0,i(5085).Yi)("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,n.loadPackageDefinition)(e)}t.PerRequestMetricRecorder=class{constructor(){this.message={}}recordRequestCostMetric(e,t){this.message.request_cost||(this.message.request_cost={}),this.message.request_cost[e]=t}recordUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}recordNamedMetric(e,t){this.message.named_metrics||(this.message.named_metrics={}),this.message.named_metrics[e]=t}recordCPUUtilizationMetric(e){this.message.cpu_utilization=e}recordMemoryUtilizationMetric(e){this.message.mem_utilization=e}recordApplicationUtilizationMetric(e){this.message.application_utilization=e}recordQpsMetric(e){this.message.rps_fractional=e}recordEpsMetric(e){this.message.eps=e}serialize(){return u().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};function h(e){return new(0,u().xds.service.orca.v3.OpenRcaService)("unused",s.ChannelCredentials.createInsecure(),{channelOverride:e})}t.ServerMetricRecorder=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{const t=e.request.report_interval?(0,r.durationToMs)((0,r.durationMessageToDuration)(e.request.report_interval)):3e4,i=setInterval(()=>{e.write(this.message)},t);e.on("cancelled",()=>{clearInterval(i)})}}}putUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}setAllUtilizationMetrics(e){this.message.utilization=Object.assign({},e)}deleteUtilizationMetric(e){var t;null===(t=this.message.utilization)||void 0===t||delete t[e]}setCpuUtilizationMetric(e){this.message.cpu_utilization=e}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(e){this.message.application_utilization=e}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(e){this.message.rps_fractional=e}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(e){this.message.eps=e}deleteEpsMetric(){delete this.message.eps}addToServer(e){const t=u().xds.service.orca.v3.OpenRcaService.service;e.addService(t,this.serviceImplementation)}},t.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";const d="grpc_orca_load_report";const f="orca_oob_metrics";class p{constructor(e,t){this.metricsListener=e,this.intervalMs=t,this.dataProducer=null}setSubchannel(e){const t=e.getOrCreateDataProducer(f,v);this.dataProducer=t,t.addDataWatcher(this)}destroy(){var e;null===(e=this.dataProducer)||void 0===e||e.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(e){this.metricsListener(e)}}class g{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new l.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();const t=e.getChannel();this.client=h(t),e.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(e){this.dataWatchers.add(e),this.updateMetricsSubscription()}removeDataWatcher(e){var t;this.dataWatchers.delete(e),0===this.dataWatchers.size?(this.subchannel.removeDataProducer(f),null===(t=this.metricsCall)||void 0===t||t.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener)):this.updateMetricsSubscription()}updateMetricsSubscription(){var e;if(0===this.dataWatchers.size||!this.orcaSupported||this.subchannel.getConnectivityState()!==c.ConnectivityState.READY)return;const t=Math.min(...Array.from(this.dataWatchers).map(e=>e.getInterval()));if(!this.metricsCall||t!==this.currentInterval){null===(e=this.metricsCall)||void 0===e||e.cancel(),this.currentInterval=t;const i=this.client.streamCoreMetrics({report_interval:(0,r.msToDuration)(t)});this.metricsCall=i,i.on("data",e=>{this.dataWatchers.forEach(t=>{t.onMetricsUpdate(e)})}),i.on("error",e=>{this.metricsCall=null,e.code!==a.Status.UNIMPLEMENTED?e.code!==a.Status.CANCELLED&&this.backoffTimer.runOnce():this.orcaSupported=!1})}}}class m extends o.BaseSubchannelWrapper{constructor(e,t,i){super(e),this.addDataWatcher(new p(t,i))}getWrappedSubchannel(){return this.child}}function v(e){return new g(e)}t.OrcaOobMetricsSubchannelWrapper=m},178(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueuePicker=t.UnavailablePicker=t.PickResultType=void 0;const n=i(4097),r=i(131);var s;!function(e){e[e.COMPLETE=0]="COMPLETE",e[e.QUEUE=1]="QUEUE",e[e.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",e[e.DROP=3]="DROP"}(s||(t.PickResultType=s={}));t.UnavailablePicker=class{constructor(e){this.status=Object.assign({code:r.Status.UNAVAILABLE,details:"No connection established",metadata:new n.Metadata},e)}pick(e){return{pickResultType:s.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}};t.QueuePicker=class{constructor(e,t){this.loadBalancer=e,this.childPicker=t,this.calledExitIdle=!1}pick(e){return this.calledExitIdle||(process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0),this.childPicker?this.childPicker.pick(e):{pickResultType:s.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}}},222(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PriorityQueue=void 0;const i=e=>Math.floor(e/2),n=e=>2*e+1,r=e=>2*e+2;t.PriorityQueue=class{constructor(e=(e,t)=>e>t){this.comparator=e,this.heap=[]}size(){return this.heap.length}isEmpty(){return 0==this.size()}peek(){return this.heap[0]}push(...e){return e.forEach(e=>{this.heap.push(e),this.siftUp()}),this.size()}pop(){const e=this.peek(),t=this.size()-1;return t>0&&this.swap(0,t),this.heap.pop(),this.siftDown(),e}replace(e){const t=this.peek();return this.heap[0]=e,this.siftDown(),t}greater(e,t){return this.comparator(this.heap[e],this.heap[t])}swap(e,t){[this.heap[e],this.heap[t]]=[this.heap[t],this.heap[e]]}siftUp(){let e=this.size()-1;for(;e>0&&this.greater(e,i(e));)this.swap(e,i(e)),e=i(e)}siftDown(){let e=0;for(;n(e)<this.size()&&this.greater(n(e),e)||r(e)<this.size()&&this.greater(r(e),e);){let t=r(e)<this.size()&&this.greater(r(e),n(e))?r(e):n(e);this.swap(e,t),e=t}}}},6700(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PORT=void 0,t.setup=function(){(0,n.registerResolver)("dns",m),(0,n.registerDefaultScheme)("dns")};const n=i(9302),r=i(2250),s=i(5656),o=i(131),a=i(5034),l=i(4097),c=i(267),u=i(131),h=i(3822),d=i(9278),f=i(3956),p=i(883);function g(e){c.trace(u.LogVerbosity.DEBUG,"dns_resolver",e)}t.DEFAULT_PORT=443;class m{constructor(e,i,n){var s,a,c;this.target=e,this.listener=i,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new r.promises.Resolver,g("Resolver constructed for target "+(0,h.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);const u=(0,h.splitHostPort)(e.path);null===u?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,d.isIPv4)(u.host)||(0,d.isIPv6)(u.host)?(this.ipResult=[{addresses:[{host:u.host,port:null!==(s=u.port)&&void 0!==s?s:t.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=u.host,this.port=null!==(a=u.port)&&void 0!==a?a:t.DEFAULT_PORT),this.percentage=100*Math.random(),1===n["grpc.service_config_disable_resolution"]&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:o.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,h.uriToString)(this.target)}`,metadata:new l.Metadata};const p={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoff=new f.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},p),this.backoff.unref(),this.minTimeBetweenResolutionsMs=null!==(c=n["grpc.dns_min_time_between_resolutions_ms"])&&void 0!==c?c:3e4,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(null!==this.ipResult)return this.returnedIpResult||(g("Returning IP address for target "+(0,h.uriToString)(this.target)),setImmediate(()=>{this.listener((0,a.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),void this.stopNextResolutionTimer();if(null===this.dnsHostname)g("Failed to parse DNS address "+(0,h.uriToString)(this.target)),setImmediate(()=>{this.listener((0,a.statusOrFromError)({code:o.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,h.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(null!==this.pendingLookupPromise)return;g("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;const e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(e=>{if(null===this.pendingLookupPromise)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,a.statusOrFromValue)(e.map(e=>({addresses:[e]})));const t="["+e.map(e=>e.host+":"+e.port).join(",")+"]";g("Resolved addresses for target "+(0,h.uriToString)(this.target)+": "+t);const i=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(i)},e=>{null!==this.pendingLookupPromise&&(g("Resolution error for target "+(0,h.uriToString)(this.target)+": "+e.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,a.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&null===this.pendingTxtPromise&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(e=>{if(null===this.pendingTxtPromise)return;let t;this.pendingTxtPromise=null;try{t=(0,s.extractAndSelectServiceConfig)(e,this.percentage),this.latestServiceConfigResult=t?(0,a.statusOrFromValue)(t):null}catch(e){this.latestServiceConfigResult=(0,a.statusOrFromError)({code:o.Status.UNAVAILABLE,details:`Parsing service config failed with error ${e.message}`})}null!==this.latestLookupResult&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},e=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(p.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){g("Using alternative DNS resolver.");const t=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(t.every(e=>"rejected"===e.status))throw new Error(t[0].reason);return t.reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).map(e=>({host:e,port:+this.port}))}return(await r.promises.lookup(e,{all:!0})).map(e=>({host:e.address,port:+this.port}))}async resolveTxt(e){return p.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(g("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):r.promises.resolveTxt(e)}startNextResolutionTimer(){var e,t;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),null===(t=(e=this.nextResolutionTimer).unref)||void 0===t||t.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){null===this.pendingLookupPromise&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){null===this.pendingLookupPromise&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?g('resolution update delayed by "min time between resolutions" rate limit'):g("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}}},82(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setup=function(){(0,a.registerResolver)(d,p),(0,a.registerResolver)(f,p)};const n=i(9278),r=i(5034),s=i(131),o=i(4097),a=i(9302),l=i(8996),c=i(3822),u=i(267);function h(e){u.trace(s.LogVerbosity.DEBUG,"ip_resolver",e)}const d="ipv4",f="ipv6";class p{constructor(e,t,i){var r;this.listener=t,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,h("Resolver constructed for target "+(0,c.uriToString)(e));const a=[];if(e.scheme!==d&&e.scheme!==f)return void(this.error={code:s.Status.UNAVAILABLE,details:`Unrecognized scheme ${e.scheme} in IP resolver`,metadata:new o.Metadata});const u=e.path.split(",");for(const t of u){const i=(0,c.splitHostPort)(t);if(null===i)return void(this.error={code:s.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${t}`,metadata:new o.Metadata});if(e.scheme===d&&!(0,n.isIPv4)(i.host)||e.scheme===f&&!(0,n.isIPv6)(i.host))return void(this.error={code:s.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${t}`,metadata:new o.Metadata});a.push({host:i.host,port:null!==(r=i.port)&&void 0!==r?r:443})}this.endpoints=a.map(e=>({addresses:[e]})),h("Parsed "+e.scheme+" address list "+a.map(l.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,r.statusOrFromError)(this.error),{},null,""):this.listener((0,r.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}}},305(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setup=function(){(0,n.registerResolver)("unix",s)};const n=i(9302),r=i(5034);class s{constructor(e,t,i){let n;this.listener=t,this.hasReturnedResult=!1,this.endpoints=[],n=""===e.authority?"/"+e.path:e.path,this.endpoints=[{addresses:[{path:n}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener,(0,r.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}}},9302(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0,t.registerResolver=function(e,t){r[e]=t},t.registerDefaultScheme=function(e){s=e},t.createResolver=function(e,t,i){if(void 0!==e.scheme&&e.scheme in r)return new r[e.scheme](e,t,i);throw new Error(`No resolver could be created for target ${(0,n.uriToString)(e)}`)},t.getDefaultAuthority=function(e){if(void 0!==e.scheme&&e.scheme in r)return r[e.scheme].getDefaultAuthority(e);throw new Error(`Invalid target ${(0,n.uriToString)(e)}`)},t.mapUriDefaultScheme=function(e){if(void 0===e.scheme||!(e.scheme in r))return null!==s?{scheme:s,authority:void 0,path:(0,n.uriToString)(e)}:null;return e};const n=i(3822);t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";const r={};let s=null},8446(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvingCall=void 0;const n=i(2267),r=i(131),s=i(6308),o=i(4097),a=i(267),l=i(6067);t.ResolvingCall=class{constructor(e,t,i,o,a){this.channel=e,this.method=t,this.filterStackFactory=o,this.callNumber=a,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.readFilterPending=!1,this.writeFilterPending=!1,this.pendingChildStatus=null,this.metadata=null,this.listener=null,this.statusWatchers=[],this.deadlineTimer=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=n.CallCredentials.createEmpty(),this.deadline=i.deadline,this.host=i.host,i.parentCall&&(i.flags&r.Propagate.CANCELLATION&&i.parentCall.on("cancelled",()=>{this.cancelWithStatus(r.Status.CANCELLED,"Cancelled by parent call")}),i.flags&r.Propagate.DEADLINE&&(this.trace("Propagating deadline from parent: "+i.parentCall.getDeadline()),this.deadline=(0,s.minDeadline)(this.deadline,i.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}trace(e){a.trace(r.LogVerbosity.DEBUG,"resolving_call","["+this.callNumber+"] "+e)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,s.deadlineToString)(this.deadline));const e=(0,s.getRelativeTimeout)(this.deadline);if(e!==1/0){this.trace("Deadline will be reached in "+e+"ms");const t=()=>{if(!this.deadlineStartTime)return void this.cancelWithStatus(r.Status.DEADLINE_EXCEEDED,"Deadline exceeded");const e=[],t=new Date;e.push(`Deadline exceeded after ${(0,s.formatDateDifference)(this.deadlineStartTime,t)}`),this.configReceivedTime?(this.configReceivedTime>this.deadlineStartTime&&e.push(`name resolution: ${(0,s.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime?this.childStartTime>this.configReceivedTime&&e.push(`metadata filters: ${(0,s.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`):e.push("waiting for metadata filters")):e.push("waiting for name resolution"),this.child&&e.push(...this.child.getDeadlineInfo()),this.cancelWithStatus(r.Status.DEADLINE_EXCEEDED,e.join(","))};e<=0?process.nextTick(t):this.deadlineTimer=setTimeout(t,e)}}outputStatus(e){if(!this.ended){this.ended=!0,this.filterStack||(this.filterStack=this.filterStackFactory.createFilter()),clearTimeout(this.deadlineTimer);const t=this.filterStack.receiveTrailers(e);this.trace("ended with status: code="+t.code+' details="'+t.details+'"'),this.statusWatchers.forEach(e=>e(t)),process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onReceiveStatus(t)})}}sendMessageOnChild(e,t){if(!this.child)throw new Error("sendMessageonChild called with child not populated");const i=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags})).then(t=>{this.writeFilterPending=!1,i.sendMessageWithContext(e,t.message),this.pendingHalfClose&&i.halfClose()},e=>{this.cancelWithStatus(e.code,e.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw new Error("getConfig called before start");const e=this.channel.getConfig(this.method,this.metadata);if("NONE"===e.type)return void this.channel.queueCallForConfig(this);if("ERROR"===e.type)return void(this.metadata.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e.error));this.configReceivedTime=new Date;const t=e.config;if(t.status!==r.Status.OK){const{code:e,details:i}=(0,l.restrictControlPlaneStatusCode)(t.status,"Failed to route call to method "+this.method);return void this.outputStatus({code:e,details:i,metadata:new o.Metadata})}if(t.methodConfig.timeout){const e=new Date;e.setSeconds(e.getSeconds()+t.methodConfig.timeout.seconds),e.setMilliseconds(e.getMilliseconds()+t.methodConfig.timeout.nanos/1e6),this.deadline=(0,s.minDeadline)(this.deadline,e),this.runDeadlineTimer()}this.filterStackFactory.push(t.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(e=>{this.child=this.channel.createRetryingCall(t,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(e,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(e))},onReceiveMessage:e=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(e).then(e=>{this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(e),this.pendingChildStatus&&this.outputStatus(this.pendingChildStatus)},e=>{this.cancelWithStatus(e.code,e.details)})},onReceiveStatus:e=>{this.trace("Received status"),this.readFilterPending?this.pendingChildStatus=e:this.outputStatus(e)}}),this.readPending&&this.child.startRead(),this.pendingMessage?this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message):this.pendingHalfClose&&this.child.halfClose()},e=>{this.outputStatus(e)})}reportResolverError(e){var t;(null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)?this.channel.queueCallForConfig(this):this.outputStatus(e)}cancelWithStatus(e,t){var i;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(i=this.child)||void 0===i||i.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new o.Metadata})}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.metadata=e.clone(),this.listener=t,this.getConfig()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.sendMessageOnChild(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child&&!this.writeFilterPending?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){this.credentials=e}addStatusWatcher(e){this.statusWatchers.push(e)}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}}},4973(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvingLoadBalancer=void 0;const n=i(8923),r=i(5656),s=i(463),o=i(9302),a=i(178),l=i(3956),c=i(131),u=i(4097),h=i(267),d=i(131),f=i(3822),p=i(533);function g(e){h.trace(d.LogVerbosity.DEBUG,"resolving_load_balancer",e)}const m=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function v(e,t,i,n){for(const r of i.name)switch(n){case"EMPTY":if(!r.service&&!r.method)return!0;break;case"SERVICE":if(r.service===e&&!r.method)return!0;break;case"SERVICE_AND_METHOD":if(r.service===e&&r.method===t)return!0}return!1}function y(e,t,i,n){for(const r of i)if(v(e,t,r,n))return r;return null}t.ResolvingLoadBalancer=class{constructor(e,t,i,n,c){this.target=e,this.channelControlHelper=t,this.channelOptions=i,this.onSuccessfulResolution=n,this.onFailedResolution=c,this.latestChildState=s.ConnectivityState.IDLE,this.latestChildPicker=new a.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=s.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,i["grpc.service_config"]?this.defaultServiceConfig=(0,r.validateServiceConfig)(JSON.parse(i["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(s.ConnectivityState.IDLE,new a.QueuePicker(this),null),this.childLoadBalancer=new p.ChildLoadBalancerHandler({createSubchannel:t.createSubchannel.bind(t),requestReresolution:()=>{this.backoffTimeout.isRunning()?(g("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0):this.updateResolution()},updateState:(e,t,i)=>{this.latestChildState=e,this.latestChildPicker=t,this.latestChildErrorMessage=i,this.updateState(e,t,i)},addChannelzChild:t.addChannelzChild.bind(t),removeChannelzChild:t.removeChannelzChild.bind(t)}),this.innerResolver=(0,o.createResolver)(e,this.handleResolverResult.bind(this),i);const u={initialDelay:i["grpc.initial_reconnect_backoff_ms"],maxDelay:i["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new l.BackoffTimeout(()=>{this.continueResolving?(this.updateResolution(),this.continueResolving=!1):this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},u),this.backoffTimeout.unref()}handleResolverResult(e,t,i,r){var s,a;this.backoffTimeout.stop(),this.backoffTimeout.reset();let l=!0,h=null;if(null===i?h=this.defaultServiceConfig:i.ok?h=i.value:null!==this.previousServiceConfig?h=this.previousServiceConfig:(l=!1,this.handleResolutionFailure(i.error)),null!==h){const i=null!==(s=null==h?void 0:h.loadBalancingConfig)&&void 0!==s?s:[],o=(0,n.selectLbConfigFromList)(i,!0);null===o?(l=!1,this.handleResolutionFailure({code:c.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new u.Metadata})):l=this.childLoadBalancer.updateAddressList(e,o,Object.assign(Object.assign({},this.channelOptions),t),r)}return l&&this.onSuccessfulResolution(h,null!==(a=t[o.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])&&void 0!==a?a:function(e){return{invoke(t,i){var n,r;const s=t.split("/").filter(e=>e.length>0),o=null!==(n=s[0])&&void 0!==n?n:"",a=null!==(r=s[1])&&void 0!==r?r:"";if(e&&e.methodConfig)for(const t of m){const i=y(o,a,e.methodConfig,t);if(i)return{methodConfig:i,pickInformation:{},status:c.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:c.Status.OK,dynamicFilterFactories:[]}},unref(){}}}(h)),l}updateResolution(){this.innerResolver.updateResolution(),this.currentState===s.ConnectivityState.IDLE&&this.updateState(s.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage),this.backoffTimeout.runOnce()}updateState(e,t,i){g((0,f.uriToString)(this.target)+" "+s.ConnectivityState[this.currentState]+" -> "+s.ConnectivityState[e]),e===s.ConnectivityState.IDLE&&(t=new a.QueuePicker(this,t)),this.currentState=e,this.channelControlHelper.updateState(e,t,i)}handleResolutionFailure(e){this.latestChildState===s.ConnectivityState.IDLE&&(this.updateState(s.ConnectivityState.TRANSIENT_FAILURE,new a.UnavailablePicker(e),e.details),this.onFailedResolution(e))}exitIdle(){this.currentState!==s.ConnectivityState.IDLE&&this.currentState!==s.ConnectivityState.TRANSIENT_FAILURE||(this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()),this.childLoadBalancer.exitIdle()}updateAddressList(e,t){throw new Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.backoffTimeout.reset(),this.backoffTimeout.stop(),this.latestChildState=s.ConnectivityState.IDLE,this.latestChildPicker=new a.QueuePicker(this),this.currentState=s.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}}},3135(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RetryingCall=t.MessageBufferTracker=t.RetryThrottler=void 0;const n=i(131),r=i(6308),s=i(4097),o=i(267);t.RetryThrottler=class{constructor(e,t,i){this.maxTokens=e,this.tokenRatio=t,this.tokens=i?i.tokens*(e/i.maxTokens):e}addCallSucceeded(){this.tokens=Math.min(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.max(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}};t.MessageBufferTracker=class{constructor(e,t){this.totalLimit=e,this.limitPerCall=t,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(e,t){var i;const n=null!==(i=this.allocatedPerCall.get(t))&&void 0!==i?i:0;return!(this.limitPerCall-n<e||this.totalLimit-this.totalAllocated<e)&&(this.allocatedPerCall.set(t,n+e),this.totalAllocated+=e,!0)}free(e,t){var i;if(this.totalAllocated<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > total allocated ${this.totalAllocated}`);this.totalAllocated-=e;const n=null!==(i=this.allocatedPerCall.get(t))&&void 0!==i?i:0;if(n<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > allocated for call ${n}`);this.allocatedPerCall.set(t,n-e)}freeAll(e){var t;const i=null!==(t=this.allocatedPerCall.get(e))&&void 0!==t?t:0;if(this.totalAllocated<i)throw new Error(`Invalid buffer allocation state: call ${e} allocated ${i} > total allocated ${this.totalAllocated}`);this.totalAllocated-=i,this.allocatedPerCall.delete(e)}};const a="grpc-previous-rpc-attempts";t.RetryingCall=class{constructor(e,t,i,n,r,s,o,a,l){var c;this.channel=e,this.callConfig=t,this.methodName=i,this.host=n,this.credentials=r,this.deadline=s,this.callNumber=o,this.bufferTracker=a,this.retryThrottler=l,this.listener=null,this.initialMetadata=null,this.underlyingCalls=[],this.writeBuffer=[],this.writeBufferOffset=0,this.readStarted=!1,this.transparentRetryUsed=!1,this.attempts=0,this.hedgingTimer=null,this.committedCallIndex=null,this.initialRetryBackoffSec=0,this.nextRetryBackoffSec=0;const u=null!==(c=e.getOptions()["grpc-node.retry_max_attempts_limit"])&&void 0!==c?c:5;if(0===e.getOptions()["grpc.enable_retries"])this.state="NO_RETRY",this.maxAttempts=1;else if(t.methodConfig.retryPolicy){this.state="RETRY";const e=t.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(e.initialBackoff.substring(0,e.initialBackoff.length-1)),this.maxAttempts=Math.min(e.maxAttempts,u)}else t.methodConfig.hedgingPolicy?(this.state="HEDGING",this.maxAttempts=Math.min(t.methodConfig.hedgingPolicy.maxAttempts,u)):(this.state="TRANSPARENT_ONLY",this.maxAttempts=1);this.startTime=new Date}getDeadlineInfo(){if(0===this.underlyingCalls.length)return[];const e=[],t=this.underlyingCalls[this.underlyingCalls.length-1];return this.underlyingCalls.length>1&&e.push("previous attempts: "+(this.underlyingCalls.length-1)),t.startTime>this.startTime&&e.push(`time to current attempt start: ${(0,r.formatDateDifference)(this.startTime,t.startTime)}`),e.push(...t.call.getDeadlineInfo()),e}getCallNumber(){return this.callNumber}trace(e){o.trace(n.LogVerbosity.DEBUG,"retrying_call","["+this.callNumber+"] "+e)}reportStatus(e){this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var t;null===(t=this.listener)||void 0===t||t.onReceiveStatus({code:e.code,details:e.details,metadata:e.metadata})})}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.reportStatus({code:e,details:t,metadata:new s.Metadata});for(const{call:i}of this.underlyingCalls)i.cancelWithStatus(e,t)}getPeer(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getPeer():"unknown"}getBufferEntry(e){var t;return null!==(t=this.writeBuffer[e-this.writeBufferOffset])&&void 0!==t?t:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if("COMMITTED"!==this.state)return;let e;e="COMPLETED"===this.underlyingCalls[this.committedCallIndex].state?this.getNextBufferIndex():this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let t=this.writeBufferOffset;t<e;t++){const e=this.getBufferEntry(t);e.allocated&&this.bufferTracker.free(e.message.message.length,this.callNumber)}this.writeBuffer=this.writeBuffer.slice(e-this.writeBufferOffset),this.writeBufferOffset=e}commitCall(e){var t,i;if("COMMITTED"!==this.state){this.trace("Committing call ["+this.underlyingCalls[e].call.getCallNumber()+"] at index "+e),this.state="COMMITTED",null===(i=(t=this.callConfig).onCommitted)||void 0===i||i.call(t),this.committedCallIndex=e;for(let t=0;t<this.underlyingCalls.length;t++)t!==e&&"COMPLETED"!==this.underlyingCalls[t].state&&(this.underlyingCalls[t].state="COMPLETED",this.underlyingCalls[t].call.cancelWithStatus(n.Status.CANCELLED,"Discarded in favor of other hedged attempt"));this.clearSentMessages()}}commitCallWithMostMessages(){if("COMMITTED"===this.state)return;let e=-1,t=-1;for(const[i,n]of this.underlyingCalls.entries())"ACTIVE"===n.state&&n.nextMessageToSend>e&&(e=n.nextMessageToSend,t=i);-1===t?this.state="TRANSPARENT_ONLY":this.commitCall(t)}isStatusCodeInList(e,t){return e.some(e=>{var i;return e===t||e.toString().toLowerCase()===(null===(i=n.Status[t])||void 0===i?void 0:i.toLowerCase())})}getNextRetryJitter(){return Math.random()*(1.2-.8)+.8}getNextRetryBackoffMs(){var e;const t=null===(e=this.callConfig)||void 0===e?void 0:e.methodConfig.retryPolicy;if(!t)return 0;const i=this.getNextRetryJitter()*this.nextRetryBackoffSec*1e3,n=Number(t.maxBackoff.substring(0,t.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*t.backoffMultiplier,n),i}maybeRetryCall(e,t){if("RETRY"!==this.state)return void t(!1);if(this.attempts>=this.maxAttempts)return void t(!1);let i;if(null===e)i=this.getNextRetryBackoffMs();else{if(e<0)return this.state="TRANSPARENT_ONLY",void t(!1);i=e,this.nextRetryBackoffSec=this.initialRetryBackoffSec}setTimeout(()=>{var e,i;"RETRY"===this.state?null===(i=null===(e=this.retryThrottler)||void 0===e?void 0:e.canRetryCall())||void 0===i||i?(t(!0),this.attempts+=1,this.startNewAttempt()):(this.trace("Retry attempt denied by throttling policy"),t(!1)):t(!1)},i)}countActiveCalls(){let e=0;for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(e+=1);return e}handleProcessedStatus(e,t,i){var n,r,s;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(t),this.reportStatus(e);break;case"HEDGING":if(this.isStatusCodeInList(null!==(n=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)&&void 0!==n?n:[],e.code)){let n;if(null===(r=this.retryThrottler)||void 0===r||r.addCallFailed(),null===i)n=0;else{if(i<0)return this.state="TRANSPARENT_ONLY",this.commitCall(t),void this.reportStatus(e);n=i}setTimeout(()=>{this.maybeStartHedgingAttempt(),0===this.countActiveCalls()&&(this.commitCall(t),this.reportStatus(e))},n)}else this.commitCall(t),this.reportStatus(e);break;case"RETRY":this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,e.code)?(null===(s=this.retryThrottler)||void 0===s||s.addCallFailed(),this.maybeRetryCall(i,i=>{i||(this.commitCall(t),this.reportStatus(e))})):(this.commitCall(t),this.reportStatus(e))}}getPushback(e){const t=e.get("grpc-retry-pushback-ms");if(0===t.length)return null;try{return parseInt(t[0])}catch(e){return-1}}handleChildStatus(e,t){var i;if("COMPLETED"===this.underlyingCalls[t].state)return;if(this.trace("state="+this.state+" handling status with progress "+e.progress+" from child ["+this.underlyingCalls[t].call.getCallNumber()+"] in state "+this.underlyingCalls[t].state),this.underlyingCalls[t].state="COMPLETED",e.code===n.Status.OK)return null===(i=this.retryThrottler)||void 0===i||i.addCallSucceeded(),this.commitCall(t),void this.reportStatus(e);if("NO_RETRY"===this.state)return this.commitCall(t),void this.reportStatus(e);if("COMMITTED"===this.state)return void this.reportStatus(e);const r=this.getPushback(e.metadata);switch(e.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":this.transparentRetryUsed?this.handleProcessedStatus(e,t,r):(this.transparentRetryUsed=!0,this.startNewAttempt());break;case"DROP":this.commitCall(t),this.reportStatus(e);break;case"PROCESSED":this.handleProcessedStatus(e,t,r)}}maybeStartHedgingAttempt(){"HEDGING"===this.state&&this.callConfig.methodConfig.hedgingPolicy&&(this.attempts>=this.maxAttempts||(this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()))}maybeStartHedgingTimer(){var e,t,i;if(this.hedgingTimer&&clearTimeout(this.hedgingTimer),"HEDGING"!==this.state)return;if(!this.callConfig.methodConfig.hedgingPolicy)return;const n=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;const r=null!==(e=n.hedgingDelay)&&void 0!==e?e:"0s",s=Number(r.substring(0,r.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},1e3*s),null===(i=(t=this.hedgingTimer).unref)||void 0===i||i.call(t)}startNewAttempt(){const e=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+e.getCallNumber()+"] for attempt "+this.attempts);const t=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:e,nextMessageToSend:0,startTime:new Date});const i=this.attempts-1,n=this.initialMetadata.clone();i>0&&n.set(a,`${i}`);let r=!1;e.start(n,{onReceiveMetadata:n=>{this.trace("Received metadata from child ["+e.getCallNumber()+"]"),this.commitCall(t),r=!0,i>0&&n.set(a,`${i}`),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMetadata(n)},onReceiveMessage:i=>{this.trace("Received message from child ["+e.getCallNumber()+"]"),this.commitCall(t),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMessage(i)},onReceiveStatus:n=>{this.trace("Received status from child ["+e.getCallNumber()+"]"),!r&&i>0&&n.metadata.set(a,`${i}`),this.handleChildStatus(n,t)}}),this.sendNextChildMessage(t),this.readStarted&&e.startRead()}start(e,t){this.trace("start called"),this.listener=t,this.initialMetadata=e,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(e,t){var i,n;null===(n=(i=this.getBufferEntry(t)).callback)||void 0===n||n.call(i),this.clearSentMessages();this.underlyingCalls[e].nextMessageToSend+=1,this.sendNextChildMessage(e)}sendNextChildMessage(e){const t=this.underlyingCalls[e];if("COMPLETED"===t.state)return;const i=t.nextMessageToSend;if(this.getBufferEntry(i)){const n=this.getBufferEntry(i);switch(n.entryType){case"MESSAGE":t.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,i)}},n.message.message);"HALF_CLOSE"===this.getBufferEntry(i+1).entryType&&(this.trace("Sending halfClose immediately after message to child ["+t.call.getCallNumber()+"] - optimizing for unary/final message"),t.nextMessageToSend+=1,t.call.halfClose());break;case"HALF_CLOSE":t.nextMessageToSend+=1,t.call.halfClose()}}}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const i={message:t,flags:e.flags},n=this.getNextBufferIndex(),r={entryType:"MESSAGE",message:i,allocated:this.bufferTracker.allocate(t.length,this.callNumber)};if(this.writeBuffer.push(r),r.allocated){process.nextTick(()=>{var t;null===(t=e.callback)||void 0===t||t.call(e)});for(const[e,i]of this.underlyingCalls.entries())"ACTIVE"===i.state&&i.nextMessageToSend===n&&i.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,n)}},t)}else{if(this.commitCallWithMostMessages(),null===this.committedCallIndex)return;const i=this.underlyingCalls[this.committedCallIndex];r.callback=e.callback,"ACTIVE"===i.state&&i.nextMessageToSend===n&&i.call.sendMessageWithContext({callback:e=>{this.handleChildWriteCompleted(this.committedCallIndex,n)}},t)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(const e of this.underlyingCalls)"ACTIVE"===(null==e?void 0:e.state)&&e.call.startRead()}halfClose(){this.trace("halfClose called");const e=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(t.nextMessageToSend!==e&&t.nextMessageToSend!==e-1||(this.trace("Sending halfClose immediately to child ["+t.call.getCallNumber()+"] - all messages already sent"),t.nextMessageToSend+=1,t.call.halfClose()))}setCredentials(e){throw new Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getAuthContext():null}}},6860(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerDuplexStreamImpl=t.ServerWritableStreamImpl=t.ServerReadableStreamImpl=t.ServerUnaryCallImpl=void 0,t.serverErrorToStatus=a;const n=i(4434),r=i(2203),s=i(131),o=i(4097);function a(e,t){var i;const n={code:s.Status.UNKNOWN,details:"message"in e?e.message:"Unknown Error",metadata:null!==(i=null!=t?t:e.metadata)&&void 0!==i?i:null};return"code"in e&&"number"==typeof e.code&&Number.isInteger(e.code)&&(n.code=e.code,"details"in e&&"string"==typeof e.details&&(n.details=e.details)),n}class l extends n.EventEmitter{constructor(e,t,i,n){super(),this.path=e,this.call=t,this.metadata=i,this.request=n,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}t.ServerUnaryCallImpl=l;class c extends r.Readable{constructor(e,t,i){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=i,this.cancelled=!1}_read(e){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}t.ServerReadableStreamImpl=c;class u extends r.Writable{constructor(e,t,i,n){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=i,this.request=n,this.pendingStatus={code:s.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new o.Metadata,this.on("error",e=>{this.pendingStatus=a(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(e,t,i){this.call.sendMessage(e,i)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}t.ServerWritableStreamImpl=u;class h extends r.Duplex{constructor(e,t,i){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=i,this.pendingStatus={code:s.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new o.Metadata,this.on("error",e=>{this.pendingStatus=a(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(e){this.call.startRead()}_write(e,t,i){this.call.sendMessage(e,i)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}t.ServerDuplexStreamImpl=h},8692(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerCredentials=void 0,t.createCertificateProviderServerCredentials=function(e,t,i){return new a(e,t,i)},t.createServerCredentialsWithInterceptors=function(e,t){return new l(e,t)};const n=i(9167);class r{constructor(e,t){this.serverConstructorOptions=e,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=null!=t?t:null}_addWatcher(e){this.watchers.add(e)}_removeWatcher(e){this.watchers.delete(e)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(e){this.latestContextOptions=e;for(const e of this.watchers)e(this.latestContextOptions)}_isSecure(){return null!==this.serverConstructorOptions}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new s}static createSsl(e,t,i=!1){var r;if(null!==e&&!Buffer.isBuffer(e))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(t))throw new TypeError("keyCertPairs must be an array");if("boolean"!=typeof i)throw new TypeError("checkClientCertificate must be a boolean");const s=[],a=[];for(let e=0;e<t.length;e++){const i=t[e];if(null===i||"object"!=typeof i)throw new TypeError(`keyCertPair[${e}] must be an object`);if(!Buffer.isBuffer(i.private_key))throw new TypeError(`keyCertPair[${e}].private_key must be a Buffer`);if(!Buffer.isBuffer(i.cert_chain))throw new TypeError(`keyCertPair[${e}].cert_chain must be a Buffer`);s.push(i.cert_chain),a.push(i.private_key)}return new o({requestCert:i,ciphers:n.CIPHER_SUITES},{ca:null!==(r=null!=e?e:(0,n.getDefaultRootsData)())&&void 0!==r?r:void 0,cert:s,key:a})}}t.ServerCredentials=r;class s extends r{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof s}}class o extends r{constructor(e,t){super(e,t),this.options=Object.assign(Object.assign({},e),t)}_equals(e){if(this===e)return!0;if(!(e instanceof o))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(e.options.ca)){if(!this.options.ca.equals(e.options.ca))return!1}else if(this.options.ca!==e.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(e.options.cert)){if(this.options.cert.length!==e.options.cert.length)return!1;for(let t=0;t<this.options.cert.length;t++){const i=this.options.cert[t],n=e.options.cert[t];if(Buffer.isBuffer(i)&&Buffer.isBuffer(n)){if(!i.equals(n))return!1}else if(i!==n)return!1}}else if(this.options.cert!==e.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(e.options.key)){if(this.options.key.length!==e.options.key.length)return!1;for(let t=0;t<this.options.key.length;t++){const i=this.options.key[t],n=e.options.key[t];if(Buffer.isBuffer(i)&&Buffer.isBuffer(n)){if(!i.equals(n))return!1}else if(i!==n)return!1}}else if(this.options.key!==e.options.key)return!1;return this.options.requestCert===e.options.requestCert}}class a extends r{constructor(e,t,i){super({requestCert:null!==t,rejectUnauthorized:i,ciphers:n.CIPHER_SUITES}),this.identityCertificateProvider=e,this.caCertificateProvider=t,this.requireClientCertificate=i,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(e){var t;0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener)),super._addWatcher(e)}_removeWatcher(e){var t;super._removeWatcher(e),0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_equals(e){return this===e||e instanceof a&&(this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&this.requireClientCertificate===e.requireClientCertificate)}calculateSecureContextOptions(){var e;return null===this.latestIdentityUpdate||null!==this.caCertificateProvider&&null===this.latestCaUpdate?null:{ca:null===(e=this.latestCaUpdate)||void 0===e?void 0:e.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){const e=this.calculateSecureContextOptions();this.updateSecureContextOptions(e)}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.finalizeUpdate()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.finalizeUpdate()}}class l extends r{constructor(e,t){super({}),this.childCredentials=e,this.interceptors=t}_isSecure(){return this.childCredentials._isSecure()}_equals(e){if(!(e instanceof l))return!1;if(!this.childCredentials._equals(e.childCredentials))return!1;if(this.interceptors.length!==e.interceptors.length)return!1;for(let t=0;t<this.interceptors.length;t++)if(this.interceptors[t]!==e.interceptors[t])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(e){this.childCredentials._addWatcher(e)}_removeWatcher(e){this.childCredentials._removeWatcher(e)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}}},4892(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseServerInterceptingCall=t.ServerInterceptingCall=t.ResponderBuilder=t.ServerListenerBuilder=void 0,t.isInterceptingServerListener=function(e){return void 0!==e.onReceiveMetadata&&1===e.onReceiveMetadata.length},t.getServerInterceptingCall=function(e,t,i,n,r,s){const o={path:r.path,requestStream:"clientStream"===r.type||"bidi"===r.type,responseStream:"serverStream"===r.type||"bidi"===r.type,requestDeserialize:r.deserialize,responseSerialize:r.serialize},a=new R(t,i,n,r,s);return e.reduce((e,t)=>t(o,e),a)};const n=i(4097),r=i(131),s=i(5675),o=i(9752),a=i(3106),l=i(9453),c=i(267),u=i(4756),h=i(2921),d="server_call";function f(e){c.trace(r.LogVerbosity.DEBUG,d,e)}t.ServerListenerBuilder=class{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveHalfClose(e){return this.halfClose=e,this}withOnCancel(e){return this.cancel=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}};class p{constructor(e,t){this.listener=e,this.nextListener=t,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingHalfClose(){this.hasPendingHalfClose&&(this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1)}onReceiveMetadata(e){this.cancelled||(this.processingMetadata=!0,this.listener.onReceiveMetadata(e,e=>{this.processingMetadata=!1,this.cancelled||(this.nextListener.onReceiveMetadata(e),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(e){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(e,e=>{this.processingMessage=!1,this.cancelled||(this.processingMetadata?(this.pendingMessage=e,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(e),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}}t.ResponderBuilder=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(e){return this.start=e,this}withSendMetadata(e){return this.metadata=e,this}withSendMessage(e){return this.message=e,this}withSendStatus(e){return this.status=e,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};const g={onReceiveMetadata:(e,t)=>{t(e)},onReceiveMessage:(e,t)=>{t(e)},onReceiveHalfClose:e=>{e()},onCancel:()=>{}},m={start:e=>{e()},sendMetadata:(e,t)=>{t(e)},sendMessage:(e,t)=>{t(e)},sendStatus:(e,t)=>{t(e)}};t.ServerInterceptingCall=class{constructor(e,t){var i,n,r,s;this.nextCall=e,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:null!==(i=null==t?void 0:t.start)&&void 0!==i?i:m.start,sendMetadata:null!==(n=null==t?void 0:t.sendMetadata)&&void 0!==n?n:m.sendMetadata,sendMessage:null!==(r=null==t?void 0:t.sendMessage)&&void 0!==r?r:m.sendMessage,sendStatus:null!==(s=null==t?void 0:t.sendStatus)&&void 0!==s?s:m.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(e){this.responder.start(t=>{var i,n,r,s;const o={onReceiveMetadata:null!==(i=null==t?void 0:t.onReceiveMetadata)&&void 0!==i?i:g.onReceiveMetadata,onReceiveMessage:null!==(n=null==t?void 0:t.onReceiveMessage)&&void 0!==n?n:g.onReceiveMessage,onReceiveHalfClose:null!==(r=null==t?void 0:t.onReceiveHalfClose)&&void 0!==r?r:g.onReceiveHalfClose,onCancel:null!==(s=null==t?void 0:t.onCancel)&&void 0!==s?s:g.onCancel},a=new p(o,e);this.nextCall.start(a)})}sendMetadata(e){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(e,e=>{this.processingMetadata=!1,this.nextCall.sendMetadata(e),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(e,t){this.processingMessage=!0,this.sentMetadata||this.sendMetadata(new n.Metadata),this.responder.sendMessage(e,e=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=e,this.pendingMessageCallback=t):this.nextCall.sendMessage(e,t)})}sendStatus(e){this.responder.sendStatus(e,e=>{this.processingMetadata||this.processingMessage?this.pendingStatus=e:this.nextCall.sendStatus(e)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}};const v="grpc-accept-encoding",y="grpc-encoding",b="grpc-message",S="grpc-status",_="grpc-timeout",C=/(\d{1,8})\s*([HMSmun])/,w={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},E={[v]:"identity,deflate,gzip",[y]:"identity"},T={[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_OK,[s.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},k={waitForTrailers:!0};class R{constructor(e,t,i,o,a){var u,p;this.stream=e,this.callEventTracker=i,this.handler=o,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=r.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=r.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new h.PerRequestMetricRecorder,this.stream.once("error",e=>{}),this.stream.once("close",()=>{var e;f("Request to method "+(null===(e=this.handler)||void 0===e?void 0:e.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:r.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",e=>{this.handleDataFrame(e)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in a&&(this.maxSendMessageSize=a["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in a&&(this.maxReceiveMessageSize=a["grpc.max_receive_message_length"]),this.host=null!==(u=t[":authority"])&&void 0!==u?u:t.host,this.decoder=new l.StreamDecoder(this.maxReceiveMessageSize);const g=n.Metadata.fromHttp2Headers(t);c.isTracerEnabled(d)&&f("Request to "+this.handler.path+" received headers "+JSON.stringify(g.toJSON()));const m=g.get(_);m.length>0&&this.handleTimeoutHeader(m[0]);const b=g.get(y);b.length>0&&(this.incomingEncoding=b[0]),g.remove(_),g.remove(y),g.remove(v),g.remove(s.constants.HTTP2_HEADER_ACCEPT_ENCODING),g.remove(s.constants.HTTP2_HEADER_TE),g.remove(s.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=g;const S=null===(p=e.session)||void 0===p?void 0:p.socket;this.connectionInfo={localAddress:null==S?void 0:S.localAddress,localPort:null==S?void 0:S.localPort,remoteAddress:null==S?void 0:S.remoteAddress,remotePort:null==S?void 0:S.remotePort},this.shouldSendMetrics=!!a["grpc.server_call_metric_recording"]}handleTimeoutHeader(e){const t=e.toString().match(C);if(null===t){const t={code:r.Status.INTERNAL,details:`Invalid ${_} value "${e}"`,metadata:null};return void process.nextTick(()=>{this.sendStatus(t)})}const i=+t[1]*w[t[2]]|0,n=new Date;this.deadline=n.setMilliseconds(n.getMilliseconds()+i),this.deadlineTimer=setTimeout(()=>{const e={code:r.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(e)},i)}checkCancelled(){return this.cancelled||!this.stream.destroyed&&!this.stream.closed||(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onCancel()}),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.resume())}maybeSendMetadata(){this.metadataSent||this.sendMetadata(new n.Metadata)}serializeMessage(e){const t=this.handler.serialize(e),i=t.byteLength,n=Buffer.allocUnsafe(i+5);return n.writeUInt8(0,0),n.writeUInt32BE(i,1),t.copy(n,5),n}decompressMessage(e,t){const i=e.subarray(5);if("identity"===t)return i;if("deflate"===t||"gzip"===t){let e;return e="deflate"===t?a.createInflate():a.createGunzip(),new Promise((t,n)=>{let s=0;const o=[];e.on("data",t=>{o.push(t),s+=t.byteLength,-1!==this.maxReceiveMessageSize&&s>this.maxReceiveMessageSize&&(e.destroy(),n({code:r.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),e.on("end",()=>{t(Buffer.concat(o))}),e.write(i),e.end()})}return Promise.reject({code:r.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${t}"`})}async decompressAndMaybePush(e){if("COMPRESSED"!==e.type)throw new Error(`Invalid queue entry type: ${e.type}`);const t=1===e.compressedMessage.readUInt8(0)?this.incomingEncoding:"identity";let i;try{i=await this.decompressMessage(e.compressedMessage,t)}catch(e){return void this.sendStatus(e)}try{e.parsedMessage=this.handler.deserialize(i)}catch(e){return void this.sendStatus({code:r.Status.INTERNAL,details:`Error deserializing request: ${e.message}`})}e.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&"COMPRESSED"!==this.readQueue[0].type){this.isReadPending=!1;const e=this.readQueue.shift();"READABLE"===e.type?this.listener.onReceiveMessage(e.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(e){var t;if(this.checkCancelled())return;let i;f("Request to "+this.handler.path+" received data frame of size "+e.length);try{i=this.decoder.write(e)}catch(e){return void this.sendStatus({code:r.Status.RESOURCE_EXHAUSTED,details:e.message})}for(const e of i){this.stream.pause();const i={type:"COMPRESSED",compressedMessage:e,parsedMessage:null};this.readQueue.push(i),this.decompressAndMaybePush(i),null===(t=this.callEventTracker)||void 0===t||t.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(e){f("Request to "+this.handler.path+" start called"),this.checkCancelled()||(this.listener=e,e.onReceiveMetadata(this.metadata))}sendMetadata(e){if(this.checkCancelled())return;if(this.metadataSent)return;this.metadataSent=!0;const t=e?e.toHttp2Headers():null,i=Object.assign(Object.assign(Object.assign({},T),E),t);this.stream.respond(i,k)}sendMessage(e,t){if(this.checkCancelled())return;let i;try{i=this.serializeMessage(e)}catch(e){return void this.sendStatus({code:r.Status.INTERNAL,details:`Error serializing response: ${(0,o.getErrorMessage)(e)}`,metadata:null})}-1!==this.maxSendMessageSize&&i.length-5>this.maxSendMessageSize?this.sendStatus({code:r.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${i.length} vs. ${this.maxSendMessageSize})`,metadata:null}):(this.maybeSendMetadata(),f("Request to "+this.handler.path+" sent data frame of size "+i.length),this.stream.write(i,e=>{var i;e?this.sendStatus({code:r.Status.INTERNAL,details:`Error writing message: ${(0,o.getErrorMessage)(e)}`,metadata:null}):(null===(i=this.callEventTracker)||void 0===i||i.addMessageSent(),t())}))}sendStatus(e){var t,i,s;if(this.checkCancelled())return;f("Request to method "+(null===(t=this.handler)||void 0===t?void 0:t.path)+" ended with status code: "+r.Status[e.code]+" details: "+e.details);const o=null!==(s=null===(i=e.metadata)||void 0===i?void 0:i.clone())&&void 0!==s?s:new n.Metadata;if(this.shouldSendMetrics&&o.set(h.GRPC_METRICS_HEADER,this.metricsRecorder.serialize()),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));const t=Object.assign({[S]:e.code,[b]:encodeURI(e.details)},o.toHttp2Headers());this.stream.sendTrailers(t),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));const t=Object.assign(Object.assign({[S]:e.code,[b]:encodeURI(e.details)},T),o.toHttp2Headers());this.stream.respond(t,{endStream:!0}),this.notifyOnCancel()}}startRead(){f("Request to "+this.handler.path+" startRead called"),this.checkCancelled()||(this.isReadPending=!0,0===this.readQueue.length?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var e;const t=null===(e=this.stream.session)||void 0===e?void 0:e.socket;return(null==t?void 0:t.remoteAddress)?t.remotePort?`${t.remoteAddress}:${t.remotePort}`:t.remoteAddress:"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var e;if((null===(e=this.stream.session)||void 0===e?void 0:e.socket)instanceof u.TLSSocket){const e=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:e.raw?e:void 0}}return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}}t.BaseServerInterceptingCall=R},5943(e,t,i){"use strict";var n=this&&this.__runInitializers||function(e,t,i){for(var n=arguments.length>2,r=0;r<t.length;r++)i=n?t[r].call(e,i):t[r].call(e);return n?i:void 0},r=this&&this.__esDecorate||function(e,t,i,n,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?n.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),d=!1,f=i.length-1;f>=0;f--){var p={};for(var g in n)p[g]="access"===g?{}:n[g];for(var g in n.access)p.access[g]=n.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,i[f])("accessor"===l?{get:h.get,set:h.set}:h[c],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(h.get=a),(a=o(m.set))&&(h.set=a),(a=o(m.init))&&r.unshift(a)}else(a=o(m))&&("field"===l?r.unshift(a):h[c]=a)}u&&Object.defineProperty(u,n.name,h),d=!0};Object.defineProperty(t,"__esModule",{value:!0}),t.Server=void 0;const s=i(5675),o=i(9023),a=i(131),l=i(6860),c=i(8692),u=i(9302),h=i(267),d=i(8996),f=i(3822),p=i(9503),g=i(4892),m=~(1<<31),v=~(1<<31),y=~(1<<31),{HTTP2_HEADER_PATH:b}=s.constants,S=Buffer.from("max_age");function _(e){h.trace(a.LogVerbosity.DEBUG,"server_call",e)}function C(){}function w(e){return{code:a.Status.UNIMPLEMENTED,details:`The server does not implement the method ${e}`}}let E=(()=>{var e;let t,i=[];return e=class{constructor(e){var t,r,s,o,a,l;this.boundPorts=(n(this,i),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=null!=e?e:{},0===this.options["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new p.ChannelzTraceStub,this.callTracker=new p.ChannelzCallTrackerStub,this.listenerChildrenTracker=new p.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new p.ChannelzChildrenTrackerStub):(this.channelzTrace=new p.ChannelzTrace,this.callTracker=new p.ChannelzCallTracker,this.listenerChildrenTracker=new p.ChannelzChildrenTracker,this.sessionChildrenTracker=new p.ChannelzChildrenTracker),this.channelzRef=(0,p.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=null!==(t=this.options["grpc.max_connection_age_ms"])&&void 0!==t?t:m,this.maxConnectionAgeGraceMs=null!==(r=this.options["grpc.max_connection_age_grace_ms"])&&void 0!==r?r:m,this.keepaliveTimeMs=null!==(s=this.options["grpc.keepalive_time_ms"])&&void 0!==s?s:v,this.keepaliveTimeoutMs=null!==(o=this.options["grpc.keepalive_timeout_ms"])&&void 0!==o?o:2e4,this.sessionIdleTimeout=null!==(a=this.options["grpc.max_connection_idle_ms"])&&void 0!==a?a:y,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options?this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=null!==(l=this.options.interceptors)&&void 0!==l?l:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(e){var t,i,n;const r=this.sessions.get(e),s=e.socket,o=s.remoteAddress?(0,d.stringToSubchannelAddress)(s.remoteAddress,s.remotePort):null,a=s.localAddress?(0,d.stringToSubchannelAddress)(s.localAddress,s.localPort):null;let l;if(e.encrypted){const e=s,i=e.getCipher(),n=e.getCertificate(),r=e.getPeerCertificate();l={cipherSuiteStandardName:null!==(t=i.standardName)&&void 0!==t?t:null,cipherSuiteOtherName:i.standardName?null:i.name,localCertificate:n&&"raw"in n?n.raw:null,remoteCertificate:r&&"raw"in r?r.raw:null}}else l=null;return{remoteAddress:o,localAddress:a,security:l,remoteName:null,streamsStarted:r.streamTracker.callsStarted,streamsSucceeded:r.streamTracker.callsSucceeded,streamsFailed:r.streamTracker.callsFailed,messagesSent:r.messagesSent,messagesReceived:r.messagesReceived,keepAlivesSent:r.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:r.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:r.lastMessageSentTimestamp,lastMessageReceivedTimestamp:r.lastMessageReceivedTimestamp,localFlowControlWindow:null!==(i=e.state.localWindowSize)&&void 0!==i?i:null,remoteFlowControlWindow:null!==(n=e.state.remoteWindowSize)&&void 0!==n?n:null}}trace(e){h.trace(a.LogVerbosity.DEBUG,"server","("+this.channelzRef.id+") "+e)}keepaliveTrace(e){h.trace(a.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+e)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(e,t){if(null===e||"object"!=typeof e||null===t||"object"!=typeof t)throw new Error("addService() requires two objects as arguments");const i=Object.keys(e);if(0===i.length)throw new Error("Cannot add an empty service to a server");i.forEach(i=>{const n=e[i];let r;r=n.requestStream?n.responseStream?"bidi":"clientStream":n.responseStream?"serverStream":"unary";let s,o=t[i];void 0===o&&"string"==typeof n.originalName&&(o=t[n.originalName]),s=void 0!==o?o.bind(t):function(e,t){const i=w(t);switch(e){case"unary":case"clientStream":return(e,t)=>{t(i,null)};case"serverStream":case"bidi":return e=>{e.emit("error",i)};default:throw new Error(`Invalid handlerType ${e}`)}}(r,i);if(!1===this.register(n.path,s,n.responseSerialize,n.requestDeserialize,r))throw new Error(`Method handler for ${n.path} already provided.`)})}removeService(e){if(null===e||"object"!=typeof e)throw new Error("removeService() requires object as argument");Object.keys(e).forEach(t=>{const i=e[t];this.unregister(i.path)})}bind(e,t){throw new Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(e){return(0,p.registerChannelzSocket)((0,d.subchannelAddressToString)(e),()=>({localAddress:e,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(e){(0,p.unregisterChannelzRef)(e)}createHttp2Server(e){let t;if(e._isSecure()){const i=e._getConstructorOptions(),n=e._getSecureContextOptions(),r=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),i),n),{enableTrace:1===this.options["grpc-node.tls_enable_trace"]});let o=null!==n;this.trace("Initial credentials valid: "+o),t=s.createSecureServer(r),t.prependListener("connection",e=>{o||(this.trace("Dropped connection from "+JSON.stringify(e.address())+" due to unloaded credentials"),e.destroy())}),t.on("secureConnection",e=>{e.on("error",e=>{this.trace("An incoming TLS connection closed with error: "+e.message)})});const l=e=>{if(e){const i=t;try{i.setSecureContext(e)}catch(t){h.log(a.LogVerbosity.ERROR,"Failed to set secure context with error "+t.message),e=null}}o=null!==e,this.trace("Post-update credentials valid: "+o)};e._addWatcher(l),t.on("close",()=>{e._removeWatcher(l)})}else t=s.createServer(this.commonServerOptions);return t.setTimeout(0,C),this._setupHandlers(t,e._getInterceptors()),t}bindOneAddress(e,t){this.trace("Attempting to bind "+(0,d.subchannelAddressToString)(e));const i=this.createHttp2Server(t.credentials);return new Promise((n,r)=>{const s=t=>{this.trace("Failed to bind "+(0,d.subchannelAddressToString)(e)+" with error "+t.message),n({port:"port"in e?e.port:1,error:t.message})};i.once("error",s),i.listen(e,()=>{const e=i.address();let r;r="string"==typeof e?{path:e}:{host:e.address,port:e.port};const o=this.experimentalRegisterListenerToChannelz(r);this.listenerChildrenTracker.refChild(o),this.http2Servers.set(i,{channelzRef:o,sessions:new Set,ownsChannelzRef:!0}),t.listeningServers.add(i),this.trace("Successfully bound "+(0,d.subchannelAddressToString)(r)),n({port:"port"in r?r.port:1}),i.removeListener("error",s)})})}async bindManyPorts(e,t){if(0===e.length)return{count:0,port:0,errors:[]};if((0,d.isTcpSubchannelAddress)(e[0])&&0===e[0].port){const i=await this.bindOneAddress(e[0],t);if(i.error){const n=await this.bindManyPorts(e.slice(1),t);return Object.assign(Object.assign({},n),{errors:[i.error,...n.errors]})}{const n=e.slice(1).map(e=>(0,d.isTcpSubchannelAddress)(e)?{host:e.host,port:i.port}:e),r=await Promise.all(n.map(e=>this.bindOneAddress(e,t))),s=[i,...r];return{count:s.filter(e=>void 0===e.error).length,port:i.port,errors:s.filter(e=>e.error).map(e=>e.error)}}}{const i=await Promise.all(e.map(e=>this.bindOneAddress(e,t)));return{count:i.filter(e=>void 0===e.error).length,port:i[0].port,errors:i.filter(e=>e.error).map(e=>e.error)}}}async bindAddressList(e,t){const i=await this.bindManyPorts(e,t);if(i.count>0)return i.count<e.length&&h.log(a.LogVerbosity.INFO,`WARNING Only ${i.count} addresses added out of total ${e.length} resolved`),i.port;{const t=`No address added out of total ${e.length} resolved`;throw h.log(a.LogVerbosity.ERROR,t),new Error(`${t} errors: [${i.errors.join(",")}]`)}}resolvePort(e){return new Promise((t,i)=>{let n=!1;(0,u.createResolver)(e,(r,s,o,a)=>{if(n)return!0;if(n=!0,!r.ok)return i(new Error(r.error.details)),!0;const l=[].concat(...r.value.map(e=>e.addresses));return 0===l.length?(i(new Error(`No addresses resolved for port ${e}`)),!0):(t(l),!0)},this.options).updateResolution()})}async bindPort(e,t){const i=await this.resolvePort(e);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");const n=await this.bindAddressList(i,t);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");return n}normalizePort(e){const t=(0,f.parseUri)(e);if(null===t)throw new Error(`Could not parse port "${e}"`);const i=(0,u.mapUriDefaultScheme)(t);if(null===i)throw new Error(`Could not get a default scheme for port "${e}"`);return i}bindAsync(e,t,i){if(this.shutdown)throw new Error("bindAsync called after shutdown");if("string"!=typeof e)throw new TypeError("port must be a string");if(null===t||!(t instanceof c.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if("function"!=typeof i)throw new TypeError("callback must be a function");this.trace("bindAsync port="+e);const n=this.normalizePort(e),r=(e,t)=>{process.nextTick(()=>i(e,t))};let s=this.boundPorts.get((0,f.uriToString)(n));if(s)return t._equals(s.credentials)?(s.cancelled=!1,void(s.completionPromise?s.completionPromise.then(e=>i(null,e),e=>i(e,0)):r(null,s.portNumber))):void r(new Error(`${e} already bound with incompatible credentials`),0);s={mapKey:(0,f.uriToString)(n),originalUri:n,completionPromise:null,cancelled:!1,portNumber:0,credentials:t,listeningServers:new Set};const o=(0,f.splitHostPort)(n.path),a=this.bindPort(n,s);s.completionPromise=a,0===(null==o?void 0:o.port)?a.then(e=>{const t={scheme:n.scheme,authority:n.authority,path:(0,f.combineHostPort)({host:o.host,port:e})};s.mapKey=(0,f.uriToString)(t),s.completionPromise=null,s.portNumber=e,this.boundPorts.set(s.mapKey,s),i(null,e)},e=>{i(e,0)}):(this.boundPorts.set(s.mapKey,s),a.then(e=>{s.completionPromise=null,s.portNumber=e,i(null,e)},e=>{i(e,0)}))}registerInjectorToChannelz(){return(0,p.registerChannelzSocket)("injector",()=>({localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(e,t,i=!1){if(null===e||!(e instanceof c.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");this.channelzEnabled&&this.listenerChildrenTracker.refChild(t);const n=this.createHttp2Server(e),r=new Set;return this.http2Servers.set(n,{channelzRef:t,sessions:r,ownsChannelzRef:i}),{injectConnection:e=>{n.emit("connection",e)},drain:e=>{var t,i;for(const e of r)this.closeSession(e);null===(i=(t=setTimeout(()=>{for(const e of r)e.destroy(s.constants.NGHTTP2_CANCEL)},e)).unref)||void 0===i||i.call(t)},destroy:()=>{this.closeServer(n);for(const e of r)this.closeSession(e)}}}createConnectionInjector(e){if(null===e||!(e instanceof c.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");const t=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(e,t,!0)}closeServer(e,t){this.trace("Closing server with address "+JSON.stringify(e.address()));const i=this.http2Servers.get(e);e.close(()=>{i&&i.ownsChannelzRef&&(this.listenerChildrenTracker.unrefChild(i.channelzRef),(0,p.unregisterChannelzRef)(i.channelzRef)),this.http2Servers.delete(e),null==t||t()})}closeSession(e,t){var i;this.trace("Closing session initiated by "+(null===(i=e.socket)||void 0===i?void 0:i.remoteAddress));const n=this.sessions.get(e),r=()=>{n&&(this.sessionChildrenTracker.unrefChild(n.ref),(0,p.unregisterChannelzRef)(n.ref)),null==t||t()};e.closed?queueMicrotask(r):e.close(r)}completeUnbind(e){for(const t of e.listeningServers){const i=this.http2Servers.get(t);if(this.closeServer(t,()=>{e.listeningServers.delete(t)}),i)for(const e of i.sessions)this.closeSession(e)}this.boundPorts.delete(e.mapKey)}unbind(e){this.trace("unbind port="+e);const t=this.normalizePort(e),i=(0,f.splitHostPort)(t.path);if(0===(null==i?void 0:i.port))throw new Error("Cannot unbind port 0");const n=this.boundPorts.get((0,f.uriToString)(t));n&&(this.trace("unbinding "+n.mapKey+" originally bound as "+(0,f.uriToString)(n.originalUri)),n.completionPromise?n.cancelled=!0:this.completeUnbind(n))}drain(e,t){var i,n;this.trace("drain port="+e+" graceTimeMs="+t);const r=this.normalizePort(e),o=(0,f.splitHostPort)(r.path);if(0===(null==o?void 0:o.port))throw new Error("Cannot drain port 0");const a=this.boundPorts.get((0,f.uriToString)(r));if(!a)return;const l=new Set;for(const e of a.listeningServers){const t=this.http2Servers.get(e);if(t)for(const e of t.sessions)l.add(e),this.closeSession(e,()=>{l.delete(e)})}null===(n=(i=setTimeout(()=>{for(const e of l)e.destroy(s.constants.NGHTTP2_CANCEL)},t)).unref)||void 0===n||n.call(i)}forceShutdown(){for(const e of this.boundPorts.values())e.cancelled=!0;this.boundPorts.clear();for(const e of this.http2Servers.keys())this.closeServer(e);this.sessions.forEach((e,t)=>{this.closeSession(t),t.destroy(s.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,p.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(e,t,i,n,r){return!this.handlers.has(e)&&(this.handlers.set(e,{func:t,serialize:i,deserialize:n,type:r,path:e}),!0)}unregister(e){return this.handlers.delete(e)}start(){if(0===this.http2Servers.size||[...this.http2Servers.keys()].every(e=>!e.listening))throw new Error("server must be bound in order to start");if(!0===this.started)throw new Error("server is already started");this.started=!0}tryShutdown(e){var t;const i=t=>{(0,p.unregisterChannelzRef)(this.channelzRef),e(t)};let n=0;function r(){n--,0===n&&i()}this.shutdown=!0;for(const[e,i]of this.http2Servers.entries()){n++;const s=i.channelzRef.name;this.trace("Waiting for server "+s+" to close"),this.closeServer(e,()=>{this.trace("Server "+s+" finished closing"),r()});for(const e of i.sessions.keys()){n++;const i=null===(t=e.socket)||void 0===t?void 0:t.remoteAddress;this.trace("Waiting for session "+i+" to close"),this.closeSession(e,()=>{this.trace("Session "+i+" finished closing"),r()})}}0===n&&i()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(e,t){const i=t[s.constants.HTTP2_HEADER_CONTENT_TYPE];return!("string"!=typeof i||!i.startsWith("application/grpc"))||(e.respond({[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1)}_retrieveHandler(e){_("Received call to method "+e+" at address "+this.serverAddressString);const t=this.handlers.get(e);return void 0===t?(_("No handler registered for method "+e+". Sending UNIMPLEMENTED status."),null):t}_respondWithError(e,t,i=null){var n,r;const o=Object.assign({"grpc-status":null!==(n=e.code)&&void 0!==n?n:a.Status.INTERNAL,"grpc-message":e.details,[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_OK,[s.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},null===(r=e.metadata)||void 0===r?void 0:r.toHttp2Headers());t.respond(o,{endStream:!0}),this.callTracker.addCallFailed(),null==i||i.streamTracker.addCallFailed()}_channelzHandler(e,t,i){this.onStreamOpened(t);const n=this.sessions.get(t.session);if(this.callTracker.addCallStarted(),null==n||n.streamTracker.addCallStarted(),!this._verifyContentType(t,i))return this.callTracker.addCallFailed(),void(null==n||n.streamTracker.addCallFailed());const r=i[b],s=this._retrieveHandler(r);if(!s)return void this._respondWithError(w(r),t,n);const o={addMessageSent:()=>{n&&(n.messagesSent+=1,n.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{n&&(n.messagesReceived+=1,n.lastMessageReceivedTimestamp=new Date)},onCallEnd:e=>{e.code===a.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:e=>{n&&(e?n.streamTracker.addCallSucceeded():n.streamTracker.addCallFailed())}},l=(0,g.getServerInterceptingCall)([...e,...this.interceptors],t,i,o,s,this.options);this._runHandlerForCall(l,s)||(this.callTracker.addCallFailed(),null==n||n.streamTracker.addCallFailed(),l.sendStatus({code:a.Status.INTERNAL,details:`Unknown handler type: ${s.type}`}))}_streamHandler(e,t,i){if(this.onStreamOpened(t),!0!==this._verifyContentType(t,i))return;const n=i[b],r=this._retrieveHandler(n);if(!r)return void this._respondWithError(w(n),t,null);const s=(0,g.getServerInterceptingCall)([...e,...this.interceptors],t,i,null,r,this.options);this._runHandlerForCall(s,r)||s.sendStatus({code:a.Status.INTERNAL,details:`Unknown handler type: ${r.type}`})}_runHandlerForCall(e,t){const{type:i}=t;if("unary"===i)!async function(e,t){let i,n;function r(t,i,n,r){t?e.sendStatus((0,l.serverErrorToStatus)(t,n)):e.sendMessage(i,()=>{e.sendStatus({code:a.Status.OK,details:"OK",metadata:null!=n?n:null})})}let s=null;e.start({onReceiveMetadata(t){n=t,e.startRead()},onReceiveMessage(i){s?e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(s=i,e.startRead())},onReceiveHalfClose(){if(s){i=new l.ServerWritableStreamImpl(t.path,e,n,s);try{t.func(i,r)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"))}})}(e,t);else if("clientStream"===i)!function(e,t){let i;function n(t,i,n,r){t?e.sendStatus((0,l.serverErrorToStatus)(t,n)):e.sendMessage(i,()=>{e.sendStatus({code:a.Status.OK,details:"OK",metadata:null!=n?n:null})})}e.start({onReceiveMetadata(r){i=new l.ServerDuplexStreamImpl(t.path,e,r);try{t.func(i,n)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){i.push(e)},onReceiveHalfClose(){i.push(null)},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"),i.destroy())}})}(e,t);else if("serverStream"===i)!function(e,t){let i,n,r=null;e.start({onReceiveMetadata(t){n=t,e.startRead()},onReceiveMessage(i){r?e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(r=i,e.startRead())},onReceiveHalfClose(){if(r){i=new l.ServerWritableStreamImpl(t.path,e,n,r);try{t.func(i)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"),i.destroy())}})}(e,t);else{if("bidi"!==i)return!1;!function(e,t){let i;e.start({onReceiveMetadata(n){i=new l.ServerDuplexStreamImpl(t.path,e,n);try{t.func(i)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){i.push(e)},onReceiveHalfClose(){i.push(null)},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"),i.destroy())}})}(e,t)}return!0}_setupHandlers(e,t){if(null===e)return;const i=e.address();let n="null";i&&(n="string"==typeof i?i:i.address+":"+i.port),this.serverAddressString=n;const r=this.channelzEnabled?this._channelzHandler:this._streamHandler,s=this.channelzEnabled?this._channelzSessionHandler(e):this._sessionHandler(e);e.on("stream",r.bind(this,t)),e.on("session",s)}_sessionHandler(e){return t=>{var i,n;null===(i=this.http2Servers.get(e))||void 0===i||i.sessions.add(t);let r=null,o=null,a=null,l=!1;const c=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==m){const e=this.maxConnectionAgeMs/10,i=Math.random()*e*2-e;r=setTimeout(()=>{var e,i;l=!0,this.trace("Connection dropped by max connection age: "+(null===(e=t.socket)||void 0===e?void 0:e.remoteAddress));try{t.goaway(s.constants.NGHTTP2_NO_ERROR,~(1<<31),S)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==m&&(o=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(i=o.unref)||void 0===i||i.call(o))},this.maxConnectionAgeMs+i),null===(n=r.unref)||void 0===n||n.call(r)}const u=()=>{a&&(clearTimeout(a),a=null)},h=()=>!t.destroyed&&this.keepaliveTimeMs<v&&this.keepaliveTimeMs>0;let d;const f=()=>{var e;h()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),a=setTimeout(()=>{u(),d()},this.keepaliveTimeMs),null===(e=a.unref)||void 0===e||e.call(a))};d=()=>{var e;if(!h())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let i="";try{t.ping((e,i,n)=>{u(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),l=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),f())})||(i="Ping returned false")}catch(e){i=(e instanceof Error?e.message:"")||"Unknown error"}if(i)return this.keepaliveTrace("Ping send failed: "+i),this.trace("Connection dropped due to ping send error: "+i),l=!0,void t.destroy();a=setTimeout(()=>{u(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),l=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=a.unref)||void 0===e||e.call(a)},f(),t.on("close",()=>{var i,n;l||this.trace(`Connection dropped by client ${null===(i=t.socket)||void 0===i?void 0:i.remoteAddress}`),r&&clearTimeout(r),o&&clearTimeout(o),u(),null!==c&&(clearTimeout(c.timeout),this.sessionIdleTimeouts.delete(t)),null===(n=this.http2Servers.get(e))||void 0===n||n.sessions.delete(t)})}}_channelzSessionHandler(e){return t=>{var i,n,r,o;const a=(0,p.registerChannelzSocket)(null!==(n=null===(i=t.socket)||void 0===i?void 0:i.remoteAddress)&&void 0!==n?n:"unknown",this.getChannelzSessionInfo.bind(this,t),this.channelzEnabled),l={ref:a,streamTracker:new p.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};null===(r=this.http2Servers.get(e))||void 0===r||r.sessions.add(t),this.sessions.set(t,l);const c=`${t.socket.remoteAddress}:${t.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+c),this.trace("Connection established by client "+c),this.sessionChildrenTracker.refChild(a);let u=null,h=null,d=null,f=!1;const g=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==m){const e=this.maxConnectionAgeMs/10,i=Math.random()*e*2-e;u=setTimeout(()=>{var e;f=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+c);try{t.goaway(s.constants.NGHTTP2_NO_ERROR,~(1<<31),S)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==m&&(h=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(e=h.unref)||void 0===e||e.call(h))},this.maxConnectionAgeMs+i),null===(o=u.unref)||void 0===o||o.call(u)}const y=()=>{d&&(clearTimeout(d),d=null)},b=()=>!t.destroyed&&this.keepaliveTimeMs<v&&this.keepaliveTimeMs>0;let _;const C=()=>{var e;b()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),d=setTimeout(()=>{y(),_()},this.keepaliveTimeMs),null===(e=d.unref)||void 0===e||e.call(d))};_=()=>{var e;if(!b())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let i="";try{t.ping((e,i,n)=>{y(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+e.message+" return in "+i),f=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),C())})||(i="Ping returned false")}catch(e){i=(e instanceof Error?e.message:"")||"Unknown error"}if(i)return this.keepaliveTrace("Ping send failed: "+i),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+i),f=!0,void t.destroy();l.keepAlivesSent+=1,d=setTimeout(()=>{y(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+c),f=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=d.unref)||void 0===e||e.call(d)},C(),t.on("close",()=>{var i;f||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+c),this.sessionChildrenTracker.unrefChild(a),(0,p.unregisterChannelzRef)(a),u&&clearTimeout(u),h&&clearTimeout(h),y(),null!==g&&(clearTimeout(g.timeout),this.sessionIdleTimeouts.delete(t)),null===(i=this.http2Servers.get(e))||void 0===i||i.sessions.delete(t),this.sessions.delete(t)})}}enableIdleTimeout(e){var t,i;if(this.sessionIdleTimeout>=y)return null;const n={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,e),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,e)};null===(i=(t=n.timeout).unref)||void 0===i||i.call(t),this.sessionIdleTimeouts.set(e,n);const{socket:r}=e;return this.trace("Enable idle timeout for "+r.remoteAddress+":"+r.remotePort),n}onIdleTimeout(e,t){const{socket:i}=t,n=e.sessionIdleTimeouts.get(t);void 0!==n&&0===n.activeStreams&&(Date.now()-n.lastIdle>=e.sessionIdleTimeout?(e.trace("Session idle timeout triggered for "+(null==i?void 0:i.remoteAddress)+":"+(null==i?void 0:i.remotePort)+" last idle at "+n.lastIdle),e.closeSession(t)):n.timeout.refresh())}onStreamOpened(e){const t=e.session,i=this.sessionIdleTimeouts.get(t);i&&(i.activeStreams+=1,e.once("close",i.onClose))}onStreamClose(e){var t,i;const n=this.sessionIdleTimeouts.get(e);n&&(n.activeStreams-=1,0===n.activeStreams&&(n.lastIdle=Date.now(),n.timeout.refresh(),this.trace("Session onStreamClose"+(null===(t=e.socket)||void 0===t?void 0:t.remoteAddress)+":"+(null===(i=e.socket)||void 0===i?void 0:i.remotePort)+" at "+n.lastIdle)))}},(()=>{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;var s;t=[(s="Calling start() is no longer necessary. It can be safely omitted.",function(e,t){return o.deprecate(e,s)})],r(e,null,t,{kind:"method",name:"start",static:!1,private:!1,access:{has:e=>"start"in e,get:e=>e.start},metadata:n},null,i),n&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})})(),e})();t.Server=E},5656(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateRetryThrottling=l,t.validateServiceConfig=u,t.extractAndSelectServiceConfig=function(e,t){for(const i of e)if(i.length>0&&i[0].startsWith("grpc_config=")){const e=i.join("").substring(12);return d(JSON.parse(e),t)}return null};const n=i(857),r=i(131),s=/^\d+(\.\d{1,9})?s$/;function o(e){if("service"in e&&""!==e.service){if("string"!=typeof e.service)throw new Error("Invalid method config name: invalid service: expected type string, got "+typeof e.service);if("method"in e&&""!==e.method){if("string"!=typeof e.method)throw new Error("Invalid method config name: invalid method: expected type string, got "+typeof e.service);return{service:e.service,method:e.method}}return{service:e.service}}if("method"in e&&void 0!==e.method)throw new Error("Invalid method config name: method set with empty or unset service");return{}}function a(e){var t;const i={name:[]};if(!("name"in e)||!Array.isArray(e.name))throw new Error("Invalid method config: invalid name array");for(const t of e.name)i.name.push(o(t));if("waitForReady"in e){if("boolean"!=typeof e.waitForReady)throw new Error("Invalid method config: invalid waitForReady");i.waitForReady=e.waitForReady}if("timeout"in e)if("object"==typeof e.timeout){if(!("seconds"in e.timeout)||"number"!=typeof e.timeout.seconds)throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in e.timeout)||"number"!=typeof e.timeout.nanos)throw new Error("Invalid method config: invalid timeout.nanos");i.timeout=e.timeout}else{if("string"!=typeof e.timeout||!s.test(e.timeout))throw new Error("Invalid method config: invalid timeout");{const n=e.timeout.substring(0,e.timeout.length-1).split(".");i.timeout={seconds:0|n[0],nanos:0|(null!==(t=n[1])&&void 0!==t?t:0)}}}if("maxRequestBytes"in e){if("number"!=typeof e.maxRequestBytes)throw new Error("Invalid method config: invalid maxRequestBytes");i.maxRequestBytes=e.maxRequestBytes}if("maxResponseBytes"in e){if("number"!=typeof e.maxResponseBytes)throw new Error("Invalid method config: invalid maxRequestBytes");i.maxResponseBytes=e.maxResponseBytes}if("retryPolicy"in e){if("hedgingPolicy"in e)throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");i.retryPolicy=function(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in e)||"string"!=typeof e.initialBackoff||!s.test(e.initialBackoff))throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in e)||"string"!=typeof e.maxBackoff||!s.test(e.maxBackoff))throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in e)||"number"!=typeof e.backoffMultiplier||e.backoffMultiplier<=0)throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!("retryableStatusCodes"in e)||!Array.isArray(e.retryableStatusCodes))throw new Error("Invalid method config retry policy: retryableStatusCodes is required");if(0===e.retryableStatusCodes.length)throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(const t of e.retryableStatusCodes)if("number"==typeof t){if(!Object.values(r.Status).includes(t))throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else{if("string"!=typeof t)throw new Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");if(!Object.values(r.Status).includes(t.toUpperCase()))throw new Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}return{maxAttempts:e.maxAttempts,initialBackoff:e.initialBackoff,maxBackoff:e.maxBackoff,backoffMultiplier:e.backoffMultiplier,retryableStatusCodes:e.retryableStatusCodes}}(e.retryPolicy)}else"hedgingPolicy"in e&&(i.hedgingPolicy=function(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in e&&("string"!=typeof e.hedgingDelay||!s.test(e.hedgingDelay)))throw new Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in e&&Array.isArray(e.nonFatalStatusCodes))for(const t of e.nonFatalStatusCodes)if("number"==typeof t){if(!Object.values(r.Status).includes(t))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else{if("string"!=typeof t)throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");if(!Object.values(r.Status).includes(t.toUpperCase()))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}const t={maxAttempts:e.maxAttempts};return e.hedgingDelay&&(t.hedgingDelay=e.hedgingDelay),e.nonFatalStatusCodes&&(t.nonFatalStatusCodes=e.nonFatalStatusCodes),t}(e.hedgingPolicy));return i}function l(e){if(!("maxTokens"in e)||"number"!=typeof e.maxTokens||e.maxTokens<=0||e.maxTokens>1e3)throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in e)||"number"!=typeof e.tokenRatio||e.tokenRatio<=0)throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+e.maxTokens.toFixed(3),tokenRatio:+e.tokenRatio.toFixed(3)}}function c(e){if("object"!=typeof e||null===e)throw new Error("Invalid loadBalancingConfig: unexpected type "+typeof e);const t=Object.keys(e);if(t.length>1)throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${t}`);if(0===t.length)throw new Error("Invalid loadBalancingConfig: load balancing policy name required");return{[t[0]]:e[t[0]]}}function u(e){const t={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in e){if("string"!=typeof e.loadBalancingPolicy)throw new Error("Invalid service config: invalid loadBalancingPolicy");t.loadBalancingPolicy=e.loadBalancingPolicy}if("loadBalancingConfig"in e){if(!Array.isArray(e.loadBalancingConfig))throw new Error("Invalid service config: invalid loadBalancingConfig");for(const i of e.loadBalancingConfig)t.loadBalancingConfig.push(c(i))}if("methodConfig"in e&&Array.isArray(e.methodConfig))for(const i of e.methodConfig)t.methodConfig.push(a(i));"retryThrottling"in e&&(t.retryThrottling=l(e.retryThrottling));const i=[];for(const e of t.methodConfig)for(const t of e.name){for(const e of i)if(t.service===e.service&&t.method===e.method)throw new Error(`Invalid service config: duplicate name ${t.service}/${t.method}`);i.push(t)}return t}function h(e){if(!("serviceConfig"in e))throw new Error("Invalid service config choice: missing service config");const t={serviceConfig:u(e.serviceConfig)};if("clientLanguage"in e){if(!Array.isArray(e.clientLanguage))throw new Error("Invalid service config choice: invalid clientLanguage");t.clientLanguage=[];for(const i of e.clientLanguage){if("string"!=typeof i)throw new Error("Invalid service config choice: invalid clientLanguage");t.clientLanguage.push(i)}}if("clientHostname"in e){if(!Array.isArray(e.clientHostname))throw new Error("Invalid service config choice: invalid clientHostname");t.clientHostname=[];for(const i of e.clientHostname){if("string"!=typeof i)throw new Error("Invalid service config choice: invalid clientHostname");t.clientHostname.push(i)}}if("percentage"in e){if(!("number"==typeof e.percentage&&0<=e.percentage&&e.percentage<=100))throw new Error("Invalid service config choice: invalid percentage");t.percentage=e.percentage}const i=["clientLanguage","percentage","clientHostname","serviceConfig"];for(const t in e)if(!i.includes(t))throw new Error(`Invalid service config choice: unexpected field ${t}`);return t}function d(e,t){if(!Array.isArray(e))throw new Error("Invalid service config list");for(const i of e){const e=h(i);if(!("number"==typeof e.percentage&&t>e.percentage)){if(Array.isArray(e.clientHostname)){let t=!1;for(const i of e.clientHostname)i===n.hostname()&&(t=!0);if(!t)continue}if(Array.isArray(e.clientLanguage)){let t=!1;for(const i of e.clientLanguage)"node"===i&&(t=!0);if(!t)continue}return e.serviceConfig}}throw new Error("No matching service config found")}},246(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SingleSubchannelChannel=void 0;const n=i(5572),r=i(9503),s=i(4987),o=i(463),a=i(131),l=i(6067),c=i(6308),u=i(1703),h=i(4097),d=i(9302),f=i(3822);class p{constructor(e,t,i,n,r){var s,o;this.subchannel=e,this.method=t,this.options=n,this.callNumber=r,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;const l=this.method.split("/");let u="";l.length>=2&&(u=l[1]);const h=null!==(o=null===(s=(0,f.splitHostPort)(this.options.host))||void 0===s?void 0:s.host)&&void 0!==o?o:"localhost";this.serviceUrl=`https://${h}/${u}`;const d=(0,c.getRelativeTimeout)(n.deadline);d!==1/0&&(d<=0?this.cancelWithStatus(a.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(a.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},d)),this.filterStack=i.createFilter()}cancelWithStatus(e,t){this.childCall?this.childCall.cancelWithStatus(e,t):this.pendingStatus={code:e,details:t,metadata:new h.Metadata}}getPeer(){var e,t;return null!==(t=null===(e=this.childCall)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.subchannel.getAddress()}async start(e,t){if(this.pendingStatus)return void t.onReceiveStatus(this.pendingStatus);if(this.subchannel.getConnectivityState()!==o.ConnectivityState.READY)return void t.onReceiveStatus({code:a.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new h.Metadata});const i=await this.filterStack.sendMetadata(Promise.resolve(e));let n;try{n=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(e){const i=e,{code:n,details:r}=(0,l.restrictControlPlaneStatusCode)("number"==typeof i.code?i.code:a.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${i.message}`);return void t.onReceiveStatus({code:n,details:r,metadata:new h.Metadata})}n.merge(i);const r={onReceiveMetadata:async e=>{t.onReceiveMetadata(await this.filterStack.receiveMetadata(e))},onReceiveMessage:async e=>{this.readFilterPending=!0;const i=await this.filterStack.receiveMessage(e);this.readFilterPending=!1,t.onReceiveMessage(i),this.pendingStatus&&t.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async e=>{const i=await this.filterStack.receiveTrailers(e);this.readFilterPending?this.pendingStatus=i:t.onReceiveStatus(i)}};this.childCall=this.subchannel.createCall(n,this.options.host,this.method,r),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,t){this.writeFilterPending=!0;const i=await this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,i.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:i.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}}t.SingleSubchannelChannel=class{constructor(e,t,i){this.subchannel=e,this.target=t,this.channelzEnabled=!1,this.channelzTrace=new r.ChannelzTrace,this.callTracker=new r.ChannelzCallTracker,this.childrenTracker=new r.ChannelzChildrenTracker,this.channelzEnabled=0!==i["grpc.enable_channelz"],this.channelzRef=(0,r.registerChannelzChannel)((0,f.uriToString)(t),()=>({target:`${(0,f.uriToString)(t)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new u.FilterStackFactory([new s.CompressionFilterFactory(this,i)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,r.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,f.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,t,i){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(e,t){const i={deadline:t,host:(0,d.getDefaultAuthority)(this.target),flags:a.Propagate.DEFAULTS,parentCall:null};return new p(this.subchannel,e,this.filterStackFactory,i,(0,n.getNextCallNumber)())}}},2284(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatusBuilder=void 0;t.StatusBuilder=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(e){return this.code=e,this}withDetails(e){return this.details=e,this}withMetadata(e){return this.metadata=e,this}build(){const e={};return null!==this.code&&(e.code=this.code),null!==this.details&&(e.details=this.details),null!==this.metadata&&(e.metadata=this.metadata),e}}},9453(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.StreamDecoder=void 0,function(e){e[e.NO_DATA=0]="NO_DATA",e[e.READING_SIZE=1]="READING_SIZE",e[e.READING_MESSAGE=2]="READING_MESSAGE"}(i||(i={}));t.StreamDecoder=class{constructor(e){this.maxReadMessageLength=e,this.readState=i.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(e){let t,n=0;const r=[];for(;n<e.length;)switch(this.readState){case i.NO_DATA:this.readCompressFlag=e.slice(n,n+1),n+=1,this.readState=i.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case i.READING_SIZE:if(t=Math.min(e.length-n,this.readSizeRemaining),e.copy(this.readPartialSize,4-this.readSizeRemaining,n,n+t),this.readSizeRemaining-=t,n+=t,0===this.readSizeRemaining){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),-1!==this.maxReadMessageLength&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=i.READING_MESSAGE;else{const e=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=i.NO_DATA,r.push(e)}}break;case i.READING_MESSAGE:if(t=Math.min(e.length-n,this.readMessageRemaining),this.readPartialMessage.push(e.slice(n,n+t)),this.readMessageRemaining-=t,n+=t,0===this.readMessageRemaining){const e=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),t=Buffer.concat(e,this.readMessageSize+5);this.readState=i.NO_DATA,r.push(t)}break;default:throw new Error("Unexpected read state")}return r}}},8996(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EndpointMap=void 0,t.isTcpSubchannelAddress=r,t.subchannelAddressEqual=s,t.subchannelAddressToString=o,t.stringToSubchannelAddress=function(e,t){return(0,n.isIP)(e)?{host:e,port:null!=t?t:443}:{path:e}},t.endpointEqual=function(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(let i=0;i<e.addresses.length;i++)if(!s(e.addresses[i],t.addresses[i]))return!1;return!0},t.endpointToString=function(e){return"["+e.addresses.map(o).join(", ")+"]"},t.endpointHasAddress=a;const n=i(9278);function r(e){return"port"in e}function s(e,t){return!e&&!t||!(!e||!t)&&(r(e)?r(t)&&e.host===t.host&&e.port===t.port:!r(t)&&e.path===t.path)}function o(e){return r(e)?(0,n.isIPv6)(e.host)?"["+e.host+"]:"+e.port:e.host+":"+e.port:e.path}function a(e,t){for(const i of e.addresses)if(s(i,t))return!0;return!1}function l(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(const i of e.addresses){let e=!1;for(const n of t.addresses)if(s(i,n)){e=!0;break}if(!e)return!1}return!0}t.EndpointMap=class{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(e){for(const t of this.map)if(a(t.key,e))return t.value}deleteMissing(e){const t=[];for(const i of this.map){let n=!1;for(const t of e)l(t,i.key)&&(n=!0);n||(t.push(i.value),this.map.delete(i))}return t}get(e){for(const t of this.map)if(l(e,t.key))return t.value}set(e,t){for(const i of this.map)if(l(e,i.key))return void(i.value=t);this.map.add({key:e,value:t})}delete(e){for(const t of this.map)if(l(e,t.key))return void this.map.delete(t)}has(e){for(const t of this.map)if(l(e,t.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(const e of this.map)yield e.key}*values(){for(const e of this.map)yield e.value}*entries(){for(const e of this.map)yield[e.key,e.value]}}},5486(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Http2SubchannelCall=void 0;const n=i(5675),r=i(857),s=i(131),o=i(4097),a=i(9453),l=i(267),c=i(131);function u(e){const t=`Received HTTP status code ${e}`;let i;switch(e){case 400:i=s.Status.INTERNAL;break;case 401:i=s.Status.UNAUTHENTICATED;break;case 403:i=s.Status.PERMISSION_DENIED;break;case 404:i=s.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:i=s.Status.UNAVAILABLE;break;default:i=s.Status.UNKNOWN}return{code:i,details:t,metadata:new o.Metadata}}t.Http2SubchannelCall=class{constructor(e,t,i,l,c){var h;this.http2Stream=e,this.callEventTracker=t,this.listener=i,this.transport=l,this.callId=c,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;const d=null!==(h=l.getOptions()["grpc.max_receive_message_length"])&&void 0!==h?h:s.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new a.StreamDecoder(d),e.on("response",(e,t)=>{let i="";for(const t of Object.keys(e))i+="\t\t"+t+": "+e[t]+"\n";if(this.trace("Received server headers:\n"+i),this.httpStatusCode=e[":status"],t&n.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(e);else{let t;try{t=o.Metadata.fromHttp2Headers(e)}catch(e){return void this.endCall({code:s.Status.UNKNOWN,details:e.message,metadata:new o.Metadata})}this.listener.onReceiveMetadata(t)}}),e.on("trailers",e=>{this.handleTrailers(e)}),e.on("data",e=>{if(this.statusOutput)return;let t;this.trace("receive HTTP/2 data frame of length "+e.length);try{t=this.decoder.write(e)}catch(e){if(void 0!==this.httpStatusCode&&200!==this.httpStatusCode){const e=u(this.httpStatusCode);this.cancelWithStatus(e.code,e.details)}else this.cancelWithStatus(s.Status.RESOURCE_EXHAUSTED,e.message);return}for(const e of t)this.trace("parsed message of length "+e.length),this.callEventTracker.addMessageReceived(),this.tryPush(e)}),e.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),e.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var t;if(this.trace("HTTP/2 stream closed with code "+e.rstCode),(null===(t=this.finalStatus)||void 0===t?void 0:t.code)===s.Status.OK)return;let i,r="";switch(e.rstCode){case n.constants.NGHTTP2_NO_ERROR:if(null!==this.finalStatus)return;if(this.httpStatusCode&&200!==this.httpStatusCode){const e=u(this.httpStatusCode);i=e.code,r=e.details}else i=s.Status.INTERNAL,r=`Received RST_STREAM with code ${e.rstCode} (Call ended without gRPC status)`;break;case n.constants.NGHTTP2_REFUSED_STREAM:i=s.Status.UNAVAILABLE,r="Stream refused by server";break;case n.constants.NGHTTP2_CANCEL:this.connectionDropped?(i=s.Status.UNAVAILABLE,r="Connection dropped"):(i=s.Status.CANCELLED,r="Call cancelled");break;case n.constants.NGHTTP2_ENHANCE_YOUR_CALM:i=s.Status.RESOURCE_EXHAUSTED,r="Bandwidth exhausted or memory limit exceeded";break;case n.constants.NGHTTP2_INADEQUATE_SECURITY:i=s.Status.PERMISSION_DENIED,r="Protocol not secure enough";break;case n.constants.NGHTTP2_INTERNAL_ERROR:i=s.Status.INTERNAL,null===this.internalError?r=`Received RST_STREAM with code ${e.rstCode} (Internal server error)`:"ECONNRESET"===this.internalError.code||"ETIMEDOUT"===this.internalError.code?(i=s.Status.UNAVAILABLE,r=this.internalError.message):r=`Received RST_STREAM with code ${e.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:i=s.Status.INTERNAL,r=`Received RST_STREAM with code ${e.rstCode}`}this.endCall({code:i,details:r,metadata:new o.Metadata,rstCode:e.rstCode})})}),e.on("error",e=>{"ERR_HTTP2_STREAM_ERROR"!==e.code&&(this.trace("Node error event: message="+e.message+" code="+e.code+" errno="+function(e){for(const[t,i]of Object.entries(r.constants.errno))if(i===e)return t;return"Unknown system error "+e}(e.errno)+" syscall="+e.syscall),this.internalError=e),this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:s.Status.UNAVAILABLE,details:"Connection dropped",metadata:new o.Metadata})})}outputStatus(){this.statusOutput||(this.statusOutput=!0,this.trace("ended with status: code="+this.finalStatus.code+' details="'+this.finalStatus.details+'"'),this.callEventTracker.onCallEnd(this.finalStatus),process.nextTick(()=>{this.listener.onReceiveStatus(this.finalStatus)}),this.http2Stream.resume())}trace(e){l.trace(c.LogVerbosity.DEBUG,"subchannel_call","["+this.callId+"] "+e)}endCall(e){null!==this.finalStatus&&this.finalStatus.code!==s.Status.OK||(this.finalStatus=e,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){null!==this.finalStatus&&(this.finalStatus.code!==s.Status.OK||this.readsClosed&&0===this.unpushedReadMessages.length&&!this.isReadFilterPending&&!this.isPushPending)&&this.outputStatus()}push(e){this.trace("pushing to reader message of length "+(e instanceof Buffer?e.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{this.isPushPending=!1,this.statusOutput||(this.listener.onReceiveMessage(e),this.maybeOutputStatus())})}tryPush(e){this.canPush?(this.http2Stream.pause(),this.push(e)):(this.trace("unpushedReadMessages.push message of length "+e.length),this.unpushedReadMessages.push(e))}handleTrailers(e){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let t,i="";for(const t of Object.keys(e))i+="\t\t"+t+": "+e[t]+"\n";this.trace("Received server trailers:\n"+i);try{t=o.Metadata.fromHttp2Headers(e)}catch(e){t=new o.Metadata}const n=t.getMap();let r;if("string"==typeof n["grpc-status"]){const e=Number(n["grpc-status"]);this.trace("received status code "+e+" from server"),t.remove("grpc-status");let i="";if("string"==typeof n["grpc-message"]){try{i=decodeURI(n["grpc-message"])}catch(e){i=n["grpc-message"]}t.remove("grpc-message"),this.trace('received status details string "'+i+'" from server')}r={code:e,details:i,metadata:t}}else this.httpStatusCode?(r=u(this.httpStatusCode),r.metadata=t):r={code:s.Status.UNKNOWN,details:"No status information received",metadata:t};this.endCall(r)}destroyHttp2Stream(){var e;if(!this.http2Stream.destroyed)if(this.serverEndedCall)this.http2Stream.end();else{let t;t=(null===(e=this.finalStatus)||void 0===e?void 0:e.code)===s.Status.OK?n.constants.NGHTTP2_NO_ERROR:n.constants.NGHTTP2_CANCEL,this.trace("close http2 stream with code "+t),this.http2Stream.close(t)}}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.endCall({code:e,details:t,metadata:new o.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}getAuthContext(){return this.transport.getAuthContext()}startRead(){if(null!==this.finalStatus&&this.finalStatus.code!==s.Status.OK)return this.readsClosed=!0,void this.maybeOutputStatus();if(this.canPush=!0,this.unpushedReadMessages.length>0){const e=this.unpushedReadMessages.shift();return void this.push(e)}this.http2Stream.resume()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const i=t=>{process.nextTick(()=>{var i;let n=s.Status.UNAVAILABLE;"ERR_STREAM_WRITE_AFTER_END"===(null==t?void 0:t.code)&&(n=s.Status.INTERNAL),t&&this.cancelWithStatus(n,`Write error: ${t.message}`),null===(i=e.callback)||void 0===i||i.call(e)})};this.trace("sending data chunk of length "+t.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(t,i)}catch(e){this.endCall({code:s.Status.UNAVAILABLE,details:`Write failed with error ${e.message}`,metadata:new o.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}}},2379(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseSubchannelWrapper=void 0;t.BaseSubchannelWrapper=class{constructor(e){this.child=e,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,e.addHealthStateWatcher(e=>{this.healthy&&this.updateHealthListeners()})}updateHealthListeners(){for(const e of this.healthListeners)e(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(e){this.child.addConnectivityStateListener(e)}removeConnectivityStateListener(e){this.child.removeConnectivityStateListener(e)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(e){this.child.throttleKeepalive(e)}ref(){this.child.ref(),this.refcount+=1}unref(){this.child.unref(),this.refcount-=1,0===this.refcount&&this.destroy()}destroy(){for(const e of this.dataWatchers)e.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(e){this.healthListeners.add(e)}removeHealthStateWatcher(e){this.healthListeners.delete(e)}addDataWatcher(e){e.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(e)}setHealthy(e){e!==this.healthy&&(this.healthy=e,this.child.isHealthy()&&this.updateHealthListeners())}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(e){return this.getRealSubchannel()===e.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}}},5716(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SubchannelPool=void 0,t.getSubchannelPool=function(e){return e?c:new l};const n=i(6998),r=i(1385),s=i(8996),o=i(3822),a=i(2095);class l{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let e=!0;for(const t in this.pool){const i=this.pool[t].filter(e=>!e.subchannel.unrefIfOneRef());i.length>0&&(e=!1),this.pool[t]=i}e&&null!==this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var e,t;null===this.cleanupTimer&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},1e4),null===(t=(e=this.cleanupTimer).unref)||void 0===t||t.call(e))}getOrCreateSubchannel(e,t,i,l){this.ensureCleanupTask();const c=(0,o.uriToString)(e);if(c in this.pool){const e=this.pool[c];for(const r of e)if((0,s.subchannelAddressEqual)(t,r.subchannelAddress)&&(0,n.channelOptionsEqual)(i,r.channelArguments)&&l._equals(r.channelCredentials))return r.subchannel}const u=new r.Subchannel(e,t,i,l,new a.Http2SubchannelConnector(e));return c in this.pool||(this.pool[c]=[]),this.pool[c].push({subchannelAddress:t,channelArguments:i,channelCredentials:l,subchannel:u}),u.ref(),u}}t.SubchannelPool=l;const c=new l},1385(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Subchannel=void 0;const n=i(463),r=i(3956),s=i(267),o=i(131),a=i(3822),l=i(8996),c=i(9503),u=i(246);t.Subchannel=class{constructor(e,t,i,s,o){var a;this.channelTarget=e,this.subchannelAddress=t,this.options=i,this.connector=o,this.connectivityState=n.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;const u={initialDelay:i["grpc.initial_reconnect_backoff_ms"],maxDelay:i["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new r.BackoffTimeout(()=>{this.handleBackoffTimer()},u),this.backoffTimeout.unref(),this.subchannelAddressString=(0,l.subchannelAddressToString)(t),this.keepaliveTime=null!==(a=i["grpc.keepalive_time_ms"])&&void 0!==a?a:-1,0===i["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new c.ChannelzTraceStub,this.callTracker=new c.ChannelzCallTrackerStub,this.childrenTracker=new c.ChannelzChildrenTrackerStub,this.streamTracker=new c.ChannelzCallTrackerStub):(this.channelzTrace=new c.ChannelzTrace,this.callTracker=new c.ChannelzCallTracker,this.childrenTracker=new c.ChannelzChildrenTracker,this.streamTracker=new c.ChannelzCallTracker),this.channelzRef=(0,c.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(i,void 0,2)),this.secureConnector=s._createSecureConnector(e,i)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){s.trace(o.LogVerbosity.DEBUG,"subchannel","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){s.trace(o.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([n.ConnectivityState.TRANSIENT_FAILURE],n.ConnectivityState.CONNECTING):this.transitionToState([n.ConnectivityState.TRANSIENT_FAILURE],n.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let e=this.options;if(e["grpc.keepalive_time_ms"]){const t=Math.min(this.keepaliveTime,2147483647);e=Object.assign(Object.assign({},e),{"grpc.keepalive_time_ms":t})}this.connector.connect(this.subchannelAddress,this.secureConnector,e).then(e=>{this.transitionToState([n.ConnectivityState.CONNECTING],n.ConnectivityState.READY)?(this.transport=e,this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),e.addDisconnectListener(e=>{this.transitionToState([n.ConnectivityState.READY],n.ConnectivityState.IDLE),e&&this.keepaliveTime>0&&(this.keepaliveTime*=2,s.log(o.LogVerbosity.ERROR,`Connection to ${(0,a.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):e.shutdown()},e=>{this.transitionToState([n.ConnectivityState.CONNECTING],n.ConnectivityState.TRANSIENT_FAILURE,`${e}`)})}transitionToState(e,t,i){var r,s;if(-1===e.indexOf(this.connectivityState))return!1;i?this.trace(n.ConnectivityState[this.connectivityState]+" -> "+n.ConnectivityState[t]+' with error "'+i+'"'):this.trace(n.ConnectivityState[this.connectivityState]+" -> "+n.ConnectivityState[t]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+n.ConnectivityState[t]);const o=this.connectivityState;switch(this.connectivityState=t,t){case n.ConnectivityState.READY:this.stopBackoff();break;case n.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case n.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(r=this.transport)||void 0===r||r.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case n.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(s=this.transport)||void 0===s||s.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${t}`)}for(const e of this.stateListeners)e(this,o,t,this.keepaliveTime,i);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,0===this.refcount&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,c.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([n.ConnectivityState.CONNECTING,n.ConnectivityState.READY],n.ConnectivityState.IDLE)}))}unrefIfOneRef(){return 1===this.refcount&&(this.unref(),!0)}createCall(e,t,i,n){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let r;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),r={onCallEnd:e=>{e.code===o.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):r={},this.transport.createCall(e,t,i,n,r)}startConnecting(){process.nextTick(()=>{this.transitionToState([n.ConnectivityState.IDLE],n.ConnectivityState.CONNECTING)||this.connectivityState===n.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([n.ConnectivityState.TRANSIENT_FAILURE],n.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new u.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,t){const i=this.dataProducers.get(e);if(i)return i;const n=t(this);return this.dataProducers.set(e,n),n}removeDataProducer(e){this.dataProducers.delete(e)}}},9167(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CIPHER_SUITES=void 0,t.getDefaultRootsData=function(){if(r)return null===s&&(s=n.readFileSync(r)),s;return null};const n=i(9896);t.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;const r=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH;let s=null},2095(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Http2SubchannelConnector=void 0;const n=i(5675),r=i(4756),s=i(9503),o=i(131),a=i(7803),l=i(267),c=i(9302),u=i(8996),h=i(3822),d=i(9278),f=i(5486),p=i(5572),g="transport",m=i(9943).rE,{HTTP2_HEADER_AUTHORITY:v,HTTP2_HEADER_CONTENT_TYPE:y,HTTP2_HEADER_METHOD:b,HTTP2_HEADER_PATH:S,HTTP2_HEADER_TE:_,HTTP2_HEADER_USER_AGENT:C}=n.constants,w=Buffer.from("too_many_pings","ascii");class E{constructor(e,t,i,o){this.session=e,this.options=i,this.remoteName=o,this.keepaliveTimer=null,this.pendingSendKeepalivePing=!1,this.activeCalls=new Set,this.disconnectListeners=[],this.disconnectHandled=!1,this.channelzEnabled=!0,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.subchannelAddressString=(0,u.subchannelAddressToString)(t),0===i["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.streamTracker=new s.ChannelzCallTrackerStub):this.streamTracker=new s.ChannelzCallTracker,this.channelzRef=(0,s.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[i["grpc.primary_user_agent"],`grpc-node-js/${m}`,i["grpc.secondary_user_agent"]].filter(e=>e).join(" "),this.keepaliveTimeMs="grpc.keepalive_time_ms"in i?i["grpc.keepalive_time_ms"]:-1,this.keepaliveTimeoutMs="grpc.keepalive_timeout_ms"in i?i["grpc.keepalive_timeout_ms"]:2e4,this.keepaliveWithoutCalls="grpc.keepalive_permit_without_calls"in i&&1===i["grpc.keepalive_permit_without_calls"],e.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),e.once("goaway",(e,t,i)=>{let r=!1;e===n.constants.NGHTTP2_ENHANCE_YOUR_CALM&&i&&i.equals(w)&&(r=!0),this.trace("connection closed by GOAWAY with code "+e+" and data "+(null==i?void 0:i.toString())),this.reportDisconnectToOwner(r)}),e.once("error",e=>{this.trace("connection closed with error "+e.message),this.handleDisconnect()}),e.socket.once("close",e=>{this.trace("connection closed. hadError="+e),this.handleDisconnect()}),l.isTracerEnabled(g)&&(e.on("remoteSettings",t=>{this.trace("new settings received"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(t))}),e.on("localSettings",t=>{this.trace("local settings acknowledged by remote"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(t))})),this.keepaliveWithoutCalls&&this.maybeStartKeepalivePingTimer(),e.socket instanceof r.TLSSocket?this.authContext={transportSecurityType:"ssl",sslPeerCertificate:e.socket.getPeerCertificate()}:this.authContext={}}getChannelzInfo(){var e,t,i;const n=this.session.socket,r=n.remoteAddress?(0,u.stringToSubchannelAddress)(n.remoteAddress,n.remotePort):null,s=n.localAddress?(0,u.stringToSubchannelAddress)(n.localAddress,n.localPort):null;let o;if(this.session.encrypted){const t=n,i=t.getCipher(),r=t.getCertificate(),s=t.getPeerCertificate();o={cipherSuiteStandardName:null!==(e=i.standardName)&&void 0!==e?e:null,cipherSuiteOtherName:i.standardName?null:i.name,localCertificate:r&&"raw"in r?r.raw:null,remoteCertificate:s&&"raw"in s?s.raw:null}}else o=null;return{remoteAddress:r,localAddress:s,security:o,remoteName:this.remoteName,streamsStarted:this.streamTracker.callsStarted,streamsSucceeded:this.streamTracker.callsSucceeded,streamsFailed:this.streamTracker.callsFailed,messagesSent:this.messagesSent,messagesReceived:this.messagesReceived,keepAlivesSent:this.keepalivesSent,lastLocalStreamCreatedTimestamp:this.streamTracker.lastCallStartedTimestamp,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:this.lastMessageSentTimestamp,lastMessageReceivedTimestamp:this.lastMessageReceivedTimestamp,localFlowControlWindow:null!==(t=this.session.state.localWindowSize)&&void 0!==t?t:null,remoteFlowControlWindow:null!==(i=this.session.state.remoteWindowSize)&&void 0!==i?i:null}}trace(e){l.trace(o.LogVerbosity.DEBUG,g,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}keepaliveTrace(e){l.trace(o.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}flowControlTrace(e){l.trace(o.LogVerbosity.DEBUG,"transport_flowctrl","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}internalsTrace(e){l.trace(o.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}reportDisconnectToOwner(e){this.disconnectHandled||(this.disconnectHandled=!0,this.disconnectListeners.forEach(t=>t(e)))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(const e of this.activeCalls)e.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(e){this.disconnectListeners.push(e)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var e,t;if(!this.canSendPing())return void(this.pendingSendKeepalivePing=!0);if(this.keepaliveTimer)return void console.error("keepaliveTimeout is not null");this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e);let i="";try{this.session.ping((e,t,i)=>{this.clearKeepaliveTimeout(),e?(this.keepaliveTrace("Ping failed with error "+e.message),this.handleDisconnect()):(this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer())})||(i="Ping returned false")}catch(e){i=(e instanceof Error?e.message:"")||"Unknown error"}i&&(this.keepaliveTrace("Ping send failed: "+i),this.handleDisconnect())}maybeStartKeepalivePingTimer(){var e,t;this.canSendPing()&&(this.pendingSendKeepalivePing?(this.pendingSendKeepalivePing=!1,this.maybeSendPing()):this.keepaliveTimer||(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e)))}clearKeepaliveTimeout(){this.keepaliveTimer&&(clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null)}removeActiveCall(e){this.activeCalls.delete(e),0===this.activeCalls.size&&this.session.unref()}addActiveCall(e){this.activeCalls.add(e),1===this.activeCalls.size&&(this.session.ref(),this.keepaliveWithoutCalls||this.maybeStartKeepalivePingTimer())}createCall(e,t,i,n,r){const s=e.toHttp2Headers();let o,a,l;s[v]=t,s[C]=this.userAgent,s[y]="application/grpc",s[b]="POST",s[S]=i,s[_]="trailers";try{o=this.session.request(s)}catch(e){throw this.handleDisconnect(),e}return this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed),this.channelzEnabled?(this.streamTracker.addCallStarted(),a={addMessageSent:()=>{var e;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,null===(e=r.addMessageSent)||void 0===e||e.call(r)},addMessageReceived:()=>{var e;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,null===(e=r.addMessageReceived)||void 0===e||e.call(r)},onCallEnd:e=>{var t;null===(t=r.onCallEnd)||void 0===t||t.call(r,e),this.removeActiveCall(l)},onStreamEnd:e=>{var t;e?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed(),null===(t=r.onStreamEnd)||void 0===t||t.call(r,e)}}):a={addMessageSent:()=>{var e;null===(e=r.addMessageSent)||void 0===e||e.call(r)},addMessageReceived:()=>{var e;null===(e=r.addMessageReceived)||void 0===e||e.call(r)},onCallEnd:e=>{var t;null===(t=r.onCallEnd)||void 0===t||t.call(r,e),this.removeActiveCall(l)},onStreamEnd:e=>{var t;null===(t=r.onStreamEnd)||void 0===t||t.call(r,e)}},l=new f.Http2SubchannelCall(o,a,n,this,(0,p.getNextCallNumber)()),this.addActiveCall(l),l}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,s.unregisterChannelzRef)(this.channelzRef)}}t.Http2SubchannelConnector=class{constructor(e){this.channelTarget=e,this.session=null,this.isShutdown=!1}trace(e){l.trace(o.LogVerbosity.DEBUG,g,(0,h.uriToString)(this.channelTarget)+" "+e)}createSession(e,t,i){return this.isShutdown?Promise.reject():e.socket.closed?Promise.reject("Connection closed before starting HTTP/2 handshake"):new Promise((r,s)=>{var o,a,l,u,d,f,p,g;let m=null,v=this.channelTarget;if("grpc.http_connect_target"in i){const e=(0,h.parseUri)(i["grpc.http_connect_target"]);e&&(v=e,m=(0,h.uriToString)(e))}const y=e.secure?"https":"http",b=(0,c.getDefaultAuthority)(v),S=()=>{var e;null===(e=this.session)||void 0===e||e.destroy(),this.session=null,setImmediate(()=>{O||(O=!0,s(`${R.trim()} (${(new Date).toISOString()})`))})},_=e=>{var t;null===(t=this.session)||void 0===t||t.destroy(),R=e.message,this.trace("connection failed with error "+R),O||(O=!0,s(`${R} (${(new Date).toISOString()})`))},C={createConnection:(t,i)=>e.socket,settings:{initialWindowSize:null!==(u=null!==(o=i["grpc-node.flow_control_window"])&&void 0!==o?o:null===(l=null===(a=n.getDefaultSettings)||void 0===a?void 0:a.call(n))||void 0===l?void 0:l.initialWindowSize)&&void 0!==u?u:65535},maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER,maxSessionMemory:null!==(d=i["grpc-node.max_session_memory"])&&void 0!==d?d:Number.MAX_SAFE_INTEGER},w=n.connect(`${y}://${b}`,C),T=null!==(g=null===(p=null===(f=n.getDefaultSettings)||void 0===f?void 0:f.call(n))||void 0===p?void 0:p.initialWindowSize)&&void 0!==g?g:65535,k=i["grpc-node.flow_control_window"];this.session=w;let R="Failed to connect",O=!1;w.unref(),w.once("remoteSettings",()=>{var n;if(k&&k>T)try{w.setLocalWindowSize(k)}catch(e){const t=k-(null!==(n=w.state.localWindowSize)&&void 0!==n?n:T);t>0&&w.incrementWindowSize(t)}w.removeAllListeners(),e.socket.removeListener("close",S),e.socket.removeListener("error",_),r(new E(w,t,i,m)),this.session=null}),w.once("close",S),w.once("error",_),e.socket.once("close",S),e.socket.once("error",_)})}tcpConnect(e,t){return(0,a.getProxiedConnection)(e,t).then(t=>t||new Promise((t,i)=>{const n=()=>{i(new Error("Socket closed"))},r=e=>{i(e)},s=d.connect(e,()=>{s.removeListener("close",n),s.removeListener("error",r),t(s)});s.once("close",n),s.once("error",r)}))}async connect(e,t,i){if(this.isShutdown)return Promise.reject();let n=null,r=null;const s=(0,u.subchannelAddressToString)(e);try{return this.trace(s+" Waiting for secureConnector to be ready"),await t.waitForReady(),this.trace(s+" secureConnector is ready"),n=await this.tcpConnect(e,i),n.setNoDelay(),this.trace(s+" Established TCP connection"),r=await t.connect(n),this.trace(s+" Established secure connection"),this.createSession(r,e,i)}catch(e){throw null==n||n.destroy(),null==r||r.socket.destroy(),e}}shutdown(){var e;this.isShutdown=!0,null===(e=this.session)||void 0===e||e.close(),this.session=null}}},3822(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseUri=function(e){const t=i.exec(e);if(null===t)return null;return{scheme:t[1],authority:t[2],path:t[3]}},t.splitHostPort=function(e){if(e.startsWith("[")){const t=e.indexOf("]");if(-1===t)return null;const i=e.substring(1,t);if(-1===i.indexOf(":"))return null;if(e.length>t+1){if(":"===e[t+1]){const r=e.substring(t+2);return n.test(r)?{host:i,port:+r}:null}return null}return{host:i}}{const t=e.split(":");return 2===t.length?n.test(t[1])?{host:t[0],port:+t[1]}:null:{host:e}}},t.combineHostPort=function(e){return void 0===e.port?e.host:e.host.includes(":")?`[${e.host}]:${e.port}`:`${e.host}:${e.port}`},t.uriToString=function(e){let t="";void 0!==e.scheme&&(t+=e.scheme+":");void 0!==e.authority&&(t+="//"+e.authority+"/");return t+=e.path,t};const i=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;const n=/^\d+$/},5085(e,t,i){"use strict";t.Yi=t.Ib=void 0;const n=i(2028),r=i(2549),s=i(5407),o=i(3197);var a;i(5017),function(e){e.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",e.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",e.IDEMPOTENT="IDEMPOTENT"}(a=t.Ib||(t.Ib={}));const l={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function c(e,t){const i=(n=t,s=e.name,""===n?s:n+"."+s);var n,s;return function(e){return e instanceof r.Service||e instanceof r.Type||e instanceof r.Enum}(e)?[[i,e]]:function(e){return e instanceof r.Namespace||e instanceof r.Root}(e)&&void 0!==e.nested?Object.keys(e.nested).map(t=>c(e.nested[t],i)).reduce((e,t)=>e.concat(t),[]):[]}function u(e,t){return function(i){return e.toObject(e.decode(i),t)}}function h(e){return function(t){if(Array.isArray(t))throw new Error(`Failed to serialize message: expected object with ${e.name} structure, got array instead`);const i=e.fromObject(t);return e.encode(i).finish()}}function d(e){return(e||[]).reduce((e,t)=>{for(const[i,n]of Object.entries(t))if("uninterpreted_option"===i)e.uninterpreted_option.push(t.uninterpreted_option);else e[i]=n;return e},{deprecated:!1,idempotency_level:a.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function f(e,t,i,r){const s=e.resolvedRequestType,o=e.resolvedResponseType;return{path:"/"+t+"/"+e.name,requestStream:!!e.requestStream,responseStream:!!e.responseStream,requestSerialize:h(s),requestDeserialize:u(s,i),responseSerialize:h(o),responseDeserialize:u(o,i),originalName:n(e.name),requestType:p(s,i,r),responseType:p(o,i,r),options:d(e.parsedOptions)}}function p(e,t,i){const n=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,l),fileDescriptorProtos:i,serialize:h(e),deserialize:u(e,t)}}function g(e,t,i,n){if(e instanceof r.Service)return function(e,t,i,n){const r={};for(const s of e.methodsArray)r[s.name]=f(s,t,i,n);return r}(e,t,i,n);if(e instanceof r.Type)return p(e,i,n);if(e instanceof r.Enum)return function(e,t){const i=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:i.$type.toObject(i,l),fileDescriptorProtos:t}}(e,n);throw new Error("Type mismatch in reflection object handling")}function m(e,t){const i={};e.resolveAll();const n=e.toDescriptor("proto3").file.map(e=>Buffer.from(s.FileDescriptorProto.encode(e).finish()));for(const[r,s]of c(e,""))i[r]=g(s,r,t,n);return i}function v(e,t){t=t||{};const i=r.Root.fromDescriptor(e);return i.resolveAll(),m(i,t)}t.Yi=function(e,t){return m((0,o.loadProtosWithOptionsSync)(e,t),t)},(0,o.addCommonProtos)()},3197(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addCommonProtos=t.loadProtosWithOptionsSync=t.loadProtosWithOptions=void 0;const n=i(9896),r=i(6928),s=i(2549);function o(e,t){const i=e.resolvePath;e.resolvePath=(e,s)=>{if(r.isAbsolute(s))return s;for(const e of t){const t=r.join(e,s);try{return n.accessSync(t,n.constants.R_OK),t}catch(e){continue}}return process.emitWarning(`${s} not found in any of the include paths ${t}`),i(e,s)}}t.loadProtosWithOptions=async function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));o(i,t.includeDirs)}const n=await i.load(e,t);return n.resolveAll(),n},t.loadProtosWithOptionsSync=function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))throw new Error("The includeDirs option must be an array");o(i,t.includeDirs)}const n=i.loadSync(e,t);return n.resolveAll(),n},t.addCommonProtos=function(){const e=i(5434),t=i(3951),n=i(2939),r=i(6710);s.common("api",e.nested.google.nested.protobuf.nested),s.common("descriptor",t.nested.google.nested.protobuf.nested),s.common("source_context",n.nested.google.nested.protobuf.nested),s.common("type",r.nested.google.nested.protobuf.nested)}},6340(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadFileDescriptorSetFromObject=t.loadFileDescriptorSetFromBuffer=t.fromJSON=t.loadSync=t.load=t.IdempotencyLevel=t.isAnyExtension=t.Long=void 0;const n=i(2028),r=i(2549),s=i(5407),o=i(1238),a=i(5017);var l;t.Long=a,t.isAnyExtension=function(e){return"@type"in e&&"string"==typeof e["@type"]},function(e){e.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",e.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",e.IDEMPOTENT="IDEMPOTENT"}(l=t.IdempotencyLevel||(t.IdempotencyLevel={}));const c={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function u(e,t){const i=(n=t,s=e.name,""===n?s:n+"."+s);var n,s;return function(e){return e instanceof r.Service||e instanceof r.Type||e instanceof r.Enum}(e)?[[i,e]]:function(e){return e instanceof r.Namespace||e instanceof r.Root}(e)&&void 0!==e.nested?Object.keys(e.nested).map(t=>u(e.nested[t],i)).reduce((e,t)=>e.concat(t),[]):[]}function h(e,t){return function(i){return e.toObject(e.decode(i),t)}}function d(e){return function(t){if(Array.isArray(t))throw new Error(`Failed to serialize message: expected object with ${e.name} structure, got array instead`);const i=e.fromObject(t);return e.encode(i).finish()}}function f(e){return(e||[]).reduce((e,t)=>{for(const[i,n]of Object.entries(t))if("uninterpreted_option"===i)e.uninterpreted_option.push(t.uninterpreted_option);else e[i]=n;return e},{deprecated:!1,idempotency_level:l.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function p(e,t,i,r){const s=e.resolvedRequestType,o=e.resolvedResponseType;return{path:"/"+t+"/"+e.name,requestStream:!!e.requestStream,responseStream:!!e.responseStream,requestSerialize:d(s),requestDeserialize:h(s,i),responseSerialize:d(o),responseDeserialize:h(o,i),originalName:n(e.name),requestType:g(s,r),responseType:g(o,r),options:f(e.parsedOptions)}}function g(e,t){const i=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:i.$type.toObject(i,c),fileDescriptorProtos:t}}function m(e,t,i,n){if(e instanceof r.Service)return function(e,t,i,n){const r={};for(const s of e.methodsArray)r[s.name]=p(s,t,i,n);return r}(e,t,i,n);if(e instanceof r.Type)return g(e,n);if(e instanceof r.Enum)return function(e,t){const i=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:i.$type.toObject(i,c),fileDescriptorProtos:t}}(e,n);throw new Error("Type mismatch in reflection object handling")}function v(e,t){const i={};e.resolveAll();const n=e.toDescriptor("proto3").file.map(e=>Buffer.from(s.FileDescriptorProto.encode(e).finish()));for(const[r,s]of u(e,""))i[r]=m(s,r,t,n);return i}function y(e,t){t=t||{};const i=r.Root.fromDescriptor(e);return i.resolveAll(),v(i,t)}t.load=function(e,t){return(0,o.loadProtosWithOptions)(e,t).then(e=>v(e,t))},t.loadSync=function(e,t){return v((0,o.loadProtosWithOptionsSync)(e,t),t)},t.fromJSON=function(e,t){t=t||{};const i=r.Root.fromJSON(e);return i.resolveAll(),v(i,t)},t.loadFileDescriptorSetFromBuffer=function(e,t){return y(s.FileDescriptorSet.decode(e),t)},t.loadFileDescriptorSetFromObject=function(e,t){return y(s.FileDescriptorSet.fromObject(e),t)},(0,o.addCommonProtos)()},1238(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addCommonProtos=t.loadProtosWithOptionsSync=t.loadProtosWithOptions=void 0;const n=i(9896),r=i(6928),s=i(2549);function o(e,t){const i=e.resolvePath;e.resolvePath=(e,s)=>{if(r.isAbsolute(s))return s;for(const e of t){const t=r.join(e,s);try{return n.accessSync(t,n.constants.R_OK),t}catch(e){continue}}return process.emitWarning(`${s} not found in any of the include paths ${t}`),i(e,s)}}t.loadProtosWithOptions=async function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));o(i,t.includeDirs)}const n=await i.load(e,t);return n.resolveAll(),n},t.loadProtosWithOptionsSync=function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))throw new Error("The includeDirs option must be an array");o(i,t.includeDirs)}const n=i.loadSync(e,t);return n.resolveAll(),n},t.addCommonProtos=function(){const e=i(5434),t=i(3951),n=i(2939),r=i(6710);s.common("api",e.nested.google.nested.protobuf.nested),s.common("descriptor",t.nested.google.nested.protobuf.nested),s.common("source_context",n.nested.google.nested.protobuf.nested),s.common("type",r.nested.google.nested.protobuf.nested)}},6787(e,t,i){"use strict";i.r(t),i.d(t,{OrderedMap:()=>d});var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}"function"==typeof SuppressedError&&SuppressedError;var s=function(){function e(e,t,i){void 0===i&&(i=1),this.t=void 0,this.i=void 0,this.h=void 0,this.u=e,this.o=t,this.l=i}return e.prototype.v=function(){var e=this,t=e.h.h===e;if(t&&1===e.l)e=e.i;else if(e.t)for(e=e.t;e.i;)e=e.i;else{if(t)return e.h;for(var i=e.h;i.t===e;)i=(e=i).h;e=i}return e},e.prototype.p=function(){var e=this;if(e.i){for(e=e.i;e.t;)e=e.t;return e}for(var t=e.h;t.i===e;)t=(e=t).h;return e.i!==t?t:e},e.prototype.T=function(){var e=this.h,t=this.i,i=t.t;return e.h===this?e.h=t:e.t===this?e.t=t:e.i=t,t.h=e,t.t=this,this.h=t,this.i=i,i&&(i.h=this),t},e.prototype.I=function(){var e=this.h,t=this.t,i=t.i;return e.h===this?e.h=t:e.t===this?e.t=t:e.i=t,t.h=e,t.i=this,this.h=t,this.t=i,i&&(i.h=this),t},e}(),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.O=1,t}return r(t,e),t.prototype.T=function(){var t=e.prototype.T.call(this);return this.M(),t.M(),t},t.prototype.I=function(){var t=e.prototype.I.call(this);return this.M(),t.M(),t},t.prototype.M=function(){this.O=1,this.t&&(this.O+=this.t.O),this.i&&(this.O+=this.i.O)},t}(s),a=function(){function e(e){void 0===e&&(e=0),this.iteratorType=e}return e.prototype.equals=function(e){return this.C===e.C},e}(),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(function(){function e(){this._=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._},enumerable:!1,configurable:!0}),e.prototype.size=function(){return this._},e.prototype.empty=function(){return 0===this._},e}());function c(){throw new RangeError("Iterator access denied!")}var u=function(e){function t(t,i){void 0===t&&(t=function(e,t){return e<t?-1:e>t?1:0}),void 0===i&&(i=!1);var n=e.call(this)||this;return n.N=void 0,n.g=t,n.enableIndex=i,n.S=i?o:s,n.A=new n.S,n}return r(t,e),t.prototype.m=function(e,t){for(var i=this.A;e;){var n=this.g(e.u,t);if(n<0)e=e.i;else{if(!(n>0))return e;i=e,e=e.t}}return i},t.prototype.B=function(e,t){for(var i=this.A;e;){this.g(e.u,t)<=0?e=e.i:(i=e,e=e.t)}return i},t.prototype.j=function(e,t){for(var i=this.A;e;){var n=this.g(e.u,t);if(n<0)i=e,e=e.i;else{if(!(n>0))return e;e=e.t}}return i},t.prototype.k=function(e,t){for(var i=this.A;e;){this.g(e.u,t)<0?(i=e,e=e.i):e=e.t}return i},t.prototype.R=function(e){for(;;){var t,i=e.h;if(i===this.A)return;if(1===e.l)return void(e.l=0);if(e===i.t)if(1===(t=i.i).l)t.l=0,i.l=1,i===this.N?this.N=i.T():i.T();else{if(t.i&&1===t.i.l)return t.l=i.l,i.l=0,t.i.l=0,void(i===this.N?this.N=i.T():i.T());t.t&&1===t.t.l?(t.l=1,t.t.l=0,t.I()):(t.l=1,e=i)}else if(1===(t=i.t).l)t.l=0,i.l=1,i===this.N?this.N=i.I():i.I();else{if(t.t&&1===t.t.l)return t.l=i.l,i.l=0,t.t.l=0,void(i===this.N?this.N=i.I():i.I());t.i&&1===t.i.l?(t.l=1,t.i.l=0,t.T()):(t.l=1,e=i)}}},t.prototype.G=function(e){if(1!==this._){for(var t=e;t.t||t.i;){if(t.i)for(t=t.i;t.t;)t=t.t;else t=t.t;var i=e.u;e.u=t.u,t.u=i;var n=e.o;e.o=t.o,t.o=n,e=t}this.A.t===t?this.A.t=t.h:this.A.i===t&&(this.A.i=t.h),this.R(t);var r=t.h;if(t===r.t?r.t=void 0:r.i=void 0,this._-=1,this.N.l=0,this.enableIndex)for(;r!==this.A;)r.O-=1,r=r.h}else this.clear()},t.prototype.P=function(e){for(var t="number"==typeof e?e:void 0,i="function"==typeof e?e:void 0,n=void 0===e?[]:void 0,r=0,s=this.N,o=[];o.length||s;)if(s)o.push(s),s=s.t;else{if(s=o.pop(),r===t)return s;n&&n.push(s),i&&i(s,r,this),r+=1,s=s.i}return n},t.prototype.q=function(e){for(;;){var t=e.h;if(0===t.l)return;var i=t.h;if(t===i.t){if((n=i.i)&&1===n.l){if(n.l=t.l=0,i===this.N)return;i.l=1,e=i;continue}if(e!==t.i)return t.l=0,i===this.N?this.N=i.I():i.I(),void(i.l=1);e.l=0,e.t&&(e.t.h=t),e.i&&(e.i.h=i),t.i=e.t,i.t=e.i,e.t=t,e.i=i,i===this.N?(this.N=e,this.A.h=e):(r=i.h).t===i?r.t=e:r.i=e,e.h=i.h,t.h=e,i.h=e,i.l=1}else{var n,r;if((n=i.t)&&1===n.l){if(n.l=t.l=0,i===this.N)return;i.l=1,e=i;continue}if(e!==t.t)return t.l=0,i===this.N?this.N=i.T():i.T(),void(i.l=1);e.l=0,e.t&&(e.t.h=i),e.i&&(e.i.h=t),i.i=e.t,t.t=e.i,e.t=i,e.i=t,i===this.N?(this.N=e,this.A.h=e):(r=i.h).t===i?r.t=e:r.i=e,e.h=i.h,t.h=e,i.h=e,i.l=1}return void(this.enableIndex&&(t.M(),i.M(),e.M()))}},t.prototype.D=function(e,t,i){if(void 0===this.N)return this._+=1,this.N=new this.S(e,t,0),this.N.h=this.A,this.A.h=this.A.t=this.A.i=this.N,this._;var n,r=this.A.t,s=this.g(r.u,e);if(0===s)return r.o=t,this._;if(s>0)r.t=new this.S(e,t),r.t.h=r,n=r.t,this.A.t=n;else{var o=this.A.i,a=this.g(o.u,e);if(0===a)return o.o=t,this._;if(a<0)o.i=new this.S(e,t),o.i.h=o,n=o.i,this.A.i=n;else{if(void 0!==i){var l=i.C;if(l!==this.A){var c=this.g(l.u,e);if(0===c)return l.o=t,this._;if(c>0){var u=l.v(),h=this.g(u.u,e);if(0===h)return u.o=t,this._;h<0&&(n=new this.S(e,t),void 0===u.i?(u.i=n,n.h=u):(l.t=n,n.h=l))}}}if(void 0===n)for(n=this.N;;){var d=this.g(n.u,e);if(d>0){if(void 0===n.t){n.t=new this.S(e,t),n.t.h=n,n=n.t;break}n=n.t}else{if(!(d<0))return n.o=t,this._;if(void 0===n.i){n.i=new this.S(e,t),n.i.h=n,n=n.i;break}n=n.i}}}}if(this.enableIndex)for(var f=n.h;f!==this.A;)f.O+=1,f=f.h;return this.q(n),this._+=1,this._},t.prototype.F=function(e,t){for(;e;){var i=this.g(e.u,t);if(i<0)e=e.i;else{if(!(i>0))return e;e=e.t}}return e||this.A},t.prototype.clear=function(){this._=0,this.N=void 0,this.A.h=void 0,this.A.t=this.A.i=void 0},t.prototype.updateKeyByIterator=function(e,t){var i=e.C;if(i===this.A&&c(),1===this._)return i.u=t,!0;var n=i.p().u;if(i===this.A.t)return this.g(n,t)>0&&(i.u=t,!0);var r=i.v().u;return i===this.A.i?this.g(r,t)<0&&(i.u=t,!0):!(this.g(r,t)>=0||this.g(n,t)<=0)&&(i.u=t,!0)},t.prototype.eraseElementByPos=function(e){if(e<0||e>this._-1)throw new RangeError;var t=this.P(e);return this.G(t),this._},t.prototype.eraseElementByKey=function(e){if(0===this._)return!1;var t=this.F(this.N,e);return t!==this.A&&(this.G(t),!0)},t.prototype.eraseElementByIterator=function(e){var t=e.C;t===this.A&&c();var i=void 0===t.i;return 0===e.iteratorType?i&&e.next():i&&void 0!==t.t||e.next(),this.G(t),e},t.prototype.getHeight=function(){if(0===this._)return 0;return function e(t){return t?Math.max(e(t.t),e(t.i))+1:0}(this.N)},t}(l),h=function(e){function t(t,i,n,r){var s=e.call(this,t,i,r)||this;return s.container=n,s}return r(t,e),Object.defineProperty(t.prototype,"pointer",{get:function(){this.C===this.A&&c();var e=this;return new Proxy([],{get:function(t,i){return"0"===i?e.C.u:"1"===i?e.C.o:(t[0]=e.C.u,t[1]=e.C.o,t[i])},set:function(t,i,n){if("1"!==i)throw new TypeError("prop must be 1");return e.C.o=n,!0}})},enumerable:!1,configurable:!0}),t.prototype.copy=function(){return new t(this.C,this.A,this.container,this.iteratorType)},t}(function(e){function t(t,i,n){var r=e.call(this,n)||this;return r.C=t,r.A=i,0===r.iteratorType?(r.pre=function(){return this.C===this.A.t&&c(),this.C=this.C.v(),this},r.next=function(){return this.C===this.A&&c(),this.C=this.C.p(),this}):(r.pre=function(){return this.C===this.A.i&&c(),this.C=this.C.p(),this},r.next=function(){return this.C===this.A&&c(),this.C=this.C.v(),this}),r}return r(t,e),Object.defineProperty(t.prototype,"index",{get:function(){var e=this.C,t=this.A.h;if(e===this.A)return t?t.O-1:0;var i=0;for(e.t&&(i+=e.t.O);e!==t;){var n=e.h;e===n.i&&(i+=1,n.t&&(i+=n.t.O)),e=n}return i},enumerable:!1,configurable:!0}),t.prototype.isAccessible=function(){return this.C!==this.A},t}(a)),d=function(e){function t(t,i,n){void 0===t&&(t=[]);var r=e.call(this,i,n)||this,s=r;return t.forEach(function(e){s.setElement(e[0],e[1])}),r}return r(t,e),t.prototype.begin=function(){return new h(this.A.t||this.A,this.A,this)},t.prototype.end=function(){return new h(this.A,this.A,this)},t.prototype.rBegin=function(){return new h(this.A.i||this.A,this.A,this,1)},t.prototype.rEnd=function(){return new h(this.A,this.A,this,1)},t.prototype.front=function(){if(0!==this._){var e=this.A.t;return[e.u,e.o]}},t.prototype.back=function(){if(0!==this._){var e=this.A.i;return[e.u,e.o]}},t.prototype.lowerBound=function(e){var t=this.m(this.N,e);return new h(t,this.A,this)},t.prototype.upperBound=function(e){var t=this.B(this.N,e);return new h(t,this.A,this)},t.prototype.reverseLowerBound=function(e){var t=this.j(this.N,e);return new h(t,this.A,this)},t.prototype.reverseUpperBound=function(e){var t=this.k(this.N,e);return new h(t,this.A,this)},t.prototype.forEach=function(e){this.P(function(t,i,n){e([t.u,t.o],i,n)})},t.prototype.setElement=function(e,t,i){return this.D(e,t,i)},t.prototype.getElementByPos=function(e){if(e<0||e>this._-1)throw new RangeError;var t=this.P(e);return[t.u,t.o]},t.prototype.find=function(e){var t=this.F(this.N,e);return new h(t,this.A,this)},t.prototype.getElementByKey=function(e){return this.F(this.N,e).o},t.prototype.union=function(e){var t=this;return e.forEach(function(e){t.setElement(e[0],e[1])}),this._},t.prototype[Symbol.iterator]=function(){var e,t,i,n;return function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&a[0]?n.return:a[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;switch(n=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}(this,function(r){switch(r.label){case 0:e=this._,t=this.P(),i=0,r.label=1;case 1:return i<e?[4,[(n=t[i]).u,n.o]]:[3,4];case 2:r.sent(),r.label=3;case 3:return++i,[3,1];case 4:return[2]}})},t}(u)},8045(e){"use strict";e.exports=function(e,t){var i=new Array(arguments.length-1),n=0,r=2,s=!0;for(;r<arguments.length;)i[n++]=arguments[r++];return new Promise(function(r,o){i[n]=function(e){if(s)if(s=!1,e)o(e);else{for(var t=new Array(arguments.length-1),i=0;i<t.length;)t[i++]=arguments[i];r.apply(null,t)}};try{e.apply(t||null,i)}catch(e){s&&(s=!1,o(e))}})}},8839(e,t){"use strict";var i=t;i.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&"="===e.charAt(t);)++i;return Math.ceil(3*e.length)/4-i};for(var n=new Array(64),r=new Array(123),s=0;s<64;)r[n[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;i.encode=function(e,t,i){for(var r,s=null,o=[],a=0,l=0;t<i;){var c=e[t++];switch(l){case 0:o[a++]=n[c>>2],r=(3&c)<<4,l=1;break;case 1:o[a++]=n[r|c>>4],r=(15&c)<<2,l=2;break;case 2:o[a++]=n[r|c>>6],o[a++]=n[63&c],l=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return l&&(o[a++]=n[r],o[a++]=61,1===l&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var o="invalid encoding";i.decode=function(e,t,i){for(var n,s=i,a=0,l=0;l<e.length;){var c=e.charCodeAt(l++);if(61===c&&a>1)break;if(void 0===(c=r[c]))throw Error(o);switch(a){case 0:n=c,a=1;break;case 1:t[i++]=n<<2|(48&c)>>4,n=c,a=2;break;case 2:t[i++]=(15&n)<<4|(60&c)>>2,n=c,a=3;break;case 3:t[i++]=(3&n)<<6|c,a=0}}if(1===a)throw Error(o);return i-s},i.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},8561(e){"use strict";function t(e,i){"string"==typeof e&&(i=e,e=void 0);var n=[];function r(e){if("string"!=typeof e){var i=s();if(t.verbose&&console.log("codegen: "+i),i="return "+i,e){for(var o=Object.keys(e),a=new Array(o.length+1),l=new Array(o.length),c=0;c<o.length;)a[c]=o[c],l[c]=e[o[c++]];return a[c]=i,Function.apply(null,a).apply(null,l)}return Function(i)()}for(var u=new Array(arguments.length-1),h=0;h<u.length;)u[h]=arguments[++h];if(h=0,e=e.replace(/%([%dfijs])/g,function(e,t){var i=u[h++];switch(t){case"d":case"f":return String(Number(i));case"i":return String(Math.floor(i));case"j":return JSON.stringify(i);case"s":return String(i)}return"%"}),h!==u.length)throw Error("parameter count mismatch");return n.push(e),r}function s(t){return"function "+(t||i||"")+"("+(e&&e.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return r.toString=s,r}e.exports=t,t.verbose=!1},4358(e){"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n<i.length;)i[n].fn===t?i.splice(n,1):++n;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var i=[],n=1;n<arguments.length;)i.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,i)}return this}},5212(e,t,i){"use strict";e.exports=s;var n=i(8045),r=i(4153)("fs");function s(e,t,i){return"function"==typeof t?(i=t,t={}):t||(t={}),i?!t.xhr&&r&&r.readFile?r.readFile(e,function(n,r){return n&&"undefined"!=typeof XMLHttpRequest?s.xhr(e,t,i):n?i(n):i(null,t.binary?r:r.toString("utf8"))}):s.xhr(e,t,i):n(s,this,e,t)}s.xhr=function(e,t,i){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return i(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var r=0;r<n.responseText.length;++r)e.push(255&n.responseText.charCodeAt(r))}return i(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return i(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()}},9410(e){"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),i=new Uint8Array(t.buffer),n=128===i[3];function r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3]}function s(e,n,r){t[0]=e,n[r]=i[3],n[r+1]=i[2],n[r+2]=i[1],n[r+3]=i[0]}function o(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],t[0]}function a(e,n){return i[3]=e[n],i[2]=e[n+1],i[1]=e[n+2],i[0]=e[n+3],t[0]}e.writeFloatLE=n?r:s,e.writeFloatBE=n?s:r,e.readFloatLE=n?o:a,e.readFloatBE=n?a:o}():function(){function t(e,t,i,n){var r=t<0?1:0;if(r&&(t=-t),0===t)e(1/t>0?0:2147483648,i,n);else if(isNaN(t))e(2143289344,i,n);else if(t>34028234663852886e22)e((r<<31|2139095040)>>>0,i,n);else if(t<11754943508222875e-54)e((r<<31|Math.round(t/1401298464324817e-60))>>>0,i,n);else{var s=Math.floor(Math.log(t)/Math.LN2);e((r<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,i,n)}}function o(e,t,i){var n=e(t,i),r=2*(n>>31)+1,s=n>>>23&255,o=8388607&n;return 255===s?o?NaN:r*(1/0):0===s?1401298464324817e-60*r*o:r*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,i),e.writeFloatBE=t.bind(null,n),e.readFloatLE=o.bind(null,r),e.readFloatBE=o.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),i=new Uint8Array(t.buffer),n=128===i[7];function r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3],n[r+4]=i[4],n[r+5]=i[5],n[r+6]=i[6],n[r+7]=i[7]}function s(e,n,r){t[0]=e,n[r]=i[7],n[r+1]=i[6],n[r+2]=i[5],n[r+3]=i[4],n[r+4]=i[3],n[r+5]=i[2],n[r+6]=i[1],n[r+7]=i[0]}function o(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],i[4]=e[n+4],i[5]=e[n+5],i[6]=e[n+6],i[7]=e[n+7],t[0]}function a(e,n){return i[7]=e[n],i[6]=e[n+1],i[5]=e[n+2],i[4]=e[n+3],i[3]=e[n+4],i[2]=e[n+5],i[1]=e[n+6],i[0]=e[n+7],t[0]}e.writeDoubleLE=n?r:s,e.writeDoubleBE=n?s:r,e.readDoubleLE=n?o:a,e.readDoubleBE=n?a:o}():function(){function t(e,t,i,n,r,s){var o=n<0?1:0;if(o&&(n=-n),0===n)e(0,r,s+t),e(1/n>0?0:2147483648,r,s+i);else if(isNaN(n))e(0,r,s+t),e(2146959360,r,s+i);else if(n>17976931348623157e292)e(0,r,s+t),e((o<<31|2146435072)>>>0,r,s+i);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,r,s+t),e((o<<31|a/4294967296)>>>0,r,s+i);else{var l=Math.floor(Math.log(n)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(a=n*Math.pow(2,-l))>>>0,r,s+t),e((o<<31|l+1023<<20|1048576*a&1048575)>>>0,r,s+i)}}}function o(e,t,i,n,r){var s=e(n,r+t),o=e(n,r+i),a=2*(o>>31)+1,l=o>>>20&2047,c=4294967296*(1048575&o)+s;return 2047===l?c?NaN:a*(1/0):0===l?5e-324*a*c:a*Math.pow(2,l-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,i,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=o.bind(null,r,0,4),e.readDoubleBE=o.bind(null,s,4,0)}(),e}function i(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}function n(e,t,i){t[i]=e>>>24,t[i+1]=e>>>16&255,t[i+2]=e>>>8&255,t[i+3]=255&e}function r(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},4153(module){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},9207(e,t){"use strict";var i=t,n=i.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},r=i.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),i=n(e),r="";i&&(r=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):i?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return r+t.join("/")};i.resolve=function(e,t,i){return i||(t=r(t)),n(t)?t:(i||(e=r(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?r(e+"/"+t):t)}},9390(e){"use strict";e.exports=function(e,t,i){var n=i||8192,r=n>>>1,s=null,o=n;return function(i){if(i<1||i>r)return e(i);o+i>n&&(s=e(n),o=0);var a=t.call(s,o,o+=i);return 7&o&&(o=1+(7|o)),a}}},1447(e,t){"use strict";var i=t;i.length=function(e){for(var t=0,i=0,n=0;n<e.length;++n)(i=e.charCodeAt(n))<128?t+=1:i<2048?t+=2:55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},i.read=function(e,t,i){if(i-t<1)return"";for(var n,r=null,s=[],o=0;t<i;)(n=e[t++])<128?s[o++]=n:n>191&&n<224?s[o++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(n>>10),s[o++]=56320+(1023&n)):s[o++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),o=0);return r?(o&&r.push(String.fromCharCode.apply(String,s.slice(0,o))),r.join("")):String.fromCharCode.apply(String,s.slice(0,o))},i.write=function(e,t,i){for(var n,r,s=i,o=0;o<e.length;++o)(n=e.charCodeAt(o))<128?t[i++]=n:n<2048?(t[i++]=n>>6|192,t[i++]=63&n|128):55296==(64512&n)&&56320==(64512&(r=e.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&r),++o,t[i++]=n>>18|240,t[i++]=n>>12&63|128,t[i++]=n>>6&63|128,t[i++]=63&n|128):(t[i++]=n>>12|224,t[i++]=n>>6&63|128,t[i++]=63&n|128);return i-s}},8591(e,t,i){var n=i(5692),r=i(8611),s=i(7016),o=i(3294),a=(e.exports.maxRedirects=5,{https:n,http:r});for(var l in a){var c=function(){};c.prototype=a[l],(c=new c).request=function(i){return function(n,r,a){a=a||{};var c,u="object"==typeof n&&"maxRedirects"in n?n.maxRedirects:t.maxRedirects,h=o.extend({count:0,max:u,clientRequest:null,userCallback:r},a);if(h.count>h.max){var d=new Error("Max redirects exceeded. To allow more redirects, pass options.maxRedirects property.");return h.clientRequest.emit("error",d),h.clientRequest}h.count++,c="string"==typeof n?n:s.format(o.extend({protocol:l},n));var f=Object.getPrototypeOf(i).request(n,function t(i,n){return function(r){if(r.statusCode<300||r.statusCode>399)return n.userCallback(r);if(!("location"in r.headers))return n.userCallback(r);var o=s.resolve(i,r.headers.location),a=s.parse(o).protocol;return a=a.substr(0,a.length-1),e.exports[a].get(o,t(i,n),n)}}(c,h));return h.clientRequest||(h.clientRequest=f),f}}(c),c.get=function(e){return function(t,i,n){var r=e.request(t,i,n);return r.end(),r}}(c),e.exports[l]=c}},8280(e,t,i){e.exports=s;var n=i(9023),r=i(4198);function s(e,t,i){var n=this;if(!(n instanceof s))return new s(e,t,i);r.Duplex.call(n,i),n._output=null,n.connect(e,t)}n.inherits(s,r.Duplex),s.prototype.connect=function(e,t){var i=this;i.req=e,i._output=t,i.emit("response",t),t.on("data",function(e){i.push(e)||i._output.pause()}),t.on("end",function(){i.push(null)})},s.prototype._read=function(e){this._output&&this._output.resume()},s.prototype._write=function(e,t,i){this.req.write(e,t),i()},s.prototype.end=function(e,t,i){return this._output.socket.destroySoon(),this.req.end(e,t,i)},s.prototype.destroy=function(){this.req.destroy(),this._output.socket.destroy()},s.prototype.destroySoon=function(){this.req.destroy(),this._output.socket.destroy()}},7469(e,t,i){var n=i(3480),r=i(8591),s=i(9896),o=i(6928),a=i(7016),l=i(8397),c=i(8280),u=i(3294),h=(i(9023),i(4546)),d=i(857),f="Windows_NT"===d.type(),p=i(2203),g=function(){return new Promise(function(e){var t=o.join(d.homedir(),".docker","run","docker.sock");s.access(t,function(i){e(i?"/var/run/docker.sock":t)})})},m=function(e){var t=function(){var e,t={};if(process.env.DOCKER_HOST)if(0===process.env.DOCKER_HOST.indexOf("unix://"))t.socketPath=process.env.DOCKER_HOST.substring(7)||g;else if(0===process.env.DOCKER_HOST.indexOf("npipe://"))t.socketPath=process.env.DOCKER_HOST.substring(8)||"//./pipe/docker_engine";else{var i=process.env.DOCKER_HOST;i.indexOf("//")<0&&(i="tcp://"+i);try{e=new a.URL(i)}catch(e){throw new Error("DOCKER_HOST env variable should be something like tcp://localhost:1234")}t.port=e.port,"1"===process.env.DOCKER_TLS_VERIFY||"2376"===t.port?t.protocol="https":"ssh:"===e.protocol?(t.protocol="ssh",t.username=e.username,t.sshOptions={agent:process.env.SSH_AUTH_SOCK}):t.protocol="http",process.env.DOCKER_PATH_PREFIX?t.pathPrefix=process.env.DOCKER_PATH_PREFIX:t.pathPrefix="/",t.host=e.hostname,process.env.DOCKER_CERT_PATH&&(t.ca=h(o.join(process.env.DOCKER_CERT_PATH,"ca.pem")),t.cert=s.readFileSync(o.join(process.env.DOCKER_CERT_PATH,"cert.pem")),t.key=s.readFileSync(o.join(process.env.DOCKER_CERT_PATH,"key.pem"))),process.env.DOCKER_CLIENT_TIMEOUT&&(t.timeout=parseInt(process.env.DOCKER_CLIENT_TIMEOUT,10))}else t.socketPath=f?"//./pipe/docker_engine":g;return t}(),i=Object.assign({},t,e);this.host=i.host,this.host||(this.socketPath=i.socketPath),this.port=i.port,this.pathPrefix=i.pathPrefix,this.username=i.username,this.password=i.password,this.version=i.version,this.key=i.key,this.cert=i.cert,this.ca=i.ca,this.timeout=i.timeout,this.connectionTimeout=i.connectionTimeout,this.checkServerIdentity=i.checkServerIdentity,this.agent=i.agent,this.headers=i.headers||{},this.sshOptions=Object.assign({},e?e.sshOptions:{},t.sshOptions),void 0===this.sshOptions.agentForward&&(this.sshOptions.agentForward=i.agentForward),this.key&&this.cert&&this.ca&&(this.protocol="https"),this.protocol=i.protocol||this.protocol||"http"};m.prototype.dial=function(e,t){var i,n,r;if(e.options&&(i=e.options),i&&i.authconfig&&delete i.authconfig,i&&i.abortSignal&&delete i.abortSignal,this.version&&(e.path="/"+this.version+e.path),this.host){var l=a.parse(this.host);n=a.format({protocol:l.protocol||this.protocol,hostname:l.hostname||this.host,port:this.port,pathname:l.pathname||this.pathPrefix}),n=a.resolve(n,e.path)}else n=e.path;-1!==e.path.indexOf("?")&&(i&&Object.keys(i).length>0?n+=this.buildQuerystring(i._query||i):n=n.substring(0,n.length-1));var c={path:n,method:e.method,headers:e.headers||Object.assign({},this.headers),key:this.key,cert:this.cert,ca:this.ca};if(this.checkServerIdentity&&(c.checkServerIdentity=this.checkServerIdentity),this.agent&&(c.agent=this.agent),e.authconfig&&(c.headers["X-Registry-Auth"]=e.authconfig.key||e.authconfig.base64||Buffer.from(JSON.stringify(e.authconfig)).toString("base64").replace(/\+/g,"-").replace(/\//g,"_")),e.registryconfig&&(c.headers["X-Registry-Config"]=e.registryconfig.base64||Buffer.from(JSON.stringify(e.registryconfig)).toString("base64")),e.abortSignal&&(c.signal=e.abortSignal),e.file?(r="string"==typeof e.file?s.createReadStream(o.resolve(e.file)):e.file,c.headers["Content-Type"]="application/tar"):i&&"POST"===e.method&&(r=JSON.stringify(i._body||i),e.allowEmpty||"{}"!==r&&'""'!==r?c.headers["Content-Type"]="application/json":r=void 0),"string"==typeof r?c.headers["Content-Length"]=Buffer.byteLength(r):!0===Buffer.isBuffer(r)?c.headers["Content-Length"]=r.length:("PUT"===c.method||e.hijack||e.openStdin)&&(c.headers["Transfer-Encoding"]="chunked"),e.hijack&&(c.headers.Connection="Upgrade",c.headers.Upgrade=c.headers.Upgrade??"tcp"),this.socketPath)this.getSocketPath().then(i=>{c.socketPath=i,this.buildRequest(c,e,r,t)});else{var u=a.parse(n);c.hostname=u.hostname,c.port=u.port,c.path=u.path,this.buildRequest(c,e,r,t)}},m.prototype.getSocketPath=function(){if(this.socketPath){if(this.socketPathCache)return Promise.resolve(this.socketPathCache);var e="function"==typeof this.socketPath?this.socketPath():this.socketPath;return this.socketPathCache=e,Promise.resolve(e)}},m.prototype.buildRequest=function(e,t,i,n){var s,o=this,a=!1,c="ssh"===o.protocol?Object.assign(e,{agent:l(Object.assign({},o.sshOptions,{host:o.host,port:o.port,username:o.username,password:o.password})),protocol:"http:"}):e,h=null;try{h=r["ssh"===o.protocol?"http":o.protocol].request(c,function(){})}catch(e){return void n(e)}o.connectionTimeout&&(s=setTimeout(function(){h.destroy()},o.connectionTimeout)),o.timeout&&(h.setTimeout(o.timeout),h.on("timeout",function(){h.destroy()})),!0===t.hijack&&(clearTimeout(s),h.on("upgrade",function(e,t,i){if(!1===a)return a=!0,i.length>0&&t.unshift(i),n(null,t)})),h.on("connect",function(){clearTimeout(s)}),h.on("disconnect",function(){clearTimeout(s)}),h.on("response",function(i){if(clearTimeout(s),!0===t.isStream)!1===a&&(a=!0,o.buildPayload(null,t.isStream,t.statusCodes,t.openStdin,h,i,null,n));else{null!=e.signal&&p.addAbortSignal(e.signal,i);var r=[];i.on("data",function(e){r.push(e)}),i.on("end",function(){var e=Buffer.concat(r),s=e.toString(),l=u.parseJSON(s)||e;!1===a&&(a=!0,o.buildPayload(null,t.isStream,t.statusCodes,!1,h,i,l,n))})}}),h.on("error",function(e){clearTimeout(s),!1===a&&(a=!0,o.buildPayload(e,t.isStream,t.statusCodes,!1,{},{},null,n))}),"string"==typeof i||Buffer.isBuffer(i)?h.write(i):i&&(i.on("error",function(e){h.destroy(e)}),i.pipe(h)),t.openStdin||"string"!=typeof i&&void 0!==i&&!Buffer.isBuffer(i)||h.end()},m.prototype.buildPayload=function(e,t,i,n,r,s,o,a){if(e)return a(e,null);!0!==i[s.statusCode]?function(e,t,i,n){var r="",s=!1;e?(t.on("data",function(e){r+=e}),t.on("error",function(e){o(e,null)}),t.on("end",function(){o(null,u.parseJSON(r)||r)})):n(null,i);function o(e,t){!1===s&&(e?n(e):n(null,t)),s=!0}}(t,s,o,function(e,t){if(e)return a(e,null);var n=new Error("(HTTP code "+s.statusCode+") "+(i[s.statusCode]||"unexpected")+" - "+(t.message||t.error||t)+" ");n.reason=i[s.statusCode],n.statusCode=s.statusCode,n.json=o,a(n,null)}):a(null,n?new c(r,s):t?s:o)},m.prototype.demuxStream=function(e,t,i){var n=null,r=null,s=Buffer.from("");function o(e){var t=s.subarray(0,e);return s=Buffer.from(s.subarray(e,s.length)),t}e.on("data",function e(a){if(a&&(s=Buffer.concat([s,a])),n){if(s.length>=r){var l=o(r);1===n?t.write(l):i.write(l),n=null,e()}}else if(s.length>=8){var c=o(8);n=c.readUInt8(0),r=c.readUInt32BE(4),e()}})},m.prototype.followProgress=function(e,t,i){var n="",r=[],s=!1;function o(e){function t(e){if("\r"==e[e.length-1]&&(e=e.substr(0,e.length-1)),e.length>0){var t=JSON.parse(e);r.push(t),i&&i(t)}}n+=e.toString(),function(){var e;for(;(e=n.indexOf("\n"))>=0;)0!=e?(t(n.slice(0,e)),n=n.slice(e+1)):n=n.slice(1)}()}function a(){s||t(null,r),s=!0}e.on("data",o),e.on("error",function i(n){s=!0,e.removeListener("data",o),e.removeListener("error",i),e.removeListener("end",a),e.removeListener("close",a),t(n,r)}),e.on("end",a),e.on("close",a)},m.prototype.buildQuerystring=function(e){var t={};return Object.keys(e).map(function(i,n){e[i]&&"object"==typeof e[i]&&!Array.isArray(e[i])?t[i]=JSON.stringify(e[i]):t[i]=e[i]}),n.stringify(t)},e.exports=m},8397(e,t,i){var n=i(1217).Client,r=i(8611);e.exports=function(e){var t=new n,i=new r.Agent;function s(e,n){if(t.end(),i.destroy(),!n)throw e;n(e)}return i.createConnection=function(n,r){try{t.once("ready",function(){t.exec("docker system dial-stdio",function(e,n){e&&s(e,r),r(null,n),n.addListener("error",e=>{s(e,r)}),n.once("close",()=>{t.end(),i.destroy()})})}).on("error",e=>{s(e,r)}).connect(e),t.once("end",()=>i.destroy())}catch(e){s(e)}},i}},3294(e){var t=[],i=t.forEach,n=t.slice;e.exports.extend=function(e){return i.call(n.call(arguments,1),function(t){if(t)for(var i in t)e[i]=t[i]}),e},e.exports.parseJSON=function(e){try{return JSON.parse(e)}catch(e){return null}}},6474(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/configs/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/configs/"+this.id+"/update?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/configs/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},4985(e,t,i){i(7052).extend;var n=i(6033),r=i(7052),s=function(e,t){this.modem=e,this.id=t,this.defaultOptions={top:{},start:{},commit:{},stop:{},pause:{},unpause:{},restart:{},resize:{},attach:{},remove:{},copy:{},kill:{},exec:{},rename:{},log:{},stats:{},getArchive:{},infoArchive:{},putArchive:{},update:{},wait:{}}};s.prototype[i(9023).inspect.custom]=function(){return this},s.prototype.inspect=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/json?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.rename=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.rename),s={path:"/containers/"+this.id+"/rename?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.update=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.update),s={path:"/containers/"+this.id+"/update",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.top=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.top),s={path:"/containers/"+this.id+"/top?",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.changes=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/changes",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.listCheckpoint=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/checkpoints?",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.deleteCheckpoint=function(e,t,i){var n=this,s=r.processArgs(t,i),o={path:"/containers/"+this.id+"/checkpoints/"+e+"?",method:"DELETE",abortSignal:s.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){n.modem.dial(o,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(o,function(e,t){s.callback(e,t)})},s.prototype.createCheckpoint=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/checkpoints",method:"POST",abortSignal:n.opts.abortSignal,allowEmpty:!0,statusCodes:{200:!0,201:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.export=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/export",method:"GET",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.start=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.start),s={path:"/containers/"+this.id+"/start?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,304:"container already started",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.pause=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.pause),s={path:"/containers/"+this.id+"/pause",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.unpause=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.unpause),s={path:"/containers/"+this.id+"/unpause",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.exec=function(e,t){var i=this,s=r.processArgs(e,t,this.defaultOptions.exec),o={path:"/containers/"+this.id+"/exec",method:"POST",abortSignal:s.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"no such container",409:"container stopped/paused",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){i.modem.dial(o,function(r,s){if(r)return t(r);e(new n(i.modem,s.Id))})});this.modem.dial(o,function(e,t){if(e)return s.callback(e,t);s.callback(e,new n(i.modem,t.Id))})},s.prototype.commit=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.commit);n.opts.container=this.id;var s={path:"/commit?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.stop=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.stop),s={path:"/containers/"+this.id+"/stop?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,304:"container already stopped",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.restart=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.restart),s={path:"/containers/"+this.id+"/restart?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.kill=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.kill),s={path:"/containers/"+this.id+"/kill?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.resize=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.resize),s={path:"/containers/"+this.id+"/resize?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.attach=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.attach),s={path:"/containers/"+this.id+"/attach?",method:"POST",abortSignal:n.opts.abortSignal,isStream:!0,hijack:n.opts.hijack,openStdin:n.opts.stdin,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.wait=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.wait),s={path:"/containers/"+this.id+"/wait?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.remove=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.remove),s={path:"/containers/"+this.id+"?",method:"DELETE",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.copy=function(e,t){var i=this;console.log("container.copy is deprecated since Docker v1.8.x");var n=r.processArgs(e,t,this.defaultOptions.copy),s={path:"/containers/"+this.id+"/copy",method:"POST",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.getArchive=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.getArchive),s={path:"/containers/"+this.id+"/archive?",method:"GET",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"client error, bad parameters",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.infoArchive=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.infoArchive),s={path:"/containers/"+this.id+"/archive?",method:"HEAD",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"client error, bad parameters",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.putArchive=function(e,t,i){var n=this,s=r.processArgs(t,i,this.defaultOptions.putArchive),o={path:"/containers/"+this.id+"/archive?",method:"PUT",file:e,abortSignal:s.opts.abortSignal,statusCodes:{200:!0,400:"client error, bad parameters",403:"client error, permission denied",404:"no such container",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){n.modem.dial(o,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(o,function(e,t){s.callback(e,t)})},s.prototype.logs=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.log),s={path:"/containers/"+this.id+"/logs?",method:"GET",abortSignal:n.opts.abortSignal,isStream:n.opts.follow||!1,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.stats=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.stats),s=!0;!1===n.opts.stream&&(s=!1);var o={path:"/containers/"+this.id+"/stats?",method:"GET",abortSignal:n.opts.abortSignal,isStream:s,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(o,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(o,function(e,t){n.callback(e,t)})},e.exports=s},8608(e,t,i){var n=i(4434).EventEmitter,r=i(7469),s=i(4985),o=i(1991),a=i(4974),l=i(384),c=i(3569),u=i(3303),h=i(9360),d=i(6474),f=i(5517),p=i(4024),g=i(6033),m=i(7052),v=i(7054),y=m.extend,b=function(e){if(!(this instanceof b))return new b(e);var t=global.Promise;e&&e.Promise&&(t=e.Promise,1===Object.keys(e).length&&(e=void 0)),e&&e.modem?this.modem=e.modem:this.modem=new r(e),this.modem.Promise=t};b.prototype.createContainer=function(e,t){var i=this,n={path:"/containers/create?",method:"POST",options:e,authconfig:e.authconfig,abortSignal:e.abortSignal,statusCodes:{200:!0,201:!0,400:"bad parameter",404:"no such container",406:"impossible to attach",500:"server error"}};if(delete e.authconfig,void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(n,r){if(n)return t(n);e(i.getContainer(r.Id))})});this.modem.dial(n,function(e,n){if(e)return t(e,n);t(e,i.getContainer(n.Id))})},b.prototype.createImage=function(e,t,i){var n=this;i||"function"!=typeof t?i||t||(e=(t=e).authconfig):(i=t,e=(t=e).authconfig||void 0);var r={path:"/images/create?",method:"POST",options:t,authconfig:e,abortSignal:t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},b.prototype.loadImage=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,t=null);var r={path:"/images/load?",method:"POST",options:t,file:e,abortSignal:t&&t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},b.prototype.importImage=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,t=void 0),t||(t={}),t.fromSrc="-";var r={path:"/images/create?",method:"POST",options:t,file:e,abortSignal:t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},b.prototype.checkAuth=function(e,t){var i=this,n={path:"/auth",method:"POST",options:e,abortSignal:e.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},b.prototype.buildImage=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,t=null);var r={path:"/build?",method:"POST",file:void 0,options:t,abortSignal:t&&t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};function s(t){m.prepareBuildContext(e,e=>{r.file=e,n.modem.dial(r,t)})}function o(e){"2"===t?.version?v(n,r.authconfig,(t,i,n)=>{if(t)return e(t);r.options.session=i,s((t,i)=>{e(t,i),i&&i.on("end",n)})}):s(e)}if(t&&(t.registryconfig&&(r.registryconfig=r.options.registryconfig,delete r.options.registryconfig),t.authconfig&&(r.authconfig=r.options.authconfig,delete r.options.authconfig),t.cachefrom&&Array.isArray(t.cachefrom)&&(r.options.cachefrom=JSON.stringify(t.cachefrom))),void 0===i)return new n.modem.Promise(function(e,t){o(function(i,n){if(i)return t(i);e(n)})});o(i)},b.prototype.getContainer=function(e){return new s(this.modem,e)},b.prototype.getImage=function(e){return new o(this.modem,e)},b.prototype.getVolume=function(e){return new a(this.modem,e)},b.prototype.getPlugin=function(e,t){return new u(this.modem,e,t)},b.prototype.getService=function(e){return new c(this.modem,e)},b.prototype.getTask=function(e){return new f(this.modem,e)},b.prototype.getNode=function(e){return new p(this.modem,e)},b.prototype.getNetwork=function(e){return new l(this.modem,e)},b.prototype.getSecret=function(e){return new h(this.modem,e)},b.prototype.getConfig=function(e){return new d(this.modem,e)},b.prototype.getExec=function(e){return new g(this.modem,e)},b.prototype.listContainers=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/containers/json?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listImages=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/images/json?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.getImages=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/images/get?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listServices=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/services?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listNodes=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/nodes?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such node",500:"server error",503:"node is not part of a swarm"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listTasks=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/tasks?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createSecret=function(e,t){var i=m.processArgs(e,t),n=this,r={path:"/secrets/create?",method:"POST",options:i.opts,abortSignal:i.opts.abortSignal,statusCodes:{200:!0,201:!0,406:"server error or node is not part of a swarm",409:"name conflicts with an existing object",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,r){if(i)return t(i);e(n.getSecret(r.ID))})});this.modem.dial(r,function(e,t){if(e)return i.callback(e,t);i.callback(e,n.getSecret(t.ID))})},b.prototype.createConfig=function(e,t){var i=m.processArgs(e,t),n=this,r={path:"/configs/create?",method:"POST",options:i.opts,abortSignal:i.opts.abortSignal,statusCodes:{200:!0,201:!0,406:"server error or node is not part of a swarm",409:"name conflicts with an existing object",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,r){if(i)return t(i);e(n.getConfig(r.ID))})});this.modem.dial(r,function(e,t){if(e)return i.callback(e,t);i.callback(e,n.getConfig(t.ID))})},b.prototype.listSecrets=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/secrets?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listConfigs=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/configs?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createPlugin=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/plugins/create?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(r,s){if(r)return t(r);e(i.getPlugin(n.opts.name))})});this.modem.dial(r,function(e,t){if(e)return n.callback(e,t);n.callback(e,i.getPlugin(n.opts.name))})},b.prototype.listPlugins=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/plugins?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneImages=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/images/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneBuilder=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/build/prune",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneContainers=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/containers/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneVolumes=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/volumes/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneNetworks=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/networks/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createVolume=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/volumes/create?",method:"POST",allowEmpty:!0,options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,201:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(n,r){if(n)return t(n);e(i.getVolume(r.Name))})});this.modem.dial(r,function(e,t){if(e)return n.callback(e,t);n.callback(e,i.getVolume(t.Name))})},b.prototype.createService=function(e,t,i){i||"function"!=typeof t?t||i||(t=e):(i=t,e=(t=e).authconfig||void 0);var n=this,r={path:"/services/create",method:"POST",options:t,authconfig:e,abortSignal:t&&t.abortSignal,statusCodes:{200:!0,201:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,r){if(i)return t(i);e(n.getService(r.ID||r.Id))})});this.modem.dial(r,function(e,t){if(e)return i(e,t);i(e,n.getService(t.ID||t.Id))})},b.prototype.listVolumes=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/volumes?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createNetwork=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/networks/create?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"driver not found",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(n,r){if(n)return t(n);e(i.getNetwork(r.Id))})});this.modem.dial(r,function(e,t){if(e)return n.callback(e,t);n.callback(e,i.getNetwork(t.Id))})},b.prototype.listNetworks=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/networks?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.searchImages=function(e,t){var i=this,n={path:"/images/search?",method:"GET",options:e,authconfig:e.authconfig,abortSignal:e.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},b.prototype.info=function(e,t){var i=this,n=m.processArgs(e,t);e={path:"/info",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(t,n){i.modem.dial(e,function(e,i){if(e)return n(e);t(i)})});this.modem.dial(e,function(e,t){n.callback(e,t)})},b.prototype.version=function(e,t){var i=this,n=m.processArgs(e,t);e={path:"/version",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(t,n){i.modem.dial(e,function(e,i){if(e)return n(e);t(i)})});this.modem.dial(e,function(e,t){n.callback(e,t)})},b.prototype.ping=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/_ping",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.df=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/system/df",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.getEvents=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/events?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pull=function(e,t,i,n){var r=m.processArgs(t,i),s=m.parseRepositoryTag(e);r.opts.fromImage=s.repository,r.opts.tag=s.tag||"latest";var o=[r.opts,r.callback];return n&&(o=[n,r.opts,r.callback]),this.createImage.apply(this,o)},b.prototype.pullAll=function(e,t,i,n){var r=m.processArgs(t,i),s=m.parseRepositoryTag(e);r.opts.fromImage=s.repository;var o=[r.opts,r.callback];return n&&(o=[n,r.opts,r.callback]),this.createImage.apply(this,o)},b.prototype.run=function(e,t,i,n,r,s){return"function"==typeof arguments[arguments.length-1]?this.runCallback(e,t,i,n,r,s):this.runPromise(e,t,i,n,r)},b.prototype.runCallback=function(e,t,i,r,s,o){o||"function"!=typeof r?o||"function"!=typeof s||(o=s,s={}):(o=r,r={},s={});var a=new n;var l={Hostname:"",User:"",AttachStdin:!1,AttachStdout:!0,AttachStderr:!0,Tty:!0,OpenStdin:!1,StdinOnce:!1,Env:null,Cmd:t,Image:e,Volumes:{},VolumesFrom:[]};return y(l,r),this.createContainer(l,function(e,t){if(e)return o(e,null,t);a.emit("container",t),t.attach({stream:!0,stdout:!0,stderr:!0},function(e,n){if(e)return o(e,null,t);a.emit("stream",n),i&&(i instanceof Array?(n.on("end",function(){try{i[0].end()}catch(e){}try{i[1].end()}catch(e){}}),t.modem.demuxStream(n,i[0],i[1])):(n.setEncoding("utf8"),n.pipe(i,{end:!0}))),t.start(s,function(e,i){if(e)return o(e,i,t);a.emit("start",t),t.wait(function(e,i){a.emit("data",i),o(e,i,t)})})})}),a},b.prototype.runPromise=function(e,t,i,n,r){var s=this;r=r||{};var o,a={Hostname:"",User:"",AttachStdin:!1,AttachStdout:!0,AttachStderr:!0,Tty:!0,OpenStdin:!1,StdinOnce:!1,Env:null,Cmd:t,Image:e,Volumes:{},VolumesFrom:[]};return y(a,n=n||{}),new this.modem.Promise(function(e,t){s.createContainer(a).then(function(e){return o=e,e.attach({stream:!0,stdout:!0,stderr:!0})}).then(function(e){return i&&(i instanceof Array?(e.on("end",function(){try{i[0].end()}catch(e){}try{i[1].end()}catch(e){}}),o.modem.demuxStream(e,i[0],i[1])):(e.setEncoding("utf8"),e.pipe(i,{end:!0}))),o.start(r)}).then(function(e){return o.wait()}).then(function(t){e([t,o])}).catch(function(e){t(e)})})},b.prototype.swarmInit=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/init",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmJoin=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/join",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmLeave=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/leave?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,406:"node is not part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmUpdate=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/update?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmInspect=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,406:"This node is not a swarm manager",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.Container=s,b.Image=o,b.Volume=a,b.Network=l,b.Service=c,b.Plugin=u,b.Secret=h,b.Task=f,b.Node=p,b.Exec=g,e.exports=b},6033(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.start=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/exec/"+this.id+"/start",method:"POST",abortSignal:r.opts.abortSignal,isStream:!0,allowEmpty:!0,hijack:r.opts.hijack,openStdin:r.opts.stdin,statusCodes:{200:!0,204:!0,404:"no such exec",409:"container stopped/paused",500:"container not running"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},r.prototype.resize=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/exec/"+this.id+"/resize?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such exec",500:"container not running"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/exec/"+this.id+"/json",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such exec",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},e.exports=r},1991(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.name=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=n.processArgs(e,t),r=this;e={path:"/images/"+this.name+"/json",method:"GET",options:i.opts,statusCodes:{200:!0,404:"no such image",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(t,i){r.modem.dial(e,function(e,n){if(e)return i(e);t(n)})});this.modem.dial(e,function(e,t){if(e)return i.callback(e,t);i.callback(e,t)})},r.prototype.distribution=function(e,t){var i=n.processArgs(e,t),r=this,s={path:"/distribution/"+this.name+"/json",method:"GET",statusCodes:{200:!0,401:"no such image",500:"server error"},authconfig:i.opts?i.opts.authconfig:void 0};if(void 0===i.callback)return new this.modem.Promise(function(e,t){r.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return i.callback(e,t);i.callback(e,t)})},r.prototype.history=function(e){var t=this,i={path:"/images/"+this.name+"/history",method:"GET",statusCodes:{200:!0,404:"no such image",500:"server error"}};if(void 0===e)return new this.modem.Promise(function(e,n){t.modem.dial(i,function(t,i){if(t)return n(t);e(i)})});this.modem.dial(i,function(t,i){if(t)return e(t,i);e(t,i)})},r.prototype.get=function(e){var t=this,i={path:"/images/"+this.name+"/get",method:"GET",isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===e)return new this.modem.Promise(function(e,n){t.modem.dial(i,function(t,i){if(t)return n(t);e(i)})});this.modem.dial(i,function(t,i){if(t)return e(t,i);e(t,i)})},r.prototype.push=function(e,t,i){var r=this,s=n.processArgs(e,t),o=!0;!1===s.opts.stream&&(o=!1);var a={path:"/images/"+this.name+"/push?",method:"POST",options:s.opts,authconfig:s.opts.authconfig||i,abortSignal:s.opts.abortSignal,isStream:o,statusCodes:{200:!0,404:"no such image",500:"server error"}};if(delete a.options.authconfig,void 0===t)return new this.modem.Promise(function(e,t){r.modem.dial(a,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(a,function(e,i){t(e,i)})},r.prototype.tag=function(e,t){var i=this,n={path:"/images/"+this.name+"/tag?",method:"POST",options:e,abortSignal:e&&e.abortSignal,statusCodes:{200:!0,201:!0,400:"bad parameter",404:"no such image",409:"conflict",500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/images/"+this.name+"?",method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such image",409:"conflict",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},384(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t);e={path:"/networks/"+this.id+"?",method:"GET",statusCodes:{200:!0,404:"no such network",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(t,n){i.modem.dial(e,function(e,i){if(e)return n(e);t(i)})});this.modem.dial(e,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/networks/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such network",409:"conflict",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.connect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/networks/"+this.id+"/connect",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"network or container is not found",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.disconnect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/networks/"+this.id+"/disconnect",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"network or container is not found",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},4024(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/nodes/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such node",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t){var i=this;t||"function"!=typeof e||(t=e);var n={path:"/nodes/"+this.id+"/update?",method:"POST",abortSignal:e&&e.abortSignal,statusCodes:{200:!0,404:"no such node",406:"node is not part of a swarm",500:"server error"},options:e};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/nodes/"+this.id+"?",method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such node",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},3303(e,t,i){var n=i(7052),r=function(e,t,i){this.modem=e,this.name=t,this.remote=i||t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/json",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"plugin is not installed",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"?",method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"plugin is not installed",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},r.prototype.privileges=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/privileges?",method:"GET",options:{remote:this.remote},abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.pull=function(e,t){var i=this,r=n.processArgs(e,t);r.opts._query&&!r.opts._query.name&&(r.opts._query.name=this.name),r.opts._query&&!r.opts._query.remote&&(r.opts._query.remote=this.remote);var s={path:"/plugins/pull?",method:"POST",abortSignal:r.opts.abortSignal,isStream:!0,options:r.opts,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.enable=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/enable?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.disable=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/disable",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.push=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/push",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"plugin not installed",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.configure=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/set",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"plugin not installed",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.upgrade=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,e=(t=e).authconfig||void 0);var r={path:"/plugins/"+this.name+"/upgrade?",method:"POST",abortSignal:t&&t.abortSignal,statusCodes:{200:!0,204:!0,404:"plugin not installed",500:"server error"},authconfig:e,options:t};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},e.exports=r},9360(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/secrets/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"secret not found",406:"node is not part of a swarm",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t){var i=this;t||"function"!=typeof e||(t=e);var n={path:"/secrets/"+this.id+"/update?",method:"POST",abortSignal:e&&e.abortSignal,statusCodes:{200:!0,404:"secret not found",500:"server error"},options:e};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/secrets/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"secret not found",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},3569(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/services/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such service",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/services/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such service",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t,i){var n=this;if(!i){var r=typeof t;"function"===r?(i=t,e=(t=e).authconfig||void 0):"undefined"===r&&(e=(t=e).authconfig||void 0)}var s={path:"/services/"+this.id+"/update?",method:"POST",abortSignal:t&&t.abortSignal,statusCodes:{200:!0,404:"no such service",500:"server error"},authconfig:e,options:t};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){i(e,t)})},r.prototype.logs=function(e,t){var i=this,r=n.processArgs(e,t,{}),s={path:"/services/"+this.id+"/logs?",method:"GET",abortSignal:r.opts.abortSignal,isStream:r.opts.follow||!1,statusCodes:{200:!0,404:"no such service",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},7054(e,t,i){var n=i(674),r=i(6340),s=i(6928),o=i(4679).v4;e.exports=function(e,t,i){const a=o(),l={method:"POST",path:"/session",hijack:!0,headers:{Upgrade:"h2c","X-Docker-Expose-Session-Uuid":a,"X-Docker-Expose-Session-Name":"testcontainers"},statusCodes:{200:!0,500:"server error"}};e.modem.dial(l,function(e,o){if(e)return i(e,null,()=>{});const l=new n.Server,c=n.ServerCredentials.createInsecure();l.createConnectionInjector(c).injectConnection(o);const u=r.loadSync(s.resolve(__dirname,"proto","auth.proto")),h=n.loadPackageDefinition(u);l.addService(h.moby.filesync.v1.Auth.service,{Credentials({request:e},i){i(null,t?{Username:t.username,Secret:t.password}:{})}}),i(null,a,function(){l.forceShutdown(),o.end()})})}},5517(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t,this.defaultOptions={log:{}}};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/tasks/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"unknown task",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.logs=function(e,t){var i=this,r=n.processArgs(e,t,this.defaultOptions.log),s={path:"/tasks/"+this.id+"/logs?",method:"GET",abortSignal:r.opts.abortSignal,isStream:r.opts.follow||!1,statusCodes:{101:!0,200:!0,404:"no such container",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},7052(e,t,i){var n=i(3065),r=i(9896),s=i(6928),o=i(6868),a=i(3106),l=[],c=l.forEach,u=l.slice;e.exports.extend=function(e){return c.call(u.call(arguments,1),function(t){if(t)for(var i in t)e[i]=t[i]}),e},e.exports.processArgs=function(t,i,n){return i||"function"!=typeof t||(i=t,t=null),{callback:i,opts:e.exports.extend({},n,t)}},e.exports.parseRepositoryTag=function(e){var t,i=e.indexOf("@"),n=e.lastIndexOf(":");if(i>=0)t=i;else{if(!(n>=0))return{repository:e};t=n}var r=e.slice(t+1);return-1===r.indexOf("/")?{repository:e.slice(0,t),tag:r}:{repository:e}},e.exports.prepareBuildContext=function(e,t){e&&e.context?r.readFile(s.join(e.context,".dockerignore"),(i,r)=>{let s,l;if(!i){const e=n({ignorecase:!1}).add(r.toString());l=e.createFilter(),s=e=>!l(e)}const c=e.src.slice()||[],u=o.pack(e.context,{entries:l?c.filter(l):c,ignore:s});t(u.pipe(a.createGzip()))}):t(e)}},4974(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.name=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/volumes/"+this.name,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such volume",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/volumes/"+this.name,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{204:!0,404:"no such volume",409:"conflict",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},6611(e,t,i){var n=i(3519),r=function(){},s=global.Bare?queueMicrotask:process.nextTick.bind(process),o=function(e,t,i){if("function"==typeof t)return o(e,null,t);t||(t={}),i=n(i||r);var a=e._writableState,l=e._readableState,c=t.readable||!1!==t.readable&&e.readable,u=t.writable||!1!==t.writable&&e.writable,h=!1,d=function(){e.writable||f()},f=function(){u=!1,c||i.call(e)},p=function(){c=!1,u||i.call(e)},g=function(t){i.call(e,t?new Error("exited with error code: "+t):null)},m=function(t){i.call(e,t)},v=function(){s(y)},y=function(){if(!h)return(!c||l&&l.ended&&!l.destroyed)&&(!u||a&&a.ended&&!a.destroyed)?void 0:i.call(e,new Error("premature close"))},b=function(){e.req.on("finish",f)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?u&&!a&&(e.on("end",d),e.on("close",d)):(e.on("complete",f),e.on("abort",v),e.req?b():e.on("request",b)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",g),e.on("end",p),e.on("finish",f),!1!==t.error&&e.on("error",m),e.on("close",v),function(){h=!0,e.removeListener("complete",f),e.removeListener("abort",v),e.removeListener("request",b),e.req&&e.req.removeListener("finish",f),e.removeListener("end",d),e.removeListener("close",d),e.removeListener("finish",f),e.removeListener("exit",g),e.removeListener("end",p),e.removeListener("error",m),e.removeListener("close",v)}};e.exports=o},5474(e,t,i){e=i.nmd(e),function t(n){"use strict";var r;function s(e,t,i){const n=typeof i,r=typeof e;if("undefined"!==n){if("undefined"!==r){if(i){if("function"===r&&n===r)return function(t){return e(i(t))};if((t=e.constructor)===i.constructor){if(t===Array)return i.concat(e);if(t===Map){var s=new Map(i);for(var o of e)s.set(o[0],o[1]);return s}if(t===Set){for(s of(o=new Set(i),e.values()))o.add(s);return o}}}return e}return i}return"undefined"===r?t:e}function o(e,t){return void 0===e?t:e}function a(){return Object.create(null)}function l(e){return"string"==typeof e}function c(e){return"object"==typeof e}function u(e,t){if(l(t))e=e[t];else for(let i=0;e&&i<t.length;i++)e=e[t[i]];return e}(n=e)._factory=t;const h=/[^\p{L}\p{N}]+/u,d=/(\d{3})/g,f=/(\D)(\d{3})/g,p=/(\d{3})(\D)/g,g=/[\u0300-\u036f]/g;function m(e={}){if(!this||this.constructor!==m)return new m(...arguments);if(arguments.length)for(e=0;e<arguments.length;e++)this.assign(arguments[e]);else this.assign(e)}function v(e){e.F=null,e.B.clear(),e.D.clear()}function y(e,t,i){i||(t||"object"!=typeof e?"object"==typeof t&&(i=t,t=0):i=e),i&&(e=i.query||e,t=i.limit||t);let n=""+(t||0);i&&(n+=(i.offset||0)+!!i.context+!!i.suggest+(!1!==i.resolve)+(i.resolution||this.resolution)+(i.boost||0)),e=(""+e).toLowerCase(),this.cache||(this.cache=new b);let r=this.cache.get(e+n);if(!r){const s=i&&i.cache;s&&(i.cache=!1),r=this.search(e,t,i),s&&(i.cache=s),this.cache.set(e+n,r)}return r}function b(e){this.limit=e&&!0!==e?e:1e3,this.cache=new Map,this.h=""}(r=m.prototype).assign=function(e){this.normalize=s(e.normalize,!0,this.normalize);let t,i=e.include,n=i||e.exclude||e.split;if(n||""===n){if("object"==typeof n&&n.constructor!==RegExp){let e="";t=!i,i||(e+="\\p{Z}"),n.letter&&(e+="\\p{L}"),n.number&&(e+="\\p{N}",t=!!i),n.symbol&&(e+="\\p{S}"),n.punctuation&&(e+="\\p{P}"),n.control&&(e+="\\p{C}"),(n=n.char)&&(e+="object"==typeof n?n.join(""):n);try{this.split=new RegExp("["+(i?"^":"")+e+"]+","u")}catch(e){this.split=/\s+/}}else this.split=n,t=!1===n||"a1a".split(n).length<2;this.numeric=s(e.numeric,t)}else{try{this.split=s(this.split,h)}catch(e){this.split=/\s+/}this.numeric=s(e.numeric,s(this.numeric,!0))}if(this.prepare=s(e.prepare,null,this.prepare),this.finalize=s(e.finalize,null,this.finalize),n=e.filter,this.filter="function"==typeof n?n:s(n&&new Set(n),null,this.filter),this.dedupe=s(e.dedupe,!0,this.dedupe),this.matcher=s((n=e.matcher)&&new Map(n),null,this.matcher),this.mapper=s((n=e.mapper)&&new Map(n),null,this.mapper),this.stemmer=s((n=e.stemmer)&&new Map(n),null,this.stemmer),this.replacer=s(e.replacer,null,this.replacer),this.minlength=s(e.minlength,1,this.minlength),this.maxlength=s(e.maxlength,1024,this.maxlength),this.rtl=s(e.rtl,!1,this.rtl),(this.cache=n=s(e.cache,!0,this.cache))&&(this.F=null,this.L="number"==typeof n?n:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(const e of this.matcher.keys())this.h+=(this.h?"|":"")+e;if(this.stemmer)for(const e of this.stemmer.keys())this.A+=(this.A?"|":"")+e;return this},r.addStemmer=function(e,t){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(e,t),this.A+=(this.A?"|":"")+e,this.K=null,this.cache&&v(this),this},r.addFilter=function(e){return"function"==typeof e?this.filter=e:(this.filter||(this.filter=new Set),this.filter.add(e)),this.cache&&v(this),this},r.addMapper=function(e,t){return"object"==typeof e?this.addReplacer(e,t):e.length>1?this.addMatcher(e,t):(this.mapper||(this.mapper=new Map),this.mapper.set(e,t),this.cache&&v(this),this)},r.addMatcher=function(e,t){return"object"==typeof e?this.addReplacer(e,t):e.length<2&&(this.dedupe||this.mapper)?this.addMapper(e,t):(this.matcher||(this.matcher=new Map),this.matcher.set(e,t),this.h+=(this.h?"|":"")+e,this.J=null,this.cache&&v(this),this)},r.addReplacer=function(e,t){return"string"==typeof e?this.addMatcher(e,t):(this.replacer||(this.replacer=[]),this.replacer.push(e,t),this.cache&&v(this),this)},r.encode=function(e,t){if(this.cache&&e.length<=this.H)if(this.F){if(this.B.has(e))return this.B.get(e)}else this.F=setTimeout(v,50,this);this.normalize&&(e="function"==typeof this.normalize?this.normalize(e):g?e.normalize("NFKD").replace(g,"").toLowerCase():e.toLowerCase()),this.prepare&&(e=this.prepare(e)),this.numeric&&e.length>3&&(e=e.replace(f,"$1 $2").replace(p,"$1 $2").replace(d,"$1 "));const i=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let n,r,s=[],o=a(),l=this.split||""===this.split?e.split(this.split):[e];for(let e,a,u=0;u<l.length;u++)if((e=a=l[u])&&!(e.length<this.minlength||e.length>this.maxlength)){if(t){if(o[e])continue;o[e]=1}else{if(n===e)continue;n=e}if(i)s.push(e);else if(!this.filter||("function"==typeof this.filter?this.filter(e):!this.filter.has(e))){if(this.cache&&e.length<=this.I)if(this.F){var c=this.D.get(e);if(c||""===c){c&&s.push(c);continue}}else this.F=setTimeout(v,50,this);if(this.stemmer){let t;for(this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));t!==e&&e.length>2;)t=e,e=e.replace(this.K,e=>this.stemmer.get(e))}if(e&&(this.mapper||this.dedupe&&e.length>1)){c="";for(let t,i,n=0,r="";n<e.length;n++)t=e.charAt(n),t===r&&this.dedupe||((i=this.mapper&&this.mapper.get(t))||""===i?i===r&&this.dedupe||!(r=i)||(c+=i):c+=r=t);e=c}if(this.matcher&&e.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),e=e.replace(this.J,e=>this.matcher.get(e))),e&&this.replacer)for(c=0;e&&c<this.replacer.length;c+=2)e=e.replace(this.replacer[c],this.replacer[c+1]);if(this.cache&&a.length<=this.I&&(this.D.set(a,e),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),e){if(e!==a)if(t){if(o[e])continue;o[e]=1}else{if(r===e)continue;r=e}s.push(e)}}}return this.finalize&&(s=this.finalize(s)||s),this.cache&&e.length<=this.H&&(this.B.set(e,s),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),s},b.prototype.set=function(e,t){this.cache.set(this.h=e,t),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)},b.prototype.get=function(e){const t=this.cache.get(e);return t&&this.h!==e&&(this.cache.delete(e),this.cache.set(this.h=e,t)),t},b.prototype.remove=function(e){for(const t of this.cache){const i=t[0];t[1].includes(e)&&this.cache.delete(i)}},b.prototype.clear=function(){this.cache.clear(),this.h=""};const S={normalize:!1,numeric:!1,dedupe:!1},_={},C=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),w=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),E=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],T={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6};var k={Exact:S,Default:_,Normalize:_,LatinBalance:{mapper:C},LatinAdvanced:{mapper:C,matcher:w,replacer:E},LatinExtra:{mapper:C,replacer:E.concat([/(?!^)[aeo]/g,""]),matcher:w},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(e){for(let i=0;i<e.length;i++){var t=e[i];let n=t.charAt(0),r=T[n];for(let e,i=1;i<t.length&&(e=t.charAt(i),"h"===e||"w"===e||!(e=T[e])||e===r||(n+=e,r=e,4!==n.length));i++);e[i]=n}}},CJK:{split:""},LatinExact:S,LatinDefault:_,LatinSimple:_};function R(e,t,i,n){let r=[];for(let s,o=0;o<e.index.length;o++)if(s=e.index[o],t>=s.length)t-=s.length;else{const o=(t=s[n?"splice":"slice"](t,i)).length;if(o&&(r=r.length?r.concat(t):t,i-=o,n&&(e.length-=o),!i))break;t=0}return r}function O(e){if(!this||this.constructor!==O)return new O(e);this.index=e?[e]:[],this.length=e?e.length:0;const t=this;return new Proxy([],{get:(e,i)=>"length"===i?t.length:"push"===i?function(e){t.index[t.index.length-1].push(e),t.length++}:"pop"===i?function(){if(t.length)return t.length--,t.index[t.index.length-1].pop()}:"indexOf"===i?function(e){let i=0;for(let n,r,s=0;s<t.index.length;s++){if(n=t.index[s],r=n.indexOf(e),r>=0)return i+r;i+=n.length}return-1}:"includes"===i?function(e){for(let i=0;i<t.index.length;i++)if(t.index[i].includes(e))return!0;return!1}:"slice"===i?function(e,i){return R(t,e||0,i||t.length,!1)}:"splice"===i?function(e,i){return R(t,e||0,i||t.length,!0)}:"constructor"===i?Array:"symbol"!=typeof i?(e=t.index[i/2**31|0])&&e[i]:void 0,set:(e,i,n)=>(e=i/2**31|0,(t.index[e]||(t.index[e]=[]))[i]=n,t.length++,!0)})}function P(e=8){if(!this||this.constructor!==P)return new P(e);this.index=a(),this.h=[],this.size=0,e>32?(this.B=N,this.A=BigInt(e)):(this.B=x,this.A=e)}function A(e=8){if(!this||this.constructor!==A)return new A(e);this.index=a(),this.h=[],this.size=0,e>32?(this.B=N,this.A=BigInt(e)):(this.B=x,this.A=e)}function x(e){let t=2**this.A-1;if("number"==typeof e)return e&t;let i=0,n=this.A+1;for(let r=0;r<e.length;r++)i=(i*n^e.charCodeAt(r))&t;return 32===this.A?i+2**31:i}function N(e){let t=BigInt(2)**this.A-BigInt(1);var i=typeof e;if("bigint"===i)return e&t;if("number"===i)return BigInt(e)&t;i=BigInt(0);let n=this.A+BigInt(1);for(let r=0;r<e.length;r++)i=(i*n^BigInt(e.charCodeAt(r)))&t;return i}let I,M,L,D,j;async function F(e){var t=(e=e.data).task;const i=e.id;let r=e.args;if("init"===t)M=e.options||{},(t=e.factory)?(Function("return "+t)()(n),I=new n.FlexSearch.Index(M),delete n.FlexSearch):I=new Oe(M),postMessage({id:i});else{let n;"export"===t&&(r[1]?(r[0]=M.export,r[2]=0,r[3]=1):r=null),"import"===t?r[0]&&(e=await M.import.call(I,r[0]),I.import(r[0],e)):((n=r&&I[t].apply(I,r))&&n.then&&(n=await n),n&&n.await&&(n=await n.await),"search"===t&&n.result&&(n=n.result)),postMessage("search"===t?{id:i,msg:n}:{id:i})}}function B(e){z.call(e,"add"),z.call(e,"append"),z.call(e,"search"),z.call(e,"update"),z.call(e,"remove"),z.call(e,"searchCache")}function U(){L=j=0}function z(e){this[e+"Async"]=function(){const t=arguments;var i=t[t.length-1];let n;if("function"==typeof i&&(n=i,delete t[t.length-1]),L?j||(j=Date.now()-D>=this.priority*this.priority*3):(L=setTimeout(U,0),D=Date.now()),j){const i=this;return new Promise(n=>{setTimeout(function(){n(i[e+"Async"].apply(i,t))},0)})}const r=this[e].apply(this,t);return i=r.then?r:new Promise(e=>e(r)),n&&i.then(n),i}}O.prototype.clear=function(){this.index.length=0},O.prototype.push=function(){},P.prototype.get=function(e){const t=this.index[this.B(e)];return t&&t.get(e)},P.prototype.set=function(e,t){var i=this.B(e);let n=this.index[i];n?(i=n.size,n.set(e,t),(i-=n.size)&&this.size++):(this.index[i]=n=new Map([[e,t]]),this.h.push(n),this.size++)},A.prototype.add=function(e){var t=this.B(e);let i=this.index[t];i?(t=i.size,i.add(e),(t-=i.size)&&this.size++):(this.index[t]=i=new Set([e]),this.h.push(i),this.size++)},(r=P.prototype).has=A.prototype.has=function(e){const t=this.index[this.B(e)];return t&&t.has(e)},r.delete=A.prototype.delete=function(e){const t=this.index[this.B(e)];t&&t.delete(e)&&this.size--},r.clear=A.prototype.clear=function(){this.index=a(),this.h=[],this.size=0},r.values=A.prototype.values=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].values())yield t},r.keys=A.prototype.keys=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].keys())yield t},r.entries=A.prototype.entries=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].entries())yield t};let H=0;function q(e={},t){function r(i){function n(e){const t=(e=e.data||e).id,i=t&&l.h[t];i&&(i(e.msg),delete l.h[t])}if(this.worker=i,this.h=a(),this.worker)return o?this.worker.on("message",n):this.worker.onmessage=n,e.config?new Promise(function(t){H>1e9&&(H=0),l.h[++H]=function(){t(l)},l.worker.postMessage({id:H,task:"init",factory:s,options:e})}):(this.priority=e.priority||4,this.encoder=t||null,this.worker.postMessage({task:"init",factory:s,options:e}),this)}if(!this||this.constructor!==q)return new q(e);let s=void 0!==n?n._factory:"undefined"!=typeof window?window._factory:null;s&&(s=s.toString());const o="undefined"==typeof window,l=this,c=function(e,t,n){return t?new(i(8167).Worker)(__dirname+"/node/node.js"):e?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+F.toString()],{type:"text/javascript"}))):new window.Worker("string"==typeof n?n:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs","module/worker/worker.js"),{type:"module"})}(s,o,e.worker);return c.then?c.then(function(e){return r.call(l,e)}):r.call(this,c)}function W(e){q.prototype[e]=function(){const t=this,i=[].slice.call(arguments);var n=i[i.length-1];let r;return"function"==typeof n&&(r=n,i.pop()),n=new Promise(function(n){"export"===e&&"function"==typeof i[0]&&(i[0]=null),H>1e9&&(H=0),t.h[++H]=n,t.worker.postMessage({task:e,id:H,args:i})}),r?(n.then(r),this):n}}function G(e,t,i,n,r,s){if(e=e[r],n===i.length-1)t[r]=s||e;else if(e)if(e.constructor===Array)for(t=t[r]=Array(e.length),r=0;r<e.length;r++)G(e,t,i,n,r);else t=t[r]||(t[r]=a()),r=i[++n],G(e,t,i,n,r)}function $(e,t,i,n,r,s,o,a){if(e=e[o])if(n===t.length-1){if(e.constructor===Array){if(i[n]){for(t=0;t<e.length;t++)r.add(s,e[t],!0,!0);return}e=e.join(" ")}r.add(s,e,a,!0)}else if(e.constructor===Array)for(o=0;o<e.length;o++)$(e,t,i,n,r,s,o,a);else o=t[++n],$(e,t,i,n,r,s,o,a)}function V(e,t,i,n){if(!e.length)return e;if(1===e.length)return e=e[0],e=i||e.length>t?e.slice(i,i+t):e,n?le.call(this,e):e;let r=[];for(let s,o,a=0;a<e.length;a++)if((s=e[a])&&(o=s.length)){if(i){if(i>=o){i-=o;continue}s=s.slice(i,i+t),o=s.length,i=0}if(o>t&&(s=s.slice(0,t),o=t),!r.length&&o>=t)return n?le.call(this,s):s;if(r.push(s),!(t-=o))break}return r=r.length>1?[].concat.apply([],r):r[0],n?le.call(this,r):r}function Y(e,t,i,n){var r=n[0];if(r[0]&&r[0].query)return e[t].apply(e,r);if(!("and"!==t&&"not"!==t||e.result.length||e.await||r.suggest))return n.length>1&&(r=n[n.length-1]),(n=r.resolve)?e.await||e.result:e;let s,o,a,l,c,u=[],h=0,d=0;for(t=0;t<n.length;t++)if(r=n[t]){var f=void 0;if(r.constructor===te)f=r.await||r.result;else if(r.then||r.constructor===Array)f=r;else{h=r.limit||0,d=r.offset||0,a=r.suggest,o=r.resolve,s=((l=r.highlight||e.highlight)||r.enrich)&&o,f=r.queue;let i=r.async||f,n=r.index,p=r.query;if(n?e.index||(e.index=n):n=e.index,p||r.tag){const s=r.field||r.pluck;if(s&&(!p||e.query&&!l||(e.query=p,e.field=s,e.highlight=l),n=n.index.get(s)),f&&(c||e.await)){let s;c=1;const o=e.C.length,a=new Promise(function(e){s=e});(function(t,n){a.h=function(){n.index=null,n.resolve=!1;let r=i?t.searchAsync(n):t.search(n);return r.then?r.then(function(t){return e.C[o]=t=t.result||t,s(t),t}):(r=r.result||r,s(r),r)}})(n,Object.assign({},r)),e.C.push(a),u[t]=a;continue}r.resolve=!1,r.index=null,f=i?n.searchAsync(r):n.search(r),r.resolve=o,r.index=n}else if(r.and)f=K(r,"and",n);else if(r.or)f=K(r,"or",n);else if(r.not)f=K(r,"not",n);else{if(!r.xor)continue;f=K(r,"xor",n)}}f.await?(c=1,f=f.await):f.then?(c=1,f=f.then(function(e){return e.result||e})):f=f.result||f,u[t]=f}if(c&&!e.await&&(e.await=new Promise(function(t){e.return=t})),c){const t=Promise.all(u).then(function(n){for(let r=0;r<e.C.length;r++)if(e.C[r]===t){e.C[r]=function(){return i.call(e,n,h,d,s,o,a,l)};break}ie(e)});e.C.push(t)}else{if(!e.await)return i.call(e,u,h,d,s,o,a,l);e.C.push(function(){return i.call(e,u,h,d,s,o,a,l)})}return o?e.await||e.result:e}function K(e,t,i){const n=(e=e[t])[0]||e;return n.index||(n.index=i),i=new te(n),e.length>1&&(i=i[t].apply(i,e.slice(1))),i}function J(e,t,i,n,r,s,o){return e.length&&(this.result.length&&e.push(this.result),e.length<2?this.result=e[0]:(this.result=re(e,t,i,!1,this.h),i=0)),r&&(this.await=null),r?this.resolve(t,i,n,o):this}function X(e,t,i,n,r,s,o){if(!s&&!this.result.length)return r?this.result:this;let a;if(e.length)if(this.result.length&&e.unshift(this.result),e.length<2)this.result=e[0];else{let n=0;for(let t,i,r=0;r<e.length;r++)if((t=e[r])&&(i=t.length))n<i&&(n=i);else if(!s){n=0;break}n?(this.result=ne(e,n,t,i,s,this.h,r),a=!0):this.result=[]}else s||(this.result=e);return r&&(this.await=null),r?this.resolve(t,i,n,o,a):this}function Q(e,t,i,n,r,s,o){if(e.length)if(this.result.length&&e.unshift(this.result),e.length<2)this.result=e[0];else{e:{s=i;var l=this.h;const n=[],o=a();let c=0;for(let t,i=0;i<e.length;i++)if(t=e[i]){c<t.length&&(c=t.length);for(let e,i=0;i<t.length;i++)if(e=t[i])for(let t,i=0;i<e.length;i++)t=e[i],o[t]=o[t]?2:1}for(let i,a=0,u=0;a<c;a++)for(let c,h=0;h<e.length;h++)if((c=e[h])&&(i=c[a]))for(let c,d=0;d<i.length;d++)if(c=i[d],1===o[c])if(s)s--;else if(r){if(n.push(c),n.length===t){e=n;break e}}else{const i=a+(h?l:0);if(n[i]||(n[i]=[]),n[i].push(c),++u===t){e=n;break e}}e=n}this.result=e,l=!0}else s||(this.result=e);return r&&(this.await=null),r?this.resolve(t,i,n,o,l):this}function Z(e,t,i,n,r,s,o){if(!s&&!this.result.length)return r?this.result:this;if(e.length&&this.result.length){e:{s=i;var a=[];e=new Set(e.flat().flat());for(let i,n=0,o=0;n<this.result.length;n++)if(i=this.result[n])for(let l,c=0;c<i.length;c++)if(l=i[c],!e.has(l))if(s)s--;else if(r){if(a.push(l),a.length===t){e=a;break e}}else if(a[n]||(a[n]=[]),a[n].push(l),++o===t){e=a;break e}e=a}this.result=e,a=!0}return r&&(this.await=null),r?this.resolve(t,i,n,o,a):this}function ee(e,t,i,n,r){let s,o,a;"string"==typeof r?(s=r,r=""):s=r.template,o=s.indexOf("$1"),a=s.substring(o+2),o=s.substring(0,o);let l=r&&r.boundary,c=!r||!1!==r.clip,h=r&&r.merge&&a&&o&&new RegExp(a+" "+o,"g");var d=0;if("object"==typeof(r=r&&r.ellipsis)){var f=r.template;d=f.length-2,r=r.pattern}let p,g;"string"!=typeof r&&(r=!1===r?"":"..."),d&&(r=f.replace("$1",r)),f=r.length-d,"object"==typeof l&&(p=l.before,0===p&&(p=-1),g=l.after,0===g&&(g=-1),l=l.total||9e5),d=new Map;for(let M,L,D,j=0;j<t.length;j++){let F;if(n)F=t,D=n;else{var m=t[j];if(D=m.field,!D)continue;F=m.result}L=i.get(D),M=L.encoder,"string"!=typeof(m=d.get(M))&&(m=M.encode(e),d.set(M,m));for(let e=0;e<F.length;e++){var v=F[e].doc;if(!v)continue;if(!(v=u(v,D)))continue;var y=v.trim().split(/\s+/);if(!y.length)continue;v="";var b=[];let t=[];for(var S=-1,_=-1,C=0,w=0;w<y.length;w++){var E=y[w],T=M.encode(E);let e;if((T=T.length>1?T.join(" "):T[0])&&E){for(var k=E.length,R=(M.split?E.replace(M.split,""):E).length-T.length,O="",P=0,A=0;A<m.length;A++){var x=m[A];if(x){var N=x.length;N+=R<0?0:R,P&&N<=P||(x=T.indexOf(x))>-1&&(O=(x?E.substring(0,x):"")+o+E.substring(x,x+N)+a+(x+N<k?E.substring(x+N):""),P=N,e=!0)}}O&&(l&&(S<0&&(S=v.length+(v?1:0)),_=v.length+(v?1:0)+O.length,C+=k,t.push(b.length),b.push({match:O})),v+=(v?" ":"")+O)}if(e){if(l&&C>=l)break}else v+=(v?" ":"")+(E=y[w]),l&&b.push({text:E})}if(C=t.length*(s.length-2),p||g||l&&v.length-C>l)if(w=_-S,p>0&&(w+=p),g>0&&(w+=g),w<=(C=l+C-2*f))y=p?S-(p>0?p:0):S-((C-w)/2|0),b=g?_+(g>0?g:0):y+C,c||(y>0&&" "!==v.charAt(y)&&" "!==v.charAt(y-1)&&((y=v.indexOf(" ",y))<0&&(y=0)),b<v.length&&" "!==v.charAt(b-1)&&" "!==v.charAt(b)&&((b=v.lastIndexOf(" ",b))<_?b=_:++b)),v=(y?r:"")+v.substring(y,b)+(b<v.length?r:"");else{for(_=[],S={},C={},w={},E={},T={},O=R=k=0,A=P=1;;){var I=void 0;for(let e,i=0;i<t.length;i++){if(e=t[i],O)if(R!==O){if(w[i+1])continue;if(e+=O,S[e]){k-=f,C[i+1]=1,w[i+1]=1;continue}if(e>=b.length-1){if(e>=b.length){w[i+1]=1,e>=y.length&&(C[i+1]=1);continue}k-=f}if(v=b[e].text,N=g&&T[i]){if(!(N>0)){w[i+1]=1;continue}if(v.length>N){if(w[i+1]=1,!c)continue;v=v.substring(0,N)}(N-=v.length)||(N=-1),T[i]=N}if(k+v.length+1<=l)v=" "+v,_[i]+=v;else{if(!c){w[i+1]=1;continue}(I=l-k-1)>0&&(v=" "+v.substring(0,I),_[i]+=v),w[i+1]=1}}else{if(w[i])continue;if(e-=R,S[e]){k-=f,w[i]=1,C[i]=1;continue}if(e<=0){if(e<0){w[i]=1,C[i]=1;continue}k-=f}if(v=b[e].text,N=p&&E[i]){if(!(N>0)){w[i]=1;continue}if(v.length>N){if(w[i]=1,!c)continue;v=v.substring(v.length-N)}(N-=v.length)||(N=-1),E[i]=N}if(k+v.length+1<=l)v+=" ",_[i]=v+_[i];else{if(!c){w[i]=1;continue}(I=v.length+1-(l-k))>=0&&I<v.length&&(v=v.substring(I)+" ",_[i]=v+_[i]),w[i]=1}}else{let t;if(v=b[e].match,p&&(E[i]=p),g&&(T[i]=g),i&&k++,e?!i&&f&&(k+=f):(C[i]=1,w[i]=1),e>=y.length-1||e<b.length-1&&b[e+1].match?t=1:f&&(k+=f),k-=s.length-2,i&&!(k+v.length<=l)){I=P=A=C[i]=0;break}_[i]=v,t&&(C[i+1]=1,w[i+1]=1)}k+=v.length,I=S[e]=1}if(I)R===O?O++:R++;else{if(R===O?P=0:A=0,!P&&!A)break;P?O=++R:O++}}v="";for(let e,t=0;t<_.length;t++)e=(C[t]?t?" ":"":(t&&!r?" ":"")+r)+_[t],v+=e;r&&!C[_.length]&&(v+=r)}h&&(v=v.replace(h," ")),F[e].highlight=v}if(n)break}return t}function te(e,t){if(!this||this.constructor!==te)return new te(e,t);let i,n,r,s,o,a,l=0;if(e&&e.index){const i=e;if(t=i.index,l=i.boost||0,n=i.query){r=i.field||i.pluck,s=i.highlight;const n=i.resolve;e=i.async||i.queue,i.resolve=!1,i.index=null,e=e?t.searchAsync(i):t.search(i),i.resolve=n,i.index=t,e=e.result||e}else e=[]}if(e&&e.then){const t=this;i=[e=e.then(function(e){t.C[0]=t.result=e.result||e,ie(t)})],e=[],o=new Promise(function(e){a=e})}this.index=t||null,this.result=e||[],this.h=l,this.C=i||[],this.await=o||null,this.return=a||null,this.highlight=s||null,this.query=n||"",this.field=r||""}function ie(e,t){let i=e.result;var n=e.await;e.await=null;for(let t,r=0;r<e.C.length;r++)if(t=e.C[r])if("function"==typeof t)i=t(),e.C[r]=i=i.result||i,r--;else if(t.h)i=t.h(),e.C[r]=i=i.result||i,r--;else if(t.then)return e.await=n;return n=e.return,e.C=[],e.return=null,t||n(i),i}function ne(e,t,i,n,r,s,o){const l=e.length;let c,u,h=[];c=a();for(let a,d,f,p,g=0;g<t;g++)for(let t=0;t<l;t++)if(f=e[t],g<f.length&&(a=f[g]))for(let e=0;e<a.length;e++){if(d=a[e],(u=c[d])?c[d]++:(u=0,c[d]=1),p=h[u]||(h[u]=[]),!o){let e=g+(t||!r?0:s||0);p=p[e]||(p[e]=[])}if(p.push(d),o&&i&&u===l-1&&p.length-n===i)return n?p.slice(n):p}if(e=h.length)if(r)h=h.length>1?re(h,i,n,o,s):(h=h[0])&&i&&h.length>i||n?h.slice(n,i+n):h;else{if(e<l)return[];if(h=h[e-1],i||n)if(o)(h.length>i||n)&&(h=h.slice(n,i+n));else{r=[];for(let e,t=0;t<h.length;t++)if(e=h[t])if(n&&e.length>n)n-=e.length;else if((i&&e.length>i||n)&&(e=e.slice(n,i+n),i-=e.length,n&&(n-=e.length)),r.push(e),!i)break;h=r}}return h}function re(e,t,i,n,r){const s=[],o=a();let l;var c=e.length;let u;if(n){for(r=c-1;r>=0;r--)if(u=(n=e[r])&&n.length)for(c=0;c<u;c++)if(l=n[c],!o[l])if(o[l]=1,i)i--;else if(s.push(l),s.length===t)return s}else for(let a,h=c-1,d=0;h>=0;h--){a=e[h];for(let e=0;e<a.length;e++)if(u=(n=a[e])&&n.length)for(let a=0;a<u;a++)if(l=n[a],!o[l])if(o[l]=1,i)i--;else{let i=(e+(h<c-1&&r||0))/(h+1)|0;if((s[i]||(s[i]=[])).push(l),++d===t)return s}}return s}function se(e,t,i,n,r){const s=a(),o=[];for(let e,i=0;i<t.length;i++){e=t[i];for(let t=0;t<e.length;t++)s[e[t]]=1}if(r){for(let t,r=0;r<e.length;r++)if(t=e[r],s[t])if(n)n--;else if(o.push(t),s[t]=0,i&&0===--i)break}else for(let i,n,r=0;r<e.result.length;r++)for(i=e.result[r],t=0;t<i.length;t++)n=i[t],s[n]&&((o[r]||(o[r]=[])).push(n),s[n]=0);return o}function oe(e){const t=[],i=a(),n=a();for(let r,s,o,a,l,c,u,h=0;h<e.length;h++){r=e[h],s=r.field,o=r.result;for(let e=0;e<o.length;e++)l=o[e],"object"!=typeof l?l={id:a=l}:a=l.id,(c=i[a])?c.push(s):(l.field=i[a]=[s],t.push(l)),(u=l.highlight)&&(c=n[a],c||(n[a]=c={},l.highlight=c),c[s]=u)}return t}function ae(e,t,i,n,r){return(e=this.tag.get(e))&&(e=e.get(t))?((t=e.length-n)>0&&((i&&t>i||n)&&(e=e.slice(n,n+i)),r&&(e=le.call(this,e))),e):[]}function le(e){if(!this||!this.store)return e;if(this.db)return this.index.get(this.field[0]).db.enrich(e);const t=Array(e.length);for(let i,n=0;n<e.length;n++)i=e[n],t[n]={id:i,doc:this.store.get(i)};return t}function ce(e){if(!this||this.constructor!==ce)return new ce(e);const t=e.document||e.doc||e;let i,n;if(this.B=[],this.field=[],this.D=[],this.key=(i=t.key||t.id)&&he(i,this.D)||"id",(n=e.keystore||0)&&(this.keystore=n),this.fastupdate=!!e.fastupdate,this.reg=!this.fastupdate||e.worker||e.db?n?new A(n):new Set:n?new P(n):new Map,this.h=(i=t.store||null)&&i&&!0!==i&&[],this.store=i?n?new P(n):new Map:null,this.cache=(i=e.cache||null)&&new b(i),e.cache=!1,this.worker=e.worker||!1,this.priority=e.priority||4,this.index=ue.call(this,e,t),this.tag=null,(i=t.tag)&&("string"==typeof i&&(i=[i]),i.length)){this.tag=new Map,this.A=[],this.F=[];for(let e,t,n=0;n<i.length;n++){if(e=i[n],t=e.field||e,!t)throw Error("The tag field from the document descriptor is undefined.");e.custom?this.A[n]=e.custom:(this.A[n]=he(t,this.D),e.filter&&("string"==typeof this.A[n]&&(this.A[n]=new String(this.A[n])),this.A[n].G=e.filter)),this.F[n]=t,this.tag.set(t,new Map)}}if(this.worker){this.fastupdate=!1,e=[];for(const t of this.index.values())t.then&&e.push(t);if(e.length){const t=this;return Promise.all(e).then(function(e){let i=0;for(const n of t.index.entries()){const r=n[0];let s=n[1];s.then&&(s=e[i],t.index.set(r,s),i++)}return t})}}else e.db&&(this.fastupdate=!1,this.mount(e.db))}function ue(e,t){const i=new Map;let n=t.index||t.field||t;l(n)&&(n=[n]);for(let t,s,o=0;o<n.length;o++){if(t=n[o],l(t)||(s=t,t=t.field),s=c(s)?Object.assign({},e,s):e,this.worker){var r=void 0;r=new q(s,r=(r=s.encoder)&&r.encode?r:new m("string"==typeof r?k[r]:r||{})),i.set(t,r)}this.worker||i.set(t,new Oe(s,this.reg)),s.custom?this.B[o]=s.custom:(this.B[o]=he(t,this.D),s.filter&&("string"==typeof this.B[o]&&(this.B[o]=new String(this.B[o])),this.B[o].G=s.filter)),this.field[o]=t}if(this.h){l(e=t.store)&&(e=[e]);for(let t,i,n=0;n<e.length;n++)t=e[n],i=t.field||t,t.custom?(this.h[n]=t.custom,t.custom.O=i):(this.h[n]=he(i,this.D),t.filter&&("string"==typeof this.h[n]&&(this.h[n]=new String(this.h[n])),this.h[n].G=t.filter))}return i}function he(e,t){const i=e.split(":");let n=0;for(let r=0;r<i.length;r++)"]"===(e=i[r])[e.length-1]&&(e=e.substring(0,e.length-2))&&(t[n]=!0),e&&(i[n++]=e);return n<i.length&&(i.length=n),n>1?i:i[0]}function de(e,t=0){let i=[],n=[];t&&(t=25e4/t*5e3|0);for(const r of e.entries())n.push(r),n.length===t&&(i.push(n),n=[]);return n.length&&i.push(n),i}function fe(e,t){t||(t=new Map);for(let i,n=0;n<e.length;n++)i=e[n],t.set(i[0],i[1]);return t}function pe(e,t=0){let i=[],n=[];t&&(t=25e4/t*1e3|0);for(const r of e.entries())n.push([r[0],de(r[1])[0]||[]]),n.length===t&&(i.push(n),n=[]);return n.length&&i.push(n),i}function ge(e,t){t||(t=new Map);for(let i,n,r=0;r<e.length;r++)i=e[r],n=t.get(i[0]),t.set(i[0],fe(i[1],n));return t}function me(e){let t=[],i=[];for(const n of e.keys())i.push(n),25e4===i.length&&(t.push(i),i=[]);return i.length&&t.push(i),t}function ve(e,t){t||(t=new Set);for(let i=0;i<e.length;i++)t.add(e[i]);return t}function ye(e,t,i,n,r,s,o=0){const a=n&&n.constructor===Array;var l=a?n.shift():n;if(!l)return this.export(e,t,r,s+1);if((l=e((t?t+".":"")+(o+1)+"."+i,JSON.stringify(l)))&&l.then){const c=this;return l.then(function(){return ye.call(c,e,t,i,a?n:null,r,s,o+1)})}return ye.call(this,e,t,i,a?n:null,r,s,o+1)}function be(e,t){let i="";for(const n of e.entries()){e=n[0];const r=n[1];let s="";for(let e,i=0;i<r.length;i++){e=r[i]||[""];let n="";for(let i=0;i<e.length;i++)n+=(n?",":"")+("string"===t?'"'+e[i]+'"':e[i]);n="["+n+"]",s+=(s?",":"")+n}s='["'+e+'",['+s+"]]",i+=(i?",":"")+s}return i}function Se(e,t){let i=0;var n=void 0===t;if(e.constructor===Array){for(let r,s,o,a=0;a<e.length;a++)if((r=e[a])&&r.length){if(n)return 1;if(s=r.indexOf(t),s>=0){if(r.length>1)return r.splice(s,1),1;if(delete e[a],i)return 1;o=1}else{if(o)return 1;i++}}}else for(let r of e.entries())n=r[0],Se(r[1],t)?i++:e.delete(n);return i}W("add"),W("append"),W("search"),W("update"),W("remove"),W("clear"),W("export"),W("import"),q.prototype.searchCache=y,B(q.prototype),ce.prototype.add=function(e,t,i){if(c(e)&&(e=u(t=e,this.key)),t&&(e||0===e)){if(!i&&this.reg.has(e))return this.update(e,t);for(let s,o=0;o<this.field.length;o++){s=this.B[o];var n=this.index.get(this.field[o]);if("function"==typeof s){var r=s(t);r&&n.add(e,r,i,!0)}else(!(r=s.G)||r(t))&&(s.constructor===String?s=[""+s]:l(s)&&(s=[s]),$(t,s,this.D,0,n,e,s[0],i))}if(this.tag)for(n=0;n<this.A.length;n++){var s=this.A[n];r=this.tag.get(this.F[n]);let c=a();if("function"==typeof s){if(!(s=s(t)))continue}else{var o=s.G;if(o&&!o(t))continue;s.constructor===String&&(s=""+s),s=u(t,s)}if(r&&s){l(s)&&(s=[s]);for(let t,n,a=0;a<s.length;a++)if(t=s[a],!c[t]&&(c[t]=1,(o=r.get(t))?n=o:r.set(t,n=[]),!i||!n.includes(e))){if(n.length===2**31-1){if(o=new O(n),this.fastupdate)for(let e of this.reg.values())e.includes(n)&&(e[e.indexOf(n)]=o);r.set(t,n=o)}n.push(e),this.fastupdate&&((o=this.reg.get(e))?o.push(n):this.reg.set(e,[n]))}}}if(this.store&&(!i||!this.store.has(e))){let n;if(this.h){n=a();for(let e,r=0;r<this.h.length;r++){if(e=this.h[r],(i=e.G)&&!i(t))continue;let s;if("function"==typeof e){if(s=e(t),!s)continue;e=[e.O]}else if(l(e)||e.constructor===String){n[e]=t[e];continue}G(t,n,e,0,e[0],s)}}this.store.set(e,n||t)}this.worker&&(this.fastupdate||this.reg.add(e))}return this},te.prototype.or=function(){return Y(this,"or",J,arguments)},te.prototype.and=function(){return Y(this,"and",X,arguments)},te.prototype.xor=function(){return Y(this,"xor",Q,arguments)},te.prototype.not=function(){return Y(this,"not",Z,arguments)},(r=te.prototype).limit=function(e){if(this.await){const t=this;this.C.push(function(){return t.limit(e).result})}else if(this.result.length){const t=[];for(let i,n=0;n<this.result.length;n++)if(i=this.result[n]){if(!(i.length<=e)){t[n]=i.slice(0,e);break}if(t[n]=i,!(e-=i.length))break}this.result=t}return this},r.offset=function(e){if(this.await){const t=this;this.C.push(function(){return t.offset(e).result})}else if(this.result.length){const t=[];for(let i,n=0;n<this.result.length;n++)(i=this.result[n])&&(i.length<=e?e-=i.length:(t[n]=i.slice(e),e=0));this.result=t}return this},r.boost=function(e){if(this.await){const t=this;this.C.push(function(){return t.boost(e).result})}else this.h+=e;return this},r.resolve=function(e,t,i,n,r){let s=this.await?ie(this,!0):this.result;if(s.then){const o=this;return s.then(function(){return o.resolve(e,t,i,n,r)})}return s.length&&("object"==typeof e?(n=e.highlight||this.highlight,i=!!n||e.enrich,t=e.offset,e=e.limit):(n=n||this.highlight,i=!!n||i),s=r?i?le.call(this.index,s):s:V.call(this.index,s,e||100,t,i)),this.finalize(s,n)},r.finalize=function(e,t){if(e.then){const i=this;return e.then(function(e){return i.finalize(e,t)})}t&&e.length&&this.query&&(e=ee(this.query,e,this.index.index,this.field,t));const i=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",i&&i(e),e},a(),ce.prototype.search=function(e,t,i,n){i||(!t&&c(e)?(i=e,e=""):c(t)&&(i=t,t=0));let r=[];var s=[];let a,u,h,d,f,p,g,m,v=0,y=!0;if(i){i.constructor===Array&&(i={index:i}),e=i.query||e,a=i.pluck,u=i.merge,d=i.boost,p=a||i.field||(p=i.index)&&(p.index?null:p);var b=this.tag&&i.tag;h=i.suggest,y=!1!==i.resolve,f=i.cache,g=y&&this.store&&i.highlight;var S=!!g||y&&this.store&&i.enrich;t=i.limit||t;var _=i.offset||0;if(t||(t=y?100:0),b&&(!this.db||!n)){b.constructor!==Array&&(b=[b]);var C=[];for(let e,t=0;t<b.length;t++)if(e=b[t],e.field&&e.tag){var w=e.tag;if(w.constructor===Array)for(var E=0;E<w.length;E++)C.push(e.field,w[E]);else C.push(e.field,w)}else{w=Object.keys(e);for(let t,i,n=0;n<w.length;n++)if(t=w[n],i=e[t],i.constructor===Array)for(E=0;E<i.length;E++)C.push(t,i[E]);else C.push(t,i)}if(b=C,!e){if(s=[],C.length)for(b=0;b<C.length;b+=2){if(this.db){if(!(n=this.index.get(C[b])))continue;s.push(n=n.db.tag(C[b+1],t,_,S))}else n=ae.call(this,C[b],C[b+1],t,_,S);r.push(y?{field:C[b],tag:C[b+1],result:n}:[n])}if(s.length){const e=this;return Promise.all(s).then(function(t){for(let e=0;e<t.length;e++)y?r[e].result=t[e]:r[e]=t[e];return y?r:new te(r.length>1?ne(r,1,0,0,h,d):r[0],e)})}return y?r:new te(r.length>1?ne(r,1,0,0,h,d):r[0],this)}}y||a||!(p=p||this.field)||(l(p)?a=p:(p.constructor===Array&&1===p.length&&(p=p[0]),a=p.field||p.index)),p&&p.constructor!==Array&&(p=[p])}p||(p=this.field),C=(this.worker||this.db)&&!n&&[];for(let a,c,u,d=0;d<p.length;d++){if(c=p[d],this.db&&this.tag&&!this.B[d])continue;let k;if(l(c)||(k=c,c=k.field,e=k.query||e,t=o(k.limit,t),_=o(k.offset,_),h=o(k.suggest,h),g=y&&this.store&&o(k.highlight,g),S=!!g||y&&this.store&&o(k.enrich,S),f=o(k.cache,f)),n)a=n[d];else{E=(w=k||i||{}).enrich;var T=this.index.get(c);if(b&&(this.db&&(w.tag=b,w.field=p,m=T.db.support_tag_search),!m&&E&&(w.enrich=!1),m||(w.limit=0,w.offset=0)),a=f?T.searchCache(e,b&&!m?0:t,w):T.search(e,b&&!m?0:t,w),b&&!m&&(w.limit=t,w.offset=_),E&&(w.enrich=E),C){C[d]=a;continue}}if(u=(a=a.result||a)&&a.length,b&&u){if(w=[],E=0,this.db&&n){if(!m)for(T=p.length;T<n.length;T++){let e=n[T];if(e&&e.length)E++,w.push(e);else if(!h)return y?r:new te(r,this)}}else for(let e,t,i=0;i<b.length;i+=2){if(e=this.tag.get(b[i]),!e){if(h)continue;return y?r:new te(r,this)}if(t=(e=e&&e.get(b[i+1]))&&e.length)E++,w.push(e);else if(!h)return y?r:new te(r,this)}if(E){if(a=se(a,w,t,_,y),u=a.length,!u&&!h)return y?a:new te(a,this);E--}}if(u)s[v]=c,r.push(a),v++;else if(1===p.length)return y?r:new te(r,this)}if(C){if(this.db&&b&&b.length&&!m)for(S=0;S<b.length;S+=2){if(!(s=this.index.get(b[S]))){if(h)continue;return y?r:new te(r,this)}C.push(s.db.tag(b[S+1],t,_,!1))}const n=this;return Promise.all(C).then(function(r){return i&&(i.resolve=y),r.length&&(r=n.search(e,t,i,r)),r})}if(!v)return y?r:new te(r,this);if(a&&(!S||!this.store))return r=r[0],y?r:new te(r,this);for(C=[],_=0;_<s.length;_++){if(b=r[_],S&&b.length&&void 0===b[0].doc&&(this.db?C.push(b=this.index.get(this.field[0]).db.enrich(b)):b=le.call(this,b)),a)return y?g?ee(e,b,this.index,a,g):b:new te(b,this);r[_]={field:s[_],result:b}}if(S&&this.db&&C.length){const t=this;return Promise.all(C).then(function(i){for(let e=0;e<i.length;e++)r[e].result=i[e];return g&&(r=ee(e,r,t.index,a,g)),u?oe(r):r})}return g&&(r=ee(e,r,this.index,a,g)),u?oe(r):r},(r=ce.prototype).mount=function(e){let t=this.field;if(this.tag)for(let e,n=0;n<this.F.length;n++){e=this.F[n];var i=void 0;this.index.set(e,i=new Oe({},this.reg)),t===this.field&&(t=t.slice(0)),t.push(e),i.tag=this.tag.get(e)}i=[];const n={db:e.db,type:e.type,fastupdate:e.fastupdate};for(let r,s,o=0;o<t.length;o++){n.field=s=t[o],r=this.index.get(s);const a=new e.constructor(e.id,n);a.id=e.id,i[o]=a.mount(r),r.document=!0,o?r.bypass=!0:r.store=this.store}const r=this;return this.db=Promise.all(i).then(function(){r.db=!0})},r.commit=async function(){const e=[];for(const t of this.index.values())e.push(t.commit());await Promise.all(e),this.reg.clear()},r.destroy=function(){const e=[];for(const t of this.index.values())e.push(t.destroy());return Promise.all(e)},r.append=function(e,t){return this.add(e,t,!0)},r.update=function(e,t){return this.remove(e).add(e,t)},r.remove=function(e){for(var t of(c(e)&&(e=u(e,this.key)),this.index.values()))t.remove(e,!0);if(this.reg.has(e)){if(this.tag&&!this.fastupdate)for(let i of this.tag.values())for(let n of i){t=n[0];const r=n[1],s=r.indexOf(e);s>-1&&(r.length>1?r.splice(s,1):i.delete(t))}this.store&&this.store.delete(e),this.reg.delete(e)}return this.cache&&this.cache.remove(e),this},r.clear=function(){const e=[];for(const t of this.index.values()){const i=t.clear();i.then&&e.push(i)}if(this.tag)for(const e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),e.length?Promise.all(e):this},r.contain=function(e){return this.db?this.index.get(this.field[0]).db.has(e):this.reg.has(e)},r.cleanup=function(){for(const e of this.index.values())e.cleanup();return this},r.get=function(e){return this.db?this.index.get(this.field[0]).db.enrich(e).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(e)||null},r.set=function(e,t){return"object"==typeof e&&(e=u(t=e,this.key)),this.store.set(e,t),this},r.searchCache=y,r.export=function(e,t,i=0,n=0){if(i<this.field.length){const r=this.field[i];if((t=this.index.get(r).export(e,r,i,n=1))&&t.then){const n=this;return t.then(function(){return n.export(e,r,i+1)})}return this.export(e,r,i+1)}let r,s;switch(n){case 0:r="reg",s=me(this.reg),t=null;break;case 1:r="tag",s=this.tag&&pe(this.tag,this.reg.size),t=null;break;case 2:r="doc",s=this.store&&de(this.store),t=null;break;default:return}return ye.call(this,e,t,r,s||null,i,n)},r.import=function(e,t){var i=e.split(".");"json"===i[i.length-1]&&i.pop();const n=i.length>2?i[0]:"";if(i=i.length>2?i[2]:i[1],this.worker&&n)return this.index.get(n).import(e);if(t){if("string"==typeof t&&(t=JSON.parse(t)),n)return this.index.get(n).import(i,t);switch(i){case"reg":this.fastupdate=!1,this.reg=ve(t,this.reg);for(let e,t=0;t<this.field.length;t++)e=this.index.get(this.field[t]),e.fastupdate=!1,e.reg=this.reg;if(this.worker){t=[];for(const i of this.index.values())t.push(i.import(e));return Promise.all(t)}break;case"tag":this.tag=ge(t,this.tag);break;case"doc":this.store=fe(t,this.store)}}},B(ce.prototype),Oe.prototype.remove=function(e,t){const i=this.reg.size&&(this.fastupdate?this.reg.get(e):this.reg.has(e));if(i){if(this.fastupdate){for(let t,n,r=0;r<i.length;r++)if((t=i[r])&&(n=t.length))if(t[n-1]===e)t.pop();else{const i=t.indexOf(e);i>=0&&t.splice(i,1)}}else Se(this.map,e),this.depth&&Se(this.ctx,e);t||this.reg.delete(e)}return this.db&&(this.commit_task.push({del:e}),this.M&&Pe(this)),this.cache&&this.cache.remove(e),this};const _e={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};function Ce(e,t,i,n,r,s,o){let l,c;if(!(l=t[i])||o&&!l[o]){if(o?((t=l||(t[i]=a()))[o]=1,c=e.ctx,(l=c.get(o))?c=l:c.set(o,c=e.keystore?new P(e.keystore):new Map)):(c=e.map,t[i]=1),(l=c.get(i))?c=l:c.set(i,c=l=[]),s)for(let i,s=0;s<l.length;s++)if((i=l[s])&&i.includes(r)){if(s<=n)return;i.splice(i.indexOf(r),1),e.fastupdate&&(t=e.reg.get(r))&&t.splice(t.indexOf(i),1);break}if(c=c[n]||(c[n]=[]),c.push(r),c.length===2**31-1){if(t=new O(c),e.fastupdate)for(let i of e.reg.values())i.includes(c)&&(i[i.indexOf(c)]=t);l[n]=c=t}e.fastupdate&&((n=e.reg.get(r))?n.push(c):e.reg.set(r,[c]))}}function we(e,t,i,n,r){return i&&e>1?t+(n||0)<=e?i+(r||0):(e-1)/(t+(n||0))*(i+(r||0))+1|0:0}function Ee(e,t,i,n,r,s,o){let a=e.length,l=e;if(a>1)l=ne(e,t,i,n,r,s,o);else if(1===a)return o?V.call(null,e[0],i,n):new te(e[0],this);return o?l:new te(l,this)}function Te(e,t,i,n,r,s,o){return e=Re(this,e,t,i,n,r,s,o),this.db?e.then(function(e){return r?e||[]:new te(e,this)}):e&&e.length?r?V.call(this,e,i,n):new te(e,this):r?[]:new te([],this)}function ke(e,t,i,n){let r=[];if(e&&e.length){if(e.length<=n)return void t.push(e);for(let t,i=0;i<n;i++)(t=e[i])&&(r[i]=t);if(r.length)return void t.push(r)}if(!i)return r}function Re(e,t,i,n,r,s,o,a){let l;return i&&(l=e.bidirectional&&t>i)&&(l=i,i=t,t=l),e.db?e.db.get(t,i,n,r,s,o,a):e=i?(e=e.ctx.get(i))&&e.get(t):e.map.get(t)}function Oe(e,t){if(!this||this.constructor!==Oe)return new Oe(e);if(e){var i=l(e)?e:e.preset;i&&(e=Object.assign({},_e[i],e))}else e={};const n=!0===(i=e.context)?{depth:1}:i||{},r=l(e.encoder)?k[e.encoder]:e.encode||e.encoder||{};this.encoder=r.encode?r:"object"==typeof r?new m(r):{encode:r},this.resolution=e.resolution||9,this.tokenize=i=(i=e.tokenize)&&"default"!==i&&"exact"!==i&&i||"strict",this.depth="strict"===i&&n.depth||0,this.bidirectional=!1!==n.bidirectional,this.fastupdate=!!e.fastupdate,this.score=e.score||null,(i=e.keystore||0)&&(this.keystore=i),this.map=i?new P(i):new Map,this.ctx=i?new P(i):new Map,this.reg=t||(this.fastupdate?i?new P(i):new Map:i?new A(i):new Set),this.N=n.resolution||3,this.rtl=r.rtl||e.rtl||!1,this.cache=(i=e.cache||null)&&new b(i),this.resolve=!1!==e.resolve,(i=e.db)&&(this.db=this.mount(i)),this.M=!1!==e.commit,this.commit_task=[],this.commit_timer=null,this.priority=e.priority||4}function Pe(e){e.commit_timer||(e.commit_timer=setTimeout(function(){e.commit_timer=null,e.db.commit(e)},1))}Oe.prototype.add=function(e,t,i,n){if(t&&(e||0===e)){if(!n&&!i&&this.reg.has(e))return this.update(e,t);n=this.depth;const u=(t=this.encoder.encode(t,!n)).length;if(u){const h=a(),d=a(),f=this.resolution;for(let a=0;a<u;a++){let p=t[this.rtl?u-1-a:a];var r=p.length;if(r&&(n||!d[p])){var s=this.score?this.score(t,p,a,null,0):we(f,u,a),o="";switch(this.tokenize){case"tolerant":if(Ce(this,d,p,s,e,i),r>2){for(let t,n,a,l,c=1;c<r-1;c++)t=p.charAt(c),n=p.charAt(c+1),a=p.substring(0,c)+n,l=p.substring(c+2),Ce(this,d,o=a+t+l,s,e,i),Ce(this,d,o=a+l,s,e,i);Ce(this,d,p.substring(0,p.length-1),s,e,i)}break;case"full":if(r>2){for(let n,c=0;c<r;c++)for(s=r;s>c;s--){o=p.substring(c,s),n=this.rtl?r-1-c:c;var l=this.score?this.score(t,p,a,o,n):we(f,u,a,r,n);Ce(this,d,o,l,e,i)}break}case"bidirectional":case"reverse":if(r>1){for(l=r-1;l>0;l--){o=p[this.rtl?r-1-l:l]+o;var c=this.score?this.score(t,p,a,o,l):we(f,u,a,r,l);Ce(this,d,o,c,e,i)}o=""}case"forward":if(r>1){for(l=0;l<r;l++)Ce(this,d,o+=p[this.rtl?r-1-l:l],s,e,i);break}default:if(Ce(this,d,p,s,e,i),n&&u>1&&a<u-1)for(r=this.N,o=p,s=Math.min(n+1,this.rtl?a+1:u-a),l=1;l<s;l++){p=t[this.rtl?u-1-a-l:a+l];Ce(this,h,(c=this.bidirectional&&p>o)?o:p,this.score?this.score(t,o,a,p,l-1):we(r+(u/2>r?0:1),u,a,s-1,l-1),e,i,c?p:o)}}}}this.fastupdate||this.reg.add(e)}}return this.db&&(this.commit_task.push(i?{ins:e}:{del:e}),this.M&&Pe(this)),this},Oe.prototype.search=function(e,t,i){if(i||(t||"object"!=typeof e?"object"==typeof t&&(i=t,t=0):(i=e,e="")),i&&i.cache)return i.cache=!1,e=this.searchCache(e,t,i),i.cache=!0,e;let n,r,s,o,l,c,u,h,d=[],f=0;i&&(e=i.query||e,t=i.limit||t,f=i.offset||0,r=i.context,s=i.suggest,h=(o=i.resolve)&&i.enrich,c=i.boost,u=i.resolution,l=this.db&&i.tag),void 0===o&&(o=this.resolve),r=this.depth&&!1!==r;let p=this.encoder.encode(e,!r);if(n=p.length,t=t||(o?100:0),1===n)return Te.call(this,p[0],"",t,f,o,h,l);if(2===n&&r&&!s)return Te.call(this,p[1],p[0],t,f,o,h,l);let g,m=a(),v=0;if(r&&(g=p[0],v=1),u||0===u||(u=g?this.N:this.resolution),this.db){if(this.db.search&&!1!==(i=this.db.search(this,p,t,f,s,o,h,l)))return i;const e=this;return async function(){for(let t,i;v<n;v++){if((i=p[v])&&!m[i]){if(m[i]=1,t=await Re(e,i,g,0,0,!1,!1),t=ke(t,d,s,u)){d=t;break}g&&(s&&t&&d.length||(g=i))}s&&g&&v===n-1&&!d.length&&(u=e.resolution,g="",v=-1,m=a())}return Ee(d,u,t,f,s,c,o)}()}for(let e,t;v<n;v++){if((t=p[v])&&!m[t]){if(m[t]=1,e=Re(this,t,g,0,0,!1,!1),e=ke(e,d,s,u)){d=e;break}g&&(s&&e&&d.length||(g=t))}s&&g&&v===n-1&&!d.length&&(u=this.resolution,g="",v=-1,m=a())}return Ee(d,u,t,f,s,c,o)},(r=Oe.prototype).mount=function(e){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),e.mount(this)},r.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)},r.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()},r.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this},r.append=function(e,t){return this.add(e,t,!0)},r.contain=function(e){return this.db?this.db.has(e):this.reg.has(e)},r.update=function(e,t){const i=this,n=this.remove(e);return n&&n.then?n.then(()=>i.add(e,t)):this.add(e,t)},r.cleanup=function(){return this.fastupdate?(Se(this.map),this.depth&&Se(this.ctx),this):this},r.searchCache=y,r.export=function(e,t,i=0,n=0){let r,s;switch(n){case 0:r="reg",s=me(this.reg);break;case 1:r="cfg",s=null;break;case 2:r="map",s=de(this.map,this.reg.size);break;case 3:r="ctx",s=pe(this.ctx,this.reg.size);break;default:return}return ye.call(this,e,t,r,s,i,n)},r.import=function(e,t){if(t)switch("string"==typeof t&&(t=JSON.parse(t)),e=e.split("."),"json"===e[e.length-1]&&e.pop(),3===e.length&&e.shift(),e=e.length>1?e[1]:e[0],e){case"reg":this.fastupdate=!1,this.reg=ve(t,this.reg);break;case"map":this.map=fe(t,this.map);break;case"ctx":this.ctx=ge(t,this.ctx)}},r.serialize=function(e=!0){let t="",i="",n="";if(this.reg.size){let e;for(var r of this.reg.keys())e||(e=typeof r),t+=(t?",":"")+("string"===e?'"'+r+'"':r);t="index.reg=new Set(["+t+"]);",i=be(this.map,e),i="index.map=new Map(["+i+"]);";for(const t of this.ctx.entries()){r=t[0];let i=be(t[1],e);i="new Map(["+i+"])",i='["'+r+'",'+i+"]",n+=(n?",":"")+i}n="index.ctx=new Map(["+n+"]);"}return e?"function inject(index){"+t+i+n+"}":t+i+n},B(Oe.prototype);const Ae="undefined"!=typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),xe=["map","ctx","tag","reg","cfg"],Ne=a();function Ie(e,t={}){if(!this||this.constructor!==Ie)return new Ie(e,t);"object"==typeof e&&(t=e,e=e.name),e||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(e?":"+e.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=t.field?t.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=t.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}function Me(e,t,i){const n=e.value;let r,s=0;for(let e,o=0;o<n.length;o++){if(e=i?n:n[o]){for(let i,s,a=0;a<t.length;a++)if(s=t[a],i=e.indexOf(s),i>=0){if(r=1,!(e.length>1)){n[o]=[];break}e.splice(i,1)}s+=e.length}if(i)break}s?r&&e.update(n):e.delete(),e.continue()}function Le(e,t){return new Promise((i,n)=>{e.onsuccess=e.oncomplete=function(){t&&t(this.result),t=null,i(this.result)},e.onerror=e.onblocked=n,e=null})}(r=Ie.prototype).mount=function(e){return e.index?e.mount(this):(e.db=this,this.open())},r.open=function(){if(this.db)return this.db;let e=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),Ne[e.id]||(Ne[e.id]=[]),Ne[e.id].push(e.field);const t=Ae.open(e.id,1);return t.onupgradeneeded=function(){const t=e.db=this.result;for(let i,n=0;n<xe.length;n++){i=xe[n];for(let n,r=0;r<Ne[e.id].length;r++)n=Ne[e.id][r],t.objectStoreNames.contains(i+("reg"!==i&&n?":"+n:""))||t.createObjectStore(i+("reg"!==i&&n?":"+n:""))}},e.db=Le(t,function(t){e.db=t,e.db.onversionchange=function(){e.close()}})},r.close=function(){this.db&&this.db.close(),this.db=null},r.destroy=function(){return Le(Ae.deleteDatabase(this.id))},r.clear=function(){const e=[];for(let t,i=0;i<xe.length;i++){t=xe[i];for(let i,n=0;n<Ne[this.id].length;n++)i=Ne[this.id][n],e.push(t+("reg"!==t&&i?":"+i:""))}const t=this.db.transaction(e,"readwrite");for(let i=0;i<e.length;i++)t.objectStore(e[i]).clear();return Le(t)},r.get=function(e,t,i=0,n=0,r=!0,s=!1){e=this.db.transaction((t?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((t?"ctx":"map")+(this.field?":"+this.field:"")).get(t?t+":"+e:e);const o=this;return Le(e).then(function(e){let t=[];if(!e||!e.length)return t;if(r){if(!i&&!n&&1===e.length)return e[0];for(let r,s=0;s<e.length;s++)if((r=e[s])&&r.length){if(n>=r.length){n-=r.length;continue}const e=i?n+Math.min(r.length-n,i):r.length;for(let i=n;i<e;i++)t.push(r[i]);if(n=0,t.length===i)break}return s?o.enrich(t):t}return e})},r.tag=function(e,t=0,i=0,n=!1){e=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(e);const r=this;return Le(e).then(function(e){return!e||!e.length||i>=e.length?[]:t||i?(e=e.slice(i,i+t),n?r.enrich(e):e):e})},r.enrich=function(e){"object"!=typeof e&&(e=[e]);const t=this.db.transaction("reg","readonly").objectStore("reg"),i=[];for(let n=0;n<e.length;n++)i[n]=Le(t.get(e[n]));return Promise.all(i).then(function(t){for(let i=0;i<t.length;i++)t[i]={id:e[i],doc:t[i]?JSON.parse(t[i]):null};return t})},r.has=function(e){return Le(e=this.db.transaction("reg","readonly").objectStore("reg").getKey(e)).then(function(e){return!!e})},r.search=null,r.info=function(){},r.transaction=function(e,t,i){e+="reg"!==e&&this.field?":"+this.field:"";let n=this.h[e+":"+t];if(n)return i.call(this,n);let r=this.db.transaction(e,t);this.h[e+":"+t]=n=r.objectStore(e);const s=i.call(this,n);return this.h[e+":"+t]=null,Le(r).finally(function(){return s})},r.commit=async function(e){let t=e.commit_task,i=[];e.commit_task=[];for(let e,n=0;n<t.length;n++)e=t[n],e.del&&i.push(e.del);i.length&&await this.remove(i),e.reg.size&&(await this.transaction("map","readwrite",function(t){for(const i of e.map){const e=i[0],n=i[1];n.length&&(t.get(e).onsuccess=function(){let i=this.result;var r;if(i&&i.length){const e=Math.max(i.length,n.length);for(let t,s,o=0;o<e;o++)if((s=n[o])&&s.length){if((t=i[o])&&t.length)for(r=0;r<s.length;r++)t.push(s[r]);else i[o]=s;r=1}}else i=n,r=1;r&&t.put(i,e)})}}),await this.transaction("ctx","readwrite",function(t){for(const i of e.ctx){const e=i[0],n=i[1];for(const i of n){const n=i[0],r=i[1];r.length&&(t.get(e+":"+n).onsuccess=function(){let i=this.result;var s;if(i&&i.length){const e=Math.max(i.length,r.length);for(let t,n,o=0;o<e;o++)if((n=r[o])&&n.length){if((t=i[o])&&t.length)for(s=0;s<n.length;s++)t.push(n[s]);else i[o]=n;s=1}}else i=r,s=1;s&&t.put(i,e+":"+n)})}}}),e.store?await this.transaction("reg","readwrite",function(t){for(const i of e.store){const e=i[0],n=i[1];t.put("object"==typeof n?JSON.stringify(n):1,e)}}):e.bypass||await this.transaction("reg","readwrite",function(t){for(const i of e.reg.keys())t.put(1,i)}),e.tag&&await this.transaction("tag","readwrite",function(t){for(const i of e.tag){const e=i[0],n=i[1];n.length&&(t.get(e).onsuccess=function(){let i=this.result;i=i&&i.length?i.concat(n):n,t.put(i,e)})}}),e.map.clear(),e.ctx.clear(),e.tag&&e.tag.clear(),e.store&&e.store.clear(),e.document||e.reg.clear())},r.remove=function(e){return"object"!=typeof e&&(e=[e]),Promise.all([this.transaction("map","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Me(t,e)}}),this.transaction("ctx","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Me(t,e)}}),this.transaction("tag","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Me(t,e,!0)}}),this.transaction("reg","readwrite",function(t){for(let i=0;i<e.length;i++)t.delete(e[i])})])};const De={Index:Oe,Charset:k,Encoder:m,Document:ce,Worker:q,Resolver:te,IndexedDB:Ie,Language:{}},je=void 0!==n?n:"undefined"!=typeof global?global:n;let Fe;(Fe=je.define)&&Fe.amd?Fe([],function(){return De}):"object"==typeof je.exports?je.exports=De:je.FlexSearch=De}(this||self)},2170(e,t,i){e.exports=i(9896).constants||i(9140)},2017(e,t,i){try{var n=i(9023);if("function"!=typeof n.inherits)throw"";e.exports=n.inherits}catch(t){e.exports=i(6698)}},6698(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}}},2880(e,t,i){let n,r={};r.__wbindgen_placeholder__=e.exports;const{TextDecoder:s,TextEncoder:o}=i(9023);let a=null;function l(){return null!==a&&0!==a.byteLength||(a=new Uint8Array(n.memory.buffer)),a}let c=new s("utf-8",{ignoreBOM:!0,fatal:!0});function u(e,t){return function(e,t){return c.decode(l().subarray(e,e+t))}(e>>>=0,t)}function h(e){const t=typeof e;if("number"==t||"boolean"==t||null==e)return`${e}`;if("string"==t)return`"${e}"`;if("symbol"==t){const t=e.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=e.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(e)){const t=e.length;let i="[";t>0&&(i+=h(e[0]));for(let n=1;n<t;n++)i+=", "+h(e[n]);return i+="]",i}const i=/\[object ([^\]]+)\]/.exec(toString.call(e));let n;if(!(i&&i.length>1))return toString.call(e);if(n=i[1],"Object"==n)try{return"Object("+JSON.stringify(e)+")"}catch(e){return"Object"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:n}c.decode();let d=0;const f=new o("utf-8"),p="function"==typeof f.encodeInto?function(e,t){return f.encodeInto(e,t)}:function(e,t){const i=f.encode(e);return t.set(i),{read:e.length,written:i.length}};function g(e,t,i){if(void 0===i){const i=f.encode(e),n=t(i.length,1)>>>0;return l().subarray(n,n+i.length).set(i),d=i.length,n}let n=e.length,r=t(n,1)>>>0;const s=l();let o=0;for(;o<n;o++){const t=e.charCodeAt(o);if(t>127)break;s[r+o]=t}if(o!==n){0!==o&&(e=e.slice(o)),r=i(r,n,n=o+3*e.length,1)>>>0;const t=l().subarray(r+o,r+n);o+=p(e,t).written,r=i(r,n,o,1)>>>0}return d=o,r}let m=null;function v(){return(null===m||!0===m.buffer.detached||void 0===m.buffer.detached&&m.buffer!==n.memory.buffer)&&(m=new DataView(n.memory.buffer)),m}function y(e){return null==e}function b(e,t){e>>>=0;const i=v(),r=[];for(let s=e;s<e+4*t;s+=4)r.push(n.__wbindgen_export_2.get(i.getUint32(s,!0)));return n.__externref_drop_slice(e,t),r}function S(e){const t=n.__wbindgen_export_2.get(e);return n.__externref_table_dealloc(e),t}e.exports.cut=function(e,t){const i=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),r=d,s=n.cut(i,r,y(t)?16777215:t?1:0);var o=b(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},e.exports.cut_all=function(e){const t=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),i=d,r=n.cut_all(t,i);var s=b(r[0],r[1]).slice();return n.__wbindgen_free(r[0],4*r[1],4),s},e.exports.cut_for_search=function(e,t){const i=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),r=d,s=n.cut_for_search(i,r,y(t)?16777215:t?1:0);var o=b(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},e.exports.tokenize=function(e,t,i){const r=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),s=d,o=g(t,n.__wbindgen_malloc,n.__wbindgen_realloc),a=d,l=n.tokenize(r,s,o,a,y(i)?16777215:i?1:0);if(l[3])throw S(l[2]);var c=b(l[0],l[1]).slice();return n.__wbindgen_free(l[0],4*l[1],4),c},e.exports.add_word=function(e,t,i){const r=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),s=d;var o=y(i)?0:g(i,n.__wbindgen_malloc,n.__wbindgen_realloc),a=d;return n.add_word(r,s,y(t)?4294967297:t>>>0,o,a)>>>0},e.exports.tag=function(e,t){const i=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),r=d,s=n.tag(i,r,y(t)?16777215:t?1:0);var o=b(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},e.exports.with_dict=function(e){const t=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),i=d,r=n.with_dict(t,i);if(r[1])throw S(r[0])},e.exports.__wbg_Error_0497d5bdba9362e5=function(e,t){return Error(u(e,t))},e.exports.__wbg_new_07b483f72211fd66=function(){return new Object},e.exports.__wbg_set_3f1d0b984ed272ed=function(e,t,i){e[t]=i},e.exports.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},e.exports.__wbindgen_debug_string=function(e,t){const i=g(h(t),n.__wbindgen_malloc,n.__wbindgen_realloc),r=d;v().setInt32(e+4,r,!0),v().setInt32(e+0,i,!0)},e.exports.__wbindgen_init_externref_table=function(){const e=n.__wbindgen_export_2,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},e.exports.__wbindgen_number_new=function(e){return e},e.exports.__wbindgen_string_new=function(e,t){return u(e,t)},e.exports.__wbindgen_throw=function(e,t){throw new Error(u(e,t))};const _=i(6928).join(__dirname,"jieba_rs_wasm_bg.wasm"),C=i(9896).readFileSync(_),w=new WebAssembly.Module(C),E=new WebAssembly.Instance(w,r);n=E.exports,e.exports.__wasm=n,n.__wbindgen_start()},2028(e){var t="[object Symbol]",i=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,n=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,r="\\ud800-\\udfff",s="\\u0300-\\u036f\\ufe20-\\ufe23",o="\\u20d0-\\u20f0",a="\\u2700-\\u27bf",l="a-z\\xdf-\\xf6\\xf8-\\xff",c="A-Z\\xc0-\\xd6\\xd8-\\xde",u="\\ufe0e\\ufe0f",h="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",d="['’]",f="["+r+"]",p="["+h+"]",g="["+s+o+"]",m="\\d+",v="["+a+"]",y="["+l+"]",b="[^"+r+h+m+a+l+c+"]",S="\\ud83c[\\udffb-\\udfff]",_="[^"+r+"]",C="(?:\\ud83c[\\udde6-\\uddff]){2}",w="[\\ud800-\\udbff][\\udc00-\\udfff]",E="["+c+"]",T="\\u200d",k="(?:"+y+"|"+b+")",R="(?:"+E+"|"+b+")",O="(?:['’](?:d|ll|m|re|s|t|ve))?",P="(?:['’](?:D|LL|M|RE|S|T|VE))?",A="(?:"+g+"|"+S+")"+"?",x="["+u+"]?",N=x+A+("(?:"+T+"(?:"+[_,C,w].join("|")+")"+x+A+")*"),I="(?:"+[v,C,w].join("|")+")"+N,M="(?:"+[_+g+"?",g,C,w,f].join("|")+")",L=RegExp(d,"g"),D=RegExp(g,"g"),j=RegExp(S+"(?="+S+")|"+M+N,"g"),F=RegExp([E+"?"+y+"+"+O+"(?="+[p,E,"$"].join("|")+")",R+"+"+P+"(?="+[p,E+k,"$"].join("|")+")",E+"?"+k+"+"+O,E+"+"+P,m,I].join("|"),"g"),B=RegExp("["+T+r+s+o+u+"]"),U=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,z="object"==typeof global&&global&&global.Object===Object&&global,H="object"==typeof self&&self&&self.Object===Object&&self,q=z||H||Function("return this")();var W,G=(W={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"ss"},function(e){return null==W?void 0:W[e]});function $(e){return B.test(e)}function V(e){return $(e)?function(e){return e.match(j)||[]}(e):function(e){return e.split("")}(e)}var Y=Object.prototype.toString,K=q.Symbol,J=K?K.prototype:void 0,X=J?J.toString:void 0;function Q(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&Y.call(e)==t}(e))return X?X.call(e):"";var i=e+"";return"0"==i&&1/e==-1/0?"-0":i}function Z(e,t,i){var n=e.length;return i=void 0===i?n:i,!t&&i>=n?e:function(e,t,i){var n=-1,r=e.length;t<0&&(t=-t>r?0:r+t),(i=i>r?r:i)<0&&(i+=r),r=t>i?0:i-t>>>0,t>>>=0;for(var s=Array(r);++n<r;)s[n]=e[n+t];return s}(e,t,i)}function ee(e){return null==e?"":Q(e)}var te,ie=(te=function(e,t,i){return t=t.toLowerCase(),e+(i?re(ee(t).toLowerCase()):t)},function(e){return function(e,t,i,n){var r=-1,s=e?e.length:0;for(n&&s&&(i=e[++r]);++r<s;)i=t(i,e[r],r,e);return i}(function(e,t,n){return e=ee(e),void 0===(t=n?void 0:t)?function(e){return U.test(e)}(e)?function(e){return e.match(F)||[]}(e):function(e){return e.match(i)||[]}(e):e.match(t)||[]}(function(e){return(e=ee(e))&&e.replace(n,G).replace(D,"")}(e).replace(L,"")),te,"")});var ne,re=(ne="toUpperCase",function(e){var t=$(e=ee(e))?V(e):void 0,i=t?t[0]:e.charAt(0),n=t?Z(t,1).join(""):e.slice(1);return i[ne]()+n});e.exports=ie},9505(e,t,i){var n=i(6928),r=i(9896),s=parseInt("0777",8);function o(e,t,i,a){"function"==typeof t?(i=t,t={}):t&&"object"==typeof t||(t={mode:t});var l=t.mode,c=t.fs||r;void 0===l&&(l=s&~process.umask()),a||(a=null);var u=i||function(){};e=n.resolve(e),c.mkdir(e,l,function(i){if(!i)return u(null,a=a||e);if("ENOENT"===i.code)o(n.dirname(e),t,function(i,n){i?u(i,n):o(e,t,u,n)});else c.stat(e,function(e,t){e||!t.isDirectory()?u(i,a):u(null,a)})})}e.exports=o.mkdirp=o.mkdirP=o,o.sync=function e(t,i,o){i&&"object"==typeof i||(i={mode:i});var a=i.mode,l=i.fs||r;void 0===a&&(a=s&~process.umask()),o||(o=null),t=n.resolve(t);try{l.mkdirSync(t,a),o=o||t}catch(r){if("ENOENT"===r.code)o=e(n.dirname(t),i,o),e(t,i,o);else{var c;try{c=l.statSync(t)}catch(e){throw r}if(!c.isDirectory())throw r}}return o}},3519(e,t,i){var n=i(6587);function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function s(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},i=e.name||"Function wrapped with `once`";return t.onceError=i+" shouldn't be called more than once",t.called=!1,t}e.exports=n(r),e.exports.strict=n(s),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return s(this)},configurable:!0})})},5407(e,t,i){"use strict";var n=i(2549);e.exports=t=n.descriptor=n.Root.fromJSON(i(3951)).lookup(".google.protobuf");var r=n.Namespace,s=n.Root,o=n.Enum,a=n.Type,l=n.Field,c=n.MapField,u=n.OneOf,h=n.Service,d=n.Method;function f(e,i,n){var c=t.FileDescriptorProto.create({name:e.filename||(e.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});!function(e,i){if(!e)return;if("proto2"===e||"proto3"===e)i.syntax=e;else{if(i.syntax="editions","2023"!==e)throw new Error("Unsupported edition "+e);i.edition=t.Edition.EDITION_2023}}(n,c),e instanceof s||(c.package=e.fullName.substring(1));for(var u,d=0;d<e.nestedArray.length;++d)(u=e._nestedArray[d])instanceof a?c.messageType.push(u.toDescriptor(n)):u instanceof o?c.enumType.push(u.toDescriptor()):u instanceof l?c.extension.push(u.toDescriptor(n)):u instanceof h?c.service.push(u.toDescriptor()):u instanceof r&&f(u,i,n);c.options=E(e.options,t.FileOptions),c.messageType.length+c.enumType.length+c.extension.length+c.service.length&&i.push(c)}s.fromDescriptor=function(e){"number"==typeof e.length&&(e=t.FileDescriptorSet.decode(e));var i=new s;if(e.file)for(var n,r,c,u=0;u<e.file.length;++u){r=i,(n=e.file[u]).package&&n.package.length&&(r=i.define(n.package));var d=R(n);if(n.name&&n.name.length&&i.files.push(r.filename=n.name),n.messageType)for(c=0;c<n.messageType.length;++c)r.add(a.fromDescriptor(n.messageType[c],d));if(n.enumType)for(c=0;c<n.enumType.length;++c)r.add(o.fromDescriptor(n.enumType[c],d));if(n.extension)for(c=0;c<n.extension.length;++c)r.add(l.fromDescriptor(n.extension[c],d));if(n.service)for(c=0;c<n.service.length;++c)r.add(h.fromDescriptor(n.service[c],d));var f=C(n.options,t.FileOptions);if(f){var p=Object.keys(f);for(c=0;c<p.length;++c)r.setOption(p[c],f[p[c]])}}return i.resolveAll()},s.prototype.toDescriptor=function(e){var i=t.FileDescriptorSet.create();return f(this,i.file,e),i};var p=0;a.fromDescriptor=function(e,i,n){"number"==typeof e.length&&(e=t.DescriptorProto.decode(e));var r,s=new a(e.name.length?e.name:"Type"+p++,C(e.options,t.MessageOptions));if(n||(s._edition=i),e.oneofDecl)for(r=0;r<e.oneofDecl.length;++r)s.add(u.fromDescriptor(e.oneofDecl[r]));if(e.field)for(r=0;r<e.field.length;++r){var c=l.fromDescriptor(e.field[r],i,!0);s.add(c),e.field[r].hasOwnProperty("oneofIndex")&&s.oneofsArray[e.field[r].oneofIndex].add(c)}if(e.extension)for(r=0;r<e.extension.length;++r)s.add(l.fromDescriptor(e.extension[r],i,!0));if(e.nestedType)for(r=0;r<e.nestedType.length;++r)s.add(a.fromDescriptor(e.nestedType[r],i,!0)),e.nestedType[r].options&&e.nestedType[r].options.mapEntry&&s.setOption("map_entry",!0);if(e.enumType)for(r=0;r<e.enumType.length;++r)s.add(o.fromDescriptor(e.enumType[r],i,!0));if(e.extensionRange&&e.extensionRange.length)for(s.extensions=[],r=0;r<e.extensionRange.length;++r)s.extensions.push([e.extensionRange[r].start,e.extensionRange[r].end]);if(e.reservedRange&&e.reservedRange.length||e.reservedName&&e.reservedName.length){if(s.reserved=[],e.reservedRange)for(r=0;r<e.reservedRange.length;++r)s.reserved.push([e.reservedRange[r].start,e.reservedRange[r].end]);if(e.reservedName)for(r=0;r<e.reservedName.length;++r)s.reserved.push(e.reservedName[r])}return s},a.prototype.toDescriptor=function(e){var i,n=t.DescriptorProto.create({name:this.name});for(i=0;i<this.fieldsArray.length;++i){var r;if(n.field.push(r=this._fieldsArray[i].toDescriptor(e)),this._fieldsArray[i]instanceof c){var s=S(this._fieldsArray[i].keyType,this._fieldsArray[i].resolvedKeyType,!1),u=S(this._fieldsArray[i].type,this._fieldsArray[i].resolvedType,!1),h=11===u||14===u?this._fieldsArray[i].resolvedType&&T(this.parent,this._fieldsArray[i].resolvedType)||this._fieldsArray[i].type:void 0;n.nestedType.push(t.DescriptorProto.create({name:r.typeName,field:[t.FieldDescriptorProto.create({name:"key",number:1,label:1,type:s}),t.FieldDescriptorProto.create({name:"value",number:2,label:1,type:u,typeName:h})],options:t.MessageOptions.create({mapEntry:!0})}))}}for(i=0;i<this.oneofsArray.length;++i)n.oneofDecl.push(this._oneofsArray[i].toDescriptor());for(i=0;i<this.nestedArray.length;++i)this._nestedArray[i]instanceof l?n.field.push(this._nestedArray[i].toDescriptor(e)):this._nestedArray[i]instanceof a?n.nestedType.push(this._nestedArray[i].toDescriptor(e)):this._nestedArray[i]instanceof o&&n.enumType.push(this._nestedArray[i].toDescriptor());if(this.extensions)for(i=0;i<this.extensions.length;++i)n.extensionRange.push(t.DescriptorProto.ExtensionRange.create({start:this.extensions[i][0],end:this.extensions[i][1]}));if(this.reserved)for(i=0;i<this.reserved.length;++i)"string"==typeof this.reserved[i]?n.reservedName.push(this.reserved[i]):n.reservedRange.push(t.DescriptorProto.ReservedRange.create({start:this.reserved[i][0],end:this.reserved[i][1]}));return n.options=E(this.options,t.MessageOptions),n};var g=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;l.fromDescriptor=function(e,i,n){if("number"==typeof e.length&&(e=t.DescriptorProto.decode(e)),"number"!=typeof e.number)throw Error("missing field id");var r,s;switch(r=e.typeName&&e.typeName.length?e.typeName:function(e){switch(e){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+e)}(e.type),e.label){case 1:s=void 0;break;case 2:s="required";break;case 3:s="repeated";break;default:throw Error("illegal label: "+e.label)}var o=e.extendee;void 0!==e.extendee&&(o=o.length?o:void 0);var a=new l(e.name.length?e.name:"field"+e.number,e.number,r,s,o);if(n||(a._edition=i),a.options=C(e.options,t.FieldOptions),e.proto3_optional&&(a.options.proto3_optional=!0),e.defaultValue&&e.defaultValue.length){var c=e.defaultValue;switch(c){case"true":case"TRUE":c=!0;break;case"false":case"FALSE":c=!1;break;default:g.exec(c)&&(c=parseInt(c))}a.setOption("default",c)}return function(e){switch(e){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}(e.type)&&("proto3"===i?e.options&&!e.options.packed&&a.setOption("packed",!1):i&&"proto2"!==i||!e.options||!e.options.packed||a.setOption("packed",!0)),a},l.prototype.toDescriptor=function(e){var i=t.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)i.type=11,i.typeName=n.util.ucFirst(this.name),i.label=3;else{switch(i.type=S(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:i.typeName=this.resolvedType?T(this.parent,this.resolvedType):this.type}"repeated"===this.rule?i.label=3:this.required&&"proto2"===e?i.label=2:i.label=1}if(i.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf&&(i.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof");return this.options&&(i.options=E(this.options,t.FieldOptions),null!=this.options.default&&(i.defaultValue=String(this.options.default)),this.options.proto3_optional&&(i.proto3_optional=!0)),"proto3"===e?this.packed||((i.options||(i.options=t.FieldOptions.create())).packed=!1):e&&"proto2"!==e||!this.packed||((i.options||(i.options=t.FieldOptions.create())).packed=!0),i};var m=0;o.fromDescriptor=function(e,i,n){"number"==typeof e.length&&(e=t.EnumDescriptorProto.decode(e));var r={};if(e.value)for(var s=0;s<e.value.length;++s){var a=e.value[s].name,l=e.value[s].number||0;r[a&&a.length?a:"NAME"+l]=l}var c=new o(e.name&&e.name.length?e.name:"Enum"+m++,r,C(e.options,t.EnumOptions));return n||(c._edition=i),c},o.prototype.toDescriptor=function(){for(var e=[],i=0,n=Object.keys(this.values);i<n.length;++i)e.push(t.EnumValueDescriptorProto.create({name:n[i],number:this.values[n[i]]}));return t.EnumDescriptorProto.create({name:this.name,value:e,options:E(this.options,t.EnumOptions)})};var v=0;u.fromDescriptor=function(e){return"number"==typeof e.length&&(e=t.OneofDescriptorProto.decode(e)),new u(e.name&&e.name.length?e.name:"oneof"+v++)},u.prototype.toDescriptor=function(){return t.OneofDescriptorProto.create({name:this.name})};var y=0;h.fromDescriptor=function(e,i,n){"number"==typeof e.length&&(e=t.ServiceDescriptorProto.decode(e));var r=new h(e.name&&e.name.length?e.name:"Service"+y++,C(e.options,t.ServiceOptions));if(n||(r._edition=i),e.method)for(var s=0;s<e.method.length;++s)r.add(d.fromDescriptor(e.method[s]));return r},h.prototype.toDescriptor=function(){for(var e=[],i=0;i<this.methodsArray.length;++i)e.push(this._methodsArray[i].toDescriptor());return t.ServiceDescriptorProto.create({name:this.name,method:e,options:E(this.options,t.ServiceOptions)})};var b=0;function S(e,t,i){switch(e){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(t instanceof o)return 14;if(t instanceof a)return i?10:11;throw Error("illegal type: "+e)}function _(e,t){for(var i,n,r={},s=0;s<t.fieldsArray.length;++s)if("uninterpretedOption"!==(n=(i=t._fieldsArray[s]).name)&&Object.prototype.hasOwnProperty.call(e,n)){var l=k(n);i.resolvedType instanceof a?r[l]=_(e[n],i.resolvedType):i.resolvedType instanceof o?r[l]=i.resolvedType.valuesById[e[n]]:r[l]=e[n]}return r}function C(e,t){if(e)return _(t.toObject(e),t)}function w(e,t){for(var i={},r=Object.keys(e),s=0;s<r.length;++s){var o=r[s],l=n.util.camelCase(o);if(Object.prototype.hasOwnProperty.call(t.fields,l)){var c=t.fields[l];c.resolvedType instanceof a?i[l]=w(e[o],c.resolvedType):i[l]=e[o],c.repeated&&!Array.isArray(i[l])&&(i[l]=[i[l]])}}return i}function E(e,t){if(e)return t.fromObject(w(e,t))}function T(e,t){var i=e.fullName.split("."),n=t.fullName.split("."),o=0,a=0,l=n.length-1;if(!(e instanceof s)&&t instanceof r)for(;o<i.length&&a<l&&i[o]===n[a];){var c=t.lookup(i[o++],!0);if(null!==c&&c!==t)break;++a}else for(;o<i.length&&a<l&&i[o]===n[a];++o,++a);return n.slice(a).join(".")}function k(e){return e.substring(0,1)+e.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,t){return"_"+t.toLowerCase()})}function R(e){if("editions"===e.syntax){if(e.edition===t.Edition.EDITION_2023)return"2023";throw new Error("Unsupported edition "+e.edition)}return"proto3"===e.syntax?"proto3":"proto2"}d.fromDescriptor=function(e){return"number"==typeof e.length&&(e=t.MethodDescriptorProto.decode(e)),new d(e.name&&e.name.length?e.name:"Method"+b++,"rpc",e.inputType,e.outputType,Boolean(e.clientStreaming),Boolean(e.serverStreaming),C(e.options,t.MethodOptions))},d.prototype.toDescriptor=function(){return t.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:E(this.options,t.MethodOptions)})}},2549(e,t,i){"use strict";e.exports=i(9100)},5095(e){"use strict";e.exports=n;var t,i=/\/|\./;function n(e,t){i.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:t}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},744(e,t,i){"use strict";var n=t,r=i(5643),s=i(3262);function o(e,t,i,n){var s=!1;if(t.resolvedType)if(t.resolvedType instanceof r){e("switch(d%s){",n);for(var o=t.resolvedType.values,a=Object.keys(o),l=0;l<a.length;++l)o[a[l]]!==t.typeDefault||s||(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),t.repeated||e("break"),s=!0),e("case%j:",a[l])("case %i:",o[a[l]])("m%s=%j",n,o[a[l]])("break");e("}")}else e('if(typeof d%s!=="object")',n)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",n,i,n);else{var c=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":c=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,c)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,c?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function a(e,t,i,n){if(t.resolvedType)t.resolvedType instanceof r?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,i,n,n,i,n,n):e("d%s=types[%i].toObject(m%s,o)",n,i,n);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,s?"true":"",n);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}n.fromObject=function(e){var t=e.fieldsArray,i=s.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return i("return new this.ctor");i("var m=new this.ctor");for(var n=0;n<t.length;++n){var a=t[n].resolve(),l=s.safeProp(a.name);a.map?(i("if(d%s){",l)('if(typeof d%s!=="object")',l)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",l)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",l),o(i,a,n,l+"[ks[i]]")("}")("}")):a.repeated?(i("if(d%s){",l)("if(!Array.isArray(d%s))",l)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",l)("for(var i=0;i<d%s.length;++i){",l),o(i,a,n,l+"[i]")("}")("}")):(a.resolvedType instanceof r||i("if(d%s!=null){",l),o(i,a,n,l),a.resolvedType instanceof r||i("}"))}return i("return m")},n.toObject=function(e){var t=e.fieldsArray.slice().sort(s.compareFieldsById);if(!t.length)return s.codegen()("return {}");for(var i=s.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),n=[],o=[],l=[],c=0;c<t.length;++c)t[c].partOf||(t[c].resolve().repeated?n:t[c].map?o:l).push(t[c]);if(n.length){for(i("if(o.arrays||o.defaults){"),c=0;c<n.length;++c)i("d%s=[]",s.safeProp(n[c].name));i("}")}if(o.length){for(i("if(o.objects||o.defaults){"),c=0;c<o.length;++c)i("d%s={}",s.safeProp(o[c].name));i("}")}if(l.length){for(i("if(o.defaults){"),c=0;c<l.length;++c){var u=l[c],h=s.safeProp(u.name);if(u.resolvedType instanceof r)i("d%s=o.enums===String?%j:%j",h,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)i("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",h)("}else")("d%s=o.longs===String?%j:%i",h,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var d="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";i("if(o.bytes===String)d%s=%j",h,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",h,d)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",h,h)("}")}else i("d%s=%j",h,u.typeDefault)}i("}")}var f=!1;for(c=0;c<t.length;++c){u=t[c];var p=e._fieldsArray.indexOf(u);h=s.safeProp(u.name);u.map?(f||(f=!0,i("var ks2")),i("if(m%s&&(ks2=Object.keys(m%s)).length){",h,h)("d%s={}",h)("for(var j=0;j<ks2.length;++j){"),a(i,u,p,h+"[ks2[j]]")("}")):u.repeated?(i("if(m%s&&m%s.length){",h,h)("d%s=[]",h)("for(var j=0;j<m%s.length;++j){",h),a(i,u,p,h+"[j]")("}")):(i("if(m%s!=null&&m.hasOwnProperty(%j)){",h,u.name),a(i,u,p,h),u.partOf&&i("if(o.oneofs)")("d%s=%j",s.safeProp(u.partOf.name),u.name)),i("}")}return i("return d")}},7728(e,t,i){"use strict";e.exports=function(e){for(var t=s.codegen(["r","l","e"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter(function(e){return e.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),i=0;i<e.fieldsArray.length;++i){var a=e._fieldsArray[i].resolve(),l=a.resolvedType instanceof n?"int32":a.type,c="m"+s.safeProp(a.name);t("case %i: {",a.id),a.map?(t("if(%s===util.emptyObject)",c)("%s={}",c)("var c2 = r.uint32()+r.pos"),void 0!==r.defaults[a.keyType]?t("k=%j",r.defaults[a.keyType]):t("k=null"),void 0!==r.defaults[l]?t("value=%j",r.defaults[l]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===r.basic[l]?t("value=types[%i].decode(r,r.uint32())",i):t("value=r.%s()",l),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==r.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',c):t("%s[k]=value",c)):a.repeated?(t("if(!(%s&&%s.length))",c,c)("%s=[]",c),void 0!==r.packed[l]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",c,l)("}else"),void 0===r.basic[l]?t(a.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4)))":"%s.push(types[%i].decode(r,r.uint32()))",c,i):t("%s.push(r.%s())",c,l)):void 0===r.basic[l]?t(a.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4))":"%s=types[%i].decode(r,r.uint32())",c,i):t("%s=r.%s()",c,l),t("break")("}")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),i=0;i<e._fieldsArray.length;++i){var u=e._fieldsArray[i];u.required&&t("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",o(u))}return t("return m")};var n=i(5643),r=i(361),s=i(3262);function o(e){return"missing required '"+e.name+"'"}},1080(e,t,i){"use strict";e.exports=function(e){for(var t,i=s.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(s.compareFieldsById),l=0;l<a.length;++l){var c=a[l].resolve(),u=e._fieldsArray.indexOf(c),h=c.resolvedType instanceof n?"int32":c.type,d=r.basic[h];t="m"+s.safeProp(c.name),c.map?(i("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,c.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(c.id<<3|2)>>>0,8|r.mapKey[c.keyType],c.keyType),void 0===d?i("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):i(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,h,t),i("}")("}")):c.repeated?(i("if(%s!=null&&%s.length){",t,t),c.packed&&void 0!==r.packed[h]?i("w.uint32(%i).fork()",(c.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",h,t)("w.ldelim()"):(i("for(var i=0;i<%s.length;++i)",t),void 0===d?o(i,c,u,t+"[i]"):i("w.uint32(%i).%s(%s[i])",(c.id<<3|d)>>>0,h,t)),i("}")):(c.optional&&i("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,c.name),void 0===d?o(i,c,u,t):i("w.uint32(%i).%s(%s)",(c.id<<3|d)>>>0,h,t))}return i("return w")};var n=i(5643),r=i(361),s=i(3262);function o(e,t,i,n){return t.delimited?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",i,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",i,n,(t.id<<3|2)>>>0)}},5643(e,t,i){"use strict";e.exports=o;var n=i(7209);((o.prototype=Object.create(n.prototype)).constructor=o).className="Enum";var r=i(1304),s=i(3262);function o(e,t,i,r,s,o){if(n.call(this,e,i),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=r,this.comments=s||{},this.valuesOptions=o,this._valuesFeatures={},this.reserved=void 0,t)for(var a=Object.keys(t),l=0;l<a.length;++l)"number"==typeof t[a[l]]&&(this.valuesById[this.values[a[l]]=t[a[l]]]=a[l])}o.prototype._resolveFeatures=function(e){return e=this._edition||e,n.prototype._resolveFeatures.call(this,e),Object.keys(this.values).forEach(e=>{var t=Object.assign({},this._features);this._valuesFeatures[e]=Object.assign(t,this.valuesOptions&&this.valuesOptions[e]&&this.valuesOptions[e].features)}),this},o.fromJSON=function(e,t){var i=new o(e,t.values,t.options,t.comment,t.comments);return i.reserved=t.reserved,t.edition&&(i._edition=t.edition),i._defaultEdition="proto3",i},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},o.prototype.add=function(e,t,i,n){if(!s.isString(e))throw TypeError("name must be a string");if(!s.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return n&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=n||null),this.comments[e]=i||null,this},o.prototype.remove=function(e){if(!s.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this},o.prototype.isReservedId=function(e){return r.isReservedId(this.reserved,e)},o.prototype.isReservedName=function(e){return r.isReservedName(this.reserved,e)}},1344(e,t,i){"use strict";e.exports=c;var n=i(7209);((c.prototype=Object.create(n.prototype)).constructor=c).className="Field";var r,s=i(5643),o=i(361),a=i(3262),l=/^required|optional|repeated$/;function c(e,t,i,r,s,c,u){if(a.isObject(r)?(u=s,c=r,r=s=void 0):a.isObject(s)&&(u=c,c=s,s=void 0),n.call(this,e,c),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(i))throw TypeError("type must be a string");if(void 0!==r&&!l.test(r=r.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!a.isString(s))throw TypeError("extend must be a string");"proto3_optional"===r&&(r="optional"),this.rule=r&&"optional"!==r?r:void 0,this.type=i,this.id=t,this.extend=s||void 0,this.repeated="repeated"===r,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==o.long[i],this.bytes="bytes"===i,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=u}c.fromJSON=function(e,t){var i=new c(e,t.id,t.type,t.rule,t.extend,t.options,t.comment);return t.edition&&(i._edition=t.edition),i._defaultEdition="proto3",i},Object.defineProperty(c.prototype,"required",{get:function(){return"LEGACY_REQUIRED"===this._features.field_presence}}),Object.defineProperty(c.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(c.prototype,"delimited",{get:function(){return this.resolvedType instanceof r&&"DELIMITED"===this._features.message_encoding}}),Object.defineProperty(c.prototype,"packed",{get:function(){return"PACKED"===this._features.repeated_field_encoding}}),Object.defineProperty(c.prototype,"hasPresence",{get:function(){return!this.repeated&&!this.map&&(this.partOf||this.declaringField||this.extensionField||"IMPLICIT"!==this._features.field_presence)}}),c.prototype.setOption=function(e,t,i){return n.prototype.setOption.call(this,e,t,i)},c.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["edition",this._editionToJSON(),"rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},c.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof r?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof s&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof s||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof r&&(this.parent.ctor.prototype[this.name]=this.defaultValue),n.prototype.resolve.call(this)},c.prototype._inferLegacyProtoFeatures=function(e){if("proto2"!==e&&"proto3"!==e)return{};var t={};if("required"===this.rule&&(t.field_presence="LEGACY_REQUIRED"),this.parent&&void 0===o.defaults[this.type]){var i=this.parent.get(this.type.split(".").pop());i&&i instanceof r&&i.group&&(t.message_encoding="DELIMITED")}return!0===this.getOption("packed")?t.repeated_field_encoding="PACKED":!1===this.getOption("packed")&&(t.repeated_field_encoding="EXPANDED"),t},c.prototype._resolveFeatures=function(e){return n.prototype._resolveFeatures.call(this,this._edition||e)},c.d=function(e,t,i,n){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(r,s){a.decorateType(r.constructor).add(new c(s,e,t,i,{default:n}))}},c._configure=function(e){r=e}},5325(e,t,i){"use strict";var n=e.exports=i(4394);n.build="light",n.load=function(e,t,i){return"function"==typeof t?(i=t,t=new n.Root):t||(t=new n.Root),t.load(e,i)},n.loadSync=function(e,t){return t||(t=new n.Root),t.loadSync(e)},n.encoder=i(1080),n.decoder=i(7728),n.verifier=i(420),n.converter=i(744),n.ReflectionObject=i(7209),n.Namespace=i(1304),n.Root=i(5330),n.Enum=i(5643),n.Type=i(7882),n.Field=i(1344),n.OneOf=i(1457),n.MapField=i(8252),n.Service=i(9687),n.Method=i(8811),n.Message=i(2551),n.wrappers=i(6434),n.types=i(361),n.util=i(3262),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},4394(e,t,i){"use strict";var n=t;function r(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=i(3449),n.BufferWriter=i(818),n.Reader=i(6237),n.BufferReader=i(3158),n.util=i(3610),n.rpc=i(5047),n.roots=i(4529),n.configure=r,r()},9100(e,t,i){"use strict";var n=e.exports=i(5325);n.build="full",n.tokenize=i(527),n.parse=i(4863),n.common=i(5095),n.Root._configure(n.Type,n.parse,n.common)},8252(e,t,i){"use strict";e.exports=o;var n=i(1344);((o.prototype=Object.create(n.prototype)).constructor=o).className="MapField";var r=i(361),s=i(3262);function o(e,t,i,r,o,a){if(n.call(this,e,t,r,void 0,void 0,o,a),!s.isString(i))throw TypeError("keyType must be a string");this.keyType=i,this.resolvedKeyType=null,this.map=!0}o.fromJSON=function(e,t){return new o(e,t.id,t.keyType,t.type,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if(void 0===r.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},o.d=function(e,t,i){return"function"==typeof i?i=s.decorateType(i).name:i&&"object"==typeof i&&(i=s.decorateEnum(i).name),function(n,r){s.decorateType(n.constructor).add(new o(r,e,t,i))}}},2551(e,t,i){"use strict";e.exports=r;var n=i(3610);function r(e){if(e)for(var t=Object.keys(e),i=0;i<t.length;++i)this[t[i]]=e[t[i]]}r.create=function(e){return this.$type.create(e)},r.encode=function(e,t){return this.$type.encode(e,t)},r.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},r.decode=function(e){return this.$type.decode(e)},r.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},r.verify=function(e){return this.$type.verify(e)},r.fromObject=function(e){return this.$type.fromObject(e)},r.toObject=function(e,t){return this.$type.toObject(e,t)},r.prototype.toJSON=function(){return this.$type.toObject(this,n.toJSONOptions)}},8811(e,t,i){"use strict";e.exports=s;var n=i(7209);((s.prototype=Object.create(n.prototype)).constructor=s).className="Method";var r=i(3262);function s(e,t,i,s,o,a,l,c,u){if(r.isObject(o)?(l=o,o=a=void 0):r.isObject(a)&&(l=a,a=void 0),void 0!==t&&!r.isString(t))throw TypeError("type must be a string");if(!r.isString(i))throw TypeError("requestType must be a string");if(!r.isString(s))throw TypeError("responseType must be a string");n.call(this,e,l),this.type=t||"rpc",this.requestType=i,this.requestStream=!!o||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=c,this.parsedOptions=u}s.fromJSON=function(e,t){return new s(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},s.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),n.prototype.resolve.call(this))}},1304(e,t,i){"use strict";e.exports=h;var n=i(7209);((h.prototype=Object.create(n.prototype)).constructor=h).className="Namespace";var r,s,o,a=i(1344),l=i(3262),c=i(1457);function u(e,t){if(e&&e.length){for(var i={},n=0;n<e.length;++n)i[e[n].name]=e[n].toJSON(t);return i}}function h(e,t){n.call(this,e,t),this.nested=void 0,this._nestedArray=null,this._lookupCache={},this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function d(e){e._nestedArray=null,e._lookupCache={};for(var t=e;t=t.parent;)t._lookupCache={};return e}h.fromJSON=function(e,t){return new h(e,t.options).addJSON(t.nested)},h.arrayToJSON=u,h.isReservedId=function(e,t){if(e)for(var i=0;i<e.length;++i)if("string"!=typeof e[i]&&e[i][0]<=t&&e[i][1]>t)return!0;return!1},h.isReservedName=function(e,t){if(e)for(var i=0;i<e.length;++i)if(e[i]===t)return!0;return!1},Object.defineProperty(h.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=l.toArray(this.nested))}}),h.prototype.toJSON=function(e){return l.toObject(["options",this.options,"nested",u(this.nestedArray,e)])},h.prototype.addJSON=function(e){if(e)for(var t,i=Object.keys(e),n=0;n<i.length;++n)t=e[i[n]],this.add((void 0!==t.fields?r.fromJSON:void 0!==t.values?o.fromJSON:void 0!==t.methods?s.fromJSON:void 0!==t.id?a.fromJSON:h.fromJSON)(i[n],t));return this},h.prototype.get=function(e){return this.nested&&this.nested[e]||null},h.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof o)return this.nested[e].values;throw Error("no such enum: "+e)},h.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof r||e instanceof c||e instanceof o||e instanceof s||e instanceof h))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof h&&e instanceof h)||t instanceof r||t instanceof s)throw Error("duplicate name '"+e.name+"' in "+this);for(var i=t.nestedArray,n=0;n<i.length;++n)e.add(i[n]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};this.nested[e.name]=e,this instanceof r||this instanceof s||this instanceof o||this instanceof a||e._edition||(e._edition=e._defaultEdition),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;for(var l=this;l=l.parent;)l._needsRecursiveFeatureResolution=!0,l._needsRecursiveResolve=!0;return e.onAdd(this),d(this)},h.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),d(this)},h.prototype.define=function(e,t){if(l.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var i=this;e.length>0;){var n=e.shift();if(i.nested&&i.nested[n]){if(!((i=i.nested[n])instanceof h))throw Error("path conflicts with non-namespace objects")}else i.add(i=new h(n))}return t&&i.addJSON(t),i},h.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var e=this.nestedArray,t=0;for(this.resolve();t<e.length;)e[t]instanceof h?e[t++].resolveAll():e[t++].resolve();return this._needsRecursiveResolve=!1,this},h.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(this._needsRecursiveFeatureResolution=!1,e=this._edition||e,n.prototype._resolveFeaturesRecursive.call(this,e),this.nestedArray.forEach(t=>{t._resolveFeaturesRecursive(e)}),this):this},h.prototype.lookup=function(e,t,i){if("boolean"==typeof t?(i=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),l.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;var n=e.join(".");if(""===e[0])return this.root.lookup(e.slice(1),t);var r=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+n];if(r&&(!t||t.indexOf(r.constructor)>-1))return r;if((r=this._lookupImpl(e,n))&&(!t||t.indexOf(r.constructor)>-1))return r;if(i)return null;for(var s=this;s.parent;){if((r=s.parent._lookupImpl(e,n))&&(!t||t.indexOf(r.constructor)>-1))return r;s=s.parent}return null},h.prototype._lookupImpl=function(e,t){if(Object.prototype.hasOwnProperty.call(this._lookupCache,t))return this._lookupCache[t];var i=this.get(e[0]),n=null;if(i)1===e.length?n=i:i instanceof h&&(e=e.slice(1),n=i._lookupImpl(e,e.join(".")));else for(var r=0;r<this.nestedArray.length;++r)this._nestedArray[r]instanceof h&&(i=this._nestedArray[r]._lookupImpl(e,t))&&(n=i);return this._lookupCache[t]=n,n},h.prototype.lookupType=function(e){var t=this.lookup(e,[r]);if(!t)throw Error("no such type: "+e);return t},h.prototype.lookupEnum=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},h.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[r,o]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},h.prototype.lookupService=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},h._configure=function(e,t,i){r=e,s=t,o=i}},7209(e,t,i){"use strict";e.exports=c,c.className="ReflectionObject";const n=i(1457);var r,s=i(3262),o={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},a={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},l={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function c(e,t){if(!s.isString(e))throw TypeError("name must be a string");if(t&&!s.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(c.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),c.prototype.toJSON=function(){throw Error()},c.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof r&&t._handleAdd(this)},c.prototype.onRemove=function(e){var t=e.root;t instanceof r&&t._handleRemove(this),this.parent=null,this.resolved=!1},c.prototype.resolve=function(){return this.resolved||this.root instanceof r&&(this.resolved=!0),this},c.prototype._resolveFeaturesRecursive=function(e){return this._resolveFeatures(this._edition||e)},c.prototype._resolveFeatures=function(e){if(!this._featuresResolved){var t={};if(!e)throw new Error("Unknown edition for "+this.fullName);var i=Object.assign(this.options?Object.assign({},this.options.features):{},this._inferLegacyProtoFeatures(e));if(this._edition){if("proto2"===e)t=Object.assign({},a);else if("proto3"===e)t=Object.assign({},l);else{if("2023"!==e)throw new Error("Unknown edition: "+e);t=Object.assign({},o)}return this._features=Object.assign(t,i||{}),void(this._featuresResolved=!0)}if(this.partOf instanceof n){var r=Object.assign({},this.partOf._features);this._features=Object.assign(r,i||{})}else if(this.declaringField);else{if(!this.parent)throw new Error("Unable to find a parent for "+this.fullName);var s=Object.assign({},this.parent._features);this._features=Object.assign(s,i||{})}this.extensionField&&(this.extensionField._features=this._features),this._featuresResolved=!0}},c.prototype._inferLegacyProtoFeatures=function(){return{}},c.prototype.getOption=function(e){if(this.options)return this.options[e]},c.prototype.setOption=function(e,t,i){return this.options||(this.options={}),/^features\./.test(e)?s.setProperty(this.options,e,t,i):i&&void 0!==this.options[e]||(this.getOption(e)!==t&&(this.resolved=!1),this.options[e]=t),this},c.prototype.setParsedOption=function(e,t,i){this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(i){var r=n.find(function(t){return Object.prototype.hasOwnProperty.call(t,e)});if(r){var o=r[e];s.setProperty(o,i,t)}else(r={})[e]=s.setProperty({},i,t),n.push(r)}else{var a={};a[e]=t,n.push(a)}return this},c.prototype.setOptions=function(e,t){if(e)for(var i=Object.keys(e),n=0;n<i.length;++n)this.setOption(i[n],e[i[n]],t);return this},c.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},c.prototype._editionToJSON=function(){if(this._edition&&"proto3"!==this._edition)return this._edition},c._configure=function(e){r=e}},1457(e,t,i){"use strict";e.exports=o;var n=i(7209);((o.prototype=Object.create(n.prototype)).constructor=o).className="OneOf";var r=i(1344),s=i(3262);function o(e,t,i,r){if(Array.isArray(t)||(i=t,t=void 0),n.call(this,e,i),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=r}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}o.fromJSON=function(e,t){return new o(e,t.oneof,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},o.prototype.add=function(e){if(!(e instanceof r))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},o.prototype.remove=function(e){if(!(e instanceof r))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},o.prototype.onAdd=function(e){n.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var i=e.get(this.oneof[t]);i&&!i.partOf&&(i.partOf=this,this.fieldsArray.push(i))}a(this)},o.prototype.onRemove=function(e){for(var t,i=0;i<this.fieldsArray.length;++i)(t=this.fieldsArray[i]).parent&&t.parent.remove(t);n.prototype.onRemove.call(this,e)},Object.defineProperty(o.prototype,"isProto3Optional",{get:function(){if(null==this.fieldsArray||1!==this.fieldsArray.length)return!1;var e=this.fieldsArray[0];return null!=e.options&&!0===e.options.proto3_optional}}),o.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,i){s.decorateType(t.constructor).add(new o(i,e)),Object.defineProperty(t,i,{get:s.oneOfGetter(e),set:s.oneOfSetter(e)})}}},4863(e,t,i){"use strict";e.exports=E,E.filename=null,E.defaults={keepCase:!1};var n=i(527),r=i(5330),s=i(7882),o=i(1344),a=i(8252),l=i(1457),c=i(5643),u=i(9687),h=i(8811),d=i(7209),f=i(361),p=i(3262),g=/^[1-9][0-9]*$/,m=/^-?[1-9][0-9]*$/,v=/^0[x][0-9a-fA-F]+$/,y=/^-?0[x][0-9a-fA-F]+$/,b=/^0[0-7]+$/,S=/^-?0[0-7]+$/,_=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,C=/^[a-zA-Z_][a-zA-Z_0-9]*$/,w=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;function E(e,t,i){t instanceof r||(i=t,t=new r),i||(i=E.defaults);var T,k,R,O,P=i.preferTrailingComment||!1,A=n(e,i.alternateCommentMode||!1),x=A.next,N=A.push,I=A.peek,M=A.skip,L=A.cmnt,D=!0,j="proto2",F=t,B=[],U={},z=i.keepCase?function(e){return e}:p.camelCase;function H(e,t,i){var n=E.filename;return i||(E.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+A.line+")")}function q(){var e,t=[];do{if('"'!==(e=x())&&"'"!==e)throw H(e);t.push(x()),M(e),e=I()}while('"'===e||"'"===e);return t.join("")}function W(e){var t=x();switch(t){case"'":case'"':return N(t),q();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var i=1;"-"===e.charAt(0)&&(i=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return i*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(g.test(e))return i*parseInt(e,10);if(v.test(e))return i*parseInt(e,16);if(b.test(e))return i*parseInt(e,8);if(_.test(e))return i*parseFloat(e);throw H(e,"number",t)}(t,!0)}catch(i){if(e&&w.test(t))return t;throw H(t,"value")}}function G(e,t){var i,n;do{if(!t||'"'!==(i=I())&&"'"!==i)try{e.push([n=$(x()),M("to",!0)?$(x()):n])}catch(n){if(!(t&&w.test(i)&&j>=2023))throw n;e.push(i)}else{var r=q();if(e.push(r),j>=2023)throw H(r,"id")}}while(M(",",!0));var s={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};Q(s,function(e){if("option"!==e)throw H(e);ie(s,e),M(";")},function(){se(s)})}function $(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw H(e,"id");if(m.test(e))return parseInt(e,10);if(y.test(e))return parseInt(e,16);if(S.test(e))return parseInt(e,8);throw H(e,"id")}function V(){if(void 0!==T)throw H("package");if(T=x(),!w.test(T))throw H(T,"name");F=F.define(T),M(";")}function Y(){var e,t=I();switch(t){case"weak":e=R||(R=[]),x();break;case"public":x();default:e=k||(k=[])}t=q(),M(";"),e.push(t)}function K(){if(M("="),(j=q())<2023)throw H(j,"syntax");M(";")}function J(){M("="),j=q();if(!["2023"].includes(j))throw H(j,"edition");M(";")}function X(e,t){switch(t){case"option":return ie(e,t),M(";"),!0;case"message":return Z(e,t),!0;case"enum":return te(e,t),!0;case"service":return function(e,t){if(!C.test(t=x()))throw H(t,"service name");var i=new u(t);Q(i,function(e){if(!X(i,e)){if("rpc"!==e)throw H(e);!function(e,t){var i=L(),n=t;if(!C.test(t=x()))throw H(t,"name");var r,s,o,a,l=t;M("("),M("stream",!0)&&(s=!0);if(!w.test(t=x()))throw H(t);r=t,M(")"),M("returns"),M("("),M("stream",!0)&&(a=!0);if(!w.test(t=x()))throw H(t);o=t,M(")");var c=new h(l,n,r,o,s,a);c.comment=i,Q(c,function(e){if("option"!==e)throw H(e);ie(c,e),M(";")}),e.add(c)}(i,e)}}),e.add(i),e===F&&B.push(i)}(e,t),!0;case"extend":return function(e,t){if(!w.test(t=x()))throw H(t,"reference");var i=t;Q(null,function(t){switch(t){case"required":case"repeated":ee(e,t,i);break;case"optional":ee(e,"proto3"===j?"proto3_optional":"optional",i);break;default:if("proto2"===j||!w.test(t))throw H(t);N(t),ee(e,"optional",i)}})}(e,t),!0}return!1}function Q(e,t,i){var n=A.line;if(e&&("string"!=typeof e.comment&&(e.comment=L()),e.filename=E.filename),M("{",!0)){for(var r;"}"!==(r=x());)t(r);M(";",!0)}else i&&i(),M(";"),e&&("string"!=typeof e.comment||P)&&(e.comment=L(n)||e.comment)}function Z(e,t){if(!C.test(t=x()))throw H(t,"type name");var i=new s(t);Q(i,function(e){if(!X(i,e))switch(e){case"map":!function(e){M("<");var t=x();if(void 0===f.mapKey[t])throw H(t,"type");M(",");var i=x();if(!w.test(i))throw H(i,"type");M(">");var n=x();if(!C.test(n))throw H(n,"name");M("=");var r=new a(z(n),$(x()),t,i);Q(r,function(e){if("option"!==e)throw H(e);ie(r,e),M(";")},function(){se(r)}),e.add(r)}(i);break;case"required":if("proto2"!==j)throw H(e);case"repeated":ee(i,e);break;case"optional":if("proto3"===j)ee(i,"proto3_optional");else{if("proto2"!==j)throw H(e);ee(i,"optional")}break;case"oneof":!function(e,t){if(!C.test(t=x()))throw H(t,"name");var i=new l(z(t));Q(i,function(e){"option"===e?(ie(i,e),M(";")):(N(e),ee(i,"optional"))}),e.add(i)}(i,e);break;case"extensions":G(i.extensions||(i.extensions=[]));break;case"reserved":G(i.reserved||(i.reserved=[]),!0);break;default:if("proto2"===j||!w.test(e))throw H(e);N(e),ee(i,"optional")}}),e.add(i),e===F&&B.push(i)}function ee(e,t,i){var n=x();if("group"!==n){for(;n.endsWith(".")||I().startsWith(".");)n+=x();if(!w.test(n))throw H(n,"type");var r=x();if(!C.test(r))throw H(r,"name");r=z(r),M("=");var a=new o(r,$(x()),n,t,i);if(Q(a,function(e){if("option"!==e)throw H(e);ie(a,e),M(";")},function(){se(a)}),"proto3_optional"===t){var c=new l("_"+r);a.setOption("proto3_optional",!0),c.add(a),e.add(c)}else e.add(a);e===F&&B.push(a)}else!function(e,t){if(j>=2023)throw H("group");var i=x();if(!C.test(i))throw H(i,"name");var n=p.lcFirst(i);i===n&&(i=p.ucFirst(i));M("=");var r=$(x()),a=new s(i);a.group=!0;var l=new o(n,r,i,t);l.filename=E.filename,Q(a,function(e){switch(e){case"option":ie(a,e),M(";");break;case"required":case"repeated":ee(a,e);break;case"optional":ee(a,"proto3"===j?"proto3_optional":"optional");break;case"message":Z(a,e);break;case"enum":te(a,e);break;case"reserved":G(a.reserved||(a.reserved=[]),!0);break;default:throw H(e)}}),e.add(a).add(l)}(e,t)}function te(e,t){if(!C.test(t=x()))throw H(t,"name");var i=new c(t);Q(i,function(e){switch(e){case"option":ie(i,e),M(";");break;case"reserved":G(i.reserved||(i.reserved=[]),!0),void 0===i.reserved&&(i.reserved=[]);break;default:!function(e,t){if(!C.test(t))throw H(t,"name");M("=");var i=$(x(),!0),n={options:void 0,getOption:function(e){return this.options[e]}};n.setOption=function(e,t){d.prototype.setOption.call(n,e,t)},n.setParsedOption=function(){},Q(n,function(e){if("option"!==e)throw H(e);ie(n,e),M(";")},function(){se(n)}),e.add(t,i,n.comment,n.parsedOptions||n.options)}(i,e)}}),e.add(i),e===F&&B.push(i)}function ie(e,t){var i,n,r=!0;for("option"===t&&(t=x());"="!==t;){if("("===t){var s=x();M(")"),t="("+s+")"}if(r){if(r=!1,t.includes(".")&&!t.includes("(")){var o=t.split(".");i=o[0]+".",t=o[1];continue}i=t}else n=n?n+=t:t;t=x()}var a=ne(e,n?i.concat(n):i);n=n&&"."===n[0]?n.slice(1):n,function(e,t,i,n){e.setParsedOption&&e.setParsedOption(t,i,n)}(e,i=i&&"."===i[i.length-1]?i.slice(0,-1):i,a,n)}function ne(e,t){if(M("{",!0)){for(var i={};!M("}",!0);){if(!C.test(O=x()))throw H(O,"name");if(null===O)throw H(O,"end of input");var n,r=O;if(M(":",!0),"{"===I())n=ne(e,t+"."+O);else if("["===I()){var s;if(n=[],M("[",!0)){do{s=W(!0),n.push(s)}while(M(",",!0));M("]"),void 0!==s&&re(e,t+"."+O,s)}}else n=W(!0),re(e,t+"."+O,n);var o=i[r];o&&(n=[].concat(o).concat(n)),i[r]=n,M(",",!0),M(";",!0)}return i}var a=W(!0);return re(e,t,a),a}function re(e,t,i){F===e&&/^features\./.test(t)?U[t]=i:e.setOption&&e.setOption(t,i)}function se(e){if(M("[",!0)){do{ie(e,"option")}while(M(",",!0));M("]")}return e}for(;null!==(O=x());)switch(O){case"package":if(!D)throw H(O);V();break;case"import":if(!D)throw H(O);Y();break;case"syntax":if(!D)throw H(O);K();break;case"edition":if(!D)throw H(O);J();break;case"option":ie(F,O),M(";",!0);break;default:if(X(F,O)){D=!1;continue}throw H(O)}return B.forEach(e=>{e._edition=j,Object.keys(U).forEach(t=>{void 0===e.getOption(t)&&e.setOption(t,U[t],!0)})}),E.filename=null,{package:T,imports:k,weakImports:R,root:t}}},6237(e,t,i){"use strict";e.exports=l;var n,r=i(3610),s=r.LongBits,o=r.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var c,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")},h=function(){return r.Buffer?function(e){return(l.create=function(e){return r.Buffer.isBuffer(e)?new n(e):u(e)})(e)}:u};function d(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function f(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw a(this,8);return new s(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}l.create=h(),l.prototype._slice=r.Array.prototype.subarray||r.Array.prototype.slice,l.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return c}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return f(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|f(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw a(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,i);if(t===i){var n=r.Buffer;return n?n.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,i)},l.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},l.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},l._configure=function(e){n=e,l.create=h(),n._configure();var t=r.Long?"toLong":"toNumber";r.merge(l.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},3158(e,t,i){"use strict";e.exports=s;var n=i(6237);(s.prototype=Object.create(n.prototype)).constructor=s;var r=i(3610);function s(e){n.call(this,e)}s._configure=function(){r.Buffer&&(s.prototype._slice=r.Buffer.prototype.slice)},s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},s._configure()},5330(e,t,i){"use strict";e.exports=h;var n=i(1304);((h.prototype=Object.create(n.prototype)).constructor=h).className="Root";var r,s,o,a=i(1344),l=i(5643),c=i(1457),u=i(3262);function h(e){n.call(this,"",e),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}function d(){}h.fromJSON=function(e,t){return t||(t=new h),e.options&&t.setOptions(e.options),t.addJSON(e.nested).resolveAll()},h.prototype.resolvePath=u.path.resolve,h.prototype.fetch=u.fetch,h.prototype.load=function e(t,i,n){"function"==typeof i&&(n=i,i=void 0);var r=this;if(!n)return u.asPromise(e,r,t,i);var a=n===d;function l(e,t){if(n){if(a)throw e;t&&t.resolveAll();var i=n;n=null,i(e,t)}}function c(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var i=e.substring(t);if(i in o)return i}return null}function h(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){s.filename=e;var n,o=s(t,r,i),h=0;if(o.imports)for(;h<o.imports.length;++h)(n=c(o.imports[h])||r.resolvePath(e,o.imports[h]))&&f(n);if(o.weakImports)for(h=0;h<o.weakImports.length;++h)(n=c(o.weakImports[h])||r.resolvePath(e,o.weakImports[h]))&&f(n,!0)}else r.setOptions(t.options).addJSON(t.nested)}catch(e){l(e)}a||p||l(null,r)}function f(e,t){if(e=c(e)||e,!(r.files.indexOf(e)>-1))if(r.files.push(e),e in o)a?h(e,o[e]):(++p,setTimeout(function(){--p,h(e,o[e])}));else if(a){var i;try{i=u.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||l(e))}h(e,i)}else++p,r.fetch(e,function(i,s){--p,n&&(i?t?p||l(null,r):l(i):h(e,s))})}var p=0;u.isString(t)&&(t=[t]);for(var g,m=0;m<t.length;++m)(g=r.resolvePath("",t[m]))&&f(g);return a?(r.resolveAll(),r):(p||l(null,r),r)},h.prototype.loadSync=function(e,t){if(!u.isNode)throw Error("not supported");return this.load(e,t,d)},h.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return n.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function p(e,t){var i=t.parent.lookup(t.extend);if(i){var n=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return i.get(n.name)||(n.declaringField=t,t.extensionField=n,i.add(n)),!0}return!1}h.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||p(0,e)||this.deferred.push(e);else if(e instanceof l)f.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof c)){if(e instanceof r)for(var t=0;t<this.deferred.length;)p(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var i=0;i<e.nestedArray.length;++i)this._handleAdd(e._nestedArray[i]);f.test(e.name)&&(e.parent[e.name]=e)}(e instanceof r||e instanceof l||e instanceof a)&&(this._fullyQualifiedObjects[e.fullName]=e)},h.prototype._handleRemove=function(e){if(e instanceof a){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof l)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var i=0;i<e.nestedArray.length;++i)this._handleRemove(e._nestedArray[i]);f.test(e.name)&&delete e.parent[e.name]}delete this._fullyQualifiedObjects[e.fullName]},h._configure=function(e,t,i){r=e,s=t,o=i}},4529(e){"use strict";e.exports={}},5047(e,t,i){"use strict";t.Service=i(7595)},7595(e,t,i){"use strict";e.exports=r;var n=i(3610);function r(e,t,i){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(i)}(r.prototype=Object.create(n.EventEmitter.prototype)).constructor=r,r.prototype.rpcCall=function e(t,i,r,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return n.asPromise(e,a,t,i,r,s);if(a.rpcImpl)try{return a.rpcImpl(t,i[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),function(e,i){if(e)return a.emit("error",e,t),o(e);if(null!==i){if(!(i instanceof r))try{i=r[a.responseDelimited?"decodeDelimited":"decode"](i)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",i,t),o(null,i)}a.end(!0)})}catch(e){return a.emit("error",e,t),void setTimeout(function(){o(e)},0)}else setTimeout(function(){o(Error("already ended"))},0)},r.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},9687(e,t,i){"use strict";e.exports=a;var n=i(1304);((a.prototype=Object.create(n.prototype)).constructor=a).className="Service";var r=i(8811),s=i(3262),o=i(5047);function a(e,t){n.call(this,e,t),this.methods={},this._methodsArray=null}function l(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var i=new a(e,t.options);if(t.methods)for(var n=Object.keys(t.methods),s=0;s<n.length;++s)i.add(r.fromJSON(n[s],t.methods[n[s]]));return t.nested&&i.addJSON(t.nested),t.edition&&(i._edition=t.edition),i.comment=t.comment,i._defaultEdition="proto3",i},a.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),i=!!e&&Boolean(e.keepComments);return s.toObject(["edition",this._editionToJSON(),"options",t&&t.options||void 0,"methods",n.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",i?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=s.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||n.prototype.get.call(this,e)},a.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;n.prototype.resolve.call(this);for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return this},a.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,n.prototype._resolveFeaturesRecursive.call(this,e),this.methodsArray.forEach(t=>{t._resolveFeaturesRecursive(e)}),this):this},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof r?(this.methods[e.name]=e,e.parent=this,l(this)):n.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof r){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,l(this)}return n.prototype.remove.call(this,e)},a.prototype.create=function(e,t,i){for(var n,r=new o.Service(e,t,i),a=0;a<this.methodsArray.length;++a){var l=s.lcFirst((n=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");r[l]=s.codegen(["r","c"],s.isReserved(l)?l+"_":l)("return this.rpcCall(m,q,s,r,c)")({m:n,q:n.resolvedRequestType.ctor,s:n.resolvedResponseType.ctor})}return r}},527(e){"use strict";e.exports=h;var t=/[\s{}=;:[\],'"()<>]/g,i=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,n=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,r=/^ *[*/]+ */,s=/^\s*\*?\/*/,o=/\n/g,a=/\s/,l=/\\(.?)/g,c={0:"\0",r:"\r",n:"\n",t:"\t"};function u(e){return e.replace(l,function(e,t){switch(t){case"\\":case"":return t;default:return c[t]||""}})}function h(e,l){e=e.toString();var c=0,h=e.length,d=1,f=0,p={},g=[],m=null;function v(e){return Error("illegal "+e+" (line "+d+")")}function y(t){return e.charAt(t)}function b(t,i,n){var a,c={type:e.charAt(t++),lineEmpty:!1,leading:n},u=t-(l?2:3);do{if(--u<0||"\n"===(a=e.charAt(u))){c.lineEmpty=!0;break}}while(" "===a||"\t"===a);for(var h=e.substring(t,i).split(o),g=0;g<h.length;++g)h[g]=h[g].replace(l?s:r,"").trim();c.text=h.join("\n").trim(),p[d]=c,f=d}function S(t){var i=_(t),n=e.substring(t,i);return/^\s*\/\//.test(n)}function _(e){for(var t=e;t<h&&"\n"!==y(t);)t++;return t}function C(){if(g.length>0)return g.shift();if(m)return function(){var t="'"===m?n:i;t.lastIndex=c-1;var r=t.exec(e);if(!r)throw v("string");return c=t.lastIndex,w(m),m=null,u(r[1])}();var r,s,o,f,p,C=0===c;do{if(c===h)return null;for(r=!1;a.test(o=y(c));)if("\n"===o&&(C=!0,++d),++c===h)return null;if("/"===y(c)){if(++c===h)throw v("comment");if("/"===y(c))if(l){if(f=c,p=!1,S(c-1)){p=!0;do{if((c=_(c))===h)break;if(c++,!C)break}while(S(c))}else c=Math.min(h,_(c)+1);p&&(b(f,c,C),C=!0),d++,r=!0}else{for(p="/"===y(f=c+1);"\n"!==y(++c);)if(c===h)return null;++c,p&&(b(f,c-1,C),C=!0),++d,r=!0}else{if("*"!==(o=y(c)))return"/";f=c+1,p=l||"*"===y(f);do{if("\n"===o&&++d,++c===h)throw v("comment");s=o,o=y(c)}while("*"!==s||"/"!==o);++c,p&&(b(f,c-2,C),C=!0),r=!0}}}while(r);var E=c;if(t.lastIndex=0,!t.test(y(E++)))for(;E<h&&!t.test(y(E));)++E;var T=e.substring(c,c=E);return'"'!==T&&"'"!==T||(m=T),T}function w(e){g.push(e)}function E(){if(!g.length){var e=C();if(null===e)return null;w(e)}return g[0]}return Object.defineProperty({next:C,peek:E,push:w,skip:function(e,t){var i=E();if(i===e)return C(),!0;if(!t)throw v("token '"+i+"', '"+e+"' expected");return!1},cmnt:function(e){var t,i=null;return void 0===e?(t=p[d-1],delete p[d-1],t&&(l||"*"===t.type||t.lineEmpty)&&(i=t.leading?t.text:null)):(f<e&&E(),t=p[e],delete p[e],!t||t.lineEmpty||!l&&"/"!==t.type||(i=t.leading?null:t.text)),i}},"line",{get:function(){return d}})}h.unescape=u},7882(e,t,i){"use strict";e.exports=y;var n=i(1304);((y.prototype=Object.create(n.prototype)).constructor=y).className="Type";var r=i(5643),s=i(1457),o=i(1344),a=i(8252),l=i(9687),c=i(2551),u=i(6237),h=i(3449),d=i(3262),f=i(1080),p=i(7728),g=i(420),m=i(744),v=i(6434);function y(e,t){n.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(y.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var i=this.fields[e[t]],n=i.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=i}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=d.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=d.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=y.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof c||((e.prototype=new c).constructor=e,d.merge(e.prototype,t)),e.$type=e.prototype.$type=this,d.merge(e,c,!0),this._ctor=e;for(var i=0;i<this.fieldsArray.length;++i)this._fieldsArray[i].resolve();var n={};for(i=0;i<this.oneofsArray.length;++i)n[this._oneofsArray[i].resolve().name]={get:d.oneOfGetter(this._oneofsArray[i].oneof),set:d.oneOfSetter(this._oneofsArray[i].oneof)};i&&Object.defineProperties(e.prototype,n)}}}),y.generateConstructor=function(e){for(var t,i=d.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?i("this%s={}",d.safeProp(t.name)):t.repeated&&i("this%s=[]",d.safeProp(t.name));return i("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},y.fromJSON=function(e,t){var i=new y(e,t.options);i.extensions=t.extensions,i.reserved=t.reserved;for(var c=Object.keys(t.fields),u=0;u<c.length;++u)i.add((void 0!==t.fields[c[u]].keyType?a.fromJSON:o.fromJSON)(c[u],t.fields[c[u]]));if(t.oneofs)for(c=Object.keys(t.oneofs),u=0;u<c.length;++u)i.add(s.fromJSON(c[u],t.oneofs[c[u]]));if(t.nested)for(c=Object.keys(t.nested),u=0;u<c.length;++u){var h=t.nested[c[u]];i.add((void 0!==h.id?o.fromJSON:void 0!==h.fields?y.fromJSON:void 0!==h.values?r.fromJSON:void 0!==h.methods?l.fromJSON:n.fromJSON)(c[u],h))}return t.extensions&&t.extensions.length&&(i.extensions=t.extensions),t.reserved&&t.reserved.length&&(i.reserved=t.reserved),t.group&&(i.group=!0),t.comment&&(i.comment=t.comment),t.edition&&(i._edition=t.edition),i._defaultEdition="proto3",i},y.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),i=!!e&&Boolean(e.keepComments);return d.toObject(["edition",this._editionToJSON(),"options",t&&t.options||void 0,"oneofs",n.arrayToJSON(this.oneofsArray,e),"fields",n.arrayToJSON(this.fieldsArray.filter(function(e){return!e.declaringField}),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",i?this.comment:void 0])},y.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;n.prototype.resolveAll.call(this);var e=this.oneofsArray;for(i=0;i<e.length;)e[i++].resolve();for(var t=this.fieldsArray,i=0;i<t.length;)t[i++].resolve();return this},y.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,n.prototype._resolveFeaturesRecursive.call(this,e),this.oneofsArray.forEach(t=>{t._resolveFeatures(e)}),this.fieldsArray.forEach(t=>{t._resolveFeatures(e)}),this):this},y.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},y.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof s?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):n.prototype.add.call(this,e)},y.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof s){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return n.prototype.remove.call(this,e)},y.prototype.isReservedId=function(e){return n.isReservedId(this.reserved,e)},y.prototype.isReservedName=function(e){return n.isReservedName(this.reserved,e)},y.prototype.create=function(e){return new this.ctor(e)},y.prototype.setup=function(){for(var e=this.fullName,t=[],i=0;i<this.fieldsArray.length;++i)t.push(this._fieldsArray[i].resolve().resolvedType);this.encode=f(this)({Writer:h,types:t,util:d}),this.decode=p(this)({Reader:u,types:t,util:d}),this.verify=g(this)({types:t,util:d}),this.fromObject=m.fromObject(this)({types:t,util:d}),this.toObject=m.toObject(this)({types:t,util:d});var n=v[e];if(n){var r=Object.create(this);r.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(r),r.toObject=this.toObject,this.toObject=n.toObject.bind(r)}return this},y.prototype.encode=function(e,t){return this.setup().encode(e,t)},y.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},y.prototype.decode=function(e,t){return this.setup().decode(e,t)},y.prototype.decodeDelimited=function(e){return e instanceof u||(e=u.create(e)),this.decode(e,e.uint32())},y.prototype.verify=function(e){return this.setup().verify(e)},y.prototype.fromObject=function(e){return this.setup().fromObject(e)},y.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},y.d=function(e){return function(t){d.decorateType(t,e)}}},361(e,t,i){"use strict";var n=t,r=i(3262),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var i=0,n={};for(t|=0;i<e.length;)n[s[i+t]]=e[i++];return n}n.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),n.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",r.emptyArray,null]),n.long=o([0,0,0,1,1],7),n.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),n.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])},3262(e,t,i){"use strict";var n,r,s=e.exports=i(3610),o=i(4529);s.codegen=i(8561),s.fetch=i(5212),s.path=i(9207),s.fs=s.inquire("fs"),s.toArray=function(e){if(e){for(var t=Object.keys(e),i=new Array(t.length),n=0;n<t.length;)i[n]=e[t[n++]];return i}return[]},s.toObject=function(e){for(var t={},i=0;i<e.length;){var n=e[i++],r=e[i++];void 0!==r&&(t[n]=r)}return t};var a=/\\/g,l=/"/g;s.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},s.safeProp=function(e){return!/^[$\w_]+$/.test(e)||s.isReserved(e)?'["'+e.replace(a,"\\\\").replace(l,'\\"')+'"]':"."+e},s.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var c=/_([a-z])/g;s.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(c,function(e,t){return t.toUpperCase()})},s.compareFieldsById=function(e,t){return e.id-t.id},s.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(s.decorateRoot.remove(e.$type),e.$type.name=t,s.decorateRoot.add(e.$type)),e.$type;n||(n=i(7882));var r=new n(t||e.name);return s.decorateRoot.add(r),r.ctor=e,Object.defineProperty(e,"$type",{value:r,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:r,enumerable:!1}),r};var u=0;s.decorateEnum=function(e){if(e.$type)return e.$type;r||(r=i(5643));var t=new r("Enum"+u++,e);return s.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},s.setProperty=function(e,t,i,n){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,i,r){var s=i.shift();if("__proto__"===s||"prototype"===s)return t;if(i.length>0)t[s]=e(t[s]||{},i,r);else{var o=t[s];if(o&&n)return t;o&&(r=[].concat(o).concat(r)),t[s]=r}return t}(e,t=t.split("."),i)},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(i(5330)))}})},2239(e,t,i){"use strict";e.exports=r;var n=i(3610);function r(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=r.zero=new r(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=r.zeroHash="\0\0\0\0\0\0\0\0";r.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new r(i,n)},r.from=function(e){if("number"==typeof e)return r.fromNumber(e);if(n.isString(e)){if(!n.Long)return r.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new r(e.low>>>0,e.high>>>0):s},r.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+4294967296*i)}return this.lo+4294967296*this.hi},r.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;r.fromHash=function(e){return e===o?s:new r((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},r.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},r.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},r.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},r.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}},3610(e,t,i){"use strict";var n=t;function r(e,t,i){for(var n=Object.keys(t),r=0;r<n.length;++r)void 0!==e[n[r]]&&i||(e[n[r]]=t[n[r]]);return e}function s(e){function t(e,i){if(!(this instanceof t))return new t(e,i);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),i&&r(this,i)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=i(8045),n.base64=i(8839),n.EventEmitter=i(4358),n.float=i(9410),n.inquire=i(4153),n.utf8=i(1447),n.pool=i(9390),n.LongBits=i(2239),n.isNode=Boolean("undefined"!=typeof global&&global&&global.process&&global.process.versions&&global.process.versions.node),n.global=n.isNode&&global||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.isset=n.isSet=function(e,t){var i=e[t];return!(null==i||!e.hasOwnProperty(t))&&("object"!=typeof i||(Array.isArray(i)?i.length:Object.keys(i).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var i=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))},n.merge=r,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=s,n.ProtocolError=s("ProtocolError"),n.oneOfGetter=function(e){for(var t={},i=0;i<e.length;++i)t[e[i]]=1;return function(){for(var e=Object.keys(this),i=e.length-1;i>-1;--i)if(1===t[e[i]]&&void 0!==this[e[i]]&&null!==this[e[i]])return e[i]}},n.oneOfSetter=function(e){return function(t){for(var i=0;i<e.length;++i)e[i]!==t&&delete this[e[i]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,i){return new e(t,i)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},420(e,t,i){"use strict";e.exports=function(e){var t=r.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),i=e.oneofsArray,n={};i.length&&t("var p={}");for(var l=0;l<e.fieldsArray.length;++l){var c=e._fieldsArray[l].resolve(),u="m"+r.safeProp(c.name);if(c.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",u,c.name),c.map)t("if(!util.isObject(%s))",u)("return%j",s(c,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),a(t,c,"k[i]"),o(t,c,l,u+"[k[i]]")("}");else if(c.repeated)t("if(!Array.isArray(%s))",u)("return%j",s(c,"array"))("for(var i=0;i<%s.length;++i){",u),o(t,c,l,u+"[i]")("}");else{if(c.partOf){var h=r.safeProp(c.partOf.name);1===n[c.partOf.name]&&t("if(p%s===1)",h)("return%j",c.partOf.name+": multiple values"),n[c.partOf.name]=1,t("p%s=1",h)}o(t,c,l,u)}c.optional&&t("}")}return t("return null")};var n=i(5643),r=i(3262);function s(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function o(e,t,i,r){if(t.resolvedType)if(t.resolvedType instanceof n){e("switch(%s){",r)("default:")("return%j",s(t,"enum value"));for(var o=Object.keys(t.resolvedType.values),a=0;a<o.length;++a)e("case %i:",t.resolvedType.values[o[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",i,r)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",r)("return%j",s(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",r,r,r,r)("return%j",s(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',r)("return%j",s(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',r)("return%j",s(t,"boolean"));break;case"string":e("if(!util.isString(%s))",r)("return%j",s(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',r,r,r)("return%j",s(t,"buffer"))}return e}function a(e,t,i){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",i)("return%j",s(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",i)("return%j",s(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",i)("return%j",s(t,"boolean key"))}return e}},6434(e,t,i){"use strict";var n=t,r=i(2551);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),i=this.lookup(t);if(i){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:i.encode(i.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var i="",n="";if(t&&t.json&&e.type_url&&e.value){n=e.type_url.substring(e.type_url.lastIndexOf("/")+1),i=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(n);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof r){var o=e.$type.toObject(e,t);return""===i&&(i="type.googleapis.com/"),n=i+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),o["@type"]=n,o}return this.toObject(e,t)}}},3449(e,t,i){"use strict";e.exports=h;var n,r=i(3610),s=r.LongBits,o=r.base64,a=r.utf8;function l(e,t,i){this.fn=e,this.len=t,this.next=void 0,this.val=i}function c(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new l(c,0,0),this.tail=this.head,this.states=null}var d=function(){return r.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,i){t[i]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,i){for(;e.hi;)t[i++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[i++]=127&e.lo|128,e.lo=e.lo>>>7;t[i++]=e.lo}function m(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}h.create=d(),h.alloc=function(e){return new r.Array(e)},r.Array!==Array&&(h.alloc=r.pool(h.alloc,r.Array.prototype.subarray)),h.prototype._push=function(e,t,i){return this.tail=this.tail.next=new l(e,t,i),this.len+=t,this},p.prototype=Object.create(l.prototype),p.prototype.fn=function(e,t,i){for(;e>127;)t[i++]=127&e|128,e>>>=7;t[i]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,s.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=s.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=s.from(e);return this._push(m,4,t.lo)._push(m,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(r.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(r.float.writeDoubleLE,8,e)};var v=r.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n<e.length;++n)t[i+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(r.isString(e)){var i=h.alloc(t=o.length(e));o.decode(e,i,0),e=i}return this.uint32(t)._push(v,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new l(c,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(c,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},818(e,t,i){"use strict";e.exports=s;var n=i(3449);(s.prototype=Object.create(n.prototype)).constructor=s;var r=i(3610);function s(){n.call(this)}function o(e,t,i){e.length<40?r.utf8.write(e,t,i):t.utf8Write?t.utf8Write(e,i):t.write(e,i)}s._configure=function(){s.alloc=r._Buffer_allocUnsafe,s.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&"set"===r.Buffer.prototype.set.name?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n<e.length;)t[i++]=e[n++]}},s.prototype.bytes=function(e){r.isString(e)&&(e=r._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=r.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},815(e,t,i){var n,r=i(3519),s=i(6611);try{n=i(9896)}catch(e){}var o=function(){},a="undefined"!=typeof process&&/^v?\.0/.test(process.version),l=function(e){return"function"==typeof e},c=function(e,t,i,c){c=r(c);var u=!1;e.on("close",function(){u=!0}),s(e,{readable:t,writable:i},function(e){if(e)return c(e);u=!0,c()});var h=!1;return function(t){if(!u&&!h)return h=!0,function(e){return!!a&&!!n&&(e instanceof(n.ReadStream||o)||e instanceof(n.WriteStream||o))&&l(e.close)}(e)?e.close(o):function(e){return e.setHeader&&l(e.abort)}(e)?e.abort():l(e.destroy)?e.destroy():void c(t||new Error("stream was destroyed"))}},u=function(e){e()},h=function(e,t){return e.pipe(t)};e.exports=function(){var e,t=Array.prototype.slice.call(arguments),i=l(t[t.length-1]||o)&&t.pop()||o;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var n=t.map(function(r,s){var o=s<t.length-1;return c(r,o,s>0,function(t){e||(e=t),t&&n.forEach(u),o||(n.forEach(u),i(e))})});return t.reduce(h)}},113(e){"use strict";const t={};function i(e,i,n){n||(n=Error);class r extends n{constructor(e,t,n){super(function(e,t,n){return"string"==typeof i?i:i(e,t,n)}(e,t,n))}}r.prototype.name=n.name,r.prototype.code=e,t[e]=r}function n(e,t){if(Array.isArray(e)){const i=e.length;return e=e.map(e=>String(e)),i>2?`one of ${t} ${e.slice(0,i-1).join(", ")}, or `+e[i-1]:2===i?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}return`of ${t} ${String(e)}`}i("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(e,t,i){let r;var s,o;let a;if("string"==typeof t&&(s="not ",t.substr(!o||o<0?0:+o,s.length)===s)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,i){return(void 0===i||i>e.length)&&(i=e.length),e.substring(i-t.length,i)===t}(e," argument"))a=`The ${e} ${r} ${n(t,"type")}`;else{const i=function(e,t,i){return"number"!=typeof i&&(i=0),!(i+t.length>e.length)&&-1!==e.indexOf(t,i)}(e,".")?"property":"argument";a=`The "${e}" ${i} ${r} ${n(t,"type")}`}return a+=". Received type "+typeof i,a},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},5382(e,t,i){"use strict";var n=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};e.exports=c;var r=i(5412),s=i(6708);i(2017)(c,r);for(var o=n(s.prototype),a=0;a<o.length;a++){var l=o[a];c.prototype[l]||(c.prototype[l]=s.prototype[l])}function c(e){if(!(this instanceof c))return new c(e);r.call(this,e),s.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",u)))}function u(){this._writableState.ended||process.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},3600(e,t,i){"use strict";e.exports=r;var n=i(4610);function r(e){if(!(this instanceof r))return new r(e);n.call(this,e)}i(2017)(r,n),r.prototype._transform=function(e,t,i){i(null,e)}},5412(e,t,i){"use strict";var n;e.exports=E,E.ReadableState=w;i(4434).EventEmitter;var r=function(e,t){return e.listeners(t).length},s=i(1416),o=i(181).Buffer,a=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var l,c=i(9023);l=c&&c.debuglog?c.debuglog("stream"):function(){};var u,h,d,f=i(345),p=i(5896),g=i(5291).getHighWaterMark,m=i(113).F,v=m.ERR_INVALID_ARG_TYPE,y=m.ERR_STREAM_PUSH_AFTER_EOF,b=m.ERR_METHOD_NOT_IMPLEMENTED,S=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;i(2017)(E,s);var _=p.errorOrDestroy,C=["error","close","destroy","pause","resume"];function w(e,t,r){n=n||i(5382),e=e||{},"boolean"!=typeof r&&(r=t instanceof n),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",r),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(u||(u=i(3141).I),this.decoder=new u(e.encoding),this.encoding=e.encoding)}function E(e){if(n=n||i(5382),!(this instanceof E))return new E(e);var t=this instanceof n;this._readableState=new w(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function T(e,t,i,n,r){l("readableAddChunk",t);var s,c=e._readableState;if(null===t)c.reading=!1,function(e,t){if(l("onEofChunk"),t.ended)return;if(t.decoder){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,t.sync?P(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,A(e)))}(e,c);else if(r||(s=function(e,t){var i;n=t,o.isBuffer(n)||n instanceof a||"string"==typeof t||void 0===t||e.objectMode||(i=new v("chunk",["string","Buffer","Uint8Array"],t));var n;return i}(c,t)),s)_(e,s);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===o.prototype||(t=function(e){return o.from(e)}(t)),n)c.endEmitted?_(e,new S):k(e,c,t,!0);else if(c.ended)_(e,new y);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!i?(t=c.decoder.write(t),c.objectMode||0!==t.length?k(e,c,t,!1):x(e,c)):k(e,c,t,!1)}else n||(c.reading=!1,x(e,c));return!c.ended&&(c.length<c.highWaterMark||0===c.length)}function k(e,t,i,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",i)):(t.length+=t.objectMode?1:i.length,n?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&P(e)),x(e,t)}Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),E.prototype.destroy=p.destroy,E.prototype._undestroy=p.undestroy,E.prototype._destroy=function(e,t){t(e)},E.prototype.push=function(e,t){var i,n=this._readableState;return n.objectMode?i=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=o.from(e,t),t=""),i=!0),T(this,e,t,!1,i)},E.prototype.unshift=function(e){return T(this,e,null,!0,!1)},E.prototype.isPaused=function(){return!1===this._readableState.flowing},E.prototype.setEncoding=function(e){u||(u=i(3141).I);var t=new u(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var R=1073741824;function O(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function P(e){var t=e._readableState;l("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(A,e))}function A(e){var t=e._readableState;l("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,D(e)}function x(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(N,e,t))}function N(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var i=t.length;if(l("maybeReadMore read 0"),e.read(0),i===t.length)break}t.readingMore=!1}function I(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function M(e){l("readable nexttick read 0"),e.read(0)}function L(e,t){l("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),D(e),t.flowing&&!t.reading&&e.read(0)}function D(e){var t=e._readableState;for(l("flow",t.flowing);t.flowing&&null!==e.read(););}function j(e,t){return 0===t.length?null:(t.objectMode?i=t.buffer.shift():!e||e>=t.length?(i=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):i=t.buffer.consume(e,t.decoder),i);var i}function F(e){var t=e._readableState;l("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(B,t,e))}function B(e,t){if(l("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var i=t._writableState;(!i||i.autoDestroy&&i.finished)&&t.destroy()}}function U(e,t){for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1}E.prototype.read=function(e){l("read",e),e=parseInt(e,10);var t=this._readableState,i=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?F(this):P(this),null;if(0===(e=O(e,t))&&t.ended)return 0===t.length&&F(this),null;var n,r=t.needReadable;return l("need readable",r),(0===t.length||t.length-e<t.highWaterMark)&&l("length less than watermark",r=!0),t.ended||t.reading?l("reading or ended",r=!1):r&&(l("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=O(i,t))),null===(n=e>0?j(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),i!==e&&t.ended&&F(this)),null!==n&&this.emit("data",n),n},E.prototype._read=function(e){_(this,new b("_read()"))},E.prototype.pipe=function(e,t){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,l("pipe count=%d opts=%j",n.pipesCount,t);var s=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?a:g;function o(t,r){l("onunpipe"),t===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,l("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",o),i.removeListener("end",a),i.removeListener("end",g),i.removeListener("data",h),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function a(){l("onend"),e.end()}n.endEmitted?process.nextTick(s):i.once("end",s),e.on("unpipe",o);var c=function(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&r(e,"data")&&(t.flowing=!0,D(e))}}(i);e.on("drain",c);var u=!1;function h(t){l("ondata");var r=e.write(t);l("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==U(n.pipes,e))&&!u&&(l("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function d(t){l("onerror",t),g(),e.removeListener("error",d),0===r(e,"error")&&_(e,t)}function f(){e.removeListener("finish",p),g()}function p(){l("onfinish"),e.removeListener("close",f),g()}function g(){l("unpipe"),i.unpipe(e)}return i.on("data",h),function(e,t,i){if("function"==typeof e.prependListener)return e.prependListener(t,i);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]:e.on(t,i)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",i),n.flowing||(l("pipe resume"),i.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,i={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,i)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<r;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=U(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,i)),this},E.prototype.on=function(e,t){var i=s.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,l("on readable",n.length,n.reading),n.length?P(this):n.reading||process.nextTick(M,this))),i},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(e,t){var i=s.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(I,this),i},E.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(I,this),t},E.prototype.resume=function(){var e=this._readableState;return e.flowing||(l("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(L,e,t))}(this,e)),e.paused=!1,this},E.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(e){var t=this,i=this._readableState,n=!1;for(var r in e.on("end",function(){if(l("wrapped end"),i.decoder&&!i.ended){var e=i.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(r){(l("wrapped data"),i.decoder&&(r=i.decoder.write(r)),i.objectMode&&null==r)||(i.objectMode||r&&r.length)&&(t.push(r)||(n=!0,e.pause()))}),e)void 0===this[r]&&"function"==typeof e[r]&&(this[r]=function(t){return function(){return e[t].apply(e,arguments)}}(r));for(var s=0;s<C.length;s++)e.on(C[s],this.emit.bind(this,C[s]));return this._read=function(t){l("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(E.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=i(2955)),h(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),E._fromList=j,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(E.from=function(e,t){return void 0===d&&(d=i(6532)),d(E,e,t)})},4610(e,t,i){"use strict";e.exports=u;var n=i(113).F,r=n.ERR_METHOD_NOT_IMPLEMENTED,s=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,l=i(5382);function c(e,t){var i=this._transformState;i.transforming=!1;var n=i.writecb;if(null===n)return this.emit("error",new s);i.writechunk=null,i.writecb=null,null!=t&&this.push(t),n(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function u(e){if(!(this instanceof u))return new u(e);l.call(this,e),this._transformState={afterTransform:c.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",h)}function h(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush(function(t,i){d(e,t,i)})}function d(e,t,i){if(t)return e.emit("error",t);if(null!=i&&e.push(i),e._writableState.length)throw new a;if(e._transformState.transforming)throw new o;return e.push(null)}i(2017)(u,l),u.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},u.prototype._transform=function(e,t,i){i(new r("_transform()"))},u.prototype._write=function(e,t,i){var n=this._transformState;if(n.writecb=i,n.writechunk=e,n.writeencoding=t,!n.transforming){var r=this._readableState;(n.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},u.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},u.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,function(e){t(e)})}},6708(e,t,i){"use strict";function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,i){var n=e.entry;e.entry=null;for(;n;){var r=n.callback;t.pendingcb--,r(i),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var r;e.exports=E,E.WritableState=w;var s={deprecate:i(7983)},o=i(1416),a=i(181).Buffer,l=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,u=i(5896),h=i(5291).getHighWaterMark,d=i(113).F,f=d.ERR_INVALID_ARG_TYPE,p=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,m=d.ERR_STREAM_CANNOT_PIPE,v=d.ERR_STREAM_DESTROYED,y=d.ERR_STREAM_NULL_VALUES,b=d.ERR_STREAM_WRITE_AFTER_END,S=d.ERR_UNKNOWN_ENCODING,_=u.errorOrDestroy;function C(){}function w(e,t,s){r=r||i(5382),e=e||{},"boolean"!=typeof s&&(s=t instanceof r),this.objectMode=!!e.objectMode,s&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var i=e._writableState,n=i.sync,r=i.writecb;if("function"!=typeof r)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(i),t)!function(e,t,i,n,r){--t.pendingcb,i?(process.nextTick(r,n),process.nextTick(A,e,t),e._writableState.errorEmitted=!0,_(e,n)):(r(n),e._writableState.errorEmitted=!0,_(e,n),A(e,t))}(e,i,n,t,r);else{var s=O(i)||e.destroyed;s||i.corked||i.bufferProcessing||!i.bufferedRequest||R(e,i),n?process.nextTick(k,e,i,s,r):k(e,i,s,r)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function E(e){var t=this instanceof(r=r||i(5382));if(!t&&!c.call(E,this))return new E(e);this._writableState=new w(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),o.call(this)}function T(e,t,i,n,r,s,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new v("write")):i?e._writev(r,t.onwrite):e._write(r,s,t.onwrite),t.sync=!1}function k(e,t,i,n){i||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),A(e,t)}function R(e,t){t.bufferProcessing=!0;var i=t.bufferedRequest;if(e._writev&&i&&i.next){var r=t.bufferedRequestCount,s=new Array(r),o=t.corkedRequestsFree;o.entry=i;for(var a=0,l=!0;i;)s[a]=i,i.isBuf||(l=!1),i=i.next,a+=1;s.allBuffers=l,T(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;i;){var c=i.chunk,u=i.encoding,h=i.callback;if(T(e,t,!1,t.objectMode?1:c.length,c,u,h),i=i.next,t.bufferedRequestCount--,t.writing)break}null===i&&(t.lastBufferedRequest=null)}t.bufferedRequest=i,t.bufferProcessing=!1}function O(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function P(e,t){e._final(function(i){t.pendingcb--,i&&_(e,i),t.prefinished=!0,e.emit("prefinish"),A(e,t)})}function A(e,t){var i=O(t);if(i&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(P,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return i}i(2017)(E,o),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(e){return!!c.call(this,e)||this===E&&(e&&e._writableState instanceof w)}})):c=function(e){return e instanceof this},E.prototype.pipe=function(){_(this,new m)},E.prototype.write=function(e,t,i){var n,r=this._writableState,s=!1,o=!r.objectMode&&(n=e,a.isBuffer(n)||n instanceof l);return o&&!a.isBuffer(e)&&(e=function(e){return a.from(e)}(e)),"function"==typeof t&&(i=t,t=null),o?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof i&&(i=C),r.ending?function(e,t){var i=new b;_(e,i),process.nextTick(t,i)}(this,i):(o||function(e,t,i,n){var r;return null===i?r=new y:"string"==typeof i||t.objectMode||(r=new f("chunk",["string","Buffer"],i)),!r||(_(e,r),process.nextTick(n,r),!1)}(this,r,e,i))&&(r.pendingcb++,s=function(e,t,i,n,r,s){if(!i){var o=function(e,t,i){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=a.from(t,i));return t}(t,n,r);n!==o&&(i=!0,r="buffer",n=o)}var l=t.objectMode?1:n.length;t.length+=l;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:r,isBuf:i,callback:s,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,l,n,r,s);return c}(this,r,o,e,t,i)),s},E.prototype.cork=function(){this._writableState.corked++},E.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||R(this,e))},E.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new S(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(e,t,i){i(new p("_write()"))},E.prototype._writev=null,E.prototype.end=function(e,t,i){var n=this._writableState;return"function"==typeof e?(i=e,e=null,t=null):"function"==typeof t&&(i=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,i){t.ending=!0,A(e,t),i&&(t.finished?process.nextTick(i):e.once("finish",i));t.ended=!0,e.writable=!1}(this,n,i),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),E.prototype.destroy=u.destroy,E.prototype._undestroy=u.undestroy,E.prototype._destroy=function(e,t){t(e)}},2955(e,t,i){"use strict";var n;function r(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var s=i(6238),o=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),u=Symbol("lastPromise"),h=Symbol("handlePromise"),d=Symbol("stream");function f(e,t){return{value:e,done:t}}function p(e){var t=e[o];if(null!==t){var i=e[d].read();null!==i&&(e[u]=null,e[o]=null,e[a]=null,t(f(i,!1)))}}function g(e){process.nextTick(p,e)}var m=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((r(n={get stream(){return this[d]},next:function(){var e=this,t=this[l];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(f(void 0,!0));if(this[d].destroyed)return new Promise(function(t,i){process.nextTick(function(){e[l]?i(e[l]):t(f(void 0,!0))})});var i,n=this[u];if(n)i=new Promise(function(e,t){return function(i,n){e.then(function(){t[c]?i(f(void 0,!0)):t[h](i,n)},n)}}(n,this));else{var r=this[d].read();if(null!==r)return Promise.resolve(f(r,!1));i=new Promise(this[h])}return this[u]=i,i}},Symbol.asyncIterator,function(){return this}),r(n,"return",function(){var e=this;return new Promise(function(t,i){e[d].destroy(null,function(e){e?i(e):t(f(void 0,!0))})})}),n),m);e.exports=function(e){var t,i=Object.create(v,(r(t={},d,{value:e,writable:!0}),r(t,o,{value:null,writable:!0}),r(t,a,{value:null,writable:!0}),r(t,l,{value:null,writable:!0}),r(t,c,{value:e._readableState.endEmitted,writable:!0}),r(t,h,{value:function(e,t){var n=i[d].read();n?(i[u]=null,i[o]=null,i[a]=null,e(f(n,!1))):(i[o]=e,i[a]=t)},writable:!0}),t));return i[u]=null,s(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=i[a];return null!==t&&(i[u]=null,i[o]=null,i[a]=null,t(e)),void(i[l]=e)}var n=i[o];null!==n&&(i[u]=null,i[o]=null,i[a]=null,n(f(void 0,!0))),i[c]=!0}),e.on("readable",g.bind(null,i)),i}},345(e,t,i){"use strict";function n(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function r(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach(function(t){s(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function s(e,t,i){return(t=a(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function o(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var l=i(181).Buffer,c=i(9023).inspect,u=c&&c.custom||"inspect";function h(e,t,i){l.prototype.copy.call(e,t,i)}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,i,n;return t=e,(i=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,i=""+t.data;t=t.next;)i+=e+t.data;return i}},{key:"concat",value:function(e){if(0===this.length)return l.alloc(0);for(var t=l.allocUnsafe(e>>>0),i=this.head,n=0;i;)h(i.data,t,n),n+=i.data.length,i=i.next;return t}},{key:"consume",value:function(e,t){var i;return e<this.head.data.length?(i=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):i=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),i}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,i=1,n=t.data;for(e-=n.length;t=t.next;){var r=t.data,s=e>r.length?r.length:e;if(s===r.length?n+=r:n+=r.slice(0,e),0===(e-=s)){s===r.length?(++i,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=r.slice(s));break}++i}return this.length-=i,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),i=this.head,n=1;for(i.data.copy(t),e-=i.data.length;i=i.next;){var r=i.data,s=e>r.length?r.length:e;if(r.copy(t,t.length-e,0,s),0===(e-=s)){s===r.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=r.slice(s));break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,r(r({},t),{},{depth:0,customInspect:!1}))}}])&&o(t.prototype,i),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},5896(e){"use strict";function t(e,t){n(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}e.exports={destroy:function(e,r){var s=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(r?r(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(n,this,e)):process.nextTick(n,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!r&&e?s._writableState?s._writableState.errorEmitted?process.nextTick(i,s):(s._writableState.errorEmitted=!0,process.nextTick(t,s,e)):process.nextTick(t,s,e):r?(process.nextTick(i,s),r(e)):process.nextTick(i,s)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var i=e._readableState,n=e._writableState;i&&i.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},6238(e,t,i){"use strict";var n=i(113).F.ERR_STREAM_PREMATURE_CLOSE;function r(){}e.exports=function e(t,i,s){if("function"==typeof i)return e(t,null,i);i||(i={}),s=function(e){var t=!1;return function(){if(!t){t=!0;for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];e.apply(this,n)}}}(s||r);var o=i.readable||!1!==i.readable&&t.readable,a=i.writable||!1!==i.writable&&t.writable,l=function(){t.writable||u()},c=t._writableState&&t._writableState.finished,u=function(){a=!1,c=!0,o||s.call(t)},h=t._readableState&&t._readableState.endEmitted,d=function(){o=!1,h=!0,a||s.call(t)},f=function(e){s.call(t,e)},p=function(){var e;return o&&!h?(t._readableState&&t._readableState.ended||(e=new n),s.call(t,e)):a&&!c?(t._writableState&&t._writableState.ended||(e=new n),s.call(t,e)):void 0},g=function(){t.req.on("finish",u)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?a&&!t._writableState&&(t.on("end",l),t.on("close",l)):(t.on("complete",u),t.on("abort",p),t.req?g():t.on("request",g)),t.on("end",d),t.on("finish",u),!1!==i.error&&t.on("error",f),t.on("close",p),function(){t.removeListener("complete",u),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",u),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",u),t.removeListener("end",d),t.removeListener("error",f),t.removeListener("close",p)}}},6532(e,t,i){"use strict";function n(e,t,i,n,r,s,o){try{var a=e[s](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(n,r)}function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function s(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var o=i(113).F.ERR_INVALID_ARG_TYPE;e.exports=function(e,t,i){var a;if(t&&"function"==typeof t.next)a=t;else if(t&&t[Symbol.asyncIterator])a=t[Symbol.asyncIterator]();else{if(!t||!t[Symbol.iterator])throw new o("iterable",["Iterable"],t);a=t[Symbol.iterator]()}var l=new e(function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach(function(t){s(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}({objectMode:!0},i)),c=!1;function u(){return h.apply(this,arguments)}function h(){var e;return e=function*(){try{var e=yield a.next(),t=e.value;e.done?l.push(null):l.push(yield t)?u():c=!1}catch(e){l.destroy(e)}},h=function(){var t=this,i=arguments;return new Promise(function(r,s){var o=e.apply(t,i);function a(e){n(o,r,s,a,l,"next",e)}function l(e){n(o,r,s,a,l,"throw",e)}a(void 0)})},h.apply(this,arguments)}return l._read=function(){c||(c=!0,u())},l}},7758(e,t,i){"use strict";var n;var r=i(113).F,s=r.ERR_MISSING_ARGS,o=r.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function l(e){e()}function c(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var u,h=function(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new s("streams");var d=t.map(function(e,r){var s=r<t.length-1;return function(e,t,r,s){s=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(s);var a=!1;e.on("close",function(){a=!0}),void 0===n&&(n=i(6238)),n(e,{readable:t,writable:r},function(e){if(e)return s(e);a=!0,s()});var l=!1;return function(t){if(!a&&!l)return l=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new o("pipe"))}}(e,s,r>0,function(e){u||(u=e),e&&d.forEach(l),s||(d.forEach(l),h(u))})});return t.reduce(c)}},5291(e,t,i){"use strict";var n=i(113).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,i,r){var s=function(e,t,i){return null!=e.highWaterMark?e.highWaterMark:t?e[i]:null}(t,r,i);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new n(r?i:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}},1416(e,t,i){e.exports=i(2203)},4198(e,t,i){var n=i(2203);"disable"===process.env.READABLE_STREAM&&n?(e.exports=n.Readable,Object.assign(e.exports,n),e.exports.Stream=n):((t=e.exports=i(5412)).Stream=n||t,t.Readable=t,t.Writable=i(6708),t.Duplex=i(5382),t.Transform=i(4610),t.PassThrough=i(3600),t.finished=i(6238),t.pipeline=i(7758))},2861(e,t,i){var n=i(181),r=n.Buffer;function s(e,t){for(var i in e)t[i]=e[i]}function o(e,t,i){return r(e,t,i)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=o),o.prototype=Object.create(r.prototype),s(r,o),o.from=function(e,t,i){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,i)},o.alloc=function(e,t,i){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=r(e);return void 0!==t?"string"==typeof i?n.fill(t,i):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},4546(e,t,i){var n=i(9896);e.exports=function(e,t,i){t=void 0!==t?t:"\n",i=void 0!==i?i:"utf8";var r=[],s=n.readFileSync(e,i);if(s.indexOf("-END CERTIFICATE-")<0||s.indexOf("-BEGIN CERTIFICATE-")<0)throw Error("File does not contain 'BEGIN CERTIFICATE' or 'END CERTIFICATE'");var o,a,l=[];for(o=0,a=(s=s.split(t)).length;o<a;o++){var c=s[o];0!==c.length&&(l.push(c),c.match(/-END CERTIFICATE-/)&&(r.push(l.join(t)),l=[]))}return r}},3141(e,t,i){"use strict";var n=i(2861).Buffer,r=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=u,this.end=h,t=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,i=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==i?i:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var i=e.toString("utf16le",t);if(i){var n=i.charCodeAt(i.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,i)}return t}function u(e,t){var i=(e.length-t)%3;return 0===i?e.toString("base64",t):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-i))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.I=s,s.prototype.write=function(e){if(0===e.length)return"";var t,i;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<e.length?t?t+this.text(e,i):this.text(e,i):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var i=function(e,t,i){var n=t.length-1;if(n<i)return 0;var r=o(t[n]);if(r>=0)return r>0&&(e.lastNeed=r-1),r;if(--n<i||-2===r)return 0;if(r=o(t[n]),r>=0)return r>0&&(e.lastNeed=r-2),r;if(--n<i||-2===r)return 0;if(r=o(t[n]),r>=0)return r>0&&(2===r?r=0:e.lastNeed=r-3),r;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=i;var n=e.length-(i-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},6868(e,t,i){var n=i(6284),r=i(6706),s=i(815),o=i(9505),a=i(9896),l=i(6928),c="win32"===i(857).platform(),u=function(){},h=function(e){return e},d=c?function(e){return e.replace(/\\/g,"/").replace(/[:?<>|]/g,"_")}:h,f=function(e,t){return function(i){i.name=i.name.split("/").slice(t).join("/");var n=i.linkname;return n&&("link"===i.type||l.isAbsolute(n))&&(i.linkname=n.split("/").slice(t).join("/")),e(i)}};t.pack=function(e,t){e||(e="."),t||(t={});var i=t.fs||a,n=t.ignore||t.filter||u,o=t.map||u,c=t.mapStream||h,p=function(e,t,i,n,r,s){var o=r||["."];return function(r){if(!o.length)return r();var a=o.shift(),c=l.join(i,a);t.call(e,c,function(t,u){return t?r(t):u.isDirectory()?void e.readdir(c,function(e,t){if(e)return r(e);s&&t.sort();for(var c=0;c<t.length;c++)n(l.join(i,a,t[c]))||o.push(l.join(a,t[c]));r(null,a,u)}):r(null,a,u)})}}(i,t.dereference?i.stat:i.lstat,e,n,t.entries,t.sort),m=!1!==t.strict,v="number"==typeof t.umask?~t.umask:~g(),y="number"==typeof t.dmode?t.dmode:0,b="number"==typeof t.fmode?t.fmode:0,S=t.pack||r.pack(),_=t.finish||u;t.strip&&(o=f(o,t.strip)),t.readable&&(y|=parseInt(555,8),b|=parseInt(444,8)),t.writable&&(y|=parseInt(333,8),b|=parseInt(222,8));var C=function(n,r,a){if(n)return S.destroy(n);if(!r)return!1!==t.finalize&&S.finalize(),_(S);if(a.isSocket())return w();var u={name:d(r),mode:(a.mode|(a.isDirectory()?y:b))&v,mtime:a.mtime,size:a.size,type:"file",uid:a.uid,gid:a.gid};if(a.isDirectory())return u.size=0,u.type="directory",u=o(u)||u,S.entry(u,w);if(a.isSymbolicLink())return u.size=0,u.type="symlink",function(t,n){i.readlink(l.join(e,t),function(e,t){if(e)return S.destroy(e);n.linkname=d(t),S.entry(n,w)})}(r,u=o(u)||u);if(u=o(u)||u,!a.isFile())return m?S.destroy(new Error("unsupported type for "+r)):w();var h=S.entry(u,w);if(h){var f=c(i.createReadStream(l.join(e,r),{start:0,end:u.size>0?u.size-1:u.size}),u);f.on("error",function(e){h.destroy(e)}),s(f,h)}},w=function(e){if(e)return S.destroy(e);p(C)};return w(),S};var p=function(e){return e.length?e[e.length-1]:null},g=function(){return process.umask?process.umask():0};function m(e,t,i,n){if(t===i)return n(null,!0);e.lstat(t,function(r,s){return r&&"ENOENT"!==r.code?n(r):r||s.isDirectory()?m(e,l.join(t,".."),i,n):void n(null,!1)})}function v(e,t,i){o(e,{fs:t.fs},function(e,r){!e&&r&&t.own?n(r,t.uid,t.gid,i):i(e)})}function y(e,t){return(t=l.resolve(t))===e||e.startsWith(t+l.sep)}t.extract=function(e,t){e||(e="."),t||(t={});var i=t.fs||a,n=t.ignore||t.filter||u,o=t.map||u,b=t.mapStream||h,S=!1!==t.chown&&!c&&0===(process.getuid?process.getuid():-1),_=t.extract||r.extract(),C=[],w=new Date,E="number"==typeof t.umask?~t.umask:~g(),T="number"==typeof t.dmode?t.dmode:0,k="number"==typeof t.fmode?t.fmode:0,R=!1!==t.strict;t.strip&&(o=f(o,t.strip)),t.readable&&(T|=parseInt(555,8),k|=parseInt(444,8)),t.writable&&(T|=parseInt(333,8),k|=parseInt(222,8));var O=function(e,t){for(var n;(n=p(C))&&e.slice(0,n[0].length)!==n[0];)C.pop();if(!n)return t();i.utimes(n[0],w,n[1],t)};return _.on("entry",function(r,a,u){(r=o(r)||r).name=d(r.name);var h=l.join(e,l.join("/",r.name));if(n(h,r))return a.resume(),u();var f=function(e){if(e)return u(e);!function(e,n,r){!1===t.utimes?r():"directory"===n.type?i.utimes(e,w,n.mtime,r):"symlink"===n.type?O(e,r):i.utimes(e,w,n.mtime,function(t){if(t)return r(t);O(e,r)})}(h,r,function(e){return e?u(e):c?u():void function(e,t,n){var r="symlink"===t.type,s=r?i.lchmod:i.chmod,o=r?i.lchown:i.chown;if(!s)return n();var a=(t.mode|("directory"===t.type?T:k))&E;function l(t){return t?n(t):s?void s.call(i,e,a,n):n()}o&&S?o.call(i,e,t.uid,t.gid,l):l(null)}(h,r,u)})},p=function(){var e=i.createWriteStream(h),t=b(a,r);e.on("error",function(e){t.destroy(e)}),s(t,e,function(t){if(t)return u(t);e.on("close",f)})};if("directory"===r.type)return C.push([h,r.mtime]),v(h,{fs:i,own:S,uid:r.uid,gid:r.gid},f);var g=l.dirname(h);m(i,g,l.join(e,"."),function(n,s){return n?u(n):s?void v(g,{fs:i,own:S,uid:r.uid,gid:r.gid},function(n){if(n)return u(n);switch(r.type){case"file":return p();case"link":return function(){if(c)return u();i.unlink(h,function(){var n=l.join(e,l.join("/",r.linkname));i.realpath(n,function(r,s){if(r||!y(s,e))return u(new Error(h+" is not a valid hardlink"));i.link(s,h,function(e){if(e&&"EPERM"===e.code&&t.hardlinkAsFilesFallback)return a=i.createReadStream(n),p();f(e)})})})}();case"symlink":return function(){if(c)return u();i.unlink(h,function(){if(!y(l.resolve(l.dirname(h),r.linkname),e))return u(new Error(h+" is not a valid symlink"));i.symlink(r.linkname,h,f)})}()}if(R)return u(new Error("unsupported type for "+h+" ("+r.type+")"));a.resume(),u()}):u(new Error(g+" is not a valid path"))})}),t.finish&&_.on("finish",t.finish),_}},5518(e,t,i){"use strict";const{Buffer:n}=i(181),r=Symbol.for("BufferList");function s(e){if(!(this instanceof s))return new s(e);s._init.call(this,e)}s._init=function(e){Object.defineProperty(this,r,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},s.prototype._new=function(e){return new s(e)},s.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let i=0;i<this._bufs.length;i++){const n=t+this._bufs[i].length;if(e<n||i===this._bufs.length-1)return[i,e-t];t=n}},s.prototype._reverseOffset=function(e){const t=e[0];let i=e[1];for(let e=0;e<t;e++)i+=this._bufs[e].length;return i},s.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},s.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},s.prototype.copy=function(e,t,i,r){if(("number"!=typeof i||i<0)&&(i=0),("number"!=typeof r||r>this.length)&&(r=this.length),i>=this.length)return e||n.alloc(0);if(r<=0)return e||n.alloc(0);const s=!!e,o=this._offset(i),a=r-i;let l=a,c=s&&t||0,u=o[1];if(0===i&&r===this.length){if(!s)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,c),c+=this._bufs[t].length;return e}if(l<=this._bufs[o[0]].length-u)return s?this._bufs[o[0]].copy(e,t,u,u+l):this._bufs[o[0]].slice(u,u+l);s||(e=n.allocUnsafe(a));for(let t=o[0];t<this._bufs.length;t++){const i=this._bufs[t].length-u;if(!(l>i)){this._bufs[t].copy(e,c,u,u+l),c+=i;break}this._bufs[t].copy(e,c,u),c+=i,l-=i,u&&(u=0)}return e.length>c?e.slice(0,c):e},s.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const i=this._offset(e),n=this._offset(t),r=this._bufs.slice(i[0],n[0]+1);return 0===n[1]?r.pop():r[r.length-1]=r[r.length-1].slice(0,n[1]),0!==i[1]&&(r[0]=r[0].slice(i[1])),this._new(r)},s.prototype.toString=function(e,t,i){return this.slice(t,i).toString(e)},s.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},s.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(n.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(n.from(e));return this},s.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},s.prototype.indexOf=function(e,t,i){if(void 0===i&&"string"==typeof t&&(i=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=n.from([e]):"string"==typeof e?e=n.from(e,i):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=n.from(e.buffer,e.byteOffset,e.byteLength):n.isBuffer(e)||(e=n.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const r=this._offset(t);let s=r[0],o=r[1];for(;s<this._bufs.length;s++){const t=this._bufs[s];for(;o<t.length;){if(t.length-o>=e.length){const i=t.indexOf(e,o);if(-1!==i)return this._reverseOffset([s,i]);o=t.length-e.length+1}else{const t=this._reverseOffset([s,o]);if(this._match(t,e))return t;o++}}o=0}return-1},s.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let i=0;i<t.length;i++)if(this.get(e+i)!==t[i])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)(function(t){s.prototype[t]=null===e[t]?function(e,i){return this.slice(e,e+i)[t](0,i)}:function(i=0){return this.slice(i,i+e[t])[t](0)}})(t)}(),s.prototype._isBufferList=function(e){return e instanceof s||s.isBufferList(e)},s.isBufferList=function(e){return null!=e&&e[r]},e.exports=s},5278(e,t,i){"use strict";const n=i(4198).Duplex,r=i(2017),s=i(5518);function o(e){if(!(this instanceof o))return new o(e);if("function"==typeof e){this._callback=e;const t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(e){e.on("error",t)}),this.on("unpipe",function(e){e.removeListener("error",t)}),e=null}s._init.call(this,e),n.call(this)}r(o,n),Object.assign(o.prototype,s.prototype),o.prototype._new=function(e){return new o(e)},o.prototype._write=function(e,t,i){this._appendBuffer(e),"function"==typeof i&&i()},o.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},o.prototype.end=function(e){n.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},o.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},o.prototype._isBufferList=function(e){return e instanceof o||e instanceof s||o.isBufferList(e)},o.isBufferList=s.isBufferList,e.exports=o,e.exports.BufferListStream=o,e.exports.BufferList=s},6284(e,t,i){"use strict";const n=i(9896),r=i(6928),s=n.lchown?"lchown":"chown",o=n.lchownSync?"lchownSync":"chownSync",a=n.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),l=(e,t,i)=>{try{return n[o](e,t,i)}catch(e){if("ENOENT"!==e.code)throw e}},c=a?(e,t,i,r)=>s=>{s&&"EISDIR"===s.code?n.chown(e,t,i,r):r(s)}:(e,t,i,n)=>n,u=a?(e,t,i)=>{try{return l(e,t,i)}catch(r){if("EISDIR"!==r.code)throw r;((e,t,i)=>{try{return n.chownSync(e,t,i)}catch(e){if("ENOENT"!==e.code)throw e}})(e,t,i)}}:(e,t,i)=>l(e,t,i),h=process.version;let d=(e,t,i)=>n.readdir(e,t,i);/^v4\./.test(h)&&(d=(e,t,i)=>n.readdir(e,i));const f=(e,t,i,r)=>{n[s](e,t,i,c(e,t,i,e=>{r(e&&"ENOENT"!==e.code?e:null)}))},p=(e,t,i,s,o)=>{if("string"==typeof t)return n.lstat(r.resolve(e,t),(n,r)=>{if(n)return o("ENOENT"!==n.code?n:null);r.name=t,p(e,r,i,s,o)});if(t.isDirectory())g(r.resolve(e,t.name),i,s,n=>{if(n)return o(n);const a=r.resolve(e,t.name);f(a,i,s,o)});else{const n=r.resolve(e,t.name);f(n,i,s,o)}},g=(e,t,i,n)=>{d(e,{withFileTypes:!0},(r,s)=>{if(r){if("ENOENT"===r.code)return n();if("ENOTDIR"!==r.code&&"ENOTSUP"!==r.code)return n(r)}if(r||!s.length)return f(e,t,i,n);let o=s.length,a=null;const l=r=>{if(!a)return r?n(a=r):0===--o?f(e,t,i,n):void 0};s.forEach(n=>p(e,n,t,i,l))})},m=(e,t,i)=>{let s;try{s=((e,t)=>n.readdirSync(e,t))(e,{withFileTypes:!0})}catch(n){if("ENOENT"===n.code)return;if("ENOTDIR"===n.code||"ENOTSUP"===n.code)return u(e,t,i);throw n}return s&&s.length&&s.forEach(s=>((e,t,i,s)=>{if("string"==typeof t)try{const i=n.lstatSync(r.resolve(e,t));i.name=t,t=i}catch(e){if("ENOENT"===e.code)return;throw e}t.isDirectory()&&m(r.resolve(e,t.name),i,s),u(r.resolve(e,t.name),i,s)})(e,s,t,i)),u(e,t,i)};e.exports=g,g.sync=m},3807(e,t,i){var n=i(9023),r=i(5278),s=i(3544),o=i(4198).Writable,a=i(4198).PassThrough,l=function(){},c=function(e){return(e&=511)&&512-e},u=function(e,t){this._parent=e,this.offset=t,a.call(this,{autoDestroy:!1})};n.inherits(u,a),u.prototype.destroy=function(e){this._parent.destroy(e)};var h=function(e){if(!(this instanceof h))return new h(e);o.call(this,e),e=e||{},this._offset=0,this._buffer=r(),this._missing=0,this._partial=!1,this._onparse=l,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var t=this,i=t._buffer,n=function(){t._continue()},a=function(e){if(t._locked=!1,e)return t.destroy(e);t._stream||n()},d=function(){t._stream=null;var e=c(t._header.size);e?t._parse(e,f):t._parse(512,y),t._locked||n()},f=function(){t._buffer.consume(c(t._header.size)),t._parse(512,y),n()},p=function(){var e=t._header.size;t._paxGlobal=s.decodePax(i.slice(0,e)),i.consume(e),d()},g=function(){var e=t._header.size;t._pax=s.decodePax(i.slice(0,e)),t._paxGlobal&&(t._pax=Object.assign({},t._paxGlobal,t._pax)),i.consume(e),d()},m=function(){var n=t._header.size;this._gnuLongPath=s.decodeLongPath(i.slice(0,n),e.filenameEncoding),i.consume(n),d()},v=function(){var n=t._header.size;this._gnuLongLinkPath=s.decodeLongPath(i.slice(0,n),e.filenameEncoding),i.consume(n),d()},y=function(){var r,o=t._offset;try{r=t._header=s.decode(i.slice(0,512),e.filenameEncoding,e.allowUnknownFormat)}catch(e){t.emit("error",e)}return i.consume(512),r?"gnu-long-path"===r.type?(t._parse(r.size,m),void n()):"gnu-long-link-path"===r.type?(t._parse(r.size,v),void n()):"pax-global-header"===r.type?(t._parse(r.size,p),void n()):"pax-header"===r.type?(t._parse(r.size,g),void n()):(t._gnuLongPath&&(r.name=t._gnuLongPath,t._gnuLongPath=null),t._gnuLongLinkPath&&(r.linkname=t._gnuLongLinkPath,t._gnuLongLinkPath=null),t._pax&&(t._header=r=function(e,t){return t.path&&(e.name=t.path),t.linkpath&&(e.linkname=t.linkpath),t.size&&(e.size=parseInt(t.size,10)),e.pax=t,e}(r,t._pax),t._pax=null),t._locked=!0,r.size&&"directory"!==r.type?(t._stream=new u(t,o),t.emit("entry",r,t._stream,a),t._parse(r.size,d),void n()):(t._parse(512,y),void t.emit("entry",r,function(e,t){var i=new u(e,t);return i.end(),i}(t,o),a))):(t._parse(512,y),void n())};this._onheader=y,this._parse(512,y)};n.inherits(h,o),h.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.emit("close"))},h.prototype._parse=function(e,t){this._destroyed||(this._offset+=e,this._missing=e,t===this._onheader&&(this._partial=!1),this._onparse=t)},h.prototype._continue=function(){if(!this._destroyed){var e=this._cb;this._cb=l,this._overflow?this._write(this._overflow,void 0,e):e()}},h.prototype._write=function(e,t,i){if(!this._destroyed){var n=this._stream,r=this._buffer,s=this._missing;if(e.length&&(this._partial=!0),e.length<s)return this._missing-=e.length,this._overflow=null,n?n.write(e,i):(r.append(e),i());this._cb=i,this._missing=0;var o=null;e.length>s&&(o=e.slice(s),e=e.slice(0,s)),n?n.end(e):r.append(e),this._overflow=o,this._onparse()}},h.prototype._final=function(e){if(this._partial)return this.destroy(new Error("Unexpected end of data"));e()},e.exports=h},3544(e,t){var i=Buffer.alloc,n="0".charCodeAt(0),r=Buffer.from("ustar\0","binary"),s=Buffer.from("00","binary"),o=Buffer.from("ustar ","binary"),a=Buffer.from(" \0","binary"),l=parseInt("7777",8),c=257,u=function(e,t,i,n){for(;i<n;i++)if(e[i]===t)return i;return n},h=function(e){for(var t=256,i=0;i<148;i++)t+=e[i];for(var n=156;n<512;n++)t+=e[n];return t},d=function(e,t){return(e=e.toString(8)).length>t?"7777777777777777777".slice(0,t)+" ":"0000000000000000000".slice(0,t-e.length)+e+" "};var f=function(e,t,i){if(128&(e=e.slice(t,t+i))[t=0])return function(e){var t;if(128===e[0])t=!0;else{if(255!==e[0])return null;t=!1}for(var i=[],n=e.length-1;n>0;n--){var r=e[n];t?i.push(r):i.push(255-r)}var s=0,o=i.length;for(n=0;n<o;n++)s+=i[n]*Math.pow(256,n);return t?s:-1*s}(e);for(;t<e.length&&32===e[t];)t++;for(var n=(r=u(e,32,t,e.length),s=e.length,o=e.length,"number"!=typeof r?o:(r=~~r)>=s?s:r>=0||(r+=s)>=0?r:0);t<n&&0===e[t];)t++;return n===t?0:parseInt(e.slice(t,n).toString(),8);var r,s,o},p=function(e,t,i,n){return e.slice(t,u(e,0,t,t+i)).toString(n)},g=function(e){var t=Buffer.byteLength(e),i=Math.floor(Math.log(t)/Math.log(10))+1;return t+i>=Math.pow(10,i)&&i++,t+i+e};t.decodeLongPath=function(e,t){return p(e,0,e.length,t)},t.encodePax=function(e){var t="";e.name&&(t+=g(" path="+e.name+"\n")),e.linkname&&(t+=g(" linkpath="+e.linkname+"\n"));var i=e.pax;if(i)for(var n in i)t+=g(" "+n+"="+i[n]+"\n");return Buffer.from(t)},t.decodePax=function(e){for(var t={};e.length;){for(var i=0;i<e.length&&32!==e[i];)i++;var n=parseInt(e.slice(0,i).toString(),10);if(!n)return t;var r=e.slice(i+1,n-1).toString(),s=r.indexOf("=");if(-1===s)return t;t[r.slice(0,s)]=r.slice(s+1),e=e.slice(n)}return t},t.encode=function(e){var t=i(512),o=e.name,a="";if(5===e.typeflag&&"/"!==o[o.length-1]&&(o+="/"),Buffer.byteLength(o)!==o.length)return null;for(;Buffer.byteLength(o)>100;){var u=o.indexOf("/");if(-1===u)return null;a+=a?"/"+o.slice(0,u):o.slice(0,u),o=o.slice(u+1)}return Buffer.byteLength(o)>100||Buffer.byteLength(a)>155||e.linkname&&Buffer.byteLength(e.linkname)>100?null:(t.write(o),t.write(d(e.mode&l,6),100),t.write(d(e.uid,6),108),t.write(d(e.gid,6),116),t.write(d(e.size,11),124),t.write(d(e.mtime.getTime()/1e3|0,11),136),t[156]=n+function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}(e.type),e.linkname&&t.write(e.linkname,157),r.copy(t,c),s.copy(t,263),e.uname&&t.write(e.uname,265),e.gname&&t.write(e.gname,297),t.write(d(e.devmajor||0,6),329),t.write(d(e.devminor||0,6),337),a&&t.write(a,345),t.write(d(h(t),6),148),t)},t.decode=function(e,t,i){var s=0===e[156]?0:e[156]-n,l=p(e,0,100,t),u=f(e,100,8),d=f(e,108,8),g=f(e,116,8),m=f(e,124,12),v=f(e,136,12),y=function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}(s),b=0===e[157]?null:p(e,157,100,t),S=p(e,265,32),_=p(e,297,32),C=f(e,329,8),w=f(e,337,8),E=h(e);if(256===E)return null;if(E!==f(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(0===r.compare(e,c,263))e[345]&&(l=p(e,345,155,t)+"/"+l);else if(0===o.compare(e,c,263)&&0===a.compare(e,263,265));else if(!i)throw new Error("Invalid tar header: unknown format.");return 0===s&&l&&"/"===l[l.length-1]&&(s=5),{name:l,mode:u,uid:d,gid:g,size:m,mtime:new Date(1e3*v),type:y,linkname:b,uname:S,gname:_,devmajor:C,devminor:w}}},6706(e,t,i){t.extract=i(3807),t.pack=i(4009)},4009(e,t,i){var n=i(2170),r=i(6611),s=i(2017),o=Buffer.alloc,a=i(4198).Readable,l=i(4198).Writable,c=i(3193).StringDecoder,u=i(3544),h=parseInt("755",8),d=parseInt("644",8),f=o(1024),p=function(){},g=function(e,t){(t&=511)&&e.push(f.slice(0,512-t))};var m=function(e){l.call(this),this.written=0,this._to=e,this._destroyed=!1};s(m,l),m.prototype._write=function(e,t,i){if(this.written+=e.length,this._to.push(e))return i();this._to._drain=i},m.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var v=function(){l.call(this),this.linkname="",this._decoder=new c("utf-8"),this._destroyed=!1};s(v,l),v.prototype._write=function(e,t,i){this.linkname+=this._decoder.write(e),i()},v.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var y=function(){l.call(this),this._destroyed=!1};s(y,l),y.prototype._write=function(e,t,i){i(new Error("No body allowed for this entry"))},y.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var b=function(e){if(!(this instanceof b))return new b(e);a.call(this,e),this._drain=p,this._finalized=!1,this._finalizing=!1,this._destroyed=!1,this._stream=null};s(b,a),b.prototype.entry=function(e,t,i){if(this._stream)throw new Error("already piping an entry");if(!this._finalized&&!this._destroyed){"function"==typeof t&&(i=t,t=null),i||(i=p);var s=this;if(e.size&&"symlink"!==e.type||(e.size=0),e.type||(e.type=function(e){switch(e&n.S_IFMT){case n.S_IFBLK:return"block-device";case n.S_IFCHR:return"character-device";case n.S_IFDIR:return"directory";case n.S_IFIFO:return"fifo";case n.S_IFLNK:return"symlink"}return"file"}(e.mode)),e.mode||(e.mode="directory"===e.type?h:d),e.uid||(e.uid=0),e.gid||(e.gid=0),e.mtime||(e.mtime=new Date),"string"==typeof t&&(t=Buffer.from(t)),Buffer.isBuffer(t)){e.size=t.length,this._encode(e);var o=this.push(t);return g(s,e.size),o?process.nextTick(i):this._drain=i,new y}if("symlink"===e.type&&!e.linkname){var a=new v;return r(a,function(t){if(t)return s.destroy(),i(t);e.linkname=a.linkname,s._encode(e),i()}),a}if(this._encode(e),"file"!==e.type&&"contiguous-file"!==e.type)return process.nextTick(i),new y;var l=new m(this);return this._stream=l,r(l,function(t){return s._stream=null,t?(s.destroy(),i(t)):l.written!==e.size?(s.destroy(),i(new Error("size mismatch"))):(g(s,e.size),s._finalizing&&s.finalize(),void i())}),l}},b.prototype.finalize=function(){this._stream?this._finalizing=!0:this._finalized||(this._finalized=!0,this.push(f),this.push(null))},b.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.destroy&&this._stream.destroy())},b.prototype._encode=function(e){if(!e.pax){var t=u.encode(e);if(t)return void this.push(t)}this._encodePax(e)},b.prototype._encodePax=function(e){var t=u.encodePax({name:e.name,linkname:e.linkname,pax:e.pax}),i={name:"PaxHeader",mode:e.mode,uid:e.uid,gid:e.gid,size:t.length,mtime:e.mtime,type:"pax-header",linkname:e.linkname&&"PaxHeader",uname:e.uname,gname:e.gname,devmajor:e.devmajor,devminor:e.devminor};this.push(u.encode(i)),this.push(t),g(this,t.length),i.size=e.size,i.type=e.type,this.push(u.encode(i))},b.prototype._read=function(e){var t=this._drain;this._drain=p,t()},e.exports=b},7983(e,t,i){e.exports=i(9023).deprecate},4679(e,t,i){"use strict";i.d(t,{v4:()=>h});const n=require("node:crypto");var r=i.n(n);const s={randomUUID:r().randomUUID},o=new Uint8Array(256);let a=o.length;function l(){return a>o.length-16&&(r().randomFillSync(o),a=0),o.slice(a,a+=16)}const c=[];for(let e=0;e<256;++e)c.push((e+256).toString(16).slice(1));function u(e,t=0){return(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase()}const h=function(e,t,i){if(s.randomUUID&&!t&&!e)return s.randomUUID();const n=(e=e||{}).random||(e.rng||l)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(let e=0;e<16;++e)t[i+e]=n[e];return t}return u(n)}},6587(e){e.exports=function e(t,i){if(t&&i)return e(t)(i);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(e){n[e]=t[e]}),n;function n(){for(var e=new Array(arguments.length),i=0;i<e.length;i++)e[i]=arguments[i];var n=t.apply(this,e),r=e[e.length-1];return"function"==typeof n&&n!==r&&Object.keys(r).forEach(function(e){n[e]=r[e]}),n}}},6087(e){"use strict";e.exports=require("@xiaobaidadada/node-pty-prebuilt")},2710(e){"use strict";e.exports=require("@xiaobaidadada/node-tuntap2-wintun")},1217(e){"use strict";e.exports=require("@xiaobaidadada/ssh2-prebuilt")},7550(e){"use strict";e.exports=require("better-sqlite3")},9642(e){"use strict";e.exports=require("better-sqlite3/build/Release/better_sqlite3.node")},4505(e){"use strict";e.exports=require("node-process-watcher")},181(e){"use strict";e.exports=require("buffer")},9140(e){"use strict";e.exports=require("constants")},2250(e){"use strict";e.exports=require("dns")},4434(e){"use strict";e.exports=require("events")},9896(e){"use strict";e.exports=require("fs")},8611(e){"use strict";e.exports=require("http")},5675(e){"use strict";e.exports=require("http2")},5692(e){"use strict";e.exports=require("https")},9278(e){"use strict";e.exports=require("net")},857(e){"use strict";e.exports=require("os")},6928(e){"use strict";e.exports=require("path")},932(e){"use strict";e.exports=require("process")},3480(e){"use strict";e.exports=require("querystring")},2203(e){"use strict";e.exports=require("stream")},3193(e){"use strict";e.exports=require("string_decoder")},4756(e){"use strict";e.exports=require("tls")},7016(e){"use strict";e.exports=require("url")},9023(e){"use strict";e.exports=require("util")},8167(e){"use strict";e.exports=require("worker_threads")},3106(e){"use strict";e.exports=require("zlib")},5017(e,t){var i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,i=function(){var e={};return function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function i(e,t,i){this.low=0|e,this.high=0|t,this.unsigned=!!i}function n(e){return!0===(e&&e.__isLong__)}function r(e){var t=Math.clz32(e&-e);return e?31-t:t}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),i.isLong=n;var s={},o={};function a(e,t){var i,n,r;return t?(r=0<=(e>>>=0)&&e<256)&&(n=o[e])?n:(i=c(e,0,!0),r&&(o[e]=i),i):(r=-128<=(e|=0)&&e<128)&&(n=s[e])?n:(i=c(e,e<0?-1:0,!1),r&&(s[e]=i),i)}function l(e,t){if(isNaN(e))return t?b:y;if(t){if(e<0)return b;if(e>=g)return E}else{if(e<=-m)return T;if(e+1>=m)return w}return e<0?l(-e,t).neg():c(e%p|0,e/p|0,t)}function c(e,t,n){return new i(e,t,n)}i.fromInt=a,i.fromNumber=l,i.fromBits=c;var u=Math.pow;function h(e,t,i){if(0===e.length)throw Error("empty string");if("number"==typeof t?(i=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?b:y;if((i=i||10)<2||36<i)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return h(e.substring(1),t,i).neg();for(var r=l(u(i,8)),s=y,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+a),i);if(a<8){var d=l(u(i,a));s=s.mul(d).add(l(c))}else s=(s=s.mul(r)).add(l(c))}return s.unsigned=t,s}function d(e,t){return"number"==typeof e?l(e,t):"string"==typeof e?h(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}i.fromString=h,i.fromValue=d;var f=65536,p=f*f,g=p*p,m=g/2,v=a(1<<24),y=a(0);i.ZERO=y;var b=a(0,!0);i.UZERO=b;var S=a(1);i.ONE=S;var _=a(1,!0);i.UONE=_;var C=a(-1);i.NEG_ONE=C;var w=c(-1,2147483647,!1);i.MAX_VALUE=w;var E=c(-1,-1,!0);i.MAX_UNSIGNED_VALUE=E;var T=c(0,-2147483648,!1);i.MIN_VALUE=T;var k=i.prototype;k.toInt=function(){return this.unsigned?this.low>>>0:this.low},k.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},k.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(T)){var t=l(e),i=this.div(t),n=i.mul(t).sub(this);return i.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var r=l(u(e,6),this.unsigned),s=this,o="";;){var a=s.div(r),c=(s.sub(a.mul(r)).toInt()>>>0).toString(e);if((s=a).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},k.getHighBits=function(){return this.high},k.getHighBitsUnsigned=function(){return this.high>>>0},k.getLowBits=function(){return this.low},k.getLowBitsUnsigned=function(){return this.low>>>0},k.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},k.isSafeInteger=function(){var e=this.high>>21;return!e||!this.unsigned&&-1===e&&!(0===this.low&&-2097152===this.high)},k.isZero=function(){return 0===this.high&&0===this.low},k.eqz=k.isZero,k.isNegative=function(){return!this.unsigned&&this.high<0},k.isPositive=function(){return this.unsigned||this.high>=0},k.isOdd=function(){return!(1&~this.low)},k.isEven=function(){return!(1&this.low)},k.equals=function(e){return n(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},k.eq=k.equals,k.notEquals=function(e){return!this.eq(e)},k.neq=k.notEquals,k.ne=k.notEquals,k.lessThan=function(e){return this.comp(e)<0},k.lt=k.lessThan,k.lessThanOrEqual=function(e){return this.comp(e)<=0},k.lte=k.lessThanOrEqual,k.le=k.lessThanOrEqual,k.greaterThan=function(e){return this.comp(e)>0},k.gt=k.greaterThan,k.greaterThanOrEqual=function(e){return this.comp(e)>=0},k.gte=k.greaterThanOrEqual,k.ge=k.greaterThanOrEqual,k.compare=function(e){if(n(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),i=e.isNegative();return t&&!i?-1:!t&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},k.comp=k.compare,k.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(S)},k.neg=k.negate,k.add=function(e){n(e)||(e=d(e));var t=this.high>>>16,i=65535&this.high,r=this.low>>>16,s=65535&this.low,o=e.high>>>16,a=65535&e.high,l=e.low>>>16,u=0,h=0,f=0,p=0;return f+=(p+=s+(65535&e.low))>>>16,h+=(f+=r+l)>>>16,u+=(h+=i+a)>>>16,u+=t+o,c((f&=65535)<<16|(p&=65535),(u&=65535)<<16|(h&=65535),this.unsigned)},k.subtract=function(e){return n(e)||(e=d(e)),this.add(e.neg())},k.sub=k.subtract,k.multiply=function(e){if(this.isZero())return this;if(n(e)||(e=d(e)),t)return c(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return this.unsigned?b:y;if(this.eq(T))return e.isOdd()?T:y;if(e.eq(T))return this.isOdd()?T:y;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(v)&&e.lt(v))return l(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,r=65535&this.high,s=this.low>>>16,o=65535&this.low,a=e.high>>>16,u=65535&e.high,h=e.low>>>16,f=65535&e.low,p=0,g=0,m=0,S=0;return m+=(S+=o*f)>>>16,g+=(m+=s*f)>>>16,m&=65535,g+=(m+=o*h)>>>16,p+=(g+=r*f)>>>16,g&=65535,p+=(g+=s*h)>>>16,g&=65535,p+=(g+=o*u)>>>16,p+=i*f+r*h+s*u+o*a,c((m&=65535)<<16|(S&=65535),(p&=65535)<<16|(g&=65535),this.unsigned)},k.mul=k.multiply,k.divide=function(e){if(n(e)||(e=d(e)),e.isZero())throw Error("division by zero");var i,r,s;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?b:y;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return b;if(e.gt(this.shru(1)))return _;s=b}else{if(this.eq(T))return e.eq(S)||e.eq(C)?T:e.eq(T)?S:(i=this.shr(1).div(e).shl(1)).eq(y)?e.isNegative()?S:C:(r=this.sub(e.mul(i)),s=i.add(r.div(e)));if(e.eq(T))return this.unsigned?b:y;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=y}for(r=this;r.gte(e);){i=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(i)/Math.LN2),a=o<=48?1:u(2,o-48),h=l(i),f=h.mul(e);f.isNegative()||f.gt(r);)f=(h=l(i-=a,this.unsigned)).mul(e);h.isZero()&&(h=S),s=s.add(h),r=r.sub(f)}return s},k.div=k.divide,k.modulo=function(e){return n(e)||(e=d(e)),t?c((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},k.mod=k.modulo,k.rem=k.modulo,k.not=function(){return c(~this.low,~this.high,this.unsigned)},k.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},k.clz=k.countLeadingZeros,k.countTrailingZeros=function(){return this.low?r(this.low):r(this.high)+32},k.ctz=k.countTrailingZeros,k.and=function(e){return n(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},k.or=function(e){return n(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},k.xor=function(e){return n(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},k.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},k.shl=k.shiftLeft,k.shiftRight=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},k.shr=k.shiftRight,k.shiftRightUnsigned=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):c(32===e?this.high:this.high>>>e-32,0,this.unsigned)},k.shru=k.shiftRightUnsigned,k.shr_u=k.shiftRightUnsigned,k.rotateLeft=function(e){var t;return n(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?c(this.high,this.low,this.unsigned):e<32?(t=32-e,c(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),c(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},k.rotl=k.rotateLeft,k.rotateRight=function(e){var t;return n(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?c(this.high,this.low,this.unsigned):e<32?(t=32-e,c(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),c(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},k.rotr=k.rotateRight,k.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},k.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},k.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},k.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},k.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},i.fromBytes=function(e,t,n){return n?i.fromBytesLE(e,t):i.fromBytesBE(e,t)},i.fromBytesLE=function(e,t){return new i(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},i.fromBytesBE=function(e,t){return new i(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)},"function"==typeof BigInt&&(i.fromBigInt=function(e,t){return c(Number(BigInt.asIntN(32,e)),Number(BigInt.asIntN(32,e>>BigInt(32))),t)},i.fromValue=function(e,t){return"bigint"==typeof e?i.fromBigInt(e,t):d(e,t)},k.toBigInt=function(){var e=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|e}),e.default=i}(e),function(e){return e.default||e}(e)}.apply(t,[]),void 0===i||(e.exports=i)},9943(e){"use strict";e.exports={rE:"1.14.3"}},5434(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"Api":{"fields":{"name":{"type":"string","id":1},"methods":{"rule":"repeated","type":"Method","id":2},"options":{"rule":"repeated","type":"Option","id":3},"version":{"type":"string","id":4},"sourceContext":{"type":"SourceContext","id":5},"mixins":{"rule":"repeated","type":"Mixin","id":6},"syntax":{"type":"Syntax","id":7}}},"Method":{"fields":{"name":{"type":"string","id":1},"requestTypeUrl":{"type":"string","id":2},"requestStreaming":{"type":"bool","id":3},"responseTypeUrl":{"type":"string","id":4},"responseStreaming":{"type":"bool","id":5},"options":{"rule":"repeated","type":"Option","id":6},"syntax":{"type":"Syntax","id":7}}},"Mixin":{"fields":{"name":{"type":"string","id":1},"root":{"type":"string","id":2}}},"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}},"Option":{"fields":{"name":{"type":"string","id":1},"value":{"type":"Any","id":2}}},"Syntax":{"values":{"SYNTAX_PROTO2":0,"SYNTAX_PROTO3":1}}}}}}}}')},3951(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"options":{"go_package":"google.golang.org/protobuf/types/descriptorpb","java_package":"com.google.protobuf","java_outer_classname":"DescriptorProtos","csharp_namespace":"Google.Protobuf.Reflection","objc_class_prefix":"GPB","cc_enable_arenas":true,"optimize_for":"SPEED"},"nested":{"FileDescriptorSet":{"edition":"proto2","fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}},"extensions":[[536000000,536000000]]},"Edition":{"edition":"proto2","values":{"EDITION_UNKNOWN":0,"EDITION_LEGACY":900,"EDITION_PROTO2":998,"EDITION_PROTO3":999,"EDITION_2023":1000,"EDITION_2024":1001,"EDITION_1_TEST_ONLY":1,"EDITION_2_TEST_ONLY":2,"EDITION_99997_TEST_ONLY":99997,"EDITION_99998_TEST_ONLY":99998,"EDITION_99999_TEST_ONLY":99999,"EDITION_MAX":2147483647}},"FileDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10},"weakDependency":{"rule":"repeated","type":"int32","id":11},"optionDependency":{"rule":"repeated","type":"string","id":15},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12},"edition":{"type":"Edition","id":14}}},"DescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10},"visibility":{"type":"SymbolVisibility","id":11}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2},"options":{"type":"ExtensionRangeOptions","id":3}}},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"ExtensionRangeOptions":{"edition":"proto2","fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999},"declaration":{"rule":"repeated","type":"Declaration","id":2,"options":{"retention":"RETENTION_SOURCE"}},"features":{"type":"FeatureSet","id":50},"verification":{"type":"VerificationState","id":3,"options":{"default":"UNVERIFIED","retention":"RETENTION_SOURCE"}}},"extensions":[[1000,536870911]],"nested":{"Declaration":{"fields":{"number":{"type":"int32","id":1},"fullName":{"type":"string","id":2},"type":{"type":"string","id":3},"reserved":{"type":"bool","id":5},"repeated":{"type":"bool","id":6}},"reserved":[[4,4]]},"VerificationState":{"values":{"DECLARATION":0,"UNVERIFIED":1}}}},"FieldDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8},"proto3Optional":{"type":"bool","id":17}},"nested":{"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REPEATED":3,"LABEL_REQUIRED":2}}}},"OneofDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}}},"EnumDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3},"reservedRange":{"rule":"repeated","type":"EnumReservedRange","id":4},"reservedName":{"rule":"repeated","type":"string","id":5},"visibility":{"type":"SymbolVisibility","id":6}},"nested":{"EnumReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"EnumValueDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}}},"ServiceDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}}},"MethodDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5},"serverStreaming":{"type":"bool","id":6}}},"FileOptions":{"edition":"proto2","fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16},"javaGenericServices":{"type":"bool","id":17},"pyGenericServices":{"type":"bool","id":18},"deprecated":{"type":"bool","id":23},"ccEnableArenas":{"type":"bool","id":31,"options":{"default":true}},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"swiftPrefix":{"type":"string","id":39},"phpClassPrefix":{"type":"string","id":40},"phpNamespace":{"type":"string","id":41},"phpMetadataNamespace":{"type":"string","id":44},"rubyPackage":{"type":"string","id":45},"features":{"type":"FeatureSet","id":50},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[42,42],[38,38],"php_generic_services"],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3}}}},"MessageOptions":{"edition":"proto2","fields":{"messageSetWireFormat":{"type":"bool","id":1},"noStandardDescriptorAccessor":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"mapEntry":{"type":"bool","id":7},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":11,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":12},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[5,5],[6,6],[8,8],[9,9]]},"FieldOptions":{"edition":"proto2","fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5},"unverifiedLazy":{"type":"bool","id":15},"deprecated":{"type":"bool","id":3},"weak":{"type":"bool","id":10,"options":{"deprecated":true}},"debugRedact":{"type":"bool","id":16},"retention":{"type":"OptionRetention","id":17},"targets":{"rule":"repeated","type":"OptionTargetType","id":19},"editionDefaults":{"rule":"repeated","type":"EditionDefault","id":20},"features":{"type":"FeatureSet","id":21},"featureSupport":{"type":"FeatureSupport","id":22},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[18,18]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2}},"OptionRetention":{"values":{"RETENTION_UNKNOWN":0,"RETENTION_RUNTIME":1,"RETENTION_SOURCE":2}},"OptionTargetType":{"values":{"TARGET_TYPE_UNKNOWN":0,"TARGET_TYPE_FILE":1,"TARGET_TYPE_EXTENSION_RANGE":2,"TARGET_TYPE_MESSAGE":3,"TARGET_TYPE_FIELD":4,"TARGET_TYPE_ONEOF":5,"TARGET_TYPE_ENUM":6,"TARGET_TYPE_ENUM_ENTRY":7,"TARGET_TYPE_SERVICE":8,"TARGET_TYPE_METHOD":9}},"EditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"value":{"type":"string","id":2}}},"FeatureSupport":{"fields":{"editionIntroduced":{"type":"Edition","id":1},"editionDeprecated":{"type":"Edition","id":2},"deprecationWarning":{"type":"string","id":3},"editionRemoved":{"type":"Edition","id":4}}}}},"OneofOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":1},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"EnumOptions":{"edition":"proto2","fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":6,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[5,5]]},"EnumValueOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":1},"features":{"type":"FeatureSet","id":2},"debugRedact":{"type":"bool","id":3},"featureSupport":{"type":"FieldOptions.FeatureSupport","id":4},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"ServiceOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":34},"deprecated":{"type":"bool","id":33},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"MethodOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":33},"idempotencyLevel":{"type":"IdempotencyLevel","id":34,"options":{"default":"IDEMPOTENCY_UNKNOWN"}},"features":{"type":"FeatureSet","id":35},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"nested":{"IdempotencyLevel":{"values":{"IDEMPOTENCY_UNKNOWN":0,"NO_SIDE_EFFECTS":1,"IDEMPOTENT":2}}}},"UninterpretedOption":{"edition":"proto2","fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}}}}},"FeatureSet":{"edition":"proto2","fields":{"fieldPresence":{"type":"FieldPresence","id":1,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},"enumType":{"type":"EnumType","id":2,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},"repeatedFieldEncoding":{"type":"RepeatedFieldEncoding","id":3,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},"utf8Validation":{"type":"Utf8Validation","id":4,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},"messageEncoding":{"type":"MessageEncoding","id":5,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},"jsonFormat":{"type":"JsonFormat","id":6,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},"enforceNamingStyle":{"type":"EnforceNamingStyle","id":7,"options":{"retention":"RETENTION_SOURCE","targets":"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},"defaultSymbolVisibility":{"type":"VisibilityFeature.DefaultSymbolVisibility","id":8,"options":{"retention":"RETENTION_SOURCE","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},"extensions":[[1000,9994],[9995,9999],[10000,10000]],"reserved":[[999,999]],"nested":{"FieldPresence":{"values":{"FIELD_PRESENCE_UNKNOWN":0,"EXPLICIT":1,"IMPLICIT":2,"LEGACY_REQUIRED":3}},"EnumType":{"values":{"ENUM_TYPE_UNKNOWN":0,"OPEN":1,"CLOSED":2}},"RepeatedFieldEncoding":{"values":{"REPEATED_FIELD_ENCODING_UNKNOWN":0,"PACKED":1,"EXPANDED":2}},"Utf8Validation":{"values":{"UTF8_VALIDATION_UNKNOWN":0,"VERIFY":2,"NONE":3}},"MessageEncoding":{"values":{"MESSAGE_ENCODING_UNKNOWN":0,"LENGTH_PREFIXED":1,"DELIMITED":2}},"JsonFormat":{"values":{"JSON_FORMAT_UNKNOWN":0,"ALLOW":1,"LEGACY_BEST_EFFORT":2}},"EnforceNamingStyle":{"values":{"ENFORCE_NAMING_STYLE_UNKNOWN":0,"STYLE2024":1,"STYLE_LEGACY":2}},"VisibilityFeature":{"fields":{},"reserved":[[1,536870911]],"nested":{"DefaultSymbolVisibility":{"values":{"DEFAULT_SYMBOL_VISIBILITY_UNKNOWN":0,"EXPORT_ALL":1,"EXPORT_TOP_LEVEL":2,"LOCAL_ALL":3,"STRICT":4}}}}}},"FeatureSetDefaults":{"edition":"proto2","fields":{"defaults":{"rule":"repeated","type":"FeatureSetEditionDefault","id":1},"minimumEdition":{"type":"Edition","id":4},"maximumEdition":{"type":"Edition","id":5}},"nested":{"FeatureSetEditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"overridableFeatures":{"type":"FeatureSet","id":4},"fixedFeatures":{"type":"FeatureSet","id":5}},"reserved":[[1,1],[2,2],"features"]}}},"SourceCodeInfo":{"edition":"proto2","fields":{"location":{"rule":"repeated","type":"Location","id":1}},"extensions":[[536000000,536000000]],"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"span":{"rule":"repeated","type":"int32","id":2,"options":{"packed":true}},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}}}}},"GeneratedCodeInfo":{"edition":"proto2","fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4},"semantic":{"type":"Semantic","id":5}},"nested":{"Semantic":{"values":{"NONE":0,"SET":1,"ALIAS":2}}}}}},"SymbolVisibility":{"edition":"proto2","values":{"VISIBILITY_UNSET":0,"VISIBILITY_LOCAL":1,"VISIBILITY_EXPORT":2}}}}}}}}')},2939(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}}}}}}}}')},6710(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"Type":{"fields":{"name":{"type":"string","id":1},"fields":{"rule":"repeated","type":"Field","id":2},"oneofs":{"rule":"repeated","type":"string","id":3},"options":{"rule":"repeated","type":"Option","id":4},"sourceContext":{"type":"SourceContext","id":5},"syntax":{"type":"Syntax","id":6}}},"Field":{"fields":{"kind":{"type":"Kind","id":1},"cardinality":{"type":"Cardinality","id":2},"number":{"type":"int32","id":3},"name":{"type":"string","id":4},"typeUrl":{"type":"string","id":6},"oneofIndex":{"type":"int32","id":7},"packed":{"type":"bool","id":8},"options":{"rule":"repeated","type":"Option","id":9},"jsonName":{"type":"string","id":10},"defaultValue":{"type":"string","id":11}},"nested":{"Kind":{"values":{"TYPE_UNKNOWN":0,"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Cardinality":{"values":{"CARDINALITY_UNKNOWN":0,"CARDINALITY_OPTIONAL":1,"CARDINALITY_REQUIRED":2,"CARDINALITY_REPEATED":3}}}},"Enum":{"fields":{"name":{"type":"string","id":1},"enumvalue":{"rule":"repeated","type":"EnumValue","id":2},"options":{"rule":"repeated","type":"Option","id":3},"sourceContext":{"type":"SourceContext","id":4},"syntax":{"type":"Syntax","id":5}}},"EnumValue":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"rule":"repeated","type":"Option","id":3}}},"Option":{"fields":{"name":{"type":"string","id":1},"value":{"type":"Any","id":2}}},"Syntax":{"values":{"SYNTAX_PROTO2":0,"SYNTAX_PROTO3":1}},"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}}},"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}}}}}}}}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var i=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(i.exports,i,i.exports,__webpack_require__),i.loaded=!0,i.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};(()=>{"use strict";const e=__webpack_require__(3285),t=__webpack_require__(3054);(0,e.file_search_start)(),(0,t.start_ai_agent_agent)()})()})();
|
|
2
|
+
(()=>{var __webpack_modules__={3054(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.start_ai_agent_agent=function(){(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_init,async e=>{const{index_storage_type:t,db_path:i}=e.data;w=t,"memory"===t&&(S||(S=new o.default.Index({tokenize:"strict"}),_=new o.default.Index({tokenize:"strict"}))),"sqlite"===t&&(C=new h(i,{nativeBinding:u}),C.exec("\n CREATE VIRTUAL TABLE IF NOT EXISTS docs USING fts5(\n file_path UNINDEXED,\n content,\n mtime UNINDEXED,\n tokenize = 'unicode61'\n );\n \n CREATE VIRTUAL TABLE IF NOT EXISTS doc_names USING fts5(\n file_path UNINDEXED,\n name,\n mtime UNINDEXED,\n tokenize = 'unicode61'\n );\n "),y=C.prepare("\n SELECT mtime FROM docs WHERE file_path = ? LIMIT 1\n "),b=C.prepare("\n SELECT mtime FROM doc_names WHERE file_path = ? LIMIT 1\n "),d=C.prepare("INSERT INTO docs (file_path, content, mtime) VALUES (?, ?, ?)"),f=C.prepare("INSERT INTO doc_names (file_path, name, mtime) VALUES (?, ?, ?)"),p=C.prepare("DELETE FROM docs WHERE file_path = ?"),g=C.prepare("DELETE FROM doc_names WHERE file_path = ?"),m=C.prepare("\n SELECT file_path\n FROM docs\n WHERE docs MATCH ?\n ORDER BY bm25(docs)\n LIMIT 50\n "),v=C.prepare("\n SELECT file_path\n FROM doc_names\n WHERE doc_names MATCH ?\n ORDER BY bm25(doc_names)\n LIMIT 50\n "))}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_add,async e=>{let t,i,{use_zh_segmentation:n,file_path:r,mtime:s}=e.data;if("sqlite"===w&&C){s=s??(await c.FileUtil.statSync(r)).mtime;const e=y.get(r);if(e&&e.mtime===s)return{char_num:0};t=`${r} ${(await c.FileUtil.readFileSync(r)).toString()}。`,i=t.length;let o=t,l=r;n&&(o=(0,a.cut)(t,!0).join(" "),l=(0,a.cut)(r,!0).join(" ")),p.run(r),g.run(r),d.run(r,o,s),f.run(r,l,s)}if("memory"===w){t=`${r} ${(await c.FileUtil.readFileSync(r)).toString()}。`,i=t.length;let e=t.toLowerCase(),s=r.toLowerCase();n&&(e=(0,a.cut)(t,!0).join(" ").toLowerCase(),s=(0,a.cut)(r,!0).join(" ").toLowerCase()),S?.add(r,e),_?.add(r,s)}return{char_num:i}}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_del,async e=>{const{file_path:t}=e.data;"memory"===w&&(S?.remove(t),_?.remove(t)),"sqlite"===w&&C&&(p.run(t),g.run(t))}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_search,async e=>{const{key:t,use_zh_segmentation:i}=e.data;let n=t;if(i){n=(0,a.cut)(t,!0).map(e=>e+"*").join(" OR ")}if("memory"===w){const e={suggest:!0,resolution:9,context:!0,limit:50};return{ids:S?.search(n,e)||[],names_ids:_?.search(n,e)||[]}}if("sqlite"===w&&C){const e=(0,a.cut)(n,!0).filter(e=>""!==e.trim()).map(e=>e+"*").join(" OR "),t=m.all(e),i=v.all(e);return{ids:t.map(e=>e.file_path),names_ids:i.map(e=>e.file_path)}}return{ids:[],names_ids:[]}}),(0,r.register_threads_worker_handler)(s.threads_msg_type.docs_close,async()=>{"memory"===w&&(S?.clear(),_?.clear(),S=null,_=null),"sqlite"===w&&C&&(C.close(),C=null)})};const r=i(324),s=i(7525),o=n(i(5474)),a=i(2880),l=i(3917),c=i(1776),u=(0,l.get_bin_dependency)("sqlite3"),h=(0,l.get_bin_dependency)("better-sqlite3");let d,f,p,g,m,v,y,b,S=null,_=null,C=null,w="memory"},3917(__unused_webpack_module,exports,__webpack_require__){"use strict";function get_bin_dependency(module,auto_throw=!1){try{if("sqlite3"===module)return __webpack_require__(9642);if("exe"===process.env.run_env)switch(module){case"@xiaobaidadada/dockerode":return __webpack_require__(8608);case"@xiaobaidadada/node-pty-prebuilt":return __webpack_require__(6087);case"@xiaobaidadada/ssh2-prebuilt":return __webpack_require__(1217);case"node-process-watcher":return __webpack_require__(4505);case"@xiaobaidadada/node-tuntap2-wintun":return __webpack_require__(2710);case"better-sqlite3":return __webpack_require__(7550);default:throw{message:"不存在的包"}}return eval("require")(module)}catch(e){if(console.log(`${process.env.run_env} 模块没有加载失败,请手动安装 npm 依赖( -g 安装的就尝试全局安装,本地仓库安装的就在仓库内安装):${module} error ${e.message}`),auto_throw)throw e}return{}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.get_bin_dependency=get_bin_dependency},1776(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FileUtil=void 0;const r=n(i(9896)),s=n(i(6928));t.FileUtil=class{static async statSync(e){return r.default.promises.stat(e)}static async readdirSync(e){return r.default.promises.readdir(e)}static async readFileSync(e){return r.default.promises.readFile(e)}static async open(e,t,i){return r.default.promises.open(e,t,i)}static async access(e){try{return await r.default.promises.access(e,r.default.constants.F_OK),!0}catch{return!1}}static async appendFileSync(e,t,i){return r.default.promises.appendFile(e,t,i)}static async writeFileSync(e,t){return r.default.promises.writeFile(e,t)}static async writeFileSyncWithUtf8bom(e,t){return t.startsWith("\ufeff")||(t="\ufeff"+t),r.default.promises.writeFile(e,t,{encoding:"utf8"})}static async truncateSync(e){return r.default.promises.truncate(e)}static async unlinkSync(e){return r.default.promises.unlink(e)}static async mkdirSync(e,t){return r.default.promises.mkdir(e,t)}static async renameSync(e,t){return r.default.promises.rename(e,t)}static async getUniqueFileName(e){const t=s.default.dirname(e),i=s.default.extname(e),n=s.default.basename(e,i);let r=e,o=1;for(;await this.access(r);)r=s.default.join(t,`${n}(${o})${i}`),o++;return r}static async get_exe_path_by_env_dir(e,t){if(!await this.access(e))return null;if(!(await this.statSync(e)).isDirectory())return null;const i=await this.readdirSync(e);for(const n of i)if(n.startsWith(t))return s.default.join(e,`${n}`);return null}}},3285(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.file_search_start=function(){(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search,async e=>{const{start:t,end:i,file_path:c,query_text_buffer:u,ram_id:h}=e.data;let d=0,f=Buffer.alloc(0);const p=s.openSync(c,"r");let g=0;for(;d<i&&!l[h];){const e=Buffer.alloc(2097152);let t=s.readSync(p,e,0,e.length,d);if(0===t)break;d+=t,f=Buffer.concat([f,e.subarray(0,t)]),(0,n.threads_send)({type:r.threads_msg_type.search_file_progress,data:{progress:(100*d/i).toFixed(0),ram_id:h}});const l=[];if(a(f,u,l),l.length>0){for(let e=0;e<l.length;e++)l[e]+=g;(0,n.threads_send)({type:r.threads_msg_type.search_file_index,data:{find_index:l,ram_id:h}})}g+=f.length-u.length,f=o(f,f.length-u.length,f.length)}return(0,n.threads_send)({type:r.threads_msg_type.search_file_end,data:{ram_id:h}}),s.closeSync(p),"ok"}),(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search_close,async e=>{const{ram_id:t}=e.data;return l[t]=!0,"ok"}),(0,n.register_threads_worker_handler)(r.threads_msg_type.file_search_start,async e=>{const{ram_id:t}=e.data;return delete l[t],"ok"})};const n=i(324),r=i(7525),s=i(9896);function o(e,t,i){const n=i-t,r=Buffer.alloc(n);return e.copy(r,0,t,i),r}function a(e,t,i){const n=function(e){const t={},i=e.length;for(let n=0;n<i;n++)t[e[n]]=n;return t}(t),r=e.length,s=t.length,o=r-s;let a=0;for(;a<=o;){let o=s-1;for(;o>=0&&e[a+o]===t[o];)o--;if(o<0)i.push(a),a+=a+s<r?s-n[e[a+s]]||s:1;else{const t=n[e[a+o]],i=void 0!==t?o-t:o+1;a+=Math.max(i,1)}}}const l={}},7525(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.threads_msg_type=void 0,function(e){e[e.hello=1]="hello",e[e.file_search_start=2]="file_search_start",e[e.file_search=3]="file_search",e[e.file_search_close=4]="file_search_close",e[e.search_file_index=5]="search_file_index",e[e.search_file_progress=6]="search_file_progress",e[e.search_file_end=7]="search_file_end",e[e.docs_init=8]="docs_init",e[e.docs_add=9]="docs_add",e[e.docs_del=10]="docs_del",e[e.docs_close=11]="docs_close",e[e.docs_search=12]="docs_search"}(i||(t.threads_msg_type=i={}))},324(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.register_threads_worker_handler=o,t.threads_send=a;const n=i(8167),r=i(7525);console.log("[worker] 子线程启动, workerData=",n.workerData);const s=new Map;function o(e,t){s.set(e,t)}function a(e){try{n.parentPort?.postMessage(e)}catch(e){console.error("[worker] send failed:",e)}}n.parentPort?.on("message",e=>{(async function(e){try{const t=s.get(e.type);if(!t)return void a({id:e.id,type:e.type,data:`unknown type ${e.type}`});const i=await t(e);a({id:e.id,type:e.type,data:i})}catch(t){a({id:e.id,type:e.type,data:null,error:t?.message||String(t)}),console.error("[worker] task error:",t)}})(e).catch(console.error)}),o(r.threads_msg_type.hello,async e=>new Promise((t,i)=>setTimeout(()=>{if(Math.random()<.05)return i(new Error("模拟错误"));t(`done:${e.data}`)},500))),console.log("[worker] ready and waiting for messages..."),process.on("uncaughtException",e=>{console.error("子线程全局未捕获异常:",e)}),process.on("unhandledRejection",e=>{console.error("子线程未处理的 Promise 拒绝:",e)})},3065(e,t,i){"use strict";const n=i(6928),r=e=>new c(e);function s(e){return Array.isArray(e)?e:[e]}r.default=r,e.exports=r;const o="\\"===n.sep?/(?<=.)\\$/:/(?<=.)\/$/,a="undefined"!=typeof Symbol?Symbol.for("dockerignore"):"dockerignore";function l(e){return n.normalize(e).replace(o,"")}class c{constructor({ignorecase:e=!0}={}){this._rules=[],this._ignorecase=e,this[a]=!0,this._initCache()}_initCache(){this._cache={}}add(e){return this._added=!1,"string"==typeof e&&(e=e.split(/\r?\n/g)),s(e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_addPattern(e){if(e&&e[a])return this._rules=this._rules.concat(e._rules),void(this._added=!0);if(this._checkPattern(e)){const t=this._createRule(e.trim());null!==t&&(this._added=!0,this._rules.push(t))}}_checkPattern(e){return e&&"string"==typeof e&&0!==e.indexOf("#")&&""!==e.trim()}filter(e){return s(e).filter(e=>this._filter(e))}createFilter(){return e=>this._filter(e)}ignores(e){return!this._filter(e)}_createRule(e){const t=e;let i=!1;var r;if("!"===e[0]&&(i=!0,e=e.substring(1).trim()),e.length>0&&(e=l(e),r=e,(e="/"===n.sep?r:r.replace(/\\/g,"/")).length>1&&"/"===e[0]&&(e=e.slice(1))),i&&(e="!"+e),""===(e=e.trim()))return null;if("!"===(e=l(e))[0]){if(1===e.length)return null;i=!0,e=e.substring(1)}else i=!1;return{origin:t,pattern:e,dirs:e.split(n.sep),negative:i}}_filter(e){return!!e&&(e in this._cache?this._cache[e]:this._cache[e]=this._test(e))}_test(e){e=function(e){return"/"===n.sep?e:e.replace(/\//g,n.sep)}(e);const t=l(n.dirname(e)),i=t.split(n.sep);let r=!1;return this._rules.forEach(s=>{let o=this._match(e,s);if(!o&&"."!==t)if(s.dirs.includes("**"))for(let e=s.dirs.filter(e=>"**"!==e).length;e<=i.length;e++)o=o||this._match(i.slice(0,e).join(n.sep),s);else s.dirs.length<=i.length&&(o=this._match(i.slice(0,s.dirs.length).join(n.sep),s));o&&(r=!s.negative)}),!r}_match(e,t){return this._compile(t).regexp.test(e)}_compile(e){if(e.regexp)return e;let t="^",i="\\"===n.sep?"\\\\":n.sep;for(let r=0;r<e.pattern.length;r++){const s=e.pattern[r];if("*"===s)"*"===e.pattern[r+1]?(r++,e.pattern[r+1]===n.sep&&r++,void 0===e.pattern[r+1]?t+=".*":t+=`(.*${i})?`):t+=`[^${i}]*`;else if("?"===s)t+=`[^${i}]`;else if("."===s||"$"===s)t+=`\\${s}`;else if("\\"===s){if("\\"===n.sep){t+=i;continue}void 0!==e.pattern[r+1]?(t+="\\"+e.pattern[r+1],r++):t+="\\"}else t+=s}return t+="$",e.regexp=new RegExp(t,this._ignorecase?"i":""),e}}},2661(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerAdminService=function(e,t){i.push({getServiceDefinition:e,getHandlers:t})},t.addAdminServicesToServer=function(e){for(const{getServiceDefinition:t,getHandlers:n}of i)e.addService(t(),n())};const i=[]},3956(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BackoffTimeout=void 0;const n=i(131),r=i(267);class s{constructor(e,t){this.callback=e,this.initialDelay=1e3,this.multiplier=1.6,this.maxDelay=12e4,this.jitter=.2,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=s.getNextId(),t&&(t.initialDelay&&(this.initialDelay=t.initialDelay),t.multiplier&&(this.multiplier=t.multiplier),t.jitter&&(this.jitter=t.jitter),t.maxDelay&&(this.maxDelay=t.maxDelay)),this.trace("constructed initialDelay="+this.initialDelay+" multiplier="+this.multiplier+" jitter="+this.jitter+" maxDelay="+this.maxDelay),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}static getNextId(){return this.nextId++}trace(e){r.trace(n.LogVerbosity.DEBUG,"backoff","{"+this.id+"} "+e)}runTimer(e){var t,i;this.trace("runTimer(delay="+e+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+e),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},e),this.hasRef||null===(i=(t=this.timerId).unref)||void 0===i||i.call(t)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);const e=Math.min(this.nextDelay*this.multiplier,this.maxDelay),t=e*this.jitter;var i,n;this.nextDelay=e+(i=-t,n=t,Math.random()*(n-i)+i)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){const e=new Date,t=this.startTime;t.setMilliseconds(t.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),e<t?this.runTimer(t.getTime()-e.getTime()):this.running=!1}}isRunning(){return this.running}ref(){var e,t;this.hasRef=!0,null===(t=(e=this.timerId).ref)||void 0===t||t.call(e)}unref(){var e,t;this.hasRef=!1,null===(t=(e=this.timerId).unref)||void 0===t||t.call(e)}getEndTime(){return this.endTime}}t.BackoffTimeout=s,s.nextId=0},2267(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CallCredentials=void 0;const n=i(4097);class r{static createFromMetadataGenerator(e){return new o(e)}static createFromGoogleCredential(e){return r.createFromMetadataGenerator((t,i)=>{let r;var s;r="getRequestHeaders"in(s=e)&&"function"==typeof s.getRequestHeaders?e.getRequestHeaders(t.service_url):new Promise((i,n)=>{e.getRequestMetadata(t.service_url,(e,t)=>{e?n(e):t?i(t):n(new Error("Headers not set by metadata plugin"))})}),r.then(e=>{const t=new n.Metadata;for(const i of Object.keys(e))t.add(i,e[i]);i(null,t)},e=>{i(e)})})}static createEmpty(){return new a}}t.CallCredentials=r;class s extends r{constructor(e){super(),this.creds=e}async generateMetadata(e){const t=new n.Metadata,i=await Promise.all(this.creds.map(t=>t.generateMetadata(e)));for(const e of i)t.merge(e);return t}compose(e){return new s(this.creds.concat([e]))}_equals(e){return this===e||e instanceof s&&this.creds.every((t,i)=>t._equals(e.creds[i]))}}class o extends r{constructor(e){super(),this.metadataGenerator=e}generateMetadata(e){return new Promise((t,i)=>{this.metadataGenerator(e,(e,n)=>{void 0!==n?t(n):i(e)})})}compose(e){return new s([this,e])}_equals(e){return this===e||e instanceof o&&this.metadataGenerator===e.metadataGenerator}}class a extends r{generateMetadata(e){return Promise.resolve(new n.Metadata)}compose(e){return e}_equals(e){return e instanceof a}}},5034(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InterceptingListenerImpl=void 0,t.statusOrFromValue=function(e){return{ok:!0,value:e}},t.statusOrFromError=function(e){var t;return{ok:!1,error:Object.assign(Object.assign({},e),{metadata:null!==(t=e.metadata)&&void 0!==t?t:new n.Metadata})}},t.isInterceptingListener=function(e){return void 0!==e.onReceiveMetadata&&1===e.onReceiveMetadata.length};const n=i(4097);t.InterceptingListenerImpl=class{constructor(e,t){this.listener=e,this.nextListener=t,this.processingMetadata=!1,this.hasPendingMessage=!1,this.processingMessage=!1,this.pendingStatus=null}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingStatus(){this.pendingStatus&&this.nextListener.onReceiveStatus(this.pendingStatus)}onReceiveMetadata(e){this.processingMetadata=!0,this.listener.onReceiveMetadata(e,e=>{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(e),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(e){this.processingMessage=!0,this.listener.onReceiveMessage(e,e=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=e,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(e),this.processPendingStatus())})}onReceiveStatus(e){this.listener.onReceiveStatus(e,e=>{this.processingMetadata||this.processingMessage?this.pendingStatus=e:this.nextListener.onReceiveStatus(e)})}}},5572(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getNextCallNumber=function(){return i++};let i=0},1544(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClientDuplexStreamImpl=t.ClientWritableStreamImpl=t.ClientReadableStreamImpl=t.ClientUnaryCallImpl=void 0,t.callErrorFromStatus=function(e,t){const i=`${e.code} ${s.Status[e.code]}: ${e.details}`,n=`${new Error(i).stack}\nfor call at\n${t}`;return Object.assign(new Error(i),e,{stack:n})};const n=i(4434),r=i(2203),s=i(131);class o extends n.EventEmitter{constructor(){super()}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}}t.ClientUnaryCallImpl=o;class a extends r.Readable{constructor(e){super({objectMode:!0}),this.deserialize=e}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_read(e){var t;null===(t=this.call)||void 0===t||t.startRead()}}t.ClientReadableStreamImpl=a;class l extends r.Writable{constructor(e){super({objectMode:!0}),this.serialize=e}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_write(e,t,i){var n;const r={callback:i},s=Number(t);Number.isNaN(s)||(r.flags=s),null===(n=this.call)||void 0===n||n.sendMessageWithContext(r,e)}_final(e){var t;null===(t=this.call)||void 0===t||t.halfClose(),e()}}t.ClientWritableStreamImpl=l;class c extends r.Duplex{constructor(e,t){super({objectMode:!0}),this.serialize=e,this.deserialize=t}cancel(){var e;null===(e=this.call)||void 0===e||e.cancelWithStatus(s.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:"unknown"}getAuthContext(){var e,t;return null!==(t=null===(e=this.call)||void 0===e?void 0:e.getAuthContext())&&void 0!==t?t:null}_read(e){var t;null===(t=this.call)||void 0===t||t.startRead()}_write(e,t,i){var n;const r={callback:i},s=Number(t);Number.isNaN(s)||(r.flags=s),null===(n=this.call)||void 0===n||n.sendMessageWithContext(r,e)}_final(e){var t;null===(t=this.call)||void 0===t||t.halfClose(),e()}}t.ClientDuplexStreamImpl=c},5819(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileWatcherCertificateProvider=void 0;const n=i(9896),r=i(267),s=i(131),o=i(9023);function a(e){r.trace(s.LogVerbosity.DEBUG,"certificate_provider",e)}const l=(0,o.promisify)(n.readFile);t.FileWatcherCertificateProvider=class{constructor(e){if(this.config=e,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,void 0===e.certificateFile!=(void 0===e.privateKeyFile))throw new Error("certificateFile and privateKeyFile must be set or unset together");if(void 0===e.certificateFile&&void 0===e.caCertificateFile)throw new Error("At least one of certificateFile and caCertificateFile must be set");a("File watcher constructed with config "+JSON.stringify(e))}updateCertificates(){this.fileResultPromise||(this.fileResultPromise=Promise.allSettled([this.config.certificateFile?l(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?l(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?l(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([e,t,i])=>{if(this.refreshTimer){a("File watcher read certificates certificate "+e.status+", privateKey "+t.status+", CA certificate "+i.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,"fulfilled"===e.status&&"fulfilled"===t.status?this.latestIdentityUpdate={certificate:e.value,privateKey:t.value}:this.latestIdentityUpdate=null,"fulfilled"===i.status?this.latestCaUpdate={caCertificate:i.value}:this.latestCaUpdate=null;for(const e of this.identityListeners)e(this.latestIdentityUpdate);for(const e of this.caListeners)e(this.latestCaUpdate)}}),a("File watcher initiated certificate update"))}maybeStartWatchingFiles(){if(!this.refreshTimer){const e=this.lastUpdateTime?(new Date).getTime()-this.lastUpdateTime.getTime():1/0;e>this.config.refreshIntervalMs&&this.updateCertificates(),e>2*this.config.refreshIntervalMs&&(this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0),this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),a("File watcher started watching")}}maybeStopWatchingFiles(){0===this.caListeners.size&&0===this.identityListeners.size&&(this.fileResultPromise=null,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null))}addCaCertificateListener(e){this.caListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestCaUpdate&&process.nextTick(e,this.latestCaUpdate)}removeCaCertificateListener(e){this.caListeners.delete(e),this.maybeStopWatchingFiles()}addIdentityCertificateListener(e){this.identityListeners.add(e),this.maybeStartWatchingFiles(),void 0!==this.latestIdentityUpdate&&process.nextTick(e,this.latestIdentityUpdate)}removeIdentityCertificateListener(e){this.identityListeners.delete(e),this.maybeStopWatchingFiles()}}},7434(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelCredentials=void 0,t.createCertificateProviderChannelCredentials=function(e,t,i){return new m(e,t,null!=i?i:{})};const n=i(4756),r=i(2267),s=i(9167),o=i(3822),a=i(9302),l=i(267),c=i(131);function u(e,t){if(e&&!(e instanceof Buffer))throw new TypeError(`${t}, if provided, must be a Buffer.`)}class h{compose(e){return new v(this,e)}static createSsl(e,t,i,r){var o;if(u(e,"Root certificate"),u(t,"Private key"),u(i,"Certificate chain"),t&&!i)throw new Error("Private key must be given with accompanying certificate chain");if(!t&&i)throw new Error("Certificate chain must be given with accompanying private key");const a=(0,n.createSecureContext)({ca:null!==(o=null!=e?e:(0,s.getDefaultRootsData)())&&void 0!==o?o:void 0,key:null!=t?t:void 0,cert:null!=i?i:void 0,ciphers:s.CIPHER_SUITES});return new g(a,null!=r?r:{})}static createFromSecureContext(e,t){return new g(e,null!=t?t:{})}static createInsecure(){return new d}}t.ChannelCredentials=h;class d extends h{constructor(){super()}compose(e){throw new Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(e){return e instanceof d}_createSecureConnector(e,t,i){return{connect:e=>Promise.resolve({socket:e,secure:!1}),waitForReady:()=>Promise.resolve(),getCallCredentials:()=>null!=i?i:r.CallCredentials.createEmpty(),destroy(){}}}}function f(e,t,i,r){var s,l;const c={secureContext:e};let u=i;if("grpc.http_connect_target"in r){const e=(0,o.parseUri)(r["grpc.http_connect_target"]);e&&(u=e)}const h=(0,a.getDefaultAuthority)(u),d=(0,o.splitHostPort)(h),f=null!==(s=null==d?void 0:d.host)&&void 0!==s?s:h;if(c.host=f,t.checkServerIdentity&&(c.checkServerIdentity=t.checkServerIdentity),void 0!==t.rejectUnauthorized&&(c.rejectUnauthorized=t.rejectUnauthorized),c.ALPNProtocols=["h2"],r["grpc.ssl_target_name_override"]){const e=r["grpc.ssl_target_name_override"],t=null!==(l=c.checkServerIdentity)&&void 0!==l?l:n.checkServerIdentity;c.checkServerIdentity=(i,n)=>t(e,n),c.servername=e}else c.servername=f;return r["grpc-node.tls_enable_trace"]&&(c.enableTrace=!0),c}class p{constructor(e,t){this.connectionOptions=e,this.callCredentials=t}connect(e){const t=Object.assign({socket:e},this.connectionOptions);return new Promise((e,i)=>{const r=(0,n.connect)(t,()=>{var t;null!==(t=this.connectionOptions.rejectUnauthorized)&&void 0!==t&&!t||r.authorized?e({socket:r,secure:!0}):i(r.authorizationError)});r.on("error",e=>{i(e)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}}class g extends h{constructor(e,t){super(),this.secureContext=e,this.verifyOptions=t}_isSecure(){return!0}_equals(e){return this===e||e instanceof g&&(this.secureContext===e.secureContext&&this.verifyOptions.checkServerIdentity===e.verifyOptions.checkServerIdentity)}_createSecureConnector(e,t,i){const n=f(this.secureContext,this.verifyOptions,e,t);return new p(n,null!=i?i:r.CallCredentials.createEmpty())}}class m extends h{constructor(e,t,i){super(),this.caCertificateProvider=e,this.identityCertificateProvider=t,this.verifyOptions=i,this.refcount=0,this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this),this.secureContextWatchers=[]}_isSecure(){return!0}_equals(e){var t,i;return this===e||e instanceof m&&(this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&(null===(t=this.verifyOptions)||void 0===t?void 0:t.checkServerIdentity)===(null===(i=e.verifyOptions)||void 0===i?void 0:i.checkServerIdentity))}ref(){var e;0===this.refcount&&(this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),null===(e=this.identityCertificateProvider)||void 0===e||e.addIdentityCertificateListener(this.identityCertificateUpdateListener)),this.refcount+=1}unref(){var e;this.refcount-=1,0===this.refcount&&(this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),null===(e=this.identityCertificateProvider)||void 0===e||e.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_createSecureConnector(e,t,i){return this.ref(),new m.SecureConnectorImpl(this,e,t,null!=i?i:r.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(const e of this.secureContextWatchers)e(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.maybeUpdateWatchers()}hasReceivedUpdates(){return void 0!==this.latestCaUpdate&&(!this.identityCertificateProvider||void 0!==this.latestIdentityUpdate)}getSecureContext(){return this.hasReceivedUpdates()?Promise.resolve(this.getLatestSecureContext()):new Promise(e=>{this.secureContextWatchers.push(e)})}getLatestSecureContext(){var e,t;if(!this.latestCaUpdate)return null;if(null!==this.identityCertificateProvider&&!this.latestIdentityUpdate)return null;try{return(0,n.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:null===(e=this.latestIdentityUpdate)||void 0===e?void 0:e.privateKey,cert:null===(t=this.latestIdentityUpdate)||void 0===t?void 0:t.certificate,ciphers:s.CIPHER_SUITES})}catch(e){return(0,l.log)(c.LogVerbosity.ERROR,"Failed to createSecureContext with error "+e.message),null}}}m.SecureConnectorImpl=class{constructor(e,t,i,n){this.parent=e,this.channelTarget=t,this.options=i,this.callCredentials=n}connect(e){return new Promise((t,i)=>{const r=this.parent.getLatestSecureContext();if(!r)return void i(new Error("Failed to load credentials"));e.closed&&i(new Error("Socket closed while loading credentials"));const s=f(r,this.parent.verifyOptions,this.channelTarget,this.options),o=Object.assign({socket:e},s),a=()=>{i(new Error("Socket closed"))},l=e=>{i(e)},c=(0,n.connect)(o,()=>{var e;c.removeListener("close",a),c.removeListener("error",l),null!==(e=this.parent.verifyOptions.rejectUnauthorized)&&void 0!==e&&!e||c.authorized?t({socket:c,secure:!0}):i(c.authorizationError)});c.once("close",a),c.once("error",l)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};class v extends h{constructor(e,t){if(super(),this.channelCredentials=e,this.callCredentials=t,!e._isSecure())throw new Error("Cannot compose insecure credentials")}compose(e){const t=this.callCredentials.compose(e);return new v(this.channelCredentials,t)}_isSecure(){return!0}_equals(e){return this===e||e instanceof v&&(this.channelCredentials._equals(e.channelCredentials)&&this.callCredentials._equals(e.callCredentials))}_createSecureConnector(e,t,i){const n=this.callCredentials.compose(null!=i?i:r.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(e,t,n)}}},6998(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.recognizedOptions=void 0,t.channelOptionsEqual=function(e,t){const i=Object.keys(e).sort(),n=Object.keys(t).sort();if(i.length!==n.length)return!1;for(let r=0;r<i.length;r+=1){if(i[r]!==n[r])return!1;if(e[i[r]]!==t[n[r]])return!1}return!0},t.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc.enable_retries":!0,"grpc.per_rpc_retry_buffer_size":!0,"grpc.retry_buffer_size":!0,"grpc.max_connection_age_ms":!0,"grpc.max_connection_age_grace_ms":!0,"grpc-node.max_session_memory":!0,"grpc.service_config_disable_resolution":!0,"grpc.client_idle_timeout_ms":!0,"grpc-node.tls_enable_trace":!0,"grpc.lb.ring_hash.ring_size_cap":!0,"grpc-node.retry_max_attempts_limit":!0,"grpc-node.flow_control_window":!0,"grpc.server_call_metric_recording":!0}},3653(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelImplementation=void 0;const n=i(7434),r=i(8899);t.ChannelImplementation=class{constructor(e,t,i){if("string"!=typeof e)throw new TypeError("Channel target must be a string");if(!(t instanceof n.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(i&&"object"!=typeof i)throw new TypeError("Channel options must be an object");this.internalChannel=new r.InternalChannel(e,t,i)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(e){return this.internalChannel.getConnectivityState(e)}watchConnectivityState(e,t,i){this.internalChannel.watchConnectivityState(e,t,i)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(e,t,i,n,r){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(e,t,i,n,r)}}},9503(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerChannelzSocket=t.registerChannelzServer=t.registerChannelzSubchannel=t.registerChannelzChannel=t.ChannelzCallTrackerStub=t.ChannelzCallTracker=t.ChannelzChildrenTrackerStub=t.ChannelzChildrenTracker=t.ChannelzTrace=t.ChannelzTraceStub=void 0,t.unregisterChannelzRef=function(e){g[e.kind].eraseElementByKey(e.id)},t.getChannelzHandlers=N,t.getChannelzServiceDefinition=M,t.setup=function(){(0,l.registerAdminService)(M,N)};const n=i(9278),r=i(6787),s=i(463),o=i(131),a=i(8996),l=i(2661),c=i(4056);function u(e){return{channel_id:e.id,name:e.name}}function h(e){return{subchannel_id:e.id,name:e.name}}function d(e){return{socket_id:e.id,name:e.name}}t.ChannelzTraceStub=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:_(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};t.ChannelzTrace=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,t,i){const n=new Date;this.events.push({description:t,severity:e,timestamp:n,childChannel:"channel"===(null==i?void 0:i.kind)?i:void 0,childSubchannel:"subchannel"===(null==i?void 0:i.kind)?i:void 0}),this.events.length>=64&&(this.events=this.events.slice(32)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:_(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:_(e.timestamp),channel_ref:e.childChannel?u(e.childChannel):null,subchannel_ref:e.childSubchannel?h(e.childSubchannel):null}))}}};class f{constructor(){this.channelChildren=new r.OrderedMap,this.subchannelChildren=new r.OrderedMap,this.socketChildren=new r.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){const t=this.trackerMap[e.kind],i=t.find(e.id);i.equals(t.end())?t.setElement(e.id,{ref:e,count:1},i):i.pointer[1].count+=1}unrefChild(e){const t=this.trackerMap[e.kind],i=t.getElementByKey(e.id);void 0!==i&&(i.count-=1,0===i.count&&t.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}}t.ChannelzChildrenTracker=f;t.ChannelzChildrenTrackerStub=class extends f{refChild(){}unrefChild(){}};class p{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}}t.ChannelzCallTracker=p;t.ChannelzCallTrackerStub=class extends p{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};const g={channel:new r.OrderedMap,subchannel:new r.OrderedMap,server:new r.OrderedMap,socket:new r.OrderedMap},m=e=>{let t=1;const i=g[e];return(n,r,s)=>{const o=t++,a={id:o,name:n,kind:e};return s&&i.setElement(o,{ref:a,getInfo:r}),a}};function v(e){if(""===e)return[];const t=e.split(":").map(e=>function(e){const t=Number.parseInt(e,16);return[t/256|0,t%256]}(e));return[].concat(...t)}function y(e){return Buffer.from(Uint8Array.from(e.split(".").map(e=>Number.parseInt(e))))}function b(e){if((0,n.isIPv4)(e))return y(e);if(function(e){return(0,n.isIPv6)(e)&&e.toLowerCase().startsWith("::ffff:")&&(0,n.isIPv4)(e.substring(7))}(e))return y(e.substring(7));if((0,n.isIPv6)(e)){let t,i;const n=e.indexOf("::");-1===n?(t=e,i=""):(t=e.substring(0,n),i=e.substring(n+2));const r=Buffer.from(v(t)),s=Buffer.from(v(i)),o=Buffer.alloc(16-r.length-s.length,0);return Buffer.concat([r,o,s])}return null}function S(e){switch(e){case s.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case s.ConnectivityState.IDLE:return{state:"IDLE"};case s.ConnectivityState.READY:return{state:"READY"};case s.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case s.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function _(e){if(!e)return null;const t=e.getTime();return{seconds:t/1e3|0,nanos:t%1e3*1e6}}function C(e){const t=e.getInfo(),i=[],n=[];return t.children.channels.forEach(e=>{i.push(u(e[1].ref))}),t.children.subchannels.forEach(e=>{n.push(h(e[1].ref))}),{ref:u(e.ref),data:{target:t.target,state:S(t.state),calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:_(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},channel_ref:i,subchannel_ref:n}}function w(e,t){const i=parseInt(e.request.channel_id,10),n=g.channel.getElementByKey(i);void 0!==n?t(null,{channel:C(n)}):t({code:o.Status.NOT_FOUND,details:"No channel data found for id "+i})}function E(e,t){const i=parseInt(e.request.max_results,10)||100,n=[],r=parseInt(e.request.start_channel_id,10),s=g.channel;let o;for(o=s.lowerBound(r);!o.equals(s.end())&&n.length<i;o=o.next())n.push(C(o.pointer[1]));t(null,{channel:n,end:o.equals(s.end())})}function T(e){const t=e.getInfo(),i=[];return t.listenerChildren.sockets.forEach(e=>{i.push(d(e[1].ref))}),{ref:(n=e.ref,{server_id:n.id}),data:{calls_started:t.callTracker.callsStarted,calls_succeeded:t.callTracker.callsSucceeded,calls_failed:t.callTracker.callsFailed,last_call_started_timestamp:_(t.callTracker.lastCallStartedTimestamp),trace:t.trace.getTraceMessage()},listen_socket:i};var n}function k(e,t){const i=parseInt(e.request.server_id,10),n=g.server.getElementByKey(i);void 0!==n?t(null,{server:T(n)}):t({code:o.Status.NOT_FOUND,details:"No server data found for id "+i})}function R(e,t){const i=parseInt(e.request.max_results,10)||100,n=parseInt(e.request.start_server_id,10),r=g.server,s=[];let o;for(o=r.lowerBound(n);!o.equals(r.end())&&s.length<i;o=o.next())s.push(T(o.pointer[1]));t(null,{server:s,end:o.equals(r.end())})}function O(e,t){const i=parseInt(e.request.subchannel_id,10),n=g.subchannel.getElementByKey(i);if(void 0===n)return void t({code:o.Status.NOT_FOUND,details:"No subchannel data found for id "+i});const r=n.getInfo(),s=[];r.children.sockets.forEach(e=>{s.push(d(e[1].ref))});t(null,{subchannel:{ref:h(n.ref),data:{target:r.target,state:S(r.state),calls_started:r.callTracker.callsStarted,calls_succeeded:r.callTracker.callsSucceeded,calls_failed:r.callTracker.callsFailed,last_call_started_timestamp:_(r.callTracker.lastCallStartedTimestamp),trace:r.trace.getTraceMessage()},socket_ref:s}})}function P(e){var t;return(0,a.isTcpSubchannelAddress)(e)?{address:"tcpip_address",tcpip_address:{ip_address:null!==(t=b(e.host))&&void 0!==t?t:void 0,port:e.port}}:{address:"uds_address",uds_address:{filename:e.path}}}function A(e,t){var i,n,r,s,a;const l=parseInt(e.request.socket_id,10),c=g.socket.getElementByKey(l);if(void 0===c)return void t({code:o.Status.NOT_FOUND,details:"No socket data found for id "+l});const u=c.getInfo(),h=u.security?{model:"tls",tls:{cipher_suite:u.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:null!==(i=u.security.cipherSuiteStandardName)&&void 0!==i?i:void 0,other_name:null!==(n=u.security.cipherSuiteOtherName)&&void 0!==n?n:void 0,local_certificate:null!==(r=u.security.localCertificate)&&void 0!==r?r:void 0,remote_certificate:null!==(s=u.security.remoteCertificate)&&void 0!==s?s:void 0}}:null;t(null,{socket:{ref:d(c.ref),local:u.localAddress?P(u.localAddress):null,remote:u.remoteAddress?P(u.remoteAddress):null,remote_name:null!==(a=u.remoteName)&&void 0!==a?a:void 0,security:h,data:{keep_alives_sent:u.keepAlivesSent,streams_started:u.streamsStarted,streams_succeeded:u.streamsSucceeded,streams_failed:u.streamsFailed,last_local_stream_created_timestamp:_(u.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:_(u.lastRemoteStreamCreatedTimestamp),messages_received:u.messagesReceived,messages_sent:u.messagesSent,last_message_received_timestamp:_(u.lastMessageReceivedTimestamp),last_message_sent_timestamp:_(u.lastMessageSentTimestamp),local_flow_control_window:u.localFlowControlWindow?{value:u.localFlowControlWindow}:null,remote_flow_control_window:u.remoteFlowControlWindow?{value:u.remoteFlowControlWindow}:null}}})}function x(e,t){const i=parseInt(e.request.server_id,10),n=g.server.getElementByKey(i);if(void 0===n)return void t({code:o.Status.NOT_FOUND,details:"No server data found for id "+i});const r=parseInt(e.request.start_socket_id,10),s=parseInt(e.request.max_results,10)||100,a=n.getInfo().sessionChildren.sockets,l=[];let c;for(c=a.lowerBound(r);!c.equals(a.end())&&l.length<s;c=c.next())l.push(d(c.pointer[1].ref));t(null,{socket_ref:l,end:c.equals(a.end())})}function N(){return{GetChannel:w,GetTopChannels:E,GetServer:k,GetServers:R,GetSubchannel:O,GetSocket:A,GetServerSockets:x}}t.registerChannelzChannel=m("channel"),t.registerChannelzSubchannel=m("subchannel"),t.registerChannelzServer=m("server"),t.registerChannelzSocket=m("socket");let I=null;function M(){if(I)return I;const e=(0,i(5085).Yi)("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]}),t=(0,c.loadPackageDefinition)(e);return I=t.grpc.channelz.v1.Channelz.service,I}},3952(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InterceptingCall=t.RequesterBuilder=t.ListenerBuilder=t.InterceptorConfigurationError=void 0,t.getInterceptingCall=function(e,t,i,n){if(e.clientInterceptors.length>0&&e.clientInterceptorProviders.length>0)throw new a("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(e.callInterceptors.length>0&&e.callInterceptorProviders.length>0)throw new a("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let r=[];r=e.callInterceptors.length>0||e.callInterceptorProviders.length>0?[].concat(e.callInterceptors,e.callInterceptorProviders.map(e=>e(t))).filter(e=>e):[].concat(e.clientInterceptors,e.clientInterceptorProviders.map(e=>e(t))).filter(e=>e);const s=Object.assign({},i,{method_definition:t}),o=r.reduceRight((e,t)=>i=>t(i,e),e=>f(n,e,t));return o(s)};const n=i(4097),r=i(5034),s=i(131),o=i(9752);class a extends Error{constructor(e){super(e),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,a)}}t.InterceptorConfigurationError=a;t.ListenerBuilder=class{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveStatus(e){return this.status=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}};t.RequesterBuilder=class{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(e){return this.start=e,this}withSendMessage(e){return this.message=e,this}withHalfClose(e){return this.halfClose=e,this}withCancel(e){return this.cancel=e,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}};const l={onReceiveMetadata:(e,t)=>{t(e)},onReceiveMessage:(e,t)=>{t(e)},onReceiveStatus:(e,t)=>{t(e)}},c={start:(e,t,i)=>{i(e,t)},sendMessage:(e,t)=>{t(e)},halfClose:e=>{e()},cancel:e=>{e()}};t.InterceptingCall=class{constructor(e,t){var i,n,r,s;this.nextCall=e,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,this.requester=t?{start:null!==(i=t.start)&&void 0!==i?i:c.start,sendMessage:null!==(n=t.sendMessage)&&void 0!==n?n:c.sendMessage,halfClose:null!==(r=t.halfClose)&&void 0!==r?r:c.halfClose,cancel:null!==(s=t.cancel)&&void 0!==s?s:c.cancel}:c}cancelWithStatus(e,t){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(e,t)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){this.pendingMessageContext&&(this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null)}processPendingHalfClose(){this.pendingHalfClose&&this.nextCall.halfClose()}start(e,t){var i,n,s,o,a,c;const u={onReceiveMetadata:null!==(n=null===(i=null==t?void 0:t.onReceiveMetadata)||void 0===i?void 0:i.bind(t))&&void 0!==n?n:e=>{},onReceiveMessage:null!==(o=null===(s=null==t?void 0:t.onReceiveMessage)||void 0===s?void 0:s.bind(t))&&void 0!==o?o:e=>{},onReceiveStatus:null!==(c=null===(a=null==t?void 0:t.onReceiveStatus)||void 0===a?void 0:a.bind(t))&&void 0!==c?c:e=>{}};this.processingMetadata=!0,this.requester.start(e,u,(e,t)=>{var i,n,s;let o;if(this.processingMetadata=!1,(0,r.isInterceptingListener)(t))o=t;else{const e={onReceiveMetadata:null!==(i=t.onReceiveMetadata)&&void 0!==i?i:l.onReceiveMetadata,onReceiveMessage:null!==(n=t.onReceiveMessage)&&void 0!==n?n:l.onReceiveMessage,onReceiveStatus:null!==(s=t.onReceiveStatus)&&void 0!==s?s:l.onReceiveStatus};o=new r.InterceptingListenerImpl(e,u)}this.nextCall.start(e,o),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(e,t){this.processingMessage=!0,this.requester.sendMessage(t,i=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessageContext=e,this.pendingMessage=t):(this.nextCall.sendMessageWithContext(e,i),this.processPendingHalfClose())})}sendMessage(e){this.sendMessageWithContext({},e)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{this.processingMetadata||this.processingMessage?this.pendingHalfClose=!0:this.nextCall.halfClose()})}getAuthContext(){return this.nextCall.getAuthContext()}};class u{constructor(e,t){this.call=e,this.methodDefinition=t}cancelWithStatus(e,t){this.call.cancelWithStatus(e,t)}getPeer(){return this.call.getPeer()}sendMessageWithContext(e,t){let i;try{i=this.methodDefinition.requestSerialize(t)}catch(e){return void this.call.cancelWithStatus(s.Status.INTERNAL,`Request message serialization failure: ${(0,o.getErrorMessage)(e)}`)}this.call.sendMessageWithContext(e,i)}sendMessage(e){this.sendMessageWithContext({},e)}start(e,t){let i=null;this.call.start(e,{onReceiveMetadata:e=>{var i;null===(i=null==t?void 0:t.onReceiveMetadata)||void 0===i||i.call(t,e)},onReceiveMessage:e=>{var r;let a;try{a=this.methodDefinition.responseDeserialize(e)}catch(e){return i={code:s.Status.INTERNAL,details:`Response message parsing error: ${(0,o.getErrorMessage)(e)}`,metadata:new n.Metadata},void this.call.cancelWithStatus(i.code,i.details)}null===(r=null==t?void 0:t.onReceiveMessage)||void 0===r||r.call(t,a)},onReceiveStatus:e=>{var n,r;i?null===(n=null==t?void 0:t.onReceiveStatus)||void 0===n||n.call(t,i):null===(r=null==t?void 0:t.onReceiveStatus)||void 0===r||r.call(t,e)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}getAuthContext(){return this.call.getAuthContext()}}class h extends u{constructor(e,t){super(e,t)}start(e,t){var i,n;let r=!1;const s={onReceiveMetadata:null!==(n=null===(i=null==t?void 0:t.onReceiveMetadata)||void 0===i?void 0:i.bind(t))&&void 0!==n?n:e=>{},onReceiveMessage:e=>{var i;r=!0,null===(i=null==t?void 0:t.onReceiveMessage)||void 0===i||i.call(t,e)},onReceiveStatus:e=>{var i,n;r||null===(i=null==t?void 0:t.onReceiveMessage)||void 0===i||i.call(t,null),null===(n=null==t?void 0:t.onReceiveStatus)||void 0===n||n.call(t,e)}};super.start(e,s),this.call.startRead()}}class d extends u{}function f(e,t,i){const n=function(e,t,i){var n,r;const s=null!==(n=i.deadline)&&void 0!==n?n:1/0,o=i.host,a=null!==(r=i.parent)&&void 0!==r?r:null,l=i.propagate_flags,c=i.credentials,u=e.createCall(t,s,o,a,l);return c&&u.setCredentials(c),u}(e,i.path,t);return i.responseStream?new d(n,i):new h(n,i)}},5563(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0;const n=i(1544),r=i(3653),s=i(463),o=i(131),a=i(4097),l=i(3952),c=Symbol(),u=Symbol(),h=Symbol(),d=Symbol();function f(e){return"function"==typeof e}function p(e){var t;return(null===(t=e.stack)||void 0===t?void 0:t.split("\n").slice(1).join("\n"))||"no stack trace available"}t.Client=class{constructor(e,t,i={}){var n,s;if(i=Object.assign({},i),this[u]=null!==(n=i.interceptors)&&void 0!==n?n:[],delete i.interceptors,this[h]=null!==(s=i.interceptor_providers)&&void 0!==s?s:[],delete i.interceptor_providers,this[u].length>0&&this[h].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[d]=i.callInvocationTransformer,delete i.callInvocationTransformer,i.channelOverride)this[c]=i.channelOverride;else if(i.channelFactoryOverride){const n=i.channelFactoryOverride;delete i.channelFactoryOverride,this[c]=n(e,t,i)}else this[c]=new r.ChannelImplementation(e,t,i)}close(){this[c].close()}getChannel(){return this[c]}waitForReady(e,t){const i=n=>{if(n)return void t(new Error("Failed to connect before the deadline"));let r;try{r=this[c].getConnectivityState(!0)}catch(e){return void t(new Error("The channel has been closed"))}if(r===s.ConnectivityState.READY)t();else try{this[c].watchConnectivityState(r,e,i)}catch(e){t(new Error("The channel has been closed"))}};setImmediate(i)}checkOptionalUnaryResponseArguments(e,t,i){if(f(e))return{metadata:new a.Metadata,options:{},callback:e};if(f(t))return e instanceof a.Metadata?{metadata:e,options:{},callback:t}:{metadata:new a.Metadata,options:e,callback:t};if(!(e instanceof a.Metadata&&t instanceof Object&&f(i)))throw new Error("Incorrect arguments passed");return{metadata:e,options:t,callback:i}}makeUnaryRequest(e,t,i,r,s,a,f){var g,m;const v=this.checkOptionalUnaryResponseArguments(s,a,f),y={path:e,requestStream:!1,responseStream:!1,requestSerialize:t,responseDeserialize:i};let b={argument:r,metadata:v.metadata,call:new n.ClientUnaryCallImpl,channel:this[c],methodDefinition:y,callOptions:v.options,callback:v.callback};this[d]&&(b=this[d](b));const S=b.call,_={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(g=b.callOptions.interceptors)&&void 0!==g?g:[],callInterceptorProviders:null!==(m=b.callOptions.interceptor_providers)&&void 0!==m?m:[]},C=(0,l.getInterceptingCall)(_,b.methodDefinition,b.callOptions,b.channel);S.call=C;let w=null,E=!1,T=new Error;return C.start(b.metadata,{onReceiveMetadata:e=>{S.emit("metadata",e)},onReceiveMessage(e){null!==w&&C.cancelWithStatus(o.Status.UNIMPLEMENTED,"Too many responses received"),w=e},onReceiveStatus(e){if(!E){if(E=!0,e.code===o.Status.OK)if(null===w){const t=p(T);b.callback((0,n.callErrorFromStatus)({code:o.Status.UNIMPLEMENTED,details:"No message received",metadata:e.metadata},t))}else b.callback(null,w);else{const t=p(T);b.callback((0,n.callErrorFromStatus)(e,t))}T=null,S.emit("status",e)}}}),C.sendMessage(r),C.halfClose(),S}makeClientStreamRequest(e,t,i,r,s,a){var f,g;const m=this.checkOptionalUnaryResponseArguments(r,s,a),v={path:e,requestStream:!0,responseStream:!1,requestSerialize:t,responseDeserialize:i};let y={metadata:m.metadata,call:new n.ClientWritableStreamImpl(t),channel:this[c],methodDefinition:v,callOptions:m.options,callback:m.callback};this[d]&&(y=this[d](y));const b=y.call,S={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(f=y.callOptions.interceptors)&&void 0!==f?f:[],callInterceptorProviders:null!==(g=y.callOptions.interceptor_providers)&&void 0!==g?g:[]},_=(0,l.getInterceptingCall)(S,y.methodDefinition,y.callOptions,y.channel);b.call=_;let C=null,w=!1,E=new Error;return _.start(y.metadata,{onReceiveMetadata:e=>{b.emit("metadata",e)},onReceiveMessage(e){null!==C&&_.cancelWithStatus(o.Status.UNIMPLEMENTED,"Too many responses received"),C=e,_.startRead()},onReceiveStatus(e){if(!w){if(w=!0,e.code===o.Status.OK)if(null===C){const t=p(E);y.callback((0,n.callErrorFromStatus)({code:o.Status.UNIMPLEMENTED,details:"No message received",metadata:e.metadata},t))}else y.callback(null,C);else{const t=p(E);y.callback((0,n.callErrorFromStatus)(e,t))}E=null,b.emit("status",e)}}}),b}checkMetadataAndOptions(e,t){let i,n;return e instanceof a.Metadata?(i=e,n=t||{}):(n=e||{},i=new a.Metadata),{metadata:i,options:n}}makeServerStreamRequest(e,t,i,r,s,a){var f,g;const m=this.checkMetadataAndOptions(s,a),v={path:e,requestStream:!1,responseStream:!0,requestSerialize:t,responseDeserialize:i};let y={argument:r,metadata:m.metadata,call:new n.ClientReadableStreamImpl(i),channel:this[c],methodDefinition:v,callOptions:m.options};this[d]&&(y=this[d](y));const b=y.call,S={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(f=y.callOptions.interceptors)&&void 0!==f?f:[],callInterceptorProviders:null!==(g=y.callOptions.interceptor_providers)&&void 0!==g?g:[]},_=(0,l.getInterceptingCall)(S,y.methodDefinition,y.callOptions,y.channel);b.call=_;let C=!1,w=new Error;return _.start(y.metadata,{onReceiveMetadata(e){b.emit("metadata",e)},onReceiveMessage(e){b.push(e)},onReceiveStatus(e){if(!C){if(C=!0,b.push(null),e.code!==o.Status.OK){const t=p(w);b.emit("error",(0,n.callErrorFromStatus)(e,t))}w=null,b.emit("status",e)}}}),_.sendMessage(r),_.halfClose(),b}makeBidiStreamRequest(e,t,i,r,s){var a,f;const g=this.checkMetadataAndOptions(r,s),m={path:e,requestStream:!0,responseStream:!0,requestSerialize:t,responseDeserialize:i};let v={metadata:g.metadata,call:new n.ClientDuplexStreamImpl(t,i),channel:this[c],methodDefinition:m,callOptions:g.options};this[d]&&(v=this[d](v));const y=v.call,b={clientInterceptors:this[u],clientInterceptorProviders:this[h],callInterceptors:null!==(a=v.callOptions.interceptors)&&void 0!==a?a:[],callInterceptorProviders:null!==(f=v.callOptions.interceptor_providers)&&void 0!==f?f:[]},S=(0,l.getInterceptingCall)(b,v.methodDefinition,v.callOptions,v.channel);y.call=S;let _=!1,C=new Error;return S.start(v.metadata,{onReceiveMetadata(e){y.emit("metadata",e)},onReceiveMessage(e){y.push(e)},onReceiveStatus(e){if(!_){if(_=!0,y.push(null),e.code!==o.Status.OK){const t=p(C);y.emit("error",(0,n.callErrorFromStatus)(e,t))}C=null,y.emit("status",e)}}}),y}}},5179(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.CompressionAlgorithms=void 0,function(e){e[e.identity=0]="identity",e[e.deflate=1]="deflate",e[e.gzip=2]="gzip"}(i||(t.CompressionAlgorithms=i={}))},4987(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompressionFilterFactory=t.CompressionFilter=void 0;const n=i(3106),r=i(5179),s=i(131),o=i(2558),a=i(267);class l{async writeMessage(e,t){let i=e;t&&(i=await this.compressMessage(i));const n=Buffer.allocUnsafe(i.length+5);return n.writeUInt8(t?1:0,0),n.writeUInt32BE(i.length,1),i.copy(n,5),n}async readMessage(e){const t=1===e.readUInt8(0);let i=e.slice(5);return t&&(i=await this.decompressMessage(i)),i}}class c extends l{async compressMessage(e){return e}async writeMessage(e,t){const i=Buffer.allocUnsafe(e.length+5);return i.writeUInt8(0,0),i.writeUInt32BE(e.length,1),e.copy(i,5),i}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}}class u extends l{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,i)=>{n.deflate(e,(e,n)=>{e?i(e):t(n)})})}decompressMessage(e){return new Promise((t,i)=>{let r=0;const o=[],a=n.createInflate();a.on("data",e=>{o.push(e),r+=e.byteLength,-1!==this.maxRecvMessageLength&&r>this.maxRecvMessageLength&&(a.destroy(),i({code:s.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),a.on("end",()=>{t(Buffer.concat(o))}),a.write(e),a.end()})}}class h extends l{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,i)=>{n.gzip(e,(e,n)=>{e?i(e):t(n)})})}decompressMessage(e){return new Promise((t,i)=>{let r=0;const o=[],a=n.createGunzip();a.on("data",e=>{o.push(e),r+=e.byteLength,-1!==this.maxRecvMessageLength&&r>this.maxRecvMessageLength&&(a.destroy(),i({code:s.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),a.on("end",()=>{t(Buffer.concat(o))}),a.write(e),a.end()})}}class d extends l{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}}function f(e,t){switch(e){case"identity":return new c;case"deflate":return new u(t);case"gzip":return new h(t);default:return new d(e)}}class p extends o.BaseFilter{constructor(e,t){var i,n,o;super(),this.sharedFilterConfig=t,this.sendCompression=new c,this.receiveCompression=new c,this.currentCompressionAlgorithm="identity";const l=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=null!==(i=e["grpc.max_receive_message_length"])&&void 0!==i?i:s.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=null!==(n=e["grpc.max_send_message_length"])&&void 0!==n?n:s.DEFAULT_MAX_SEND_MESSAGE_LENGTH,void 0!==l)if("number"==typeof(u=l)&&"string"==typeof r.CompressionAlgorithms[u]){const e=r.CompressionAlgorithms[l],i=null===(o=t.serverSupportedEncodingHeader)||void 0===o?void 0:o.split(",");i&&!i.includes(e)||(this.currentCompressionAlgorithm=e,this.sendCompression=f(this.currentCompressionAlgorithm,-1))}else a.log(s.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${l}`);var u}async sendMetadata(e){const t=await e;return t.set("grpc-accept-encoding","identity,deflate,gzip"),t.set("accept-encoding","identity"),"identity"===this.currentCompressionAlgorithm?t.remove("grpc-encoding"):t.set("grpc-encoding",this.currentCompressionAlgorithm),t}receiveMetadata(e){const t=e.get("grpc-encoding");if(t.length>0){const e=t[0];"string"==typeof e&&(this.receiveCompression=f(e,this.maxReceiveMessageLength))}e.remove("grpc-encoding");const i=e.get("grpc-accept-encoding")[0];if(i){this.sharedFilterConfig.serverSupportedEncodingHeader=i;i.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new c,this.currentCompressionAlgorithm="identity")}return e.remove("grpc-accept-encoding"),e}async sendMessage(e){var t;const i=await e;if(-1!==this.maxSendMessageLength&&i.message.length>this.maxSendMessageLength)throw{code:s.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let n;return n=!(this.sendCompression instanceof c)&&!(2&(null!==(t=i.flags)&&void 0!==t?t:0)),{message:await this.sendCompression.writeMessage(i.message,n),flags:i.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}}t.CompressionFilter=p;t.CompressionFilterFactory=class{constructor(e,t){this.options=t,this.sharedFilterConfig={}}createFilter(){return new p(this.options,this.sharedFilterConfig)}}},463(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectivityState=void 0,function(e){e[e.IDLE=0]="IDLE",e[e.CONNECTING=1]="CONNECTING",e[e.READY=2]="READY",e[e.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",e[e.SHUTDOWN=4]="SHUTDOWN"}(i||(t.ConnectivityState=i={}))},131(e,t){"use strict";var i,n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=t.DEFAULT_MAX_SEND_MESSAGE_LENGTH=t.Propagate=t.LogVerbosity=t.Status=void 0,function(e){e[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.ALREADY_EXISTS=6]="ALREADY_EXISTS",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",e[e.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",e[e.ABORTED=10]="ABORTED",e[e.OUT_OF_RANGE=11]="OUT_OF_RANGE",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.DATA_LOSS=15]="DATA_LOSS",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED"}(i||(t.Status=i={})),function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.ERROR=2]="ERROR",e[e.NONE=3]="NONE"}(n||(t.LogVerbosity=n={})),function(e){e[e.DEADLINE=1]="DEADLINE",e[e.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",e[e.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",e[e.CANCELLATION=8]="CANCELLATION",e[e.DEFAULTS=65535]="DEFAULTS"}(r||(t.Propagate=r={})),t.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1,t.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4194304},6067(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.restrictControlPlaneStatusCode=function(e,t){return r.includes(e)?{code:n.Status.INTERNAL,details:`Invalid status from control plane: ${e} ${n.Status[e]} ${t}`}:{code:e,details:t}};const n=i(131),r=[n.Status.OK,n.Status.INVALID_ARGUMENT,n.Status.NOT_FOUND,n.Status.ALREADY_EXISTS,n.Status.FAILED_PRECONDITION,n.Status.ABORTED,n.Status.OUT_OF_RANGE,n.Status.DATA_LOSS]},6308(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.minDeadline=function(...e){let t=1/0;for(const i of e){const e=i instanceof Date?i.getTime():i;e<t&&(t=e)}return t},t.getDeadlineTimeoutString=function(e){const t=(new Date).getTime();e instanceof Date&&(e=e.getTime());const n=Math.max(e-t,0);for(const[e,t]of i){const i=n/t;if(i<1e8)return String(Math.ceil(i))+e}throw new Error("Deadline is too far in the future")},t.getRelativeTimeout=function(e){const t=e instanceof Date?e.getTime():e,i=(new Date).getTime(),n=t-i;return n<0?0:n>2147483647?1/0:n},t.deadlineToString=function(e){if(e instanceof Date)return e.toISOString();{const t=new Date(e);return Number.isNaN(t.getTime())?""+e:t.toISOString()}},t.formatDateDifference=function(e,t){return((t.getTime()-e.getTime())/1e3).toFixed(3)+"s"};const i=[["m",1],["S",1e3],["M",6e4],["H",36e5]]},4700(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.durationMessageToDuration=function(e){return{seconds:Number.parseInt(e.seconds),nanos:e.nanos}},t.msToDuration=function(e){return{seconds:e/1e3|0,nanos:e%1e3*1e6|0}},t.durationToMs=function(e){return 1e3*e.seconds+e.nanos/1e6|0},t.isDuration=function(e){return"number"==typeof e.seconds&&"number"==typeof e.nanos},t.isDurationMessage=function(e){return"string"==typeof e.seconds&&"number"==typeof e.nanos},t.parseDuration=function(e){const t=e.match(i);if(!t)return null;return{seconds:Number.parseInt(t[1],10),nanos:t[2]?Number.parseInt(t[2].padEnd(9,"0"),10):0}},t.durationToString=function(e){if(0===e.nanos)return`${e.seconds}s`;let t;t=e.nanos%1e6==0?1e6:e.nanos%1e3==0?1e3:1;return`${e.seconds}.${e.nanos/t}s`};const i=/^(\d+)(?:\.(\d+))?s$/},883(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0,t.GRPC_NODE_USE_ALTERNATIVE_RESOLVER="true"===(null!==(i=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)&&void 0!==i?i:"false")},9752(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorMessage=function(e){return e instanceof Error?e.message:String(e)},t.getErrorCode=function(e){return"object"==typeof e&&null!==e&&"code"in e&&"number"==typeof e.code?e.code:null}},342(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=t.createCertificateProviderChannelCredentials=t.FileWatcherCertificateProvider=t.createCertificateProviderServerCredentials=t.createServerCredentialsWithInterceptors=t.BaseSubchannelWrapper=t.registerAdminService=t.FilterStackFactory=t.BaseFilter=t.statusOrFromError=t.statusOrFromValue=t.PickResultType=t.QueuePicker=t.UnavailablePicker=t.ChildLoadBalancerHandler=t.EndpointMap=t.endpointHasAddress=t.endpointToString=t.subchannelAddressToString=t.LeafLoadBalancer=t.isLoadBalancerNameRegistered=t.parseLoadBalancingConfig=t.selectLbConfigFromList=t.registerLoadBalancerType=t.createChildChannelControlHelper=t.BackoffTimeout=t.parseDuration=t.durationToMs=t.splitHostPort=t.uriToString=t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=t.createResolver=t.registerResolver=t.log=t.trace=void 0;var n=i(267);Object.defineProperty(t,"trace",{enumerable:!0,get:function(){return n.trace}}),Object.defineProperty(t,"log",{enumerable:!0,get:function(){return n.log}});var r=i(9302);Object.defineProperty(t,"registerResolver",{enumerable:!0,get:function(){return r.registerResolver}}),Object.defineProperty(t,"createResolver",{enumerable:!0,get:function(){return r.createResolver}}),Object.defineProperty(t,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return r.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var s=i(3822);Object.defineProperty(t,"uriToString",{enumerable:!0,get:function(){return s.uriToString}}),Object.defineProperty(t,"splitHostPort",{enumerable:!0,get:function(){return s.splitHostPort}});var o=i(4700);Object.defineProperty(t,"durationToMs",{enumerable:!0,get:function(){return o.durationToMs}}),Object.defineProperty(t,"parseDuration",{enumerable:!0,get:function(){return o.parseDuration}});var a=i(3956);Object.defineProperty(t,"BackoffTimeout",{enumerable:!0,get:function(){return a.BackoffTimeout}});var l=i(8923);Object.defineProperty(t,"createChildChannelControlHelper",{enumerable:!0,get:function(){return l.createChildChannelControlHelper}}),Object.defineProperty(t,"registerLoadBalancerType",{enumerable:!0,get:function(){return l.registerLoadBalancerType}}),Object.defineProperty(t,"selectLbConfigFromList",{enumerable:!0,get:function(){return l.selectLbConfigFromList}}),Object.defineProperty(t,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return l.parseLoadBalancingConfig}}),Object.defineProperty(t,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return l.isLoadBalancerNameRegistered}});var c=i(6486);Object.defineProperty(t,"LeafLoadBalancer",{enumerable:!0,get:function(){return c.LeafLoadBalancer}});var u=i(8996);Object.defineProperty(t,"subchannelAddressToString",{enumerable:!0,get:function(){return u.subchannelAddressToString}}),Object.defineProperty(t,"endpointToString",{enumerable:!0,get:function(){return u.endpointToString}}),Object.defineProperty(t,"endpointHasAddress",{enumerable:!0,get:function(){return u.endpointHasAddress}}),Object.defineProperty(t,"EndpointMap",{enumerable:!0,get:function(){return u.EndpointMap}});var h=i(533);Object.defineProperty(t,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return h.ChildLoadBalancerHandler}});var d=i(178);Object.defineProperty(t,"UnavailablePicker",{enumerable:!0,get:function(){return d.UnavailablePicker}}),Object.defineProperty(t,"QueuePicker",{enumerable:!0,get:function(){return d.QueuePicker}}),Object.defineProperty(t,"PickResultType",{enumerable:!0,get:function(){return d.PickResultType}});var f=i(5034);Object.defineProperty(t,"statusOrFromValue",{enumerable:!0,get:function(){return f.statusOrFromValue}}),Object.defineProperty(t,"statusOrFromError",{enumerable:!0,get:function(){return f.statusOrFromError}});var p=i(2558);Object.defineProperty(t,"BaseFilter",{enumerable:!0,get:function(){return p.BaseFilter}});var g=i(1703);Object.defineProperty(t,"FilterStackFactory",{enumerable:!0,get:function(){return g.FilterStackFactory}});var m=i(2661);Object.defineProperty(t,"registerAdminService",{enumerable:!0,get:function(){return m.registerAdminService}});var v=i(2379);Object.defineProperty(t,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return v.BaseSubchannelWrapper}});var y=i(8692);Object.defineProperty(t,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return y.createServerCredentialsWithInterceptors}}),Object.defineProperty(t,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return y.createCertificateProviderServerCredentials}});var b=i(5819);Object.defineProperty(t,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return b.FileWatcherCertificateProvider}});var S=i(7434);Object.defineProperty(t,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return S.createCertificateProviderChannelCredentials}});var _=i(8899);Object.defineProperty(t,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return _.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})},1703(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilterStackFactory=t.FilterStack=void 0;class i{constructor(e){this.filters=e}sendMetadata(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMetadata(t);return t}receiveMetadata(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMetadata(t);return t}sendMessage(e){let t=e;for(let e=0;e<this.filters.length;e++)t=this.filters[e].sendMessage(t);return t}receiveMessage(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveMessage(t);return t}receiveTrailers(e){let t=e;for(let e=this.filters.length-1;e>=0;e--)t=this.filters[e].receiveTrailers(t);return t}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}}t.FilterStack=i;class n{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new n([...this.factories])}createFilter(){return new i(this.factories.map(e=>e.createFilter()))}}t.FilterStackFactory=n},2558(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseFilter=void 0;t.BaseFilter=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}}},7803(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseCIDR=f,t.mapProxyName=function(e,t){var i;const o={target:e,extraOptions:{}};if(0===(null!==(i=t["grpc.enable_http_proxy"])&&void 0!==i?i:1))return o;if("unix"===e.scheme)return o;const a=function(){let e,t="",i="";if(process.env.grpc_proxy)i="grpc_proxy",t=process.env.grpc_proxy;else if(process.env.https_proxy)i="https_proxy",t=process.env.https_proxy;else{if(!process.env.http_proxy)return{};i="http_proxy",t=process.env.http_proxy}try{e=new u.URL(t)}catch(e){return(0,n.log)(r.LogVerbosity.ERROR,`cannot parse value of "${i}" env var`),{}}if("http:"!==e.protocol)return(0,n.log)(r.LogVerbosity.ERROR,`"${e.protocol}" scheme not supported in proxy URI`),{};let s=null;e.username&&(e.password?((0,n.log)(r.LogVerbosity.INFO,"userinfo found in proxy URI"),s=decodeURIComponent(`${e.username}:${e.password}`)):s=e.username);const o=e.hostname;let a=e.port;""===a&&(a="80");const l={address:`${o}:${a}`};s&&(l.creds=s);return d("Proxy server "+l.address+" set by environment variable "+i),l}();if(!a.address)return o;const l=(0,c.splitHostPort)(e.path);if(!l)return o;if(function(e){for(const t of function(){let e=process.env.no_grpc_proxy,t="no_grpc_proxy";e||(e=process.env.no_proxy,t="no_proxy");return e?(d("No proxy server list set by environment variable "+t),e.split(",")):[]}()){const i=f(t);if((0,s.isIPv4)(e)&&i&&g(i,e))return!0;if(e.endsWith(t))return!0}return!1}(l.host))return d("Not using proxy for target in no_proxy list: "+(0,c.uriToString)(e)),o;const h={"grpc.http_connect_target":(0,c.uriToString)(e)};a.creds&&(h["grpc.http_connect_creds"]=a.creds);return{target:{scheme:"dns",path:a.address},extraOptions:h}},t.getProxiedConnection=function(e,t){var i;if(!("grpc.http_connect_target"in t))return Promise.resolve(null);const s=t["grpc.http_connect_target"],a=(0,c.parseUri)(s);if(null===a)return Promise.resolve(null);const u=(0,c.splitHostPort)(a.path);if(null===u)return Promise.resolve(null);const f=`${u.host}:${null!==(i=u.port)&&void 0!==i?i:h.DEFAULT_PORT}`,p={method:"CONNECT",path:f},g={Host:f};(0,l.isTcpSubchannelAddress)(e)?(p.host=e.host,p.port=e.port):p.socketPath=e.path;"grpc.http_connect_creds"in t&&(g["Proxy-Authorization"]="Basic "+Buffer.from(t["grpc.http_connect_creds"]).toString("base64"));p.headers=g;const m=(0,l.subchannelAddressToString)(e);return d("Using proxy "+m+" to connect to "+p.path),new Promise((e,t)=>{const i=o.request(p);i.once("connect",(s,o,a)=>{i.removeAllListeners(),o.removeAllListeners(),200===s.statusCode?(d("Successfully connected to "+p.path+" through proxy "+m),a.length>0&&o.unshift(a),d("Successfully established a plaintext connection to "+p.path+" through proxy "+m),e(o)):((0,n.log)(r.LogVerbosity.ERROR,"Failed to connect to "+p.path+" through proxy "+m+" with status "+s.statusCode),t())}),i.once("error",e=>{i.removeAllListeners(),(0,n.log)(r.LogVerbosity.ERROR,"Failed to connect to proxy "+m+" with error "+e.message),t()}),i.end()})};const n=i(267),r=i(131),s=i(9278),o=i(8611),a=i(267),l=i(8996),c=i(3822),u=i(7016),h=i(6700);function d(e){a.trace(r.LogVerbosity.DEBUG,"proxy",e)}function f(e){const t=e.split("/");if(2!==t.length)return null;const i=parseInt(t[1],10);return!(0,s.isIPv4)(t[0])||Number.isNaN(i)||i<0||i>32?null:{ip:p(t[0]),prefixLength:i}}function p(e){return e.split(".").reduce((e,t)=>(e<<8)+parseInt(t,10),0)}function g(e,t){const i=e.ip,n=-1<<32-e.prefixLength;return(p(t)&n)===(i&n)}},674(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.experimental=t.ServerMetricRecorder=t.ServerInterceptingCall=t.ResponderBuilder=t.ServerListenerBuilder=t.addAdminServicesToServer=t.getChannelzHandlers=t.getChannelzServiceDefinition=t.InterceptorConfigurationError=t.InterceptingCall=t.RequesterBuilder=t.ListenerBuilder=t.StatusBuilder=t.getClientChannel=t.ServerCredentials=t.Server=t.setLogVerbosity=t.setLogger=t.load=t.loadObject=t.CallCredentials=t.ChannelCredentials=t.waitForClientReady=t.closeClient=t.Channel=t.makeGenericClientConstructor=t.makeClientConstructor=t.loadPackageDefinition=t.Client=t.compressionAlgorithms=t.propagate=t.connectivityState=t.status=t.logVerbosity=t.Metadata=t.credentials=void 0;const n=i(2267);Object.defineProperty(t,"CallCredentials",{enumerable:!0,get:function(){return n.CallCredentials}});const r=i(3653);Object.defineProperty(t,"Channel",{enumerable:!0,get:function(){return r.ChannelImplementation}});const s=i(5179);Object.defineProperty(t,"compressionAlgorithms",{enumerable:!0,get:function(){return s.CompressionAlgorithms}});const o=i(463);Object.defineProperty(t,"connectivityState",{enumerable:!0,get:function(){return o.ConnectivityState}});const a=i(7434);Object.defineProperty(t,"ChannelCredentials",{enumerable:!0,get:function(){return a.ChannelCredentials}});const l=i(5563);Object.defineProperty(t,"Client",{enumerable:!0,get:function(){return l.Client}});const c=i(131);Object.defineProperty(t,"logVerbosity",{enumerable:!0,get:function(){return c.LogVerbosity}}),Object.defineProperty(t,"status",{enumerable:!0,get:function(){return c.Status}}),Object.defineProperty(t,"propagate",{enumerable:!0,get:function(){return c.Propagate}});const u=i(267),h=i(4056);Object.defineProperty(t,"loadPackageDefinition",{enumerable:!0,get:function(){return h.loadPackageDefinition}}),Object.defineProperty(t,"makeClientConstructor",{enumerable:!0,get:function(){return h.makeClientConstructor}}),Object.defineProperty(t,"makeGenericClientConstructor",{enumerable:!0,get:function(){return h.makeClientConstructor}});const d=i(4097);Object.defineProperty(t,"Metadata",{enumerable:!0,get:function(){return d.Metadata}});const f=i(5943);Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return f.Server}});const p=i(8692);Object.defineProperty(t,"ServerCredentials",{enumerable:!0,get:function(){return p.ServerCredentials}});const g=i(2284);Object.defineProperty(t,"StatusBuilder",{enumerable:!0,get:function(){return g.StatusBuilder}}),t.credentials={combineChannelCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),combineCallCredentials:(e,...t)=>t.reduce((e,t)=>e.compose(t),e),createInsecure:a.ChannelCredentials.createInsecure,createSsl:a.ChannelCredentials.createSsl,createFromSecureContext:a.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:n.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:n.CallCredentials.createFromGoogleCredential,createEmpty:n.CallCredentials.createEmpty};t.closeClient=e=>e.close();t.waitForClientReady=(e,t,i)=>e.waitForReady(t,i);t.loadObject=(e,t)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};t.load=(e,t,i)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};t.setLogger=e=>{u.setLogger(e)};t.setLogVerbosity=e=>{u.setLoggerVerbosity(e)};t.getClientChannel=e=>l.Client.prototype.getChannel.call(e);var m=i(3952);Object.defineProperty(t,"ListenerBuilder",{enumerable:!0,get:function(){return m.ListenerBuilder}}),Object.defineProperty(t,"RequesterBuilder",{enumerable:!0,get:function(){return m.RequesterBuilder}}),Object.defineProperty(t,"InterceptingCall",{enumerable:!0,get:function(){return m.InterceptingCall}}),Object.defineProperty(t,"InterceptorConfigurationError",{enumerable:!0,get:function(){return m.InterceptorConfigurationError}});var v=i(9503);Object.defineProperty(t,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return v.getChannelzServiceDefinition}}),Object.defineProperty(t,"getChannelzHandlers",{enumerable:!0,get:function(){return v.getChannelzHandlers}});var y=i(2661);Object.defineProperty(t,"addAdminServicesToServer",{enumerable:!0,get:function(){return y.addAdminServicesToServer}});var b=i(4892);Object.defineProperty(t,"ServerListenerBuilder",{enumerable:!0,get:function(){return b.ServerListenerBuilder}}),Object.defineProperty(t,"ResponderBuilder",{enumerable:!0,get:function(){return b.ResponderBuilder}}),Object.defineProperty(t,"ServerInterceptingCall",{enumerable:!0,get:function(){return b.ServerInterceptingCall}});var S=i(2921);Object.defineProperty(t,"ServerMetricRecorder",{enumerable:!0,get:function(){return S.ServerMetricRecorder}});const _=i(342);t.experimental=_;const C=i(6700),w=i(305),E=i(82),T=i(6486),k=i(1563),R=i(9012),O=i(4117),P=i(9503);C.setup(),w.setup(),E.setup(),T.setup(),k.setup(),R.setup(),O.setup(),P.setup()},8899(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InternalChannel=t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;const n=i(7434),r=i(4973),s=i(5716),o=i(178),a=i(4097),l=i(131),c=i(1703),u=i(4987),h=i(9302),d=i(267),f=i(7803),p=i(3822),g=i(463),m=i(9503),v=i(2611),y=i(6308),b=i(8446),S=i(5572),_=i(6067),C=i(3135),w=i(2379),E=new Map;class T extends w.BaseSubchannelWrapper{constructor(e,t){super(e),this.channel=t,this.refCount=0,this.subchannelStateListener=(e,i,n,r)=>{t.throttleKeepalive(r)}}ref(){0===this.refCount&&(this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this)),this.child.ref(),this.refCount+=1}unref(){this.child.unref(),this.refCount-=1,this.refCount<=0&&(this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this))}}class k{pick(e){return{pickResultType:o.PickResultType.DROP,status:{code:l.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new a.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}}t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";class R{constructor(e){this.target=e,this.trace=new m.ChannelzTrace,this.callTracker=new m.ChannelzCallTracker,this.childrenTracker=new m.ChannelzChildrenTracker,this.state=g.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>({target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()})}}t.InternalChannel=class{constructor(e,i,a){var v,y,b,S,w,k;if(this.credentials=i,this.options=a,this.connectivityState=g.ConnectivityState.IDLE,this.currentPicker=new o.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.callRefTimer=null,this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),"string"!=typeof e)throw new TypeError("Channel target must be a string");if(!(i instanceof n.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(a&&"object"!=typeof a)throw new TypeError("Channel options must be an object");this.channelzInfoTracker=new R(e);const O=(0,p.parseUri)(e);if(null===O)throw new Error(`Could not parse target name "${e}"`);const P=(0,h.mapUriDefaultScheme)(O);if(null===P)throw new Error(`Could not find a default scheme for target name "${e}"`);0===this.options["grpc.enable_channelz"]&&(this.channelzEnabled=!1),this.channelzRef=(0,m.registerChannelzChannel)(e,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=(0,h.getDefaultAuthority)(P);const A=(0,f.mapProxyName)(P,a);this.target=A.target,this.options=Object.assign({},this.options,A.extraOptions),this.subchannelPool=(0,s.getSubchannelPool)(0===(null!==(v=this.options["grpc.use_local_subchannel_pool"])&&void 0!==v?v:0)),this.retryBufferTracker=new C.MessageBufferTracker(null!==(y=this.options["grpc.retry_buffer_size"])&&void 0!==y?y:16777216,null!==(b=this.options["grpc.per_rpc_retry_buffer_size"])&&void 0!==b?b:1048576),this.keepaliveTime=null!==(S=this.options["grpc.keepalive_time_ms"])&&void 0!==S?S:-1,this.idleTimeoutMs=Math.max(null!==(w=this.options["grpc.client_idle_timeout_ms"])&&void 0!==w?w:18e5,1e3);const x={createSubchannel:(e,i)=>{const n={};for(const[e,r]of Object.entries(i))e.startsWith(t.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX)||(n[e]=r);const r=this.subchannelPool.getOrCreateSubchannel(this.target,e,n,this.credentials);r.throttleKeepalive(this.keepaliveTime),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",r.getChannelzRef());return new T(r,this)},updateState:(e,t)=>{this.currentPicker=t;const i=this.pickQueue.slice();this.pickQueue=[],i.length>0&&this.callRefTimerUnref();for(const e of i)e.doPick();this.updateState(e)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.refChild(e)},removeChannelzChild:e=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.unrefChild(e)}};this.resolvingLoadBalancer=new r.ResolvingLoadBalancer(this.target,x,this.options,(e,t)=>{var i;e.retryThrottling?E.set(this.getTarget(),new C.RetryThrottler(e.retryThrottling.maxTokens,e.retryThrottling.tokenRatio,E.get(this.getTarget()))):E.delete(this.getTarget()),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded"),null===(i=this.configSelector)||void 0===i||i.unref(),this.configSelector=t,this.currentResolutionError=null,process.nextTick(()=>{const e=this.configSelectionQueue;this.configSelectionQueue=[],e.length>0&&this.callRefTimerUnref();for(const t of e)t.getConfig()})},e=>{this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+e.code+' and details "'+e.details+'"'),this.configSelectionQueue.length>0&&this.trace("Name resolution failed with calls queued for config selection"),null===this.configSelector&&(this.currentResolutionError=Object.assign(Object.assign({},(0,_.restrictControlPlaneStatusCode)(e.code,e.details)),{metadata:e.metadata}));const t=this.configSelectionQueue;this.configSelectionQueue=[],t.length>0&&this.callRefTimerUnref();for(const i of t)i.reportResolverError(e)}),this.filterStackFactory=new c.FilterStackFactory([new u.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(a,void 0,2));const N=new Error;(0,d.isTracerEnabled)("channel_stacktrace")&&(0,d.trace)(l.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+") Channel constructed \n"+(null===(k=N.stack)||void 0===k?void 0:k.substring(N.stack.indexOf("\n")+1))),this.lastActivityTimestamp=new Date}trace(e,t){(0,d.trace)(null!=t?t:l.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,p.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,t,i,n;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},2147483647)),(null===(t=(e=this.callRefTimer).hasRef)||void 0===t?void 0:t.call(e))||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(n=(i=this.callRefTimer).ref)||void 0===n||n.call(i))}callRefTimerUnref(){var e,t,i;(null===(e=this.callRefTimer)||void 0===e?void 0:e.hasRef)&&!this.callRefTimer.hasRef()||(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),null===(i=null===(t=this.callRefTimer)||void 0===t?void 0:t.unref)||void 0===i||i.call(t))}removeConnectivityStateWatcher(e){const t=this.connectivityStateWatchers.findIndex(t=>t===e);t>=0&&this.connectivityStateWatchers.splice(t,1)}updateState(e){(0,d.trace)(l.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,p.uriToString)(this.target)+" "+g.ConnectivityState[this.connectivityState]+" -> "+g.ConnectivityState[e]),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+g.ConnectivityState[e]),this.connectivityState=e,this.channelzInfoTracker.state=e;const t=this.connectivityStateWatchers.slice();for(const i of t)e!==i.currentState&&(i.timer&&clearTimeout(i.timer),this.removeConnectivityStateWatcher(i),i.callback());e!==g.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(e){if(e>this.keepaliveTime){this.keepaliveTime=e;for(const t of this.wrappedSubchannels)t.throttleKeepalive(e)}}addWrappedSubchannel(e){this.wrappedSubchannels.add(e)}removeWrappedSubchannel(e){this.wrappedSubchannels.delete(e)}doPick(e,t){return this.currentPicker.pick({metadata:e,extraPickInfo:t})}queueCallForPick(e){this.pickQueue.push(e),this.callRefTimerRef()}getConfig(e,t){return this.connectivityState!==g.ConnectivityState.SHUTDOWN&&this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector.invoke(e,t,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(e){this.configSelectionQueue.push(e),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(g.ConnectivityState.IDLE),this.currentPicker=new o.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.callRefTimer&&(clearInterval(this.callRefTimer),this.callRefTimer=null)}startIdleTimeout(e){var t,i;this.idleTimer=setTimeout(()=>{if(this.callCount>0)return void this.startIdleTimeout(this.idleTimeoutMs);const e=(new Date).valueOf()-this.lastActivityTimestamp.valueOf();e>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-e)},e),null===(i=(t=this.idleTimer).unref)||void 0===i||i.call(t)}maybeStartIdleTimer(){this.connectivityState===g.ConnectivityState.SHUTDOWN||this.idleTimer||this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.channelzInfoTracker.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(e){this.channelzEnabled&&(e.code===l.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(e,t,i,n,r){const s=(0,S.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+s+'] method="'+t+'"'),new v.LoadBalancingCall(this,e,t,i,n,r,s)}createRetryingCall(e,t,i,n,r){const s=(0,S.getNextCallNumber)();return this.trace("createRetryingCall ["+s+'] method="'+t+'"'),new C.RetryingCall(this,e,t,i,n,r,s,this.retryBufferTracker,E.get(this.getTarget()))}createResolvingCall(e,t,i,n,r){const s=(0,S.getNextCallNumber)();this.trace("createResolvingCall ["+s+'] method="'+e+'", deadline='+(0,y.deadlineToString)(t));const o={deadline:t,flags:null!=r?r:l.Propagate.DEFAULTS,host:null!=i?i:this.defaultAuthority,parentCall:n},a=new b.ResolvingCall(this,e,o,this.filterStackFactory.clone(),s);return this.onCallStart(),a.addStatusWatcher(e=>{this.onCallEnd(e)}),a}close(){var e;this.resolvingLoadBalancer.destroy(),this.updateState(g.ConnectivityState.SHUTDOWN),this.currentPicker=new k;for(const e of this.configSelectionQueue)e.cancelWithStatus(l.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(const e of this.pickQueue)e.cancelWithStatus(l.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue=[],this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,m.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),null===(e=this.configSelector)||void 0===e||e.unref(),this.configSelector=null}getTarget(){return(0,p.uriToString)(this.target)}getConnectivityState(e){const t=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),t}watchConnectivityState(e,t,i){if(this.connectivityState===g.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let n=null;if(t!==1/0){const e=t instanceof Date?t:new Date(t),s=new Date;if(t===-1/0||e<=s)return void process.nextTick(i,new Error("Deadline passed without connectivity state change"));n=setTimeout(()=>{this.removeConnectivityStateWatcher(r),i(new Error("Deadline passed without connectivity state change"))},e.getTime()-s.getTime())}const r={currentState:e,callback:i,timer:n};this.connectivityStateWatchers.push(r)}getChannelzRef(){return this.channelzRef}createCall(e,t,i,n,r){if("string"!=typeof e)throw new TypeError("Channel#createCall: method must be a string");if(!("number"==typeof t||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===g.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(e,t,i,n,r)}getOptions(){return this.options}}},533(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChildLoadBalancerHandler=void 0;const n=i(8923),r=i(463);t.ChildLoadBalancerHandler=class{constructor(e){this.channelControlHelper=e,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(e){this.parent=e,this.child=null}createSubchannel(e,t){return this.parent.channelControlHelper.createSubchannel(e,t)}updateState(e,t,i){var n;if(this.calledByPendingChild()){if(e===r.ConnectivityState.CONNECTING)return;null===(n=this.parent.currentChild)||void 0===n||n.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(e,t,i)}requestReresolution(){var e;const t=null!==(e=this.parent.pendingChild)&&void 0!==e?e:this.parent.currentChild;this.child===t&&this.parent.channelControlHelper.requestReresolution()}setChild(e){this.child=e}addChannelzChild(e){this.parent.channelControlHelper.addChannelzChild(e)}removeChannelzChild(e){this.parent.channelControlHelper.removeChannelzChild(e)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(e,t){return e.getLoadBalancerName()!==t.getLoadBalancerName()}updateAddressList(e,t,i,r){let s;if(null===this.currentChild||null===this.latestConfig||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,t)){const e=new this.ChildPolicyHelper(this),i=(0,n.createLoadBalancer)(t,e);e.setChild(i),null===this.currentChild?(this.currentChild=i,s=this.currentChild):(this.pendingChild&&this.pendingChild.destroy(),this.pendingChild=i,s=this.pendingChild)}else s=null===this.pendingChild?this.currentChild:this.pendingChild;return this.latestConfig=t,s.updateAddressList(e,t,i,r)}exitIdle(){this.currentChild&&(this.currentChild.exitIdle(),this.pendingChild&&this.pendingChild.exitIdle())}resetBackoff(){this.currentChild&&(this.currentChild.resetBackoff(),this.pendingChild&&this.pendingChild.resetBackoff())}destroy(){this.currentChild&&(this.currentChild.destroy(),this.currentChild=null),this.pendingChild&&(this.pendingChild.destroy(),this.pendingChild=null)}getTypeName(){return"child_load_balancer_helper"}}},9012(e,t,i){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.OutlierDetectionLoadBalancer=t.OutlierDetectionLoadBalancingConfig=void 0,t.setup=function(){m&&(0,a.registerLoadBalancerType)(g,k,C)};const r=i(463),s=i(131),o=i(4700),a=i(342),l=i(8923),c=i(533),u=i(178),h=i(8996),d=i(2379),f=i(267);function p(e){f.trace(s.LogVerbosity.DEBUG,"outlier_detection",e)}const g="outlier_detection",m="true"===(null!==(n=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)&&void 0!==n?n:"true"),v={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},y={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function b(e,t,i,n){if(t in e&&void 0!==e[t]&&typeof e[t]!==i){throw new Error(`outlier detection config ${n?`${n}.${t}`:t} parse error: expected ${i}, got ${typeof e[t]}`)}}function S(e,t,i){const n=i?`${i}.${t}`:t;if(t in e&&void 0!==e[t]){if(!(0,o.isDuration)(e[t]))throw new Error(`outlier detection config ${n} parse error: expected Duration, got ${typeof e[t]}`);if(!(e[t].seconds>=0&&e[t].seconds<=315576e6&&e[t].nanos>=0&&e[t].nanos<=999999999))throw new Error(`outlier detection config ${n} parse error: values out of range for non-negative Duaration`)}}function _(e,t,i){const n=i?`${i}.${t}`:t;if(b(e,t,"number",i),t in e&&void 0!==e[t]&&!(e[t]>=0&&e[t]<=100))throw new Error(`outlier detection config ${n} parse error: value out of range for percentage (0-100)`)}class C{constructor(e,t,i,n,r,s,o){if(this.childPolicy=o,"pick_first"===o.getLoadBalancerName())throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=null!=e?e:1e4,this.baseEjectionTimeMs=null!=t?t:3e4,this.maxEjectionTimeMs=null!=i?i:3e5,this.maxEjectionPercent=null!=n?n:10,this.successRateEjection=r?Object.assign(Object.assign({},v),r):null,this.failurePercentageEjection=s?Object.assign(Object.assign({},y),s):null}getLoadBalancerName(){return g}toJsonObject(){var e,t;return{outlier_detection:{interval:(0,o.msToDuration)(this.intervalMs),base_ejection_time:(0,o.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,o.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:null!==(e=this.successRateEjection)&&void 0!==e?e:void 0,failure_percentage_ejection:null!==(t=this.failurePercentageEjection)&&void 0!==t?t:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(e){var t;if(S(e,"interval"),S(e,"base_ejection_time"),S(e,"max_ejection_time"),_(e,"max_ejection_percent"),"success_rate_ejection"in e&&void 0!==e.success_rate_ejection){if("object"!=typeof e.success_rate_ejection)throw new Error("outlier detection config success_rate_ejection must be an object");b(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),_(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),b(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),b(e.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in e&&void 0!==e.failure_percentage_ejection){if("object"!=typeof e.failure_percentage_ejection)throw new Error("outlier detection config failure_percentage_ejection must be an object");_(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),_(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),b(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),b(e.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in e)||!Array.isArray(e.child_policy))throw new Error("outlier detection config child_policy must be an array");const i=(0,l.selectLbConfigFromList)(e.child_policy);if(!i)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new C(e.interval?(0,o.durationToMs)(e.interval):null,e.base_ejection_time?(0,o.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,o.durationToMs)(e.max_ejection_time):null,null!==(t=e.max_ejection_percent)&&void 0!==t?t:null,e.success_rate_ejection,e.failure_percentage_ejection,i)}}t.OutlierDetectionLoadBalancingConfig=C;class w extends d.BaseSubchannelWrapper{constructor(e,t){super(e),this.mapEntry=t,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){const e=this.mapEntry.subchannelWrappers.indexOf(this);e>=0&&this.mapEntry.subchannelWrappers.splice(e,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}}class E{constructor(){this.activeBucket={success:0,failure:0},this.inactiveBucket={success:0,failure:0}}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket={success:0,failure:0}}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}}class T{constructor(e,t){this.wrappedPicker=e,this.countCalls=t}pick(e){const t=this.wrappedPicker.pick(e);if(t.pickResultType===u.PickResultType.COMPLETE){const e=t.subchannel,i=e.getMapEntry();if(i){let n=t.onCallEnded;return this.countCalls&&(n=(e,n,r)=>{var o;e===s.Status.OK?i.counter.addSuccess():i.counter.addFailure(),null===(o=t.onCallEnded)||void 0===o||o.call(t,e,n,r)}),Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel(),onCallEnded:n})}return Object.assign(Object.assign({},t),{subchannel:e.getWrappedSubchannel()})}return t}}class k{constructor(e){this.entryMap=new h.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new c.ChildLoadBalancerHandler((0,a.createChildChannelControlHelper)(e,{createSubchannel:(t,i)=>{const n=e.createSubchannel(t,i),r=this.entryMap.getForSubchannelAddress(t),s=new w(n,r);return null!==(null==r?void 0:r.currentEjectionTimestamp)&&s.eject(),null==r||r.subchannelWrappers.push(s),s},updateState:(t,i,n)=>{t===r.ConnectivityState.READY?e.updateState(t,new T(i,this.isCountingEnabled()),n):e.updateState(t,i,n)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return null!==this.latestConfig&&(null!==this.latestConfig.getSuccessRateEjectionConfig()||null!==this.latestConfig.getFailurePercentageEjectionConfig())}getCurrentEjectionPercent(){let e=0;for(const t of this.entryMap.values())null!==t.currentEjectionTimestamp&&(e+=1);return 100*e/this.entryMap.size}runSuccessRateCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getSuccessRateEjectionConfig();if(!t)return;p("Running success rate check");const i=t.request_volume;let n=0;const r=[];for(const[e,t]of this.entryMap.entries()){const s=t.counter.getLastSuccesses(),o=t.counter.getLastFailures();p("Stats for "+(0,h.endpointToString)(e)+": successes="+s+" failures="+o+" targetRequestVolume="+i),s+o>=i&&(n+=1,r.push(s/(s+o)))}if(p("Found "+n+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+r+"]"),n<t.minimum_hosts)return;const s=r.reduce((e,t)=>e+t)/r.length;let o=0;for(const e of r){const t=e-s;o+=t*t}const a=o/r.length,l=Math.sqrt(a),c=s-l*(t.stdev_factor/1e3);p("stdev="+l+" ejectionThreshold="+c);for(const[n,r]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const s=r.counter.getLastSuccesses(),o=r.counter.getLastFailures();if(s+o<i)continue;const a=s/(s+o);if(p("Checking candidate "+n+" successRate="+a),a<c){const i=100*Math.random();p("Candidate "+n+" randomNumber="+i+" enforcement_percentage="+t.enforcement_percentage),i<t.enforcement_percentage&&(p("Ejecting candidate "+n),this.eject(r,e))}}}runFailurePercentageCheck(e){if(!this.latestConfig)return;const t=this.latestConfig.getFailurePercentageEjectionConfig();if(!t)return;p("Running failure percentage check. threshold="+t.threshold+" request volume threshold="+t.request_volume);let i=0;for(const e of this.entryMap.values()){e.counter.getLastSuccesses()+e.counter.getLastFailures()>=t.request_volume&&(i+=1)}if(!(i<t.minimum_hosts))for(const[i,n]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;const r=n.counter.getLastSuccesses(),s=n.counter.getLastFailures();if(p("Candidate successes="+r+" failures="+s),r+s<t.request_volume)continue;if(100*s/(s+r)>t.threshold){const r=100*Math.random();p("Candidate "+i+" randomNumber="+r+" enforcement_percentage="+t.enforcement_percentage),r<t.enforcement_percentage&&(p("Ejecting candidate "+i),this.eject(n,e))}}}eject(e,t){e.currentEjectionTimestamp=new Date,e.ejectionTimeMultiplier+=1;for(const t of e.subchannelWrappers)t.eject()}uneject(e){e.currentEjectionTimestamp=null;for(const t of e.subchannelWrappers)t.uneject()}switchAllBuckets(){for(const e of this.entryMap.values())e.counter.switchBuckets()}startTimer(e){var t,i;this.ejectionTimer=setTimeout(()=>this.runChecks(),e),null===(i=(t=this.ejectionTimer).unref)||void 0===i||i.call(t)}runChecks(){const e=new Date;if(p("Ejection timer running"),this.switchAllBuckets(),this.latestConfig){this.timerStartTime=e,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(e),this.runFailurePercentageCheck(e);for(const[e,t]of this.entryMap.entries())if(null===t.currentEjectionTimestamp)t.ejectionTimeMultiplier>0&&(t.ejectionTimeMultiplier-=1);else{const i=this.latestConfig.getBaseEjectionTimeMs(),n=this.latestConfig.getMaxEjectionTimeMs(),r=new Date(t.currentEjectionTimestamp.getTime());r.setMilliseconds(r.getMilliseconds()+Math.min(i*t.ejectionTimeMultiplier,Math.max(i,n))),r<new Date&&(p("Unejecting "+e),this.uneject(t))}}}updateAddressList(e,t,i,n){if(!(t instanceof C))return!1;if(p("Received update with config: "+JSON.stringify(t.toJsonObject(),void 0,2)),e.ok){for(const t of e.value)this.entryMap.has(t)||(p("Adding map entry for "+(0,h.endpointToString)(t)),this.entryMap.set(t,{counter:new E,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));this.entryMap.deleteMissing(e.value)}const r=t.getChildPolicy();if(this.childBalancer.updateAddressList(e,r,i,n),t.getSuccessRateEjectionConfig()||t.getFailurePercentageEjectionConfig())if(this.timerStartTime){p("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);const e=t.getIntervalMs()-((new Date).getTime()-this.timerStartTime.getTime());this.startTimer(e)}else p("Starting new timer"),this.timerStartTime=new Date,this.startTimer(t.getIntervalMs()),this.switchAllBuckets();else{p("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(const e of this.entryMap.values())this.uneject(e),e.ejectionTimeMultiplier=0}return this.latestConfig=t,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return g}}t.OutlierDetectionLoadBalancer=k},6486(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LeafLoadBalancer=t.PickFirstLoadBalancer=t.PickFirstLoadBalancingConfig=void 0,t.shuffled=m,t.setup=function(){(0,n.registerLoadBalancerType)(f,y,p),(0,n.registerDefaultLoadBalancerType)(f)};const n=i(8923),r=i(463),s=i(178),o=i(8996),a=i(267),l=i(131),c=i(8996),u=i(9278),h=i(5034);function d(e){a.trace(l.LogVerbosity.DEBUG,"pick_first",e)}const f="pick_first";class p{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return f}toJsonObject(){return{[f]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(e){if("shuffleAddressList"in e&&"boolean"!=typeof e.shuffleAddressList)throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new p(!0===e.shuffleAddressList)}}t.PickFirstLoadBalancingConfig=p;class g{constructor(e){this.subchannel=e}pick(e){return{pickResultType:s.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}}function m(e){const t=e.slice();for(let e=t.length-1;e>1;e--){const i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t}const v="grpc-node.internal.pick-first.report_health_status";class y{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=r.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(e,t,i,n,r)=>{this.onSubchannelStateUpdate(e,t,i,r)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every(e=>e.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every(e=>e.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var e;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){const e=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(r.ConnectivityState.READY,new g(this.currentPick),null);else if(0===(null===(e=this.latestAddressList)||void 0===e?void 0:e.length)){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else if(0===this.children.length)this.updateState(r.ConnectivityState.IDLE,new s.QueuePicker(this),null);else if(this.stickyTransientFailureMode){const e=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(r.ConnectivityState.CONNECTING,new s.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF())if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode)this.calculateAndReportNewState();else{this.stickyTransientFailureMode=!0;for(const{subchannel:e}of this.children)e.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){null!==this.currentPick&&(this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null)}onSubchannelStateUpdate(e,t,i,n){var s;if(null===(s=this.currentPick)||void 0===s?void 0:s.realSubchannelEquals(e))i!==r.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState());else for(const[t,s]of this.children.entries())if(e.realSubchannelEquals(s.subchannel))return i===r.ConnectivityState.READY&&this.pickSubchannel(s.subchannel),i===r.ConnectivityState.TRANSIENT_FAILURE&&(s.hasReportedTransientFailure=!0,n&&(this.lastError=n),this.maybeEnterStickyTransientFailureMode(),t===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(t+1)),void s.subchannel.startConnecting()}startNextSubchannelConnecting(e){clearTimeout(this.connectionDelayTimeout);for(const[t,i]of this.children.entries())if(t>=e){const e=i.subchannel.getConnectivityState();if(e===r.ConnectivityState.IDLE||e===r.ConnectivityState.CONNECTING)return void this.startConnecting(t)}this.maybeEnterStickyTransientFailureMode()}startConnecting(e){var t,i;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=e,this.children[e].subchannel.getConnectivityState()===r.ConnectivityState.IDLE&&(d("Start connecting to subchannel with address "+this.children[e].subchannel.getAddress()),process.nextTick(()=>{var t;null===(t=this.children[e])||void 0===t||t.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(e+1)},250),null===(i=(t=this.connectionDelayTimeout).unref)||void 0===i||i.call(t)}pickSubchannel(e){d("Pick subchannel with address "+e.getAddress()),this.stickyTransientFailureMode=!1,e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),e.addConnectivityStateListener(this.subchannelStateListener),e.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=e,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(e,t,i){d(r.ConnectivityState[this.currentState]+" -> "+r.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,t,i)}resetSubchannelList(){for(const e of this.children)e.subchannel.removeConnectivityStateListener(this.subchannelStateListener),e.subchannel.unref(),this.channelControlHelper.removeChannelzChild(e.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(e,t){d("connectToAddressList(["+e.map(e=>(0,o.subchannelAddressToString)(e))+"])");const i=e.map(e=>({subchannel:this.channelControlHelper.createSubchannel(e,t),hasReportedTransientFailure:!1}));for(const{subchannel:e}of i)if(e.getConnectivityState()===r.ConnectivityState.READY)return void this.pickSubchannel(e);for(const{subchannel:e}of i)e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef());this.resetSubchannelList(),this.children=i;for(const{subchannel:e}of this.children)e.addConnectivityStateListener(this.subchannelStateListener);for(const e of this.children)e.subchannel.getConnectivityState()===r.ConnectivityState.TRANSIENT_FAILURE&&(e.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(e,t,i,n){if(!(t instanceof p))return!1;if(!e.ok)return 0===this.children.length&&null===this.currentPick&&this.channelControlHelper.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker(e.error),e.error.details),!0;let a=e.value;this.reportHealthStatus=i[v],t.getShuffleAddressList()&&(a=m(a));const l=[].concat(...a.map(e=>e.addresses));d("updateAddressList(["+l.map(e=>(0,o.subchannelAddressToString)(e))+"])");const h=function(e){if(0===e.length)return[];const t=[],i=[],n=[],r=(0,c.isTcpSubchannelAddress)(e[0])&&(0,u.isIPv6)(e[0].host);for(const t of e)(0,c.isTcpSubchannelAddress)(t)&&(0,u.isIPv6)(t.host)?i.push(t):n.push(t);const s=r?i:n,o=r?n:i;for(let e=0;e<Math.max(s.length,o.length);e++)e<s.length&&t.push(s[e]),e<o.length&&t.push(o[e]);return t}(l);return this.latestAddressList=h,this.latestOptions=i,this.connectToAddressList(h,i),this.latestResolutionNote=n,l.length>0||(this.lastError="No addresses resolved",!1)}exitIdle(){this.currentState===r.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return f}}t.PickFirstLoadBalancer=y;const b=new p(!1);t.LeafLoadBalancer=class{constructor(e,t,i,o){this.endpoint=e,this.options=i,this.resolutionNote=o,this.latestState=r.ConnectivityState.IDLE;const a=(0,n.createChildChannelControlHelper)(t,{updateState:(e,i,n)=>{this.latestState=e,this.latestPicker=i,t.updateState(e,i,n)}});this.pickFirstBalancer=new y(a),this.latestPicker=new s.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,h.statusOrFromValue)([this.endpoint]),b,Object.assign(Object.assign({},this.options),{[v]:!0}),this.resolutionNote)}updateEndpoint(e,t){this.options=t,this.endpoint=e,this.latestState!==r.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}}},1563(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RoundRobinLoadBalancer=void 0,t.setup=function(){(0,n.registerLoadBalancerType)(h,p,d)};const n=i(8923),r=i(463),s=i(178),o=i(267),a=i(131),l=i(8996),c=i(6486);function u(e){o.trace(a.LogVerbosity.DEBUG,"round_robin",e)}const h="round_robin";class d{getLoadBalancerName(){return h}constructor(){}toJsonObject(){return{[h]:{}}}static createFromJson(e){return new d}}class f{constructor(e,t=0){this.children=e,this.nextIndex=t}pick(e){const t=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,t.pick(e)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}}class p{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=r.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,n.createChildChannelControlHelper)(e,{updateState:(e,t,i)=>{this.currentState===r.ConnectivityState.READY&&e!==r.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),i&&(this.lastError=i),this.calculateAndUpdateState()}})}countChildrenWithState(e){return this.children.filter(t=>t.getConnectivityState()===e).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(r.ConnectivityState.READY)>0){const e=this.children.filter(e=>e.getConnectivityState()===r.ConnectivityState.READY);let t=0;if(null!==this.currentReadyPicker){const i=this.currentReadyPicker.peekNextEndpoint();t=e.findIndex(e=>(0,l.endpointEqual)(e.getEndpoint(),i)),t<0&&(t=0)}this.updateState(r.ConnectivityState.READY,new f(e.map(e=>({endpoint:e.getEndpoint(),picker:e.getPicker()})),t),null)}else if(this.countChildrenWithState(r.ConnectivityState.CONNECTING)>0)this.updateState(r.ConnectivityState.CONNECTING,new s.QueuePicker(this),null);else if(this.countChildrenWithState(r.ConnectivityState.TRANSIENT_FAILURE)>0){const e=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}else this.updateState(r.ConnectivityState.IDLE,new s.QueuePicker(this),null);for(const e of this.children)e.getConnectivityState()===r.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,t,i){u(r.ConnectivityState[this.currentState]+" -> "+r.ConnectivityState[e]),e===r.ConnectivityState.READY?this.currentReadyPicker=t:this.currentReadyPicker=null,this.currentState=e,this.channelControlHelper.updateState(e,t,i)}resetSubchannelList(){for(const e of this.children)e.destroy();this.children=[]}updateAddressList(e,t,i,n){if(!(t instanceof d))return!1;if(!e.ok)return 0===this.children.length&&this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker(e.error),e.error.details),!0;const o=Math.random()*e.value.length|0,a=function(e,t){return[...e.slice(t),...e.slice(0,t)]}(e.value,o);if(this.resetSubchannelList(),0===a.length){const e=`No addresses resolved. Resolution note: ${n}`;this.updateState(r.ConnectivityState.TRANSIENT_FAILURE,new s.UnavailablePicker({details:e}),e)}u("Connect to endpoint list "+a.map(l.endpointToString)),this.updatesPaused=!0,this.children=a.map(e=>new c.LeafLoadBalancer(e,this.childChannelControlHelper,i,n));for(const e of this.children)e.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return h}}t.RoundRobinLoadBalancer=p},4117(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WeightedRoundRobinLoadBalancingConfig=void 0,t.setup=function(){(0,o.registerLoadBalancerType)(p,b,v)};const n=i(463),r=i(131),s=i(4700),o=i(8923),a=i(6486),l=i(267),c=i(2921),u=i(178),h=i(222),d=i(8996);function f(e){l.trace(r.LogVerbosity.DEBUG,"weighted_round_robin",e)}const p="weighted_round_robin";function g(e,t,i){if(t in e&&void 0!==e[t]&&typeof e[t]!==i)throw new Error(`weighted round robin config ${t} parse error: expected ${i}, got ${typeof e[t]}`)}function m(e,t){if(t in e&&void 0!==e[t]&&null!==e[t]){let i;if((0,s.isDuration)(e[t]))i=e[t];else if((0,s.isDurationMessage)(e[t]))i=(0,s.durationMessageToDuration)(e[t]);else{if("string"!=typeof e[t])throw new Error(`weighted round robin config ${t}: expected duration, got ${typeof e[t]}`);{const n=(0,s.parseDuration)(e[t]);if(!n)throw new Error(`weighted round robin config ${t}: failed to parse duration string ${e[t]}`);i=n}}return(0,s.durationToMs)(i)}return null}class v{constructor(e,t,i,n,r,s){this.enableOobLoadReport=null!=e&&e,this.oobLoadReportingPeriodMs=null!=t?t:1e4,this.blackoutPeriodMs=null!=i?i:1e4,this.weightExpirationPeriodMs=null!=n?n:18e4,this.weightUpdatePeriodMs=Math.max(null!=r?r:1e3,100),this.errorUtilizationPenalty=null!=s?s:1}getLoadBalancerName(){return p}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,s.durationToString)((0,s.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,s.durationToString)((0,s.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,s.durationToString)((0,s.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,s.durationToString)((0,s.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(e){if(g(e,"enable_oob_load_report","boolean"),g(e,"error_utilization_penalty","number"),e.error_utilization_penalty<0)throw new Error("weighted round robin config error_utilization_penalty < 0");return new v(e.enable_oob_load_report,m(e,"oob_load_reporting_period"),m(e,"blackout_period"),m(e,"weight_expiration_period"),m(e,"weight_update_period"),e.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}}t.WeightedRoundRobinLoadBalancingConfig=v;class y{constructor(e,t){this.metricsHandler=t,this.queue=new h.PriorityQueue((e,t)=>e.deadline<t.deadline);const i=e.filter(e=>e.weight>0);let n;if(i.length<2)n=1;else{let e=0;for(const{weight:t}of i)e+=t;n=e/i.length}for(const t of e){const e=t.weight>0?1/t.weight:n;this.queue.push({endpointName:t.endpointName,picker:t.picker,period:e,deadline:Math.random()*e})}}pick(e){const t=this.queue.pop();this.queue.push(Object.assign(Object.assign({},t),{deadline:t.deadline+t.period}));const i=t.picker.pick(e);if(i.pickResultType===u.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},i),{onCallEnded:(0,c.createMetricsReader)(e=>this.metricsHandler(e,t.endpointName),i.onCallEnded)});{const e=i.subchannel;return Object.assign(Object.assign({},i),{subchannel:e.getWrappedSubchannel()})}}return i}}class b{constructor(e){this.channelControlHelper=e,this.latestConfig=null,this.children=new Map,this.currentState=n.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(e){let t=0;for(const i of this.children.values())i.child.getConnectivityState()===e&&(t+=1);return t}updateWeight(e,t){var i,n;const r=t.rps_fractional;let s=t.application_utilization;s>0&&r>0&&(s+=t.eps/r*(null!==(n=null===(i=this.latestConfig)||void 0===i?void 0:i.getErrorUtilizationPenalty())&&void 0!==n?n:0));const o=0===s?0:r/s;if(0===o)return;const a=new Date;null===e.nonEmptySince&&(e.nonEmptySince=a),e.lastUpdated=a,e.weight=o}getWeight(e){if(!this.latestConfig)return 0;const t=(new Date).getTime();if(t-e.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return e.nonEmptySince=null,0;const i=this.latestConfig.getBlackoutPeriodMs();return i>0&&(null===e.nonEmptySince||t-e.nonEmptySince.getTime()<i)?0:e.weight}calculateAndUpdateState(){if(!this.updatesPaused&&this.latestConfig){if(this.countChildrenWithState(n.ConnectivityState.READY)>0){const e=[];for(const[t,i]of this.children)i.child.getConnectivityState()===n.ConnectivityState.READY&&e.push({endpointName:t,picker:i.child.getPicker(),weight:this.getWeight(i)});let t;f("Created picker with weights: "+e.map(e=>e.endpointName+":"+e.weight).join(",")),t=this.latestConfig.getEnableOobLoadReport()?null:(e,t)=>{const i=this.children.get(t);i&&this.updateWeight(i,e)},this.updateState(n.ConnectivityState.READY,new y(e,t),null)}else if(this.countChildrenWithState(n.ConnectivityState.CONNECTING)>0)this.updateState(n.ConnectivityState.CONNECTING,new u.QueuePicker(this),null);else if(this.countChildrenWithState(n.ConnectivityState.TRANSIENT_FAILURE)>0){const e=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(n.ConnectivityState.TRANSIENT_FAILURE,new u.UnavailablePicker({details:e}),e)}else this.updateState(n.ConnectivityState.IDLE,new u.QueuePicker(this),null);for(const{child:e}of this.children.values())e.getConnectivityState()===n.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,t,i){f(n.ConnectivityState[this.currentState]+" -> "+n.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,t,i)}updateAddressList(e,t,i,r){var s,l;if(!(t instanceof v))return!1;if(!e.ok)return 0===this.children.size&&this.updateState(n.ConnectivityState.TRANSIENT_FAILURE,new u.UnavailablePicker(e.error),e.error.details),!0;if(0===e.value.length){const e=`No addresses resolved. Resolution note: ${r}`;return this.updateState(n.ConnectivityState.TRANSIENT_FAILURE,new u.UnavailablePicker({details:e}),e),!1}f("Connect to endpoint list "+e.value.map(d.endpointToString));const h=new Date,p=new Set;this.updatesPaused=!0,this.latestConfig=t;for(const s of e.value){const e=(0,d.endpointToString)(s);p.add(e);let l=this.children.get(e);l||(l={child:new a.LeafLoadBalancer(s,(0,o.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(e,t,i)=>{this.currentState===n.ConnectivityState.READY&&e!==n.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),e===n.ConnectivityState.READY&&(l.nonEmptySince=null),i&&(this.lastError=i),this.calculateAndUpdateState()},createSubchannel:(e,t)=>{const i=this.channelControlHelper.createSubchannel(e,t);return(null==l?void 0:l.oobMetricsListener)?new c.OrcaOobMetricsSubchannelWrapper(i,l.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs()):i}}),i,r),lastUpdated:h,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(e,l)),t.getEnableOobLoadReport()?l.oobMetricsListener=e=>{this.updateWeight(l,e)}:l.oobMetricsListener=null}for(const[e,t]of this.children)p.has(e)?t.child.startConnecting():(t.child.destroy(),this.children.delete(e));return this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer),this.weightUpdateTimer=null===(l=(s=setInterval(()=>{this.currentState===n.ConnectivityState.READY&&this.calculateAndUpdateState()},t.getWeightUpdatePeriodMs())).unref)||void 0===l?void 0:l.call(s),!0}exitIdle(){}resetBackoff(){}destroy(){for(const e of this.children.values())e.child.destroy();this.children.clear(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer)}getTypeName(){return p}}},8923(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createChildChannelControlHelper=function(e,t){var i,n,r,s,o,a,l,c,u,h;return{createSubchannel:null!==(n=null===(i=t.createSubchannel)||void 0===i?void 0:i.bind(t))&&void 0!==n?n:e.createSubchannel.bind(e),updateState:null!==(s=null===(r=t.updateState)||void 0===r?void 0:r.bind(t))&&void 0!==s?s:e.updateState.bind(e),requestReresolution:null!==(a=null===(o=t.requestReresolution)||void 0===o?void 0:o.bind(t))&&void 0!==a?a:e.requestReresolution.bind(e),addChannelzChild:null!==(c=null===(l=t.addChannelzChild)||void 0===l?void 0:l.bind(t))&&void 0!==c?c:e.addChannelzChild.bind(e),removeChannelzChild:null!==(h=null===(u=t.removeChannelzChild)||void 0===u?void 0:u.bind(t))&&void 0!==h?h:e.removeChannelzChild.bind(e)}},t.registerLoadBalancerType=function(e,t,i){s[e]={LoadBalancer:t,LoadBalancingConfig:i}},t.registerDefaultLoadBalancerType=function(e){o=e},t.createLoadBalancer=function(e,t){const i=e.getLoadBalancerName();return i in s?new s[i].LoadBalancer(t):null},t.isLoadBalancerNameRegistered=function(e){return e in s},t.parseLoadBalancingConfig=a,t.getDefaultConfig=function(){if(!o)throw new Error("No default load balancer type registered");return new s[o].LoadBalancingConfig},t.selectLbConfigFromList=function(e,t=!1){for(const t of e)try{return a(t)}catch(e){(0,n.log)(r.LogVerbosity.DEBUG,"Config parsing failed with error",e.message);continue}return t&&o?new s[o].LoadBalancingConfig:null};const n=i(267),r=i(131);const s={};let o=null;function a(e){const t=Object.keys(e);if(1!==t.length)throw new Error("Provided load balancing config has multiple conflicting entries");const i=t[0];if(!(i in s))throw new Error(`Unrecognized load balancing config name ${i}`);try{return s[i].LoadBalancingConfig.createFromJson(e[i])}catch(e){throw new Error(`${i}: ${e.message}`)}}},2611(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoadBalancingCall=void 0;const n=i(463),r=i(131),s=i(6308),o=i(4097),a=i(178),l=i(3822),c=i(267),u=i(6067),h=i(5675);t.LoadBalancingCall=class{constructor(e,t,i,n,r,s,o){var a,c;this.channel=e,this.callConfig=t,this.methodName=i,this.host=n,this.credentials=r,this.deadline=s,this.callNumber=o,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.metadata=null,this.listener=null,this.onCallEnded=null,this.childStartTime=null;const u=this.methodName.split("/");let h="";u.length>=2&&(h=u[1]);const d=null!==(c=null===(a=(0,l.splitHostPort)(this.host))||void 0===a?void 0:a.host)&&void 0!==c?c:"localhost";this.serviceUrl=`https://${d}/${h}`,this.startTime=new Date}getDeadlineInfo(){var e,t;const i=[];return this.childStartTime?(this.childStartTime>this.startTime&&((null===(e=this.metadata)||void 0===e?void 0:e.getOptions().waitForReady)&&i.push("wait_for_ready"),i.push(`LB pick: ${(0,s.formatDateDifference)(this.startTime,this.childStartTime)}`)),i.push(...this.child.getDeadlineInfo()),i):((null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)&&i.push("wait_for_ready"),i.push("Waiting for LB pick"),i)}trace(e){c.trace(r.LogVerbosity.DEBUG,"load_balancing_call","["+this.callNumber+"] "+e)}outputStatus(e,t){var i,n;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString());const r=Object.assign(Object.assign({},e),{progress:t});null===(i=this.listener)||void 0===i||i.onReceiveStatus(r),null===(n=this.onCallEnded)||void 0===n||n.call(this,r.code,r.details,r.metadata)}}doPick(){var e,t;if(this.ended)return;if(!this.metadata)throw new Error("doPick called before start");this.trace("Pick called");const i=this.metadata.clone(),l=this.channel.doPick(i,this.callConfig.pickInformation),c=l.subchannel?"("+l.subchannel.getChannelzRef().id+") "+l.subchannel.getAddress():""+l.subchannel;switch(this.trace("Pick result: "+a.PickResultType[l.pickResultType]+" subchannel: "+c+" status: "+(null===(e=l.status)||void 0===e?void 0:e.code)+" "+(null===(t=l.status)||void 0===t?void 0:t.details)),l.pickResultType){case a.PickResultType.COMPLETE:this.credentials.compose(l.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then(e=>{var t;if(this.ended)this.trace("Credentials metadata generation finished after call ended");else{if(i.merge(e),i.get("authorization").length>1&&this.outputStatus({code:r.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new o.Metadata},"PROCESSED"),l.subchannel.getConnectivityState()!==n.ConnectivityState.READY)return this.trace("Picked subchannel "+c+" has state "+n.ConnectivityState[l.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),void this.doPick();this.deadline!==1/0&&i.set("grpc-timeout",(0,s.getDeadlineTimeoutString)(this.deadline));try{this.child=l.subchannel.getRealSubchannel().createCall(i,this.host,this.methodName,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(e)},onReceiveMessage:e=>{this.trace("Received message"),this.listener.onReceiveMessage(e)},onReceiveStatus:e=>{this.trace("Received status"),e.rstCode===h.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(e,"REFUSED"):this.outputStatus(e,"PROCESSED")}}),this.childStartTime=new Date}catch(e){return this.trace("Failed to start call on picked subchannel "+c+" with error "+e.message),void this.outputStatus({code:r.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+e.message,metadata:new o.Metadata},"NOT_STARTED")}null===(t=l.onCallStarted)||void 0===t||t.call(l),this.onCallEnded=l.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending&&this.child.startRead(),this.pendingMessage&&this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.pendingHalfClose&&this.child.halfClose()}},e=>{const{code:t,details:i}=(0,u.restrictControlPlaneStatusCode)("number"==typeof e.code?e.code:r.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${e.message}`);this.outputStatus({code:t,details:i,metadata:new o.Metadata},"PROCESSED")});break;case a.PickResultType.DROP:const{code:e,details:t}=(0,u.restrictControlPlaneStatusCode)(l.status.code,l.status.details);setImmediate(()=>{this.outputStatus({code:e,details:t,metadata:l.status.metadata},"DROP")});break;case a.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{const{code:e,details:t}=(0,u.restrictControlPlaneStatusCode)(l.status.code,l.status.details);setImmediate(()=>{this.outputStatus({code:e,details:t,metadata:l.status.metadata},"PROCESSED")})}break;case a.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(e,t){var i;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(i=this.child)||void 0===i||i.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new o.Metadata},"PROCESSED")}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.listener=t,this.metadata=e,this.doPick()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.child.sendMessageWithContext(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){throw new Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}}},267(e,t,i){"use strict";var n,r,s,o;Object.defineProperty(t,"__esModule",{value:!0}),t.log=t.setLoggerVerbosity=t.setLogger=t.getLogger=void 0,t.trace=function(e,i,n){m(i)&&(0,t.log)(e,(new Date).toISOString()+" | v"+c+" "+l.pid+" | "+i+" | "+n)},t.isTracerEnabled=m;const a=i(131),l=i(932),c=i(9943).rE;let u={error:(e,...t)=>{console.error("E "+e,...t)},info:(e,...t)=>{console.error("I "+e,...t)},debug:(e,...t)=>{console.error("D "+e,...t)}},h=a.LogVerbosity.ERROR;switch((null!==(r=null!==(n=process.env.GRPC_NODE_VERBOSITY)&&void 0!==n?n:process.env.GRPC_VERBOSITY)&&void 0!==r?r:"").toUpperCase()){case"DEBUG":h=a.LogVerbosity.DEBUG;break;case"INFO":h=a.LogVerbosity.INFO;break;case"ERROR":h=a.LogVerbosity.ERROR;break;case"NONE":h=a.LogVerbosity.NONE}t.getLogger=()=>u;t.setLogger=e=>{u=e};t.setLoggerVerbosity=e=>{h=e};t.log=(e,...t)=>{let i;if(e>=h){switch(e){case a.LogVerbosity.DEBUG:i=u.debug;break;case a.LogVerbosity.INFO:i=u.info;break;case a.LogVerbosity.ERROR:i=u.error}i||(i=u.error),i&&i.bind(u)(...t)}};const d=null!==(o=null!==(s=process.env.GRPC_NODE_TRACE)&&void 0!==s?s:process.env.GRPC_TRACE)&&void 0!==o?o:"",f=new Set,p=new Set;for(const e of d.split(","))e.startsWith("-")?p.add(e.substring(1)):f.add(e);const g=f.has("all");function m(e){return!p.has(e)&&(g||f.has(e))}},4056(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeClientConstructor=o,t.loadPackageDefinition=function(e){const t={};for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i],r=i.split(".");if(r.some(e=>s(e)))continue;const l=r[r.length-1];let c=t;for(const e of r.slice(0,-1))c[e]||(c[e]={}),c=c[e];a(n)?c[l]=n:c[l]=o(n,l,{})}return t};const n=i(5563),r={unary:n.Client.prototype.makeUnaryRequest,server_stream:n.Client.prototype.makeServerStreamRequest,client_stream:n.Client.prototype.makeClientStreamRequest,bidi:n.Client.prototype.makeBidiStreamRequest};function s(e){return["__proto__","prototype","constructor"].includes(e)}function o(e,t,i){i||(i={});class o extends n.Client{}return Object.keys(e).forEach(t=>{if(s(t))return;const i=e[t];let n;if("string"==typeof t&&"$"===t.charAt(0))throw new Error("Method names cannot start with $");n=i.requestStream?i.responseStream?"bidi":"client_stream":i.responseStream?"server_stream":"unary";const a=i.requestSerialize,l=i.responseDeserialize,c=function(e,t,i,n){return function(...r){return e.call(this,t,i,n,...r)}}(r[n],i.path,a,l);o.prototype[t]=c,Object.assign(o.prototype[t],i),i.originalName&&!s(i.originalName)&&(o.prototype[i.originalName]=o.prototype[t])}),o.service=e,o.serviceName=t,o}function a(e){return"format"in e}},4097(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;const n=i(267),r=i(131),s=i(9752),o=/^[:0-9a-z_.-]+$/,a=/^[ -~]*$/;function l(e){return e.endsWith("-bin")}function c(e){return!e.startsWith("grpc-")}function u(e){return e.toLowerCase()}function h(e,t){if(!function(e){return o.test(e)}(e))throw new Error('Metadata key "'+e+'" contains illegal characters');if(null!=t)if(l(e)){if(!Buffer.isBuffer(t))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(t))throw new Error("keys that don't end with '-bin' must have String values");if(!function(e){return a.test(e)}(t))throw new Error('Metadata string value "'+t+'" contains illegal characters')}}class d{constructor(e={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=e}set(e,t){h(e=u(e),t),this.internalRepr.set(e,[t])}add(e,t){h(e=u(e),t);const i=this.internalRepr.get(e);void 0===i?this.internalRepr.set(e,[t]):i.push(t)}remove(e){e=u(e),this.internalRepr.delete(e)}get(e){return e=u(e),this.internalRepr.get(e)||[]}getMap(){const e={};for(const[t,i]of this.internalRepr)if(i.length>0){const n=i[0];e[t]=Buffer.isBuffer(n)?Buffer.from(n):n}return e}clone(){const e=new d(this.options),t=e.internalRepr;for(const[e,i]of this.internalRepr){const n=i.map(e=>Buffer.isBuffer(e)?Buffer.from(e):e);t.set(e,n)}return e}merge(e){for(const[t,i]of e.internalRepr){const e=(this.internalRepr.get(t)||[]).concat(i);this.internalRepr.set(t,e)}}setOptions(e){this.options=e}getOptions(){return this.options}toHttp2Headers(){const e={};for(const[t,i]of this.internalRepr)t.startsWith(":")||(e[t]=i.map(f));return e}toJSON(){const e={};for(const[t,i]of this.internalRepr)e[t]=i;return e}setOpaque(e,t){this.opaqueData.set(e,t)}getOpaque(e){return this.opaqueData.get(e)}static fromHttp2Headers(e){const t=new d;for(const i of Object.keys(e)){if(":"===i.charAt(0))continue;const o=e[i];try{l(i)?Array.isArray(o)?o.forEach(e=>{t.add(i,Buffer.from(e,"base64"))}):void 0!==o&&(c(i)?o.split(",").forEach(e=>{t.add(i,Buffer.from(e.trim(),"base64"))}):t.add(i,Buffer.from(o,"base64"))):Array.isArray(o)?o.forEach(e=>{t.add(i,e)}):void 0!==o&&t.add(i,o)}catch(e){const t=`Failed to add metadata entry ${i}: ${o}. ${(0,s.getErrorMessage)(e)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,n.log)(r.LogVerbosity.ERROR,t)}}return t}}t.Metadata=d;const f=e=>Buffer.isBuffer(e)?e.toString("base64"):e},2921(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OrcaOobMetricsSubchannelWrapper=t.GRPC_METRICS_HEADER=t.ServerMetricRecorder=t.PerRequestMetricRecorder=void 0,t.createOrcaClient=h,t.createMetricsReader=function(e,i){return(n,r,s)=>{let o=s.getOpaque(d);if(o)e(o);else{const i=s.get(t.GRPC_METRICS_HEADER);if(i.length>0){o=u().xds.data.orca.v3.OrcaLoadReport.deserialize(i[0]),e(o),s.setOpaque(d,o)}}i&&i(n,r,s)}};const n=i(4056),r=i(4700),s=i(7434),o=i(2379),a=i(131),l=i(3956),c=i(463);function u(){const e=(0,i(5085).Yi)("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,n.loadPackageDefinition)(e)}t.PerRequestMetricRecorder=class{constructor(){this.message={}}recordRequestCostMetric(e,t){this.message.request_cost||(this.message.request_cost={}),this.message.request_cost[e]=t}recordUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}recordNamedMetric(e,t){this.message.named_metrics||(this.message.named_metrics={}),this.message.named_metrics[e]=t}recordCPUUtilizationMetric(e){this.message.cpu_utilization=e}recordMemoryUtilizationMetric(e){this.message.mem_utilization=e}recordApplicationUtilizationMetric(e){this.message.application_utilization=e}recordQpsMetric(e){this.message.rps_fractional=e}recordEpsMetric(e){this.message.eps=e}serialize(){return u().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};function h(e){return new(0,u().xds.service.orca.v3.OpenRcaService)("unused",s.ChannelCredentials.createInsecure(),{channelOverride:e})}t.ServerMetricRecorder=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{const t=e.request.report_interval?(0,r.durationToMs)((0,r.durationMessageToDuration)(e.request.report_interval)):3e4,i=setInterval(()=>{e.write(this.message)},t);e.on("cancelled",()=>{clearInterval(i)})}}}putUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}setAllUtilizationMetrics(e){this.message.utilization=Object.assign({},e)}deleteUtilizationMetric(e){var t;null===(t=this.message.utilization)||void 0===t||delete t[e]}setCpuUtilizationMetric(e){this.message.cpu_utilization=e}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(e){this.message.application_utilization=e}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(e){this.message.rps_fractional=e}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(e){this.message.eps=e}deleteEpsMetric(){delete this.message.eps}addToServer(e){const t=u().xds.service.orca.v3.OpenRcaService.service;e.addService(t,this.serviceImplementation)}},t.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";const d="grpc_orca_load_report";const f="orca_oob_metrics";class p{constructor(e,t){this.metricsListener=e,this.intervalMs=t,this.dataProducer=null}setSubchannel(e){const t=e.getOrCreateDataProducer(f,v);this.dataProducer=t,t.addDataWatcher(this)}destroy(){var e;null===(e=this.dataProducer)||void 0===e||e.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(e){this.metricsListener(e)}}class g{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new l.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();const t=e.getChannel();this.client=h(t),e.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(e){this.dataWatchers.add(e),this.updateMetricsSubscription()}removeDataWatcher(e){var t;this.dataWatchers.delete(e),0===this.dataWatchers.size?(this.subchannel.removeDataProducer(f),null===(t=this.metricsCall)||void 0===t||t.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener)):this.updateMetricsSubscription()}updateMetricsSubscription(){var e;if(0===this.dataWatchers.size||!this.orcaSupported||this.subchannel.getConnectivityState()!==c.ConnectivityState.READY)return;const t=Math.min(...Array.from(this.dataWatchers).map(e=>e.getInterval()));if(!this.metricsCall||t!==this.currentInterval){null===(e=this.metricsCall)||void 0===e||e.cancel(),this.currentInterval=t;const i=this.client.streamCoreMetrics({report_interval:(0,r.msToDuration)(t)});this.metricsCall=i,i.on("data",e=>{this.dataWatchers.forEach(t=>{t.onMetricsUpdate(e)})}),i.on("error",e=>{this.metricsCall=null,e.code!==a.Status.UNIMPLEMENTED?e.code!==a.Status.CANCELLED&&this.backoffTimer.runOnce():this.orcaSupported=!1})}}}class m extends o.BaseSubchannelWrapper{constructor(e,t,i){super(e),this.addDataWatcher(new p(t,i))}getWrappedSubchannel(){return this.child}}function v(e){return new g(e)}t.OrcaOobMetricsSubchannelWrapper=m},178(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueuePicker=t.UnavailablePicker=t.PickResultType=void 0;const n=i(4097),r=i(131);var s;!function(e){e[e.COMPLETE=0]="COMPLETE",e[e.QUEUE=1]="QUEUE",e[e.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",e[e.DROP=3]="DROP"}(s||(t.PickResultType=s={}));t.UnavailablePicker=class{constructor(e){this.status=Object.assign({code:r.Status.UNAVAILABLE,details:"No connection established",metadata:new n.Metadata},e)}pick(e){return{pickResultType:s.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}};t.QueuePicker=class{constructor(e,t){this.loadBalancer=e,this.childPicker=t,this.calledExitIdle=!1}pick(e){return this.calledExitIdle||(process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0),this.childPicker?this.childPicker.pick(e):{pickResultType:s.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}}},222(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PriorityQueue=void 0;const i=e=>Math.floor(e/2),n=e=>2*e+1,r=e=>2*e+2;t.PriorityQueue=class{constructor(e=(e,t)=>e>t){this.comparator=e,this.heap=[]}size(){return this.heap.length}isEmpty(){return 0==this.size()}peek(){return this.heap[0]}push(...e){return e.forEach(e=>{this.heap.push(e),this.siftUp()}),this.size()}pop(){const e=this.peek(),t=this.size()-1;return t>0&&this.swap(0,t),this.heap.pop(),this.siftDown(),e}replace(e){const t=this.peek();return this.heap[0]=e,this.siftDown(),t}greater(e,t){return this.comparator(this.heap[e],this.heap[t])}swap(e,t){[this.heap[e],this.heap[t]]=[this.heap[t],this.heap[e]]}siftUp(){let e=this.size()-1;for(;e>0&&this.greater(e,i(e));)this.swap(e,i(e)),e=i(e)}siftDown(){let e=0;for(;n(e)<this.size()&&this.greater(n(e),e)||r(e)<this.size()&&this.greater(r(e),e);){let t=r(e)<this.size()&&this.greater(r(e),n(e))?r(e):n(e);this.swap(e,t),e=t}}}},6700(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PORT=void 0,t.setup=function(){(0,n.registerResolver)("dns",m),(0,n.registerDefaultScheme)("dns")};const n=i(9302),r=i(2250),s=i(5656),o=i(131),a=i(5034),l=i(4097),c=i(267),u=i(131),h=i(3822),d=i(9278),f=i(3956),p=i(883);function g(e){c.trace(u.LogVerbosity.DEBUG,"dns_resolver",e)}t.DEFAULT_PORT=443;class m{constructor(e,i,n){var s,a,c;this.target=e,this.listener=i,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new r.promises.Resolver,g("Resolver constructed for target "+(0,h.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);const u=(0,h.splitHostPort)(e.path);null===u?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,d.isIPv4)(u.host)||(0,d.isIPv6)(u.host)?(this.ipResult=[{addresses:[{host:u.host,port:null!==(s=u.port)&&void 0!==s?s:t.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=u.host,this.port=null!==(a=u.port)&&void 0!==a?a:t.DEFAULT_PORT),this.percentage=100*Math.random(),1===n["grpc.service_config_disable_resolution"]&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:o.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,h.uriToString)(this.target)}`,metadata:new l.Metadata};const p={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoff=new f.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},p),this.backoff.unref(),this.minTimeBetweenResolutionsMs=null!==(c=n["grpc.dns_min_time_between_resolutions_ms"])&&void 0!==c?c:3e4,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(null!==this.ipResult)return this.returnedIpResult||(g("Returning IP address for target "+(0,h.uriToString)(this.target)),setImmediate(()=>{this.listener((0,a.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),void this.stopNextResolutionTimer();if(null===this.dnsHostname)g("Failed to parse DNS address "+(0,h.uriToString)(this.target)),setImmediate(()=>{this.listener((0,a.statusOrFromError)({code:o.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,h.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(null!==this.pendingLookupPromise)return;g("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;const e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(e=>{if(null===this.pendingLookupPromise)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,a.statusOrFromValue)(e.map(e=>({addresses:[e]})));const t="["+e.map(e=>e.host+":"+e.port).join(",")+"]";g("Resolved addresses for target "+(0,h.uriToString)(this.target)+": "+t);const i=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(i)},e=>{null!==this.pendingLookupPromise&&(g("Resolution error for target "+(0,h.uriToString)(this.target)+": "+e.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,a.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&null===this.pendingTxtPromise&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(e=>{if(null===this.pendingTxtPromise)return;let t;this.pendingTxtPromise=null;try{t=(0,s.extractAndSelectServiceConfig)(e,this.percentage),this.latestServiceConfigResult=t?(0,a.statusOrFromValue)(t):null}catch(e){this.latestServiceConfigResult=(0,a.statusOrFromError)({code:o.Status.UNAVAILABLE,details:`Parsing service config failed with error ${e.message}`})}null!==this.latestLookupResult&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},e=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(p.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){g("Using alternative DNS resolver.");const t=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(t.every(e=>"rejected"===e.status))throw new Error(t[0].reason);return t.reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).map(e=>({host:e,port:+this.port}))}return(await r.promises.lookup(e,{all:!0})).map(e=>({host:e.address,port:+this.port}))}async resolveTxt(e){return p.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(g("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):r.promises.resolveTxt(e)}startNextResolutionTimer(){var e,t;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),null===(t=(e=this.nextResolutionTimer).unref)||void 0===t||t.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){null===this.pendingLookupPromise&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){null===this.pendingLookupPromise&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?g('resolution update delayed by "min time between resolutions" rate limit'):g("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}}},82(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setup=function(){(0,a.registerResolver)(d,p),(0,a.registerResolver)(f,p)};const n=i(9278),r=i(5034),s=i(131),o=i(4097),a=i(9302),l=i(8996),c=i(3822),u=i(267);function h(e){u.trace(s.LogVerbosity.DEBUG,"ip_resolver",e)}const d="ipv4",f="ipv6";class p{constructor(e,t,i){var r;this.listener=t,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,h("Resolver constructed for target "+(0,c.uriToString)(e));const a=[];if(e.scheme!==d&&e.scheme!==f)return void(this.error={code:s.Status.UNAVAILABLE,details:`Unrecognized scheme ${e.scheme} in IP resolver`,metadata:new o.Metadata});const u=e.path.split(",");for(const t of u){const i=(0,c.splitHostPort)(t);if(null===i)return void(this.error={code:s.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${t}`,metadata:new o.Metadata});if(e.scheme===d&&!(0,n.isIPv4)(i.host)||e.scheme===f&&!(0,n.isIPv6)(i.host))return void(this.error={code:s.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${t}`,metadata:new o.Metadata});a.push({host:i.host,port:null!==(r=i.port)&&void 0!==r?r:443})}this.endpoints=a.map(e=>({addresses:[e]})),h("Parsed "+e.scheme+" address list "+a.map(l.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,r.statusOrFromError)(this.error),{},null,""):this.listener((0,r.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}}},305(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setup=function(){(0,n.registerResolver)("unix",s)};const n=i(9302),r=i(5034);class s{constructor(e,t,i){let n;this.listener=t,this.hasReturnedResult=!1,this.endpoints=[],n=""===e.authority?"/"+e.path:e.path,this.endpoints=[{addresses:[{path:n}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener,(0,r.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}}},9302(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0,t.registerResolver=function(e,t){r[e]=t},t.registerDefaultScheme=function(e){s=e},t.createResolver=function(e,t,i){if(void 0!==e.scheme&&e.scheme in r)return new r[e.scheme](e,t,i);throw new Error(`No resolver could be created for target ${(0,n.uriToString)(e)}`)},t.getDefaultAuthority=function(e){if(void 0!==e.scheme&&e.scheme in r)return r[e.scheme].getDefaultAuthority(e);throw new Error(`Invalid target ${(0,n.uriToString)(e)}`)},t.mapUriDefaultScheme=function(e){if(void 0===e.scheme||!(e.scheme in r))return null!==s?{scheme:s,authority:void 0,path:(0,n.uriToString)(e)}:null;return e};const n=i(3822);t.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";const r={};let s=null},8446(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvingCall=void 0;const n=i(2267),r=i(131),s=i(6308),o=i(4097),a=i(267),l=i(6067);t.ResolvingCall=class{constructor(e,t,i,o,a){this.channel=e,this.method=t,this.filterStackFactory=o,this.callNumber=a,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.readFilterPending=!1,this.writeFilterPending=!1,this.pendingChildStatus=null,this.metadata=null,this.listener=null,this.statusWatchers=[],this.deadlineTimer=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=n.CallCredentials.createEmpty(),this.deadline=i.deadline,this.host=i.host,i.parentCall&&(i.flags&r.Propagate.CANCELLATION&&i.parentCall.on("cancelled",()=>{this.cancelWithStatus(r.Status.CANCELLED,"Cancelled by parent call")}),i.flags&r.Propagate.DEADLINE&&(this.trace("Propagating deadline from parent: "+i.parentCall.getDeadline()),this.deadline=(0,s.minDeadline)(this.deadline,i.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}trace(e){a.trace(r.LogVerbosity.DEBUG,"resolving_call","["+this.callNumber+"] "+e)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,s.deadlineToString)(this.deadline));const e=(0,s.getRelativeTimeout)(this.deadline);if(e!==1/0){this.trace("Deadline will be reached in "+e+"ms");const t=()=>{if(!this.deadlineStartTime)return void this.cancelWithStatus(r.Status.DEADLINE_EXCEEDED,"Deadline exceeded");const e=[],t=new Date;e.push(`Deadline exceeded after ${(0,s.formatDateDifference)(this.deadlineStartTime,t)}`),this.configReceivedTime?(this.configReceivedTime>this.deadlineStartTime&&e.push(`name resolution: ${(0,s.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime?this.childStartTime>this.configReceivedTime&&e.push(`metadata filters: ${(0,s.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`):e.push("waiting for metadata filters")):e.push("waiting for name resolution"),this.child&&e.push(...this.child.getDeadlineInfo()),this.cancelWithStatus(r.Status.DEADLINE_EXCEEDED,e.join(","))};e<=0?process.nextTick(t):this.deadlineTimer=setTimeout(t,e)}}outputStatus(e){if(!this.ended){this.ended=!0,this.filterStack||(this.filterStack=this.filterStackFactory.createFilter()),clearTimeout(this.deadlineTimer);const t=this.filterStack.receiveTrailers(e);this.trace("ended with status: code="+t.code+' details="'+t.details+'"'),this.statusWatchers.forEach(e=>e(t)),process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onReceiveStatus(t)})}}sendMessageOnChild(e,t){if(!this.child)throw new Error("sendMessageonChild called with child not populated");const i=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags})).then(t=>{this.writeFilterPending=!1,i.sendMessageWithContext(e,t.message),this.pendingHalfClose&&i.halfClose()},e=>{this.cancelWithStatus(e.code,e.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw new Error("getConfig called before start");const e=this.channel.getConfig(this.method,this.metadata);if("NONE"===e.type)return void this.channel.queueCallForConfig(this);if("ERROR"===e.type)return void(this.metadata.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e.error));this.configReceivedTime=new Date;const t=e.config;if(t.status!==r.Status.OK){const{code:e,details:i}=(0,l.restrictControlPlaneStatusCode)(t.status,"Failed to route call to method "+this.method);return void this.outputStatus({code:e,details:i,metadata:new o.Metadata})}if(t.methodConfig.timeout){const e=new Date;e.setSeconds(e.getSeconds()+t.methodConfig.timeout.seconds),e.setMilliseconds(e.getMilliseconds()+t.methodConfig.timeout.nanos/1e6),this.deadline=(0,s.minDeadline)(this.deadline,e),this.runDeadlineTimer()}this.filterStackFactory.push(t.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(e=>{this.child=this.channel.createRetryingCall(t,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(e,{onReceiveMetadata:e=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(e))},onReceiveMessage:e=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(e).then(e=>{this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(e),this.pendingChildStatus&&this.outputStatus(this.pendingChildStatus)},e=>{this.cancelWithStatus(e.code,e.details)})},onReceiveStatus:e=>{this.trace("Received status"),this.readFilterPending?this.pendingChildStatus=e:this.outputStatus(e)}}),this.readPending&&this.child.startRead(),this.pendingMessage?this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message):this.pendingHalfClose&&this.child.halfClose()},e=>{this.outputStatus(e)})}reportResolverError(e){var t;(null===(t=this.metadata)||void 0===t?void 0:t.getOptions().waitForReady)?this.channel.queueCallForConfig(this):this.outputStatus(e)}cancelWithStatus(e,t){var i;this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),null===(i=this.child)||void 0===i||i.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new o.Metadata})}getPeer(){var e,t;return null!==(t=null===(e=this.child)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.metadata=e.clone(),this.listener=t,this.getConfig()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length),this.child?this.sendMessageOnChild(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child&&!this.writeFilterPending?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){this.credentials=e}addStatusWatcher(e){this.statusWatchers.push(e)}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}}},4973(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ResolvingLoadBalancer=void 0;const n=i(8923),r=i(5656),s=i(463),o=i(9302),a=i(178),l=i(3956),c=i(131),u=i(4097),h=i(267),d=i(131),f=i(3822),p=i(533);function g(e){h.trace(d.LogVerbosity.DEBUG,"resolving_load_balancer",e)}const m=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function v(e,t,i,n){for(const r of i.name)switch(n){case"EMPTY":if(!r.service&&!r.method)return!0;break;case"SERVICE":if(r.service===e&&!r.method)return!0;break;case"SERVICE_AND_METHOD":if(r.service===e&&r.method===t)return!0}return!1}function y(e,t,i,n){for(const r of i)if(v(e,t,r,n))return r;return null}t.ResolvingLoadBalancer=class{constructor(e,t,i,n,c){this.target=e,this.channelControlHelper=t,this.channelOptions=i,this.onSuccessfulResolution=n,this.onFailedResolution=c,this.latestChildState=s.ConnectivityState.IDLE,this.latestChildPicker=new a.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=s.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,i["grpc.service_config"]?this.defaultServiceConfig=(0,r.validateServiceConfig)(JSON.parse(i["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(s.ConnectivityState.IDLE,new a.QueuePicker(this),null),this.childLoadBalancer=new p.ChildLoadBalancerHandler({createSubchannel:t.createSubchannel.bind(t),requestReresolution:()=>{this.backoffTimeout.isRunning()?(g("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0):this.updateResolution()},updateState:(e,t,i)=>{this.latestChildState=e,this.latestChildPicker=t,this.latestChildErrorMessage=i,this.updateState(e,t,i)},addChannelzChild:t.addChannelzChild.bind(t),removeChannelzChild:t.removeChannelzChild.bind(t)}),this.innerResolver=(0,o.createResolver)(e,this.handleResolverResult.bind(this),i);const u={initialDelay:i["grpc.initial_reconnect_backoff_ms"],maxDelay:i["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new l.BackoffTimeout(()=>{this.continueResolving?(this.updateResolution(),this.continueResolving=!1):this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},u),this.backoffTimeout.unref()}handleResolverResult(e,t,i,r){var s,a;this.backoffTimeout.stop(),this.backoffTimeout.reset();let l=!0,h=null;if(null===i?h=this.defaultServiceConfig:i.ok?h=i.value:null!==this.previousServiceConfig?h=this.previousServiceConfig:(l=!1,this.handleResolutionFailure(i.error)),null!==h){const i=null!==(s=null==h?void 0:h.loadBalancingConfig)&&void 0!==s?s:[],o=(0,n.selectLbConfigFromList)(i,!0);null===o?(l=!1,this.handleResolutionFailure({code:c.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new u.Metadata})):l=this.childLoadBalancer.updateAddressList(e,o,Object.assign(Object.assign({},this.channelOptions),t),r)}return l&&this.onSuccessfulResolution(h,null!==(a=t[o.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])&&void 0!==a?a:function(e){return{invoke(t,i){var n,r;const s=t.split("/").filter(e=>e.length>0),o=null!==(n=s[0])&&void 0!==n?n:"",a=null!==(r=s[1])&&void 0!==r?r:"";if(e&&e.methodConfig)for(const t of m){const i=y(o,a,e.methodConfig,t);if(i)return{methodConfig:i,pickInformation:{},status:c.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:c.Status.OK,dynamicFilterFactories:[]}},unref(){}}}(h)),l}updateResolution(){this.innerResolver.updateResolution(),this.currentState===s.ConnectivityState.IDLE&&this.updateState(s.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage),this.backoffTimeout.runOnce()}updateState(e,t,i){g((0,f.uriToString)(this.target)+" "+s.ConnectivityState[this.currentState]+" -> "+s.ConnectivityState[e]),e===s.ConnectivityState.IDLE&&(t=new a.QueuePicker(this,t)),this.currentState=e,this.channelControlHelper.updateState(e,t,i)}handleResolutionFailure(e){this.latestChildState===s.ConnectivityState.IDLE&&(this.updateState(s.ConnectivityState.TRANSIENT_FAILURE,new a.UnavailablePicker(e),e.details),this.onFailedResolution(e))}exitIdle(){this.currentState!==s.ConnectivityState.IDLE&&this.currentState!==s.ConnectivityState.TRANSIENT_FAILURE||(this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()),this.childLoadBalancer.exitIdle()}updateAddressList(e,t){throw new Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.backoffTimeout.reset(),this.backoffTimeout.stop(),this.latestChildState=s.ConnectivityState.IDLE,this.latestChildPicker=new a.QueuePicker(this),this.currentState=s.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}}},3135(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RetryingCall=t.MessageBufferTracker=t.RetryThrottler=void 0;const n=i(131),r=i(6308),s=i(4097),o=i(267);t.RetryThrottler=class{constructor(e,t,i){this.maxTokens=e,this.tokenRatio=t,this.tokens=i?i.tokens*(e/i.maxTokens):e}addCallSucceeded(){this.tokens=Math.min(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.max(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}};t.MessageBufferTracker=class{constructor(e,t){this.totalLimit=e,this.limitPerCall=t,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(e,t){var i;const n=null!==(i=this.allocatedPerCall.get(t))&&void 0!==i?i:0;return!(this.limitPerCall-n<e||this.totalLimit-this.totalAllocated<e)&&(this.allocatedPerCall.set(t,n+e),this.totalAllocated+=e,!0)}free(e,t){var i;if(this.totalAllocated<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > total allocated ${this.totalAllocated}`);this.totalAllocated-=e;const n=null!==(i=this.allocatedPerCall.get(t))&&void 0!==i?i:0;if(n<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > allocated for call ${n}`);this.allocatedPerCall.set(t,n-e)}freeAll(e){var t;const i=null!==(t=this.allocatedPerCall.get(e))&&void 0!==t?t:0;if(this.totalAllocated<i)throw new Error(`Invalid buffer allocation state: call ${e} allocated ${i} > total allocated ${this.totalAllocated}`);this.totalAllocated-=i,this.allocatedPerCall.delete(e)}};const a="grpc-previous-rpc-attempts";t.RetryingCall=class{constructor(e,t,i,n,r,s,o,a,l){var c;this.channel=e,this.callConfig=t,this.methodName=i,this.host=n,this.credentials=r,this.deadline=s,this.callNumber=o,this.bufferTracker=a,this.retryThrottler=l,this.listener=null,this.initialMetadata=null,this.underlyingCalls=[],this.writeBuffer=[],this.writeBufferOffset=0,this.readStarted=!1,this.transparentRetryUsed=!1,this.attempts=0,this.hedgingTimer=null,this.committedCallIndex=null,this.initialRetryBackoffSec=0,this.nextRetryBackoffSec=0;const u=null!==(c=e.getOptions()["grpc-node.retry_max_attempts_limit"])&&void 0!==c?c:5;if(0===e.getOptions()["grpc.enable_retries"])this.state="NO_RETRY",this.maxAttempts=1;else if(t.methodConfig.retryPolicy){this.state="RETRY";const e=t.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(e.initialBackoff.substring(0,e.initialBackoff.length-1)),this.maxAttempts=Math.min(e.maxAttempts,u)}else t.methodConfig.hedgingPolicy?(this.state="HEDGING",this.maxAttempts=Math.min(t.methodConfig.hedgingPolicy.maxAttempts,u)):(this.state="TRANSPARENT_ONLY",this.maxAttempts=1);this.startTime=new Date}getDeadlineInfo(){if(0===this.underlyingCalls.length)return[];const e=[],t=this.underlyingCalls[this.underlyingCalls.length-1];return this.underlyingCalls.length>1&&e.push("previous attempts: "+(this.underlyingCalls.length-1)),t.startTime>this.startTime&&e.push(`time to current attempt start: ${(0,r.formatDateDifference)(this.startTime,t.startTime)}`),e.push(...t.call.getDeadlineInfo()),e}getCallNumber(){return this.callNumber}trace(e){o.trace(n.LogVerbosity.DEBUG,"retrying_call","["+this.callNumber+"] "+e)}reportStatus(e){this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var t;null===(t=this.listener)||void 0===t||t.onReceiveStatus({code:e.code,details:e.details,metadata:e.metadata})})}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.reportStatus({code:e,details:t,metadata:new s.Metadata});for(const{call:i}of this.underlyingCalls)i.cancelWithStatus(e,t)}getPeer(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getPeer():"unknown"}getBufferEntry(e){var t;return null!==(t=this.writeBuffer[e-this.writeBufferOffset])&&void 0!==t?t:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if("COMMITTED"!==this.state)return;let e;e="COMPLETED"===this.underlyingCalls[this.committedCallIndex].state?this.getNextBufferIndex():this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let t=this.writeBufferOffset;t<e;t++){const e=this.getBufferEntry(t);e.allocated&&this.bufferTracker.free(e.message.message.length,this.callNumber)}this.writeBuffer=this.writeBuffer.slice(e-this.writeBufferOffset),this.writeBufferOffset=e}commitCall(e){var t,i;if("COMMITTED"!==this.state){this.trace("Committing call ["+this.underlyingCalls[e].call.getCallNumber()+"] at index "+e),this.state="COMMITTED",null===(i=(t=this.callConfig).onCommitted)||void 0===i||i.call(t),this.committedCallIndex=e;for(let t=0;t<this.underlyingCalls.length;t++)t!==e&&"COMPLETED"!==this.underlyingCalls[t].state&&(this.underlyingCalls[t].state="COMPLETED",this.underlyingCalls[t].call.cancelWithStatus(n.Status.CANCELLED,"Discarded in favor of other hedged attempt"));this.clearSentMessages()}}commitCallWithMostMessages(){if("COMMITTED"===this.state)return;let e=-1,t=-1;for(const[i,n]of this.underlyingCalls.entries())"ACTIVE"===n.state&&n.nextMessageToSend>e&&(e=n.nextMessageToSend,t=i);-1===t?this.state="TRANSPARENT_ONLY":this.commitCall(t)}isStatusCodeInList(e,t){return e.some(e=>{var i;return e===t||e.toString().toLowerCase()===(null===(i=n.Status[t])||void 0===i?void 0:i.toLowerCase())})}getNextRetryJitter(){return Math.random()*(1.2-.8)+.8}getNextRetryBackoffMs(){var e;const t=null===(e=this.callConfig)||void 0===e?void 0:e.methodConfig.retryPolicy;if(!t)return 0;const i=this.getNextRetryJitter()*this.nextRetryBackoffSec*1e3,n=Number(t.maxBackoff.substring(0,t.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*t.backoffMultiplier,n),i}maybeRetryCall(e,t){if("RETRY"!==this.state)return void t(!1);if(this.attempts>=this.maxAttempts)return void t(!1);let i;if(null===e)i=this.getNextRetryBackoffMs();else{if(e<0)return this.state="TRANSPARENT_ONLY",void t(!1);i=e,this.nextRetryBackoffSec=this.initialRetryBackoffSec}setTimeout(()=>{var e,i;"RETRY"===this.state?null===(i=null===(e=this.retryThrottler)||void 0===e?void 0:e.canRetryCall())||void 0===i||i?(t(!0),this.attempts+=1,this.startNewAttempt()):(this.trace("Retry attempt denied by throttling policy"),t(!1)):t(!1)},i)}countActiveCalls(){let e=0;for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(e+=1);return e}handleProcessedStatus(e,t,i){var n,r,s;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(t),this.reportStatus(e);break;case"HEDGING":if(this.isStatusCodeInList(null!==(n=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)&&void 0!==n?n:[],e.code)){let n;if(null===(r=this.retryThrottler)||void 0===r||r.addCallFailed(),null===i)n=0;else{if(i<0)return this.state="TRANSPARENT_ONLY",this.commitCall(t),void this.reportStatus(e);n=i}setTimeout(()=>{this.maybeStartHedgingAttempt(),0===this.countActiveCalls()&&(this.commitCall(t),this.reportStatus(e))},n)}else this.commitCall(t),this.reportStatus(e);break;case"RETRY":this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,e.code)?(null===(s=this.retryThrottler)||void 0===s||s.addCallFailed(),this.maybeRetryCall(i,i=>{i||(this.commitCall(t),this.reportStatus(e))})):(this.commitCall(t),this.reportStatus(e))}}getPushback(e){const t=e.get("grpc-retry-pushback-ms");if(0===t.length)return null;try{return parseInt(t[0])}catch(e){return-1}}handleChildStatus(e,t){var i;if("COMPLETED"===this.underlyingCalls[t].state)return;if(this.trace("state="+this.state+" handling status with progress "+e.progress+" from child ["+this.underlyingCalls[t].call.getCallNumber()+"] in state "+this.underlyingCalls[t].state),this.underlyingCalls[t].state="COMPLETED",e.code===n.Status.OK)return null===(i=this.retryThrottler)||void 0===i||i.addCallSucceeded(),this.commitCall(t),void this.reportStatus(e);if("NO_RETRY"===this.state)return this.commitCall(t),void this.reportStatus(e);if("COMMITTED"===this.state)return void this.reportStatus(e);const r=this.getPushback(e.metadata);switch(e.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":this.transparentRetryUsed?this.handleProcessedStatus(e,t,r):(this.transparentRetryUsed=!0,this.startNewAttempt());break;case"DROP":this.commitCall(t),this.reportStatus(e);break;case"PROCESSED":this.handleProcessedStatus(e,t,r)}}maybeStartHedgingAttempt(){"HEDGING"===this.state&&this.callConfig.methodConfig.hedgingPolicy&&(this.attempts>=this.maxAttempts||(this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()))}maybeStartHedgingTimer(){var e,t,i;if(this.hedgingTimer&&clearTimeout(this.hedgingTimer),"HEDGING"!==this.state)return;if(!this.callConfig.methodConfig.hedgingPolicy)return;const n=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;const r=null!==(e=n.hedgingDelay)&&void 0!==e?e:"0s",s=Number(r.substring(0,r.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},1e3*s),null===(i=(t=this.hedgingTimer).unref)||void 0===i||i.call(t)}startNewAttempt(){const e=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+e.getCallNumber()+"] for attempt "+this.attempts);const t=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:e,nextMessageToSend:0,startTime:new Date});const i=this.attempts-1,n=this.initialMetadata.clone();i>0&&n.set(a,`${i}`);let r=!1;e.start(n,{onReceiveMetadata:n=>{this.trace("Received metadata from child ["+e.getCallNumber()+"]"),this.commitCall(t),r=!0,i>0&&n.set(a,`${i}`),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMetadata(n)},onReceiveMessage:i=>{this.trace("Received message from child ["+e.getCallNumber()+"]"),this.commitCall(t),"ACTIVE"===this.underlyingCalls[t].state&&this.listener.onReceiveMessage(i)},onReceiveStatus:n=>{this.trace("Received status from child ["+e.getCallNumber()+"]"),!r&&i>0&&n.metadata.set(a,`${i}`),this.handleChildStatus(n,t)}}),this.sendNextChildMessage(t),this.readStarted&&e.startRead()}start(e,t){this.trace("start called"),this.listener=t,this.initialMetadata=e,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(e,t){var i,n;null===(n=(i=this.getBufferEntry(t)).callback)||void 0===n||n.call(i),this.clearSentMessages();this.underlyingCalls[e].nextMessageToSend+=1,this.sendNextChildMessage(e)}sendNextChildMessage(e){const t=this.underlyingCalls[e];if("COMPLETED"===t.state)return;const i=t.nextMessageToSend;if(this.getBufferEntry(i)){const n=this.getBufferEntry(i);switch(n.entryType){case"MESSAGE":t.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,i)}},n.message.message);"HALF_CLOSE"===this.getBufferEntry(i+1).entryType&&(this.trace("Sending halfClose immediately after message to child ["+t.call.getCallNumber()+"] - optimizing for unary/final message"),t.nextMessageToSend+=1,t.call.halfClose());break;case"HALF_CLOSE":t.nextMessageToSend+=1,t.call.halfClose()}}}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const i={message:t,flags:e.flags},n=this.getNextBufferIndex(),r={entryType:"MESSAGE",message:i,allocated:this.bufferTracker.allocate(t.length,this.callNumber)};if(this.writeBuffer.push(r),r.allocated){process.nextTick(()=>{var t;null===(t=e.callback)||void 0===t||t.call(e)});for(const[e,i]of this.underlyingCalls.entries())"ACTIVE"===i.state&&i.nextMessageToSend===n&&i.call.sendMessageWithContext({callback:t=>{this.handleChildWriteCompleted(e,n)}},t)}else{if(this.commitCallWithMostMessages(),null===this.committedCallIndex)return;const i=this.underlyingCalls[this.committedCallIndex];r.callback=e.callback,"ACTIVE"===i.state&&i.nextMessageToSend===n&&i.call.sendMessageWithContext({callback:e=>{this.handleChildWriteCompleted(this.committedCallIndex,n)}},t)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(const e of this.underlyingCalls)"ACTIVE"===(null==e?void 0:e.state)&&e.call.startRead()}halfClose(){this.trace("halfClose called");const e=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(const t of this.underlyingCalls)"ACTIVE"===(null==t?void 0:t.state)&&(t.nextMessageToSend!==e&&t.nextMessageToSend!==e-1||(this.trace("Sending halfClose immediately to child ["+t.call.getCallNumber()+"] - all messages already sent"),t.nextMessageToSend+=1,t.call.halfClose()))}setCredentials(e){throw new Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){return null!==this.committedCallIndex?this.underlyingCalls[this.committedCallIndex].call.getAuthContext():null}}},6860(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerDuplexStreamImpl=t.ServerWritableStreamImpl=t.ServerReadableStreamImpl=t.ServerUnaryCallImpl=void 0,t.serverErrorToStatus=a;const n=i(4434),r=i(2203),s=i(131),o=i(4097);function a(e,t){var i;const n={code:s.Status.UNKNOWN,details:"message"in e?e.message:"Unknown Error",metadata:null!==(i=null!=t?t:e.metadata)&&void 0!==i?i:null};return"code"in e&&"number"==typeof e.code&&Number.isInteger(e.code)&&(n.code=e.code,"details"in e&&"string"==typeof e.details&&(n.details=e.details)),n}class l extends n.EventEmitter{constructor(e,t,i,n){super(),this.path=e,this.call=t,this.metadata=i,this.request=n,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}t.ServerUnaryCallImpl=l;class c extends r.Readable{constructor(e,t,i){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=i,this.cancelled=!1}_read(e){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}t.ServerReadableStreamImpl=c;class u extends r.Writable{constructor(e,t,i,n){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=i,this.request=n,this.pendingStatus={code:s.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new o.Metadata,this.on("error",e=>{this.pendingStatus=a(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(e,t,i){this.call.sendMessage(e,i)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}t.ServerWritableStreamImpl=u;class h extends r.Duplex{constructor(e,t,i){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=i,this.pendingStatus={code:s.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new o.Metadata,this.on("error",e=>{this.pendingStatus=a(e),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(e){this.call.startRead()}_write(e,t,i){this.call.sendMessage(e,i)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:null!==(t=this.pendingStatus.metadata)&&void 0!==t?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}}t.ServerDuplexStreamImpl=h},8692(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerCredentials=void 0,t.createCertificateProviderServerCredentials=function(e,t,i){return new a(e,t,i)},t.createServerCredentialsWithInterceptors=function(e,t){return new l(e,t)};const n=i(9167);class r{constructor(e,t){this.serverConstructorOptions=e,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=null!=t?t:null}_addWatcher(e){this.watchers.add(e)}_removeWatcher(e){this.watchers.delete(e)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(e){this.latestContextOptions=e;for(const e of this.watchers)e(this.latestContextOptions)}_isSecure(){return null!==this.serverConstructorOptions}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new s}static createSsl(e,t,i=!1){var r;if(null!==e&&!Buffer.isBuffer(e))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(t))throw new TypeError("keyCertPairs must be an array");if("boolean"!=typeof i)throw new TypeError("checkClientCertificate must be a boolean");const s=[],a=[];for(let e=0;e<t.length;e++){const i=t[e];if(null===i||"object"!=typeof i)throw new TypeError(`keyCertPair[${e}] must be an object`);if(!Buffer.isBuffer(i.private_key))throw new TypeError(`keyCertPair[${e}].private_key must be a Buffer`);if(!Buffer.isBuffer(i.cert_chain))throw new TypeError(`keyCertPair[${e}].cert_chain must be a Buffer`);s.push(i.cert_chain),a.push(i.private_key)}return new o({requestCert:i,ciphers:n.CIPHER_SUITES},{ca:null!==(r=null!=e?e:(0,n.getDefaultRootsData)())&&void 0!==r?r:void 0,cert:s,key:a})}}t.ServerCredentials=r;class s extends r{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof s}}class o extends r{constructor(e,t){super(e,t),this.options=Object.assign(Object.assign({},e),t)}_equals(e){if(this===e)return!0;if(!(e instanceof o))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(e.options.ca)){if(!this.options.ca.equals(e.options.ca))return!1}else if(this.options.ca!==e.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(e.options.cert)){if(this.options.cert.length!==e.options.cert.length)return!1;for(let t=0;t<this.options.cert.length;t++){const i=this.options.cert[t],n=e.options.cert[t];if(Buffer.isBuffer(i)&&Buffer.isBuffer(n)){if(!i.equals(n))return!1}else if(i!==n)return!1}}else if(this.options.cert!==e.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(e.options.key)){if(this.options.key.length!==e.options.key.length)return!1;for(let t=0;t<this.options.key.length;t++){const i=this.options.key[t],n=e.options.key[t];if(Buffer.isBuffer(i)&&Buffer.isBuffer(n)){if(!i.equals(n))return!1}else if(i!==n)return!1}}else if(this.options.key!==e.options.key)return!1;return this.options.requestCert===e.options.requestCert}}class a extends r{constructor(e,t,i){super({requestCert:null!==t,rejectUnauthorized:i,ciphers:n.CIPHER_SUITES}),this.identityCertificateProvider=e,this.caCertificateProvider=t,this.requireClientCertificate=i,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(e){var t;0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener)),super._addWatcher(e)}_removeWatcher(e){var t;super._removeWatcher(e),0===this.getWatcherCount()&&(null===(t=this.caCertificateProvider)||void 0===t||t.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_equals(e){return this===e||e instanceof a&&(this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&this.requireClientCertificate===e.requireClientCertificate)}calculateSecureContextOptions(){var e;return null===this.latestIdentityUpdate||null!==this.caCertificateProvider&&null===this.latestCaUpdate?null:{ca:null===(e=this.latestCaUpdate)||void 0===e?void 0:e.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){const e=this.calculateSecureContextOptions();this.updateSecureContextOptions(e)}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.finalizeUpdate()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.finalizeUpdate()}}class l extends r{constructor(e,t){super({}),this.childCredentials=e,this.interceptors=t}_isSecure(){return this.childCredentials._isSecure()}_equals(e){if(!(e instanceof l))return!1;if(!this.childCredentials._equals(e.childCredentials))return!1;if(this.interceptors.length!==e.interceptors.length)return!1;for(let t=0;t<this.interceptors.length;t++)if(this.interceptors[t]!==e.interceptors[t])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(e){this.childCredentials._addWatcher(e)}_removeWatcher(e){this.childCredentials._removeWatcher(e)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}}},4892(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseServerInterceptingCall=t.ServerInterceptingCall=t.ResponderBuilder=t.ServerListenerBuilder=void 0,t.isInterceptingServerListener=function(e){return void 0!==e.onReceiveMetadata&&1===e.onReceiveMetadata.length},t.getServerInterceptingCall=function(e,t,i,n,r,s){const o={path:r.path,requestStream:"clientStream"===r.type||"bidi"===r.type,responseStream:"serverStream"===r.type||"bidi"===r.type,requestDeserialize:r.deserialize,responseSerialize:r.serialize},a=new R(t,i,n,r,s);return e.reduce((e,t)=>t(o,e),a)};const n=i(4097),r=i(131),s=i(5675),o=i(9752),a=i(3106),l=i(9453),c=i(267),u=i(4756),h=i(2921),d="server_call";function f(e){c.trace(r.LogVerbosity.DEBUG,d,e)}t.ServerListenerBuilder=class{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveHalfClose(e){return this.halfClose=e,this}withOnCancel(e){return this.cancel=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}};class p{constructor(e,t){this.listener=e,this.nextListener=t,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingHalfClose(){this.hasPendingHalfClose&&(this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1)}onReceiveMetadata(e){this.cancelled||(this.processingMetadata=!0,this.listener.onReceiveMetadata(e,e=>{this.processingMetadata=!1,this.cancelled||(this.nextListener.onReceiveMetadata(e),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(e){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(e,e=>{this.processingMessage=!1,this.cancelled||(this.processingMetadata?(this.pendingMessage=e,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(e),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}}t.ResponderBuilder=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(e){return this.start=e,this}withSendMetadata(e){return this.metadata=e,this}withSendMessage(e){return this.message=e,this}withSendStatus(e){return this.status=e,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};const g={onReceiveMetadata:(e,t)=>{t(e)},onReceiveMessage:(e,t)=>{t(e)},onReceiveHalfClose:e=>{e()},onCancel:()=>{}},m={start:e=>{e()},sendMetadata:(e,t)=>{t(e)},sendMessage:(e,t)=>{t(e)},sendStatus:(e,t)=>{t(e)}};t.ServerInterceptingCall=class{constructor(e,t){var i,n,r,s;this.nextCall=e,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:null!==(i=null==t?void 0:t.start)&&void 0!==i?i:m.start,sendMetadata:null!==(n=null==t?void 0:t.sendMetadata)&&void 0!==n?n:m.sendMetadata,sendMessage:null!==(r=null==t?void 0:t.sendMessage)&&void 0!==r?r:m.sendMessage,sendStatus:null!==(s=null==t?void 0:t.sendStatus)&&void 0!==s?s:m.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(e){this.responder.start(t=>{var i,n,r,s;const o={onReceiveMetadata:null!==(i=null==t?void 0:t.onReceiveMetadata)&&void 0!==i?i:g.onReceiveMetadata,onReceiveMessage:null!==(n=null==t?void 0:t.onReceiveMessage)&&void 0!==n?n:g.onReceiveMessage,onReceiveHalfClose:null!==(r=null==t?void 0:t.onReceiveHalfClose)&&void 0!==r?r:g.onReceiveHalfClose,onCancel:null!==(s=null==t?void 0:t.onCancel)&&void 0!==s?s:g.onCancel},a=new p(o,e);this.nextCall.start(a)})}sendMetadata(e){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(e,e=>{this.processingMetadata=!1,this.nextCall.sendMetadata(e),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(e,t){this.processingMessage=!0,this.sentMetadata||this.sendMetadata(new n.Metadata),this.responder.sendMessage(e,e=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=e,this.pendingMessageCallback=t):this.nextCall.sendMessage(e,t)})}sendStatus(e){this.responder.sendStatus(e,e=>{this.processingMetadata||this.processingMessage?this.pendingStatus=e:this.nextCall.sendStatus(e)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}};const v="grpc-accept-encoding",y="grpc-encoding",b="grpc-message",S="grpc-status",_="grpc-timeout",C=/(\d{1,8})\s*([HMSmun])/,w={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},E={[v]:"identity,deflate,gzip",[y]:"identity"},T={[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_OK,[s.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},k={waitForTrailers:!0};class R{constructor(e,t,i,o,a){var u,p;this.stream=e,this.callEventTracker=i,this.handler=o,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=r.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=r.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new h.PerRequestMetricRecorder,this.stream.once("error",e=>{}),this.stream.once("close",()=>{var e;f("Request to method "+(null===(e=this.handler)||void 0===e?void 0:e.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:r.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",e=>{this.handleDataFrame(e)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in a&&(this.maxSendMessageSize=a["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in a&&(this.maxReceiveMessageSize=a["grpc.max_receive_message_length"]),this.host=null!==(u=t[":authority"])&&void 0!==u?u:t.host,this.decoder=new l.StreamDecoder(this.maxReceiveMessageSize);const g=n.Metadata.fromHttp2Headers(t);c.isTracerEnabled(d)&&f("Request to "+this.handler.path+" received headers "+JSON.stringify(g.toJSON()));const m=g.get(_);m.length>0&&this.handleTimeoutHeader(m[0]);const b=g.get(y);b.length>0&&(this.incomingEncoding=b[0]),g.remove(_),g.remove(y),g.remove(v),g.remove(s.constants.HTTP2_HEADER_ACCEPT_ENCODING),g.remove(s.constants.HTTP2_HEADER_TE),g.remove(s.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=g;const S=null===(p=e.session)||void 0===p?void 0:p.socket;this.connectionInfo={localAddress:null==S?void 0:S.localAddress,localPort:null==S?void 0:S.localPort,remoteAddress:null==S?void 0:S.remoteAddress,remotePort:null==S?void 0:S.remotePort},this.shouldSendMetrics=!!a["grpc.server_call_metric_recording"]}handleTimeoutHeader(e){const t=e.toString().match(C);if(null===t){const t={code:r.Status.INTERNAL,details:`Invalid ${_} value "${e}"`,metadata:null};return void process.nextTick(()=>{this.sendStatus(t)})}const i=+t[1]*w[t[2]]|0,n=new Date;this.deadline=n.setMilliseconds(n.getMilliseconds()+i),this.deadlineTimer=setTimeout(()=>{const e={code:r.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(e)},i)}checkCancelled(){return this.cancelled||!this.stream.destroyed&&!this.stream.closed||(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var e;null===(e=this.listener)||void 0===e||e.onCancel()}),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.resume())}maybeSendMetadata(){this.metadataSent||this.sendMetadata(new n.Metadata)}serializeMessage(e){const t=this.handler.serialize(e),i=t.byteLength,n=Buffer.allocUnsafe(i+5);return n.writeUInt8(0,0),n.writeUInt32BE(i,1),t.copy(n,5),n}decompressMessage(e,t){const i=e.subarray(5);if("identity"===t)return i;if("deflate"===t||"gzip"===t){let e;return e="deflate"===t?a.createInflate():a.createGunzip(),new Promise((t,n)=>{let s=0;const o=[];e.on("data",t=>{o.push(t),s+=t.byteLength,-1!==this.maxReceiveMessageSize&&s>this.maxReceiveMessageSize&&(e.destroy(),n({code:r.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),e.on("end",()=>{t(Buffer.concat(o))}),e.write(i),e.end()})}return Promise.reject({code:r.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${t}"`})}async decompressAndMaybePush(e){if("COMPRESSED"!==e.type)throw new Error(`Invalid queue entry type: ${e.type}`);const t=1===e.compressedMessage.readUInt8(0)?this.incomingEncoding:"identity";let i;try{i=await this.decompressMessage(e.compressedMessage,t)}catch(e){return void this.sendStatus(e)}try{e.parsedMessage=this.handler.deserialize(i)}catch(e){return void this.sendStatus({code:r.Status.INTERNAL,details:`Error deserializing request: ${e.message}`})}e.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&"COMPRESSED"!==this.readQueue[0].type){this.isReadPending=!1;const e=this.readQueue.shift();"READABLE"===e.type?this.listener.onReceiveMessage(e.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(e){var t;if(this.checkCancelled())return;let i;f("Request to "+this.handler.path+" received data frame of size "+e.length);try{i=this.decoder.write(e)}catch(e){return void this.sendStatus({code:r.Status.RESOURCE_EXHAUSTED,details:e.message})}for(const e of i){this.stream.pause();const i={type:"COMPRESSED",compressedMessage:e,parsedMessage:null};this.readQueue.push(i),this.decompressAndMaybePush(i),null===(t=this.callEventTracker)||void 0===t||t.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(e){f("Request to "+this.handler.path+" start called"),this.checkCancelled()||(this.listener=e,e.onReceiveMetadata(this.metadata))}sendMetadata(e){if(this.checkCancelled())return;if(this.metadataSent)return;this.metadataSent=!0;const t=e?e.toHttp2Headers():null,i=Object.assign(Object.assign(Object.assign({},T),E),t);this.stream.respond(i,k)}sendMessage(e,t){if(this.checkCancelled())return;let i;try{i=this.serializeMessage(e)}catch(e){return void this.sendStatus({code:r.Status.INTERNAL,details:`Error serializing response: ${(0,o.getErrorMessage)(e)}`,metadata:null})}-1!==this.maxSendMessageSize&&i.length-5>this.maxSendMessageSize?this.sendStatus({code:r.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${i.length} vs. ${this.maxSendMessageSize})`,metadata:null}):(this.maybeSendMetadata(),f("Request to "+this.handler.path+" sent data frame of size "+i.length),this.stream.write(i,e=>{var i;e?this.sendStatus({code:r.Status.INTERNAL,details:`Error writing message: ${(0,o.getErrorMessage)(e)}`,metadata:null}):(null===(i=this.callEventTracker)||void 0===i||i.addMessageSent(),t())}))}sendStatus(e){var t,i,s;if(this.checkCancelled())return;f("Request to method "+(null===(t=this.handler)||void 0===t?void 0:t.path)+" ended with status code: "+r.Status[e.code]+" details: "+e.details);const o=null!==(s=null===(i=e.metadata)||void 0===i?void 0:i.clone())&&void 0!==s?s:new n.Metadata;if(this.shouldSendMetrics&&o.set(h.GRPC_METRICS_HEADER,this.metricsRecorder.serialize()),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));const t=Object.assign({[S]:e.code,[b]:encodeURI(e.details)},o.toHttp2Headers());this.stream.sendTrailers(t),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));const t=Object.assign(Object.assign({[S]:e.code,[b]:encodeURI(e.details)},T),o.toHttp2Headers());this.stream.respond(t,{endStream:!0}),this.notifyOnCancel()}}startRead(){f("Request to "+this.handler.path+" startRead called"),this.checkCancelled()||(this.isReadPending=!0,0===this.readQueue.length?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var e;const t=null===(e=this.stream.session)||void 0===e?void 0:e.socket;return(null==t?void 0:t.remoteAddress)?t.remotePort?`${t.remoteAddress}:${t.remotePort}`:t.remoteAddress:"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var e;if((null===(e=this.stream.session)||void 0===e?void 0:e.socket)instanceof u.TLSSocket){const e=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:e.raw?e:void 0}}return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}}t.BaseServerInterceptingCall=R},5943(e,t,i){"use strict";var n=this&&this.__runInitializers||function(e,t,i){for(var n=arguments.length>2,r=0;r<t.length;r++)i=n?t[r].call(e,i):t[r].call(e);return n?i:void 0},r=this&&this.__esDecorate||function(e,t,i,n,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?n.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),d=!1,f=i.length-1;f>=0;f--){var p={};for(var g in n)p[g]="access"===g?{}:n[g];for(var g in n.access)p.access[g]=n.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,i[f])("accessor"===l?{get:h.get,set:h.set}:h[c],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(h.get=a),(a=o(m.set))&&(h.set=a),(a=o(m.init))&&r.unshift(a)}else(a=o(m))&&("field"===l?r.unshift(a):h[c]=a)}u&&Object.defineProperty(u,n.name,h),d=!0};Object.defineProperty(t,"__esModule",{value:!0}),t.Server=void 0;const s=i(5675),o=i(9023),a=i(131),l=i(6860),c=i(8692),u=i(9302),h=i(267),d=i(8996),f=i(3822),p=i(9503),g=i(4892),m=~(1<<31),v=~(1<<31),y=~(1<<31),{HTTP2_HEADER_PATH:b}=s.constants,S=Buffer.from("max_age");function _(e){h.trace(a.LogVerbosity.DEBUG,"server_call",e)}function C(){}function w(e){return{code:a.Status.UNIMPLEMENTED,details:`The server does not implement the method ${e}`}}let E=(()=>{var e;let t,i=[];return e=class{constructor(e){var t,r,s,o,a,l;this.boundPorts=(n(this,i),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=null!=e?e:{},0===this.options["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new p.ChannelzTraceStub,this.callTracker=new p.ChannelzCallTrackerStub,this.listenerChildrenTracker=new p.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new p.ChannelzChildrenTrackerStub):(this.channelzTrace=new p.ChannelzTrace,this.callTracker=new p.ChannelzCallTracker,this.listenerChildrenTracker=new p.ChannelzChildrenTracker,this.sessionChildrenTracker=new p.ChannelzChildrenTracker),this.channelzRef=(0,p.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=null!==(t=this.options["grpc.max_connection_age_ms"])&&void 0!==t?t:m,this.maxConnectionAgeGraceMs=null!==(r=this.options["grpc.max_connection_age_grace_ms"])&&void 0!==r?r:m,this.keepaliveTimeMs=null!==(s=this.options["grpc.keepalive_time_ms"])&&void 0!==s?s:v,this.keepaliveTimeoutMs=null!==(o=this.options["grpc.keepalive_timeout_ms"])&&void 0!==o?o:2e4,this.sessionIdleTimeout=null!==(a=this.options["grpc.max_connection_idle_ms"])&&void 0!==a?a:y,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options?this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=null!==(l=this.options.interceptors)&&void 0!==l?l:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(e){var t,i,n;const r=this.sessions.get(e),s=e.socket,o=s.remoteAddress?(0,d.stringToSubchannelAddress)(s.remoteAddress,s.remotePort):null,a=s.localAddress?(0,d.stringToSubchannelAddress)(s.localAddress,s.localPort):null;let l;if(e.encrypted){const e=s,i=e.getCipher(),n=e.getCertificate(),r=e.getPeerCertificate();l={cipherSuiteStandardName:null!==(t=i.standardName)&&void 0!==t?t:null,cipherSuiteOtherName:i.standardName?null:i.name,localCertificate:n&&"raw"in n?n.raw:null,remoteCertificate:r&&"raw"in r?r.raw:null}}else l=null;return{remoteAddress:o,localAddress:a,security:l,remoteName:null,streamsStarted:r.streamTracker.callsStarted,streamsSucceeded:r.streamTracker.callsSucceeded,streamsFailed:r.streamTracker.callsFailed,messagesSent:r.messagesSent,messagesReceived:r.messagesReceived,keepAlivesSent:r.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:r.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:r.lastMessageSentTimestamp,lastMessageReceivedTimestamp:r.lastMessageReceivedTimestamp,localFlowControlWindow:null!==(i=e.state.localWindowSize)&&void 0!==i?i:null,remoteFlowControlWindow:null!==(n=e.state.remoteWindowSize)&&void 0!==n?n:null}}trace(e){h.trace(a.LogVerbosity.DEBUG,"server","("+this.channelzRef.id+") "+e)}keepaliveTrace(e){h.trace(a.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+e)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(e,t){if(null===e||"object"!=typeof e||null===t||"object"!=typeof t)throw new Error("addService() requires two objects as arguments");const i=Object.keys(e);if(0===i.length)throw new Error("Cannot add an empty service to a server");i.forEach(i=>{const n=e[i];let r;r=n.requestStream?n.responseStream?"bidi":"clientStream":n.responseStream?"serverStream":"unary";let s,o=t[i];void 0===o&&"string"==typeof n.originalName&&(o=t[n.originalName]),s=void 0!==o?o.bind(t):function(e,t){const i=w(t);switch(e){case"unary":case"clientStream":return(e,t)=>{t(i,null)};case"serverStream":case"bidi":return e=>{e.emit("error",i)};default:throw new Error(`Invalid handlerType ${e}`)}}(r,i);if(!1===this.register(n.path,s,n.responseSerialize,n.requestDeserialize,r))throw new Error(`Method handler for ${n.path} already provided.`)})}removeService(e){if(null===e||"object"!=typeof e)throw new Error("removeService() requires object as argument");Object.keys(e).forEach(t=>{const i=e[t];this.unregister(i.path)})}bind(e,t){throw new Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(e){return(0,p.registerChannelzSocket)((0,d.subchannelAddressToString)(e),()=>({localAddress:e,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(e){(0,p.unregisterChannelzRef)(e)}createHttp2Server(e){let t;if(e._isSecure()){const i=e._getConstructorOptions(),n=e._getSecureContextOptions(),r=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),i),n),{enableTrace:1===this.options["grpc-node.tls_enable_trace"]});let o=null!==n;this.trace("Initial credentials valid: "+o),t=s.createSecureServer(r),t.prependListener("connection",e=>{o||(this.trace("Dropped connection from "+JSON.stringify(e.address())+" due to unloaded credentials"),e.destroy())}),t.on("secureConnection",e=>{e.on("error",e=>{this.trace("An incoming TLS connection closed with error: "+e.message)})});const l=e=>{if(e){const i=t;try{i.setSecureContext(e)}catch(t){h.log(a.LogVerbosity.ERROR,"Failed to set secure context with error "+t.message),e=null}}o=null!==e,this.trace("Post-update credentials valid: "+o)};e._addWatcher(l),t.on("close",()=>{e._removeWatcher(l)})}else t=s.createServer(this.commonServerOptions);return t.setTimeout(0,C),this._setupHandlers(t,e._getInterceptors()),t}bindOneAddress(e,t){this.trace("Attempting to bind "+(0,d.subchannelAddressToString)(e));const i=this.createHttp2Server(t.credentials);return new Promise((n,r)=>{const s=t=>{this.trace("Failed to bind "+(0,d.subchannelAddressToString)(e)+" with error "+t.message),n({port:"port"in e?e.port:1,error:t.message})};i.once("error",s),i.listen(e,()=>{const e=i.address();let r;r="string"==typeof e?{path:e}:{host:e.address,port:e.port};const o=this.experimentalRegisterListenerToChannelz(r);this.listenerChildrenTracker.refChild(o),this.http2Servers.set(i,{channelzRef:o,sessions:new Set,ownsChannelzRef:!0}),t.listeningServers.add(i),this.trace("Successfully bound "+(0,d.subchannelAddressToString)(r)),n({port:"port"in r?r.port:1}),i.removeListener("error",s)})})}async bindManyPorts(e,t){if(0===e.length)return{count:0,port:0,errors:[]};if((0,d.isTcpSubchannelAddress)(e[0])&&0===e[0].port){const i=await this.bindOneAddress(e[0],t);if(i.error){const n=await this.bindManyPorts(e.slice(1),t);return Object.assign(Object.assign({},n),{errors:[i.error,...n.errors]})}{const n=e.slice(1).map(e=>(0,d.isTcpSubchannelAddress)(e)?{host:e.host,port:i.port}:e),r=await Promise.all(n.map(e=>this.bindOneAddress(e,t))),s=[i,...r];return{count:s.filter(e=>void 0===e.error).length,port:i.port,errors:s.filter(e=>e.error).map(e=>e.error)}}}{const i=await Promise.all(e.map(e=>this.bindOneAddress(e,t)));return{count:i.filter(e=>void 0===e.error).length,port:i[0].port,errors:i.filter(e=>e.error).map(e=>e.error)}}}async bindAddressList(e,t){const i=await this.bindManyPorts(e,t);if(i.count>0)return i.count<e.length&&h.log(a.LogVerbosity.INFO,`WARNING Only ${i.count} addresses added out of total ${e.length} resolved`),i.port;{const t=`No address added out of total ${e.length} resolved`;throw h.log(a.LogVerbosity.ERROR,t),new Error(`${t} errors: [${i.errors.join(",")}]`)}}resolvePort(e){return new Promise((t,i)=>{let n=!1;(0,u.createResolver)(e,(r,s,o,a)=>{if(n)return!0;if(n=!0,!r.ok)return i(new Error(r.error.details)),!0;const l=[].concat(...r.value.map(e=>e.addresses));return 0===l.length?(i(new Error(`No addresses resolved for port ${e}`)),!0):(t(l),!0)},this.options).updateResolution()})}async bindPort(e,t){const i=await this.resolvePort(e);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");const n=await this.bindAddressList(i,t);if(t.cancelled)throw this.completeUnbind(t),new Error("bindAsync operation cancelled by unbind call");return n}normalizePort(e){const t=(0,f.parseUri)(e);if(null===t)throw new Error(`Could not parse port "${e}"`);const i=(0,u.mapUriDefaultScheme)(t);if(null===i)throw new Error(`Could not get a default scheme for port "${e}"`);return i}bindAsync(e,t,i){if(this.shutdown)throw new Error("bindAsync called after shutdown");if("string"!=typeof e)throw new TypeError("port must be a string");if(null===t||!(t instanceof c.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if("function"!=typeof i)throw new TypeError("callback must be a function");this.trace("bindAsync port="+e);const n=this.normalizePort(e),r=(e,t)=>{process.nextTick(()=>i(e,t))};let s=this.boundPorts.get((0,f.uriToString)(n));if(s)return t._equals(s.credentials)?(s.cancelled=!1,void(s.completionPromise?s.completionPromise.then(e=>i(null,e),e=>i(e,0)):r(null,s.portNumber))):void r(new Error(`${e} already bound with incompatible credentials`),0);s={mapKey:(0,f.uriToString)(n),originalUri:n,completionPromise:null,cancelled:!1,portNumber:0,credentials:t,listeningServers:new Set};const o=(0,f.splitHostPort)(n.path),a=this.bindPort(n,s);s.completionPromise=a,0===(null==o?void 0:o.port)?a.then(e=>{const t={scheme:n.scheme,authority:n.authority,path:(0,f.combineHostPort)({host:o.host,port:e})};s.mapKey=(0,f.uriToString)(t),s.completionPromise=null,s.portNumber=e,this.boundPorts.set(s.mapKey,s),i(null,e)},e=>{i(e,0)}):(this.boundPorts.set(s.mapKey,s),a.then(e=>{s.completionPromise=null,s.portNumber=e,i(null,e)},e=>{i(e,0)}))}registerInjectorToChannelz(){return(0,p.registerChannelzSocket)("injector",()=>({localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(e,t,i=!1){if(null===e||!(e instanceof c.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");this.channelzEnabled&&this.listenerChildrenTracker.refChild(t);const n=this.createHttp2Server(e),r=new Set;return this.http2Servers.set(n,{channelzRef:t,sessions:r,ownsChannelzRef:i}),{injectConnection:e=>{n.emit("connection",e)},drain:e=>{var t,i;for(const e of r)this.closeSession(e);null===(i=(t=setTimeout(()=>{for(const e of r)e.destroy(s.constants.NGHTTP2_CANCEL)},e)).unref)||void 0===i||i.call(t)},destroy:()=>{this.closeServer(n);for(const e of r)this.closeSession(e)}}}createConnectionInjector(e){if(null===e||!(e instanceof c.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");const t=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(e,t,!0)}closeServer(e,t){this.trace("Closing server with address "+JSON.stringify(e.address()));const i=this.http2Servers.get(e);e.close(()=>{i&&i.ownsChannelzRef&&(this.listenerChildrenTracker.unrefChild(i.channelzRef),(0,p.unregisterChannelzRef)(i.channelzRef)),this.http2Servers.delete(e),null==t||t()})}closeSession(e,t){var i;this.trace("Closing session initiated by "+(null===(i=e.socket)||void 0===i?void 0:i.remoteAddress));const n=this.sessions.get(e),r=()=>{n&&(this.sessionChildrenTracker.unrefChild(n.ref),(0,p.unregisterChannelzRef)(n.ref)),null==t||t()};e.closed?queueMicrotask(r):e.close(r)}completeUnbind(e){for(const t of e.listeningServers){const i=this.http2Servers.get(t);if(this.closeServer(t,()=>{e.listeningServers.delete(t)}),i)for(const e of i.sessions)this.closeSession(e)}this.boundPorts.delete(e.mapKey)}unbind(e){this.trace("unbind port="+e);const t=this.normalizePort(e),i=(0,f.splitHostPort)(t.path);if(0===(null==i?void 0:i.port))throw new Error("Cannot unbind port 0");const n=this.boundPorts.get((0,f.uriToString)(t));n&&(this.trace("unbinding "+n.mapKey+" originally bound as "+(0,f.uriToString)(n.originalUri)),n.completionPromise?n.cancelled=!0:this.completeUnbind(n))}drain(e,t){var i,n;this.trace("drain port="+e+" graceTimeMs="+t);const r=this.normalizePort(e),o=(0,f.splitHostPort)(r.path);if(0===(null==o?void 0:o.port))throw new Error("Cannot drain port 0");const a=this.boundPorts.get((0,f.uriToString)(r));if(!a)return;const l=new Set;for(const e of a.listeningServers){const t=this.http2Servers.get(e);if(t)for(const e of t.sessions)l.add(e),this.closeSession(e,()=>{l.delete(e)})}null===(n=(i=setTimeout(()=>{for(const e of l)e.destroy(s.constants.NGHTTP2_CANCEL)},t)).unref)||void 0===n||n.call(i)}forceShutdown(){for(const e of this.boundPorts.values())e.cancelled=!0;this.boundPorts.clear();for(const e of this.http2Servers.keys())this.closeServer(e);this.sessions.forEach((e,t)=>{this.closeSession(t),t.destroy(s.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,p.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(e,t,i,n,r){return!this.handlers.has(e)&&(this.handlers.set(e,{func:t,serialize:i,deserialize:n,type:r,path:e}),!0)}unregister(e){return this.handlers.delete(e)}start(){if(0===this.http2Servers.size||[...this.http2Servers.keys()].every(e=>!e.listening))throw new Error("server must be bound in order to start");if(!0===this.started)throw new Error("server is already started");this.started=!0}tryShutdown(e){var t;const i=t=>{(0,p.unregisterChannelzRef)(this.channelzRef),e(t)};let n=0;function r(){n--,0===n&&i()}this.shutdown=!0;for(const[e,i]of this.http2Servers.entries()){n++;const s=i.channelzRef.name;this.trace("Waiting for server "+s+" to close"),this.closeServer(e,()=>{this.trace("Server "+s+" finished closing"),r()});for(const e of i.sessions.keys()){n++;const i=null===(t=e.socket)||void 0===t?void 0:t.remoteAddress;this.trace("Waiting for session "+i+" to close"),this.closeSession(e,()=>{this.trace("Session "+i+" finished closing"),r()})}}0===n&&i()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(e,t){const i=t[s.constants.HTTP2_HEADER_CONTENT_TYPE];return!("string"!=typeof i||!i.startsWith("application/grpc"))||(e.respond({[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1)}_retrieveHandler(e){_("Received call to method "+e+" at address "+this.serverAddressString);const t=this.handlers.get(e);return void 0===t?(_("No handler registered for method "+e+". Sending UNIMPLEMENTED status."),null):t}_respondWithError(e,t,i=null){var n,r;const o=Object.assign({"grpc-status":null!==(n=e.code)&&void 0!==n?n:a.Status.INTERNAL,"grpc-message":e.details,[s.constants.HTTP2_HEADER_STATUS]:s.constants.HTTP_STATUS_OK,[s.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},null===(r=e.metadata)||void 0===r?void 0:r.toHttp2Headers());t.respond(o,{endStream:!0}),this.callTracker.addCallFailed(),null==i||i.streamTracker.addCallFailed()}_channelzHandler(e,t,i){this.onStreamOpened(t);const n=this.sessions.get(t.session);if(this.callTracker.addCallStarted(),null==n||n.streamTracker.addCallStarted(),!this._verifyContentType(t,i))return this.callTracker.addCallFailed(),void(null==n||n.streamTracker.addCallFailed());const r=i[b],s=this._retrieveHandler(r);if(!s)return void this._respondWithError(w(r),t,n);const o={addMessageSent:()=>{n&&(n.messagesSent+=1,n.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{n&&(n.messagesReceived+=1,n.lastMessageReceivedTimestamp=new Date)},onCallEnd:e=>{e.code===a.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:e=>{n&&(e?n.streamTracker.addCallSucceeded():n.streamTracker.addCallFailed())}},l=(0,g.getServerInterceptingCall)([...e,...this.interceptors],t,i,o,s,this.options);this._runHandlerForCall(l,s)||(this.callTracker.addCallFailed(),null==n||n.streamTracker.addCallFailed(),l.sendStatus({code:a.Status.INTERNAL,details:`Unknown handler type: ${s.type}`}))}_streamHandler(e,t,i){if(this.onStreamOpened(t),!0!==this._verifyContentType(t,i))return;const n=i[b],r=this._retrieveHandler(n);if(!r)return void this._respondWithError(w(n),t,null);const s=(0,g.getServerInterceptingCall)([...e,...this.interceptors],t,i,null,r,this.options);this._runHandlerForCall(s,r)||s.sendStatus({code:a.Status.INTERNAL,details:`Unknown handler type: ${r.type}`})}_runHandlerForCall(e,t){const{type:i}=t;if("unary"===i)!async function(e,t){let i,n;function r(t,i,n,r){t?e.sendStatus((0,l.serverErrorToStatus)(t,n)):e.sendMessage(i,()=>{e.sendStatus({code:a.Status.OK,details:"OK",metadata:null!=n?n:null})})}let s=null;e.start({onReceiveMetadata(t){n=t,e.startRead()},onReceiveMessage(i){s?e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(s=i,e.startRead())},onReceiveHalfClose(){if(s){i=new l.ServerWritableStreamImpl(t.path,e,n,s);try{t.func(i,r)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"))}})}(e,t);else if("clientStream"===i)!function(e,t){let i;function n(t,i,n,r){t?e.sendStatus((0,l.serverErrorToStatus)(t,n)):e.sendMessage(i,()=>{e.sendStatus({code:a.Status.OK,details:"OK",metadata:null!=n?n:null})})}e.start({onReceiveMetadata(r){i=new l.ServerDuplexStreamImpl(t.path,e,r);try{t.func(i,n)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){i.push(e)},onReceiveHalfClose(){i.push(null)},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"),i.destroy())}})}(e,t);else if("serverStream"===i)!function(e,t){let i,n,r=null;e.start({onReceiveMetadata(t){n=t,e.startRead()},onReceiveMessage(i){r?e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${t.path}`,metadata:null}):(r=i,e.startRead())},onReceiveHalfClose(){if(r){i=new l.ServerWritableStreamImpl(t.path,e,n,r);try{t.func(i)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}}else e.sendStatus({code:a.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${t.path}`,metadata:null})},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"),i.destroy())}})}(e,t);else{if("bidi"!==i)return!1;!function(e,t){let i;e.start({onReceiveMetadata(n){i=new l.ServerDuplexStreamImpl(t.path,e,n);try{t.func(i)}catch(t){e.sendStatus({code:a.Status.UNKNOWN,details:`Server method handler threw error ${t.message}`,metadata:null})}},onReceiveMessage(e){i.push(e)},onReceiveHalfClose(){i.push(null)},onCancel(){i&&(i.cancelled=!0,i.emit("cancelled","cancelled"),i.destroy())}})}(e,t)}return!0}_setupHandlers(e,t){if(null===e)return;const i=e.address();let n="null";i&&(n="string"==typeof i?i:i.address+":"+i.port),this.serverAddressString=n;const r=this.channelzEnabled?this._channelzHandler:this._streamHandler,s=this.channelzEnabled?this._channelzSessionHandler(e):this._sessionHandler(e);e.on("stream",r.bind(this,t)),e.on("session",s)}_sessionHandler(e){return t=>{var i,n;null===(i=this.http2Servers.get(e))||void 0===i||i.sessions.add(t);let r=null,o=null,a=null,l=!1;const c=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==m){const e=this.maxConnectionAgeMs/10,i=Math.random()*e*2-e;r=setTimeout(()=>{var e,i;l=!0,this.trace("Connection dropped by max connection age: "+(null===(e=t.socket)||void 0===e?void 0:e.remoteAddress));try{t.goaway(s.constants.NGHTTP2_NO_ERROR,~(1<<31),S)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==m&&(o=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(i=o.unref)||void 0===i||i.call(o))},this.maxConnectionAgeMs+i),null===(n=r.unref)||void 0===n||n.call(r)}const u=()=>{a&&(clearTimeout(a),a=null)},h=()=>!t.destroyed&&this.keepaliveTimeMs<v&&this.keepaliveTimeMs>0;let d;const f=()=>{var e;h()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),a=setTimeout(()=>{u(),d()},this.keepaliveTimeMs),null===(e=a.unref)||void 0===e||e.call(a))};d=()=>{var e;if(!h())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let i="";try{t.ping((e,i,n)=>{u(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),l=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),f())})||(i="Ping returned false")}catch(e){i=(e instanceof Error?e.message:"")||"Unknown error"}if(i)return this.keepaliveTrace("Ping send failed: "+i),this.trace("Connection dropped due to ping send error: "+i),l=!0,void t.destroy();a=setTimeout(()=>{u(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),l=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=a.unref)||void 0===e||e.call(a)},f(),t.on("close",()=>{var i,n;l||this.trace(`Connection dropped by client ${null===(i=t.socket)||void 0===i?void 0:i.remoteAddress}`),r&&clearTimeout(r),o&&clearTimeout(o),u(),null!==c&&(clearTimeout(c.timeout),this.sessionIdleTimeouts.delete(t)),null===(n=this.http2Servers.get(e))||void 0===n||n.sessions.delete(t)})}}_channelzSessionHandler(e){return t=>{var i,n,r,o;const a=(0,p.registerChannelzSocket)(null!==(n=null===(i=t.socket)||void 0===i?void 0:i.remoteAddress)&&void 0!==n?n:"unknown",this.getChannelzSessionInfo.bind(this,t),this.channelzEnabled),l={ref:a,streamTracker:new p.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};null===(r=this.http2Servers.get(e))||void 0===r||r.sessions.add(t),this.sessions.set(t,l);const c=`${t.socket.remoteAddress}:${t.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+c),this.trace("Connection established by client "+c),this.sessionChildrenTracker.refChild(a);let u=null,h=null,d=null,f=!1;const g=this.enableIdleTimeout(t);if(this.maxConnectionAgeMs!==m){const e=this.maxConnectionAgeMs/10,i=Math.random()*e*2-e;u=setTimeout(()=>{var e;f=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+c);try{t.goaway(s.constants.NGHTTP2_NO_ERROR,~(1<<31),S)}catch(e){return void t.destroy()}t.close(),this.maxConnectionAgeGraceMs!==m&&(h=setTimeout(()=>{t.destroy()},this.maxConnectionAgeGraceMs),null===(e=h.unref)||void 0===e||e.call(h))},this.maxConnectionAgeMs+i),null===(o=u.unref)||void 0===o||o.call(u)}const y=()=>{d&&(clearTimeout(d),d=null)},b=()=>!t.destroyed&&this.keepaliveTimeMs<v&&this.keepaliveTimeMs>0;let _;const C=()=>{var e;b()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),d=setTimeout(()=>{y(),_()},this.keepaliveTimeMs),null===(e=d.unref)||void 0===e||e.call(d))};_=()=>{var e;if(!b())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let i="";try{t.ping((e,i,n)=>{y(),e?(this.keepaliveTrace("Ping failed with error: "+e.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+e.message+" return in "+i),f=!0,t.destroy()):(this.keepaliveTrace("Received ping response"),C())})||(i="Ping returned false")}catch(e){i=(e instanceof Error?e.message:"")||"Unknown error"}if(i)return this.keepaliveTrace("Ping send failed: "+i),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+i),f=!0,void t.destroy();l.keepAlivesSent+=1,d=setTimeout(()=>{y(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+c),f=!0,t.destroy()},this.keepaliveTimeoutMs),null===(e=d.unref)||void 0===e||e.call(d)},C(),t.on("close",()=>{var i;f||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+c),this.sessionChildrenTracker.unrefChild(a),(0,p.unregisterChannelzRef)(a),u&&clearTimeout(u),h&&clearTimeout(h),y(),null!==g&&(clearTimeout(g.timeout),this.sessionIdleTimeouts.delete(t)),null===(i=this.http2Servers.get(e))||void 0===i||i.sessions.delete(t),this.sessions.delete(t)})}}enableIdleTimeout(e){var t,i;if(this.sessionIdleTimeout>=y)return null;const n={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,e),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,e)};null===(i=(t=n.timeout).unref)||void 0===i||i.call(t),this.sessionIdleTimeouts.set(e,n);const{socket:r}=e;return this.trace("Enable idle timeout for "+r.remoteAddress+":"+r.remotePort),n}onIdleTimeout(e,t){const{socket:i}=t,n=e.sessionIdleTimeouts.get(t);void 0!==n&&0===n.activeStreams&&(Date.now()-n.lastIdle>=e.sessionIdleTimeout?(e.trace("Session idle timeout triggered for "+(null==i?void 0:i.remoteAddress)+":"+(null==i?void 0:i.remotePort)+" last idle at "+n.lastIdle),e.closeSession(t)):n.timeout.refresh())}onStreamOpened(e){const t=e.session,i=this.sessionIdleTimeouts.get(t);i&&(i.activeStreams+=1,e.once("close",i.onClose))}onStreamClose(e){var t,i;const n=this.sessionIdleTimeouts.get(e);n&&(n.activeStreams-=1,0===n.activeStreams&&(n.lastIdle=Date.now(),n.timeout.refresh(),this.trace("Session onStreamClose"+(null===(t=e.socket)||void 0===t?void 0:t.remoteAddress)+":"+(null===(i=e.socket)||void 0===i?void 0:i.remotePort)+" at "+n.lastIdle)))}},(()=>{const n="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;var s;t=[(s="Calling start() is no longer necessary. It can be safely omitted.",function(e,t){return o.deprecate(e,s)})],r(e,null,t,{kind:"method",name:"start",static:!1,private:!1,access:{has:e=>"start"in e,get:e=>e.start},metadata:n},null,i),n&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})})(),e})();t.Server=E},5656(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateRetryThrottling=l,t.validateServiceConfig=u,t.extractAndSelectServiceConfig=function(e,t){for(const i of e)if(i.length>0&&i[0].startsWith("grpc_config=")){const e=i.join("").substring(12);return d(JSON.parse(e),t)}return null};const n=i(857),r=i(131),s=/^\d+(\.\d{1,9})?s$/;function o(e){if("service"in e&&""!==e.service){if("string"!=typeof e.service)throw new Error("Invalid method config name: invalid service: expected type string, got "+typeof e.service);if("method"in e&&""!==e.method){if("string"!=typeof e.method)throw new Error("Invalid method config name: invalid method: expected type string, got "+typeof e.service);return{service:e.service,method:e.method}}return{service:e.service}}if("method"in e&&void 0!==e.method)throw new Error("Invalid method config name: method set with empty or unset service");return{}}function a(e){var t;const i={name:[]};if(!("name"in e)||!Array.isArray(e.name))throw new Error("Invalid method config: invalid name array");for(const t of e.name)i.name.push(o(t));if("waitForReady"in e){if("boolean"!=typeof e.waitForReady)throw new Error("Invalid method config: invalid waitForReady");i.waitForReady=e.waitForReady}if("timeout"in e)if("object"==typeof e.timeout){if(!("seconds"in e.timeout)||"number"!=typeof e.timeout.seconds)throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in e.timeout)||"number"!=typeof e.timeout.nanos)throw new Error("Invalid method config: invalid timeout.nanos");i.timeout=e.timeout}else{if("string"!=typeof e.timeout||!s.test(e.timeout))throw new Error("Invalid method config: invalid timeout");{const n=e.timeout.substring(0,e.timeout.length-1).split(".");i.timeout={seconds:0|n[0],nanos:0|(null!==(t=n[1])&&void 0!==t?t:0)}}}if("maxRequestBytes"in e){if("number"!=typeof e.maxRequestBytes)throw new Error("Invalid method config: invalid maxRequestBytes");i.maxRequestBytes=e.maxRequestBytes}if("maxResponseBytes"in e){if("number"!=typeof e.maxResponseBytes)throw new Error("Invalid method config: invalid maxRequestBytes");i.maxResponseBytes=e.maxResponseBytes}if("retryPolicy"in e){if("hedgingPolicy"in e)throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");i.retryPolicy=function(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in e)||"string"!=typeof e.initialBackoff||!s.test(e.initialBackoff))throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in e)||"string"!=typeof e.maxBackoff||!s.test(e.maxBackoff))throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in e)||"number"!=typeof e.backoffMultiplier||e.backoffMultiplier<=0)throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!("retryableStatusCodes"in e)||!Array.isArray(e.retryableStatusCodes))throw new Error("Invalid method config retry policy: retryableStatusCodes is required");if(0===e.retryableStatusCodes.length)throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(const t of e.retryableStatusCodes)if("number"==typeof t){if(!Object.values(r.Status).includes(t))throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else{if("string"!=typeof t)throw new Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");if(!Object.values(r.Status).includes(t.toUpperCase()))throw new Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}return{maxAttempts:e.maxAttempts,initialBackoff:e.initialBackoff,maxBackoff:e.maxBackoff,backoffMultiplier:e.backoffMultiplier,retryableStatusCodes:e.retryableStatusCodes}}(e.retryPolicy)}else"hedgingPolicy"in e&&(i.hedgingPolicy=function(e){if(!("maxAttempts"in e)||!Number.isInteger(e.maxAttempts)||e.maxAttempts<2)throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in e&&("string"!=typeof e.hedgingDelay||!s.test(e.hedgingDelay)))throw new Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in e&&Array.isArray(e.nonFatalStatusCodes))for(const t of e.nonFatalStatusCodes)if("number"==typeof t){if(!Object.values(r.Status).includes(t))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else{if("string"!=typeof t)throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");if(!Object.values(r.Status).includes(t.toUpperCase()))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}const t={maxAttempts:e.maxAttempts};return e.hedgingDelay&&(t.hedgingDelay=e.hedgingDelay),e.nonFatalStatusCodes&&(t.nonFatalStatusCodes=e.nonFatalStatusCodes),t}(e.hedgingPolicy));return i}function l(e){if(!("maxTokens"in e)||"number"!=typeof e.maxTokens||e.maxTokens<=0||e.maxTokens>1e3)throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in e)||"number"!=typeof e.tokenRatio||e.tokenRatio<=0)throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+e.maxTokens.toFixed(3),tokenRatio:+e.tokenRatio.toFixed(3)}}function c(e){if("object"!=typeof e||null===e)throw new Error("Invalid loadBalancingConfig: unexpected type "+typeof e);const t=Object.keys(e);if(t.length>1)throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${t}`);if(0===t.length)throw new Error("Invalid loadBalancingConfig: load balancing policy name required");return{[t[0]]:e[t[0]]}}function u(e){const t={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in e){if("string"!=typeof e.loadBalancingPolicy)throw new Error("Invalid service config: invalid loadBalancingPolicy");t.loadBalancingPolicy=e.loadBalancingPolicy}if("loadBalancingConfig"in e){if(!Array.isArray(e.loadBalancingConfig))throw new Error("Invalid service config: invalid loadBalancingConfig");for(const i of e.loadBalancingConfig)t.loadBalancingConfig.push(c(i))}if("methodConfig"in e&&Array.isArray(e.methodConfig))for(const i of e.methodConfig)t.methodConfig.push(a(i));"retryThrottling"in e&&(t.retryThrottling=l(e.retryThrottling));const i=[];for(const e of t.methodConfig)for(const t of e.name){for(const e of i)if(t.service===e.service&&t.method===e.method)throw new Error(`Invalid service config: duplicate name ${t.service}/${t.method}`);i.push(t)}return t}function h(e){if(!("serviceConfig"in e))throw new Error("Invalid service config choice: missing service config");const t={serviceConfig:u(e.serviceConfig)};if("clientLanguage"in e){if(!Array.isArray(e.clientLanguage))throw new Error("Invalid service config choice: invalid clientLanguage");t.clientLanguage=[];for(const i of e.clientLanguage){if("string"!=typeof i)throw new Error("Invalid service config choice: invalid clientLanguage");t.clientLanguage.push(i)}}if("clientHostname"in e){if(!Array.isArray(e.clientHostname))throw new Error("Invalid service config choice: invalid clientHostname");t.clientHostname=[];for(const i of e.clientHostname){if("string"!=typeof i)throw new Error("Invalid service config choice: invalid clientHostname");t.clientHostname.push(i)}}if("percentage"in e){if(!("number"==typeof e.percentage&&0<=e.percentage&&e.percentage<=100))throw new Error("Invalid service config choice: invalid percentage");t.percentage=e.percentage}const i=["clientLanguage","percentage","clientHostname","serviceConfig"];for(const t in e)if(!i.includes(t))throw new Error(`Invalid service config choice: unexpected field ${t}`);return t}function d(e,t){if(!Array.isArray(e))throw new Error("Invalid service config list");for(const i of e){const e=h(i);if(!("number"==typeof e.percentage&&t>e.percentage)){if(Array.isArray(e.clientHostname)){let t=!1;for(const i of e.clientHostname)i===n.hostname()&&(t=!0);if(!t)continue}if(Array.isArray(e.clientLanguage)){let t=!1;for(const i of e.clientLanguage)"node"===i&&(t=!0);if(!t)continue}return e.serviceConfig}}throw new Error("No matching service config found")}},246(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SingleSubchannelChannel=void 0;const n=i(5572),r=i(9503),s=i(4987),o=i(463),a=i(131),l=i(6067),c=i(6308),u=i(1703),h=i(4097),d=i(9302),f=i(3822);class p{constructor(e,t,i,n,r){var s,o;this.subchannel=e,this.method=t,this.options=n,this.callNumber=r,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;const l=this.method.split("/");let u="";l.length>=2&&(u=l[1]);const h=null!==(o=null===(s=(0,f.splitHostPort)(this.options.host))||void 0===s?void 0:s.host)&&void 0!==o?o:"localhost";this.serviceUrl=`https://${h}/${u}`;const d=(0,c.getRelativeTimeout)(n.deadline);d!==1/0&&(d<=0?this.cancelWithStatus(a.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(a.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},d)),this.filterStack=i.createFilter()}cancelWithStatus(e,t){this.childCall?this.childCall.cancelWithStatus(e,t):this.pendingStatus={code:e,details:t,metadata:new h.Metadata}}getPeer(){var e,t;return null!==(t=null===(e=this.childCall)||void 0===e?void 0:e.getPeer())&&void 0!==t?t:this.subchannel.getAddress()}async start(e,t){if(this.pendingStatus)return void t.onReceiveStatus(this.pendingStatus);if(this.subchannel.getConnectivityState()!==o.ConnectivityState.READY)return void t.onReceiveStatus({code:a.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new h.Metadata});const i=await this.filterStack.sendMetadata(Promise.resolve(e));let n;try{n=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(e){const i=e,{code:n,details:r}=(0,l.restrictControlPlaneStatusCode)("number"==typeof i.code?i.code:a.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${i.message}`);return void t.onReceiveStatus({code:n,details:r,metadata:new h.Metadata})}n.merge(i);const r={onReceiveMetadata:async e=>{t.onReceiveMetadata(await this.filterStack.receiveMetadata(e))},onReceiveMessage:async e=>{this.readFilterPending=!0;const i=await this.filterStack.receiveMessage(e);this.readFilterPending=!1,t.onReceiveMessage(i),this.pendingStatus&&t.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async e=>{const i=await this.filterStack.receiveTrailers(e);this.readFilterPending?this.pendingStatus=i:t.onReceiveStatus(i)}};this.childCall=this.subchannel.createCall(n,this.options.host,this.method,r),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,t){this.writeFilterPending=!0;const i=await this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,i.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:i.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}}t.SingleSubchannelChannel=class{constructor(e,t,i){this.subchannel=e,this.target=t,this.channelzEnabled=!1,this.channelzTrace=new r.ChannelzTrace,this.callTracker=new r.ChannelzCallTracker,this.childrenTracker=new r.ChannelzChildrenTracker,this.channelzEnabled=0!==i["grpc.enable_channelz"],this.channelzRef=(0,r.registerChannelzChannel)((0,f.uriToString)(t),()=>({target:`${(0,f.uriToString)(t)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new u.FilterStackFactory([new s.CompressionFilterFactory(this,i)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,r.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,f.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,t,i){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(e,t){const i={deadline:t,host:(0,d.getDefaultAuthority)(this.target),flags:a.Propagate.DEFAULTS,parentCall:null};return new p(this.subchannel,e,this.filterStackFactory,i,(0,n.getNextCallNumber)())}}},2284(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatusBuilder=void 0;t.StatusBuilder=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(e){return this.code=e,this}withDetails(e){return this.details=e,this}withMetadata(e){return this.metadata=e,this}build(){const e={};return null!==this.code&&(e.code=this.code),null!==this.details&&(e.details=this.details),null!==this.metadata&&(e.metadata=this.metadata),e}}},9453(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.StreamDecoder=void 0,function(e){e[e.NO_DATA=0]="NO_DATA",e[e.READING_SIZE=1]="READING_SIZE",e[e.READING_MESSAGE=2]="READING_MESSAGE"}(i||(i={}));t.StreamDecoder=class{constructor(e){this.maxReadMessageLength=e,this.readState=i.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(e){let t,n=0;const r=[];for(;n<e.length;)switch(this.readState){case i.NO_DATA:this.readCompressFlag=e.slice(n,n+1),n+=1,this.readState=i.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case i.READING_SIZE:if(t=Math.min(e.length-n,this.readSizeRemaining),e.copy(this.readPartialSize,4-this.readSizeRemaining,n,n+t),this.readSizeRemaining-=t,n+=t,0===this.readSizeRemaining){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),-1!==this.maxReadMessageLength&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=i.READING_MESSAGE;else{const e=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=i.NO_DATA,r.push(e)}}break;case i.READING_MESSAGE:if(t=Math.min(e.length-n,this.readMessageRemaining),this.readPartialMessage.push(e.slice(n,n+t)),this.readMessageRemaining-=t,n+=t,0===this.readMessageRemaining){const e=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),t=Buffer.concat(e,this.readMessageSize+5);this.readState=i.NO_DATA,r.push(t)}break;default:throw new Error("Unexpected read state")}return r}}},8996(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EndpointMap=void 0,t.isTcpSubchannelAddress=r,t.subchannelAddressEqual=s,t.subchannelAddressToString=o,t.stringToSubchannelAddress=function(e,t){return(0,n.isIP)(e)?{host:e,port:null!=t?t:443}:{path:e}},t.endpointEqual=function(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(let i=0;i<e.addresses.length;i++)if(!s(e.addresses[i],t.addresses[i]))return!1;return!0},t.endpointToString=function(e){return"["+e.addresses.map(o).join(", ")+"]"},t.endpointHasAddress=a;const n=i(9278);function r(e){return"port"in e}function s(e,t){return!e&&!t||!(!e||!t)&&(r(e)?r(t)&&e.host===t.host&&e.port===t.port:!r(t)&&e.path===t.path)}function o(e){return r(e)?(0,n.isIPv6)(e.host)?"["+e.host+"]:"+e.port:e.host+":"+e.port:e.path}function a(e,t){for(const i of e.addresses)if(s(i,t))return!0;return!1}function l(e,t){if(e.addresses.length!==t.addresses.length)return!1;for(const i of e.addresses){let e=!1;for(const n of t.addresses)if(s(i,n)){e=!0;break}if(!e)return!1}return!0}t.EndpointMap=class{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(e){for(const t of this.map)if(a(t.key,e))return t.value}deleteMissing(e){const t=[];for(const i of this.map){let n=!1;for(const t of e)l(t,i.key)&&(n=!0);n||(t.push(i.value),this.map.delete(i))}return t}get(e){for(const t of this.map)if(l(e,t.key))return t.value}set(e,t){for(const i of this.map)if(l(e,i.key))return void(i.value=t);this.map.add({key:e,value:t})}delete(e){for(const t of this.map)if(l(e,t.key))return void this.map.delete(t)}has(e){for(const t of this.map)if(l(e,t.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(const e of this.map)yield e.key}*values(){for(const e of this.map)yield e.value}*entries(){for(const e of this.map)yield[e.key,e.value]}}},5486(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Http2SubchannelCall=void 0;const n=i(5675),r=i(857),s=i(131),o=i(4097),a=i(9453),l=i(267),c=i(131);function u(e){const t=`Received HTTP status code ${e}`;let i;switch(e){case 400:i=s.Status.INTERNAL;break;case 401:i=s.Status.UNAUTHENTICATED;break;case 403:i=s.Status.PERMISSION_DENIED;break;case 404:i=s.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:i=s.Status.UNAVAILABLE;break;default:i=s.Status.UNKNOWN}return{code:i,details:t,metadata:new o.Metadata}}t.Http2SubchannelCall=class{constructor(e,t,i,l,c){var h;this.http2Stream=e,this.callEventTracker=t,this.listener=i,this.transport=l,this.callId=c,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;const d=null!==(h=l.getOptions()["grpc.max_receive_message_length"])&&void 0!==h?h:s.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new a.StreamDecoder(d),e.on("response",(e,t)=>{let i="";for(const t of Object.keys(e))i+="\t\t"+t+": "+e[t]+"\n";if(this.trace("Received server headers:\n"+i),this.httpStatusCode=e[":status"],t&n.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(e);else{let t;try{t=o.Metadata.fromHttp2Headers(e)}catch(e){return void this.endCall({code:s.Status.UNKNOWN,details:e.message,metadata:new o.Metadata})}this.listener.onReceiveMetadata(t)}}),e.on("trailers",e=>{this.handleTrailers(e)}),e.on("data",e=>{if(this.statusOutput)return;let t;this.trace("receive HTTP/2 data frame of length "+e.length);try{t=this.decoder.write(e)}catch(e){if(void 0!==this.httpStatusCode&&200!==this.httpStatusCode){const e=u(this.httpStatusCode);this.cancelWithStatus(e.code,e.details)}else this.cancelWithStatus(s.Status.RESOURCE_EXHAUSTED,e.message);return}for(const e of t)this.trace("parsed message of length "+e.length),this.callEventTracker.addMessageReceived(),this.tryPush(e)}),e.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),e.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var t;if(this.trace("HTTP/2 stream closed with code "+e.rstCode),(null===(t=this.finalStatus)||void 0===t?void 0:t.code)===s.Status.OK)return;let i,r="";switch(e.rstCode){case n.constants.NGHTTP2_NO_ERROR:if(null!==this.finalStatus)return;if(this.httpStatusCode&&200!==this.httpStatusCode){const e=u(this.httpStatusCode);i=e.code,r=e.details}else i=s.Status.INTERNAL,r=`Received RST_STREAM with code ${e.rstCode} (Call ended without gRPC status)`;break;case n.constants.NGHTTP2_REFUSED_STREAM:i=s.Status.UNAVAILABLE,r="Stream refused by server";break;case n.constants.NGHTTP2_CANCEL:this.connectionDropped?(i=s.Status.UNAVAILABLE,r="Connection dropped"):(i=s.Status.CANCELLED,r="Call cancelled");break;case n.constants.NGHTTP2_ENHANCE_YOUR_CALM:i=s.Status.RESOURCE_EXHAUSTED,r="Bandwidth exhausted or memory limit exceeded";break;case n.constants.NGHTTP2_INADEQUATE_SECURITY:i=s.Status.PERMISSION_DENIED,r="Protocol not secure enough";break;case n.constants.NGHTTP2_INTERNAL_ERROR:i=s.Status.INTERNAL,null===this.internalError?r=`Received RST_STREAM with code ${e.rstCode} (Internal server error)`:"ECONNRESET"===this.internalError.code||"ETIMEDOUT"===this.internalError.code?(i=s.Status.UNAVAILABLE,r=this.internalError.message):r=`Received RST_STREAM with code ${e.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:i=s.Status.INTERNAL,r=`Received RST_STREAM with code ${e.rstCode}`}this.endCall({code:i,details:r,metadata:new o.Metadata,rstCode:e.rstCode})})}),e.on("error",e=>{"ERR_HTTP2_STREAM_ERROR"!==e.code&&(this.trace("Node error event: message="+e.message+" code="+e.code+" errno="+function(e){for(const[t,i]of Object.entries(r.constants.errno))if(i===e)return t;return"Unknown system error "+e}(e.errno)+" syscall="+e.syscall),this.internalError=e),this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:s.Status.UNAVAILABLE,details:"Connection dropped",metadata:new o.Metadata})})}outputStatus(){this.statusOutput||(this.statusOutput=!0,this.trace("ended with status: code="+this.finalStatus.code+' details="'+this.finalStatus.details+'"'),this.callEventTracker.onCallEnd(this.finalStatus),process.nextTick(()=>{this.listener.onReceiveStatus(this.finalStatus)}),this.http2Stream.resume())}trace(e){l.trace(c.LogVerbosity.DEBUG,"subchannel_call","["+this.callId+"] "+e)}endCall(e){null!==this.finalStatus&&this.finalStatus.code!==s.Status.OK||(this.finalStatus=e,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){null!==this.finalStatus&&(this.finalStatus.code!==s.Status.OK||this.readsClosed&&0===this.unpushedReadMessages.length&&!this.isReadFilterPending&&!this.isPushPending)&&this.outputStatus()}push(e){this.trace("pushing to reader message of length "+(e instanceof Buffer?e.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{this.isPushPending=!1,this.statusOutput||(this.listener.onReceiveMessage(e),this.maybeOutputStatus())})}tryPush(e){this.canPush?(this.http2Stream.pause(),this.push(e)):(this.trace("unpushedReadMessages.push message of length "+e.length),this.unpushedReadMessages.push(e))}handleTrailers(e){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let t,i="";for(const t of Object.keys(e))i+="\t\t"+t+": "+e[t]+"\n";this.trace("Received server trailers:\n"+i);try{t=o.Metadata.fromHttp2Headers(e)}catch(e){t=new o.Metadata}const n=t.getMap();let r;if("string"==typeof n["grpc-status"]){const e=Number(n["grpc-status"]);this.trace("received status code "+e+" from server"),t.remove("grpc-status");let i="";if("string"==typeof n["grpc-message"]){try{i=decodeURI(n["grpc-message"])}catch(e){i=n["grpc-message"]}t.remove("grpc-message"),this.trace('received status details string "'+i+'" from server')}r={code:e,details:i,metadata:t}}else this.httpStatusCode?(r=u(this.httpStatusCode),r.metadata=t):r={code:s.Status.UNKNOWN,details:"No status information received",metadata:t};this.endCall(r)}destroyHttp2Stream(){var e;if(!this.http2Stream.destroyed)if(this.serverEndedCall)this.http2Stream.end();else{let t;t=(null===(e=this.finalStatus)||void 0===e?void 0:e.code)===s.Status.OK?n.constants.NGHTTP2_NO_ERROR:n.constants.NGHTTP2_CANCEL,this.trace("close http2 stream with code "+t),this.http2Stream.close(t)}}cancelWithStatus(e,t){this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.endCall({code:e,details:t,metadata:new o.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}getAuthContext(){return this.transport.getAuthContext()}startRead(){if(null!==this.finalStatus&&this.finalStatus.code!==s.Status.OK)return this.readsClosed=!0,void this.maybeOutputStatus();if(this.canPush=!0,this.unpushedReadMessages.length>0){const e=this.unpushedReadMessages.shift();return void this.push(e)}this.http2Stream.resume()}sendMessageWithContext(e,t){this.trace("write() called with message of length "+t.length);const i=t=>{process.nextTick(()=>{var i;let n=s.Status.UNAVAILABLE;"ERR_STREAM_WRITE_AFTER_END"===(null==t?void 0:t.code)&&(n=s.Status.INTERNAL),t&&this.cancelWithStatus(n,`Write error: ${t.message}`),null===(i=e.callback)||void 0===i||i.call(e)})};this.trace("sending data chunk of length "+t.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(t,i)}catch(e){this.endCall({code:s.Status.UNAVAILABLE,details:`Write failed with error ${e.message}`,metadata:new o.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}}},2379(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseSubchannelWrapper=void 0;t.BaseSubchannelWrapper=class{constructor(e){this.child=e,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,e.addHealthStateWatcher(e=>{this.healthy&&this.updateHealthListeners()})}updateHealthListeners(){for(const e of this.healthListeners)e(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(e){this.child.addConnectivityStateListener(e)}removeConnectivityStateListener(e){this.child.removeConnectivityStateListener(e)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(e){this.child.throttleKeepalive(e)}ref(){this.child.ref(),this.refcount+=1}unref(){this.child.unref(),this.refcount-=1,0===this.refcount&&this.destroy()}destroy(){for(const e of this.dataWatchers)e.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(e){this.healthListeners.add(e)}removeHealthStateWatcher(e){this.healthListeners.delete(e)}addDataWatcher(e){e.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(e)}setHealthy(e){e!==this.healthy&&(this.healthy=e,this.child.isHealthy()&&this.updateHealthListeners())}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(e){return this.getRealSubchannel()===e.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}}},5716(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SubchannelPool=void 0,t.getSubchannelPool=function(e){return e?c:new l};const n=i(6998),r=i(1385),s=i(8996),o=i(3822),a=i(2095);class l{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let e=!0;for(const t in this.pool){const i=this.pool[t].filter(e=>!e.subchannel.unrefIfOneRef());i.length>0&&(e=!1),this.pool[t]=i}e&&null!==this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var e,t;null===this.cleanupTimer&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},1e4),null===(t=(e=this.cleanupTimer).unref)||void 0===t||t.call(e))}getOrCreateSubchannel(e,t,i,l){this.ensureCleanupTask();const c=(0,o.uriToString)(e);if(c in this.pool){const e=this.pool[c];for(const r of e)if((0,s.subchannelAddressEqual)(t,r.subchannelAddress)&&(0,n.channelOptionsEqual)(i,r.channelArguments)&&l._equals(r.channelCredentials))return r.subchannel}const u=new r.Subchannel(e,t,i,l,new a.Http2SubchannelConnector(e));return c in this.pool||(this.pool[c]=[]),this.pool[c].push({subchannelAddress:t,channelArguments:i,channelCredentials:l,subchannel:u}),u.ref(),u}}t.SubchannelPool=l;const c=new l},1385(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Subchannel=void 0;const n=i(463),r=i(3956),s=i(267),o=i(131),a=i(3822),l=i(8996),c=i(9503),u=i(246);t.Subchannel=class{constructor(e,t,i,s,o){var a;this.channelTarget=e,this.subchannelAddress=t,this.options=i,this.connector=o,this.connectivityState=n.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;const u={initialDelay:i["grpc.initial_reconnect_backoff_ms"],maxDelay:i["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new r.BackoffTimeout(()=>{this.handleBackoffTimer()},u),this.backoffTimeout.unref(),this.subchannelAddressString=(0,l.subchannelAddressToString)(t),this.keepaliveTime=null!==(a=i["grpc.keepalive_time_ms"])&&void 0!==a?a:-1,0===i["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.channelzTrace=new c.ChannelzTraceStub,this.callTracker=new c.ChannelzCallTrackerStub,this.childrenTracker=new c.ChannelzChildrenTrackerStub,this.streamTracker=new c.ChannelzCallTrackerStub):(this.channelzTrace=new c.ChannelzTrace,this.callTracker=new c.ChannelzCallTracker,this.childrenTracker=new c.ChannelzChildrenTracker,this.streamTracker=new c.ChannelzCallTracker),this.channelzRef=(0,c.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(i,void 0,2)),this.secureConnector=s._createSecureConnector(e,i)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){s.trace(o.LogVerbosity.DEBUG,"subchannel","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){s.trace(o.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([n.ConnectivityState.TRANSIENT_FAILURE],n.ConnectivityState.CONNECTING):this.transitionToState([n.ConnectivityState.TRANSIENT_FAILURE],n.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let e=this.options;if(e["grpc.keepalive_time_ms"]){const t=Math.min(this.keepaliveTime,2147483647);e=Object.assign(Object.assign({},e),{"grpc.keepalive_time_ms":t})}this.connector.connect(this.subchannelAddress,this.secureConnector,e).then(e=>{this.transitionToState([n.ConnectivityState.CONNECTING],n.ConnectivityState.READY)?(this.transport=e,this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),e.addDisconnectListener(e=>{this.transitionToState([n.ConnectivityState.READY],n.ConnectivityState.IDLE),e&&this.keepaliveTime>0&&(this.keepaliveTime*=2,s.log(o.LogVerbosity.ERROR,`Connection to ${(0,a.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):e.shutdown()},e=>{this.transitionToState([n.ConnectivityState.CONNECTING],n.ConnectivityState.TRANSIENT_FAILURE,`${e}`)})}transitionToState(e,t,i){var r,s;if(-1===e.indexOf(this.connectivityState))return!1;i?this.trace(n.ConnectivityState[this.connectivityState]+" -> "+n.ConnectivityState[t]+' with error "'+i+'"'):this.trace(n.ConnectivityState[this.connectivityState]+" -> "+n.ConnectivityState[t]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+n.ConnectivityState[t]);const o=this.connectivityState;switch(this.connectivityState=t,t){case n.ConnectivityState.READY:this.stopBackoff();break;case n.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case n.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(r=this.transport)||void 0===r||r.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case n.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),null===(s=this.transport)||void 0===s||s.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${t}`)}for(const e of this.stateListeners)e(this,o,t,this.keepaliveTime,i);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,0===this.refcount&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,c.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([n.ConnectivityState.CONNECTING,n.ConnectivityState.READY],n.ConnectivityState.IDLE)}))}unrefIfOneRef(){return 1===this.refcount&&(this.unref(),!0)}createCall(e,t,i,n){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let r;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),r={onCallEnd:e=>{e.code===o.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):r={},this.transport.createCall(e,t,i,n,r)}startConnecting(){process.nextTick(()=>{this.transitionToState([n.ConnectivityState.IDLE],n.ConnectivityState.CONNECTING)||this.connectivityState===n.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([n.ConnectivityState.TRANSIENT_FAILURE],n.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new u.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,t){const i=this.dataProducers.get(e);if(i)return i;const n=t(this);return this.dataProducers.set(e,n),n}removeDataProducer(e){this.dataProducers.delete(e)}}},9167(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CIPHER_SUITES=void 0,t.getDefaultRootsData=function(){if(r)return null===s&&(s=n.readFileSync(r)),s;return null};const n=i(9896);t.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;const r=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH;let s=null},2095(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Http2SubchannelConnector=void 0;const n=i(5675),r=i(4756),s=i(9503),o=i(131),a=i(7803),l=i(267),c=i(9302),u=i(8996),h=i(3822),d=i(9278),f=i(5486),p=i(5572),g="transport",m=i(9943).rE,{HTTP2_HEADER_AUTHORITY:v,HTTP2_HEADER_CONTENT_TYPE:y,HTTP2_HEADER_METHOD:b,HTTP2_HEADER_PATH:S,HTTP2_HEADER_TE:_,HTTP2_HEADER_USER_AGENT:C}=n.constants,w=Buffer.from("too_many_pings","ascii");class E{constructor(e,t,i,o){this.session=e,this.options=i,this.remoteName=o,this.keepaliveTimer=null,this.pendingSendKeepalivePing=!1,this.activeCalls=new Set,this.disconnectListeners=[],this.disconnectHandled=!1,this.channelzEnabled=!0,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.subchannelAddressString=(0,u.subchannelAddressToString)(t),0===i["grpc.enable_channelz"]?(this.channelzEnabled=!1,this.streamTracker=new s.ChannelzCallTrackerStub):this.streamTracker=new s.ChannelzCallTracker,this.channelzRef=(0,s.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[i["grpc.primary_user_agent"],`grpc-node-js/${m}`,i["grpc.secondary_user_agent"]].filter(e=>e).join(" "),this.keepaliveTimeMs="grpc.keepalive_time_ms"in i?i["grpc.keepalive_time_ms"]:-1,this.keepaliveTimeoutMs="grpc.keepalive_timeout_ms"in i?i["grpc.keepalive_timeout_ms"]:2e4,this.keepaliveWithoutCalls="grpc.keepalive_permit_without_calls"in i&&1===i["grpc.keepalive_permit_without_calls"],e.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),e.once("goaway",(e,t,i)=>{let r=!1;e===n.constants.NGHTTP2_ENHANCE_YOUR_CALM&&i&&i.equals(w)&&(r=!0),this.trace("connection closed by GOAWAY with code "+e+" and data "+(null==i?void 0:i.toString())),this.reportDisconnectToOwner(r)}),e.once("error",e=>{this.trace("connection closed with error "+e.message),this.handleDisconnect()}),e.socket.once("close",e=>{this.trace("connection closed. hadError="+e),this.handleDisconnect()}),l.isTracerEnabled(g)&&(e.on("remoteSettings",t=>{this.trace("new settings received"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(t))}),e.on("localSettings",t=>{this.trace("local settings acknowledged by remote"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(t))})),this.keepaliveWithoutCalls&&this.maybeStartKeepalivePingTimer(),e.socket instanceof r.TLSSocket?this.authContext={transportSecurityType:"ssl",sslPeerCertificate:e.socket.getPeerCertificate()}:this.authContext={}}getChannelzInfo(){var e,t,i;const n=this.session.socket,r=n.remoteAddress?(0,u.stringToSubchannelAddress)(n.remoteAddress,n.remotePort):null,s=n.localAddress?(0,u.stringToSubchannelAddress)(n.localAddress,n.localPort):null;let o;if(this.session.encrypted){const t=n,i=t.getCipher(),r=t.getCertificate(),s=t.getPeerCertificate();o={cipherSuiteStandardName:null!==(e=i.standardName)&&void 0!==e?e:null,cipherSuiteOtherName:i.standardName?null:i.name,localCertificate:r&&"raw"in r?r.raw:null,remoteCertificate:s&&"raw"in s?s.raw:null}}else o=null;return{remoteAddress:r,localAddress:s,security:o,remoteName:this.remoteName,streamsStarted:this.streamTracker.callsStarted,streamsSucceeded:this.streamTracker.callsSucceeded,streamsFailed:this.streamTracker.callsFailed,messagesSent:this.messagesSent,messagesReceived:this.messagesReceived,keepAlivesSent:this.keepalivesSent,lastLocalStreamCreatedTimestamp:this.streamTracker.lastCallStartedTimestamp,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:this.lastMessageSentTimestamp,lastMessageReceivedTimestamp:this.lastMessageReceivedTimestamp,localFlowControlWindow:null!==(t=this.session.state.localWindowSize)&&void 0!==t?t:null,remoteFlowControlWindow:null!==(i=this.session.state.remoteWindowSize)&&void 0!==i?i:null}}trace(e){l.trace(o.LogVerbosity.DEBUG,g,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}keepaliveTrace(e){l.trace(o.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}flowControlTrace(e){l.trace(o.LogVerbosity.DEBUG,"transport_flowctrl","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}internalsTrace(e){l.trace(o.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}reportDisconnectToOwner(e){this.disconnectHandled||(this.disconnectHandled=!0,this.disconnectListeners.forEach(t=>t(e)))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(const e of this.activeCalls)e.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(e){this.disconnectListeners.push(e)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var e,t;if(!this.canSendPing())return void(this.pendingSendKeepalivePing=!0);if(this.keepaliveTimer)return void console.error("keepaliveTimeout is not null");this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e);let i="";try{this.session.ping((e,t,i)=>{this.clearKeepaliveTimeout(),e?(this.keepaliveTrace("Ping failed with error "+e.message),this.handleDisconnect()):(this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer())})||(i="Ping returned false")}catch(e){i=(e instanceof Error?e.message:"")||"Unknown error"}i&&(this.keepaliveTrace("Ping send failed: "+i),this.handleDisconnect())}maybeStartKeepalivePingTimer(){var e,t;this.canSendPing()&&(this.pendingSendKeepalivePing?(this.pendingSendKeepalivePing=!1,this.maybeSendPing()):this.keepaliveTimer||(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),null===(t=(e=this.keepaliveTimer).unref)||void 0===t||t.call(e)))}clearKeepaliveTimeout(){this.keepaliveTimer&&(clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null)}removeActiveCall(e){this.activeCalls.delete(e),0===this.activeCalls.size&&this.session.unref()}addActiveCall(e){this.activeCalls.add(e),1===this.activeCalls.size&&(this.session.ref(),this.keepaliveWithoutCalls||this.maybeStartKeepalivePingTimer())}createCall(e,t,i,n,r){const s=e.toHttp2Headers();let o,a,l;s[v]=t,s[C]=this.userAgent,s[y]="application/grpc",s[b]="POST",s[S]=i,s[_]="trailers";try{o=this.session.request(s)}catch(e){throw this.handleDisconnect(),e}return this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed),this.channelzEnabled?(this.streamTracker.addCallStarted(),a={addMessageSent:()=>{var e;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,null===(e=r.addMessageSent)||void 0===e||e.call(r)},addMessageReceived:()=>{var e;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,null===(e=r.addMessageReceived)||void 0===e||e.call(r)},onCallEnd:e=>{var t;null===(t=r.onCallEnd)||void 0===t||t.call(r,e),this.removeActiveCall(l)},onStreamEnd:e=>{var t;e?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed(),null===(t=r.onStreamEnd)||void 0===t||t.call(r,e)}}):a={addMessageSent:()=>{var e;null===(e=r.addMessageSent)||void 0===e||e.call(r)},addMessageReceived:()=>{var e;null===(e=r.addMessageReceived)||void 0===e||e.call(r)},onCallEnd:e=>{var t;null===(t=r.onCallEnd)||void 0===t||t.call(r,e),this.removeActiveCall(l)},onStreamEnd:e=>{var t;null===(t=r.onStreamEnd)||void 0===t||t.call(r,e)}},l=new f.Http2SubchannelCall(o,a,n,this,(0,p.getNextCallNumber)()),this.addActiveCall(l),l}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,s.unregisterChannelzRef)(this.channelzRef)}}t.Http2SubchannelConnector=class{constructor(e){this.channelTarget=e,this.session=null,this.isShutdown=!1}trace(e){l.trace(o.LogVerbosity.DEBUG,g,(0,h.uriToString)(this.channelTarget)+" "+e)}createSession(e,t,i){return this.isShutdown?Promise.reject():e.socket.closed?Promise.reject("Connection closed before starting HTTP/2 handshake"):new Promise((r,s)=>{var o,a,l,u,d,f,p,g;let m=null,v=this.channelTarget;if("grpc.http_connect_target"in i){const e=(0,h.parseUri)(i["grpc.http_connect_target"]);e&&(v=e,m=(0,h.uriToString)(e))}const y=e.secure?"https":"http",b=(0,c.getDefaultAuthority)(v),S=()=>{var e;null===(e=this.session)||void 0===e||e.destroy(),this.session=null,setImmediate(()=>{O||(O=!0,s(`${R.trim()} (${(new Date).toISOString()})`))})},_=e=>{var t;null===(t=this.session)||void 0===t||t.destroy(),R=e.message,this.trace("connection failed with error "+R),O||(O=!0,s(`${R} (${(new Date).toISOString()})`))},C={createConnection:(t,i)=>e.socket,settings:{initialWindowSize:null!==(u=null!==(o=i["grpc-node.flow_control_window"])&&void 0!==o?o:null===(l=null===(a=n.getDefaultSettings)||void 0===a?void 0:a.call(n))||void 0===l?void 0:l.initialWindowSize)&&void 0!==u?u:65535},maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER,maxSessionMemory:null!==(d=i["grpc-node.max_session_memory"])&&void 0!==d?d:Number.MAX_SAFE_INTEGER},w=n.connect(`${y}://${b}`,C),T=null!==(g=null===(p=null===(f=n.getDefaultSettings)||void 0===f?void 0:f.call(n))||void 0===p?void 0:p.initialWindowSize)&&void 0!==g?g:65535,k=i["grpc-node.flow_control_window"];this.session=w;let R="Failed to connect",O=!1;w.unref(),w.once("remoteSettings",()=>{var n;if(k&&k>T)try{w.setLocalWindowSize(k)}catch(e){const t=k-(null!==(n=w.state.localWindowSize)&&void 0!==n?n:T);t>0&&w.incrementWindowSize(t)}w.removeAllListeners(),e.socket.removeListener("close",S),e.socket.removeListener("error",_),r(new E(w,t,i,m)),this.session=null}),w.once("close",S),w.once("error",_),e.socket.once("close",S),e.socket.once("error",_)})}tcpConnect(e,t){return(0,a.getProxiedConnection)(e,t).then(t=>t||new Promise((t,i)=>{const n=()=>{i(new Error("Socket closed"))},r=e=>{i(e)},s=d.connect(e,()=>{s.removeListener("close",n),s.removeListener("error",r),t(s)});s.once("close",n),s.once("error",r)}))}async connect(e,t,i){if(this.isShutdown)return Promise.reject();let n=null,r=null;const s=(0,u.subchannelAddressToString)(e);try{return this.trace(s+" Waiting for secureConnector to be ready"),await t.waitForReady(),this.trace(s+" secureConnector is ready"),n=await this.tcpConnect(e,i),n.setNoDelay(),this.trace(s+" Established TCP connection"),r=await t.connect(n),this.trace(s+" Established secure connection"),this.createSession(r,e,i)}catch(e){throw null==n||n.destroy(),null==r||r.socket.destroy(),e}}shutdown(){var e;this.isShutdown=!0,null===(e=this.session)||void 0===e||e.close(),this.session=null}}},3822(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseUri=function(e){const t=i.exec(e);if(null===t)return null;return{scheme:t[1],authority:t[2],path:t[3]}},t.splitHostPort=function(e){if(e.startsWith("[")){const t=e.indexOf("]");if(-1===t)return null;const i=e.substring(1,t);if(-1===i.indexOf(":"))return null;if(e.length>t+1){if(":"===e[t+1]){const r=e.substring(t+2);return n.test(r)?{host:i,port:+r}:null}return null}return{host:i}}{const t=e.split(":");return 2===t.length?n.test(t[1])?{host:t[0],port:+t[1]}:null:{host:e}}},t.combineHostPort=function(e){return void 0===e.port?e.host:e.host.includes(":")?`[${e.host}]:${e.port}`:`${e.host}:${e.port}`},t.uriToString=function(e){let t="";void 0!==e.scheme&&(t+=e.scheme+":");void 0!==e.authority&&(t+="//"+e.authority+"/");return t+=e.path,t};const i=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;const n=/^\d+$/},5085(e,t,i){"use strict";t.Yi=t.Ib=void 0;const n=i(2028),r=i(2549),s=i(5407),o=i(3197);var a;i(5017),function(e){e.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",e.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",e.IDEMPOTENT="IDEMPOTENT"}(a=t.Ib||(t.Ib={}));const l={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function c(e,t){const i=(n=t,s=e.name,""===n?s:n+"."+s);var n,s;return function(e){return e instanceof r.Service||e instanceof r.Type||e instanceof r.Enum}(e)?[[i,e]]:function(e){return e instanceof r.Namespace||e instanceof r.Root}(e)&&void 0!==e.nested?Object.keys(e.nested).map(t=>c(e.nested[t],i)).reduce((e,t)=>e.concat(t),[]):[]}function u(e,t){return function(i){return e.toObject(e.decode(i),t)}}function h(e){return function(t){if(Array.isArray(t))throw new Error(`Failed to serialize message: expected object with ${e.name} structure, got array instead`);const i=e.fromObject(t);return e.encode(i).finish()}}function d(e){return(e||[]).reduce((e,t)=>{for(const[i,n]of Object.entries(t))if("uninterpreted_option"===i)e.uninterpreted_option.push(t.uninterpreted_option);else e[i]=n;return e},{deprecated:!1,idempotency_level:a.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function f(e,t,i,r){const s=e.resolvedRequestType,o=e.resolvedResponseType;return{path:"/"+t+"/"+e.name,requestStream:!!e.requestStream,responseStream:!!e.responseStream,requestSerialize:h(s),requestDeserialize:u(s,i),responseSerialize:h(o),responseDeserialize:u(o,i),originalName:n(e.name),requestType:p(s,i,r),responseType:p(o,i,r),options:d(e.parsedOptions)}}function p(e,t,i){const n=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,l),fileDescriptorProtos:i,serialize:h(e),deserialize:u(e,t)}}function g(e,t,i,n){if(e instanceof r.Service)return function(e,t,i,n){const r={};for(const s of e.methodsArray)r[s.name]=f(s,t,i,n);return r}(e,t,i,n);if(e instanceof r.Type)return p(e,i,n);if(e instanceof r.Enum)return function(e,t){const i=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:i.$type.toObject(i,l),fileDescriptorProtos:t}}(e,n);throw new Error("Type mismatch in reflection object handling")}function m(e,t){const i={};e.resolveAll();const n=e.toDescriptor("proto3").file.map(e=>Buffer.from(s.FileDescriptorProto.encode(e).finish()));for(const[r,s]of c(e,""))i[r]=g(s,r,t,n);return i}function v(e,t){t=t||{};const i=r.Root.fromDescriptor(e);return i.resolveAll(),m(i,t)}t.Yi=function(e,t){return m((0,o.loadProtosWithOptionsSync)(e,t),t)},(0,o.addCommonProtos)()},3197(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addCommonProtos=t.loadProtosWithOptionsSync=t.loadProtosWithOptions=void 0;const n=i(9896),r=i(6928),s=i(2549);function o(e,t){const i=e.resolvePath;e.resolvePath=(e,s)=>{if(r.isAbsolute(s))return s;for(const e of t){const t=r.join(e,s);try{return n.accessSync(t,n.constants.R_OK),t}catch(e){continue}}return process.emitWarning(`${s} not found in any of the include paths ${t}`),i(e,s)}}t.loadProtosWithOptions=async function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));o(i,t.includeDirs)}const n=await i.load(e,t);return n.resolveAll(),n},t.loadProtosWithOptionsSync=function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))throw new Error("The includeDirs option must be an array");o(i,t.includeDirs)}const n=i.loadSync(e,t);return n.resolveAll(),n},t.addCommonProtos=function(){const e=i(5434),t=i(3951),n=i(2939),r=i(6710);s.common("api",e.nested.google.nested.protobuf.nested),s.common("descriptor",t.nested.google.nested.protobuf.nested),s.common("source_context",n.nested.google.nested.protobuf.nested),s.common("type",r.nested.google.nested.protobuf.nested)}},6340(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadFileDescriptorSetFromObject=t.loadFileDescriptorSetFromBuffer=t.fromJSON=t.loadSync=t.load=t.IdempotencyLevel=t.isAnyExtension=t.Long=void 0;const n=i(2028),r=i(2549),s=i(5407),o=i(1238),a=i(5017);var l;t.Long=a,t.isAnyExtension=function(e){return"@type"in e&&"string"==typeof e["@type"]},function(e){e.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",e.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",e.IDEMPOTENT="IDEMPOTENT"}(l=t.IdempotencyLevel||(t.IdempotencyLevel={}));const c={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function u(e,t){const i=(n=t,s=e.name,""===n?s:n+"."+s);var n,s;return function(e){return e instanceof r.Service||e instanceof r.Type||e instanceof r.Enum}(e)?[[i,e]]:function(e){return e instanceof r.Namespace||e instanceof r.Root}(e)&&void 0!==e.nested?Object.keys(e.nested).map(t=>u(e.nested[t],i)).reduce((e,t)=>e.concat(t),[]):[]}function h(e,t){return function(i){return e.toObject(e.decode(i),t)}}function d(e){return function(t){if(Array.isArray(t))throw new Error(`Failed to serialize message: expected object with ${e.name} structure, got array instead`);const i=e.fromObject(t);return e.encode(i).finish()}}function f(e){return(e||[]).reduce((e,t)=>{for(const[i,n]of Object.entries(t))if("uninterpreted_option"===i)e.uninterpreted_option.push(t.uninterpreted_option);else e[i]=n;return e},{deprecated:!1,idempotency_level:l.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function p(e,t,i,r){const s=e.resolvedRequestType,o=e.resolvedResponseType;return{path:"/"+t+"/"+e.name,requestStream:!!e.requestStream,responseStream:!!e.responseStream,requestSerialize:d(s),requestDeserialize:h(s,i),responseSerialize:d(o),responseDeserialize:h(o,i),originalName:n(e.name),requestType:g(s,r),responseType:g(o,r),options:f(e.parsedOptions)}}function g(e,t){const i=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:i.$type.toObject(i,c),fileDescriptorProtos:t}}function m(e,t,i,n){if(e instanceof r.Service)return function(e,t,i,n){const r={};for(const s of e.methodsArray)r[s.name]=p(s,t,i,n);return r}(e,t,i,n);if(e instanceof r.Type)return g(e,n);if(e instanceof r.Enum)return function(e,t){const i=e.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:i.$type.toObject(i,c),fileDescriptorProtos:t}}(e,n);throw new Error("Type mismatch in reflection object handling")}function v(e,t){const i={};e.resolveAll();const n=e.toDescriptor("proto3").file.map(e=>Buffer.from(s.FileDescriptorProto.encode(e).finish()));for(const[r,s]of u(e,""))i[r]=m(s,r,t,n);return i}function y(e,t){t=t||{};const i=r.Root.fromDescriptor(e);return i.resolveAll(),v(i,t)}t.load=function(e,t){return(0,o.loadProtosWithOptions)(e,t).then(e=>v(e,t))},t.loadSync=function(e,t){return v((0,o.loadProtosWithOptionsSync)(e,t),t)},t.fromJSON=function(e,t){t=t||{};const i=r.Root.fromJSON(e);return i.resolveAll(),v(i,t)},t.loadFileDescriptorSetFromBuffer=function(e,t){return y(s.FileDescriptorSet.decode(e),t)},t.loadFileDescriptorSetFromObject=function(e,t){return y(s.FileDescriptorSet.fromObject(e),t)},(0,o.addCommonProtos)()},1238(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addCommonProtos=t.loadProtosWithOptionsSync=t.loadProtosWithOptions=void 0;const n=i(9896),r=i(6928),s=i(2549);function o(e,t){const i=e.resolvePath;e.resolvePath=(e,s)=>{if(r.isAbsolute(s))return s;for(const e of t){const t=r.join(e,s);try{return n.accessSync(t,n.constants.R_OK),t}catch(e){continue}}return process.emitWarning(`${s} not found in any of the include paths ${t}`),i(e,s)}}t.loadProtosWithOptions=async function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));o(i,t.includeDirs)}const n=await i.load(e,t);return n.resolveAll(),n},t.loadProtosWithOptionsSync=function(e,t){const i=new s.Root;if((t=t||{}).includeDirs){if(!Array.isArray(t.includeDirs))throw new Error("The includeDirs option must be an array");o(i,t.includeDirs)}const n=i.loadSync(e,t);return n.resolveAll(),n},t.addCommonProtos=function(){const e=i(5434),t=i(3951),n=i(2939),r=i(6710);s.common("api",e.nested.google.nested.protobuf.nested),s.common("descriptor",t.nested.google.nested.protobuf.nested),s.common("source_context",n.nested.google.nested.protobuf.nested),s.common("type",r.nested.google.nested.protobuf.nested)}},6787(e,t,i){"use strict";i.r(t),i.d(t,{OrderedMap:()=>d});var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)};function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}"function"==typeof SuppressedError&&SuppressedError;var s=function(){function e(e,t,i){void 0===i&&(i=1),this.t=void 0,this.i=void 0,this.h=void 0,this.u=e,this.o=t,this.l=i}return e.prototype.v=function(){var e=this,t=e.h.h===e;if(t&&1===e.l)e=e.i;else if(e.t)for(e=e.t;e.i;)e=e.i;else{if(t)return e.h;for(var i=e.h;i.t===e;)i=(e=i).h;e=i}return e},e.prototype.p=function(){var e=this;if(e.i){for(e=e.i;e.t;)e=e.t;return e}for(var t=e.h;t.i===e;)t=(e=t).h;return e.i!==t?t:e},e.prototype.T=function(){var e=this.h,t=this.i,i=t.t;return e.h===this?e.h=t:e.t===this?e.t=t:e.i=t,t.h=e,t.t=this,this.h=t,this.i=i,i&&(i.h=this),t},e.prototype.I=function(){var e=this.h,t=this.t,i=t.i;return e.h===this?e.h=t:e.t===this?e.t=t:e.i=t,t.h=e,t.i=this,this.h=t,this.t=i,i&&(i.h=this),t},e}(),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.O=1,t}return r(t,e),t.prototype.T=function(){var t=e.prototype.T.call(this);return this.M(),t.M(),t},t.prototype.I=function(){var t=e.prototype.I.call(this);return this.M(),t.M(),t},t.prototype.M=function(){this.O=1,this.t&&(this.O+=this.t.O),this.i&&(this.O+=this.i.O)},t}(s),a=function(){function e(e){void 0===e&&(e=0),this.iteratorType=e}return e.prototype.equals=function(e){return this.C===e.C},e}(),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(function(){function e(){this._=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._},enumerable:!1,configurable:!0}),e.prototype.size=function(){return this._},e.prototype.empty=function(){return 0===this._},e}());function c(){throw new RangeError("Iterator access denied!")}var u=function(e){function t(t,i){void 0===t&&(t=function(e,t){return e<t?-1:e>t?1:0}),void 0===i&&(i=!1);var n=e.call(this)||this;return n.N=void 0,n.g=t,n.enableIndex=i,n.S=i?o:s,n.A=new n.S,n}return r(t,e),t.prototype.m=function(e,t){for(var i=this.A;e;){var n=this.g(e.u,t);if(n<0)e=e.i;else{if(!(n>0))return e;i=e,e=e.t}}return i},t.prototype.B=function(e,t){for(var i=this.A;e;){this.g(e.u,t)<=0?e=e.i:(i=e,e=e.t)}return i},t.prototype.j=function(e,t){for(var i=this.A;e;){var n=this.g(e.u,t);if(n<0)i=e,e=e.i;else{if(!(n>0))return e;e=e.t}}return i},t.prototype.k=function(e,t){for(var i=this.A;e;){this.g(e.u,t)<0?(i=e,e=e.i):e=e.t}return i},t.prototype.R=function(e){for(;;){var t,i=e.h;if(i===this.A)return;if(1===e.l)return void(e.l=0);if(e===i.t)if(1===(t=i.i).l)t.l=0,i.l=1,i===this.N?this.N=i.T():i.T();else{if(t.i&&1===t.i.l)return t.l=i.l,i.l=0,t.i.l=0,void(i===this.N?this.N=i.T():i.T());t.t&&1===t.t.l?(t.l=1,t.t.l=0,t.I()):(t.l=1,e=i)}else if(1===(t=i.t).l)t.l=0,i.l=1,i===this.N?this.N=i.I():i.I();else{if(t.t&&1===t.t.l)return t.l=i.l,i.l=0,t.t.l=0,void(i===this.N?this.N=i.I():i.I());t.i&&1===t.i.l?(t.l=1,t.i.l=0,t.T()):(t.l=1,e=i)}}},t.prototype.G=function(e){if(1!==this._){for(var t=e;t.t||t.i;){if(t.i)for(t=t.i;t.t;)t=t.t;else t=t.t;var i=e.u;e.u=t.u,t.u=i;var n=e.o;e.o=t.o,t.o=n,e=t}this.A.t===t?this.A.t=t.h:this.A.i===t&&(this.A.i=t.h),this.R(t);var r=t.h;if(t===r.t?r.t=void 0:r.i=void 0,this._-=1,this.N.l=0,this.enableIndex)for(;r!==this.A;)r.O-=1,r=r.h}else this.clear()},t.prototype.P=function(e){for(var t="number"==typeof e?e:void 0,i="function"==typeof e?e:void 0,n=void 0===e?[]:void 0,r=0,s=this.N,o=[];o.length||s;)if(s)o.push(s),s=s.t;else{if(s=o.pop(),r===t)return s;n&&n.push(s),i&&i(s,r,this),r+=1,s=s.i}return n},t.prototype.q=function(e){for(;;){var t=e.h;if(0===t.l)return;var i=t.h;if(t===i.t){if((n=i.i)&&1===n.l){if(n.l=t.l=0,i===this.N)return;i.l=1,e=i;continue}if(e!==t.i)return t.l=0,i===this.N?this.N=i.I():i.I(),void(i.l=1);e.l=0,e.t&&(e.t.h=t),e.i&&(e.i.h=i),t.i=e.t,i.t=e.i,e.t=t,e.i=i,i===this.N?(this.N=e,this.A.h=e):(r=i.h).t===i?r.t=e:r.i=e,e.h=i.h,t.h=e,i.h=e,i.l=1}else{var n,r;if((n=i.t)&&1===n.l){if(n.l=t.l=0,i===this.N)return;i.l=1,e=i;continue}if(e!==t.t)return t.l=0,i===this.N?this.N=i.T():i.T(),void(i.l=1);e.l=0,e.t&&(e.t.h=i),e.i&&(e.i.h=t),i.i=e.t,t.t=e.i,e.t=i,e.i=t,i===this.N?(this.N=e,this.A.h=e):(r=i.h).t===i?r.t=e:r.i=e,e.h=i.h,t.h=e,i.h=e,i.l=1}return void(this.enableIndex&&(t.M(),i.M(),e.M()))}},t.prototype.D=function(e,t,i){if(void 0===this.N)return this._+=1,this.N=new this.S(e,t,0),this.N.h=this.A,this.A.h=this.A.t=this.A.i=this.N,this._;var n,r=this.A.t,s=this.g(r.u,e);if(0===s)return r.o=t,this._;if(s>0)r.t=new this.S(e,t),r.t.h=r,n=r.t,this.A.t=n;else{var o=this.A.i,a=this.g(o.u,e);if(0===a)return o.o=t,this._;if(a<0)o.i=new this.S(e,t),o.i.h=o,n=o.i,this.A.i=n;else{if(void 0!==i){var l=i.C;if(l!==this.A){var c=this.g(l.u,e);if(0===c)return l.o=t,this._;if(c>0){var u=l.v(),h=this.g(u.u,e);if(0===h)return u.o=t,this._;h<0&&(n=new this.S(e,t),void 0===u.i?(u.i=n,n.h=u):(l.t=n,n.h=l))}}}if(void 0===n)for(n=this.N;;){var d=this.g(n.u,e);if(d>0){if(void 0===n.t){n.t=new this.S(e,t),n.t.h=n,n=n.t;break}n=n.t}else{if(!(d<0))return n.o=t,this._;if(void 0===n.i){n.i=new this.S(e,t),n.i.h=n,n=n.i;break}n=n.i}}}}if(this.enableIndex)for(var f=n.h;f!==this.A;)f.O+=1,f=f.h;return this.q(n),this._+=1,this._},t.prototype.F=function(e,t){for(;e;){var i=this.g(e.u,t);if(i<0)e=e.i;else{if(!(i>0))return e;e=e.t}}return e||this.A},t.prototype.clear=function(){this._=0,this.N=void 0,this.A.h=void 0,this.A.t=this.A.i=void 0},t.prototype.updateKeyByIterator=function(e,t){var i=e.C;if(i===this.A&&c(),1===this._)return i.u=t,!0;var n=i.p().u;if(i===this.A.t)return this.g(n,t)>0&&(i.u=t,!0);var r=i.v().u;return i===this.A.i?this.g(r,t)<0&&(i.u=t,!0):!(this.g(r,t)>=0||this.g(n,t)<=0)&&(i.u=t,!0)},t.prototype.eraseElementByPos=function(e){if(e<0||e>this._-1)throw new RangeError;var t=this.P(e);return this.G(t),this._},t.prototype.eraseElementByKey=function(e){if(0===this._)return!1;var t=this.F(this.N,e);return t!==this.A&&(this.G(t),!0)},t.prototype.eraseElementByIterator=function(e){var t=e.C;t===this.A&&c();var i=void 0===t.i;return 0===e.iteratorType?i&&e.next():i&&void 0!==t.t||e.next(),this.G(t),e},t.prototype.getHeight=function(){if(0===this._)return 0;return function e(t){return t?Math.max(e(t.t),e(t.i))+1:0}(this.N)},t}(l),h=function(e){function t(t,i,n,r){var s=e.call(this,t,i,r)||this;return s.container=n,s}return r(t,e),Object.defineProperty(t.prototype,"pointer",{get:function(){this.C===this.A&&c();var e=this;return new Proxy([],{get:function(t,i){return"0"===i?e.C.u:"1"===i?e.C.o:(t[0]=e.C.u,t[1]=e.C.o,t[i])},set:function(t,i,n){if("1"!==i)throw new TypeError("prop must be 1");return e.C.o=n,!0}})},enumerable:!1,configurable:!0}),t.prototype.copy=function(){return new t(this.C,this.A,this.container,this.iteratorType)},t}(function(e){function t(t,i,n){var r=e.call(this,n)||this;return r.C=t,r.A=i,0===r.iteratorType?(r.pre=function(){return this.C===this.A.t&&c(),this.C=this.C.v(),this},r.next=function(){return this.C===this.A&&c(),this.C=this.C.p(),this}):(r.pre=function(){return this.C===this.A.i&&c(),this.C=this.C.p(),this},r.next=function(){return this.C===this.A&&c(),this.C=this.C.v(),this}),r}return r(t,e),Object.defineProperty(t.prototype,"index",{get:function(){var e=this.C,t=this.A.h;if(e===this.A)return t?t.O-1:0;var i=0;for(e.t&&(i+=e.t.O);e!==t;){var n=e.h;e===n.i&&(i+=1,n.t&&(i+=n.t.O)),e=n}return i},enumerable:!1,configurable:!0}),t.prototype.isAccessible=function(){return this.C!==this.A},t}(a)),d=function(e){function t(t,i,n){void 0===t&&(t=[]);var r=e.call(this,i,n)||this,s=r;return t.forEach(function(e){s.setElement(e[0],e[1])}),r}return r(t,e),t.prototype.begin=function(){return new h(this.A.t||this.A,this.A,this)},t.prototype.end=function(){return new h(this.A,this.A,this)},t.prototype.rBegin=function(){return new h(this.A.i||this.A,this.A,this,1)},t.prototype.rEnd=function(){return new h(this.A,this.A,this,1)},t.prototype.front=function(){if(0!==this._){var e=this.A.t;return[e.u,e.o]}},t.prototype.back=function(){if(0!==this._){var e=this.A.i;return[e.u,e.o]}},t.prototype.lowerBound=function(e){var t=this.m(this.N,e);return new h(t,this.A,this)},t.prototype.upperBound=function(e){var t=this.B(this.N,e);return new h(t,this.A,this)},t.prototype.reverseLowerBound=function(e){var t=this.j(this.N,e);return new h(t,this.A,this)},t.prototype.reverseUpperBound=function(e){var t=this.k(this.N,e);return new h(t,this.A,this)},t.prototype.forEach=function(e){this.P(function(t,i,n){e([t.u,t.o],i,n)})},t.prototype.setElement=function(e,t,i){return this.D(e,t,i)},t.prototype.getElementByPos=function(e){if(e<0||e>this._-1)throw new RangeError;var t=this.P(e);return[t.u,t.o]},t.prototype.find=function(e){var t=this.F(this.N,e);return new h(t,this.A,this)},t.prototype.getElementByKey=function(e){return this.F(this.N,e).o},t.prototype.union=function(e){var t=this;return e.forEach(function(e){t.setElement(e[0],e[1])}),this._},t.prototype[Symbol.iterator]=function(){var e,t,i,n;return function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&a[0]?n.return:a[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;switch(n=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{i=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}(this,function(r){switch(r.label){case 0:e=this._,t=this.P(),i=0,r.label=1;case 1:return i<e?[4,[(n=t[i]).u,n.o]]:[3,4];case 2:r.sent(),r.label=3;case 3:return++i,[3,1];case 4:return[2]}})},t}(u)},8045(e){"use strict";e.exports=function(e,t){var i=new Array(arguments.length-1),n=0,r=2,s=!0;for(;r<arguments.length;)i[n++]=arguments[r++];return new Promise(function(r,o){i[n]=function(e){if(s)if(s=!1,e)o(e);else{for(var t=new Array(arguments.length-1),i=0;i<t.length;)t[i++]=arguments[i];r.apply(null,t)}};try{e.apply(t||null,i)}catch(e){s&&(s=!1,o(e))}})}},8839(e,t){"use strict";var i=t;i.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&"="===e.charAt(t);)++i;return Math.ceil(3*e.length)/4-i};for(var n=new Array(64),r=new Array(123),s=0;s<64;)r[n[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;i.encode=function(e,t,i){for(var r,s=null,o=[],a=0,l=0;t<i;){var c=e[t++];switch(l){case 0:o[a++]=n[c>>2],r=(3&c)<<4,l=1;break;case 1:o[a++]=n[r|c>>4],r=(15&c)<<2,l=2;break;case 2:o[a++]=n[r|c>>6],o[a++]=n[63&c],l=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return l&&(o[a++]=n[r],o[a++]=61,1===l&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var o="invalid encoding";i.decode=function(e,t,i){for(var n,s=i,a=0,l=0;l<e.length;){var c=e.charCodeAt(l++);if(61===c&&a>1)break;if(void 0===(c=r[c]))throw Error(o);switch(a){case 0:n=c,a=1;break;case 1:t[i++]=n<<2|(48&c)>>4,n=c,a=2;break;case 2:t[i++]=(15&n)<<4|(60&c)>>2,n=c,a=3;break;case 3:t[i++]=(3&n)<<6|c,a=0}}if(1===a)throw Error(o);return i-s},i.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},8561(e){"use strict";function t(e,i){"string"==typeof e&&(i=e,e=void 0);var n=[];function r(e){if("string"!=typeof e){var i=s();if(t.verbose&&console.log("codegen: "+i),i="return "+i,e){for(var o=Object.keys(e),a=new Array(o.length+1),l=new Array(o.length),c=0;c<o.length;)a[c]=o[c],l[c]=e[o[c++]];return a[c]=i,Function.apply(null,a).apply(null,l)}return Function(i)()}for(var u=new Array(arguments.length-1),h=0;h<u.length;)u[h]=arguments[++h];if(h=0,e=e.replace(/%([%dfijs])/g,function(e,t){var i=u[h++];switch(t){case"d":case"f":return String(Number(i));case"i":return String(Math.floor(i));case"j":return JSON.stringify(i);case"s":return String(i)}return"%"}),h!==u.length)throw Error("parameter count mismatch");return n.push(e),r}function s(t){return"function "+(t||i||"")+"("+(e&&e.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return r.toString=s,r}e.exports=t,t.verbose=!1},4358(e){"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n<i.length;)i[n].fn===t?i.splice(n,1):++n;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var i=[],n=1;n<arguments.length;)i.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,i)}return this}},5212(e,t,i){"use strict";e.exports=s;var n=i(8045),r=i(4153)("fs");function s(e,t,i){return"function"==typeof t?(i=t,t={}):t||(t={}),i?!t.xhr&&r&&r.readFile?r.readFile(e,function(n,r){return n&&"undefined"!=typeof XMLHttpRequest?s.xhr(e,t,i):n?i(n):i(null,t.binary?r:r.toString("utf8"))}):s.xhr(e,t,i):n(s,this,e,t)}s.xhr=function(e,t,i){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return i(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var r=0;r<n.responseText.length;++r)e.push(255&n.responseText.charCodeAt(r))}return i(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return i(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()}},9410(e){"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),i=new Uint8Array(t.buffer),n=128===i[3];function r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3]}function s(e,n,r){t[0]=e,n[r]=i[3],n[r+1]=i[2],n[r+2]=i[1],n[r+3]=i[0]}function o(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],t[0]}function a(e,n){return i[3]=e[n],i[2]=e[n+1],i[1]=e[n+2],i[0]=e[n+3],t[0]}e.writeFloatLE=n?r:s,e.writeFloatBE=n?s:r,e.readFloatLE=n?o:a,e.readFloatBE=n?a:o}():function(){function t(e,t,i,n){var r=t<0?1:0;if(r&&(t=-t),0===t)e(1/t>0?0:2147483648,i,n);else if(isNaN(t))e(2143289344,i,n);else if(t>34028234663852886e22)e((r<<31|2139095040)>>>0,i,n);else if(t<11754943508222875e-54)e((r<<31|Math.round(t/1401298464324817e-60))>>>0,i,n);else{var s=Math.floor(Math.log(t)/Math.LN2);e((r<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,i,n)}}function o(e,t,i){var n=e(t,i),r=2*(n>>31)+1,s=n>>>23&255,o=8388607&n;return 255===s?o?NaN:r*(1/0):0===s?1401298464324817e-60*r*o:r*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,i),e.writeFloatBE=t.bind(null,n),e.readFloatLE=o.bind(null,r),e.readFloatBE=o.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),i=new Uint8Array(t.buffer),n=128===i[7];function r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3],n[r+4]=i[4],n[r+5]=i[5],n[r+6]=i[6],n[r+7]=i[7]}function s(e,n,r){t[0]=e,n[r]=i[7],n[r+1]=i[6],n[r+2]=i[5],n[r+3]=i[4],n[r+4]=i[3],n[r+5]=i[2],n[r+6]=i[1],n[r+7]=i[0]}function o(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],i[4]=e[n+4],i[5]=e[n+5],i[6]=e[n+6],i[7]=e[n+7],t[0]}function a(e,n){return i[7]=e[n],i[6]=e[n+1],i[5]=e[n+2],i[4]=e[n+3],i[3]=e[n+4],i[2]=e[n+5],i[1]=e[n+6],i[0]=e[n+7],t[0]}e.writeDoubleLE=n?r:s,e.writeDoubleBE=n?s:r,e.readDoubleLE=n?o:a,e.readDoubleBE=n?a:o}():function(){function t(e,t,i,n,r,s){var o=n<0?1:0;if(o&&(n=-n),0===n)e(0,r,s+t),e(1/n>0?0:2147483648,r,s+i);else if(isNaN(n))e(0,r,s+t),e(2146959360,r,s+i);else if(n>17976931348623157e292)e(0,r,s+t),e((o<<31|2146435072)>>>0,r,s+i);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,r,s+t),e((o<<31|a/4294967296)>>>0,r,s+i);else{var l=Math.floor(Math.log(n)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(a=n*Math.pow(2,-l))>>>0,r,s+t),e((o<<31|l+1023<<20|1048576*a&1048575)>>>0,r,s+i)}}}function o(e,t,i,n,r){var s=e(n,r+t),o=e(n,r+i),a=2*(o>>31)+1,l=o>>>20&2047,c=4294967296*(1048575&o)+s;return 2047===l?c?NaN:a*(1/0):0===l?5e-324*a*c:a*Math.pow(2,l-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,i,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=o.bind(null,r,0,4),e.readDoubleBE=o.bind(null,s,4,0)}(),e}function i(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}function n(e,t,i){t[i]=e>>>24,t[i+1]=e>>>16&255,t[i+2]=e>>>8&255,t[i+3]=255&e}function r(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},4153(module){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},9207(e,t){"use strict";var i=t,n=i.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},r=i.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),i=n(e),r="";i&&(r=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):i?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return r+t.join("/")};i.resolve=function(e,t,i){return i||(t=r(t)),n(t)?t:(i||(e=r(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?r(e+"/"+t):t)}},9390(e){"use strict";e.exports=function(e,t,i){var n=i||8192,r=n>>>1,s=null,o=n;return function(i){if(i<1||i>r)return e(i);o+i>n&&(s=e(n),o=0);var a=t.call(s,o,o+=i);return 7&o&&(o=1+(7|o)),a}}},1447(e,t){"use strict";var i=t;i.length=function(e){for(var t=0,i=0,n=0;n<e.length;++n)(i=e.charCodeAt(n))<128?t+=1:i<2048?t+=2:55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},i.read=function(e,t,i){if(i-t<1)return"";for(var n,r=null,s=[],o=0;t<i;)(n=e[t++])<128?s[o++]=n:n>191&&n<224?s[o++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(n>>10),s[o++]=56320+(1023&n)):s[o++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),o=0);return r?(o&&r.push(String.fromCharCode.apply(String,s.slice(0,o))),r.join("")):String.fromCharCode.apply(String,s.slice(0,o))},i.write=function(e,t,i){for(var n,r,s=i,o=0;o<e.length;++o)(n=e.charCodeAt(o))<128?t[i++]=n:n<2048?(t[i++]=n>>6|192,t[i++]=63&n|128):55296==(64512&n)&&56320==(64512&(r=e.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&r),++o,t[i++]=n>>18|240,t[i++]=n>>12&63|128,t[i++]=n>>6&63|128,t[i++]=63&n|128):(t[i++]=n>>12|224,t[i++]=n>>6&63|128,t[i++]=63&n|128);return i-s}},8591(e,t,i){var n=i(5692),r=i(8611),s=i(7016),o=i(3294),a=(e.exports.maxRedirects=5,{https:n,http:r});for(var l in a){var c=function(){};c.prototype=a[l],(c=new c).request=function(i){return function(n,r,a){a=a||{};var c,u="object"==typeof n&&"maxRedirects"in n?n.maxRedirects:t.maxRedirects,h=o.extend({count:0,max:u,clientRequest:null,userCallback:r},a);if(h.count>h.max){var d=new Error("Max redirects exceeded. To allow more redirects, pass options.maxRedirects property.");return h.clientRequest.emit("error",d),h.clientRequest}h.count++,c="string"==typeof n?n:s.format(o.extend({protocol:l},n));var f=Object.getPrototypeOf(i).request(n,function t(i,n){return function(r){if(r.statusCode<300||r.statusCode>399)return n.userCallback(r);if(!("location"in r.headers))return n.userCallback(r);var o=s.resolve(i,r.headers.location),a=s.parse(o).protocol;return a=a.substr(0,a.length-1),e.exports[a].get(o,t(i,n),n)}}(c,h));return h.clientRequest||(h.clientRequest=f),f}}(c),c.get=function(e){return function(t,i,n){var r=e.request(t,i,n);return r.end(),r}}(c),e.exports[l]=c}},8280(e,t,i){e.exports=s;var n=i(9023),r=i(4198);function s(e,t,i){var n=this;if(!(n instanceof s))return new s(e,t,i);r.Duplex.call(n,i),n._output=null,n.connect(e,t)}n.inherits(s,r.Duplex),s.prototype.connect=function(e,t){var i=this;i.req=e,i._output=t,i.emit("response",t),t.on("data",function(e){i.push(e)||i._output.pause()}),t.on("end",function(){i.push(null)})},s.prototype._read=function(e){this._output&&this._output.resume()},s.prototype._write=function(e,t,i){this.req.write(e,t),i()},s.prototype.end=function(e,t,i){return this._output.socket.destroySoon(),this.req.end(e,t,i)},s.prototype.destroy=function(){this.req.destroy(),this._output.socket.destroy()},s.prototype.destroySoon=function(){this.req.destroy(),this._output.socket.destroy()}},7469(e,t,i){var n=i(3480),r=i(8591),s=i(9896),o=i(6928),a=i(7016),l=i(8397),c=i(8280),u=i(3294),h=(i(9023),i(4546)),d=i(857),f="Windows_NT"===d.type(),p=i(2203),g=function(){return new Promise(function(e){var t=o.join(d.homedir(),".docker","run","docker.sock");s.access(t,function(i){e(i?"/var/run/docker.sock":t)})})},m=function(e){var t=function(){var e,t={};if(process.env.DOCKER_HOST)if(0===process.env.DOCKER_HOST.indexOf("unix://"))t.socketPath=process.env.DOCKER_HOST.substring(7)||g;else if(0===process.env.DOCKER_HOST.indexOf("npipe://"))t.socketPath=process.env.DOCKER_HOST.substring(8)||"//./pipe/docker_engine";else{var i=process.env.DOCKER_HOST;i.indexOf("//")<0&&(i="tcp://"+i);try{e=new a.URL(i)}catch(e){throw new Error("DOCKER_HOST env variable should be something like tcp://localhost:1234")}t.port=e.port,"1"===process.env.DOCKER_TLS_VERIFY||"2376"===t.port?t.protocol="https":"ssh:"===e.protocol?(t.protocol="ssh",t.username=e.username,t.sshOptions={agent:process.env.SSH_AUTH_SOCK}):t.protocol="http",process.env.DOCKER_PATH_PREFIX?t.pathPrefix=process.env.DOCKER_PATH_PREFIX:t.pathPrefix="/",t.host=e.hostname,process.env.DOCKER_CERT_PATH&&(t.ca=h(o.join(process.env.DOCKER_CERT_PATH,"ca.pem")),t.cert=s.readFileSync(o.join(process.env.DOCKER_CERT_PATH,"cert.pem")),t.key=s.readFileSync(o.join(process.env.DOCKER_CERT_PATH,"key.pem"))),process.env.DOCKER_CLIENT_TIMEOUT&&(t.timeout=parseInt(process.env.DOCKER_CLIENT_TIMEOUT,10))}else t.socketPath=f?"//./pipe/docker_engine":g;return t}(),i=Object.assign({},t,e);this.host=i.host,this.host||(this.socketPath=i.socketPath),this.port=i.port,this.pathPrefix=i.pathPrefix,this.username=i.username,this.password=i.password,this.version=i.version,this.key=i.key,this.cert=i.cert,this.ca=i.ca,this.timeout=i.timeout,this.connectionTimeout=i.connectionTimeout,this.checkServerIdentity=i.checkServerIdentity,this.agent=i.agent,this.headers=i.headers||{},this.sshOptions=Object.assign({},e?e.sshOptions:{},t.sshOptions),void 0===this.sshOptions.agentForward&&(this.sshOptions.agentForward=i.agentForward),this.key&&this.cert&&this.ca&&(this.protocol="https"),this.protocol=i.protocol||this.protocol||"http"};m.prototype.dial=function(e,t){var i,n,r;if(e.options&&(i=e.options),i&&i.authconfig&&delete i.authconfig,i&&i.abortSignal&&delete i.abortSignal,this.version&&(e.path="/"+this.version+e.path),this.host){var l=a.parse(this.host);n=a.format({protocol:l.protocol||this.protocol,hostname:l.hostname||this.host,port:this.port,pathname:l.pathname||this.pathPrefix}),n=a.resolve(n,e.path)}else n=e.path;-1!==e.path.indexOf("?")&&(i&&Object.keys(i).length>0?n+=this.buildQuerystring(i._query||i):n=n.substring(0,n.length-1));var c={path:n,method:e.method,headers:e.headers||Object.assign({},this.headers),key:this.key,cert:this.cert,ca:this.ca};if(this.checkServerIdentity&&(c.checkServerIdentity=this.checkServerIdentity),this.agent&&(c.agent=this.agent),e.authconfig&&(c.headers["X-Registry-Auth"]=e.authconfig.key||e.authconfig.base64||Buffer.from(JSON.stringify(e.authconfig)).toString("base64").replace(/\+/g,"-").replace(/\//g,"_")),e.registryconfig&&(c.headers["X-Registry-Config"]=e.registryconfig.base64||Buffer.from(JSON.stringify(e.registryconfig)).toString("base64")),e.abortSignal&&(c.signal=e.abortSignal),e.file?(r="string"==typeof e.file?s.createReadStream(o.resolve(e.file)):e.file,c.headers["Content-Type"]="application/tar"):i&&"POST"===e.method&&(r=JSON.stringify(i._body||i),e.allowEmpty||"{}"!==r&&'""'!==r?c.headers["Content-Type"]="application/json":r=void 0),"string"==typeof r?c.headers["Content-Length"]=Buffer.byteLength(r):!0===Buffer.isBuffer(r)?c.headers["Content-Length"]=r.length:("PUT"===c.method||e.hijack||e.openStdin)&&(c.headers["Transfer-Encoding"]="chunked"),e.hijack&&(c.headers.Connection="Upgrade",c.headers.Upgrade=c.headers.Upgrade??"tcp"),this.socketPath)this.getSocketPath().then(i=>{c.socketPath=i,this.buildRequest(c,e,r,t)});else{var u=a.parse(n);c.hostname=u.hostname,c.port=u.port,c.path=u.path,this.buildRequest(c,e,r,t)}},m.prototype.getSocketPath=function(){if(this.socketPath){if(this.socketPathCache)return Promise.resolve(this.socketPathCache);var e="function"==typeof this.socketPath?this.socketPath():this.socketPath;return this.socketPathCache=e,Promise.resolve(e)}},m.prototype.buildRequest=function(e,t,i,n){var s,o=this,a=!1,c="ssh"===o.protocol?Object.assign(e,{agent:l(Object.assign({},o.sshOptions,{host:o.host,port:o.port,username:o.username,password:o.password})),protocol:"http:"}):e,h=null;try{h=r["ssh"===o.protocol?"http":o.protocol].request(c,function(){})}catch(e){return void n(e)}o.connectionTimeout&&(s=setTimeout(function(){h.destroy()},o.connectionTimeout)),o.timeout&&(h.setTimeout(o.timeout),h.on("timeout",function(){h.destroy()})),!0===t.hijack&&(clearTimeout(s),h.on("upgrade",function(e,t,i){if(!1===a)return a=!0,i.length>0&&t.unshift(i),n(null,t)})),h.on("connect",function(){clearTimeout(s)}),h.on("disconnect",function(){clearTimeout(s)}),h.on("response",function(i){if(clearTimeout(s),!0===t.isStream)!1===a&&(a=!0,o.buildPayload(null,t.isStream,t.statusCodes,t.openStdin,h,i,null,n));else{null!=e.signal&&p.addAbortSignal(e.signal,i);var r=[];i.on("data",function(e){r.push(e)}),i.on("end",function(){var e=Buffer.concat(r),s=e.toString(),l=u.parseJSON(s)||e;!1===a&&(a=!0,o.buildPayload(null,t.isStream,t.statusCodes,!1,h,i,l,n))})}}),h.on("error",function(e){clearTimeout(s),!1===a&&(a=!0,o.buildPayload(e,t.isStream,t.statusCodes,!1,{},{},null,n))}),"string"==typeof i||Buffer.isBuffer(i)?h.write(i):i&&(i.on("error",function(e){h.destroy(e)}),i.pipe(h)),t.openStdin||"string"!=typeof i&&void 0!==i&&!Buffer.isBuffer(i)||h.end()},m.prototype.buildPayload=function(e,t,i,n,r,s,o,a){if(e)return a(e,null);!0!==i[s.statusCode]?function(e,t,i,n){var r="",s=!1;e?(t.on("data",function(e){r+=e}),t.on("error",function(e){o(e,null)}),t.on("end",function(){o(null,u.parseJSON(r)||r)})):n(null,i);function o(e,t){!1===s&&(e?n(e):n(null,t)),s=!0}}(t,s,o,function(e,t){if(e)return a(e,null);var n=new Error("(HTTP code "+s.statusCode+") "+(i[s.statusCode]||"unexpected")+" - "+(t.message||t.error||t)+" ");n.reason=i[s.statusCode],n.statusCode=s.statusCode,n.json=o,a(n,null)}):a(null,n?new c(r,s):t?s:o)},m.prototype.demuxStream=function(e,t,i){var n=null,r=null,s=Buffer.from("");function o(e){var t=s.subarray(0,e);return s=Buffer.from(s.subarray(e,s.length)),t}e.on("data",function e(a){if(a&&(s=Buffer.concat([s,a])),n){if(s.length>=r){var l=o(r);1===n?t.write(l):i.write(l),n=null,e()}}else if(s.length>=8){var c=o(8);n=c.readUInt8(0),r=c.readUInt32BE(4),e()}})},m.prototype.followProgress=function(e,t,i){var n="",r=[],s=!1;function o(e){function t(e){if("\r"==e[e.length-1]&&(e=e.substr(0,e.length-1)),e.length>0){var t=JSON.parse(e);r.push(t),i&&i(t)}}n+=e.toString(),function(){var e;for(;(e=n.indexOf("\n"))>=0;)0!=e?(t(n.slice(0,e)),n=n.slice(e+1)):n=n.slice(1)}()}function a(){s||t(null,r),s=!0}e.on("data",o),e.on("error",function i(n){s=!0,e.removeListener("data",o),e.removeListener("error",i),e.removeListener("end",a),e.removeListener("close",a),t(n,r)}),e.on("end",a),e.on("close",a)},m.prototype.buildQuerystring=function(e){var t={};return Object.keys(e).map(function(i,n){e[i]&&"object"==typeof e[i]&&!Array.isArray(e[i])?t[i]=JSON.stringify(e[i]):t[i]=e[i]}),n.stringify(t)},e.exports=m},8397(e,t,i){var n=i(1217).Client,r=i(8611);e.exports=function(e){var t=new n,i=new r.Agent;function s(e,n){if(t.end(),i.destroy(),!n)throw e;n(e)}return i.createConnection=function(n,r){try{t.once("ready",function(){t.exec("docker system dial-stdio",function(e,n){e&&s(e,r),r(null,n),n.addListener("error",e=>{s(e,r)}),n.once("close",()=>{t.end(),i.destroy()})})}).on("error",e=>{s(e,r)}).connect(e),t.once("end",()=>i.destroy())}catch(e){s(e)}},i}},3294(e){var t=[],i=t.forEach,n=t.slice;e.exports.extend=function(e){return i.call(n.call(arguments,1),function(t){if(t)for(var i in t)e[i]=t[i]}),e},e.exports.parseJSON=function(e){try{return JSON.parse(e)}catch(e){return null}}},6474(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/configs/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/configs/"+this.id+"/update?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/configs/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"config not found",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},4985(e,t,i){i(7052).extend;var n=i(6033),r=i(7052),s=function(e,t){this.modem=e,this.id=t,this.defaultOptions={top:{},start:{},commit:{},stop:{},pause:{},unpause:{},restart:{},resize:{},attach:{},remove:{},copy:{},kill:{},exec:{},rename:{},log:{},stats:{},getArchive:{},infoArchive:{},putArchive:{},update:{},wait:{}}};s.prototype[i(9023).inspect.custom]=function(){return this},s.prototype.inspect=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/json?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.rename=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.rename),s={path:"/containers/"+this.id+"/rename?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.update=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.update),s={path:"/containers/"+this.id+"/update",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.top=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.top),s={path:"/containers/"+this.id+"/top?",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.changes=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/changes",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.listCheckpoint=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/checkpoints?",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.deleteCheckpoint=function(e,t,i){var n=this,s=r.processArgs(t,i),o={path:"/containers/"+this.id+"/checkpoints/"+e+"?",method:"DELETE",abortSignal:s.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){n.modem.dial(o,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(o,function(e,t){s.callback(e,t)})},s.prototype.createCheckpoint=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/checkpoints",method:"POST",abortSignal:n.opts.abortSignal,allowEmpty:!0,statusCodes:{200:!0,201:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.export=function(e,t){var i=this,n=r.processArgs(e,t),s={path:"/containers/"+this.id+"/export",method:"GET",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,404:"no such container",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.start=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.start),s={path:"/containers/"+this.id+"/start?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,304:"container already started",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.pause=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.pause),s={path:"/containers/"+this.id+"/pause",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.unpause=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.unpause),s={path:"/containers/"+this.id+"/unpause",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.exec=function(e,t){var i=this,s=r.processArgs(e,t,this.defaultOptions.exec),o={path:"/containers/"+this.id+"/exec",method:"POST",abortSignal:s.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"no such container",409:"container stopped/paused",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){i.modem.dial(o,function(r,s){if(r)return t(r);e(new n(i.modem,s.Id))})});this.modem.dial(o,function(e,t){if(e)return s.callback(e,t);s.callback(e,new n(i.modem,t.Id))})},s.prototype.commit=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.commit);n.opts.container=this.id;var s={path:"/commit?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.stop=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.stop),s={path:"/containers/"+this.id+"/stop?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,304:"container already stopped",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.restart=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.restart),s={path:"/containers/"+this.id+"/restart?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.kill=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.kill),s={path:"/containers/"+this.id+"/kill?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.resize=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.resize),s={path:"/containers/"+this.id+"/resize?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.attach=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.attach),s={path:"/containers/"+this.id+"/attach?",method:"POST",abortSignal:n.opts.abortSignal,isStream:!0,hijack:n.opts.hijack,openStdin:n.opts.stdin,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.wait=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.wait),s={path:"/containers/"+this.id+"/wait?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.remove=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.remove),s={path:"/containers/"+this.id+"?",method:"DELETE",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,400:"bad parameter",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.copy=function(e,t){var i=this;console.log("container.copy is deprecated since Docker v1.8.x");var n=r.processArgs(e,t,this.defaultOptions.copy),s={path:"/containers/"+this.id+"/copy",method:"POST",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.getArchive=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.getArchive),s={path:"/containers/"+this.id+"/archive?",method:"GET",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"client error, bad parameters",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.infoArchive=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.infoArchive),s={path:"/containers/"+this.id+"/archive?",method:"HEAD",abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"client error, bad parameters",404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.putArchive=function(e,t,i){var n=this,s=r.processArgs(t,i,this.defaultOptions.putArchive),o={path:"/containers/"+this.id+"/archive?",method:"PUT",file:e,abortSignal:s.opts.abortSignal,statusCodes:{200:!0,400:"client error, bad parameters",403:"client error, permission denied",404:"no such container",500:"server error"},options:s.opts};if(void 0===s.callback)return new this.modem.Promise(function(e,t){n.modem.dial(o,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(o,function(e,t){s.callback(e,t)})},s.prototype.logs=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.log),s={path:"/containers/"+this.id+"/logs?",method:"GET",abortSignal:n.opts.abortSignal,isStream:n.opts.follow||!1,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){n.callback(e,t)})},s.prototype.stats=function(e,t){var i=this,n=r.processArgs(e,t,this.defaultOptions.stats),s=!0;!1===n.opts.stream&&(s=!1);var o={path:"/containers/"+this.id+"/stats?",method:"GET",abortSignal:n.opts.abortSignal,isStream:s,statusCodes:{200:!0,404:"no such container",500:"server error"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(o,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(o,function(e,t){n.callback(e,t)})},e.exports=s},8608(e,t,i){var n=i(4434).EventEmitter,r=i(7469),s=i(4985),o=i(1991),a=i(4974),l=i(384),c=i(3569),u=i(3303),h=i(9360),d=i(6474),f=i(5517),p=i(4024),g=i(6033),m=i(7052),v=i(7054),y=m.extend,b=function(e){if(!(this instanceof b))return new b(e);var t=global.Promise;e&&e.Promise&&(t=e.Promise,1===Object.keys(e).length&&(e=void 0)),e&&e.modem?this.modem=e.modem:this.modem=new r(e),this.modem.Promise=t};b.prototype.createContainer=function(e,t){var i=this,n={path:"/containers/create?",method:"POST",options:e,authconfig:e.authconfig,abortSignal:e.abortSignal,statusCodes:{200:!0,201:!0,400:"bad parameter",404:"no such container",406:"impossible to attach",500:"server error"}};if(delete e.authconfig,void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(n,r){if(n)return t(n);e(i.getContainer(r.Id))})});this.modem.dial(n,function(e,n){if(e)return t(e,n);t(e,i.getContainer(n.Id))})},b.prototype.createImage=function(e,t,i){var n=this;i||"function"!=typeof t?i||t||(e=(t=e).authconfig):(i=t,e=(t=e).authconfig||void 0);var r={path:"/images/create?",method:"POST",options:t,authconfig:e,abortSignal:t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},b.prototype.loadImage=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,t=null);var r={path:"/images/load?",method:"POST",options:t,file:e,abortSignal:t&&t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},b.prototype.importImage=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,t=void 0),t||(t={}),t.fromSrc="-";var r={path:"/images/create?",method:"POST",options:t,file:e,abortSignal:t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},b.prototype.checkAuth=function(e,t){var i=this,n={path:"/auth",method:"POST",options:e,abortSignal:e.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},b.prototype.buildImage=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,t=null);var r={path:"/build?",method:"POST",file:void 0,options:t,abortSignal:t&&t.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};function s(t){m.prepareBuildContext(e,e=>{r.file=e,n.modem.dial(r,t)})}function o(e){"2"===t?.version?v(n,r.authconfig,(t,i,n)=>{if(t)return e(t);r.options.session=i,s((t,i)=>{e(t,i),i&&i.on("end",n)})}):s(e)}if(t&&(t.registryconfig&&(r.registryconfig=r.options.registryconfig,delete r.options.registryconfig),t.authconfig&&(r.authconfig=r.options.authconfig,delete r.options.authconfig),t.cachefrom&&Array.isArray(t.cachefrom)&&(r.options.cachefrom=JSON.stringify(t.cachefrom))),void 0===i)return new n.modem.Promise(function(e,t){o(function(i,n){if(i)return t(i);e(n)})});o(i)},b.prototype.getContainer=function(e){return new s(this.modem,e)},b.prototype.getImage=function(e){return new o(this.modem,e)},b.prototype.getVolume=function(e){return new a(this.modem,e)},b.prototype.getPlugin=function(e,t){return new u(this.modem,e,t)},b.prototype.getService=function(e){return new c(this.modem,e)},b.prototype.getTask=function(e){return new f(this.modem,e)},b.prototype.getNode=function(e){return new p(this.modem,e)},b.prototype.getNetwork=function(e){return new l(this.modem,e)},b.prototype.getSecret=function(e){return new h(this.modem,e)},b.prototype.getConfig=function(e){return new d(this.modem,e)},b.prototype.getExec=function(e){return new g(this.modem,e)},b.prototype.listContainers=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/containers/json?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listImages=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/images/json?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.getImages=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/images/get?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listServices=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/services?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listNodes=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/nodes?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",404:"no such node",500:"server error",503:"node is not part of a swarm"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listTasks=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/tasks?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createSecret=function(e,t){var i=m.processArgs(e,t),n=this,r={path:"/secrets/create?",method:"POST",options:i.opts,abortSignal:i.opts.abortSignal,statusCodes:{200:!0,201:!0,406:"server error or node is not part of a swarm",409:"name conflicts with an existing object",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,r){if(i)return t(i);e(n.getSecret(r.ID))})});this.modem.dial(r,function(e,t){if(e)return i.callback(e,t);i.callback(e,n.getSecret(t.ID))})},b.prototype.createConfig=function(e,t){var i=m.processArgs(e,t),n=this,r={path:"/configs/create?",method:"POST",options:i.opts,abortSignal:i.opts.abortSignal,statusCodes:{200:!0,201:!0,406:"server error or node is not part of a swarm",409:"name conflicts with an existing object",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,r){if(i)return t(i);e(n.getConfig(r.ID))})});this.modem.dial(r,function(e,t){if(e)return i.callback(e,t);i.callback(e,n.getConfig(t.ID))})},b.prototype.listSecrets=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/secrets?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.listConfigs=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/configs?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createPlugin=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/plugins/create?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(r,s){if(r)return t(r);e(i.getPlugin(n.opts.name))})});this.modem.dial(r,function(e,t){if(e)return n.callback(e,t);n.callback(e,i.getPlugin(n.opts.name))})},b.prototype.listPlugins=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/plugins?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneImages=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/images/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneBuilder=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/build/prune",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneContainers=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/containers/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneVolumes=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/volumes/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pruneNetworks=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/networks/prune?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createVolume=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/volumes/create?",method:"POST",allowEmpty:!0,options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,201:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(n,r){if(n)return t(n);e(i.getVolume(r.Name))})});this.modem.dial(r,function(e,t){if(e)return n.callback(e,t);n.callback(e,i.getVolume(t.Name))})},b.prototype.createService=function(e,t,i){i||"function"!=typeof t?t||i||(t=e):(i=t,e=(t=e).authconfig||void 0);var n=this,r={path:"/services/create",method:"POST",options:t,authconfig:e,abortSignal:t&&t.abortSignal,statusCodes:{200:!0,201:!0,500:"server error"}};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,r){if(i)return t(i);e(n.getService(r.ID||r.Id))})});this.modem.dial(r,function(e,t){if(e)return i(e,t);i(e,n.getService(t.ID||t.Id))})},b.prototype.listVolumes=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/volumes?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.createNetwork=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/networks/create?",method:"POST",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"driver not found",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(n,r){if(n)return t(n);e(i.getNetwork(r.Id))})});this.modem.dial(r,function(e,t){if(e)return n.callback(e,t);n.callback(e,i.getNetwork(t.Id))})},b.prototype.listNetworks=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/networks?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.searchImages=function(e,t){var i=this,n={path:"/images/search?",method:"GET",options:e,authconfig:e.authconfig,abortSignal:e.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},b.prototype.info=function(e,t){var i=this,n=m.processArgs(e,t);e={path:"/info",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(t,n){i.modem.dial(e,function(e,i){if(e)return n(e);t(i)})});this.modem.dial(e,function(e,t){n.callback(e,t)})},b.prototype.version=function(e,t){var i=this,n=m.processArgs(e,t);e={path:"/version",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(t,n){i.modem.dial(e,function(e,i){if(e)return n(e);t(i)})});this.modem.dial(e,function(e,t){n.callback(e,t)})},b.prototype.ping=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/_ping",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.df=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/system/df",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.getEvents=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/events?",method:"GET",options:n.opts,abortSignal:n.opts.abortSignal,isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.pull=function(e,t,i,n){var r=m.processArgs(t,i),s=m.parseRepositoryTag(e);r.opts.fromImage=s.repository,r.opts.tag=s.tag||"latest";var o=[r.opts,r.callback];return n&&(o=[n,r.opts,r.callback]),this.createImage.apply(this,o)},b.prototype.pullAll=function(e,t,i,n){var r=m.processArgs(t,i),s=m.parseRepositoryTag(e);r.opts.fromImage=s.repository;var o=[r.opts,r.callback];return n&&(o=[n,r.opts,r.callback]),this.createImage.apply(this,o)},b.prototype.run=function(e,t,i,n,r,s){return"function"==typeof arguments[arguments.length-1]?this.runCallback(e,t,i,n,r,s):this.runPromise(e,t,i,n,r)},b.prototype.runCallback=function(e,t,i,r,s,o){o||"function"!=typeof r?o||"function"!=typeof s||(o=s,s={}):(o=r,r={},s={});var a=new n;var l={Hostname:"",User:"",AttachStdin:!1,AttachStdout:!0,AttachStderr:!0,Tty:!0,OpenStdin:!1,StdinOnce:!1,Env:null,Cmd:t,Image:e,Volumes:{},VolumesFrom:[]};return y(l,r),this.createContainer(l,function(e,t){if(e)return o(e,null,t);a.emit("container",t),t.attach({stream:!0,stdout:!0,stderr:!0},function(e,n){if(e)return o(e,null,t);a.emit("stream",n),i&&(i instanceof Array?(n.on("end",function(){try{i[0].end()}catch(e){}try{i[1].end()}catch(e){}}),t.modem.demuxStream(n,i[0],i[1])):(n.setEncoding("utf8"),n.pipe(i,{end:!0}))),t.start(s,function(e,i){if(e)return o(e,i,t);a.emit("start",t),t.wait(function(e,i){a.emit("data",i),o(e,i,t)})})})}),a},b.prototype.runPromise=function(e,t,i,n,r){var s=this;r=r||{};var o,a={Hostname:"",User:"",AttachStdin:!1,AttachStdout:!0,AttachStderr:!0,Tty:!0,OpenStdin:!1,StdinOnce:!1,Env:null,Cmd:t,Image:e,Volumes:{},VolumesFrom:[]};return y(a,n=n||{}),new this.modem.Promise(function(e,t){s.createContainer(a).then(function(e){return o=e,e.attach({stream:!0,stdout:!0,stderr:!0})}).then(function(e){return i&&(i instanceof Array?(e.on("end",function(){try{i[0].end()}catch(e){}try{i[1].end()}catch(e){}}),o.modem.demuxStream(e,i[0],i[1])):(e.setEncoding("utf8"),e.pipe(i,{end:!0}))),o.start(r)}).then(function(e){return o.wait()}).then(function(t){e([t,o])}).catch(function(e){t(e)})})},b.prototype.swarmInit=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/init",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmJoin=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/join",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmLeave=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/leave?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,406:"node is not part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmUpdate=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm/update?",method:"POST",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,400:"bad parameter",406:"node is already part of a Swarm"},options:n.opts};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.prototype.swarmInspect=function(e,t){var i=this,n=m.processArgs(e,t),r={path:"/swarm",method:"GET",abortSignal:n.opts.abortSignal,statusCodes:{200:!0,406:"This node is not a swarm manager",500:"server error"}};if(void 0===n.callback)return new this.modem.Promise(function(e,t){i.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){n.callback(e,t)})},b.Container=s,b.Image=o,b.Volume=a,b.Network=l,b.Service=c,b.Plugin=u,b.Secret=h,b.Task=f,b.Node=p,b.Exec=g,e.exports=b},6033(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.start=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/exec/"+this.id+"/start",method:"POST",abortSignal:r.opts.abortSignal,isStream:!0,allowEmpty:!0,hijack:r.opts.hijack,openStdin:r.opts.stdin,statusCodes:{200:!0,204:!0,404:"no such exec",409:"container stopped/paused",500:"container not running"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},r.prototype.resize=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/exec/"+this.id+"/resize?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such exec",500:"container not running"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/exec/"+this.id+"/json",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such exec",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},e.exports=r},1991(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.name=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=n.processArgs(e,t),r=this;e={path:"/images/"+this.name+"/json",method:"GET",options:i.opts,statusCodes:{200:!0,404:"no such image",500:"server error"}};if(void 0===i.callback)return new this.modem.Promise(function(t,i){r.modem.dial(e,function(e,n){if(e)return i(e);t(n)})});this.modem.dial(e,function(e,t){if(e)return i.callback(e,t);i.callback(e,t)})},r.prototype.distribution=function(e,t){var i=n.processArgs(e,t),r=this,s={path:"/distribution/"+this.name+"/json",method:"GET",statusCodes:{200:!0,401:"no such image",500:"server error"},authconfig:i.opts?i.opts.authconfig:void 0};if(void 0===i.callback)return new this.modem.Promise(function(e,t){r.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return i.callback(e,t);i.callback(e,t)})},r.prototype.history=function(e){var t=this,i={path:"/images/"+this.name+"/history",method:"GET",statusCodes:{200:!0,404:"no such image",500:"server error"}};if(void 0===e)return new this.modem.Promise(function(e,n){t.modem.dial(i,function(t,i){if(t)return n(t);e(i)})});this.modem.dial(i,function(t,i){if(t)return e(t,i);e(t,i)})},r.prototype.get=function(e){var t=this,i={path:"/images/"+this.name+"/get",method:"GET",isStream:!0,statusCodes:{200:!0,500:"server error"}};if(void 0===e)return new this.modem.Promise(function(e,n){t.modem.dial(i,function(t,i){if(t)return n(t);e(i)})});this.modem.dial(i,function(t,i){if(t)return e(t,i);e(t,i)})},r.prototype.push=function(e,t,i){var r=this,s=n.processArgs(e,t),o=!0;!1===s.opts.stream&&(o=!1);var a={path:"/images/"+this.name+"/push?",method:"POST",options:s.opts,authconfig:s.opts.authconfig||i,abortSignal:s.opts.abortSignal,isStream:o,statusCodes:{200:!0,404:"no such image",500:"server error"}};if(delete a.options.authconfig,void 0===t)return new this.modem.Promise(function(e,t){r.modem.dial(a,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(a,function(e,i){t(e,i)})},r.prototype.tag=function(e,t){var i=this,n={path:"/images/"+this.name+"/tag?",method:"POST",options:e,abortSignal:e&&e.abortSignal,statusCodes:{200:!0,201:!0,400:"bad parameter",404:"no such image",409:"conflict",500:"server error"}};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/images/"+this.name+"?",method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such image",409:"conflict",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},384(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t);e={path:"/networks/"+this.id+"?",method:"GET",statusCodes:{200:!0,404:"no such network",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(t,n){i.modem.dial(e,function(e,i){if(e)return n(e);t(i)})});this.modem.dial(e,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/networks/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such network",409:"conflict",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.connect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/networks/"+this.id+"/connect",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"network or container is not found",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.disconnect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/networks/"+this.id+"/disconnect",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,201:!0,404:"network or container is not found",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},4024(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/nodes/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such node",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t){var i=this;t||"function"!=typeof e||(t=e);var n={path:"/nodes/"+this.id+"/update?",method:"POST",abortSignal:e&&e.abortSignal,statusCodes:{200:!0,404:"no such node",406:"node is not part of a swarm",500:"server error"},options:e};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/nodes/"+this.id+"?",method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such node",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},3303(e,t,i){var n=i(7052),r=function(e,t,i){this.modem=e,this.name=t,this.remote=i||t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/json",method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"plugin is not installed",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"?",method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"plugin is not installed",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){if(e)return r.callback(e,t);r.callback(e,t)})},r.prototype.privileges=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/privileges?",method:"GET",options:{remote:this.remote},abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.pull=function(e,t){var i=this,r=n.processArgs(e,t);r.opts._query&&!r.opts._query.name&&(r.opts._query.name=this.name),r.opts._query&&!r.opts._query.remote&&(r.opts._query.remote=this.remote);var s={path:"/plugins/pull?",method:"POST",abortSignal:r.opts.abortSignal,isStream:!0,options:r.opts,statusCodes:{200:!0,204:!0,500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.enable=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/enable?",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.disable=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/disable",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.push=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/push",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"plugin not installed",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.configure=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/plugins/"+this.name+"/set",method:"POST",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"plugin not installed",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.upgrade=function(e,t,i){var n=this;i||"function"!=typeof t||(i=t,e=(t=e).authconfig||void 0);var r={path:"/plugins/"+this.name+"/upgrade?",method:"POST",abortSignal:t&&t.abortSignal,statusCodes:{200:!0,204:!0,404:"plugin not installed",500:"server error"},authconfig:e,options:t};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(r,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(r,function(e,t){i(e,t)})},e.exports=r},9360(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/secrets/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"secret not found",406:"node is not part of a swarm",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t){var i=this;t||"function"!=typeof e||(t=e);var n={path:"/secrets/"+this.id+"/update?",method:"POST",abortSignal:e&&e.abortSignal,statusCodes:{200:!0,404:"secret not found",500:"server error"},options:e};if(void 0===t)return new this.modem.Promise(function(e,t){i.modem.dial(n,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(n,function(e,i){t(e,i)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/secrets/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"secret not found",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},3569(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/services/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such service",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/services/"+this.id,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,204:!0,404:"no such service",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.update=function(e,t,i){var n=this;if(!i){var r=typeof t;"function"===r?(i=t,e=(t=e).authconfig||void 0):"undefined"===r&&(e=(t=e).authconfig||void 0)}var s={path:"/services/"+this.id+"/update?",method:"POST",abortSignal:t&&t.abortSignal,statusCodes:{200:!0,404:"no such service",500:"server error"},authconfig:e,options:t};if(void 0===i)return new this.modem.Promise(function(e,t){n.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){i(e,t)})},r.prototype.logs=function(e,t){var i=this,r=n.processArgs(e,t,{}),s={path:"/services/"+this.id+"/logs?",method:"GET",abortSignal:r.opts.abortSignal,isStream:r.opts.follow||!1,statusCodes:{200:!0,404:"no such service",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},7054(e,t,i){var n=i(674),r=i(6340),s=i(6928),o=i(4679).v4;e.exports=function(e,t,i){const a=o(),l={method:"POST",path:"/session",hijack:!0,headers:{Upgrade:"h2c","X-Docker-Expose-Session-Uuid":a,"X-Docker-Expose-Session-Name":"testcontainers"},statusCodes:{200:!0,500:"server error"}};e.modem.dial(l,function(e,o){if(e)return i(e,null,()=>{});const l=new n.Server,c=n.ServerCredentials.createInsecure();l.createConnectionInjector(c).injectConnection(o);const u=r.loadSync(s.resolve(__dirname,"proto","auth.proto")),h=n.loadPackageDefinition(u);l.addService(h.moby.filesync.v1.Auth.service,{Credentials({request:e},i){i(null,t?{Username:t.username,Secret:t.password}:{})}}),i(null,a,function(){l.forceShutdown(),o.end()})})}},5517(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.id=t,this.defaultOptions={log:{}}};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/tasks/"+this.id,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"unknown task",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.logs=function(e,t){var i=this,r=n.processArgs(e,t,this.defaultOptions.log),s={path:"/tasks/"+this.id+"/logs?",method:"GET",abortSignal:r.opts.abortSignal,isStream:r.opts.follow||!1,statusCodes:{101:!0,200:!0,404:"no such container",500:"server error",503:"node is not part of a swarm"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},7052(e,t,i){var n=i(3065),r=i(9896),s=i(6928),o=i(6868),a=i(3106),l=[],c=l.forEach,u=l.slice;e.exports.extend=function(e){return c.call(u.call(arguments,1),function(t){if(t)for(var i in t)e[i]=t[i]}),e},e.exports.processArgs=function(t,i,n){return i||"function"!=typeof t||(i=t,t=null),{callback:i,opts:e.exports.extend({},n,t)}},e.exports.parseRepositoryTag=function(e){var t,i=e.indexOf("@"),n=e.lastIndexOf(":");if(i>=0)t=i;else{if(!(n>=0))return{repository:e};t=n}var r=e.slice(t+1);return-1===r.indexOf("/")?{repository:e.slice(0,t),tag:r}:{repository:e}},e.exports.prepareBuildContext=function(e,t){e&&e.context?r.readFile(s.join(e.context,".dockerignore"),(i,r)=>{let s,l;if(!i){const e=n({ignorecase:!1}).add(r.toString());l=e.createFilter(),s=e=>!l(e)}const c=e.src.slice()||[],u=o.pack(e.context,{entries:l?c.filter(l):c,ignore:s});t(u.pipe(a.createGzip()))}):t(e)}},4974(e,t,i){var n=i(7052),r=function(e,t){this.modem=e,this.name=t};r.prototype[i(9023).inspect.custom]=function(){return this},r.prototype.inspect=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/volumes/"+this.name,method:"GET",abortSignal:r.opts.abortSignal,statusCodes:{200:!0,404:"no such volume",500:"server error"}};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},r.prototype.remove=function(e,t){var i=this,r=n.processArgs(e,t),s={path:"/volumes/"+this.name,method:"DELETE",abortSignal:r.opts.abortSignal,statusCodes:{204:!0,404:"no such volume",409:"conflict",500:"server error"},options:r.opts};if(void 0===r.callback)return new this.modem.Promise(function(e,t){i.modem.dial(s,function(i,n){if(i)return t(i);e(n)})});this.modem.dial(s,function(e,t){r.callback(e,t)})},e.exports=r},6611(e,t,i){var n=i(3519),r=function(){},s=global.Bare?queueMicrotask:process.nextTick.bind(process),o=function(e,t,i){if("function"==typeof t)return o(e,null,t);t||(t={}),i=n(i||r);var a=e._writableState,l=e._readableState,c=t.readable||!1!==t.readable&&e.readable,u=t.writable||!1!==t.writable&&e.writable,h=!1,d=function(){e.writable||f()},f=function(){u=!1,c||i.call(e)},p=function(){c=!1,u||i.call(e)},g=function(t){i.call(e,t?new Error("exited with error code: "+t):null)},m=function(t){i.call(e,t)},v=function(){s(y)},y=function(){if(!h)return(!c||l&&l.ended&&!l.destroyed)&&(!u||a&&a.ended&&!a.destroyed)?void 0:i.call(e,new Error("premature close"))},b=function(){e.req.on("finish",f)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?u&&!a&&(e.on("end",d),e.on("close",d)):(e.on("complete",f),e.on("abort",v),e.req?b():e.on("request",b)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",g),e.on("end",p),e.on("finish",f),!1!==t.error&&e.on("error",m),e.on("close",v),function(){h=!0,e.removeListener("complete",f),e.removeListener("abort",v),e.removeListener("request",b),e.req&&e.req.removeListener("finish",f),e.removeListener("end",d),e.removeListener("close",d),e.removeListener("finish",f),e.removeListener("exit",g),e.removeListener("end",p),e.removeListener("error",m),e.removeListener("close",v)}};e.exports=o},5474(e,t,i){e=i.nmd(e),function t(n){"use strict";var r;function s(e,t,i){const n=typeof i,r=typeof e;if("undefined"!==n){if("undefined"!==r){if(i){if("function"===r&&n===r)return function(t){return e(i(t))};if((t=e.constructor)===i.constructor){if(t===Array)return i.concat(e);if(t===Map){var s=new Map(i);for(var o of e)s.set(o[0],o[1]);return s}if(t===Set){for(s of(o=new Set(i),e.values()))o.add(s);return o}}}return e}return i}return"undefined"===r?t:e}function o(e,t){return void 0===e?t:e}function a(){return Object.create(null)}function l(e){return"string"==typeof e}function c(e){return"object"==typeof e}function u(e,t){if(l(t))e=e[t];else for(let i=0;e&&i<t.length;i++)e=e[t[i]];return e}(n=e)._factory=t;const h=/[^\p{L}\p{N}]+/u,d=/(\d{3})/g,f=/(\D)(\d{3})/g,p=/(\d{3})(\D)/g,g=/[\u0300-\u036f]/g;function m(e={}){if(!this||this.constructor!==m)return new m(...arguments);if(arguments.length)for(e=0;e<arguments.length;e++)this.assign(arguments[e]);else this.assign(e)}function v(e){e.F=null,e.B.clear(),e.D.clear()}function y(e,t,i){i||(t||"object"!=typeof e?"object"==typeof t&&(i=t,t=0):i=e),i&&(e=i.query||e,t=i.limit||t);let n=""+(t||0);i&&(n+=(i.offset||0)+!!i.context+!!i.suggest+(!1!==i.resolve)+(i.resolution||this.resolution)+(i.boost||0)),e=(""+e).toLowerCase(),this.cache||(this.cache=new b);let r=this.cache.get(e+n);if(!r){const s=i&&i.cache;s&&(i.cache=!1),r=this.search(e,t,i),s&&(i.cache=s),this.cache.set(e+n,r)}return r}function b(e){this.limit=e&&!0!==e?e:1e3,this.cache=new Map,this.h=""}(r=m.prototype).assign=function(e){this.normalize=s(e.normalize,!0,this.normalize);let t,i=e.include,n=i||e.exclude||e.split;if(n||""===n){if("object"==typeof n&&n.constructor!==RegExp){let e="";t=!i,i||(e+="\\p{Z}"),n.letter&&(e+="\\p{L}"),n.number&&(e+="\\p{N}",t=!!i),n.symbol&&(e+="\\p{S}"),n.punctuation&&(e+="\\p{P}"),n.control&&(e+="\\p{C}"),(n=n.char)&&(e+="object"==typeof n?n.join(""):n);try{this.split=new RegExp("["+(i?"^":"")+e+"]+","u")}catch(e){this.split=/\s+/}}else this.split=n,t=!1===n||"a1a".split(n).length<2;this.numeric=s(e.numeric,t)}else{try{this.split=s(this.split,h)}catch(e){this.split=/\s+/}this.numeric=s(e.numeric,s(this.numeric,!0))}if(this.prepare=s(e.prepare,null,this.prepare),this.finalize=s(e.finalize,null,this.finalize),n=e.filter,this.filter="function"==typeof n?n:s(n&&new Set(n),null,this.filter),this.dedupe=s(e.dedupe,!0,this.dedupe),this.matcher=s((n=e.matcher)&&new Map(n),null,this.matcher),this.mapper=s((n=e.mapper)&&new Map(n),null,this.mapper),this.stemmer=s((n=e.stemmer)&&new Map(n),null,this.stemmer),this.replacer=s(e.replacer,null,this.replacer),this.minlength=s(e.minlength,1,this.minlength),this.maxlength=s(e.maxlength,1024,this.maxlength),this.rtl=s(e.rtl,!1,this.rtl),(this.cache=n=s(e.cache,!0,this.cache))&&(this.F=null,this.L="number"==typeof n?n:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(const e of this.matcher.keys())this.h+=(this.h?"|":"")+e;if(this.stemmer)for(const e of this.stemmer.keys())this.A+=(this.A?"|":"")+e;return this},r.addStemmer=function(e,t){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(e,t),this.A+=(this.A?"|":"")+e,this.K=null,this.cache&&v(this),this},r.addFilter=function(e){return"function"==typeof e?this.filter=e:(this.filter||(this.filter=new Set),this.filter.add(e)),this.cache&&v(this),this},r.addMapper=function(e,t){return"object"==typeof e?this.addReplacer(e,t):e.length>1?this.addMatcher(e,t):(this.mapper||(this.mapper=new Map),this.mapper.set(e,t),this.cache&&v(this),this)},r.addMatcher=function(e,t){return"object"==typeof e?this.addReplacer(e,t):e.length<2&&(this.dedupe||this.mapper)?this.addMapper(e,t):(this.matcher||(this.matcher=new Map),this.matcher.set(e,t),this.h+=(this.h?"|":"")+e,this.J=null,this.cache&&v(this),this)},r.addReplacer=function(e,t){return"string"==typeof e?this.addMatcher(e,t):(this.replacer||(this.replacer=[]),this.replacer.push(e,t),this.cache&&v(this),this)},r.encode=function(e,t){if(this.cache&&e.length<=this.H)if(this.F){if(this.B.has(e))return this.B.get(e)}else this.F=setTimeout(v,50,this);this.normalize&&(e="function"==typeof this.normalize?this.normalize(e):g?e.normalize("NFKD").replace(g,"").toLowerCase():e.toLowerCase()),this.prepare&&(e=this.prepare(e)),this.numeric&&e.length>3&&(e=e.replace(f,"$1 $2").replace(p,"$1 $2").replace(d,"$1 "));const i=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let n,r,s=[],o=a(),l=this.split||""===this.split?e.split(this.split):[e];for(let e,a,u=0;u<l.length;u++)if((e=a=l[u])&&!(e.length<this.minlength||e.length>this.maxlength)){if(t){if(o[e])continue;o[e]=1}else{if(n===e)continue;n=e}if(i)s.push(e);else if(!this.filter||("function"==typeof this.filter?this.filter(e):!this.filter.has(e))){if(this.cache&&e.length<=this.I)if(this.F){var c=this.D.get(e);if(c||""===c){c&&s.push(c);continue}}else this.F=setTimeout(v,50,this);if(this.stemmer){let t;for(this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));t!==e&&e.length>2;)t=e,e=e.replace(this.K,e=>this.stemmer.get(e))}if(e&&(this.mapper||this.dedupe&&e.length>1)){c="";for(let t,i,n=0,r="";n<e.length;n++)t=e.charAt(n),t===r&&this.dedupe||((i=this.mapper&&this.mapper.get(t))||""===i?i===r&&this.dedupe||!(r=i)||(c+=i):c+=r=t);e=c}if(this.matcher&&e.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),e=e.replace(this.J,e=>this.matcher.get(e))),e&&this.replacer)for(c=0;e&&c<this.replacer.length;c+=2)e=e.replace(this.replacer[c],this.replacer[c+1]);if(this.cache&&a.length<=this.I&&(this.D.set(a,e),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),e){if(e!==a)if(t){if(o[e])continue;o[e]=1}else{if(r===e)continue;r=e}s.push(e)}}}return this.finalize&&(s=this.finalize(s)||s),this.cache&&e.length<=this.H&&(this.B.set(e,s),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),s},b.prototype.set=function(e,t){this.cache.set(this.h=e,t),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)},b.prototype.get=function(e){const t=this.cache.get(e);return t&&this.h!==e&&(this.cache.delete(e),this.cache.set(this.h=e,t)),t},b.prototype.remove=function(e){for(const t of this.cache){const i=t[0];t[1].includes(e)&&this.cache.delete(i)}},b.prototype.clear=function(){this.cache.clear(),this.h=""};const S={normalize:!1,numeric:!1,dedupe:!1},_={},C=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),w=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),E=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],T={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6};var k={Exact:S,Default:_,Normalize:_,LatinBalance:{mapper:C},LatinAdvanced:{mapper:C,matcher:w,replacer:E},LatinExtra:{mapper:C,replacer:E.concat([/(?!^)[aeo]/g,""]),matcher:w},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(e){for(let i=0;i<e.length;i++){var t=e[i];let n=t.charAt(0),r=T[n];for(let e,i=1;i<t.length&&(e=t.charAt(i),"h"===e||"w"===e||!(e=T[e])||e===r||(n+=e,r=e,4!==n.length));i++);e[i]=n}}},CJK:{split:""},LatinExact:S,LatinDefault:_,LatinSimple:_};function R(e,t,i,n){let r=[];for(let s,o=0;o<e.index.length;o++)if(s=e.index[o],t>=s.length)t-=s.length;else{const o=(t=s[n?"splice":"slice"](t,i)).length;if(o&&(r=r.length?r.concat(t):t,i-=o,n&&(e.length-=o),!i))break;t=0}return r}function O(e){if(!this||this.constructor!==O)return new O(e);this.index=e?[e]:[],this.length=e?e.length:0;const t=this;return new Proxy([],{get:(e,i)=>"length"===i?t.length:"push"===i?function(e){t.index[t.index.length-1].push(e),t.length++}:"pop"===i?function(){if(t.length)return t.length--,t.index[t.index.length-1].pop()}:"indexOf"===i?function(e){let i=0;for(let n,r,s=0;s<t.index.length;s++){if(n=t.index[s],r=n.indexOf(e),r>=0)return i+r;i+=n.length}return-1}:"includes"===i?function(e){for(let i=0;i<t.index.length;i++)if(t.index[i].includes(e))return!0;return!1}:"slice"===i?function(e,i){return R(t,e||0,i||t.length,!1)}:"splice"===i?function(e,i){return R(t,e||0,i||t.length,!0)}:"constructor"===i?Array:"symbol"!=typeof i?(e=t.index[i/2**31|0])&&e[i]:void 0,set:(e,i,n)=>(e=i/2**31|0,(t.index[e]||(t.index[e]=[]))[i]=n,t.length++,!0)})}function P(e=8){if(!this||this.constructor!==P)return new P(e);this.index=a(),this.h=[],this.size=0,e>32?(this.B=N,this.A=BigInt(e)):(this.B=x,this.A=e)}function A(e=8){if(!this||this.constructor!==A)return new A(e);this.index=a(),this.h=[],this.size=0,e>32?(this.B=N,this.A=BigInt(e)):(this.B=x,this.A=e)}function x(e){let t=2**this.A-1;if("number"==typeof e)return e&t;let i=0,n=this.A+1;for(let r=0;r<e.length;r++)i=(i*n^e.charCodeAt(r))&t;return 32===this.A?i+2**31:i}function N(e){let t=BigInt(2)**this.A-BigInt(1);var i=typeof e;if("bigint"===i)return e&t;if("number"===i)return BigInt(e)&t;i=BigInt(0);let n=this.A+BigInt(1);for(let r=0;r<e.length;r++)i=(i*n^BigInt(e.charCodeAt(r)))&t;return i}let I,M,L,D,j;async function F(e){var t=(e=e.data).task;const i=e.id;let r=e.args;if("init"===t)M=e.options||{},(t=e.factory)?(Function("return "+t)()(n),I=new n.FlexSearch.Index(M),delete n.FlexSearch):I=new Oe(M),postMessage({id:i});else{let n;"export"===t&&(r[1]?(r[0]=M.export,r[2]=0,r[3]=1):r=null),"import"===t?r[0]&&(e=await M.import.call(I,r[0]),I.import(r[0],e)):((n=r&&I[t].apply(I,r))&&n.then&&(n=await n),n&&n.await&&(n=await n.await),"search"===t&&n.result&&(n=n.result)),postMessage("search"===t?{id:i,msg:n}:{id:i})}}function B(e){z.call(e,"add"),z.call(e,"append"),z.call(e,"search"),z.call(e,"update"),z.call(e,"remove"),z.call(e,"searchCache")}function U(){L=j=0}function z(e){this[e+"Async"]=function(){const t=arguments;var i=t[t.length-1];let n;if("function"==typeof i&&(n=i,delete t[t.length-1]),L?j||(j=Date.now()-D>=this.priority*this.priority*3):(L=setTimeout(U,0),D=Date.now()),j){const i=this;return new Promise(n=>{setTimeout(function(){n(i[e+"Async"].apply(i,t))},0)})}const r=this[e].apply(this,t);return i=r.then?r:new Promise(e=>e(r)),n&&i.then(n),i}}O.prototype.clear=function(){this.index.length=0},O.prototype.push=function(){},P.prototype.get=function(e){const t=this.index[this.B(e)];return t&&t.get(e)},P.prototype.set=function(e,t){var i=this.B(e);let n=this.index[i];n?(i=n.size,n.set(e,t),(i-=n.size)&&this.size++):(this.index[i]=n=new Map([[e,t]]),this.h.push(n),this.size++)},A.prototype.add=function(e){var t=this.B(e);let i=this.index[t];i?(t=i.size,i.add(e),(t-=i.size)&&this.size++):(this.index[t]=i=new Set([e]),this.h.push(i),this.size++)},(r=P.prototype).has=A.prototype.has=function(e){const t=this.index[this.B(e)];return t&&t.has(e)},r.delete=A.prototype.delete=function(e){const t=this.index[this.B(e)];t&&t.delete(e)&&this.size--},r.clear=A.prototype.clear=function(){this.index=a(),this.h=[],this.size=0},r.values=A.prototype.values=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].values())yield t},r.keys=A.prototype.keys=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].keys())yield t},r.entries=A.prototype.entries=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].entries())yield t};let H=0;function q(e={},t){function r(i){function n(e){const t=(e=e.data||e).id,i=t&&l.h[t];i&&(i(e.msg),delete l.h[t])}if(this.worker=i,this.h=a(),this.worker)return o?this.worker.on("message",n):this.worker.onmessage=n,e.config?new Promise(function(t){H>1e9&&(H=0),l.h[++H]=function(){t(l)},l.worker.postMessage({id:H,task:"init",factory:s,options:e})}):(this.priority=e.priority||4,this.encoder=t||null,this.worker.postMessage({task:"init",factory:s,options:e}),this)}if(!this||this.constructor!==q)return new q(e);let s=void 0!==n?n._factory:"undefined"!=typeof window?window._factory:null;s&&(s=s.toString());const o="undefined"==typeof window,l=this,c=function(e,t,n){return t?new(i(8167).Worker)(__dirname+"/node/node.js"):e?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+F.toString()],{type:"text/javascript"}))):new window.Worker("string"==typeof n?n:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs","module/worker/worker.js"),{type:"module"})}(s,o,e.worker);return c.then?c.then(function(e){return r.call(l,e)}):r.call(this,c)}function W(e){q.prototype[e]=function(){const t=this,i=[].slice.call(arguments);var n=i[i.length-1];let r;return"function"==typeof n&&(r=n,i.pop()),n=new Promise(function(n){"export"===e&&"function"==typeof i[0]&&(i[0]=null),H>1e9&&(H=0),t.h[++H]=n,t.worker.postMessage({task:e,id:H,args:i})}),r?(n.then(r),this):n}}function G(e,t,i,n,r,s){if(e=e[r],n===i.length-1)t[r]=s||e;else if(e)if(e.constructor===Array)for(t=t[r]=Array(e.length),r=0;r<e.length;r++)G(e,t,i,n,r);else t=t[r]||(t[r]=a()),r=i[++n],G(e,t,i,n,r)}function $(e,t,i,n,r,s,o,a){if(e=e[o])if(n===t.length-1){if(e.constructor===Array){if(i[n]){for(t=0;t<e.length;t++)r.add(s,e[t],!0,!0);return}e=e.join(" ")}r.add(s,e,a,!0)}else if(e.constructor===Array)for(o=0;o<e.length;o++)$(e,t,i,n,r,s,o,a);else o=t[++n],$(e,t,i,n,r,s,o,a)}function V(e,t,i,n){if(!e.length)return e;if(1===e.length)return e=e[0],e=i||e.length>t?e.slice(i,i+t):e,n?le.call(this,e):e;let r=[];for(let s,o,a=0;a<e.length;a++)if((s=e[a])&&(o=s.length)){if(i){if(i>=o){i-=o;continue}s=s.slice(i,i+t),o=s.length,i=0}if(o>t&&(s=s.slice(0,t),o=t),!r.length&&o>=t)return n?le.call(this,s):s;if(r.push(s),!(t-=o))break}return r=r.length>1?[].concat.apply([],r):r[0],n?le.call(this,r):r}function Y(e,t,i,n){var r=n[0];if(r[0]&&r[0].query)return e[t].apply(e,r);if(!("and"!==t&&"not"!==t||e.result.length||e.await||r.suggest))return n.length>1&&(r=n[n.length-1]),(n=r.resolve)?e.await||e.result:e;let s,o,a,l,c,u=[],h=0,d=0;for(t=0;t<n.length;t++)if(r=n[t]){var f=void 0;if(r.constructor===te)f=r.await||r.result;else if(r.then||r.constructor===Array)f=r;else{h=r.limit||0,d=r.offset||0,a=r.suggest,o=r.resolve,s=((l=r.highlight||e.highlight)||r.enrich)&&o,f=r.queue;let i=r.async||f,n=r.index,p=r.query;if(n?e.index||(e.index=n):n=e.index,p||r.tag){const s=r.field||r.pluck;if(s&&(!p||e.query&&!l||(e.query=p,e.field=s,e.highlight=l),n=n.index.get(s)),f&&(c||e.await)){let s;c=1;const o=e.C.length,a=new Promise(function(e){s=e});(function(t,n){a.h=function(){n.index=null,n.resolve=!1;let r=i?t.searchAsync(n):t.search(n);return r.then?r.then(function(t){return e.C[o]=t=t.result||t,s(t),t}):(r=r.result||r,s(r),r)}})(n,Object.assign({},r)),e.C.push(a),u[t]=a;continue}r.resolve=!1,r.index=null,f=i?n.searchAsync(r):n.search(r),r.resolve=o,r.index=n}else if(r.and)f=K(r,"and",n);else if(r.or)f=K(r,"or",n);else if(r.not)f=K(r,"not",n);else{if(!r.xor)continue;f=K(r,"xor",n)}}f.await?(c=1,f=f.await):f.then?(c=1,f=f.then(function(e){return e.result||e})):f=f.result||f,u[t]=f}if(c&&!e.await&&(e.await=new Promise(function(t){e.return=t})),c){const t=Promise.all(u).then(function(n){for(let r=0;r<e.C.length;r++)if(e.C[r]===t){e.C[r]=function(){return i.call(e,n,h,d,s,o,a,l)};break}ie(e)});e.C.push(t)}else{if(!e.await)return i.call(e,u,h,d,s,o,a,l);e.C.push(function(){return i.call(e,u,h,d,s,o,a,l)})}return o?e.await||e.result:e}function K(e,t,i){const n=(e=e[t])[0]||e;return n.index||(n.index=i),i=new te(n),e.length>1&&(i=i[t].apply(i,e.slice(1))),i}function J(e,t,i,n,r,s,o){return e.length&&(this.result.length&&e.push(this.result),e.length<2?this.result=e[0]:(this.result=re(e,t,i,!1,this.h),i=0)),r&&(this.await=null),r?this.resolve(t,i,n,o):this}function X(e,t,i,n,r,s,o){if(!s&&!this.result.length)return r?this.result:this;let a;if(e.length)if(this.result.length&&e.unshift(this.result),e.length<2)this.result=e[0];else{let n=0;for(let t,i,r=0;r<e.length;r++)if((t=e[r])&&(i=t.length))n<i&&(n=i);else if(!s){n=0;break}n?(this.result=ne(e,n,t,i,s,this.h,r),a=!0):this.result=[]}else s||(this.result=e);return r&&(this.await=null),r?this.resolve(t,i,n,o,a):this}function Q(e,t,i,n,r,s,o){if(e.length)if(this.result.length&&e.unshift(this.result),e.length<2)this.result=e[0];else{e:{s=i;var l=this.h;const n=[],o=a();let c=0;for(let t,i=0;i<e.length;i++)if(t=e[i]){c<t.length&&(c=t.length);for(let e,i=0;i<t.length;i++)if(e=t[i])for(let t,i=0;i<e.length;i++)t=e[i],o[t]=o[t]?2:1}for(let i,a=0,u=0;a<c;a++)for(let c,h=0;h<e.length;h++)if((c=e[h])&&(i=c[a]))for(let c,d=0;d<i.length;d++)if(c=i[d],1===o[c])if(s)s--;else if(r){if(n.push(c),n.length===t){e=n;break e}}else{const i=a+(h?l:0);if(n[i]||(n[i]=[]),n[i].push(c),++u===t){e=n;break e}}e=n}this.result=e,l=!0}else s||(this.result=e);return r&&(this.await=null),r?this.resolve(t,i,n,o,l):this}function Z(e,t,i,n,r,s,o){if(!s&&!this.result.length)return r?this.result:this;if(e.length&&this.result.length){e:{s=i;var a=[];e=new Set(e.flat().flat());for(let i,n=0,o=0;n<this.result.length;n++)if(i=this.result[n])for(let l,c=0;c<i.length;c++)if(l=i[c],!e.has(l))if(s)s--;else if(r){if(a.push(l),a.length===t){e=a;break e}}else if(a[n]||(a[n]=[]),a[n].push(l),++o===t){e=a;break e}e=a}this.result=e,a=!0}return r&&(this.await=null),r?this.resolve(t,i,n,o,a):this}function ee(e,t,i,n,r){let s,o,a;"string"==typeof r?(s=r,r=""):s=r.template,o=s.indexOf("$1"),a=s.substring(o+2),o=s.substring(0,o);let l=r&&r.boundary,c=!r||!1!==r.clip,h=r&&r.merge&&a&&o&&new RegExp(a+" "+o,"g");var d=0;if("object"==typeof(r=r&&r.ellipsis)){var f=r.template;d=f.length-2,r=r.pattern}let p,g;"string"!=typeof r&&(r=!1===r?"":"..."),d&&(r=f.replace("$1",r)),f=r.length-d,"object"==typeof l&&(p=l.before,0===p&&(p=-1),g=l.after,0===g&&(g=-1),l=l.total||9e5),d=new Map;for(let M,L,D,j=0;j<t.length;j++){let F;if(n)F=t,D=n;else{var m=t[j];if(D=m.field,!D)continue;F=m.result}L=i.get(D),M=L.encoder,"string"!=typeof(m=d.get(M))&&(m=M.encode(e),d.set(M,m));for(let e=0;e<F.length;e++){var v=F[e].doc;if(!v)continue;if(!(v=u(v,D)))continue;var y=v.trim().split(/\s+/);if(!y.length)continue;v="";var b=[];let t=[];for(var S=-1,_=-1,C=0,w=0;w<y.length;w++){var E=y[w],T=M.encode(E);let e;if((T=T.length>1?T.join(" "):T[0])&&E){for(var k=E.length,R=(M.split?E.replace(M.split,""):E).length-T.length,O="",P=0,A=0;A<m.length;A++){var x=m[A];if(x){var N=x.length;N+=R<0?0:R,P&&N<=P||(x=T.indexOf(x))>-1&&(O=(x?E.substring(0,x):"")+o+E.substring(x,x+N)+a+(x+N<k?E.substring(x+N):""),P=N,e=!0)}}O&&(l&&(S<0&&(S=v.length+(v?1:0)),_=v.length+(v?1:0)+O.length,C+=k,t.push(b.length),b.push({match:O})),v+=(v?" ":"")+O)}if(e){if(l&&C>=l)break}else v+=(v?" ":"")+(E=y[w]),l&&b.push({text:E})}if(C=t.length*(s.length-2),p||g||l&&v.length-C>l)if(w=_-S,p>0&&(w+=p),g>0&&(w+=g),w<=(C=l+C-2*f))y=p?S-(p>0?p:0):S-((C-w)/2|0),b=g?_+(g>0?g:0):y+C,c||(y>0&&" "!==v.charAt(y)&&" "!==v.charAt(y-1)&&((y=v.indexOf(" ",y))<0&&(y=0)),b<v.length&&" "!==v.charAt(b-1)&&" "!==v.charAt(b)&&((b=v.lastIndexOf(" ",b))<_?b=_:++b)),v=(y?r:"")+v.substring(y,b)+(b<v.length?r:"");else{for(_=[],S={},C={},w={},E={},T={},O=R=k=0,A=P=1;;){var I=void 0;for(let e,i=0;i<t.length;i++){if(e=t[i],O)if(R!==O){if(w[i+1])continue;if(e+=O,S[e]){k-=f,C[i+1]=1,w[i+1]=1;continue}if(e>=b.length-1){if(e>=b.length){w[i+1]=1,e>=y.length&&(C[i+1]=1);continue}k-=f}if(v=b[e].text,N=g&&T[i]){if(!(N>0)){w[i+1]=1;continue}if(v.length>N){if(w[i+1]=1,!c)continue;v=v.substring(0,N)}(N-=v.length)||(N=-1),T[i]=N}if(k+v.length+1<=l)v=" "+v,_[i]+=v;else{if(!c){w[i+1]=1;continue}(I=l-k-1)>0&&(v=" "+v.substring(0,I),_[i]+=v),w[i+1]=1}}else{if(w[i])continue;if(e-=R,S[e]){k-=f,w[i]=1,C[i]=1;continue}if(e<=0){if(e<0){w[i]=1,C[i]=1;continue}k-=f}if(v=b[e].text,N=p&&E[i]){if(!(N>0)){w[i]=1;continue}if(v.length>N){if(w[i]=1,!c)continue;v=v.substring(v.length-N)}(N-=v.length)||(N=-1),E[i]=N}if(k+v.length+1<=l)v+=" ",_[i]=v+_[i];else{if(!c){w[i]=1;continue}(I=v.length+1-(l-k))>=0&&I<v.length&&(v=v.substring(I)+" ",_[i]=v+_[i]),w[i]=1}}else{let t;if(v=b[e].match,p&&(E[i]=p),g&&(T[i]=g),i&&k++,e?!i&&f&&(k+=f):(C[i]=1,w[i]=1),e>=y.length-1||e<b.length-1&&b[e+1].match?t=1:f&&(k+=f),k-=s.length-2,i&&!(k+v.length<=l)){I=P=A=C[i]=0;break}_[i]=v,t&&(C[i+1]=1,w[i+1]=1)}k+=v.length,I=S[e]=1}if(I)R===O?O++:R++;else{if(R===O?P=0:A=0,!P&&!A)break;P?O=++R:O++}}v="";for(let e,t=0;t<_.length;t++)e=(C[t]?t?" ":"":(t&&!r?" ":"")+r)+_[t],v+=e;r&&!C[_.length]&&(v+=r)}h&&(v=v.replace(h," ")),F[e].highlight=v}if(n)break}return t}function te(e,t){if(!this||this.constructor!==te)return new te(e,t);let i,n,r,s,o,a,l=0;if(e&&e.index){const i=e;if(t=i.index,l=i.boost||0,n=i.query){r=i.field||i.pluck,s=i.highlight;const n=i.resolve;e=i.async||i.queue,i.resolve=!1,i.index=null,e=e?t.searchAsync(i):t.search(i),i.resolve=n,i.index=t,e=e.result||e}else e=[]}if(e&&e.then){const t=this;i=[e=e.then(function(e){t.C[0]=t.result=e.result||e,ie(t)})],e=[],o=new Promise(function(e){a=e})}this.index=t||null,this.result=e||[],this.h=l,this.C=i||[],this.await=o||null,this.return=a||null,this.highlight=s||null,this.query=n||"",this.field=r||""}function ie(e,t){let i=e.result;var n=e.await;e.await=null;for(let t,r=0;r<e.C.length;r++)if(t=e.C[r])if("function"==typeof t)i=t(),e.C[r]=i=i.result||i,r--;else if(t.h)i=t.h(),e.C[r]=i=i.result||i,r--;else if(t.then)return e.await=n;return n=e.return,e.C=[],e.return=null,t||n(i),i}function ne(e,t,i,n,r,s,o){const l=e.length;let c,u,h=[];c=a();for(let a,d,f,p,g=0;g<t;g++)for(let t=0;t<l;t++)if(f=e[t],g<f.length&&(a=f[g]))for(let e=0;e<a.length;e++){if(d=a[e],(u=c[d])?c[d]++:(u=0,c[d]=1),p=h[u]||(h[u]=[]),!o){let e=g+(t||!r?0:s||0);p=p[e]||(p[e]=[])}if(p.push(d),o&&i&&u===l-1&&p.length-n===i)return n?p.slice(n):p}if(e=h.length)if(r)h=h.length>1?re(h,i,n,o,s):(h=h[0])&&i&&h.length>i||n?h.slice(n,i+n):h;else{if(e<l)return[];if(h=h[e-1],i||n)if(o)(h.length>i||n)&&(h=h.slice(n,i+n));else{r=[];for(let e,t=0;t<h.length;t++)if(e=h[t])if(n&&e.length>n)n-=e.length;else if((i&&e.length>i||n)&&(e=e.slice(n,i+n),i-=e.length,n&&(n-=e.length)),r.push(e),!i)break;h=r}}return h}function re(e,t,i,n,r){const s=[],o=a();let l;var c=e.length;let u;if(n){for(r=c-1;r>=0;r--)if(u=(n=e[r])&&n.length)for(c=0;c<u;c++)if(l=n[c],!o[l])if(o[l]=1,i)i--;else if(s.push(l),s.length===t)return s}else for(let a,h=c-1,d=0;h>=0;h--){a=e[h];for(let e=0;e<a.length;e++)if(u=(n=a[e])&&n.length)for(let a=0;a<u;a++)if(l=n[a],!o[l])if(o[l]=1,i)i--;else{let i=(e+(h<c-1&&r||0))/(h+1)|0;if((s[i]||(s[i]=[])).push(l),++d===t)return s}}return s}function se(e,t,i,n,r){const s=a(),o=[];for(let e,i=0;i<t.length;i++){e=t[i];for(let t=0;t<e.length;t++)s[e[t]]=1}if(r){for(let t,r=0;r<e.length;r++)if(t=e[r],s[t])if(n)n--;else if(o.push(t),s[t]=0,i&&0===--i)break}else for(let i,n,r=0;r<e.result.length;r++)for(i=e.result[r],t=0;t<i.length;t++)n=i[t],s[n]&&((o[r]||(o[r]=[])).push(n),s[n]=0);return o}function oe(e){const t=[],i=a(),n=a();for(let r,s,o,a,l,c,u,h=0;h<e.length;h++){r=e[h],s=r.field,o=r.result;for(let e=0;e<o.length;e++)l=o[e],"object"!=typeof l?l={id:a=l}:a=l.id,(c=i[a])?c.push(s):(l.field=i[a]=[s],t.push(l)),(u=l.highlight)&&(c=n[a],c||(n[a]=c={},l.highlight=c),c[s]=u)}return t}function ae(e,t,i,n,r){return(e=this.tag.get(e))&&(e=e.get(t))?((t=e.length-n)>0&&((i&&t>i||n)&&(e=e.slice(n,n+i)),r&&(e=le.call(this,e))),e):[]}function le(e){if(!this||!this.store)return e;if(this.db)return this.index.get(this.field[0]).db.enrich(e);const t=Array(e.length);for(let i,n=0;n<e.length;n++)i=e[n],t[n]={id:i,doc:this.store.get(i)};return t}function ce(e){if(!this||this.constructor!==ce)return new ce(e);const t=e.document||e.doc||e;let i,n;if(this.B=[],this.field=[],this.D=[],this.key=(i=t.key||t.id)&&he(i,this.D)||"id",(n=e.keystore||0)&&(this.keystore=n),this.fastupdate=!!e.fastupdate,this.reg=!this.fastupdate||e.worker||e.db?n?new A(n):new Set:n?new P(n):new Map,this.h=(i=t.store||null)&&i&&!0!==i&&[],this.store=i?n?new P(n):new Map:null,this.cache=(i=e.cache||null)&&new b(i),e.cache=!1,this.worker=e.worker||!1,this.priority=e.priority||4,this.index=ue.call(this,e,t),this.tag=null,(i=t.tag)&&("string"==typeof i&&(i=[i]),i.length)){this.tag=new Map,this.A=[],this.F=[];for(let e,t,n=0;n<i.length;n++){if(e=i[n],t=e.field||e,!t)throw Error("The tag field from the document descriptor is undefined.");e.custom?this.A[n]=e.custom:(this.A[n]=he(t,this.D),e.filter&&("string"==typeof this.A[n]&&(this.A[n]=new String(this.A[n])),this.A[n].G=e.filter)),this.F[n]=t,this.tag.set(t,new Map)}}if(this.worker){this.fastupdate=!1,e=[];for(const t of this.index.values())t.then&&e.push(t);if(e.length){const t=this;return Promise.all(e).then(function(e){let i=0;for(const n of t.index.entries()){const r=n[0];let s=n[1];s.then&&(s=e[i],t.index.set(r,s),i++)}return t})}}else e.db&&(this.fastupdate=!1,this.mount(e.db))}function ue(e,t){const i=new Map;let n=t.index||t.field||t;l(n)&&(n=[n]);for(let t,s,o=0;o<n.length;o++){if(t=n[o],l(t)||(s=t,t=t.field),s=c(s)?Object.assign({},e,s):e,this.worker){var r=void 0;r=new q(s,r=(r=s.encoder)&&r.encode?r:new m("string"==typeof r?k[r]:r||{})),i.set(t,r)}this.worker||i.set(t,new Oe(s,this.reg)),s.custom?this.B[o]=s.custom:(this.B[o]=he(t,this.D),s.filter&&("string"==typeof this.B[o]&&(this.B[o]=new String(this.B[o])),this.B[o].G=s.filter)),this.field[o]=t}if(this.h){l(e=t.store)&&(e=[e]);for(let t,i,n=0;n<e.length;n++)t=e[n],i=t.field||t,t.custom?(this.h[n]=t.custom,t.custom.O=i):(this.h[n]=he(i,this.D),t.filter&&("string"==typeof this.h[n]&&(this.h[n]=new String(this.h[n])),this.h[n].G=t.filter))}return i}function he(e,t){const i=e.split(":");let n=0;for(let r=0;r<i.length;r++)"]"===(e=i[r])[e.length-1]&&(e=e.substring(0,e.length-2))&&(t[n]=!0),e&&(i[n++]=e);return n<i.length&&(i.length=n),n>1?i:i[0]}function de(e,t=0){let i=[],n=[];t&&(t=25e4/t*5e3|0);for(const r of e.entries())n.push(r),n.length===t&&(i.push(n),n=[]);return n.length&&i.push(n),i}function fe(e,t){t||(t=new Map);for(let i,n=0;n<e.length;n++)i=e[n],t.set(i[0],i[1]);return t}function pe(e,t=0){let i=[],n=[];t&&(t=25e4/t*1e3|0);for(const r of e.entries())n.push([r[0],de(r[1])[0]||[]]),n.length===t&&(i.push(n),n=[]);return n.length&&i.push(n),i}function ge(e,t){t||(t=new Map);for(let i,n,r=0;r<e.length;r++)i=e[r],n=t.get(i[0]),t.set(i[0],fe(i[1],n));return t}function me(e){let t=[],i=[];for(const n of e.keys())i.push(n),25e4===i.length&&(t.push(i),i=[]);return i.length&&t.push(i),t}function ve(e,t){t||(t=new Set);for(let i=0;i<e.length;i++)t.add(e[i]);return t}function ye(e,t,i,n,r,s,o=0){const a=n&&n.constructor===Array;var l=a?n.shift():n;if(!l)return this.export(e,t,r,s+1);if((l=e((t?t+".":"")+(o+1)+"."+i,JSON.stringify(l)))&&l.then){const c=this;return l.then(function(){return ye.call(c,e,t,i,a?n:null,r,s,o+1)})}return ye.call(this,e,t,i,a?n:null,r,s,o+1)}function be(e,t){let i="";for(const n of e.entries()){e=n[0];const r=n[1];let s="";for(let e,i=0;i<r.length;i++){e=r[i]||[""];let n="";for(let i=0;i<e.length;i++)n+=(n?",":"")+("string"===t?'"'+e[i]+'"':e[i]);n="["+n+"]",s+=(s?",":"")+n}s='["'+e+'",['+s+"]]",i+=(i?",":"")+s}return i}function Se(e,t){let i=0;var n=void 0===t;if(e.constructor===Array){for(let r,s,o,a=0;a<e.length;a++)if((r=e[a])&&r.length){if(n)return 1;if(s=r.indexOf(t),s>=0){if(r.length>1)return r.splice(s,1),1;if(delete e[a],i)return 1;o=1}else{if(o)return 1;i++}}}else for(let r of e.entries())n=r[0],Se(r[1],t)?i++:e.delete(n);return i}W("add"),W("append"),W("search"),W("update"),W("remove"),W("clear"),W("export"),W("import"),q.prototype.searchCache=y,B(q.prototype),ce.prototype.add=function(e,t,i){if(c(e)&&(e=u(t=e,this.key)),t&&(e||0===e)){if(!i&&this.reg.has(e))return this.update(e,t);for(let s,o=0;o<this.field.length;o++){s=this.B[o];var n=this.index.get(this.field[o]);if("function"==typeof s){var r=s(t);r&&n.add(e,r,i,!0)}else(!(r=s.G)||r(t))&&(s.constructor===String?s=[""+s]:l(s)&&(s=[s]),$(t,s,this.D,0,n,e,s[0],i))}if(this.tag)for(n=0;n<this.A.length;n++){var s=this.A[n];r=this.tag.get(this.F[n]);let c=a();if("function"==typeof s){if(!(s=s(t)))continue}else{var o=s.G;if(o&&!o(t))continue;s.constructor===String&&(s=""+s),s=u(t,s)}if(r&&s){l(s)&&(s=[s]);for(let t,n,a=0;a<s.length;a++)if(t=s[a],!c[t]&&(c[t]=1,(o=r.get(t))?n=o:r.set(t,n=[]),!i||!n.includes(e))){if(n.length===2**31-1){if(o=new O(n),this.fastupdate)for(let e of this.reg.values())e.includes(n)&&(e[e.indexOf(n)]=o);r.set(t,n=o)}n.push(e),this.fastupdate&&((o=this.reg.get(e))?o.push(n):this.reg.set(e,[n]))}}}if(this.store&&(!i||!this.store.has(e))){let n;if(this.h){n=a();for(let e,r=0;r<this.h.length;r++){if(e=this.h[r],(i=e.G)&&!i(t))continue;let s;if("function"==typeof e){if(s=e(t),!s)continue;e=[e.O]}else if(l(e)||e.constructor===String){n[e]=t[e];continue}G(t,n,e,0,e[0],s)}}this.store.set(e,n||t)}this.worker&&(this.fastupdate||this.reg.add(e))}return this},te.prototype.or=function(){return Y(this,"or",J,arguments)},te.prototype.and=function(){return Y(this,"and",X,arguments)},te.prototype.xor=function(){return Y(this,"xor",Q,arguments)},te.prototype.not=function(){return Y(this,"not",Z,arguments)},(r=te.prototype).limit=function(e){if(this.await){const t=this;this.C.push(function(){return t.limit(e).result})}else if(this.result.length){const t=[];for(let i,n=0;n<this.result.length;n++)if(i=this.result[n]){if(!(i.length<=e)){t[n]=i.slice(0,e);break}if(t[n]=i,!(e-=i.length))break}this.result=t}return this},r.offset=function(e){if(this.await){const t=this;this.C.push(function(){return t.offset(e).result})}else if(this.result.length){const t=[];for(let i,n=0;n<this.result.length;n++)(i=this.result[n])&&(i.length<=e?e-=i.length:(t[n]=i.slice(e),e=0));this.result=t}return this},r.boost=function(e){if(this.await){const t=this;this.C.push(function(){return t.boost(e).result})}else this.h+=e;return this},r.resolve=function(e,t,i,n,r){let s=this.await?ie(this,!0):this.result;if(s.then){const o=this;return s.then(function(){return o.resolve(e,t,i,n,r)})}return s.length&&("object"==typeof e?(n=e.highlight||this.highlight,i=!!n||e.enrich,t=e.offset,e=e.limit):(n=n||this.highlight,i=!!n||i),s=r?i?le.call(this.index,s):s:V.call(this.index,s,e||100,t,i)),this.finalize(s,n)},r.finalize=function(e,t){if(e.then){const i=this;return e.then(function(e){return i.finalize(e,t)})}t&&e.length&&this.query&&(e=ee(this.query,e,this.index.index,this.field,t));const i=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",i&&i(e),e},a(),ce.prototype.search=function(e,t,i,n){i||(!t&&c(e)?(i=e,e=""):c(t)&&(i=t,t=0));let r=[];var s=[];let a,u,h,d,f,p,g,m,v=0,y=!0;if(i){i.constructor===Array&&(i={index:i}),e=i.query||e,a=i.pluck,u=i.merge,d=i.boost,p=a||i.field||(p=i.index)&&(p.index?null:p);var b=this.tag&&i.tag;h=i.suggest,y=!1!==i.resolve,f=i.cache,g=y&&this.store&&i.highlight;var S=!!g||y&&this.store&&i.enrich;t=i.limit||t;var _=i.offset||0;if(t||(t=y?100:0),b&&(!this.db||!n)){b.constructor!==Array&&(b=[b]);var C=[];for(let e,t=0;t<b.length;t++)if(e=b[t],e.field&&e.tag){var w=e.tag;if(w.constructor===Array)for(var E=0;E<w.length;E++)C.push(e.field,w[E]);else C.push(e.field,w)}else{w=Object.keys(e);for(let t,i,n=0;n<w.length;n++)if(t=w[n],i=e[t],i.constructor===Array)for(E=0;E<i.length;E++)C.push(t,i[E]);else C.push(t,i)}if(b=C,!e){if(s=[],C.length)for(b=0;b<C.length;b+=2){if(this.db){if(!(n=this.index.get(C[b])))continue;s.push(n=n.db.tag(C[b+1],t,_,S))}else n=ae.call(this,C[b],C[b+1],t,_,S);r.push(y?{field:C[b],tag:C[b+1],result:n}:[n])}if(s.length){const e=this;return Promise.all(s).then(function(t){for(let e=0;e<t.length;e++)y?r[e].result=t[e]:r[e]=t[e];return y?r:new te(r.length>1?ne(r,1,0,0,h,d):r[0],e)})}return y?r:new te(r.length>1?ne(r,1,0,0,h,d):r[0],this)}}y||a||!(p=p||this.field)||(l(p)?a=p:(p.constructor===Array&&1===p.length&&(p=p[0]),a=p.field||p.index)),p&&p.constructor!==Array&&(p=[p])}p||(p=this.field),C=(this.worker||this.db)&&!n&&[];for(let a,c,u,d=0;d<p.length;d++){if(c=p[d],this.db&&this.tag&&!this.B[d])continue;let k;if(l(c)||(k=c,c=k.field,e=k.query||e,t=o(k.limit,t),_=o(k.offset,_),h=o(k.suggest,h),g=y&&this.store&&o(k.highlight,g),S=!!g||y&&this.store&&o(k.enrich,S),f=o(k.cache,f)),n)a=n[d];else{E=(w=k||i||{}).enrich;var T=this.index.get(c);if(b&&(this.db&&(w.tag=b,w.field=p,m=T.db.support_tag_search),!m&&E&&(w.enrich=!1),m||(w.limit=0,w.offset=0)),a=f?T.searchCache(e,b&&!m?0:t,w):T.search(e,b&&!m?0:t,w),b&&!m&&(w.limit=t,w.offset=_),E&&(w.enrich=E),C){C[d]=a;continue}}if(u=(a=a.result||a)&&a.length,b&&u){if(w=[],E=0,this.db&&n){if(!m)for(T=p.length;T<n.length;T++){let e=n[T];if(e&&e.length)E++,w.push(e);else if(!h)return y?r:new te(r,this)}}else for(let e,t,i=0;i<b.length;i+=2){if(e=this.tag.get(b[i]),!e){if(h)continue;return y?r:new te(r,this)}if(t=(e=e&&e.get(b[i+1]))&&e.length)E++,w.push(e);else if(!h)return y?r:new te(r,this)}if(E){if(a=se(a,w,t,_,y),u=a.length,!u&&!h)return y?a:new te(a,this);E--}}if(u)s[v]=c,r.push(a),v++;else if(1===p.length)return y?r:new te(r,this)}if(C){if(this.db&&b&&b.length&&!m)for(S=0;S<b.length;S+=2){if(!(s=this.index.get(b[S]))){if(h)continue;return y?r:new te(r,this)}C.push(s.db.tag(b[S+1],t,_,!1))}const n=this;return Promise.all(C).then(function(r){return i&&(i.resolve=y),r.length&&(r=n.search(e,t,i,r)),r})}if(!v)return y?r:new te(r,this);if(a&&(!S||!this.store))return r=r[0],y?r:new te(r,this);for(C=[],_=0;_<s.length;_++){if(b=r[_],S&&b.length&&void 0===b[0].doc&&(this.db?C.push(b=this.index.get(this.field[0]).db.enrich(b)):b=le.call(this,b)),a)return y?g?ee(e,b,this.index,a,g):b:new te(b,this);r[_]={field:s[_],result:b}}if(S&&this.db&&C.length){const t=this;return Promise.all(C).then(function(i){for(let e=0;e<i.length;e++)r[e].result=i[e];return g&&(r=ee(e,r,t.index,a,g)),u?oe(r):r})}return g&&(r=ee(e,r,this.index,a,g)),u?oe(r):r},(r=ce.prototype).mount=function(e){let t=this.field;if(this.tag)for(let e,n=0;n<this.F.length;n++){e=this.F[n];var i=void 0;this.index.set(e,i=new Oe({},this.reg)),t===this.field&&(t=t.slice(0)),t.push(e),i.tag=this.tag.get(e)}i=[];const n={db:e.db,type:e.type,fastupdate:e.fastupdate};for(let r,s,o=0;o<t.length;o++){n.field=s=t[o],r=this.index.get(s);const a=new e.constructor(e.id,n);a.id=e.id,i[o]=a.mount(r),r.document=!0,o?r.bypass=!0:r.store=this.store}const r=this;return this.db=Promise.all(i).then(function(){r.db=!0})},r.commit=async function(){const e=[];for(const t of this.index.values())e.push(t.commit());await Promise.all(e),this.reg.clear()},r.destroy=function(){const e=[];for(const t of this.index.values())e.push(t.destroy());return Promise.all(e)},r.append=function(e,t){return this.add(e,t,!0)},r.update=function(e,t){return this.remove(e).add(e,t)},r.remove=function(e){for(var t of(c(e)&&(e=u(e,this.key)),this.index.values()))t.remove(e,!0);if(this.reg.has(e)){if(this.tag&&!this.fastupdate)for(let i of this.tag.values())for(let n of i){t=n[0];const r=n[1],s=r.indexOf(e);s>-1&&(r.length>1?r.splice(s,1):i.delete(t))}this.store&&this.store.delete(e),this.reg.delete(e)}return this.cache&&this.cache.remove(e),this},r.clear=function(){const e=[];for(const t of this.index.values()){const i=t.clear();i.then&&e.push(i)}if(this.tag)for(const e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),e.length?Promise.all(e):this},r.contain=function(e){return this.db?this.index.get(this.field[0]).db.has(e):this.reg.has(e)},r.cleanup=function(){for(const e of this.index.values())e.cleanup();return this},r.get=function(e){return this.db?this.index.get(this.field[0]).db.enrich(e).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(e)||null},r.set=function(e,t){return"object"==typeof e&&(e=u(t=e,this.key)),this.store.set(e,t),this},r.searchCache=y,r.export=function(e,t,i=0,n=0){if(i<this.field.length){const r=this.field[i];if((t=this.index.get(r).export(e,r,i,n=1))&&t.then){const n=this;return t.then(function(){return n.export(e,r,i+1)})}return this.export(e,r,i+1)}let r,s;switch(n){case 0:r="reg",s=me(this.reg),t=null;break;case 1:r="tag",s=this.tag&&pe(this.tag,this.reg.size),t=null;break;case 2:r="doc",s=this.store&&de(this.store),t=null;break;default:return}return ye.call(this,e,t,r,s||null,i,n)},r.import=function(e,t){var i=e.split(".");"json"===i[i.length-1]&&i.pop();const n=i.length>2?i[0]:"";if(i=i.length>2?i[2]:i[1],this.worker&&n)return this.index.get(n).import(e);if(t){if("string"==typeof t&&(t=JSON.parse(t)),n)return this.index.get(n).import(i,t);switch(i){case"reg":this.fastupdate=!1,this.reg=ve(t,this.reg);for(let e,t=0;t<this.field.length;t++)e=this.index.get(this.field[t]),e.fastupdate=!1,e.reg=this.reg;if(this.worker){t=[];for(const i of this.index.values())t.push(i.import(e));return Promise.all(t)}break;case"tag":this.tag=ge(t,this.tag);break;case"doc":this.store=fe(t,this.store)}}},B(ce.prototype),Oe.prototype.remove=function(e,t){const i=this.reg.size&&(this.fastupdate?this.reg.get(e):this.reg.has(e));if(i){if(this.fastupdate){for(let t,n,r=0;r<i.length;r++)if((t=i[r])&&(n=t.length))if(t[n-1]===e)t.pop();else{const i=t.indexOf(e);i>=0&&t.splice(i,1)}}else Se(this.map,e),this.depth&&Se(this.ctx,e);t||this.reg.delete(e)}return this.db&&(this.commit_task.push({del:e}),this.M&&Pe(this)),this.cache&&this.cache.remove(e),this};const _e={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};function Ce(e,t,i,n,r,s,o){let l,c;if(!(l=t[i])||o&&!l[o]){if(o?((t=l||(t[i]=a()))[o]=1,c=e.ctx,(l=c.get(o))?c=l:c.set(o,c=e.keystore?new P(e.keystore):new Map)):(c=e.map,t[i]=1),(l=c.get(i))?c=l:c.set(i,c=l=[]),s)for(let i,s=0;s<l.length;s++)if((i=l[s])&&i.includes(r)){if(s<=n)return;i.splice(i.indexOf(r),1),e.fastupdate&&(t=e.reg.get(r))&&t.splice(t.indexOf(i),1);break}if(c=c[n]||(c[n]=[]),c.push(r),c.length===2**31-1){if(t=new O(c),e.fastupdate)for(let i of e.reg.values())i.includes(c)&&(i[i.indexOf(c)]=t);l[n]=c=t}e.fastupdate&&((n=e.reg.get(r))?n.push(c):e.reg.set(r,[c]))}}function we(e,t,i,n,r){return i&&e>1?t+(n||0)<=e?i+(r||0):(e-1)/(t+(n||0))*(i+(r||0))+1|0:0}function Ee(e,t,i,n,r,s,o){let a=e.length,l=e;if(a>1)l=ne(e,t,i,n,r,s,o);else if(1===a)return o?V.call(null,e[0],i,n):new te(e[0],this);return o?l:new te(l,this)}function Te(e,t,i,n,r,s,o){return e=Re(this,e,t,i,n,r,s,o),this.db?e.then(function(e){return r?e||[]:new te(e,this)}):e&&e.length?r?V.call(this,e,i,n):new te(e,this):r?[]:new te([],this)}function ke(e,t,i,n){let r=[];if(e&&e.length){if(e.length<=n)return void t.push(e);for(let t,i=0;i<n;i++)(t=e[i])&&(r[i]=t);if(r.length)return void t.push(r)}if(!i)return r}function Re(e,t,i,n,r,s,o,a){let l;return i&&(l=e.bidirectional&&t>i)&&(l=i,i=t,t=l),e.db?e.db.get(t,i,n,r,s,o,a):e=i?(e=e.ctx.get(i))&&e.get(t):e.map.get(t)}function Oe(e,t){if(!this||this.constructor!==Oe)return new Oe(e);if(e){var i=l(e)?e:e.preset;i&&(e=Object.assign({},_e[i],e))}else e={};const n=!0===(i=e.context)?{depth:1}:i||{},r=l(e.encoder)?k[e.encoder]:e.encode||e.encoder||{};this.encoder=r.encode?r:"object"==typeof r?new m(r):{encode:r},this.resolution=e.resolution||9,this.tokenize=i=(i=e.tokenize)&&"default"!==i&&"exact"!==i&&i||"strict",this.depth="strict"===i&&n.depth||0,this.bidirectional=!1!==n.bidirectional,this.fastupdate=!!e.fastupdate,this.score=e.score||null,(i=e.keystore||0)&&(this.keystore=i),this.map=i?new P(i):new Map,this.ctx=i?new P(i):new Map,this.reg=t||(this.fastupdate?i?new P(i):new Map:i?new A(i):new Set),this.N=n.resolution||3,this.rtl=r.rtl||e.rtl||!1,this.cache=(i=e.cache||null)&&new b(i),this.resolve=!1!==e.resolve,(i=e.db)&&(this.db=this.mount(i)),this.M=!1!==e.commit,this.commit_task=[],this.commit_timer=null,this.priority=e.priority||4}function Pe(e){e.commit_timer||(e.commit_timer=setTimeout(function(){e.commit_timer=null,e.db.commit(e)},1))}Oe.prototype.add=function(e,t,i,n){if(t&&(e||0===e)){if(!n&&!i&&this.reg.has(e))return this.update(e,t);n=this.depth;const u=(t=this.encoder.encode(t,!n)).length;if(u){const h=a(),d=a(),f=this.resolution;for(let a=0;a<u;a++){let p=t[this.rtl?u-1-a:a];var r=p.length;if(r&&(n||!d[p])){var s=this.score?this.score(t,p,a,null,0):we(f,u,a),o="";switch(this.tokenize){case"tolerant":if(Ce(this,d,p,s,e,i),r>2){for(let t,n,a,l,c=1;c<r-1;c++)t=p.charAt(c),n=p.charAt(c+1),a=p.substring(0,c)+n,l=p.substring(c+2),Ce(this,d,o=a+t+l,s,e,i),Ce(this,d,o=a+l,s,e,i);Ce(this,d,p.substring(0,p.length-1),s,e,i)}break;case"full":if(r>2){for(let n,c=0;c<r;c++)for(s=r;s>c;s--){o=p.substring(c,s),n=this.rtl?r-1-c:c;var l=this.score?this.score(t,p,a,o,n):we(f,u,a,r,n);Ce(this,d,o,l,e,i)}break}case"bidirectional":case"reverse":if(r>1){for(l=r-1;l>0;l--){o=p[this.rtl?r-1-l:l]+o;var c=this.score?this.score(t,p,a,o,l):we(f,u,a,r,l);Ce(this,d,o,c,e,i)}o=""}case"forward":if(r>1){for(l=0;l<r;l++)Ce(this,d,o+=p[this.rtl?r-1-l:l],s,e,i);break}default:if(Ce(this,d,p,s,e,i),n&&u>1&&a<u-1)for(r=this.N,o=p,s=Math.min(n+1,this.rtl?a+1:u-a),l=1;l<s;l++){p=t[this.rtl?u-1-a-l:a+l];Ce(this,h,(c=this.bidirectional&&p>o)?o:p,this.score?this.score(t,o,a,p,l-1):we(r+(u/2>r?0:1),u,a,s-1,l-1),e,i,c?p:o)}}}}this.fastupdate||this.reg.add(e)}}return this.db&&(this.commit_task.push(i?{ins:e}:{del:e}),this.M&&Pe(this)),this},Oe.prototype.search=function(e,t,i){if(i||(t||"object"!=typeof e?"object"==typeof t&&(i=t,t=0):(i=e,e="")),i&&i.cache)return i.cache=!1,e=this.searchCache(e,t,i),i.cache=!0,e;let n,r,s,o,l,c,u,h,d=[],f=0;i&&(e=i.query||e,t=i.limit||t,f=i.offset||0,r=i.context,s=i.suggest,h=(o=i.resolve)&&i.enrich,c=i.boost,u=i.resolution,l=this.db&&i.tag),void 0===o&&(o=this.resolve),r=this.depth&&!1!==r;let p=this.encoder.encode(e,!r);if(n=p.length,t=t||(o?100:0),1===n)return Te.call(this,p[0],"",t,f,o,h,l);if(2===n&&r&&!s)return Te.call(this,p[1],p[0],t,f,o,h,l);let g,m=a(),v=0;if(r&&(g=p[0],v=1),u||0===u||(u=g?this.N:this.resolution),this.db){if(this.db.search&&!1!==(i=this.db.search(this,p,t,f,s,o,h,l)))return i;const e=this;return async function(){for(let t,i;v<n;v++){if((i=p[v])&&!m[i]){if(m[i]=1,t=await Re(e,i,g,0,0,!1,!1),t=ke(t,d,s,u)){d=t;break}g&&(s&&t&&d.length||(g=i))}s&&g&&v===n-1&&!d.length&&(u=e.resolution,g="",v=-1,m=a())}return Ee(d,u,t,f,s,c,o)}()}for(let e,t;v<n;v++){if((t=p[v])&&!m[t]){if(m[t]=1,e=Re(this,t,g,0,0,!1,!1),e=ke(e,d,s,u)){d=e;break}g&&(s&&e&&d.length||(g=t))}s&&g&&v===n-1&&!d.length&&(u=this.resolution,g="",v=-1,m=a())}return Ee(d,u,t,f,s,c,o)},(r=Oe.prototype).mount=function(e){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),e.mount(this)},r.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)},r.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()},r.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this},r.append=function(e,t){return this.add(e,t,!0)},r.contain=function(e){return this.db?this.db.has(e):this.reg.has(e)},r.update=function(e,t){const i=this,n=this.remove(e);return n&&n.then?n.then(()=>i.add(e,t)):this.add(e,t)},r.cleanup=function(){return this.fastupdate?(Se(this.map),this.depth&&Se(this.ctx),this):this},r.searchCache=y,r.export=function(e,t,i=0,n=0){let r,s;switch(n){case 0:r="reg",s=me(this.reg);break;case 1:r="cfg",s=null;break;case 2:r="map",s=de(this.map,this.reg.size);break;case 3:r="ctx",s=pe(this.ctx,this.reg.size);break;default:return}return ye.call(this,e,t,r,s,i,n)},r.import=function(e,t){if(t)switch("string"==typeof t&&(t=JSON.parse(t)),e=e.split("."),"json"===e[e.length-1]&&e.pop(),3===e.length&&e.shift(),e=e.length>1?e[1]:e[0],e){case"reg":this.fastupdate=!1,this.reg=ve(t,this.reg);break;case"map":this.map=fe(t,this.map);break;case"ctx":this.ctx=ge(t,this.ctx)}},r.serialize=function(e=!0){let t="",i="",n="";if(this.reg.size){let e;for(var r of this.reg.keys())e||(e=typeof r),t+=(t?",":"")+("string"===e?'"'+r+'"':r);t="index.reg=new Set(["+t+"]);",i=be(this.map,e),i="index.map=new Map(["+i+"]);";for(const t of this.ctx.entries()){r=t[0];let i=be(t[1],e);i="new Map(["+i+"])",i='["'+r+'",'+i+"]",n+=(n?",":"")+i}n="index.ctx=new Map(["+n+"]);"}return e?"function inject(index){"+t+i+n+"}":t+i+n},B(Oe.prototype);const Ae="undefined"!=typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),xe=["map","ctx","tag","reg","cfg"],Ne=a();function Ie(e,t={}){if(!this||this.constructor!==Ie)return new Ie(e,t);"object"==typeof e&&(t=e,e=e.name),e||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(e?":"+e.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=t.field?t.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=t.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}function Me(e,t,i){const n=e.value;let r,s=0;for(let e,o=0;o<n.length;o++){if(e=i?n:n[o]){for(let i,s,a=0;a<t.length;a++)if(s=t[a],i=e.indexOf(s),i>=0){if(r=1,!(e.length>1)){n[o]=[];break}e.splice(i,1)}s+=e.length}if(i)break}s?r&&e.update(n):e.delete(),e.continue()}function Le(e,t){return new Promise((i,n)=>{e.onsuccess=e.oncomplete=function(){t&&t(this.result),t=null,i(this.result)},e.onerror=e.onblocked=n,e=null})}(r=Ie.prototype).mount=function(e){return e.index?e.mount(this):(e.db=this,this.open())},r.open=function(){if(this.db)return this.db;let e=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),Ne[e.id]||(Ne[e.id]=[]),Ne[e.id].push(e.field);const t=Ae.open(e.id,1);return t.onupgradeneeded=function(){const t=e.db=this.result;for(let i,n=0;n<xe.length;n++){i=xe[n];for(let n,r=0;r<Ne[e.id].length;r++)n=Ne[e.id][r],t.objectStoreNames.contains(i+("reg"!==i&&n?":"+n:""))||t.createObjectStore(i+("reg"!==i&&n?":"+n:""))}},e.db=Le(t,function(t){e.db=t,e.db.onversionchange=function(){e.close()}})},r.close=function(){this.db&&this.db.close(),this.db=null},r.destroy=function(){return Le(Ae.deleteDatabase(this.id))},r.clear=function(){const e=[];for(let t,i=0;i<xe.length;i++){t=xe[i];for(let i,n=0;n<Ne[this.id].length;n++)i=Ne[this.id][n],e.push(t+("reg"!==t&&i?":"+i:""))}const t=this.db.transaction(e,"readwrite");for(let i=0;i<e.length;i++)t.objectStore(e[i]).clear();return Le(t)},r.get=function(e,t,i=0,n=0,r=!0,s=!1){e=this.db.transaction((t?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((t?"ctx":"map")+(this.field?":"+this.field:"")).get(t?t+":"+e:e);const o=this;return Le(e).then(function(e){let t=[];if(!e||!e.length)return t;if(r){if(!i&&!n&&1===e.length)return e[0];for(let r,s=0;s<e.length;s++)if((r=e[s])&&r.length){if(n>=r.length){n-=r.length;continue}const e=i?n+Math.min(r.length-n,i):r.length;for(let i=n;i<e;i++)t.push(r[i]);if(n=0,t.length===i)break}return s?o.enrich(t):t}return e})},r.tag=function(e,t=0,i=0,n=!1){e=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(e);const r=this;return Le(e).then(function(e){return!e||!e.length||i>=e.length?[]:t||i?(e=e.slice(i,i+t),n?r.enrich(e):e):e})},r.enrich=function(e){"object"!=typeof e&&(e=[e]);const t=this.db.transaction("reg","readonly").objectStore("reg"),i=[];for(let n=0;n<e.length;n++)i[n]=Le(t.get(e[n]));return Promise.all(i).then(function(t){for(let i=0;i<t.length;i++)t[i]={id:e[i],doc:t[i]?JSON.parse(t[i]):null};return t})},r.has=function(e){return Le(e=this.db.transaction("reg","readonly").objectStore("reg").getKey(e)).then(function(e){return!!e})},r.search=null,r.info=function(){},r.transaction=function(e,t,i){e+="reg"!==e&&this.field?":"+this.field:"";let n=this.h[e+":"+t];if(n)return i.call(this,n);let r=this.db.transaction(e,t);this.h[e+":"+t]=n=r.objectStore(e);const s=i.call(this,n);return this.h[e+":"+t]=null,Le(r).finally(function(){return s})},r.commit=async function(e){let t=e.commit_task,i=[];e.commit_task=[];for(let e,n=0;n<t.length;n++)e=t[n],e.del&&i.push(e.del);i.length&&await this.remove(i),e.reg.size&&(await this.transaction("map","readwrite",function(t){for(const i of e.map){const e=i[0],n=i[1];n.length&&(t.get(e).onsuccess=function(){let i=this.result;var r;if(i&&i.length){const e=Math.max(i.length,n.length);for(let t,s,o=0;o<e;o++)if((s=n[o])&&s.length){if((t=i[o])&&t.length)for(r=0;r<s.length;r++)t.push(s[r]);else i[o]=s;r=1}}else i=n,r=1;r&&t.put(i,e)})}}),await this.transaction("ctx","readwrite",function(t){for(const i of e.ctx){const e=i[0],n=i[1];for(const i of n){const n=i[0],r=i[1];r.length&&(t.get(e+":"+n).onsuccess=function(){let i=this.result;var s;if(i&&i.length){const e=Math.max(i.length,r.length);for(let t,n,o=0;o<e;o++)if((n=r[o])&&n.length){if((t=i[o])&&t.length)for(s=0;s<n.length;s++)t.push(n[s]);else i[o]=n;s=1}}else i=r,s=1;s&&t.put(i,e+":"+n)})}}}),e.store?await this.transaction("reg","readwrite",function(t){for(const i of e.store){const e=i[0],n=i[1];t.put("object"==typeof n?JSON.stringify(n):1,e)}}):e.bypass||await this.transaction("reg","readwrite",function(t){for(const i of e.reg.keys())t.put(1,i)}),e.tag&&await this.transaction("tag","readwrite",function(t){for(const i of e.tag){const e=i[0],n=i[1];n.length&&(t.get(e).onsuccess=function(){let i=this.result;i=i&&i.length?i.concat(n):n,t.put(i,e)})}}),e.map.clear(),e.ctx.clear(),e.tag&&e.tag.clear(),e.store&&e.store.clear(),e.document||e.reg.clear())},r.remove=function(e){return"object"!=typeof e&&(e=[e]),Promise.all([this.transaction("map","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Me(t,e)}}),this.transaction("ctx","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Me(t,e)}}),this.transaction("tag","readwrite",function(t){t.openCursor().onsuccess=function(){const t=this.result;t&&Me(t,e,!0)}}),this.transaction("reg","readwrite",function(t){for(let i=0;i<e.length;i++)t.delete(e[i])})])};const De={Index:Oe,Charset:k,Encoder:m,Document:ce,Worker:q,Resolver:te,IndexedDB:Ie,Language:{}},je=void 0!==n?n:"undefined"!=typeof global?global:n;let Fe;(Fe=je.define)&&Fe.amd?Fe([],function(){return De}):"object"==typeof je.exports?je.exports=De:je.FlexSearch=De}(this||self)},2170(e,t,i){e.exports=i(9896).constants||i(9140)},2017(e,t,i){try{var n=i(9023);if("function"!=typeof n.inherits)throw"";e.exports=n.inherits}catch(t){e.exports=i(6698)}},6698(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}}},2880(e,t,i){let n,r={};r.__wbindgen_placeholder__=e.exports;const{TextDecoder:s,TextEncoder:o}=i(9023);let a=null;function l(){return null!==a&&0!==a.byteLength||(a=new Uint8Array(n.memory.buffer)),a}let c=new s("utf-8",{ignoreBOM:!0,fatal:!0});function u(e,t){return function(e,t){return c.decode(l().subarray(e,e+t))}(e>>>=0,t)}function h(e){const t=typeof e;if("number"==t||"boolean"==t||null==e)return`${e}`;if("string"==t)return`"${e}"`;if("symbol"==t){const t=e.description;return null==t?"Symbol":`Symbol(${t})`}if("function"==t){const t=e.name;return"string"==typeof t&&t.length>0?`Function(${t})`:"Function"}if(Array.isArray(e)){const t=e.length;let i="[";t>0&&(i+=h(e[0]));for(let n=1;n<t;n++)i+=", "+h(e[n]);return i+="]",i}const i=/\[object ([^\]]+)\]/.exec(toString.call(e));let n;if(!(i&&i.length>1))return toString.call(e);if(n=i[1],"Object"==n)try{return"Object("+JSON.stringify(e)+")"}catch(e){return"Object"}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:n}c.decode();let d=0;const f=new o("utf-8"),p="function"==typeof f.encodeInto?function(e,t){return f.encodeInto(e,t)}:function(e,t){const i=f.encode(e);return t.set(i),{read:e.length,written:i.length}};function g(e,t,i){if(void 0===i){const i=f.encode(e),n=t(i.length,1)>>>0;return l().subarray(n,n+i.length).set(i),d=i.length,n}let n=e.length,r=t(n,1)>>>0;const s=l();let o=0;for(;o<n;o++){const t=e.charCodeAt(o);if(t>127)break;s[r+o]=t}if(o!==n){0!==o&&(e=e.slice(o)),r=i(r,n,n=o+3*e.length,1)>>>0;const t=l().subarray(r+o,r+n);o+=p(e,t).written,r=i(r,n,o,1)>>>0}return d=o,r}let m=null;function v(){return(null===m||!0===m.buffer.detached||void 0===m.buffer.detached&&m.buffer!==n.memory.buffer)&&(m=new DataView(n.memory.buffer)),m}function y(e){return null==e}function b(e,t){e>>>=0;const i=v(),r=[];for(let s=e;s<e+4*t;s+=4)r.push(n.__wbindgen_export_2.get(i.getUint32(s,!0)));return n.__externref_drop_slice(e,t),r}function S(e){const t=n.__wbindgen_export_2.get(e);return n.__externref_table_dealloc(e),t}e.exports.cut=function(e,t){const i=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),r=d,s=n.cut(i,r,y(t)?16777215:t?1:0);var o=b(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},e.exports.cut_all=function(e){const t=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),i=d,r=n.cut_all(t,i);var s=b(r[0],r[1]).slice();return n.__wbindgen_free(r[0],4*r[1],4),s},e.exports.cut_for_search=function(e,t){const i=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),r=d,s=n.cut_for_search(i,r,y(t)?16777215:t?1:0);var o=b(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},e.exports.tokenize=function(e,t,i){const r=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),s=d,o=g(t,n.__wbindgen_malloc,n.__wbindgen_realloc),a=d,l=n.tokenize(r,s,o,a,y(i)?16777215:i?1:0);if(l[3])throw S(l[2]);var c=b(l[0],l[1]).slice();return n.__wbindgen_free(l[0],4*l[1],4),c},e.exports.add_word=function(e,t,i){const r=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),s=d;var o=y(i)?0:g(i,n.__wbindgen_malloc,n.__wbindgen_realloc),a=d;return n.add_word(r,s,y(t)?4294967297:t>>>0,o,a)>>>0},e.exports.tag=function(e,t){const i=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),r=d,s=n.tag(i,r,y(t)?16777215:t?1:0);var o=b(s[0],s[1]).slice();return n.__wbindgen_free(s[0],4*s[1],4),o},e.exports.with_dict=function(e){const t=g(e,n.__wbindgen_malloc,n.__wbindgen_realloc),i=d,r=n.with_dict(t,i);if(r[1])throw S(r[0])},e.exports.__wbg_Error_0497d5bdba9362e5=function(e,t){return Error(u(e,t))},e.exports.__wbg_new_07b483f72211fd66=function(){return new Object},e.exports.__wbg_set_3f1d0b984ed272ed=function(e,t,i){e[t]=i},e.exports.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},e.exports.__wbindgen_debug_string=function(e,t){const i=g(h(t),n.__wbindgen_malloc,n.__wbindgen_realloc),r=d;v().setInt32(e+4,r,!0),v().setInt32(e+0,i,!0)},e.exports.__wbindgen_init_externref_table=function(){const e=n.__wbindgen_export_2,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},e.exports.__wbindgen_number_new=function(e){return e},e.exports.__wbindgen_string_new=function(e,t){return u(e,t)},e.exports.__wbindgen_throw=function(e,t){throw new Error(u(e,t))};const _=i(6928).join(__dirname,"jieba_rs_wasm_bg.wasm"),C=i(9896).readFileSync(_),w=new WebAssembly.Module(C),E=new WebAssembly.Instance(w,r);n=E.exports,e.exports.__wasm=n,n.__wbindgen_start()},2028(e){var t="[object Symbol]",i=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,n=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,r="\\ud800-\\udfff",s="\\u0300-\\u036f\\ufe20-\\ufe23",o="\\u20d0-\\u20f0",a="\\u2700-\\u27bf",l="a-z\\xdf-\\xf6\\xf8-\\xff",c="A-Z\\xc0-\\xd6\\xd8-\\xde",u="\\ufe0e\\ufe0f",h="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",d="['’]",f="["+r+"]",p="["+h+"]",g="["+s+o+"]",m="\\d+",v="["+a+"]",y="["+l+"]",b="[^"+r+h+m+a+l+c+"]",S="\\ud83c[\\udffb-\\udfff]",_="[^"+r+"]",C="(?:\\ud83c[\\udde6-\\uddff]){2}",w="[\\ud800-\\udbff][\\udc00-\\udfff]",E="["+c+"]",T="\\u200d",k="(?:"+y+"|"+b+")",R="(?:"+E+"|"+b+")",O="(?:['’](?:d|ll|m|re|s|t|ve))?",P="(?:['’](?:D|LL|M|RE|S|T|VE))?",A="(?:"+g+"|"+S+")"+"?",x="["+u+"]?",N=x+A+("(?:"+T+"(?:"+[_,C,w].join("|")+")"+x+A+")*"),I="(?:"+[v,C,w].join("|")+")"+N,M="(?:"+[_+g+"?",g,C,w,f].join("|")+")",L=RegExp(d,"g"),D=RegExp(g,"g"),j=RegExp(S+"(?="+S+")|"+M+N,"g"),F=RegExp([E+"?"+y+"+"+O+"(?="+[p,E,"$"].join("|")+")",R+"+"+P+"(?="+[p,E+k,"$"].join("|")+")",E+"?"+k+"+"+O,E+"+"+P,m,I].join("|"),"g"),B=RegExp("["+T+r+s+o+u+"]"),U=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,z="object"==typeof global&&global&&global.Object===Object&&global,H="object"==typeof self&&self&&self.Object===Object&&self,q=z||H||Function("return this")();var W,G=(W={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"ss"},function(e){return null==W?void 0:W[e]});function $(e){return B.test(e)}function V(e){return $(e)?function(e){return e.match(j)||[]}(e):function(e){return e.split("")}(e)}var Y=Object.prototype.toString,K=q.Symbol,J=K?K.prototype:void 0,X=J?J.toString:void 0;function Q(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&Y.call(e)==t}(e))return X?X.call(e):"";var i=e+"";return"0"==i&&1/e==-1/0?"-0":i}function Z(e,t,i){var n=e.length;return i=void 0===i?n:i,!t&&i>=n?e:function(e,t,i){var n=-1,r=e.length;t<0&&(t=-t>r?0:r+t),(i=i>r?r:i)<0&&(i+=r),r=t>i?0:i-t>>>0,t>>>=0;for(var s=Array(r);++n<r;)s[n]=e[n+t];return s}(e,t,i)}function ee(e){return null==e?"":Q(e)}var te,ie=(te=function(e,t,i){return t=t.toLowerCase(),e+(i?re(ee(t).toLowerCase()):t)},function(e){return function(e,t,i,n){var r=-1,s=e?e.length:0;for(n&&s&&(i=e[++r]);++r<s;)i=t(i,e[r],r,e);return i}(function(e,t,n){return e=ee(e),void 0===(t=n?void 0:t)?function(e){return U.test(e)}(e)?function(e){return e.match(F)||[]}(e):function(e){return e.match(i)||[]}(e):e.match(t)||[]}(function(e){return(e=ee(e))&&e.replace(n,G).replace(D,"")}(e).replace(L,"")),te,"")});var ne,re=(ne="toUpperCase",function(e){var t=$(e=ee(e))?V(e):void 0,i=t?t[0]:e.charAt(0),n=t?Z(t,1).join(""):e.slice(1);return i[ne]()+n});e.exports=ie},9505(e,t,i){var n=i(6928),r=i(9896),s=parseInt("0777",8);function o(e,t,i,a){"function"==typeof t?(i=t,t={}):t&&"object"==typeof t||(t={mode:t});var l=t.mode,c=t.fs||r;void 0===l&&(l=s&~process.umask()),a||(a=null);var u=i||function(){};e=n.resolve(e),c.mkdir(e,l,function(i){if(!i)return u(null,a=a||e);if("ENOENT"===i.code)o(n.dirname(e),t,function(i,n){i?u(i,n):o(e,t,u,n)});else c.stat(e,function(e,t){e||!t.isDirectory()?u(i,a):u(null,a)})})}e.exports=o.mkdirp=o.mkdirP=o,o.sync=function e(t,i,o){i&&"object"==typeof i||(i={mode:i});var a=i.mode,l=i.fs||r;void 0===a&&(a=s&~process.umask()),o||(o=null),t=n.resolve(t);try{l.mkdirSync(t,a),o=o||t}catch(r){if("ENOENT"===r.code)o=e(n.dirname(t),i,o),e(t,i,o);else{var c;try{c=l.statSync(t)}catch(e){throw r}if(!c.isDirectory())throw r}}return o}},3519(e,t,i){var n=i(6587);function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function s(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},i=e.name||"Function wrapped with `once`";return t.onceError=i+" shouldn't be called more than once",t.called=!1,t}e.exports=n(r),e.exports.strict=n(s),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return s(this)},configurable:!0})})},5407(e,t,i){"use strict";var n=i(2549);e.exports=t=n.descriptor=n.Root.fromJSON(i(3951)).lookup(".google.protobuf");var r=n.Namespace,s=n.Root,o=n.Enum,a=n.Type,l=n.Field,c=n.MapField,u=n.OneOf,h=n.Service,d=n.Method;function f(e,i,n){var c=t.FileDescriptorProto.create({name:e.filename||(e.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});!function(e,i){if(!e)return;if("proto2"===e||"proto3"===e)i.syntax=e;else{if(i.syntax="editions","2023"!==e)throw new Error("Unsupported edition "+e);i.edition=t.Edition.EDITION_2023}}(n,c),e instanceof s||(c.package=e.fullName.substring(1));for(var u,d=0;d<e.nestedArray.length;++d)(u=e._nestedArray[d])instanceof a?c.messageType.push(u.toDescriptor(n)):u instanceof o?c.enumType.push(u.toDescriptor()):u instanceof l?c.extension.push(u.toDescriptor(n)):u instanceof h?c.service.push(u.toDescriptor()):u instanceof r&&f(u,i,n);c.options=E(e.options,t.FileOptions),c.messageType.length+c.enumType.length+c.extension.length+c.service.length&&i.push(c)}s.fromDescriptor=function(e){"number"==typeof e.length&&(e=t.FileDescriptorSet.decode(e));var i=new s;if(e.file)for(var n,r,c,u=0;u<e.file.length;++u){r=i,(n=e.file[u]).package&&n.package.length&&(r=i.define(n.package));var d=R(n);if(n.name&&n.name.length&&i.files.push(r.filename=n.name),n.messageType)for(c=0;c<n.messageType.length;++c)r.add(a.fromDescriptor(n.messageType[c],d));if(n.enumType)for(c=0;c<n.enumType.length;++c)r.add(o.fromDescriptor(n.enumType[c],d));if(n.extension)for(c=0;c<n.extension.length;++c)r.add(l.fromDescriptor(n.extension[c],d));if(n.service)for(c=0;c<n.service.length;++c)r.add(h.fromDescriptor(n.service[c],d));var f=C(n.options,t.FileOptions);if(f){var p=Object.keys(f);for(c=0;c<p.length;++c)r.setOption(p[c],f[p[c]])}}return i.resolveAll()},s.prototype.toDescriptor=function(e){var i=t.FileDescriptorSet.create();return f(this,i.file,e),i};var p=0;a.fromDescriptor=function(e,i,n){"number"==typeof e.length&&(e=t.DescriptorProto.decode(e));var r,s=new a(e.name.length?e.name:"Type"+p++,C(e.options,t.MessageOptions));if(n||(s._edition=i),e.oneofDecl)for(r=0;r<e.oneofDecl.length;++r)s.add(u.fromDescriptor(e.oneofDecl[r]));if(e.field)for(r=0;r<e.field.length;++r){var c=l.fromDescriptor(e.field[r],i,!0);s.add(c),e.field[r].hasOwnProperty("oneofIndex")&&s.oneofsArray[e.field[r].oneofIndex].add(c)}if(e.extension)for(r=0;r<e.extension.length;++r)s.add(l.fromDescriptor(e.extension[r],i,!0));if(e.nestedType)for(r=0;r<e.nestedType.length;++r)s.add(a.fromDescriptor(e.nestedType[r],i,!0)),e.nestedType[r].options&&e.nestedType[r].options.mapEntry&&s.setOption("map_entry",!0);if(e.enumType)for(r=0;r<e.enumType.length;++r)s.add(o.fromDescriptor(e.enumType[r],i,!0));if(e.extensionRange&&e.extensionRange.length)for(s.extensions=[],r=0;r<e.extensionRange.length;++r)s.extensions.push([e.extensionRange[r].start,e.extensionRange[r].end]);if(e.reservedRange&&e.reservedRange.length||e.reservedName&&e.reservedName.length){if(s.reserved=[],e.reservedRange)for(r=0;r<e.reservedRange.length;++r)s.reserved.push([e.reservedRange[r].start,e.reservedRange[r].end]);if(e.reservedName)for(r=0;r<e.reservedName.length;++r)s.reserved.push(e.reservedName[r])}return s},a.prototype.toDescriptor=function(e){var i,n=t.DescriptorProto.create({name:this.name});for(i=0;i<this.fieldsArray.length;++i){var r;if(n.field.push(r=this._fieldsArray[i].toDescriptor(e)),this._fieldsArray[i]instanceof c){var s=S(this._fieldsArray[i].keyType,this._fieldsArray[i].resolvedKeyType,!1),u=S(this._fieldsArray[i].type,this._fieldsArray[i].resolvedType,!1),h=11===u||14===u?this._fieldsArray[i].resolvedType&&T(this.parent,this._fieldsArray[i].resolvedType)||this._fieldsArray[i].type:void 0;n.nestedType.push(t.DescriptorProto.create({name:r.typeName,field:[t.FieldDescriptorProto.create({name:"key",number:1,label:1,type:s}),t.FieldDescriptorProto.create({name:"value",number:2,label:1,type:u,typeName:h})],options:t.MessageOptions.create({mapEntry:!0})}))}}for(i=0;i<this.oneofsArray.length;++i)n.oneofDecl.push(this._oneofsArray[i].toDescriptor());for(i=0;i<this.nestedArray.length;++i)this._nestedArray[i]instanceof l?n.field.push(this._nestedArray[i].toDescriptor(e)):this._nestedArray[i]instanceof a?n.nestedType.push(this._nestedArray[i].toDescriptor(e)):this._nestedArray[i]instanceof o&&n.enumType.push(this._nestedArray[i].toDescriptor());if(this.extensions)for(i=0;i<this.extensions.length;++i)n.extensionRange.push(t.DescriptorProto.ExtensionRange.create({start:this.extensions[i][0],end:this.extensions[i][1]}));if(this.reserved)for(i=0;i<this.reserved.length;++i)"string"==typeof this.reserved[i]?n.reservedName.push(this.reserved[i]):n.reservedRange.push(t.DescriptorProto.ReservedRange.create({start:this.reserved[i][0],end:this.reserved[i][1]}));return n.options=E(this.options,t.MessageOptions),n};var g=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;l.fromDescriptor=function(e,i,n){if("number"==typeof e.length&&(e=t.DescriptorProto.decode(e)),"number"!=typeof e.number)throw Error("missing field id");var r,s;switch(r=e.typeName&&e.typeName.length?e.typeName:function(e){switch(e){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+e)}(e.type),e.label){case 1:s=void 0;break;case 2:s="required";break;case 3:s="repeated";break;default:throw Error("illegal label: "+e.label)}var o=e.extendee;void 0!==e.extendee&&(o=o.length?o:void 0);var a=new l(e.name.length?e.name:"field"+e.number,e.number,r,s,o);if(n||(a._edition=i),a.options=C(e.options,t.FieldOptions),e.proto3_optional&&(a.options.proto3_optional=!0),e.defaultValue&&e.defaultValue.length){var c=e.defaultValue;switch(c){case"true":case"TRUE":c=!0;break;case"false":case"FALSE":c=!1;break;default:g.exec(c)&&(c=parseInt(c))}a.setOption("default",c)}return function(e){switch(e){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}(e.type)&&("proto3"===i?e.options&&!e.options.packed&&a.setOption("packed",!1):i&&"proto2"!==i||!e.options||!e.options.packed||a.setOption("packed",!0)),a},l.prototype.toDescriptor=function(e){var i=t.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)i.type=11,i.typeName=n.util.ucFirst(this.name),i.label=3;else{switch(i.type=S(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:i.typeName=this.resolvedType?T(this.parent,this.resolvedType):this.type}"repeated"===this.rule?i.label=3:this.required&&"proto2"===e?i.label=2:i.label=1}if(i.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf&&(i.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof");return this.options&&(i.options=E(this.options,t.FieldOptions),null!=this.options.default&&(i.defaultValue=String(this.options.default)),this.options.proto3_optional&&(i.proto3_optional=!0)),"proto3"===e?this.packed||((i.options||(i.options=t.FieldOptions.create())).packed=!1):e&&"proto2"!==e||!this.packed||((i.options||(i.options=t.FieldOptions.create())).packed=!0),i};var m=0;o.fromDescriptor=function(e,i,n){"number"==typeof e.length&&(e=t.EnumDescriptorProto.decode(e));var r={};if(e.value)for(var s=0;s<e.value.length;++s){var a=e.value[s].name,l=e.value[s].number||0;r[a&&a.length?a:"NAME"+l]=l}var c=new o(e.name&&e.name.length?e.name:"Enum"+m++,r,C(e.options,t.EnumOptions));return n||(c._edition=i),c},o.prototype.toDescriptor=function(){for(var e=[],i=0,n=Object.keys(this.values);i<n.length;++i)e.push(t.EnumValueDescriptorProto.create({name:n[i],number:this.values[n[i]]}));return t.EnumDescriptorProto.create({name:this.name,value:e,options:E(this.options,t.EnumOptions)})};var v=0;u.fromDescriptor=function(e){return"number"==typeof e.length&&(e=t.OneofDescriptorProto.decode(e)),new u(e.name&&e.name.length?e.name:"oneof"+v++)},u.prototype.toDescriptor=function(){return t.OneofDescriptorProto.create({name:this.name})};var y=0;h.fromDescriptor=function(e,i,n){"number"==typeof e.length&&(e=t.ServiceDescriptorProto.decode(e));var r=new h(e.name&&e.name.length?e.name:"Service"+y++,C(e.options,t.ServiceOptions));if(n||(r._edition=i),e.method)for(var s=0;s<e.method.length;++s)r.add(d.fromDescriptor(e.method[s]));return r},h.prototype.toDescriptor=function(){for(var e=[],i=0;i<this.methodsArray.length;++i)e.push(this._methodsArray[i].toDescriptor());return t.ServiceDescriptorProto.create({name:this.name,method:e,options:E(this.options,t.ServiceOptions)})};var b=0;function S(e,t,i){switch(e){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(t instanceof o)return 14;if(t instanceof a)return i?10:11;throw Error("illegal type: "+e)}function _(e,t){for(var i,n,r={},s=0;s<t.fieldsArray.length;++s)if("uninterpretedOption"!==(n=(i=t._fieldsArray[s]).name)&&Object.prototype.hasOwnProperty.call(e,n)){var l=k(n);i.resolvedType instanceof a?r[l]=_(e[n],i.resolvedType):i.resolvedType instanceof o?r[l]=i.resolvedType.valuesById[e[n]]:r[l]=e[n]}return r}function C(e,t){if(e)return _(t.toObject(e),t)}function w(e,t){for(var i={},r=Object.keys(e),s=0;s<r.length;++s){var o=r[s],l=n.util.camelCase(o);if(Object.prototype.hasOwnProperty.call(t.fields,l)){var c=t.fields[l];c.resolvedType instanceof a?i[l]=w(e[o],c.resolvedType):i[l]=e[o],c.repeated&&!Array.isArray(i[l])&&(i[l]=[i[l]])}}return i}function E(e,t){if(e)return t.fromObject(w(e,t))}function T(e,t){var i=e.fullName.split("."),n=t.fullName.split("."),o=0,a=0,l=n.length-1;if(!(e instanceof s)&&t instanceof r)for(;o<i.length&&a<l&&i[o]===n[a];){var c=t.lookup(i[o++],!0);if(null!==c&&c!==t)break;++a}else for(;o<i.length&&a<l&&i[o]===n[a];++o,++a);return n.slice(a).join(".")}function k(e){return e.substring(0,1)+e.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,t){return"_"+t.toLowerCase()})}function R(e){if("editions"===e.syntax){if(e.edition===t.Edition.EDITION_2023)return"2023";throw new Error("Unsupported edition "+e.edition)}return"proto3"===e.syntax?"proto3":"proto2"}d.fromDescriptor=function(e){return"number"==typeof e.length&&(e=t.MethodDescriptorProto.decode(e)),new d(e.name&&e.name.length?e.name:"Method"+b++,"rpc",e.inputType,e.outputType,Boolean(e.clientStreaming),Boolean(e.serverStreaming),C(e.options,t.MethodOptions))},d.prototype.toDescriptor=function(){return t.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:E(this.options,t.MethodOptions)})}},2549(e,t,i){"use strict";e.exports=i(9100)},5095(e){"use strict";e.exports=n;var t,i=/\/|\./;function n(e,t){i.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:t}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},744(e,t,i){"use strict";var n=t,r=i(5643),s=i(3262);function o(e,t,i,n){var s=!1;if(t.resolvedType)if(t.resolvedType instanceof r){e("switch(d%s){",n);for(var o=t.resolvedType.values,a=Object.keys(o),l=0;l<a.length;++l)o[a[l]]!==t.typeDefault||s||(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),t.repeated||e("break"),s=!0),e("case%j:",a[l])("case %i:",o[a[l]])("m%s=%j",n,o[a[l]])("break");e("}")}else e('if(typeof d%s!=="object")',n)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",n,i,n);else{var c=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":c=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,c)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,c?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function a(e,t,i,n){if(t.resolvedType)t.resolvedType instanceof r?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,i,n,n,i,n,n):e("d%s=types[%i].toObject(m%s,o)",n,i,n);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,s?"true":"",n);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}n.fromObject=function(e){var t=e.fieldsArray,i=s.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return i("return new this.ctor");i("var m=new this.ctor");for(var n=0;n<t.length;++n){var a=t[n].resolve(),l=s.safeProp(a.name);a.map?(i("if(d%s){",l)('if(typeof d%s!=="object")',l)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",l)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",l),o(i,a,n,l+"[ks[i]]")("}")("}")):a.repeated?(i("if(d%s){",l)("if(!Array.isArray(d%s))",l)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",l)("for(var i=0;i<d%s.length;++i){",l),o(i,a,n,l+"[i]")("}")("}")):(a.resolvedType instanceof r||i("if(d%s!=null){",l),o(i,a,n,l),a.resolvedType instanceof r||i("}"))}return i("return m")},n.toObject=function(e){var t=e.fieldsArray.slice().sort(s.compareFieldsById);if(!t.length)return s.codegen()("return {}");for(var i=s.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),n=[],o=[],l=[],c=0;c<t.length;++c)t[c].partOf||(t[c].resolve().repeated?n:t[c].map?o:l).push(t[c]);if(n.length){for(i("if(o.arrays||o.defaults){"),c=0;c<n.length;++c)i("d%s=[]",s.safeProp(n[c].name));i("}")}if(o.length){for(i("if(o.objects||o.defaults){"),c=0;c<o.length;++c)i("d%s={}",s.safeProp(o[c].name));i("}")}if(l.length){for(i("if(o.defaults){"),c=0;c<l.length;++c){var u=l[c],h=s.safeProp(u.name);if(u.resolvedType instanceof r)i("d%s=o.enums===String?%j:%j",h,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)i("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",h)("}else")("d%s=o.longs===String?%j:%i",h,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var d="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";i("if(o.bytes===String)d%s=%j",h,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",h,d)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",h,h)("}")}else i("d%s=%j",h,u.typeDefault)}i("}")}var f=!1;for(c=0;c<t.length;++c){u=t[c];var p=e._fieldsArray.indexOf(u);h=s.safeProp(u.name);u.map?(f||(f=!0,i("var ks2")),i("if(m%s&&(ks2=Object.keys(m%s)).length){",h,h)("d%s={}",h)("for(var j=0;j<ks2.length;++j){"),a(i,u,p,h+"[ks2[j]]")("}")):u.repeated?(i("if(m%s&&m%s.length){",h,h)("d%s=[]",h)("for(var j=0;j<m%s.length;++j){",h),a(i,u,p,h+"[j]")("}")):(i("if(m%s!=null&&m.hasOwnProperty(%j)){",h,u.name),a(i,u,p,h),u.partOf&&i("if(o.oneofs)")("d%s=%j",s.safeProp(u.partOf.name),u.name)),i("}")}return i("return d")}},7728(e,t,i){"use strict";e.exports=function(e){for(var t=s.codegen(["r","l","e"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter(function(e){return e.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),i=0;i<e.fieldsArray.length;++i){var a=e._fieldsArray[i].resolve(),l=a.resolvedType instanceof n?"int32":a.type,c="m"+s.safeProp(a.name);t("case %i: {",a.id),a.map?(t("if(%s===util.emptyObject)",c)("%s={}",c)("var c2 = r.uint32()+r.pos"),void 0!==r.defaults[a.keyType]?t("k=%j",r.defaults[a.keyType]):t("k=null"),void 0!==r.defaults[l]?t("value=%j",r.defaults[l]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===r.basic[l]?t("value=types[%i].decode(r,r.uint32())",i):t("value=r.%s()",l),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==r.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',c):t("%s[k]=value",c)):a.repeated?(t("if(!(%s&&%s.length))",c,c)("%s=[]",c),void 0!==r.packed[l]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",c,l)("}else"),void 0===r.basic[l]?t(a.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4)))":"%s.push(types[%i].decode(r,r.uint32()))",c,i):t("%s.push(r.%s())",c,l)):void 0===r.basic[l]?t(a.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4))":"%s=types[%i].decode(r,r.uint32())",c,i):t("%s=r.%s()",c,l),t("break")("}")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),i=0;i<e._fieldsArray.length;++i){var u=e._fieldsArray[i];u.required&&t("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",o(u))}return t("return m")};var n=i(5643),r=i(361),s=i(3262);function o(e){return"missing required '"+e.name+"'"}},1080(e,t,i){"use strict";e.exports=function(e){for(var t,i=s.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(s.compareFieldsById),l=0;l<a.length;++l){var c=a[l].resolve(),u=e._fieldsArray.indexOf(c),h=c.resolvedType instanceof n?"int32":c.type,d=r.basic[h];t="m"+s.safeProp(c.name),c.map?(i("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,c.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(c.id<<3|2)>>>0,8|r.mapKey[c.keyType],c.keyType),void 0===d?i("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):i(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,h,t),i("}")("}")):c.repeated?(i("if(%s!=null&&%s.length){",t,t),c.packed&&void 0!==r.packed[h]?i("w.uint32(%i).fork()",(c.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",h,t)("w.ldelim()"):(i("for(var i=0;i<%s.length;++i)",t),void 0===d?o(i,c,u,t+"[i]"):i("w.uint32(%i).%s(%s[i])",(c.id<<3|d)>>>0,h,t)),i("}")):(c.optional&&i("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,c.name),void 0===d?o(i,c,u,t):i("w.uint32(%i).%s(%s)",(c.id<<3|d)>>>0,h,t))}return i("return w")};var n=i(5643),r=i(361),s=i(3262);function o(e,t,i,n){return t.delimited?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",i,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",i,n,(t.id<<3|2)>>>0)}},5643(e,t,i){"use strict";e.exports=o;var n=i(7209);((o.prototype=Object.create(n.prototype)).constructor=o).className="Enum";var r=i(1304),s=i(3262);function o(e,t,i,r,s,o){if(n.call(this,e,i),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=r,this.comments=s||{},this.valuesOptions=o,this._valuesFeatures={},this.reserved=void 0,t)for(var a=Object.keys(t),l=0;l<a.length;++l)"number"==typeof t[a[l]]&&(this.valuesById[this.values[a[l]]=t[a[l]]]=a[l])}o.prototype._resolveFeatures=function(e){return e=this._edition||e,n.prototype._resolveFeatures.call(this,e),Object.keys(this.values).forEach(e=>{var t=Object.assign({},this._features);this._valuesFeatures[e]=Object.assign(t,this.valuesOptions&&this.valuesOptions[e]&&this.valuesOptions[e].features)}),this},o.fromJSON=function(e,t){var i=new o(e,t.values,t.options,t.comment,t.comments);return i.reserved=t.reserved,t.edition&&(i._edition=t.edition),i._defaultEdition="proto3",i},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},o.prototype.add=function(e,t,i,n){if(!s.isString(e))throw TypeError("name must be a string");if(!s.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return n&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=n||null),this.comments[e]=i||null,this},o.prototype.remove=function(e){if(!s.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this},o.prototype.isReservedId=function(e){return r.isReservedId(this.reserved,e)},o.prototype.isReservedName=function(e){return r.isReservedName(this.reserved,e)}},1344(e,t,i){"use strict";e.exports=c;var n=i(7209);((c.prototype=Object.create(n.prototype)).constructor=c).className="Field";var r,s=i(5643),o=i(361),a=i(3262),l=/^required|optional|repeated$/;function c(e,t,i,r,s,c,u){if(a.isObject(r)?(u=s,c=r,r=s=void 0):a.isObject(s)&&(u=c,c=s,s=void 0),n.call(this,e,c),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(i))throw TypeError("type must be a string");if(void 0!==r&&!l.test(r=r.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!a.isString(s))throw TypeError("extend must be a string");"proto3_optional"===r&&(r="optional"),this.rule=r&&"optional"!==r?r:void 0,this.type=i,this.id=t,this.extend=s||void 0,this.repeated="repeated"===r,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==o.long[i],this.bytes="bytes"===i,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=u}c.fromJSON=function(e,t){var i=new c(e,t.id,t.type,t.rule,t.extend,t.options,t.comment);return t.edition&&(i._edition=t.edition),i._defaultEdition="proto3",i},Object.defineProperty(c.prototype,"required",{get:function(){return"LEGACY_REQUIRED"===this._features.field_presence}}),Object.defineProperty(c.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(c.prototype,"delimited",{get:function(){return this.resolvedType instanceof r&&"DELIMITED"===this._features.message_encoding}}),Object.defineProperty(c.prototype,"packed",{get:function(){return"PACKED"===this._features.repeated_field_encoding}}),Object.defineProperty(c.prototype,"hasPresence",{get:function(){return!this.repeated&&!this.map&&(this.partOf||this.declaringField||this.extensionField||"IMPLICIT"!==this._features.field_presence)}}),c.prototype.setOption=function(e,t,i){return n.prototype.setOption.call(this,e,t,i)},c.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["edition",this._editionToJSON(),"rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},c.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof r?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof s&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof s||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof r&&(this.parent.ctor.prototype[this.name]=this.defaultValue),n.prototype.resolve.call(this)},c.prototype._inferLegacyProtoFeatures=function(e){if("proto2"!==e&&"proto3"!==e)return{};var t={};if("required"===this.rule&&(t.field_presence="LEGACY_REQUIRED"),this.parent&&void 0===o.defaults[this.type]){var i=this.parent.get(this.type.split(".").pop());i&&i instanceof r&&i.group&&(t.message_encoding="DELIMITED")}return!0===this.getOption("packed")?t.repeated_field_encoding="PACKED":!1===this.getOption("packed")&&(t.repeated_field_encoding="EXPANDED"),t},c.prototype._resolveFeatures=function(e){return n.prototype._resolveFeatures.call(this,this._edition||e)},c.d=function(e,t,i,n){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(r,s){a.decorateType(r.constructor).add(new c(s,e,t,i,{default:n}))}},c._configure=function(e){r=e}},5325(e,t,i){"use strict";var n=e.exports=i(4394);n.build="light",n.load=function(e,t,i){return"function"==typeof t?(i=t,t=new n.Root):t||(t=new n.Root),t.load(e,i)},n.loadSync=function(e,t){return t||(t=new n.Root),t.loadSync(e)},n.encoder=i(1080),n.decoder=i(7728),n.verifier=i(420),n.converter=i(744),n.ReflectionObject=i(7209),n.Namespace=i(1304),n.Root=i(5330),n.Enum=i(5643),n.Type=i(7882),n.Field=i(1344),n.OneOf=i(1457),n.MapField=i(8252),n.Service=i(9687),n.Method=i(8811),n.Message=i(2551),n.wrappers=i(6434),n.types=i(361),n.util=i(3262),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},4394(e,t,i){"use strict";var n=t;function r(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=i(3449),n.BufferWriter=i(818),n.Reader=i(6237),n.BufferReader=i(3158),n.util=i(3610),n.rpc=i(5047),n.roots=i(4529),n.configure=r,r()},9100(e,t,i){"use strict";var n=e.exports=i(5325);n.build="full",n.tokenize=i(527),n.parse=i(4863),n.common=i(5095),n.Root._configure(n.Type,n.parse,n.common)},8252(e,t,i){"use strict";e.exports=o;var n=i(1344);((o.prototype=Object.create(n.prototype)).constructor=o).className="MapField";var r=i(361),s=i(3262);function o(e,t,i,r,o,a){if(n.call(this,e,t,r,void 0,void 0,o,a),!s.isString(i))throw TypeError("keyType must be a string");this.keyType=i,this.resolvedKeyType=null,this.map=!0}o.fromJSON=function(e,t){return new o(e,t.id,t.keyType,t.type,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if(void 0===r.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},o.d=function(e,t,i){return"function"==typeof i?i=s.decorateType(i).name:i&&"object"==typeof i&&(i=s.decorateEnum(i).name),function(n,r){s.decorateType(n.constructor).add(new o(r,e,t,i))}}},2551(e,t,i){"use strict";e.exports=r;var n=i(3610);function r(e){if(e)for(var t=Object.keys(e),i=0;i<t.length;++i)this[t[i]]=e[t[i]]}r.create=function(e){return this.$type.create(e)},r.encode=function(e,t){return this.$type.encode(e,t)},r.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},r.decode=function(e){return this.$type.decode(e)},r.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},r.verify=function(e){return this.$type.verify(e)},r.fromObject=function(e){return this.$type.fromObject(e)},r.toObject=function(e,t){return this.$type.toObject(e,t)},r.prototype.toJSON=function(){return this.$type.toObject(this,n.toJSONOptions)}},8811(e,t,i){"use strict";e.exports=s;var n=i(7209);((s.prototype=Object.create(n.prototype)).constructor=s).className="Method";var r=i(3262);function s(e,t,i,s,o,a,l,c,u){if(r.isObject(o)?(l=o,o=a=void 0):r.isObject(a)&&(l=a,a=void 0),void 0!==t&&!r.isString(t))throw TypeError("type must be a string");if(!r.isString(i))throw TypeError("requestType must be a string");if(!r.isString(s))throw TypeError("responseType must be a string");n.call(this,e,l),this.type=t||"rpc",this.requestType=i,this.requestStream=!!o||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=c,this.parsedOptions=u}s.fromJSON=function(e,t){return new s(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},s.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),n.prototype.resolve.call(this))}},1304(e,t,i){"use strict";e.exports=h;var n=i(7209);((h.prototype=Object.create(n.prototype)).constructor=h).className="Namespace";var r,s,o,a=i(1344),l=i(3262),c=i(1457);function u(e,t){if(e&&e.length){for(var i={},n=0;n<e.length;++n)i[e[n].name]=e[n].toJSON(t);return i}}function h(e,t){n.call(this,e,t),this.nested=void 0,this._nestedArray=null,this._lookupCache={},this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function d(e){e._nestedArray=null,e._lookupCache={};for(var t=e;t=t.parent;)t._lookupCache={};return e}h.fromJSON=function(e,t){return new h(e,t.options).addJSON(t.nested)},h.arrayToJSON=u,h.isReservedId=function(e,t){if(e)for(var i=0;i<e.length;++i)if("string"!=typeof e[i]&&e[i][0]<=t&&e[i][1]>t)return!0;return!1},h.isReservedName=function(e,t){if(e)for(var i=0;i<e.length;++i)if(e[i]===t)return!0;return!1},Object.defineProperty(h.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=l.toArray(this.nested))}}),h.prototype.toJSON=function(e){return l.toObject(["options",this.options,"nested",u(this.nestedArray,e)])},h.prototype.addJSON=function(e){if(e)for(var t,i=Object.keys(e),n=0;n<i.length;++n)t=e[i[n]],this.add((void 0!==t.fields?r.fromJSON:void 0!==t.values?o.fromJSON:void 0!==t.methods?s.fromJSON:void 0!==t.id?a.fromJSON:h.fromJSON)(i[n],t));return this},h.prototype.get=function(e){return this.nested&&this.nested[e]||null},h.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof o)return this.nested[e].values;throw Error("no such enum: "+e)},h.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof r||e instanceof c||e instanceof o||e instanceof s||e instanceof h))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof h&&e instanceof h)||t instanceof r||t instanceof s)throw Error("duplicate name '"+e.name+"' in "+this);for(var i=t.nestedArray,n=0;n<i.length;++n)e.add(i[n]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};this.nested[e.name]=e,this instanceof r||this instanceof s||this instanceof o||this instanceof a||e._edition||(e._edition=e._defaultEdition),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;for(var l=this;l=l.parent;)l._needsRecursiveFeatureResolution=!0,l._needsRecursiveResolve=!0;return e.onAdd(this),d(this)},h.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),d(this)},h.prototype.define=function(e,t){if(l.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var i=this;e.length>0;){var n=e.shift();if(i.nested&&i.nested[n]){if(!((i=i.nested[n])instanceof h))throw Error("path conflicts with non-namespace objects")}else i.add(i=new h(n))}return t&&i.addJSON(t),i},h.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var e=this.nestedArray,t=0;for(this.resolve();t<e.length;)e[t]instanceof h?e[t++].resolveAll():e[t++].resolve();return this._needsRecursiveResolve=!1,this},h.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(this._needsRecursiveFeatureResolution=!1,e=this._edition||e,n.prototype._resolveFeaturesRecursive.call(this,e),this.nestedArray.forEach(t=>{t._resolveFeaturesRecursive(e)}),this):this},h.prototype.lookup=function(e,t,i){if("boolean"==typeof t?(i=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),l.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;var n=e.join(".");if(""===e[0])return this.root.lookup(e.slice(1),t);var r=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+n];if(r&&(!t||t.indexOf(r.constructor)>-1))return r;if((r=this._lookupImpl(e,n))&&(!t||t.indexOf(r.constructor)>-1))return r;if(i)return null;for(var s=this;s.parent;){if((r=s.parent._lookupImpl(e,n))&&(!t||t.indexOf(r.constructor)>-1))return r;s=s.parent}return null},h.prototype._lookupImpl=function(e,t){if(Object.prototype.hasOwnProperty.call(this._lookupCache,t))return this._lookupCache[t];var i=this.get(e[0]),n=null;if(i)1===e.length?n=i:i instanceof h&&(e=e.slice(1),n=i._lookupImpl(e,e.join(".")));else for(var r=0;r<this.nestedArray.length;++r)this._nestedArray[r]instanceof h&&(i=this._nestedArray[r]._lookupImpl(e,t))&&(n=i);return this._lookupCache[t]=n,n},h.prototype.lookupType=function(e){var t=this.lookup(e,[r]);if(!t)throw Error("no such type: "+e);return t},h.prototype.lookupEnum=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},h.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[r,o]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},h.prototype.lookupService=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},h._configure=function(e,t,i){r=e,s=t,o=i}},7209(e,t,i){"use strict";e.exports=c,c.className="ReflectionObject";const n=i(1457);var r,s=i(3262),o={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},a={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},l={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function c(e,t){if(!s.isString(e))throw TypeError("name must be a string");if(t&&!s.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(c.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),c.prototype.toJSON=function(){throw Error()},c.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof r&&t._handleAdd(this)},c.prototype.onRemove=function(e){var t=e.root;t instanceof r&&t._handleRemove(this),this.parent=null,this.resolved=!1},c.prototype.resolve=function(){return this.resolved||this.root instanceof r&&(this.resolved=!0),this},c.prototype._resolveFeaturesRecursive=function(e){return this._resolveFeatures(this._edition||e)},c.prototype._resolveFeatures=function(e){if(!this._featuresResolved){var t={};if(!e)throw new Error("Unknown edition for "+this.fullName);var i=Object.assign(this.options?Object.assign({},this.options.features):{},this._inferLegacyProtoFeatures(e));if(this._edition){if("proto2"===e)t=Object.assign({},a);else if("proto3"===e)t=Object.assign({},l);else{if("2023"!==e)throw new Error("Unknown edition: "+e);t=Object.assign({},o)}return this._features=Object.assign(t,i||{}),void(this._featuresResolved=!0)}if(this.partOf instanceof n){var r=Object.assign({},this.partOf._features);this._features=Object.assign(r,i||{})}else if(this.declaringField);else{if(!this.parent)throw new Error("Unable to find a parent for "+this.fullName);var s=Object.assign({},this.parent._features);this._features=Object.assign(s,i||{})}this.extensionField&&(this.extensionField._features=this._features),this._featuresResolved=!0}},c.prototype._inferLegacyProtoFeatures=function(){return{}},c.prototype.getOption=function(e){if(this.options)return this.options[e]},c.prototype.setOption=function(e,t,i){return this.options||(this.options={}),/^features\./.test(e)?s.setProperty(this.options,e,t,i):i&&void 0!==this.options[e]||(this.getOption(e)!==t&&(this.resolved=!1),this.options[e]=t),this},c.prototype.setParsedOption=function(e,t,i){this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(i){var r=n.find(function(t){return Object.prototype.hasOwnProperty.call(t,e)});if(r){var o=r[e];s.setProperty(o,i,t)}else(r={})[e]=s.setProperty({},i,t),n.push(r)}else{var a={};a[e]=t,n.push(a)}return this},c.prototype.setOptions=function(e,t){if(e)for(var i=Object.keys(e),n=0;n<i.length;++n)this.setOption(i[n],e[i[n]],t);return this},c.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},c.prototype._editionToJSON=function(){if(this._edition&&"proto3"!==this._edition)return this._edition},c._configure=function(e){r=e}},1457(e,t,i){"use strict";e.exports=o;var n=i(7209);((o.prototype=Object.create(n.prototype)).constructor=o).className="OneOf";var r=i(1344),s=i(3262);function o(e,t,i,r){if(Array.isArray(t)||(i=t,t=void 0),n.call(this,e,i),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=r}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}o.fromJSON=function(e,t){return new o(e,t.oneof,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},o.prototype.add=function(e){if(!(e instanceof r))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},o.prototype.remove=function(e){if(!(e instanceof r))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},o.prototype.onAdd=function(e){n.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var i=e.get(this.oneof[t]);i&&!i.partOf&&(i.partOf=this,this.fieldsArray.push(i))}a(this)},o.prototype.onRemove=function(e){for(var t,i=0;i<this.fieldsArray.length;++i)(t=this.fieldsArray[i]).parent&&t.parent.remove(t);n.prototype.onRemove.call(this,e)},Object.defineProperty(o.prototype,"isProto3Optional",{get:function(){if(null==this.fieldsArray||1!==this.fieldsArray.length)return!1;var e=this.fieldsArray[0];return null!=e.options&&!0===e.options.proto3_optional}}),o.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,i){s.decorateType(t.constructor).add(new o(i,e)),Object.defineProperty(t,i,{get:s.oneOfGetter(e),set:s.oneOfSetter(e)})}}},4863(e,t,i){"use strict";e.exports=E,E.filename=null,E.defaults={keepCase:!1};var n=i(527),r=i(5330),s=i(7882),o=i(1344),a=i(8252),l=i(1457),c=i(5643),u=i(9687),h=i(8811),d=i(7209),f=i(361),p=i(3262),g=/^[1-9][0-9]*$/,m=/^-?[1-9][0-9]*$/,v=/^0[x][0-9a-fA-F]+$/,y=/^-?0[x][0-9a-fA-F]+$/,b=/^0[0-7]+$/,S=/^-?0[0-7]+$/,_=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,C=/^[a-zA-Z_][a-zA-Z_0-9]*$/,w=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;function E(e,t,i){t instanceof r||(i=t,t=new r),i||(i=E.defaults);var T,k,R,O,P=i.preferTrailingComment||!1,A=n(e,i.alternateCommentMode||!1),x=A.next,N=A.push,I=A.peek,M=A.skip,L=A.cmnt,D=!0,j="proto2",F=t,B=[],U={},z=i.keepCase?function(e){return e}:p.camelCase;function H(e,t,i){var n=E.filename;return i||(E.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+A.line+")")}function q(){var e,t=[];do{if('"'!==(e=x())&&"'"!==e)throw H(e);t.push(x()),M(e),e=I()}while('"'===e||"'"===e);return t.join("")}function W(e){var t=x();switch(t){case"'":case'"':return N(t),q();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var i=1;"-"===e.charAt(0)&&(i=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return i*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(g.test(e))return i*parseInt(e,10);if(v.test(e))return i*parseInt(e,16);if(b.test(e))return i*parseInt(e,8);if(_.test(e))return i*parseFloat(e);throw H(e,"number",t)}(t,!0)}catch(i){if(e&&w.test(t))return t;throw H(t,"value")}}function G(e,t){var i,n;do{if(!t||'"'!==(i=I())&&"'"!==i)try{e.push([n=$(x()),M("to",!0)?$(x()):n])}catch(n){if(!(t&&w.test(i)&&j>=2023))throw n;e.push(i)}else{var r=q();if(e.push(r),j>=2023)throw H(r,"id")}}while(M(",",!0));var s={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};Q(s,function(e){if("option"!==e)throw H(e);ie(s,e),M(";")},function(){se(s)})}function $(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw H(e,"id");if(m.test(e))return parseInt(e,10);if(y.test(e))return parseInt(e,16);if(S.test(e))return parseInt(e,8);throw H(e,"id")}function V(){if(void 0!==T)throw H("package");if(T=x(),!w.test(T))throw H(T,"name");F=F.define(T),M(";")}function Y(){var e,t=I();switch(t){case"weak":e=R||(R=[]),x();break;case"public":x();default:e=k||(k=[])}t=q(),M(";"),e.push(t)}function K(){if(M("="),(j=q())<2023)throw H(j,"syntax");M(";")}function J(){M("="),j=q();if(!["2023"].includes(j))throw H(j,"edition");M(";")}function X(e,t){switch(t){case"option":return ie(e,t),M(";"),!0;case"message":return Z(e,t),!0;case"enum":return te(e,t),!0;case"service":return function(e,t){if(!C.test(t=x()))throw H(t,"service name");var i=new u(t);Q(i,function(e){if(!X(i,e)){if("rpc"!==e)throw H(e);!function(e,t){var i=L(),n=t;if(!C.test(t=x()))throw H(t,"name");var r,s,o,a,l=t;M("("),M("stream",!0)&&(s=!0);if(!w.test(t=x()))throw H(t);r=t,M(")"),M("returns"),M("("),M("stream",!0)&&(a=!0);if(!w.test(t=x()))throw H(t);o=t,M(")");var c=new h(l,n,r,o,s,a);c.comment=i,Q(c,function(e){if("option"!==e)throw H(e);ie(c,e),M(";")}),e.add(c)}(i,e)}}),e.add(i),e===F&&B.push(i)}(e,t),!0;case"extend":return function(e,t){if(!w.test(t=x()))throw H(t,"reference");var i=t;Q(null,function(t){switch(t){case"required":case"repeated":ee(e,t,i);break;case"optional":ee(e,"proto3"===j?"proto3_optional":"optional",i);break;default:if("proto2"===j||!w.test(t))throw H(t);N(t),ee(e,"optional",i)}})}(e,t),!0}return!1}function Q(e,t,i){var n=A.line;if(e&&("string"!=typeof e.comment&&(e.comment=L()),e.filename=E.filename),M("{",!0)){for(var r;"}"!==(r=x());)t(r);M(";",!0)}else i&&i(),M(";"),e&&("string"!=typeof e.comment||P)&&(e.comment=L(n)||e.comment)}function Z(e,t){if(!C.test(t=x()))throw H(t,"type name");var i=new s(t);Q(i,function(e){if(!X(i,e))switch(e){case"map":!function(e){M("<");var t=x();if(void 0===f.mapKey[t])throw H(t,"type");M(",");var i=x();if(!w.test(i))throw H(i,"type");M(">");var n=x();if(!C.test(n))throw H(n,"name");M("=");var r=new a(z(n),$(x()),t,i);Q(r,function(e){if("option"!==e)throw H(e);ie(r,e),M(";")},function(){se(r)}),e.add(r)}(i);break;case"required":if("proto2"!==j)throw H(e);case"repeated":ee(i,e);break;case"optional":if("proto3"===j)ee(i,"proto3_optional");else{if("proto2"!==j)throw H(e);ee(i,"optional")}break;case"oneof":!function(e,t){if(!C.test(t=x()))throw H(t,"name");var i=new l(z(t));Q(i,function(e){"option"===e?(ie(i,e),M(";")):(N(e),ee(i,"optional"))}),e.add(i)}(i,e);break;case"extensions":G(i.extensions||(i.extensions=[]));break;case"reserved":G(i.reserved||(i.reserved=[]),!0);break;default:if("proto2"===j||!w.test(e))throw H(e);N(e),ee(i,"optional")}}),e.add(i),e===F&&B.push(i)}function ee(e,t,i){var n=x();if("group"!==n){for(;n.endsWith(".")||I().startsWith(".");)n+=x();if(!w.test(n))throw H(n,"type");var r=x();if(!C.test(r))throw H(r,"name");r=z(r),M("=");var a=new o(r,$(x()),n,t,i);if(Q(a,function(e){if("option"!==e)throw H(e);ie(a,e),M(";")},function(){se(a)}),"proto3_optional"===t){var c=new l("_"+r);a.setOption("proto3_optional",!0),c.add(a),e.add(c)}else e.add(a);e===F&&B.push(a)}else!function(e,t){if(j>=2023)throw H("group");var i=x();if(!C.test(i))throw H(i,"name");var n=p.lcFirst(i);i===n&&(i=p.ucFirst(i));M("=");var r=$(x()),a=new s(i);a.group=!0;var l=new o(n,r,i,t);l.filename=E.filename,Q(a,function(e){switch(e){case"option":ie(a,e),M(";");break;case"required":case"repeated":ee(a,e);break;case"optional":ee(a,"proto3"===j?"proto3_optional":"optional");break;case"message":Z(a,e);break;case"enum":te(a,e);break;case"reserved":G(a.reserved||(a.reserved=[]),!0);break;default:throw H(e)}}),e.add(a).add(l)}(e,t)}function te(e,t){if(!C.test(t=x()))throw H(t,"name");var i=new c(t);Q(i,function(e){switch(e){case"option":ie(i,e),M(";");break;case"reserved":G(i.reserved||(i.reserved=[]),!0),void 0===i.reserved&&(i.reserved=[]);break;default:!function(e,t){if(!C.test(t))throw H(t,"name");M("=");var i=$(x(),!0),n={options:void 0,getOption:function(e){return this.options[e]}};n.setOption=function(e,t){d.prototype.setOption.call(n,e,t)},n.setParsedOption=function(){},Q(n,function(e){if("option"!==e)throw H(e);ie(n,e),M(";")},function(){se(n)}),e.add(t,i,n.comment,n.parsedOptions||n.options)}(i,e)}}),e.add(i),e===F&&B.push(i)}function ie(e,t){var i,n,r=!0;for("option"===t&&(t=x());"="!==t;){if("("===t){var s=x();M(")"),t="("+s+")"}if(r){if(r=!1,t.includes(".")&&!t.includes("(")){var o=t.split(".");i=o[0]+".",t=o[1];continue}i=t}else n=n?n+=t:t;t=x()}var a=ne(e,n?i.concat(n):i);n=n&&"."===n[0]?n.slice(1):n,function(e,t,i,n){e.setParsedOption&&e.setParsedOption(t,i,n)}(e,i=i&&"."===i[i.length-1]?i.slice(0,-1):i,a,n)}function ne(e,t){if(M("{",!0)){for(var i={};!M("}",!0);){if(!C.test(O=x()))throw H(O,"name");if(null===O)throw H(O,"end of input");var n,r=O;if(M(":",!0),"{"===I())n=ne(e,t+"."+O);else if("["===I()){var s;if(n=[],M("[",!0)){do{s=W(!0),n.push(s)}while(M(",",!0));M("]"),void 0!==s&&re(e,t+"."+O,s)}}else n=W(!0),re(e,t+"."+O,n);var o=i[r];o&&(n=[].concat(o).concat(n)),i[r]=n,M(",",!0),M(";",!0)}return i}var a=W(!0);return re(e,t,a),a}function re(e,t,i){F===e&&/^features\./.test(t)?U[t]=i:e.setOption&&e.setOption(t,i)}function se(e){if(M("[",!0)){do{ie(e,"option")}while(M(",",!0));M("]")}return e}for(;null!==(O=x());)switch(O){case"package":if(!D)throw H(O);V();break;case"import":if(!D)throw H(O);Y();break;case"syntax":if(!D)throw H(O);K();break;case"edition":if(!D)throw H(O);J();break;case"option":ie(F,O),M(";",!0);break;default:if(X(F,O)){D=!1;continue}throw H(O)}return B.forEach(e=>{e._edition=j,Object.keys(U).forEach(t=>{void 0===e.getOption(t)&&e.setOption(t,U[t],!0)})}),E.filename=null,{package:T,imports:k,weakImports:R,root:t}}},6237(e,t,i){"use strict";e.exports=l;var n,r=i(3610),s=r.LongBits,o=r.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var c,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")},h=function(){return r.Buffer?function(e){return(l.create=function(e){return r.Buffer.isBuffer(e)?new n(e):u(e)})(e)}:u};function d(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function f(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw a(this,8);return new s(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}l.create=h(),l.prototype._slice=r.Array.prototype.subarray||r.Array.prototype.slice,l.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return c}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return f(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|f(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw a(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,i);if(t===i){var n=r.Buffer;return n?n.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,i)},l.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},l.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},l._configure=function(e){n=e,l.create=h(),n._configure();var t=r.Long?"toLong":"toNumber";r.merge(l.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},3158(e,t,i){"use strict";e.exports=s;var n=i(6237);(s.prototype=Object.create(n.prototype)).constructor=s;var r=i(3610);function s(e){n.call(this,e)}s._configure=function(){r.Buffer&&(s.prototype._slice=r.Buffer.prototype.slice)},s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},s._configure()},5330(e,t,i){"use strict";e.exports=h;var n=i(1304);((h.prototype=Object.create(n.prototype)).constructor=h).className="Root";var r,s,o,a=i(1344),l=i(5643),c=i(1457),u=i(3262);function h(e){n.call(this,"",e),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}function d(){}h.fromJSON=function(e,t){return t||(t=new h),e.options&&t.setOptions(e.options),t.addJSON(e.nested).resolveAll()},h.prototype.resolvePath=u.path.resolve,h.prototype.fetch=u.fetch,h.prototype.load=function e(t,i,n){"function"==typeof i&&(n=i,i=void 0);var r=this;if(!n)return u.asPromise(e,r,t,i);var a=n===d;function l(e,t){if(n){if(a)throw e;t&&t.resolveAll();var i=n;n=null,i(e,t)}}function c(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var i=e.substring(t);if(i in o)return i}return null}function h(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){s.filename=e;var n,o=s(t,r,i),h=0;if(o.imports)for(;h<o.imports.length;++h)(n=c(o.imports[h])||r.resolvePath(e,o.imports[h]))&&f(n);if(o.weakImports)for(h=0;h<o.weakImports.length;++h)(n=c(o.weakImports[h])||r.resolvePath(e,o.weakImports[h]))&&f(n,!0)}else r.setOptions(t.options).addJSON(t.nested)}catch(e){l(e)}a||p||l(null,r)}function f(e,t){if(e=c(e)||e,!(r.files.indexOf(e)>-1))if(r.files.push(e),e in o)a?h(e,o[e]):(++p,setTimeout(function(){--p,h(e,o[e])}));else if(a){var i;try{i=u.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||l(e))}h(e,i)}else++p,r.fetch(e,function(i,s){--p,n&&(i?t?p||l(null,r):l(i):h(e,s))})}var p=0;u.isString(t)&&(t=[t]);for(var g,m=0;m<t.length;++m)(g=r.resolvePath("",t[m]))&&f(g);return a?(r.resolveAll(),r):(p||l(null,r),r)},h.prototype.loadSync=function(e,t){if(!u.isNode)throw Error("not supported");return this.load(e,t,d)},h.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return n.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function p(e,t){var i=t.parent.lookup(t.extend);if(i){var n=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return i.get(n.name)||(n.declaringField=t,t.extensionField=n,i.add(n)),!0}return!1}h.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||p(0,e)||this.deferred.push(e);else if(e instanceof l)f.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof c)){if(e instanceof r)for(var t=0;t<this.deferred.length;)p(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var i=0;i<e.nestedArray.length;++i)this._handleAdd(e._nestedArray[i]);f.test(e.name)&&(e.parent[e.name]=e)}(e instanceof r||e instanceof l||e instanceof a)&&(this._fullyQualifiedObjects[e.fullName]=e)},h.prototype._handleRemove=function(e){if(e instanceof a){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof l)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var i=0;i<e.nestedArray.length;++i)this._handleRemove(e._nestedArray[i]);f.test(e.name)&&delete e.parent[e.name]}delete this._fullyQualifiedObjects[e.fullName]},h._configure=function(e,t,i){r=e,s=t,o=i}},4529(e){"use strict";e.exports={}},5047(e,t,i){"use strict";t.Service=i(7595)},7595(e,t,i){"use strict";e.exports=r;var n=i(3610);function r(e,t,i){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(i)}(r.prototype=Object.create(n.EventEmitter.prototype)).constructor=r,r.prototype.rpcCall=function e(t,i,r,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return n.asPromise(e,a,t,i,r,s);if(a.rpcImpl)try{return a.rpcImpl(t,i[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),function(e,i){if(e)return a.emit("error",e,t),o(e);if(null!==i){if(!(i instanceof r))try{i=r[a.responseDelimited?"decodeDelimited":"decode"](i)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",i,t),o(null,i)}a.end(!0)})}catch(e){return a.emit("error",e,t),void setTimeout(function(){o(e)},0)}else setTimeout(function(){o(Error("already ended"))},0)},r.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},9687(e,t,i){"use strict";e.exports=a;var n=i(1304);((a.prototype=Object.create(n.prototype)).constructor=a).className="Service";var r=i(8811),s=i(3262),o=i(5047);function a(e,t){n.call(this,e,t),this.methods={},this._methodsArray=null}function l(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var i=new a(e,t.options);if(t.methods)for(var n=Object.keys(t.methods),s=0;s<n.length;++s)i.add(r.fromJSON(n[s],t.methods[n[s]]));return t.nested&&i.addJSON(t.nested),t.edition&&(i._edition=t.edition),i.comment=t.comment,i._defaultEdition="proto3",i},a.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),i=!!e&&Boolean(e.keepComments);return s.toObject(["edition",this._editionToJSON(),"options",t&&t.options||void 0,"methods",n.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",i?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=s.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||n.prototype.get.call(this,e)},a.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;n.prototype.resolve.call(this);for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return this},a.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,n.prototype._resolveFeaturesRecursive.call(this,e),this.methodsArray.forEach(t=>{t._resolveFeaturesRecursive(e)}),this):this},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof r?(this.methods[e.name]=e,e.parent=this,l(this)):n.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof r){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,l(this)}return n.prototype.remove.call(this,e)},a.prototype.create=function(e,t,i){for(var n,r=new o.Service(e,t,i),a=0;a<this.methodsArray.length;++a){var l=s.lcFirst((n=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");r[l]=s.codegen(["r","c"],s.isReserved(l)?l+"_":l)("return this.rpcCall(m,q,s,r,c)")({m:n,q:n.resolvedRequestType.ctor,s:n.resolvedResponseType.ctor})}return r}},527(e){"use strict";e.exports=h;var t=/[\s{}=;:[\],'"()<>]/g,i=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,n=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,r=/^ *[*/]+ */,s=/^\s*\*?\/*/,o=/\n/g,a=/\s/,l=/\\(.?)/g,c={0:"\0",r:"\r",n:"\n",t:"\t"};function u(e){return e.replace(l,function(e,t){switch(t){case"\\":case"":return t;default:return c[t]||""}})}function h(e,l){e=e.toString();var c=0,h=e.length,d=1,f=0,p={},g=[],m=null;function v(e){return Error("illegal "+e+" (line "+d+")")}function y(t){return e.charAt(t)}function b(t,i,n){var a,c={type:e.charAt(t++),lineEmpty:!1,leading:n},u=t-(l?2:3);do{if(--u<0||"\n"===(a=e.charAt(u))){c.lineEmpty=!0;break}}while(" "===a||"\t"===a);for(var h=e.substring(t,i).split(o),g=0;g<h.length;++g)h[g]=h[g].replace(l?s:r,"").trim();c.text=h.join("\n").trim(),p[d]=c,f=d}function S(t){var i=_(t),n=e.substring(t,i);return/^\s*\/\//.test(n)}function _(e){for(var t=e;t<h&&"\n"!==y(t);)t++;return t}function C(){if(g.length>0)return g.shift();if(m)return function(){var t="'"===m?n:i;t.lastIndex=c-1;var r=t.exec(e);if(!r)throw v("string");return c=t.lastIndex,w(m),m=null,u(r[1])}();var r,s,o,f,p,C=0===c;do{if(c===h)return null;for(r=!1;a.test(o=y(c));)if("\n"===o&&(C=!0,++d),++c===h)return null;if("/"===y(c)){if(++c===h)throw v("comment");if("/"===y(c))if(l){if(f=c,p=!1,S(c-1)){p=!0;do{if((c=_(c))===h)break;if(c++,!C)break}while(S(c))}else c=Math.min(h,_(c)+1);p&&(b(f,c,C),C=!0),d++,r=!0}else{for(p="/"===y(f=c+1);"\n"!==y(++c);)if(c===h)return null;++c,p&&(b(f,c-1,C),C=!0),++d,r=!0}else{if("*"!==(o=y(c)))return"/";f=c+1,p=l||"*"===y(f);do{if("\n"===o&&++d,++c===h)throw v("comment");s=o,o=y(c)}while("*"!==s||"/"!==o);++c,p&&(b(f,c-2,C),C=!0),r=!0}}}while(r);var E=c;if(t.lastIndex=0,!t.test(y(E++)))for(;E<h&&!t.test(y(E));)++E;var T=e.substring(c,c=E);return'"'!==T&&"'"!==T||(m=T),T}function w(e){g.push(e)}function E(){if(!g.length){var e=C();if(null===e)return null;w(e)}return g[0]}return Object.defineProperty({next:C,peek:E,push:w,skip:function(e,t){var i=E();if(i===e)return C(),!0;if(!t)throw v("token '"+i+"', '"+e+"' expected");return!1},cmnt:function(e){var t,i=null;return void 0===e?(t=p[d-1],delete p[d-1],t&&(l||"*"===t.type||t.lineEmpty)&&(i=t.leading?t.text:null)):(f<e&&E(),t=p[e],delete p[e],!t||t.lineEmpty||!l&&"/"!==t.type||(i=t.leading?null:t.text)),i}},"line",{get:function(){return d}})}h.unescape=u},7882(e,t,i){"use strict";e.exports=y;var n=i(1304);((y.prototype=Object.create(n.prototype)).constructor=y).className="Type";var r=i(5643),s=i(1457),o=i(1344),a=i(8252),l=i(9687),c=i(2551),u=i(6237),h=i(3449),d=i(3262),f=i(1080),p=i(7728),g=i(420),m=i(744),v=i(6434);function y(e,t){n.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(y.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var i=this.fields[e[t]],n=i.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=i}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=d.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=d.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=y.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof c||((e.prototype=new c).constructor=e,d.merge(e.prototype,t)),e.$type=e.prototype.$type=this,d.merge(e,c,!0),this._ctor=e;for(var i=0;i<this.fieldsArray.length;++i)this._fieldsArray[i].resolve();var n={};for(i=0;i<this.oneofsArray.length;++i)n[this._oneofsArray[i].resolve().name]={get:d.oneOfGetter(this._oneofsArray[i].oneof),set:d.oneOfSetter(this._oneofsArray[i].oneof)};i&&Object.defineProperties(e.prototype,n)}}}),y.generateConstructor=function(e){for(var t,i=d.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?i("this%s={}",d.safeProp(t.name)):t.repeated&&i("this%s=[]",d.safeProp(t.name));return i("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},y.fromJSON=function(e,t){var i=new y(e,t.options);i.extensions=t.extensions,i.reserved=t.reserved;for(var c=Object.keys(t.fields),u=0;u<c.length;++u)i.add((void 0!==t.fields[c[u]].keyType?a.fromJSON:o.fromJSON)(c[u],t.fields[c[u]]));if(t.oneofs)for(c=Object.keys(t.oneofs),u=0;u<c.length;++u)i.add(s.fromJSON(c[u],t.oneofs[c[u]]));if(t.nested)for(c=Object.keys(t.nested),u=0;u<c.length;++u){var h=t.nested[c[u]];i.add((void 0!==h.id?o.fromJSON:void 0!==h.fields?y.fromJSON:void 0!==h.values?r.fromJSON:void 0!==h.methods?l.fromJSON:n.fromJSON)(c[u],h))}return t.extensions&&t.extensions.length&&(i.extensions=t.extensions),t.reserved&&t.reserved.length&&(i.reserved=t.reserved),t.group&&(i.group=!0),t.comment&&(i.comment=t.comment),t.edition&&(i._edition=t.edition),i._defaultEdition="proto3",i},y.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),i=!!e&&Boolean(e.keepComments);return d.toObject(["edition",this._editionToJSON(),"options",t&&t.options||void 0,"oneofs",n.arrayToJSON(this.oneofsArray,e),"fields",n.arrayToJSON(this.fieldsArray.filter(function(e){return!e.declaringField}),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",i?this.comment:void 0])},y.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;n.prototype.resolveAll.call(this);var e=this.oneofsArray;for(i=0;i<e.length;)e[i++].resolve();for(var t=this.fieldsArray,i=0;i<t.length;)t[i++].resolve();return this},y.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,n.prototype._resolveFeaturesRecursive.call(this,e),this.oneofsArray.forEach(t=>{t._resolveFeatures(e)}),this.fieldsArray.forEach(t=>{t._resolveFeatures(e)}),this):this},y.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},y.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof s?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):n.prototype.add.call(this,e)},y.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof s){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return n.prototype.remove.call(this,e)},y.prototype.isReservedId=function(e){return n.isReservedId(this.reserved,e)},y.prototype.isReservedName=function(e){return n.isReservedName(this.reserved,e)},y.prototype.create=function(e){return new this.ctor(e)},y.prototype.setup=function(){for(var e=this.fullName,t=[],i=0;i<this.fieldsArray.length;++i)t.push(this._fieldsArray[i].resolve().resolvedType);this.encode=f(this)({Writer:h,types:t,util:d}),this.decode=p(this)({Reader:u,types:t,util:d}),this.verify=g(this)({types:t,util:d}),this.fromObject=m.fromObject(this)({types:t,util:d}),this.toObject=m.toObject(this)({types:t,util:d});var n=v[e];if(n){var r=Object.create(this);r.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(r),r.toObject=this.toObject,this.toObject=n.toObject.bind(r)}return this},y.prototype.encode=function(e,t){return this.setup().encode(e,t)},y.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},y.prototype.decode=function(e,t){return this.setup().decode(e,t)},y.prototype.decodeDelimited=function(e){return e instanceof u||(e=u.create(e)),this.decode(e,e.uint32())},y.prototype.verify=function(e){return this.setup().verify(e)},y.prototype.fromObject=function(e){return this.setup().fromObject(e)},y.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},y.d=function(e){return function(t){d.decorateType(t,e)}}},361(e,t,i){"use strict";var n=t,r=i(3262),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var i=0,n={};for(t|=0;i<e.length;)n[s[i+t]]=e[i++];return n}n.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),n.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",r.emptyArray,null]),n.long=o([0,0,0,1,1],7),n.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),n.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])},3262(e,t,i){"use strict";var n,r,s=e.exports=i(3610),o=i(4529);s.codegen=i(8561),s.fetch=i(5212),s.path=i(9207),s.fs=s.inquire("fs"),s.toArray=function(e){if(e){for(var t=Object.keys(e),i=new Array(t.length),n=0;n<t.length;)i[n]=e[t[n++]];return i}return[]},s.toObject=function(e){for(var t={},i=0;i<e.length;){var n=e[i++],r=e[i++];void 0!==r&&(t[n]=r)}return t};var a=/\\/g,l=/"/g;s.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},s.safeProp=function(e){return!/^[$\w_]+$/.test(e)||s.isReserved(e)?'["'+e.replace(a,"\\\\").replace(l,'\\"')+'"]':"."+e},s.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var c=/_([a-z])/g;s.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(c,function(e,t){return t.toUpperCase()})},s.compareFieldsById=function(e,t){return e.id-t.id},s.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(s.decorateRoot.remove(e.$type),e.$type.name=t,s.decorateRoot.add(e.$type)),e.$type;n||(n=i(7882));var r=new n(t||e.name);return s.decorateRoot.add(r),r.ctor=e,Object.defineProperty(e,"$type",{value:r,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:r,enumerable:!1}),r};var u=0;s.decorateEnum=function(e){if(e.$type)return e.$type;r||(r=i(5643));var t=new r("Enum"+u++,e);return s.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},s.setProperty=function(e,t,i,n){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,i,r){var s=i.shift();if("__proto__"===s||"prototype"===s)return t;if(i.length>0)t[s]=e(t[s]||{},i,r);else{var o=t[s];if(o&&n)return t;o&&(r=[].concat(o).concat(r)),t[s]=r}return t}(e,t=t.split("."),i)},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(i(5330)))}})},2239(e,t,i){"use strict";e.exports=r;var n=i(3610);function r(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=r.zero=new r(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=r.zeroHash="\0\0\0\0\0\0\0\0";r.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new r(i,n)},r.from=function(e){if("number"==typeof e)return r.fromNumber(e);if(n.isString(e)){if(!n.Long)return r.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new r(e.low>>>0,e.high>>>0):s},r.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+4294967296*i)}return this.lo+4294967296*this.hi},r.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;r.fromHash=function(e){return e===o?s:new r((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},r.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},r.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},r.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},r.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}},3610(e,t,i){"use strict";var n=t;function r(e,t,i){for(var n=Object.keys(t),r=0;r<n.length;++r)void 0!==e[n[r]]&&i||(e[n[r]]=t[n[r]]);return e}function s(e){function t(e,i){if(!(this instanceof t))return new t(e,i);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),i&&r(this,i)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=i(8045),n.base64=i(8839),n.EventEmitter=i(4358),n.float=i(9410),n.inquire=i(4153),n.utf8=i(1447),n.pool=i(9390),n.LongBits=i(2239),n.isNode=Boolean("undefined"!=typeof global&&global&&global.process&&global.process.versions&&global.process.versions.node),n.global=n.isNode&&global||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.isset=n.isSet=function(e,t){var i=e[t];return!(null==i||!e.hasOwnProperty(t))&&("object"!=typeof i||(Array.isArray(i)?i.length:Object.keys(i).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var i=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))},n.merge=r,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=s,n.ProtocolError=s("ProtocolError"),n.oneOfGetter=function(e){for(var t={},i=0;i<e.length;++i)t[e[i]]=1;return function(){for(var e=Object.keys(this),i=e.length-1;i>-1;--i)if(1===t[e[i]]&&void 0!==this[e[i]]&&null!==this[e[i]])return e[i]}},n.oneOfSetter=function(e){return function(t){for(var i=0;i<e.length;++i)e[i]!==t&&delete this[e[i]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,i){return new e(t,i)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},420(e,t,i){"use strict";e.exports=function(e){var t=r.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),i=e.oneofsArray,n={};i.length&&t("var p={}");for(var l=0;l<e.fieldsArray.length;++l){var c=e._fieldsArray[l].resolve(),u="m"+r.safeProp(c.name);if(c.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",u,c.name),c.map)t("if(!util.isObject(%s))",u)("return%j",s(c,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),a(t,c,"k[i]"),o(t,c,l,u+"[k[i]]")("}");else if(c.repeated)t("if(!Array.isArray(%s))",u)("return%j",s(c,"array"))("for(var i=0;i<%s.length;++i){",u),o(t,c,l,u+"[i]")("}");else{if(c.partOf){var h=r.safeProp(c.partOf.name);1===n[c.partOf.name]&&t("if(p%s===1)",h)("return%j",c.partOf.name+": multiple values"),n[c.partOf.name]=1,t("p%s=1",h)}o(t,c,l,u)}c.optional&&t("}")}return t("return null")};var n=i(5643),r=i(3262);function s(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function o(e,t,i,r){if(t.resolvedType)if(t.resolvedType instanceof n){e("switch(%s){",r)("default:")("return%j",s(t,"enum value"));for(var o=Object.keys(t.resolvedType.values),a=0;a<o.length;++a)e("case %i:",t.resolvedType.values[o[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",i,r)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",r)("return%j",s(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",r,r,r,r)("return%j",s(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',r)("return%j",s(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',r)("return%j",s(t,"boolean"));break;case"string":e("if(!util.isString(%s))",r)("return%j",s(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',r,r,r)("return%j",s(t,"buffer"))}return e}function a(e,t,i){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",i)("return%j",s(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",i)("return%j",s(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",i)("return%j",s(t,"boolean key"))}return e}},6434(e,t,i){"use strict";var n=t,r=i(2551);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),i=this.lookup(t);if(i){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:i.encode(i.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var i="",n="";if(t&&t.json&&e.type_url&&e.value){n=e.type_url.substring(e.type_url.lastIndexOf("/")+1),i=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(n);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof r){var o=e.$type.toObject(e,t);return""===i&&(i="type.googleapis.com/"),n=i+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),o["@type"]=n,o}return this.toObject(e,t)}}},3449(e,t,i){"use strict";e.exports=h;var n,r=i(3610),s=r.LongBits,o=r.base64,a=r.utf8;function l(e,t,i){this.fn=e,this.len=t,this.next=void 0,this.val=i}function c(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new l(c,0,0),this.tail=this.head,this.states=null}var d=function(){return r.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,i){t[i]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,i){for(;e.hi;)t[i++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[i++]=127&e.lo|128,e.lo=e.lo>>>7;t[i++]=e.lo}function m(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}h.create=d(),h.alloc=function(e){return new r.Array(e)},r.Array!==Array&&(h.alloc=r.pool(h.alloc,r.Array.prototype.subarray)),h.prototype._push=function(e,t,i){return this.tail=this.tail.next=new l(e,t,i),this.len+=t,this},p.prototype=Object.create(l.prototype),p.prototype.fn=function(e,t,i){for(;e>127;)t[i++]=127&e|128,e>>>=7;t[i]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,s.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=s.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=s.from(e);return this._push(m,4,t.lo)._push(m,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(r.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(r.float.writeDoubleLE,8,e)};var v=r.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n<e.length;++n)t[i+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(r.isString(e)){var i=h.alloc(t=o.length(e));o.decode(e,i,0),e=i}return this.uint32(t)._push(v,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new l(c,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(c,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},818(e,t,i){"use strict";e.exports=s;var n=i(3449);(s.prototype=Object.create(n.prototype)).constructor=s;var r=i(3610);function s(){n.call(this)}function o(e,t,i){e.length<40?r.utf8.write(e,t,i):t.utf8Write?t.utf8Write(e,i):t.write(e,i)}s._configure=function(){s.alloc=r._Buffer_allocUnsafe,s.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&"set"===r.Buffer.prototype.set.name?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n<e.length;)t[i++]=e[n++]}},s.prototype.bytes=function(e){r.isString(e)&&(e=r._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=r.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},815(e,t,i){var n,r=i(3519),s=i(6611);try{n=i(9896)}catch(e){}var o=function(){},a="undefined"!=typeof process&&/^v?\.0/.test(process.version),l=function(e){return"function"==typeof e},c=function(e,t,i,c){c=r(c);var u=!1;e.on("close",function(){u=!0}),s(e,{readable:t,writable:i},function(e){if(e)return c(e);u=!0,c()});var h=!1;return function(t){if(!u&&!h)return h=!0,function(e){return!!a&&!!n&&(e instanceof(n.ReadStream||o)||e instanceof(n.WriteStream||o))&&l(e.close)}(e)?e.close(o):function(e){return e.setHeader&&l(e.abort)}(e)?e.abort():l(e.destroy)?e.destroy():void c(t||new Error("stream was destroyed"))}},u=function(e){e()},h=function(e,t){return e.pipe(t)};e.exports=function(){var e,t=Array.prototype.slice.call(arguments),i=l(t[t.length-1]||o)&&t.pop()||o;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var n=t.map(function(r,s){var o=s<t.length-1;return c(r,o,s>0,function(t){e||(e=t),t&&n.forEach(u),o||(n.forEach(u),i(e))})});return t.reduce(h)}},113(e){"use strict";const t={};function i(e,i,n){n||(n=Error);class r extends n{constructor(e,t,n){super(function(e,t,n){return"string"==typeof i?i:i(e,t,n)}(e,t,n))}}r.prototype.name=n.name,r.prototype.code=e,t[e]=r}function n(e,t){if(Array.isArray(e)){const i=e.length;return e=e.map(e=>String(e)),i>2?`one of ${t} ${e.slice(0,i-1).join(", ")}, or `+e[i-1]:2===i?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}return`of ${t} ${String(e)}`}i("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(e,t,i){let r;var s,o;let a;if("string"==typeof t&&(s="not ",t.substr(!o||o<0?0:+o,s.length)===s)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,i){return(void 0===i||i>e.length)&&(i=e.length),e.substring(i-t.length,i)===t}(e," argument"))a=`The ${e} ${r} ${n(t,"type")}`;else{const i=function(e,t,i){return"number"!=typeof i&&(i=0),!(i+t.length>e.length)&&-1!==e.indexOf(t,i)}(e,".")?"property":"argument";a=`The "${e}" ${i} ${r} ${n(t,"type")}`}return a+=". Received type "+typeof i,a},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},5382(e,t,i){"use strict";var n=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};e.exports=c;var r=i(5412),s=i(6708);i(2017)(c,r);for(var o=n(s.prototype),a=0;a<o.length;a++){var l=o[a];c.prototype[l]||(c.prototype[l]=s.prototype[l])}function c(e){if(!(this instanceof c))return new c(e);r.call(this,e),s.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",u)))}function u(){this._writableState.ended||process.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},3600(e,t,i){"use strict";e.exports=r;var n=i(4610);function r(e){if(!(this instanceof r))return new r(e);n.call(this,e)}i(2017)(r,n),r.prototype._transform=function(e,t,i){i(null,e)}},5412(e,t,i){"use strict";var n;e.exports=E,E.ReadableState=w;i(4434).EventEmitter;var r=function(e,t){return e.listeners(t).length},s=i(1416),o=i(181).Buffer,a=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var l,c=i(9023);l=c&&c.debuglog?c.debuglog("stream"):function(){};var u,h,d,f=i(345),p=i(5896),g=i(5291).getHighWaterMark,m=i(113).F,v=m.ERR_INVALID_ARG_TYPE,y=m.ERR_STREAM_PUSH_AFTER_EOF,b=m.ERR_METHOD_NOT_IMPLEMENTED,S=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;i(2017)(E,s);var _=p.errorOrDestroy,C=["error","close","destroy","pause","resume"];function w(e,t,r){n=n||i(5382),e=e||{},"boolean"!=typeof r&&(r=t instanceof n),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",r),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(u||(u=i(3141).I),this.decoder=new u(e.encoding),this.encoding=e.encoding)}function E(e){if(n=n||i(5382),!(this instanceof E))return new E(e);var t=this instanceof n;this._readableState=new w(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function T(e,t,i,n,r){l("readableAddChunk",t);var s,c=e._readableState;if(null===t)c.reading=!1,function(e,t){if(l("onEofChunk"),t.ended)return;if(t.decoder){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,t.sync?P(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,A(e)))}(e,c);else if(r||(s=function(e,t){var i;n=t,o.isBuffer(n)||n instanceof a||"string"==typeof t||void 0===t||e.objectMode||(i=new v("chunk",["string","Buffer","Uint8Array"],t));var n;return i}(c,t)),s)_(e,s);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===o.prototype||(t=function(e){return o.from(e)}(t)),n)c.endEmitted?_(e,new S):k(e,c,t,!0);else if(c.ended)_(e,new y);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!i?(t=c.decoder.write(t),c.objectMode||0!==t.length?k(e,c,t,!1):x(e,c)):k(e,c,t,!1)}else n||(c.reading=!1,x(e,c));return!c.ended&&(c.length<c.highWaterMark||0===c.length)}function k(e,t,i,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",i)):(t.length+=t.objectMode?1:i.length,n?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&P(e)),x(e,t)}Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),E.prototype.destroy=p.destroy,E.prototype._undestroy=p.undestroy,E.prototype._destroy=function(e,t){t(e)},E.prototype.push=function(e,t){var i,n=this._readableState;return n.objectMode?i=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=o.from(e,t),t=""),i=!0),T(this,e,t,!1,i)},E.prototype.unshift=function(e){return T(this,e,null,!0,!1)},E.prototype.isPaused=function(){return!1===this._readableState.flowing},E.prototype.setEncoding=function(e){u||(u=i(3141).I);var t=new u(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var R=1073741824;function O(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function P(e){var t=e._readableState;l("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(A,e))}function A(e){var t=e._readableState;l("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,D(e)}function x(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(N,e,t))}function N(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var i=t.length;if(l("maybeReadMore read 0"),e.read(0),i===t.length)break}t.readingMore=!1}function I(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function M(e){l("readable nexttick read 0"),e.read(0)}function L(e,t){l("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),D(e),t.flowing&&!t.reading&&e.read(0)}function D(e){var t=e._readableState;for(l("flow",t.flowing);t.flowing&&null!==e.read(););}function j(e,t){return 0===t.length?null:(t.objectMode?i=t.buffer.shift():!e||e>=t.length?(i=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):i=t.buffer.consume(e,t.decoder),i);var i}function F(e){var t=e._readableState;l("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(B,t,e))}function B(e,t){if(l("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var i=t._writableState;(!i||i.autoDestroy&&i.finished)&&t.destroy()}}function U(e,t){for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1}E.prototype.read=function(e){l("read",e),e=parseInt(e,10);var t=this._readableState,i=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?F(this):P(this),null;if(0===(e=O(e,t))&&t.ended)return 0===t.length&&F(this),null;var n,r=t.needReadable;return l("need readable",r),(0===t.length||t.length-e<t.highWaterMark)&&l("length less than watermark",r=!0),t.ended||t.reading?l("reading or ended",r=!1):r&&(l("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=O(i,t))),null===(n=e>0?j(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),i!==e&&t.ended&&F(this)),null!==n&&this.emit("data",n),n},E.prototype._read=function(e){_(this,new b("_read()"))},E.prototype.pipe=function(e,t){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,l("pipe count=%d opts=%j",n.pipesCount,t);var s=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?a:g;function o(t,r){l("onunpipe"),t===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,l("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",o),i.removeListener("end",a),i.removeListener("end",g),i.removeListener("data",h),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function a(){l("onend"),e.end()}n.endEmitted?process.nextTick(s):i.once("end",s),e.on("unpipe",o);var c=function(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&r(e,"data")&&(t.flowing=!0,D(e))}}(i);e.on("drain",c);var u=!1;function h(t){l("ondata");var r=e.write(t);l("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==U(n.pipes,e))&&!u&&(l("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function d(t){l("onerror",t),g(),e.removeListener("error",d),0===r(e,"error")&&_(e,t)}function f(){e.removeListener("finish",p),g()}function p(){l("onfinish"),e.removeListener("close",f),g()}function g(){l("unpipe"),i.unpipe(e)}return i.on("data",h),function(e,t,i){if("function"==typeof e.prependListener)return e.prependListener(t,i);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(i):e._events[t]=[i,e._events[t]]:e.on(t,i)}(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",i),n.flowing||(l("pipe resume"),i.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,i={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,i)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<r;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=U(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,i)),this},E.prototype.on=function(e,t){var i=s.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,l("on readable",n.length,n.reading),n.length?P(this):n.reading||process.nextTick(M,this))),i},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(e,t){var i=s.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(I,this),i},E.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(I,this),t},E.prototype.resume=function(){var e=this._readableState;return e.flowing||(l("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(L,e,t))}(this,e)),e.paused=!1,this},E.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(e){var t=this,i=this._readableState,n=!1;for(var r in e.on("end",function(){if(l("wrapped end"),i.decoder&&!i.ended){var e=i.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(r){(l("wrapped data"),i.decoder&&(r=i.decoder.write(r)),i.objectMode&&null==r)||(i.objectMode||r&&r.length)&&(t.push(r)||(n=!0,e.pause()))}),e)void 0===this[r]&&"function"==typeof e[r]&&(this[r]=function(t){return function(){return e[t].apply(e,arguments)}}(r));for(var s=0;s<C.length;s++)e.on(C[s],this.emit.bind(this,C[s]));return this._read=function(t){l("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(E.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=i(2955)),h(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),E._fromList=j,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(E.from=function(e,t){return void 0===d&&(d=i(6532)),d(E,e,t)})},4610(e,t,i){"use strict";e.exports=u;var n=i(113).F,r=n.ERR_METHOD_NOT_IMPLEMENTED,s=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,l=i(5382);function c(e,t){var i=this._transformState;i.transforming=!1;var n=i.writecb;if(null===n)return this.emit("error",new s);i.writechunk=null,i.writecb=null,null!=t&&this.push(t),n(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function u(e){if(!(this instanceof u))return new u(e);l.call(this,e),this._transformState={afterTransform:c.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",h)}function h(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush(function(t,i){d(e,t,i)})}function d(e,t,i){if(t)return e.emit("error",t);if(null!=i&&e.push(i),e._writableState.length)throw new a;if(e._transformState.transforming)throw new o;return e.push(null)}i(2017)(u,l),u.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},u.prototype._transform=function(e,t,i){i(new r("_transform()"))},u.prototype._write=function(e,t,i){var n=this._transformState;if(n.writecb=i,n.writechunk=e,n.writeencoding=t,!n.transforming){var r=this._readableState;(n.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},u.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},u.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,function(e){t(e)})}},6708(e,t,i){"use strict";function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,i){var n=e.entry;e.entry=null;for(;n;){var r=n.callback;t.pendingcb--,r(i),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var r;e.exports=E,E.WritableState=w;var s={deprecate:i(7983)},o=i(1416),a=i(181).Buffer,l=("undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,u=i(5896),h=i(5291).getHighWaterMark,d=i(113).F,f=d.ERR_INVALID_ARG_TYPE,p=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,m=d.ERR_STREAM_CANNOT_PIPE,v=d.ERR_STREAM_DESTROYED,y=d.ERR_STREAM_NULL_VALUES,b=d.ERR_STREAM_WRITE_AFTER_END,S=d.ERR_UNKNOWN_ENCODING,_=u.errorOrDestroy;function C(){}function w(e,t,s){r=r||i(5382),e=e||{},"boolean"!=typeof s&&(s=t instanceof r),this.objectMode=!!e.objectMode,s&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var i=e._writableState,n=i.sync,r=i.writecb;if("function"!=typeof r)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(i),t)!function(e,t,i,n,r){--t.pendingcb,i?(process.nextTick(r,n),process.nextTick(A,e,t),e._writableState.errorEmitted=!0,_(e,n)):(r(n),e._writableState.errorEmitted=!0,_(e,n),A(e,t))}(e,i,n,t,r);else{var s=O(i)||e.destroyed;s||i.corked||i.bufferProcessing||!i.bufferedRequest||R(e,i),n?process.nextTick(k,e,i,s,r):k(e,i,s,r)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function E(e){var t=this instanceof(r=r||i(5382));if(!t&&!c.call(E,this))return new E(e);this._writableState=new w(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),o.call(this)}function T(e,t,i,n,r,s,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new v("write")):i?e._writev(r,t.onwrite):e._write(r,s,t.onwrite),t.sync=!1}function k(e,t,i,n){i||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),A(e,t)}function R(e,t){t.bufferProcessing=!0;var i=t.bufferedRequest;if(e._writev&&i&&i.next){var r=t.bufferedRequestCount,s=new Array(r),o=t.corkedRequestsFree;o.entry=i;for(var a=0,l=!0;i;)s[a]=i,i.isBuf||(l=!1),i=i.next,a+=1;s.allBuffers=l,T(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;i;){var c=i.chunk,u=i.encoding,h=i.callback;if(T(e,t,!1,t.objectMode?1:c.length,c,u,h),i=i.next,t.bufferedRequestCount--,t.writing)break}null===i&&(t.lastBufferedRequest=null)}t.bufferedRequest=i,t.bufferProcessing=!1}function O(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function P(e,t){e._final(function(i){t.pendingcb--,i&&_(e,i),t.prefinished=!0,e.emit("prefinish"),A(e,t)})}function A(e,t){var i=O(t);if(i&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(P,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return i}i(2017)(E,o),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(e){return!!c.call(this,e)||this===E&&(e&&e._writableState instanceof w)}})):c=function(e){return e instanceof this},E.prototype.pipe=function(){_(this,new m)},E.prototype.write=function(e,t,i){var n,r=this._writableState,s=!1,o=!r.objectMode&&(n=e,a.isBuffer(n)||n instanceof l);return o&&!a.isBuffer(e)&&(e=function(e){return a.from(e)}(e)),"function"==typeof t&&(i=t,t=null),o?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof i&&(i=C),r.ending?function(e,t){var i=new b;_(e,i),process.nextTick(t,i)}(this,i):(o||function(e,t,i,n){var r;return null===i?r=new y:"string"==typeof i||t.objectMode||(r=new f("chunk",["string","Buffer"],i)),!r||(_(e,r),process.nextTick(n,r),!1)}(this,r,e,i))&&(r.pendingcb++,s=function(e,t,i,n,r,s){if(!i){var o=function(e,t,i){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=a.from(t,i));return t}(t,n,r);n!==o&&(i=!0,r="buffer",n=o)}var l=t.objectMode?1:n.length;t.length+=l;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:r,isBuf:i,callback:s,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,l,n,r,s);return c}(this,r,o,e,t,i)),s},E.prototype.cork=function(){this._writableState.corked++},E.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||R(this,e))},E.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new S(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(e,t,i){i(new p("_write()"))},E.prototype._writev=null,E.prototype.end=function(e,t,i){var n=this._writableState;return"function"==typeof e?(i=e,e=null,t=null):"function"==typeof t&&(i=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,i){t.ending=!0,A(e,t),i&&(t.finished?process.nextTick(i):e.once("finish",i));t.ended=!0,e.writable=!1}(this,n,i),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),E.prototype.destroy=u.destroy,E.prototype._undestroy=u.undestroy,E.prototype._destroy=function(e,t){t(e)}},2955(e,t,i){"use strict";var n;function r(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var s=i(6238),o=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),u=Symbol("lastPromise"),h=Symbol("handlePromise"),d=Symbol("stream");function f(e,t){return{value:e,done:t}}function p(e){var t=e[o];if(null!==t){var i=e[d].read();null!==i&&(e[u]=null,e[o]=null,e[a]=null,t(f(i,!1)))}}function g(e){process.nextTick(p,e)}var m=Object.getPrototypeOf(function(){}),v=Object.setPrototypeOf((r(n={get stream(){return this[d]},next:function(){var e=this,t=this[l];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(f(void 0,!0));if(this[d].destroyed)return new Promise(function(t,i){process.nextTick(function(){e[l]?i(e[l]):t(f(void 0,!0))})});var i,n=this[u];if(n)i=new Promise(function(e,t){return function(i,n){e.then(function(){t[c]?i(f(void 0,!0)):t[h](i,n)},n)}}(n,this));else{var r=this[d].read();if(null!==r)return Promise.resolve(f(r,!1));i=new Promise(this[h])}return this[u]=i,i}},Symbol.asyncIterator,function(){return this}),r(n,"return",function(){var e=this;return new Promise(function(t,i){e[d].destroy(null,function(e){e?i(e):t(f(void 0,!0))})})}),n),m);e.exports=function(e){var t,i=Object.create(v,(r(t={},d,{value:e,writable:!0}),r(t,o,{value:null,writable:!0}),r(t,a,{value:null,writable:!0}),r(t,l,{value:null,writable:!0}),r(t,c,{value:e._readableState.endEmitted,writable:!0}),r(t,h,{value:function(e,t){var n=i[d].read();n?(i[u]=null,i[o]=null,i[a]=null,e(f(n,!1))):(i[o]=e,i[a]=t)},writable:!0}),t));return i[u]=null,s(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=i[a];return null!==t&&(i[u]=null,i[o]=null,i[a]=null,t(e)),void(i[l]=e)}var n=i[o];null!==n&&(i[u]=null,i[o]=null,i[a]=null,n(f(void 0,!0))),i[c]=!0}),e.on("readable",g.bind(null,i)),i}},345(e,t,i){"use strict";function n(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function r(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach(function(t){s(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function s(e,t,i){return(t=a(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function o(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var l=i(181).Buffer,c=i(9023).inspect,u=c&&c.custom||"inspect";function h(e,t,i){l.prototype.copy.call(e,t,i)}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,i,n;return t=e,(i=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,i=""+t.data;t=t.next;)i+=e+t.data;return i}},{key:"concat",value:function(e){if(0===this.length)return l.alloc(0);for(var t=l.allocUnsafe(e>>>0),i=this.head,n=0;i;)h(i.data,t,n),n+=i.data.length,i=i.next;return t}},{key:"consume",value:function(e,t){var i;return e<this.head.data.length?(i=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):i=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),i}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,i=1,n=t.data;for(e-=n.length;t=t.next;){var r=t.data,s=e>r.length?r.length:e;if(s===r.length?n+=r:n+=r.slice(0,e),0===(e-=s)){s===r.length?(++i,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=r.slice(s));break}++i}return this.length-=i,n}},{key:"_getBuffer",value:function(e){var t=l.allocUnsafe(e),i=this.head,n=1;for(i.data.copy(t),e-=i.data.length;i=i.next;){var r=i.data,s=e>r.length?r.length:e;if(r.copy(t,t.length-e,0,s),0===(e-=s)){s===r.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=r.slice(s));break}++n}return this.length-=n,t}},{key:u,value:function(e,t){return c(this,r(r({},t),{},{depth:0,customInspect:!1}))}}])&&o(t.prototype,i),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},5896(e){"use strict";function t(e,t){n(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}e.exports={destroy:function(e,r){var s=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(r?r(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(n,this,e)):process.nextTick(n,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!r&&e?s._writableState?s._writableState.errorEmitted?process.nextTick(i,s):(s._writableState.errorEmitted=!0,process.nextTick(t,s,e)):process.nextTick(t,s,e):r?(process.nextTick(i,s),r(e)):process.nextTick(i,s)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var i=e._readableState,n=e._writableState;i&&i.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},6238(e,t,i){"use strict";var n=i(113).F.ERR_STREAM_PREMATURE_CLOSE;function r(){}e.exports=function e(t,i,s){if("function"==typeof i)return e(t,null,i);i||(i={}),s=function(e){var t=!1;return function(){if(!t){t=!0;for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];e.apply(this,n)}}}(s||r);var o=i.readable||!1!==i.readable&&t.readable,a=i.writable||!1!==i.writable&&t.writable,l=function(){t.writable||u()},c=t._writableState&&t._writableState.finished,u=function(){a=!1,c=!0,o||s.call(t)},h=t._readableState&&t._readableState.endEmitted,d=function(){o=!1,h=!0,a||s.call(t)},f=function(e){s.call(t,e)},p=function(){var e;return o&&!h?(t._readableState&&t._readableState.ended||(e=new n),s.call(t,e)):a&&!c?(t._writableState&&t._writableState.ended||(e=new n),s.call(t,e)):void 0},g=function(){t.req.on("finish",u)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?a&&!t._writableState&&(t.on("end",l),t.on("close",l)):(t.on("complete",u),t.on("abort",p),t.req?g():t.on("request",g)),t.on("end",d),t.on("finish",u),!1!==i.error&&t.on("error",f),t.on("close",p),function(){t.removeListener("complete",u),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",u),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",u),t.removeListener("end",d),t.removeListener("error",f),t.removeListener("close",p)}}},6532(e,t,i){"use strict";function n(e,t,i,n,r,s,o){try{var a=e[s](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(n,r)}function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function s(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var o=i(113).F.ERR_INVALID_ARG_TYPE;e.exports=function(e,t,i){var a;if(t&&"function"==typeof t.next)a=t;else if(t&&t[Symbol.asyncIterator])a=t[Symbol.asyncIterator]();else{if(!t||!t[Symbol.iterator])throw new o("iterable",["Iterable"],t);a=t[Symbol.iterator]()}var l=new e(function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach(function(t){s(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}({objectMode:!0},i)),c=!1;function u(){return h.apply(this,arguments)}function h(){var e;return e=function*(){try{var e=yield a.next(),t=e.value;e.done?l.push(null):l.push(yield t)?u():c=!1}catch(e){l.destroy(e)}},h=function(){var t=this,i=arguments;return new Promise(function(r,s){var o=e.apply(t,i);function a(e){n(o,r,s,a,l,"next",e)}function l(e){n(o,r,s,a,l,"throw",e)}a(void 0)})},h.apply(this,arguments)}return l._read=function(){c||(c=!0,u())},l}},7758(e,t,i){"use strict";var n;var r=i(113).F,s=r.ERR_MISSING_ARGS,o=r.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function l(e){e()}function c(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var u,h=function(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new s("streams");var d=t.map(function(e,r){var s=r<t.length-1;return function(e,t,r,s){s=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(s);var a=!1;e.on("close",function(){a=!0}),void 0===n&&(n=i(6238)),n(e,{readable:t,writable:r},function(e){if(e)return s(e);a=!0,s()});var l=!1;return function(t){if(!a&&!l)return l=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new o("pipe"))}}(e,s,r>0,function(e){u||(u=e),e&&d.forEach(l),s||(d.forEach(l),h(u))})});return t.reduce(c)}},5291(e,t,i){"use strict";var n=i(113).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,i,r){var s=function(e,t,i){return null!=e.highWaterMark?e.highWaterMark:t?e[i]:null}(t,r,i);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new n(r?i:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}},1416(e,t,i){e.exports=i(2203)},4198(e,t,i){var n=i(2203);"disable"===process.env.READABLE_STREAM&&n?(e.exports=n.Readable,Object.assign(e.exports,n),e.exports.Stream=n):((t=e.exports=i(5412)).Stream=n||t,t.Readable=t,t.Writable=i(6708),t.Duplex=i(5382),t.Transform=i(4610),t.PassThrough=i(3600),t.finished=i(6238),t.pipeline=i(7758))},2861(e,t,i){var n=i(181),r=n.Buffer;function s(e,t){for(var i in e)t[i]=e[i]}function o(e,t,i){return r(e,t,i)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=o),o.prototype=Object.create(r.prototype),s(r,o),o.from=function(e,t,i){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,i)},o.alloc=function(e,t,i){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=r(e);return void 0!==t?"string"==typeof i?n.fill(t,i):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},4546(e,t,i){var n=i(9896);e.exports=function(e,t,i){t=void 0!==t?t:"\n",i=void 0!==i?i:"utf8";var r=[],s=n.readFileSync(e,i);if(s.indexOf("-END CERTIFICATE-")<0||s.indexOf("-BEGIN CERTIFICATE-")<0)throw Error("File does not contain 'BEGIN CERTIFICATE' or 'END CERTIFICATE'");var o,a,l=[];for(o=0,a=(s=s.split(t)).length;o<a;o++){var c=s[o];0!==c.length&&(l.push(c),c.match(/-END CERTIFICATE-/)&&(r.push(l.join(t)),l=[]))}return r}},3141(e,t,i){"use strict";var n=i(2861).Buffer,r=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=u,this.end=h,t=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,i=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==i?i:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var i=e.toString("utf16le",t);if(i){var n=i.charCodeAt(i.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],i.slice(0,-1)}return i}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var i=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,i)}return t}function u(e,t){var i=(e.length-t)%3;return 0===i?e.toString("base64",t):(this.lastNeed=3-i,this.lastTotal=3,1===i?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-i))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.I=s,s.prototype.write=function(e){if(0===e.length)return"";var t,i;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<e.length?t?t+this.text(e,i):this.text(e,i):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var i=function(e,t,i){var n=t.length-1;if(n<i)return 0;var r=o(t[n]);if(r>=0)return r>0&&(e.lastNeed=r-1),r;if(--n<i||-2===r)return 0;if(r=o(t[n]),r>=0)return r>0&&(e.lastNeed=r-2),r;if(--n<i||-2===r)return 0;if(r=o(t[n]),r>=0)return r>0&&(2===r?r=0:e.lastNeed=r-3),r;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=i;var n=e.length-(i-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},6868(e,t,i){var n=i(6284),r=i(6706),s=i(815),o=i(9505),a=i(9896),l=i(6928),c="win32"===i(857).platform(),u=function(){},h=function(e){return e},d=c?function(e){return e.replace(/\\/g,"/").replace(/[:?<>|]/g,"_")}:h,f=function(e,t){return function(i){i.name=i.name.split("/").slice(t).join("/");var n=i.linkname;return n&&("link"===i.type||l.isAbsolute(n))&&(i.linkname=n.split("/").slice(t).join("/")),e(i)}};t.pack=function(e,t){e||(e="."),t||(t={});var i=t.fs||a,n=t.ignore||t.filter||u,o=t.map||u,c=t.mapStream||h,p=function(e,t,i,n,r,s){var o=r||["."];return function(r){if(!o.length)return r();var a=o.shift(),c=l.join(i,a);t.call(e,c,function(t,u){return t?r(t):u.isDirectory()?void e.readdir(c,function(e,t){if(e)return r(e);s&&t.sort();for(var c=0;c<t.length;c++)n(l.join(i,a,t[c]))||o.push(l.join(a,t[c]));r(null,a,u)}):r(null,a,u)})}}(i,t.dereference?i.stat:i.lstat,e,n,t.entries,t.sort),m=!1!==t.strict,v="number"==typeof t.umask?~t.umask:~g(),y="number"==typeof t.dmode?t.dmode:0,b="number"==typeof t.fmode?t.fmode:0,S=t.pack||r.pack(),_=t.finish||u;t.strip&&(o=f(o,t.strip)),t.readable&&(y|=parseInt(555,8),b|=parseInt(444,8)),t.writable&&(y|=parseInt(333,8),b|=parseInt(222,8));var C=function(n,r,a){if(n)return S.destroy(n);if(!r)return!1!==t.finalize&&S.finalize(),_(S);if(a.isSocket())return w();var u={name:d(r),mode:(a.mode|(a.isDirectory()?y:b))&v,mtime:a.mtime,size:a.size,type:"file",uid:a.uid,gid:a.gid};if(a.isDirectory())return u.size=0,u.type="directory",u=o(u)||u,S.entry(u,w);if(a.isSymbolicLink())return u.size=0,u.type="symlink",function(t,n){i.readlink(l.join(e,t),function(e,t){if(e)return S.destroy(e);n.linkname=d(t),S.entry(n,w)})}(r,u=o(u)||u);if(u=o(u)||u,!a.isFile())return m?S.destroy(new Error("unsupported type for "+r)):w();var h=S.entry(u,w);if(h){var f=c(i.createReadStream(l.join(e,r),{start:0,end:u.size>0?u.size-1:u.size}),u);f.on("error",function(e){h.destroy(e)}),s(f,h)}},w=function(e){if(e)return S.destroy(e);p(C)};return w(),S};var p=function(e){return e.length?e[e.length-1]:null},g=function(){return process.umask?process.umask():0};function m(e,t,i,n){if(t===i)return n(null,!0);e.lstat(t,function(r,s){return r&&"ENOENT"!==r.code?n(r):r||s.isDirectory()?m(e,l.join(t,".."),i,n):void n(null,!1)})}function v(e,t,i){o(e,{fs:t.fs},function(e,r){!e&&r&&t.own?n(r,t.uid,t.gid,i):i(e)})}function y(e,t){return(t=l.resolve(t))===e||e.startsWith(t+l.sep)}t.extract=function(e,t){e||(e="."),t||(t={});var i=t.fs||a,n=t.ignore||t.filter||u,o=t.map||u,b=t.mapStream||h,S=!1!==t.chown&&!c&&0===(process.getuid?process.getuid():-1),_=t.extract||r.extract(),C=[],w=new Date,E="number"==typeof t.umask?~t.umask:~g(),T="number"==typeof t.dmode?t.dmode:0,k="number"==typeof t.fmode?t.fmode:0,R=!1!==t.strict;t.strip&&(o=f(o,t.strip)),t.readable&&(T|=parseInt(555,8),k|=parseInt(444,8)),t.writable&&(T|=parseInt(333,8),k|=parseInt(222,8));var O=function(e,t){for(var n;(n=p(C))&&e.slice(0,n[0].length)!==n[0];)C.pop();if(!n)return t();i.utimes(n[0],w,n[1],t)};return _.on("entry",function(r,a,u){(r=o(r)||r).name=d(r.name);var h=l.join(e,l.join("/",r.name));if(n(h,r))return a.resume(),u();var f=function(e){if(e)return u(e);!function(e,n,r){!1===t.utimes?r():"directory"===n.type?i.utimes(e,w,n.mtime,r):"symlink"===n.type?O(e,r):i.utimes(e,w,n.mtime,function(t){if(t)return r(t);O(e,r)})}(h,r,function(e){return e?u(e):c?u():void function(e,t,n){var r="symlink"===t.type,s=r?i.lchmod:i.chmod,o=r?i.lchown:i.chown;if(!s)return n();var a=(t.mode|("directory"===t.type?T:k))&E;function l(t){return t?n(t):s?void s.call(i,e,a,n):n()}o&&S?o.call(i,e,t.uid,t.gid,l):l(null)}(h,r,u)})},p=function(){var e=i.createWriteStream(h),t=b(a,r);e.on("error",function(e){t.destroy(e)}),s(t,e,function(t){if(t)return u(t);e.on("close",f)})};if("directory"===r.type)return C.push([h,r.mtime]),v(h,{fs:i,own:S,uid:r.uid,gid:r.gid},f);var g=l.dirname(h);m(i,g,l.join(e,"."),function(n,s){return n?u(n):s?void v(g,{fs:i,own:S,uid:r.uid,gid:r.gid},function(n){if(n)return u(n);switch(r.type){case"file":return p();case"link":return function(){if(c)return u();i.unlink(h,function(){var n=l.join(e,l.join("/",r.linkname));i.realpath(n,function(r,s){if(r||!y(s,e))return u(new Error(h+" is not a valid hardlink"));i.link(s,h,function(e){if(e&&"EPERM"===e.code&&t.hardlinkAsFilesFallback)return a=i.createReadStream(n),p();f(e)})})})}();case"symlink":return function(){if(c)return u();i.unlink(h,function(){if(!y(l.resolve(l.dirname(h),r.linkname),e))return u(new Error(h+" is not a valid symlink"));i.symlink(r.linkname,h,f)})}()}if(R)return u(new Error("unsupported type for "+h+" ("+r.type+")"));a.resume(),u()}):u(new Error(g+" is not a valid path"))})}),t.finish&&_.on("finish",t.finish),_}},5518(e,t,i){"use strict";const{Buffer:n}=i(181),r=Symbol.for("BufferList");function s(e){if(!(this instanceof s))return new s(e);s._init.call(this,e)}s._init=function(e){Object.defineProperty(this,r,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},s.prototype._new=function(e){return new s(e)},s.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let i=0;i<this._bufs.length;i++){const n=t+this._bufs[i].length;if(e<n||i===this._bufs.length-1)return[i,e-t];t=n}},s.prototype._reverseOffset=function(e){const t=e[0];let i=e[1];for(let e=0;e<t;e++)i+=this._bufs[e].length;return i},s.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},s.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},s.prototype.copy=function(e,t,i,r){if(("number"!=typeof i||i<0)&&(i=0),("number"!=typeof r||r>this.length)&&(r=this.length),i>=this.length)return e||n.alloc(0);if(r<=0)return e||n.alloc(0);const s=!!e,o=this._offset(i),a=r-i;let l=a,c=s&&t||0,u=o[1];if(0===i&&r===this.length){if(!s)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,c),c+=this._bufs[t].length;return e}if(l<=this._bufs[o[0]].length-u)return s?this._bufs[o[0]].copy(e,t,u,u+l):this._bufs[o[0]].slice(u,u+l);s||(e=n.allocUnsafe(a));for(let t=o[0];t<this._bufs.length;t++){const i=this._bufs[t].length-u;if(!(l>i)){this._bufs[t].copy(e,c,u,u+l),c+=i;break}this._bufs[t].copy(e,c,u),c+=i,l-=i,u&&(u=0)}return e.length>c?e.slice(0,c):e},s.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const i=this._offset(e),n=this._offset(t),r=this._bufs.slice(i[0],n[0]+1);return 0===n[1]?r.pop():r[r.length-1]=r[r.length-1].slice(0,n[1]),0!==i[1]&&(r[0]=r[0].slice(i[1])),this._new(r)},s.prototype.toString=function(e,t,i){return this.slice(t,i).toString(e)},s.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},s.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(n.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(n.from(e));return this},s.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},s.prototype.indexOf=function(e,t,i){if(void 0===i&&"string"==typeof t&&(i=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=n.from([e]):"string"==typeof e?e=n.from(e,i):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=n.from(e.buffer,e.byteOffset,e.byteLength):n.isBuffer(e)||(e=n.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const r=this._offset(t);let s=r[0],o=r[1];for(;s<this._bufs.length;s++){const t=this._bufs[s];for(;o<t.length;){if(t.length-o>=e.length){const i=t.indexOf(e,o);if(-1!==i)return this._reverseOffset([s,i]);o=t.length-e.length+1}else{const t=this._reverseOffset([s,o]);if(this._match(t,e))return t;o++}}o=0}return-1},s.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let i=0;i<t.length;i++)if(this.get(e+i)!==t[i])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)(function(t){s.prototype[t]=null===e[t]?function(e,i){return this.slice(e,e+i)[t](0,i)}:function(i=0){return this.slice(i,i+e[t])[t](0)}})(t)}(),s.prototype._isBufferList=function(e){return e instanceof s||s.isBufferList(e)},s.isBufferList=function(e){return null!=e&&e[r]},e.exports=s},5278(e,t,i){"use strict";const n=i(4198).Duplex,r=i(2017),s=i(5518);function o(e){if(!(this instanceof o))return new o(e);if("function"==typeof e){this._callback=e;const t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(e){e.on("error",t)}),this.on("unpipe",function(e){e.removeListener("error",t)}),e=null}s._init.call(this,e),n.call(this)}r(o,n),Object.assign(o.prototype,s.prototype),o.prototype._new=function(e){return new o(e)},o.prototype._write=function(e,t,i){this._appendBuffer(e),"function"==typeof i&&i()},o.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},o.prototype.end=function(e){n.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},o.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},o.prototype._isBufferList=function(e){return e instanceof o||e instanceof s||o.isBufferList(e)},o.isBufferList=s.isBufferList,e.exports=o,e.exports.BufferListStream=o,e.exports.BufferList=s},6284(e,t,i){"use strict";const n=i(9896),r=i(6928),s=n.lchown?"lchown":"chown",o=n.lchownSync?"lchownSync":"chownSync",a=n.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),l=(e,t,i)=>{try{return n[o](e,t,i)}catch(e){if("ENOENT"!==e.code)throw e}},c=a?(e,t,i,r)=>s=>{s&&"EISDIR"===s.code?n.chown(e,t,i,r):r(s)}:(e,t,i,n)=>n,u=a?(e,t,i)=>{try{return l(e,t,i)}catch(r){if("EISDIR"!==r.code)throw r;((e,t,i)=>{try{return n.chownSync(e,t,i)}catch(e){if("ENOENT"!==e.code)throw e}})(e,t,i)}}:(e,t,i)=>l(e,t,i),h=process.version;let d=(e,t,i)=>n.readdir(e,t,i);/^v4\./.test(h)&&(d=(e,t,i)=>n.readdir(e,i));const f=(e,t,i,r)=>{n[s](e,t,i,c(e,t,i,e=>{r(e&&"ENOENT"!==e.code?e:null)}))},p=(e,t,i,s,o)=>{if("string"==typeof t)return n.lstat(r.resolve(e,t),(n,r)=>{if(n)return o("ENOENT"!==n.code?n:null);r.name=t,p(e,r,i,s,o)});if(t.isDirectory())g(r.resolve(e,t.name),i,s,n=>{if(n)return o(n);const a=r.resolve(e,t.name);f(a,i,s,o)});else{const n=r.resolve(e,t.name);f(n,i,s,o)}},g=(e,t,i,n)=>{d(e,{withFileTypes:!0},(r,s)=>{if(r){if("ENOENT"===r.code)return n();if("ENOTDIR"!==r.code&&"ENOTSUP"!==r.code)return n(r)}if(r||!s.length)return f(e,t,i,n);let o=s.length,a=null;const l=r=>{if(!a)return r?n(a=r):0===--o?f(e,t,i,n):void 0};s.forEach(n=>p(e,n,t,i,l))})},m=(e,t,i)=>{let s;try{s=((e,t)=>n.readdirSync(e,t))(e,{withFileTypes:!0})}catch(n){if("ENOENT"===n.code)return;if("ENOTDIR"===n.code||"ENOTSUP"===n.code)return u(e,t,i);throw n}return s&&s.length&&s.forEach(s=>((e,t,i,s)=>{if("string"==typeof t)try{const i=n.lstatSync(r.resolve(e,t));i.name=t,t=i}catch(e){if("ENOENT"===e.code)return;throw e}t.isDirectory()&&m(r.resolve(e,t.name),i,s),u(r.resolve(e,t.name),i,s)})(e,s,t,i)),u(e,t,i)};e.exports=g,g.sync=m},3807(e,t,i){var n=i(9023),r=i(5278),s=i(3544),o=i(4198).Writable,a=i(4198).PassThrough,l=function(){},c=function(e){return(e&=511)&&512-e},u=function(e,t){this._parent=e,this.offset=t,a.call(this,{autoDestroy:!1})};n.inherits(u,a),u.prototype.destroy=function(e){this._parent.destroy(e)};var h=function(e){if(!(this instanceof h))return new h(e);o.call(this,e),e=e||{},this._offset=0,this._buffer=r(),this._missing=0,this._partial=!1,this._onparse=l,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var t=this,i=t._buffer,n=function(){t._continue()},a=function(e){if(t._locked=!1,e)return t.destroy(e);t._stream||n()},d=function(){t._stream=null;var e=c(t._header.size);e?t._parse(e,f):t._parse(512,y),t._locked||n()},f=function(){t._buffer.consume(c(t._header.size)),t._parse(512,y),n()},p=function(){var e=t._header.size;t._paxGlobal=s.decodePax(i.slice(0,e)),i.consume(e),d()},g=function(){var e=t._header.size;t._pax=s.decodePax(i.slice(0,e)),t._paxGlobal&&(t._pax=Object.assign({},t._paxGlobal,t._pax)),i.consume(e),d()},m=function(){var n=t._header.size;this._gnuLongPath=s.decodeLongPath(i.slice(0,n),e.filenameEncoding),i.consume(n),d()},v=function(){var n=t._header.size;this._gnuLongLinkPath=s.decodeLongPath(i.slice(0,n),e.filenameEncoding),i.consume(n),d()},y=function(){var r,o=t._offset;try{r=t._header=s.decode(i.slice(0,512),e.filenameEncoding,e.allowUnknownFormat)}catch(e){t.emit("error",e)}return i.consume(512),r?"gnu-long-path"===r.type?(t._parse(r.size,m),void n()):"gnu-long-link-path"===r.type?(t._parse(r.size,v),void n()):"pax-global-header"===r.type?(t._parse(r.size,p),void n()):"pax-header"===r.type?(t._parse(r.size,g),void n()):(t._gnuLongPath&&(r.name=t._gnuLongPath,t._gnuLongPath=null),t._gnuLongLinkPath&&(r.linkname=t._gnuLongLinkPath,t._gnuLongLinkPath=null),t._pax&&(t._header=r=function(e,t){return t.path&&(e.name=t.path),t.linkpath&&(e.linkname=t.linkpath),t.size&&(e.size=parseInt(t.size,10)),e.pax=t,e}(r,t._pax),t._pax=null),t._locked=!0,r.size&&"directory"!==r.type?(t._stream=new u(t,o),t.emit("entry",r,t._stream,a),t._parse(r.size,d),void n()):(t._parse(512,y),void t.emit("entry",r,function(e,t){var i=new u(e,t);return i.end(),i}(t,o),a))):(t._parse(512,y),void n())};this._onheader=y,this._parse(512,y)};n.inherits(h,o),h.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.emit("close"))},h.prototype._parse=function(e,t){this._destroyed||(this._offset+=e,this._missing=e,t===this._onheader&&(this._partial=!1),this._onparse=t)},h.prototype._continue=function(){if(!this._destroyed){var e=this._cb;this._cb=l,this._overflow?this._write(this._overflow,void 0,e):e()}},h.prototype._write=function(e,t,i){if(!this._destroyed){var n=this._stream,r=this._buffer,s=this._missing;if(e.length&&(this._partial=!0),e.length<s)return this._missing-=e.length,this._overflow=null,n?n.write(e,i):(r.append(e),i());this._cb=i,this._missing=0;var o=null;e.length>s&&(o=e.slice(s),e=e.slice(0,s)),n?n.end(e):r.append(e),this._overflow=o,this._onparse()}},h.prototype._final=function(e){if(this._partial)return this.destroy(new Error("Unexpected end of data"));e()},e.exports=h},3544(e,t){var i=Buffer.alloc,n="0".charCodeAt(0),r=Buffer.from("ustar\0","binary"),s=Buffer.from("00","binary"),o=Buffer.from("ustar ","binary"),a=Buffer.from(" \0","binary"),l=parseInt("7777",8),c=257,u=function(e,t,i,n){for(;i<n;i++)if(e[i]===t)return i;return n},h=function(e){for(var t=256,i=0;i<148;i++)t+=e[i];for(var n=156;n<512;n++)t+=e[n];return t},d=function(e,t){return(e=e.toString(8)).length>t?"7777777777777777777".slice(0,t)+" ":"0000000000000000000".slice(0,t-e.length)+e+" "};var f=function(e,t,i){if(128&(e=e.slice(t,t+i))[t=0])return function(e){var t;if(128===e[0])t=!0;else{if(255!==e[0])return null;t=!1}for(var i=[],n=e.length-1;n>0;n--){var r=e[n];t?i.push(r):i.push(255-r)}var s=0,o=i.length;for(n=0;n<o;n++)s+=i[n]*Math.pow(256,n);return t?s:-1*s}(e);for(;t<e.length&&32===e[t];)t++;for(var n=(r=u(e,32,t,e.length),s=e.length,o=e.length,"number"!=typeof r?o:(r=~~r)>=s?s:r>=0||(r+=s)>=0?r:0);t<n&&0===e[t];)t++;return n===t?0:parseInt(e.slice(t,n).toString(),8);var r,s,o},p=function(e,t,i,n){return e.slice(t,u(e,0,t,t+i)).toString(n)},g=function(e){var t=Buffer.byteLength(e),i=Math.floor(Math.log(t)/Math.log(10))+1;return t+i>=Math.pow(10,i)&&i++,t+i+e};t.decodeLongPath=function(e,t){return p(e,0,e.length,t)},t.encodePax=function(e){var t="";e.name&&(t+=g(" path="+e.name+"\n")),e.linkname&&(t+=g(" linkpath="+e.linkname+"\n"));var i=e.pax;if(i)for(var n in i)t+=g(" "+n+"="+i[n]+"\n");return Buffer.from(t)},t.decodePax=function(e){for(var t={};e.length;){for(var i=0;i<e.length&&32!==e[i];)i++;var n=parseInt(e.slice(0,i).toString(),10);if(!n)return t;var r=e.slice(i+1,n-1).toString(),s=r.indexOf("=");if(-1===s)return t;t[r.slice(0,s)]=r.slice(s+1),e=e.slice(n)}return t},t.encode=function(e){var t=i(512),o=e.name,a="";if(5===e.typeflag&&"/"!==o[o.length-1]&&(o+="/"),Buffer.byteLength(o)!==o.length)return null;for(;Buffer.byteLength(o)>100;){var u=o.indexOf("/");if(-1===u)return null;a+=a?"/"+o.slice(0,u):o.slice(0,u),o=o.slice(u+1)}return Buffer.byteLength(o)>100||Buffer.byteLength(a)>155||e.linkname&&Buffer.byteLength(e.linkname)>100?null:(t.write(o),t.write(d(e.mode&l,6),100),t.write(d(e.uid,6),108),t.write(d(e.gid,6),116),t.write(d(e.size,11),124),t.write(d(e.mtime.getTime()/1e3|0,11),136),t[156]=n+function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}(e.type),e.linkname&&t.write(e.linkname,157),r.copy(t,c),s.copy(t,263),e.uname&&t.write(e.uname,265),e.gname&&t.write(e.gname,297),t.write(d(e.devmajor||0,6),329),t.write(d(e.devminor||0,6),337),a&&t.write(a,345),t.write(d(h(t),6),148),t)},t.decode=function(e,t,i){var s=0===e[156]?0:e[156]-n,l=p(e,0,100,t),u=f(e,100,8),d=f(e,108,8),g=f(e,116,8),m=f(e,124,12),v=f(e,136,12),y=function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}(s),b=0===e[157]?null:p(e,157,100,t),S=p(e,265,32),_=p(e,297,32),C=f(e,329,8),w=f(e,337,8),E=h(e);if(256===E)return null;if(E!==f(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(0===r.compare(e,c,263))e[345]&&(l=p(e,345,155,t)+"/"+l);else if(0===o.compare(e,c,263)&&0===a.compare(e,263,265));else if(!i)throw new Error("Invalid tar header: unknown format.");return 0===s&&l&&"/"===l[l.length-1]&&(s=5),{name:l,mode:u,uid:d,gid:g,size:m,mtime:new Date(1e3*v),type:y,linkname:b,uname:S,gname:_,devmajor:C,devminor:w}}},6706(e,t,i){t.extract=i(3807),t.pack=i(4009)},4009(e,t,i){var n=i(2170),r=i(6611),s=i(2017),o=Buffer.alloc,a=i(4198).Readable,l=i(4198).Writable,c=i(3193).StringDecoder,u=i(3544),h=parseInt("755",8),d=parseInt("644",8),f=o(1024),p=function(){},g=function(e,t){(t&=511)&&e.push(f.slice(0,512-t))};var m=function(e){l.call(this),this.written=0,this._to=e,this._destroyed=!1};s(m,l),m.prototype._write=function(e,t,i){if(this.written+=e.length,this._to.push(e))return i();this._to._drain=i},m.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var v=function(){l.call(this),this.linkname="",this._decoder=new c("utf-8"),this._destroyed=!1};s(v,l),v.prototype._write=function(e,t,i){this.linkname+=this._decoder.write(e),i()},v.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var y=function(){l.call(this),this._destroyed=!1};s(y,l),y.prototype._write=function(e,t,i){i(new Error("No body allowed for this entry"))},y.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var b=function(e){if(!(this instanceof b))return new b(e);a.call(this,e),this._drain=p,this._finalized=!1,this._finalizing=!1,this._destroyed=!1,this._stream=null};s(b,a),b.prototype.entry=function(e,t,i){if(this._stream)throw new Error("already piping an entry");if(!this._finalized&&!this._destroyed){"function"==typeof t&&(i=t,t=null),i||(i=p);var s=this;if(e.size&&"symlink"!==e.type||(e.size=0),e.type||(e.type=function(e){switch(e&n.S_IFMT){case n.S_IFBLK:return"block-device";case n.S_IFCHR:return"character-device";case n.S_IFDIR:return"directory";case n.S_IFIFO:return"fifo";case n.S_IFLNK:return"symlink"}return"file"}(e.mode)),e.mode||(e.mode="directory"===e.type?h:d),e.uid||(e.uid=0),e.gid||(e.gid=0),e.mtime||(e.mtime=new Date),"string"==typeof t&&(t=Buffer.from(t)),Buffer.isBuffer(t)){e.size=t.length,this._encode(e);var o=this.push(t);return g(s,e.size),o?process.nextTick(i):this._drain=i,new y}if("symlink"===e.type&&!e.linkname){var a=new v;return r(a,function(t){if(t)return s.destroy(),i(t);e.linkname=a.linkname,s._encode(e),i()}),a}if(this._encode(e),"file"!==e.type&&"contiguous-file"!==e.type)return process.nextTick(i),new y;var l=new m(this);return this._stream=l,r(l,function(t){return s._stream=null,t?(s.destroy(),i(t)):l.written!==e.size?(s.destroy(),i(new Error("size mismatch"))):(g(s,e.size),s._finalizing&&s.finalize(),void i())}),l}},b.prototype.finalize=function(){this._stream?this._finalizing=!0:this._finalized||(this._finalized=!0,this.push(f),this.push(null))},b.prototype.destroy=function(e){this._destroyed||(this._destroyed=!0,e&&this.emit("error",e),this.emit("close"),this._stream&&this._stream.destroy&&this._stream.destroy())},b.prototype._encode=function(e){if(!e.pax){var t=u.encode(e);if(t)return void this.push(t)}this._encodePax(e)},b.prototype._encodePax=function(e){var t=u.encodePax({name:e.name,linkname:e.linkname,pax:e.pax}),i={name:"PaxHeader",mode:e.mode,uid:e.uid,gid:e.gid,size:t.length,mtime:e.mtime,type:"pax-header",linkname:e.linkname&&"PaxHeader",uname:e.uname,gname:e.gname,devmajor:e.devmajor,devminor:e.devminor};this.push(u.encode(i)),this.push(t),g(this,t.length),i.size=e.size,i.type=e.type,this.push(u.encode(i))},b.prototype._read=function(e){var t=this._drain;this._drain=p,t()},e.exports=b},7983(e,t,i){e.exports=i(9023).deprecate},4679(e,t,i){"use strict";i.d(t,{v4:()=>h});const n=require("node:crypto");var r=i.n(n);const s={randomUUID:r().randomUUID},o=new Uint8Array(256);let a=o.length;function l(){return a>o.length-16&&(r().randomFillSync(o),a=0),o.slice(a,a+=16)}const c=[];for(let e=0;e<256;++e)c.push((e+256).toString(16).slice(1));function u(e,t=0){return(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase()}const h=function(e,t,i){if(s.randomUUID&&!t&&!e)return s.randomUUID();const n=(e=e||{}).random||(e.rng||l)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(let e=0;e<16;++e)t[i+e]=n[e];return t}return u(n)}},6587(e){e.exports=function e(t,i){if(t&&i)return e(t)(i);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(e){n[e]=t[e]}),n;function n(){for(var e=new Array(arguments.length),i=0;i<e.length;i++)e[i]=arguments[i];var n=t.apply(this,e),r=e[e.length-1];return"function"==typeof n&&n!==r&&Object.keys(r).forEach(function(e){n[e]=r[e]}),n}}},6087(e){"use strict";e.exports=require("@xiaobaidadada/node-pty-prebuilt")},2710(e){"use strict";e.exports=require("@xiaobaidadada/node-tuntap2-wintun")},1217(e){"use strict";e.exports=require("@xiaobaidadada/ssh2-prebuilt")},7550(e){"use strict";e.exports=require("better-sqlite3")},9642(e){"use strict";e.exports=require("better-sqlite3/build/Release/better_sqlite3.node")},4505(e){"use strict";e.exports=require("node-process-watcher")},181(e){"use strict";e.exports=require("buffer")},9140(e){"use strict";e.exports=require("constants")},2250(e){"use strict";e.exports=require("dns")},4434(e){"use strict";e.exports=require("events")},9896(e){"use strict";e.exports=require("fs")},8611(e){"use strict";e.exports=require("http")},5675(e){"use strict";e.exports=require("http2")},5692(e){"use strict";e.exports=require("https")},9278(e){"use strict";e.exports=require("net")},857(e){"use strict";e.exports=require("os")},6928(e){"use strict";e.exports=require("path")},932(e){"use strict";e.exports=require("process")},3480(e){"use strict";e.exports=require("querystring")},2203(e){"use strict";e.exports=require("stream")},3193(e){"use strict";e.exports=require("string_decoder")},4756(e){"use strict";e.exports=require("tls")},7016(e){"use strict";e.exports=require("url")},9023(e){"use strict";e.exports=require("util")},8167(e){"use strict";e.exports=require("worker_threads")},3106(e){"use strict";e.exports=require("zlib")},5017(e,t){var i;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,i=function(){var e={};return function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function i(e,t,i){this.low=0|e,this.high=0|t,this.unsigned=!!i}function n(e){return!0===(e&&e.__isLong__)}function r(e){var t=Math.clz32(e&-e);return e?31-t:t}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),i.isLong=n;var s={},o={};function a(e,t){var i,n,r;return t?(r=0<=(e>>>=0)&&e<256)&&(n=o[e])?n:(i=c(e,0,!0),r&&(o[e]=i),i):(r=-128<=(e|=0)&&e<128)&&(n=s[e])?n:(i=c(e,e<0?-1:0,!1),r&&(s[e]=i),i)}function l(e,t){if(isNaN(e))return t?b:y;if(t){if(e<0)return b;if(e>=g)return E}else{if(e<=-m)return T;if(e+1>=m)return w}return e<0?l(-e,t).neg():c(e%p|0,e/p|0,t)}function c(e,t,n){return new i(e,t,n)}i.fromInt=a,i.fromNumber=l,i.fromBits=c;var u=Math.pow;function h(e,t,i){if(0===e.length)throw Error("empty string");if("number"==typeof t?(i=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?b:y;if((i=i||10)<2||36<i)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return h(e.substring(1),t,i).neg();for(var r=l(u(i,8)),s=y,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+a),i);if(a<8){var d=l(u(i,a));s=s.mul(d).add(l(c))}else s=(s=s.mul(r)).add(l(c))}return s.unsigned=t,s}function d(e,t){return"number"==typeof e?l(e,t):"string"==typeof e?h(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}i.fromString=h,i.fromValue=d;var f=65536,p=f*f,g=p*p,m=g/2,v=a(1<<24),y=a(0);i.ZERO=y;var b=a(0,!0);i.UZERO=b;var S=a(1);i.ONE=S;var _=a(1,!0);i.UONE=_;var C=a(-1);i.NEG_ONE=C;var w=c(-1,2147483647,!1);i.MAX_VALUE=w;var E=c(-1,-1,!0);i.MAX_UNSIGNED_VALUE=E;var T=c(0,-2147483648,!1);i.MIN_VALUE=T;var k=i.prototype;k.toInt=function(){return this.unsigned?this.low>>>0:this.low},k.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},k.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(T)){var t=l(e),i=this.div(t),n=i.mul(t).sub(this);return i.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var r=l(u(e,6),this.unsigned),s=this,o="";;){var a=s.div(r),c=(s.sub(a.mul(r)).toInt()>>>0).toString(e);if((s=a).isZero())return c+o;for(;c.length<6;)c="0"+c;o=""+c+o}},k.getHighBits=function(){return this.high},k.getHighBitsUnsigned=function(){return this.high>>>0},k.getLowBits=function(){return this.low},k.getLowBitsUnsigned=function(){return this.low>>>0},k.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},k.isSafeInteger=function(){var e=this.high>>21;return!e||!this.unsigned&&-1===e&&!(0===this.low&&-2097152===this.high)},k.isZero=function(){return 0===this.high&&0===this.low},k.eqz=k.isZero,k.isNegative=function(){return!this.unsigned&&this.high<0},k.isPositive=function(){return this.unsigned||this.high>=0},k.isOdd=function(){return!(1&~this.low)},k.isEven=function(){return!(1&this.low)},k.equals=function(e){return n(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},k.eq=k.equals,k.notEquals=function(e){return!this.eq(e)},k.neq=k.notEquals,k.ne=k.notEquals,k.lessThan=function(e){return this.comp(e)<0},k.lt=k.lessThan,k.lessThanOrEqual=function(e){return this.comp(e)<=0},k.lte=k.lessThanOrEqual,k.le=k.lessThanOrEqual,k.greaterThan=function(e){return this.comp(e)>0},k.gt=k.greaterThan,k.greaterThanOrEqual=function(e){return this.comp(e)>=0},k.gte=k.greaterThanOrEqual,k.ge=k.greaterThanOrEqual,k.compare=function(e){if(n(e)||(e=d(e)),this.eq(e))return 0;var t=this.isNegative(),i=e.isNegative();return t&&!i?-1:!t&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},k.comp=k.compare,k.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(S)},k.neg=k.negate,k.add=function(e){n(e)||(e=d(e));var t=this.high>>>16,i=65535&this.high,r=this.low>>>16,s=65535&this.low,o=e.high>>>16,a=65535&e.high,l=e.low>>>16,u=0,h=0,f=0,p=0;return f+=(p+=s+(65535&e.low))>>>16,h+=(f+=r+l)>>>16,u+=(h+=i+a)>>>16,u+=t+o,c((f&=65535)<<16|(p&=65535),(u&=65535)<<16|(h&=65535),this.unsigned)},k.subtract=function(e){return n(e)||(e=d(e)),this.add(e.neg())},k.sub=k.subtract,k.multiply=function(e){if(this.isZero())return this;if(n(e)||(e=d(e)),t)return c(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return this.unsigned?b:y;if(this.eq(T))return e.isOdd()?T:y;if(e.eq(T))return this.isOdd()?T:y;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(v)&&e.lt(v))return l(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,r=65535&this.high,s=this.low>>>16,o=65535&this.low,a=e.high>>>16,u=65535&e.high,h=e.low>>>16,f=65535&e.low,p=0,g=0,m=0,S=0;return m+=(S+=o*f)>>>16,g+=(m+=s*f)>>>16,m&=65535,g+=(m+=o*h)>>>16,p+=(g+=r*f)>>>16,g&=65535,p+=(g+=s*h)>>>16,g&=65535,p+=(g+=o*u)>>>16,p+=i*f+r*h+s*u+o*a,c((m&=65535)<<16|(S&=65535),(p&=65535)<<16|(g&=65535),this.unsigned)},k.mul=k.multiply,k.divide=function(e){if(n(e)||(e=d(e)),e.isZero())throw Error("division by zero");var i,r,s;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?b:y;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return b;if(e.gt(this.shru(1)))return _;s=b}else{if(this.eq(T))return e.eq(S)||e.eq(C)?T:e.eq(T)?S:(i=this.shr(1).div(e).shl(1)).eq(y)?e.isNegative()?S:C:(r=this.sub(e.mul(i)),s=i.add(r.div(e)));if(e.eq(T))return this.unsigned?b:y;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=y}for(r=this;r.gte(e);){i=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(i)/Math.LN2),a=o<=48?1:u(2,o-48),h=l(i),f=h.mul(e);f.isNegative()||f.gt(r);)f=(h=l(i-=a,this.unsigned)).mul(e);h.isZero()&&(h=S),s=s.add(h),r=r.sub(f)}return s},k.div=k.divide,k.modulo=function(e){return n(e)||(e=d(e)),t?c((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},k.mod=k.modulo,k.rem=k.modulo,k.not=function(){return c(~this.low,~this.high,this.unsigned)},k.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},k.clz=k.countLeadingZeros,k.countTrailingZeros=function(){return this.low?r(this.low):r(this.high)+32},k.ctz=k.countTrailingZeros,k.and=function(e){return n(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},k.or=function(e){return n(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},k.xor=function(e){return n(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},k.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},k.shl=k.shiftLeft,k.shiftRight=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},k.shr=k.shiftRight,k.shiftRightUnsigned=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):c(32===e?this.high:this.high>>>e-32,0,this.unsigned)},k.shru=k.shiftRightUnsigned,k.shr_u=k.shiftRightUnsigned,k.rotateLeft=function(e){var t;return n(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?c(this.high,this.low,this.unsigned):e<32?(t=32-e,c(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),c(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},k.rotl=k.rotateLeft,k.rotateRight=function(e){var t;return n(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?c(this.high,this.low,this.unsigned):e<32?(t=32-e,c(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),c(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},k.rotr=k.rotateRight,k.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},k.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},k.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},k.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},k.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},i.fromBytes=function(e,t,n){return n?i.fromBytesLE(e,t):i.fromBytesBE(e,t)},i.fromBytesLE=function(e,t){return new i(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},i.fromBytesBE=function(e,t){return new i(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)},"function"==typeof BigInt&&(i.fromBigInt=function(e,t){return c(Number(BigInt.asIntN(32,e)),Number(BigInt.asIntN(32,e>>BigInt(32))),t)},i.fromValue=function(e,t){return"bigint"==typeof e?i.fromBigInt(e,t):d(e,t)},k.toBigInt=function(){var e=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|e}),e.default=i}(e),function(e){return e.default||e}(e)}.apply(t,[]),void 0===i||(e.exports=i)},9943(e){"use strict";e.exports={rE:"1.14.3"}},5434(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"Api":{"fields":{"name":{"type":"string","id":1},"methods":{"rule":"repeated","type":"Method","id":2},"options":{"rule":"repeated","type":"Option","id":3},"version":{"type":"string","id":4},"sourceContext":{"type":"SourceContext","id":5},"mixins":{"rule":"repeated","type":"Mixin","id":6},"syntax":{"type":"Syntax","id":7}}},"Method":{"fields":{"name":{"type":"string","id":1},"requestTypeUrl":{"type":"string","id":2},"requestStreaming":{"type":"bool","id":3},"responseTypeUrl":{"type":"string","id":4},"responseStreaming":{"type":"bool","id":5},"options":{"rule":"repeated","type":"Option","id":6},"syntax":{"type":"Syntax","id":7}}},"Mixin":{"fields":{"name":{"type":"string","id":1},"root":{"type":"string","id":2}}},"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}},"Option":{"fields":{"name":{"type":"string","id":1},"value":{"type":"Any","id":2}}},"Syntax":{"values":{"SYNTAX_PROTO2":0,"SYNTAX_PROTO3":1}}}}}}}}')},3951(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"options":{"go_package":"google.golang.org/protobuf/types/descriptorpb","java_package":"com.google.protobuf","java_outer_classname":"DescriptorProtos","csharp_namespace":"Google.Protobuf.Reflection","objc_class_prefix":"GPB","cc_enable_arenas":true,"optimize_for":"SPEED"},"nested":{"FileDescriptorSet":{"edition":"proto2","fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}},"extensions":[[536000000,536000000]]},"Edition":{"edition":"proto2","values":{"EDITION_UNKNOWN":0,"EDITION_LEGACY":900,"EDITION_PROTO2":998,"EDITION_PROTO3":999,"EDITION_2023":1000,"EDITION_2024":1001,"EDITION_1_TEST_ONLY":1,"EDITION_2_TEST_ONLY":2,"EDITION_99997_TEST_ONLY":99997,"EDITION_99998_TEST_ONLY":99998,"EDITION_99999_TEST_ONLY":99999,"EDITION_MAX":2147483647}},"FileDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10},"weakDependency":{"rule":"repeated","type":"int32","id":11},"optionDependency":{"rule":"repeated","type":"string","id":15},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12},"edition":{"type":"Edition","id":14}}},"DescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10},"visibility":{"type":"SymbolVisibility","id":11}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2},"options":{"type":"ExtensionRangeOptions","id":3}}},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"ExtensionRangeOptions":{"edition":"proto2","fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999},"declaration":{"rule":"repeated","type":"Declaration","id":2,"options":{"retention":"RETENTION_SOURCE"}},"features":{"type":"FeatureSet","id":50},"verification":{"type":"VerificationState","id":3,"options":{"default":"UNVERIFIED","retention":"RETENTION_SOURCE"}}},"extensions":[[1000,536870911]],"nested":{"Declaration":{"fields":{"number":{"type":"int32","id":1},"fullName":{"type":"string","id":2},"type":{"type":"string","id":3},"reserved":{"type":"bool","id":5},"repeated":{"type":"bool","id":6}},"reserved":[[4,4]]},"VerificationState":{"values":{"DECLARATION":0,"UNVERIFIED":1}}}},"FieldDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8},"proto3Optional":{"type":"bool","id":17}},"nested":{"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REPEATED":3,"LABEL_REQUIRED":2}}}},"OneofDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}}},"EnumDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3},"reservedRange":{"rule":"repeated","type":"EnumReservedRange","id":4},"reservedName":{"rule":"repeated","type":"string","id":5},"visibility":{"type":"SymbolVisibility","id":6}},"nested":{"EnumReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"EnumValueDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}}},"ServiceDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}}},"MethodDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5},"serverStreaming":{"type":"bool","id":6}}},"FileOptions":{"edition":"proto2","fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16},"javaGenericServices":{"type":"bool","id":17},"pyGenericServices":{"type":"bool","id":18},"deprecated":{"type":"bool","id":23},"ccEnableArenas":{"type":"bool","id":31,"options":{"default":true}},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"swiftPrefix":{"type":"string","id":39},"phpClassPrefix":{"type":"string","id":40},"phpNamespace":{"type":"string","id":41},"phpMetadataNamespace":{"type":"string","id":44},"rubyPackage":{"type":"string","id":45},"features":{"type":"FeatureSet","id":50},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[42,42],[38,38],"php_generic_services"],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3}}}},"MessageOptions":{"edition":"proto2","fields":{"messageSetWireFormat":{"type":"bool","id":1},"noStandardDescriptorAccessor":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"mapEntry":{"type":"bool","id":7},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":11,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":12},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[5,5],[6,6],[8,8],[9,9]]},"FieldOptions":{"edition":"proto2","fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5},"unverifiedLazy":{"type":"bool","id":15},"deprecated":{"type":"bool","id":3},"weak":{"type":"bool","id":10,"options":{"deprecated":true}},"debugRedact":{"type":"bool","id":16},"retention":{"type":"OptionRetention","id":17},"targets":{"rule":"repeated","type":"OptionTargetType","id":19},"editionDefaults":{"rule":"repeated","type":"EditionDefault","id":20},"features":{"type":"FeatureSet","id":21},"featureSupport":{"type":"FeatureSupport","id":22},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[18,18]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2}},"OptionRetention":{"values":{"RETENTION_UNKNOWN":0,"RETENTION_RUNTIME":1,"RETENTION_SOURCE":2}},"OptionTargetType":{"values":{"TARGET_TYPE_UNKNOWN":0,"TARGET_TYPE_FILE":1,"TARGET_TYPE_EXTENSION_RANGE":2,"TARGET_TYPE_MESSAGE":3,"TARGET_TYPE_FIELD":4,"TARGET_TYPE_ONEOF":5,"TARGET_TYPE_ENUM":6,"TARGET_TYPE_ENUM_ENTRY":7,"TARGET_TYPE_SERVICE":8,"TARGET_TYPE_METHOD":9}},"EditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"value":{"type":"string","id":2}}},"FeatureSupport":{"fields":{"editionIntroduced":{"type":"Edition","id":1},"editionDeprecated":{"type":"Edition","id":2},"deprecationWarning":{"type":"string","id":3},"editionRemoved":{"type":"Edition","id":4}}}}},"OneofOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":1},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"EnumOptions":{"edition":"proto2","fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":6,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[5,5]]},"EnumValueOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":1},"features":{"type":"FeatureSet","id":2},"debugRedact":{"type":"bool","id":3},"featureSupport":{"type":"FieldOptions.FeatureSupport","id":4},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"ServiceOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":34},"deprecated":{"type":"bool","id":33},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"MethodOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":33},"idempotencyLevel":{"type":"IdempotencyLevel","id":34,"options":{"default":"IDEMPOTENCY_UNKNOWN"}},"features":{"type":"FeatureSet","id":35},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"nested":{"IdempotencyLevel":{"values":{"IDEMPOTENCY_UNKNOWN":0,"NO_SIDE_EFFECTS":1,"IDEMPOTENT":2}}}},"UninterpretedOption":{"edition":"proto2","fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}}}}},"FeatureSet":{"edition":"proto2","fields":{"fieldPresence":{"type":"FieldPresence","id":1,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},"enumType":{"type":"EnumType","id":2,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},"repeatedFieldEncoding":{"type":"RepeatedFieldEncoding","id":3,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},"utf8Validation":{"type":"Utf8Validation","id":4,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},"messageEncoding":{"type":"MessageEncoding","id":5,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},"jsonFormat":{"type":"JsonFormat","id":6,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},"enforceNamingStyle":{"type":"EnforceNamingStyle","id":7,"options":{"retention":"RETENTION_SOURCE","targets":"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},"defaultSymbolVisibility":{"type":"VisibilityFeature.DefaultSymbolVisibility","id":8,"options":{"retention":"RETENTION_SOURCE","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},"extensions":[[1000,9994],[9995,9999],[10000,10000]],"reserved":[[999,999]],"nested":{"FieldPresence":{"values":{"FIELD_PRESENCE_UNKNOWN":0,"EXPLICIT":1,"IMPLICIT":2,"LEGACY_REQUIRED":3}},"EnumType":{"values":{"ENUM_TYPE_UNKNOWN":0,"OPEN":1,"CLOSED":2}},"RepeatedFieldEncoding":{"values":{"REPEATED_FIELD_ENCODING_UNKNOWN":0,"PACKED":1,"EXPANDED":2}},"Utf8Validation":{"values":{"UTF8_VALIDATION_UNKNOWN":0,"VERIFY":2,"NONE":3}},"MessageEncoding":{"values":{"MESSAGE_ENCODING_UNKNOWN":0,"LENGTH_PREFIXED":1,"DELIMITED":2}},"JsonFormat":{"values":{"JSON_FORMAT_UNKNOWN":0,"ALLOW":1,"LEGACY_BEST_EFFORT":2}},"EnforceNamingStyle":{"values":{"ENFORCE_NAMING_STYLE_UNKNOWN":0,"STYLE2024":1,"STYLE_LEGACY":2}},"VisibilityFeature":{"fields":{},"reserved":[[1,536870911]],"nested":{"DefaultSymbolVisibility":{"values":{"DEFAULT_SYMBOL_VISIBILITY_UNKNOWN":0,"EXPORT_ALL":1,"EXPORT_TOP_LEVEL":2,"LOCAL_ALL":3,"STRICT":4}}}}}},"FeatureSetDefaults":{"edition":"proto2","fields":{"defaults":{"rule":"repeated","type":"FeatureSetEditionDefault","id":1},"minimumEdition":{"type":"Edition","id":4},"maximumEdition":{"type":"Edition","id":5}},"nested":{"FeatureSetEditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"overridableFeatures":{"type":"FeatureSet","id":4},"fixedFeatures":{"type":"FeatureSet","id":5}},"reserved":[[1,1],[2,2],"features"]}}},"SourceCodeInfo":{"edition":"proto2","fields":{"location":{"rule":"repeated","type":"Location","id":1}},"extensions":[[536000000,536000000]],"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"span":{"rule":"repeated","type":"int32","id":2,"options":{"packed":true}},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}}}}},"GeneratedCodeInfo":{"edition":"proto2","fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4},"semantic":{"type":"Semantic","id":5}},"nested":{"Semantic":{"values":{"NONE":0,"SET":1,"ALIAS":2}}}}}},"SymbolVisibility":{"edition":"proto2","values":{"VISIBILITY_UNSET":0,"VISIBILITY_LOCAL":1,"VISIBILITY_EXPORT":2}}}}}}}}')},2939(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}}}}}}}}')},6710(e){"use strict";e.exports=JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"Type":{"fields":{"name":{"type":"string","id":1},"fields":{"rule":"repeated","type":"Field","id":2},"oneofs":{"rule":"repeated","type":"string","id":3},"options":{"rule":"repeated","type":"Option","id":4},"sourceContext":{"type":"SourceContext","id":5},"syntax":{"type":"Syntax","id":6}}},"Field":{"fields":{"kind":{"type":"Kind","id":1},"cardinality":{"type":"Cardinality","id":2},"number":{"type":"int32","id":3},"name":{"type":"string","id":4},"typeUrl":{"type":"string","id":6},"oneofIndex":{"type":"int32","id":7},"packed":{"type":"bool","id":8},"options":{"rule":"repeated","type":"Option","id":9},"jsonName":{"type":"string","id":10},"defaultValue":{"type":"string","id":11}},"nested":{"Kind":{"values":{"TYPE_UNKNOWN":0,"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Cardinality":{"values":{"CARDINALITY_UNKNOWN":0,"CARDINALITY_OPTIONAL":1,"CARDINALITY_REQUIRED":2,"CARDINALITY_REPEATED":3}}}},"Enum":{"fields":{"name":{"type":"string","id":1},"enumvalue":{"rule":"repeated","type":"EnumValue","id":2},"options":{"rule":"repeated","type":"Option","id":3},"sourceContext":{"type":"SourceContext","id":4},"syntax":{"type":"Syntax","id":5}}},"EnumValue":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"rule":"repeated","type":"Option","id":3}}},"Option":{"fields":{"name":{"type":"string","id":1},"value":{"type":"Any","id":2}}},"Syntax":{"values":{"SYNTAX_PROTO2":0,"SYNTAX_PROTO3":1}},"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}}},"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}}}}}}}}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var i=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(i.exports,i,i.exports,__webpack_require__),i.loaded=!0,i.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};(()=>{"use strict";const e=__webpack_require__(3285),t=__webpack_require__(3054);(0,e.file_search_start)(),(0,t.start_ai_agent_agent)()})()})();
|