shadow-claw 1.28.0 → 1.29.0
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/.well-known/mcp/server-card.json +1 -1
- package/.well-known/mcp.json +1 -1
- package/README.md +96 -278
- package/bin/cli.mjs +4 -0
- package/bin/commands/mcp.mjs +409 -125
- package/bin/commands/mcp.test.mjs +151 -18
- package/bin/utils/control-client.mjs +338 -103
- package/bin/utils/control-client.test.mjs +14 -0
- package/dist/electron/main.cjs +179 -179
- package/dist/lib/components/index.js +21 -21
- package/dist/lib/components/settings/shadow-claw-channel-config.js +1 -1
- package/dist/lib/components/settings/shadow-claw-control-plane.js +1 -1
- package/dist/lib/components/settings/shadow-claw-git.js +1 -1
- package/dist/lib/components/settings/shadow-claw-llm.js +1 -1
- package/dist/lib/components/settings/shadow-claw-networking.js +1 -1
- package/dist/lib/components/settings/shadow-claw-notifications.js +1 -1
- package/dist/lib/components/settings/shadow-claw-peerjs.js +1 -1
- package/dist/lib/components/settings/shadow-claw-storage.js +1 -1
- package/dist/lib/components/settings/shadow-claw-task-server.js +1 -1
- package/dist/lib/components/settings/shadow-claw-webvm.js +1 -1
- package/dist/lib/components/shadow-claw-channel-config.js +1 -1
- package/dist/lib/components/shadow-claw-channels.js +1 -1
- package/dist/lib/components/shadow-claw-chat.js +1 -1
- package/dist/lib/components/shadow-claw-control-plane.js +1 -1
- package/dist/lib/components/shadow-claw-conversations.js +1 -1
- package/dist/lib/components/shadow-claw-file-viewer.js +1 -1
- package/dist/lib/components/shadow-claw-files.js +1 -1
- package/dist/lib/components/shadow-claw-git.js +1 -1
- package/dist/lib/components/shadow-claw-llm.js +1 -1
- package/dist/lib/components/shadow-claw-networking.js +1 -1
- package/dist/lib/components/shadow-claw-notifications.js +1 -1
- package/dist/lib/components/shadow-claw-pages.js +1 -1
- package/dist/lib/components/shadow-claw-peerjs.js +1 -1
- package/dist/lib/components/shadow-claw-settings.js +1 -1
- package/dist/lib/components/shadow-claw-storage.js +1 -1
- package/dist/lib/components/shadow-claw-task-server.js +1 -1
- package/dist/lib/components/shadow-claw-tasks.js +1 -1
- package/dist/lib/components/shadow-claw-terminal.js +1 -1
- package/dist/lib/components/shadow-claw-tools.js +1 -1
- package/dist/lib/components/shadow-claw-webvm.js +1 -1
- package/dist/lib/components/shadow-claw.js +1 -1
- package/dist/lib/{configurePeerJs-D8Ph0-A9.js → configurePeerJs-DG4hliKp.js} +2 -2
- package/dist/lib/{configurePeerJs-D8Ph0-A9.js.map → configurePeerJs-DG4hliKp.js.map} +1 -1
- package/dist/lib/index.js +21 -21
- package/dist/lib/{initControlPlane-BIrWmpzc.js → initControlPlane-DnpAzphg.js} +8 -8
- package/dist/lib/{initControlPlane-BIrWmpzc.js.map → initControlPlane-DnpAzphg.js.map} +1 -1
- package/dist/lib/{markdown-DEUoM1c6.js → markdown-DgdSt2GD.js} +2 -2
- package/dist/lib/{markdown-DEUoM1c6.js.map → markdown-DgdSt2GD.js.map} +1 -1
- package/dist/lib/{orchestrator-CFCW-l1O.js → orchestrator-CjEau_RG.js} +5 -5
- package/dist/lib/{orchestrator-CFCW-l1O.js.map → orchestrator-CjEau_RG.js.map} +1 -1
- package/dist/lib/{orchestrator-BtVj9bBB.js → orchestrator-ClXbJ4Mb.js} +2 -2
- package/dist/lib/{orchestrator-BtVj9bBB.js.map → orchestrator-ClXbJ4Mb.js.map} +1 -1
- package/dist/lib/{peerjs-BoBkx9DJ.js → peerjs-BdfpltIe.js} +3 -3
- package/dist/lib/{peerjs-BoBkx9DJ.js.map → peerjs-BdfpltIe.js.map} +1 -1
- package/dist/lib/{push-client-D6hbzDNV.js → push-client-DjwKknNg.js} +9 -3
- package/dist/lib/push-client-DjwKknNg.js.map +1 -0
- package/dist/lib/{shadow-claw-Cuf2O5bZ.js → shadow-claw-DcPGKenn.js} +4 -4
- package/dist/lib/{shadow-claw-Cuf2O5bZ.js.map → shadow-claw-DcPGKenn.js.map} +1 -1
- package/dist/lib/{shadow-claw-channel-config-BDPKt6Bd.js → shadow-claw-channel-config-DEL-aZ7N.js} +3 -3
- package/dist/lib/{shadow-claw-channel-config-BDPKt6Bd.js.map → shadow-claw-channel-config-DEL-aZ7N.js.map} +1 -1
- package/dist/lib/{shadow-claw-channels-BsP5JABM.js → shadow-claw-channels-BgaJiPdE.js} +2 -2
- package/dist/lib/{shadow-claw-channels-BsP5JABM.js.map → shadow-claw-channels-BgaJiPdE.js.map} +1 -1
- package/dist/lib/{shadow-claw-chat-Cam2lX4k.js → shadow-claw-chat-mXPQZbwT.js} +4 -4
- package/dist/lib/{shadow-claw-chat-Cam2lX4k.js.map → shadow-claw-chat-mXPQZbwT.js.map} +1 -1
- package/dist/lib/{shadow-claw-control-plane-DB2qcCFs.js → shadow-claw-control-plane-DO6foOLV.js} +6 -6
- package/dist/lib/{shadow-claw-control-plane-DB2qcCFs.js.map → shadow-claw-control-plane-DO6foOLV.js.map} +1 -1
- package/dist/lib/{shadow-claw-conversations-C9Vf4XGx.js → shadow-claw-conversations-BLwHTwdW.js} +2 -2
- package/dist/lib/{shadow-claw-conversations-C9Vf4XGx.js.map → shadow-claw-conversations-BLwHTwdW.js.map} +1 -1
- package/dist/lib/{shadow-claw-file-viewer-B4HYiI0v.js → shadow-claw-file-viewer-BSbZvSl-.js} +3 -3
- package/dist/lib/{shadow-claw-file-viewer-B4HYiI0v.js.map → shadow-claw-file-viewer-BSbZvSl-.js.map} +1 -1
- package/dist/lib/{shadow-claw-files-DVROUESO.js → shadow-claw-files-BLVr9Pua.js} +2 -2
- package/dist/lib/{shadow-claw-files-DVROUESO.js.map → shadow-claw-files-BLVr9Pua.js.map} +1 -1
- package/dist/lib/{shadow-claw-git-BqrO7cHJ.js → shadow-claw-git-CHC1H86J.js} +3 -3
- package/dist/lib/{shadow-claw-git-BqrO7cHJ.js.map → shadow-claw-git-CHC1H86J.js.map} +1 -1
- package/dist/lib/{shadow-claw-llm-BexUQdYo.js → shadow-claw-llm-CKXfxd3D.js} +2 -2
- package/dist/lib/{shadow-claw-llm-BexUQdYo.js.map → shadow-claw-llm-CKXfxd3D.js.map} +1 -1
- package/dist/lib/{shadow-claw-networking-CfXRGpUD.js → shadow-claw-networking-dpYvfchh.js} +2 -2
- package/dist/lib/{shadow-claw-networking-CfXRGpUD.js.map → shadow-claw-networking-dpYvfchh.js.map} +1 -1
- package/dist/lib/{shadow-claw-notifications-C9KPMgx_.js → shadow-claw-notifications-_YeAVPga.js} +2 -2
- package/dist/lib/{shadow-claw-notifications-C9KPMgx_.js.map → shadow-claw-notifications-_YeAVPga.js.map} +1 -1
- package/dist/lib/{shadow-claw-pages-CGzGXmrI.js → shadow-claw-pages-DVzZriZ7.js} +3 -3
- package/dist/lib/{shadow-claw-pages-CGzGXmrI.js.map → shadow-claw-pages-DVzZriZ7.js.map} +1 -1
- package/dist/lib/{shadow-claw-peerjs-B0ZB7yhB.js → shadow-claw-peerjs-BvixjeBz.js} +3 -3
- package/dist/lib/{shadow-claw-peerjs-B0ZB7yhB.js.map → shadow-claw-peerjs-BvixjeBz.js.map} +1 -1
- package/dist/lib/{shadow-claw-settings-DBfMZdDS.js → shadow-claw-settings-DV9-gD4Q.js} +2 -2
- package/dist/lib/{shadow-claw-settings-DBfMZdDS.js.map → shadow-claw-settings-DV9-gD4Q.js.map} +1 -1
- package/dist/lib/{shadow-claw-storage-CM-w6mgG.js → shadow-claw-storage-Bv__kXG6.js} +2 -2
- package/dist/lib/{shadow-claw-storage-CM-w6mgG.js.map → shadow-claw-storage-Bv__kXG6.js.map} +1 -1
- package/dist/lib/{shadow-claw-task-server-DV4b1g2-.js → shadow-claw-task-server-DNOe8PWK.js} +2 -2
- package/dist/lib/{shadow-claw-task-server-DV4b1g2-.js.map → shadow-claw-task-server-DNOe8PWK.js.map} +1 -1
- package/dist/lib/{shadow-claw-tasks-K-foOHSE.js → shadow-claw-tasks-qmcDT4PU.js} +3 -3
- package/dist/lib/{shadow-claw-tasks-K-foOHSE.js.map → shadow-claw-tasks-qmcDT4PU.js.map} +1 -1
- package/dist/lib/{shadow-claw-terminal-CpAknKyA.js → shadow-claw-terminal-0QUWP8of.js} +2 -2
- package/dist/lib/{shadow-claw-terminal-CpAknKyA.js.map → shadow-claw-terminal-0QUWP8of.js.map} +1 -1
- package/dist/lib/{shadow-claw-tools-D98XZ0Ep.js → shadow-claw-tools-Bs_bmI6-.js} +3 -3
- package/dist/lib/{shadow-claw-tools-D98XZ0Ep.js.map → shadow-claw-tools-Bs_bmI6-.js.map} +1 -1
- package/dist/lib/{shadow-claw-webvm-DLOb8dMI.js → shadow-claw-webvm-DYaoL7QY.js} +2 -2
- package/dist/lib/{shadow-claw-webvm-DLOb8dMI.js.map → shadow-claw-webvm-DYaoL7QY.js.map} +1 -1
- package/dist/lib/{syncWebMcpRegistration-NspKefOI.js → syncWebMcpRegistration-BhbqI6R2.js} +2 -2
- package/dist/lib/{syncWebMcpRegistration-NspKefOI.js.map → syncWebMcpRegistration-BhbqI6R2.js.map} +1 -1
- package/dist/public/.well-known/mcp/server-card.json +1 -1
- package/dist/public/.well-known/mcp.json +1 -1
- package/dist/public/AGENTS.md +22 -3
- package/dist/public/README.md +96 -278
- package/dist/public/agent.worker.js +50 -50
- package/dist/public/{base-task-model-CYkpwnvU-DDfHUUIS.js → base-task-model-CYkpwnvU-DrXr4G1R.js} +1 -1
- package/dist/public/{configurePeerJs-BhBokQlC.js → configurePeerJs-B470pdeU.js} +1 -1
- package/dist/public/docs/README.md +31 -31
- package/dist/public/docs/architecture/context-management.md +7 -0
- package/dist/public/docs/architecture/storage.md +10 -1
- package/dist/public/docs/decisions/bundled-typescript-architecture.md +0 -1
- package/dist/public/docs/decisions/native-web-components-and-signals.md +0 -1
- package/dist/public/docs/example/article/index.html +1 -1
- package/dist/public/docs/guides/publishing-to-github-pages.md +334 -0
- package/dist/public/docs/guides/server-development-configuration.md +15 -0
- package/dist/public/docs/publishing/index.html +1 -1
- package/dist/public/docs/skill-creator/index.html +1 -1
- package/dist/public/docs/subsystems/cli.md +10 -2
- package/dist/public/docs/subsystems/control-plane.md +9 -8
- package/dist/public/docs/subsystems/crypto.md +9 -0
- package/dist/public/docs/subsystems/custom-element-security.md +2 -0
- package/dist/public/docs/subsystems/mcp-server.md +31 -16
- package/dist/public/docs/subsystems/notifications.md +8 -5
- package/dist/public/docs/subsystems/providers.md +9 -0
- package/dist/public/docs/subsystems/share-target.md +107 -0
- package/dist/public/docs/subsystems/webmcp.md +43 -0
- package/dist/public/e2e/README.md +4 -2
- package/dist/public/{e2e-bridge-DcBoeFvd.js → e2e-bridge-CSW0S5Yz.js} +1 -1
- package/dist/public/{file-viewer-CKtVC9Ix.js → file-viewer-Cs-riNvy.js} +1 -1
- package/dist/public/{firebase-OSDX3viP.js → firebase-cwAl_ABm.js} +1 -1
- package/dist/public/{git-CkhCJonj.js → git-GD09WATp.js} +25 -25
- package/dist/public/index.html +1 -1
- package/dist/public/index.js +1 -1
- package/dist/public/{initControlPlane-Bi8ouFEb.js → initControlPlane-BqCY0NQy.js} +1 -1
- package/dist/public/initControlPlane-C-IXaKYX.js +1 -0
- package/dist/public/{language-detector-BRKrlra0.js → language-detector-CIeEuQFk.js} +1 -1
- package/dist/public/llms.txt +4 -2
- package/dist/public/main/index.html +1 -1
- package/dist/public/main/memory/index.html +1 -1
- package/dist/public/{markdown-C-hCVJtc.js → markdown-Cw7vCtTg.js} +1 -1
- package/dist/public/{openai-Bpd71Oja.js → openai-BJIb2c5j.js} +3 -3
- package/dist/public/{orchestrator-8qNGfw8r.js → orchestrator-BWkHHO9Y.js} +1 -1
- package/dist/public/{orchestrator-BT3Ks5ip.js → orchestrator-DpkkeD6T.js} +1 -1
- package/dist/public/{peerjs-DfhwEiiq.js → peerjs-tf2EmWjB.js} +1 -1
- package/dist/public/{prompt-api-polyfill-Dl1kbJhR.js → prompt-api-polyfill-CXd75leW.js} +1 -1
- package/dist/public/{push-client-BVLrE9pK.js → push-client-CHjSbrWs.js} +1 -1
- package/dist/public/{rewriter-j6D9LDER.js → rewriter-BEHn9gll.js} +1 -1
- package/dist/public/service-worker.js +1 -1
- package/dist/public/{shadow-claw-DCjxNDCX.js → shadow-claw-BBPV_9X8.js} +2 -2
- package/dist/public/{shadow-claw-channels-CITDrqMl.js → shadow-claw-channels-BJvrKQjg.js} +1 -1
- package/dist/public/{shadow-claw-chat-BQrSgSKF.js → shadow-claw-chat-BG2EaRaw.js} +1 -1
- package/dist/public/{shadow-claw-control-plane-Cp001OY0.js → shadow-claw-control-plane-BBa7WbTg.js} +2 -2
- package/dist/public/{shadow-claw-conversations-EhX4RvIj.js → shadow-claw-conversations-CFaWFmkm.js} +1 -1
- package/dist/public/{shadow-claw-file-viewer-DiQXIjZD.js → shadow-claw-file-viewer-Z-GIKaE9.js} +1 -1
- package/dist/public/{shadow-claw-files-lkTnSJsn.js → shadow-claw-files-BBx4iMsk.js} +1 -1
- package/dist/public/{shadow-claw-git-BlcA_z8x.js → shadow-claw-git-vTOKatwd.js} +2 -2
- package/dist/public/{shadow-claw-llm-CW16X9Rg.js → shadow-claw-llm-Ce1Ax6-x.js} +1 -1
- package/dist/public/{shadow-claw-networking-ySsMBY_i.js → shadow-claw-networking-q4XIzdB5.js} +1 -1
- package/dist/public/{shadow-claw-notifications-CyV2zCQ8.js → shadow-claw-notifications-D2cz0gmm.js} +1 -1
- package/dist/public/{shadow-claw-pages-Cx7cF9ah.js → shadow-claw-pages-3335lmSC.js} +1 -1
- package/dist/public/{shadow-claw-settings-zm4PHHGi.js → shadow-claw-settings-4ptYuJwO.js} +2 -2
- package/dist/public/{shadow-claw-storage-dy9JAEGd.js → shadow-claw-storage-bIrPKFhF.js} +1 -1
- package/dist/public/{shadow-claw-task-server-Bleww48s.js → shadow-claw-task-server-5yqVBxy1.js} +1 -1
- package/dist/public/{shadow-claw-tasks-CTI5oaLN.js → shadow-claw-tasks-DcqYHPLZ.js} +1 -1
- package/dist/public/{shadow-claw-terminal-mZ3i4HaQ.js → shadow-claw-terminal-fARaDONr.js} +1 -1
- package/dist/public/{shadow-claw-tools-B_nuk8Zl.js → shadow-claw-tools-paEAhcJr.js} +1 -1
- package/dist/public/{shadow-claw-webvm-Vl_jH5YL.js → shadow-claw-webvm-CbzH_vyX.js} +1 -1
- package/dist/public/{summarizer-VJNr-7xG.js → summarizer-BT3AuFed.js} +1 -1
- package/dist/public/{syncWebMcpRegistration-n2vAMJ4w.js → syncWebMcpRegistration-CWSYaHex.js} +1 -1
- package/dist/public/{transformers-BhQMWQG5.js → transformers-1VTxqKjT.js} +1 -1
- package/dist/public/{translator-DEQXb7ZL.js → translator-B50RYlFt.js} +1 -1
- package/dist/public/{webllm-CHN5H-Sy.js → webllm-FmyJWWpt.js} +1 -1
- package/dist/public/{writer-CD9oN2pq.js → writer-Bhb4YYRE.js} +1 -1
- package/dist/server.js +205 -203
- package/package.json +1 -1
- package/src/components/settings/shadow-claw-llm/shadow-claw-llm.test.ts +2 -0
- package/src/core/orchestrator/utils/configurePeerJs.test.ts +2 -0
- package/src/server/client-registry.test.ts +9 -0
- package/src/server/client-registry.ts +14 -0
- package/src/server/mcp/mcp-integration.test.ts +68 -16
- package/src/server/mcp/tools/built-in-tools.ts +125 -34
- package/src/server/mcp/tools/client-tool-relay.ts +81 -44
- package/src/server/mcp/tools/mcp-tools.test.ts +103 -13
- package/src/server/mcp/types.ts +3 -0
- package/src/server/openapi/paths/push.ts +48 -0
- package/src/server/server.ts +30 -0
- package/src/subsystems/notifications/push-client.test.ts +17 -0
- package/src/subsystems/notifications/push-client.ts +22 -2
- package/src/subsystems/notifications/push-routes.test.ts +31 -0
- package/src/subsystems/notifications/push-routes.ts +10 -0
- package/src/subsystems/notifications/push-store.test.ts +49 -0
- package/src/subsystems/notifications/push-store.ts +45 -0
- package/src/worker/worker.test.ts +2 -0
- package/dist/lib/push-client-D6hbzDNV.js.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{i as e,r as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{
|
|
1
|
+
import{i as e,r as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{C as r,S as i,_ as a,a as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,m,n as h,o as g,p as _,r as v,s as y,u as b,v as x}from"./agent.worker.js";var S=n(((t,n)=>{var r=e(x()),i=function(e){if(e||={},this.Promise=e.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=e.domainReentrant||!1,this.domainReentrant){if(r.default===void 0||r.default.domain===void 0)throw Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=e.timeout||i.DEFAULT_TIMEOUT,this.maxOccupationTime=e.maxOccupationTime||i.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=e.maxExecutionTime||i.DEFAULT_MAX_EXECUTION_TIME,e.maxPending===1/0||Number.isInteger(e.maxPending)&&e.maxPending>=0?this.maxPending=e.maxPending:this.maxPending=i.DEFAULT_MAX_PENDING};i.DEFAULT_TIMEOUT=0,i.DEFAULT_MAX_OCCUPATION_TIME=0,i.DEFAULT_MAX_EXECUTION_TIME=0,i.DEFAULT_MAX_PENDING=1e3,i.prototype.acquire=function(e,t,n,i){if(Array.isArray(e))return this._acquireBatch(e,t,n,i);if(typeof t!=`function`)throw Error(`You must pass a function to execute`);var a=null,o=null,s=null;typeof n!=`function`&&(i=n,n=null,s=new this.Promise(function(e,t){a=e,o=t})),i||={};var c=!1,l=null,u=null,d=null,f=this,p=function(t,r,i){u&&=(clearTimeout(u),null),d&&=(clearTimeout(d),null),t&&(f.queues[e]&&f.queues[e].length===0&&delete f.queues[e],f.domainReentrant&&delete f.domains[e]),c||=(s?r?o(r):a(i):typeof n==`function`&&n(r,i),!0),t&&f.queues[e]&&f.queues[e].length>0&&f.queues[e].shift()()},m=function(n){if(c)return p(n);l&&=(clearTimeout(l),null),f.domainReentrant&&n&&(f.domains[e]=r.default.domain);var a=i.maxExecutionTime||f.maxExecutionTime;if(a&&(d=setTimeout(function(){f.queues[e]&&p(n,Error(`Maximum execution time is exceeded `+e))},a)),t.length===1){var o=!1;try{t(function(e,t){o||(o=!0,p(n,e,t))})}catch(e){o||(o=!0,p(n,e))}}else f._promiseTry(function(){return t()}).then(function(e){p(n,void 0,e)},function(e){p(n,e)})};f.domainReentrant&&r.default.domain&&(m=r.default.domain.bind(m));var h=i.maxPending||f.maxPending;if(!f.queues[e])f.queues[e]=[],m(!0);else if(f.domainReentrant&&r.default.domain&&r.default.domain===f.domains[e])m(!1);else if(f.queues[e].length>=h)p(!1,Error(`Too many pending tasks in queue `+e));else{var g=function(){m(!0)};i.skipQueue?f.queues[e].unshift(g):f.queues[e].push(g);var _=i.timeout||f.timeout;_&&(l=setTimeout(function(){l=null,p(!1,Error(`async-lock timed out in queue `+e))},_))}var v=i.maxOccupationTime||f.maxOccupationTime;if(v&&(u=setTimeout(function(){f.queues[e]&&p(!1,Error(`Maximum occupation time is exceeded in queue `+e))},v)),s)return s},i.prototype._acquireBatch=function(e,t,n,r){typeof n!=`function`&&(r=n,n=null);var i=this,a=function(e,t){return function(n){i.acquire(e,t,n,r)}},o=e.reduceRight(function(e,t){return a(t,e)},t);if(typeof n==`function`)o(n);else return new this.Promise(function(e,t){o.length===1?o(function(n,r){n?t(n):e(r)}):e(o())})},i.prototype.isBusy=function(e){return e?!!this.queues[e]:Object.keys(this.queues).length>0},i.prototype._promiseTry=function(e){try{return this.Promise.resolve(e())}catch(e){return this.Promise.reject(e)}},n.exports=i})),C=n(((e,t)=>{t.exports=S()})),w=n(((e,t)=>{var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)==`[object Array]`}})),T=n(((e,t)=>{var n=b(),r=p()(`TypedArray.prototype.buffer`,!0),i=s();t.exports=r||function(e){if(!i(e))throw new n(`Not a Typed Array`);return e.buffer}})),E=n(((e,t)=>{var n=_().Buffer,r=w(),i=T(),a=ArrayBuffer.isView||function(e){try{return i(e),!0}catch{return!1}},o=typeof Uint8Array<`u`,s=typeof ArrayBuffer<`u`&&typeof Uint8Array<`u`,c=s&&(n.prototype instanceof Uint8Array||n.TYPED_ARRAY_SUPPORT);t.exports=function(e,t){if(n.isBuffer(e))return e.constructor&&!(`isBuffer`in e)?n.from(e):e;if(typeof e==`string`)return n.from(e,t);if(s&&a(e)){if(e.byteLength===0)return n.alloc(0);if(c){var i=n.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var l=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),u=n.from(l);if(u.length===e.byteLength)return u}if(o&&e instanceof Uint8Array)return n.from(e);var d=r(e);if(d)for(var f=0;f<e.length;f+=1){var p=e[f];if(typeof p!=`number`||p<0||p>255||~~p!==p)throw RangeError(`Array items must be numbers in the range 0-255.`)}if(d||n.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e))return n.from(e);throw TypeError(`The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.`)}})),D=n(((e,t)=>{var n=_().Buffer,r=E();function i(e,t){this._block=n.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){e=r(e,t||`utf8`);for(var n=this._block,i=this._blockSize,a=e.length,o=this._len,s=0;s<a;){for(var c=o%i,l=Math.min(a-s,i-c),u=0;u<l;u++)n[c+u]=e[s+u];o+=l,s+=l,o%i===0&&this._update(n)}return this._len+=a,this},i.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=this._len*8;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(n&4294967295)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var a=this._hash();return e?a.toString(e):a},i.prototype._update=function(){throw Error(`_update must be implemented by subclass`)},t.exports=i})),O=n(((e,t)=>{var n=d(),r=D(),i=_().Buffer,a=[1518500249,1859775393,-1894007588,-899497514],o=Array(80);function s(){this.init(),this._w=o,r.call(this,64,56)}n(s,r),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function c(e){return e<<1|e>>>31}function l(e){return e<<5|e>>>27}function u(e){return e<<30|e>>>2}function f(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}s.prototype._update=function(e){for(var t=this._w,n=this._a|0,r=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,d=0;d<16;++d)t[d]=e.readInt32BE(d*4);for(;d<80;++d)t[d]=c(t[d-3]^t[d-8]^t[d-14]^t[d-16]);for(var p=0;p<80;++p){var m=~~(p/20),h=l(n)+f(m,r,i,o)+s+t[p]+a[m]|0;s=o,o=i,i=u(r),r=n,n=h}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0},s.prototype._hash=function(){var e=i.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e},t.exports=s})),k=n((e=>{
|
|
2
2
|
/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
|
|
3
|
-
(function(t){typeof DO_NOT_EXPORT_CRC>`u`?typeof e==`object`?t(e):typeof define==`function`&&define.amd?define(function(){var e={};return t(e),e}):t({}):t({})})(function(e){e.version=`1.2.2`;function t(){for(var e=0,t=Array(256),n=0;n!=256;++n)e=n,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,t[n]=e;return typeof Int32Array<`u`?new Int32Array(t):t}var n=t();function r(e){var t=0,n=0,r=0,i=typeof Int32Array<`u`?new Int32Array(4096):Array(4096);for(r=0;r!=256;++r)i[r]=e[r];for(r=0;r!=256;++r)for(n=e[r],t=256+r;t<4096;t+=256)n=i[t]=n>>>8^e[n&255];var a=[];for(r=1;r!=16;++r)a[r-1]=typeof Int32Array<`u`?i.subarray(r*256,r*256+256):i.slice(r*256,r*256+256);return a}var i=r(n),a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14];function b(e,t){for(var r=t^-1,i=0,a=e.length;i<a;)r=r>>>8^n[(r^e.charCodeAt(i++))&255];return~r}function x(e,t){for(var r=t^-1,i=e.length-15,b=0;b<i;)r=y[e[b++]^r&255]^v[e[b++]^r>>8&255]^_[e[b++]^r>>16&255]^g[e[b++]^r>>>24]^h[e[b++]]^m[e[b++]]^p[e[b++]]^f[e[b++]]^d[e[b++]]^u[e[b++]]^l[e[b++]]^c[e[b++]]^s[e[b++]]^o[e[b++]]^a[e[b++]]^n[e[b++]];for(i+=15;b<i;)r=r>>>8^n[(r^e[b++])&255];return~r}function S(e,t){for(var r=t^-1,i=0,a=e.length,o=0,s=0;i<a;)o=e.charCodeAt(i++),o<128?r=r>>>8^n[(r^o)&255]:o<2048?(r=r>>>8^n[(r^(192|o>>6&31))&255],r=r>>>8^n[(r^(128|o&63))&255]):o>=55296&&o<57344?(o=(o&1023)+64,s=e.charCodeAt(i++)&1023,r=r>>>8^n[(r^(240|o>>8&7))&255],r=r>>>8^n[(r^(128|o>>2&63))&255],r=r>>>8^n[(r^(128|s>>6&15|(o&3)<<4))&255],r=r>>>8^n[(r^(128|s&63))&255]):(r=r>>>8^n[(r^(224|o>>12&15))&255],r=r>>>8^n[(r^(128|o>>6&63))&255],r=r>>>8^n[(r^(128|o&63))&255]);return~r}e.table=n,e.bstr=b,e.buf=x,e.str=S})})),A=n((e=>{var t=
|
|
4
|
-
Use Chrome, Firefox or Internet Explorer 11`)}var l=c().Buffer,u=globalThis.crypto||globalThis.msCrypto;u&&u.getRandomValues?n.exports=d:n.exports=s;function d(e,t){if(e>o)throw RangeError(`requested too many random bytes`);var n=l.allocUnsafe(e);if(e>0)if(e>a)for(var r=0;r<e;r+=a)u.getRandomValues(n.slice(r,r+a));else u.getRandomValues(n);return typeof t==`function`?i.default.nextTick(function(){t(null,n)}):n}})),P=n(((e,t)=>{var n=c().Buffer,r=b().Transform,i=p();function a(e){r.call(this),this._block=n.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}i(a,r),a.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},a.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)};var o=typeof Uint8Array<`u`,s=typeof ArrayBuffer<`u`&&typeof Uint8Array<`u`&&ArrayBuffer.isView&&(n.prototype instanceof Uint8Array||n.TYPED_ARRAY_SUPPORT);function l(e,t){if(e instanceof n)return e;if(typeof e==`string`)return n.from(e,t);if(s&&ArrayBuffer.isView(e)){if(e.byteLength===0)return n.alloc(0);var r=n.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}if(o&&e instanceof Uint8Array||n.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e))return n.from(e);throw TypeError(`The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.`)}a.prototype.update=function(e,t){if(this._finalized)throw Error(`Digest already called`);e=l(e,t);for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)n[i++]=e[r++];this._update(),this._blockOffset=0}for(;r<e.length;)n[this._blockOffset++]=e[r++];for(var a=0,o=e.length*8;o>0;++a)this._length[a]+=o,o=this._length[a]/4294967296|0,o>0&&(this._length[a]-=4294967296*o);return this},a.prototype._update=function(){throw Error(`_update is not implemented`)},a.prototype.digest=function(e){if(this._finalized)throw Error(`Digest already called`);this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},a.prototype._digest=function(){throw Error(`_digest is not implemented`)},t.exports=a})),ne=n(((e,t)=>{var n=p(),r=P(),i=c().Buffer,a=Array(16);function o(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}n(o,r),o.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);var n=this._a,r=this._b,i=this._c,o=this._d;n=l(n,r,i,o,e[0],3614090360,7),o=l(o,n,r,i,e[1],3905402710,12),i=l(i,o,n,r,e[2],606105819,17),r=l(r,i,o,n,e[3],3250441966,22),n=l(n,r,i,o,e[4],4118548399,7),o=l(o,n,r,i,e[5],1200080426,12),i=l(i,o,n,r,e[6],2821735955,17),r=l(r,i,o,n,e[7],4249261313,22),n=l(n,r,i,o,e[8],1770035416,7),o=l(o,n,r,i,e[9],2336552879,12),i=l(i,o,n,r,e[10],4294925233,17),r=l(r,i,o,n,e[11],2304563134,22),n=l(n,r,i,o,e[12],1804603682,7),o=l(o,n,r,i,e[13],4254626195,12),i=l(i,o,n,r,e[14],2792965006,17),r=l(r,i,o,n,e[15],1236535329,22),n=u(n,r,i,o,e[1],4129170786,5),o=u(o,n,r,i,e[6],3225465664,9),i=u(i,o,n,r,e[11],643717713,14),r=u(r,i,o,n,e[0],3921069994,20),n=u(n,r,i,o,e[5],3593408605,5),o=u(o,n,r,i,e[10],38016083,9),i=u(i,o,n,r,e[15],3634488961,14),r=u(r,i,o,n,e[4],3889429448,20),n=u(n,r,i,o,e[9],568446438,5),o=u(o,n,r,i,e[14],3275163606,9),i=u(i,o,n,r,e[3],4107603335,14),r=u(r,i,o,n,e[8],1163531501,20),n=u(n,r,i,o,e[13],2850285829,5),o=u(o,n,r,i,e[2],4243563512,9),i=u(i,o,n,r,e[7],1735328473,14),r=u(r,i,o,n,e[12],2368359562,20),n=d(n,r,i,o,e[5],4294588738,4),o=d(o,n,r,i,e[8],2272392833,11),i=d(i,o,n,r,e[11],1839030562,16),r=d(r,i,o,n,e[14],4259657740,23),n=d(n,r,i,o,e[1],2763975236,4),o=d(o,n,r,i,e[4],1272893353,11),i=d(i,o,n,r,e[7],4139469664,16),r=d(r,i,o,n,e[10],3200236656,23),n=d(n,r,i,o,e[13],681279174,4),o=d(o,n,r,i,e[0],3936430074,11),i=d(i,o,n,r,e[3],3572445317,16),r=d(r,i,o,n,e[6],76029189,23),n=d(n,r,i,o,e[9],3654602809,4),o=d(o,n,r,i,e[12],3873151461,11),i=d(i,o,n,r,e[15],530742520,16),r=d(r,i,o,n,e[2],3299628645,23),n=f(n,r,i,o,e[0],4096336452,6),o=f(o,n,r,i,e[7],1126891415,10),i=f(i,o,n,r,e[14],2878612391,15),r=f(r,i,o,n,e[5],4237533241,21),n=f(n,r,i,o,e[12],1700485571,6),o=f(o,n,r,i,e[3],2399980690,10),i=f(i,o,n,r,e[10],4293915773,15),r=f(r,i,o,n,e[1],2240044497,21),n=f(n,r,i,o,e[8],1873313359,6),o=f(o,n,r,i,e[15],4264355552,10),i=f(i,o,n,r,e[6],2734768916,15),r=f(r,i,o,n,e[13],1309151649,21),n=f(n,r,i,o,e[4],4149444226,6),o=f(o,n,r,i,e[11],3174756917,10),i=f(i,o,n,r,e[2],718787259,15),r=f(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},o.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=i.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};function s(e,t){return e<<t|e>>>32-t}function l(e,t,n,r,i,a,o){return s(e+(t&n|~t&r)+i+a|0,o)+t|0}function u(e,t,n,r,i,a,o){return s(e+(t&r|n&~r)+i+a|0,o)+t|0}function d(e,t,n,r,i,a,o){return s(e+(t^n^r)+i+a|0,o)+t|0}function f(e,t,n,r,i,a,o){return s(e+(n^(t|~r))+i+a|0,o)+t|0}t.exports=o})),F=n(((e,t)=>{var n=c().Buffer,r=E(),i=typeof Uint8Array<`u`,a=i&&typeof ArrayBuffer<`u`&&ArrayBuffer.isView;t.exports=function(e,t){if(typeof e==`string`||n.isBuffer(e)||i&&e instanceof Uint8Array||a&&a(e))return r(e,t);throw TypeError(`The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView`)}})),I=n(((t,n)=>{var i=e(r());i.default===void 0||!i.default.version||i.default.version.indexOf(`v0.`)===0||i.default.version.indexOf(`v1.`)===0&&i.default.version.indexOf(`v1.8.`)!==0?n.exports={nextTick:a}:n.exports=i.default;function a(e,t,n,r){if(typeof e!=`function`)throw TypeError(`"callback" argument must be a function`);var a=arguments.length,o,s;switch(a){case 0:case 1:return i.default.nextTick(e);case 2:return i.default.nextTick(function(){e.call(null,t)});case 3:return i.default.nextTick(function(){e.call(null,t,n)});case 4:return i.default.nextTick(function(){e.call(null,t,n,r)});default:for(o=Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return i.default.nextTick(function(){e.apply(null,o)})}}})),re=n(((e,t)=>{var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)==`[object Array]`}})),L=n(((e,t)=>{t.exports=u().EventEmitter})),R=n(((e,t)=>{var n=l(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),ie=n((e=>{var t=l();function n(e){return Array.isArray?Array.isArray(e):_(e)===`[object Array]`}e.isArray=n;function r(e){return typeof e==`boolean`}e.isBoolean=r;function i(e){return e===null}e.isNull=i;function a(e){return e==null}e.isNullOrUndefined=a;function o(e){return typeof e==`number`}e.isNumber=o;function s(e){return typeof e==`string`}e.isString=s;function c(e){return typeof e==`symbol`}e.isSymbol=c;function u(e){return e===void 0}e.isUndefined=u;function d(e){return _(e)===`[object RegExp]`}e.isRegExp=d;function f(e){return typeof e==`object`&&!!e}e.isObject=f;function p(e){return _(e)===`[object Date]`}e.isDate=p;function m(e){return _(e)===`[object Error]`||e instanceof Error}e.isError=m;function h(e){return typeof e==`function`}e.isFunction=h;function g(e){return e===null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`||typeof e==`symbol`||e===void 0}e.isPrimitive=g,e.isBuffer=t.Buffer.isBuffer;function _(e){return Object.prototype.toString.call(e)}})),z=n((()=>{})),B=n((()=>{})),ae=n(((e,t)=>{function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var r=R().Buffer,i=B();function a(e,t,n){e.copy(t,n)}t.exports=function(){function e(){n(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(this.length!==0){var e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(this.length===0)return``;for(var t=this.head,n=``+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(this.length===0)return r.alloc(0);for(var t=r.allocUnsafe(e>>>0),n=this.head,i=0;n;)a(n.data,t,i),i+=n.data.length,n=n.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+` `+e})})),V=n(((e,t)=>{var n=I();function r(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return i||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,n.nextTick(a,r,e)):n.nextTick(a,r,e):t&&t(e)}),this)}function i(){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)}function a(e,t){e.emit(`error`,t)}t.exports={destroy:r,undestroy:i}})),H=n(((t,n)=>{var i=e(r()),a=I();n.exports=S;function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){re(t,e)}}var s=!i.default.browser&&[`v0.10`,`v0.9.`].indexOf(i.default.version.slice(0,5))>-1?setImmediate:a.nextTick,c;S.WritableState=b;var l=Object.create(ie());l.inherits=p();var u={deprecate:g()},d=L(),f=R().Buffer,m=(typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:{}).Uint8Array||function(){};function h(e){return f.from(e)}function _(e){return f.isBuffer(e)||e instanceof m}var v=V();l.inherits(S,d);function y(){}function b(e,t){c||=oe(),e||={};var n=t instanceof c;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,i=e.writableHighWaterMark,a=this.objectMode?16:16*1024;r||r===0?this.highWaterMark=r:n&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=e.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){A(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}b.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},(function(){try{Object.defineProperty(b.prototype,"buffer",{get:u.deprecate(function(){return this.getBuffer()},`_writableState.buffer is deprecated. Use _writableState.getBuffer instead.`,`DEP0003`)})}catch{}})();var x;typeof Symbol==`function`&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==`function`?(x=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(e){return x.call(this,e)?!0:this===S&&e&&e._writableState instanceof b}})):x=function(e){return e instanceof this};function S(e){if(c||=oe(),!x.call(S,this)&&!(this instanceof c))return new S(e);this._writableState=new b(e,this),this.writable=!0,e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final)),d.call(this)}S.prototype.pipe=function(){this.emit(`error`,Error(`Cannot pipe, not readable`))};function C(e,t){var n=Error(`write after end`);e.emit(`error`,n),a.nextTick(t,n)}function w(e,t,n,r){var i=!0,o=!1;return n===null?o=TypeError(`May not write null values to stream`):typeof n!=`string`&&n!==void 0&&!t.objectMode&&(o=TypeError(`Invalid non-string/buffer chunk`)),o&&(e.emit(`error`,o),a.nextTick(r,o),i=!1),i}S.prototype.write=function(e,t,n){var r=this._writableState,i=!1,a=!r.objectMode&&_(e);return a&&!f.isBuffer(e)&&(e=h(e)),typeof t==`function`&&(n=t,t=null),a?t=`buffer`:t||=r.defaultEncoding,typeof n!=`function`&&(n=y),r.ended?C(this,n):(a||w(this,r,e,n))&&(r.pendingcb++,i=E(this,r,a,e,t,n)),i},S.prototype.cork=function(){var e=this._writableState;e.corked++},S.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&M(this,e))},S.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=e.toLowerCase()),!([`hex`,`utf8`,`utf-8`,`ascii`,`binary`,`base64`,`ucs2`,`ucs-2`,`utf16le`,`utf-16le`,`raw`].indexOf((e+``).toLowerCase())>-1))throw TypeError(`Unknown encoding: `+e);return this._writableState.defaultEncoding=e,this};function T(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t==`string`&&(t=f.from(t,n)),t}Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function E(e,t,n,r,i,a){if(!n){var o=T(t,r,i);r!==o&&(n=!0,i=`buffer`,r=o)}var s=t.objectMode?1:r.length;t.length+=s;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else D(e,t,!1,s,r,i,a);return c}function D(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function O(e,t,n,r,i){--t.pendingcb,n?(a.nextTick(i,r),a.nextTick(ne,e,t),e._writableState.errorEmitted=!0,e.emit(`error`,r)):(i(r),e._writableState.errorEmitted=!0,e.emit(`error`,r),ne(e,t))}function k(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function A(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(k(n),t)O(e,n,r,t,i);else{var a=te(n);!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&M(e,n),r?s(ee,e,n,a,i):ee(e,n,a,i)}}function ee(e,t,n,r){n||j(e,t),t.pendingcb--,r(),ne(e,t)}function j(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`))}function M(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=Array(r),a=t.corkedRequestsFree;a.entry=n;for(var s=0,c=!0;n;)i[s]=n,n.isBuf||(c=!1),n=n.next,s+=1;i.allBuffers=c,D(e,t,!0,t.length,i,``,a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,u=n.encoding,d=n.callback;if(D(e,t,!1,t.objectMode?1:l.length,l,u,d),n=n.next,t.bufferedRequestCount--,t.writing)break}n===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}S.prototype._write=function(e,t,n){n(Error(`_write() is not implemented`))},S.prototype._writev=null,S.prototype.end=function(e,t,n){var r=this._writableState;typeof e==`function`?(n=e,e=null,t=null):typeof t==`function`&&(n=t,t=null),e!=null&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||F(this,r,n)};function te(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function N(e,t){e._final(function(n){t.pendingcb--,n&&e.emit(`error`,n),t.prefinished=!0,e.emit(`prefinish`),ne(e,t)})}function P(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`?(t.pendingcb++,t.finalCalled=!0,a.nextTick(N,e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function ne(e,t){var n=te(t);return n&&(P(e,t),t.pendingcb===0&&(t.finished=!0,e.emit(`finish`))),n}function F(e,t,n){t.ending=!0,ne(e,t),n&&(t.finished?a.nextTick(n):e.once(`finish`,n)),t.ended=!0,e.writable=!1}function re(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}Object.defineProperty(S.prototype,"destroyed",{get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),S.prototype.destroy=v.destroy,S.prototype._undestroy=v.undestroy,S.prototype._destroy=function(e,t){this.end(),t(e)}})),oe=n(((e,t)=>{var n=I(),r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=u;var i=Object.create(ie());i.inherits=p();var a=ce(),o=H();i.inherits(u,a);for(var s=r(o.prototype),c=0;c<s.length;c++){var l=s[c];u.prototype[l]||(u.prototype[l]=o.prototype[l])}function u(e){if(!(this instanceof u))return new u(e);a.call(this,e),o.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once(`end`,d)}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function d(){this.allowHalfOpen||this._writableState.ended||n.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(u.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),u.prototype._destroy=function(e,t){this.push(null),this.end(),n.nextTick(t,e)}})),se=n(((e,t)=>{var n=l(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),U=n((e=>{var t=se().Buffer,n=t.isEncoding||function(e){switch(e=``+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 r(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}}function i(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=a;function a(e){this.encoding=i(e);var n;switch(this.encoding){case`utf16le`:this.text=f,this.end=p,n=4;break;case`utf8`:this.fillLast=l,n=4;break;case`base64`:this.text=m,this.end=h,n=3;break;default:this.write=g,this.end=_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}a.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},a.prototype.end=d,a.prototype.text=u,a.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};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 s(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function l(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function u(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function d(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function f(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function m(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?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-n))}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 g(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):``}})),ce=n(((t,n)=>{var i=e(r()),a=I();n.exports=T;var o=re(),s;T.ReadableState=w,u().EventEmitter;var c=function(e,t){return e.listeners(t).length},l=L(),d=R().Buffer,f=(typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:{}).Uint8Array||function(){};function m(e){return d.from(e)}function h(e){return d.isBuffer(e)||e instanceof f}var g=Object.create(ie());g.inherits=p();var _=z(),v=void 0;v=_&&_.debuglog?_.debuglog(`stream`):function(){};var y=ae(),b=V(),x;g.inherits(T,l);var S=[`error`,`close`,`destroy`,`pause`,`resume`];function C(e,t,n){if(typeof e.prependListener==`function`)return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function w(e,t){s||=oe(),e||={};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,i=e.readableHighWaterMark,a=this.objectMode?16:16*1024;r||r===0?this.highWaterMark=r:n&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||`utf8`,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(x||=U().StringDecoder,this.decoder=new x(e.encoding),this.encoding=e.encoding)}function T(e){if(s||=oe(),!(this instanceof T))return new T(e);this._readableState=new w(e,this),this.readable=!0,e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy)),l.call(this)}Object.defineProperty(T.prototype,"destroyed",{get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),T.prototype.destroy=b.destroy,T.prototype._undestroy=b.undestroy,T.prototype._destroy=function(e,t){this.push(null),t(e)},T.prototype.push=function(e,t){var n=this._readableState,r;return n.objectMode?r=!0:typeof e==`string`&&(t||=n.defaultEncoding,t!==n.encoding&&(e=d.from(e,t),t=``),r=!0),E(this,e,t,!1,r)},T.prototype.unshift=function(e){return E(this,e,null,!0,!1)};function E(e,t,n,r,i){var a=e._readableState;if(t===null)a.reading=!1,M(e,a);else{var o;i||(o=O(a,t)),o?e.emit(`error`,o):a.objectMode||t&&t.length>0?(typeof t!=`string`&&!a.objectMode&&Object.getPrototypeOf(t)!==d.prototype&&(t=m(t)),r?a.endEmitted?e.emit(`error`,Error(`stream.unshift() after end event`)):D(e,a,t,!0):a.ended?e.emit(`error`,Error(`stream.push() after EOF`)):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||t.length!==0?D(e,a,t,!1):P(e,a)):D(e,a,t,!1))):r||(a.reading=!1)}return k(a)}function D(e,t,n,r){t.flowing&&t.length===0&&!t.sync?(e.emit(`data`,n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&te(e)),P(e,t)}function O(e,t){var n;return!h(t)&&typeof t!=`string`&&t!==void 0&&!e.objectMode&&(n=TypeError(`Invalid non-string/buffer chunk`)),n}function k(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}T.prototype.isPaused=function(){return this._readableState.flowing===!1},T.prototype.setEncoding=function(e){return x||=U().StringDecoder,this._readableState.decoder=new x(e),this._readableState.encoding=e,this};var A=8388608;function ee(e){return e>=A?e=A:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=ee(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}T.prototype.read=function(e){v(`read`,e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return v(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?q(this):te(this),null;if(e=j(e,t),e===0&&t.ended)return t.length===0&&q(this),null;var r=t.needReadable;v(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,v(`length less than watermark`,r)),t.ended||t.reading?(r=!1,v(`reading or ended`,r)):r&&(v(`do read`),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=j(n,t)));var i=e>0?W(e,t):null;return i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&q(this)),i!==null&&this.emit(`data`,i),i};function M(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,te(e)}}function te(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(v(`emitReadable`,t.flowing),t.emittedReadable=!0,t.sync?a.nextTick(N,e):N(e))}function N(e){v(`emit readable`),e.emit(`readable`),ce(e)}function P(e,t){t.readingMore||(t.readingMore=!0,a.nextTick(ne,e,t))}function ne(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(v(`maybeReadMore read 0`),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}T.prototype._read=function(e){this.emit(`error`,Error(`_read() is not implemented`))},T.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e);break}r.pipesCount+=1,v(`pipe count=%d opts=%j`,r.pipesCount,t);var o=(!t||t.end!==!1)&&e!==i.default.stdout&&e!==i.default.stderr?l:y;r.endEmitted?a.nextTick(o):n.once(`end`,o),e.on(`unpipe`,s);function s(e,t){v(`onunpipe`),e===n&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,f())}function l(){v(`onend`),e.end()}var u=F(n);e.on(`drain`,u);var d=!1;function f(){v(`cleanup`),e.removeListener(`close`,g),e.removeListener(`finish`,_),e.removeListener(`drain`,u),e.removeListener(`error`,h),e.removeListener(`unpipe`,s),n.removeListener(`end`,l),n.removeListener(`end`,y),n.removeListener(`data`,m),d=!0,r.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&u()}var p=!1;n.on(`data`,m);function m(t){v(`ondata`),p=!1,!1===e.write(t)&&!p&&((r.pipesCount===1&&r.pipes===e||r.pipesCount>1&&J(r.pipes,e)!==-1)&&!d&&(v(`false write response, pause`,r.awaitDrain),r.awaitDrain++,p=!0),n.pause())}function h(t){v(`onerror`,t),y(),e.removeListener(`error`,h),c(e,`error`)===0&&e.emit(`error`,t)}C(e,`error`,h);function g(){e.removeListener(`finish`,_),y()}e.once(`close`,g);function _(){v(`onfinish`),e.removeListener(`close`,g),y()}e.once(`finish`,_);function y(){v(`unpipe`),n.unpipe(e)}return e.emit(`pipe`,n),r.flowing||(v(`pipe resume`),n.resume()),e};function F(e){return function(){var t=e._readableState;v(`pipeOnDrain`,t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&c(e,`data`)&&(t.flowing=!0,ce(e))}}T.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||=t.pipes,t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit(`unpipe`,this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)r[a].emit(`unpipe`,this,{hasUnpiped:!1});return this}var o=J(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),--t.pipesCount,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit(`unpipe`,this,n),this)},T.prototype.on=function(e,t){var n=l.prototype.on.call(this,e,t);if(e===`data`)this._readableState.flowing!==!1&&this.resume();else if(e===`readable`){var r=this._readableState;!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&te(this):a.nextTick(B,this))}return n},T.prototype.addListener=T.prototype.on;function B(e){v(`readable nexttick read 0`),e.read(0)}T.prototype.resume=function(){var e=this._readableState;return e.flowing||(v(`resume`),e.flowing=!0,H(this,e)),this};function H(e,t){t.resumeScheduled||(t.resumeScheduled=!0,a.nextTick(se,e,t))}function se(e,t){t.reading||(v(`resume read 0`),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit(`resume`),ce(e),t.flowing&&!t.reading&&e.read(0)}T.prototype.pause=function(){return v(`call pause flowing=%j`,this._readableState.flowing),!1!==this._readableState.flowing&&(v(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this};function ce(e){var t=e._readableState;for(v(`flow`,t.flowing);t.flowing&&e.read()!==null;);}T.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on(`end`,function(){if(v(`wrapped end`),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on(`data`,function(i){v(`wrapped data`),n.decoder&&(i=n.decoder.write(i)),!(n.objectMode&&i==null)&&(!n.objectMode&&(!i||!i.length)||t.push(i)||(r=!0,e.pause()))}),e)this[i]===void 0&&typeof e[i]==`function`&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<S.length;a++)e.on(S[a],this.emit.bind(this,S[a]));return this._read=function(t){v(`wrapped _read`,t),r&&(r=!1,e.resume())},this},Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),T._fromList=W;function W(e,t){if(t.length===0)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=G(e,t.buffer,t.decoder),n}function G(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?le(e,t):K(e,t),r}function le(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),e-=o,e===0){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}function K(e,t){var n=d.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),e-=o,e===0){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}function q(e){var t=e._readableState;if(t.length>0)throw Error(`"endReadable()" called on non-empty stream`);t.endEmitted||(t.ended=!0,a.nextTick(ue,t,e))}function ue(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit(`end`))}function J(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}})),W=n(((e,t)=>{t.exports=a;var n=oe(),r=Object.create(ie());r.inherits=p(),r.inherits(a,n);function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit(`error`,Error(`write callback called multiple times`));n.writechunk=null,n.writecb=null,t!=null&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function a(e){if(!(this instanceof a))return new a(e);n.call(this,e),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,o)}function o(){var e=this;typeof this._flush==`function`?this._flush(function(t,n){s(e,t,n)}):s(this,null,null)}a.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},a.prototype._transform=function(e,t,n){throw Error(`_transform() is not implemented`)},a.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},a.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,function(e){t(e),r.emit(`close`)})};function s(e,t,n){if(t)return e.emit(`error`,t);if(n!=null&&e.push(n),e._writableState.length)throw Error(`Calling transform done when ws.length != 0`);if(e._transformState.transforming)throw Error(`Calling transform done when still transforming`);return e.push(null)}})),G=n(((e,t)=>{t.exports=i;var n=W(),r=Object.create(ie());r.inherits=p(),r.inherits(i,n);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}i.prototype._transform=function(e,t,n){n(null,e)}})),le=n(((e,t)=>{e=t.exports=ce(),e.Stream=e,e.Readable=e,e.Writable=H(),e.Duplex=oe(),e.Transform=W(),e.PassThrough=G()})),K=n(((e,t)=>{var n=c().Buffer,r=F(),i=le().Transform,a=p();function o(e){i.call(this),this._block=n.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}a(o,i),o.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},o.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},o.prototype.update=function(e,t){if(this._finalized)throw Error(`Digest already called`);for(var n=r(e,t),i=this._block,a=0;this._blockOffset+n.length-a>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)i[o]=n[a],o+=1,a+=1;this._update(),this._blockOffset=0}for(;a<n.length;)i[this._blockOffset]=n[a],this._blockOffset+=1,a+=1;for(var s=0,c=n.length*8;c>0;++s)this._length[s]+=c,c=this._length[s]/4294967296|0,c>0&&(this._length[s]-=4294967296*c);return this},o.prototype._update=function(){throw Error(`_update is not implemented`)},o.prototype.digest=function(e){if(this._finalized)throw Error(`Digest already called`);this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},o.prototype._digest=function(){throw Error(`_digest is not implemented`)},t.exports=o})),q=n(((e,t)=>{var n=l().Buffer,r=p(),i=K(),a=Array(16),o=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],s=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],u=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],d=[0,1518500249,1859775393,2400959708,2840853838],f=[1352829926,1548603684,1836072691,2053994217,0];function m(e,t){return e<<t|e>>>32-t}function h(e,t,n,r,i,a,o,s){return m(e+(t^n^r)+a+o|0,s)+i|0}function g(e,t,n,r,i,a,o,s){return m(e+(t&n|~t&r)+a+o|0,s)+i|0}function _(e,t,n,r,i,a,o,s){return m(e+((t|~n)^r)+a+o|0,s)+i|0}function v(e,t,n,r,i,a,o,s){return m(e+(t&r|n&~r)+a+o|0,s)+i|0}function y(e,t,n,r,i,a,o,s){return m(e+(t^(n|~r))+a+o|0,s)+i|0}function b(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}r(b,i),b.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);for(var n=this._a|0,r=this._b|0,i=this._c|0,l=this._d|0,p=this._e|0,b=this._a|0,x=this._b|0,S=this._c|0,C=this._d|0,w=this._e|0,T=0;T<80;T+=1){var E,D;T<16?(E=h(n,r,i,l,p,e[o[T]],d[0],c[T]),D=y(b,x,S,C,w,e[s[T]],f[0],u[T])):T<32?(E=g(n,r,i,l,p,e[o[T]],d[1],c[T]),D=v(b,x,S,C,w,e[s[T]],f[1],u[T])):T<48?(E=_(n,r,i,l,p,e[o[T]],d[2],c[T]),D=_(b,x,S,C,w,e[s[T]],f[2],u[T])):T<64?(E=v(n,r,i,l,p,e[o[T]],d[3],c[T]),D=g(b,x,S,C,w,e[s[T]],f[3],u[T])):(E=y(n,r,i,l,p,e[o[T]],d[4],c[T]),D=h(b,x,S,C,w,e[s[T]],f[4],u[T])),n=p,p=l,l=m(i,10),i=r,r=E,b=w,w=C,C=m(S,10),S=x,x=D}var O=this._b+i+C|0;this._b=this._c+l+w|0,this._c=this._d+p+b|0,this._d=this._e+n+x|0,this._e=this._a+r+S|0,this._a=O},b.prototype._digest=function(){this._block[this._blockOffset]=128,this._blockOffset+=1,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=n.alloc?n.alloc(20):new n(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},t.exports=b})),ue=n(((e,t)=>{var n=p(),r=D(),i=c().Buffer,a=[1518500249,1859775393,-1894007588,-899497514],o=Array(80);function s(){this.init(),this._w=o,r.call(this,64,56)}n(s,r),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function l(e){return e<<5|e>>>27}function u(e){return e<<30|e>>>2}function d(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}s.prototype._update=function(e){for(var t=this._w,n=this._a|0,r=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,c=0;c<16;++c)t[c]=e.readInt32BE(c*4);for(;c<80;++c)t[c]=t[c-3]^t[c-8]^t[c-14]^t[c-16];for(var f=0;f<80;++f){var p=~~(f/20),m=l(n)+d(p,r,i,o)+s+t[f]+a[p]|0;s=o,o=i,i=u(r),r=n,n=m}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0},s.prototype._hash=function(){var e=i.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e},t.exports=s})),J=n(((e,t)=>{var n=p(),r=D(),i=c().Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],o=Array(64);function s(){this.init(),this._w=o,r.call(this,64,56)}n(s,r),s.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function l(e,t,n){return n^e&(t^n)}function u(e,t,n){return e&t|n&(e|t)}function d(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function f(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function m(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function h(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}s.prototype._update=function(e){for(var t=this._w,n=this._a|0,r=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,c=this._f|0,p=this._g|0,g=this._h|0,_=0;_<16;++_)t[_]=e.readInt32BE(_*4);for(;_<64;++_)t[_]=h(t[_-2])+t[_-7]+m(t[_-15])+t[_-16]|0;for(var v=0;v<64;++v){var y=g+f(s)+l(s,c,p)+a[v]+t[v]|0,b=d(n)+u(n,r,i)|0;g=p,p=c,c=s,s=o+y|0,o=i,i=r,r=n,n=y+b|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=c+this._f|0,this._g=p+this._g|0,this._h=g+this._h|0},s.prototype._hash=function(){var e=i.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=s})),de=n(((e,t)=>{var n=p(),r=J(),i=D(),a=c().Buffer,o=Array(64);function s(){this.init(),this._w=o,i.call(this,64,56)}n(s,r),s.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},s.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=s})),fe=n(((e,t)=>{var n=p(),r=D(),i=c().Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],o=Array(160);function s(){this.init(),this._w=o,r.call(this,128,112)}n(s,r),s.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function l(e,t,n){return n^e&(t^n)}function u(e,t,n){return e&t|n&(e|t)}function d(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function f(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function m(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function h(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function _(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function v(e,t){return+(e>>>0<t>>>0)}s.prototype._update=function(e){for(var t=this._w,n=this._ah|0,r=this._bh|0,i=this._ch|0,o=this._dh|0,s=this._eh|0,c=this._fh|0,p=this._gh|0,y=this._hh|0,b=this._al|0,x=this._bl|0,S=this._cl|0,C=this._dl|0,w=this._el|0,T=this._fl|0,E=this._gl|0,D=this._hl|0,O=0;O<32;O+=2)t[O]=e.readInt32BE(O*4),t[O+1]=e.readInt32BE(O*4+4);for(;O<160;O+=2){var k=t[O-30],A=t[O-30+1],ee=m(k,A),j=h(A,k);k=t[O-4],A=t[O-4+1];var M=g(k,A),te=_(A,k),N=t[O-14],P=t[O-14+1],ne=t[O-32],F=t[O-32+1],I=j+P|0,re=ee+N+v(I,j)|0;I=I+te|0,re=re+M+v(I,te)|0,I=I+F|0,re=re+ne+v(I,F)|0,t[O]=re,t[O+1]=I}for(var L=0;L<160;L+=2){re=t[L],I=t[L+1];var R=u(n,r,i),ie=u(b,x,S),z=d(n,b),B=d(b,n),ae=f(s,w),V=f(w,s),H=a[L],oe=a[L+1],se=l(s,c,p),U=l(w,T,E),ce=D+V|0,W=y+ae+v(ce,D)|0;ce=ce+U|0,W=W+se+v(ce,U)|0,ce=ce+oe|0,W=W+H+v(ce,oe)|0,ce=ce+I|0,W=W+re+v(ce,I)|0;var G=B+ie|0,le=z+R+v(G,B)|0;y=p,D=E,p=c,E=T,c=s,T=w,w=C+ce|0,s=o+W+v(w,C)|0,o=i,C=S,i=r,S=x,r=n,x=b,b=ce+G|0,n=W+le+v(b,ce)|0}this._al=this._al+b|0,this._bl=this._bl+x|0,this._cl=this._cl+S|0,this._dl=this._dl+C|0,this._el=this._el+w|0,this._fl=this._fl+T|0,this._gl=this._gl+E|0,this._hl=this._hl+D|0,this._ah=this._ah+n+v(this._al,b)|0,this._bh=this._bh+r+v(this._bl,x)|0,this._ch=this._ch+i+v(this._cl,S)|0,this._dh=this._dh+o+v(this._dl,C)|0,this._eh=this._eh+s+v(this._el,w)|0,this._fh=this._fh+c+v(this._fl,T)|0,this._gh=this._gh+p+v(this._gl,E)|0,this._hh=this._hh+y+v(this._hl,D)|0},s.prototype._hash=function(){var e=i.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},t.exports=s})),pe=n(((e,t)=>{var n=p(),r=fe(),i=D(),a=c().Buffer,o=Array(160);function s(){this.init(),this._w=o,i.call(this,128,112)}n(s,r),s.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},s.prototype._hash=function(){var e=a.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},t.exports=s})),me=n(((e,t)=>{t.exports=function(e){var n=e.toLowerCase(),r=t.exports[n];if(!r)throw Error(n+` is not supported (we accept pull requests)`);return new r},t.exports.sha=ue(),t.exports.sha1=O(),t.exports.sha224=de(),t.exports.sha256=J(),t.exports.sha384=pe(),t.exports.sha512=fe()})),Y=n(((e,t)=>{var n=c().Buffer,r=b().Transform,i=s().StringDecoder,a=p(),o=E();function l(e){r.call(this),this.hashMode=typeof e==`string`,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&=(this.__final=this._final,null),this._decoder=null,this._encoding=null}a(l,r),l.prototype.update=function(e,t,n){var r=o(e,t),i=this._update(r);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},l.prototype.setAutoPadding=function(){},l.prototype.getAuthTag=function(){throw Error(`trying to get auth tag in unsupported state`)},l.prototype.setAuthTag=function(){throw Error(`trying to set auth tag in unsupported state`)},l.prototype.setAAD=function(){throw Error(`trying to set aad in unsupported state`)},l.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},l.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},l.prototype._finalOrDigest=function(e){var t=this.__final()||n.alloc(0);return e&&(t=this._toString(t,e,!0)),t},l.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new i(t),this._encoding=t),this._encoding!==t)throw Error(`can’t switch encodings`);var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r},t.exports=l})),X=n(((e,t)=>{var n=p(),r=ne(),i=q(),a=me(),o=Y();function s(e){o.call(this,`digest`),this._hash=e}n(s,o),s.prototype._update=function(e){this._hash.update(e)},s.prototype._final=function(){return this._hash.digest()},t.exports=function(e){return e=e.toLowerCase(),e===`md5`?new r:e===`rmd160`||e===`ripemd160`?new i:new s(a(e))}})),Z=n(((e,t)=>{var n=p(),r=c().Buffer,i=Y(),a=r.alloc(128),o=64;function s(e,t){i.call(this,`digest`),typeof t==`string`&&(t=r.from(t)),this._alg=e,this._key=t,t.length>o?t=e(t):t.length<o&&(t=r.concat([t,a],o));for(var n=this._ipad=r.allocUnsafe(o),s=this._opad=r.allocUnsafe(o),c=0;c<o;c++)n[c]=t[c]^54,s[c]=t[c]^92;this._hash=[n]}n(s,i),s.prototype._update=function(e){this._hash.push(e)},s.prototype._final=function(){var e=this._alg(r.concat(this._hash));return this._alg(r.concat([this._opad,e]))},t.exports=s})),he=n(((e,t)=>{var n=ne();t.exports=function(e){return new n().update(e).digest()}})),ge=n(((e,t)=>{var n=p(),r=Z(),i=Y(),a=c().Buffer,o=he(),s=q(),l=me(),u=a.alloc(128);function d(e,t){i.call(this,`digest`),typeof t==`string`&&(t=a.from(t));var n=e===`sha512`||e===`sha384`?128:64;this._alg=e,this._key=t,t.length>n?t=(e===`rmd160`?new s:l(e)).update(t).digest():t.length<n&&(t=a.concat([t,u],n));for(var r=this._ipad=a.allocUnsafe(n),o=this._opad=a.allocUnsafe(n),c=0;c<n;c++)r[c]=t[c]^54,o[c]=t[c]^92;this._hash=e===`rmd160`?new s:l(e),this._hash.update(r)}n(d,i),d.prototype._update=function(e){this._hash.update(e)},d.prototype._final=function(){var e=this._hash.digest();return(this._alg===`rmd160`?new s:l(this._alg)).update(this._opad).update(e).digest()},t.exports=function(e,t){return e=e.toLowerCase(),e===`rmd160`||e===`ripemd160`?new d(`rmd160`,t):e===`md5`?new r(o,t):new d(e,t)}})),_e=n(((e,t)=>{t.exports={sha224WithRSAEncryption:{sign:`rsa`,hash:`sha224`,id:`302d300d06096086480165030402040500041c`},"RSA-SHA224":{sign:`ecdsa/rsa`,hash:`sha224`,id:`302d300d06096086480165030402040500041c`},sha256WithRSAEncryption:{sign:`rsa`,hash:`sha256`,id:`3031300d060960864801650304020105000420`},"RSA-SHA256":{sign:`ecdsa/rsa`,hash:`sha256`,id:`3031300d060960864801650304020105000420`},sha384WithRSAEncryption:{sign:`rsa`,hash:`sha384`,id:`3041300d060960864801650304020205000430`},"RSA-SHA384":{sign:`ecdsa/rsa`,hash:`sha384`,id:`3041300d060960864801650304020205000430`},sha512WithRSAEncryption:{sign:`rsa`,hash:`sha512`,id:`3051300d060960864801650304020305000440`},"RSA-SHA512":{sign:`ecdsa/rsa`,hash:`sha512`,id:`3051300d060960864801650304020305000440`},"RSA-SHA1":{sign:`rsa`,hash:`sha1`,id:`3021300906052b0e03021a05000414`},"ecdsa-with-SHA1":{sign:`ecdsa`,hash:`sha1`,id:``},sha256:{sign:`ecdsa/rsa`,hash:`sha256`,id:`3031300d060960864801650304020105000420`},sha224:{sign:`ecdsa/rsa`,hash:`sha224`,id:`302d300d06096086480165030402040500041c`},sha384:{sign:`ecdsa/rsa`,hash:`sha384`,id:`3041300d060960864801650304020205000430`},sha512:{sign:`ecdsa/rsa`,hash:`sha512`,id:`3051300d060960864801650304020305000440`},"DSA-SHA":{sign:`dsa`,hash:`sha1`,id:``},"DSA-SHA1":{sign:`dsa`,hash:`sha1`,id:``},DSA:{sign:`dsa`,hash:`sha1`,id:``},"DSA-WITH-SHA224":{sign:`dsa`,hash:`sha224`,id:``},"DSA-SHA224":{sign:`dsa`,hash:`sha224`,id:``},"DSA-WITH-SHA256":{sign:`dsa`,hash:`sha256`,id:``},"DSA-SHA256":{sign:`dsa`,hash:`sha256`,id:``},"DSA-WITH-SHA384":{sign:`dsa`,hash:`sha384`,id:``},"DSA-SHA384":{sign:`dsa`,hash:`sha384`,id:``},"DSA-WITH-SHA512":{sign:`dsa`,hash:`sha512`,id:``},"DSA-SHA512":{sign:`dsa`,hash:`sha512`,id:``},"DSA-RIPEMD160":{sign:`dsa`,hash:`rmd160`,id:``},ripemd160WithRSA:{sign:`rsa`,hash:`rmd160`,id:`3021300906052b2403020105000414`},"RSA-RIPEMD160":{sign:`rsa`,hash:`rmd160`,id:`3021300906052b2403020105000414`},md5WithRSAEncryption:{sign:`rsa`,hash:`md5`,id:`3020300c06082a864886f70d020505000410`},"RSA-MD5":{sign:`rsa`,hash:`md5`,id:`3020300c06082a864886f70d020505000410`}}})),ve=n(((e,t)=>{t.exports=_e()})),ye=n(((e,t)=>{var n=isFinite,r=2**30-1;t.exports=function(e,t){if(typeof e!=`number`)throw TypeError(`Iterations not a number`);if(e<0||!n(e))throw TypeError(`Bad iterations`);if(typeof t!=`number`)throw TypeError(`Key length not a number`);if(t<0||t>r||t!==t)throw TypeError(`Bad key length`);return t+0}})),be=n(((t,n)=>{var i=e(r());n.exports=globalThis.process&&globalThis.process.browser?`utf-8`:globalThis.process&&globalThis.process.version?parseInt(i.default.version.split(`.`)[0].slice(1),10)>=6?`utf-8`:`binary`:`utf-8`})),xe=n(((e,t)=>{var n=c().Buffer,r=E(),i=typeof Uint8Array<`u`,a=i&&typeof ArrayBuffer<`u`&&ArrayBuffer.isView;t.exports=function(e,t,o){if(typeof e==`string`||n.isBuffer(e)||i&&e instanceof Uint8Array||a&&a(e))return r(e,t);throw TypeError(o+` must be a string, a Buffer, a Uint8Array, or a DataView`)}})),Se=n(((e,t)=>{var n=he(),r=q(),i=me(),a=c().Buffer,o=ye(),s=be(),l=xe(),u=a.alloc(128),d={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},f={__proto__:null,"sha-1":`sha1`,"sha-224":`sha224`,"sha-256":`sha256`,"sha-384":`sha384`,"sha-512":`sha512`,"ripemd-160":`ripemd160`};function p(e){return new r().update(e).digest()}function m(e){function t(t){return i(e).update(t).digest()}return e===`rmd160`||e===`ripemd160`?p:e===`md5`?n:t}function h(e,t,n){var r=m(e),i=e===`sha512`||e===`sha384`?128:64;t.length>i?t=r(t):t.length<i&&(t=a.concat([t,u],i));for(var o=a.allocUnsafe(i+d[e]),s=a.allocUnsafe(i+d[e]),c=0;c<i;c++)o[c]=t[c]^54,s[c]=t[c]^92;var l=a.allocUnsafe(i+n+4);o.copy(l,0,0,i),this.ipad1=l,this.ipad2=o,this.opad=s,this.alg=e,this.blocksize=i,this.hash=r,this.size=d[e]}h.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)};function g(e,t,n,r,i){r=o(n,r),e=l(e,s,`Password`),t=l(t,s,`Salt`);var c=(i||`sha1`).toLowerCase(),u=f[c]||c,p=d[u];if(typeof p!=`number`||!p)throw TypeError(`Digest algorithm not supported: `+i);var m=new h(u,e,t.length),g=a.allocUnsafe(r),_=a.allocUnsafe(t.length+4);t.copy(_,0,0,t.length);for(var v=0,y=p,b=Math.ceil(r/y),x=1;x<=b;x++){_.writeUInt32BE(x,t.length);for(var S=m.run(_,m.ipad1),C=S,w=1;w<n;w++){C=m.run(C,m.ipad2);for(var T=0;T<y;T++)S[T]^=C[T]}S.copy(g,v),v+=y}return g}t.exports=g})),Ce=n(((e,t)=>{var n=c().Buffer,r=ye(),i=be(),a=Se(),o=xe(),s,l=globalThis.crypto&&globalThis.crypto.subtle,u={sha:`SHA-1`,"sha-1":`SHA-1`,sha1:`SHA-1`,sha256:`SHA-256`,"sha-256":`SHA-256`,sha384:`SHA-384`,"sha-384":`SHA-384`,"sha-512":`SHA-512`,sha512:`SHA-512`},d=[],f;function p(){return f||(f=globalThis.process&&globalThis.process.nextTick?globalThis.process.nextTick:globalThis.queueMicrotask?globalThis.queueMicrotask:globalThis.setImmediate?globalThis.setImmediate:globalThis.setTimeout,f)}function m(e,t,r,i,a){return l.importKey(`raw`,e,{name:`PBKDF2`},!1,[`deriveBits`]).then(function(e){return l.deriveBits({name:`PBKDF2`,salt:t,iterations:r,hash:{name:a}},e,i<<3)}).then(function(e){return n.from(e)})}function h(e){if(globalThis.process&&!globalThis.process.browser||!l||!l.importKey||!l.deriveBits)return Promise.resolve(!1);if(d[e]!==void 0)return d[e];s||=n.alloc(8);var t=m(s,s,10,128,e).then(function(){return!0},function(){return!1});return d[e]=t,t}function g(e,t){e.then(function(e){p()(function(){t(null,e)})},function(e){p()(function(){t(e)})})}t.exports=function(e,t,n,s,c,l){if(typeof c==`function`&&(l=c,c=void 0),s=r(n,s),e=o(e,i,`Password`),t=o(t,i,`Salt`),typeof l!=`function`)throw Error(`No callback provided to pbkdf2`);c||=`sha1`;var d=u[c.toLowerCase()];if(!d||typeof globalThis.Promise!=`function`){p()(function(){var r;try{r=a(e,t,n,s,c)}catch(e){l(e);return}l(null,r)});return}g(h(d).then(function(r){return r?m(e,t,n,s,d):a(e,t,n,s,c)}),l)}})),we=n((e=>{e.pbkdf2=Ce(),e.pbkdf2Sync=Se()})),Te=n((e=>{e.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},e.writeUInt32BE=function(e,t,n){e[0+n]=t>>>24,e[1+n]=t>>>16&255,e[2+n]=t>>>8&255,e[3+n]=t&255},e.ip=function(e,t,n,r){for(var i=0,a=0,o=6;o>=0;o-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+o&1;for(var s=0;s<=24;s+=8)i<<=1,i|=e>>>s+o&1}for(var o=6;o>=0;o-=2){for(var s=1;s<=25;s+=8)a<<=1,a|=t>>>s+o&1;for(var s=1;s<=25;s+=8)a<<=1,a|=e>>>s+o&1}n[r+0]=i>>>0,n[r+1]=a>>>0},e.rip=function(e,t,n,r){for(var i=0,a=0,o=0;o<4;o++)for(var s=24;s>=0;s-=8)i<<=1,i|=t>>>s+o&1,i<<=1,i|=e>>>s+o&1;for(var o=4;o<8;o++)for(var s=24;s>=0;s-=8)a<<=1,a|=t>>>s+o&1,a<<=1,a|=e>>>s+o&1;n[r+0]=i>>>0,n[r+1]=a>>>0},e.pc1=function(e,t,n,r){for(var i=0,a=0,o=7;o>=5;o--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+o&1;for(var s=0;s<=24;s+=8)i<<=1,i|=e>>s+o&1}for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+o&1;for(var o=1;o<=3;o++){for(var s=0;s<=24;s+=8)a<<=1,a|=t>>s+o&1;for(var s=0;s<=24;s+=8)a<<=1,a|=e>>s+o&1}for(var s=0;s<=24;s+=8)a<<=1,a|=e>>s+o&1;n[r+0]=i>>>0,n[r+1]=a>>>0},e.r28shl=function(e,t){return e<<t&268435455|e>>>28-t};var t=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(e,n,r,i){for(var a=0,o=0,s=t.length>>>1,c=0;c<s;c++)a<<=1,a|=e>>>t[c]&1;for(var c=s;c<t.length;c++)o<<=1,o|=n>>>t[c]&1;r[i+0]=a>>>0,r[i+1]=o>>>0},e.expand=function(e,t,n){var r=0,i=0;r=(e&1)<<5|e>>>27;for(var a=23;a>=15;a-=4)r<<=6,r|=e>>>a&63;for(var a=11;a>=3;a-=4)i|=e>>>a&63,i<<=6;i|=(e&31)<<1|e>>>31,t[n+0]=r>>>0,t[n+1]=i>>>0};var n=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(e,t){for(var r=0,i=0;i<4;i++){var a=e>>>18-i*6&63,o=n[i*64+a];r<<=4,r|=o}for(var i=0;i<4;i++){var a=t>>>18-i*6&63,o=n[256+i*64+a];r<<=4,r|=o}return r>>>0};var r=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(e){for(var t=0,n=0;n<r.length;n++)t<<=1,t|=e>>>r[n]&1;return t>>>0},e.padSplit=function(e,t,n){for(var r=e.toString(2);r.length<t;)r=`0`+r;for(var i=[],a=0;a<t;a+=n)i.push(r.slice(a,a+n));return i.join(` `)}})),Ee=n(((e,t)=>{t.exports=n;function n(e,t){if(!e)throw Error(t||`Assertion failed`)}n.equal=function(e,t,n){if(e!=t)throw Error(n||`Assertion failed: `+e+` != `+t)}})),De=n(((e,t)=>{var n=Ee();function r(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=Array(this.blockSize),this.bufferOff=0,this.padding=e.padding!==!1}t.exports=r,r.prototype._init=function(){},r.prototype.update=function(e){return e.length===0?[]:this.type===`decrypt`?this._updateDecrypt(e):this._updateEncrypt(e)},r.prototype._buffer=function(e,t){for(var n=Math.min(this.buffer.length-this.bufferOff,e.length-t),r=0;r<n;r++)this.buffer[this.bufferOff+r]=e[t+r];return this.bufferOff+=n,n},r.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},r.prototype._updateEncrypt=function(e){var t=0,n=0,r=(this.bufferOff+e.length)/this.blockSize|0,i=Array(r*this.blockSize);this.bufferOff!==0&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(i,n)));for(var a=e.length-(e.length-t)%this.blockSize;t<a;t+=this.blockSize)this._update(e,t,i,n),n+=this.blockSize;for(;t<e.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=e[t];return i},r.prototype._updateDecrypt=function(e){for(var t=0,n=0,r=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,i=Array(r*this.blockSize);r>0;r--)t+=this._buffer(e,t),n+=this._flushBuffer(i,n);return t+=this._buffer(e,t),i},r.prototype.final=function(e){var t;e&&(t=this.update(e));var n=this.type===`encrypt`?this._finalEncrypt():this._finalDecrypt();return t?t.concat(n):n},r.prototype._pad=function(e,t){if(t===0)return!1;for(;t<e.length;)e[t++]=0;return!0},r.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=Array(this.blockSize);return this._update(this.buffer,0,e,0),e},r.prototype._unpad=function(e){return e},r.prototype._finalDecrypt=function(){n.equal(this.bufferOff,this.blockSize,`Not enough data to decrypt`);var e=Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)}})),Oe=n(((e,t)=>{var n=Ee(),r=p(),i=Te(),a=De();function o(){this.tmp=[,,],this.keys=null}function s(e){a.call(this,e);var t=new o;this._desState=t,this.deriveKeys(t,e.key)}r(s,a),t.exports=s,s.create=function(e){return new s(e)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];s.prototype.deriveKeys=function(e,t){e.keys=Array(32),n.equal(t.length,this.blockSize,`Invalid key length`);var r=i.readUInt32BE(t,0),a=i.readUInt32BE(t,4);i.pc1(r,a,e.tmp,0),r=e.tmp[0],a=e.tmp[1];for(var o=0;o<e.keys.length;o+=2){var s=c[o>>>1];r=i.r28shl(r,s),a=i.r28shl(a,s),i.pc2(r,a,e.keys,o)}},s.prototype._update=function(e,t,n,r){var a=this._desState,o=i.readUInt32BE(e,t),s=i.readUInt32BE(e,t+4);i.ip(o,s,a.tmp,0),o=a.tmp[0],s=a.tmp[1],this.type===`encrypt`?this._encrypt(a,o,s,a.tmp,0):this._decrypt(a,o,s,a.tmp,0),o=a.tmp[0],s=a.tmp[1],i.writeUInt32BE(n,o,r),i.writeUInt32BE(n,s,r+4)},s.prototype._pad=function(e,t){if(this.padding===!1)return!1;for(var n=e.length-t,r=t;r<e.length;r++)e[r]=n;return!0},s.prototype._unpad=function(e){if(this.padding===!1)return e;for(var t=e[e.length-1],r=e.length-t;r<e.length;r++)n.equal(e[r],t);return e.slice(0,e.length-t)},s.prototype._encrypt=function(e,t,n,r,a){for(var o=t,s=n,c=0;c<e.keys.length;c+=2){var l=e.keys[c],u=e.keys[c+1];i.expand(s,e.tmp,0),l^=e.tmp[0],u^=e.tmp[1];var d=i.substitute(l,u),f=i.permute(d),p=s;s=(o^f)>>>0,o=p}i.rip(s,o,r,a)},s.prototype._decrypt=function(e,t,n,r,a){for(var o=n,s=t,c=e.keys.length-2;c>=0;c-=2){var l=e.keys[c],u=e.keys[c+1];i.expand(o,e.tmp,0),l^=e.tmp[0],u^=e.tmp[1];var d=i.substitute(l,u),f=i.permute(d),p=o;o=(s^f)>>>0,s=p}i.rip(o,s,r,a)}})),ke=n((e=>{var t=Ee(),n=p(),r={};function i(e){t.equal(e.length,8,`Invalid IV length`),this.iv=Array(8);for(var n=0;n<this.iv.length;n++)this.iv[n]=e[n]}function a(e){function t(t){e.call(this,t),this._cbcInit()}n(t,e);for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];t.prototype[o]=r[o]}return t.create=function(e){return new t(e)},t}e.instantiate=a,r._cbcInit=function(){var e=new i(this.options.iv);this._cbcState=e},r._update=function(e,t,n,r){var i=this._cbcState,a=this.constructor.super_.prototype,o=i.iv;if(this.type===`encrypt`){for(var s=0;s<this.blockSize;s++)o[s]^=e[t+s];a._update.call(this,o,0,n,r);for(var s=0;s<this.blockSize;s++)o[s]=n[r+s]}else{a._update.call(this,e,t,n,r);for(var s=0;s<this.blockSize;s++)n[r+s]^=o[s];for(var s=0;s<this.blockSize;s++)o[s]=e[t+s]}}})),Ae=n(((e,t)=>{var n=Ee(),r=p(),i=De(),a=Oe();function o(e,t){n.equal(t.length,24,`Invalid key length`);var r=t.slice(0,8),i=t.slice(8,16),o=t.slice(16,24);e===`encrypt`?this.ciphers=[a.create({type:`encrypt`,key:r}),a.create({type:`decrypt`,key:i}),a.create({type:`encrypt`,key:o})]:this.ciphers=[a.create({type:`decrypt`,key:o}),a.create({type:`encrypt`,key:i}),a.create({type:`decrypt`,key:r})]}function s(e){i.call(this,e);var t=new o(this.type,this.options.key);this._edeState=t}r(s,i),t.exports=s,s.create=function(e){return new s(e)},s.prototype._update=function(e,t,n,r){var i=this._edeState;i.ciphers[0]._update(e,t,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},s.prototype._pad=a.prototype._pad,s.prototype._unpad=a.prototype._unpad})),je=n((e=>{e.utils=Te(),e.Cipher=De(),e.DES=Oe(),e.CBC=ke(),e.EDE=Ae()})),Me=n(((e,t)=>{var n=Y(),r=je(),i=p(),a=c().Buffer,o={"des-ede3-cbc":r.CBC.instantiate(r.EDE),"des-ede3":r.EDE,"des-ede-cbc":r.CBC.instantiate(r.EDE),"des-ede":r.EDE,"des-cbc":r.CBC.instantiate(r.DES),"des-ecb":r.DES};o.des=o[`des-cbc`],o.des3=o[`des-ede3-cbc`],t.exports=s,i(s,n);function s(e){n.call(this);var t=e.mode.toLowerCase(),r=o[t],i=e.decrypt?`decrypt`:`encrypt`,s=e.key;a.isBuffer(s)||(s=a.from(s)),(t===`des-ede`||t===`des-ede-cbc`)&&(s=a.concat([s,s.slice(0,8)]));var c=e.iv;a.isBuffer(c)||(c=a.from(c)),this._des=r.create({key:s,iv:c,type:i})}s.prototype._update=function(e){return a.from(this._des.update(e))},s.prototype._final=function(){return a.from(this._des.final())}})),Ne=n((e=>{e.encrypt=function(e,t){return e._cipher.encryptBlock(t)},e.decrypt=function(e,t){return e._cipher.decryptBlock(t)}})),Pe=n(((e,t)=>{var n=l();t.exports=function(e,t){for(var r=Math.min(e.length,t.length),i=new n.Buffer(r),a=0;a<r;++a)i[a]=e[a]^t[a];return i}})),Fe=n((e=>{var t=Pe();e.encrypt=function(e,n){var r=t(n,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},e.decrypt=function(e,n){var r=e._prev;return e._prev=n,t(e._cipher.decryptBlock(n),r)}})),Q=n((e=>{var t=c().Buffer,n=Pe();function r(e,r,i){var a=r.length,o=n(r,e._cache);return e._cache=e._cache.slice(a),e._prev=t.concat([e._prev,i?r:o]),o}e.encrypt=function(e,n,i){for(var a=t.allocUnsafe(0),o;n.length;)if(e._cache.length===0&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=t.allocUnsafe(0)),e._cache.length<=n.length)o=e._cache.length,a=t.concat([a,r(e,n.slice(0,o),i)]),n=n.slice(o);else{a=t.concat([a,r(e,n,i)]);break}return a}})),Ie=n((e=>{var t=c().Buffer;function n(e,n,r){var i=e._cipher.encryptBlock(e._prev)[0]^n;return e._prev=t.concat([e._prev.slice(1),t.from([r?n:i])]),i}e.encrypt=function(e,r,i){for(var a=r.length,o=t.allocUnsafe(a),s=-1;++s<a;)o[s]=n(e,r[s],i);return o}})),Le=n((e=>{var t=c().Buffer;function n(e,t,n){for(var i,a=-1,o=8,s=0,c,l;++a<o;)i=e._cipher.encryptBlock(e._prev),c=t&1<<7-a?128:0,l=i[0]^c,s+=(l&128)>>a%8,e._prev=r(e._prev,n?c:l);return s}function r(e,n){var r=e.length,i=-1,a=t.allocUnsafe(e.length);for(e=t.concat([e,t.from([n])]);++i<r;)a[i]=e[i]<<1|e[i+1]>>7;return a}e.encrypt=function(e,r,i){for(var a=r.length,o=t.allocUnsafe(a),s=-1;++s<a;)o[s]=n(e,r[s],i);return o}})),Re=n((e=>{var t=l(),n=Pe();function r(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}e.encrypt=function(e,i){for(;e._cache.length<i.length;)e._cache=t.Buffer.concat([e._cache,r(e)]);var a=e._cache.slice(0,i.length);return e._cache=e._cache.slice(i.length),n(i,a)}})),ze=n(((e,t)=>{function n(e){for(var t=e.length,n;t--;)if(n=e.readUInt8(t),n===255)e.writeUInt8(0,t);else{n++,e.writeUInt8(n,t);break}}t.exports=n})),Be=n((e=>{var t=Pe(),n=c().Buffer,r=ze();function i(e){var t=e._cipher.encryptBlockRaw(e._prev);return r(e._prev),t}var a=16;e.encrypt=function(e,r){var o=Math.ceil(r.length/a),s=e._cache.length;e._cache=n.concat([e._cache,n.allocUnsafe(o*a)]);for(var c=0;c<o;c++){var l=i(e),u=s+c*a;e._cache.writeUInt32BE(l[0],u+0),e._cache.writeUInt32BE(l[1],u+4),e._cache.writeUInt32BE(l[2],u+8),e._cache.writeUInt32BE(l[3],u+12)}var d=e._cache.slice(0,r.length);return e._cache=e._cache.slice(r.length),t(r,d)}})),Ve=n(((e,t)=>{t.exports={"aes-128-ecb":{cipher:`AES`,key:128,iv:0,mode:`ECB`,type:`block`},"aes-192-ecb":{cipher:`AES`,key:192,iv:0,mode:`ECB`,type:`block`},"aes-256-ecb":{cipher:`AES`,key:256,iv:0,mode:`ECB`,type:`block`},"aes-128-cbc":{cipher:`AES`,key:128,iv:16,mode:`CBC`,type:`block`},"aes-192-cbc":{cipher:`AES`,key:192,iv:16,mode:`CBC`,type:`block`},"aes-256-cbc":{cipher:`AES`,key:256,iv:16,mode:`CBC`,type:`block`},aes128:{cipher:`AES`,key:128,iv:16,mode:`CBC`,type:`block`},aes192:{cipher:`AES`,key:192,iv:16,mode:`CBC`,type:`block`},aes256:{cipher:`AES`,key:256,iv:16,mode:`CBC`,type:`block`},"aes-128-cfb":{cipher:`AES`,key:128,iv:16,mode:`CFB`,type:`stream`},"aes-192-cfb":{cipher:`AES`,key:192,iv:16,mode:`CFB`,type:`stream`},"aes-256-cfb":{cipher:`AES`,key:256,iv:16,mode:`CFB`,type:`stream`},"aes-128-cfb8":{cipher:`AES`,key:128,iv:16,mode:`CFB8`,type:`stream`},"aes-192-cfb8":{cipher:`AES`,key:192,iv:16,mode:`CFB8`,type:`stream`},"aes-256-cfb8":{cipher:`AES`,key:256,iv:16,mode:`CFB8`,type:`stream`},"aes-128-cfb1":{cipher:`AES`,key:128,iv:16,mode:`CFB1`,type:`stream`},"aes-192-cfb1":{cipher:`AES`,key:192,iv:16,mode:`CFB1`,type:`stream`},"aes-256-cfb1":{cipher:`AES`,key:256,iv:16,mode:`CFB1`,type:`stream`},"aes-128-ofb":{cipher:`AES`,key:128,iv:16,mode:`OFB`,type:`stream`},"aes-192-ofb":{cipher:`AES`,key:192,iv:16,mode:`OFB`,type:`stream`},"aes-256-ofb":{cipher:`AES`,key:256,iv:16,mode:`OFB`,type:`stream`},"aes-128-ctr":{cipher:`AES`,key:128,iv:16,mode:`CTR`,type:`stream`},"aes-192-ctr":{cipher:`AES`,key:192,iv:16,mode:`CTR`,type:`stream`},"aes-256-ctr":{cipher:`AES`,key:256,iv:16,mode:`CTR`,type:`stream`},"aes-128-gcm":{cipher:`AES`,key:128,iv:12,mode:`GCM`,type:`auth`},"aes-192-gcm":{cipher:`AES`,key:192,iv:12,mode:`GCM`,type:`auth`},"aes-256-gcm":{cipher:`AES`,key:256,iv:12,mode:`GCM`,type:`auth`}}})),He=n(((e,t)=>{var n={ECB:Ne(),CBC:Fe(),CFB:Q(),CFB8:Ie(),CFB1:Le(),OFB:Re(),CTR:Be(),GCM:Be()},r=Ve();for(var i in r)r[i].module=n[r[i].mode];t.exports=r})),Ue=n(((e,t)=>{var n=c().Buffer;function r(e){n.isBuffer(e)||(e=n.from(e));for(var t=e.length/4|0,r=Array(t),i=0;i<t;i++)r[i]=e.readUInt32BE(i*4);return r}function i(e){for(var t=0;t<e.length;e++)e[t]=0}function a(e,t,n,r,i){for(var a=n[0],o=n[1],s=n[2],c=n[3],l=e[0]^t[0],u=e[1]^t[1],d=e[2]^t[2],f=e[3]^t[3],p,m,h,g,_=4,v=1;v<i;v++)p=a[l>>>24]^o[u>>>16&255]^s[d>>>8&255]^c[f&255]^t[_++],m=a[u>>>24]^o[d>>>16&255]^s[f>>>8&255]^c[l&255]^t[_++],h=a[d>>>24]^o[f>>>16&255]^s[l>>>8&255]^c[u&255]^t[_++],g=a[f>>>24]^o[l>>>16&255]^s[u>>>8&255]^c[d&255]^t[_++],l=p,u=m,d=h,f=g;return p=(r[l>>>24]<<24|r[u>>>16&255]<<16|r[d>>>8&255]<<8|r[f&255])^t[_++],m=(r[u>>>24]<<24|r[d>>>16&255]<<16|r[f>>>8&255]<<8|r[l&255])^t[_++],h=(r[d>>>24]<<24|r[f>>>16&255]<<16|r[l>>>8&255]<<8|r[u&255])^t[_++],g=(r[f>>>24]<<24|r[l>>>16&255]<<16|r[u>>>8&255]<<8|r[d&255])^t[_++],p>>>=0,m>>>=0,h>>>=0,g>>>=0,[p,m,h,g]}var o=[0,1,2,4,8,16,32,64,128,27,54],s=(function(){for(var e=Array(256),t=0;t<256;t++)t<128?e[t]=t<<1:e[t]=t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],a=[[],[],[],[]],o=0,s=0,c=0;c<256;++c){var l=s^s<<1^s<<2^s<<3^s<<4;l=l>>>8^l&255^99,n[o]=l,r[l]=o;var u=e[o],d=e[u],f=e[d],p=e[l]*257^l*16843008;i[0][o]=p<<24|p>>>8,i[1][o]=p<<16|p>>>16,i[2][o]=p<<8|p>>>24,i[3][o]=p,p=f*16843009^d*65537^u*257^o*16843008,a[0][l]=p<<24|p>>>8,a[1][l]=p<<16|p>>>16,a[2][l]=p<<8|p>>>24,a[3][l]=p,o===0?o=s=1:(o=u^e[e[e[f^u]]],s^=e[e[s]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:a}})();function l(e){this._key=r(e),this._reset()}l.blockSize=16,l.keySize=256/8,l.prototype.blockSize=l.blockSize,l.prototype.keySize=l.keySize,l.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=(n+1)*4,i=[],a=0;a<t;a++)i[a]=e[a];for(a=t;a<r;a++){var c=i[a-1];a%t===0?(c=c<<8|c>>>24,c=s.SBOX[c>>>24]<<24|s.SBOX[c>>>16&255]<<16|s.SBOX[c>>>8&255]<<8|s.SBOX[c&255],c^=o[a/t|0]<<24):t>6&&a%t===4&&(c=s.SBOX[c>>>24]<<24|s.SBOX[c>>>16&255]<<16|s.SBOX[c>>>8&255]<<8|s.SBOX[c&255]),i[a]=i[a-t]^c}for(var l=[],u=0;u<r;u++){var d=r-u,f=i[d-(u%4?0:4)];u<4||d<=4?l[u]=f:l[u]=s.INV_SUB_MIX[0][s.SBOX[f>>>24]]^s.INV_SUB_MIX[1][s.SBOX[f>>>16&255]]^s.INV_SUB_MIX[2][s.SBOX[f>>>8&255]]^s.INV_SUB_MIX[3][s.SBOX[f&255]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=l},l.prototype.encryptBlockRaw=function(e){return e=r(e),a(e,this._keySchedule,s.SUB_MIX,s.SBOX,this._nRounds)},l.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=n.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},l.prototype.decryptBlock=function(e){e=r(e);var t=e[1];e[1]=e[3],e[3]=t;var i=a(e,this._invKeySchedule,s.INV_SUB_MIX,s.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(i[0],0),o.writeUInt32BE(i[3],4),o.writeUInt32BE(i[2],8),o.writeUInt32BE(i[1],12),o},l.prototype.scrub=function(){i(this._keySchedule),i(this._invKeySchedule),i(this._key)},t.exports.AES=l})),We=n(((e,t)=>{var n=c().Buffer,r=n.alloc(16,0);function i(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)]}function a(e){var t=n.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}o.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},o.prototype._multiply=function(){for(var e=i(this.h),t=[0,0,0,0],n,r,o,s=-1;++s<128;){for(r=(this.state[~~(s/8)]&1<<7-s%8)!=0,r&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),o=(e[3]&1)!=0,n=3;n>0;n--)e[n]=e[n]>>>1|(e[n-1]&1)<<31;e[0]>>>=1,o&&(e[0]^=225<<24)}this.state=a(t)},o.prototype.update=function(e){this.cache=n.concat([this.cache,e]);for(var t;this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,r],16)),this.ghash(a([0,e,0,t])),this.state},t.exports=o})),Ge=n(((e,t)=>{var n=Ue(),r=c().Buffer,i=Y(),a=p(),o=We(),s=Pe(),l=ze();function u(e,t){var n=0;e.length!==t.length&&n++;for(var r=Math.min(e.length,t.length),i=0;i<r;++i)n+=e[i]^t[i];return n}function d(e,t,n){if(t.length===12)return e._finID=r.concat([t,r.from([0,0,0,1])]),r.concat([t,r.from([0,0,0,2])]);var i=new o(n),a=t.length,s=a%16;i.update(t),s&&(s=16-s,i.update(r.alloc(s,0))),i.update(r.alloc(8,0));var c=a*8,u=r.alloc(8);u.writeUIntBE(c,0,8),i.update(u),e._finID=i.state;var d=r.from(e._finID);return l(d),d}function f(e,t,a,s){i.call(this);var c=r.alloc(4,0);this._cipher=new n.AES(t);var l=this._cipher.encryptBlock(c);this._ghash=new o(l),a=d(this,a,l),this._prev=r.from(a),this._cache=r.allocUnsafe(0),this._secCache=r.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}a(f,i),f.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=r.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},f.prototype._final=function(){if(this._decrypt&&!this._authTag)throw Error(`Unsupported state or unable to authenticate data`);var e=s(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&u(e,this._authTag))throw Error(`Unsupported state or unable to authenticate data`);this._authTag=e,this._cipher.scrub()},f.prototype.getAuthTag=function(){if(this._decrypt||!r.isBuffer(this._authTag))throw Error(`Attempting to get auth tag in unsupported state`);return this._authTag},f.prototype.setAuthTag=function(e){if(!this._decrypt)throw Error(`Attempting to set auth tag in unsupported state`);this._authTag=e},f.prototype.setAAD=function(e){if(this._called)throw Error(`Attempting to set AAD in unsupported state`);this._ghash.update(e),this._alen+=e.length},t.exports=f})),Ke=n(((e,t)=>{var n=Ue(),r=c().Buffer,i=Y(),a=p();function o(e,t,a,o){i.call(this),this._cipher=new n.AES(t),this._prev=r.from(a),this._cache=r.allocUnsafe(0),this._secCache=r.allocUnsafe(0),this._decrypt=o,this._mode=e}a(o,i),o.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},o.prototype._final=function(){this._cipher.scrub()},t.exports=o})),qe=n(((e,t)=>{var n=c().Buffer,r=ne();function i(e,t,i,a){if(n.isBuffer(e)||(e=n.from(e,`binary`)),t&&(n.isBuffer(t)||(t=n.from(t,`binary`)),t.length!==8))throw RangeError(`salt should be Buffer with 8 byte length`);for(var o=i/8,s=n.alloc(o),c=n.alloc(a||0),l=n.alloc(0);o>0||a>0;){var u=new r;u.update(l),u.update(e),t&&u.update(t),l=u.digest();var d=0;if(o>0){var f=s.length-o;d=Math.min(o,l.length),l.copy(s,f,0,d),o-=d}if(d<l.length&&a>0){var p=c.length-a,m=Math.min(a,l.length-d);l.copy(c,p,d,d+m),a-=m}}return l.fill(0),{key:s,iv:c}}t.exports=i})),Je=n((e=>{var t=He(),n=Ge(),r=c().Buffer,i=Ke(),a=Y(),o=Ue(),s=qe(),l=p();function u(e,t,n){a.call(this),this._cache=new f,this._cipher=new o.AES(t),this._prev=r.from(n),this._mode=e,this._autopadding=!0}l(u,a),u.prototype._update=function(e){this._cache.add(e);for(var t,n,i=[];t=this._cache.get();)n=this._mode.encrypt(this,t),i.push(n);return r.concat(i)};var d=r.alloc(16,16);u.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(d))throw this._cipher.scrub(),Error(`data not multiple of block length`)},u.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function f(){this.cache=r.allocUnsafe(0)}f.prototype.add=function(e){this.cache=r.concat([this.cache,e])},f.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},f.prototype.flush=function(){for(var e=16-this.cache.length,t=r.allocUnsafe(e),n=-1;++n<e;)t.writeUInt8(e,n);return r.concat([this.cache,t])};function m(e,a,o){var s=t[e.toLowerCase()];if(!s)throw TypeError(`invalid suite type`);if(typeof a==`string`&&(a=r.from(a)),a.length!==s.key/8)throw TypeError(`invalid key length `+a.length);if(typeof o==`string`&&(o=r.from(o)),s.mode!==`GCM`&&o.length!==s.iv)throw TypeError(`invalid iv length `+o.length);return s.type===`stream`?new i(s.module,a,o):s.type===`auth`?new n(s.module,a,o):new u(s.module,a,o)}function h(e,n){var r=t[e.toLowerCase()];if(!r)throw TypeError(`invalid suite type`);var i=s(n,!1,r.key,r.iv);return m(e,i.key,i.iv)}e.createCipheriv=m,e.createCipher=h})),Ye=n((e=>{var t=Ge(),n=c().Buffer,r=He(),i=Ke(),a=Y(),o=Ue(),s=qe(),l=p();function u(e,t,r){a.call(this),this._cache=new d,this._last=void 0,this._cipher=new o.AES(t),this._prev=n.from(r),this._mode=e,this._autopadding=!0}l(u,a),u.prototype._update=function(e){this._cache.add(e);for(var t,r,i=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),i.push(r);return n.concat(i)},u.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return f(this._mode.decrypt(this,e));if(e)throw Error(`data not multiple of block length`)},u.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function d(){this.cache=n.allocUnsafe(0)}d.prototype.add=function(e){this.cache=n.concat([this.cache,e])},d.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},d.prototype.flush=function(){if(this.cache.length)return this.cache};function f(e){var t=e[15];if(t<1||t>16)throw Error(`unable to decrypt data`);for(var n=-1;++n<t;)if(e[n+(16-t)]!==t)throw Error(`unable to decrypt data`);if(t!==16)return e.slice(0,16-t)}function m(e,a,o){var s=r[e.toLowerCase()];if(!s)throw TypeError(`invalid suite type`);if(typeof o==`string`&&(o=n.from(o)),s.mode!==`GCM`&&o.length!==s.iv)throw TypeError(`invalid iv length `+o.length);if(typeof a==`string`&&(a=n.from(a)),a.length!==s.key/8)throw TypeError(`invalid key length `+a.length);return s.type===`stream`?new i(s.module,a,o,!0):s.type===`auth`?new t(s.module,a,o,!0):new u(s.module,a,o)}function h(e,t){var n=r[e.toLowerCase()];if(!n)throw TypeError(`invalid suite type`);var i=s(t,!1,n.key,n.iv);return m(e,i.key,i.iv)}e.createDecipher=h,e.createDecipheriv=m})),Xe=n((e=>{var t=Je(),n=Ye(),r=Ve();function i(){return Object.keys(r)}e.createCipher=e.Cipher=t.createCipher,e.createCipheriv=e.Cipheriv=t.createCipheriv,e.createDecipher=e.Decipher=n.createDecipher,e.createDecipheriv=e.Decipheriv=n.createDecipheriv,e.listCiphers=e.getCiphers=i})),Ze=n((e=>{e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}})),Qe=n((e=>{var t=Me(),n=Xe(),r=He(),i=Ze(),a=qe();function o(e,t){e=e.toLowerCase();var n,o;if(r[e])n=r[e].key,o=r[e].iv;else if(i[e])n=i[e].key*8,o=i[e].iv;else throw TypeError(`invalid suite type`);var s=a(t,!1,n,o);return c(e,s.key,s.iv)}function s(e,t){e=e.toLowerCase();var n,o;if(r[e])n=r[e].key,o=r[e].iv;else if(i[e])n=i[e].key*8,o=i[e].iv;else throw TypeError(`invalid suite type`);var s=a(t,!1,n,o);return l(e,s.key,s.iv)}function c(e,a,o){if(e=e.toLowerCase(),r[e])return n.createCipheriv(e,a,o);if(i[e])return new t({key:a,iv:o,mode:e});throw TypeError(`invalid suite type`)}function l(e,a,o){if(e=e.toLowerCase(),r[e])return n.createDecipheriv(e,a,o);if(i[e])return new t({key:a,iv:o,mode:e,decrypt:!0});throw TypeError(`invalid suite type`)}function u(){return Object.keys(i).concat(n.getCiphers())}e.createCipher=e.Cipher=o,e.createCipheriv=e.Cipheriv=c,e.createDecipher=e.Decipher=s,e.createDecipheriv=e.Decipheriv=l,e.listCiphers=e.getCiphers=u})),$e=n((()=>{})),et=n(((e,t)=>{(function(e,t){function n(e,t){if(!e)throw Error(t||`Assertion failed`)}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,e!==null&&((t===`le`||t===`be`)&&(n=t,t=10),this._init(e||0,t||10,n||`be`))}typeof e==`object`?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var a;try{a=typeof window<`u`&&window.Buffer!==void 0?window.Buffer:$e().Buffer}catch{}i.isBN=function(e){return e instanceof i||typeof e==`object`&&!!e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if(typeof e==`number`)return this._initNumber(e,t,r);if(typeof e==`object`)return this._initArray(e,t,r);t===`hex`&&(t=16),n(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,``);var i=0;e[0]===`-`&&(i++,this.negative=1),i<e.length&&(t===16?this._parseHex(e,i,r):(this._parseBase(e,t,i),r===`le`&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),r===`le`&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n(typeof e.length==`number`),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if(r===`be`)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);else if(r===`le`)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);return this.strip()};function o(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function s(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i=0,a=0,o;if(n===`be`)for(r=e.length-1;r>=t;r-=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this.strip()};function c(e,t,n,r){for(var i=0,a=Math.min(e.length,n),o=t;o<a;o++){var s=e.charCodeAt(o)-48;i*=r,s>=49?i+=s-49+10:s>=17?i+=s-17+10:i+=s}return i}i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var a=e.length-n,o=a%r,s=Math.min(a,a-o)+n,l=0,u=n;u<s;u+=r)l=c(e,u,u+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(o!==0){var d=1;for(l=c(e,u,e.length,t),u=0;u<o;u++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this.strip()},i.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?`<BN-R: `:`<BN: `)+this.toString(16)+`>`};var l=`.0.00.000.0000.00000.000000.0000000.00000000.000000000.0000000000.00000000000.000000000000.0000000000000.00000000000000.000000000000000.0000000000000000.00000000000000000.000000000000000000.0000000000000000000.00000000000000000000.000000000000000000000.0000000000000000000000.00000000000000000000000.000000000000000000000000.0000000000000000000000000`.split(`.`),u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){e||=10,t=t|0||1;var r;if(e===16||e===`hex`){r=``;for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],c=((s<<i|a)&16777215).toString(16);a=s>>>24-i&16777215,i+=2,i>=26&&(i-=26,o--),r=a!==0||o!==this.length-1?l[6-c.length]+c+r:c+r}for(a!==0&&(r=a.toString(16)+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}if(e===(e|0)&&e>=2&&e<=36){var f=u[e],p=d[e];r=``;var m=this.clone();for(m.negative=0;!m.isZero();){var h=m.modn(p).toString(e);m=m.idivn(p),r=m.isZero()?h+r:l[f-h.length]+h+r}for(this.isZero()&&(r=`0`+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}n(!1,`Base should be between 2 and 36`)},i.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,`Number can only safely store up to 53 bits`),this.negative===0?e:-e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(a!==void 0),this.toArrayLike(a,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,`byte array longer than desired length`),n(a>0,`Requested array length <= 0`),this.strip();var o=t===`le`,s=new e(a),c,l,u=this.clone();if(o){for(l=0;!u.isZero();l++)c=u.andln(255),u.iushrn(8),s[l]=c;for(;l<a;l++)s[l]=0}else{for(l=0;l<a-i;l++)s[l]=0;for(l=0;!u.isZero();l++)c=u.andln(255),u.iushrn(8),s[a-l-1]=c}return s},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,n=0;return t&8191||(n+=13,t>>>=13),t&127||(n+=7,t>>>=7),t&15||(n+=4,t>>>=4),t&3||(n+=2,t>>>=2),t&1||n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function f(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,n!==26)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return this.negative===0?this.clone():this.abs().inotn(e).iaddn(1)},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},i.prototype.ior=function(e){return n((this.negative|e.negative)===0),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){for(var t=this.length>e.length?e:this,n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this.strip()},i.prototype.iand=function(e){return n((this.negative|e.negative)===0),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},i.prototype.ixor=function(e){return n((this.negative|e.negative)===0),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n(typeof e==`number`&&e>=0);var t=Math.ceil(e/26)|0,r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=~this.words[i]&67108863;return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n(typeof e==`number`&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<i:this.words[r]=this.words[r]&~(1<<i),this.strip()},i.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var n,r;this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(n.words[a]|0)+(r.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;for(;i!==0&&a<n.length;a++)t=(n.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;if(this.length=n.length,i!==0)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},i.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var r,i;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)t=(r.words[o]|0)-(i.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;for(;a!==0&&o<r.length;o++)t=(r.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;if(a===0&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(e){return this.clone().isub(e)};function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=e.words[0]|0,a=t.words[0]|0,o=i*a,s=o&67108863,c=o/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var u=c>>>26,d=c&67108863,f=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=f;p++){var m=l-p|0;i=e.words[m]|0,a=t.words[p]|0,o=i*a+d,u+=o/67108864|0,d=o&67108863}n.words[l]=d|0,c=u|0}return c===0?n.length--:n.words[l]=c|0,n.strip()}var m=function(e,t,n){var r=e.words,i=t.words,a=n.words,o=0,s,c,l,u=r[0]|0,d=u&8191,f=u>>>13,p=r[1]|0,m=p&8191,h=p>>>13,g=r[2]|0,_=g&8191,v=g>>>13,y=r[3]|0,b=y&8191,x=y>>>13,S=r[4]|0,C=S&8191,w=S>>>13,T=r[5]|0,E=T&8191,D=T>>>13,O=r[6]|0,k=O&8191,A=O>>>13,ee=r[7]|0,j=ee&8191,M=ee>>>13,te=r[8]|0,N=te&8191,P=te>>>13,ne=r[9]|0,F=ne&8191,I=ne>>>13,re=i[0]|0,L=re&8191,R=re>>>13,ie=i[1]|0,z=ie&8191,B=ie>>>13,ae=i[2]|0,V=ae&8191,H=ae>>>13,oe=i[3]|0,se=oe&8191,U=oe>>>13,ce=i[4]|0,W=ce&8191,G=ce>>>13,le=i[5]|0,K=le&8191,q=le>>>13,ue=i[6]|0,J=ue&8191,de=ue>>>13,fe=i[7]|0,pe=fe&8191,me=fe>>>13,Y=i[8]|0,X=Y&8191,Z=Y>>>13,he=i[9]|0,ge=he&8191,_e=he>>>13;n.negative=e.negative^t.negative,n.length=19,s=Math.imul(d,L),c=Math.imul(d,R),c=c+Math.imul(f,L)|0,l=Math.imul(f,R);var ve=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ve>>>26)|0,ve&=67108863,s=Math.imul(m,L),c=Math.imul(m,R),c=c+Math.imul(h,L)|0,l=Math.imul(h,R),s=s+Math.imul(d,z)|0,c=c+Math.imul(d,B)|0,c=c+Math.imul(f,z)|0,l=l+Math.imul(f,B)|0;var ye=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ye>>>26)|0,ye&=67108863,s=Math.imul(_,L),c=Math.imul(_,R),c=c+Math.imul(v,L)|0,l=Math.imul(v,R),s=s+Math.imul(m,z)|0,c=c+Math.imul(m,B)|0,c=c+Math.imul(h,z)|0,l=l+Math.imul(h,B)|0,s=s+Math.imul(d,V)|0,c=c+Math.imul(d,H)|0,c=c+Math.imul(f,V)|0,l=l+Math.imul(f,H)|0;var be=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(be>>>26)|0,be&=67108863,s=Math.imul(b,L),c=Math.imul(b,R),c=c+Math.imul(x,L)|0,l=Math.imul(x,R),s=s+Math.imul(_,z)|0,c=c+Math.imul(_,B)|0,c=c+Math.imul(v,z)|0,l=l+Math.imul(v,B)|0,s=s+Math.imul(m,V)|0,c=c+Math.imul(m,H)|0,c=c+Math.imul(h,V)|0,l=l+Math.imul(h,H)|0,s=s+Math.imul(d,se)|0,c=c+Math.imul(d,U)|0,c=c+Math.imul(f,se)|0,l=l+Math.imul(f,U)|0;var xe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(xe>>>26)|0,xe&=67108863,s=Math.imul(C,L),c=Math.imul(C,R),c=c+Math.imul(w,L)|0,l=Math.imul(w,R),s=s+Math.imul(b,z)|0,c=c+Math.imul(b,B)|0,c=c+Math.imul(x,z)|0,l=l+Math.imul(x,B)|0,s=s+Math.imul(_,V)|0,c=c+Math.imul(_,H)|0,c=c+Math.imul(v,V)|0,l=l+Math.imul(v,H)|0,s=s+Math.imul(m,se)|0,c=c+Math.imul(m,U)|0,c=c+Math.imul(h,se)|0,l=l+Math.imul(h,U)|0,s=s+Math.imul(d,W)|0,c=c+Math.imul(d,G)|0,c=c+Math.imul(f,W)|0,l=l+Math.imul(f,G)|0;var Se=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Se>>>26)|0,Se&=67108863,s=Math.imul(E,L),c=Math.imul(E,R),c=c+Math.imul(D,L)|0,l=Math.imul(D,R),s=s+Math.imul(C,z)|0,c=c+Math.imul(C,B)|0,c=c+Math.imul(w,z)|0,l=l+Math.imul(w,B)|0,s=s+Math.imul(b,V)|0,c=c+Math.imul(b,H)|0,c=c+Math.imul(x,V)|0,l=l+Math.imul(x,H)|0,s=s+Math.imul(_,se)|0,c=c+Math.imul(_,U)|0,c=c+Math.imul(v,se)|0,l=l+Math.imul(v,U)|0,s=s+Math.imul(m,W)|0,c=c+Math.imul(m,G)|0,c=c+Math.imul(h,W)|0,l=l+Math.imul(h,G)|0,s=s+Math.imul(d,K)|0,c=c+Math.imul(d,q)|0,c=c+Math.imul(f,K)|0,l=l+Math.imul(f,q)|0;var Ce=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,s=Math.imul(k,L),c=Math.imul(k,R),c=c+Math.imul(A,L)|0,l=Math.imul(A,R),s=s+Math.imul(E,z)|0,c=c+Math.imul(E,B)|0,c=c+Math.imul(D,z)|0,l=l+Math.imul(D,B)|0,s=s+Math.imul(C,V)|0,c=c+Math.imul(C,H)|0,c=c+Math.imul(w,V)|0,l=l+Math.imul(w,H)|0,s=s+Math.imul(b,se)|0,c=c+Math.imul(b,U)|0,c=c+Math.imul(x,se)|0,l=l+Math.imul(x,U)|0,s=s+Math.imul(_,W)|0,c=c+Math.imul(_,G)|0,c=c+Math.imul(v,W)|0,l=l+Math.imul(v,G)|0,s=s+Math.imul(m,K)|0,c=c+Math.imul(m,q)|0,c=c+Math.imul(h,K)|0,l=l+Math.imul(h,q)|0,s=s+Math.imul(d,J)|0,c=c+Math.imul(d,de)|0,c=c+Math.imul(f,J)|0,l=l+Math.imul(f,de)|0;var we=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(we>>>26)|0,we&=67108863,s=Math.imul(j,L),c=Math.imul(j,R),c=c+Math.imul(M,L)|0,l=Math.imul(M,R),s=s+Math.imul(k,z)|0,c=c+Math.imul(k,B)|0,c=c+Math.imul(A,z)|0,l=l+Math.imul(A,B)|0,s=s+Math.imul(E,V)|0,c=c+Math.imul(E,H)|0,c=c+Math.imul(D,V)|0,l=l+Math.imul(D,H)|0,s=s+Math.imul(C,se)|0,c=c+Math.imul(C,U)|0,c=c+Math.imul(w,se)|0,l=l+Math.imul(w,U)|0,s=s+Math.imul(b,W)|0,c=c+Math.imul(b,G)|0,c=c+Math.imul(x,W)|0,l=l+Math.imul(x,G)|0,s=s+Math.imul(_,K)|0,c=c+Math.imul(_,q)|0,c=c+Math.imul(v,K)|0,l=l+Math.imul(v,q)|0,s=s+Math.imul(m,J)|0,c=c+Math.imul(m,de)|0,c=c+Math.imul(h,J)|0,l=l+Math.imul(h,de)|0,s=s+Math.imul(d,pe)|0,c=c+Math.imul(d,me)|0,c=c+Math.imul(f,pe)|0,l=l+Math.imul(f,me)|0;var Te=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,s=Math.imul(N,L),c=Math.imul(N,R),c=c+Math.imul(P,L)|0,l=Math.imul(P,R),s=s+Math.imul(j,z)|0,c=c+Math.imul(j,B)|0,c=c+Math.imul(M,z)|0,l=l+Math.imul(M,B)|0,s=s+Math.imul(k,V)|0,c=c+Math.imul(k,H)|0,c=c+Math.imul(A,V)|0,l=l+Math.imul(A,H)|0,s=s+Math.imul(E,se)|0,c=c+Math.imul(E,U)|0,c=c+Math.imul(D,se)|0,l=l+Math.imul(D,U)|0,s=s+Math.imul(C,W)|0,c=c+Math.imul(C,G)|0,c=c+Math.imul(w,W)|0,l=l+Math.imul(w,G)|0,s=s+Math.imul(b,K)|0,c=c+Math.imul(b,q)|0,c=c+Math.imul(x,K)|0,l=l+Math.imul(x,q)|0,s=s+Math.imul(_,J)|0,c=c+Math.imul(_,de)|0,c=c+Math.imul(v,J)|0,l=l+Math.imul(v,de)|0,s=s+Math.imul(m,pe)|0,c=c+Math.imul(m,me)|0,c=c+Math.imul(h,pe)|0,l=l+Math.imul(h,me)|0,s=s+Math.imul(d,X)|0,c=c+Math.imul(d,Z)|0,c=c+Math.imul(f,X)|0,l=l+Math.imul(f,Z)|0;var Ee=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,s=Math.imul(F,L),c=Math.imul(F,R),c=c+Math.imul(I,L)|0,l=Math.imul(I,R),s=s+Math.imul(N,z)|0,c=c+Math.imul(N,B)|0,c=c+Math.imul(P,z)|0,l=l+Math.imul(P,B)|0,s=s+Math.imul(j,V)|0,c=c+Math.imul(j,H)|0,c=c+Math.imul(M,V)|0,l=l+Math.imul(M,H)|0,s=s+Math.imul(k,se)|0,c=c+Math.imul(k,U)|0,c=c+Math.imul(A,se)|0,l=l+Math.imul(A,U)|0,s=s+Math.imul(E,W)|0,c=c+Math.imul(E,G)|0,c=c+Math.imul(D,W)|0,l=l+Math.imul(D,G)|0,s=s+Math.imul(C,K)|0,c=c+Math.imul(C,q)|0,c=c+Math.imul(w,K)|0,l=l+Math.imul(w,q)|0,s=s+Math.imul(b,J)|0,c=c+Math.imul(b,de)|0,c=c+Math.imul(x,J)|0,l=l+Math.imul(x,de)|0,s=s+Math.imul(_,pe)|0,c=c+Math.imul(_,me)|0,c=c+Math.imul(v,pe)|0,l=l+Math.imul(v,me)|0,s=s+Math.imul(m,X)|0,c=c+Math.imul(m,Z)|0,c=c+Math.imul(h,X)|0,l=l+Math.imul(h,Z)|0,s=s+Math.imul(d,ge)|0,c=c+Math.imul(d,_e)|0,c=c+Math.imul(f,ge)|0,l=l+Math.imul(f,_e)|0;var De=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(De>>>26)|0,De&=67108863,s=Math.imul(F,z),c=Math.imul(F,B),c=c+Math.imul(I,z)|0,l=Math.imul(I,B),s=s+Math.imul(N,V)|0,c=c+Math.imul(N,H)|0,c=c+Math.imul(P,V)|0,l=l+Math.imul(P,H)|0,s=s+Math.imul(j,se)|0,c=c+Math.imul(j,U)|0,c=c+Math.imul(M,se)|0,l=l+Math.imul(M,U)|0,s=s+Math.imul(k,W)|0,c=c+Math.imul(k,G)|0,c=c+Math.imul(A,W)|0,l=l+Math.imul(A,G)|0,s=s+Math.imul(E,K)|0,c=c+Math.imul(E,q)|0,c=c+Math.imul(D,K)|0,l=l+Math.imul(D,q)|0,s=s+Math.imul(C,J)|0,c=c+Math.imul(C,de)|0,c=c+Math.imul(w,J)|0,l=l+Math.imul(w,de)|0,s=s+Math.imul(b,pe)|0,c=c+Math.imul(b,me)|0,c=c+Math.imul(x,pe)|0,l=l+Math.imul(x,me)|0,s=s+Math.imul(_,X)|0,c=c+Math.imul(_,Z)|0,c=c+Math.imul(v,X)|0,l=l+Math.imul(v,Z)|0,s=s+Math.imul(m,ge)|0,c=c+Math.imul(m,_e)|0,c=c+Math.imul(h,ge)|0,l=l+Math.imul(h,_e)|0;var Oe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,s=Math.imul(F,V),c=Math.imul(F,H),c=c+Math.imul(I,V)|0,l=Math.imul(I,H),s=s+Math.imul(N,se)|0,c=c+Math.imul(N,U)|0,c=c+Math.imul(P,se)|0,l=l+Math.imul(P,U)|0,s=s+Math.imul(j,W)|0,c=c+Math.imul(j,G)|0,c=c+Math.imul(M,W)|0,l=l+Math.imul(M,G)|0,s=s+Math.imul(k,K)|0,c=c+Math.imul(k,q)|0,c=c+Math.imul(A,K)|0,l=l+Math.imul(A,q)|0,s=s+Math.imul(E,J)|0,c=c+Math.imul(E,de)|0,c=c+Math.imul(D,J)|0,l=l+Math.imul(D,de)|0,s=s+Math.imul(C,pe)|0,c=c+Math.imul(C,me)|0,c=c+Math.imul(w,pe)|0,l=l+Math.imul(w,me)|0,s=s+Math.imul(b,X)|0,c=c+Math.imul(b,Z)|0,c=c+Math.imul(x,X)|0,l=l+Math.imul(x,Z)|0,s=s+Math.imul(_,ge)|0,c=c+Math.imul(_,_e)|0,c=c+Math.imul(v,ge)|0,l=l+Math.imul(v,_e)|0;var ke=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ke>>>26)|0,ke&=67108863,s=Math.imul(F,se),c=Math.imul(F,U),c=c+Math.imul(I,se)|0,l=Math.imul(I,U),s=s+Math.imul(N,W)|0,c=c+Math.imul(N,G)|0,c=c+Math.imul(P,W)|0,l=l+Math.imul(P,G)|0,s=s+Math.imul(j,K)|0,c=c+Math.imul(j,q)|0,c=c+Math.imul(M,K)|0,l=l+Math.imul(M,q)|0,s=s+Math.imul(k,J)|0,c=c+Math.imul(k,de)|0,c=c+Math.imul(A,J)|0,l=l+Math.imul(A,de)|0,s=s+Math.imul(E,pe)|0,c=c+Math.imul(E,me)|0,c=c+Math.imul(D,pe)|0,l=l+Math.imul(D,me)|0,s=s+Math.imul(C,X)|0,c=c+Math.imul(C,Z)|0,c=c+Math.imul(w,X)|0,l=l+Math.imul(w,Z)|0,s=s+Math.imul(b,ge)|0,c=c+Math.imul(b,_e)|0,c=c+Math.imul(x,ge)|0,l=l+Math.imul(x,_e)|0;var Ae=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,s=Math.imul(F,W),c=Math.imul(F,G),c=c+Math.imul(I,W)|0,l=Math.imul(I,G),s=s+Math.imul(N,K)|0,c=c+Math.imul(N,q)|0,c=c+Math.imul(P,K)|0,l=l+Math.imul(P,q)|0,s=s+Math.imul(j,J)|0,c=c+Math.imul(j,de)|0,c=c+Math.imul(M,J)|0,l=l+Math.imul(M,de)|0,s=s+Math.imul(k,pe)|0,c=c+Math.imul(k,me)|0,c=c+Math.imul(A,pe)|0,l=l+Math.imul(A,me)|0,s=s+Math.imul(E,X)|0,c=c+Math.imul(E,Z)|0,c=c+Math.imul(D,X)|0,l=l+Math.imul(D,Z)|0,s=s+Math.imul(C,ge)|0,c=c+Math.imul(C,_e)|0,c=c+Math.imul(w,ge)|0,l=l+Math.imul(w,_e)|0;var je=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(je>>>26)|0,je&=67108863,s=Math.imul(F,K),c=Math.imul(F,q),c=c+Math.imul(I,K)|0,l=Math.imul(I,q),s=s+Math.imul(N,J)|0,c=c+Math.imul(N,de)|0,c=c+Math.imul(P,J)|0,l=l+Math.imul(P,de)|0,s=s+Math.imul(j,pe)|0,c=c+Math.imul(j,me)|0,c=c+Math.imul(M,pe)|0,l=l+Math.imul(M,me)|0,s=s+Math.imul(k,X)|0,c=c+Math.imul(k,Z)|0,c=c+Math.imul(A,X)|0,l=l+Math.imul(A,Z)|0,s=s+Math.imul(E,ge)|0,c=c+Math.imul(E,_e)|0,c=c+Math.imul(D,ge)|0,l=l+Math.imul(D,_e)|0;var Me=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Me>>>26)|0,Me&=67108863,s=Math.imul(F,J),c=Math.imul(F,de),c=c+Math.imul(I,J)|0,l=Math.imul(I,de),s=s+Math.imul(N,pe)|0,c=c+Math.imul(N,me)|0,c=c+Math.imul(P,pe)|0,l=l+Math.imul(P,me)|0,s=s+Math.imul(j,X)|0,c=c+Math.imul(j,Z)|0,c=c+Math.imul(M,X)|0,l=l+Math.imul(M,Z)|0,s=s+Math.imul(k,ge)|0,c=c+Math.imul(k,_e)|0,c=c+Math.imul(A,ge)|0,l=l+Math.imul(A,_e)|0;var Ne=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s=Math.imul(F,pe),c=Math.imul(F,me),c=c+Math.imul(I,pe)|0,l=Math.imul(I,me),s=s+Math.imul(N,X)|0,c=c+Math.imul(N,Z)|0,c=c+Math.imul(P,X)|0,l=l+Math.imul(P,Z)|0,s=s+Math.imul(j,ge)|0,c=c+Math.imul(j,_e)|0,c=c+Math.imul(M,ge)|0,l=l+Math.imul(M,_e)|0;var Pe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,s=Math.imul(F,X),c=Math.imul(F,Z),c=c+Math.imul(I,X)|0,l=Math.imul(I,Z),s=s+Math.imul(N,ge)|0,c=c+Math.imul(N,_e)|0,c=c+Math.imul(P,ge)|0,l=l+Math.imul(P,_e)|0;var Fe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,s=Math.imul(F,ge),c=Math.imul(F,_e),c=c+Math.imul(I,ge)|0,l=Math.imul(I,_e);var Q=(o+s|0)+((c&8191)<<13)|0;return o=(l+(c>>>13)|0)+(Q>>>26)|0,Q&=67108863,a[0]=ve,a[1]=ye,a[2]=be,a[3]=xe,a[4]=Se,a[5]=Ce,a[6]=we,a[7]=Te,a[8]=Ee,a[9]=De,a[10]=Oe,a[11]=ke,a[12]=Ae,a[13]=je,a[14]=Me,a[15]=Ne,a[16]=Pe,a[17]=Fe,a[18]=Q,o!==0&&(a[19]=o,n.length++),n};Math.imul||(m=p);function h(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,a=0;a<n.length-1;a++){var o=i;i=0;for(var s=r&67108863,c=Math.min(a,t.length-1),l=Math.max(0,a-e.length+1);l<=c;l++){var u=a-l,d=(e.words[u]|0)*(t.words[l]|0),f=d&67108863;o=o+(d/67108864|0)|0,f=f+s|0,s=f&67108863,o=o+(f>>>26)|0,i+=o>>>26,o&=67108863}n.words[a]=s,r=o,o=i}return r===0?n.length--:n.words[a]=r,n.strip()}function g(e,t,n){return new _().mulp(e,t,n)}i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=this.length===10&&e.length===10?m(this,e,t):r<63?p(this,e,t):r<1024?h(this,e,t):g(this,e,t),n};function _(e,t){this.x=e,this.y=t}_.prototype.makeRBT=function(e){for(var t=Array(e),n=i.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},_.prototype.revBin=function(e,t,n){if(e===0||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(e&1)<<t-i-1,e>>=1;return r},_.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},_.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,c=Math.cos(2*Math.PI/s),l=Math.sin(2*Math.PI/s),u=0;u<i;u+=s)for(var d=c,f=l,p=0;p<o;p++){var m=n[u+p],h=r[u+p],g=n[u+p+o],_=r[u+p+o],v=d*g-f*_;_=d*_+f*g,g=v,n[u+p]=m+g,r[u+p]=h+_,n[u+p+o]=m-g,r[u+p+o]=h-_,p!==s&&(v=c*d-l*f,f=c*f+l*d,d=v)}},_.prototype.guessLen13b=function(e,t){var n=Math.max(t,e)|1,r=n&1,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},_.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},_.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=Math.round(e[2*r+1]/t)*8192+Math.round(e[2*r]/t)+n;e[r]=i&67108863,n=i<67108864?0:i/67108864|0}return e},_.prototype.convert13b=function(e,t,r,i){for(var a=0,o=0;o<t;o++)a+=e[o]|0,r[2*o]=a&8191,a>>>=13,r[2*o+1]=a&8191,a>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(a===0),n((a&-8192)==0)},_.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},_.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),c=Array(r),l=Array(r),u=Array(r),d=Array(r),f=n.words;f.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,c,r,i),this.transform(l,a,u,d,r,i);for(var p=0;p<r;p++){var m=s[p]*u[p]-c[p]*d[p];c[p]=s[p]*d[p]+c[p]*u[p],s[p]=m}return this.conjugate(s,c,r),this.transform(s,c,f,a,r,i),this.conjugate(f,a,r),this.normalize13b(f,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){n(typeof e==`number`),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var i=(this.words[r]|0)*e,a=(i&67108863)+(t&67108863);t>>=26,t+=i/67108864|0,t+=a>>>26,this.words[r]=a&67108863}return t!==0&&(this.words[r]=t,this.length++),this.length=e===0?1:this.length,this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=f(e);if(t.length===0)return new i(1);for(var n=this,r=0;r<t.length&&t[r]===0;r++,n=n.sqr());if(++r<t.length)for(var a=n.sqr();r<t.length;r++,a=a.sqr())t[r]!==0&&(n=n.mul(a));return n},i.prototype.iushln=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=67108863>>>26-t<<26-t,a;if(t!==0){var o=0;for(a=0;a<this.length;a++){var s=this.words[a]&i,c=(this.words[a]|0)-s<<t;this.words[a]=c|o,o=s>>>26-t}o&&(this.words[a]=o,this.length++)}if(r!==0){for(a=this.length-1;a>=0;a--)this.words[a+r]=this.words[a];for(a=0;a<r;a++)this.words[a]=0;this.length+=r}return this.strip()},i.prototype.ishln=function(e){return n(this.negative===0),this.iushln(e)},i.prototype.iushrn=function(e,t,r){n(typeof e==`number`&&e>=0);var i=t?(t-t%26)/26:0,a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,c=r;if(i-=o,i=Math.max(0,i),c){for(var l=0;l<o;l++)c.words[l]=this.words[l];c.length=o}if(o!==0)if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var u=0;for(l=this.length-1;l>=0&&(u!==0||l>=i);l--){var d=this.words[l]|0;this.words[l]=u<<26-a|d>>>a,u=d&s}return c&&u!==0&&(c.words[c.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(this.negative===0),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return this.length<=r?!1:!!(this.words[r]&i)},i.prototype.imaskn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26;if(n(this.negative===0,`imaskn works only with positive numbers`),this.length<=r)return this;if(t!==0&&r++,this.length=Math.min(r,this.length),t!==0){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n(typeof e==`number`),n(e<67108864),e<0?this.isubn(-e):this.negative===0?this._iaddn(e):this.length===1&&(this.words[0]|0)<e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n(typeof e==`number`),n(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,--this.words[t+1];return this.strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i=e.length+r,a;this._expand(i);var o,s=0;for(a=0;a<e.length;a++){o=(this.words[a+r]|0)+s;var c=(e.words[a]|0)*t;o-=c&67108863,s=(o>>26)-(c/67108864|0),this.words[a+r]=o&67108863}for(;a<this.length-r;a++)o=(this.words[a+r]|0)+s,s=o>>26,this.words[a+r]=o&67108863;if(s===0)return this.strip();for(n(s===-1),s=0,a=0;a<this.length;a++)o=-(this.words[a]|0)+s,s=o>>26,this.words[a]=o&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=this.length-e.length,r=this.clone(),a=e,o=a.words[a.length-1]|0;n=26-this._countBits(o),n!==0&&(a=a.ushln(n),r.iushln(n),o=a.words[a.length-1]|0);var s=r.length-a.length,c;if(t!==`mod`){c=new i(null),c.length=s+1,c.words=Array(c.length);for(var l=0;l<c.length;l++)c.words[l]=0}var u=r.clone()._ishlnsubmul(a,1,s);u.negative===0&&(r=u,c&&(c.words[s]=1));for(var d=s-1;d>=0;d--){var f=(r.words[a.length+d]|0)*67108864+(r.words[a.length+d-1]|0);for(f=Math.min(f/o|0,67108863),r._ishlnsubmul(a,f,d);r.negative!==0;)f--,r.negative=0,r._ishlnsubmul(a,1,d),r.isZero()||(r.negative^=1);c&&(c.words[d]=f)}return c&&c.strip(),r.strip(),t!==`div`&&n!==0&&r.iushrn(n),{div:c||null,mod:r}},i.prototype.divmod=function(e,t,r){if(n(!e.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var a,o,s;return this.negative!==0&&e.negative===0?(s=this.neg().divmod(e,t),t!==`mod`&&(a=s.div.neg()),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.iadd(e)),{div:a,mod:o}):this.negative===0&&e.negative!==0?(s=this.divmod(e.neg(),t),t!==`mod`&&(a=s.div.neg()),{div:a,mod:s.mod}):(this.negative&e.negative)===0?e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:e.length===1?t===`div`?{div:this.divn(e.words[0]),mod:null}:t===`mod`?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.isub(e)),{div:s.div,mod:o})},i.prototype.div=function(e){return this.divmod(e,`div`,!1).div},i.prototype.mod=function(e){return this.divmod(e,`mod`,!1).mod},i.prototype.umod=function(e){return this.divmod(e,`mod`,!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=t.div.negative===0?t.mod:t.mod.isub(e),r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return a<0||i===1&&a===0?t.div:t.div.negative===0?t.div.iaddn(1):t.div.isubn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(this.words[i]|0))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(this.words[r]|0)+t*67108864;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=new i(0),c=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var u=r.clone(),d=t.clone();!t.isZero();){for(var f=0,p=1;(t.words[0]&p)===0&&f<26;++f,p<<=1);if(f>0)for(t.iushrn(f);f-->0;)(a.isOdd()||o.isOdd())&&(a.iadd(u),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var m=0,h=1;(r.words[0]&h)===0&&m<26;++m,h<<=1);if(m>0)for(r.iushrn(m);m-->0;)(s.isOdd()||c.isOdd())&&(s.iadd(u),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s),o.isub(c)):(r.isub(t),s.isub(a),c.isub(o))}return{a:s,b:c,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;(t.words[0]&l)===0&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-->0;)a.isOdd()&&a.iadd(s),a.iushrn(1);for(var u=0,d=1;(r.words[0]&d)===0&&u<26;++u,d<<=1);if(u>0)for(r.iushrn(u);u-->0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o)):(r.isub(t),o.isub(a))}var f=t.cmpn(1)===0?a:o;return f.cmpn(0)<0&&f.iadd(e),f},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var a=t;t=n,n=a}else if(i===0||n.cmpn(1)===0)break;t.isub(n)}while(!0);return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return(this.words[0]&1)==0},i.prototype.isOdd=function(){return(this.words[0]&1)==1},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n(typeof e==`number`);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;a!==0&&o<this.length;o++){var s=this.words[o]|0;s+=a,a=s>>>26,s&=67108863,this.words[o]=s}return a!==0&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this.strip();var r;if(this.length>1)r=1;else{t&&(e=-e),n(e<=67108863,`Number is too big`);var i=this.words[0]|0;r=i===e?0:i<e?-1:1}return this.negative===0?r:-r|0},i.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative===0?t:-t|0},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=this.words[n]|0,i=e.words[n]|0;if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return this.cmpn(e)===1},i.prototype.gt=function(e){return this.cmp(e)===1},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return this.cmpn(e)===-1},i.prototype.lt=function(e){return this.cmp(e)===-1},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return this.cmpn(e)===0},i.prototype.eq=function(e){return this.cmp(e)===0},i.red=function(e){return new w(e)},i.prototype.toRed=function(e){return n(!this.red,`Already a number in reduction context`),n(this.negative===0,`red works only with positives`),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,`fromRed works only with numbers in reduction context`),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,`Already a number in reduction context`),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,`redAdd works only with red numbers`),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,`redIAdd works only with red numbers`),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,`redSub works only with red numbers`),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,`redISub works only with red numbers`),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,`redShl works only with red numbers`),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,`redSqr works only with red numbers`),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,`redISqr works only with red numbers`),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,`redSqrt works only with red numbers`),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,`redInvm works only with red numbers`),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,`redNeg works only with red numbers`),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,`redPow(normalNum)`),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}y.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t=e,n;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),n=t.bitLength();while(n>this.n);var r=n<this.n?-1:t.ucmp(this.p);return r===0?(t.words[0]=0,t.length=1):r>0?t.isub(this.p):t.strip===void 0?t._strip():t.strip(),t},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)};function b(){y.call(this,`k256`,`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`)}r(b,y),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=e.words[i]|0;e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,a===0&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=e.words[n]|0;t+=r*977,e.words[n]=t&67108863,t=r*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function x(){y.call(this,`p224`,`ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001`)}r(x,y);function S(){y.call(this,`p192`,`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff`)}r(S,y);function C(){y.call(this,`25519`,`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`)}r(C,y),C.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=(e.words[n]|0)*19+t,i=r&67108863;r>>>=26,e.words[n]=i,t=r}return t!==0&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if(e===`k256`)t=new b;else if(e===`p224`)t=new x;else if(e===`p192`)t=new S;else if(e===`p25519`)t=new C;else throw Error(`Unknown prime `+e);return v[e]=t,t};function w(e){if(typeof e==`string`){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),`modulus must be greater than 1`),this.m=e,this.prime=null}w.prototype._verify1=function(e){n(e.negative===0,`red works only with positives`),n(e.red,`red works only with red numbers`)},w.prototype._verify2=function(e,t){n((e.negative|t.negative)===0,`red works only with positives`),n(e.red&&e.red===t.red,`red works only with red numbers`)},w.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},w.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},w.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},w.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},w.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},w.prototype.isqr=function(e){return this.imul(e,e.clone())},w.prototype.sqr=function(e){return this.mul(e,e)},w.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),t===3){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&a.andln(1)===0;)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),c=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,l).cmp(c)!==0;)u.redIAdd(c);for(var d=this.pow(u,a),f=this.pow(e,a.addn(1).iushrn(1)),p=this.pow(e,a),m=o;p.cmp(s)!==0;){for(var h=p,g=0;h.cmp(s)!==0;g++)h=h.redSqr();n(g<m);var _=this.pow(d,new i(1).iushln(m-g-1));f=f.redMul(_),d=_.redSqr(),p=p.redMul(d),m=g}return f},w.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative===0?this.imod(t):(t.negative=0,this.imod(t).redNeg())},w.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var n=4,r=Array(1<<n);r[0]=new i(1).toRed(this),r[1]=e;for(var a=2;a<r.length;a++)r[a]=this.mul(r[a-1],e);var o=r[0],s=0,c=0,l=t.bitLength()%26;for(l===0&&(l=26),a=t.length-1;a>=0;a--){for(var u=t.words[a],d=l-1;d>=0;d--){var f=u>>d&1;if(o!==r[0]&&(o=this.sqr(o)),f===0&&s===0){c=0;continue}s<<=1,s|=f,c++,!(c!==n&&(a!==0||d!==0))&&(o=this.mul(o,r[s]),c=0,s=0)}l=26}return o},w.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},w.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)};function T(e){w.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}r(T,w),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(r).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}})(t===void 0||t,e)})),tt=n(((e,t)=>{var n;t.exports=function(e){return n||=new r(null),n.generate(e)};function r(e){this.rand=e}if(t.exports.Rand=r,r.prototype.generate=function(e){return this._rand(e)},r.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},typeof self==`object`)self.crypto&&self.crypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window==`object`&&(r.prototype._rand=function(){throw Error(`Not implemented yet`)});else try{var i=Pn();if(typeof i.randomBytes!=`function`)throw Error(`Not supported`);r.prototype._rand=function(e){return i.randomBytes(e)}}catch{}})),nt=n(((e,t)=>{var n=et(),r=tt();function i(e){this.rand=e||new r.Rand}t.exports=i,i.create=function(e){return new i(e)},i.prototype._randbelow=function(e){var t=e.bitLength(),r=Math.ceil(t/8);do var i=new n(this.rand.generate(r));while(i.cmp(e)>=0);return i},i.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},i.prototype.test=function(e,t,r){var i=e.bitLength(),a=n.mont(e),o=new n(1).toRed(a);t||=Math.max(1,i/48|0);for(var s=e.subn(1),c=0;!s.testn(c);c++);for(var l=e.shrn(c),u=s.toRed(a),d=!0;t>0;t--){var f=this._randrange(new n(2),s);r&&r(f);var p=f.toRed(a).redPow(l);if(!(p.cmp(o)===0||p.cmp(u)===0)){for(var m=1;m<c;m++){if(p=p.redSqr(),p.cmp(o)===0)return!1;if(p.cmp(u)===0)break}if(m===c)return!1}}return d},i.prototype.getDivisor=function(e,t){var r=e.bitLength(),i=n.mont(e),a=new n(1).toRed(i);t||=Math.max(1,r/48|0);for(var o=e.subn(1),s=0;!o.testn(s);s++);for(var c=e.shrn(s),l=o.toRed(i);t>0;t--){var u=this._randrange(new n(2),o),d=e.gcd(u);if(d.cmpn(1)!==0)return d;var f=u.toRed(i).redPow(c);if(!(f.cmp(a)===0||f.cmp(l)===0)){for(var p=1;p<s;p++){if(f=f.redSqr(),f.cmp(a)===0)return f.fromRed().subn(1).gcd(e);if(f.cmp(l)===0)break}if(p===s)return f=f.redSqr(),f.fromRed().subn(1).gcd(e)}}return!1}})),rt=n(((e,t)=>{var n=N();t.exports=_,_.simpleSieve=h,_.fermatTest=g;var r=et(),i=new r(24),a=new(nt()),o=new r(1),s=new r(2),c=new r(5);new r(16),new r(8);var l=new r(10),u=new r(3);new r(7);var d=new r(11),f=new r(4);new r(12);var p=null;function m(){if(p!==null)return p;var e=1048576,t=[];t[0]=2;for(var n=1,r=3;r<e;r+=2){for(var i=Math.ceil(Math.sqrt(r)),a=0;a<n&&t[a]<=i&&r%t[a]!==0;a++);n!==a&&t[a]<=i||(t[n++]=r)}return p=t,t}function h(e){for(var t=m(),n=0;n<t.length;n++)if(e.modn(t[n])===0)return e.cmpn(t[n])===0;return!0}function g(e){var t=r.mont(e);return s.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)===0}function _(e,t){if(e<16)return t===2||t===5?new r([140,123]):new r([140,39]);t=new r(t);for(var p,m;;){for(p=new r(n(Math.ceil(e/8)));p.bitLength()>e;)p.ishrn(1);if(p.isEven()&&p.iadd(o),p.testn(1)||p.iadd(s),!t.cmp(s))for(;p.mod(i).cmp(d);)p.iadd(f);else if(!t.cmp(c))for(;p.mod(l).cmp(u);)p.iadd(f);if(m=p.shrn(1),h(m)&&h(p)&&g(m)&&g(p)&&a.test(m)&&a.test(p))return p}}})),it=n(((e,t)=>{t.exports={modp1:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff`},modp2:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff`},modp5:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff`},modp14:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff`},modp15:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff`},modp16:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff`},modp17:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff`},modp18:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff`}}})),at=n(((e,t)=>{var n=l(),r=et(),i=new(nt()),a=new r(24),o=new r(11),s=new r(10),c=new r(3),u=new r(7),d=rt(),f=N();t.exports=_;function p(e,t){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),this._pub=new r(e),this}function m(e,t){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),this._priv=new r(e),this}var h={};function g(e,t){var n=t.toString(`hex`),r=[n,e.toString(16)].join(`_`);if(r in h)return h[r];var l=0;if(e.isEven()||!d.simpleSieve||!d.fermatTest(e)||!i.test(e))return l+=1,n===`02`||n===`05`?l+=8:l+=4,h[r]=l,l;i.test(e.shrn(1))||(l+=2);var f;switch(n){case`02`:e.mod(a).cmp(o)&&(l+=8);break;case`05`:f=e.mod(s),f.cmp(c)&&f.cmp(u)&&(l+=8);break;default:l+=4}return h[r]=l,l}function _(e,t,n){this.setGenerator(t),this.__prime=new r(e),this._prime=r.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=p,this.setPrivateKey=m):this._primeCode=8}Object.defineProperty(_.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!=`number`&&(this._primeCode=g(this.__prime,this.__gen)),this._primeCode}}),_.prototype.generateKeys=function(){return this._priv||=new r(f(this._primeLen)),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},_.prototype.computeSecret=function(e){e=new r(e),e=e.toRed(this._prime);var t=new n.Buffer(e.redPow(this._priv).fromRed().toArray()),i=this.getPrime();if(t.length<i.length){var a=new n.Buffer(i.length-t.length);a.fill(0),t=n.Buffer.concat([a,t])}return t},_.prototype.getPublicKey=function(e){return v(this._pub,e)},_.prototype.getPrivateKey=function(e){return v(this._priv,e)},_.prototype.getPrime=function(e){return v(this.__prime,e)},_.prototype.getGenerator=function(e){return v(this._gen,e)},_.prototype.setGenerator=function(e,t){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),this.__gen=e,this._gen=new r(e),this};function v(e,t){var r=new n.Buffer(e.toArray());return t?r.toString(t):r}})),ot=n((e=>{var t=l(),n=rt(),r=it(),i=at();function a(e){return new i(new t.Buffer(r[e].prime,`hex`),new t.Buffer(r[e].gen,`hex`))}var o={binary:!0,hex:!0,base64:!0};function s(e,r,a,c){return t.Buffer.isBuffer(r)||o[r]===void 0?s(e,`binary`,r,a):(r||=`binary`,c||=`binary`,a||=new t.Buffer([2]),t.Buffer.isBuffer(a)||(a=new t.Buffer(a,c)),typeof e==`number`?new i(n(e,a),a,!0):(t.Buffer.isBuffer(e)||(e=new t.Buffer(e,r)),new i(e,a,!0)))}e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=a,e.createDiffieHellman=e.DiffieHellman=s})),st=n(((e,t)=>{var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)==`[object Array]`}})),ct=n(((e,t)=>{t.exports=u().EventEmitter})),lt=n(((e,t)=>{var n=l(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),ut=n((()=>{})),dt=n((()=>{})),ft=n(((e,t)=>{function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var r=lt().Buffer,i=dt();function a(e,t,n){e.copy(t,n)}t.exports=function(){function e(){n(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(this.length!==0){var e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(this.length===0)return``;for(var t=this.head,n=``+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(this.length===0)return r.alloc(0);for(var t=r.allocUnsafe(e>>>0),n=this.head,i=0;n;)a(n.data,t,i),i+=n.data.length,n=n.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+` `+e})})),pt=n(((e,t)=>{var n=I();function r(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return i||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,n.nextTick(a,r,e)):n.nextTick(a,r,e):t&&t(e)}),this)}function i(){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)}function a(e,t){e.emit(`error`,t)}t.exports={destroy:r,undestroy:i}})),mt=n(((t,n)=>{var i=e(r()),a=I();n.exports=S;function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){re(t,e)}}var s=!i.default.browser&&[`v0.10`,`v0.9.`].indexOf(i.default.version.slice(0,5))>-1?setImmediate:a.nextTick,c;S.WritableState=b;var l=Object.create(ie());l.inherits=p();var u={deprecate:g()},d=ct(),f=lt().Buffer,m=(typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:{}).Uint8Array||function(){};function h(e){return f.from(e)}function _(e){return f.isBuffer(e)||e instanceof m}var v=pt();l.inherits(S,d);function y(){}function b(e,t){c||=ht(),e||={};var n=t instanceof c;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,i=e.writableHighWaterMark,a=this.objectMode?16:16*1024;r||r===0?this.highWaterMark=r:n&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=e.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){A(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}b.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},(function(){try{Object.defineProperty(b.prototype,"buffer",{get:u.deprecate(function(){return this.getBuffer()},`_writableState.buffer is deprecated. Use _writableState.getBuffer instead.`,`DEP0003`)})}catch{}})();var x;typeof Symbol==`function`&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==`function`?(x=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(e){return x.call(this,e)?!0:this===S&&e&&e._writableState instanceof b}})):x=function(e){return e instanceof this};function S(e){if(c||=ht(),!x.call(S,this)&&!(this instanceof c))return new S(e);this._writableState=new b(e,this),this.writable=!0,e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final)),d.call(this)}S.prototype.pipe=function(){this.emit(`error`,Error(`Cannot pipe, not readable`))};function C(e,t){var n=Error(`write after end`);e.emit(`error`,n),a.nextTick(t,n)}function w(e,t,n,r){var i=!0,o=!1;return n===null?o=TypeError(`May not write null values to stream`):typeof n!=`string`&&n!==void 0&&!t.objectMode&&(o=TypeError(`Invalid non-string/buffer chunk`)),o&&(e.emit(`error`,o),a.nextTick(r,o),i=!1),i}S.prototype.write=function(e,t,n){var r=this._writableState,i=!1,a=!r.objectMode&&_(e);return a&&!f.isBuffer(e)&&(e=h(e)),typeof t==`function`&&(n=t,t=null),a?t=`buffer`:t||=r.defaultEncoding,typeof n!=`function`&&(n=y),r.ended?C(this,n):(a||w(this,r,e,n))&&(r.pendingcb++,i=E(this,r,a,e,t,n)),i},S.prototype.cork=function(){var e=this._writableState;e.corked++},S.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&M(this,e))},S.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=e.toLowerCase()),!([`hex`,`utf8`,`utf-8`,`ascii`,`binary`,`base64`,`ucs2`,`ucs-2`,`utf16le`,`utf-16le`,`raw`].indexOf((e+``).toLowerCase())>-1))throw TypeError(`Unknown encoding: `+e);return this._writableState.defaultEncoding=e,this};function T(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t==`string`&&(t=f.from(t,n)),t}Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function E(e,t,n,r,i,a){if(!n){var o=T(t,r,i);r!==o&&(n=!0,i=`buffer`,r=o)}var s=t.objectMode?1:r.length;t.length+=s;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else D(e,t,!1,s,r,i,a);return c}function D(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function O(e,t,n,r,i){--t.pendingcb,n?(a.nextTick(i,r),a.nextTick(ne,e,t),e._writableState.errorEmitted=!0,e.emit(`error`,r)):(i(r),e._writableState.errorEmitted=!0,e.emit(`error`,r),ne(e,t))}function k(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function A(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(k(n),t)O(e,n,r,t,i);else{var a=te(n);!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&M(e,n),r?s(ee,e,n,a,i):ee(e,n,a,i)}}function ee(e,t,n,r){n||j(e,t),t.pendingcb--,r(),ne(e,t)}function j(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`))}function M(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=Array(r),a=t.corkedRequestsFree;a.entry=n;for(var s=0,c=!0;n;)i[s]=n,n.isBuf||(c=!1),n=n.next,s+=1;i.allBuffers=c,D(e,t,!0,t.length,i,``,a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,u=n.encoding,d=n.callback;if(D(e,t,!1,t.objectMode?1:l.length,l,u,d),n=n.next,t.bufferedRequestCount--,t.writing)break}n===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}S.prototype._write=function(e,t,n){n(Error(`_write() is not implemented`))},S.prototype._writev=null,S.prototype.end=function(e,t,n){var r=this._writableState;typeof e==`function`?(n=e,e=null,t=null):typeof t==`function`&&(n=t,t=null),e!=null&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||F(this,r,n)};function te(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function N(e,t){e._final(function(n){t.pendingcb--,n&&e.emit(`error`,n),t.prefinished=!0,e.emit(`prefinish`),ne(e,t)})}function P(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`?(t.pendingcb++,t.finalCalled=!0,a.nextTick(N,e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function ne(e,t){var n=te(t);return n&&(P(e,t),t.pendingcb===0&&(t.finished=!0,e.emit(`finish`))),n}function F(e,t,n){t.ending=!0,ne(e,t),n&&(t.finished?a.nextTick(n):e.once(`finish`,n)),t.ended=!0,e.writable=!1}function re(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}Object.defineProperty(S.prototype,"destroyed",{get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),S.prototype.destroy=v.destroy,S.prototype._undestroy=v.undestroy,S.prototype._destroy=function(e,t){this.end(),t(e)}})),ht=n(((e,t)=>{var n=I(),r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=u;var i=Object.create(ie());i.inherits=p();var a=vt(),o=mt();i.inherits(u,a);for(var s=r(o.prototype),c=0;c<s.length;c++){var l=s[c];u.prototype[l]||(u.prototype[l]=o.prototype[l])}function u(e){if(!(this instanceof u))return new u(e);a.call(this,e),o.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once(`end`,d)}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function d(){this.allowHalfOpen||this._writableState.ended||n.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(u.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),u.prototype._destroy=function(e,t){this.push(null),this.end(),n.nextTick(t,e)}})),gt=n(((e,t)=>{var n=l(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),_t=n((e=>{var t=gt().Buffer,n=t.isEncoding||function(e){switch(e=``+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 r(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}}function i(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=a;function a(e){this.encoding=i(e);var n;switch(this.encoding){case`utf16le`:this.text=f,this.end=p,n=4;break;case`utf8`:this.fillLast=l,n=4;break;case`base64`:this.text=m,this.end=h,n=3;break;default:this.write=g,this.end=_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}a.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},a.prototype.end=d,a.prototype.text=u,a.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};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 s(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function l(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function u(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function d(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function f(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function m(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?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-n))}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 g(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):``}})),vt=n(((t,n)=>{var i=e(r()),a=I();n.exports=T;var o=st(),s;T.ReadableState=w,u().EventEmitter;var c=function(e,t){return e.listeners(t).length},l=ct(),d=lt().Buffer,f=(typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:{}).Uint8Array||function(){};function m(e){return d.from(e)}function h(e){return d.isBuffer(e)||e instanceof f}var g=Object.create(ie());g.inherits=p();var _=ut(),v=void 0;v=_&&_.debuglog?_.debuglog(`stream`):function(){};var y=ft(),b=pt(),x;g.inherits(T,l);var S=[`error`,`close`,`destroy`,`pause`,`resume`];function C(e,t,n){if(typeof e.prependListener==`function`)return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function w(e,t){s||=ht(),e||={};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,i=e.readableHighWaterMark,a=this.objectMode?16:16*1024;r||r===0?this.highWaterMark=r:n&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||`utf8`,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(x||=_t().StringDecoder,this.decoder=new x(e.encoding),this.encoding=e.encoding)}function T(e){if(s||=ht(),!(this instanceof T))return new T(e);this._readableState=new w(e,this),this.readable=!0,e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy)),l.call(this)}Object.defineProperty(T.prototype,"destroyed",{get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),T.prototype.destroy=b.destroy,T.prototype._undestroy=b.undestroy,T.prototype._destroy=function(e,t){this.push(null),t(e)},T.prototype.push=function(e,t){var n=this._readableState,r;return n.objectMode?r=!0:typeof e==`string`&&(t||=n.defaultEncoding,t!==n.encoding&&(e=d.from(e,t),t=``),r=!0),E(this,e,t,!1,r)},T.prototype.unshift=function(e){return E(this,e,null,!0,!1)};function E(e,t,n,r,i){var a=e._readableState;if(t===null)a.reading=!1,M(e,a);else{var o;i||(o=O(a,t)),o?e.emit(`error`,o):a.objectMode||t&&t.length>0?(typeof t!=`string`&&!a.objectMode&&Object.getPrototypeOf(t)!==d.prototype&&(t=m(t)),r?a.endEmitted?e.emit(`error`,Error(`stream.unshift() after end event`)):D(e,a,t,!0):a.ended?e.emit(`error`,Error(`stream.push() after EOF`)):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||t.length!==0?D(e,a,t,!1):P(e,a)):D(e,a,t,!1))):r||(a.reading=!1)}return k(a)}function D(e,t,n,r){t.flowing&&t.length===0&&!t.sync?(e.emit(`data`,n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&te(e)),P(e,t)}function O(e,t){var n;return!h(t)&&typeof t!=`string`&&t!==void 0&&!e.objectMode&&(n=TypeError(`Invalid non-string/buffer chunk`)),n}function k(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}T.prototype.isPaused=function(){return this._readableState.flowing===!1},T.prototype.setEncoding=function(e){return x||=_t().StringDecoder,this._readableState.decoder=new x(e),this._readableState.encoding=e,this};var A=8388608;function ee(e){return e>=A?e=A:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=ee(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}T.prototype.read=function(e){v(`read`,e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return v(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?oe(this):te(this),null;if(e=j(e,t),e===0&&t.ended)return t.length===0&&oe(this),null;var r=t.needReadable;v(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,v(`length less than watermark`,r)),t.ended||t.reading?(r=!1,v(`reading or ended`,r)):r&&(v(`do read`),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=j(n,t)));var i=e>0?B(e,t):null;return i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&oe(this)),i!==null&&this.emit(`data`,i),i};function M(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,te(e)}}function te(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(v(`emitReadable`,t.flowing),t.emittedReadable=!0,t.sync?a.nextTick(N,e):N(e))}function N(e){v(`emit readable`),e.emit(`readable`),z(e)}function P(e,t){t.readingMore||(t.readingMore=!0,a.nextTick(ne,e,t))}function ne(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(v(`maybeReadMore read 0`),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}T.prototype._read=function(e){this.emit(`error`,Error(`_read() is not implemented`))},T.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e);break}r.pipesCount+=1,v(`pipe count=%d opts=%j`,r.pipesCount,t);var o=(!t||t.end!==!1)&&e!==i.default.stdout&&e!==i.default.stderr?l:y;r.endEmitted?a.nextTick(o):n.once(`end`,o),e.on(`unpipe`,s);function s(e,t){v(`onunpipe`),e===n&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,f())}function l(){v(`onend`),e.end()}var u=F(n);e.on(`drain`,u);var d=!1;function f(){v(`cleanup`),e.removeListener(`close`,g),e.removeListener(`finish`,_),e.removeListener(`drain`,u),e.removeListener(`error`,h),e.removeListener(`unpipe`,s),n.removeListener(`end`,l),n.removeListener(`end`,y),n.removeListener(`data`,m),d=!0,r.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&u()}var p=!1;n.on(`data`,m);function m(t){v(`ondata`),p=!1,!1===e.write(t)&&!p&&((r.pipesCount===1&&r.pipes===e||r.pipesCount>1&&U(r.pipes,e)!==-1)&&!d&&(v(`false write response, pause`,r.awaitDrain),r.awaitDrain++,p=!0),n.pause())}function h(t){v(`onerror`,t),y(),e.removeListener(`error`,h),c(e,`error`)===0&&e.emit(`error`,t)}C(e,`error`,h);function g(){e.removeListener(`finish`,_),y()}e.once(`close`,g);function _(){v(`onfinish`),e.removeListener(`close`,g),y()}e.once(`finish`,_);function y(){v(`unpipe`),n.unpipe(e)}return e.emit(`pipe`,n),r.flowing||(v(`pipe resume`),n.resume()),e};function F(e){return function(){var t=e._readableState;v(`pipeOnDrain`,t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&c(e,`data`)&&(t.flowing=!0,z(e))}}T.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||=t.pipes,t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit(`unpipe`,this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)r[a].emit(`unpipe`,this,{hasUnpiped:!1});return this}var o=U(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),--t.pipesCount,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit(`unpipe`,this,n),this)},T.prototype.on=function(e,t){var n=l.prototype.on.call(this,e,t);if(e===`data`)this._readableState.flowing!==!1&&this.resume();else if(e===`readable`){var r=this._readableState;!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&te(this):a.nextTick(re,this))}return n},T.prototype.addListener=T.prototype.on;function re(e){v(`readable nexttick read 0`),e.read(0)}T.prototype.resume=function(){var e=this._readableState;return e.flowing||(v(`resume`),e.flowing=!0,L(this,e)),this};function L(e,t){t.resumeScheduled||(t.resumeScheduled=!0,a.nextTick(R,e,t))}function R(e,t){t.reading||(v(`resume read 0`),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit(`resume`),z(e),t.flowing&&!t.reading&&e.read(0)}T.prototype.pause=function(){return v(`call pause flowing=%j`,this._readableState.flowing),!1!==this._readableState.flowing&&(v(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this};function z(e){var t=e._readableState;for(v(`flow`,t.flowing);t.flowing&&e.read()!==null;);}T.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on(`end`,function(){if(v(`wrapped end`),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on(`data`,function(i){v(`wrapped data`),n.decoder&&(i=n.decoder.write(i)),!(n.objectMode&&i==null)&&(!n.objectMode&&(!i||!i.length)||t.push(i)||(r=!0,e.pause()))}),e)this[i]===void 0&&typeof e[i]==`function`&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<S.length;a++)e.on(S[a],this.emit.bind(this,S[a]));return this._read=function(t){v(`wrapped _read`,t),r&&(r=!1,e.resume())},this},Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),T._fromList=B;function B(e,t){if(t.length===0)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=ae(e,t.buffer,t.decoder),n}function ae(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?V(e,t):H(e,t),r}function V(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),e-=o,e===0){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}function H(e,t){var n=d.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),e-=o,e===0){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}function oe(e){var t=e._readableState;if(t.length>0)throw Error(`"endReadable()" called on non-empty stream`);t.endEmitted||(t.ended=!0,a.nextTick(se,t,e))}function se(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit(`end`))}function U(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}})),yt=n(((e,t)=>{t.exports=a;var n=ht(),r=Object.create(ie());r.inherits=p(),r.inherits(a,n);function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit(`error`,Error(`write callback called multiple times`));n.writechunk=null,n.writecb=null,t!=null&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function a(e){if(!(this instanceof a))return new a(e);n.call(this,e),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,o)}function o(){var e=this;typeof this._flush==`function`?this._flush(function(t,n){s(e,t,n)}):s(this,null,null)}a.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},a.prototype._transform=function(e,t,n){throw Error(`_transform() is not implemented`)},a.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},a.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,function(e){t(e),r.emit(`close`)})};function s(e,t,n){if(t)return e.emit(`error`,t);if(n!=null&&e.push(n),e._writableState.length)throw Error(`Calling transform done when ws.length != 0`);if(e._transformState.transforming)throw Error(`Calling transform done when still transforming`);return e.push(null)}})),bt=n(((e,t)=>{t.exports=i;var n=yt(),r=Object.create(ie());r.inherits=p(),r.inherits(i,n);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}i.prototype._transform=function(e,t,n){n(null,e)}})),xt=n(((e,t)=>{e=t.exports=vt(),e.Stream=e,e.Readable=e,e.Writable=mt(),e.Duplex=ht(),e.Transform=yt(),e.PassThrough=bt()})),St=n((()=>{})),Ct=n(((e,t)=>{(function(e,t){function n(e,t){if(!e)throw Error(t||`Assertion failed`)}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,e!==null&&((t===`le`||t===`be`)&&(n=t,t=10),this._init(e||0,t||10,n||`be`))}typeof e==`object`?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var a;try{a=typeof window<`u`&&window.Buffer!==void 0?window.Buffer:St().Buffer}catch{}i.isBN=function(e){return e instanceof i||typeof e==`object`&&!!e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if(typeof e==`number`)return this._initNumber(e,t,r);if(typeof e==`object`)return this._initArray(e,t,r);t===`hex`&&(t=16),n(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,``);var i=0;e[0]===`-`&&(i++,this.negative=1),i<e.length&&(t===16?this._parseHex(e,i,r):(this._parseBase(e,t,i),r===`le`&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),r===`le`&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n(typeof e.length==`number`),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if(r===`be`)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);else if(r===`le`)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);return this._strip()};function o(e,t){var r=e.charCodeAt(t);if(r>=48&&r<=57)return r-48;if(r>=65&&r<=70)return r-55;if(r>=97&&r<=102)return r-87;n(!1,`Invalid character in `+e)}function s(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i=0,a=0,o;if(n===`be`)for(r=e.length-1;r>=t;r-=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this._strip()};function c(e,t,r,i){for(var a=0,o=0,s=Math.min(e.length,r),c=t;c<s;c++){var l=e.charCodeAt(c)-48;a*=i,o=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&o<i,`Invalid character`),a+=o}return a}i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var a=e.length-n,o=a%r,s=Math.min(a,a-o)+n,l=0,u=n;u<s;u+=r)l=c(e,u,u+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(o!==0){var d=1;for(l=c(e,u,e.length,t),u=0;u<o;u++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this._strip()},i.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red};function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.prototype._move=function(e){l(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<`u`&&typeof Symbol.for==`function`)try{i.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=u}catch{i.prototype.inspect=u}else i.prototype.inspect=u;function u(){return(this.red?`<BN-R: `:`<BN: `)+this.toString(16)+`>`}var d=`.0.00.000.0000.00000.000000.0000000.00000000.000000000.0000000000.00000000000.000000000000.0000000000000.00000000000000.000000000000000.0000000000000000.00000000000000000.000000000000000000.0000000000000000000.00000000000000000000.000000000000000000000.0000000000000000000000.00000000000000000000000.000000000000000000000000.0000000000000000000000000`.split(`.`),f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){e||=10,t=t|0||1;var r;if(e===16||e===`hex`){r=``;for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],c=((s<<i|a)&16777215).toString(16);a=s>>>24-i&16777215,i+=2,i>=26&&(i-=26,o--),r=a!==0||o!==this.length-1?d[6-c.length]+c+r:c+r}for(a!==0&&(r=a.toString(16)+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}if(e===(e|0)&&e>=2&&e<=36){var l=f[e],u=p[e];r=``;var m=this.clone();for(m.negative=0;!m.isZero();){var h=m.modrn(u).toString(e);m=m.idivn(u),r=m.isZero()?h+r:d[l-h.length]+h+r}for(this.isZero()&&(r=`0`+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}n(!1,`Base should be between 2 and 36`)},i.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,`Number can only safely store up to 53 bits`),this.negative===0?e:-e},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};var m=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)};i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,`byte array longer than desired length`),n(a>0,`Requested array length <= 0`);var o=m(e,a),s=t===`le`?`LE`:`BE`;return this[`_toArrayLike`+s](o,i),o},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n++]=o&255,n<e.length&&(e[n++]=o>>8&255),n<e.length&&(e[n++]=o>>16&255),a===6?(n<e.length&&(e[n++]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n--]=o&255,n>=0&&(e[n--]=o>>8&255),n>=0&&(e[n--]=o>>16&255),a===6?(n>=0&&(e[n--]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,n=0;return t&8191||(n+=13,t>>>=13),t&127||(n+=7,t>>>=7),t&15||(n+=4,t>>>=4),t&3||(n+=2,t>>>=2),t&1||n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function h(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,n!==26)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return this.negative===0?this.clone():this.abs().inotn(e).iaddn(1)},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n((this.negative|e.negative)===0),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){for(var t=this.length>e.length?e:this,n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n((this.negative|e.negative)===0),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n((this.negative|e.negative)===0),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n(typeof e==`number`&&e>=0);var t=Math.ceil(e/26)|0,r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=~this.words[i]&67108863;for(r>0&&(this.words[i]=~this.words[i]&67108863>>26-r,i++);i<this.length;i++)this.words[i]=0;return this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n(typeof e==`number`&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<i:this.words[r]=this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var n,r;this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(n.words[a]|0)+(r.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;for(;i!==0&&a<n.length;a++)t=(n.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;if(this.length=n.length,i!==0)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},i.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var r,i;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)t=(r.words[o]|0)-(i.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;for(;a!==0&&o<r.length;o++)t=(r.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;if(a===0&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};function g(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=e.words[0]|0,a=t.words[0]|0,o=i*a,s=o&67108863,c=o/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var u=c>>>26,d=c&67108863,f=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=f;p++){var m=l-p|0;i=e.words[m]|0,a=t.words[p]|0,o=i*a+d,u+=o/67108864|0,d=o&67108863}n.words[l]=d|0,c=u|0}return c===0?n.length--:n.words[l]=c|0,n._strip()}var _=function(e,t,n){var r=e.words,i=t.words,a=n.words,o=0,s,c,l,u=r[0]|0,d=u&8191,f=u>>>13,p=r[1]|0,m=p&8191,h=p>>>13,g=r[2]|0,_=g&8191,v=g>>>13,y=r[3]|0,b=y&8191,x=y>>>13,S=r[4]|0,C=S&8191,w=S>>>13,T=r[5]|0,E=T&8191,D=T>>>13,O=r[6]|0,k=O&8191,A=O>>>13,ee=r[7]|0,j=ee&8191,M=ee>>>13,te=r[8]|0,N=te&8191,P=te>>>13,ne=r[9]|0,F=ne&8191,I=ne>>>13,re=i[0]|0,L=re&8191,R=re>>>13,ie=i[1]|0,z=ie&8191,B=ie>>>13,ae=i[2]|0,V=ae&8191,H=ae>>>13,oe=i[3]|0,se=oe&8191,U=oe>>>13,ce=i[4]|0,W=ce&8191,G=ce>>>13,le=i[5]|0,K=le&8191,q=le>>>13,ue=i[6]|0,J=ue&8191,de=ue>>>13,fe=i[7]|0,pe=fe&8191,me=fe>>>13,Y=i[8]|0,X=Y&8191,Z=Y>>>13,he=i[9]|0,ge=he&8191,_e=he>>>13;n.negative=e.negative^t.negative,n.length=19,s=Math.imul(d,L),c=Math.imul(d,R),c=c+Math.imul(f,L)|0,l=Math.imul(f,R);var ve=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ve>>>26)|0,ve&=67108863,s=Math.imul(m,L),c=Math.imul(m,R),c=c+Math.imul(h,L)|0,l=Math.imul(h,R),s=s+Math.imul(d,z)|0,c=c+Math.imul(d,B)|0,c=c+Math.imul(f,z)|0,l=l+Math.imul(f,B)|0;var ye=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ye>>>26)|0,ye&=67108863,s=Math.imul(_,L),c=Math.imul(_,R),c=c+Math.imul(v,L)|0,l=Math.imul(v,R),s=s+Math.imul(m,z)|0,c=c+Math.imul(m,B)|0,c=c+Math.imul(h,z)|0,l=l+Math.imul(h,B)|0,s=s+Math.imul(d,V)|0,c=c+Math.imul(d,H)|0,c=c+Math.imul(f,V)|0,l=l+Math.imul(f,H)|0;var be=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(be>>>26)|0,be&=67108863,s=Math.imul(b,L),c=Math.imul(b,R),c=c+Math.imul(x,L)|0,l=Math.imul(x,R),s=s+Math.imul(_,z)|0,c=c+Math.imul(_,B)|0,c=c+Math.imul(v,z)|0,l=l+Math.imul(v,B)|0,s=s+Math.imul(m,V)|0,c=c+Math.imul(m,H)|0,c=c+Math.imul(h,V)|0,l=l+Math.imul(h,H)|0,s=s+Math.imul(d,se)|0,c=c+Math.imul(d,U)|0,c=c+Math.imul(f,se)|0,l=l+Math.imul(f,U)|0;var xe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(xe>>>26)|0,xe&=67108863,s=Math.imul(C,L),c=Math.imul(C,R),c=c+Math.imul(w,L)|0,l=Math.imul(w,R),s=s+Math.imul(b,z)|0,c=c+Math.imul(b,B)|0,c=c+Math.imul(x,z)|0,l=l+Math.imul(x,B)|0,s=s+Math.imul(_,V)|0,c=c+Math.imul(_,H)|0,c=c+Math.imul(v,V)|0,l=l+Math.imul(v,H)|0,s=s+Math.imul(m,se)|0,c=c+Math.imul(m,U)|0,c=c+Math.imul(h,se)|0,l=l+Math.imul(h,U)|0,s=s+Math.imul(d,W)|0,c=c+Math.imul(d,G)|0,c=c+Math.imul(f,W)|0,l=l+Math.imul(f,G)|0;var Se=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Se>>>26)|0,Se&=67108863,s=Math.imul(E,L),c=Math.imul(E,R),c=c+Math.imul(D,L)|0,l=Math.imul(D,R),s=s+Math.imul(C,z)|0,c=c+Math.imul(C,B)|0,c=c+Math.imul(w,z)|0,l=l+Math.imul(w,B)|0,s=s+Math.imul(b,V)|0,c=c+Math.imul(b,H)|0,c=c+Math.imul(x,V)|0,l=l+Math.imul(x,H)|0,s=s+Math.imul(_,se)|0,c=c+Math.imul(_,U)|0,c=c+Math.imul(v,se)|0,l=l+Math.imul(v,U)|0,s=s+Math.imul(m,W)|0,c=c+Math.imul(m,G)|0,c=c+Math.imul(h,W)|0,l=l+Math.imul(h,G)|0,s=s+Math.imul(d,K)|0,c=c+Math.imul(d,q)|0,c=c+Math.imul(f,K)|0,l=l+Math.imul(f,q)|0;var Ce=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,s=Math.imul(k,L),c=Math.imul(k,R),c=c+Math.imul(A,L)|0,l=Math.imul(A,R),s=s+Math.imul(E,z)|0,c=c+Math.imul(E,B)|0,c=c+Math.imul(D,z)|0,l=l+Math.imul(D,B)|0,s=s+Math.imul(C,V)|0,c=c+Math.imul(C,H)|0,c=c+Math.imul(w,V)|0,l=l+Math.imul(w,H)|0,s=s+Math.imul(b,se)|0,c=c+Math.imul(b,U)|0,c=c+Math.imul(x,se)|0,l=l+Math.imul(x,U)|0,s=s+Math.imul(_,W)|0,c=c+Math.imul(_,G)|0,c=c+Math.imul(v,W)|0,l=l+Math.imul(v,G)|0,s=s+Math.imul(m,K)|0,c=c+Math.imul(m,q)|0,c=c+Math.imul(h,K)|0,l=l+Math.imul(h,q)|0,s=s+Math.imul(d,J)|0,c=c+Math.imul(d,de)|0,c=c+Math.imul(f,J)|0,l=l+Math.imul(f,de)|0;var we=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(we>>>26)|0,we&=67108863,s=Math.imul(j,L),c=Math.imul(j,R),c=c+Math.imul(M,L)|0,l=Math.imul(M,R),s=s+Math.imul(k,z)|0,c=c+Math.imul(k,B)|0,c=c+Math.imul(A,z)|0,l=l+Math.imul(A,B)|0,s=s+Math.imul(E,V)|0,c=c+Math.imul(E,H)|0,c=c+Math.imul(D,V)|0,l=l+Math.imul(D,H)|0,s=s+Math.imul(C,se)|0,c=c+Math.imul(C,U)|0,c=c+Math.imul(w,se)|0,l=l+Math.imul(w,U)|0,s=s+Math.imul(b,W)|0,c=c+Math.imul(b,G)|0,c=c+Math.imul(x,W)|0,l=l+Math.imul(x,G)|0,s=s+Math.imul(_,K)|0,c=c+Math.imul(_,q)|0,c=c+Math.imul(v,K)|0,l=l+Math.imul(v,q)|0,s=s+Math.imul(m,J)|0,c=c+Math.imul(m,de)|0,c=c+Math.imul(h,J)|0,l=l+Math.imul(h,de)|0,s=s+Math.imul(d,pe)|0,c=c+Math.imul(d,me)|0,c=c+Math.imul(f,pe)|0,l=l+Math.imul(f,me)|0;var Te=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,s=Math.imul(N,L),c=Math.imul(N,R),c=c+Math.imul(P,L)|0,l=Math.imul(P,R),s=s+Math.imul(j,z)|0,c=c+Math.imul(j,B)|0,c=c+Math.imul(M,z)|0,l=l+Math.imul(M,B)|0,s=s+Math.imul(k,V)|0,c=c+Math.imul(k,H)|0,c=c+Math.imul(A,V)|0,l=l+Math.imul(A,H)|0,s=s+Math.imul(E,se)|0,c=c+Math.imul(E,U)|0,c=c+Math.imul(D,se)|0,l=l+Math.imul(D,U)|0,s=s+Math.imul(C,W)|0,c=c+Math.imul(C,G)|0,c=c+Math.imul(w,W)|0,l=l+Math.imul(w,G)|0,s=s+Math.imul(b,K)|0,c=c+Math.imul(b,q)|0,c=c+Math.imul(x,K)|0,l=l+Math.imul(x,q)|0,s=s+Math.imul(_,J)|0,c=c+Math.imul(_,de)|0,c=c+Math.imul(v,J)|0,l=l+Math.imul(v,de)|0,s=s+Math.imul(m,pe)|0,c=c+Math.imul(m,me)|0,c=c+Math.imul(h,pe)|0,l=l+Math.imul(h,me)|0,s=s+Math.imul(d,X)|0,c=c+Math.imul(d,Z)|0,c=c+Math.imul(f,X)|0,l=l+Math.imul(f,Z)|0;var Ee=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,s=Math.imul(F,L),c=Math.imul(F,R),c=c+Math.imul(I,L)|0,l=Math.imul(I,R),s=s+Math.imul(N,z)|0,c=c+Math.imul(N,B)|0,c=c+Math.imul(P,z)|0,l=l+Math.imul(P,B)|0,s=s+Math.imul(j,V)|0,c=c+Math.imul(j,H)|0,c=c+Math.imul(M,V)|0,l=l+Math.imul(M,H)|0,s=s+Math.imul(k,se)|0,c=c+Math.imul(k,U)|0,c=c+Math.imul(A,se)|0,l=l+Math.imul(A,U)|0,s=s+Math.imul(E,W)|0,c=c+Math.imul(E,G)|0,c=c+Math.imul(D,W)|0,l=l+Math.imul(D,G)|0,s=s+Math.imul(C,K)|0,c=c+Math.imul(C,q)|0,c=c+Math.imul(w,K)|0,l=l+Math.imul(w,q)|0,s=s+Math.imul(b,J)|0,c=c+Math.imul(b,de)|0,c=c+Math.imul(x,J)|0,l=l+Math.imul(x,de)|0,s=s+Math.imul(_,pe)|0,c=c+Math.imul(_,me)|0,c=c+Math.imul(v,pe)|0,l=l+Math.imul(v,me)|0,s=s+Math.imul(m,X)|0,c=c+Math.imul(m,Z)|0,c=c+Math.imul(h,X)|0,l=l+Math.imul(h,Z)|0,s=s+Math.imul(d,ge)|0,c=c+Math.imul(d,_e)|0,c=c+Math.imul(f,ge)|0,l=l+Math.imul(f,_e)|0;var De=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(De>>>26)|0,De&=67108863,s=Math.imul(F,z),c=Math.imul(F,B),c=c+Math.imul(I,z)|0,l=Math.imul(I,B),s=s+Math.imul(N,V)|0,c=c+Math.imul(N,H)|0,c=c+Math.imul(P,V)|0,l=l+Math.imul(P,H)|0,s=s+Math.imul(j,se)|0,c=c+Math.imul(j,U)|0,c=c+Math.imul(M,se)|0,l=l+Math.imul(M,U)|0,s=s+Math.imul(k,W)|0,c=c+Math.imul(k,G)|0,c=c+Math.imul(A,W)|0,l=l+Math.imul(A,G)|0,s=s+Math.imul(E,K)|0,c=c+Math.imul(E,q)|0,c=c+Math.imul(D,K)|0,l=l+Math.imul(D,q)|0,s=s+Math.imul(C,J)|0,c=c+Math.imul(C,de)|0,c=c+Math.imul(w,J)|0,l=l+Math.imul(w,de)|0,s=s+Math.imul(b,pe)|0,c=c+Math.imul(b,me)|0,c=c+Math.imul(x,pe)|0,l=l+Math.imul(x,me)|0,s=s+Math.imul(_,X)|0,c=c+Math.imul(_,Z)|0,c=c+Math.imul(v,X)|0,l=l+Math.imul(v,Z)|0,s=s+Math.imul(m,ge)|0,c=c+Math.imul(m,_e)|0,c=c+Math.imul(h,ge)|0,l=l+Math.imul(h,_e)|0;var Oe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,s=Math.imul(F,V),c=Math.imul(F,H),c=c+Math.imul(I,V)|0,l=Math.imul(I,H),s=s+Math.imul(N,se)|0,c=c+Math.imul(N,U)|0,c=c+Math.imul(P,se)|0,l=l+Math.imul(P,U)|0,s=s+Math.imul(j,W)|0,c=c+Math.imul(j,G)|0,c=c+Math.imul(M,W)|0,l=l+Math.imul(M,G)|0,s=s+Math.imul(k,K)|0,c=c+Math.imul(k,q)|0,c=c+Math.imul(A,K)|0,l=l+Math.imul(A,q)|0,s=s+Math.imul(E,J)|0,c=c+Math.imul(E,de)|0,c=c+Math.imul(D,J)|0,l=l+Math.imul(D,de)|0,s=s+Math.imul(C,pe)|0,c=c+Math.imul(C,me)|0,c=c+Math.imul(w,pe)|0,l=l+Math.imul(w,me)|0,s=s+Math.imul(b,X)|0,c=c+Math.imul(b,Z)|0,c=c+Math.imul(x,X)|0,l=l+Math.imul(x,Z)|0,s=s+Math.imul(_,ge)|0,c=c+Math.imul(_,_e)|0,c=c+Math.imul(v,ge)|0,l=l+Math.imul(v,_e)|0;var ke=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ke>>>26)|0,ke&=67108863,s=Math.imul(F,se),c=Math.imul(F,U),c=c+Math.imul(I,se)|0,l=Math.imul(I,U),s=s+Math.imul(N,W)|0,c=c+Math.imul(N,G)|0,c=c+Math.imul(P,W)|0,l=l+Math.imul(P,G)|0,s=s+Math.imul(j,K)|0,c=c+Math.imul(j,q)|0,c=c+Math.imul(M,K)|0,l=l+Math.imul(M,q)|0,s=s+Math.imul(k,J)|0,c=c+Math.imul(k,de)|0,c=c+Math.imul(A,J)|0,l=l+Math.imul(A,de)|0,s=s+Math.imul(E,pe)|0,c=c+Math.imul(E,me)|0,c=c+Math.imul(D,pe)|0,l=l+Math.imul(D,me)|0,s=s+Math.imul(C,X)|0,c=c+Math.imul(C,Z)|0,c=c+Math.imul(w,X)|0,l=l+Math.imul(w,Z)|0,s=s+Math.imul(b,ge)|0,c=c+Math.imul(b,_e)|0,c=c+Math.imul(x,ge)|0,l=l+Math.imul(x,_e)|0;var Ae=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,s=Math.imul(F,W),c=Math.imul(F,G),c=c+Math.imul(I,W)|0,l=Math.imul(I,G),s=s+Math.imul(N,K)|0,c=c+Math.imul(N,q)|0,c=c+Math.imul(P,K)|0,l=l+Math.imul(P,q)|0,s=s+Math.imul(j,J)|0,c=c+Math.imul(j,de)|0,c=c+Math.imul(M,J)|0,l=l+Math.imul(M,de)|0,s=s+Math.imul(k,pe)|0,c=c+Math.imul(k,me)|0,c=c+Math.imul(A,pe)|0,l=l+Math.imul(A,me)|0,s=s+Math.imul(E,X)|0,c=c+Math.imul(E,Z)|0,c=c+Math.imul(D,X)|0,l=l+Math.imul(D,Z)|0,s=s+Math.imul(C,ge)|0,c=c+Math.imul(C,_e)|0,c=c+Math.imul(w,ge)|0,l=l+Math.imul(w,_e)|0;var je=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(je>>>26)|0,je&=67108863,s=Math.imul(F,K),c=Math.imul(F,q),c=c+Math.imul(I,K)|0,l=Math.imul(I,q),s=s+Math.imul(N,J)|0,c=c+Math.imul(N,de)|0,c=c+Math.imul(P,J)|0,l=l+Math.imul(P,de)|0,s=s+Math.imul(j,pe)|0,c=c+Math.imul(j,me)|0,c=c+Math.imul(M,pe)|0,l=l+Math.imul(M,me)|0,s=s+Math.imul(k,X)|0,c=c+Math.imul(k,Z)|0,c=c+Math.imul(A,X)|0,l=l+Math.imul(A,Z)|0,s=s+Math.imul(E,ge)|0,c=c+Math.imul(E,_e)|0,c=c+Math.imul(D,ge)|0,l=l+Math.imul(D,_e)|0;var Me=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Me>>>26)|0,Me&=67108863,s=Math.imul(F,J),c=Math.imul(F,de),c=c+Math.imul(I,J)|0,l=Math.imul(I,de),s=s+Math.imul(N,pe)|0,c=c+Math.imul(N,me)|0,c=c+Math.imul(P,pe)|0,l=l+Math.imul(P,me)|0,s=s+Math.imul(j,X)|0,c=c+Math.imul(j,Z)|0,c=c+Math.imul(M,X)|0,l=l+Math.imul(M,Z)|0,s=s+Math.imul(k,ge)|0,c=c+Math.imul(k,_e)|0,c=c+Math.imul(A,ge)|0,l=l+Math.imul(A,_e)|0;var Ne=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s=Math.imul(F,pe),c=Math.imul(F,me),c=c+Math.imul(I,pe)|0,l=Math.imul(I,me),s=s+Math.imul(N,X)|0,c=c+Math.imul(N,Z)|0,c=c+Math.imul(P,X)|0,l=l+Math.imul(P,Z)|0,s=s+Math.imul(j,ge)|0,c=c+Math.imul(j,_e)|0,c=c+Math.imul(M,ge)|0,l=l+Math.imul(M,_e)|0;var Pe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,s=Math.imul(F,X),c=Math.imul(F,Z),c=c+Math.imul(I,X)|0,l=Math.imul(I,Z),s=s+Math.imul(N,ge)|0,c=c+Math.imul(N,_e)|0,c=c+Math.imul(P,ge)|0,l=l+Math.imul(P,_e)|0;var Fe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,s=Math.imul(F,ge),c=Math.imul(F,_e),c=c+Math.imul(I,ge)|0,l=Math.imul(I,_e);var Q=(o+s|0)+((c&8191)<<13)|0;return o=(l+(c>>>13)|0)+(Q>>>26)|0,Q&=67108863,a[0]=ve,a[1]=ye,a[2]=be,a[3]=xe,a[4]=Se,a[5]=Ce,a[6]=we,a[7]=Te,a[8]=Ee,a[9]=De,a[10]=Oe,a[11]=ke,a[12]=Ae,a[13]=je,a[14]=Me,a[15]=Ne,a[16]=Pe,a[17]=Fe,a[18]=Q,o!==0&&(a[19]=o,n.length++),n};Math.imul||(_=g);function v(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,a=0;a<n.length-1;a++){var o=i;i=0;for(var s=r&67108863,c=Math.min(a,t.length-1),l=Math.max(0,a-e.length+1);l<=c;l++){var u=a-l,d=(e.words[u]|0)*(t.words[l]|0),f=d&67108863;o=o+(d/67108864|0)|0,f=f+s|0,s=f&67108863,o=o+(f>>>26)|0,i+=o>>>26,o&=67108863}n.words[a]=s,r=o,o=i}return r===0?n.length--:n.words[a]=r,n._strip()}function y(e,t,n){return v(e,t,n)}i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=this.length===10&&e.length===10?_(this,e,t):r<63?g(this,e,t):r<1024?v(this,e,t):y(this,e,t),n};function b(e,t){this.x=e,this.y=t}b.prototype.makeRBT=function(e){for(var t=Array(e),n=i.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},b.prototype.revBin=function(e,t,n){if(e===0||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(e&1)<<t-i-1,e>>=1;return r},b.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},b.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,c=Math.cos(2*Math.PI/s),l=Math.sin(2*Math.PI/s),u=0;u<i;u+=s)for(var d=c,f=l,p=0;p<o;p++){var m=n[u+p],h=r[u+p],g=n[u+p+o],_=r[u+p+o],v=d*g-f*_;_=d*_+f*g,g=v,n[u+p]=m+g,r[u+p]=h+_,n[u+p+o]=m-g,r[u+p+o]=h-_,p!==s&&(v=c*d-l*f,f=c*f+l*d,d=v)}},b.prototype.guessLen13b=function(e,t){var n=Math.max(t,e)|1,r=n&1,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},b.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},b.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=Math.round(e[2*r+1]/t)*8192+Math.round(e[2*r]/t)+n;e[r]=i&67108863,n=i<67108864?0:i/67108864|0}return e},b.prototype.convert13b=function(e,t,r,i){for(var a=0,o=0;o<t;o++)a+=e[o]|0,r[2*o]=a&8191,a>>>=13,r[2*o+1]=a&8191,a>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(a===0),n((a&-8192)==0)},b.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},b.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),c=Array(r),l=Array(r),u=Array(r),d=Array(r),f=n.words;f.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,c,r,i),this.transform(l,a,u,d,r,i);for(var p=0;p<r;p++){var m=s[p]*u[p]-c[p]*d[p];c[p]=s[p]*d[p]+c[p]*u[p],s[p]=m}return this.conjugate(s,c,r),this.transform(s,c,f,a,r,i),this.conjugate(f,a,r),this.normalize13b(f,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n._strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n(typeof e==`number`),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var a=(this.words[i]|0)*e,o=(a&67108863)+(r&67108863);r>>=26,r+=a/67108864|0,r+=o>>>26,this.words[i]=o&67108863}return r!==0&&(this.words[i]=r,this.length++),e===0&&(this.length=1,this._normSign()),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=h(e);if(t.length===0)return new i(1);for(var n=this,r=0;r<t.length&&t[r]===0;r++,n=n.sqr());if(++r<t.length)for(var a=n.sqr();r<t.length;r++,a=a.sqr())t[r]!==0&&(n=n.mul(a));return n},i.prototype.iushln=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=67108863>>>26-t<<26-t,a;if(t!==0){var o=0;for(a=0;a<this.length;a++){var s=this.words[a]&i,c=(this.words[a]|0)-s<<t;this.words[a]=c|o,o=s>>>26-t}o&&(this.words[a]=o,this.length++)}if(r!==0){for(a=this.length-1;a>=0;a--)this.words[a+r]=this.words[a];for(a=0;a<r;a++)this.words[a]=0;this.length+=r}return this._strip()},i.prototype.ishln=function(e){return n(this.negative===0),this.iushln(e)},i.prototype.iushrn=function(e,t,r){n(typeof e==`number`&&e>=0);var i=t?(t-t%26)/26:0,a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,c=r;if(i-=o,i=Math.max(0,i),c){for(var l=0;l<o;l++)c.words[l]=this.words[l];c.length=o}if(o!==0)if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var u=0;for(l=this.length-1;l>=0&&(u!==0||l>=i);l--){var d=this.words[l]|0;this.words[l]=u<<26-a|d>>>a,u=d&s}return c&&u!==0&&(c.words[c.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(this.negative===0),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return this.length<=r?!1:!!(this.words[r]&i)},i.prototype.imaskn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26;if(n(this.negative===0,`imaskn works only with positive numbers`),this.length<=r)return this;if(t!==0&&r++,this.length=Math.min(r,this.length),t!==0){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n(typeof e==`number`),n(e<67108864),e<0?this.isubn(-e):this.negative===0?this._iaddn(e):this.length===1&&(this.words[0]|0)<=e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n(typeof e==`number`),n(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,--this.words[t+1];return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i=e.length+r,a;this._expand(i);var o,s=0;for(a=0;a<e.length;a++){o=(this.words[a+r]|0)+s;var c=(e.words[a]|0)*t;o-=c&67108863,s=(o>>26)-(c/67108864|0),this.words[a+r]=o&67108863}for(;a<this.length-r;a++)o=(this.words[a+r]|0)+s,s=o>>26,this.words[a+r]=o&67108863;if(s===0)return this._strip();for(n(s===-1),s=0,a=0;a<this.length;a++)o=-(this.words[a]|0)+s,s=o>>26,this.words[a]=o&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=this.length-e.length,r=this.clone(),a=e,o=a.words[a.length-1]|0;n=26-this._countBits(o),n!==0&&(a=a.ushln(n),r.iushln(n),o=a.words[a.length-1]|0);var s=r.length-a.length,c;if(t!==`mod`){c=new i(null),c.length=s+1,c.words=Array(c.length);for(var l=0;l<c.length;l++)c.words[l]=0}var u=r.clone()._ishlnsubmul(a,1,s);u.negative===0&&(r=u,c&&(c.words[s]=1));for(var d=s-1;d>=0;d--){var f=(r.words[a.length+d]|0)*67108864+(r.words[a.length+d-1]|0);for(f=Math.min(f/o|0,67108863),r._ishlnsubmul(a,f,d);r.negative!==0;)f--,r.negative=0,r._ishlnsubmul(a,1,d),r.isZero()||(r.negative^=1);c&&(c.words[d]=f)}return c&&c._strip(),r._strip(),t!==`div`&&n!==0&&r.iushrn(n),{div:c||null,mod:r}},i.prototype.divmod=function(e,t,r){if(n(!e.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var a,o,s;return this.negative!==0&&e.negative===0?(s=this.neg().divmod(e,t),t!==`mod`&&(a=s.div.neg()),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.iadd(e)),{div:a,mod:o}):this.negative===0&&e.negative!==0?(s=this.divmod(e.neg(),t),t!==`mod`&&(a=s.div.neg()),{div:a,mod:s.mod}):(this.negative&e.negative)===0?e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:e.length===1?t===`div`?{div:this.divn(e.words[0]),mod:null}:t===`mod`?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.isub(e)),{div:s.div,mod:o})},i.prototype.div=function(e){return this.divmod(e,`div`,!1).div},i.prototype.mod=function(e){return this.divmod(e,`mod`,!1).mod},i.prototype.umod=function(e){return this.divmod(e,`mod`,!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=t.mod.abs(),r=e.abs().iushrn(1),a=e.words[0]&1,o=n.cmp(r);if(o<0||a===1&&o===0)return t.div;var s=new i(1);return s.negative=this.negative^e.negative,t.div.iadd(s)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(r*i+(this.words[a]|0))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var a=(this.words[i]|0)+r*67108864;this.words[i]=a/e|0,r=a%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=new i(0),c=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var u=r.clone(),d=t.clone();!t.isZero();){for(var f=0,p=1;(t.words[0]&p)===0&&f<26;++f,p<<=1);if(f>0)for(t.iushrn(f);f-->0;)(a.isOdd()||o.isOdd())&&(a.iadd(u),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var m=0,h=1;(r.words[0]&h)===0&&m<26;++m,h<<=1);if(m>0)for(r.iushrn(m);m-->0;)(s.isOdd()||c.isOdd())&&(s.iadd(u),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s),o.isub(c)):(r.isub(t),s.isub(a),c.isub(o))}return{a:s,b:c,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;(t.words[0]&l)===0&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-->0;)a.isOdd()&&a.iadd(s),a.iushrn(1);for(var u=0,d=1;(r.words[0]&d)===0&&u<26;++u,d<<=1);if(u>0)for(r.iushrn(u);u-->0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o)):(r.isub(t),o.isub(a))}var f=t.cmpn(1)===0?a:o;return f.cmpn(0)<0&&f.iadd(e),f},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var a=t;t=n,n=a}else if(i===0||n.cmpn(1)===0)break;t.isub(n)}while(!0);return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return(this.words[0]&1)==0},i.prototype.isOdd=function(){return(this.words[0]&1)==1},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n(typeof e==`number`);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;a!==0&&o<this.length;o++){var s=this.words[o]|0;s+=a,a=s>>>26,s&=67108863,this.words[o]=s}return a!==0&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this._strip();var r;if(this.length>1)r=1;else{t&&(e=-e),n(e<=67108863,`Number is too big`);var i=this.words[0]|0;r=i===e?0:i<e?-1:1}return this.negative===0?r:-r|0},i.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative===0?t:-t|0},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=this.words[n]|0,i=e.words[n]|0;if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return this.cmpn(e)===1},i.prototype.gt=function(e){return this.cmp(e)===1},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return this.cmpn(e)===-1},i.prototype.lt=function(e){return this.cmp(e)===-1},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return this.cmpn(e)===0},i.prototype.eq=function(e){return this.cmp(e)===0},i.red=function(e){return new D(e)},i.prototype.toRed=function(e){return n(!this.red,`Already a number in reduction context`),n(this.negative===0,`red works only with positives`),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,`fromRed works only with numbers in reduction context`),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,`Already a number in reduction context`),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,`redAdd works only with red numbers`),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,`redIAdd works only with red numbers`),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,`redSub works only with red numbers`),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,`redISub works only with red numbers`),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,`redShl works only with red numbers`),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,`redSqr works only with red numbers`),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,`redISqr works only with red numbers`),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,`redSqrt works only with red numbers`),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,`redInvm works only with red numbers`),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,`redNeg works only with red numbers`),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,`redPow(normalNum)`),this.red._verify1(this),this.red.pow(this,e)};var x={k256:null,p224:null,p192:null,p25519:null};function S(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}S.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},S.prototype.ireduce=function(e){var t=e,n;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),n=t.bitLength();while(n>this.n);var r=n<this.n?-1:t.ucmp(this.p);return r===0?(t.words[0]=0,t.length=1):r>0?t.isub(this.p):t.strip===void 0?t._strip():t.strip(),t},S.prototype.split=function(e,t){e.iushrn(this.n,0,t)},S.prototype.imulK=function(e){return e.imul(this.k)};function C(){S.call(this,`k256`,`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`)}r(C,S),C.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=e.words[i]|0;e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,a===0&&e.length>10?e.length-=10:e.length-=9},C.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=e.words[n]|0;t+=r*977,e.words[n]=t&67108863,t=r*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function w(){S.call(this,`p224`,`ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001`)}r(w,S);function T(){S.call(this,`p192`,`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff`)}r(T,S);function E(){S.call(this,`25519`,`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`)}r(E,S),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=(e.words[n]|0)*19+t,i=r&67108863;r>>>=26,e.words[n]=i,t=r}return t!==0&&(e.words[e.length++]=t),e},i._prime=function(e){if(x[e])return x[e];var t;if(e===`k256`)t=new C;else if(e===`p224`)t=new w;else if(e===`p192`)t=new T;else if(e===`p25519`)t=new E;else throw Error(`Unknown prime `+e);return x[e]=t,t};function D(e){if(typeof e==`string`){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),`modulus must be greater than 1`),this.m=e,this.prime=null}D.prototype._verify1=function(e){n(e.negative===0,`red works only with positives`),n(e.red,`red works only with red numbers`)},D.prototype._verify2=function(e,t){n((e.negative|t.negative)===0,`red works only with positives`),n(e.red&&e.red===t.red,`red works only with red numbers`)},D.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},D.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},D.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},D.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},D.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},D.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},D.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},D.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},D.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},D.prototype.isqr=function(e){return this.imul(e,e.clone())},D.prototype.sqr=function(e){return this.mul(e,e)},D.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),t===3){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&a.andln(1)===0;)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),c=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,l).cmp(c)!==0;)u.redIAdd(c);for(var d=this.pow(u,a),f=this.pow(e,a.addn(1).iushrn(1)),p=this.pow(e,a),m=o;p.cmp(s)!==0;){for(var h=p,g=0;h.cmp(s)!==0;g++)h=h.redSqr();n(g<m);var _=this.pow(d,new i(1).iushln(m-g-1));f=f.redMul(_),d=_.redSqr(),p=p.redMul(d),m=g}return f},D.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative===0?this.imod(t):(t.negative=0,this.imod(t).redNeg())},D.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var n=4,r=Array(1<<n);r[0]=new i(1).toRed(this),r[1]=e;for(var a=2;a<r.length;a++)r[a]=this.mul(r[a-1],e);var o=r[0],s=0,c=0,l=t.bitLength()%26;for(l===0&&(l=26),a=t.length-1;a>=0;a--){for(var u=t.words[a],d=l-1;d>=0;d--){var f=u>>d&1;if(o!==r[0]&&(o=this.sqr(o)),f===0&&s===0){c=0;continue}s<<=1,s|=f,c++,!(c!==n&&(a!==0||d!==0))&&(o=this.mul(o,r[s]),c=0,s=0)}l=26}return o},D.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},D.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new O(e)};function O(e){D.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}r(O,D),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(r).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}})(t===void 0||t,e)})),wt=n(((e,t)=>{var n=Ct(),r=N(),i=c().Buffer;function a(e){var t=e.modulus.byteLength(),i;do i=new n(r(t));while(i.cmp(e.modulus)>=0||!i.umod(e.prime1)||!i.umod(e.prime2));return i}function o(e){var t=a(e);return{blinder:t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}function s(e,t){var r=o(t),a=t.modulus.byteLength(),s=new n(e).mul(r.blinder).umod(t.modulus),c=s.toRed(n.mont(t.prime1)),l=s.toRed(n.mont(t.prime2)),u=t.coefficient,d=t.prime1,f=t.prime2,p=c.redPow(t.exponent1).fromRed(),m=l.redPow(t.exponent2).fromRed(),h=p.isub(m).imul(u).umod(d).imul(f);return m.iadd(h).imul(r.unblinder).umod(t.modulus).toArrayLike(i,`be`,a)}s.getr=a,t.exports=s})),Tt=n(((e,t)=>{t.exports={name:`elliptic`,version:`6.6.1`,description:`EC cryptography`,main:`lib/elliptic.js`,files:[`lib`],scripts:{lint:`eslint lib test`,"lint:fix":`npm run lint -- --fix`,unit:`istanbul test _mocha --reporter=spec test/index.js`,test:`npm run lint && npm run unit`,version:`grunt dist && git add dist/`},repository:{type:`git`,url:`git@github.com:indutny/elliptic`},keywords:[`EC`,`Elliptic`,`curve`,`Cryptography`],author:`Fedor Indutny <fedor@indutny.com>`,license:`MIT`,bugs:{url:`https://github.com/indutny/elliptic/issues`},homepage:`https://github.com/indutny/elliptic`,devDependencies:{brfs:`^2.0.2`,coveralls:`^3.1.0`,eslint:`^7.6.0`,grunt:`^1.2.1`,"grunt-browserify":`^5.3.0`,"grunt-cli":`^1.3.2`,"grunt-contrib-connect":`^3.0.0`,"grunt-contrib-copy":`^1.0.0`,"grunt-contrib-uglify":`^5.0.0`,"grunt-mocha-istanbul":`^5.0.2`,"grunt-saucelabs":`^9.0.1`,istanbul:`^0.4.5`,mocha:`^8.0.1`},dependencies:{"bn.js":`^4.11.9`,brorand:`^1.1.0`,"hash.js":`^1.0.0`,"hmac-drbg":`^1.0.1`,inherits:`^2.0.4`,"minimalistic-assert":`^1.0.1`,"minimalistic-crypto-utils":`^1.0.1`}}})),Et=n((e=>{var t=e;function n(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if(typeof e!=`string`){for(var r=0;r<e.length;r++)n[r]=e[r]|0;return n}if(t===`hex`){e=e.replace(/[^a-z0-9]+/gi,``),e.length%2!=0&&(e=`0`+e);for(var r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(var r=0;r<e.length;r++){var i=e.charCodeAt(r),a=i>>8,o=i&255;a?n.push(a,o):n.push(o)}return n}t.toArray=n;function r(e){return e.length===1?`0`+e:e}t.zero2=r;function i(e){for(var t=``,n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}t.toHex=i,t.encode=function(e,t){return t===`hex`?i(e):e}})),Dt=n((e=>{var t=e,n=et(),r=Ee(),i=Et();t.assert=r,t.toArray=i.toArray,t.zero2=i.zero2,t.toHex=i.toHex,t.encode=i.encode;function a(e,t,n){var r=Array(Math.max(e.bitLength(),n)+1),i;for(i=0;i<r.length;i+=1)r[i]=0;var a=1<<t+1,o=e.clone();for(i=0;i<r.length;i++){var s,c=o.andln(a-1);o.isOdd()?(s=c>(a>>1)-1?(a>>1)-c:c,o.isubn(s)):s=0,r[i]=s,o.iushrn(1)}return r}t.getNAF=a;function o(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r=0,i=0,a;e.cmpn(-r)>0||t.cmpn(-i)>0;){var o=e.andln(3)+r&3,s=t.andln(3)+i&3;o===3&&(o=-1),s===3&&(s=-1);var c;o&1?(a=e.andln(7)+r&7,c=(a===3||a===5)&&s===2?-o:o):c=0,n[0].push(c);var l;s&1?(a=t.andln(7)+i&7,l=(a===3||a===5)&&o===2?-s:s):l=0,n[1].push(l),2*r===c+1&&(r=1-r),2*i===l+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return n}t.getJSF=o;function s(e,t,n){var r=`_`+t;e.prototype[t]=function(){return this[r]===void 0?this[r]=n.call(this):this[r]}}t.cachedProperty=s;function c(e){return typeof e==`string`?t.toArray(e,`hex`):e}t.parseBytes=c;function l(e){return new n(e,`hex`,`le`)}t.intFromLE=l})),Ot=n(((e,t)=>{var n=et(),r=Dt(),i=r.getNAF,a=r.getJSF,o=r.assert;function s(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}t.exports=s,s.prototype.point=function(){throw Error(`Not implemented`)},s.prototype.validate=function(){throw Error(`Not implemented`)},s.prototype._fixedNafMul=function(e,t){o(e.precomputed);var n=e._getDoubles(),r=i(t,1,this._bitLength),a=(1<<n.step+1)-(n.step%2==0?2:1);a/=3;var s=[],c,l;for(c=0;c<r.length;c+=n.step){l=0;for(var u=c+n.step-1;u>=c;u--)l=(l<<1)+r[u];s.push(l)}for(var d=this.jpoint(null,null,null),f=this.jpoint(null,null,null),p=a;p>0;p--){for(c=0;c<s.length;c++)l=s[c],l===p?f=f.mixedAdd(n.points[c]):l===-p&&(f=f.mixedAdd(n.points[c].neg()));d=d.add(f)}return d.toP()},s.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var a=r.points,s=i(t,n,this._bitLength),c=this.jpoint(null,null,null),l=s.length-1;l>=0;l--){for(var u=0;l>=0&&s[l]===0;l--)u++;if(l>=0&&u++,c=c.dblp(u),l<0)break;var d=s[l];o(d!==0),c=e.type===`affine`?d>0?c.mixedAdd(a[d-1>>1]):c.mixedAdd(a[-d-1>>1].neg()):d>0?c.add(a[d-1>>1]):c.add(a[-d-1>>1].neg())}return e.type===`affine`?c.toP():c},s.prototype._wnafMulAdd=function(e,t,n,r,o){var s=this._wnafT1,c=this._wnafT2,l=this._wnafT3,u=0,d,f,p;for(d=0;d<r;d++){p=t[d];var m=p._getNAFPoints(e);s[d]=m.wnd,c[d]=m.points}for(d=r-1;d>=1;d-=2){var h=d-1,g=d;if(s[h]!==1||s[g]!==1){l[h]=i(n[h],s[h],this._bitLength),l[g]=i(n[g],s[g],this._bitLength),u=Math.max(l[h].length,u),u=Math.max(l[g].length,u);continue}var _=[t[h],null,null,t[g]];t[h].y.cmp(t[g].y)===0?(_[1]=t[h].add(t[g]),_[2]=t[h].toJ().mixedAdd(t[g].neg())):t[h].y.cmp(t[g].y.redNeg())===0?(_[1]=t[h].toJ().mixedAdd(t[g]),_[2]=t[h].add(t[g].neg())):(_[1]=t[h].toJ().mixedAdd(t[g]),_[2]=t[h].toJ().mixedAdd(t[g].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],y=a(n[h],n[g]);for(u=Math.max(y[0].length,u),l[h]=Array(u),l[g]=Array(u),f=0;f<u;f++){var b=y[0][f]|0,x=y[1][f]|0;l[h][f]=v[(b+1)*3+(x+1)],l[g][f]=0,c[h]=_}}var S=this.jpoint(null,null,null),C=this._wnafT4;for(d=u;d>=0;d--){for(var w=0;d>=0;){var T=!0;for(f=0;f<r;f++)C[f]=l[f][d]|0,C[f]!==0&&(T=!1);if(!T)break;w++,d--}if(d>=0&&w++,S=S.dblp(w),d<0)break;for(f=0;f<r;f++){var E=C[f];E!==0&&(E>0?p=c[f][E-1>>1]:E<0&&(p=c[f][-E-1>>1].neg()),S=p.type===`affine`?S.mixedAdd(p):S.add(p))}}for(d=0;d<r;d++)c[d]=null;return o?S:S.toP()};function c(e,t){this.curve=e,this.type=t,this.precomputed=null}s.BasePoint=c,c.prototype.eq=function(){throw Error(`Not implemented`)},c.prototype.validate=function(){return this.curve.validate(this)},s.prototype.decodePoint=function(e,t){e=r.toArray(e,t);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1==2*n)return e[0]===6?o(e[e.length-1]%2==0):e[0]===7&&o(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw Error(`Unknown point format`)},c.prototype.encodeCompressed=function(e){return this.encode(e,!0)},c.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray(`be`,t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray(`be`,t))},c.prototype.encode=function(e,t){return r.encode(this._encode(t),e)},c.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},c.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var a=0;a<e;a++)r=r.dbl();n.push(r)}return{step:e,points:n}},c.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=n===1?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}})),kt=n(((e,t)=>{var n=Dt(),r=et(),i=p(),a=Ot(),o=n.assert;function s(e){a.call(this,`short`,e),this.a=new r(e.a,16).toRed(this.red),this.b=new r(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}i(s,a),t.exports=s,s.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,n;if(e.beta)t=new r(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=i[0].cmp(i[1])<0?i[0]:i[1],t=t.toRed(this.red)}if(e.lambda)n=new r(e.lambda,16);else{var a=this._getEndoRoots(this.n);this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))===0?n=a[0]:(n=a[1],o(this.g.mul(n).x.cmp(this.g.x.redMul(t))===0))}var s=e.basis?e.basis.map(function(e){return{a:new r(e.a,16),b:new r(e.b,16)}}):this._getEndoBasis(n);return{beta:t,lambda:n,basis:s}}},s.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:r.mont(e),n=new r(2).toRed(t).redInvm(),i=n.redNeg(),a=new r(3).toRed(t).redNeg().redSqrt().redMul(n);return[i.redAdd(a).fromRed(),i.redSub(a).fromRed()]},s.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),a=new r(1),o=new r(0),s=new r(0),c=new r(1),l,u,d,f,p,m,h,g=0,_,v;n.cmpn(0)!==0;){var y=i.div(n);_=i.sub(y.mul(n)),v=s.sub(y.mul(a));var b=c.sub(y.mul(o));if(!d&&_.cmp(t)<0)l=h.neg(),u=a,d=_.neg(),f=v;else if(d&&++g===2)break;h=_,i=n,n=_,s=a,a=v,c=o,o=b}p=_.neg(),m=v;var x=d.sqr().add(f.sqr());return p.sqr().add(m.sqr()).cmp(x)>=0&&(p=l,m=u),d.negative&&(d=d.neg(),f=f.neg()),p.negative&&(p=p.neg(),m=m.neg()),[{a:d,b:f},{a:p,b:m}]},s.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),o=i.mul(n.a),s=a.mul(r.a),c=i.mul(n.b),l=a.mul(r.b);return{k1:e.sub(o).sub(s),k2:c.add(l).neg()}},s.prototype.pointFromX=function(e,t){e=new r(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw Error(`invalid point`);var a=i.fromRed().isOdd();return(t&&!a||!t&&a)&&(i=i.redNeg()),this.point(e,i)},s.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return n.redSqr().redISub(i).cmpn(0)===0},s.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,a=0;a<e.length;a++){var o=this._endoSplit(t[a]),s=e[a],c=s._getBeta();o.k1.negative&&(o.k1.ineg(),s=s.neg(!0)),o.k2.negative&&(o.k2.ineg(),c=c.neg(!0)),r[a*2]=s,r[a*2+1]=c,i[a*2]=o.k1,i[a*2+1]=o.k2}for(var l=this._wnafMulAdd(1,r,i,a*2,n),u=0;u<a*2;u++)r[u]=null,i[u]=null;return l};function c(e,t,n,i){a.BasePoint.call(this,e,`affine`),t===null&&n===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new r(t,16),this.y=new r(n,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}i(c,a.BasePoint),s.prototype.point=function(e,t,n){return new c(this,e,t,n)},s.prototype.pointFromJSON=function(e,t){return c.fromJSON(this,e,t)},c.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(e,t,n){typeof t==`string`&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var a=t[2];return r.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[r].concat(a.doubles.points.map(i))},naf:a.naf&&{wnd:a.naf.wnd,points:[r].concat(a.naf.points.map(i))}},r},c.prototype.inspect=function(){return this.isInfinity()?`<EC Point Infinity>`:`<EC Point x: `+this.x.fromRed().toString(16,2)+` y: `+this.y.fromRed().toString(16,2)+`>`},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},c.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),a=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(e){return e=new r(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},c.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},c.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},c.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)};function l(e,t,n,i){a.BasePoint.call(this,e,`jacobian`),t===null&&n===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new r(0)):(this.x=new r(t,16),this.y=new r(n,16),this.z=new r(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}i(l,a.BasePoint),s.prototype.jpoint=function(e,t,n){return new l(this,e,t,n)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),a=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),c=a.redSub(o);if(s.cmpn(0)===0)return c.cmpn(0)===0?this.dbl():this.curve.jpoint(null,null,null);var l=s.redSqr(),u=l.redMul(s),d=r.redMul(l),f=c.redSqr().redIAdd(u).redISub(d).redISub(d),p=c.redMul(d.redISub(f)).redISub(a.redMul(u)),m=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,p,m)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,a=e.y.redMul(t).redMul(this.z),o=n.redSub(r),s=i.redSub(a);if(o.cmpn(0)===0)return s.cmpn(0)===0?this.dbl():this.curve.jpoint(null,null,null);var c=o.redSqr(),l=c.redMul(o),u=n.redMul(c),d=s.redSqr().redIAdd(l).redISub(u).redISub(u),f=s.redMul(u.redISub(d)).redISub(i.redMul(l)),p=this.z.redMul(o);return this.curve.jpoint(d,f,p)},l.prototype.dblp=function(e){if(e===0||this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,a=this.x,o=this.y,s=this.z,c=s.redSqr().redSqr(),l=o.redAdd(o);for(t=0;t<e;t++){var u=a.redSqr(),d=l.redSqr(),f=d.redSqr(),p=u.redAdd(u).redIAdd(u).redIAdd(r.redMul(c)),m=a.redMul(d),h=p.redSqr().redISub(m.redAdd(m)),g=m.redISub(h),_=p.redMul(g);_=_.redIAdd(_).redISub(f);var v=l.redMul(s);t+1<e&&(c=c.redMul(f)),a=h,s=v,l=_}return this.curve.jpoint(a,l.redMul(i),s)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(a);o=o.redIAdd(o);var s=r.redAdd(r).redIAdd(r),c=s.redSqr().redISub(o).redISub(o),l=a.redIAdd(a);l=l.redIAdd(l),l=l.redIAdd(l),e=c,t=s.redMul(o.redISub(c)).redISub(l),n=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),p=this.x.redAdd(d).redSqr().redISub(u).redISub(f);p=p.redIAdd(p);var m=u.redAdd(u).redIAdd(u),h=m.redSqr(),g=f.redIAdd(f);g=g.redIAdd(g),g=g.redIAdd(g),e=h.redISub(p).redISub(p),t=m.redMul(p.redISub(e)).redISub(g),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,t,n)},l.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(a);o=o.redIAdd(o);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),c=s.redSqr().redISub(o).redISub(o);e=c;var l=a.redIAdd(a);l=l.redIAdd(l),l=l.redIAdd(l),t=s.redMul(o.redISub(c)).redISub(l),n=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),p=this.x.redSub(u).redMul(this.x.redAdd(u));p=p.redAdd(p).redIAdd(p);var m=f.redIAdd(f);m=m.redIAdd(m);var h=m.redAdd(m);e=p.redSqr().redISub(h),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(u);var g=d.redSqr();g=g.redIAdd(g),g=g.redIAdd(g),g=g.redIAdd(g),t=p.redMul(m.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,n)},l.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),a=t.redSqr(),o=n.redSqr(),s=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(i)),c=t.redAdd(t);c=c.redIAdd(c);var l=c.redMul(o),u=s.redSqr().redISub(l.redAdd(l)),d=l.redISub(u),f=o.redSqr();f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var p=s.redMul(d).redISub(f),m=n.redAdd(n).redMul(r);return this.curve.jpoint(u,p,m)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),a=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(r);o=o.redIAdd(o),o=o.redAdd(o).redIAdd(o),o=o.redISub(a);var s=o.redSqr(),c=r.redIAdd(r);c=c.redIAdd(c),c=c.redIAdd(c),c=c.redIAdd(c);var l=i.redIAdd(o).redSqr().redISub(a).redISub(s).redISub(c),u=t.redMul(l);u=u.redIAdd(u),u=u.redIAdd(u);var d=this.x.redMul(s).redISub(u);d=d.redIAdd(d),d=d.redIAdd(d);var f=this.y.redMul(l.redMul(c.redISub(l)).redISub(o.redMul(s)));f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var p=this.z.redAdd(o).redSqr().redISub(n).redISub(s);return this.curve.jpoint(d,f,p)},l.prototype.mul=function(e,t){return e=new r(e,t),this.curve._wnafMul(this,e)},l.prototype.eq=function(e){if(e.type===`affine`)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)===0},l.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(n)===0)return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),this.x.cmp(n)===0)return!0}},l.prototype.inspect=function(){return this.isInfinity()?`<EC JPoint Infinity>`:`<EC JPoint x: `+this.x.toString(16,2)+` y: `+this.y.toString(16,2)+` z: `+this.z.toString(16,2)+`>`},l.prototype.isInfinity=function(){return this.z.cmpn(0)===0}})),At=n(((e,t)=>{var n=et(),r=p(),i=Ot(),a=Dt();function o(e){i.call(this,`mont`,e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}r(o,i),t.exports=o,o.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return r.redSqrt().redSqr().cmp(r)===0};function s(e,t,r){i.BasePoint.call(this,e,`projective`),t===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}r(s,i.BasePoint),o.prototype.decodePoint=function(e,t){return this.point(a.toArray(e,t),1)},o.prototype.point=function(e,t){return new s(this,e,t)},o.prototype.pointFromJSON=function(e){return s.fromJSON(this,e)},s.prototype.precompute=function(){},s.prototype._encode=function(){return this.getX().toArray(`be`,this.curve.p.byteLength())},s.fromJSON=function(e,t){return new s(e,t[0],t[1]||e.one)},s.prototype.inspect=function(){return this.isInfinity()?`<EC Point Infinity>`:`<EC Point x: `+this.x.fromRed().toString(16,2)+` z: `+this.z.fromRed().toString(16,2)+`>`},s.prototype.isInfinity=function(){return this.z.cmpn(0)===0},s.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},s.prototype.add=function(){throw Error(`Not supported on Montgomery curve`)},s.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(n),o=i.redMul(r),s=t.z.redMul(a.redAdd(o).redSqr()),c=t.x.redMul(a.redISub(o).redSqr());return this.curve.point(s,c)},s.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=this,a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var o=a.length-1;o>=0;o--)a[o]===0?(n=n.diffAdd(r,i),r=r.dbl()):(r=n.diffAdd(r,i),n=n.dbl());return r},s.prototype.mulAdd=function(){throw Error(`Not supported on Montgomery curve`)},s.prototype.jumlAdd=function(){throw Error(`Not supported on Montgomery curve`)},s.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},s.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},s.prototype.getX=function(){return this.normalize(),this.x.fromRed()}})),jt=n(((e,t)=>{var n=Dt(),r=et(),i=p(),a=Ot(),o=n.assert;function s(e){this.twisted=(e.a|0)!=1,this.mOneA=this.twisted&&(e.a|0)==-1,this.extended=this.mOneA,a.call(this,`edwards`,e),this.a=new r(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new r(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new r(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),o(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(e.c|0)==1}i(s,a),t.exports=s,s.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},s.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},s.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},s.prototype.pointFromX=function(e,t){e=new r(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),a=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(a.redInvm()),s=o.redSqrt();if(s.redSqr().redSub(o).cmp(this.zero)!==0)throw Error(`invalid point`);var c=s.fromRed().isOdd();return(t&&!c||!t&&c)&&(s=s.redNeg()),this.point(e,s)},s.prototype.pointFromY=function(e,t){e=new r(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),a=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(a.redInvm());if(o.cmp(this.zero)===0){if(t)throw Error(`invalid point`);return this.point(this.zero,e)}var s=o.redSqrt();if(s.redSqr().redSub(o).cmp(this.zero)!==0)throw Error(`invalid point`);return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},s.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return r.cmp(i)===0};function c(e,t,n,i,o){a.BasePoint.call(this,e,`projective`),t===null&&n===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new r(t,16),this.y=new r(n,16),this.z=i?new r(i,16):this.curve.one,this.t=o&&new r(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}i(c,a.BasePoint),s.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},s.prototype.point=function(e,t,n,r){return new c(this,e,t,n,r)},c.fromJSON=function(e,t){return new c(e,t[0],t[1],t[2])},c.prototype.inspect=function(){return this.isInfinity()?`<EC Point Infinity>`:`<EC Point x: `+this.x.fromRed().toString(16,2)+` y: `+this.y.fromRed().toString(16,2)+` z: `+this.z.fromRed().toString(16,2)+`>`},c.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=r.redAdd(t),o=a.redSub(n),s=r.redSub(t),c=i.redMul(o),l=a.redMul(s),u=i.redMul(s),d=o.redMul(a);return this.curve.point(c,l,d,u)},c.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),n=this.y.redSqr(),r,i,a,o,s,c;if(this.curve.twisted){o=this.curve._mulA(t);var l=o.redAdd(n);this.zOne?(r=e.redSub(t).redSub(n).redMul(l.redSub(this.curve.two)),i=l.redMul(o.redSub(n)),a=l.redSqr().redSub(l).redSub(l)):(s=this.z.redSqr(),c=l.redSub(s).redISub(s),r=e.redSub(t).redISub(n).redMul(c),i=l.redMul(o.redSub(n)),a=l.redMul(c))}else o=t.redAdd(n),s=this.curve._mulC(this.z).redSqr(),c=o.redSub(s).redSub(s),r=this.curve._mulC(e.redISub(o)).redMul(c),i=this.curve._mulC(o).redMul(t.redISub(n)),a=o.redMul(c);return this.curve.point(r,i,a)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),a=n.redSub(t),o=i.redSub(r),s=i.redAdd(r),c=n.redAdd(t),l=a.redMul(o),u=s.redMul(c),d=a.redMul(c),f=o.redMul(s);return this.curve.point(l,u,f,d)},c.prototype._projAdd=function(e){var t=this.z.redMul(e.z),n=t.redSqr(),r=this.x.redMul(e.x),i=this.y.redMul(e.y),a=this.curve.d.redMul(r).redMul(i),o=n.redSub(a),s=n.redAdd(a),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(r).redISub(i),l=t.redMul(o).redMul(c),u,d;return this.curve.twisted?(u=t.redMul(s).redMul(i.redSub(this.curve._mulA(r))),d=o.redMul(s)):(u=t.redMul(s).redMul(i.redSub(r)),d=this.curve._mulC(o).redMul(s)),this.curve.point(l,u,d)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},c.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&=this.t.redMul(e),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),this.x.cmp(t)===0)return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add})),Mt=n((e=>{var t=e;t.base=Ot(),t.short=kt(),t.mont=At(),t.edwards=jt()})),Nt=n((e=>{var t=Ee();e.inherits=p();function n(e,t){return(e.charCodeAt(t)&64512)!=55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)==56320}function r(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e==`string`){if(!t)for(var i=0,a=0;a<e.length;a++){var o=e.charCodeAt(a);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=o&63|128):n(e,a)?(o=65536+((o&1023)<<10)+(e.charCodeAt(++a)&1023),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=o&63|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=o&63|128)}else if(t===`hex`)for(e=e.replace(/[^a-z0-9]+/gi,``),e.length%2!=0&&(e=`0`+e),a=0;a<e.length;a+=2)r.push(parseInt(e[a]+e[a+1],16))}else for(a=0;a<e.length;a++)r[a]=e[a]|0;return r}e.toArray=r;function i(e){for(var t=``,n=0;n<e.length;n++)t+=s(e[n].toString(16));return t}e.toHex=i;function a(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24)>>>0}e.htonl=a;function o(e,t){for(var n=``,r=0;r<e.length;r++){var i=e[r];t===`little`&&(i=a(i)),n+=c(i.toString(16))}return n}e.toHex32=o;function s(e){return e.length===1?`0`+e:e}e.zero2=s;function c(e){return e.length===7?`0`+e:e.length===6?`00`+e:e.length===5?`000`+e:e.length===4?`0000`+e:e.length===3?`00000`+e:e.length===2?`000000`+e:e.length===1?`0000000`+e:e}e.zero8=c;function l(e,n,r,i){var a=r-n;t(a%4==0);for(var o=Array(a/4),s=0,c=n;s<o.length;s++,c+=4)o[s]=(i===`big`?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c])>>>0;return o}e.join32=l;function u(e,t){for(var n=Array(e.length*4),r=0,i=0;r<e.length;r++,i+=4){var a=e[r];t===`big`?(n[i]=a>>>24,n[i+1]=a>>>16&255,n[i+2]=a>>>8&255,n[i+3]=a&255):(n[i+3]=a>>>24,n[i+2]=a>>>16&255,n[i+1]=a>>>8&255,n[i]=a&255)}return n}e.split32=u;function d(e,t){return e>>>t|e<<32-t}e.rotr32=d;function f(e,t){return e<<t|e>>>32-t}e.rotl32=f;function m(e,t){return e+t>>>0}e.sum32=m;function h(e,t,n){return e+t+n>>>0}e.sum32_3=h;function g(e,t,n,r){return e+t+n+r>>>0}e.sum32_4=g;function _(e,t,n,r,i){return e+t+n+r+i>>>0}e.sum32_5=_;function v(e,t,n,r){var i=e[t],a=r+e[t+1]>>>0;e[t]=+(a<r)+n+i>>>0,e[t+1]=a}e.sum64=v;function y(e,t,n,r){return+(t+r>>>0<t)+e+n>>>0}e.sum64_hi=y;function b(e,t,n,r){return t+r>>>0}e.sum64_lo=b;function x(e,t,n,r,i,a,o,s){var c=0,l=t;return l=l+r>>>0,c+=+(l<t),l=l+a>>>0,c+=+(l<a),l=l+s>>>0,c+=+(l<s),e+n+i+o+c>>>0}e.sum64_4_hi=x;function S(e,t,n,r,i,a,o,s){return t+r+a+s>>>0}e.sum64_4_lo=S;function C(e,t,n,r,i,a,o,s,c,l){var u=0,d=t;return d=d+r>>>0,u+=+(d<t),d=d+a>>>0,u+=+(d<a),d=d+s>>>0,u+=+(d<s),d=d+l>>>0,u+=+(d<l),e+n+i+o+c+u>>>0}e.sum64_5_hi=C;function w(e,t,n,r,i,a,o,s,c,l){return t+r+a+s+l>>>0}e.sum64_5_lo=w;function T(e,t,n){return(t<<32-n|e>>>n)>>>0}e.rotr64_hi=T;function E(e,t,n){return(e<<32-n|t>>>n)>>>0}e.rotr64_lo=E;function D(e,t,n){return e>>>n}e.shr64_hi=D;function O(e,t,n){return(e<<32-n|t>>>n)>>>0}e.shr64_lo=O})),Pt=n((e=>{var t=Nt(),n=Ee();function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian=`big`,this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=r,r.prototype.update=function(e,n){if(e=t.toArray(e,n),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=t.join32(e,0,e.length-r,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},r.prototype.digest=function(e){return this.update(this._pad()),n(this.pending===null),this._digest(e)},r.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=3,this.endian===`big`){for(var a=8;a<this.padLength;a++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=e&255}else for(r[i++]=e&255,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,a=8;a<this.padLength;a++)r[i++]=0;return r}})),Ft=n((e=>{var t=Nt().rotr32;function n(e,t,n,o){if(e===0)return r(t,n,o);if(e===1||e===3)return a(t,n,o);if(e===2)return i(t,n,o)}e.ft_1=n;function r(e,t,n){return e&t^~e&n}e.ch32=r;function i(e,t,n){return e&t^e&n^t&n}e.maj32=i;function a(e,t,n){return e^t^n}e.p32=a;function o(e){return t(e,2)^t(e,13)^t(e,22)}e.s0_256=o;function s(e){return t(e,6)^t(e,11)^t(e,25)}e.s1_256=s;function c(e){return t(e,7)^t(e,18)^e>>>3}e.g0_256=c;function l(e){return t(e,17)^t(e,19)^e>>>10}e.g1_256=l})),It=n(((e,t)=>{var n=Nt(),r=Pt(),i=Ft(),a=n.rotl32,o=n.sum32,s=n.sum32_5,c=i.ft_1,l=r.BlockHash,u=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}n.inherits(d,l),t.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=a(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],l=this.h[1],d=this.h[2],f=this.h[3],p=this.h[4];for(r=0;r<n.length;r++){var m=~~(r/20),h=s(a(i,5),c(m,l,d,f),p,n[r],u[m]);p=f,f=d,d=a(l,30),l=i,i=h}this.h[0]=o(this.h[0],i),this.h[1]=o(this.h[1],l),this.h[2]=o(this.h[2],d),this.h[3]=o(this.h[3],f),this.h[4]=o(this.h[4],p)},d.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h,`big`):n.split32(this.h,`big`)}})),Lt=n(((e,t)=>{var n=Nt(),r=Pt(),i=Ft(),a=Ee(),o=n.sum32,s=n.sum32_4,c=n.sum32_5,l=i.ch32,u=i.maj32,d=i.s0_256,f=i.s1_256,p=i.g0_256,m=i.g1_256,h=r.BlockHash,g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function _(){if(!(this instanceof _))return new _;h.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=Array(64)}n.inherits(_,h),t.exports=_,_.blockSize=512,_.outSize=256,_.hmacStrength=192,_.padLength=64,_.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=s(m(n[r-2]),n[r-7],p(n[r-15]),n[r-16]);var i=this.h[0],h=this.h[1],g=this.h[2],_=this.h[3],v=this.h[4],y=this.h[5],b=this.h[6],x=this.h[7];for(a(this.k.length===n.length),r=0;r<n.length;r++){var S=c(x,f(v),l(v,y,b),this.k[r],n[r]),C=o(d(i),u(i,h,g));x=b,b=y,y=v,v=o(_,S),_=g,g=h,h=i,i=o(S,C)}this.h[0]=o(this.h[0],i),this.h[1]=o(this.h[1],h),this.h[2]=o(this.h[2],g),this.h[3]=o(this.h[3],_),this.h[4]=o(this.h[4],v),this.h[5]=o(this.h[5],y),this.h[6]=o(this.h[6],b),this.h[7]=o(this.h[7],x)},_.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h,`big`):n.split32(this.h,`big`)}})),Rt=n(((e,t)=>{var n=Nt(),r=Lt();function i(){if(!(this instanceof i))return new i;r.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(i,r),t.exports=i,i.blockSize=512,i.outSize=224,i.hmacStrength=192,i.padLength=64,i.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h.slice(0,7),`big`):n.split32(this.h.slice(0,7),`big`)}})),zt=n(((e,t)=>{var n=Nt(),r=Pt(),i=Ee(),a=n.rotr64_hi,o=n.rotr64_lo,s=n.shr64_hi,c=n.shr64_lo,l=n.sum64,u=n.sum64_hi,d=n.sum64_lo,f=n.sum64_4_hi,p=n.sum64_4_lo,m=n.sum64_5_hi,h=n.sum64_5_lo,g=r.BlockHash,_=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=_,this.W=Array(160)}n.inherits(v,g),t.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;r<32;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=k(n[r-4],n[r-3]),a=A(n[r-4],n[r-3]),o=n[r-14],s=n[r-13],c=D(n[r-30],n[r-29]),l=O(n[r-30],n[r-29]),u=n[r-32],d=n[r-31];n[r]=f(i,a,o,s,c,l,u,d),n[r+1]=p(i,a,o,s,c,l,u,d)}},v.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,r=this.h[0],a=this.h[1],o=this.h[2],s=this.h[3],c=this.h[4],f=this.h[5],p=this.h[6],g=this.h[7],_=this.h[8],v=this.h[9],D=this.h[10],O=this.h[11],k=this.h[12],A=this.h[13],ee=this.h[14],j=this.h[15];i(this.k.length===n.length);for(var M=0;M<n.length;M+=2){var te=ee,N=j,P=T(_,v),ne=E(_,v),F=y(_,v,D,O,k,A),I=b(_,v,D,O,k,A),re=this.k[M],L=this.k[M+1],R=n[M],ie=n[M+1],z=m(te,N,P,ne,F,I,re,L,R,ie),B=h(te,N,P,ne,F,I,re,L,R,ie);te=C(r,a),N=w(r,a),P=x(r,a,o,s,c,f),ne=S(r,a,o,s,c,f);var ae=u(te,N,P,ne),V=d(te,N,P,ne);ee=k,j=A,k=D,A=O,D=_,O=v,_=u(p,g,z,B),v=d(g,g,z,B),p=c,g=f,c=o,f=s,o=r,s=a,r=u(z,B,ae,V),a=d(z,B,ae,V)}l(this.h,0,r,a),l(this.h,2,o,s),l(this.h,4,c,f),l(this.h,6,p,g),l(this.h,8,_,v),l(this.h,10,D,O),l(this.h,12,k,A),l(this.h,14,ee,j)},v.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h,`big`):n.split32(this.h,`big`)};function y(e,t,n,r,i){var a=e&n^~e&i;return a<0&&(a+=4294967296),a}function b(e,t,n,r,i,a){var o=t&r^~t&a;return o<0&&(o+=4294967296),o}function x(e,t,n,r,i){var a=e&n^e&i^n&i;return a<0&&(a+=4294967296),a}function S(e,t,n,r,i,a){var o=t&r^t&a^r&a;return o<0&&(o+=4294967296),o}function C(e,t){var n=a(e,t,28),r=a(t,e,2),i=a(t,e,7),o=n^r^i;return o<0&&(o+=4294967296),o}function w(e,t){var n=o(e,t,28),r=o(t,e,2),i=o(t,e,7),a=n^r^i;return a<0&&(a+=4294967296),a}function T(e,t){var n=a(e,t,14),r=a(e,t,18),i=a(t,e,9),o=n^r^i;return o<0&&(o+=4294967296),o}function E(e,t){var n=o(e,t,14),r=o(e,t,18),i=o(t,e,9),a=n^r^i;return a<0&&(a+=4294967296),a}function D(e,t){var n=a(e,t,1),r=a(e,t,8),i=s(e,t,7),o=n^r^i;return o<0&&(o+=4294967296),o}function O(e,t){var n=o(e,t,1),r=o(e,t,8),i=c(e,t,7),a=n^r^i;return a<0&&(a+=4294967296),a}function k(e,t){var n=a(e,t,19),r=a(t,e,29),i=s(e,t,6),o=n^r^i;return o<0&&(o+=4294967296),o}function A(e,t){var n=o(e,t,19),r=o(t,e,29),i=c(e,t,6),a=n^r^i;return a<0&&(a+=4294967296),a}})),Bt=n(((e,t)=>{var n=Nt(),r=zt();function i(){if(!(this instanceof i))return new i;r.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(i,r),t.exports=i,i.blockSize=1024,i.outSize=384,i.hmacStrength=192,i.padLength=128,i.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h.slice(0,12),`big`):n.split32(this.h.slice(0,12),`big`)}})),Vt=n((e=>{e.sha1=It(),e.sha224=Rt(),e.sha256=Lt(),e.sha384=Bt(),e.sha512=zt()})),Ht=n((e=>{var t=Nt(),n=Pt(),r=t.rotl32,i=t.sum32,a=t.sum32_3,o=t.sum32_4,s=n.BlockHash;function c(){if(!(this instanceof c))return new c;s.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian=`little`}t.inherits(c,s),e.ripemd160=c,c.blockSize=512,c.outSize=160,c.hmacStrength=192,c.padLength=64,c.prototype._update=function(e,t){for(var n=this.h[0],s=this.h[1],c=this.h[2],g=this.h[3],_=this.h[4],v=n,y=s,b=c,x=g,S=_,C=0;C<80;C++){var w=i(r(o(n,l(C,s,c,g),e[f[C]+t],u(C)),m[C]),_);n=_,_=g,g=r(c,10),c=s,s=w,w=i(r(o(v,l(79-C,y,b,x),e[p[C]+t],d(C)),h[C]),S),v=S,S=x,x=r(b,10),b=y,y=w}w=a(this.h[1],c,x),this.h[1]=a(this.h[2],g,S),this.h[2]=a(this.h[3],_,v),this.h[3]=a(this.h[4],n,y),this.h[4]=a(this.h[0],s,b),this.h[0]=w},c.prototype._digest=function(e){return e===`hex`?t.toHex32(this.h,`little`):t.split32(this.h,`little`)};function l(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function u(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function d(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],p=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],h=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]})),Ut=n(((e,t)=>{var n=Nt(),r=Ee();function i(e,t,r){if(!(this instanceof i))return new i(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}t.exports=i,i.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),r(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},i.prototype.update=function(e,t){return this.inner.update(e,t),this},i.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}})),Wt=n((e=>{var t=e;t.utils=Nt(),t.common=Pt(),t.sha=Vt(),t.ripemd=Ht(),t.hmac=Ut(),t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160})),Gt=n(((e,t)=>{t.exports={doubles:{step:4,points:[[`e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a`,`f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821`],[`8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508`,`11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf`],[`175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739`,`d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695`],[`363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640`,`4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9`],[`8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c`,`4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36`],[`723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda`,`96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f`],[`eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa`,`5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999`],[`100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0`,`cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09`],[`e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d`,`9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d`],[`feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d`,`e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088`],[`da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1`,`9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d`],[`53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0`,`5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8`],[`8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047`,`10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a`],[`385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862`,`283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453`],[`6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7`,`7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160`],[`3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd`,`56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0`],[`85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83`,`7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6`],[`948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a`,`53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589`],[`6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8`,`bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17`],[`e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d`,`4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda`],[`e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725`,`7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd`],[`213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754`,`4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2`],[`4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c`,`17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6`],[`fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6`,`6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f`],[`76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39`,`c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01`],[`c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891`,`893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3`],[`d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b`,`febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f`],[`b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03`,`2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7`],[`e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d`,`eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78`],[`a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070`,`7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1`],[`90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4`,`e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150`],[`8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da`,`662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82`],[`e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11`,`1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc`],[`8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e`,`efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b`],[`e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41`,`2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51`],[`b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef`,`67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45`],[`d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8`,`db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120`],[`324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d`,`648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84`],[`4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96`,`35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d`],[`9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd`,`ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d`],[`6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5`,`9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8`],[`a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266`,`40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8`],[`7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71`,`34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac`],[`928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac`,`c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f`],[`85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751`,`1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962`],[`ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e`,`493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907`],[`827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241`,`c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec`],[`eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3`,`be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d`],[`e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f`,`4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414`],[`1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19`,`aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd`],[`146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be`,`b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0`],[`fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9`,`6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811`],[`da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2`,`8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1`],[`a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13`,`7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c`],[`174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c`,`ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73`],[`959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba`,`2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd`],[`d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151`,`e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405`],[`64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073`,`d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589`],[`8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458`,`38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e`],[`13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b`,`69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27`],[`bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366`,`d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1`],[`8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa`,`40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482`],[`8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0`,`620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945`],[`dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787`,`7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573`],[`f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e`,`ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82`]]},naf:{wnd:7,points:[[`f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9`,`388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672`],[`2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4`,`d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6`],[`5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc`,`6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da`],[`acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe`,`cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37`],[`774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb`,`d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b`],[`f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8`,`ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81`],[`d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e`,`581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58`],[`defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34`,`4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77`],[`2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c`,`85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a`],[`352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5`,`321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c`],[`2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f`,`2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67`],[`9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714`,`73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402`],[`daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729`,`a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55`],[`c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db`,`2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482`],[`6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4`,`e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82`],[`1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5`,`b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396`],[`605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479`,`2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49`],[`62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d`,`80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf`],[`80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f`,`1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a`],[`7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb`,`d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7`],[`d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9`,`eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933`],[`49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963`,`758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a`],[`77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74`,`958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6`],[`f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530`,`e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37`],[`463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b`,`5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e`],[`f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247`,`cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6`],[`caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1`,`cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476`],[`2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120`,`4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40`],[`7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435`,`91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61`],[`754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18`,`673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683`],[`e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8`,`59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5`],[`186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb`,`3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b`],[`df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f`,`55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417`],[`5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143`,`efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868`],[`290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba`,`e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a`],[`af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45`,`f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6`],[`766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a`,`744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996`],[`59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e`,`c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e`],[`f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8`,`e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d`],[`7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c`,`30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2`],[`948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519`,`e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e`],[`7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab`,`100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437`],[`3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca`,`ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311`],[`d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf`,`8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4`],[`1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610`,`68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575`],[`733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4`,`f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d`],[`15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c`,`d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d`],[`a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940`,`edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629`],[`e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980`,`a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06`],[`311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3`,`66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374`],[`34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf`,`9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee`],[`f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63`,`4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1`],[`d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448`,`fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b`],[`32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf`,`5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661`],[`7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5`,`8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6`],[`ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6`,`8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e`],[`16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5`,`5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d`],[`eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99`,`f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc`],[`78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51`,`f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4`],[`494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5`,`42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c`],[`a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5`,`204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b`],[`c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997`,`4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913`],[`841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881`,`73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154`],[`5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5`,`39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865`],[`36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66`,`d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc`],[`336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726`,`ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224`],[`8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede`,`6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e`],[`1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94`,`60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6`],[`85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31`,`3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511`],[`29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51`,`b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b`],[`a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252`,`ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2`],[`4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5`,`cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c`],[`d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b`,`6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3`],[`ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4`,`322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d`],[`af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f`,`6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700`],[`e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889`,`2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4`],[`591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246`,`b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196`],[`11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984`,`998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4`],[`3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a`,`b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257`],[`cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030`,`bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13`],[`c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197`,`6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096`],[`c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593`,`c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38`],[`a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef`,`21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f`],[`347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38`,`60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448`],[`da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a`,`49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a`],[`c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111`,`5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4`],[`4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502`,`7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437`],[`3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea`,`be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7`],[`cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26`,`8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d`],[`b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986`,`39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a`],[`d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e`,`62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54`],[`48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4`,`25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77`],[`dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda`,`ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517`],[`6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859`,`cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10`],[`e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f`,`f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125`],[`eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c`,`6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e`],[`13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942`,`fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1`],[`ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a`,`1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2`],[`b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80`,`5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423`],[`ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d`,`438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8`],[`8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1`,`cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758`],[`52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63`,`c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375`],[`e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352`,`6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d`],[`7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193`,`ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec`],[`5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00`,`9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0`],[`32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58`,`ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c`],[`e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7`,`d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4`],[`8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8`,`c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f`],[`4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e`,`67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649`],[`3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d`,`cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826`],[`674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b`,`299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5`],[`d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f`,`f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87`],[`30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6`,`462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b`],[`be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297`,`62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc`],[`93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a`,`7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c`],[`b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c`,`ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f`],[`d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52`,`4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a`],[`d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb`,`bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46`],[`463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065`,`bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f`],[`7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917`,`603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03`],[`74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9`,`cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08`],[`30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3`,`553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8`],[`9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57`,`712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373`],[`176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66`,`ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3`],[`75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8`,`9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8`],[`809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721`,`9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1`],[`1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180`,`4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9`]]}}})),Kt=n((e=>{var t=e,n=Wt(),r=Mt(),i=Dt().assert;function a(e){e.type===`short`?this.curve=new r.short(e):e.type===`edwards`?this.curve=new r.edwards(e):this.curve=new r.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),`Invalid curve`),i(this.g.mul(this.n).isInfinity(),`Invalid curve, G*N != O`)}t.PresetCurve=a;function o(e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){var r=new a(n);return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:r}),r}})}o(`p192`,{type:`short`,prime:`p192`,p:`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff`,a:`ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc`,b:`64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1`,n:`ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831`,hash:n.sha256,gRed:!1,g:[`188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012`,`07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811`]}),o(`p224`,{type:`short`,prime:`p224`,p:`ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001`,a:`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe`,b:`b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4`,n:`ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d`,hash:n.sha256,gRed:!1,g:[`b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21`,`bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34`]}),o(`p256`,{type:`short`,prime:null,p:`ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff`,a:`ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc`,b:`5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b`,n:`ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551`,hash:n.sha256,gRed:!1,g:[`6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296`,`4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5`]}),o(`p384`,{type:`short`,prime:null,p:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff`,a:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc`,b:`b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef`,n:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973`,hash:n.sha384,gRed:!1,g:[`aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7`,`3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f`]}),o(`p521`,{type:`short`,prime:null,p:`000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff`,a:`000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc`,b:`00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00`,n:`000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409`,hash:n.sha512,gRed:!1,g:[`000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66`,`00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650`]}),o(`curve25519`,{type:`mont`,prime:`p25519`,p:`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`,a:`76d06`,b:`1`,n:`1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed`,hash:n.sha256,gRed:!1,g:[`9`]}),o(`ed25519`,{type:`edwards`,prime:`p25519`,p:`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`,a:`-1`,c:`1`,d:`52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3`,n:`1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed`,hash:n.sha256,gRed:!1,g:[`216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a`,`6666666666666666666666666666666666666666666666666666666666666658`]});var s;try{s=Gt()}catch{s=void 0}o(`secp256k1`,{type:`short`,prime:`k256`,p:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`,a:`0`,b:`7`,n:`ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141`,h:`1`,hash:n.sha256,beta:`7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee`,lambda:`5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72`,basis:[{a:`3086d221a7d46bcde86c90e49284eb15`,b:`-e4437ed6010e88286f547fa90abfe4c3`},{a:`114ca50f7a8e2f3f657c1108d9d44cfd8`,b:`3086d221a7d46bcde86c90e49284eb15`}],gRed:!1,g:[`79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798`,`483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8`,s]})})),qt=n(((e,t)=>{var n=Wt(),r=Et(),i=Ee();function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=r.toArray(e.entropy,e.entropyEnc||`hex`),n=r.toArray(e.nonce,e.nonceEnc||`hex`),o=r.toArray(e.pers,e.persEnc||`hex`);i(t.length>=this.minEntropy/8,`Not enough entropy. Minimum is: `+this.minEntropy+` bits`),this._init(t,n,o)}t.exports=a,a.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},a.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(e,t,n,a){typeof t!=`string`&&(a=n,n=t,t=null),e=r.toArray(e,t),n=r.toArray(n,a),i(e.length>=this.minEntropy/8,`Not enough entropy. Minimum is: `+this.minEntropy+` bits`),this._update(e.concat(n||[])),this._reseed=1},a.prototype.generate=function(e,t,n,i){if(this._reseed>this.reseedInterval)throw Error(`Reseed is required`);typeof t!=`string`&&(i=n,n=t,t=null),n&&(n=r.toArray(n,i||`hex`),this._update(n));for(var a=[];a.length<e;)this.V=this._hmac().update(this.V).digest(),a=a.concat(this.V);var o=a.slice(0,e);return this._update(n),this._reseed++,r.encode(o,t)}})),Jt=n(((e,t)=>{var n=et(),r=Dt().assert;function i(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}t.exports=i,i.fromPublic=function(e,t,n){return t instanceof i?t:new i(e,{pub:t,pubEnc:n})},i.fromPrivate=function(e,t,n){return t instanceof i?t:new i(e,{priv:t,privEnc:n})},i.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:`Invalid public key`}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:`Public key * N != O`}:{result:!1,reason:`Public key is not a point`}},i.prototype.getPublic=function(e,t){return typeof e==`string`&&(t=e,e=null),this.pub||=this.ec.g.mul(this.priv),t?this.pub.encode(t,e):this.pub},i.prototype.getPrivate=function(e){return e===`hex`?this.priv.toString(16,2):this.priv},i.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},i.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type===`mont`?r(e.x,`Need x coordinate`):(this.ec.curve.type===`short`||this.ec.curve.type===`edwards`)&&r(e.x&&e.y,`Need both x and y coordinate`),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},i.prototype.derive=function(e){return e.validate()||r(e.validate(),`public point not validated`),e.mul(this.priv).getX()},i.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},i.prototype.verify=function(e,t,n){return this.ec.verify(e,t,this,void 0,n)},i.prototype.inspect=function(){return`<Key priv: `+(this.priv&&this.priv.toString(16,2))+` pub: `+(this.pub&&this.pub.inspect())+` >`}})),Yt=n(((e,t)=>{var n=et(),r=Dt(),i=r.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(i(e.r&&e.s,`Signature without r or s`),this.r=new n(e.r,16),this.s=new n(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}t.exports=a;function o(){this.place=0}function s(e,t){var n=e[t.place++];if(!(n&128))return n;var r=n&15;if(r===0||r>4||e[t.place]===0)return!1;for(var i=0,a=0,o=t.place;a<r;a++,o++)i<<=8,i|=e[o],i>>>=0;return i<=127?!1:(t.place=o,i)}function c(e){for(var t=0,n=e.length-1;!e[t]&&!(e[t+1]&128)&&t<n;)t++;return t===0?e:e.slice(t)}a.prototype._importDER=function(e,t){e=r.toArray(e,t);var i=new o;if(e[i.place++]!==48)return!1;var a=s(e,i);if(a===!1||a+i.place!==e.length||e[i.place++]!==2)return!1;var c=s(e,i);if(c===!1||e[i.place]&128)return!1;var l=e.slice(i.place,c+i.place);if(i.place+=c,e[i.place++]!==2)return!1;var u=s(e,i);if(u===!1||e.length!==u+i.place||e[i.place]&128)return!1;var d=e.slice(i.place,u+i.place);if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;if(d[0]===0)if(d[1]&128)d=d.slice(1);else return!1;return this.r=new n(l),this.s=new n(d),this.recoveryParam=null,!0};function l(e,t){if(t<128){e.push(t);return}var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(n|128);--n;)e.push(t>>>(n<<3)&255);e.push(t)}a.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),n[0]&128&&(n=[0].concat(n)),t=c(t),n=c(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];l(i,t.length),i=i.concat(t),i.push(2),l(i,n.length);var a=i.concat(n),o=[48];return l(o,a.length),o=o.concat(a),r.encode(o,e)}})),Xt=n(((e,t)=>{var n=et(),r=qt(),i=Dt(),a=Kt(),o=tt(),s=i.assert,c=Jt(),l=Yt();function u(e){if(!(this instanceof u))return new u(e);typeof e==`string`&&(s(Object.prototype.hasOwnProperty.call(a,e),`Unknown curve `+e),e=a[e]),e instanceof a.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}t.exports=u,u.prototype.keyPair=function(e){return new c(this,e)},u.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},u.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},u.prototype.genKeyPair=function(e){e||={};for(var t=new r({hash:this.hash,pers:e.pers,persEnc:e.persEnc||`utf8`,entropy:e.entropy||o(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||`utf8`,nonce:this.n.toArray()}),i=this.n.byteLength(),a=this.n.sub(new n(2));;){var s=new n(t.generate(i));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},u.prototype._truncateToN=function(e,t,r){var i;if(n.isBN(e)||typeof e==`number`)e=new n(e,16),i=e.byteLength();else if(typeof e==`object`)i=e.length,e=new n(e,16);else{var a=e.toString();i=a.length+1>>>1,e=new n(a,16)}typeof r!=`number`&&(r=i*8);var o=r-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},u.prototype.sign=function(e,t,i,a){if(typeof i==`object`&&(a=i,i=null),a||={},typeof e!=`string`&&typeof e!=`number`&&!n.isBN(e)){s(typeof e==`object`&&e&&typeof e.length==`number`,`Expected message to be an array-like, a hex string, or a BN instance`),s(e.length>>>0===e.length);for(var o=0;o<e.length;o++)s((e[o]&255)===e[o])}t=this.keyFromPrivate(t,i),e=this._truncateToN(e,!1,a.msgBitLength),s(!e.isNeg(),`Can not sign a negative message`);var c=this.n.byteLength(),u=t.getPrivate().toArray(`be`,c),d=e.toArray(`be`,c);s(new n(d).eq(e),`Can not sign message`);for(var f=new r({hash:this.hash,entropy:u,nonce:d,pers:a.pers,persEnc:a.persEnc||`utf8`}),p=this.n.sub(new n(1)),m=0;;m++){var h=a.k?a.k(m):new n(f.generate(this.n.byteLength()));if(h=this._truncateToN(h,!0),!(h.cmpn(1)<=0||h.cmp(p)>=0)){var g=this.g.mul(h);if(!g.isInfinity()){var _=g.getX(),v=_.umod(this.n);if(v.cmpn(0)!==0){var y=h.invm(this.n).mul(v.mul(t.getPrivate()).iadd(e));if(y=y.umod(this.n),y.cmpn(0)!==0){var b=!!g.getY().isOdd()|(_.cmp(v)===0?0:2);return a.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),b^=1),new l({r:v,s:y,recoveryParam:b})}}}}}},u.prototype.verify=function(e,t,n,r,i){i||={},e=this._truncateToN(e,!1,i.msgBitLength),n=this.keyFromPublic(n,r),t=new l(t,`hex`);var a=t.r,o=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s=o.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(a).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(c,n.getPublic(),u),!d.isInfinity()&&d.eqXToP(a)):(d=this.g.mulAdd(c,n.getPublic(),u),!d.isInfinity()&&d.getX().umod(this.n).cmp(a)===0)},u.prototype.recoverPubKey=function(e,t,r,i){s((3&r)===r,`The recovery param is more than two bits`),t=new l(t,i);var a=this.n,o=new n(e),c=t.r,u=t.s,d=r&1,f=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw Error(`Unable to find sencond key candinate`);c=f?this.curve.pointFromX(c.add(this.curve.n),d):this.curve.pointFromX(c,d);var p=t.r.invm(a),m=a.sub(o).mul(p).umod(a),h=u.mul(p).umod(a);return this.g.mulAdd(m,c,h)},u.prototype.getKeyRecoveryParam=function(e,t,n,r){if(t=new l(t,r),t.recoveryParam!==null)return t.recoveryParam;for(var i=0;i<4;i++){var a;try{a=this.recoverPubKey(e,t,i)}catch{continue}if(a.eq(n))return i}throw Error(`Unable to find valid recovery factor`)}})),Zt=n(((e,t)=>{var n=Dt(),r=n.assert,i=n.parseBytes,a=n.cachedProperty;function o(e,t){this.eddsa=e,this._secret=i(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=i(t.pub)}o.fromPublic=function(e,t){return t instanceof o?t:new o(e,{pub:t})},o.fromSecret=function(e,t){return t instanceof o?t:new o(e,{secret:t})},o.prototype.secret=function(){return this._secret},a(o,`pubBytes`,function(){return this.eddsa.encodePoint(this.pub())}),a(o,`pub`,function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),a(o,`privBytes`,function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),a(o,`priv`,function(){return this.eddsa.decodeInt(this.privBytes())}),a(o,`hash`,function(){return this.eddsa.hash().update(this.secret()).digest()}),a(o,`messagePrefix`,function(){return this.hash().slice(this.eddsa.encodingLength)}),o.prototype.sign=function(e){return r(this._secret,`KeyPair can only verify`),this.eddsa.sign(e,this)},o.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},o.prototype.getSecret=function(e){return r(this._secret,`KeyPair is public only`),n.encode(this.secret(),e)},o.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},t.exports=o})),Qt=n(((e,t)=>{var n=et(),r=Dt(),i=r.assert,a=r.cachedProperty,o=r.parseBytes;function s(e,t){this.eddsa=e,typeof t!=`object`&&(t=o(t)),Array.isArray(t)&&(i(t.length===e.encodingLength*2,`Signature has invalid size`),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),i(t.R&&t.S,`Signature without R or S`),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}a(s,`S`,function(){return this.eddsa.decodeInt(this.Sencoded())}),a(s,`R`,function(){return this.eddsa.decodePoint(this.Rencoded())}),a(s,`Rencoded`,function(){return this.eddsa.encodePoint(this.R())}),a(s,`Sencoded`,function(){return this.eddsa.encodeInt(this.S())}),s.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},s.prototype.toHex=function(){return r.encode(this.toBytes(),`hex`).toUpperCase()},t.exports=s})),$t=n(((e,t)=>{var n=Wt(),r=Kt(),i=Dt(),a=i.assert,o=i.parseBytes,s=Zt(),c=Qt();function l(e){if(a(e===`ed25519`,`only tested with ed25519 so far`),!(this instanceof l))return new l(e);e=r[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}t.exports=l,l.prototype.sign=function(e,t){e=o(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),a=this.encodePoint(i),s=this.hashInt(a,n.pubBytes(),e).mul(n.priv()),c=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:a})},l.prototype.verify=function(e,t,n){if(e=o(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(a)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return i.intFromLE(e.digest()).umod(this.curve.n)},l.prototype.keyFromPublic=function(e){return s.fromPublic(this,e)},l.prototype.keyFromSecret=function(e){return s.fromSecret(this,e)},l.prototype.makeSignature=function(e){return e instanceof c?e:new c(this,e)},l.prototype.encodePoint=function(e){var t=e.getY().toArray(`le`,this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},l.prototype.decodePoint=function(e){e=i.parseBytes(e);var t=e.length-1,n=e.slice(0,t).concat(e[t]&-129),r=(e[t]&128)!=0,a=i.intFromLE(n);return this.curve.pointFromY(a,r)},l.prototype.encodeInt=function(e){return e.toArray(`le`,this.encodingLength)},l.prototype.decodeInt=function(e){return i.intFromLE(e)},l.prototype.isPoint=function(e){return e instanceof this.pointClass}})),en=n((e=>{var t=e;t.version=Tt().version,t.utils=Dt(),t.rand=tt(),t.curve=Mt(),t.curves=Kt(),t.ec=Xt(),t.eddsa=$t()})),tn=n((()=>{})),nn=n(((e,t)=>{(function(e,t){function n(e,t){if(!e)throw Error(t||`Assertion failed`)}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,e!==null&&((t===`le`||t===`be`)&&(n=t,t=10),this._init(e||0,t||10,n||`be`))}typeof e==`object`?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var a;try{a=typeof window<`u`&&window.Buffer!==void 0?window.Buffer:tn().Buffer}catch{}i.isBN=function(e){return e instanceof i||typeof e==`object`&&!!e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if(typeof e==`number`)return this._initNumber(e,t,r);if(typeof e==`object`)return this._initArray(e,t,r);t===`hex`&&(t=16),n(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,``);var i=0;e[0]===`-`&&(i++,this.negative=1),i<e.length&&(t===16?this._parseHex(e,i,r):(this._parseBase(e,t,i),r===`le`&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),r===`le`&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n(typeof e.length==`number`),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if(r===`be`)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);else if(r===`le`)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);return this._strip()};function o(e,t){var r=e.charCodeAt(t);if(r>=48&&r<=57)return r-48;if(r>=65&&r<=70)return r-55;if(r>=97&&r<=102)return r-87;n(!1,`Invalid character in `+e)}function s(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i=0,a=0,o;if(n===`be`)for(r=e.length-1;r>=t;r-=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this._strip()};function c(e,t,r,i){for(var a=0,o=0,s=Math.min(e.length,r),c=t;c<s;c++){var l=e.charCodeAt(c)-48;a*=i,o=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&o<i,`Invalid character`),a+=o}return a}i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var a=e.length-n,o=a%r,s=Math.min(a,a-o)+n,l=0,u=n;u<s;u+=r)l=c(e,u,u+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(o!==0){var d=1;for(l=c(e,u,e.length,t),u=0;u<o;u++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this._strip()},i.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red};function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.prototype._move=function(e){l(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<`u`&&typeof Symbol.for==`function`)try{i.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=u}catch{i.prototype.inspect=u}else i.prototype.inspect=u;function u(){return(this.red?`<BN-R: `:`<BN: `)+this.toString(16)+`>`}var d=`.0.00.000.0000.00000.000000.0000000.00000000.000000000.0000000000.00000000000.000000000000.0000000000000.00000000000000.000000000000000.0000000000000000.00000000000000000.000000000000000000.0000000000000000000.00000000000000000000.000000000000000000000.0000000000000000000000.00000000000000000000000.000000000000000000000000.0000000000000000000000000`.split(`.`),f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){e||=10,t=t|0||1;var r;if(e===16||e===`hex`){r=``;for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],c=((s<<i|a)&16777215).toString(16);a=s>>>24-i&16777215,i+=2,i>=26&&(i-=26,o--),r=a!==0||o!==this.length-1?d[6-c.length]+c+r:c+r}for(a!==0&&(r=a.toString(16)+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}if(e===(e|0)&&e>=2&&e<=36){var l=f[e],u=p[e];r=``;var m=this.clone();for(m.negative=0;!m.isZero();){var h=m.modrn(u).toString(e);m=m.idivn(u),r=m.isZero()?h+r:d[l-h.length]+h+r}for(this.isZero()&&(r=`0`+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}n(!1,`Base should be between 2 and 36`)},i.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,`Number can only safely store up to 53 bits`),this.negative===0?e:-e},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};var m=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)};i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,`byte array longer than desired length`),n(a>0,`Requested array length <= 0`);var o=m(e,a),s=t===`le`?`LE`:`BE`;return this[`_toArrayLike`+s](o,i),o},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n++]=o&255,n<e.length&&(e[n++]=o>>8&255),n<e.length&&(e[n++]=o>>16&255),a===6?(n<e.length&&(e[n++]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n--]=o&255,n>=0&&(e[n--]=o>>8&255),n>=0&&(e[n--]=o>>16&255),a===6?(n>=0&&(e[n--]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,n=0;return t&8191||(n+=13,t>>>=13),t&127||(n+=7,t>>>=7),t&15||(n+=4,t>>>=4),t&3||(n+=2,t>>>=2),t&1||n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function h(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,n!==26)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return this.negative===0?this.clone():this.abs().inotn(e).iaddn(1)},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n((this.negative|e.negative)===0),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){for(var t=this.length>e.length?e:this,n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n((this.negative|e.negative)===0),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n((this.negative|e.negative)===0),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n(typeof e==`number`&&e>=0);var t=Math.ceil(e/26)|0,r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=~this.words[i]&67108863;for(r>0&&(this.words[i]=~this.words[i]&67108863>>26-r,i++);i<this.length;i++)this.words[i]=0;return this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n(typeof e==`number`&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<i:this.words[r]=this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var n,r;this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(n.words[a]|0)+(r.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;for(;i!==0&&a<n.length;a++)t=(n.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;if(this.length=n.length,i!==0)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},i.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var r,i;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)t=(r.words[o]|0)-(i.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;for(;a!==0&&o<r.length;o++)t=(r.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;if(a===0&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};function g(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=e.words[0]|0,a=t.words[0]|0,o=i*a,s=o&67108863,c=o/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var u=c>>>26,d=c&67108863,f=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=f;p++){var m=l-p|0;i=e.words[m]|0,a=t.words[p]|0,o=i*a+d,u+=o/67108864|0,d=o&67108863}n.words[l]=d|0,c=u|0}return c===0?n.length--:n.words[l]=c|0,n._strip()}var _=function(e,t,n){var r=e.words,i=t.words,a=n.words,o=0,s,c,l,u=r[0]|0,d=u&8191,f=u>>>13,p=r[1]|0,m=p&8191,h=p>>>13,g=r[2]|0,_=g&8191,v=g>>>13,y=r[3]|0,b=y&8191,x=y>>>13,S=r[4]|0,C=S&8191,w=S>>>13,T=r[5]|0,E=T&8191,D=T>>>13,O=r[6]|0,k=O&8191,A=O>>>13,ee=r[7]|0,j=ee&8191,M=ee>>>13,te=r[8]|0,N=te&8191,P=te>>>13,ne=r[9]|0,F=ne&8191,I=ne>>>13,re=i[0]|0,L=re&8191,R=re>>>13,ie=i[1]|0,z=ie&8191,B=ie>>>13,ae=i[2]|0,V=ae&8191,H=ae>>>13,oe=i[3]|0,se=oe&8191,U=oe>>>13,ce=i[4]|0,W=ce&8191,G=ce>>>13,le=i[5]|0,K=le&8191,q=le>>>13,ue=i[6]|0,J=ue&8191,de=ue>>>13,fe=i[7]|0,pe=fe&8191,me=fe>>>13,Y=i[8]|0,X=Y&8191,Z=Y>>>13,he=i[9]|0,ge=he&8191,_e=he>>>13;n.negative=e.negative^t.negative,n.length=19,s=Math.imul(d,L),c=Math.imul(d,R),c=c+Math.imul(f,L)|0,l=Math.imul(f,R);var ve=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ve>>>26)|0,ve&=67108863,s=Math.imul(m,L),c=Math.imul(m,R),c=c+Math.imul(h,L)|0,l=Math.imul(h,R),s=s+Math.imul(d,z)|0,c=c+Math.imul(d,B)|0,c=c+Math.imul(f,z)|0,l=l+Math.imul(f,B)|0;var ye=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ye>>>26)|0,ye&=67108863,s=Math.imul(_,L),c=Math.imul(_,R),c=c+Math.imul(v,L)|0,l=Math.imul(v,R),s=s+Math.imul(m,z)|0,c=c+Math.imul(m,B)|0,c=c+Math.imul(h,z)|0,l=l+Math.imul(h,B)|0,s=s+Math.imul(d,V)|0,c=c+Math.imul(d,H)|0,c=c+Math.imul(f,V)|0,l=l+Math.imul(f,H)|0;var be=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(be>>>26)|0,be&=67108863,s=Math.imul(b,L),c=Math.imul(b,R),c=c+Math.imul(x,L)|0,l=Math.imul(x,R),s=s+Math.imul(_,z)|0,c=c+Math.imul(_,B)|0,c=c+Math.imul(v,z)|0,l=l+Math.imul(v,B)|0,s=s+Math.imul(m,V)|0,c=c+Math.imul(m,H)|0,c=c+Math.imul(h,V)|0,l=l+Math.imul(h,H)|0,s=s+Math.imul(d,se)|0,c=c+Math.imul(d,U)|0,c=c+Math.imul(f,se)|0,l=l+Math.imul(f,U)|0;var xe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(xe>>>26)|0,xe&=67108863,s=Math.imul(C,L),c=Math.imul(C,R),c=c+Math.imul(w,L)|0,l=Math.imul(w,R),s=s+Math.imul(b,z)|0,c=c+Math.imul(b,B)|0,c=c+Math.imul(x,z)|0,l=l+Math.imul(x,B)|0,s=s+Math.imul(_,V)|0,c=c+Math.imul(_,H)|0,c=c+Math.imul(v,V)|0,l=l+Math.imul(v,H)|0,s=s+Math.imul(m,se)|0,c=c+Math.imul(m,U)|0,c=c+Math.imul(h,se)|0,l=l+Math.imul(h,U)|0,s=s+Math.imul(d,W)|0,c=c+Math.imul(d,G)|0,c=c+Math.imul(f,W)|0,l=l+Math.imul(f,G)|0;var Se=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Se>>>26)|0,Se&=67108863,s=Math.imul(E,L),c=Math.imul(E,R),c=c+Math.imul(D,L)|0,l=Math.imul(D,R),s=s+Math.imul(C,z)|0,c=c+Math.imul(C,B)|0,c=c+Math.imul(w,z)|0,l=l+Math.imul(w,B)|0,s=s+Math.imul(b,V)|0,c=c+Math.imul(b,H)|0,c=c+Math.imul(x,V)|0,l=l+Math.imul(x,H)|0,s=s+Math.imul(_,se)|0,c=c+Math.imul(_,U)|0,c=c+Math.imul(v,se)|0,l=l+Math.imul(v,U)|0,s=s+Math.imul(m,W)|0,c=c+Math.imul(m,G)|0,c=c+Math.imul(h,W)|0,l=l+Math.imul(h,G)|0,s=s+Math.imul(d,K)|0,c=c+Math.imul(d,q)|0,c=c+Math.imul(f,K)|0,l=l+Math.imul(f,q)|0;var Ce=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,s=Math.imul(k,L),c=Math.imul(k,R),c=c+Math.imul(A,L)|0,l=Math.imul(A,R),s=s+Math.imul(E,z)|0,c=c+Math.imul(E,B)|0,c=c+Math.imul(D,z)|0,l=l+Math.imul(D,B)|0,s=s+Math.imul(C,V)|0,c=c+Math.imul(C,H)|0,c=c+Math.imul(w,V)|0,l=l+Math.imul(w,H)|0,s=s+Math.imul(b,se)|0,c=c+Math.imul(b,U)|0,c=c+Math.imul(x,se)|0,l=l+Math.imul(x,U)|0,s=s+Math.imul(_,W)|0,c=c+Math.imul(_,G)|0,c=c+Math.imul(v,W)|0,l=l+Math.imul(v,G)|0,s=s+Math.imul(m,K)|0,c=c+Math.imul(m,q)|0,c=c+Math.imul(h,K)|0,l=l+Math.imul(h,q)|0,s=s+Math.imul(d,J)|0,c=c+Math.imul(d,de)|0,c=c+Math.imul(f,J)|0,l=l+Math.imul(f,de)|0;var we=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(we>>>26)|0,we&=67108863,s=Math.imul(j,L),c=Math.imul(j,R),c=c+Math.imul(M,L)|0,l=Math.imul(M,R),s=s+Math.imul(k,z)|0,c=c+Math.imul(k,B)|0,c=c+Math.imul(A,z)|0,l=l+Math.imul(A,B)|0,s=s+Math.imul(E,V)|0,c=c+Math.imul(E,H)|0,c=c+Math.imul(D,V)|0,l=l+Math.imul(D,H)|0,s=s+Math.imul(C,se)|0,c=c+Math.imul(C,U)|0,c=c+Math.imul(w,se)|0,l=l+Math.imul(w,U)|0,s=s+Math.imul(b,W)|0,c=c+Math.imul(b,G)|0,c=c+Math.imul(x,W)|0,l=l+Math.imul(x,G)|0,s=s+Math.imul(_,K)|0,c=c+Math.imul(_,q)|0,c=c+Math.imul(v,K)|0,l=l+Math.imul(v,q)|0,s=s+Math.imul(m,J)|0,c=c+Math.imul(m,de)|0,c=c+Math.imul(h,J)|0,l=l+Math.imul(h,de)|0,s=s+Math.imul(d,pe)|0,c=c+Math.imul(d,me)|0,c=c+Math.imul(f,pe)|0,l=l+Math.imul(f,me)|0;var Te=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,s=Math.imul(N,L),c=Math.imul(N,R),c=c+Math.imul(P,L)|0,l=Math.imul(P,R),s=s+Math.imul(j,z)|0,c=c+Math.imul(j,B)|0,c=c+Math.imul(M,z)|0,l=l+Math.imul(M,B)|0,s=s+Math.imul(k,V)|0,c=c+Math.imul(k,H)|0,c=c+Math.imul(A,V)|0,l=l+Math.imul(A,H)|0,s=s+Math.imul(E,se)|0,c=c+Math.imul(E,U)|0,c=c+Math.imul(D,se)|0,l=l+Math.imul(D,U)|0,s=s+Math.imul(C,W)|0,c=c+Math.imul(C,G)|0,c=c+Math.imul(w,W)|0,l=l+Math.imul(w,G)|0,s=s+Math.imul(b,K)|0,c=c+Math.imul(b,q)|0,c=c+Math.imul(x,K)|0,l=l+Math.imul(x,q)|0,s=s+Math.imul(_,J)|0,c=c+Math.imul(_,de)|0,c=c+Math.imul(v,J)|0,l=l+Math.imul(v,de)|0,s=s+Math.imul(m,pe)|0,c=c+Math.imul(m,me)|0,c=c+Math.imul(h,pe)|0,l=l+Math.imul(h,me)|0,s=s+Math.imul(d,X)|0,c=c+Math.imul(d,Z)|0,c=c+Math.imul(f,X)|0,l=l+Math.imul(f,Z)|0;var Ee=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,s=Math.imul(F,L),c=Math.imul(F,R),c=c+Math.imul(I,L)|0,l=Math.imul(I,R),s=s+Math.imul(N,z)|0,c=c+Math.imul(N,B)|0,c=c+Math.imul(P,z)|0,l=l+Math.imul(P,B)|0,s=s+Math.imul(j,V)|0,c=c+Math.imul(j,H)|0,c=c+Math.imul(M,V)|0,l=l+Math.imul(M,H)|0,s=s+Math.imul(k,se)|0,c=c+Math.imul(k,U)|0,c=c+Math.imul(A,se)|0,l=l+Math.imul(A,U)|0,s=s+Math.imul(E,W)|0,c=c+Math.imul(E,G)|0,c=c+Math.imul(D,W)|0,l=l+Math.imul(D,G)|0,s=s+Math.imul(C,K)|0,c=c+Math.imul(C,q)|0,c=c+Math.imul(w,K)|0,l=l+Math.imul(w,q)|0,s=s+Math.imul(b,J)|0,c=c+Math.imul(b,de)|0,c=c+Math.imul(x,J)|0,l=l+Math.imul(x,de)|0,s=s+Math.imul(_,pe)|0,c=c+Math.imul(_,me)|0,c=c+Math.imul(v,pe)|0,l=l+Math.imul(v,me)|0,s=s+Math.imul(m,X)|0,c=c+Math.imul(m,Z)|0,c=c+Math.imul(h,X)|0,l=l+Math.imul(h,Z)|0,s=s+Math.imul(d,ge)|0,c=c+Math.imul(d,_e)|0,c=c+Math.imul(f,ge)|0,l=l+Math.imul(f,_e)|0;var De=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(De>>>26)|0,De&=67108863,s=Math.imul(F,z),c=Math.imul(F,B),c=c+Math.imul(I,z)|0,l=Math.imul(I,B),s=s+Math.imul(N,V)|0,c=c+Math.imul(N,H)|0,c=c+Math.imul(P,V)|0,l=l+Math.imul(P,H)|0,s=s+Math.imul(j,se)|0,c=c+Math.imul(j,U)|0,c=c+Math.imul(M,se)|0,l=l+Math.imul(M,U)|0,s=s+Math.imul(k,W)|0,c=c+Math.imul(k,G)|0,c=c+Math.imul(A,W)|0,l=l+Math.imul(A,G)|0,s=s+Math.imul(E,K)|0,c=c+Math.imul(E,q)|0,c=c+Math.imul(D,K)|0,l=l+Math.imul(D,q)|0,s=s+Math.imul(C,J)|0,c=c+Math.imul(C,de)|0,c=c+Math.imul(w,J)|0,l=l+Math.imul(w,de)|0,s=s+Math.imul(b,pe)|0,c=c+Math.imul(b,me)|0,c=c+Math.imul(x,pe)|0,l=l+Math.imul(x,me)|0,s=s+Math.imul(_,X)|0,c=c+Math.imul(_,Z)|0,c=c+Math.imul(v,X)|0,l=l+Math.imul(v,Z)|0,s=s+Math.imul(m,ge)|0,c=c+Math.imul(m,_e)|0,c=c+Math.imul(h,ge)|0,l=l+Math.imul(h,_e)|0;var Oe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,s=Math.imul(F,V),c=Math.imul(F,H),c=c+Math.imul(I,V)|0,l=Math.imul(I,H),s=s+Math.imul(N,se)|0,c=c+Math.imul(N,U)|0,c=c+Math.imul(P,se)|0,l=l+Math.imul(P,U)|0,s=s+Math.imul(j,W)|0,c=c+Math.imul(j,G)|0,c=c+Math.imul(M,W)|0,l=l+Math.imul(M,G)|0,s=s+Math.imul(k,K)|0,c=c+Math.imul(k,q)|0,c=c+Math.imul(A,K)|0,l=l+Math.imul(A,q)|0,s=s+Math.imul(E,J)|0,c=c+Math.imul(E,de)|0,c=c+Math.imul(D,J)|0,l=l+Math.imul(D,de)|0,s=s+Math.imul(C,pe)|0,c=c+Math.imul(C,me)|0,c=c+Math.imul(w,pe)|0,l=l+Math.imul(w,me)|0,s=s+Math.imul(b,X)|0,c=c+Math.imul(b,Z)|0,c=c+Math.imul(x,X)|0,l=l+Math.imul(x,Z)|0,s=s+Math.imul(_,ge)|0,c=c+Math.imul(_,_e)|0,c=c+Math.imul(v,ge)|0,l=l+Math.imul(v,_e)|0;var ke=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ke>>>26)|0,ke&=67108863,s=Math.imul(F,se),c=Math.imul(F,U),c=c+Math.imul(I,se)|0,l=Math.imul(I,U),s=s+Math.imul(N,W)|0,c=c+Math.imul(N,G)|0,c=c+Math.imul(P,W)|0,l=l+Math.imul(P,G)|0,s=s+Math.imul(j,K)|0,c=c+Math.imul(j,q)|0,c=c+Math.imul(M,K)|0,l=l+Math.imul(M,q)|0,s=s+Math.imul(k,J)|0,c=c+Math.imul(k,de)|0,c=c+Math.imul(A,J)|0,l=l+Math.imul(A,de)|0,s=s+Math.imul(E,pe)|0,c=c+Math.imul(E,me)|0,c=c+Math.imul(D,pe)|0,l=l+Math.imul(D,me)|0,s=s+Math.imul(C,X)|0,c=c+Math.imul(C,Z)|0,c=c+Math.imul(w,X)|0,l=l+Math.imul(w,Z)|0,s=s+Math.imul(b,ge)|0,c=c+Math.imul(b,_e)|0,c=c+Math.imul(x,ge)|0,l=l+Math.imul(x,_e)|0;var Ae=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,s=Math.imul(F,W),c=Math.imul(F,G),c=c+Math.imul(I,W)|0,l=Math.imul(I,G),s=s+Math.imul(N,K)|0,c=c+Math.imul(N,q)|0,c=c+Math.imul(P,K)|0,l=l+Math.imul(P,q)|0,s=s+Math.imul(j,J)|0,c=c+Math.imul(j,de)|0,c=c+Math.imul(M,J)|0,l=l+Math.imul(M,de)|0,s=s+Math.imul(k,pe)|0,c=c+Math.imul(k,me)|0,c=c+Math.imul(A,pe)|0,l=l+Math.imul(A,me)|0,s=s+Math.imul(E,X)|0,c=c+Math.imul(E,Z)|0,c=c+Math.imul(D,X)|0,l=l+Math.imul(D,Z)|0,s=s+Math.imul(C,ge)|0,c=c+Math.imul(C,_e)|0,c=c+Math.imul(w,ge)|0,l=l+Math.imul(w,_e)|0;var je=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(je>>>26)|0,je&=67108863,s=Math.imul(F,K),c=Math.imul(F,q),c=c+Math.imul(I,K)|0,l=Math.imul(I,q),s=s+Math.imul(N,J)|0,c=c+Math.imul(N,de)|0,c=c+Math.imul(P,J)|0,l=l+Math.imul(P,de)|0,s=s+Math.imul(j,pe)|0,c=c+Math.imul(j,me)|0,c=c+Math.imul(M,pe)|0,l=l+Math.imul(M,me)|0,s=s+Math.imul(k,X)|0,c=c+Math.imul(k,Z)|0,c=c+Math.imul(A,X)|0,l=l+Math.imul(A,Z)|0,s=s+Math.imul(E,ge)|0,c=c+Math.imul(E,_e)|0,c=c+Math.imul(D,ge)|0,l=l+Math.imul(D,_e)|0;var Me=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Me>>>26)|0,Me&=67108863,s=Math.imul(F,J),c=Math.imul(F,de),c=c+Math.imul(I,J)|0,l=Math.imul(I,de),s=s+Math.imul(N,pe)|0,c=c+Math.imul(N,me)|0,c=c+Math.imul(P,pe)|0,l=l+Math.imul(P,me)|0,s=s+Math.imul(j,X)|0,c=c+Math.imul(j,Z)|0,c=c+Math.imul(M,X)|0,l=l+Math.imul(M,Z)|0,s=s+Math.imul(k,ge)|0,c=c+Math.imul(k,_e)|0,c=c+Math.imul(A,ge)|0,l=l+Math.imul(A,_e)|0;var Ne=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s=Math.imul(F,pe),c=Math.imul(F,me),c=c+Math.imul(I,pe)|0,l=Math.imul(I,me),s=s+Math.imul(N,X)|0,c=c+Math.imul(N,Z)|0,c=c+Math.imul(P,X)|0,l=l+Math.imul(P,Z)|0,s=s+Math.imul(j,ge)|0,c=c+Math.imul(j,_e)|0,c=c+Math.imul(M,ge)|0,l=l+Math.imul(M,_e)|0;var Pe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,s=Math.imul(F,X),c=Math.imul(F,Z),c=c+Math.imul(I,X)|0,l=Math.imul(I,Z),s=s+Math.imul(N,ge)|0,c=c+Math.imul(N,_e)|0,c=c+Math.imul(P,ge)|0,l=l+Math.imul(P,_e)|0;var Fe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,s=Math.imul(F,ge),c=Math.imul(F,_e),c=c+Math.imul(I,ge)|0,l=Math.imul(I,_e);var Q=(o+s|0)+((c&8191)<<13)|0;return o=(l+(c>>>13)|0)+(Q>>>26)|0,Q&=67108863,a[0]=ve,a[1]=ye,a[2]=be,a[3]=xe,a[4]=Se,a[5]=Ce,a[6]=we,a[7]=Te,a[8]=Ee,a[9]=De,a[10]=Oe,a[11]=ke,a[12]=Ae,a[13]=je,a[14]=Me,a[15]=Ne,a[16]=Pe,a[17]=Fe,a[18]=Q,o!==0&&(a[19]=o,n.length++),n};Math.imul||(_=g);function v(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,a=0;a<n.length-1;a++){var o=i;i=0;for(var s=r&67108863,c=Math.min(a,t.length-1),l=Math.max(0,a-e.length+1);l<=c;l++){var u=a-l,d=(e.words[u]|0)*(t.words[l]|0),f=d&67108863;o=o+(d/67108864|0)|0,f=f+s|0,s=f&67108863,o=o+(f>>>26)|0,i+=o>>>26,o&=67108863}n.words[a]=s,r=o,o=i}return r===0?n.length--:n.words[a]=r,n._strip()}function y(e,t,n){return v(e,t,n)}i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=this.length===10&&e.length===10?_(this,e,t):r<63?g(this,e,t):r<1024?v(this,e,t):y(this,e,t),n};function b(e,t){this.x=e,this.y=t}b.prototype.makeRBT=function(e){for(var t=Array(e),n=i.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},b.prototype.revBin=function(e,t,n){if(e===0||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(e&1)<<t-i-1,e>>=1;return r},b.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},b.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,c=Math.cos(2*Math.PI/s),l=Math.sin(2*Math.PI/s),u=0;u<i;u+=s)for(var d=c,f=l,p=0;p<o;p++){var m=n[u+p],h=r[u+p],g=n[u+p+o],_=r[u+p+o],v=d*g-f*_;_=d*_+f*g,g=v,n[u+p]=m+g,r[u+p]=h+_,n[u+p+o]=m-g,r[u+p+o]=h-_,p!==s&&(v=c*d-l*f,f=c*f+l*d,d=v)}},b.prototype.guessLen13b=function(e,t){var n=Math.max(t,e)|1,r=n&1,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},b.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},b.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=Math.round(e[2*r+1]/t)*8192+Math.round(e[2*r]/t)+n;e[r]=i&67108863,n=i<67108864?0:i/67108864|0}return e},b.prototype.convert13b=function(e,t,r,i){for(var a=0,o=0;o<t;o++)a+=e[o]|0,r[2*o]=a&8191,a>>>=13,r[2*o+1]=a&8191,a>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(a===0),n((a&-8192)==0)},b.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},b.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),c=Array(r),l=Array(r),u=Array(r),d=Array(r),f=n.words;f.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,c,r,i),this.transform(l,a,u,d,r,i);for(var p=0;p<r;p++){var m=s[p]*u[p]-c[p]*d[p];c[p]=s[p]*d[p]+c[p]*u[p],s[p]=m}return this.conjugate(s,c,r),this.transform(s,c,f,a,r,i),this.conjugate(f,a,r),this.normalize13b(f,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n._strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n(typeof e==`number`),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var a=(this.words[i]|0)*e,o=(a&67108863)+(r&67108863);r>>=26,r+=a/67108864|0,r+=o>>>26,this.words[i]=o&67108863}return r!==0&&(this.words[i]=r,this.length++),e===0&&(this.length=1,this._normSign()),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=h(e);if(t.length===0)return new i(1);for(var n=this,r=0;r<t.length&&t[r]===0;r++,n=n.sqr());if(++r<t.length)for(var a=n.sqr();r<t.length;r++,a=a.sqr())t[r]!==0&&(n=n.mul(a));return n},i.prototype.iushln=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=67108863>>>26-t<<26-t,a;if(t!==0){var o=0;for(a=0;a<this.length;a++){var s=this.words[a]&i,c=(this.words[a]|0)-s<<t;this.words[a]=c|o,o=s>>>26-t}o&&(this.words[a]=o,this.length++)}if(r!==0){for(a=this.length-1;a>=0;a--)this.words[a+r]=this.words[a];for(a=0;a<r;a++)this.words[a]=0;this.length+=r}return this._strip()},i.prototype.ishln=function(e){return n(this.negative===0),this.iushln(e)},i.prototype.iushrn=function(e,t,r){n(typeof e==`number`&&e>=0);var i=t?(t-t%26)/26:0,a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,c=r;if(i-=o,i=Math.max(0,i),c){for(var l=0;l<o;l++)c.words[l]=this.words[l];c.length=o}if(o!==0)if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var u=0;for(l=this.length-1;l>=0&&(u!==0||l>=i);l--){var d=this.words[l]|0;this.words[l]=u<<26-a|d>>>a,u=d&s}return c&&u!==0&&(c.words[c.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(this.negative===0),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return this.length<=r?!1:!!(this.words[r]&i)},i.prototype.imaskn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26;if(n(this.negative===0,`imaskn works only with positive numbers`),this.length<=r)return this;if(t!==0&&r++,this.length=Math.min(r,this.length),t!==0){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n(typeof e==`number`),n(e<67108864),e<0?this.isubn(-e):this.negative===0?this._iaddn(e):this.length===1&&(this.words[0]|0)<=e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n(typeof e==`number`),n(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,--this.words[t+1];return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i=e.length+r,a;this._expand(i);var o,s=0;for(a=0;a<e.length;a++){o=(this.words[a+r]|0)+s;var c=(e.words[a]|0)*t;o-=c&67108863,s=(o>>26)-(c/67108864|0),this.words[a+r]=o&67108863}for(;a<this.length-r;a++)o=(this.words[a+r]|0)+s,s=o>>26,this.words[a+r]=o&67108863;if(s===0)return this._strip();for(n(s===-1),s=0,a=0;a<this.length;a++)o=-(this.words[a]|0)+s,s=o>>26,this.words[a]=o&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=this.length-e.length,r=this.clone(),a=e,o=a.words[a.length-1]|0;n=26-this._countBits(o),n!==0&&(a=a.ushln(n),r.iushln(n),o=a.words[a.length-1]|0);var s=r.length-a.length,c;if(t!==`mod`){c=new i(null),c.length=s+1,c.words=Array(c.length);for(var l=0;l<c.length;l++)c.words[l]=0}var u=r.clone()._ishlnsubmul(a,1,s);u.negative===0&&(r=u,c&&(c.words[s]=1));for(var d=s-1;d>=0;d--){var f=(r.words[a.length+d]|0)*67108864+(r.words[a.length+d-1]|0);for(f=Math.min(f/o|0,67108863),r._ishlnsubmul(a,f,d);r.negative!==0;)f--,r.negative=0,r._ishlnsubmul(a,1,d),r.isZero()||(r.negative^=1);c&&(c.words[d]=f)}return c&&c._strip(),r._strip(),t!==`div`&&n!==0&&r.iushrn(n),{div:c||null,mod:r}},i.prototype.divmod=function(e,t,r){if(n(!e.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var a,o,s;return this.negative!==0&&e.negative===0?(s=this.neg().divmod(e,t),t!==`mod`&&(a=s.div.neg()),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.iadd(e)),{div:a,mod:o}):this.negative===0&&e.negative!==0?(s=this.divmod(e.neg(),t),t!==`mod`&&(a=s.div.neg()),{div:a,mod:s.mod}):(this.negative&e.negative)===0?e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:e.length===1?t===`div`?{div:this.divn(e.words[0]),mod:null}:t===`mod`?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.isub(e)),{div:s.div,mod:o})},i.prototype.div=function(e){return this.divmod(e,`div`,!1).div},i.prototype.mod=function(e){return this.divmod(e,`mod`,!1).mod},i.prototype.umod=function(e){return this.divmod(e,`mod`,!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=t.mod.abs(),r=e.abs().iushrn(1),a=e.words[0]&1,o=n.cmp(r);if(o<0||a===1&&o===0)return t.div;var s=new i(1);return s.negative=this.negative^e.negative,t.div.iadd(s)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(r*i+(this.words[a]|0))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var a=(this.words[i]|0)+r*67108864;this.words[i]=a/e|0,r=a%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=new i(0),c=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var u=r.clone(),d=t.clone();!t.isZero();){for(var f=0,p=1;(t.words[0]&p)===0&&f<26;++f,p<<=1);if(f>0)for(t.iushrn(f);f-->0;)(a.isOdd()||o.isOdd())&&(a.iadd(u),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var m=0,h=1;(r.words[0]&h)===0&&m<26;++m,h<<=1);if(m>0)for(r.iushrn(m);m-->0;)(s.isOdd()||c.isOdd())&&(s.iadd(u),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s),o.isub(c)):(r.isub(t),s.isub(a),c.isub(o))}return{a:s,b:c,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;(t.words[0]&l)===0&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-->0;)a.isOdd()&&a.iadd(s),a.iushrn(1);for(var u=0,d=1;(r.words[0]&d)===0&&u<26;++u,d<<=1);if(u>0)for(r.iushrn(u);u-->0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o)):(r.isub(t),o.isub(a))}var f=t.cmpn(1)===0?a:o;return f.cmpn(0)<0&&f.iadd(e),f},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var a=t;t=n,n=a}else if(i===0||n.cmpn(1)===0)break;t.isub(n)}while(!0);return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return(this.words[0]&1)==0},i.prototype.isOdd=function(){return(this.words[0]&1)==1},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n(typeof e==`number`);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;a!==0&&o<this.length;o++){var s=this.words[o]|0;s+=a,a=s>>>26,s&=67108863,this.words[o]=s}return a!==0&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this._strip();var r;if(this.length>1)r=1;else{t&&(e=-e),n(e<=67108863,`Number is too big`);var i=this.words[0]|0;r=i===e?0:i<e?-1:1}return this.negative===0?r:-r|0},i.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative===0?t:-t|0},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=this.words[n]|0,i=e.words[n]|0;if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return this.cmpn(e)===1},i.prototype.gt=function(e){return this.cmp(e)===1},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return this.cmpn(e)===-1},i.prototype.lt=function(e){return this.cmp(e)===-1},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return this.cmpn(e)===0},i.prototype.eq=function(e){return this.cmp(e)===0},i.red=function(e){return new D(e)},i.prototype.toRed=function(e){return n(!this.red,`Already a number in reduction context`),n(this.negative===0,`red works only with positives`),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,`fromRed works only with numbers in reduction context`),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,`Already a number in reduction context`),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,`redAdd works only with red numbers`),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,`redIAdd works only with red numbers`),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,`redSub works only with red numbers`),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,`redISub works only with red numbers`),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,`redShl works only with red numbers`),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,`redSqr works only with red numbers`),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,`redISqr works only with red numbers`),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,`redSqrt works only with red numbers`),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,`redInvm works only with red numbers`),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,`redNeg works only with red numbers`),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,`redPow(normalNum)`),this.red._verify1(this),this.red.pow(this,e)};var x={k256:null,p224:null,p192:null,p25519:null};function S(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}S.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},S.prototype.ireduce=function(e){var t=e,n;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),n=t.bitLength();while(n>this.n);var r=n<this.n?-1:t.ucmp(this.p);return r===0?(t.words[0]=0,t.length=1):r>0?t.isub(this.p):t.strip===void 0?t._strip():t.strip(),t},S.prototype.split=function(e,t){e.iushrn(this.n,0,t)},S.prototype.imulK=function(e){return e.imul(this.k)};function C(){S.call(this,`k256`,`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`)}r(C,S),C.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=e.words[i]|0;e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,a===0&&e.length>10?e.length-=10:e.length-=9},C.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=e.words[n]|0;t+=r*977,e.words[n]=t&67108863,t=r*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function w(){S.call(this,`p224`,`ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001`)}r(w,S);function T(){S.call(this,`p192`,`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff`)}r(T,S);function E(){S.call(this,`25519`,`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`)}r(E,S),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=(e.words[n]|0)*19+t,i=r&67108863;r>>>=26,e.words[n]=i,t=r}return t!==0&&(e.words[e.length++]=t),e},i._prime=function(e){if(x[e])return x[e];var t;if(e===`k256`)t=new C;else if(e===`p224`)t=new w;else if(e===`p192`)t=new T;else if(e===`p25519`)t=new E;else throw Error(`Unknown prime `+e);return x[e]=t,t};function D(e){if(typeof e==`string`){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),`modulus must be greater than 1`),this.m=e,this.prime=null}D.prototype._verify1=function(e){n(e.negative===0,`red works only with positives`),n(e.red,`red works only with red numbers`)},D.prototype._verify2=function(e,t){n((e.negative|t.negative)===0,`red works only with positives`),n(e.red&&e.red===t.red,`red works only with red numbers`)},D.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},D.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},D.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},D.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},D.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},D.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},D.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},D.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},D.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},D.prototype.isqr=function(e){return this.imul(e,e.clone())},D.prototype.sqr=function(e){return this.mul(e,e)},D.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),t===3){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&a.andln(1)===0;)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),c=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,l).cmp(c)!==0;)u.redIAdd(c);for(var d=this.pow(u,a),f=this.pow(e,a.addn(1).iushrn(1)),p=this.pow(e,a),m=o;p.cmp(s)!==0;){for(var h=p,g=0;h.cmp(s)!==0;g++)h=h.redSqr();n(g<m);var _=this.pow(d,new i(1).iushln(m-g-1));f=f.redMul(_),d=_.redSqr(),p=p.redMul(d),m=g}return f},D.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative===0?this.imod(t):(t.negative=0,this.imod(t).redNeg())},D.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var n=4,r=Array(1<<n);r[0]=new i(1).toRed(this),r[1]=e;for(var a=2;a<r.length;a++)r[a]=this.mul(r[a-1],e);var o=r[0],s=0,c=0,l=t.bitLength()%26;for(l===0&&(l=26),a=t.length-1;a>=0;a--){for(var u=t.words[a],d=l-1;d>=0;d--){var f=u>>d&1;if(o!==r[0]&&(o=this.sqr(o)),f===0&&s===0){c=0;continue}s<<=1,s|=f,c++,!(c!==n&&(a!==0||d!==0))&&(o=this.mul(o,r[s]),c=0,s=0)}l=26}return o},D.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},D.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new O(e)};function O(e){D.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}r(O,D),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(r).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}})(t===void 0||t,e)})),rn=n((e=>{var n=_n(),r=p(),i=e;i.define=function(e,t){return new a(e,t)};function a(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}a.prototype._createNamed=function(e){var n;try{n=t(`vm`).runInThisContext(`(function `+this.name+`(entity) {
|
|
3
|
+
(function(t){typeof DO_NOT_EXPORT_CRC>`u`?typeof e==`object`?t(e):typeof define==`function`&&define.amd?define(function(){var e={};return t(e),e}):t({}):t({})})(function(e){e.version=`1.2.2`;function t(){for(var e=0,t=Array(256),n=0;n!=256;++n)e=n,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,t[n]=e;return typeof Int32Array<`u`?new Int32Array(t):t}var n=t();function r(e){var t=0,n=0,r=0,i=typeof Int32Array<`u`?new Int32Array(4096):Array(4096);for(r=0;r!=256;++r)i[r]=e[r];for(r=0;r!=256;++r)for(n=e[r],t=256+r;t<4096;t+=256)n=i[t]=n>>>8^e[n&255];var a=[];for(r=1;r!=16;++r)a[r-1]=typeof Int32Array<`u`?i.subarray(r*256,r*256+256):i.slice(r*256,r*256+256);return a}var i=r(n),a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14];function b(e,t){for(var r=t^-1,i=0,a=e.length;i<a;)r=r>>>8^n[(r^e.charCodeAt(i++))&255];return~r}function x(e,t){for(var r=t^-1,i=e.length-15,b=0;b<i;)r=y[e[b++]^r&255]^v[e[b++]^r>>8&255]^_[e[b++]^r>>16&255]^g[e[b++]^r>>>24]^h[e[b++]]^m[e[b++]]^p[e[b++]]^f[e[b++]]^d[e[b++]]^u[e[b++]]^l[e[b++]]^c[e[b++]]^s[e[b++]]^o[e[b++]]^a[e[b++]]^n[e[b++]];for(i+=15;b<i;)r=r>>>8^n[(r^e[b++])&255];return~r}function S(e,t){for(var r=t^-1,i=0,a=e.length,o=0,s=0;i<a;)o=e.charCodeAt(i++),o<128?r=r>>>8^n[(r^o)&255]:o<2048?(r=r>>>8^n[(r^(192|o>>6&31))&255],r=r>>>8^n[(r^(128|o&63))&255]):o>=55296&&o<57344?(o=(o&1023)+64,s=e.charCodeAt(i++)&1023,r=r>>>8^n[(r^(240|o>>8&7))&255],r=r>>>8^n[(r^(128|o>>2&63))&255],r=r>>>8^n[(r^(128|s>>6&15|(o&3)<<4))&255],r=r>>>8^n[(r^(128|s&63))&255]):(r=r>>>8^n[(r^(224|o>>12&15))&255],r=r>>>8^n[(r^(128|o>>6&63))&255],r=r>>>8^n[(r^(128|o&63))&255]);return~r}e.table=n,e.bstr=b,e.buf=x,e.str=S})})),A=n((e=>{var t=g(),n=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}for(var i=new t.Buf8(256),a=0;a<256;a++)i[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;i[254]=i[254]=1,e.string2buf=function(e){var n,r,i,a,o,s=e.length,c=0;for(a=0;a<s;a++)r=e.charCodeAt(a),(r&64512)==55296&&a+1<s&&(i=e.charCodeAt(a+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),a++)),c+=r<128?1:r<2048?2:r<65536?3:4;for(n=new t.Buf8(c),o=0,a=0;o<c;a++)r=e.charCodeAt(a),(r&64512)==55296&&a+1<s&&(i=e.charCodeAt(a+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),a++)),r<128?n[o++]=r:r<2048?(n[o++]=192|r>>>6,n[o++]=128|r&63):r<65536?(n[o++]=224|r>>>12,n[o++]=128|r>>>6&63,n[o++]=128|r&63):(n[o++]=240|r>>>18,n[o++]=128|r>>>12&63,n[o++]=128|r>>>6&63,n[o++]=128|r&63);return n};function o(e,i){if(i<65534&&(e.subarray&&r||!e.subarray&&n))return String.fromCharCode.apply(null,t.shrinkBuf(e,i));for(var a=``,o=0;o<i;o++)a+=String.fromCharCode(e[o]);return a}e.buf2binstring=function(e){return o(e,e.length)},e.binstring2buf=function(e){for(var n=new t.Buf8(e.length),r=0,i=n.length;r<i;r++)n[r]=e.charCodeAt(r);return n},e.buf2string=function(e,t){var n,r,a,s,c=t||e.length,l=Array(c*2);for(r=0,n=0;n<c;){if(a=e[n++],a<128){l[r++]=a;continue}if(s=i[a],s>4){l[r++]=65533,n+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>1&&n<c;)a=a<<6|e[n++]&63,s--;if(s>1){l[r++]=65533;continue}a<65536?l[r++]=a:(a-=65536,l[r++]=55296|a>>10&1023,l[r++]=56320|a&1023)}return o(l,r)},e.utf8border=function(e,t){var n;for(t||=e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+i[e[n]]>t?n:t}})),ee=n((e=>{var t=f(),n=g(),r=A(),i=o(),a=y(),s=Object.prototype.toString,c=0,l=4,u=0,d=1,p=2,m=-1,h=0,_=8;function v(e){if(!(this instanceof v))return new v(e);this.options=n.assign({level:m,method:_,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:``},e||{});var o=this.options;o.raw&&o.windowBits>0?o.windowBits=-o.windowBits:o.gzip&&o.windowBits>0&&o.windowBits<16&&(o.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var c=t.deflateInit2(this.strm,o.level,o.method,o.windowBits,o.memLevel,o.strategy);if(c!==u)throw Error(i[c]);if(o.header&&t.deflateSetHeader(this.strm,o.header),o.dictionary){var l=typeof o.dictionary==`string`?r.string2buf(o.dictionary):s.call(o.dictionary)===`[object ArrayBuffer]`?new Uint8Array(o.dictionary):o.dictionary;if(c=t.deflateSetDictionary(this.strm,l),c!==u)throw Error(i[c]);this._dict_set=!0}}v.prototype.push=function(e,i){var a=this.strm,o=this.options.chunkSize,f,m;if(this.ended)return!1;m=i===~~i?i:i===!0?l:c,typeof e==`string`?a.input=r.string2buf(e):s.call(e)===`[object ArrayBuffer]`?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(a.avail_out===0&&(a.output=new n.Buf8(o),a.next_out=0,a.avail_out=o),f=t.deflate(a,m),f!==d&&f!==u)return this.onEnd(f),this.ended=!0,!1;(a.avail_out===0||a.avail_in===0&&(m===l||m===p))&&(this.options.to===`string`?this.onData(r.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||a.avail_out===0)&&f!==d);return m===l?(f=t.deflateEnd(this.strm),this.onEnd(f),this.ended=!0,f===u):m===p?(this.onEnd(u),a.avail_out=0,!0):!0},v.prototype.onData=function(e){this.chunks.push(e)},v.prototype.onEnd=function(e){e===u&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function b(e,t){var n=new v(t);if(n.push(e,!0),n.err)throw n.msg||i[n.err];return n.result}function x(e,t){return t||={},t.raw=!0,b(e,t)}function S(e,t){return t||={},t.gzip=!0,b(e,t)}e.Deflate=v,e.deflate=b,e.deflateRaw=x,e.gzip=S})),j=n(((e,t)=>{function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}t.exports=n})),M=n((e=>{var t=v(),n=g(),r=A(),i=h(),a=o(),s=y(),c=j(),l=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:``},e||{});var o=this.options;o.raw&&o.windowBits>=0&&o.windowBits<16&&(o.windowBits=-o.windowBits,o.windowBits===0&&(o.windowBits=-15)),o.windowBits>=0&&o.windowBits<16&&!(e&&e.windowBits)&&(o.windowBits+=32),o.windowBits>15&&o.windowBits<48&&(o.windowBits&15||(o.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var d=t.inflateInit2(this.strm,o.windowBits);if(d!==i.Z_OK||(this.header=new c,t.inflateGetHeader(this.strm,this.header),o.dictionary&&(typeof o.dictionary==`string`?o.dictionary=r.string2buf(o.dictionary):l.call(o.dictionary)===`[object ArrayBuffer]`&&(o.dictionary=new Uint8Array(o.dictionary)),o.raw&&(d=t.inflateSetDictionary(this.strm,o.dictionary),d!==i.Z_OK))))throw Error(a[d])}u.prototype.push=function(e,a){var o=this.strm,s=this.options.chunkSize,c=this.options.dictionary,u,d,f,p,m,h=!1;if(this.ended)return!1;d=a===~~a?a:a===!0?i.Z_FINISH:i.Z_NO_FLUSH,typeof e==`string`?o.input=r.binstring2buf(e):l.call(e)===`[object ArrayBuffer]`?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;do{if(o.avail_out===0&&(o.output=new n.Buf8(s),o.next_out=0,o.avail_out=s),u=t.inflate(o,i.Z_NO_FLUSH),u===i.Z_NEED_DICT&&c&&(u=t.inflateSetDictionary(this.strm,c)),u===i.Z_BUF_ERROR&&h===!0&&(u=i.Z_OK,h=!1),u!==i.Z_STREAM_END&&u!==i.Z_OK)return this.onEnd(u),this.ended=!0,!1;o.next_out&&(o.avail_out===0||u===i.Z_STREAM_END||o.avail_in===0&&(d===i.Z_FINISH||d===i.Z_SYNC_FLUSH))&&(this.options.to===`string`?(f=r.utf8border(o.output,o.next_out),p=o.next_out-f,m=r.buf2string(o.output,f),o.next_out=p,o.avail_out=s-p,p&&n.arraySet(o.output,o.output,f,p,0),this.onData(m)):this.onData(n.shrinkBuf(o.output,o.next_out))),o.avail_in===0&&o.avail_out===0&&(h=!0)}while((o.avail_in>0||o.avail_out===0)&&u!==i.Z_STREAM_END);return u===i.Z_STREAM_END&&(d=i.Z_FINISH),d===i.Z_FINISH?(u=t.inflateEnd(this.strm),this.onEnd(u),this.ended=!0,u===i.Z_OK):d===i.Z_SYNC_FLUSH?(this.onEnd(i.Z_OK),o.avail_out=0,!0):!0},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===i.Z_OK&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function d(e,t){var n=new u(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}function f(e,t){return t||={},t.raw=!0,d(e,t)}e.Inflate=u,e.inflate=d,e.inflateRaw=f,e.ungzip=d})),te=n(((e,t)=>{var n=g().assign,r=ee(),i=M(),a=h(),o={};n(o,r,i,a),t.exports=o})),N=n(((t,n)=>{var r=e(x()),i=65536,a=4294967295;function o(){throw Error(`Secure random number generation is not supported by this browser.
|
|
4
|
+
Use Chrome, Firefox or Internet Explorer 11`)}var s=_().Buffer,c=globalThis.crypto||globalThis.msCrypto;c&&c.getRandomValues?n.exports=l:n.exports=o;function l(e,t){if(e>a)throw RangeError(`requested too many random bytes`);var n=s.allocUnsafe(e);if(e>0)if(e>i)for(var o=0;o<e;o+=i)c.getRandomValues(n.slice(o,o+i));else c.getRandomValues(n);return typeof t==`function`?r.default.nextTick(function(){t(null,n)}):n}})),P=n(((e,t)=>{var n=_().Buffer,r=c().Transform,i=d();function a(e){r.call(this),this._block=n.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}i(a,r),a.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},a.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)};var o=typeof Uint8Array<`u`,s=typeof ArrayBuffer<`u`&&typeof Uint8Array<`u`&&ArrayBuffer.isView&&(n.prototype instanceof Uint8Array||n.TYPED_ARRAY_SUPPORT);function l(e,t){if(e instanceof n)return e;if(typeof e==`string`)return n.from(e,t);if(s&&ArrayBuffer.isView(e)){if(e.byteLength===0)return n.alloc(0);var r=n.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}if(o&&e instanceof Uint8Array||n.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e))return n.from(e);throw TypeError(`The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.`)}a.prototype.update=function(e,t){if(this._finalized)throw Error(`Digest already called`);e=l(e,t);for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)n[i++]=e[r++];this._update(),this._blockOffset=0}for(;r<e.length;)n[this._blockOffset++]=e[r++];for(var a=0,o=e.length*8;o>0;++a)this._length[a]+=o,o=this._length[a]/4294967296|0,o>0&&(this._length[a]-=4294967296*o);return this},a.prototype._update=function(){throw Error(`_update is not implemented`)},a.prototype.digest=function(e){if(this._finalized)throw Error(`Digest already called`);this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},a.prototype._digest=function(){throw Error(`_digest is not implemented`)},t.exports=a})),ne=n(((e,t)=>{var n=d(),r=P(),i=_().Buffer,a=Array(16);function o(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}n(o,r),o.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);var n=this._a,r=this._b,i=this._c,o=this._d;n=c(n,r,i,o,e[0],3614090360,7),o=c(o,n,r,i,e[1],3905402710,12),i=c(i,o,n,r,e[2],606105819,17),r=c(r,i,o,n,e[3],3250441966,22),n=c(n,r,i,o,e[4],4118548399,7),o=c(o,n,r,i,e[5],1200080426,12),i=c(i,o,n,r,e[6],2821735955,17),r=c(r,i,o,n,e[7],4249261313,22),n=c(n,r,i,o,e[8],1770035416,7),o=c(o,n,r,i,e[9],2336552879,12),i=c(i,o,n,r,e[10],4294925233,17),r=c(r,i,o,n,e[11],2304563134,22),n=c(n,r,i,o,e[12],1804603682,7),o=c(o,n,r,i,e[13],4254626195,12),i=c(i,o,n,r,e[14],2792965006,17),r=c(r,i,o,n,e[15],1236535329,22),n=l(n,r,i,o,e[1],4129170786,5),o=l(o,n,r,i,e[6],3225465664,9),i=l(i,o,n,r,e[11],643717713,14),r=l(r,i,o,n,e[0],3921069994,20),n=l(n,r,i,o,e[5],3593408605,5),o=l(o,n,r,i,e[10],38016083,9),i=l(i,o,n,r,e[15],3634488961,14),r=l(r,i,o,n,e[4],3889429448,20),n=l(n,r,i,o,e[9],568446438,5),o=l(o,n,r,i,e[14],3275163606,9),i=l(i,o,n,r,e[3],4107603335,14),r=l(r,i,o,n,e[8],1163531501,20),n=l(n,r,i,o,e[13],2850285829,5),o=l(o,n,r,i,e[2],4243563512,9),i=l(i,o,n,r,e[7],1735328473,14),r=l(r,i,o,n,e[12],2368359562,20),n=u(n,r,i,o,e[5],4294588738,4),o=u(o,n,r,i,e[8],2272392833,11),i=u(i,o,n,r,e[11],1839030562,16),r=u(r,i,o,n,e[14],4259657740,23),n=u(n,r,i,o,e[1],2763975236,4),o=u(o,n,r,i,e[4],1272893353,11),i=u(i,o,n,r,e[7],4139469664,16),r=u(r,i,o,n,e[10],3200236656,23),n=u(n,r,i,o,e[13],681279174,4),o=u(o,n,r,i,e[0],3936430074,11),i=u(i,o,n,r,e[3],3572445317,16),r=u(r,i,o,n,e[6],76029189,23),n=u(n,r,i,o,e[9],3654602809,4),o=u(o,n,r,i,e[12],3873151461,11),i=u(i,o,n,r,e[15],530742520,16),r=u(r,i,o,n,e[2],3299628645,23),n=f(n,r,i,o,e[0],4096336452,6),o=f(o,n,r,i,e[7],1126891415,10),i=f(i,o,n,r,e[14],2878612391,15),r=f(r,i,o,n,e[5],4237533241,21),n=f(n,r,i,o,e[12],1700485571,6),o=f(o,n,r,i,e[3],2399980690,10),i=f(i,o,n,r,e[10],4293915773,15),r=f(r,i,o,n,e[1],2240044497,21),n=f(n,r,i,o,e[8],1873313359,6),o=f(o,n,r,i,e[15],4264355552,10),i=f(i,o,n,r,e[6],2734768916,15),r=f(r,i,o,n,e[13],1309151649,21),n=f(n,r,i,o,e[4],4149444226,6),o=f(o,n,r,i,e[11],3174756917,10),i=f(i,o,n,r,e[2],718787259,15),r=f(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},o.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=i.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};function s(e,t){return e<<t|e>>>32-t}function c(e,t,n,r,i,a,o){return s(e+(t&n|~t&r)+i+a|0,o)+t|0}function l(e,t,n,r,i,a,o){return s(e+(t&r|n&~r)+i+a|0,o)+t|0}function u(e,t,n,r,i,a,o){return s(e+(t^n^r)+i+a|0,o)+t|0}function f(e,t,n,r,i,a,o){return s(e+(n^(t|~r))+i+a|0,o)+t|0}t.exports=o})),F=n(((e,t)=>{var n=_().Buffer,r=E(),i=typeof Uint8Array<`u`,a=i&&typeof ArrayBuffer<`u`&&ArrayBuffer.isView;t.exports=function(e,t){if(typeof e==`string`||n.isBuffer(e)||i&&e instanceof Uint8Array||a&&a(e))return r(e,t);throw TypeError(`The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView`)}})),I=n(((t,n)=>{var r=e(x());r.default===void 0||!r.default.version||r.default.version.indexOf(`v0.`)===0||r.default.version.indexOf(`v1.`)===0&&r.default.version.indexOf(`v1.8.`)!==0?n.exports={nextTick:i}:n.exports=r.default;function i(e,t,n,i){if(typeof e!=`function`)throw TypeError(`"callback" argument must be a function`);var a=arguments.length,o,s;switch(a){case 0:case 1:return r.default.nextTick(e);case 2:return r.default.nextTick(function(){e.call(null,t)});case 3:return r.default.nextTick(function(){e.call(null,t,n)});case 4:return r.default.nextTick(function(){e.call(null,t,n,i)});default:for(o=Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return r.default.nextTick(function(){e.apply(null,o)})}}})),re=n(((e,t)=>{var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)==`[object Array]`}})),L=n(((e,t)=>{t.exports=u().EventEmitter})),R=n(((e,t)=>{var n=a(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=o);function o(e,t,n){return r(e,t,n)}i(r,o),o.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},o.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},o.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},o.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),ie=n((e=>{var t=a();function n(e){return Array.isArray?Array.isArray(e):_(e)===`[object Array]`}e.isArray=n;function r(e){return typeof e==`boolean`}e.isBoolean=r;function i(e){return e===null}e.isNull=i;function o(e){return e==null}e.isNullOrUndefined=o;function s(e){return typeof e==`number`}e.isNumber=s;function c(e){return typeof e==`string`}e.isString=c;function l(e){return typeof e==`symbol`}e.isSymbol=l;function u(e){return e===void 0}e.isUndefined=u;function d(e){return _(e)===`[object RegExp]`}e.isRegExp=d;function f(e){return typeof e==`object`&&!!e}e.isObject=f;function p(e){return _(e)===`[object Date]`}e.isDate=p;function m(e){return _(e)===`[object Error]`||e instanceof Error}e.isError=m;function h(e){return typeof e==`function`}e.isFunction=h;function g(e){return e===null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`||typeof e==`symbol`||e===void 0}e.isPrimitive=g,e.isBuffer=t.Buffer.isBuffer;function _(e){return Object.prototype.toString.call(e)}})),z=n((()=>{})),B=n((()=>{})),ae=n(((e,t)=>{function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var r=R().Buffer,i=B();function a(e,t,n){e.copy(t,n)}t.exports=function(){function e(){n(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(this.length!==0){var e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(this.length===0)return``;for(var t=this.head,n=``+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(this.length===0)return r.alloc(0);for(var t=r.allocUnsafe(e>>>0),n=this.head,i=0;n;)a(n.data,t,i),i+=n.data.length,n=n.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+` `+e})})),V=n(((e,t)=>{var n=I();function r(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return i||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,n.nextTick(a,r,e)):n.nextTick(a,r,e):t&&t(e)}),this)}function i(){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)}function a(e,t){e.emit(`error`,t)}t.exports={destroy:r,undestroy:i}})),H=n(((t,n)=>{var r=e(x()),i=I();n.exports=S;function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){re(t,e)}}var o=!r.default.browser&&[`v0.10`,`v0.9.`].indexOf(r.default.version.slice(0,5))>-1?setImmediate:i.nextTick,s;S.WritableState=y;var c=Object.create(ie());c.inherits=d();var l={deprecate:m()},u=L(),f=R().Buffer,p=(typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:{}).Uint8Array||function(){};function h(e){return f.from(e)}function g(e){return f.isBuffer(e)||e instanceof p}var _=V();c.inherits(S,u);function v(){}function y(e,t){s||=oe(),e||={};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,i=e.writableHighWaterMark,o=this.objectMode?16:16*1024;r||r===0?this.highWaterMark=r:n&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=e.decodeStrings===!1;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){A(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}y.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},(function(){try{Object.defineProperty(y.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},`_writableState.buffer is deprecated. Use _writableState.getBuffer instead.`,`DEP0003`)})}catch{}})();var b;typeof Symbol==`function`&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==`function`?(b=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(e){return b.call(this,e)?!0:this===S&&e&&e._writableState instanceof y}})):b=function(e){return e instanceof this};function S(e){if(s||=oe(),!b.call(S,this)&&!(this instanceof s))return new S(e);this._writableState=new y(e,this),this.writable=!0,e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final)),u.call(this)}S.prototype.pipe=function(){this.emit(`error`,Error(`Cannot pipe, not readable`))};function C(e,t){var n=Error(`write after end`);e.emit(`error`,n),i.nextTick(t,n)}function w(e,t,n,r){var a=!0,o=!1;return n===null?o=TypeError(`May not write null values to stream`):typeof n!=`string`&&n!==void 0&&!t.objectMode&&(o=TypeError(`Invalid non-string/buffer chunk`)),o&&(e.emit(`error`,o),i.nextTick(r,o),a=!1),a}S.prototype.write=function(e,t,n){var r=this._writableState,i=!1,a=!r.objectMode&&g(e);return a&&!f.isBuffer(e)&&(e=h(e)),typeof t==`function`&&(n=t,t=null),a?t=`buffer`:t||=r.defaultEncoding,typeof n!=`function`&&(n=v),r.ended?C(this,n):(a||w(this,r,e,n))&&(r.pendingcb++,i=E(this,r,a,e,t,n)),i},S.prototype.cork=function(){var e=this._writableState;e.corked++},S.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&M(this,e))},S.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=e.toLowerCase()),!([`hex`,`utf8`,`utf-8`,`ascii`,`binary`,`base64`,`ucs2`,`ucs-2`,`utf16le`,`utf-16le`,`raw`].indexOf((e+``).toLowerCase())>-1))throw TypeError(`Unknown encoding: `+e);return this._writableState.defaultEncoding=e,this};function T(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t==`string`&&(t=f.from(t,n)),t}Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function E(e,t,n,r,i,a){if(!n){var o=T(t,r,i);r!==o&&(n=!0,i=`buffer`,r=o)}var s=t.objectMode?1:r.length;t.length+=s;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else D(e,t,!1,s,r,i,a);return c}function D(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function O(e,t,n,r,a){--t.pendingcb,n?(i.nextTick(a,r),i.nextTick(ne,e,t),e._writableState.errorEmitted=!0,e.emit(`error`,r)):(a(r),e._writableState.errorEmitted=!0,e.emit(`error`,r),ne(e,t))}function k(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function A(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(k(n),t)O(e,n,r,t,i);else{var a=te(n);!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&M(e,n),r?o(ee,e,n,a,i):ee(e,n,a,i)}}function ee(e,t,n,r){n||j(e,t),t.pendingcb--,r(),ne(e,t)}function j(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`))}function M(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=Array(r),o=t.corkedRequestsFree;o.entry=n;for(var s=0,c=!0;n;)i[s]=n,n.isBuf||(c=!1),n=n.next,s+=1;i.allBuffers=c,D(e,t,!0,t.length,i,``,o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,u=n.encoding,d=n.callback;if(D(e,t,!1,t.objectMode?1:l.length,l,u,d),n=n.next,t.bufferedRequestCount--,t.writing)break}n===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}S.prototype._write=function(e,t,n){n(Error(`_write() is not implemented`))},S.prototype._writev=null,S.prototype.end=function(e,t,n){var r=this._writableState;typeof e==`function`?(n=e,e=null,t=null):typeof t==`function`&&(n=t,t=null),e!=null&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||F(this,r,n)};function te(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function N(e,t){e._final(function(n){t.pendingcb--,n&&e.emit(`error`,n),t.prefinished=!0,e.emit(`prefinish`),ne(e,t)})}function P(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`?(t.pendingcb++,t.finalCalled=!0,i.nextTick(N,e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function ne(e,t){var n=te(t);return n&&(P(e,t),t.pendingcb===0&&(t.finished=!0,e.emit(`finish`))),n}function F(e,t,n){t.ending=!0,ne(e,t),n&&(t.finished?i.nextTick(n):e.once(`finish`,n)),t.ended=!0,e.writable=!1}function re(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}Object.defineProperty(S.prototype,"destroyed",{get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),S.prototype.destroy=_.destroy,S.prototype._undestroy=_.undestroy,S.prototype._destroy=function(e,t){this.end(),t(e)}})),oe=n(((e,t)=>{var n=I(),r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=u;var i=Object.create(ie());i.inherits=d();var a=ce(),o=H();i.inherits(u,a);for(var s=r(o.prototype),c=0;c<s.length;c++){var l=s[c];u.prototype[l]||(u.prototype[l]=o.prototype[l])}function u(e){if(!(this instanceof u))return new u(e);a.call(this,e),o.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once(`end`,f)}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function f(){this.allowHalfOpen||this._writableState.ended||n.nextTick(p,this)}function p(e){e.end()}Object.defineProperty(u.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),u.prototype._destroy=function(e,t){this.push(null),this.end(),n.nextTick(t,e)}})),se=n(((e,t)=>{var n=a(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=o);function o(e,t,n){return r(e,t,n)}i(r,o),o.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},o.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},o.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},o.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),U=n((e=>{var t=se().Buffer,n=t.isEncoding||function(e){switch(e=``+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 r(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}}function i(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=a;function a(e){this.encoding=i(e);var n;switch(this.encoding){case`utf16le`:this.text=f,this.end=p,n=4;break;case`utf8`:this.fillLast=l,n=4;break;case`base64`:this.text=m,this.end=h,n=3;break;default:this.write=g,this.end=_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}a.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},a.prototype.end=d,a.prototype.text=u,a.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};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 s(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function l(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function u(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function d(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function f(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function m(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?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-n))}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 g(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):``}})),ce=n(((t,n)=>{var r=e(x()),i=I();n.exports=T;var a=re(),o;T.ReadableState=w,u().EventEmitter;var s=function(e,t){return e.listeners(t).length},c=L(),l=R().Buffer,f=(typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:{}).Uint8Array||function(){};function p(e){return l.from(e)}function m(e){return l.isBuffer(e)||e instanceof f}var h=Object.create(ie());h.inherits=d();var g=z(),_=void 0;_=g&&g.debuglog?g.debuglog(`stream`):function(){};var v=ae(),y=V(),b;h.inherits(T,c);var S=[`error`,`close`,`destroy`,`pause`,`resume`];function C(e,t,n){if(typeof e.prependListener==`function`)return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):a(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function w(e,t){o||=oe(),e||={};var n=t instanceof o;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,i=e.readableHighWaterMark,a=this.objectMode?16:16*1024;r||r===0?this.highWaterMark=r:n&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new v,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||`utf8`,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||=U().StringDecoder,this.decoder=new b(e.encoding),this.encoding=e.encoding)}function T(e){if(o||=oe(),!(this instanceof T))return new T(e);this._readableState=new w(e,this),this.readable=!0,e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy)),c.call(this)}Object.defineProperty(T.prototype,"destroyed",{get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),T.prototype.destroy=y.destroy,T.prototype._undestroy=y.undestroy,T.prototype._destroy=function(e,t){this.push(null),t(e)},T.prototype.push=function(e,t){var n=this._readableState,r;return n.objectMode?r=!0:typeof e==`string`&&(t||=n.defaultEncoding,t!==n.encoding&&(e=l.from(e,t),t=``),r=!0),E(this,e,t,!1,r)},T.prototype.unshift=function(e){return E(this,e,null,!0,!1)};function E(e,t,n,r,i){var a=e._readableState;if(t===null)a.reading=!1,M(e,a);else{var o;i||(o=O(a,t)),o?e.emit(`error`,o):a.objectMode||t&&t.length>0?(typeof t!=`string`&&!a.objectMode&&Object.getPrototypeOf(t)!==l.prototype&&(t=p(t)),r?a.endEmitted?e.emit(`error`,Error(`stream.unshift() after end event`)):D(e,a,t,!0):a.ended?e.emit(`error`,Error(`stream.push() after EOF`)):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||t.length!==0?D(e,a,t,!1):P(e,a)):D(e,a,t,!1))):r||(a.reading=!1)}return k(a)}function D(e,t,n,r){t.flowing&&t.length===0&&!t.sync?(e.emit(`data`,n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&te(e)),P(e,t)}function O(e,t){var n;return!m(t)&&typeof t!=`string`&&t!==void 0&&!e.objectMode&&(n=TypeError(`Invalid non-string/buffer chunk`)),n}function k(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}T.prototype.isPaused=function(){return this._readableState.flowing===!1},T.prototype.setEncoding=function(e){return b||=U().StringDecoder,this._readableState.decoder=new b(e),this._readableState.encoding=e,this};var A=8388608;function ee(e){return e>=A?e=A:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=ee(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}T.prototype.read=function(e){_(`read`,e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return _(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?q(this):te(this),null;if(e=j(e,t),e===0&&t.ended)return t.length===0&&q(this),null;var r=t.needReadable;_(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,_(`length less than watermark`,r)),t.ended||t.reading?(r=!1,_(`reading or ended`,r)):r&&(_(`do read`),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=j(n,t)));var i=e>0?W(e,t):null;return i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&q(this)),i!==null&&this.emit(`data`,i),i};function M(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,te(e)}}function te(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(_(`emitReadable`,t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(N,e):N(e))}function N(e){_(`emit readable`),e.emit(`readable`),ce(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(ne,e,t))}function ne(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(_(`maybeReadMore read 0`),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}T.prototype._read=function(e){this.emit(`error`,Error(`_read() is not implemented`))},T.prototype.pipe=function(e,t){var n=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e);break}a.pipesCount+=1,_(`pipe count=%d opts=%j`,a.pipesCount,t);var o=(!t||t.end!==!1)&&e!==r.default.stdout&&e!==r.default.stderr?l:y;a.endEmitted?i.nextTick(o):n.once(`end`,o),e.on(`unpipe`,c);function c(e,t){_(`onunpipe`),e===n&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,f())}function l(){_(`onend`),e.end()}var u=F(n);e.on(`drain`,u);var d=!1;function f(){_(`cleanup`),e.removeListener(`close`,g),e.removeListener(`finish`,v),e.removeListener(`drain`,u),e.removeListener(`error`,h),e.removeListener(`unpipe`,c),n.removeListener(`end`,l),n.removeListener(`end`,y),n.removeListener(`data`,m),d=!0,a.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&u()}var p=!1;n.on(`data`,m);function m(t){_(`ondata`),p=!1,!1===e.write(t)&&!p&&((a.pipesCount===1&&a.pipes===e||a.pipesCount>1&&J(a.pipes,e)!==-1)&&!d&&(_(`false write response, pause`,a.awaitDrain),a.awaitDrain++,p=!0),n.pause())}function h(t){_(`onerror`,t),y(),e.removeListener(`error`,h),s(e,`error`)===0&&e.emit(`error`,t)}C(e,`error`,h);function g(){e.removeListener(`finish`,v),y()}e.once(`close`,g);function v(){_(`onfinish`),e.removeListener(`close`,g),y()}e.once(`finish`,v);function y(){_(`unpipe`),n.unpipe(e)}return e.emit(`pipe`,n),a.flowing||(_(`pipe resume`),n.resume()),e};function F(e){return function(){var t=e._readableState;_(`pipeOnDrain`,t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&s(e,`data`)&&(t.flowing=!0,ce(e))}}T.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||=t.pipes,t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit(`unpipe`,this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)r[a].emit(`unpipe`,this,{hasUnpiped:!1});return this}var o=J(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),--t.pipesCount,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit(`unpipe`,this,n),this)},T.prototype.on=function(e,t){var n=c.prototype.on.call(this,e,t);if(e===`data`)this._readableState.flowing!==!1&&this.resume();else if(e===`readable`){var r=this._readableState;!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&te(this):i.nextTick(B,this))}return n},T.prototype.addListener=T.prototype.on;function B(e){_(`readable nexttick read 0`),e.read(0)}T.prototype.resume=function(){var e=this._readableState;return e.flowing||(_(`resume`),e.flowing=!0,H(this,e)),this};function H(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(se,e,t))}function se(e,t){t.reading||(_(`resume read 0`),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit(`resume`),ce(e),t.flowing&&!t.reading&&e.read(0)}T.prototype.pause=function(){return _(`call pause flowing=%j`,this._readableState.flowing),!1!==this._readableState.flowing&&(_(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this};function ce(e){var t=e._readableState;for(_(`flow`,t.flowing);t.flowing&&e.read()!==null;);}T.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on(`end`,function(){if(_(`wrapped end`),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on(`data`,function(i){_(`wrapped data`),n.decoder&&(i=n.decoder.write(i)),!(n.objectMode&&i==null)&&(!n.objectMode&&(!i||!i.length)||t.push(i)||(r=!0,e.pause()))}),e)this[i]===void 0&&typeof e[i]==`function`&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<S.length;a++)e.on(S[a],this.emit.bind(this,S[a]));return this._read=function(t){_(`wrapped _read`,t),r&&(r=!1,e.resume())},this},Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),T._fromList=W;function W(e,t){if(t.length===0)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=G(e,t.buffer,t.decoder),n}function G(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?le(e,t):K(e,t),r}function le(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),e-=o,e===0){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}function K(e,t){var n=l.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),e-=o,e===0){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}function q(e){var t=e._readableState;if(t.length>0)throw Error(`"endReadable()" called on non-empty stream`);t.endEmitted||(t.ended=!0,i.nextTick(ue,t,e))}function ue(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit(`end`))}function J(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}})),W=n(((e,t)=>{t.exports=a;var n=oe(),r=Object.create(ie());r.inherits=d(),r.inherits(a,n);function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit(`error`,Error(`write callback called multiple times`));n.writechunk=null,n.writecb=null,t!=null&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function a(e){if(!(this instanceof a))return new a(e);n.call(this,e),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,o)}function o(){var e=this;typeof this._flush==`function`?this._flush(function(t,n){s(e,t,n)}):s(this,null,null)}a.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},a.prototype._transform=function(e,t,n){throw Error(`_transform() is not implemented`)},a.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},a.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,function(e){t(e),r.emit(`close`)})};function s(e,t,n){if(t)return e.emit(`error`,t);if(n!=null&&e.push(n),e._writableState.length)throw Error(`Calling transform done when ws.length != 0`);if(e._transformState.transforming)throw Error(`Calling transform done when still transforming`);return e.push(null)}})),G=n(((e,t)=>{t.exports=i;var n=W(),r=Object.create(ie());r.inherits=d(),r.inherits(i,n);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}i.prototype._transform=function(e,t,n){n(null,e)}})),le=n(((e,t)=>{e=t.exports=ce(),e.Stream=e,e.Readable=e,e.Writable=H(),e.Duplex=oe(),e.Transform=W(),e.PassThrough=G()})),K=n(((e,t)=>{var n=_().Buffer,r=F(),i=le().Transform,a=d();function o(e){i.call(this),this._block=n.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}a(o,i),o.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},o.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},o.prototype.update=function(e,t){if(this._finalized)throw Error(`Digest already called`);for(var n=r(e,t),i=this._block,a=0;this._blockOffset+n.length-a>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)i[o]=n[a],o+=1,a+=1;this._update(),this._blockOffset=0}for(;a<n.length;)i[this._blockOffset]=n[a],this._blockOffset+=1,a+=1;for(var s=0,c=n.length*8;c>0;++s)this._length[s]+=c,c=this._length[s]/4294967296|0,c>0&&(this._length[s]-=4294967296*c);return this},o.prototype._update=function(){throw Error(`_update is not implemented`)},o.prototype.digest=function(e){if(this._finalized)throw Error(`Digest already called`);this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},o.prototype._digest=function(){throw Error(`_digest is not implemented`)},t.exports=o})),q=n(((e,t)=>{var n=a().Buffer,r=d(),i=K(),o=Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],c=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],l=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],u=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],f=[0,1518500249,1859775393,2400959708,2840853838],p=[1352829926,1548603684,1836072691,2053994217,0];function m(e,t){return e<<t|e>>>32-t}function h(e,t,n,r,i,a,o,s){return m(e+(t^n^r)+a+o|0,s)+i|0}function g(e,t,n,r,i,a,o,s){return m(e+(t&n|~t&r)+a+o|0,s)+i|0}function _(e,t,n,r,i,a,o,s){return m(e+((t|~n)^r)+a+o|0,s)+i|0}function v(e,t,n,r,i,a,o,s){return m(e+(t&r|n&~r)+a+o|0,s)+i|0}function y(e,t,n,r,i,a,o,s){return m(e+(t^(n|~r))+a+o|0,s)+i|0}function b(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}r(b,i),b.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);for(var n=this._a|0,r=this._b|0,i=this._c|0,a=this._d|0,d=this._e|0,b=this._a|0,x=this._b|0,S=this._c|0,C=this._d|0,w=this._e|0,T=0;T<80;T+=1){var E,D;T<16?(E=h(n,r,i,a,d,e[s[T]],f[0],l[T]),D=y(b,x,S,C,w,e[c[T]],p[0],u[T])):T<32?(E=g(n,r,i,a,d,e[s[T]],f[1],l[T]),D=v(b,x,S,C,w,e[c[T]],p[1],u[T])):T<48?(E=_(n,r,i,a,d,e[s[T]],f[2],l[T]),D=_(b,x,S,C,w,e[c[T]],p[2],u[T])):T<64?(E=v(n,r,i,a,d,e[s[T]],f[3],l[T]),D=g(b,x,S,C,w,e[c[T]],p[3],u[T])):(E=y(n,r,i,a,d,e[s[T]],f[4],l[T]),D=h(b,x,S,C,w,e[c[T]],p[4],u[T])),n=d,d=a,a=m(i,10),i=r,r=E,b=w,w=C,C=m(S,10),S=x,x=D}var O=this._b+i+C|0;this._b=this._c+a+w|0,this._c=this._d+d+b|0,this._d=this._e+n+x|0,this._e=this._a+r+S|0,this._a=O},b.prototype._digest=function(){this._block[this._blockOffset]=128,this._blockOffset+=1,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=n.alloc?n.alloc(20):new n(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},t.exports=b})),ue=n(((e,t)=>{var n=d(),r=D(),i=_().Buffer,a=[1518500249,1859775393,-1894007588,-899497514],o=Array(80);function s(){this.init(),this._w=o,r.call(this,64,56)}n(s,r),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function c(e){return e<<5|e>>>27}function l(e){return e<<30|e>>>2}function u(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}s.prototype._update=function(e){for(var t=this._w,n=this._a|0,r=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,d=0;d<16;++d)t[d]=e.readInt32BE(d*4);for(;d<80;++d)t[d]=t[d-3]^t[d-8]^t[d-14]^t[d-16];for(var f=0;f<80;++f){var p=~~(f/20),m=c(n)+u(p,r,i,o)+s+t[f]+a[p]|0;s=o,o=i,i=l(r),r=n,n=m}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0},s.prototype._hash=function(){var e=i.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e},t.exports=s})),J=n(((e,t)=>{var n=d(),r=D(),i=_().Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],o=Array(64);function s(){this.init(),this._w=o,r.call(this,64,56)}n(s,r),s.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function c(e,t,n){return n^e&(t^n)}function l(e,t,n){return e&t|n&(e|t)}function u(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function f(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function p(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function m(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}s.prototype._update=function(e){for(var t=this._w,n=this._a|0,r=this._b|0,i=this._c|0,o=this._d|0,s=this._e|0,d=this._f|0,h=this._g|0,g=this._h|0,_=0;_<16;++_)t[_]=e.readInt32BE(_*4);for(;_<64;++_)t[_]=m(t[_-2])+t[_-7]+p(t[_-15])+t[_-16]|0;for(var v=0;v<64;++v){var y=g+f(s)+c(s,d,h)+a[v]+t[v]|0,b=u(n)+l(n,r,i)|0;g=h,h=d,d=s,s=o+y|0,o=i,i=r,r=n,n=y+b|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=d+this._f|0,this._g=h+this._g|0,this._h=g+this._h|0},s.prototype._hash=function(){var e=i.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=s})),de=n(((e,t)=>{var n=d(),r=J(),i=D(),a=_().Buffer,o=Array(64);function s(){this.init(),this._w=o,i.call(this,64,56)}n(s,r),s.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},s.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=s})),fe=n(((e,t)=>{var n=d(),r=D(),i=_().Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],o=Array(160);function s(){this.init(),this._w=o,r.call(this,128,112)}n(s,r),s.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function c(e,t,n){return n^e&(t^n)}function l(e,t,n){return e&t|n&(e|t)}function u(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function f(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function m(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function h(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function v(e,t){return+(e>>>0<t>>>0)}s.prototype._update=function(e){for(var t=this._w,n=this._ah|0,r=this._bh|0,i=this._ch|0,o=this._dh|0,s=this._eh|0,d=this._fh|0,_=this._gh|0,y=this._hh|0,b=this._al|0,x=this._bl|0,S=this._cl|0,C=this._dl|0,w=this._el|0,T=this._fl|0,E=this._gl|0,D=this._hl|0,O=0;O<32;O+=2)t[O]=e.readInt32BE(O*4),t[O+1]=e.readInt32BE(O*4+4);for(;O<160;O+=2){var k=t[O-30],A=t[O-30+1],ee=p(k,A),j=m(A,k);k=t[O-4],A=t[O-4+1];var M=h(k,A),te=g(A,k),N=t[O-14],P=t[O-14+1],ne=t[O-32],F=t[O-32+1],I=j+P|0,re=ee+N+v(I,j)|0;I=I+te|0,re=re+M+v(I,te)|0,I=I+F|0,re=re+ne+v(I,F)|0,t[O]=re,t[O+1]=I}for(var L=0;L<160;L+=2){re=t[L],I=t[L+1];var R=l(n,r,i),ie=l(b,x,S),z=u(n,b),B=u(b,n),ae=f(s,w),V=f(w,s),H=a[L],oe=a[L+1],se=c(s,d,_),U=c(w,T,E),ce=D+V|0,W=y+ae+v(ce,D)|0;ce=ce+U|0,W=W+se+v(ce,U)|0,ce=ce+oe|0,W=W+H+v(ce,oe)|0,ce=ce+I|0,W=W+re+v(ce,I)|0;var G=B+ie|0,le=z+R+v(G,B)|0;y=_,D=E,_=d,E=T,d=s,T=w,w=C+ce|0,s=o+W+v(w,C)|0,o=i,C=S,i=r,S=x,r=n,x=b,b=ce+G|0,n=W+le+v(b,ce)|0}this._al=this._al+b|0,this._bl=this._bl+x|0,this._cl=this._cl+S|0,this._dl=this._dl+C|0,this._el=this._el+w|0,this._fl=this._fl+T|0,this._gl=this._gl+E|0,this._hl=this._hl+D|0,this._ah=this._ah+n+v(this._al,b)|0,this._bh=this._bh+r+v(this._bl,x)|0,this._ch=this._ch+i+v(this._cl,S)|0,this._dh=this._dh+o+v(this._dl,C)|0,this._eh=this._eh+s+v(this._el,w)|0,this._fh=this._fh+d+v(this._fl,T)|0,this._gh=this._gh+_+v(this._gl,E)|0,this._hh=this._hh+y+v(this._hl,D)|0},s.prototype._hash=function(){var e=i.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},t.exports=s})),pe=n(((e,t)=>{var n=d(),r=fe(),i=D(),a=_().Buffer,o=Array(160);function s(){this.init(),this._w=o,i.call(this,128,112)}n(s,r),s.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},s.prototype._hash=function(){var e=a.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},t.exports=s})),me=n(((e,t)=>{t.exports=function(e){var n=e.toLowerCase(),r=t.exports[n];if(!r)throw Error(n+` is not supported (we accept pull requests)`);return new r},t.exports.sha=ue(),t.exports.sha1=O(),t.exports.sha224=de(),t.exports.sha256=J(),t.exports.sha384=pe(),t.exports.sha512=fe()})),Y=n(((e,t)=>{var n=_().Buffer,r=c().Transform,i=l().StringDecoder,a=d(),o=E();function s(e){r.call(this),this.hashMode=typeof e==`string`,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&=(this.__final=this._final,null),this._decoder=null,this._encoding=null}a(s,r),s.prototype.update=function(e,t,n){var r=o(e,t),i=this._update(r);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw Error(`trying to get auth tag in unsupported state`)},s.prototype.setAuthTag=function(){throw Error(`trying to set auth tag in unsupported state`)},s.prototype.setAAD=function(){throw Error(`trying to set aad in unsupported state`)},s.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},s.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},s.prototype._finalOrDigest=function(e){var t=this.__final()||n.alloc(0);return e&&(t=this._toString(t,e,!0)),t},s.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new i(t),this._encoding=t),this._encoding!==t)throw Error(`can’t switch encodings`);var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r},t.exports=s})),X=n(((e,t)=>{var n=d(),r=ne(),i=q(),a=me(),o=Y();function s(e){o.call(this,`digest`),this._hash=e}n(s,o),s.prototype._update=function(e){this._hash.update(e)},s.prototype._final=function(){return this._hash.digest()},t.exports=function(e){return e=e.toLowerCase(),e===`md5`?new r:e===`rmd160`||e===`ripemd160`?new i:new s(a(e))}})),Z=n(((e,t)=>{var n=d(),r=_().Buffer,i=Y(),a=r.alloc(128),o=64;function s(e,t){i.call(this,`digest`),typeof t==`string`&&(t=r.from(t)),this._alg=e,this._key=t,t.length>o?t=e(t):t.length<o&&(t=r.concat([t,a],o));for(var n=this._ipad=r.allocUnsafe(o),s=this._opad=r.allocUnsafe(o),c=0;c<o;c++)n[c]=t[c]^54,s[c]=t[c]^92;this._hash=[n]}n(s,i),s.prototype._update=function(e){this._hash.push(e)},s.prototype._final=function(){var e=this._alg(r.concat(this._hash));return this._alg(r.concat([this._opad,e]))},t.exports=s})),he=n(((e,t)=>{var n=ne();t.exports=function(e){return new n().update(e).digest()}})),ge=n(((e,t)=>{var n=d(),r=Z(),i=Y(),a=_().Buffer,o=he(),s=q(),c=me(),l=a.alloc(128);function u(e,t){i.call(this,`digest`),typeof t==`string`&&(t=a.from(t));var n=e===`sha512`||e===`sha384`?128:64;this._alg=e,this._key=t,t.length>n?t=(e===`rmd160`?new s:c(e)).update(t).digest():t.length<n&&(t=a.concat([t,l],n));for(var r=this._ipad=a.allocUnsafe(n),o=this._opad=a.allocUnsafe(n),u=0;u<n;u++)r[u]=t[u]^54,o[u]=t[u]^92;this._hash=e===`rmd160`?new s:c(e),this._hash.update(r)}n(u,i),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){var e=this._hash.digest();return(this._alg===`rmd160`?new s:c(this._alg)).update(this._opad).update(e).digest()},t.exports=function(e,t){return e=e.toLowerCase(),e===`rmd160`||e===`ripemd160`?new u(`rmd160`,t):e===`md5`?new r(o,t):new u(e,t)}})),_e=n(((e,t)=>{t.exports={sha224WithRSAEncryption:{sign:`rsa`,hash:`sha224`,id:`302d300d06096086480165030402040500041c`},"RSA-SHA224":{sign:`ecdsa/rsa`,hash:`sha224`,id:`302d300d06096086480165030402040500041c`},sha256WithRSAEncryption:{sign:`rsa`,hash:`sha256`,id:`3031300d060960864801650304020105000420`},"RSA-SHA256":{sign:`ecdsa/rsa`,hash:`sha256`,id:`3031300d060960864801650304020105000420`},sha384WithRSAEncryption:{sign:`rsa`,hash:`sha384`,id:`3041300d060960864801650304020205000430`},"RSA-SHA384":{sign:`ecdsa/rsa`,hash:`sha384`,id:`3041300d060960864801650304020205000430`},sha512WithRSAEncryption:{sign:`rsa`,hash:`sha512`,id:`3051300d060960864801650304020305000440`},"RSA-SHA512":{sign:`ecdsa/rsa`,hash:`sha512`,id:`3051300d060960864801650304020305000440`},"RSA-SHA1":{sign:`rsa`,hash:`sha1`,id:`3021300906052b0e03021a05000414`},"ecdsa-with-SHA1":{sign:`ecdsa`,hash:`sha1`,id:``},sha256:{sign:`ecdsa/rsa`,hash:`sha256`,id:`3031300d060960864801650304020105000420`},sha224:{sign:`ecdsa/rsa`,hash:`sha224`,id:`302d300d06096086480165030402040500041c`},sha384:{sign:`ecdsa/rsa`,hash:`sha384`,id:`3041300d060960864801650304020205000430`},sha512:{sign:`ecdsa/rsa`,hash:`sha512`,id:`3051300d060960864801650304020305000440`},"DSA-SHA":{sign:`dsa`,hash:`sha1`,id:``},"DSA-SHA1":{sign:`dsa`,hash:`sha1`,id:``},DSA:{sign:`dsa`,hash:`sha1`,id:``},"DSA-WITH-SHA224":{sign:`dsa`,hash:`sha224`,id:``},"DSA-SHA224":{sign:`dsa`,hash:`sha224`,id:``},"DSA-WITH-SHA256":{sign:`dsa`,hash:`sha256`,id:``},"DSA-SHA256":{sign:`dsa`,hash:`sha256`,id:``},"DSA-WITH-SHA384":{sign:`dsa`,hash:`sha384`,id:``},"DSA-SHA384":{sign:`dsa`,hash:`sha384`,id:``},"DSA-WITH-SHA512":{sign:`dsa`,hash:`sha512`,id:``},"DSA-SHA512":{sign:`dsa`,hash:`sha512`,id:``},"DSA-RIPEMD160":{sign:`dsa`,hash:`rmd160`,id:``},ripemd160WithRSA:{sign:`rsa`,hash:`rmd160`,id:`3021300906052b2403020105000414`},"RSA-RIPEMD160":{sign:`rsa`,hash:`rmd160`,id:`3021300906052b2403020105000414`},md5WithRSAEncryption:{sign:`rsa`,hash:`md5`,id:`3020300c06082a864886f70d020505000410`},"RSA-MD5":{sign:`rsa`,hash:`md5`,id:`3020300c06082a864886f70d020505000410`}}})),ve=n(((e,t)=>{t.exports=_e()})),ye=n(((e,t)=>{var n=isFinite,r=2**30-1;t.exports=function(e,t){if(typeof e!=`number`)throw TypeError(`Iterations not a number`);if(e<0||!n(e))throw TypeError(`Bad iterations`);if(typeof t!=`number`)throw TypeError(`Key length not a number`);if(t<0||t>r||t!==t)throw TypeError(`Bad key length`);return t+0}})),be=n(((t,n)=>{var r=e(x());n.exports=globalThis.process&&globalThis.process.browser?`utf-8`:globalThis.process&&globalThis.process.version?parseInt(r.default.version.split(`.`)[0].slice(1),10)>=6?`utf-8`:`binary`:`utf-8`})),xe=n(((e,t)=>{var n=_().Buffer,r=E(),i=typeof Uint8Array<`u`,a=i&&typeof ArrayBuffer<`u`&&ArrayBuffer.isView;t.exports=function(e,t,o){if(typeof e==`string`||n.isBuffer(e)||i&&e instanceof Uint8Array||a&&a(e))return r(e,t);throw TypeError(o+` must be a string, a Buffer, a Uint8Array, or a DataView`)}})),Se=n(((e,t)=>{var n=he(),r=q(),i=me(),a=_().Buffer,o=ye(),s=be(),c=xe(),l=a.alloc(128),u={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},d={__proto__:null,"sha-1":`sha1`,"sha-224":`sha224`,"sha-256":`sha256`,"sha-384":`sha384`,"sha-512":`sha512`,"ripemd-160":`ripemd160`};function f(e){return new r().update(e).digest()}function p(e){function t(t){return i(e).update(t).digest()}return e===`rmd160`||e===`ripemd160`?f:e===`md5`?n:t}function m(e,t,n){var r=p(e),i=e===`sha512`||e===`sha384`?128:64;t.length>i?t=r(t):t.length<i&&(t=a.concat([t,l],i));for(var o=a.allocUnsafe(i+u[e]),s=a.allocUnsafe(i+u[e]),c=0;c<i;c++)o[c]=t[c]^54,s[c]=t[c]^92;var d=a.allocUnsafe(i+n+4);o.copy(d,0,0,i),this.ipad1=d,this.ipad2=o,this.opad=s,this.alg=e,this.blocksize=i,this.hash=r,this.size=u[e]}m.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)};function h(e,t,n,r,i){r=o(n,r),e=c(e,s,`Password`),t=c(t,s,`Salt`);var l=(i||`sha1`).toLowerCase(),f=d[l]||l,p=u[f];if(typeof p!=`number`||!p)throw TypeError(`Digest algorithm not supported: `+i);var h=new m(f,e,t.length),g=a.allocUnsafe(r),_=a.allocUnsafe(t.length+4);t.copy(_,0,0,t.length);for(var v=0,y=p,b=Math.ceil(r/y),x=1;x<=b;x++){_.writeUInt32BE(x,t.length);for(var S=h.run(_,h.ipad1),C=S,w=1;w<n;w++){C=h.run(C,h.ipad2);for(var T=0;T<y;T++)S[T]^=C[T]}S.copy(g,v),v+=y}return g}t.exports=h})),Ce=n(((e,t)=>{var n=_().Buffer,r=ye(),i=be(),a=Se(),o=xe(),s,c=globalThis.crypto&&globalThis.crypto.subtle,l={sha:`SHA-1`,"sha-1":`SHA-1`,sha1:`SHA-1`,sha256:`SHA-256`,"sha-256":`SHA-256`,sha384:`SHA-384`,"sha-384":`SHA-384`,"sha-512":`SHA-512`,sha512:`SHA-512`},u=[],d;function f(){return d||(d=globalThis.process&&globalThis.process.nextTick?globalThis.process.nextTick:globalThis.queueMicrotask?globalThis.queueMicrotask:globalThis.setImmediate?globalThis.setImmediate:globalThis.setTimeout,d)}function p(e,t,r,i,a){return c.importKey(`raw`,e,{name:`PBKDF2`},!1,[`deriveBits`]).then(function(e){return c.deriveBits({name:`PBKDF2`,salt:t,iterations:r,hash:{name:a}},e,i<<3)}).then(function(e){return n.from(e)})}function m(e){if(globalThis.process&&!globalThis.process.browser||!c||!c.importKey||!c.deriveBits)return Promise.resolve(!1);if(u[e]!==void 0)return u[e];s||=n.alloc(8);var t=p(s,s,10,128,e).then(function(){return!0},function(){return!1});return u[e]=t,t}function h(e,t){e.then(function(e){f()(function(){t(null,e)})},function(e){f()(function(){t(e)})})}t.exports=function(e,t,n,s,c,u){if(typeof c==`function`&&(u=c,c=void 0),s=r(n,s),e=o(e,i,`Password`),t=o(t,i,`Salt`),typeof u!=`function`)throw Error(`No callback provided to pbkdf2`);c||=`sha1`;var d=l[c.toLowerCase()];if(!d||typeof globalThis.Promise!=`function`){f()(function(){var r;try{r=a(e,t,n,s,c)}catch(e){u(e);return}u(null,r)});return}h(m(d).then(function(r){return r?p(e,t,n,s,d):a(e,t,n,s,c)}),u)}})),we=n((e=>{e.pbkdf2=Ce(),e.pbkdf2Sync=Se()})),Te=n((e=>{e.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},e.writeUInt32BE=function(e,t,n){e[0+n]=t>>>24,e[1+n]=t>>>16&255,e[2+n]=t>>>8&255,e[3+n]=t&255},e.ip=function(e,t,n,r){for(var i=0,a=0,o=6;o>=0;o-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+o&1;for(var s=0;s<=24;s+=8)i<<=1,i|=e>>>s+o&1}for(var o=6;o>=0;o-=2){for(var s=1;s<=25;s+=8)a<<=1,a|=t>>>s+o&1;for(var s=1;s<=25;s+=8)a<<=1,a|=e>>>s+o&1}n[r+0]=i>>>0,n[r+1]=a>>>0},e.rip=function(e,t,n,r){for(var i=0,a=0,o=0;o<4;o++)for(var s=24;s>=0;s-=8)i<<=1,i|=t>>>s+o&1,i<<=1,i|=e>>>s+o&1;for(var o=4;o<8;o++)for(var s=24;s>=0;s-=8)a<<=1,a|=t>>>s+o&1,a<<=1,a|=e>>>s+o&1;n[r+0]=i>>>0,n[r+1]=a>>>0},e.pc1=function(e,t,n,r){for(var i=0,a=0,o=7;o>=5;o--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+o&1;for(var s=0;s<=24;s+=8)i<<=1,i|=e>>s+o&1}for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+o&1;for(var o=1;o<=3;o++){for(var s=0;s<=24;s+=8)a<<=1,a|=t>>s+o&1;for(var s=0;s<=24;s+=8)a<<=1,a|=e>>s+o&1}for(var s=0;s<=24;s+=8)a<<=1,a|=e>>s+o&1;n[r+0]=i>>>0,n[r+1]=a>>>0},e.r28shl=function(e,t){return e<<t&268435455|e>>>28-t};var t=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(e,n,r,i){for(var a=0,o=0,s=t.length>>>1,c=0;c<s;c++)a<<=1,a|=e>>>t[c]&1;for(var c=s;c<t.length;c++)o<<=1,o|=n>>>t[c]&1;r[i+0]=a>>>0,r[i+1]=o>>>0},e.expand=function(e,t,n){var r=0,i=0;r=(e&1)<<5|e>>>27;for(var a=23;a>=15;a-=4)r<<=6,r|=e>>>a&63;for(var a=11;a>=3;a-=4)i|=e>>>a&63,i<<=6;i|=(e&31)<<1|e>>>31,t[n+0]=r>>>0,t[n+1]=i>>>0};var n=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(e,t){for(var r=0,i=0;i<4;i++){var a=e>>>18-i*6&63,o=n[i*64+a];r<<=4,r|=o}for(var i=0;i<4;i++){var a=t>>>18-i*6&63,o=n[256+i*64+a];r<<=4,r|=o}return r>>>0};var r=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(e){for(var t=0,n=0;n<r.length;n++)t<<=1,t|=e>>>r[n]&1;return t>>>0},e.padSplit=function(e,t,n){for(var r=e.toString(2);r.length<t;)r=`0`+r;for(var i=[],a=0;a<t;a+=n)i.push(r.slice(a,a+n));return i.join(` `)}})),Ee=n(((e,t)=>{t.exports=n;function n(e,t){if(!e)throw Error(t||`Assertion failed`)}n.equal=function(e,t,n){if(e!=t)throw Error(n||`Assertion failed: `+e+` != `+t)}})),De=n(((e,t)=>{var n=Ee();function r(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=Array(this.blockSize),this.bufferOff=0,this.padding=e.padding!==!1}t.exports=r,r.prototype._init=function(){},r.prototype.update=function(e){return e.length===0?[]:this.type===`decrypt`?this._updateDecrypt(e):this._updateEncrypt(e)},r.prototype._buffer=function(e,t){for(var n=Math.min(this.buffer.length-this.bufferOff,e.length-t),r=0;r<n;r++)this.buffer[this.bufferOff+r]=e[t+r];return this.bufferOff+=n,n},r.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},r.prototype._updateEncrypt=function(e){var t=0,n=0,r=(this.bufferOff+e.length)/this.blockSize|0,i=Array(r*this.blockSize);this.bufferOff!==0&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(i,n)));for(var a=e.length-(e.length-t)%this.blockSize;t<a;t+=this.blockSize)this._update(e,t,i,n),n+=this.blockSize;for(;t<e.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=e[t];return i},r.prototype._updateDecrypt=function(e){for(var t=0,n=0,r=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,i=Array(r*this.blockSize);r>0;r--)t+=this._buffer(e,t),n+=this._flushBuffer(i,n);return t+=this._buffer(e,t),i},r.prototype.final=function(e){var t;e&&(t=this.update(e));var n=this.type===`encrypt`?this._finalEncrypt():this._finalDecrypt();return t?t.concat(n):n},r.prototype._pad=function(e,t){if(t===0)return!1;for(;t<e.length;)e[t++]=0;return!0},r.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=Array(this.blockSize);return this._update(this.buffer,0,e,0),e},r.prototype._unpad=function(e){return e},r.prototype._finalDecrypt=function(){n.equal(this.bufferOff,this.blockSize,`Not enough data to decrypt`);var e=Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)}})),Oe=n(((e,t)=>{var n=Ee(),r=d(),i=Te(),a=De();function o(){this.tmp=[,,],this.keys=null}function s(e){a.call(this,e);var t=new o;this._desState=t,this.deriveKeys(t,e.key)}r(s,a),t.exports=s,s.create=function(e){return new s(e)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];s.prototype.deriveKeys=function(e,t){e.keys=Array(32),n.equal(t.length,this.blockSize,`Invalid key length`);var r=i.readUInt32BE(t,0),a=i.readUInt32BE(t,4);i.pc1(r,a,e.tmp,0),r=e.tmp[0],a=e.tmp[1];for(var o=0;o<e.keys.length;o+=2){var s=c[o>>>1];r=i.r28shl(r,s),a=i.r28shl(a,s),i.pc2(r,a,e.keys,o)}},s.prototype._update=function(e,t,n,r){var a=this._desState,o=i.readUInt32BE(e,t),s=i.readUInt32BE(e,t+4);i.ip(o,s,a.tmp,0),o=a.tmp[0],s=a.tmp[1],this.type===`encrypt`?this._encrypt(a,o,s,a.tmp,0):this._decrypt(a,o,s,a.tmp,0),o=a.tmp[0],s=a.tmp[1],i.writeUInt32BE(n,o,r),i.writeUInt32BE(n,s,r+4)},s.prototype._pad=function(e,t){if(this.padding===!1)return!1;for(var n=e.length-t,r=t;r<e.length;r++)e[r]=n;return!0},s.prototype._unpad=function(e){if(this.padding===!1)return e;for(var t=e[e.length-1],r=e.length-t;r<e.length;r++)n.equal(e[r],t);return e.slice(0,e.length-t)},s.prototype._encrypt=function(e,t,n,r,a){for(var o=t,s=n,c=0;c<e.keys.length;c+=2){var l=e.keys[c],u=e.keys[c+1];i.expand(s,e.tmp,0),l^=e.tmp[0],u^=e.tmp[1];var d=i.substitute(l,u),f=i.permute(d),p=s;s=(o^f)>>>0,o=p}i.rip(s,o,r,a)},s.prototype._decrypt=function(e,t,n,r,a){for(var o=n,s=t,c=e.keys.length-2;c>=0;c-=2){var l=e.keys[c],u=e.keys[c+1];i.expand(o,e.tmp,0),l^=e.tmp[0],u^=e.tmp[1];var d=i.substitute(l,u),f=i.permute(d),p=o;o=(s^f)>>>0,s=p}i.rip(o,s,r,a)}})),ke=n((e=>{var t=Ee(),n=d(),r={};function i(e){t.equal(e.length,8,`Invalid IV length`),this.iv=Array(8);for(var n=0;n<this.iv.length;n++)this.iv[n]=e[n]}function a(e){function t(t){e.call(this,t),this._cbcInit()}n(t,e);for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];t.prototype[o]=r[o]}return t.create=function(e){return new t(e)},t}e.instantiate=a,r._cbcInit=function(){var e=new i(this.options.iv);this._cbcState=e},r._update=function(e,t,n,r){var i=this._cbcState,a=this.constructor.super_.prototype,o=i.iv;if(this.type===`encrypt`){for(var s=0;s<this.blockSize;s++)o[s]^=e[t+s];a._update.call(this,o,0,n,r);for(var s=0;s<this.blockSize;s++)o[s]=n[r+s]}else{a._update.call(this,e,t,n,r);for(var s=0;s<this.blockSize;s++)n[r+s]^=o[s];for(var s=0;s<this.blockSize;s++)o[s]=e[t+s]}}})),Ae=n(((e,t)=>{var n=Ee(),r=d(),i=De(),a=Oe();function o(e,t){n.equal(t.length,24,`Invalid key length`);var r=t.slice(0,8),i=t.slice(8,16),o=t.slice(16,24);e===`encrypt`?this.ciphers=[a.create({type:`encrypt`,key:r}),a.create({type:`decrypt`,key:i}),a.create({type:`encrypt`,key:o})]:this.ciphers=[a.create({type:`decrypt`,key:o}),a.create({type:`encrypt`,key:i}),a.create({type:`decrypt`,key:r})]}function s(e){i.call(this,e);var t=new o(this.type,this.options.key);this._edeState=t}r(s,i),t.exports=s,s.create=function(e){return new s(e)},s.prototype._update=function(e,t,n,r){var i=this._edeState;i.ciphers[0]._update(e,t,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},s.prototype._pad=a.prototype._pad,s.prototype._unpad=a.prototype._unpad})),je=n((e=>{e.utils=Te(),e.Cipher=De(),e.DES=Oe(),e.CBC=ke(),e.EDE=Ae()})),Me=n(((e,t)=>{var n=Y(),r=je(),i=d(),a=_().Buffer,o={"des-ede3-cbc":r.CBC.instantiate(r.EDE),"des-ede3":r.EDE,"des-ede-cbc":r.CBC.instantiate(r.EDE),"des-ede":r.EDE,"des-cbc":r.CBC.instantiate(r.DES),"des-ecb":r.DES};o.des=o[`des-cbc`],o.des3=o[`des-ede3-cbc`],t.exports=s,i(s,n);function s(e){n.call(this);var t=e.mode.toLowerCase(),r=o[t],i=e.decrypt?`decrypt`:`encrypt`,s=e.key;a.isBuffer(s)||(s=a.from(s)),(t===`des-ede`||t===`des-ede-cbc`)&&(s=a.concat([s,s.slice(0,8)]));var c=e.iv;a.isBuffer(c)||(c=a.from(c)),this._des=r.create({key:s,iv:c,type:i})}s.prototype._update=function(e){return a.from(this._des.update(e))},s.prototype._final=function(){return a.from(this._des.final())}})),Ne=n((e=>{e.encrypt=function(e,t){return e._cipher.encryptBlock(t)},e.decrypt=function(e,t){return e._cipher.decryptBlock(t)}})),Pe=n(((e,t)=>{var n=a();t.exports=function(e,t){for(var r=Math.min(e.length,t.length),i=new n.Buffer(r),a=0;a<r;++a)i[a]=e[a]^t[a];return i}})),Fe=n((e=>{var t=Pe();e.encrypt=function(e,n){var r=t(n,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},e.decrypt=function(e,n){var r=e._prev;return e._prev=n,t(e._cipher.decryptBlock(n),r)}})),Q=n((e=>{var t=_().Buffer,n=Pe();function r(e,r,i){var a=r.length,o=n(r,e._cache);return e._cache=e._cache.slice(a),e._prev=t.concat([e._prev,i?r:o]),o}e.encrypt=function(e,n,i){for(var a=t.allocUnsafe(0),o;n.length;)if(e._cache.length===0&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=t.allocUnsafe(0)),e._cache.length<=n.length)o=e._cache.length,a=t.concat([a,r(e,n.slice(0,o),i)]),n=n.slice(o);else{a=t.concat([a,r(e,n,i)]);break}return a}})),Ie=n((e=>{var t=_().Buffer;function n(e,n,r){var i=e._cipher.encryptBlock(e._prev)[0]^n;return e._prev=t.concat([e._prev.slice(1),t.from([r?n:i])]),i}e.encrypt=function(e,r,i){for(var a=r.length,o=t.allocUnsafe(a),s=-1;++s<a;)o[s]=n(e,r[s],i);return o}})),Le=n((e=>{var t=_().Buffer;function n(e,t,n){for(var i,a=-1,o=8,s=0,c,l;++a<o;)i=e._cipher.encryptBlock(e._prev),c=t&1<<7-a?128:0,l=i[0]^c,s+=(l&128)>>a%8,e._prev=r(e._prev,n?c:l);return s}function r(e,n){var r=e.length,i=-1,a=t.allocUnsafe(e.length);for(e=t.concat([e,t.from([n])]);++i<r;)a[i]=e[i]<<1|e[i+1]>>7;return a}e.encrypt=function(e,r,i){for(var a=r.length,o=t.allocUnsafe(a),s=-1;++s<a;)o[s]=n(e,r[s],i);return o}})),Re=n((e=>{var t=a(),n=Pe();function r(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}e.encrypt=function(e,i){for(;e._cache.length<i.length;)e._cache=t.Buffer.concat([e._cache,r(e)]);var a=e._cache.slice(0,i.length);return e._cache=e._cache.slice(i.length),n(i,a)}})),ze=n(((e,t)=>{function n(e){for(var t=e.length,n;t--;)if(n=e.readUInt8(t),n===255)e.writeUInt8(0,t);else{n++,e.writeUInt8(n,t);break}}t.exports=n})),Be=n((e=>{var t=Pe(),n=_().Buffer,r=ze();function i(e){var t=e._cipher.encryptBlockRaw(e._prev);return r(e._prev),t}var a=16;e.encrypt=function(e,r){var o=Math.ceil(r.length/a),s=e._cache.length;e._cache=n.concat([e._cache,n.allocUnsafe(o*a)]);for(var c=0;c<o;c++){var l=i(e),u=s+c*a;e._cache.writeUInt32BE(l[0],u+0),e._cache.writeUInt32BE(l[1],u+4),e._cache.writeUInt32BE(l[2],u+8),e._cache.writeUInt32BE(l[3],u+12)}var d=e._cache.slice(0,r.length);return e._cache=e._cache.slice(r.length),t(r,d)}})),Ve=n(((e,t)=>{t.exports={"aes-128-ecb":{cipher:`AES`,key:128,iv:0,mode:`ECB`,type:`block`},"aes-192-ecb":{cipher:`AES`,key:192,iv:0,mode:`ECB`,type:`block`},"aes-256-ecb":{cipher:`AES`,key:256,iv:0,mode:`ECB`,type:`block`},"aes-128-cbc":{cipher:`AES`,key:128,iv:16,mode:`CBC`,type:`block`},"aes-192-cbc":{cipher:`AES`,key:192,iv:16,mode:`CBC`,type:`block`},"aes-256-cbc":{cipher:`AES`,key:256,iv:16,mode:`CBC`,type:`block`},aes128:{cipher:`AES`,key:128,iv:16,mode:`CBC`,type:`block`},aes192:{cipher:`AES`,key:192,iv:16,mode:`CBC`,type:`block`},aes256:{cipher:`AES`,key:256,iv:16,mode:`CBC`,type:`block`},"aes-128-cfb":{cipher:`AES`,key:128,iv:16,mode:`CFB`,type:`stream`},"aes-192-cfb":{cipher:`AES`,key:192,iv:16,mode:`CFB`,type:`stream`},"aes-256-cfb":{cipher:`AES`,key:256,iv:16,mode:`CFB`,type:`stream`},"aes-128-cfb8":{cipher:`AES`,key:128,iv:16,mode:`CFB8`,type:`stream`},"aes-192-cfb8":{cipher:`AES`,key:192,iv:16,mode:`CFB8`,type:`stream`},"aes-256-cfb8":{cipher:`AES`,key:256,iv:16,mode:`CFB8`,type:`stream`},"aes-128-cfb1":{cipher:`AES`,key:128,iv:16,mode:`CFB1`,type:`stream`},"aes-192-cfb1":{cipher:`AES`,key:192,iv:16,mode:`CFB1`,type:`stream`},"aes-256-cfb1":{cipher:`AES`,key:256,iv:16,mode:`CFB1`,type:`stream`},"aes-128-ofb":{cipher:`AES`,key:128,iv:16,mode:`OFB`,type:`stream`},"aes-192-ofb":{cipher:`AES`,key:192,iv:16,mode:`OFB`,type:`stream`},"aes-256-ofb":{cipher:`AES`,key:256,iv:16,mode:`OFB`,type:`stream`},"aes-128-ctr":{cipher:`AES`,key:128,iv:16,mode:`CTR`,type:`stream`},"aes-192-ctr":{cipher:`AES`,key:192,iv:16,mode:`CTR`,type:`stream`},"aes-256-ctr":{cipher:`AES`,key:256,iv:16,mode:`CTR`,type:`stream`},"aes-128-gcm":{cipher:`AES`,key:128,iv:12,mode:`GCM`,type:`auth`},"aes-192-gcm":{cipher:`AES`,key:192,iv:12,mode:`GCM`,type:`auth`},"aes-256-gcm":{cipher:`AES`,key:256,iv:12,mode:`GCM`,type:`auth`}}})),He=n(((e,t)=>{var n={ECB:Ne(),CBC:Fe(),CFB:Q(),CFB8:Ie(),CFB1:Le(),OFB:Re(),CTR:Be(),GCM:Be()},r=Ve();for(var i in r)r[i].module=n[r[i].mode];t.exports=r})),Ue=n(((e,t)=>{var n=_().Buffer;function r(e){n.isBuffer(e)||(e=n.from(e));for(var t=e.length/4|0,r=Array(t),i=0;i<t;i++)r[i]=e.readUInt32BE(i*4);return r}function i(e){for(var t=0;t<e.length;e++)e[t]=0}function a(e,t,n,r,i){for(var a=n[0],o=n[1],s=n[2],c=n[3],l=e[0]^t[0],u=e[1]^t[1],d=e[2]^t[2],f=e[3]^t[3],p,m,h,g,_=4,v=1;v<i;v++)p=a[l>>>24]^o[u>>>16&255]^s[d>>>8&255]^c[f&255]^t[_++],m=a[u>>>24]^o[d>>>16&255]^s[f>>>8&255]^c[l&255]^t[_++],h=a[d>>>24]^o[f>>>16&255]^s[l>>>8&255]^c[u&255]^t[_++],g=a[f>>>24]^o[l>>>16&255]^s[u>>>8&255]^c[d&255]^t[_++],l=p,u=m,d=h,f=g;return p=(r[l>>>24]<<24|r[u>>>16&255]<<16|r[d>>>8&255]<<8|r[f&255])^t[_++],m=(r[u>>>24]<<24|r[d>>>16&255]<<16|r[f>>>8&255]<<8|r[l&255])^t[_++],h=(r[d>>>24]<<24|r[f>>>16&255]<<16|r[l>>>8&255]<<8|r[u&255])^t[_++],g=(r[f>>>24]<<24|r[l>>>16&255]<<16|r[u>>>8&255]<<8|r[d&255])^t[_++],p>>>=0,m>>>=0,h>>>=0,g>>>=0,[p,m,h,g]}var o=[0,1,2,4,8,16,32,64,128,27,54],s=(function(){for(var e=Array(256),t=0;t<256;t++)t<128?e[t]=t<<1:e[t]=t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],a=[[],[],[],[]],o=0,s=0,c=0;c<256;++c){var l=s^s<<1^s<<2^s<<3^s<<4;l=l>>>8^l&255^99,n[o]=l,r[l]=o;var u=e[o],d=e[u],f=e[d],p=e[l]*257^l*16843008;i[0][o]=p<<24|p>>>8,i[1][o]=p<<16|p>>>16,i[2][o]=p<<8|p>>>24,i[3][o]=p,p=f*16843009^d*65537^u*257^o*16843008,a[0][l]=p<<24|p>>>8,a[1][l]=p<<16|p>>>16,a[2][l]=p<<8|p>>>24,a[3][l]=p,o===0?o=s=1:(o=u^e[e[e[f^u]]],s^=e[e[s]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:a}})();function c(e){this._key=r(e),this._reset()}c.blockSize=16,c.keySize=256/8,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=(n+1)*4,i=[],a=0;a<t;a++)i[a]=e[a];for(a=t;a<r;a++){var c=i[a-1];a%t===0?(c=c<<8|c>>>24,c=s.SBOX[c>>>24]<<24|s.SBOX[c>>>16&255]<<16|s.SBOX[c>>>8&255]<<8|s.SBOX[c&255],c^=o[a/t|0]<<24):t>6&&a%t===4&&(c=s.SBOX[c>>>24]<<24|s.SBOX[c>>>16&255]<<16|s.SBOX[c>>>8&255]<<8|s.SBOX[c&255]),i[a]=i[a-t]^c}for(var l=[],u=0;u<r;u++){var d=r-u,f=i[d-(u%4?0:4)];u<4||d<=4?l[u]=f:l[u]=s.INV_SUB_MIX[0][s.SBOX[f>>>24]]^s.INV_SUB_MIX[1][s.SBOX[f>>>16&255]]^s.INV_SUB_MIX[2][s.SBOX[f>>>8&255]]^s.INV_SUB_MIX[3][s.SBOX[f&255]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=l},c.prototype.encryptBlockRaw=function(e){return e=r(e),a(e,this._keySchedule,s.SUB_MIX,s.SBOX,this._nRounds)},c.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=n.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},c.prototype.decryptBlock=function(e){e=r(e);var t=e[1];e[1]=e[3],e[3]=t;var i=a(e,this._invKeySchedule,s.INV_SUB_MIX,s.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(i[0],0),o.writeUInt32BE(i[3],4),o.writeUInt32BE(i[2],8),o.writeUInt32BE(i[1],12),o},c.prototype.scrub=function(){i(this._keySchedule),i(this._invKeySchedule),i(this._key)},t.exports.AES=c})),We=n(((e,t)=>{var n=_().Buffer,r=n.alloc(16,0);function i(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)]}function a(e){var t=n.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}o.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},o.prototype._multiply=function(){for(var e=i(this.h),t=[0,0,0,0],n,r,o,s=-1;++s<128;){for(r=(this.state[~~(s/8)]&1<<7-s%8)!=0,r&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),o=(e[3]&1)!=0,n=3;n>0;n--)e[n]=e[n]>>>1|(e[n-1]&1)<<31;e[0]>>>=1,o&&(e[0]^=225<<24)}this.state=a(t)},o.prototype.update=function(e){this.cache=n.concat([this.cache,e]);for(var t;this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,r],16)),this.ghash(a([0,e,0,t])),this.state},t.exports=o})),Ge=n(((e,t)=>{var n=Ue(),r=_().Buffer,i=Y(),a=d(),o=We(),s=Pe(),c=ze();function l(e,t){var n=0;e.length!==t.length&&n++;for(var r=Math.min(e.length,t.length),i=0;i<r;++i)n+=e[i]^t[i];return n}function u(e,t,n){if(t.length===12)return e._finID=r.concat([t,r.from([0,0,0,1])]),r.concat([t,r.from([0,0,0,2])]);var i=new o(n),a=t.length,s=a%16;i.update(t),s&&(s=16-s,i.update(r.alloc(s,0))),i.update(r.alloc(8,0));var l=a*8,u=r.alloc(8);u.writeUIntBE(l,0,8),i.update(u),e._finID=i.state;var d=r.from(e._finID);return c(d),d}function f(e,t,a,s){i.call(this);var c=r.alloc(4,0);this._cipher=new n.AES(t);var l=this._cipher.encryptBlock(c);this._ghash=new o(l),a=u(this,a,l),this._prev=r.from(a),this._cache=r.allocUnsafe(0),this._secCache=r.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}a(f,i),f.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=r.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},f.prototype._final=function(){if(this._decrypt&&!this._authTag)throw Error(`Unsupported state or unable to authenticate data`);var e=s(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&l(e,this._authTag))throw Error(`Unsupported state or unable to authenticate data`);this._authTag=e,this._cipher.scrub()},f.prototype.getAuthTag=function(){if(this._decrypt||!r.isBuffer(this._authTag))throw Error(`Attempting to get auth tag in unsupported state`);return this._authTag},f.prototype.setAuthTag=function(e){if(!this._decrypt)throw Error(`Attempting to set auth tag in unsupported state`);this._authTag=e},f.prototype.setAAD=function(e){if(this._called)throw Error(`Attempting to set AAD in unsupported state`);this._ghash.update(e),this._alen+=e.length},t.exports=f})),Ke=n(((e,t)=>{var n=Ue(),r=_().Buffer,i=Y(),a=d();function o(e,t,a,o){i.call(this),this._cipher=new n.AES(t),this._prev=r.from(a),this._cache=r.allocUnsafe(0),this._secCache=r.allocUnsafe(0),this._decrypt=o,this._mode=e}a(o,i),o.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},o.prototype._final=function(){this._cipher.scrub()},t.exports=o})),qe=n(((e,t)=>{var n=_().Buffer,r=ne();function i(e,t,i,a){if(n.isBuffer(e)||(e=n.from(e,`binary`)),t&&(n.isBuffer(t)||(t=n.from(t,`binary`)),t.length!==8))throw RangeError(`salt should be Buffer with 8 byte length`);for(var o=i/8,s=n.alloc(o),c=n.alloc(a||0),l=n.alloc(0);o>0||a>0;){var u=new r;u.update(l),u.update(e),t&&u.update(t),l=u.digest();var d=0;if(o>0){var f=s.length-o;d=Math.min(o,l.length),l.copy(s,f,0,d),o-=d}if(d<l.length&&a>0){var p=c.length-a,m=Math.min(a,l.length-d);l.copy(c,p,d,d+m),a-=m}}return l.fill(0),{key:s,iv:c}}t.exports=i})),Je=n((e=>{var t=He(),n=Ge(),r=_().Buffer,i=Ke(),a=Y(),o=Ue(),s=qe(),c=d();function l(e,t,n){a.call(this),this._cache=new f,this._cipher=new o.AES(t),this._prev=r.from(n),this._mode=e,this._autopadding=!0}c(l,a),l.prototype._update=function(e){this._cache.add(e);for(var t,n,i=[];t=this._cache.get();)n=this._mode.encrypt(this,t),i.push(n);return r.concat(i)};var u=r.alloc(16,16);l.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(u))throw this._cipher.scrub(),Error(`data not multiple of block length`)},l.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function f(){this.cache=r.allocUnsafe(0)}f.prototype.add=function(e){this.cache=r.concat([this.cache,e])},f.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},f.prototype.flush=function(){for(var e=16-this.cache.length,t=r.allocUnsafe(e),n=-1;++n<e;)t.writeUInt8(e,n);return r.concat([this.cache,t])};function p(e,a,o){var s=t[e.toLowerCase()];if(!s)throw TypeError(`invalid suite type`);if(typeof a==`string`&&(a=r.from(a)),a.length!==s.key/8)throw TypeError(`invalid key length `+a.length);if(typeof o==`string`&&(o=r.from(o)),s.mode!==`GCM`&&o.length!==s.iv)throw TypeError(`invalid iv length `+o.length);return s.type===`stream`?new i(s.module,a,o):s.type===`auth`?new n(s.module,a,o):new l(s.module,a,o)}function m(e,n){var r=t[e.toLowerCase()];if(!r)throw TypeError(`invalid suite type`);var i=s(n,!1,r.key,r.iv);return p(e,i.key,i.iv)}e.createCipheriv=p,e.createCipher=m})),Ye=n((e=>{var t=Ge(),n=_().Buffer,r=He(),i=Ke(),a=Y(),o=Ue(),s=qe(),c=d();function l(e,t,r){a.call(this),this._cache=new u,this._last=void 0,this._cipher=new o.AES(t),this._prev=n.from(r),this._mode=e,this._autopadding=!0}c(l,a),l.prototype._update=function(e){this._cache.add(e);for(var t,r,i=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),i.push(r);return n.concat(i)},l.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return f(this._mode.decrypt(this,e));if(e)throw Error(`data not multiple of block length`)},l.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function u(){this.cache=n.allocUnsafe(0)}u.prototype.add=function(e){this.cache=n.concat([this.cache,e])},u.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},u.prototype.flush=function(){if(this.cache.length)return this.cache};function f(e){var t=e[15];if(t<1||t>16)throw Error(`unable to decrypt data`);for(var n=-1;++n<t;)if(e[n+(16-t)]!==t)throw Error(`unable to decrypt data`);if(t!==16)return e.slice(0,16-t)}function p(e,a,o){var s=r[e.toLowerCase()];if(!s)throw TypeError(`invalid suite type`);if(typeof o==`string`&&(o=n.from(o)),s.mode!==`GCM`&&o.length!==s.iv)throw TypeError(`invalid iv length `+o.length);if(typeof a==`string`&&(a=n.from(a)),a.length!==s.key/8)throw TypeError(`invalid key length `+a.length);return s.type===`stream`?new i(s.module,a,o,!0):s.type===`auth`?new t(s.module,a,o,!0):new l(s.module,a,o)}function m(e,t){var n=r[e.toLowerCase()];if(!n)throw TypeError(`invalid suite type`);var i=s(t,!1,n.key,n.iv);return p(e,i.key,i.iv)}e.createDecipher=m,e.createDecipheriv=p})),Xe=n((e=>{var t=Je(),n=Ye(),r=Ve();function i(){return Object.keys(r)}e.createCipher=e.Cipher=t.createCipher,e.createCipheriv=e.Cipheriv=t.createCipheriv,e.createDecipher=e.Decipher=n.createDecipher,e.createDecipheriv=e.Decipheriv=n.createDecipheriv,e.listCiphers=e.getCiphers=i})),Ze=n((e=>{e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}})),Qe=n((e=>{var t=Me(),n=Xe(),r=He(),i=Ze(),a=qe();function o(e,t){e=e.toLowerCase();var n,o;if(r[e])n=r[e].key,o=r[e].iv;else if(i[e])n=i[e].key*8,o=i[e].iv;else throw TypeError(`invalid suite type`);var s=a(t,!1,n,o);return c(e,s.key,s.iv)}function s(e,t){e=e.toLowerCase();var n,o;if(r[e])n=r[e].key,o=r[e].iv;else if(i[e])n=i[e].key*8,o=i[e].iv;else throw TypeError(`invalid suite type`);var s=a(t,!1,n,o);return l(e,s.key,s.iv)}function c(e,a,o){if(e=e.toLowerCase(),r[e])return n.createCipheriv(e,a,o);if(i[e])return new t({key:a,iv:o,mode:e});throw TypeError(`invalid suite type`)}function l(e,a,o){if(e=e.toLowerCase(),r[e])return n.createDecipheriv(e,a,o);if(i[e])return new t({key:a,iv:o,mode:e,decrypt:!0});throw TypeError(`invalid suite type`)}function u(){return Object.keys(i).concat(n.getCiphers())}e.createCipher=e.Cipher=o,e.createCipheriv=e.Cipheriv=c,e.createDecipher=e.Decipher=s,e.createDecipheriv=e.Decipheriv=l,e.listCiphers=e.getCiphers=u})),$e=n((()=>{})),et=n(((e,t)=>{(function(e,t){function n(e,t){if(!e)throw Error(t||`Assertion failed`)}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,e!==null&&((t===`le`||t===`be`)&&(n=t,t=10),this._init(e||0,t||10,n||`be`))}typeof e==`object`?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var a;try{a=typeof window<`u`&&window.Buffer!==void 0?window.Buffer:$e().Buffer}catch{}i.isBN=function(e){return e instanceof i||typeof e==`object`&&!!e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if(typeof e==`number`)return this._initNumber(e,t,r);if(typeof e==`object`)return this._initArray(e,t,r);t===`hex`&&(t=16),n(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,``);var i=0;e[0]===`-`&&(i++,this.negative=1),i<e.length&&(t===16?this._parseHex(e,i,r):(this._parseBase(e,t,i),r===`le`&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),r===`le`&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n(typeof e.length==`number`),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if(r===`be`)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);else if(r===`le`)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);return this.strip()};function o(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function s(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i=0,a=0,o;if(n===`be`)for(r=e.length-1;r>=t;r-=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this.strip()};function c(e,t,n,r){for(var i=0,a=Math.min(e.length,n),o=t;o<a;o++){var s=e.charCodeAt(o)-48;i*=r,s>=49?i+=s-49+10:s>=17?i+=s-17+10:i+=s}return i}i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var a=e.length-n,o=a%r,s=Math.min(a,a-o)+n,l=0,u=n;u<s;u+=r)l=c(e,u,u+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(o!==0){var d=1;for(l=c(e,u,e.length,t),u=0;u<o;u++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this.strip()},i.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?`<BN-R: `:`<BN: `)+this.toString(16)+`>`};var l=`.0.00.000.0000.00000.000000.0000000.00000000.000000000.0000000000.00000000000.000000000000.0000000000000.00000000000000.000000000000000.0000000000000000.00000000000000000.000000000000000000.0000000000000000000.00000000000000000000.000000000000000000000.0000000000000000000000.00000000000000000000000.000000000000000000000000.0000000000000000000000000`.split(`.`),u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){e||=10,t=t|0||1;var r;if(e===16||e===`hex`){r=``;for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],c=((s<<i|a)&16777215).toString(16);a=s>>>24-i&16777215,i+=2,i>=26&&(i-=26,o--),r=a!==0||o!==this.length-1?l[6-c.length]+c+r:c+r}for(a!==0&&(r=a.toString(16)+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}if(e===(e|0)&&e>=2&&e<=36){var f=u[e],p=d[e];r=``;var m=this.clone();for(m.negative=0;!m.isZero();){var h=m.modn(p).toString(e);m=m.idivn(p),r=m.isZero()?h+r:l[f-h.length]+h+r}for(this.isZero()&&(r=`0`+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}n(!1,`Base should be between 2 and 36`)},i.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,`Number can only safely store up to 53 bits`),this.negative===0?e:-e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(a!==void 0),this.toArrayLike(a,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,`byte array longer than desired length`),n(a>0,`Requested array length <= 0`),this.strip();var o=t===`le`,s=new e(a),c,l,u=this.clone();if(o){for(l=0;!u.isZero();l++)c=u.andln(255),u.iushrn(8),s[l]=c;for(;l<a;l++)s[l]=0}else{for(l=0;l<a-i;l++)s[l]=0;for(l=0;!u.isZero();l++)c=u.andln(255),u.iushrn(8),s[a-l-1]=c}return s},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,n=0;return t&8191||(n+=13,t>>>=13),t&127||(n+=7,t>>>=7),t&15||(n+=4,t>>>=4),t&3||(n+=2,t>>>=2),t&1||n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function f(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,n!==26)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return this.negative===0?this.clone():this.abs().inotn(e).iaddn(1)},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},i.prototype.ior=function(e){return n((this.negative|e.negative)===0),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){for(var t=this.length>e.length?e:this,n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this.strip()},i.prototype.iand=function(e){return n((this.negative|e.negative)===0),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},i.prototype.ixor=function(e){return n((this.negative|e.negative)===0),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n(typeof e==`number`&&e>=0);var t=Math.ceil(e/26)|0,r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=~this.words[i]&67108863;return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n(typeof e==`number`&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<i:this.words[r]=this.words[r]&~(1<<i),this.strip()},i.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var n,r;this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(n.words[a]|0)+(r.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;for(;i!==0&&a<n.length;a++)t=(n.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;if(this.length=n.length,i!==0)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},i.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var r,i;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)t=(r.words[o]|0)-(i.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;for(;a!==0&&o<r.length;o++)t=(r.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;if(a===0&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(e){return this.clone().isub(e)};function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=e.words[0]|0,a=t.words[0]|0,o=i*a,s=o&67108863,c=o/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var u=c>>>26,d=c&67108863,f=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=f;p++){var m=l-p|0;i=e.words[m]|0,a=t.words[p]|0,o=i*a+d,u+=o/67108864|0,d=o&67108863}n.words[l]=d|0,c=u|0}return c===0?n.length--:n.words[l]=c|0,n.strip()}var m=function(e,t,n){var r=e.words,i=t.words,a=n.words,o=0,s,c,l,u=r[0]|0,d=u&8191,f=u>>>13,p=r[1]|0,m=p&8191,h=p>>>13,g=r[2]|0,_=g&8191,v=g>>>13,y=r[3]|0,b=y&8191,x=y>>>13,S=r[4]|0,C=S&8191,w=S>>>13,T=r[5]|0,E=T&8191,D=T>>>13,O=r[6]|0,k=O&8191,A=O>>>13,ee=r[7]|0,j=ee&8191,M=ee>>>13,te=r[8]|0,N=te&8191,P=te>>>13,ne=r[9]|0,F=ne&8191,I=ne>>>13,re=i[0]|0,L=re&8191,R=re>>>13,ie=i[1]|0,z=ie&8191,B=ie>>>13,ae=i[2]|0,V=ae&8191,H=ae>>>13,oe=i[3]|0,se=oe&8191,U=oe>>>13,ce=i[4]|0,W=ce&8191,G=ce>>>13,le=i[5]|0,K=le&8191,q=le>>>13,ue=i[6]|0,J=ue&8191,de=ue>>>13,fe=i[7]|0,pe=fe&8191,me=fe>>>13,Y=i[8]|0,X=Y&8191,Z=Y>>>13,he=i[9]|0,ge=he&8191,_e=he>>>13;n.negative=e.negative^t.negative,n.length=19,s=Math.imul(d,L),c=Math.imul(d,R),c=c+Math.imul(f,L)|0,l=Math.imul(f,R);var ve=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ve>>>26)|0,ve&=67108863,s=Math.imul(m,L),c=Math.imul(m,R),c=c+Math.imul(h,L)|0,l=Math.imul(h,R),s=s+Math.imul(d,z)|0,c=c+Math.imul(d,B)|0,c=c+Math.imul(f,z)|0,l=l+Math.imul(f,B)|0;var ye=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ye>>>26)|0,ye&=67108863,s=Math.imul(_,L),c=Math.imul(_,R),c=c+Math.imul(v,L)|0,l=Math.imul(v,R),s=s+Math.imul(m,z)|0,c=c+Math.imul(m,B)|0,c=c+Math.imul(h,z)|0,l=l+Math.imul(h,B)|0,s=s+Math.imul(d,V)|0,c=c+Math.imul(d,H)|0,c=c+Math.imul(f,V)|0,l=l+Math.imul(f,H)|0;var be=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(be>>>26)|0,be&=67108863,s=Math.imul(b,L),c=Math.imul(b,R),c=c+Math.imul(x,L)|0,l=Math.imul(x,R),s=s+Math.imul(_,z)|0,c=c+Math.imul(_,B)|0,c=c+Math.imul(v,z)|0,l=l+Math.imul(v,B)|0,s=s+Math.imul(m,V)|0,c=c+Math.imul(m,H)|0,c=c+Math.imul(h,V)|0,l=l+Math.imul(h,H)|0,s=s+Math.imul(d,se)|0,c=c+Math.imul(d,U)|0,c=c+Math.imul(f,se)|0,l=l+Math.imul(f,U)|0;var xe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(xe>>>26)|0,xe&=67108863,s=Math.imul(C,L),c=Math.imul(C,R),c=c+Math.imul(w,L)|0,l=Math.imul(w,R),s=s+Math.imul(b,z)|0,c=c+Math.imul(b,B)|0,c=c+Math.imul(x,z)|0,l=l+Math.imul(x,B)|0,s=s+Math.imul(_,V)|0,c=c+Math.imul(_,H)|0,c=c+Math.imul(v,V)|0,l=l+Math.imul(v,H)|0,s=s+Math.imul(m,se)|0,c=c+Math.imul(m,U)|0,c=c+Math.imul(h,se)|0,l=l+Math.imul(h,U)|0,s=s+Math.imul(d,W)|0,c=c+Math.imul(d,G)|0,c=c+Math.imul(f,W)|0,l=l+Math.imul(f,G)|0;var Se=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Se>>>26)|0,Se&=67108863,s=Math.imul(E,L),c=Math.imul(E,R),c=c+Math.imul(D,L)|0,l=Math.imul(D,R),s=s+Math.imul(C,z)|0,c=c+Math.imul(C,B)|0,c=c+Math.imul(w,z)|0,l=l+Math.imul(w,B)|0,s=s+Math.imul(b,V)|0,c=c+Math.imul(b,H)|0,c=c+Math.imul(x,V)|0,l=l+Math.imul(x,H)|0,s=s+Math.imul(_,se)|0,c=c+Math.imul(_,U)|0,c=c+Math.imul(v,se)|0,l=l+Math.imul(v,U)|0,s=s+Math.imul(m,W)|0,c=c+Math.imul(m,G)|0,c=c+Math.imul(h,W)|0,l=l+Math.imul(h,G)|0,s=s+Math.imul(d,K)|0,c=c+Math.imul(d,q)|0,c=c+Math.imul(f,K)|0,l=l+Math.imul(f,q)|0;var Ce=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,s=Math.imul(k,L),c=Math.imul(k,R),c=c+Math.imul(A,L)|0,l=Math.imul(A,R),s=s+Math.imul(E,z)|0,c=c+Math.imul(E,B)|0,c=c+Math.imul(D,z)|0,l=l+Math.imul(D,B)|0,s=s+Math.imul(C,V)|0,c=c+Math.imul(C,H)|0,c=c+Math.imul(w,V)|0,l=l+Math.imul(w,H)|0,s=s+Math.imul(b,se)|0,c=c+Math.imul(b,U)|0,c=c+Math.imul(x,se)|0,l=l+Math.imul(x,U)|0,s=s+Math.imul(_,W)|0,c=c+Math.imul(_,G)|0,c=c+Math.imul(v,W)|0,l=l+Math.imul(v,G)|0,s=s+Math.imul(m,K)|0,c=c+Math.imul(m,q)|0,c=c+Math.imul(h,K)|0,l=l+Math.imul(h,q)|0,s=s+Math.imul(d,J)|0,c=c+Math.imul(d,de)|0,c=c+Math.imul(f,J)|0,l=l+Math.imul(f,de)|0;var we=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(we>>>26)|0,we&=67108863,s=Math.imul(j,L),c=Math.imul(j,R),c=c+Math.imul(M,L)|0,l=Math.imul(M,R),s=s+Math.imul(k,z)|0,c=c+Math.imul(k,B)|0,c=c+Math.imul(A,z)|0,l=l+Math.imul(A,B)|0,s=s+Math.imul(E,V)|0,c=c+Math.imul(E,H)|0,c=c+Math.imul(D,V)|0,l=l+Math.imul(D,H)|0,s=s+Math.imul(C,se)|0,c=c+Math.imul(C,U)|0,c=c+Math.imul(w,se)|0,l=l+Math.imul(w,U)|0,s=s+Math.imul(b,W)|0,c=c+Math.imul(b,G)|0,c=c+Math.imul(x,W)|0,l=l+Math.imul(x,G)|0,s=s+Math.imul(_,K)|0,c=c+Math.imul(_,q)|0,c=c+Math.imul(v,K)|0,l=l+Math.imul(v,q)|0,s=s+Math.imul(m,J)|0,c=c+Math.imul(m,de)|0,c=c+Math.imul(h,J)|0,l=l+Math.imul(h,de)|0,s=s+Math.imul(d,pe)|0,c=c+Math.imul(d,me)|0,c=c+Math.imul(f,pe)|0,l=l+Math.imul(f,me)|0;var Te=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,s=Math.imul(N,L),c=Math.imul(N,R),c=c+Math.imul(P,L)|0,l=Math.imul(P,R),s=s+Math.imul(j,z)|0,c=c+Math.imul(j,B)|0,c=c+Math.imul(M,z)|0,l=l+Math.imul(M,B)|0,s=s+Math.imul(k,V)|0,c=c+Math.imul(k,H)|0,c=c+Math.imul(A,V)|0,l=l+Math.imul(A,H)|0,s=s+Math.imul(E,se)|0,c=c+Math.imul(E,U)|0,c=c+Math.imul(D,se)|0,l=l+Math.imul(D,U)|0,s=s+Math.imul(C,W)|0,c=c+Math.imul(C,G)|0,c=c+Math.imul(w,W)|0,l=l+Math.imul(w,G)|0,s=s+Math.imul(b,K)|0,c=c+Math.imul(b,q)|0,c=c+Math.imul(x,K)|0,l=l+Math.imul(x,q)|0,s=s+Math.imul(_,J)|0,c=c+Math.imul(_,de)|0,c=c+Math.imul(v,J)|0,l=l+Math.imul(v,de)|0,s=s+Math.imul(m,pe)|0,c=c+Math.imul(m,me)|0,c=c+Math.imul(h,pe)|0,l=l+Math.imul(h,me)|0,s=s+Math.imul(d,X)|0,c=c+Math.imul(d,Z)|0,c=c+Math.imul(f,X)|0,l=l+Math.imul(f,Z)|0;var Ee=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,s=Math.imul(F,L),c=Math.imul(F,R),c=c+Math.imul(I,L)|0,l=Math.imul(I,R),s=s+Math.imul(N,z)|0,c=c+Math.imul(N,B)|0,c=c+Math.imul(P,z)|0,l=l+Math.imul(P,B)|0,s=s+Math.imul(j,V)|0,c=c+Math.imul(j,H)|0,c=c+Math.imul(M,V)|0,l=l+Math.imul(M,H)|0,s=s+Math.imul(k,se)|0,c=c+Math.imul(k,U)|0,c=c+Math.imul(A,se)|0,l=l+Math.imul(A,U)|0,s=s+Math.imul(E,W)|0,c=c+Math.imul(E,G)|0,c=c+Math.imul(D,W)|0,l=l+Math.imul(D,G)|0,s=s+Math.imul(C,K)|0,c=c+Math.imul(C,q)|0,c=c+Math.imul(w,K)|0,l=l+Math.imul(w,q)|0,s=s+Math.imul(b,J)|0,c=c+Math.imul(b,de)|0,c=c+Math.imul(x,J)|0,l=l+Math.imul(x,de)|0,s=s+Math.imul(_,pe)|0,c=c+Math.imul(_,me)|0,c=c+Math.imul(v,pe)|0,l=l+Math.imul(v,me)|0,s=s+Math.imul(m,X)|0,c=c+Math.imul(m,Z)|0,c=c+Math.imul(h,X)|0,l=l+Math.imul(h,Z)|0,s=s+Math.imul(d,ge)|0,c=c+Math.imul(d,_e)|0,c=c+Math.imul(f,ge)|0,l=l+Math.imul(f,_e)|0;var De=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(De>>>26)|0,De&=67108863,s=Math.imul(F,z),c=Math.imul(F,B),c=c+Math.imul(I,z)|0,l=Math.imul(I,B),s=s+Math.imul(N,V)|0,c=c+Math.imul(N,H)|0,c=c+Math.imul(P,V)|0,l=l+Math.imul(P,H)|0,s=s+Math.imul(j,se)|0,c=c+Math.imul(j,U)|0,c=c+Math.imul(M,se)|0,l=l+Math.imul(M,U)|0,s=s+Math.imul(k,W)|0,c=c+Math.imul(k,G)|0,c=c+Math.imul(A,W)|0,l=l+Math.imul(A,G)|0,s=s+Math.imul(E,K)|0,c=c+Math.imul(E,q)|0,c=c+Math.imul(D,K)|0,l=l+Math.imul(D,q)|0,s=s+Math.imul(C,J)|0,c=c+Math.imul(C,de)|0,c=c+Math.imul(w,J)|0,l=l+Math.imul(w,de)|0,s=s+Math.imul(b,pe)|0,c=c+Math.imul(b,me)|0,c=c+Math.imul(x,pe)|0,l=l+Math.imul(x,me)|0,s=s+Math.imul(_,X)|0,c=c+Math.imul(_,Z)|0,c=c+Math.imul(v,X)|0,l=l+Math.imul(v,Z)|0,s=s+Math.imul(m,ge)|0,c=c+Math.imul(m,_e)|0,c=c+Math.imul(h,ge)|0,l=l+Math.imul(h,_e)|0;var Oe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,s=Math.imul(F,V),c=Math.imul(F,H),c=c+Math.imul(I,V)|0,l=Math.imul(I,H),s=s+Math.imul(N,se)|0,c=c+Math.imul(N,U)|0,c=c+Math.imul(P,se)|0,l=l+Math.imul(P,U)|0,s=s+Math.imul(j,W)|0,c=c+Math.imul(j,G)|0,c=c+Math.imul(M,W)|0,l=l+Math.imul(M,G)|0,s=s+Math.imul(k,K)|0,c=c+Math.imul(k,q)|0,c=c+Math.imul(A,K)|0,l=l+Math.imul(A,q)|0,s=s+Math.imul(E,J)|0,c=c+Math.imul(E,de)|0,c=c+Math.imul(D,J)|0,l=l+Math.imul(D,de)|0,s=s+Math.imul(C,pe)|0,c=c+Math.imul(C,me)|0,c=c+Math.imul(w,pe)|0,l=l+Math.imul(w,me)|0,s=s+Math.imul(b,X)|0,c=c+Math.imul(b,Z)|0,c=c+Math.imul(x,X)|0,l=l+Math.imul(x,Z)|0,s=s+Math.imul(_,ge)|0,c=c+Math.imul(_,_e)|0,c=c+Math.imul(v,ge)|0,l=l+Math.imul(v,_e)|0;var ke=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ke>>>26)|0,ke&=67108863,s=Math.imul(F,se),c=Math.imul(F,U),c=c+Math.imul(I,se)|0,l=Math.imul(I,U),s=s+Math.imul(N,W)|0,c=c+Math.imul(N,G)|0,c=c+Math.imul(P,W)|0,l=l+Math.imul(P,G)|0,s=s+Math.imul(j,K)|0,c=c+Math.imul(j,q)|0,c=c+Math.imul(M,K)|0,l=l+Math.imul(M,q)|0,s=s+Math.imul(k,J)|0,c=c+Math.imul(k,de)|0,c=c+Math.imul(A,J)|0,l=l+Math.imul(A,de)|0,s=s+Math.imul(E,pe)|0,c=c+Math.imul(E,me)|0,c=c+Math.imul(D,pe)|0,l=l+Math.imul(D,me)|0,s=s+Math.imul(C,X)|0,c=c+Math.imul(C,Z)|0,c=c+Math.imul(w,X)|0,l=l+Math.imul(w,Z)|0,s=s+Math.imul(b,ge)|0,c=c+Math.imul(b,_e)|0,c=c+Math.imul(x,ge)|0,l=l+Math.imul(x,_e)|0;var Ae=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,s=Math.imul(F,W),c=Math.imul(F,G),c=c+Math.imul(I,W)|0,l=Math.imul(I,G),s=s+Math.imul(N,K)|0,c=c+Math.imul(N,q)|0,c=c+Math.imul(P,K)|0,l=l+Math.imul(P,q)|0,s=s+Math.imul(j,J)|0,c=c+Math.imul(j,de)|0,c=c+Math.imul(M,J)|0,l=l+Math.imul(M,de)|0,s=s+Math.imul(k,pe)|0,c=c+Math.imul(k,me)|0,c=c+Math.imul(A,pe)|0,l=l+Math.imul(A,me)|0,s=s+Math.imul(E,X)|0,c=c+Math.imul(E,Z)|0,c=c+Math.imul(D,X)|0,l=l+Math.imul(D,Z)|0,s=s+Math.imul(C,ge)|0,c=c+Math.imul(C,_e)|0,c=c+Math.imul(w,ge)|0,l=l+Math.imul(w,_e)|0;var je=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(je>>>26)|0,je&=67108863,s=Math.imul(F,K),c=Math.imul(F,q),c=c+Math.imul(I,K)|0,l=Math.imul(I,q),s=s+Math.imul(N,J)|0,c=c+Math.imul(N,de)|0,c=c+Math.imul(P,J)|0,l=l+Math.imul(P,de)|0,s=s+Math.imul(j,pe)|0,c=c+Math.imul(j,me)|0,c=c+Math.imul(M,pe)|0,l=l+Math.imul(M,me)|0,s=s+Math.imul(k,X)|0,c=c+Math.imul(k,Z)|0,c=c+Math.imul(A,X)|0,l=l+Math.imul(A,Z)|0,s=s+Math.imul(E,ge)|0,c=c+Math.imul(E,_e)|0,c=c+Math.imul(D,ge)|0,l=l+Math.imul(D,_e)|0;var Me=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Me>>>26)|0,Me&=67108863,s=Math.imul(F,J),c=Math.imul(F,de),c=c+Math.imul(I,J)|0,l=Math.imul(I,de),s=s+Math.imul(N,pe)|0,c=c+Math.imul(N,me)|0,c=c+Math.imul(P,pe)|0,l=l+Math.imul(P,me)|0,s=s+Math.imul(j,X)|0,c=c+Math.imul(j,Z)|0,c=c+Math.imul(M,X)|0,l=l+Math.imul(M,Z)|0,s=s+Math.imul(k,ge)|0,c=c+Math.imul(k,_e)|0,c=c+Math.imul(A,ge)|0,l=l+Math.imul(A,_e)|0;var Ne=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s=Math.imul(F,pe),c=Math.imul(F,me),c=c+Math.imul(I,pe)|0,l=Math.imul(I,me),s=s+Math.imul(N,X)|0,c=c+Math.imul(N,Z)|0,c=c+Math.imul(P,X)|0,l=l+Math.imul(P,Z)|0,s=s+Math.imul(j,ge)|0,c=c+Math.imul(j,_e)|0,c=c+Math.imul(M,ge)|0,l=l+Math.imul(M,_e)|0;var Pe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,s=Math.imul(F,X),c=Math.imul(F,Z),c=c+Math.imul(I,X)|0,l=Math.imul(I,Z),s=s+Math.imul(N,ge)|0,c=c+Math.imul(N,_e)|0,c=c+Math.imul(P,ge)|0,l=l+Math.imul(P,_e)|0;var Fe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,s=Math.imul(F,ge),c=Math.imul(F,_e),c=c+Math.imul(I,ge)|0,l=Math.imul(I,_e);var Q=(o+s|0)+((c&8191)<<13)|0;return o=(l+(c>>>13)|0)+(Q>>>26)|0,Q&=67108863,a[0]=ve,a[1]=ye,a[2]=be,a[3]=xe,a[4]=Se,a[5]=Ce,a[6]=we,a[7]=Te,a[8]=Ee,a[9]=De,a[10]=Oe,a[11]=ke,a[12]=Ae,a[13]=je,a[14]=Me,a[15]=Ne,a[16]=Pe,a[17]=Fe,a[18]=Q,o!==0&&(a[19]=o,n.length++),n};Math.imul||(m=p);function h(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,a=0;a<n.length-1;a++){var o=i;i=0;for(var s=r&67108863,c=Math.min(a,t.length-1),l=Math.max(0,a-e.length+1);l<=c;l++){var u=a-l,d=(e.words[u]|0)*(t.words[l]|0),f=d&67108863;o=o+(d/67108864|0)|0,f=f+s|0,s=f&67108863,o=o+(f>>>26)|0,i+=o>>>26,o&=67108863}n.words[a]=s,r=o,o=i}return r===0?n.length--:n.words[a]=r,n.strip()}function g(e,t,n){return new _().mulp(e,t,n)}i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=this.length===10&&e.length===10?m(this,e,t):r<63?p(this,e,t):r<1024?h(this,e,t):g(this,e,t),n};function _(e,t){this.x=e,this.y=t}_.prototype.makeRBT=function(e){for(var t=Array(e),n=i.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},_.prototype.revBin=function(e,t,n){if(e===0||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(e&1)<<t-i-1,e>>=1;return r},_.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},_.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,c=Math.cos(2*Math.PI/s),l=Math.sin(2*Math.PI/s),u=0;u<i;u+=s)for(var d=c,f=l,p=0;p<o;p++){var m=n[u+p],h=r[u+p],g=n[u+p+o],_=r[u+p+o],v=d*g-f*_;_=d*_+f*g,g=v,n[u+p]=m+g,r[u+p]=h+_,n[u+p+o]=m-g,r[u+p+o]=h-_,p!==s&&(v=c*d-l*f,f=c*f+l*d,d=v)}},_.prototype.guessLen13b=function(e,t){var n=Math.max(t,e)|1,r=n&1,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},_.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},_.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=Math.round(e[2*r+1]/t)*8192+Math.round(e[2*r]/t)+n;e[r]=i&67108863,n=i<67108864?0:i/67108864|0}return e},_.prototype.convert13b=function(e,t,r,i){for(var a=0,o=0;o<t;o++)a+=e[o]|0,r[2*o]=a&8191,a>>>=13,r[2*o+1]=a&8191,a>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(a===0),n((a&-8192)==0)},_.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},_.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),c=Array(r),l=Array(r),u=Array(r),d=Array(r),f=n.words;f.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,c,r,i),this.transform(l,a,u,d,r,i);for(var p=0;p<r;p++){var m=s[p]*u[p]-c[p]*d[p];c[p]=s[p]*d[p]+c[p]*u[p],s[p]=m}return this.conjugate(s,c,r),this.transform(s,c,f,a,r,i),this.conjugate(f,a,r),this.normalize13b(f,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){n(typeof e==`number`),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var i=(this.words[r]|0)*e,a=(i&67108863)+(t&67108863);t>>=26,t+=i/67108864|0,t+=a>>>26,this.words[r]=a&67108863}return t!==0&&(this.words[r]=t,this.length++),this.length=e===0?1:this.length,this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=f(e);if(t.length===0)return new i(1);for(var n=this,r=0;r<t.length&&t[r]===0;r++,n=n.sqr());if(++r<t.length)for(var a=n.sqr();r<t.length;r++,a=a.sqr())t[r]!==0&&(n=n.mul(a));return n},i.prototype.iushln=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=67108863>>>26-t<<26-t,a;if(t!==0){var o=0;for(a=0;a<this.length;a++){var s=this.words[a]&i,c=(this.words[a]|0)-s<<t;this.words[a]=c|o,o=s>>>26-t}o&&(this.words[a]=o,this.length++)}if(r!==0){for(a=this.length-1;a>=0;a--)this.words[a+r]=this.words[a];for(a=0;a<r;a++)this.words[a]=0;this.length+=r}return this.strip()},i.prototype.ishln=function(e){return n(this.negative===0),this.iushln(e)},i.prototype.iushrn=function(e,t,r){n(typeof e==`number`&&e>=0);var i=t?(t-t%26)/26:0,a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,c=r;if(i-=o,i=Math.max(0,i),c){for(var l=0;l<o;l++)c.words[l]=this.words[l];c.length=o}if(o!==0)if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var u=0;for(l=this.length-1;l>=0&&(u!==0||l>=i);l--){var d=this.words[l]|0;this.words[l]=u<<26-a|d>>>a,u=d&s}return c&&u!==0&&(c.words[c.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(this.negative===0),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return this.length<=r?!1:!!(this.words[r]&i)},i.prototype.imaskn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26;if(n(this.negative===0,`imaskn works only with positive numbers`),this.length<=r)return this;if(t!==0&&r++,this.length=Math.min(r,this.length),t!==0){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n(typeof e==`number`),n(e<67108864),e<0?this.isubn(-e):this.negative===0?this._iaddn(e):this.length===1&&(this.words[0]|0)<e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n(typeof e==`number`),n(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,--this.words[t+1];return this.strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i=e.length+r,a;this._expand(i);var o,s=0;for(a=0;a<e.length;a++){o=(this.words[a+r]|0)+s;var c=(e.words[a]|0)*t;o-=c&67108863,s=(o>>26)-(c/67108864|0),this.words[a+r]=o&67108863}for(;a<this.length-r;a++)o=(this.words[a+r]|0)+s,s=o>>26,this.words[a+r]=o&67108863;if(s===0)return this.strip();for(n(s===-1),s=0,a=0;a<this.length;a++)o=-(this.words[a]|0)+s,s=o>>26,this.words[a]=o&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=this.length-e.length,r=this.clone(),a=e,o=a.words[a.length-1]|0;n=26-this._countBits(o),n!==0&&(a=a.ushln(n),r.iushln(n),o=a.words[a.length-1]|0);var s=r.length-a.length,c;if(t!==`mod`){c=new i(null),c.length=s+1,c.words=Array(c.length);for(var l=0;l<c.length;l++)c.words[l]=0}var u=r.clone()._ishlnsubmul(a,1,s);u.negative===0&&(r=u,c&&(c.words[s]=1));for(var d=s-1;d>=0;d--){var f=(r.words[a.length+d]|0)*67108864+(r.words[a.length+d-1]|0);for(f=Math.min(f/o|0,67108863),r._ishlnsubmul(a,f,d);r.negative!==0;)f--,r.negative=0,r._ishlnsubmul(a,1,d),r.isZero()||(r.negative^=1);c&&(c.words[d]=f)}return c&&c.strip(),r.strip(),t!==`div`&&n!==0&&r.iushrn(n),{div:c||null,mod:r}},i.prototype.divmod=function(e,t,r){if(n(!e.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var a,o,s;return this.negative!==0&&e.negative===0?(s=this.neg().divmod(e,t),t!==`mod`&&(a=s.div.neg()),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.iadd(e)),{div:a,mod:o}):this.negative===0&&e.negative!==0?(s=this.divmod(e.neg(),t),t!==`mod`&&(a=s.div.neg()),{div:a,mod:s.mod}):(this.negative&e.negative)===0?e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:e.length===1?t===`div`?{div:this.divn(e.words[0]),mod:null}:t===`mod`?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.isub(e)),{div:s.div,mod:o})},i.prototype.div=function(e){return this.divmod(e,`div`,!1).div},i.prototype.mod=function(e){return this.divmod(e,`mod`,!1).mod},i.prototype.umod=function(e){return this.divmod(e,`mod`,!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=t.div.negative===0?t.mod:t.mod.isub(e),r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return a<0||i===1&&a===0?t.div:t.div.negative===0?t.div.iaddn(1):t.div.isubn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(this.words[i]|0))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(this.words[r]|0)+t*67108864;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=new i(0),c=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var u=r.clone(),d=t.clone();!t.isZero();){for(var f=0,p=1;(t.words[0]&p)===0&&f<26;++f,p<<=1);if(f>0)for(t.iushrn(f);f-->0;)(a.isOdd()||o.isOdd())&&(a.iadd(u),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var m=0,h=1;(r.words[0]&h)===0&&m<26;++m,h<<=1);if(m>0)for(r.iushrn(m);m-->0;)(s.isOdd()||c.isOdd())&&(s.iadd(u),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s),o.isub(c)):(r.isub(t),s.isub(a),c.isub(o))}return{a:s,b:c,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;(t.words[0]&l)===0&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-->0;)a.isOdd()&&a.iadd(s),a.iushrn(1);for(var u=0,d=1;(r.words[0]&d)===0&&u<26;++u,d<<=1);if(u>0)for(r.iushrn(u);u-->0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o)):(r.isub(t),o.isub(a))}var f=t.cmpn(1)===0?a:o;return f.cmpn(0)<0&&f.iadd(e),f},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var a=t;t=n,n=a}else if(i===0||n.cmpn(1)===0)break;t.isub(n)}while(!0);return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return(this.words[0]&1)==0},i.prototype.isOdd=function(){return(this.words[0]&1)==1},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n(typeof e==`number`);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;a!==0&&o<this.length;o++){var s=this.words[o]|0;s+=a,a=s>>>26,s&=67108863,this.words[o]=s}return a!==0&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this.strip();var r;if(this.length>1)r=1;else{t&&(e=-e),n(e<=67108863,`Number is too big`);var i=this.words[0]|0;r=i===e?0:i<e?-1:1}return this.negative===0?r:-r|0},i.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative===0?t:-t|0},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=this.words[n]|0,i=e.words[n]|0;if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return this.cmpn(e)===1},i.prototype.gt=function(e){return this.cmp(e)===1},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return this.cmpn(e)===-1},i.prototype.lt=function(e){return this.cmp(e)===-1},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return this.cmpn(e)===0},i.prototype.eq=function(e){return this.cmp(e)===0},i.red=function(e){return new w(e)},i.prototype.toRed=function(e){return n(!this.red,`Already a number in reduction context`),n(this.negative===0,`red works only with positives`),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,`fromRed works only with numbers in reduction context`),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,`Already a number in reduction context`),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,`redAdd works only with red numbers`),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,`redIAdd works only with red numbers`),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,`redSub works only with red numbers`),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,`redISub works only with red numbers`),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,`redShl works only with red numbers`),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,`redSqr works only with red numbers`),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,`redISqr works only with red numbers`),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,`redSqrt works only with red numbers`),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,`redInvm works only with red numbers`),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,`redNeg works only with red numbers`),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,`redPow(normalNum)`),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}y.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t=e,n;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),n=t.bitLength();while(n>this.n);var r=n<this.n?-1:t.ucmp(this.p);return r===0?(t.words[0]=0,t.length=1):r>0?t.isub(this.p):t.strip===void 0?t._strip():t.strip(),t},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)};function b(){y.call(this,`k256`,`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`)}r(b,y),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=e.words[i]|0;e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,a===0&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=e.words[n]|0;t+=r*977,e.words[n]=t&67108863,t=r*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function x(){y.call(this,`p224`,`ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001`)}r(x,y);function S(){y.call(this,`p192`,`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff`)}r(S,y);function C(){y.call(this,`25519`,`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`)}r(C,y),C.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=(e.words[n]|0)*19+t,i=r&67108863;r>>>=26,e.words[n]=i,t=r}return t!==0&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if(e===`k256`)t=new b;else if(e===`p224`)t=new x;else if(e===`p192`)t=new S;else if(e===`p25519`)t=new C;else throw Error(`Unknown prime `+e);return v[e]=t,t};function w(e){if(typeof e==`string`){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),`modulus must be greater than 1`),this.m=e,this.prime=null}w.prototype._verify1=function(e){n(e.negative===0,`red works only with positives`),n(e.red,`red works only with red numbers`)},w.prototype._verify2=function(e,t){n((e.negative|t.negative)===0,`red works only with positives`),n(e.red&&e.red===t.red,`red works only with red numbers`)},w.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},w.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},w.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},w.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},w.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},w.prototype.isqr=function(e){return this.imul(e,e.clone())},w.prototype.sqr=function(e){return this.mul(e,e)},w.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),t===3){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&a.andln(1)===0;)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),c=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,l).cmp(c)!==0;)u.redIAdd(c);for(var d=this.pow(u,a),f=this.pow(e,a.addn(1).iushrn(1)),p=this.pow(e,a),m=o;p.cmp(s)!==0;){for(var h=p,g=0;h.cmp(s)!==0;g++)h=h.redSqr();n(g<m);var _=this.pow(d,new i(1).iushln(m-g-1));f=f.redMul(_),d=_.redSqr(),p=p.redMul(d),m=g}return f},w.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative===0?this.imod(t):(t.negative=0,this.imod(t).redNeg())},w.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var n=4,r=Array(1<<n);r[0]=new i(1).toRed(this),r[1]=e;for(var a=2;a<r.length;a++)r[a]=this.mul(r[a-1],e);var o=r[0],s=0,c=0,l=t.bitLength()%26;for(l===0&&(l=26),a=t.length-1;a>=0;a--){for(var u=t.words[a],d=l-1;d>=0;d--){var f=u>>d&1;if(o!==r[0]&&(o=this.sqr(o)),f===0&&s===0){c=0;continue}s<<=1,s|=f,c++,!(c!==n&&(a!==0||d!==0))&&(o=this.mul(o,r[s]),c=0,s=0)}l=26}return o},w.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},w.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)};function T(e){w.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}r(T,w),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(r).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}})(t===void 0||t,e)})),tt=n(((e,t)=>{var n;t.exports=function(e){return n||=new r(null),n.generate(e)};function r(e){this.rand=e}if(t.exports.Rand=r,r.prototype.generate=function(e){return this._rand(e)},r.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},typeof self==`object`)self.crypto&&self.crypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window==`object`&&(r.prototype._rand=function(){throw Error(`Not implemented yet`)});else try{var i=Pn();if(typeof i.randomBytes!=`function`)throw Error(`Not supported`);r.prototype._rand=function(e){return i.randomBytes(e)}}catch{}})),nt=n(((e,t)=>{var n=et(),r=tt();function i(e){this.rand=e||new r.Rand}t.exports=i,i.create=function(e){return new i(e)},i.prototype._randbelow=function(e){var t=e.bitLength(),r=Math.ceil(t/8);do var i=new n(this.rand.generate(r));while(i.cmp(e)>=0);return i},i.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},i.prototype.test=function(e,t,r){var i=e.bitLength(),a=n.mont(e),o=new n(1).toRed(a);t||=Math.max(1,i/48|0);for(var s=e.subn(1),c=0;!s.testn(c);c++);for(var l=e.shrn(c),u=s.toRed(a),d=!0;t>0;t--){var f=this._randrange(new n(2),s);r&&r(f);var p=f.toRed(a).redPow(l);if(!(p.cmp(o)===0||p.cmp(u)===0)){for(var m=1;m<c;m++){if(p=p.redSqr(),p.cmp(o)===0)return!1;if(p.cmp(u)===0)break}if(m===c)return!1}}return d},i.prototype.getDivisor=function(e,t){var r=e.bitLength(),i=n.mont(e),a=new n(1).toRed(i);t||=Math.max(1,r/48|0);for(var o=e.subn(1),s=0;!o.testn(s);s++);for(var c=e.shrn(s),l=o.toRed(i);t>0;t--){var u=this._randrange(new n(2),o),d=e.gcd(u);if(d.cmpn(1)!==0)return d;var f=u.toRed(i).redPow(c);if(!(f.cmp(a)===0||f.cmp(l)===0)){for(var p=1;p<s;p++){if(f=f.redSqr(),f.cmp(a)===0)return f.fromRed().subn(1).gcd(e);if(f.cmp(l)===0)break}if(p===s)return f=f.redSqr(),f.fromRed().subn(1).gcd(e)}}return!1}})),rt=n(((e,t)=>{var n=N();t.exports=_,_.simpleSieve=h,_.fermatTest=g;var r=et(),i=new r(24),a=new(nt()),o=new r(1),s=new r(2),c=new r(5);new r(16),new r(8);var l=new r(10),u=new r(3);new r(7);var d=new r(11),f=new r(4);new r(12);var p=null;function m(){if(p!==null)return p;var e=1048576,t=[];t[0]=2;for(var n=1,r=3;r<e;r+=2){for(var i=Math.ceil(Math.sqrt(r)),a=0;a<n&&t[a]<=i&&r%t[a]!==0;a++);n!==a&&t[a]<=i||(t[n++]=r)}return p=t,t}function h(e){for(var t=m(),n=0;n<t.length;n++)if(e.modn(t[n])===0)return e.cmpn(t[n])===0;return!0}function g(e){var t=r.mont(e);return s.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)===0}function _(e,t){if(e<16)return t===2||t===5?new r([140,123]):new r([140,39]);t=new r(t);for(var p,m;;){for(p=new r(n(Math.ceil(e/8)));p.bitLength()>e;)p.ishrn(1);if(p.isEven()&&p.iadd(o),p.testn(1)||p.iadd(s),!t.cmp(s))for(;p.mod(i).cmp(d);)p.iadd(f);else if(!t.cmp(c))for(;p.mod(l).cmp(u);)p.iadd(f);if(m=p.shrn(1),h(m)&&h(p)&&g(m)&&g(p)&&a.test(m)&&a.test(p))return p}}})),it=n(((e,t)=>{t.exports={modp1:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff`},modp2:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff`},modp5:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff`},modp14:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff`},modp15:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff`},modp16:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff`},modp17:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff`},modp18:{gen:`02`,prime:`ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff`}}})),at=n(((e,t)=>{var n=a(),r=et(),i=new(nt()),o=new r(24),s=new r(11),c=new r(10),l=new r(3),u=new r(7),d=rt(),f=N();t.exports=_;function p(e,t){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),this._pub=new r(e),this}function m(e,t){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),this._priv=new r(e),this}var h={};function g(e,t){var n=t.toString(`hex`),r=[n,e.toString(16)].join(`_`);if(r in h)return h[r];var a=0;if(e.isEven()||!d.simpleSieve||!d.fermatTest(e)||!i.test(e))return a+=1,n===`02`||n===`05`?a+=8:a+=4,h[r]=a,a;i.test(e.shrn(1))||(a+=2);var f;switch(n){case`02`:e.mod(o).cmp(s)&&(a+=8);break;case`05`:f=e.mod(c),f.cmp(l)&&f.cmp(u)&&(a+=8);break;default:a+=4}return h[r]=a,a}function _(e,t,n){this.setGenerator(t),this.__prime=new r(e),this._prime=r.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=p,this.setPrivateKey=m):this._primeCode=8}Object.defineProperty(_.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!=`number`&&(this._primeCode=g(this.__prime,this.__gen)),this._primeCode}}),_.prototype.generateKeys=function(){return this._priv||=new r(f(this._primeLen)),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},_.prototype.computeSecret=function(e){e=new r(e),e=e.toRed(this._prime);var t=new n.Buffer(e.redPow(this._priv).fromRed().toArray()),i=this.getPrime();if(t.length<i.length){var a=new n.Buffer(i.length-t.length);a.fill(0),t=n.Buffer.concat([a,t])}return t},_.prototype.getPublicKey=function(e){return v(this._pub,e)},_.prototype.getPrivateKey=function(e){return v(this._priv,e)},_.prototype.getPrime=function(e){return v(this.__prime,e)},_.prototype.getGenerator=function(e){return v(this._gen,e)},_.prototype.setGenerator=function(e,t){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),this.__gen=e,this._gen=new r(e),this};function v(e,t){var r=new n.Buffer(e.toArray());return t?r.toString(t):r}})),ot=n((e=>{var t=a(),n=rt(),r=it(),i=at();function o(e){return new i(new t.Buffer(r[e].prime,`hex`),new t.Buffer(r[e].gen,`hex`))}var s={binary:!0,hex:!0,base64:!0};function c(e,r,a,o){return t.Buffer.isBuffer(r)||s[r]===void 0?c(e,`binary`,r,a):(r||=`binary`,o||=`binary`,a||=new t.Buffer([2]),t.Buffer.isBuffer(a)||(a=new t.Buffer(a,o)),typeof e==`number`?new i(n(e,a),a,!0):(t.Buffer.isBuffer(e)||(e=new t.Buffer(e,r)),new i(e,a,!0)))}e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=o,e.createDiffieHellman=e.DiffieHellman=c})),st=n(((e,t)=>{var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)==`[object Array]`}})),ct=n(((e,t)=>{t.exports=u().EventEmitter})),lt=n(((e,t)=>{var n=a(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=o);function o(e,t,n){return r(e,t,n)}i(r,o),o.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},o.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},o.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},o.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),ut=n((()=>{})),dt=n((()=>{})),ft=n(((e,t)=>{function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var r=lt().Buffer,i=dt();function a(e,t,n){e.copy(t,n)}t.exports=function(){function e(){n(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(this.length!==0){var e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(this.length===0)return``;for(var t=this.head,n=``+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(this.length===0)return r.alloc(0);for(var t=r.allocUnsafe(e>>>0),n=this.head,i=0;n;)a(n.data,t,i),i+=n.data.length,n=n.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+` `+e})})),pt=n(((e,t)=>{var n=I();function r(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return i||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,n.nextTick(a,r,e)):n.nextTick(a,r,e):t&&t(e)}),this)}function i(){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)}function a(e,t){e.emit(`error`,t)}t.exports={destroy:r,undestroy:i}})),mt=n(((t,n)=>{var r=e(x()),i=I();n.exports=S;function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){re(t,e)}}var o=!r.default.browser&&[`v0.10`,`v0.9.`].indexOf(r.default.version.slice(0,5))>-1?setImmediate:i.nextTick,s;S.WritableState=y;var c=Object.create(ie());c.inherits=d();var l={deprecate:m()},u=ct(),f=lt().Buffer,p=(typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:{}).Uint8Array||function(){};function h(e){return f.from(e)}function g(e){return f.isBuffer(e)||e instanceof p}var _=pt();c.inherits(S,u);function v(){}function y(e,t){s||=ht(),e||={};var n=t instanceof s;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,i=e.writableHighWaterMark,o=this.objectMode?16:16*1024;r||r===0?this.highWaterMark=r:n&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=e.decodeStrings===!1;this.decodeStrings=!c,this.defaultEncoding=e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){A(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}y.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},(function(){try{Object.defineProperty(y.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},`_writableState.buffer is deprecated. Use _writableState.getBuffer instead.`,`DEP0003`)})}catch{}})();var b;typeof Symbol==`function`&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==`function`?(b=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(e){return b.call(this,e)?!0:this===S&&e&&e._writableState instanceof y}})):b=function(e){return e instanceof this};function S(e){if(s||=ht(),!b.call(S,this)&&!(this instanceof s))return new S(e);this._writableState=new y(e,this),this.writable=!0,e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final)),u.call(this)}S.prototype.pipe=function(){this.emit(`error`,Error(`Cannot pipe, not readable`))};function C(e,t){var n=Error(`write after end`);e.emit(`error`,n),i.nextTick(t,n)}function w(e,t,n,r){var a=!0,o=!1;return n===null?o=TypeError(`May not write null values to stream`):typeof n!=`string`&&n!==void 0&&!t.objectMode&&(o=TypeError(`Invalid non-string/buffer chunk`)),o&&(e.emit(`error`,o),i.nextTick(r,o),a=!1),a}S.prototype.write=function(e,t,n){var r=this._writableState,i=!1,a=!r.objectMode&&g(e);return a&&!f.isBuffer(e)&&(e=h(e)),typeof t==`function`&&(n=t,t=null),a?t=`buffer`:t||=r.defaultEncoding,typeof n!=`function`&&(n=v),r.ended?C(this,n):(a||w(this,r,e,n))&&(r.pendingcb++,i=E(this,r,a,e,t,n)),i},S.prototype.cork=function(){var e=this._writableState;e.corked++},S.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&M(this,e))},S.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=e.toLowerCase()),!([`hex`,`utf8`,`utf-8`,`ascii`,`binary`,`base64`,`ucs2`,`ucs-2`,`utf16le`,`utf-16le`,`raw`].indexOf((e+``).toLowerCase())>-1))throw TypeError(`Unknown encoding: `+e);return this._writableState.defaultEncoding=e,this};function T(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t==`string`&&(t=f.from(t,n)),t}Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function E(e,t,n,r,i,a){if(!n){var o=T(t,r,i);r!==o&&(n=!0,i=`buffer`,r=o)}var s=t.objectMode?1:r.length;t.length+=s;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else D(e,t,!1,s,r,i,a);return c}function D(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function O(e,t,n,r,a){--t.pendingcb,n?(i.nextTick(a,r),i.nextTick(ne,e,t),e._writableState.errorEmitted=!0,e.emit(`error`,r)):(a(r),e._writableState.errorEmitted=!0,e.emit(`error`,r),ne(e,t))}function k(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function A(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(k(n),t)O(e,n,r,t,i);else{var a=te(n);!a&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&M(e,n),r?o(ee,e,n,a,i):ee(e,n,a,i)}}function ee(e,t,n,r){n||j(e,t),t.pendingcb--,r(),ne(e,t)}function j(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`))}function M(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=Array(r),o=t.corkedRequestsFree;o.entry=n;for(var s=0,c=!0;n;)i[s]=n,n.isBuf||(c=!1),n=n.next,s+=1;i.allBuffers=c,D(e,t,!0,t.length,i,``,o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,u=n.encoding,d=n.callback;if(D(e,t,!1,t.objectMode?1:l.length,l,u,d),n=n.next,t.bufferedRequestCount--,t.writing)break}n===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}S.prototype._write=function(e,t,n){n(Error(`_write() is not implemented`))},S.prototype._writev=null,S.prototype.end=function(e,t,n){var r=this._writableState;typeof e==`function`?(n=e,e=null,t=null):typeof t==`function`&&(n=t,t=null),e!=null&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||F(this,r,n)};function te(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function N(e,t){e._final(function(n){t.pendingcb--,n&&e.emit(`error`,n),t.prefinished=!0,e.emit(`prefinish`),ne(e,t)})}function P(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`?(t.pendingcb++,t.finalCalled=!0,i.nextTick(N,e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function ne(e,t){var n=te(t);return n&&(P(e,t),t.pendingcb===0&&(t.finished=!0,e.emit(`finish`))),n}function F(e,t,n){t.ending=!0,ne(e,t),n&&(t.finished?i.nextTick(n):e.once(`finish`,n)),t.ended=!0,e.writable=!1}function re(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}Object.defineProperty(S.prototype,"destroyed",{get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),S.prototype.destroy=_.destroy,S.prototype._undestroy=_.undestroy,S.prototype._destroy=function(e,t){this.end(),t(e)}})),ht=n(((e,t)=>{var n=I(),r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};t.exports=u;var i=Object.create(ie());i.inherits=d();var a=vt(),o=mt();i.inherits(u,a);for(var s=r(o.prototype),c=0;c<s.length;c++){var l=s[c];u.prototype[l]||(u.prototype[l]=o.prototype[l])}function u(e){if(!(this instanceof u))return new u(e);a.call(this,e),o.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once(`end`,f)}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function f(){this.allowHalfOpen||this._writableState.ended||n.nextTick(p,this)}function p(e){e.end()}Object.defineProperty(u.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),u.prototype._destroy=function(e,t){this.push(null),this.end(),n.nextTick(t,e)}})),gt=n(((e,t)=>{var n=a(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=o);function o(e,t,n){return r(e,t,n)}i(r,o),o.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},o.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},o.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},o.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),_t=n((e=>{var t=gt().Buffer,n=t.isEncoding||function(e){switch(e=``+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 r(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}}function i(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=a;function a(e){this.encoding=i(e);var n;switch(this.encoding){case`utf16le`:this.text=f,this.end=p,n=4;break;case`utf8`:this.fillLast=l,n=4;break;case`base64`:this.text=m,this.end=h,n=3;break;default:this.write=g,this.end=_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}a.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},a.prototype.end=d,a.prototype.text=u,a.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};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 s(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function l(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function u(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function d(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function f(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function m(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?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-n))}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 g(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):``}})),vt=n(((t,n)=>{var r=e(x()),i=I();n.exports=T;var a=st(),o;T.ReadableState=w,u().EventEmitter;var s=function(e,t){return e.listeners(t).length},c=ct(),l=lt().Buffer,f=(typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof self<`u`?self:{}).Uint8Array||function(){};function p(e){return l.from(e)}function m(e){return l.isBuffer(e)||e instanceof f}var h=Object.create(ie());h.inherits=d();var g=ut(),_=void 0;_=g&&g.debuglog?g.debuglog(`stream`):function(){};var v=ft(),y=pt(),b;h.inherits(T,c);var S=[`error`,`close`,`destroy`,`pause`,`resume`];function C(e,t,n){if(typeof e.prependListener==`function`)return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):a(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}function w(e,t){o||=ht(),e||={};var n=t instanceof o;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,i=e.readableHighWaterMark,a=this.objectMode?16:16*1024;r||r===0?this.highWaterMark=r:n&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new v,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||`utf8`,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(b||=_t().StringDecoder,this.decoder=new b(e.encoding),this.encoding=e.encoding)}function T(e){if(o||=ht(),!(this instanceof T))return new T(e);this._readableState=new w(e,this),this.readable=!0,e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy)),c.call(this)}Object.defineProperty(T.prototype,"destroyed",{get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),T.prototype.destroy=y.destroy,T.prototype._undestroy=y.undestroy,T.prototype._destroy=function(e,t){this.push(null),t(e)},T.prototype.push=function(e,t){var n=this._readableState,r;return n.objectMode?r=!0:typeof e==`string`&&(t||=n.defaultEncoding,t!==n.encoding&&(e=l.from(e,t),t=``),r=!0),E(this,e,t,!1,r)},T.prototype.unshift=function(e){return E(this,e,null,!0,!1)};function E(e,t,n,r,i){var a=e._readableState;if(t===null)a.reading=!1,M(e,a);else{var o;i||(o=O(a,t)),o?e.emit(`error`,o):a.objectMode||t&&t.length>0?(typeof t!=`string`&&!a.objectMode&&Object.getPrototypeOf(t)!==l.prototype&&(t=p(t)),r?a.endEmitted?e.emit(`error`,Error(`stream.unshift() after end event`)):D(e,a,t,!0):a.ended?e.emit(`error`,Error(`stream.push() after EOF`)):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||t.length!==0?D(e,a,t,!1):P(e,a)):D(e,a,t,!1))):r||(a.reading=!1)}return k(a)}function D(e,t,n,r){t.flowing&&t.length===0&&!t.sync?(e.emit(`data`,n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&te(e)),P(e,t)}function O(e,t){var n;return!m(t)&&typeof t!=`string`&&t!==void 0&&!e.objectMode&&(n=TypeError(`Invalid non-string/buffer chunk`)),n}function k(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}T.prototype.isPaused=function(){return this._readableState.flowing===!1},T.prototype.setEncoding=function(e){return b||=_t().StringDecoder,this._readableState.decoder=new b(e),this._readableState.encoding=e,this};var A=8388608;function ee(e){return e>=A?e=A:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function j(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=ee(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}T.prototype.read=function(e){_(`read`,e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return _(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?oe(this):te(this),null;if(e=j(e,t),e===0&&t.ended)return t.length===0&&oe(this),null;var r=t.needReadable;_(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,_(`length less than watermark`,r)),t.ended||t.reading?(r=!1,_(`reading or ended`,r)):r&&(_(`do read`),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=j(n,t)));var i=e>0?B(e,t):null;return i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&oe(this)),i!==null&&this.emit(`data`,i),i};function M(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,te(e)}}function te(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(_(`emitReadable`,t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(N,e):N(e))}function N(e){_(`emit readable`),e.emit(`readable`),z(e)}function P(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(ne,e,t))}function ne(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(_(`maybeReadMore read 0`),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}T.prototype._read=function(e){this.emit(`error`,Error(`_read() is not implemented`))},T.prototype.pipe=function(e,t){var n=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e);break}a.pipesCount+=1,_(`pipe count=%d opts=%j`,a.pipesCount,t);var o=(!t||t.end!==!1)&&e!==r.default.stdout&&e!==r.default.stderr?l:y;a.endEmitted?i.nextTick(o):n.once(`end`,o),e.on(`unpipe`,c);function c(e,t){_(`onunpipe`),e===n&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,f())}function l(){_(`onend`),e.end()}var u=F(n);e.on(`drain`,u);var d=!1;function f(){_(`cleanup`),e.removeListener(`close`,g),e.removeListener(`finish`,v),e.removeListener(`drain`,u),e.removeListener(`error`,h),e.removeListener(`unpipe`,c),n.removeListener(`end`,l),n.removeListener(`end`,y),n.removeListener(`data`,m),d=!0,a.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&u()}var p=!1;n.on(`data`,m);function m(t){_(`ondata`),p=!1,!1===e.write(t)&&!p&&((a.pipesCount===1&&a.pipes===e||a.pipesCount>1&&U(a.pipes,e)!==-1)&&!d&&(_(`false write response, pause`,a.awaitDrain),a.awaitDrain++,p=!0),n.pause())}function h(t){_(`onerror`,t),y(),e.removeListener(`error`,h),s(e,`error`)===0&&e.emit(`error`,t)}C(e,`error`,h);function g(){e.removeListener(`finish`,v),y()}e.once(`close`,g);function v(){_(`onfinish`),e.removeListener(`close`,g),y()}e.once(`finish`,v);function y(){_(`unpipe`),n.unpipe(e)}return e.emit(`pipe`,n),a.flowing||(_(`pipe resume`),n.resume()),e};function F(e){return function(){var t=e._readableState;_(`pipeOnDrain`,t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&s(e,`data`)&&(t.flowing=!0,z(e))}}T.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||=t.pipes,t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit(`unpipe`,this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)r[a].emit(`unpipe`,this,{hasUnpiped:!1});return this}var o=U(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),--t.pipesCount,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit(`unpipe`,this,n),this)},T.prototype.on=function(e,t){var n=c.prototype.on.call(this,e,t);if(e===`data`)this._readableState.flowing!==!1&&this.resume();else if(e===`readable`){var r=this._readableState;!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&te(this):i.nextTick(re,this))}return n},T.prototype.addListener=T.prototype.on;function re(e){_(`readable nexttick read 0`),e.read(0)}T.prototype.resume=function(){var e=this._readableState;return e.flowing||(_(`resume`),e.flowing=!0,L(this,e)),this};function L(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(R,e,t))}function R(e,t){t.reading||(_(`resume read 0`),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit(`resume`),z(e),t.flowing&&!t.reading&&e.read(0)}T.prototype.pause=function(){return _(`call pause flowing=%j`,this._readableState.flowing),!1!==this._readableState.flowing&&(_(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this};function z(e){var t=e._readableState;for(_(`flow`,t.flowing);t.flowing&&e.read()!==null;);}T.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on(`end`,function(){if(_(`wrapped end`),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on(`data`,function(i){_(`wrapped data`),n.decoder&&(i=n.decoder.write(i)),!(n.objectMode&&i==null)&&(!n.objectMode&&(!i||!i.length)||t.push(i)||(r=!0,e.pause()))}),e)this[i]===void 0&&typeof e[i]==`function`&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<S.length;a++)e.on(S[a],this.emit.bind(this,S[a]));return this._read=function(t){_(`wrapped _read`,t),r&&(r=!1,e.resume())},this},Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),T._fromList=B;function B(e,t){if(t.length===0)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=ae(e,t.buffer,t.decoder),n}function ae(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?V(e,t):H(e,t),r}function V(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var a=n.data,o=e>a.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),e-=o,e===0){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}function H(e,t){var n=l.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),e-=o,e===0){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}function oe(e){var t=e._readableState;if(t.length>0)throw Error(`"endReadable()" called on non-empty stream`);t.endEmitted||(t.ended=!0,i.nextTick(se,t,e))}function se(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit(`end`))}function U(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}})),yt=n(((e,t)=>{t.exports=a;var n=ht(),r=Object.create(ie());r.inherits=d(),r.inherits(a,n);function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit(`error`,Error(`write callback called multiple times`));n.writechunk=null,n.writecb=null,t!=null&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function a(e){if(!(this instanceof a))return new a(e);n.call(this,e),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,o)}function o(){var e=this;typeof this._flush==`function`?this._flush(function(t,n){s(e,t,n)}):s(this,null,null)}a.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},a.prototype._transform=function(e,t,n){throw Error(`_transform() is not implemented`)},a.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},a.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,function(e){t(e),r.emit(`close`)})};function s(e,t,n){if(t)return e.emit(`error`,t);if(n!=null&&e.push(n),e._writableState.length)throw Error(`Calling transform done when ws.length != 0`);if(e._transformState.transforming)throw Error(`Calling transform done when still transforming`);return e.push(null)}})),bt=n(((e,t)=>{t.exports=i;var n=yt(),r=Object.create(ie());r.inherits=d(),r.inherits(i,n);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}i.prototype._transform=function(e,t,n){n(null,e)}})),xt=n(((e,t)=>{e=t.exports=vt(),e.Stream=e,e.Readable=e,e.Writable=mt(),e.Duplex=ht(),e.Transform=yt(),e.PassThrough=bt()})),St=n((()=>{})),Ct=n(((e,t)=>{(function(e,t){function n(e,t){if(!e)throw Error(t||`Assertion failed`)}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,e!==null&&((t===`le`||t===`be`)&&(n=t,t=10),this._init(e||0,t||10,n||`be`))}typeof e==`object`?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var a;try{a=typeof window<`u`&&window.Buffer!==void 0?window.Buffer:St().Buffer}catch{}i.isBN=function(e){return e instanceof i||typeof e==`object`&&!!e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if(typeof e==`number`)return this._initNumber(e,t,r);if(typeof e==`object`)return this._initArray(e,t,r);t===`hex`&&(t=16),n(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,``);var i=0;e[0]===`-`&&(i++,this.negative=1),i<e.length&&(t===16?this._parseHex(e,i,r):(this._parseBase(e,t,i),r===`le`&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),r===`le`&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n(typeof e.length==`number`),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if(r===`be`)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);else if(r===`le`)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);return this._strip()};function o(e,t){var r=e.charCodeAt(t);if(r>=48&&r<=57)return r-48;if(r>=65&&r<=70)return r-55;if(r>=97&&r<=102)return r-87;n(!1,`Invalid character in `+e)}function s(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i=0,a=0,o;if(n===`be`)for(r=e.length-1;r>=t;r-=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this._strip()};function c(e,t,r,i){for(var a=0,o=0,s=Math.min(e.length,r),c=t;c<s;c++){var l=e.charCodeAt(c)-48;a*=i,o=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&o<i,`Invalid character`),a+=o}return a}i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var a=e.length-n,o=a%r,s=Math.min(a,a-o)+n,l=0,u=n;u<s;u+=r)l=c(e,u,u+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(o!==0){var d=1;for(l=c(e,u,e.length,t),u=0;u<o;u++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this._strip()},i.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red};function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.prototype._move=function(e){l(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<`u`&&typeof Symbol.for==`function`)try{i.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=u}catch{i.prototype.inspect=u}else i.prototype.inspect=u;function u(){return(this.red?`<BN-R: `:`<BN: `)+this.toString(16)+`>`}var d=`.0.00.000.0000.00000.000000.0000000.00000000.000000000.0000000000.00000000000.000000000000.0000000000000.00000000000000.000000000000000.0000000000000000.00000000000000000.000000000000000000.0000000000000000000.00000000000000000000.000000000000000000000.0000000000000000000000.00000000000000000000000.000000000000000000000000.0000000000000000000000000`.split(`.`),f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){e||=10,t=t|0||1;var r;if(e===16||e===`hex`){r=``;for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],c=((s<<i|a)&16777215).toString(16);a=s>>>24-i&16777215,i+=2,i>=26&&(i-=26,o--),r=a!==0||o!==this.length-1?d[6-c.length]+c+r:c+r}for(a!==0&&(r=a.toString(16)+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}if(e===(e|0)&&e>=2&&e<=36){var l=f[e],u=p[e];r=``;var m=this.clone();for(m.negative=0;!m.isZero();){var h=m.modrn(u).toString(e);m=m.idivn(u),r=m.isZero()?h+r:d[l-h.length]+h+r}for(this.isZero()&&(r=`0`+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}n(!1,`Base should be between 2 and 36`)},i.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,`Number can only safely store up to 53 bits`),this.negative===0?e:-e},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};var m=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)};i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,`byte array longer than desired length`),n(a>0,`Requested array length <= 0`);var o=m(e,a),s=t===`le`?`LE`:`BE`;return this[`_toArrayLike`+s](o,i),o},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n++]=o&255,n<e.length&&(e[n++]=o>>8&255),n<e.length&&(e[n++]=o>>16&255),a===6?(n<e.length&&(e[n++]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n--]=o&255,n>=0&&(e[n--]=o>>8&255),n>=0&&(e[n--]=o>>16&255),a===6?(n>=0&&(e[n--]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,n=0;return t&8191||(n+=13,t>>>=13),t&127||(n+=7,t>>>=7),t&15||(n+=4,t>>>=4),t&3||(n+=2,t>>>=2),t&1||n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function h(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,n!==26)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return this.negative===0?this.clone():this.abs().inotn(e).iaddn(1)},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n((this.negative|e.negative)===0),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){for(var t=this.length>e.length?e:this,n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n((this.negative|e.negative)===0),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n((this.negative|e.negative)===0),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n(typeof e==`number`&&e>=0);var t=Math.ceil(e/26)|0,r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=~this.words[i]&67108863;for(r>0&&(this.words[i]=~this.words[i]&67108863>>26-r,i++);i<this.length;i++)this.words[i]=0;return this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n(typeof e==`number`&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<i:this.words[r]=this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var n,r;this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(n.words[a]|0)+(r.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;for(;i!==0&&a<n.length;a++)t=(n.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;if(this.length=n.length,i!==0)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},i.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var r,i;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)t=(r.words[o]|0)-(i.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;for(;a!==0&&o<r.length;o++)t=(r.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;if(a===0&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};function g(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=e.words[0]|0,a=t.words[0]|0,o=i*a,s=o&67108863,c=o/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var u=c>>>26,d=c&67108863,f=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=f;p++){var m=l-p|0;i=e.words[m]|0,a=t.words[p]|0,o=i*a+d,u+=o/67108864|0,d=o&67108863}n.words[l]=d|0,c=u|0}return c===0?n.length--:n.words[l]=c|0,n._strip()}var _=function(e,t,n){var r=e.words,i=t.words,a=n.words,o=0,s,c,l,u=r[0]|0,d=u&8191,f=u>>>13,p=r[1]|0,m=p&8191,h=p>>>13,g=r[2]|0,_=g&8191,v=g>>>13,y=r[3]|0,b=y&8191,x=y>>>13,S=r[4]|0,C=S&8191,w=S>>>13,T=r[5]|0,E=T&8191,D=T>>>13,O=r[6]|0,k=O&8191,A=O>>>13,ee=r[7]|0,j=ee&8191,M=ee>>>13,te=r[8]|0,N=te&8191,P=te>>>13,ne=r[9]|0,F=ne&8191,I=ne>>>13,re=i[0]|0,L=re&8191,R=re>>>13,ie=i[1]|0,z=ie&8191,B=ie>>>13,ae=i[2]|0,V=ae&8191,H=ae>>>13,oe=i[3]|0,se=oe&8191,U=oe>>>13,ce=i[4]|0,W=ce&8191,G=ce>>>13,le=i[5]|0,K=le&8191,q=le>>>13,ue=i[6]|0,J=ue&8191,de=ue>>>13,fe=i[7]|0,pe=fe&8191,me=fe>>>13,Y=i[8]|0,X=Y&8191,Z=Y>>>13,he=i[9]|0,ge=he&8191,_e=he>>>13;n.negative=e.negative^t.negative,n.length=19,s=Math.imul(d,L),c=Math.imul(d,R),c=c+Math.imul(f,L)|0,l=Math.imul(f,R);var ve=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ve>>>26)|0,ve&=67108863,s=Math.imul(m,L),c=Math.imul(m,R),c=c+Math.imul(h,L)|0,l=Math.imul(h,R),s=s+Math.imul(d,z)|0,c=c+Math.imul(d,B)|0,c=c+Math.imul(f,z)|0,l=l+Math.imul(f,B)|0;var ye=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ye>>>26)|0,ye&=67108863,s=Math.imul(_,L),c=Math.imul(_,R),c=c+Math.imul(v,L)|0,l=Math.imul(v,R),s=s+Math.imul(m,z)|0,c=c+Math.imul(m,B)|0,c=c+Math.imul(h,z)|0,l=l+Math.imul(h,B)|0,s=s+Math.imul(d,V)|0,c=c+Math.imul(d,H)|0,c=c+Math.imul(f,V)|0,l=l+Math.imul(f,H)|0;var be=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(be>>>26)|0,be&=67108863,s=Math.imul(b,L),c=Math.imul(b,R),c=c+Math.imul(x,L)|0,l=Math.imul(x,R),s=s+Math.imul(_,z)|0,c=c+Math.imul(_,B)|0,c=c+Math.imul(v,z)|0,l=l+Math.imul(v,B)|0,s=s+Math.imul(m,V)|0,c=c+Math.imul(m,H)|0,c=c+Math.imul(h,V)|0,l=l+Math.imul(h,H)|0,s=s+Math.imul(d,se)|0,c=c+Math.imul(d,U)|0,c=c+Math.imul(f,se)|0,l=l+Math.imul(f,U)|0;var xe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(xe>>>26)|0,xe&=67108863,s=Math.imul(C,L),c=Math.imul(C,R),c=c+Math.imul(w,L)|0,l=Math.imul(w,R),s=s+Math.imul(b,z)|0,c=c+Math.imul(b,B)|0,c=c+Math.imul(x,z)|0,l=l+Math.imul(x,B)|0,s=s+Math.imul(_,V)|0,c=c+Math.imul(_,H)|0,c=c+Math.imul(v,V)|0,l=l+Math.imul(v,H)|0,s=s+Math.imul(m,se)|0,c=c+Math.imul(m,U)|0,c=c+Math.imul(h,se)|0,l=l+Math.imul(h,U)|0,s=s+Math.imul(d,W)|0,c=c+Math.imul(d,G)|0,c=c+Math.imul(f,W)|0,l=l+Math.imul(f,G)|0;var Se=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Se>>>26)|0,Se&=67108863,s=Math.imul(E,L),c=Math.imul(E,R),c=c+Math.imul(D,L)|0,l=Math.imul(D,R),s=s+Math.imul(C,z)|0,c=c+Math.imul(C,B)|0,c=c+Math.imul(w,z)|0,l=l+Math.imul(w,B)|0,s=s+Math.imul(b,V)|0,c=c+Math.imul(b,H)|0,c=c+Math.imul(x,V)|0,l=l+Math.imul(x,H)|0,s=s+Math.imul(_,se)|0,c=c+Math.imul(_,U)|0,c=c+Math.imul(v,se)|0,l=l+Math.imul(v,U)|0,s=s+Math.imul(m,W)|0,c=c+Math.imul(m,G)|0,c=c+Math.imul(h,W)|0,l=l+Math.imul(h,G)|0,s=s+Math.imul(d,K)|0,c=c+Math.imul(d,q)|0,c=c+Math.imul(f,K)|0,l=l+Math.imul(f,q)|0;var Ce=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,s=Math.imul(k,L),c=Math.imul(k,R),c=c+Math.imul(A,L)|0,l=Math.imul(A,R),s=s+Math.imul(E,z)|0,c=c+Math.imul(E,B)|0,c=c+Math.imul(D,z)|0,l=l+Math.imul(D,B)|0,s=s+Math.imul(C,V)|0,c=c+Math.imul(C,H)|0,c=c+Math.imul(w,V)|0,l=l+Math.imul(w,H)|0,s=s+Math.imul(b,se)|0,c=c+Math.imul(b,U)|0,c=c+Math.imul(x,se)|0,l=l+Math.imul(x,U)|0,s=s+Math.imul(_,W)|0,c=c+Math.imul(_,G)|0,c=c+Math.imul(v,W)|0,l=l+Math.imul(v,G)|0,s=s+Math.imul(m,K)|0,c=c+Math.imul(m,q)|0,c=c+Math.imul(h,K)|0,l=l+Math.imul(h,q)|0,s=s+Math.imul(d,J)|0,c=c+Math.imul(d,de)|0,c=c+Math.imul(f,J)|0,l=l+Math.imul(f,de)|0;var we=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(we>>>26)|0,we&=67108863,s=Math.imul(j,L),c=Math.imul(j,R),c=c+Math.imul(M,L)|0,l=Math.imul(M,R),s=s+Math.imul(k,z)|0,c=c+Math.imul(k,B)|0,c=c+Math.imul(A,z)|0,l=l+Math.imul(A,B)|0,s=s+Math.imul(E,V)|0,c=c+Math.imul(E,H)|0,c=c+Math.imul(D,V)|0,l=l+Math.imul(D,H)|0,s=s+Math.imul(C,se)|0,c=c+Math.imul(C,U)|0,c=c+Math.imul(w,se)|0,l=l+Math.imul(w,U)|0,s=s+Math.imul(b,W)|0,c=c+Math.imul(b,G)|0,c=c+Math.imul(x,W)|0,l=l+Math.imul(x,G)|0,s=s+Math.imul(_,K)|0,c=c+Math.imul(_,q)|0,c=c+Math.imul(v,K)|0,l=l+Math.imul(v,q)|0,s=s+Math.imul(m,J)|0,c=c+Math.imul(m,de)|0,c=c+Math.imul(h,J)|0,l=l+Math.imul(h,de)|0,s=s+Math.imul(d,pe)|0,c=c+Math.imul(d,me)|0,c=c+Math.imul(f,pe)|0,l=l+Math.imul(f,me)|0;var Te=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,s=Math.imul(N,L),c=Math.imul(N,R),c=c+Math.imul(P,L)|0,l=Math.imul(P,R),s=s+Math.imul(j,z)|0,c=c+Math.imul(j,B)|0,c=c+Math.imul(M,z)|0,l=l+Math.imul(M,B)|0,s=s+Math.imul(k,V)|0,c=c+Math.imul(k,H)|0,c=c+Math.imul(A,V)|0,l=l+Math.imul(A,H)|0,s=s+Math.imul(E,se)|0,c=c+Math.imul(E,U)|0,c=c+Math.imul(D,se)|0,l=l+Math.imul(D,U)|0,s=s+Math.imul(C,W)|0,c=c+Math.imul(C,G)|0,c=c+Math.imul(w,W)|0,l=l+Math.imul(w,G)|0,s=s+Math.imul(b,K)|0,c=c+Math.imul(b,q)|0,c=c+Math.imul(x,K)|0,l=l+Math.imul(x,q)|0,s=s+Math.imul(_,J)|0,c=c+Math.imul(_,de)|0,c=c+Math.imul(v,J)|0,l=l+Math.imul(v,de)|0,s=s+Math.imul(m,pe)|0,c=c+Math.imul(m,me)|0,c=c+Math.imul(h,pe)|0,l=l+Math.imul(h,me)|0,s=s+Math.imul(d,X)|0,c=c+Math.imul(d,Z)|0,c=c+Math.imul(f,X)|0,l=l+Math.imul(f,Z)|0;var Ee=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,s=Math.imul(F,L),c=Math.imul(F,R),c=c+Math.imul(I,L)|0,l=Math.imul(I,R),s=s+Math.imul(N,z)|0,c=c+Math.imul(N,B)|0,c=c+Math.imul(P,z)|0,l=l+Math.imul(P,B)|0,s=s+Math.imul(j,V)|0,c=c+Math.imul(j,H)|0,c=c+Math.imul(M,V)|0,l=l+Math.imul(M,H)|0,s=s+Math.imul(k,se)|0,c=c+Math.imul(k,U)|0,c=c+Math.imul(A,se)|0,l=l+Math.imul(A,U)|0,s=s+Math.imul(E,W)|0,c=c+Math.imul(E,G)|0,c=c+Math.imul(D,W)|0,l=l+Math.imul(D,G)|0,s=s+Math.imul(C,K)|0,c=c+Math.imul(C,q)|0,c=c+Math.imul(w,K)|0,l=l+Math.imul(w,q)|0,s=s+Math.imul(b,J)|0,c=c+Math.imul(b,de)|0,c=c+Math.imul(x,J)|0,l=l+Math.imul(x,de)|0,s=s+Math.imul(_,pe)|0,c=c+Math.imul(_,me)|0,c=c+Math.imul(v,pe)|0,l=l+Math.imul(v,me)|0,s=s+Math.imul(m,X)|0,c=c+Math.imul(m,Z)|0,c=c+Math.imul(h,X)|0,l=l+Math.imul(h,Z)|0,s=s+Math.imul(d,ge)|0,c=c+Math.imul(d,_e)|0,c=c+Math.imul(f,ge)|0,l=l+Math.imul(f,_e)|0;var De=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(De>>>26)|0,De&=67108863,s=Math.imul(F,z),c=Math.imul(F,B),c=c+Math.imul(I,z)|0,l=Math.imul(I,B),s=s+Math.imul(N,V)|0,c=c+Math.imul(N,H)|0,c=c+Math.imul(P,V)|0,l=l+Math.imul(P,H)|0,s=s+Math.imul(j,se)|0,c=c+Math.imul(j,U)|0,c=c+Math.imul(M,se)|0,l=l+Math.imul(M,U)|0,s=s+Math.imul(k,W)|0,c=c+Math.imul(k,G)|0,c=c+Math.imul(A,W)|0,l=l+Math.imul(A,G)|0,s=s+Math.imul(E,K)|0,c=c+Math.imul(E,q)|0,c=c+Math.imul(D,K)|0,l=l+Math.imul(D,q)|0,s=s+Math.imul(C,J)|0,c=c+Math.imul(C,de)|0,c=c+Math.imul(w,J)|0,l=l+Math.imul(w,de)|0,s=s+Math.imul(b,pe)|0,c=c+Math.imul(b,me)|0,c=c+Math.imul(x,pe)|0,l=l+Math.imul(x,me)|0,s=s+Math.imul(_,X)|0,c=c+Math.imul(_,Z)|0,c=c+Math.imul(v,X)|0,l=l+Math.imul(v,Z)|0,s=s+Math.imul(m,ge)|0,c=c+Math.imul(m,_e)|0,c=c+Math.imul(h,ge)|0,l=l+Math.imul(h,_e)|0;var Oe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,s=Math.imul(F,V),c=Math.imul(F,H),c=c+Math.imul(I,V)|0,l=Math.imul(I,H),s=s+Math.imul(N,se)|0,c=c+Math.imul(N,U)|0,c=c+Math.imul(P,se)|0,l=l+Math.imul(P,U)|0,s=s+Math.imul(j,W)|0,c=c+Math.imul(j,G)|0,c=c+Math.imul(M,W)|0,l=l+Math.imul(M,G)|0,s=s+Math.imul(k,K)|0,c=c+Math.imul(k,q)|0,c=c+Math.imul(A,K)|0,l=l+Math.imul(A,q)|0,s=s+Math.imul(E,J)|0,c=c+Math.imul(E,de)|0,c=c+Math.imul(D,J)|0,l=l+Math.imul(D,de)|0,s=s+Math.imul(C,pe)|0,c=c+Math.imul(C,me)|0,c=c+Math.imul(w,pe)|0,l=l+Math.imul(w,me)|0,s=s+Math.imul(b,X)|0,c=c+Math.imul(b,Z)|0,c=c+Math.imul(x,X)|0,l=l+Math.imul(x,Z)|0,s=s+Math.imul(_,ge)|0,c=c+Math.imul(_,_e)|0,c=c+Math.imul(v,ge)|0,l=l+Math.imul(v,_e)|0;var ke=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ke>>>26)|0,ke&=67108863,s=Math.imul(F,se),c=Math.imul(F,U),c=c+Math.imul(I,se)|0,l=Math.imul(I,U),s=s+Math.imul(N,W)|0,c=c+Math.imul(N,G)|0,c=c+Math.imul(P,W)|0,l=l+Math.imul(P,G)|0,s=s+Math.imul(j,K)|0,c=c+Math.imul(j,q)|0,c=c+Math.imul(M,K)|0,l=l+Math.imul(M,q)|0,s=s+Math.imul(k,J)|0,c=c+Math.imul(k,de)|0,c=c+Math.imul(A,J)|0,l=l+Math.imul(A,de)|0,s=s+Math.imul(E,pe)|0,c=c+Math.imul(E,me)|0,c=c+Math.imul(D,pe)|0,l=l+Math.imul(D,me)|0,s=s+Math.imul(C,X)|0,c=c+Math.imul(C,Z)|0,c=c+Math.imul(w,X)|0,l=l+Math.imul(w,Z)|0,s=s+Math.imul(b,ge)|0,c=c+Math.imul(b,_e)|0,c=c+Math.imul(x,ge)|0,l=l+Math.imul(x,_e)|0;var Ae=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,s=Math.imul(F,W),c=Math.imul(F,G),c=c+Math.imul(I,W)|0,l=Math.imul(I,G),s=s+Math.imul(N,K)|0,c=c+Math.imul(N,q)|0,c=c+Math.imul(P,K)|0,l=l+Math.imul(P,q)|0,s=s+Math.imul(j,J)|0,c=c+Math.imul(j,de)|0,c=c+Math.imul(M,J)|0,l=l+Math.imul(M,de)|0,s=s+Math.imul(k,pe)|0,c=c+Math.imul(k,me)|0,c=c+Math.imul(A,pe)|0,l=l+Math.imul(A,me)|0,s=s+Math.imul(E,X)|0,c=c+Math.imul(E,Z)|0,c=c+Math.imul(D,X)|0,l=l+Math.imul(D,Z)|0,s=s+Math.imul(C,ge)|0,c=c+Math.imul(C,_e)|0,c=c+Math.imul(w,ge)|0,l=l+Math.imul(w,_e)|0;var je=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(je>>>26)|0,je&=67108863,s=Math.imul(F,K),c=Math.imul(F,q),c=c+Math.imul(I,K)|0,l=Math.imul(I,q),s=s+Math.imul(N,J)|0,c=c+Math.imul(N,de)|0,c=c+Math.imul(P,J)|0,l=l+Math.imul(P,de)|0,s=s+Math.imul(j,pe)|0,c=c+Math.imul(j,me)|0,c=c+Math.imul(M,pe)|0,l=l+Math.imul(M,me)|0,s=s+Math.imul(k,X)|0,c=c+Math.imul(k,Z)|0,c=c+Math.imul(A,X)|0,l=l+Math.imul(A,Z)|0,s=s+Math.imul(E,ge)|0,c=c+Math.imul(E,_e)|0,c=c+Math.imul(D,ge)|0,l=l+Math.imul(D,_e)|0;var Me=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Me>>>26)|0,Me&=67108863,s=Math.imul(F,J),c=Math.imul(F,de),c=c+Math.imul(I,J)|0,l=Math.imul(I,de),s=s+Math.imul(N,pe)|0,c=c+Math.imul(N,me)|0,c=c+Math.imul(P,pe)|0,l=l+Math.imul(P,me)|0,s=s+Math.imul(j,X)|0,c=c+Math.imul(j,Z)|0,c=c+Math.imul(M,X)|0,l=l+Math.imul(M,Z)|0,s=s+Math.imul(k,ge)|0,c=c+Math.imul(k,_e)|0,c=c+Math.imul(A,ge)|0,l=l+Math.imul(A,_e)|0;var Ne=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s=Math.imul(F,pe),c=Math.imul(F,me),c=c+Math.imul(I,pe)|0,l=Math.imul(I,me),s=s+Math.imul(N,X)|0,c=c+Math.imul(N,Z)|0,c=c+Math.imul(P,X)|0,l=l+Math.imul(P,Z)|0,s=s+Math.imul(j,ge)|0,c=c+Math.imul(j,_e)|0,c=c+Math.imul(M,ge)|0,l=l+Math.imul(M,_e)|0;var Pe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,s=Math.imul(F,X),c=Math.imul(F,Z),c=c+Math.imul(I,X)|0,l=Math.imul(I,Z),s=s+Math.imul(N,ge)|0,c=c+Math.imul(N,_e)|0,c=c+Math.imul(P,ge)|0,l=l+Math.imul(P,_e)|0;var Fe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,s=Math.imul(F,ge),c=Math.imul(F,_e),c=c+Math.imul(I,ge)|0,l=Math.imul(I,_e);var Q=(o+s|0)+((c&8191)<<13)|0;return o=(l+(c>>>13)|0)+(Q>>>26)|0,Q&=67108863,a[0]=ve,a[1]=ye,a[2]=be,a[3]=xe,a[4]=Se,a[5]=Ce,a[6]=we,a[7]=Te,a[8]=Ee,a[9]=De,a[10]=Oe,a[11]=ke,a[12]=Ae,a[13]=je,a[14]=Me,a[15]=Ne,a[16]=Pe,a[17]=Fe,a[18]=Q,o!==0&&(a[19]=o,n.length++),n};Math.imul||(_=g);function v(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,a=0;a<n.length-1;a++){var o=i;i=0;for(var s=r&67108863,c=Math.min(a,t.length-1),l=Math.max(0,a-e.length+1);l<=c;l++){var u=a-l,d=(e.words[u]|0)*(t.words[l]|0),f=d&67108863;o=o+(d/67108864|0)|0,f=f+s|0,s=f&67108863,o=o+(f>>>26)|0,i+=o>>>26,o&=67108863}n.words[a]=s,r=o,o=i}return r===0?n.length--:n.words[a]=r,n._strip()}function y(e,t,n){return v(e,t,n)}i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=this.length===10&&e.length===10?_(this,e,t):r<63?g(this,e,t):r<1024?v(this,e,t):y(this,e,t),n};function b(e,t){this.x=e,this.y=t}b.prototype.makeRBT=function(e){for(var t=Array(e),n=i.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},b.prototype.revBin=function(e,t,n){if(e===0||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(e&1)<<t-i-1,e>>=1;return r},b.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},b.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,c=Math.cos(2*Math.PI/s),l=Math.sin(2*Math.PI/s),u=0;u<i;u+=s)for(var d=c,f=l,p=0;p<o;p++){var m=n[u+p],h=r[u+p],g=n[u+p+o],_=r[u+p+o],v=d*g-f*_;_=d*_+f*g,g=v,n[u+p]=m+g,r[u+p]=h+_,n[u+p+o]=m-g,r[u+p+o]=h-_,p!==s&&(v=c*d-l*f,f=c*f+l*d,d=v)}},b.prototype.guessLen13b=function(e,t){var n=Math.max(t,e)|1,r=n&1,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},b.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},b.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=Math.round(e[2*r+1]/t)*8192+Math.round(e[2*r]/t)+n;e[r]=i&67108863,n=i<67108864?0:i/67108864|0}return e},b.prototype.convert13b=function(e,t,r,i){for(var a=0,o=0;o<t;o++)a+=e[o]|0,r[2*o]=a&8191,a>>>=13,r[2*o+1]=a&8191,a>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(a===0),n((a&-8192)==0)},b.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},b.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),c=Array(r),l=Array(r),u=Array(r),d=Array(r),f=n.words;f.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,c,r,i),this.transform(l,a,u,d,r,i);for(var p=0;p<r;p++){var m=s[p]*u[p]-c[p]*d[p];c[p]=s[p]*d[p]+c[p]*u[p],s[p]=m}return this.conjugate(s,c,r),this.transform(s,c,f,a,r,i),this.conjugate(f,a,r),this.normalize13b(f,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n._strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n(typeof e==`number`),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var a=(this.words[i]|0)*e,o=(a&67108863)+(r&67108863);r>>=26,r+=a/67108864|0,r+=o>>>26,this.words[i]=o&67108863}return r!==0&&(this.words[i]=r,this.length++),e===0&&(this.length=1,this._normSign()),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=h(e);if(t.length===0)return new i(1);for(var n=this,r=0;r<t.length&&t[r]===0;r++,n=n.sqr());if(++r<t.length)for(var a=n.sqr();r<t.length;r++,a=a.sqr())t[r]!==0&&(n=n.mul(a));return n},i.prototype.iushln=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=67108863>>>26-t<<26-t,a;if(t!==0){var o=0;for(a=0;a<this.length;a++){var s=this.words[a]&i,c=(this.words[a]|0)-s<<t;this.words[a]=c|o,o=s>>>26-t}o&&(this.words[a]=o,this.length++)}if(r!==0){for(a=this.length-1;a>=0;a--)this.words[a+r]=this.words[a];for(a=0;a<r;a++)this.words[a]=0;this.length+=r}return this._strip()},i.prototype.ishln=function(e){return n(this.negative===0),this.iushln(e)},i.prototype.iushrn=function(e,t,r){n(typeof e==`number`&&e>=0);var i=t?(t-t%26)/26:0,a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,c=r;if(i-=o,i=Math.max(0,i),c){for(var l=0;l<o;l++)c.words[l]=this.words[l];c.length=o}if(o!==0)if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var u=0;for(l=this.length-1;l>=0&&(u!==0||l>=i);l--){var d=this.words[l]|0;this.words[l]=u<<26-a|d>>>a,u=d&s}return c&&u!==0&&(c.words[c.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(this.negative===0),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return this.length<=r?!1:!!(this.words[r]&i)},i.prototype.imaskn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26;if(n(this.negative===0,`imaskn works only with positive numbers`),this.length<=r)return this;if(t!==0&&r++,this.length=Math.min(r,this.length),t!==0){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n(typeof e==`number`),n(e<67108864),e<0?this.isubn(-e):this.negative===0?this._iaddn(e):this.length===1&&(this.words[0]|0)<=e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n(typeof e==`number`),n(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,--this.words[t+1];return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i=e.length+r,a;this._expand(i);var o,s=0;for(a=0;a<e.length;a++){o=(this.words[a+r]|0)+s;var c=(e.words[a]|0)*t;o-=c&67108863,s=(o>>26)-(c/67108864|0),this.words[a+r]=o&67108863}for(;a<this.length-r;a++)o=(this.words[a+r]|0)+s,s=o>>26,this.words[a+r]=o&67108863;if(s===0)return this._strip();for(n(s===-1),s=0,a=0;a<this.length;a++)o=-(this.words[a]|0)+s,s=o>>26,this.words[a]=o&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=this.length-e.length,r=this.clone(),a=e,o=a.words[a.length-1]|0;n=26-this._countBits(o),n!==0&&(a=a.ushln(n),r.iushln(n),o=a.words[a.length-1]|0);var s=r.length-a.length,c;if(t!==`mod`){c=new i(null),c.length=s+1,c.words=Array(c.length);for(var l=0;l<c.length;l++)c.words[l]=0}var u=r.clone()._ishlnsubmul(a,1,s);u.negative===0&&(r=u,c&&(c.words[s]=1));for(var d=s-1;d>=0;d--){var f=(r.words[a.length+d]|0)*67108864+(r.words[a.length+d-1]|0);for(f=Math.min(f/o|0,67108863),r._ishlnsubmul(a,f,d);r.negative!==0;)f--,r.negative=0,r._ishlnsubmul(a,1,d),r.isZero()||(r.negative^=1);c&&(c.words[d]=f)}return c&&c._strip(),r._strip(),t!==`div`&&n!==0&&r.iushrn(n),{div:c||null,mod:r}},i.prototype.divmod=function(e,t,r){if(n(!e.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var a,o,s;return this.negative!==0&&e.negative===0?(s=this.neg().divmod(e,t),t!==`mod`&&(a=s.div.neg()),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.iadd(e)),{div:a,mod:o}):this.negative===0&&e.negative!==0?(s=this.divmod(e.neg(),t),t!==`mod`&&(a=s.div.neg()),{div:a,mod:s.mod}):(this.negative&e.negative)===0?e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:e.length===1?t===`div`?{div:this.divn(e.words[0]),mod:null}:t===`mod`?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.isub(e)),{div:s.div,mod:o})},i.prototype.div=function(e){return this.divmod(e,`div`,!1).div},i.prototype.mod=function(e){return this.divmod(e,`mod`,!1).mod},i.prototype.umod=function(e){return this.divmod(e,`mod`,!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=t.mod.abs(),r=e.abs().iushrn(1),a=e.words[0]&1,o=n.cmp(r);if(o<0||a===1&&o===0)return t.div;var s=new i(1);return s.negative=this.negative^e.negative,t.div.iadd(s)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(r*i+(this.words[a]|0))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var a=(this.words[i]|0)+r*67108864;this.words[i]=a/e|0,r=a%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=new i(0),c=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var u=r.clone(),d=t.clone();!t.isZero();){for(var f=0,p=1;(t.words[0]&p)===0&&f<26;++f,p<<=1);if(f>0)for(t.iushrn(f);f-->0;)(a.isOdd()||o.isOdd())&&(a.iadd(u),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var m=0,h=1;(r.words[0]&h)===0&&m<26;++m,h<<=1);if(m>0)for(r.iushrn(m);m-->0;)(s.isOdd()||c.isOdd())&&(s.iadd(u),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s),o.isub(c)):(r.isub(t),s.isub(a),c.isub(o))}return{a:s,b:c,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;(t.words[0]&l)===0&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-->0;)a.isOdd()&&a.iadd(s),a.iushrn(1);for(var u=0,d=1;(r.words[0]&d)===0&&u<26;++u,d<<=1);if(u>0)for(r.iushrn(u);u-->0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o)):(r.isub(t),o.isub(a))}var f=t.cmpn(1)===0?a:o;return f.cmpn(0)<0&&f.iadd(e),f},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var a=t;t=n,n=a}else if(i===0||n.cmpn(1)===0)break;t.isub(n)}while(!0);return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return(this.words[0]&1)==0},i.prototype.isOdd=function(){return(this.words[0]&1)==1},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n(typeof e==`number`);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;a!==0&&o<this.length;o++){var s=this.words[o]|0;s+=a,a=s>>>26,s&=67108863,this.words[o]=s}return a!==0&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this._strip();var r;if(this.length>1)r=1;else{t&&(e=-e),n(e<=67108863,`Number is too big`);var i=this.words[0]|0;r=i===e?0:i<e?-1:1}return this.negative===0?r:-r|0},i.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative===0?t:-t|0},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=this.words[n]|0,i=e.words[n]|0;if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return this.cmpn(e)===1},i.prototype.gt=function(e){return this.cmp(e)===1},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return this.cmpn(e)===-1},i.prototype.lt=function(e){return this.cmp(e)===-1},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return this.cmpn(e)===0},i.prototype.eq=function(e){return this.cmp(e)===0},i.red=function(e){return new D(e)},i.prototype.toRed=function(e){return n(!this.red,`Already a number in reduction context`),n(this.negative===0,`red works only with positives`),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,`fromRed works only with numbers in reduction context`),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,`Already a number in reduction context`),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,`redAdd works only with red numbers`),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,`redIAdd works only with red numbers`),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,`redSub works only with red numbers`),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,`redISub works only with red numbers`),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,`redShl works only with red numbers`),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,`redSqr works only with red numbers`),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,`redISqr works only with red numbers`),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,`redSqrt works only with red numbers`),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,`redInvm works only with red numbers`),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,`redNeg works only with red numbers`),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,`redPow(normalNum)`),this.red._verify1(this),this.red.pow(this,e)};var x={k256:null,p224:null,p192:null,p25519:null};function S(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}S.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},S.prototype.ireduce=function(e){var t=e,n;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),n=t.bitLength();while(n>this.n);var r=n<this.n?-1:t.ucmp(this.p);return r===0?(t.words[0]=0,t.length=1):r>0?t.isub(this.p):t.strip===void 0?t._strip():t.strip(),t},S.prototype.split=function(e,t){e.iushrn(this.n,0,t)},S.prototype.imulK=function(e){return e.imul(this.k)};function C(){S.call(this,`k256`,`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`)}r(C,S),C.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=e.words[i]|0;e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,a===0&&e.length>10?e.length-=10:e.length-=9},C.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=e.words[n]|0;t+=r*977,e.words[n]=t&67108863,t=r*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function w(){S.call(this,`p224`,`ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001`)}r(w,S);function T(){S.call(this,`p192`,`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff`)}r(T,S);function E(){S.call(this,`25519`,`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`)}r(E,S),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=(e.words[n]|0)*19+t,i=r&67108863;r>>>=26,e.words[n]=i,t=r}return t!==0&&(e.words[e.length++]=t),e},i._prime=function(e){if(x[e])return x[e];var t;if(e===`k256`)t=new C;else if(e===`p224`)t=new w;else if(e===`p192`)t=new T;else if(e===`p25519`)t=new E;else throw Error(`Unknown prime `+e);return x[e]=t,t};function D(e){if(typeof e==`string`){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),`modulus must be greater than 1`),this.m=e,this.prime=null}D.prototype._verify1=function(e){n(e.negative===0,`red works only with positives`),n(e.red,`red works only with red numbers`)},D.prototype._verify2=function(e,t){n((e.negative|t.negative)===0,`red works only with positives`),n(e.red&&e.red===t.red,`red works only with red numbers`)},D.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},D.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},D.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},D.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},D.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},D.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},D.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},D.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},D.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},D.prototype.isqr=function(e){return this.imul(e,e.clone())},D.prototype.sqr=function(e){return this.mul(e,e)},D.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),t===3){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&a.andln(1)===0;)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),c=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,l).cmp(c)!==0;)u.redIAdd(c);for(var d=this.pow(u,a),f=this.pow(e,a.addn(1).iushrn(1)),p=this.pow(e,a),m=o;p.cmp(s)!==0;){for(var h=p,g=0;h.cmp(s)!==0;g++)h=h.redSqr();n(g<m);var _=this.pow(d,new i(1).iushln(m-g-1));f=f.redMul(_),d=_.redSqr(),p=p.redMul(d),m=g}return f},D.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative===0?this.imod(t):(t.negative=0,this.imod(t).redNeg())},D.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var n=4,r=Array(1<<n);r[0]=new i(1).toRed(this),r[1]=e;for(var a=2;a<r.length;a++)r[a]=this.mul(r[a-1],e);var o=r[0],s=0,c=0,l=t.bitLength()%26;for(l===0&&(l=26),a=t.length-1;a>=0;a--){for(var u=t.words[a],d=l-1;d>=0;d--){var f=u>>d&1;if(o!==r[0]&&(o=this.sqr(o)),f===0&&s===0){c=0;continue}s<<=1,s|=f,c++,!(c!==n&&(a!==0||d!==0))&&(o=this.mul(o,r[s]),c=0,s=0)}l=26}return o},D.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},D.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new O(e)};function O(e){D.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}r(O,D),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(r).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}})(t===void 0||t,e)})),wt=n(((e,t)=>{var n=Ct(),r=N(),i=_().Buffer;function a(e){var t=e.modulus.byteLength(),i;do i=new n(r(t));while(i.cmp(e.modulus)>=0||!i.umod(e.prime1)||!i.umod(e.prime2));return i}function o(e){var t=a(e);return{blinder:t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}function s(e,t){var r=o(t),a=t.modulus.byteLength(),s=new n(e).mul(r.blinder).umod(t.modulus),c=s.toRed(n.mont(t.prime1)),l=s.toRed(n.mont(t.prime2)),u=t.coefficient,d=t.prime1,f=t.prime2,p=c.redPow(t.exponent1).fromRed(),m=l.redPow(t.exponent2).fromRed(),h=p.isub(m).imul(u).umod(d).imul(f);return m.iadd(h).imul(r.unblinder).umod(t.modulus).toArrayLike(i,`be`,a)}s.getr=a,t.exports=s})),Tt=n(((e,t)=>{t.exports={name:`elliptic`,version:`6.6.1`,description:`EC cryptography`,main:`lib/elliptic.js`,files:[`lib`],scripts:{lint:`eslint lib test`,"lint:fix":`npm run lint -- --fix`,unit:`istanbul test _mocha --reporter=spec test/index.js`,test:`npm run lint && npm run unit`,version:`grunt dist && git add dist/`},repository:{type:`git`,url:`git@github.com:indutny/elliptic`},keywords:[`EC`,`Elliptic`,`curve`,`Cryptography`],author:`Fedor Indutny <fedor@indutny.com>`,license:`MIT`,bugs:{url:`https://github.com/indutny/elliptic/issues`},homepage:`https://github.com/indutny/elliptic`,devDependencies:{brfs:`^2.0.2`,coveralls:`^3.1.0`,eslint:`^7.6.0`,grunt:`^1.2.1`,"grunt-browserify":`^5.3.0`,"grunt-cli":`^1.3.2`,"grunt-contrib-connect":`^3.0.0`,"grunt-contrib-copy":`^1.0.0`,"grunt-contrib-uglify":`^5.0.0`,"grunt-mocha-istanbul":`^5.0.2`,"grunt-saucelabs":`^9.0.1`,istanbul:`^0.4.5`,mocha:`^8.0.1`},dependencies:{"bn.js":`^4.11.9`,brorand:`^1.1.0`,"hash.js":`^1.0.0`,"hmac-drbg":`^1.0.1`,inherits:`^2.0.4`,"minimalistic-assert":`^1.0.1`,"minimalistic-crypto-utils":`^1.0.1`}}})),Et=n((e=>{var t=e;function n(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if(typeof e!=`string`){for(var r=0;r<e.length;r++)n[r]=e[r]|0;return n}if(t===`hex`){e=e.replace(/[^a-z0-9]+/gi,``),e.length%2!=0&&(e=`0`+e);for(var r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(var r=0;r<e.length;r++){var i=e.charCodeAt(r),a=i>>8,o=i&255;a?n.push(a,o):n.push(o)}return n}t.toArray=n;function r(e){return e.length===1?`0`+e:e}t.zero2=r;function i(e){for(var t=``,n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}t.toHex=i,t.encode=function(e,t){return t===`hex`?i(e):e}})),Dt=n((e=>{var t=e,n=et(),r=Ee(),i=Et();t.assert=r,t.toArray=i.toArray,t.zero2=i.zero2,t.toHex=i.toHex,t.encode=i.encode;function a(e,t,n){var r=Array(Math.max(e.bitLength(),n)+1),i;for(i=0;i<r.length;i+=1)r[i]=0;var a=1<<t+1,o=e.clone();for(i=0;i<r.length;i++){var s,c=o.andln(a-1);o.isOdd()?(s=c>(a>>1)-1?(a>>1)-c:c,o.isubn(s)):s=0,r[i]=s,o.iushrn(1)}return r}t.getNAF=a;function o(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r=0,i=0,a;e.cmpn(-r)>0||t.cmpn(-i)>0;){var o=e.andln(3)+r&3,s=t.andln(3)+i&3;o===3&&(o=-1),s===3&&(s=-1);var c;o&1?(a=e.andln(7)+r&7,c=(a===3||a===5)&&s===2?-o:o):c=0,n[0].push(c);var l;s&1?(a=t.andln(7)+i&7,l=(a===3||a===5)&&o===2?-s:s):l=0,n[1].push(l),2*r===c+1&&(r=1-r),2*i===l+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return n}t.getJSF=o;function s(e,t,n){var r=`_`+t;e.prototype[t]=function(){return this[r]===void 0?this[r]=n.call(this):this[r]}}t.cachedProperty=s;function c(e){return typeof e==`string`?t.toArray(e,`hex`):e}t.parseBytes=c;function l(e){return new n(e,`hex`,`le`)}t.intFromLE=l})),Ot=n(((e,t)=>{var n=et(),r=Dt(),i=r.getNAF,a=r.getJSF,o=r.assert;function s(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}t.exports=s,s.prototype.point=function(){throw Error(`Not implemented`)},s.prototype.validate=function(){throw Error(`Not implemented`)},s.prototype._fixedNafMul=function(e,t){o(e.precomputed);var n=e._getDoubles(),r=i(t,1,this._bitLength),a=(1<<n.step+1)-(n.step%2==0?2:1);a/=3;var s=[],c,l;for(c=0;c<r.length;c+=n.step){l=0;for(var u=c+n.step-1;u>=c;u--)l=(l<<1)+r[u];s.push(l)}for(var d=this.jpoint(null,null,null),f=this.jpoint(null,null,null),p=a;p>0;p--){for(c=0;c<s.length;c++)l=s[c],l===p?f=f.mixedAdd(n.points[c]):l===-p&&(f=f.mixedAdd(n.points[c].neg()));d=d.add(f)}return d.toP()},s.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var a=r.points,s=i(t,n,this._bitLength),c=this.jpoint(null,null,null),l=s.length-1;l>=0;l--){for(var u=0;l>=0&&s[l]===0;l--)u++;if(l>=0&&u++,c=c.dblp(u),l<0)break;var d=s[l];o(d!==0),c=e.type===`affine`?d>0?c.mixedAdd(a[d-1>>1]):c.mixedAdd(a[-d-1>>1].neg()):d>0?c.add(a[d-1>>1]):c.add(a[-d-1>>1].neg())}return e.type===`affine`?c.toP():c},s.prototype._wnafMulAdd=function(e,t,n,r,o){var s=this._wnafT1,c=this._wnafT2,l=this._wnafT3,u=0,d,f,p;for(d=0;d<r;d++){p=t[d];var m=p._getNAFPoints(e);s[d]=m.wnd,c[d]=m.points}for(d=r-1;d>=1;d-=2){var h=d-1,g=d;if(s[h]!==1||s[g]!==1){l[h]=i(n[h],s[h],this._bitLength),l[g]=i(n[g],s[g],this._bitLength),u=Math.max(l[h].length,u),u=Math.max(l[g].length,u);continue}var _=[t[h],null,null,t[g]];t[h].y.cmp(t[g].y)===0?(_[1]=t[h].add(t[g]),_[2]=t[h].toJ().mixedAdd(t[g].neg())):t[h].y.cmp(t[g].y.redNeg())===0?(_[1]=t[h].toJ().mixedAdd(t[g]),_[2]=t[h].add(t[g].neg())):(_[1]=t[h].toJ().mixedAdd(t[g]),_[2]=t[h].toJ().mixedAdd(t[g].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],y=a(n[h],n[g]);for(u=Math.max(y[0].length,u),l[h]=Array(u),l[g]=Array(u),f=0;f<u;f++){var b=y[0][f]|0,x=y[1][f]|0;l[h][f]=v[(b+1)*3+(x+1)],l[g][f]=0,c[h]=_}}var S=this.jpoint(null,null,null),C=this._wnafT4;for(d=u;d>=0;d--){for(var w=0;d>=0;){var T=!0;for(f=0;f<r;f++)C[f]=l[f][d]|0,C[f]!==0&&(T=!1);if(!T)break;w++,d--}if(d>=0&&w++,S=S.dblp(w),d<0)break;for(f=0;f<r;f++){var E=C[f];E!==0&&(E>0?p=c[f][E-1>>1]:E<0&&(p=c[f][-E-1>>1].neg()),S=p.type===`affine`?S.mixedAdd(p):S.add(p))}}for(d=0;d<r;d++)c[d]=null;return o?S:S.toP()};function c(e,t){this.curve=e,this.type=t,this.precomputed=null}s.BasePoint=c,c.prototype.eq=function(){throw Error(`Not implemented`)},c.prototype.validate=function(){return this.curve.validate(this)},s.prototype.decodePoint=function(e,t){e=r.toArray(e,t);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1==2*n)return e[0]===6?o(e[e.length-1]%2==0):e[0]===7&&o(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw Error(`Unknown point format`)},c.prototype.encodeCompressed=function(e){return this.encode(e,!0)},c.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray(`be`,t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray(`be`,t))},c.prototype.encode=function(e,t){return r.encode(this._encode(t),e)},c.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},c.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var a=0;a<e;a++)r=r.dbl();n.push(r)}return{step:e,points:n}},c.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=n===1?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}})),kt=n(((e,t)=>{var n=Dt(),r=et(),i=d(),a=Ot(),o=n.assert;function s(e){a.call(this,`short`,e),this.a=new r(e.a,16).toRed(this.red),this.b=new r(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}i(s,a),t.exports=s,s.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,n;if(e.beta)t=new r(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=i[0].cmp(i[1])<0?i[0]:i[1],t=t.toRed(this.red)}if(e.lambda)n=new r(e.lambda,16);else{var a=this._getEndoRoots(this.n);this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))===0?n=a[0]:(n=a[1],o(this.g.mul(n).x.cmp(this.g.x.redMul(t))===0))}var s=e.basis?e.basis.map(function(e){return{a:new r(e.a,16),b:new r(e.b,16)}}):this._getEndoBasis(n);return{beta:t,lambda:n,basis:s}}},s.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:r.mont(e),n=new r(2).toRed(t).redInvm(),i=n.redNeg(),a=new r(3).toRed(t).redNeg().redSqrt().redMul(n);return[i.redAdd(a).fromRed(),i.redSub(a).fromRed()]},s.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),a=new r(1),o=new r(0),s=new r(0),c=new r(1),l,u,d,f,p,m,h,g=0,_,v;n.cmpn(0)!==0;){var y=i.div(n);_=i.sub(y.mul(n)),v=s.sub(y.mul(a));var b=c.sub(y.mul(o));if(!d&&_.cmp(t)<0)l=h.neg(),u=a,d=_.neg(),f=v;else if(d&&++g===2)break;h=_,i=n,n=_,s=a,a=v,c=o,o=b}p=_.neg(),m=v;var x=d.sqr().add(f.sqr());return p.sqr().add(m.sqr()).cmp(x)>=0&&(p=l,m=u),d.negative&&(d=d.neg(),f=f.neg()),p.negative&&(p=p.neg(),m=m.neg()),[{a:d,b:f},{a:p,b:m}]},s.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),o=i.mul(n.a),s=a.mul(r.a),c=i.mul(n.b),l=a.mul(r.b);return{k1:e.sub(o).sub(s),k2:c.add(l).neg()}},s.prototype.pointFromX=function(e,t){e=new r(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw Error(`invalid point`);var a=i.fromRed().isOdd();return(t&&!a||!t&&a)&&(i=i.redNeg()),this.point(e,i)},s.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return n.redSqr().redISub(i).cmpn(0)===0},s.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,a=0;a<e.length;a++){var o=this._endoSplit(t[a]),s=e[a],c=s._getBeta();o.k1.negative&&(o.k1.ineg(),s=s.neg(!0)),o.k2.negative&&(o.k2.ineg(),c=c.neg(!0)),r[a*2]=s,r[a*2+1]=c,i[a*2]=o.k1,i[a*2+1]=o.k2}for(var l=this._wnafMulAdd(1,r,i,a*2,n),u=0;u<a*2;u++)r[u]=null,i[u]=null;return l};function c(e,t,n,i){a.BasePoint.call(this,e,`affine`),t===null&&n===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new r(t,16),this.y=new r(n,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}i(c,a.BasePoint),s.prototype.point=function(e,t,n){return new c(this,e,t,n)},s.prototype.pointFromJSON=function(e,t){return c.fromJSON(this,e,t)},c.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(e,t,n){typeof t==`string`&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var a=t[2];return r.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[r].concat(a.doubles.points.map(i))},naf:a.naf&&{wnd:a.naf.wnd,points:[r].concat(a.naf.points.map(i))}},r},c.prototype.inspect=function(){return this.isInfinity()?`<EC Point Infinity>`:`<EC Point x: `+this.x.fromRed().toString(16,2)+` y: `+this.y.fromRed().toString(16,2)+`>`},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},c.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),a=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(e){return e=new r(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},c.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},c.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},c.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)};function l(e,t,n,i){a.BasePoint.call(this,e,`jacobian`),t===null&&n===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new r(0)):(this.x=new r(t,16),this.y=new r(n,16),this.z=new r(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}i(l,a.BasePoint),s.prototype.jpoint=function(e,t,n){return new l(this,e,t,n)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),a=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),c=a.redSub(o);if(s.cmpn(0)===0)return c.cmpn(0)===0?this.dbl():this.curve.jpoint(null,null,null);var l=s.redSqr(),u=l.redMul(s),d=r.redMul(l),f=c.redSqr().redIAdd(u).redISub(d).redISub(d),p=c.redMul(d.redISub(f)).redISub(a.redMul(u)),m=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,p,m)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,a=e.y.redMul(t).redMul(this.z),o=n.redSub(r),s=i.redSub(a);if(o.cmpn(0)===0)return s.cmpn(0)===0?this.dbl():this.curve.jpoint(null,null,null);var c=o.redSqr(),l=c.redMul(o),u=n.redMul(c),d=s.redSqr().redIAdd(l).redISub(u).redISub(u),f=s.redMul(u.redISub(d)).redISub(i.redMul(l)),p=this.z.redMul(o);return this.curve.jpoint(d,f,p)},l.prototype.dblp=function(e){if(e===0||this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,a=this.x,o=this.y,s=this.z,c=s.redSqr().redSqr(),l=o.redAdd(o);for(t=0;t<e;t++){var u=a.redSqr(),d=l.redSqr(),f=d.redSqr(),p=u.redAdd(u).redIAdd(u).redIAdd(r.redMul(c)),m=a.redMul(d),h=p.redSqr().redISub(m.redAdd(m)),g=m.redISub(h),_=p.redMul(g);_=_.redIAdd(_).redISub(f);var v=l.redMul(s);t+1<e&&(c=c.redMul(f)),a=h,s=v,l=_}return this.curve.jpoint(a,l.redMul(i),s)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(a);o=o.redIAdd(o);var s=r.redAdd(r).redIAdd(r),c=s.redSqr().redISub(o).redISub(o),l=a.redIAdd(a);l=l.redIAdd(l),l=l.redIAdd(l),e=c,t=s.redMul(o.redISub(c)).redISub(l),n=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),p=this.x.redAdd(d).redSqr().redISub(u).redISub(f);p=p.redIAdd(p);var m=u.redAdd(u).redIAdd(u),h=m.redSqr(),g=f.redIAdd(f);g=g.redIAdd(g),g=g.redIAdd(g),e=h.redISub(p).redISub(p),t=m.redMul(p.redISub(e)).redISub(g),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,t,n)},l.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(a);o=o.redIAdd(o);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),c=s.redSqr().redISub(o).redISub(o);e=c;var l=a.redIAdd(a);l=l.redIAdd(l),l=l.redIAdd(l),t=s.redMul(o.redISub(c)).redISub(l),n=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),p=this.x.redSub(u).redMul(this.x.redAdd(u));p=p.redAdd(p).redIAdd(p);var m=f.redIAdd(f);m=m.redIAdd(m);var h=m.redAdd(m);e=p.redSqr().redISub(h),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(u);var g=d.redSqr();g=g.redIAdd(g),g=g.redIAdd(g),g=g.redIAdd(g),t=p.redMul(m.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,n)},l.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),a=t.redSqr(),o=n.redSqr(),s=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(i)),c=t.redAdd(t);c=c.redIAdd(c);var l=c.redMul(o),u=s.redSqr().redISub(l.redAdd(l)),d=l.redISub(u),f=o.redSqr();f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var p=s.redMul(d).redISub(f),m=n.redAdd(n).redMul(r);return this.curve.jpoint(u,p,m)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),a=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(r);o=o.redIAdd(o),o=o.redAdd(o).redIAdd(o),o=o.redISub(a);var s=o.redSqr(),c=r.redIAdd(r);c=c.redIAdd(c),c=c.redIAdd(c),c=c.redIAdd(c);var l=i.redIAdd(o).redSqr().redISub(a).redISub(s).redISub(c),u=t.redMul(l);u=u.redIAdd(u),u=u.redIAdd(u);var d=this.x.redMul(s).redISub(u);d=d.redIAdd(d),d=d.redIAdd(d);var f=this.y.redMul(l.redMul(c.redISub(l)).redISub(o.redMul(s)));f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var p=this.z.redAdd(o).redSqr().redISub(n).redISub(s);return this.curve.jpoint(d,f,p)},l.prototype.mul=function(e,t){return e=new r(e,t),this.curve._wnafMul(this,e)},l.prototype.eq=function(e){if(e.type===`affine`)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)===0},l.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(n)===0)return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),this.x.cmp(n)===0)return!0}},l.prototype.inspect=function(){return this.isInfinity()?`<EC JPoint Infinity>`:`<EC JPoint x: `+this.x.toString(16,2)+` y: `+this.y.toString(16,2)+` z: `+this.z.toString(16,2)+`>`},l.prototype.isInfinity=function(){return this.z.cmpn(0)===0}})),At=n(((e,t)=>{var n=et(),r=d(),i=Ot(),a=Dt();function o(e){i.call(this,`mont`,e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}r(o,i),t.exports=o,o.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return r.redSqrt().redSqr().cmp(r)===0};function s(e,t,r){i.BasePoint.call(this,e,`projective`),t===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}r(s,i.BasePoint),o.prototype.decodePoint=function(e,t){return this.point(a.toArray(e,t),1)},o.prototype.point=function(e,t){return new s(this,e,t)},o.prototype.pointFromJSON=function(e){return s.fromJSON(this,e)},s.prototype.precompute=function(){},s.prototype._encode=function(){return this.getX().toArray(`be`,this.curve.p.byteLength())},s.fromJSON=function(e,t){return new s(e,t[0],t[1]||e.one)},s.prototype.inspect=function(){return this.isInfinity()?`<EC Point Infinity>`:`<EC Point x: `+this.x.fromRed().toString(16,2)+` z: `+this.z.fromRed().toString(16,2)+`>`},s.prototype.isInfinity=function(){return this.z.cmpn(0)===0},s.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},s.prototype.add=function(){throw Error(`Not supported on Montgomery curve`)},s.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(n),o=i.redMul(r),s=t.z.redMul(a.redAdd(o).redSqr()),c=t.x.redMul(a.redISub(o).redSqr());return this.curve.point(s,c)},s.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=this,a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var o=a.length-1;o>=0;o--)a[o]===0?(n=n.diffAdd(r,i),r=r.dbl()):(r=n.diffAdd(r,i),n=n.dbl());return r},s.prototype.mulAdd=function(){throw Error(`Not supported on Montgomery curve`)},s.prototype.jumlAdd=function(){throw Error(`Not supported on Montgomery curve`)},s.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},s.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},s.prototype.getX=function(){return this.normalize(),this.x.fromRed()}})),jt=n(((e,t)=>{var n=Dt(),r=et(),i=d(),a=Ot(),o=n.assert;function s(e){this.twisted=(e.a|0)!=1,this.mOneA=this.twisted&&(e.a|0)==-1,this.extended=this.mOneA,a.call(this,`edwards`,e),this.a=new r(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new r(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new r(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),o(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(e.c|0)==1}i(s,a),t.exports=s,s.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},s.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},s.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},s.prototype.pointFromX=function(e,t){e=new r(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),a=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(a.redInvm()),s=o.redSqrt();if(s.redSqr().redSub(o).cmp(this.zero)!==0)throw Error(`invalid point`);var c=s.fromRed().isOdd();return(t&&!c||!t&&c)&&(s=s.redNeg()),this.point(e,s)},s.prototype.pointFromY=function(e,t){e=new r(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),a=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(a.redInvm());if(o.cmp(this.zero)===0){if(t)throw Error(`invalid point`);return this.point(this.zero,e)}var s=o.redSqrt();if(s.redSqr().redSub(o).cmp(this.zero)!==0)throw Error(`invalid point`);return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},s.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return r.cmp(i)===0};function c(e,t,n,i,o){a.BasePoint.call(this,e,`projective`),t===null&&n===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new r(t,16),this.y=new r(n,16),this.z=i?new r(i,16):this.curve.one,this.t=o&&new r(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}i(c,a.BasePoint),s.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},s.prototype.point=function(e,t,n,r){return new c(this,e,t,n,r)},c.fromJSON=function(e,t){return new c(e,t[0],t[1],t[2])},c.prototype.inspect=function(){return this.isInfinity()?`<EC Point Infinity>`:`<EC Point x: `+this.x.fromRed().toString(16,2)+` y: `+this.y.fromRed().toString(16,2)+` z: `+this.z.fromRed().toString(16,2)+`>`},c.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=r.redAdd(t),o=a.redSub(n),s=r.redSub(t),c=i.redMul(o),l=a.redMul(s),u=i.redMul(s),d=o.redMul(a);return this.curve.point(c,l,d,u)},c.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),n=this.y.redSqr(),r,i,a,o,s,c;if(this.curve.twisted){o=this.curve._mulA(t);var l=o.redAdd(n);this.zOne?(r=e.redSub(t).redSub(n).redMul(l.redSub(this.curve.two)),i=l.redMul(o.redSub(n)),a=l.redSqr().redSub(l).redSub(l)):(s=this.z.redSqr(),c=l.redSub(s).redISub(s),r=e.redSub(t).redISub(n).redMul(c),i=l.redMul(o.redSub(n)),a=l.redMul(c))}else o=t.redAdd(n),s=this.curve._mulC(this.z).redSqr(),c=o.redSub(s).redSub(s),r=this.curve._mulC(e.redISub(o)).redMul(c),i=this.curve._mulC(o).redMul(t.redISub(n)),a=o.redMul(c);return this.curve.point(r,i,a)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),a=n.redSub(t),o=i.redSub(r),s=i.redAdd(r),c=n.redAdd(t),l=a.redMul(o),u=s.redMul(c),d=a.redMul(c),f=o.redMul(s);return this.curve.point(l,u,f,d)},c.prototype._projAdd=function(e){var t=this.z.redMul(e.z),n=t.redSqr(),r=this.x.redMul(e.x),i=this.y.redMul(e.y),a=this.curve.d.redMul(r).redMul(i),o=n.redSub(a),s=n.redAdd(a),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(r).redISub(i),l=t.redMul(o).redMul(c),u,d;return this.curve.twisted?(u=t.redMul(s).redMul(i.redSub(this.curve._mulA(r))),d=o.redMul(s)):(u=t.redMul(s).redMul(i.redSub(r)),d=this.curve._mulC(o).redMul(s)),this.curve.point(l,u,d)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},c.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&=this.t.redMul(e),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),this.x.cmp(t)===0)return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add})),Mt=n((e=>{var t=e;t.base=Ot(),t.short=kt(),t.mont=At(),t.edwards=jt()})),Nt=n((e=>{var t=Ee();e.inherits=d();function n(e,t){return(e.charCodeAt(t)&64512)!=55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)==56320}function r(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e==`string`){if(!t)for(var i=0,a=0;a<e.length;a++){var o=e.charCodeAt(a);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=o&63|128):n(e,a)?(o=65536+((o&1023)<<10)+(e.charCodeAt(++a)&1023),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=o&63|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=o&63|128)}else if(t===`hex`)for(e=e.replace(/[^a-z0-9]+/gi,``),e.length%2!=0&&(e=`0`+e),a=0;a<e.length;a+=2)r.push(parseInt(e[a]+e[a+1],16))}else for(a=0;a<e.length;a++)r[a]=e[a]|0;return r}e.toArray=r;function i(e){for(var t=``,n=0;n<e.length;n++)t+=s(e[n].toString(16));return t}e.toHex=i;function a(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24)>>>0}e.htonl=a;function o(e,t){for(var n=``,r=0;r<e.length;r++){var i=e[r];t===`little`&&(i=a(i)),n+=c(i.toString(16))}return n}e.toHex32=o;function s(e){return e.length===1?`0`+e:e}e.zero2=s;function c(e){return e.length===7?`0`+e:e.length===6?`00`+e:e.length===5?`000`+e:e.length===4?`0000`+e:e.length===3?`00000`+e:e.length===2?`000000`+e:e.length===1?`0000000`+e:e}e.zero8=c;function l(e,n,r,i){var a=r-n;t(a%4==0);for(var o=Array(a/4),s=0,c=n;s<o.length;s++,c+=4)o[s]=(i===`big`?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c])>>>0;return o}e.join32=l;function u(e,t){for(var n=Array(e.length*4),r=0,i=0;r<e.length;r++,i+=4){var a=e[r];t===`big`?(n[i]=a>>>24,n[i+1]=a>>>16&255,n[i+2]=a>>>8&255,n[i+3]=a&255):(n[i+3]=a>>>24,n[i+2]=a>>>16&255,n[i+1]=a>>>8&255,n[i]=a&255)}return n}e.split32=u;function f(e,t){return e>>>t|e<<32-t}e.rotr32=f;function p(e,t){return e<<t|e>>>32-t}e.rotl32=p;function m(e,t){return e+t>>>0}e.sum32=m;function h(e,t,n){return e+t+n>>>0}e.sum32_3=h;function g(e,t,n,r){return e+t+n+r>>>0}e.sum32_4=g;function _(e,t,n,r,i){return e+t+n+r+i>>>0}e.sum32_5=_;function v(e,t,n,r){var i=e[t],a=r+e[t+1]>>>0;e[t]=+(a<r)+n+i>>>0,e[t+1]=a}e.sum64=v;function y(e,t,n,r){return+(t+r>>>0<t)+e+n>>>0}e.sum64_hi=y;function b(e,t,n,r){return t+r>>>0}e.sum64_lo=b;function x(e,t,n,r,i,a,o,s){var c=0,l=t;return l=l+r>>>0,c+=+(l<t),l=l+a>>>0,c+=+(l<a),l=l+s>>>0,c+=+(l<s),e+n+i+o+c>>>0}e.sum64_4_hi=x;function S(e,t,n,r,i,a,o,s){return t+r+a+s>>>0}e.sum64_4_lo=S;function C(e,t,n,r,i,a,o,s,c,l){var u=0,d=t;return d=d+r>>>0,u+=+(d<t),d=d+a>>>0,u+=+(d<a),d=d+s>>>0,u+=+(d<s),d=d+l>>>0,u+=+(d<l),e+n+i+o+c+u>>>0}e.sum64_5_hi=C;function w(e,t,n,r,i,a,o,s,c,l){return t+r+a+s+l>>>0}e.sum64_5_lo=w;function T(e,t,n){return(t<<32-n|e>>>n)>>>0}e.rotr64_hi=T;function E(e,t,n){return(e<<32-n|t>>>n)>>>0}e.rotr64_lo=E;function D(e,t,n){return e>>>n}e.shr64_hi=D;function O(e,t,n){return(e<<32-n|t>>>n)>>>0}e.shr64_lo=O})),Pt=n((e=>{var t=Nt(),n=Ee();function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian=`big`,this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=r,r.prototype.update=function(e,n){if(e=t.toArray(e,n),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=t.join32(e,0,e.length-r,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},r.prototype.digest=function(e){return this.update(this._pad()),n(this.pending===null),this._digest(e)},r.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=3,this.endian===`big`){for(var a=8;a<this.padLength;a++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=e&255}else for(r[i++]=e&255,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,a=8;a<this.padLength;a++)r[i++]=0;return r}})),Ft=n((e=>{var t=Nt().rotr32;function n(e,t,n,o){if(e===0)return r(t,n,o);if(e===1||e===3)return a(t,n,o);if(e===2)return i(t,n,o)}e.ft_1=n;function r(e,t,n){return e&t^~e&n}e.ch32=r;function i(e,t,n){return e&t^e&n^t&n}e.maj32=i;function a(e,t,n){return e^t^n}e.p32=a;function o(e){return t(e,2)^t(e,13)^t(e,22)}e.s0_256=o;function s(e){return t(e,6)^t(e,11)^t(e,25)}e.s1_256=s;function c(e){return t(e,7)^t(e,18)^e>>>3}e.g0_256=c;function l(e){return t(e,17)^t(e,19)^e>>>10}e.g1_256=l})),It=n(((e,t)=>{var n=Nt(),r=Pt(),i=Ft(),a=n.rotl32,o=n.sum32,s=n.sum32_5,c=i.ft_1,l=r.BlockHash,u=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}n.inherits(d,l),t.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=a(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],l=this.h[1],d=this.h[2],f=this.h[3],p=this.h[4];for(r=0;r<n.length;r++){var m=~~(r/20),h=s(a(i,5),c(m,l,d,f),p,n[r],u[m]);p=f,f=d,d=a(l,30),l=i,i=h}this.h[0]=o(this.h[0],i),this.h[1]=o(this.h[1],l),this.h[2]=o(this.h[2],d),this.h[3]=o(this.h[3],f),this.h[4]=o(this.h[4],p)},d.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h,`big`):n.split32(this.h,`big`)}})),Lt=n(((e,t)=>{var n=Nt(),r=Pt(),i=Ft(),a=Ee(),o=n.sum32,s=n.sum32_4,c=n.sum32_5,l=i.ch32,u=i.maj32,d=i.s0_256,f=i.s1_256,p=i.g0_256,m=i.g1_256,h=r.BlockHash,g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function _(){if(!(this instanceof _))return new _;h.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=Array(64)}n.inherits(_,h),t.exports=_,_.blockSize=512,_.outSize=256,_.hmacStrength=192,_.padLength=64,_.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=s(m(n[r-2]),n[r-7],p(n[r-15]),n[r-16]);var i=this.h[0],h=this.h[1],g=this.h[2],_=this.h[3],v=this.h[4],y=this.h[5],b=this.h[6],x=this.h[7];for(a(this.k.length===n.length),r=0;r<n.length;r++){var S=c(x,f(v),l(v,y,b),this.k[r],n[r]),C=o(d(i),u(i,h,g));x=b,b=y,y=v,v=o(_,S),_=g,g=h,h=i,i=o(S,C)}this.h[0]=o(this.h[0],i),this.h[1]=o(this.h[1],h),this.h[2]=o(this.h[2],g),this.h[3]=o(this.h[3],_),this.h[4]=o(this.h[4],v),this.h[5]=o(this.h[5],y),this.h[6]=o(this.h[6],b),this.h[7]=o(this.h[7],x)},_.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h,`big`):n.split32(this.h,`big`)}})),Rt=n(((e,t)=>{var n=Nt(),r=Lt();function i(){if(!(this instanceof i))return new i;r.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(i,r),t.exports=i,i.blockSize=512,i.outSize=224,i.hmacStrength=192,i.padLength=64,i.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h.slice(0,7),`big`):n.split32(this.h.slice(0,7),`big`)}})),zt=n(((e,t)=>{var n=Nt(),r=Pt(),i=Ee(),a=n.rotr64_hi,o=n.rotr64_lo,s=n.shr64_hi,c=n.shr64_lo,l=n.sum64,u=n.sum64_hi,d=n.sum64_lo,f=n.sum64_4_hi,p=n.sum64_4_lo,m=n.sum64_5_hi,h=n.sum64_5_lo,g=r.BlockHash,_=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=_,this.W=Array(160)}n.inherits(v,g),t.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;r<32;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=k(n[r-4],n[r-3]),a=A(n[r-4],n[r-3]),o=n[r-14],s=n[r-13],c=D(n[r-30],n[r-29]),l=O(n[r-30],n[r-29]),u=n[r-32],d=n[r-31];n[r]=f(i,a,o,s,c,l,u,d),n[r+1]=p(i,a,o,s,c,l,u,d)}},v.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,r=this.h[0],a=this.h[1],o=this.h[2],s=this.h[3],c=this.h[4],f=this.h[5],p=this.h[6],g=this.h[7],_=this.h[8],v=this.h[9],D=this.h[10],O=this.h[11],k=this.h[12],A=this.h[13],ee=this.h[14],j=this.h[15];i(this.k.length===n.length);for(var M=0;M<n.length;M+=2){var te=ee,N=j,P=T(_,v),ne=E(_,v),F=y(_,v,D,O,k,A),I=b(_,v,D,O,k,A),re=this.k[M],L=this.k[M+1],R=n[M],ie=n[M+1],z=m(te,N,P,ne,F,I,re,L,R,ie),B=h(te,N,P,ne,F,I,re,L,R,ie);te=C(r,a),N=w(r,a),P=x(r,a,o,s,c,f),ne=S(r,a,o,s,c,f);var ae=u(te,N,P,ne),V=d(te,N,P,ne);ee=k,j=A,k=D,A=O,D=_,O=v,_=u(p,g,z,B),v=d(g,g,z,B),p=c,g=f,c=o,f=s,o=r,s=a,r=u(z,B,ae,V),a=d(z,B,ae,V)}l(this.h,0,r,a),l(this.h,2,o,s),l(this.h,4,c,f),l(this.h,6,p,g),l(this.h,8,_,v),l(this.h,10,D,O),l(this.h,12,k,A),l(this.h,14,ee,j)},v.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h,`big`):n.split32(this.h,`big`)};function y(e,t,n,r,i){var a=e&n^~e&i;return a<0&&(a+=4294967296),a}function b(e,t,n,r,i,a){var o=t&r^~t&a;return o<0&&(o+=4294967296),o}function x(e,t,n,r,i){var a=e&n^e&i^n&i;return a<0&&(a+=4294967296),a}function S(e,t,n,r,i,a){var o=t&r^t&a^r&a;return o<0&&(o+=4294967296),o}function C(e,t){var n=a(e,t,28),r=a(t,e,2),i=a(t,e,7),o=n^r^i;return o<0&&(o+=4294967296),o}function w(e,t){var n=o(e,t,28),r=o(t,e,2),i=o(t,e,7),a=n^r^i;return a<0&&(a+=4294967296),a}function T(e,t){var n=a(e,t,14),r=a(e,t,18),i=a(t,e,9),o=n^r^i;return o<0&&(o+=4294967296),o}function E(e,t){var n=o(e,t,14),r=o(e,t,18),i=o(t,e,9),a=n^r^i;return a<0&&(a+=4294967296),a}function D(e,t){var n=a(e,t,1),r=a(e,t,8),i=s(e,t,7),o=n^r^i;return o<0&&(o+=4294967296),o}function O(e,t){var n=o(e,t,1),r=o(e,t,8),i=c(e,t,7),a=n^r^i;return a<0&&(a+=4294967296),a}function k(e,t){var n=a(e,t,19),r=a(t,e,29),i=s(e,t,6),o=n^r^i;return o<0&&(o+=4294967296),o}function A(e,t){var n=o(e,t,19),r=o(t,e,29),i=c(e,t,6),a=n^r^i;return a<0&&(a+=4294967296),a}})),Bt=n(((e,t)=>{var n=Nt(),r=zt();function i(){if(!(this instanceof i))return new i;r.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(i,r),t.exports=i,i.blockSize=1024,i.outSize=384,i.hmacStrength=192,i.padLength=128,i.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h.slice(0,12),`big`):n.split32(this.h.slice(0,12),`big`)}})),Vt=n((e=>{e.sha1=It(),e.sha224=Rt(),e.sha256=Lt(),e.sha384=Bt(),e.sha512=zt()})),Ht=n((e=>{var t=Nt(),n=Pt(),r=t.rotl32,i=t.sum32,a=t.sum32_3,o=t.sum32_4,s=n.BlockHash;function c(){if(!(this instanceof c))return new c;s.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian=`little`}t.inherits(c,s),e.ripemd160=c,c.blockSize=512,c.outSize=160,c.hmacStrength=192,c.padLength=64,c.prototype._update=function(e,t){for(var n=this.h[0],s=this.h[1],c=this.h[2],g=this.h[3],_=this.h[4],v=n,y=s,b=c,x=g,S=_,C=0;C<80;C++){var w=i(r(o(n,l(C,s,c,g),e[f[C]+t],u(C)),m[C]),_);n=_,_=g,g=r(c,10),c=s,s=w,w=i(r(o(v,l(79-C,y,b,x),e[p[C]+t],d(C)),h[C]),S),v=S,S=x,x=r(b,10),b=y,y=w}w=a(this.h[1],c,x),this.h[1]=a(this.h[2],g,S),this.h[2]=a(this.h[3],_,v),this.h[3]=a(this.h[4],n,y),this.h[4]=a(this.h[0],s,b),this.h[0]=w},c.prototype._digest=function(e){return e===`hex`?t.toHex32(this.h,`little`):t.split32(this.h,`little`)};function l(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function u(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function d(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],p=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],h=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]})),Ut=n(((e,t)=>{var n=Nt(),r=Ee();function i(e,t,r){if(!(this instanceof i))return new i(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}t.exports=i,i.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),r(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},i.prototype.update=function(e,t){return this.inner.update(e,t),this},i.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}})),Wt=n((e=>{var t=e;t.utils=Nt(),t.common=Pt(),t.sha=Vt(),t.ripemd=Ht(),t.hmac=Ut(),t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160})),Gt=n(((e,t)=>{t.exports={doubles:{step:4,points:[[`e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a`,`f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821`],[`8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508`,`11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf`],[`175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739`,`d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695`],[`363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640`,`4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9`],[`8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c`,`4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36`],[`723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda`,`96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f`],[`eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa`,`5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999`],[`100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0`,`cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09`],[`e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d`,`9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d`],[`feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d`,`e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088`],[`da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1`,`9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d`],[`53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0`,`5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8`],[`8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047`,`10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a`],[`385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862`,`283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453`],[`6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7`,`7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160`],[`3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd`,`56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0`],[`85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83`,`7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6`],[`948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a`,`53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589`],[`6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8`,`bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17`],[`e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d`,`4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda`],[`e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725`,`7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd`],[`213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754`,`4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2`],[`4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c`,`17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6`],[`fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6`,`6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f`],[`76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39`,`c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01`],[`c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891`,`893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3`],[`d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b`,`febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f`],[`b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03`,`2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7`],[`e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d`,`eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78`],[`a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070`,`7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1`],[`90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4`,`e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150`],[`8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da`,`662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82`],[`e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11`,`1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc`],[`8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e`,`efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b`],[`e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41`,`2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51`],[`b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef`,`67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45`],[`d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8`,`db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120`],[`324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d`,`648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84`],[`4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96`,`35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d`],[`9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd`,`ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d`],[`6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5`,`9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8`],[`a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266`,`40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8`],[`7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71`,`34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac`],[`928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac`,`c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f`],[`85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751`,`1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962`],[`ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e`,`493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907`],[`827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241`,`c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec`],[`eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3`,`be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d`],[`e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f`,`4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414`],[`1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19`,`aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd`],[`146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be`,`b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0`],[`fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9`,`6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811`],[`da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2`,`8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1`],[`a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13`,`7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c`],[`174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c`,`ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73`],[`959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba`,`2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd`],[`d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151`,`e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405`],[`64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073`,`d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589`],[`8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458`,`38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e`],[`13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b`,`69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27`],[`bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366`,`d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1`],[`8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa`,`40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482`],[`8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0`,`620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945`],[`dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787`,`7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573`],[`f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e`,`ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82`]]},naf:{wnd:7,points:[[`f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9`,`388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672`],[`2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4`,`d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6`],[`5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc`,`6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da`],[`acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe`,`cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37`],[`774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb`,`d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b`],[`f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8`,`ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81`],[`d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e`,`581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58`],[`defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34`,`4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77`],[`2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c`,`85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a`],[`352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5`,`321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c`],[`2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f`,`2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67`],[`9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714`,`73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402`],[`daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729`,`a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55`],[`c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db`,`2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482`],[`6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4`,`e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82`],[`1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5`,`b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396`],[`605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479`,`2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49`],[`62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d`,`80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf`],[`80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f`,`1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a`],[`7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb`,`d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7`],[`d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9`,`eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933`],[`49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963`,`758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a`],[`77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74`,`958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6`],[`f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530`,`e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37`],[`463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b`,`5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e`],[`f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247`,`cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6`],[`caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1`,`cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476`],[`2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120`,`4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40`],[`7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435`,`91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61`],[`754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18`,`673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683`],[`e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8`,`59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5`],[`186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb`,`3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b`],[`df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f`,`55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417`],[`5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143`,`efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868`],[`290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba`,`e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a`],[`af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45`,`f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6`],[`766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a`,`744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996`],[`59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e`,`c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e`],[`f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8`,`e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d`],[`7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c`,`30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2`],[`948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519`,`e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e`],[`7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab`,`100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437`],[`3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca`,`ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311`],[`d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf`,`8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4`],[`1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610`,`68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575`],[`733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4`,`f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d`],[`15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c`,`d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d`],[`a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940`,`edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629`],[`e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980`,`a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06`],[`311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3`,`66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374`],[`34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf`,`9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee`],[`f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63`,`4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1`],[`d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448`,`fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b`],[`32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf`,`5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661`],[`7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5`,`8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6`],[`ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6`,`8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e`],[`16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5`,`5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d`],[`eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99`,`f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc`],[`78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51`,`f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4`],[`494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5`,`42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c`],[`a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5`,`204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b`],[`c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997`,`4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913`],[`841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881`,`73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154`],[`5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5`,`39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865`],[`36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66`,`d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc`],[`336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726`,`ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224`],[`8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede`,`6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e`],[`1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94`,`60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6`],[`85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31`,`3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511`],[`29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51`,`b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b`],[`a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252`,`ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2`],[`4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5`,`cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c`],[`d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b`,`6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3`],[`ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4`,`322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d`],[`af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f`,`6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700`],[`e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889`,`2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4`],[`591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246`,`b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196`],[`11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984`,`998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4`],[`3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a`,`b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257`],[`cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030`,`bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13`],[`c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197`,`6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096`],[`c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593`,`c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38`],[`a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef`,`21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f`],[`347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38`,`60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448`],[`da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a`,`49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a`],[`c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111`,`5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4`],[`4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502`,`7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437`],[`3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea`,`be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7`],[`cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26`,`8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d`],[`b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986`,`39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a`],[`d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e`,`62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54`],[`48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4`,`25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77`],[`dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda`,`ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517`],[`6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859`,`cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10`],[`e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f`,`f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125`],[`eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c`,`6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e`],[`13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942`,`fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1`],[`ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a`,`1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2`],[`b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80`,`5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423`],[`ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d`,`438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8`],[`8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1`,`cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758`],[`52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63`,`c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375`],[`e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352`,`6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d`],[`7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193`,`ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec`],[`5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00`,`9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0`],[`32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58`,`ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c`],[`e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7`,`d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4`],[`8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8`,`c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f`],[`4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e`,`67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649`],[`3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d`,`cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826`],[`674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b`,`299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5`],[`d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f`,`f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87`],[`30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6`,`462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b`],[`be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297`,`62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc`],[`93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a`,`7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c`],[`b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c`,`ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f`],[`d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52`,`4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a`],[`d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb`,`bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46`],[`463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065`,`bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f`],[`7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917`,`603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03`],[`74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9`,`cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08`],[`30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3`,`553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8`],[`9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57`,`712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373`],[`176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66`,`ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3`],[`75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8`,`9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8`],[`809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721`,`9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1`],[`1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180`,`4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9`]]}}})),Kt=n((e=>{var t=e,n=Wt(),r=Mt(),i=Dt().assert;function a(e){e.type===`short`?this.curve=new r.short(e):e.type===`edwards`?this.curve=new r.edwards(e):this.curve=new r.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),`Invalid curve`),i(this.g.mul(this.n).isInfinity(),`Invalid curve, G*N != O`)}t.PresetCurve=a;function o(e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){var r=new a(n);return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:r}),r}})}o(`p192`,{type:`short`,prime:`p192`,p:`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff`,a:`ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc`,b:`64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1`,n:`ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831`,hash:n.sha256,gRed:!1,g:[`188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012`,`07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811`]}),o(`p224`,{type:`short`,prime:`p224`,p:`ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001`,a:`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe`,b:`b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4`,n:`ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d`,hash:n.sha256,gRed:!1,g:[`b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21`,`bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34`]}),o(`p256`,{type:`short`,prime:null,p:`ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff`,a:`ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc`,b:`5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b`,n:`ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551`,hash:n.sha256,gRed:!1,g:[`6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296`,`4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5`]}),o(`p384`,{type:`short`,prime:null,p:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff`,a:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc`,b:`b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef`,n:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973`,hash:n.sha384,gRed:!1,g:[`aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7`,`3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f`]}),o(`p521`,{type:`short`,prime:null,p:`000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff`,a:`000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc`,b:`00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00`,n:`000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409`,hash:n.sha512,gRed:!1,g:[`000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66`,`00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650`]}),o(`curve25519`,{type:`mont`,prime:`p25519`,p:`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`,a:`76d06`,b:`1`,n:`1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed`,hash:n.sha256,gRed:!1,g:[`9`]}),o(`ed25519`,{type:`edwards`,prime:`p25519`,p:`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`,a:`-1`,c:`1`,d:`52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3`,n:`1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed`,hash:n.sha256,gRed:!1,g:[`216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a`,`6666666666666666666666666666666666666666666666666666666666666658`]});var s;try{s=Gt()}catch{s=void 0}o(`secp256k1`,{type:`short`,prime:`k256`,p:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`,a:`0`,b:`7`,n:`ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141`,h:`1`,hash:n.sha256,beta:`7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee`,lambda:`5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72`,basis:[{a:`3086d221a7d46bcde86c90e49284eb15`,b:`-e4437ed6010e88286f547fa90abfe4c3`},{a:`114ca50f7a8e2f3f657c1108d9d44cfd8`,b:`3086d221a7d46bcde86c90e49284eb15`}],gRed:!1,g:[`79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798`,`483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8`,s]})})),qt=n(((e,t)=>{var n=Wt(),r=Et(),i=Ee();function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=r.toArray(e.entropy,e.entropyEnc||`hex`),n=r.toArray(e.nonce,e.nonceEnc||`hex`),o=r.toArray(e.pers,e.persEnc||`hex`);i(t.length>=this.minEntropy/8,`Not enough entropy. Minimum is: `+this.minEntropy+` bits`),this._init(t,n,o)}t.exports=a,a.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},a.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(e,t,n,a){typeof t!=`string`&&(a=n,n=t,t=null),e=r.toArray(e,t),n=r.toArray(n,a),i(e.length>=this.minEntropy/8,`Not enough entropy. Minimum is: `+this.minEntropy+` bits`),this._update(e.concat(n||[])),this._reseed=1},a.prototype.generate=function(e,t,n,i){if(this._reseed>this.reseedInterval)throw Error(`Reseed is required`);typeof t!=`string`&&(i=n,n=t,t=null),n&&(n=r.toArray(n,i||`hex`),this._update(n));for(var a=[];a.length<e;)this.V=this._hmac().update(this.V).digest(),a=a.concat(this.V);var o=a.slice(0,e);return this._update(n),this._reseed++,r.encode(o,t)}})),Jt=n(((e,t)=>{var n=et(),r=Dt().assert;function i(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}t.exports=i,i.fromPublic=function(e,t,n){return t instanceof i?t:new i(e,{pub:t,pubEnc:n})},i.fromPrivate=function(e,t,n){return t instanceof i?t:new i(e,{priv:t,privEnc:n})},i.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:`Invalid public key`}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:`Public key * N != O`}:{result:!1,reason:`Public key is not a point`}},i.prototype.getPublic=function(e,t){return typeof e==`string`&&(t=e,e=null),this.pub||=this.ec.g.mul(this.priv),t?this.pub.encode(t,e):this.pub},i.prototype.getPrivate=function(e){return e===`hex`?this.priv.toString(16,2):this.priv},i.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},i.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type===`mont`?r(e.x,`Need x coordinate`):(this.ec.curve.type===`short`||this.ec.curve.type===`edwards`)&&r(e.x&&e.y,`Need both x and y coordinate`),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},i.prototype.derive=function(e){return e.validate()||r(e.validate(),`public point not validated`),e.mul(this.priv).getX()},i.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},i.prototype.verify=function(e,t,n){return this.ec.verify(e,t,this,void 0,n)},i.prototype.inspect=function(){return`<Key priv: `+(this.priv&&this.priv.toString(16,2))+` pub: `+(this.pub&&this.pub.inspect())+` >`}})),Yt=n(((e,t)=>{var n=et(),r=Dt(),i=r.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(i(e.r&&e.s,`Signature without r or s`),this.r=new n(e.r,16),this.s=new n(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}t.exports=a;function o(){this.place=0}function s(e,t){var n=e[t.place++];if(!(n&128))return n;var r=n&15;if(r===0||r>4||e[t.place]===0)return!1;for(var i=0,a=0,o=t.place;a<r;a++,o++)i<<=8,i|=e[o],i>>>=0;return i<=127?!1:(t.place=o,i)}function c(e){for(var t=0,n=e.length-1;!e[t]&&!(e[t+1]&128)&&t<n;)t++;return t===0?e:e.slice(t)}a.prototype._importDER=function(e,t){e=r.toArray(e,t);var i=new o;if(e[i.place++]!==48)return!1;var a=s(e,i);if(a===!1||a+i.place!==e.length||e[i.place++]!==2)return!1;var c=s(e,i);if(c===!1||e[i.place]&128)return!1;var l=e.slice(i.place,c+i.place);if(i.place+=c,e[i.place++]!==2)return!1;var u=s(e,i);if(u===!1||e.length!==u+i.place||e[i.place]&128)return!1;var d=e.slice(i.place,u+i.place);if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;if(d[0]===0)if(d[1]&128)d=d.slice(1);else return!1;return this.r=new n(l),this.s=new n(d),this.recoveryParam=null,!0};function l(e,t){if(t<128){e.push(t);return}var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(n|128);--n;)e.push(t>>>(n<<3)&255);e.push(t)}a.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),n[0]&128&&(n=[0].concat(n)),t=c(t),n=c(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];l(i,t.length),i=i.concat(t),i.push(2),l(i,n.length);var a=i.concat(n),o=[48];return l(o,a.length),o=o.concat(a),r.encode(o,e)}})),Xt=n(((e,t)=>{var n=et(),r=qt(),i=Dt(),a=Kt(),o=tt(),s=i.assert,c=Jt(),l=Yt();function u(e){if(!(this instanceof u))return new u(e);typeof e==`string`&&(s(Object.prototype.hasOwnProperty.call(a,e),`Unknown curve `+e),e=a[e]),e instanceof a.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}t.exports=u,u.prototype.keyPair=function(e){return new c(this,e)},u.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},u.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},u.prototype.genKeyPair=function(e){e||={};for(var t=new r({hash:this.hash,pers:e.pers,persEnc:e.persEnc||`utf8`,entropy:e.entropy||o(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||`utf8`,nonce:this.n.toArray()}),i=this.n.byteLength(),a=this.n.sub(new n(2));;){var s=new n(t.generate(i));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},u.prototype._truncateToN=function(e,t,r){var i;if(n.isBN(e)||typeof e==`number`)e=new n(e,16),i=e.byteLength();else if(typeof e==`object`)i=e.length,e=new n(e,16);else{var a=e.toString();i=a.length+1>>>1,e=new n(a,16)}typeof r!=`number`&&(r=i*8);var o=r-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},u.prototype.sign=function(e,t,i,a){if(typeof i==`object`&&(a=i,i=null),a||={},typeof e!=`string`&&typeof e!=`number`&&!n.isBN(e)){s(typeof e==`object`&&e&&typeof e.length==`number`,`Expected message to be an array-like, a hex string, or a BN instance`),s(e.length>>>0===e.length);for(var o=0;o<e.length;o++)s((e[o]&255)===e[o])}t=this.keyFromPrivate(t,i),e=this._truncateToN(e,!1,a.msgBitLength),s(!e.isNeg(),`Can not sign a negative message`);var c=this.n.byteLength(),u=t.getPrivate().toArray(`be`,c),d=e.toArray(`be`,c);s(new n(d).eq(e),`Can not sign message`);for(var f=new r({hash:this.hash,entropy:u,nonce:d,pers:a.pers,persEnc:a.persEnc||`utf8`}),p=this.n.sub(new n(1)),m=0;;m++){var h=a.k?a.k(m):new n(f.generate(this.n.byteLength()));if(h=this._truncateToN(h,!0),!(h.cmpn(1)<=0||h.cmp(p)>=0)){var g=this.g.mul(h);if(!g.isInfinity()){var _=g.getX(),v=_.umod(this.n);if(v.cmpn(0)!==0){var y=h.invm(this.n).mul(v.mul(t.getPrivate()).iadd(e));if(y=y.umod(this.n),y.cmpn(0)!==0){var b=!!g.getY().isOdd()|(_.cmp(v)===0?0:2);return a.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),b^=1),new l({r:v,s:y,recoveryParam:b})}}}}}},u.prototype.verify=function(e,t,n,r,i){i||={},e=this._truncateToN(e,!1,i.msgBitLength),n=this.keyFromPublic(n,r),t=new l(t,`hex`);var a=t.r,o=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s=o.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(a).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(c,n.getPublic(),u),!d.isInfinity()&&d.eqXToP(a)):(d=this.g.mulAdd(c,n.getPublic(),u),!d.isInfinity()&&d.getX().umod(this.n).cmp(a)===0)},u.prototype.recoverPubKey=function(e,t,r,i){s((3&r)===r,`The recovery param is more than two bits`),t=new l(t,i);var a=this.n,o=new n(e),c=t.r,u=t.s,d=r&1,f=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw Error(`Unable to find sencond key candinate`);c=f?this.curve.pointFromX(c.add(this.curve.n),d):this.curve.pointFromX(c,d);var p=t.r.invm(a),m=a.sub(o).mul(p).umod(a),h=u.mul(p).umod(a);return this.g.mulAdd(m,c,h)},u.prototype.getKeyRecoveryParam=function(e,t,n,r){if(t=new l(t,r),t.recoveryParam!==null)return t.recoveryParam;for(var i=0;i<4;i++){var a;try{a=this.recoverPubKey(e,t,i)}catch{continue}if(a.eq(n))return i}throw Error(`Unable to find valid recovery factor`)}})),Zt=n(((e,t)=>{var n=Dt(),r=n.assert,i=n.parseBytes,a=n.cachedProperty;function o(e,t){this.eddsa=e,this._secret=i(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=i(t.pub)}o.fromPublic=function(e,t){return t instanceof o?t:new o(e,{pub:t})},o.fromSecret=function(e,t){return t instanceof o?t:new o(e,{secret:t})},o.prototype.secret=function(){return this._secret},a(o,`pubBytes`,function(){return this.eddsa.encodePoint(this.pub())}),a(o,`pub`,function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),a(o,`privBytes`,function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),a(o,`priv`,function(){return this.eddsa.decodeInt(this.privBytes())}),a(o,`hash`,function(){return this.eddsa.hash().update(this.secret()).digest()}),a(o,`messagePrefix`,function(){return this.hash().slice(this.eddsa.encodingLength)}),o.prototype.sign=function(e){return r(this._secret,`KeyPair can only verify`),this.eddsa.sign(e,this)},o.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},o.prototype.getSecret=function(e){return r(this._secret,`KeyPair is public only`),n.encode(this.secret(),e)},o.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},t.exports=o})),Qt=n(((e,t)=>{var n=et(),r=Dt(),i=r.assert,a=r.cachedProperty,o=r.parseBytes;function s(e,t){this.eddsa=e,typeof t!=`object`&&(t=o(t)),Array.isArray(t)&&(i(t.length===e.encodingLength*2,`Signature has invalid size`),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),i(t.R&&t.S,`Signature without R or S`),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}a(s,`S`,function(){return this.eddsa.decodeInt(this.Sencoded())}),a(s,`R`,function(){return this.eddsa.decodePoint(this.Rencoded())}),a(s,`Rencoded`,function(){return this.eddsa.encodePoint(this.R())}),a(s,`Sencoded`,function(){return this.eddsa.encodeInt(this.S())}),s.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},s.prototype.toHex=function(){return r.encode(this.toBytes(),`hex`).toUpperCase()},t.exports=s})),$t=n(((e,t)=>{var n=Wt(),r=Kt(),i=Dt(),a=i.assert,o=i.parseBytes,s=Zt(),c=Qt();function l(e){if(a(e===`ed25519`,`only tested with ed25519 so far`),!(this instanceof l))return new l(e);e=r[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}t.exports=l,l.prototype.sign=function(e,t){e=o(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),a=this.encodePoint(i),s=this.hashInt(a,n.pubBytes(),e).mul(n.priv()),c=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:a})},l.prototype.verify=function(e,t,n){if(e=o(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(a)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return i.intFromLE(e.digest()).umod(this.curve.n)},l.prototype.keyFromPublic=function(e){return s.fromPublic(this,e)},l.prototype.keyFromSecret=function(e){return s.fromSecret(this,e)},l.prototype.makeSignature=function(e){return e instanceof c?e:new c(this,e)},l.prototype.encodePoint=function(e){var t=e.getY().toArray(`le`,this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},l.prototype.decodePoint=function(e){e=i.parseBytes(e);var t=e.length-1,n=e.slice(0,t).concat(e[t]&-129),r=(e[t]&128)!=0,a=i.intFromLE(n);return this.curve.pointFromY(a,r)},l.prototype.encodeInt=function(e){return e.toArray(`le`,this.encodingLength)},l.prototype.decodeInt=function(e){return i.intFromLE(e)},l.prototype.isPoint=function(e){return e instanceof this.pointClass}})),en=n((e=>{var t=e;t.version=Tt().version,t.utils=Dt(),t.rand=tt(),t.curve=Mt(),t.curves=Kt(),t.ec=Xt(),t.eddsa=$t()})),tn=n((()=>{})),nn=n(((e,t)=>{(function(e,t){function n(e,t){if(!e)throw Error(t||`Assertion failed`)}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,e!==null&&((t===`le`||t===`be`)&&(n=t,t=10),this._init(e||0,t||10,n||`be`))}typeof e==`object`?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var a;try{a=typeof window<`u`&&window.Buffer!==void 0?window.Buffer:tn().Buffer}catch{}i.isBN=function(e){return e instanceof i||typeof e==`object`&&!!e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if(typeof e==`number`)return this._initNumber(e,t,r);if(typeof e==`object`)return this._initArray(e,t,r);t===`hex`&&(t=16),n(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,``);var i=0;e[0]===`-`&&(i++,this.negative=1),i<e.length&&(t===16?this._parseHex(e,i,r):(this._parseBase(e,t,i),r===`le`&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),r===`le`&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n(typeof e.length==`number`),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if(r===`be`)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);else if(r===`le`)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);return this._strip()};function o(e,t){var r=e.charCodeAt(t);if(r>=48&&r<=57)return r-48;if(r>=65&&r<=70)return r-55;if(r>=97&&r<=102)return r-87;n(!1,`Invalid character in `+e)}function s(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i=0,a=0,o;if(n===`be`)for(r=e.length-1;r>=t;r-=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)o=s(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this._strip()};function c(e,t,r,i){for(var a=0,o=0,s=Math.min(e.length,r),c=t;c<s;c++){var l=e.charCodeAt(c)-48;a*=i,o=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&o<i,`Invalid character`),a+=o}return a}i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var a=e.length-n,o=a%r,s=Math.min(a,a-o)+n,l=0,u=n;u<s;u+=r)l=c(e,u,u+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(o!==0){var d=1;for(l=c(e,u,e.length,t),u=0;u<o;u++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this._strip()},i.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red};function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.prototype._move=function(e){l(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<`u`&&typeof Symbol.for==`function`)try{i.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=u}catch{i.prototype.inspect=u}else i.prototype.inspect=u;function u(){return(this.red?`<BN-R: `:`<BN: `)+this.toString(16)+`>`}var d=`.0.00.000.0000.00000.000000.0000000.00000000.000000000.0000000000.00000000000.000000000000.0000000000000.00000000000000.000000000000000.0000000000000000.00000000000000000.000000000000000000.0000000000000000000.00000000000000000000.000000000000000000000.0000000000000000000000.00000000000000000000000.000000000000000000000000.0000000000000000000000000`.split(`.`),f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(e,t){e||=10,t=t|0||1;var r;if(e===16||e===`hex`){r=``;for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],c=((s<<i|a)&16777215).toString(16);a=s>>>24-i&16777215,i+=2,i>=26&&(i-=26,o--),r=a!==0||o!==this.length-1?d[6-c.length]+c+r:c+r}for(a!==0&&(r=a.toString(16)+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}if(e===(e|0)&&e>=2&&e<=36){var l=f[e],u=p[e];r=``;var m=this.clone();for(m.negative=0;!m.isZero();){var h=m.modrn(u).toString(e);m=m.idivn(u),r=m.isZero()?h+r:d[l-h.length]+h+r}for(this.isZero()&&(r=`0`+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}n(!1,`Base should be between 2 and 36`)},i.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,`Number can only safely store up to 53 bits`),this.negative===0?e:-e},i.prototype.toJSON=function(){return this.toString(16,2)},a&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};var m=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)};i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,`byte array longer than desired length`),n(a>0,`Requested array length <= 0`);var o=m(e,a),s=t===`le`?`LE`:`BE`;return this[`_toArrayLike`+s](o,i),o},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n++]=o&255,n<e.length&&(e[n++]=o>>8&255),n<e.length&&(e[n++]=o>>16&255),a===6?(n<e.length&&(e[n++]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,a=0;i<this.length;i++){var o=this.words[i]<<a|r;e[n--]=o&255,n>=0&&(e[n--]=o>>8&255),n>=0&&(e[n--]=o>>16&255),a===6?(n>=0&&(e[n--]=o>>24&255),r=0,a=0):(r=o>>>24,a+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,n=0;return t&8191||(n+=13,t>>>=13),t&127||(n+=7,t>>>=7),t&15||(n+=4,t>>>=4),t&3||(n+=2,t>>>=2),t&1||n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function h(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,n!==26)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return this.negative===0?this.clone():this.abs().inotn(e).iaddn(1)},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n((this.negative|e.negative)===0),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){for(var t=this.length>e.length?e:this,n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n((this.negative|e.negative)===0),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n((this.negative|e.negative)===0),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n(typeof e==`number`&&e>=0);var t=Math.ceil(e/26)|0,r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=~this.words[i]&67108863;for(r>0&&(this.words[i]=~this.words[i]&67108863>>26-r,i++);i<this.length;i++)this.words[i]=0;return this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n(typeof e==`number`&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<i:this.words[r]=this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var n,r;this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(n.words[a]|0)+(r.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;for(;i!==0&&a<n.length;a++)t=(n.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;if(this.length=n.length,i!==0)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},i.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var r,i;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)t=(r.words[o]|0)-(i.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;for(;a!==0&&o<r.length;o++)t=(r.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;if(a===0&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};function g(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=e.words[0]|0,a=t.words[0]|0,o=i*a,s=o&67108863,c=o/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var u=c>>>26,d=c&67108863,f=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=f;p++){var m=l-p|0;i=e.words[m]|0,a=t.words[p]|0,o=i*a+d,u+=o/67108864|0,d=o&67108863}n.words[l]=d|0,c=u|0}return c===0?n.length--:n.words[l]=c|0,n._strip()}var _=function(e,t,n){var r=e.words,i=t.words,a=n.words,o=0,s,c,l,u=r[0]|0,d=u&8191,f=u>>>13,p=r[1]|0,m=p&8191,h=p>>>13,g=r[2]|0,_=g&8191,v=g>>>13,y=r[3]|0,b=y&8191,x=y>>>13,S=r[4]|0,C=S&8191,w=S>>>13,T=r[5]|0,E=T&8191,D=T>>>13,O=r[6]|0,k=O&8191,A=O>>>13,ee=r[7]|0,j=ee&8191,M=ee>>>13,te=r[8]|0,N=te&8191,P=te>>>13,ne=r[9]|0,F=ne&8191,I=ne>>>13,re=i[0]|0,L=re&8191,R=re>>>13,ie=i[1]|0,z=ie&8191,B=ie>>>13,ae=i[2]|0,V=ae&8191,H=ae>>>13,oe=i[3]|0,se=oe&8191,U=oe>>>13,ce=i[4]|0,W=ce&8191,G=ce>>>13,le=i[5]|0,K=le&8191,q=le>>>13,ue=i[6]|0,J=ue&8191,de=ue>>>13,fe=i[7]|0,pe=fe&8191,me=fe>>>13,Y=i[8]|0,X=Y&8191,Z=Y>>>13,he=i[9]|0,ge=he&8191,_e=he>>>13;n.negative=e.negative^t.negative,n.length=19,s=Math.imul(d,L),c=Math.imul(d,R),c=c+Math.imul(f,L)|0,l=Math.imul(f,R);var ve=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ve>>>26)|0,ve&=67108863,s=Math.imul(m,L),c=Math.imul(m,R),c=c+Math.imul(h,L)|0,l=Math.imul(h,R),s=s+Math.imul(d,z)|0,c=c+Math.imul(d,B)|0,c=c+Math.imul(f,z)|0,l=l+Math.imul(f,B)|0;var ye=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ye>>>26)|0,ye&=67108863,s=Math.imul(_,L),c=Math.imul(_,R),c=c+Math.imul(v,L)|0,l=Math.imul(v,R),s=s+Math.imul(m,z)|0,c=c+Math.imul(m,B)|0,c=c+Math.imul(h,z)|0,l=l+Math.imul(h,B)|0,s=s+Math.imul(d,V)|0,c=c+Math.imul(d,H)|0,c=c+Math.imul(f,V)|0,l=l+Math.imul(f,H)|0;var be=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(be>>>26)|0,be&=67108863,s=Math.imul(b,L),c=Math.imul(b,R),c=c+Math.imul(x,L)|0,l=Math.imul(x,R),s=s+Math.imul(_,z)|0,c=c+Math.imul(_,B)|0,c=c+Math.imul(v,z)|0,l=l+Math.imul(v,B)|0,s=s+Math.imul(m,V)|0,c=c+Math.imul(m,H)|0,c=c+Math.imul(h,V)|0,l=l+Math.imul(h,H)|0,s=s+Math.imul(d,se)|0,c=c+Math.imul(d,U)|0,c=c+Math.imul(f,se)|0,l=l+Math.imul(f,U)|0;var xe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(xe>>>26)|0,xe&=67108863,s=Math.imul(C,L),c=Math.imul(C,R),c=c+Math.imul(w,L)|0,l=Math.imul(w,R),s=s+Math.imul(b,z)|0,c=c+Math.imul(b,B)|0,c=c+Math.imul(x,z)|0,l=l+Math.imul(x,B)|0,s=s+Math.imul(_,V)|0,c=c+Math.imul(_,H)|0,c=c+Math.imul(v,V)|0,l=l+Math.imul(v,H)|0,s=s+Math.imul(m,se)|0,c=c+Math.imul(m,U)|0,c=c+Math.imul(h,se)|0,l=l+Math.imul(h,U)|0,s=s+Math.imul(d,W)|0,c=c+Math.imul(d,G)|0,c=c+Math.imul(f,W)|0,l=l+Math.imul(f,G)|0;var Se=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Se>>>26)|0,Se&=67108863,s=Math.imul(E,L),c=Math.imul(E,R),c=c+Math.imul(D,L)|0,l=Math.imul(D,R),s=s+Math.imul(C,z)|0,c=c+Math.imul(C,B)|0,c=c+Math.imul(w,z)|0,l=l+Math.imul(w,B)|0,s=s+Math.imul(b,V)|0,c=c+Math.imul(b,H)|0,c=c+Math.imul(x,V)|0,l=l+Math.imul(x,H)|0,s=s+Math.imul(_,se)|0,c=c+Math.imul(_,U)|0,c=c+Math.imul(v,se)|0,l=l+Math.imul(v,U)|0,s=s+Math.imul(m,W)|0,c=c+Math.imul(m,G)|0,c=c+Math.imul(h,W)|0,l=l+Math.imul(h,G)|0,s=s+Math.imul(d,K)|0,c=c+Math.imul(d,q)|0,c=c+Math.imul(f,K)|0,l=l+Math.imul(f,q)|0;var Ce=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,s=Math.imul(k,L),c=Math.imul(k,R),c=c+Math.imul(A,L)|0,l=Math.imul(A,R),s=s+Math.imul(E,z)|0,c=c+Math.imul(E,B)|0,c=c+Math.imul(D,z)|0,l=l+Math.imul(D,B)|0,s=s+Math.imul(C,V)|0,c=c+Math.imul(C,H)|0,c=c+Math.imul(w,V)|0,l=l+Math.imul(w,H)|0,s=s+Math.imul(b,se)|0,c=c+Math.imul(b,U)|0,c=c+Math.imul(x,se)|0,l=l+Math.imul(x,U)|0,s=s+Math.imul(_,W)|0,c=c+Math.imul(_,G)|0,c=c+Math.imul(v,W)|0,l=l+Math.imul(v,G)|0,s=s+Math.imul(m,K)|0,c=c+Math.imul(m,q)|0,c=c+Math.imul(h,K)|0,l=l+Math.imul(h,q)|0,s=s+Math.imul(d,J)|0,c=c+Math.imul(d,de)|0,c=c+Math.imul(f,J)|0,l=l+Math.imul(f,de)|0;var we=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(we>>>26)|0,we&=67108863,s=Math.imul(j,L),c=Math.imul(j,R),c=c+Math.imul(M,L)|0,l=Math.imul(M,R),s=s+Math.imul(k,z)|0,c=c+Math.imul(k,B)|0,c=c+Math.imul(A,z)|0,l=l+Math.imul(A,B)|0,s=s+Math.imul(E,V)|0,c=c+Math.imul(E,H)|0,c=c+Math.imul(D,V)|0,l=l+Math.imul(D,H)|0,s=s+Math.imul(C,se)|0,c=c+Math.imul(C,U)|0,c=c+Math.imul(w,se)|0,l=l+Math.imul(w,U)|0,s=s+Math.imul(b,W)|0,c=c+Math.imul(b,G)|0,c=c+Math.imul(x,W)|0,l=l+Math.imul(x,G)|0,s=s+Math.imul(_,K)|0,c=c+Math.imul(_,q)|0,c=c+Math.imul(v,K)|0,l=l+Math.imul(v,q)|0,s=s+Math.imul(m,J)|0,c=c+Math.imul(m,de)|0,c=c+Math.imul(h,J)|0,l=l+Math.imul(h,de)|0,s=s+Math.imul(d,pe)|0,c=c+Math.imul(d,me)|0,c=c+Math.imul(f,pe)|0,l=l+Math.imul(f,me)|0;var Te=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,s=Math.imul(N,L),c=Math.imul(N,R),c=c+Math.imul(P,L)|0,l=Math.imul(P,R),s=s+Math.imul(j,z)|0,c=c+Math.imul(j,B)|0,c=c+Math.imul(M,z)|0,l=l+Math.imul(M,B)|0,s=s+Math.imul(k,V)|0,c=c+Math.imul(k,H)|0,c=c+Math.imul(A,V)|0,l=l+Math.imul(A,H)|0,s=s+Math.imul(E,se)|0,c=c+Math.imul(E,U)|0,c=c+Math.imul(D,se)|0,l=l+Math.imul(D,U)|0,s=s+Math.imul(C,W)|0,c=c+Math.imul(C,G)|0,c=c+Math.imul(w,W)|0,l=l+Math.imul(w,G)|0,s=s+Math.imul(b,K)|0,c=c+Math.imul(b,q)|0,c=c+Math.imul(x,K)|0,l=l+Math.imul(x,q)|0,s=s+Math.imul(_,J)|0,c=c+Math.imul(_,de)|0,c=c+Math.imul(v,J)|0,l=l+Math.imul(v,de)|0,s=s+Math.imul(m,pe)|0,c=c+Math.imul(m,me)|0,c=c+Math.imul(h,pe)|0,l=l+Math.imul(h,me)|0,s=s+Math.imul(d,X)|0,c=c+Math.imul(d,Z)|0,c=c+Math.imul(f,X)|0,l=l+Math.imul(f,Z)|0;var Ee=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,s=Math.imul(F,L),c=Math.imul(F,R),c=c+Math.imul(I,L)|0,l=Math.imul(I,R),s=s+Math.imul(N,z)|0,c=c+Math.imul(N,B)|0,c=c+Math.imul(P,z)|0,l=l+Math.imul(P,B)|0,s=s+Math.imul(j,V)|0,c=c+Math.imul(j,H)|0,c=c+Math.imul(M,V)|0,l=l+Math.imul(M,H)|0,s=s+Math.imul(k,se)|0,c=c+Math.imul(k,U)|0,c=c+Math.imul(A,se)|0,l=l+Math.imul(A,U)|0,s=s+Math.imul(E,W)|0,c=c+Math.imul(E,G)|0,c=c+Math.imul(D,W)|0,l=l+Math.imul(D,G)|0,s=s+Math.imul(C,K)|0,c=c+Math.imul(C,q)|0,c=c+Math.imul(w,K)|0,l=l+Math.imul(w,q)|0,s=s+Math.imul(b,J)|0,c=c+Math.imul(b,de)|0,c=c+Math.imul(x,J)|0,l=l+Math.imul(x,de)|0,s=s+Math.imul(_,pe)|0,c=c+Math.imul(_,me)|0,c=c+Math.imul(v,pe)|0,l=l+Math.imul(v,me)|0,s=s+Math.imul(m,X)|0,c=c+Math.imul(m,Z)|0,c=c+Math.imul(h,X)|0,l=l+Math.imul(h,Z)|0,s=s+Math.imul(d,ge)|0,c=c+Math.imul(d,_e)|0,c=c+Math.imul(f,ge)|0,l=l+Math.imul(f,_e)|0;var De=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(De>>>26)|0,De&=67108863,s=Math.imul(F,z),c=Math.imul(F,B),c=c+Math.imul(I,z)|0,l=Math.imul(I,B),s=s+Math.imul(N,V)|0,c=c+Math.imul(N,H)|0,c=c+Math.imul(P,V)|0,l=l+Math.imul(P,H)|0,s=s+Math.imul(j,se)|0,c=c+Math.imul(j,U)|0,c=c+Math.imul(M,se)|0,l=l+Math.imul(M,U)|0,s=s+Math.imul(k,W)|0,c=c+Math.imul(k,G)|0,c=c+Math.imul(A,W)|0,l=l+Math.imul(A,G)|0,s=s+Math.imul(E,K)|0,c=c+Math.imul(E,q)|0,c=c+Math.imul(D,K)|0,l=l+Math.imul(D,q)|0,s=s+Math.imul(C,J)|0,c=c+Math.imul(C,de)|0,c=c+Math.imul(w,J)|0,l=l+Math.imul(w,de)|0,s=s+Math.imul(b,pe)|0,c=c+Math.imul(b,me)|0,c=c+Math.imul(x,pe)|0,l=l+Math.imul(x,me)|0,s=s+Math.imul(_,X)|0,c=c+Math.imul(_,Z)|0,c=c+Math.imul(v,X)|0,l=l+Math.imul(v,Z)|0,s=s+Math.imul(m,ge)|0,c=c+Math.imul(m,_e)|0,c=c+Math.imul(h,ge)|0,l=l+Math.imul(h,_e)|0;var Oe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,s=Math.imul(F,V),c=Math.imul(F,H),c=c+Math.imul(I,V)|0,l=Math.imul(I,H),s=s+Math.imul(N,se)|0,c=c+Math.imul(N,U)|0,c=c+Math.imul(P,se)|0,l=l+Math.imul(P,U)|0,s=s+Math.imul(j,W)|0,c=c+Math.imul(j,G)|0,c=c+Math.imul(M,W)|0,l=l+Math.imul(M,G)|0,s=s+Math.imul(k,K)|0,c=c+Math.imul(k,q)|0,c=c+Math.imul(A,K)|0,l=l+Math.imul(A,q)|0,s=s+Math.imul(E,J)|0,c=c+Math.imul(E,de)|0,c=c+Math.imul(D,J)|0,l=l+Math.imul(D,de)|0,s=s+Math.imul(C,pe)|0,c=c+Math.imul(C,me)|0,c=c+Math.imul(w,pe)|0,l=l+Math.imul(w,me)|0,s=s+Math.imul(b,X)|0,c=c+Math.imul(b,Z)|0,c=c+Math.imul(x,X)|0,l=l+Math.imul(x,Z)|0,s=s+Math.imul(_,ge)|0,c=c+Math.imul(_,_e)|0,c=c+Math.imul(v,ge)|0,l=l+Math.imul(v,_e)|0;var ke=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ke>>>26)|0,ke&=67108863,s=Math.imul(F,se),c=Math.imul(F,U),c=c+Math.imul(I,se)|0,l=Math.imul(I,U),s=s+Math.imul(N,W)|0,c=c+Math.imul(N,G)|0,c=c+Math.imul(P,W)|0,l=l+Math.imul(P,G)|0,s=s+Math.imul(j,K)|0,c=c+Math.imul(j,q)|0,c=c+Math.imul(M,K)|0,l=l+Math.imul(M,q)|0,s=s+Math.imul(k,J)|0,c=c+Math.imul(k,de)|0,c=c+Math.imul(A,J)|0,l=l+Math.imul(A,de)|0,s=s+Math.imul(E,pe)|0,c=c+Math.imul(E,me)|0,c=c+Math.imul(D,pe)|0,l=l+Math.imul(D,me)|0,s=s+Math.imul(C,X)|0,c=c+Math.imul(C,Z)|0,c=c+Math.imul(w,X)|0,l=l+Math.imul(w,Z)|0,s=s+Math.imul(b,ge)|0,c=c+Math.imul(b,_e)|0,c=c+Math.imul(x,ge)|0,l=l+Math.imul(x,_e)|0;var Ae=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,s=Math.imul(F,W),c=Math.imul(F,G),c=c+Math.imul(I,W)|0,l=Math.imul(I,G),s=s+Math.imul(N,K)|0,c=c+Math.imul(N,q)|0,c=c+Math.imul(P,K)|0,l=l+Math.imul(P,q)|0,s=s+Math.imul(j,J)|0,c=c+Math.imul(j,de)|0,c=c+Math.imul(M,J)|0,l=l+Math.imul(M,de)|0,s=s+Math.imul(k,pe)|0,c=c+Math.imul(k,me)|0,c=c+Math.imul(A,pe)|0,l=l+Math.imul(A,me)|0,s=s+Math.imul(E,X)|0,c=c+Math.imul(E,Z)|0,c=c+Math.imul(D,X)|0,l=l+Math.imul(D,Z)|0,s=s+Math.imul(C,ge)|0,c=c+Math.imul(C,_e)|0,c=c+Math.imul(w,ge)|0,l=l+Math.imul(w,_e)|0;var je=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(je>>>26)|0,je&=67108863,s=Math.imul(F,K),c=Math.imul(F,q),c=c+Math.imul(I,K)|0,l=Math.imul(I,q),s=s+Math.imul(N,J)|0,c=c+Math.imul(N,de)|0,c=c+Math.imul(P,J)|0,l=l+Math.imul(P,de)|0,s=s+Math.imul(j,pe)|0,c=c+Math.imul(j,me)|0,c=c+Math.imul(M,pe)|0,l=l+Math.imul(M,me)|0,s=s+Math.imul(k,X)|0,c=c+Math.imul(k,Z)|0,c=c+Math.imul(A,X)|0,l=l+Math.imul(A,Z)|0,s=s+Math.imul(E,ge)|0,c=c+Math.imul(E,_e)|0,c=c+Math.imul(D,ge)|0,l=l+Math.imul(D,_e)|0;var Me=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Me>>>26)|0,Me&=67108863,s=Math.imul(F,J),c=Math.imul(F,de),c=c+Math.imul(I,J)|0,l=Math.imul(I,de),s=s+Math.imul(N,pe)|0,c=c+Math.imul(N,me)|0,c=c+Math.imul(P,pe)|0,l=l+Math.imul(P,me)|0,s=s+Math.imul(j,X)|0,c=c+Math.imul(j,Z)|0,c=c+Math.imul(M,X)|0,l=l+Math.imul(M,Z)|0,s=s+Math.imul(k,ge)|0,c=c+Math.imul(k,_e)|0,c=c+Math.imul(A,ge)|0,l=l+Math.imul(A,_e)|0;var Ne=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s=Math.imul(F,pe),c=Math.imul(F,me),c=c+Math.imul(I,pe)|0,l=Math.imul(I,me),s=s+Math.imul(N,X)|0,c=c+Math.imul(N,Z)|0,c=c+Math.imul(P,X)|0,l=l+Math.imul(P,Z)|0,s=s+Math.imul(j,ge)|0,c=c+Math.imul(j,_e)|0,c=c+Math.imul(M,ge)|0,l=l+Math.imul(M,_e)|0;var Pe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,s=Math.imul(F,X),c=Math.imul(F,Z),c=c+Math.imul(I,X)|0,l=Math.imul(I,Z),s=s+Math.imul(N,ge)|0,c=c+Math.imul(N,_e)|0,c=c+Math.imul(P,ge)|0,l=l+Math.imul(P,_e)|0;var Fe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,s=Math.imul(F,ge),c=Math.imul(F,_e),c=c+Math.imul(I,ge)|0,l=Math.imul(I,_e);var Q=(o+s|0)+((c&8191)<<13)|0;return o=(l+(c>>>13)|0)+(Q>>>26)|0,Q&=67108863,a[0]=ve,a[1]=ye,a[2]=be,a[3]=xe,a[4]=Se,a[5]=Ce,a[6]=we,a[7]=Te,a[8]=Ee,a[9]=De,a[10]=Oe,a[11]=ke,a[12]=Ae,a[13]=je,a[14]=Me,a[15]=Ne,a[16]=Pe,a[17]=Fe,a[18]=Q,o!==0&&(a[19]=o,n.length++),n};Math.imul||(_=g);function v(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,a=0;a<n.length-1;a++){var o=i;i=0;for(var s=r&67108863,c=Math.min(a,t.length-1),l=Math.max(0,a-e.length+1);l<=c;l++){var u=a-l,d=(e.words[u]|0)*(t.words[l]|0),f=d&67108863;o=o+(d/67108864|0)|0,f=f+s|0,s=f&67108863,o=o+(f>>>26)|0,i+=o>>>26,o&=67108863}n.words[a]=s,r=o,o=i}return r===0?n.length--:n.words[a]=r,n._strip()}function y(e,t,n){return v(e,t,n)}i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=this.length===10&&e.length===10?_(this,e,t):r<63?g(this,e,t):r<1024?v(this,e,t):y(this,e,t),n};function b(e,t){this.x=e,this.y=t}b.prototype.makeRBT=function(e){for(var t=Array(e),n=i.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},b.prototype.revBin=function(e,t,n){if(e===0||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(e&1)<<t-i-1,e>>=1;return r},b.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},b.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,c=Math.cos(2*Math.PI/s),l=Math.sin(2*Math.PI/s),u=0;u<i;u+=s)for(var d=c,f=l,p=0;p<o;p++){var m=n[u+p],h=r[u+p],g=n[u+p+o],_=r[u+p+o],v=d*g-f*_;_=d*_+f*g,g=v,n[u+p]=m+g,r[u+p]=h+_,n[u+p+o]=m-g,r[u+p+o]=h-_,p!==s&&(v=c*d-l*f,f=c*f+l*d,d=v)}},b.prototype.guessLen13b=function(e,t){var n=Math.max(t,e)|1,r=n&1,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},b.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},b.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=Math.round(e[2*r+1]/t)*8192+Math.round(e[2*r]/t)+n;e[r]=i&67108863,n=i<67108864?0:i/67108864|0}return e},b.prototype.convert13b=function(e,t,r,i){for(var a=0,o=0;o<t;o++)a+=e[o]|0,r[2*o]=a&8191,a>>>=13,r[2*o+1]=a&8191,a>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(a===0),n((a&-8192)==0)},b.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},b.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),c=Array(r),l=Array(r),u=Array(r),d=Array(r),f=n.words;f.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,c,r,i),this.transform(l,a,u,d,r,i);for(var p=0;p<r;p++){var m=s[p]*u[p]-c[p]*d[p];c[p]=s[p]*d[p]+c[p]*u[p],s[p]=m}return this.conjugate(s,c,r),this.transform(s,c,f,a,r,i),this.conjugate(f,a,r),this.normalize13b(f,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n._strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n(typeof e==`number`),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var a=(this.words[i]|0)*e,o=(a&67108863)+(r&67108863);r>>=26,r+=a/67108864|0,r+=o>>>26,this.words[i]=o&67108863}return r!==0&&(this.words[i]=r,this.length++),e===0&&(this.length=1,this._normSign()),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=h(e);if(t.length===0)return new i(1);for(var n=this,r=0;r<t.length&&t[r]===0;r++,n=n.sqr());if(++r<t.length)for(var a=n.sqr();r<t.length;r++,a=a.sqr())t[r]!==0&&(n=n.mul(a));return n},i.prototype.iushln=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=67108863>>>26-t<<26-t,a;if(t!==0){var o=0;for(a=0;a<this.length;a++){var s=this.words[a]&i,c=(this.words[a]|0)-s<<t;this.words[a]=c|o,o=s>>>26-t}o&&(this.words[a]=o,this.length++)}if(r!==0){for(a=this.length-1;a>=0;a--)this.words[a+r]=this.words[a];for(a=0;a<r;a++)this.words[a]=0;this.length+=r}return this._strip()},i.prototype.ishln=function(e){return n(this.negative===0),this.iushln(e)},i.prototype.iushrn=function(e,t,r){n(typeof e==`number`&&e>=0);var i=t?(t-t%26)/26:0,a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,c=r;if(i-=o,i=Math.max(0,i),c){for(var l=0;l<o;l++)c.words[l]=this.words[l];c.length=o}if(o!==0)if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var u=0;for(l=this.length-1;l>=0&&(u!==0||l>=i);l--){var d=this.words[l]|0;this.words[l]=u<<26-a|d>>>a,u=d&s}return c&&u!==0&&(c.words[c.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(this.negative===0),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return this.length<=r?!1:!!(this.words[r]&i)},i.prototype.imaskn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26;if(n(this.negative===0,`imaskn works only with positive numbers`),this.length<=r)return this;if(t!==0&&r++,this.length=Math.min(r,this.length),t!==0){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n(typeof e==`number`),n(e<67108864),e<0?this.isubn(-e):this.negative===0?this._iaddn(e):this.length===1&&(this.words[0]|0)<=e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n(typeof e==`number`),n(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,--this.words[t+1];return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i=e.length+r,a;this._expand(i);var o,s=0;for(a=0;a<e.length;a++){o=(this.words[a+r]|0)+s;var c=(e.words[a]|0)*t;o-=c&67108863,s=(o>>26)-(c/67108864|0),this.words[a+r]=o&67108863}for(;a<this.length-r;a++)o=(this.words[a+r]|0)+s,s=o>>26,this.words[a+r]=o&67108863;if(s===0)return this._strip();for(n(s===-1),s=0,a=0;a<this.length;a++)o=-(this.words[a]|0)+s,s=o>>26,this.words[a]=o&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=this.length-e.length,r=this.clone(),a=e,o=a.words[a.length-1]|0;n=26-this._countBits(o),n!==0&&(a=a.ushln(n),r.iushln(n),o=a.words[a.length-1]|0);var s=r.length-a.length,c;if(t!==`mod`){c=new i(null),c.length=s+1,c.words=Array(c.length);for(var l=0;l<c.length;l++)c.words[l]=0}var u=r.clone()._ishlnsubmul(a,1,s);u.negative===0&&(r=u,c&&(c.words[s]=1));for(var d=s-1;d>=0;d--){var f=(r.words[a.length+d]|0)*67108864+(r.words[a.length+d-1]|0);for(f=Math.min(f/o|0,67108863),r._ishlnsubmul(a,f,d);r.negative!==0;)f--,r.negative=0,r._ishlnsubmul(a,1,d),r.isZero()||(r.negative^=1);c&&(c.words[d]=f)}return c&&c._strip(),r._strip(),t!==`div`&&n!==0&&r.iushrn(n),{div:c||null,mod:r}},i.prototype.divmod=function(e,t,r){if(n(!e.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var a,o,s;return this.negative!==0&&e.negative===0?(s=this.neg().divmod(e,t),t!==`mod`&&(a=s.div.neg()),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.iadd(e)),{div:a,mod:o}):this.negative===0&&e.negative!==0?(s=this.divmod(e.neg(),t),t!==`mod`&&(a=s.div.neg()),{div:a,mod:s.mod}):(this.negative&e.negative)===0?e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:e.length===1?t===`div`?{div:this.divn(e.words[0]),mod:null}:t===`mod`?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.isub(e)),{div:s.div,mod:o})},i.prototype.div=function(e){return this.divmod(e,`div`,!1).div},i.prototype.mod=function(e){return this.divmod(e,`mod`,!1).mod},i.prototype.umod=function(e){return this.divmod(e,`mod`,!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=t.mod.abs(),r=e.abs().iushrn(1),a=e.words[0]&1,o=n.cmp(r);if(o<0||a===1&&o===0)return t.div;var s=new i(1);return s.negative=this.negative^e.negative,t.div.iadd(s)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(r*i+(this.words[a]|0))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var a=(this.words[i]|0)+r*67108864;this.words[i]=a/e|0,r=a%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=new i(0),c=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var u=r.clone(),d=t.clone();!t.isZero();){for(var f=0,p=1;(t.words[0]&p)===0&&f<26;++f,p<<=1);if(f>0)for(t.iushrn(f);f-->0;)(a.isOdd()||o.isOdd())&&(a.iadd(u),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var m=0,h=1;(r.words[0]&h)===0&&m<26;++m,h<<=1);if(m>0)for(r.iushrn(m);m-->0;)(s.isOdd()||c.isOdd())&&(s.iadd(u),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s),o.isub(c)):(r.isub(t),s.isub(a),c.isub(o))}return{a:s,b:c,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;(t.words[0]&l)===0&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-->0;)a.isOdd()&&a.iadd(s),a.iushrn(1);for(var u=0,d=1;(r.words[0]&d)===0&&u<26;++u,d<<=1);if(u>0)for(r.iushrn(u);u-->0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o)):(r.isub(t),o.isub(a))}var f=t.cmpn(1)===0?a:o;return f.cmpn(0)<0&&f.iadd(e),f},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var a=t;t=n,n=a}else if(i===0||n.cmpn(1)===0)break;t.isub(n)}while(!0);return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return(this.words[0]&1)==0},i.prototype.isOdd=function(){return(this.words[0]&1)==1},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n(typeof e==`number`);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;a!==0&&o<this.length;o++){var s=this.words[o]|0;s+=a,a=s>>>26,s&=67108863,this.words[o]=s}return a!==0&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this._strip();var r;if(this.length>1)r=1;else{t&&(e=-e),n(e<=67108863,`Number is too big`);var i=this.words[0]|0;r=i===e?0:i<e?-1:1}return this.negative===0?r:-r|0},i.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative===0?t:-t|0},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=this.words[n]|0,i=e.words[n]|0;if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return this.cmpn(e)===1},i.prototype.gt=function(e){return this.cmp(e)===1},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return this.cmpn(e)===-1},i.prototype.lt=function(e){return this.cmp(e)===-1},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return this.cmpn(e)===0},i.prototype.eq=function(e){return this.cmp(e)===0},i.red=function(e){return new D(e)},i.prototype.toRed=function(e){return n(!this.red,`Already a number in reduction context`),n(this.negative===0,`red works only with positives`),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,`fromRed works only with numbers in reduction context`),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,`Already a number in reduction context`),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,`redAdd works only with red numbers`),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,`redIAdd works only with red numbers`),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,`redSub works only with red numbers`),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,`redISub works only with red numbers`),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,`redShl works only with red numbers`),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,`redSqr works only with red numbers`),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,`redISqr works only with red numbers`),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,`redSqrt works only with red numbers`),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,`redInvm works only with red numbers`),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,`redNeg works only with red numbers`),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,`redPow(normalNum)`),this.red._verify1(this),this.red.pow(this,e)};var x={k256:null,p224:null,p192:null,p25519:null};function S(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}S.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},S.prototype.ireduce=function(e){var t=e,n;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),n=t.bitLength();while(n>this.n);var r=n<this.n?-1:t.ucmp(this.p);return r===0?(t.words[0]=0,t.length=1):r>0?t.isub(this.p):t.strip===void 0?t._strip():t.strip(),t},S.prototype.split=function(e,t){e.iushrn(this.n,0,t)},S.prototype.imulK=function(e){return e.imul(this.k)};function C(){S.call(this,`k256`,`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`)}r(C,S),C.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=e.words[i]|0;e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,a===0&&e.length>10?e.length-=10:e.length-=9},C.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=e.words[n]|0;t+=r*977,e.words[n]=t&67108863,t=r*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function w(){S.call(this,`p224`,`ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001`)}r(w,S);function T(){S.call(this,`p192`,`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff`)}r(T,S);function E(){S.call(this,`25519`,`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`)}r(E,S),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=(e.words[n]|0)*19+t,i=r&67108863;r>>>=26,e.words[n]=i,t=r}return t!==0&&(e.words[e.length++]=t),e},i._prime=function(e){if(x[e])return x[e];var t;if(e===`k256`)t=new C;else if(e===`p224`)t=new w;else if(e===`p192`)t=new T;else if(e===`p25519`)t=new E;else throw Error(`Unknown prime `+e);return x[e]=t,t};function D(e){if(typeof e==`string`){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),`modulus must be greater than 1`),this.m=e,this.prime=null}D.prototype._verify1=function(e){n(e.negative===0,`red works only with positives`),n(e.red,`red works only with red numbers`)},D.prototype._verify2=function(e,t){n((e.negative|t.negative)===0,`red works only with positives`),n(e.red&&e.red===t.red,`red works only with red numbers`)},D.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},D.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},D.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},D.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},D.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},D.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},D.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},D.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},D.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},D.prototype.isqr=function(e){return this.imul(e,e.clone())},D.prototype.sqr=function(e){return this.mul(e,e)},D.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),t===3){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&a.andln(1)===0;)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),c=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,l).cmp(c)!==0;)u.redIAdd(c);for(var d=this.pow(u,a),f=this.pow(e,a.addn(1).iushrn(1)),p=this.pow(e,a),m=o;p.cmp(s)!==0;){for(var h=p,g=0;h.cmp(s)!==0;g++)h=h.redSqr();n(g<m);var _=this.pow(d,new i(1).iushln(m-g-1));f=f.redMul(_),d=_.redSqr(),p=p.redMul(d),m=g}return f},D.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative===0?this.imod(t):(t.negative=0,this.imod(t).redNeg())},D.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var n=4,r=Array(1<<n);r[0]=new i(1).toRed(this),r[1]=e;for(var a=2;a<r.length;a++)r[a]=this.mul(r[a-1],e);var o=r[0],s=0,c=0,l=t.bitLength()%26;for(l===0&&(l=26),a=t.length-1;a>=0;a--){for(var u=t.words[a],d=l-1;d>=0;d--){var f=u>>d&1;if(o!==r[0]&&(o=this.sqr(o)),f===0&&s===0){c=0;continue}s<<=1,s|=f,c++,!(c!==n&&(a!==0||d!==0))&&(o=this.mul(o,r[s]),c=0,s=0)}l=26}return o},D.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},D.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new O(e)};function O(e){D.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}r(O,D),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(r).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}})(t===void 0||t,e)})),rn=n((e=>{var n=_n(),r=d(),i=e;i.define=function(e,t){return new a(e,t)};function a(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}a.prototype._createNamed=function(e){var n;try{n=t(`vm`).runInThisContext(`(function `+this.name+`(entity) {
|
|
5
5
|
this._initNamed(entity);
|
|
6
|
-
})`)}catch{n=function(e){this._initNamed(e)}}return r(n,e),n.prototype._initNamed=function(t){e.call(this,t)},new n(this)},a.prototype._getDecoder=function(e){return e||=`der`,this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n.decoders[e])),this.decoders[e]},a.prototype.decode=function(e,t,n){return this._getDecoder(t).decode(e,n)},a.prototype._getEncoder=function(e){return e||=`der`,this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(n.encoders[e])),this.encoders[e]},a.prototype.encode=function(e,t,n){return this._getEncoder(t).encode(e,n)}})),an=n((e=>{var t=p();function n(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}e.Reporter=n,n.prototype.isError=function(e){return e instanceof r},n.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},n.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},n.prototype.enterKey=function(e){return this._reporterState.path.push(e)},n.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},n.prototype.leaveKey=function(e,t,n){var r=this._reporterState;this.exitKey(e),r.obj!==null&&(r.obj[t]=n)},n.prototype.path=function(){return this._reporterState.path.join(`/`)},n.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},n.prototype.leaveObject=function(e){var t=this._reporterState,n=t.obj;return t.obj=e,n},n.prototype.error=function(e){var t,n=this._reporterState,i=e instanceof r;if(t=i?e:new r(n.path.map(function(e){return`[`+JSON.stringify(e)+`]`}).join(``),e.message||e,e.stack),!n.options.partial)throw t;return i||n.errors.push(t),t},n.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e};function r(e,t){this.path=e,this.rethrow(t)}t(r,Error),r.prototype.rethrow=function(e){if(this.message=e+` at: `+(this.path||`(shallow)`),Error.captureStackTrace&&Error.captureStackTrace(this,r),!this.stack)try{throw Error(this.message)}catch(e){this.stack=e.stack}return this}})),on=n((e=>{var t=p(),n=cn().Reporter,r=l().Buffer;function i(e,t){if(n.call(this,t),!r.isBuffer(e)){this.error(`Input not Buffer`);return}this.base=e,this.offset=0,this.length=e.length}t(i,n),e.DecoderBuffer=i,i.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},i.prototype.restore=function(e){var t=new i(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,n.prototype.restore.call(this,e.reporter),t},i.prototype.isEmpty=function(){return this.offset===this.length},i.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||`DecoderBuffer overrun`)},i.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||`DecoderBuffer overrun`);var n=new i(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},i.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)};function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof a||(e=new a(e,t)),this.length+=e.length,e},this);else if(typeof e==`number`){if(!(0<=e&&e<=255))return t.error(`non-byte EncoderBuffer value`);this.value=e,this.length=1}else if(typeof e==`string`)this.value=e,this.length=r.byteLength(e);else if(r.isBuffer(e))this.value=e,this.length=e.length;else return t.error(`Unsupported type: `+typeof e)}e.EncoderBuffer=a,a.prototype.join=function(e,t){return e||=new r(this.length),t||=0,this.length===0||(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,t),t+=n.length}):(typeof this.value==`number`?e[t]=this.value:typeof this.value==`string`?e.write(this.value,t):r.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}})),sn=n(((e,t)=>{var n=cn().Reporter,r=cn().EncoderBuffer,i=cn().DecoderBuffer,a=Ee(),o=`seq.seqof.set.setof.objid.bool.gentime.utctime.null_.enum.int.objDesc.bitstr.bmpstr.charstr.genstr.graphstr.ia5str.iso646str.numstr.octstr.printstr.t61str.unistr.utf8str.videostr`.split(`.`),s=[`key`,`obj`,`use`,`optional`,`explicit`,`implicit`,`def`,`choice`,`any`,`contains`].concat(o),c=[`_peekTag`,`_decodeTag`,`_use`,`_decodeStr`,`_decodeObjid`,`_decodeTime`,`_decodeNull`,`_decodeInt`,`_decodeBool`,`_decodeList`,`_encodeComposite`,`_encodeStr`,`_encodeObjid`,`_encodeTime`,`_encodeNull`,`_encodeInt`,`_encodeBool`];function l(e,t){var n={};this._baseState=n,n.enc=e,n.parent=t||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}t.exports=l;var u=[`enc`,`parent`,`children`,`tag`,`args`,`reverseArgs`,`choice`,`optional`,`any`,`obj`,`use`,`alteredUse`,`key`,`default`,`explicit`,`implicit`,`contains`];l.prototype.clone=function(){var e=this._baseState,t={};u.forEach(function(n){t[n]=e[n]});var n=new this.constructor(t.parent);return n._baseState=t,n},l.prototype._wrap=function(){var e=this._baseState;s.forEach(function(t){this[t]=function(){var n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}},this)},l.prototype._init=function(e){var t=this._baseState;a(t.parent===null),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),a.equal(t.children.length,1,`Root node can have only one child`)},l.prototype._useArgs=function(e){var t=this._baseState,n=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),n.length!==0&&(a(t.children===null),t.children=n,n.forEach(function(e){e._baseState.parent=this},this)),e.length!==0&&(a(t.args===null),t.args=e,t.reverseArgs=e.map(function(e){if(typeof e!=`object`||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(n){n==(n|0)&&(n|=0);var r=e[n];t[r]=n}),t}))},c.forEach(function(e){l.prototype[e]=function(){var t=this._baseState;throw Error(e+` not implemented for encoding: `+t.enc)}}),o.forEach(function(e){l.prototype[e]=function(){var t=this._baseState,n=Array.prototype.slice.call(arguments);return a(t.tag===null),t.tag=e,this._useArgs(n),this}}),l.prototype.use=function(e){a(e);var t=this._baseState;return a(t.use===null),t.use=e,this},l.prototype.optional=function(){var e=this._baseState;return e.optional=!0,this},l.prototype.def=function(e){var t=this._baseState;return a(t.default===null),t.default=e,t.optional=!0,this},l.prototype.explicit=function(e){var t=this._baseState;return a(t.explicit===null&&t.implicit===null),t.explicit=e,this},l.prototype.implicit=function(e){var t=this._baseState;return a(t.explicit===null&&t.implicit===null),t.implicit=e,this},l.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,t.length!==0&&this._useArgs(t),this},l.prototype.key=function(e){var t=this._baseState;return a(t.key===null),t.key=e,this},l.prototype.any=function(){var e=this._baseState;return e.any=!0,this},l.prototype.choice=function(e){var t=this._baseState;return a(t.choice===null),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},l.prototype.contains=function(e){var t=this._baseState;return a(t.use===null),t.contains=e,this},l.prototype._decode=function(e,t){var n=this._baseState;if(n.parent===null)return e.wrapResult(n.children[0]._decode(e,t));var r=n.default,a=!0,o=null;if(n.key!==null&&(o=e.enterKey(n.key)),n.optional){var s=null;if(n.explicit===null?n.implicit===null?n.tag!==null&&(s=n.tag):s=n.implicit:s=n.explicit,s===null&&!n.any){var c=e.save();try{n.choice===null?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),a=!0}catch{a=!1}e.restore(c)}else if(a=this._peekTag(e,s,n.any),e.isError(a))return a}var l;if(n.obj&&a&&(l=e.enterObject()),a){if(n.explicit!==null){var u=this._decodeTag(e,n.explicit);if(e.isError(u))return u;e=u}var d=e.offset;if(n.use===null&&n.choice===null){if(n.any)var c=e.save();var f=this._decodeTag(e,n.implicit===null?n.tag:n.implicit,n.any);if(e.isError(f))return f;n.any?r=e.raw(c):e=f}if(t&&t.track&&n.tag!==null&&t.track(e.path(),d,e.length,`tagged`),t&&t.track&&n.tag!==null&&t.track(e.path(),e.offset,e.length,`content`),r=n.any?r:n.choice===null?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),e.isError(r))return r;if(!n.any&&n.choice===null&&n.children!==null&&n.children.forEach(function(n){n._decode(e,t)}),n.contains&&(n.tag===`octstr`||n.tag===`bitstr`)){var p=new i(r);r=this._getUse(n.contains,e._reporterState.obj)._decode(p,t)}}return n.obj&&a&&(r=e.leaveObject(l)),n.key!==null&&(r!==null||a===!0)?e.leaveKey(o,n.key,r):o!==null&&e.exitKey(o),r},l.prototype._decodeGeneric=function(e,t,n){var r=this._baseState;return e===`seq`||e===`set`?null:e===`seqof`||e===`setof`?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):e===`objid`&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):e===`objid`?this._decodeObjid(t,null,null,n):e===`gentime`||e===`utctime`?this._decodeTime(t,e,n):e===`null_`?this._decodeNull(t,n):e===`bool`?this._decodeBool(t,n):e===`objDesc`?this._decodeStr(t,e,n):e===`int`||e===`enum`?this._decodeInt(t,r.args&&r.args[0],n):r.use===null?t.error(`unknown tag: `+e):this._getUse(r.use,t._reporterState.obj)._decode(t,n)},l.prototype._getUse=function(e,t){var n=this._baseState;return n.useDecoder=this._use(e,t),a(n.useDecoder._baseState.parent===null),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},l.prototype._decodeChoice=function(e,t){var n=this._baseState,r=null,i=!1;return Object.keys(n.choice).some(function(a){var o=e.save(),s=n.choice[a];try{var c=s._decode(e,t);if(e.isError(c))return!1;r={type:a,value:c},i=!0}catch{return e.restore(o),!1}return!0},this),i?r:e.error(`Choice not matched`)},l.prototype._createEncoderBuffer=function(e){return new r(e,this.reporter)},l.prototype._encode=function(e,t,n){var r=this._baseState;if(!(r.default!==null&&r.default===e)){var i=this._encodeValue(e,t,n);if(i!==void 0&&!this._skipDefault(i,t,n))return i}},l.prototype._encodeValue=function(e,t,r){var i=this._baseState;if(i.parent===null)return i.children[0]._encode(e,t||new n);var a=null;if(this.reporter=t,i.optional&&e===void 0)if(i.default!==null)e=i.default;else return;var o=null,s=!1;if(i.any)a=this._createEncoderBuffer(e);else if(i.choice)a=this._encodeChoice(e,t);else if(i.contains)o=this._getUse(i.contains,r)._encode(e,t),s=!0;else if(i.children)o=i.children.map(function(n){if(n._baseState.tag===`null_`)return n._encode(null,t,e);if(n._baseState.key===null)return t.error(`Child should have a key`);var r=t.enterKey(n._baseState.key);if(typeof e!=`object`)return t.error(`Child expected, but input is not object`);var i=n._encode(e[n._baseState.key],t,e);return t.leaveKey(r),i},this).filter(function(e){return e}),o=this._createEncoderBuffer(o);else if(i.tag===`seqof`||i.tag===`setof`){if(!(i.args&&i.args.length===1))return t.error(`Too many args for : `+i.tag);if(!Array.isArray(e))return t.error(`seqof/setof, but data is not Array`);var c=this.clone();c._baseState.implicit=null,o=this._createEncoderBuffer(e.map(function(n){var r=this._baseState;return this._getUse(r.args[0],e)._encode(n,t)},c))}else i.use===null?(o=this._encodePrimitive(i.tag,e),s=!0):a=this._getUse(i.use,r)._encode(e,t);var a;if(!i.any&&i.choice===null){var l=i.implicit===null?i.tag:i.implicit,u=i.implicit===null?`universal`:`context`;l===null?i.use===null&&t.error(`Tag could be omitted only for .use()`):i.use===null&&(a=this._encodeComposite(l,s,u,o))}return i.explicit!==null&&(a=this._encodeComposite(i.explicit,!1,`context`,a)),a},l.prototype._encodeChoice=function(e,t){var n=this._baseState,r=n.choice[e.type];return r||a(!1,e.type+` not found in `+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},l.prototype._encodePrimitive=function(e,t){var n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if(e===`objid`&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if(e===`objid`)return this._encodeObjid(t,null,null);if(e===`gentime`||e===`utctime`)return this._encodeTime(t,e);if(e===`null_`)return this._encodeNull();if(e===`int`||e===`enum`)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if(e===`bool`)return this._encodeBool(t);if(e===`objDesc`)return this._encodeStr(t,e);throw Error(`Unsupported tag: `+e)},l.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},l.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}})),cn=n((e=>{var t=e;t.Reporter=an().Reporter,t.DecoderBuffer=on().DecoderBuffer,t.EncoderBuffer=on().EncoderBuffer,t.Node=sn()})),ln=n((e=>{var t=un();e.tagClass={0:`universal`,1:`application`,2:`context`,3:`private`},e.tagClassByName=t._reverse(e.tagClass),e.tag={0:`end`,1:`bool`,2:`int`,3:`bitstr`,4:`octstr`,5:`null_`,6:`objid`,7:`objDesc`,8:`external`,9:`real`,10:`enum`,11:`embed`,12:`utf8str`,13:`relativeOid`,16:`seq`,17:`set`,18:`numstr`,19:`printstr`,20:`t61str`,21:`videostr`,22:`ia5str`,23:`utctime`,24:`gentime`,25:`graphstr`,26:`iso646str`,27:`genstr`,28:`unistr`,29:`charstr`,30:`bmpstr`},e.tagByName=t._reverse(e.tag)})),un=n((e=>{var t=e;t._reverse=function(e){var t={};return Object.keys(e).forEach(function(n){(n|0)==n&&(n|=0);var r=e[n];t[r]=n}),t},t.der=ln()})),dn=n(((e,t)=>{var n=p(),r=_n(),i=r.base,a=r.bignum,o=r.constants.der;function s(e){this.enc=`der`,this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}t.exports=s,s.prototype.decode=function(e,t){return e instanceof i.DecoderBuffer||(e=new i.DecoderBuffer(e,t)),this.tree._decode(e,t)};function c(e){i.Node.call(this,`der`,e)}n(c,i.Node),c.prototype._peekTag=function(e,t,n){if(e.isEmpty())return!1;var r=e.save(),i=l(e,`Failed to peek tag: "`+t+`"`);return e.isError(i)?i:(e.restore(r),i.tag===t||i.tagStr===t||i.tagStr+`of`===t||n)},c.prototype._decodeTag=function(e,t,n){var r=l(e,`Failed to decode tag of "`+t+`"`);if(e.isError(r))return r;var i=u(e,r.primitive,`Failed to get length of "`+t+`"`);if(e.isError(i))return i;if(!n&&r.tag!==t&&r.tagStr!==t&&r.tagStr+`of`!==t)return e.error(`Failed to match tag: "`+t+`"`);if(r.primitive||i!==null)return e.skip(i,`Failed to match body of: "`+t+`"`);var a=e.save(),o=this._skipUntilEnd(e,`Failed to skip indefinite length body: "`+this.tag+`"`);return e.isError(o)?o:(i=e.offset-a.offset,e.restore(a),e.skip(i,`Failed to match body of: "`+t+`"`))},c.prototype._skipUntilEnd=function(e,t){for(;;){var n=l(e,t);if(e.isError(n))return n;var r=u(e,n.primitive,t);if(e.isError(r))return r;var i=n.primitive||r!==null?e.skip(r):this._skipUntilEnd(e,t);if(e.isError(i))return i;if(n.tagStr===`end`)break}},c.prototype._decodeList=function(e,t,n,r){for(var i=[];!e.isEmpty();){var a=this._peekTag(e,`end`);if(e.isError(a))return a;var o=n.decode(e,`der`,r);if(e.isError(o)&&a)break;i.push(o)}return i},c.prototype._decodeStr=function(e,t){if(t===`bitstr`){var n=e.readUInt8();return e.isError(n)?n:{unused:n,data:e.raw()}}else if(t===`bmpstr`){var r=e.raw();if(r.length%2==1)return e.error(`Decoding of string type: bmpstr length mismatch`);for(var i=``,a=0;a<r.length/2;a++)i+=String.fromCharCode(r.readUInt16BE(a*2));return i}else if(t===`numstr`){var o=e.raw().toString(`ascii`);return this._isNumstr(o)?o:e.error(`Decoding of string type: numstr unsupported characters`)}else if(t===`octstr`)return e.raw();else if(t===`objDesc`)return e.raw();else if(t===`printstr`){var s=e.raw().toString(`ascii`);return this._isPrintstr(s)?s:e.error(`Decoding of string type: printstr unsupported characters`)}else if(/str$/.test(t))return e.raw().toString();else return e.error(`Decoding of string type: `+t+` unsupported`)},c.prototype._decodeObjid=function(e,t,n){for(var r,i=[],a=0;!e.isEmpty();){var o=e.readUInt8();a<<=7,a|=o&127,o&128||(i.push(a),a=0)}o&128&&i.push(a);var s=i[0]/40|0,c=i[0]%40;if(r=n?i:[s,c].concat(i.slice(1)),t){var l=t[r.join(` `)];l===void 0&&(l=t[r.join(`.`)]),l!==void 0&&(r=l)}return r},c.prototype._decodeTime=function(e,t){var n=e.raw().toString();if(t===`gentime`)var r=n.slice(0,4)|0,i=n.slice(4,6)|0,a=n.slice(6,8)|0,o=n.slice(8,10)|0,s=n.slice(10,12)|0,c=n.slice(12,14)|0;else if(t===`utctime`){var r=n.slice(0,2)|0,i=n.slice(2,4)|0,a=n.slice(4,6)|0,o=n.slice(6,8)|0,s=n.slice(8,10)|0,c=n.slice(10,12)|0;r=r<70?2e3+r:1900+r}else return e.error(`Decoding `+t+` time is not supported yet`);return Date.UTC(r,i-1,a,o,s,c,0)},c.prototype._decodeNull=function(e){return null},c.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:t!==0},c.prototype._decodeInt=function(e,t){var n=new a(e.raw());return t&&(n=t[n.toString(10)]||n),n},c.prototype._use=function(e,t){return typeof e==`function`&&(e=e(t)),e._getDecoder(`der`).tree};function l(e,t){var n=e.readUInt8(t);if(e.isError(n))return n;var r=o.tagClass[n>>6],i=(n&32)==0;if((n&31)==31){var a=n;for(n=0;(a&128)==128;){if(a=e.readUInt8(t),e.isError(a))return a;n<<=7,n|=a&127}}else n&=31;var s=o.tag[n];return{cls:r,primitive:i,tag:n,tagStr:s}}function u(e,t,n){var r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&r===128)return null;if(!(r&128))return r;var i=r&127;if(i>4)return e.error(`length octect is too long`);r=0;for(var a=0;a<i;a++){r<<=8;var o=e.readUInt8(n);if(e.isError(o))return o;r|=o}return r}})),fn=n(((e,t)=>{var n=p(),r=l().Buffer,i=dn();function a(e){i.call(this,e),this.enc=`pem`}n(a,i),t.exports=a,a.prototype.decode=function(e,t){for(var n=e.toString().split(/[\r\n]+/g),a=t.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,c=-1,l=0;l<n.length;l++){var u=n[l].match(o);if(u!==null&&u[2]===a)if(s===-1){if(u[1]!==`BEGIN`)break;s=l}else{if(u[1]!==`END`)break;c=l;break}}if(s===-1||c===-1)throw Error(`PEM section not found for: `+a);var d=n.slice(s+1,c).join(``);d.replace(/[^a-z0-9\+\/=]+/gi,``);var f=new r(d,`base64`);return i.prototype.decode.call(this,f,t)}})),pn=n((e=>{var t=e;t.der=dn(),t.pem=fn()})),mn=n(((e,t)=>{var n=p(),r=l().Buffer,i=_n(),a=i.base,o=i.constants.der;function s(e){this.enc=`der`,this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}t.exports=s,s.prototype.encode=function(e,t){return this.tree._encode(e,t).join()};function c(e){a.Node.call(this,`der`,e)}n(c,a.Node),c.prototype._encodeComposite=function(e,t,n,i){var a=d(e,t,n,this.reporter);if(i.length<128){var o=new r(2);return o[0]=a,o[1]=i.length,this._createEncoderBuffer([o,i])}for(var s=1,c=i.length;c>=256;c>>=8)s++;var o=new r(2+s);o[0]=a,o[1]=128|s;for(var c=1+s,l=i.length;l>0;c--,l>>=8)o[c]=l&255;return this._createEncoderBuffer([o,i])},c.prototype._encodeStr=function(e,t){if(t===`bitstr`)return this._createEncoderBuffer([e.unused|0,e.data]);if(t===`bmpstr`){for(var n=new r(e.length*2),i=0;i<e.length;i++)n.writeUInt16BE(e.charCodeAt(i),i*2);return this._createEncoderBuffer(n)}else if(t===`numstr`)return this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error(`Encoding of string type: numstr supports only digits and space`);else if(t===`printstr`)return this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error(`Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark`);else if(/str$/.test(t))return this._createEncoderBuffer(e);else if(t===`objDesc`)return this._createEncoderBuffer(e);else return this.reporter.error(`Encoding of string type: `+t+` unsupported`)},c.prototype._encodeObjid=function(e,t,n){if(typeof e==`string`){if(!t)return this.reporter.error(`string objid given, but no values map found`);if(!t.hasOwnProperty(e))return this.reporter.error(`objid not found in values map`);e=t[e].split(/[\s\.]+/g);for(var i=0;i<e.length;i++)e[i]|=0}else if(Array.isArray(e)){e=e.slice();for(var i=0;i<e.length;i++)e[i]|=0}if(!Array.isArray(e))return this.reporter.error(`objid() should be either array or string, got: `+JSON.stringify(e));if(!n){if(e[1]>=40)return this.reporter.error(`Second objid identifier OOB`);e.splice(0,2,e[0]*40+e[1])}for(var a=0,i=0;i<e.length;i++){var o=e[i];for(a++;o>=128;o>>=7)a++}for(var s=new r(a),c=s.length-1,i=e.length-1;i>=0;i--){var o=e[i];for(s[c--]=o&127;(o>>=7)>0;)s[c--]=128|o&127}return this._createEncoderBuffer(s)};function u(e){return e<10?`0`+e:e}c.prototype._encodeTime=function(e,t){var n,r=new Date(e);return t===`gentime`?n=[u(r.getFullYear()),u(r.getUTCMonth()+1),u(r.getUTCDate()),u(r.getUTCHours()),u(r.getUTCMinutes()),u(r.getUTCSeconds()),`Z`].join(``):t===`utctime`?n=[u(r.getFullYear()%100),u(r.getUTCMonth()+1),u(r.getUTCDate()),u(r.getUTCHours()),u(r.getUTCMinutes()),u(r.getUTCSeconds()),`Z`].join(``):this.reporter.error(`Encoding `+t+` time is not supported yet`),this._encodeStr(n,`octstr`)},c.prototype._encodeNull=function(){return this._createEncoderBuffer(``)},c.prototype._encodeInt=function(e,t){if(typeof e==`string`){if(!t)return this.reporter.error(`String int or enum given, but no values map`);if(!t.hasOwnProperty(e))return this.reporter.error(`Values map doesn't contain: `+JSON.stringify(e));e=t[e]}if(typeof e!=`number`&&!r.isBuffer(e)){var n=e.toArray();!e.sign&&n[0]&128&&n.unshift(0),e=new r(n)}if(r.isBuffer(e)){var i=e.length;e.length===0&&i++;var a=new r(i);return e.copy(a),e.length===0&&(a[0]=0),this._createEncoderBuffer(a)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);for(var i=1,o=e;o>=256;o>>=8)i++;for(var a=Array(i),o=a.length-1;o>=0;o--)a[o]=e&255,e>>=8;return a[0]&128&&a.unshift(0),this._createEncoderBuffer(new r(a))},c.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},c.prototype._use=function(e,t){return typeof e==`function`&&(e=e(t)),e._getEncoder(`der`).tree},c.prototype._skipDefault=function(e,t,n){var r=this._baseState,i;if(r.default===null)return!1;var a=e.join();if(r.defaultBuffer===void 0&&(r.defaultBuffer=this._encodeValue(r.default,t,n).join()),a.length!==r.defaultBuffer.length)return!1;for(i=0;i<a.length;i++)if(a[i]!==r.defaultBuffer[i])return!1;return!0};function d(e,t,n,r){var i;if(e===`seqof`?e=`seq`:e===`setof`&&(e=`set`),o.tagByName.hasOwnProperty(e))i=o.tagByName[e];else if(typeof e==`number`&&(e|0)===e)i=e;else return r.error(`Unknown tag: `+e);return i>=31?r.error(`Multi-octet tag encoding unsupported`):(t||(i|=32),i|=o.tagClassByName[n||`universal`]<<6,i)}})),hn=n(((e,t)=>{var n=p(),r=mn();function i(e){r.call(this,e),this.enc=`pem`}n(i,r),t.exports=i,i.prototype.encode=function(e,t){for(var n=r.prototype.encode.call(this,e).toString(`base64`),i=[`-----BEGIN `+t.label+`-----`],a=0;a<n.length;a+=64)i.push(n.slice(a,a+64));return i.push(`-----END `+t.label+`-----`),i.join(`
|
|
7
|
-
`)}})),gn=n((e=>{var t=e;t.der=mn(),t.pem=hn()})),_n=n((e=>{var t=e;t.bignum=et(),t.define=rn().define,t.base=cn(),t.constants=un(),t.decoders=pn(),t.encoders=gn()})),vn=n(((e,t)=>{var n=_n(),r=n.define(`Time`,function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),i=n.define(`AttributeTypeValue`,function(){this.seq().obj(this.key(`type`).objid(),this.key(`value`).any())}),a=n.define(`AlgorithmIdentifier`,function(){this.seq().obj(this.key(`algorithm`).objid(),this.key(`parameters`).optional(),this.key(`curve`).objid().optional())}),o=n.define(`SubjectPublicKeyInfo`,function(){this.seq().obj(this.key(`algorithm`).use(a),this.key(`subjectPublicKey`).bitstr())}),s=n.define(`RelativeDistinguishedName`,function(){this.setof(i)}),c=n.define(`RDNSequence`,function(){this.seqof(s)}),l=n.define(`Name`,function(){this.choice({rdnSequence:this.use(c)})}),u=n.define(`Validity`,function(){this.seq().obj(this.key(`notBefore`).use(r),this.key(`notAfter`).use(r))}),d=n.define(`Extension`,function(){this.seq().obj(this.key(`extnID`).objid(),this.key(`critical`).bool().def(!1),this.key(`extnValue`).octstr())}),f=n.define(`TBSCertificate`,function(){this.seq().obj(this.key(`version`).explicit(0).int().optional(),this.key(`serialNumber`).int(),this.key(`signature`).use(a),this.key(`issuer`).use(l),this.key(`validity`).use(u),this.key(`subject`).use(l),this.key(`subjectPublicKeyInfo`).use(o),this.key(`issuerUniqueID`).implicit(1).bitstr().optional(),this.key(`subjectUniqueID`).implicit(2).bitstr().optional(),this.key(`extensions`).explicit(3).seqof(d).optional())});t.exports=n.define(`X509Certificate`,function(){this.seq().obj(this.key(`tbsCertificate`).use(f),this.key(`signatureAlgorithm`).use(a),this.key(`signatureValue`).bitstr())})})),yn=n((e=>{var t=_n();e.certificate=vn(),e.RSAPrivateKey=t.define(`RSAPrivateKey`,function(){this.seq().obj(this.key(`version`).int(),this.key(`modulus`).int(),this.key(`publicExponent`).int(),this.key(`privateExponent`).int(),this.key(`prime1`).int(),this.key(`prime2`).int(),this.key(`exponent1`).int(),this.key(`exponent2`).int(),this.key(`coefficient`).int())}),e.RSAPublicKey=t.define(`RSAPublicKey`,function(){this.seq().obj(this.key(`modulus`).int(),this.key(`publicExponent`).int())});var n=t.define(`AlgorithmIdentifier`,function(){this.seq().obj(this.key(`algorithm`).objid(),this.key(`none`).null_().optional(),this.key(`curve`).objid().optional(),this.key(`params`).seq().obj(this.key(`p`).int(),this.key(`q`).int(),this.key(`g`).int()).optional())});e.PublicKey=t.define(`SubjectPublicKeyInfo`,function(){this.seq().obj(this.key(`algorithm`).use(n),this.key(`subjectPublicKey`).bitstr())}),e.PrivateKey=t.define(`PrivateKeyInfo`,function(){this.seq().obj(this.key(`version`).int(),this.key(`algorithm`).use(n),this.key(`subjectPrivateKey`).octstr())}),e.EncryptedPrivateKey=t.define(`EncryptedPrivateKeyInfo`,function(){this.seq().obj(this.key(`algorithm`).seq().obj(this.key(`id`).objid(),this.key(`decrypt`).seq().obj(this.key(`kde`).seq().obj(this.key(`id`).objid(),this.key(`kdeparams`).seq().obj(this.key(`salt`).octstr(),this.key(`iters`).int())),this.key(`cipher`).seq().obj(this.key(`algo`).objid(),this.key(`iv`).octstr()))),this.key(`subjectPrivateKey`).octstr())}),e.DSAPrivateKey=t.define(`DSAPrivateKey`,function(){this.seq().obj(this.key(`version`).int(),this.key(`p`).int(),this.key(`q`).int(),this.key(`g`).int(),this.key(`pub_key`).int(),this.key(`priv_key`).int())}),e.DSAparam=t.define(`DSAparam`,function(){this.int()});var r=t.define(`ECParameters`,function(){this.choice({namedCurve:this.objid()})});e.ECPrivateKey=t.define(`ECPrivateKey`,function(){this.seq().obj(this.key(`version`).int(),this.key(`privateKey`).octstr(),this.key(`parameters`).optional().explicit(0).use(r),this.key(`publicKey`).optional().explicit(1).bitstr())}),e.signature=t.define(`signature`,function(){this.seq().obj(this.key(`r`).int(),this.key(`s`).int())})})),$=n(((e,t)=>{t.exports={"2.16.840.1.101.3.4.1.1":`aes-128-ecb`,"2.16.840.1.101.3.4.1.2":`aes-128-cbc`,"2.16.840.1.101.3.4.1.3":`aes-128-ofb`,"2.16.840.1.101.3.4.1.4":`aes-128-cfb`,"2.16.840.1.101.3.4.1.21":`aes-192-ecb`,"2.16.840.1.101.3.4.1.22":`aes-192-cbc`,"2.16.840.1.101.3.4.1.23":`aes-192-ofb`,"2.16.840.1.101.3.4.1.24":`aes-192-cfb`,"2.16.840.1.101.3.4.1.41":`aes-256-ecb`,"2.16.840.1.101.3.4.1.42":`aes-256-cbc`,"2.16.840.1.101.3.4.1.43":`aes-256-ofb`,"2.16.840.1.101.3.4.1.44":`aes-256-cfb`}})),bn=n(((e,t)=>{var n=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,r=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,a=qe(),o=Xe(),s=c().Buffer;t.exports=function(e,t){var c=e.toString(),l=c.match(n),u;if(l){var d=`aes`+l[1],f=s.from(l[2],`hex`),p=s.from(l[3].replace(/[\r\n]/g,``),`base64`),m=a(t,f.slice(0,8),parseInt(l[1],10)).key,h=[],g=o.createDecipheriv(d,m,f);h.push(g.update(p)),h.push(g.final()),u=s.concat(h)}else{var _=c.match(i);u=s.from(_[2].replace(/[\r\n]/g,``),`base64`)}return{tag:c.match(r)[1],data:u}}})),xn=n(((e,t)=>{var n=yn(),r=$(),i=bn(),a=Xe(),o=we().pbkdf2Sync,s=c().Buffer;function l(e,t){var n=e.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),c=r[e.algorithm.decrypt.cipher.algo.join(`.`)],l=e.algorithm.decrypt.cipher.iv,u=e.subjectPrivateKey,d=o(t,n,i,parseInt(c.split(`-`)[1],10)/8,`sha1`),f=a.createDecipheriv(c,d,l),p=[];return p.push(f.update(u)),p.push(f.final()),s.concat(p)}function u(e){var t;typeof e==`object`&&!s.isBuffer(e)&&(t=e.passphrase,e=e.key),typeof e==`string`&&(e=s.from(e));var r=i(e,t),a=r.tag,o=r.data,c,u;switch(a){case`CERTIFICATE`:u=n.certificate.decode(o,`der`).tbsCertificate.subjectPublicKeyInfo;case`PUBLIC KEY`:switch(u||=n.PublicKey.decode(o,`der`),c=u.algorithm.algorithm.join(`.`),c){case`1.2.840.113549.1.1.1`:return n.RSAPublicKey.decode(u.subjectPublicKey.data,`der`);case`1.2.840.10045.2.1`:return u.subjectPrivateKey=u.subjectPublicKey,{type:`ec`,data:u};case`1.2.840.10040.4.1`:return u.algorithm.params.pub_key=n.DSAparam.decode(u.subjectPublicKey.data,`der`),{type:`dsa`,data:u.algorithm.params};default:throw Error(`unknown key id `+c)}case`ENCRYPTED PRIVATE KEY`:o=n.EncryptedPrivateKey.decode(o,`der`),o=l(o,t);case`PRIVATE KEY`:switch(u=n.PrivateKey.decode(o,`der`),c=u.algorithm.algorithm.join(`.`),c){case`1.2.840.113549.1.1.1`:return n.RSAPrivateKey.decode(u.subjectPrivateKey,`der`);case`1.2.840.10045.2.1`:return{curve:u.algorithm.curve,privateKey:n.ECPrivateKey.decode(u.subjectPrivateKey,`der`).privateKey};case`1.2.840.10040.4.1`:return u.algorithm.params.priv_key=n.DSAparam.decode(u.subjectPrivateKey,`der`),{type:`dsa`,params:u.algorithm.params};default:throw Error(`unknown key id `+c)}case`RSA PUBLIC KEY`:return n.RSAPublicKey.decode(o,`der`);case`RSA PRIVATE KEY`:return n.RSAPrivateKey.decode(o,`der`);case`DSA PRIVATE KEY`:return{type:`dsa`,params:n.DSAPrivateKey.decode(o,`der`)};case`EC PRIVATE KEY`:return o=n.ECPrivateKey.decode(o,`der`),{curve:o.parameters.value,privateKey:o.privateKey};default:throw Error(`unknown key type `+a)}}u.signature=n.signature,t.exports=u})),Sn=n(((e,t)=>{t.exports={"1.3.132.0.10":`secp256k1`,"1.3.132.0.33":`p224`,"1.2.840.10045.3.1.1":`p192`,"1.2.840.10045.3.1.7":`p256`,"1.3.132.0.34":`p384`,"1.3.132.0.35":`p521`}})),Cn=n(((e,t)=>{var n=c().Buffer,r=ge(),i=wt(),a=en().ec,o=nn(),s=xn(),l=Sn(),u=1;function d(e,t,r,a,o){var c=s(t);if(c.curve){if(a!==`ecdsa`&&a!==`ecdsa/rsa`)throw Error(`wrong private key type`);return f(e,c)}else if(c.type===`dsa`){if(a!==`dsa`)throw Error(`wrong private key type`);return p(e,c,r)}if(a!==`rsa`&&a!==`ecdsa/rsa`)throw Error(`wrong private key type`);if(t.padding!==void 0&&t.padding!==u)throw Error(`illegal or unsupported padding mode`);e=n.concat([o,e]);for(var l=c.modulus.byteLength(),d=[0,1];e.length+d.length+1<l;)d.push(255);d.push(0);for(var m=-1;++m<e.length;)d.push(e[m]);return i(d,c)}function f(e,t){var r=l[t.curve.join(`.`)];if(!r)throw Error(`unknown curve `+t.curve.join(`.`));var i=new a(r).keyFromPrivate(t.privateKey).sign(e);return n.from(i.toDER())}function p(e,t,n){for(var r=t.params.priv_key,i=t.params.p,a=t.params.q,s=t.params.g,c=new o(0),l,u=g(e,a).mod(a),d=!1,f=h(r,a,e,n);d===!1;)l=v(a,f,n),c=y(s,l,i,a),d=l.invm(a).imul(u.add(r.mul(c))).mod(a),d.cmpn(0)===0&&(d=!1,c=new o(0));return m(c,d)}function m(e,t){e=e.toArray(),t=t.toArray(),e[0]&128&&(e=[0].concat(e)),t[0]&128&&(t=[0].concat(t));var r=[48,e.length+t.length+4,2,e.length];return r=r.concat(e,[2,t.length],t),n.from(r)}function h(e,t,i,a){if(e=n.from(e.toArray()),e.length<t.byteLength()){var o=n.alloc(t.byteLength()-e.length);e=n.concat([o,e])}var s=i.length,c=_(i,t),l=n.alloc(s);l.fill(1);var u=n.alloc(s);return u=r(a,u).update(l).update(n.from([0])).update(e).update(c).digest(),l=r(a,u).update(l).digest(),u=r(a,u).update(l).update(n.from([1])).update(e).update(c).digest(),l=r(a,u).update(l).digest(),{k:u,v:l}}function g(e,t){var n=new o(e),r=(e.length<<3)-t.bitLength();return r>0&&n.ishrn(r),n}function _(e,t){e=g(e,t),e=e.mod(t);var r=n.from(e.toArray());if(r.length<t.byteLength()){var i=n.alloc(t.byteLength()-r.length);r=n.concat([i,r])}return r}function v(e,t,i){var a,o;do{for(a=n.alloc(0);a.length*8<e.bitLength();)t.v=r(i,t.k).update(t.v).digest(),a=n.concat([a,t.v]);o=g(a,e),t.k=r(i,t.k).update(t.v).update(n.from([0])).digest(),t.v=r(i,t.k).update(t.v).digest()}while(o.cmp(e)!==-1);return o}function y(e,t,n,r){return e.toRed(o.mont(n)).redPow(t).fromRed().mod(r)}t.exports=d,t.exports.getKey=h,t.exports.makeKey=v})),wn=n(((e,t)=>{var n=c().Buffer,r=nn(),i=en().ec,a=xn(),o=Sn();function s(e,t,i,o,s){var c=a(i);if(c.type===`ec`){if(o!==`ecdsa`&&o!==`ecdsa/rsa`)throw Error(`wrong public key type`);return l(e,t,c)}else if(c.type===`dsa`){if(o!==`dsa`)throw Error(`wrong public key type`);return u(e,t,c)}if(o!==`rsa`&&o!==`ecdsa/rsa`)throw Error(`wrong public key type`);t=n.concat([s,t]);for(var d=c.modulus.byteLength(),f=[1],p=0;t.length+f.length+2<d;)f.push(255),p+=1;f.push(0);for(var m=-1;++m<t.length;)f.push(t[m]);f=n.from(f);var h=r.mont(c.modulus);e=new r(e).toRed(h),e=e.redPow(new r(c.publicExponent)),e=n.from(e.fromRed().toArray());var g=+(p<8);for(d=Math.min(e.length,f.length),e.length!==f.length&&(g=1),m=-1;++m<d;)g|=e[m]^f[m];return g===0}function l(e,t,n){var r=o[n.data.algorithm.curve.join(`.`)];if(!r)throw Error(`unknown curve `+n.data.algorithm.curve.join(`.`));var a=new i(r),s=n.data.subjectPrivateKey.data;return a.verify(t,e,s)}function u(e,t,n){var i=n.data.p,o=n.data.q,s=n.data.g,c=n.data.pub_key,l=a.signature.decode(e,`der`),u=l.s,f=l.r;d(u,o),d(f,o);var p=r.mont(i),m=u.invm(o);return s.toRed(p).redPow(new r(t).mul(m).mod(o)).fromRed().mul(c.toRed(p).redPow(f.mul(m).mod(o)).fromRed()).mod(i).mod(o).cmp(f)===0}function d(e,t){if(e.cmpn(0)<=0||e.cmp(t)>=0)throw Error(`invalid sig`)}t.exports=s})),Tn=n(((e,t)=>{var n=c().Buffer,r=X(),i=xt(),a=p(),o=Cn(),s=wn(),l=_e();Object.keys(l).forEach(function(e){l[e].id=n.from(l[e].id,`hex`),l[e.toLowerCase()]=l[e]});function u(e){i.Writable.call(this);var t=l[e];if(!t)throw Error(`Unknown message digest`);this._hashType=t.hash,this._hash=r(t.hash),this._tag=t.id,this._signType=t.sign}a(u,i.Writable),u.prototype._write=function(e,t,n){this._hash.update(e),n()},u.prototype.update=function(e,t){return this._hash.update(typeof e==`string`?n.from(e,t):e),this},u.prototype.sign=function(e,t){this.end();var n=o(this._hash.digest(),e,this._hashType,this._signType,this._tag);return t?n.toString(t):n};function d(e){i.Writable.call(this);var t=l[e];if(!t)throw Error(`Unknown message digest`);this._hash=r(t.hash),this._tag=t.id,this._signType=t.sign}a(d,i.Writable),d.prototype._write=function(e,t,n){this._hash.update(e),n()},d.prototype.update=function(e,t){return this._hash.update(typeof e==`string`?n.from(e,t):e),this},d.prototype.verify=function(e,t,r){var i=typeof t==`string`?n.from(t,r):t;return this.end(),s(i,this._hash.digest(),e,this._signType,this._tag)};function f(e){return new u(e)}function m(e){return new d(e)}t.exports={Sign:f,Verify:m,createSign:f,createVerify:m}})),En=n(((e,t)=>{var n=l(),r=en(),i=et();t.exports=function(e){return new o(e)};var a={secp256k1:{name:`secp256k1`,byteLength:32},secp224r1:{name:`p224`,byteLength:28},prime256v1:{name:`p256`,byteLength:32},prime192v1:{name:`p192`,byteLength:24},ed25519:{name:`ed25519`,byteLength:32},secp384r1:{name:`p384`,byteLength:48},secp521r1:{name:`p521`,byteLength:66}};a.p224=a.secp224r1,a.p256=a.secp256r1=a.prime256v1,a.p192=a.secp192r1=a.prime192v1,a.p384=a.secp384r1,a.p521=a.secp521r1;function o(e){this.curveType=a[e],this.curveType||={name:e},this.curve=new r.ec(this.curveType.name),this.keys=void 0}o.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},o.prototype.computeSecret=function(e,t,r){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),s(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},o.prototype.getPublicKey=function(e,t){var n=this.keys.getPublic(t===`compressed`,!0);return t===`hybrid`&&(n[n.length-1]%2?n[0]=7:n[0]=6),s(n,e)},o.prototype.getPrivateKey=function(e){return s(this.keys.getPrivate(),e)},o.prototype.setPublicKey=function(e,t){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),this.keys._importPublic(e),this},o.prototype.setPrivateKey=function(e,t){t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t));var r=new i(e);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this};function s(e,t,r){Array.isArray(e)||(e=e.toArray());var i=new n.Buffer(e);if(r&&i.length<r){var a=new n.Buffer(r-i.length);a.fill(0),i=n.Buffer.concat([a,i])}return t?i.toString(t):i}})),Dn=n(((e,t)=>{var n=X(),r=c().Buffer;t.exports=function(e,t){for(var a=r.alloc(0),o=0,s;a.length<t;)s=i(o++),a=r.concat([a,n(`sha1`).update(e).update(s).digest()]);return a.slice(0,t)};function i(e){var t=r.allocUnsafe(4);return t.writeUInt32BE(e,0),t}})),On=n(((e,t)=>{t.exports=function(e,t){for(var n=e.length,r=-1;++r<n;)e[r]^=t[r];return e}})),kn=n(((e,t)=>{var n=et(),r=c().Buffer;function i(e,t){return r.from(e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed().toArray())}t.exports=i})),An=n(((e,t)=>{var n=xn(),r=N(),i=X(),a=Dn(),o=On(),s=et(),l=kn(),u=wt(),d=c().Buffer;t.exports=function(e,t,r){var i=e.padding?e.padding:r?1:4,a=n(e),o;if(i===4)o=f(a,t);else if(i===1)o=p(a,t,r);else if(i===3){if(o=new s(t),o.cmp(a.modulus)>=0)throw Error(`data too long for modulus`)}else throw Error(`unknown padding`);return r?u(o,a):l(o,a)};function f(e,t){var n=e.modulus.byteLength(),c=t.length,l=i(`sha1`).update(d.alloc(0)).digest(),u=l.length,f=2*u;if(c>n-f-2)throw Error(`message too long`);var p=d.alloc(n-c-f-2),m=n-u-1,h=r(u),g=o(d.concat([l,p,d.alloc(1,1),t],m),a(h,m)),_=o(h,a(g,u));return new s(d.concat([d.alloc(1),_,g],n))}function p(e,t,n){var r=t.length,i=e.modulus.byteLength();if(r>i-11)throw Error(`message too long`);var a=n?d.alloc(i-r-3,255):m(i-r-3);return new s(d.concat([d.from([0,n?1:2]),a,d.alloc(1),t],i))}function m(e){for(var t=d.allocUnsafe(e),n=0,i=r(e*2),a=0,o;n<e;)a===i.length&&(i=r(e*2),a=0),o=i[a++],o&&(t[n++]=o);return t}})),jn=n(((e,t)=>{var n=xn(),r=Dn(),i=On(),a=et(),o=wt(),s=X(),l=kn(),u=c().Buffer;t.exports=function(e,t,r){var i=e.padding?e.padding:r?1:4,s=n(e),c=s.modulus.byteLength();if(t.length>c||new a(t).cmp(s.modulus)>=0)throw Error(`decryption error`);var p=r?l(new a(t),s):o(t,s),m=u.alloc(c-p.length);if(p=u.concat([m,p],c),i===4)return d(s,p);if(i===1)return f(s,p,r);if(i===3)return p;throw Error(`unknown padding`)};function d(e,t){var n=e.modulus.byteLength(),a=s(`sha1`).update(u.alloc(0)).digest(),o=a.length;if(t[0]!==0)throw Error(`decryption error`);var c=t.slice(1,o+1),l=t.slice(o+1),d=i(l,r(i(c,r(l,o)),n-o-1));if(p(a,d.slice(0,o)))throw Error(`decryption error`);for(var f=o;d[f]===0;)f++;if(d[f++]!==1)throw Error(`decryption error`);return d.slice(f)}function f(e,t,n){for(var r=t.slice(0,2),i=2,a=0;t[i++]!==0;)if(i>=t.length){a++;break}var o=t.slice(2,i-1);if((r.toString(`hex`)!==`0002`&&!n||r.toString(`hex`)!==`0001`&&n)&&a++,o.length<8&&a++,a)throw Error(`decryption error`);return t.slice(i)}function p(e,t){e=u.from(e),t=u.from(t);var n=0,r=e.length;e.length!==t.length&&(n++,r=Math.min(e.length,t.length));for(var i=-1;++i<r;)n+=e[i]^t[i];return n}})),Mn=n((e=>{e.publicEncrypt=An(),e.privateDecrypt=jn(),e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}})),Nn=n((t=>{var n=e(r());function i(){throw Error(`secure random number generation not supported by this browser
|
|
8
|
-
use chrome, FireFox or Internet Explorer 11`)}var
|
|
6
|
+
})`)}catch{n=function(e){this._initNamed(e)}}return r(n,e),n.prototype._initNamed=function(t){e.call(this,t)},new n(this)},a.prototype._getDecoder=function(e){return e||=`der`,this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n.decoders[e])),this.decoders[e]},a.prototype.decode=function(e,t,n){return this._getDecoder(t).decode(e,n)},a.prototype._getEncoder=function(e){return e||=`der`,this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(n.encoders[e])),this.encoders[e]},a.prototype.encode=function(e,t,n){return this._getEncoder(t).encode(e,n)}})),an=n((e=>{var t=d();function n(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}e.Reporter=n,n.prototype.isError=function(e){return e instanceof r},n.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},n.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},n.prototype.enterKey=function(e){return this._reporterState.path.push(e)},n.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},n.prototype.leaveKey=function(e,t,n){var r=this._reporterState;this.exitKey(e),r.obj!==null&&(r.obj[t]=n)},n.prototype.path=function(){return this._reporterState.path.join(`/`)},n.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},n.prototype.leaveObject=function(e){var t=this._reporterState,n=t.obj;return t.obj=e,n},n.prototype.error=function(e){var t,n=this._reporterState,i=e instanceof r;if(t=i?e:new r(n.path.map(function(e){return`[`+JSON.stringify(e)+`]`}).join(``),e.message||e,e.stack),!n.options.partial)throw t;return i||n.errors.push(t),t},n.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e};function r(e,t){this.path=e,this.rethrow(t)}t(r,Error),r.prototype.rethrow=function(e){if(this.message=e+` at: `+(this.path||`(shallow)`),Error.captureStackTrace&&Error.captureStackTrace(this,r),!this.stack)try{throw Error(this.message)}catch(e){this.stack=e.stack}return this}})),on=n((e=>{var t=d(),n=cn().Reporter,r=a().Buffer;function i(e,t){if(n.call(this,t),!r.isBuffer(e)){this.error(`Input not Buffer`);return}this.base=e,this.offset=0,this.length=e.length}t(i,n),e.DecoderBuffer=i,i.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},i.prototype.restore=function(e){var t=new i(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,n.prototype.restore.call(this,e.reporter),t},i.prototype.isEmpty=function(){return this.offset===this.length},i.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||`DecoderBuffer overrun`)},i.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||`DecoderBuffer overrun`);var n=new i(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},i.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)};function o(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof o||(e=new o(e,t)),this.length+=e.length,e},this);else if(typeof e==`number`){if(!(0<=e&&e<=255))return t.error(`non-byte EncoderBuffer value`);this.value=e,this.length=1}else if(typeof e==`string`)this.value=e,this.length=r.byteLength(e);else if(r.isBuffer(e))this.value=e,this.length=e.length;else return t.error(`Unsupported type: `+typeof e)}e.EncoderBuffer=o,o.prototype.join=function(e,t){return e||=new r(this.length),t||=0,this.length===0||(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,t),t+=n.length}):(typeof this.value==`number`?e[t]=this.value:typeof this.value==`string`?e.write(this.value,t):r.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}})),sn=n(((e,t)=>{var n=cn().Reporter,r=cn().EncoderBuffer,i=cn().DecoderBuffer,a=Ee(),o=`seq.seqof.set.setof.objid.bool.gentime.utctime.null_.enum.int.objDesc.bitstr.bmpstr.charstr.genstr.graphstr.ia5str.iso646str.numstr.octstr.printstr.t61str.unistr.utf8str.videostr`.split(`.`),s=[`key`,`obj`,`use`,`optional`,`explicit`,`implicit`,`def`,`choice`,`any`,`contains`].concat(o),c=[`_peekTag`,`_decodeTag`,`_use`,`_decodeStr`,`_decodeObjid`,`_decodeTime`,`_decodeNull`,`_decodeInt`,`_decodeBool`,`_decodeList`,`_encodeComposite`,`_encodeStr`,`_encodeObjid`,`_encodeTime`,`_encodeNull`,`_encodeInt`,`_encodeBool`];function l(e,t){var n={};this._baseState=n,n.enc=e,n.parent=t||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}t.exports=l;var u=[`enc`,`parent`,`children`,`tag`,`args`,`reverseArgs`,`choice`,`optional`,`any`,`obj`,`use`,`alteredUse`,`key`,`default`,`explicit`,`implicit`,`contains`];l.prototype.clone=function(){var e=this._baseState,t={};u.forEach(function(n){t[n]=e[n]});var n=new this.constructor(t.parent);return n._baseState=t,n},l.prototype._wrap=function(){var e=this._baseState;s.forEach(function(t){this[t]=function(){var n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}},this)},l.prototype._init=function(e){var t=this._baseState;a(t.parent===null),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),a.equal(t.children.length,1,`Root node can have only one child`)},l.prototype._useArgs=function(e){var t=this._baseState,n=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),n.length!==0&&(a(t.children===null),t.children=n,n.forEach(function(e){e._baseState.parent=this},this)),e.length!==0&&(a(t.args===null),t.args=e,t.reverseArgs=e.map(function(e){if(typeof e!=`object`||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(n){n==(n|0)&&(n|=0);var r=e[n];t[r]=n}),t}))},c.forEach(function(e){l.prototype[e]=function(){var t=this._baseState;throw Error(e+` not implemented for encoding: `+t.enc)}}),o.forEach(function(e){l.prototype[e]=function(){var t=this._baseState,n=Array.prototype.slice.call(arguments);return a(t.tag===null),t.tag=e,this._useArgs(n),this}}),l.prototype.use=function(e){a(e);var t=this._baseState;return a(t.use===null),t.use=e,this},l.prototype.optional=function(){var e=this._baseState;return e.optional=!0,this},l.prototype.def=function(e){var t=this._baseState;return a(t.default===null),t.default=e,t.optional=!0,this},l.prototype.explicit=function(e){var t=this._baseState;return a(t.explicit===null&&t.implicit===null),t.explicit=e,this},l.prototype.implicit=function(e){var t=this._baseState;return a(t.explicit===null&&t.implicit===null),t.implicit=e,this},l.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,t.length!==0&&this._useArgs(t),this},l.prototype.key=function(e){var t=this._baseState;return a(t.key===null),t.key=e,this},l.prototype.any=function(){var e=this._baseState;return e.any=!0,this},l.prototype.choice=function(e){var t=this._baseState;return a(t.choice===null),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},l.prototype.contains=function(e){var t=this._baseState;return a(t.use===null),t.contains=e,this},l.prototype._decode=function(e,t){var n=this._baseState;if(n.parent===null)return e.wrapResult(n.children[0]._decode(e,t));var r=n.default,a=!0,o=null;if(n.key!==null&&(o=e.enterKey(n.key)),n.optional){var s=null;if(n.explicit===null?n.implicit===null?n.tag!==null&&(s=n.tag):s=n.implicit:s=n.explicit,s===null&&!n.any){var c=e.save();try{n.choice===null?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),a=!0}catch{a=!1}e.restore(c)}else if(a=this._peekTag(e,s,n.any),e.isError(a))return a}var l;if(n.obj&&a&&(l=e.enterObject()),a){if(n.explicit!==null){var u=this._decodeTag(e,n.explicit);if(e.isError(u))return u;e=u}var d=e.offset;if(n.use===null&&n.choice===null){if(n.any)var c=e.save();var f=this._decodeTag(e,n.implicit===null?n.tag:n.implicit,n.any);if(e.isError(f))return f;n.any?r=e.raw(c):e=f}if(t&&t.track&&n.tag!==null&&t.track(e.path(),d,e.length,`tagged`),t&&t.track&&n.tag!==null&&t.track(e.path(),e.offset,e.length,`content`),r=n.any?r:n.choice===null?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),e.isError(r))return r;if(!n.any&&n.choice===null&&n.children!==null&&n.children.forEach(function(n){n._decode(e,t)}),n.contains&&(n.tag===`octstr`||n.tag===`bitstr`)){var p=new i(r);r=this._getUse(n.contains,e._reporterState.obj)._decode(p,t)}}return n.obj&&a&&(r=e.leaveObject(l)),n.key!==null&&(r!==null||a===!0)?e.leaveKey(o,n.key,r):o!==null&&e.exitKey(o),r},l.prototype._decodeGeneric=function(e,t,n){var r=this._baseState;return e===`seq`||e===`set`?null:e===`seqof`||e===`setof`?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):e===`objid`&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):e===`objid`?this._decodeObjid(t,null,null,n):e===`gentime`||e===`utctime`?this._decodeTime(t,e,n):e===`null_`?this._decodeNull(t,n):e===`bool`?this._decodeBool(t,n):e===`objDesc`?this._decodeStr(t,e,n):e===`int`||e===`enum`?this._decodeInt(t,r.args&&r.args[0],n):r.use===null?t.error(`unknown tag: `+e):this._getUse(r.use,t._reporterState.obj)._decode(t,n)},l.prototype._getUse=function(e,t){var n=this._baseState;return n.useDecoder=this._use(e,t),a(n.useDecoder._baseState.parent===null),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},l.prototype._decodeChoice=function(e,t){var n=this._baseState,r=null,i=!1;return Object.keys(n.choice).some(function(a){var o=e.save(),s=n.choice[a];try{var c=s._decode(e,t);if(e.isError(c))return!1;r={type:a,value:c},i=!0}catch{return e.restore(o),!1}return!0},this),i?r:e.error(`Choice not matched`)},l.prototype._createEncoderBuffer=function(e){return new r(e,this.reporter)},l.prototype._encode=function(e,t,n){var r=this._baseState;if(!(r.default!==null&&r.default===e)){var i=this._encodeValue(e,t,n);if(i!==void 0&&!this._skipDefault(i,t,n))return i}},l.prototype._encodeValue=function(e,t,r){var i=this._baseState;if(i.parent===null)return i.children[0]._encode(e,t||new n);var a=null;if(this.reporter=t,i.optional&&e===void 0)if(i.default!==null)e=i.default;else return;var o=null,s=!1;if(i.any)a=this._createEncoderBuffer(e);else if(i.choice)a=this._encodeChoice(e,t);else if(i.contains)o=this._getUse(i.contains,r)._encode(e,t),s=!0;else if(i.children)o=i.children.map(function(n){if(n._baseState.tag===`null_`)return n._encode(null,t,e);if(n._baseState.key===null)return t.error(`Child should have a key`);var r=t.enterKey(n._baseState.key);if(typeof e!=`object`)return t.error(`Child expected, but input is not object`);var i=n._encode(e[n._baseState.key],t,e);return t.leaveKey(r),i},this).filter(function(e){return e}),o=this._createEncoderBuffer(o);else if(i.tag===`seqof`||i.tag===`setof`){if(!(i.args&&i.args.length===1))return t.error(`Too many args for : `+i.tag);if(!Array.isArray(e))return t.error(`seqof/setof, but data is not Array`);var c=this.clone();c._baseState.implicit=null,o=this._createEncoderBuffer(e.map(function(n){var r=this._baseState;return this._getUse(r.args[0],e)._encode(n,t)},c))}else i.use===null?(o=this._encodePrimitive(i.tag,e),s=!0):a=this._getUse(i.use,r)._encode(e,t);var a;if(!i.any&&i.choice===null){var l=i.implicit===null?i.tag:i.implicit,u=i.implicit===null?`universal`:`context`;l===null?i.use===null&&t.error(`Tag could be omitted only for .use()`):i.use===null&&(a=this._encodeComposite(l,s,u,o))}return i.explicit!==null&&(a=this._encodeComposite(i.explicit,!1,`context`,a)),a},l.prototype._encodeChoice=function(e,t){var n=this._baseState,r=n.choice[e.type];return r||a(!1,e.type+` not found in `+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},l.prototype._encodePrimitive=function(e,t){var n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if(e===`objid`&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if(e===`objid`)return this._encodeObjid(t,null,null);if(e===`gentime`||e===`utctime`)return this._encodeTime(t,e);if(e===`null_`)return this._encodeNull();if(e===`int`||e===`enum`)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if(e===`bool`)return this._encodeBool(t);if(e===`objDesc`)return this._encodeStr(t,e);throw Error(`Unsupported tag: `+e)},l.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},l.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}})),cn=n((e=>{var t=e;t.Reporter=an().Reporter,t.DecoderBuffer=on().DecoderBuffer,t.EncoderBuffer=on().EncoderBuffer,t.Node=sn()})),ln=n((e=>{var t=un();e.tagClass={0:`universal`,1:`application`,2:`context`,3:`private`},e.tagClassByName=t._reverse(e.tagClass),e.tag={0:`end`,1:`bool`,2:`int`,3:`bitstr`,4:`octstr`,5:`null_`,6:`objid`,7:`objDesc`,8:`external`,9:`real`,10:`enum`,11:`embed`,12:`utf8str`,13:`relativeOid`,16:`seq`,17:`set`,18:`numstr`,19:`printstr`,20:`t61str`,21:`videostr`,22:`ia5str`,23:`utctime`,24:`gentime`,25:`graphstr`,26:`iso646str`,27:`genstr`,28:`unistr`,29:`charstr`,30:`bmpstr`},e.tagByName=t._reverse(e.tag)})),un=n((e=>{var t=e;t._reverse=function(e){var t={};return Object.keys(e).forEach(function(n){(n|0)==n&&(n|=0);var r=e[n];t[r]=n}),t},t.der=ln()})),dn=n(((e,t)=>{var n=d(),r=_n(),i=r.base,a=r.bignum,o=r.constants.der;function s(e){this.enc=`der`,this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}t.exports=s,s.prototype.decode=function(e,t){return e instanceof i.DecoderBuffer||(e=new i.DecoderBuffer(e,t)),this.tree._decode(e,t)};function c(e){i.Node.call(this,`der`,e)}n(c,i.Node),c.prototype._peekTag=function(e,t,n){if(e.isEmpty())return!1;var r=e.save(),i=l(e,`Failed to peek tag: "`+t+`"`);return e.isError(i)?i:(e.restore(r),i.tag===t||i.tagStr===t||i.tagStr+`of`===t||n)},c.prototype._decodeTag=function(e,t,n){var r=l(e,`Failed to decode tag of "`+t+`"`);if(e.isError(r))return r;var i=u(e,r.primitive,`Failed to get length of "`+t+`"`);if(e.isError(i))return i;if(!n&&r.tag!==t&&r.tagStr!==t&&r.tagStr+`of`!==t)return e.error(`Failed to match tag: "`+t+`"`);if(r.primitive||i!==null)return e.skip(i,`Failed to match body of: "`+t+`"`);var a=e.save(),o=this._skipUntilEnd(e,`Failed to skip indefinite length body: "`+this.tag+`"`);return e.isError(o)?o:(i=e.offset-a.offset,e.restore(a),e.skip(i,`Failed to match body of: "`+t+`"`))},c.prototype._skipUntilEnd=function(e,t){for(;;){var n=l(e,t);if(e.isError(n))return n;var r=u(e,n.primitive,t);if(e.isError(r))return r;var i=n.primitive||r!==null?e.skip(r):this._skipUntilEnd(e,t);if(e.isError(i))return i;if(n.tagStr===`end`)break}},c.prototype._decodeList=function(e,t,n,r){for(var i=[];!e.isEmpty();){var a=this._peekTag(e,`end`);if(e.isError(a))return a;var o=n.decode(e,`der`,r);if(e.isError(o)&&a)break;i.push(o)}return i},c.prototype._decodeStr=function(e,t){if(t===`bitstr`){var n=e.readUInt8();return e.isError(n)?n:{unused:n,data:e.raw()}}else if(t===`bmpstr`){var r=e.raw();if(r.length%2==1)return e.error(`Decoding of string type: bmpstr length mismatch`);for(var i=``,a=0;a<r.length/2;a++)i+=String.fromCharCode(r.readUInt16BE(a*2));return i}else if(t===`numstr`){var o=e.raw().toString(`ascii`);return this._isNumstr(o)?o:e.error(`Decoding of string type: numstr unsupported characters`)}else if(t===`octstr`)return e.raw();else if(t===`objDesc`)return e.raw();else if(t===`printstr`){var s=e.raw().toString(`ascii`);return this._isPrintstr(s)?s:e.error(`Decoding of string type: printstr unsupported characters`)}else if(/str$/.test(t))return e.raw().toString();else return e.error(`Decoding of string type: `+t+` unsupported`)},c.prototype._decodeObjid=function(e,t,n){for(var r,i=[],a=0;!e.isEmpty();){var o=e.readUInt8();a<<=7,a|=o&127,o&128||(i.push(a),a=0)}o&128&&i.push(a);var s=i[0]/40|0,c=i[0]%40;if(r=n?i:[s,c].concat(i.slice(1)),t){var l=t[r.join(` `)];l===void 0&&(l=t[r.join(`.`)]),l!==void 0&&(r=l)}return r},c.prototype._decodeTime=function(e,t){var n=e.raw().toString();if(t===`gentime`)var r=n.slice(0,4)|0,i=n.slice(4,6)|0,a=n.slice(6,8)|0,o=n.slice(8,10)|0,s=n.slice(10,12)|0,c=n.slice(12,14)|0;else if(t===`utctime`){var r=n.slice(0,2)|0,i=n.slice(2,4)|0,a=n.slice(4,6)|0,o=n.slice(6,8)|0,s=n.slice(8,10)|0,c=n.slice(10,12)|0;r=r<70?2e3+r:1900+r}else return e.error(`Decoding `+t+` time is not supported yet`);return Date.UTC(r,i-1,a,o,s,c,0)},c.prototype._decodeNull=function(e){return null},c.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:t!==0},c.prototype._decodeInt=function(e,t){var n=new a(e.raw());return t&&(n=t[n.toString(10)]||n),n},c.prototype._use=function(e,t){return typeof e==`function`&&(e=e(t)),e._getDecoder(`der`).tree};function l(e,t){var n=e.readUInt8(t);if(e.isError(n))return n;var r=o.tagClass[n>>6],i=(n&32)==0;if((n&31)==31){var a=n;for(n=0;(a&128)==128;){if(a=e.readUInt8(t),e.isError(a))return a;n<<=7,n|=a&127}}else n&=31;var s=o.tag[n];return{cls:r,primitive:i,tag:n,tagStr:s}}function u(e,t,n){var r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&r===128)return null;if(!(r&128))return r;var i=r&127;if(i>4)return e.error(`length octect is too long`);r=0;for(var a=0;a<i;a++){r<<=8;var o=e.readUInt8(n);if(e.isError(o))return o;r|=o}return r}})),fn=n(((e,t)=>{var n=d(),r=a().Buffer,i=dn();function o(e){i.call(this,e),this.enc=`pem`}n(o,i),t.exports=o,o.prototype.decode=function(e,t){for(var n=e.toString().split(/[\r\n]+/g),a=t.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,c=-1,l=0;l<n.length;l++){var u=n[l].match(o);if(u!==null&&u[2]===a)if(s===-1){if(u[1]!==`BEGIN`)break;s=l}else{if(u[1]!==`END`)break;c=l;break}}if(s===-1||c===-1)throw Error(`PEM section not found for: `+a);var d=n.slice(s+1,c).join(``);d.replace(/[^a-z0-9\+\/=]+/gi,``);var f=new r(d,`base64`);return i.prototype.decode.call(this,f,t)}})),pn=n((e=>{var t=e;t.der=dn(),t.pem=fn()})),mn=n(((e,t)=>{var n=d(),r=a().Buffer,i=_n(),o=i.base,s=i.constants.der;function c(e){this.enc=`der`,this.name=e.name,this.entity=e,this.tree=new l,this.tree._init(e.body)}t.exports=c,c.prototype.encode=function(e,t){return this.tree._encode(e,t).join()};function l(e){o.Node.call(this,`der`,e)}n(l,o.Node),l.prototype._encodeComposite=function(e,t,n,i){var a=f(e,t,n,this.reporter);if(i.length<128){var o=new r(2);return o[0]=a,o[1]=i.length,this._createEncoderBuffer([o,i])}for(var s=1,c=i.length;c>=256;c>>=8)s++;var o=new r(2+s);o[0]=a,o[1]=128|s;for(var c=1+s,l=i.length;l>0;c--,l>>=8)o[c]=l&255;return this._createEncoderBuffer([o,i])},l.prototype._encodeStr=function(e,t){if(t===`bitstr`)return this._createEncoderBuffer([e.unused|0,e.data]);if(t===`bmpstr`){for(var n=new r(e.length*2),i=0;i<e.length;i++)n.writeUInt16BE(e.charCodeAt(i),i*2);return this._createEncoderBuffer(n)}else if(t===`numstr`)return this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error(`Encoding of string type: numstr supports only digits and space`);else if(t===`printstr`)return this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error(`Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark`);else if(/str$/.test(t))return this._createEncoderBuffer(e);else if(t===`objDesc`)return this._createEncoderBuffer(e);else return this.reporter.error(`Encoding of string type: `+t+` unsupported`)},l.prototype._encodeObjid=function(e,t,n){if(typeof e==`string`){if(!t)return this.reporter.error(`string objid given, but no values map found`);if(!t.hasOwnProperty(e))return this.reporter.error(`objid not found in values map`);e=t[e].split(/[\s\.]+/g);for(var i=0;i<e.length;i++)e[i]|=0}else if(Array.isArray(e)){e=e.slice();for(var i=0;i<e.length;i++)e[i]|=0}if(!Array.isArray(e))return this.reporter.error(`objid() should be either array or string, got: `+JSON.stringify(e));if(!n){if(e[1]>=40)return this.reporter.error(`Second objid identifier OOB`);e.splice(0,2,e[0]*40+e[1])}for(var a=0,i=0;i<e.length;i++){var o=e[i];for(a++;o>=128;o>>=7)a++}for(var s=new r(a),c=s.length-1,i=e.length-1;i>=0;i--){var o=e[i];for(s[c--]=o&127;(o>>=7)>0;)s[c--]=128|o&127}return this._createEncoderBuffer(s)};function u(e){return e<10?`0`+e:e}l.prototype._encodeTime=function(e,t){var n,r=new Date(e);return t===`gentime`?n=[u(r.getFullYear()),u(r.getUTCMonth()+1),u(r.getUTCDate()),u(r.getUTCHours()),u(r.getUTCMinutes()),u(r.getUTCSeconds()),`Z`].join(``):t===`utctime`?n=[u(r.getFullYear()%100),u(r.getUTCMonth()+1),u(r.getUTCDate()),u(r.getUTCHours()),u(r.getUTCMinutes()),u(r.getUTCSeconds()),`Z`].join(``):this.reporter.error(`Encoding `+t+` time is not supported yet`),this._encodeStr(n,`octstr`)},l.prototype._encodeNull=function(){return this._createEncoderBuffer(``)},l.prototype._encodeInt=function(e,t){if(typeof e==`string`){if(!t)return this.reporter.error(`String int or enum given, but no values map`);if(!t.hasOwnProperty(e))return this.reporter.error(`Values map doesn't contain: `+JSON.stringify(e));e=t[e]}if(typeof e!=`number`&&!r.isBuffer(e)){var n=e.toArray();!e.sign&&n[0]&128&&n.unshift(0),e=new r(n)}if(r.isBuffer(e)){var i=e.length;e.length===0&&i++;var a=new r(i);return e.copy(a),e.length===0&&(a[0]=0),this._createEncoderBuffer(a)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);for(var i=1,o=e;o>=256;o>>=8)i++;for(var a=Array(i),o=a.length-1;o>=0;o--)a[o]=e&255,e>>=8;return a[0]&128&&a.unshift(0),this._createEncoderBuffer(new r(a))},l.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},l.prototype._use=function(e,t){return typeof e==`function`&&(e=e(t)),e._getEncoder(`der`).tree},l.prototype._skipDefault=function(e,t,n){var r=this._baseState,i;if(r.default===null)return!1;var a=e.join();if(r.defaultBuffer===void 0&&(r.defaultBuffer=this._encodeValue(r.default,t,n).join()),a.length!==r.defaultBuffer.length)return!1;for(i=0;i<a.length;i++)if(a[i]!==r.defaultBuffer[i])return!1;return!0};function f(e,t,n,r){var i;if(e===`seqof`?e=`seq`:e===`setof`&&(e=`set`),s.tagByName.hasOwnProperty(e))i=s.tagByName[e];else if(typeof e==`number`&&(e|0)===e)i=e;else return r.error(`Unknown tag: `+e);return i>=31?r.error(`Multi-octet tag encoding unsupported`):(t||(i|=32),i|=s.tagClassByName[n||`universal`]<<6,i)}})),hn=n(((e,t)=>{var n=d(),r=mn();function i(e){r.call(this,e),this.enc=`pem`}n(i,r),t.exports=i,i.prototype.encode=function(e,t){for(var n=r.prototype.encode.call(this,e).toString(`base64`),i=[`-----BEGIN `+t.label+`-----`],a=0;a<n.length;a+=64)i.push(n.slice(a,a+64));return i.push(`-----END `+t.label+`-----`),i.join(`
|
|
7
|
+
`)}})),gn=n((e=>{var t=e;t.der=mn(),t.pem=hn()})),_n=n((e=>{var t=e;t.bignum=et(),t.define=rn().define,t.base=cn(),t.constants=un(),t.decoders=pn(),t.encoders=gn()})),vn=n(((e,t)=>{var n=_n(),r=n.define(`Time`,function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),i=n.define(`AttributeTypeValue`,function(){this.seq().obj(this.key(`type`).objid(),this.key(`value`).any())}),a=n.define(`AlgorithmIdentifier`,function(){this.seq().obj(this.key(`algorithm`).objid(),this.key(`parameters`).optional(),this.key(`curve`).objid().optional())}),o=n.define(`SubjectPublicKeyInfo`,function(){this.seq().obj(this.key(`algorithm`).use(a),this.key(`subjectPublicKey`).bitstr())}),s=n.define(`RelativeDistinguishedName`,function(){this.setof(i)}),c=n.define(`RDNSequence`,function(){this.seqof(s)}),l=n.define(`Name`,function(){this.choice({rdnSequence:this.use(c)})}),u=n.define(`Validity`,function(){this.seq().obj(this.key(`notBefore`).use(r),this.key(`notAfter`).use(r))}),d=n.define(`Extension`,function(){this.seq().obj(this.key(`extnID`).objid(),this.key(`critical`).bool().def(!1),this.key(`extnValue`).octstr())}),f=n.define(`TBSCertificate`,function(){this.seq().obj(this.key(`version`).explicit(0).int().optional(),this.key(`serialNumber`).int(),this.key(`signature`).use(a),this.key(`issuer`).use(l),this.key(`validity`).use(u),this.key(`subject`).use(l),this.key(`subjectPublicKeyInfo`).use(o),this.key(`issuerUniqueID`).implicit(1).bitstr().optional(),this.key(`subjectUniqueID`).implicit(2).bitstr().optional(),this.key(`extensions`).explicit(3).seqof(d).optional())});t.exports=n.define(`X509Certificate`,function(){this.seq().obj(this.key(`tbsCertificate`).use(f),this.key(`signatureAlgorithm`).use(a),this.key(`signatureValue`).bitstr())})})),yn=n((e=>{var t=_n();e.certificate=vn(),e.RSAPrivateKey=t.define(`RSAPrivateKey`,function(){this.seq().obj(this.key(`version`).int(),this.key(`modulus`).int(),this.key(`publicExponent`).int(),this.key(`privateExponent`).int(),this.key(`prime1`).int(),this.key(`prime2`).int(),this.key(`exponent1`).int(),this.key(`exponent2`).int(),this.key(`coefficient`).int())}),e.RSAPublicKey=t.define(`RSAPublicKey`,function(){this.seq().obj(this.key(`modulus`).int(),this.key(`publicExponent`).int())});var n=t.define(`AlgorithmIdentifier`,function(){this.seq().obj(this.key(`algorithm`).objid(),this.key(`none`).null_().optional(),this.key(`curve`).objid().optional(),this.key(`params`).seq().obj(this.key(`p`).int(),this.key(`q`).int(),this.key(`g`).int()).optional())});e.PublicKey=t.define(`SubjectPublicKeyInfo`,function(){this.seq().obj(this.key(`algorithm`).use(n),this.key(`subjectPublicKey`).bitstr())}),e.PrivateKey=t.define(`PrivateKeyInfo`,function(){this.seq().obj(this.key(`version`).int(),this.key(`algorithm`).use(n),this.key(`subjectPrivateKey`).octstr())}),e.EncryptedPrivateKey=t.define(`EncryptedPrivateKeyInfo`,function(){this.seq().obj(this.key(`algorithm`).seq().obj(this.key(`id`).objid(),this.key(`decrypt`).seq().obj(this.key(`kde`).seq().obj(this.key(`id`).objid(),this.key(`kdeparams`).seq().obj(this.key(`salt`).octstr(),this.key(`iters`).int())),this.key(`cipher`).seq().obj(this.key(`algo`).objid(),this.key(`iv`).octstr()))),this.key(`subjectPrivateKey`).octstr())}),e.DSAPrivateKey=t.define(`DSAPrivateKey`,function(){this.seq().obj(this.key(`version`).int(),this.key(`p`).int(),this.key(`q`).int(),this.key(`g`).int(),this.key(`pub_key`).int(),this.key(`priv_key`).int())}),e.DSAparam=t.define(`DSAparam`,function(){this.int()});var r=t.define(`ECParameters`,function(){this.choice({namedCurve:this.objid()})});e.ECPrivateKey=t.define(`ECPrivateKey`,function(){this.seq().obj(this.key(`version`).int(),this.key(`privateKey`).octstr(),this.key(`parameters`).optional().explicit(0).use(r),this.key(`publicKey`).optional().explicit(1).bitstr())}),e.signature=t.define(`signature`,function(){this.seq().obj(this.key(`r`).int(),this.key(`s`).int())})})),$=n(((e,t)=>{t.exports={"2.16.840.1.101.3.4.1.1":`aes-128-ecb`,"2.16.840.1.101.3.4.1.2":`aes-128-cbc`,"2.16.840.1.101.3.4.1.3":`aes-128-ofb`,"2.16.840.1.101.3.4.1.4":`aes-128-cfb`,"2.16.840.1.101.3.4.1.21":`aes-192-ecb`,"2.16.840.1.101.3.4.1.22":`aes-192-cbc`,"2.16.840.1.101.3.4.1.23":`aes-192-ofb`,"2.16.840.1.101.3.4.1.24":`aes-192-cfb`,"2.16.840.1.101.3.4.1.41":`aes-256-ecb`,"2.16.840.1.101.3.4.1.42":`aes-256-cbc`,"2.16.840.1.101.3.4.1.43":`aes-256-ofb`,"2.16.840.1.101.3.4.1.44":`aes-256-cfb`}})),bn=n(((e,t)=>{var n=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,r=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,a=qe(),o=Xe(),s=_().Buffer;t.exports=function(e,t){var c=e.toString(),l=c.match(n),u;if(l){var d=`aes`+l[1],f=s.from(l[2],`hex`),p=s.from(l[3].replace(/[\r\n]/g,``),`base64`),m=a(t,f.slice(0,8),parseInt(l[1],10)).key,h=[],g=o.createDecipheriv(d,m,f);h.push(g.update(p)),h.push(g.final()),u=s.concat(h)}else{var _=c.match(i);u=s.from(_[2].replace(/[\r\n]/g,``),`base64`)}return{tag:c.match(r)[1],data:u}}})),xn=n(((e,t)=>{var n=yn(),r=$(),i=bn(),a=Xe(),o=we().pbkdf2Sync,s=_().Buffer;function c(e,t){var n=e.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),c=r[e.algorithm.decrypt.cipher.algo.join(`.`)],l=e.algorithm.decrypt.cipher.iv,u=e.subjectPrivateKey,d=o(t,n,i,parseInt(c.split(`-`)[1],10)/8,`sha1`),f=a.createDecipheriv(c,d,l),p=[];return p.push(f.update(u)),p.push(f.final()),s.concat(p)}function l(e){var t;typeof e==`object`&&!s.isBuffer(e)&&(t=e.passphrase,e=e.key),typeof e==`string`&&(e=s.from(e));var r=i(e,t),a=r.tag,o=r.data,l,u;switch(a){case`CERTIFICATE`:u=n.certificate.decode(o,`der`).tbsCertificate.subjectPublicKeyInfo;case`PUBLIC KEY`:switch(u||=n.PublicKey.decode(o,`der`),l=u.algorithm.algorithm.join(`.`),l){case`1.2.840.113549.1.1.1`:return n.RSAPublicKey.decode(u.subjectPublicKey.data,`der`);case`1.2.840.10045.2.1`:return u.subjectPrivateKey=u.subjectPublicKey,{type:`ec`,data:u};case`1.2.840.10040.4.1`:return u.algorithm.params.pub_key=n.DSAparam.decode(u.subjectPublicKey.data,`der`),{type:`dsa`,data:u.algorithm.params};default:throw Error(`unknown key id `+l)}case`ENCRYPTED PRIVATE KEY`:o=n.EncryptedPrivateKey.decode(o,`der`),o=c(o,t);case`PRIVATE KEY`:switch(u=n.PrivateKey.decode(o,`der`),l=u.algorithm.algorithm.join(`.`),l){case`1.2.840.113549.1.1.1`:return n.RSAPrivateKey.decode(u.subjectPrivateKey,`der`);case`1.2.840.10045.2.1`:return{curve:u.algorithm.curve,privateKey:n.ECPrivateKey.decode(u.subjectPrivateKey,`der`).privateKey};case`1.2.840.10040.4.1`:return u.algorithm.params.priv_key=n.DSAparam.decode(u.subjectPrivateKey,`der`),{type:`dsa`,params:u.algorithm.params};default:throw Error(`unknown key id `+l)}case`RSA PUBLIC KEY`:return n.RSAPublicKey.decode(o,`der`);case`RSA PRIVATE KEY`:return n.RSAPrivateKey.decode(o,`der`);case`DSA PRIVATE KEY`:return{type:`dsa`,params:n.DSAPrivateKey.decode(o,`der`)};case`EC PRIVATE KEY`:return o=n.ECPrivateKey.decode(o,`der`),{curve:o.parameters.value,privateKey:o.privateKey};default:throw Error(`unknown key type `+a)}}l.signature=n.signature,t.exports=l})),Sn=n(((e,t)=>{t.exports={"1.3.132.0.10":`secp256k1`,"1.3.132.0.33":`p224`,"1.2.840.10045.3.1.1":`p192`,"1.2.840.10045.3.1.7":`p256`,"1.3.132.0.34":`p384`,"1.3.132.0.35":`p521`}})),Cn=n(((e,t)=>{var n=_().Buffer,r=ge(),i=wt(),a=en().ec,o=nn(),s=xn(),c=Sn(),l=1;function u(e,t,r,a,o){var c=s(t);if(c.curve){if(a!==`ecdsa`&&a!==`ecdsa/rsa`)throw Error(`wrong private key type`);return d(e,c)}else if(c.type===`dsa`){if(a!==`dsa`)throw Error(`wrong private key type`);return f(e,c,r)}if(a!==`rsa`&&a!==`ecdsa/rsa`)throw Error(`wrong private key type`);if(t.padding!==void 0&&t.padding!==l)throw Error(`illegal or unsupported padding mode`);e=n.concat([o,e]);for(var u=c.modulus.byteLength(),p=[0,1];e.length+p.length+1<u;)p.push(255);p.push(0);for(var m=-1;++m<e.length;)p.push(e[m]);return i(p,c)}function d(e,t){var r=c[t.curve.join(`.`)];if(!r)throw Error(`unknown curve `+t.curve.join(`.`));var i=new a(r).keyFromPrivate(t.privateKey).sign(e);return n.from(i.toDER())}function f(e,t,n){for(var r=t.params.priv_key,i=t.params.p,a=t.params.q,s=t.params.g,c=new o(0),l,u=h(e,a).mod(a),d=!1,f=m(r,a,e,n);d===!1;)l=v(a,f,n),c=y(s,l,i,a),d=l.invm(a).imul(u.add(r.mul(c))).mod(a),d.cmpn(0)===0&&(d=!1,c=new o(0));return p(c,d)}function p(e,t){e=e.toArray(),t=t.toArray(),e[0]&128&&(e=[0].concat(e)),t[0]&128&&(t=[0].concat(t));var r=[48,e.length+t.length+4,2,e.length];return r=r.concat(e,[2,t.length],t),n.from(r)}function m(e,t,i,a){if(e=n.from(e.toArray()),e.length<t.byteLength()){var o=n.alloc(t.byteLength()-e.length);e=n.concat([o,e])}var s=i.length,c=g(i,t),l=n.alloc(s);l.fill(1);var u=n.alloc(s);return u=r(a,u).update(l).update(n.from([0])).update(e).update(c).digest(),l=r(a,u).update(l).digest(),u=r(a,u).update(l).update(n.from([1])).update(e).update(c).digest(),l=r(a,u).update(l).digest(),{k:u,v:l}}function h(e,t){var n=new o(e),r=(e.length<<3)-t.bitLength();return r>0&&n.ishrn(r),n}function g(e,t){e=h(e,t),e=e.mod(t);var r=n.from(e.toArray());if(r.length<t.byteLength()){var i=n.alloc(t.byteLength()-r.length);r=n.concat([i,r])}return r}function v(e,t,i){var a,o;do{for(a=n.alloc(0);a.length*8<e.bitLength();)t.v=r(i,t.k).update(t.v).digest(),a=n.concat([a,t.v]);o=h(a,e),t.k=r(i,t.k).update(t.v).update(n.from([0])).digest(),t.v=r(i,t.k).update(t.v).digest()}while(o.cmp(e)!==-1);return o}function y(e,t,n,r){return e.toRed(o.mont(n)).redPow(t).fromRed().mod(r)}t.exports=u,t.exports.getKey=m,t.exports.makeKey=v})),wn=n(((e,t)=>{var n=_().Buffer,r=nn(),i=en().ec,a=xn(),o=Sn();function s(e,t,i,o,s){var u=a(i);if(u.type===`ec`){if(o!==`ecdsa`&&o!==`ecdsa/rsa`)throw Error(`wrong public key type`);return c(e,t,u)}else if(u.type===`dsa`){if(o!==`dsa`)throw Error(`wrong public key type`);return l(e,t,u)}if(o!==`rsa`&&o!==`ecdsa/rsa`)throw Error(`wrong public key type`);t=n.concat([s,t]);for(var d=u.modulus.byteLength(),f=[1],p=0;t.length+f.length+2<d;)f.push(255),p+=1;f.push(0);for(var m=-1;++m<t.length;)f.push(t[m]);f=n.from(f);var h=r.mont(u.modulus);e=new r(e).toRed(h),e=e.redPow(new r(u.publicExponent)),e=n.from(e.fromRed().toArray());var g=+(p<8);for(d=Math.min(e.length,f.length),e.length!==f.length&&(g=1),m=-1;++m<d;)g|=e[m]^f[m];return g===0}function c(e,t,n){var r=o[n.data.algorithm.curve.join(`.`)];if(!r)throw Error(`unknown curve `+n.data.algorithm.curve.join(`.`));var a=new i(r),s=n.data.subjectPrivateKey.data;return a.verify(t,e,s)}function l(e,t,n){var i=n.data.p,o=n.data.q,s=n.data.g,c=n.data.pub_key,l=a.signature.decode(e,`der`),d=l.s,f=l.r;u(d,o),u(f,o);var p=r.mont(i),m=d.invm(o);return s.toRed(p).redPow(new r(t).mul(m).mod(o)).fromRed().mul(c.toRed(p).redPow(f.mul(m).mod(o)).fromRed()).mod(i).mod(o).cmp(f)===0}function u(e,t){if(e.cmpn(0)<=0||e.cmp(t)>=0)throw Error(`invalid sig`)}t.exports=s})),Tn=n(((e,t)=>{var n=_().Buffer,r=X(),i=xt(),a=d(),o=Cn(),s=wn(),c=_e();Object.keys(c).forEach(function(e){c[e].id=n.from(c[e].id,`hex`),c[e.toLowerCase()]=c[e]});function l(e){i.Writable.call(this);var t=c[e];if(!t)throw Error(`Unknown message digest`);this._hashType=t.hash,this._hash=r(t.hash),this._tag=t.id,this._signType=t.sign}a(l,i.Writable),l.prototype._write=function(e,t,n){this._hash.update(e),n()},l.prototype.update=function(e,t){return this._hash.update(typeof e==`string`?n.from(e,t):e),this},l.prototype.sign=function(e,t){this.end();var n=o(this._hash.digest(),e,this._hashType,this._signType,this._tag);return t?n.toString(t):n};function u(e){i.Writable.call(this);var t=c[e];if(!t)throw Error(`Unknown message digest`);this._hash=r(t.hash),this._tag=t.id,this._signType=t.sign}a(u,i.Writable),u.prototype._write=function(e,t,n){this._hash.update(e),n()},u.prototype.update=function(e,t){return this._hash.update(typeof e==`string`?n.from(e,t):e),this},u.prototype.verify=function(e,t,r){var i=typeof t==`string`?n.from(t,r):t;return this.end(),s(i,this._hash.digest(),e,this._signType,this._tag)};function f(e){return new l(e)}function p(e){return new u(e)}t.exports={Sign:f,Verify:p,createSign:f,createVerify:p}})),En=n(((e,t)=>{var n=a(),r=en(),i=et();t.exports=function(e){return new s(e)};var o={secp256k1:{name:`secp256k1`,byteLength:32},secp224r1:{name:`p224`,byteLength:28},prime256v1:{name:`p256`,byteLength:32},prime192v1:{name:`p192`,byteLength:24},ed25519:{name:`ed25519`,byteLength:32},secp384r1:{name:`p384`,byteLength:48},secp521r1:{name:`p521`,byteLength:66}};o.p224=o.secp224r1,o.p256=o.secp256r1=o.prime256v1,o.p192=o.secp192r1=o.prime192v1,o.p384=o.secp384r1,o.p521=o.secp521r1;function s(e){this.curveType=o[e],this.curveType||={name:e},this.curve=new r.ec(this.curveType.name),this.keys=void 0}s.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},s.prototype.computeSecret=function(e,t,r){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),c(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},s.prototype.getPublicKey=function(e,t){var n=this.keys.getPublic(t===`compressed`,!0);return t===`hybrid`&&(n[n.length-1]%2?n[0]=7:n[0]=6),c(n,e)},s.prototype.getPrivateKey=function(e){return c(this.keys.getPrivate(),e)},s.prototype.setPublicKey=function(e,t){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),this.keys._importPublic(e),this},s.prototype.setPrivateKey=function(e,t){t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t));var r=new i(e);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this};function c(e,t,r){Array.isArray(e)||(e=e.toArray());var i=new n.Buffer(e);if(r&&i.length<r){var a=new n.Buffer(r-i.length);a.fill(0),i=n.Buffer.concat([a,i])}return t?i.toString(t):i}})),Dn=n(((e,t)=>{var n=X(),r=_().Buffer;t.exports=function(e,t){for(var a=r.alloc(0),o=0,s;a.length<t;)s=i(o++),a=r.concat([a,n(`sha1`).update(e).update(s).digest()]);return a.slice(0,t)};function i(e){var t=r.allocUnsafe(4);return t.writeUInt32BE(e,0),t}})),On=n(((e,t)=>{t.exports=function(e,t){for(var n=e.length,r=-1;++r<n;)e[r]^=t[r];return e}})),kn=n(((e,t)=>{var n=et(),r=_().Buffer;function i(e,t){return r.from(e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed().toArray())}t.exports=i})),An=n(((e,t)=>{var n=xn(),r=N(),i=X(),a=Dn(),o=On(),s=et(),c=kn(),l=wt(),u=_().Buffer;t.exports=function(e,t,r){var i=e.padding?e.padding:r?1:4,a=n(e),o;if(i===4)o=d(a,t);else if(i===1)o=f(a,t,r);else if(i===3){if(o=new s(t),o.cmp(a.modulus)>=0)throw Error(`data too long for modulus`)}else throw Error(`unknown padding`);return r?l(o,a):c(o,a)};function d(e,t){var n=e.modulus.byteLength(),c=t.length,l=i(`sha1`).update(u.alloc(0)).digest(),d=l.length,f=2*d;if(c>n-f-2)throw Error(`message too long`);var p=u.alloc(n-c-f-2),m=n-d-1,h=r(d),g=o(u.concat([l,p,u.alloc(1,1),t],m),a(h,m)),_=o(h,a(g,d));return new s(u.concat([u.alloc(1),_,g],n))}function f(e,t,n){var r=t.length,i=e.modulus.byteLength();if(r>i-11)throw Error(`message too long`);var a=n?u.alloc(i-r-3,255):p(i-r-3);return new s(u.concat([u.from([0,n?1:2]),a,u.alloc(1),t],i))}function p(e){for(var t=u.allocUnsafe(e),n=0,i=r(e*2),a=0,o;n<e;)a===i.length&&(i=r(e*2),a=0),o=i[a++],o&&(t[n++]=o);return t}})),jn=n(((e,t)=>{var n=xn(),r=Dn(),i=On(),a=et(),o=wt(),s=X(),c=kn(),l=_().Buffer;t.exports=function(e,t,r){var i=e.padding?e.padding:r?1:4,s=n(e),f=s.modulus.byteLength();if(t.length>f||new a(t).cmp(s.modulus)>=0)throw Error(`decryption error`);var p=r?c(new a(t),s):o(t,s),m=l.alloc(f-p.length);if(p=l.concat([m,p],f),i===4)return u(s,p);if(i===1)return d(s,p,r);if(i===3)return p;throw Error(`unknown padding`)};function u(e,t){var n=e.modulus.byteLength(),a=s(`sha1`).update(l.alloc(0)).digest(),o=a.length;if(t[0]!==0)throw Error(`decryption error`);var c=t.slice(1,o+1),u=t.slice(o+1),d=i(u,r(i(c,r(u,o)),n-o-1));if(f(a,d.slice(0,o)))throw Error(`decryption error`);for(var p=o;d[p]===0;)p++;if(d[p++]!==1)throw Error(`decryption error`);return d.slice(p)}function d(e,t,n){for(var r=t.slice(0,2),i=2,a=0;t[i++]!==0;)if(i>=t.length){a++;break}var o=t.slice(2,i-1);if((r.toString(`hex`)!==`0002`&&!n||r.toString(`hex`)!==`0001`&&n)&&a++,o.length<8&&a++,a)throw Error(`decryption error`);return t.slice(i)}function f(e,t){e=l.from(e),t=l.from(t);var n=0,r=e.length;e.length!==t.length&&(n++,r=Math.min(e.length,t.length));for(var i=-1;++i<r;)n+=e[i]^t[i];return n}})),Mn=n((e=>{e.publicEncrypt=An(),e.privateDecrypt=jn(),e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}})),Nn=n((t=>{var n=e(x());function r(){throw Error(`secure random number generation not supported by this browser
|
|
8
|
+
use chrome, FireFox or Internet Explorer 11`)}var i=_(),a=N(),o=i.Buffer,s=i.kMaxLength,c=globalThis.crypto||globalThis.msCrypto,l=2**32-1;function u(e,t){if(typeof e!=`number`||e!==e)throw TypeError(`offset must be a number`);if(e>l||e<0)throw TypeError(`offset must be a uint32`);if(e>s||e>t)throw RangeError(`offset out of range`)}function d(e,t,n){if(typeof e!=`number`||e!==e)throw TypeError(`size must be a number`);if(e>l||e<0)throw TypeError(`size must be a uint32`);if(e+t>n||e>s)throw RangeError(`buffer too small`)}c&&c.getRandomValues||!n.default.browser?(t.randomFill=f,t.randomFillSync=m):(t.randomFill=r,t.randomFillSync=r);function f(e,t,n,r){if(!o.isBuffer(e)&&!(e instanceof globalThis.Uint8Array))throw TypeError(`"buf" argument must be a Buffer or Uint8Array`);if(typeof t==`function`)r=t,t=0,n=e.length;else if(typeof n==`function`)r=n,n=e.length-t;else if(typeof r!=`function`)throw TypeError(`"cb" argument must be a function`);return u(t,e.length),d(n,t,e.length),p(e,t,n,r)}function p(e,t,r,i){if(n.default.browser){var o=e.buffer,s=new Uint8Array(o,t,r);if(c.getRandomValues(s),i){n.default.nextTick(function(){i(null,e)});return}return e}if(i){a(r,function(n,r){if(n)return i(n);r.copy(e,t),i(null,e)});return}return a(r).copy(e,t),e}function m(e,t,n){if(t===void 0&&(t=0),!o.isBuffer(e)&&!(e instanceof globalThis.Uint8Array))throw TypeError(`"buf" argument must be a Buffer or Uint8Array`);return u(t,e.length),n===void 0&&(n=e.length-t),d(n,t,e.length),p(e,t,n)}})),Pn=n((e=>{e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=N(),e.createHash=e.Hash=X(),e.createHmac=e.Hmac=ge();var t=ve(),n=Object.keys(t),r=[`sha1`,`sha224`,`sha256`,`sha384`,`sha512`,`md5`,`rmd160`].concat(n);e.getHashes=function(){return r};var i=we();e.pbkdf2=i.pbkdf2,e.pbkdf2Sync=i.pbkdf2Sync;var a=Qe();e.Cipher=a.Cipher,e.createCipher=a.createCipher,e.Cipheriv=a.Cipheriv,e.createCipheriv=a.createCipheriv,e.Decipher=a.Decipher,e.createDecipher=a.createDecipher,e.Decipheriv=a.Decipheriv,e.createDecipheriv=a.createDecipheriv,e.getCiphers=a.getCiphers,e.listCiphers=a.listCiphers;var o=ot();e.DiffieHellmanGroup=o.DiffieHellmanGroup,e.createDiffieHellmanGroup=o.createDiffieHellmanGroup,e.getDiffieHellman=o.getDiffieHellman,e.createDiffieHellman=o.createDiffieHellman,e.DiffieHellman=o.DiffieHellman;var s=Tn();e.createSign=s.createSign,e.Sign=s.Sign,e.createVerify=s.createVerify,e.Verify=s.Verify,e.createECDH=En();var c=Mn();e.publicEncrypt=c.publicEncrypt,e.privateEncrypt=c.privateEncrypt,e.publicDecrypt=c.publicDecrypt,e.privateDecrypt=c.privateDecrypt;var l=Nn();e.randomFill=l.randomFill,e.randomFillSync=l.randomFillSync,e.createCredentials=function(){throw Error(`sorry, createCredentials is not implemented yet
|
|
9
9
|
we accept pull requests
|
|
10
|
-
https://github.com/browserify/crypto-browserify`)},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}})),Fn=n(((e,t)=>{let n=(e,t)=>function(...n){let r=t.promiseModule;return new r((r,i)=>{t.multiArgs?n.push((...e)=>{t.errorFirst?e[0]?i(e):(e.shift(),r(e)):r(e)}):t.errorFirst?n.push((e,t)=>{e?i(e):r(t)}):n.push(r),e.apply(this,n)})};t.exports=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);let r=typeof e;if(!(e!==null&&(r===`object`||r===`function`)))throw TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${e===null?`null`:r}\``);let i=e=>{let n=t=>typeof t==`string`?e===t:t.test(e);return t.include?t.include.some(n):!t.exclude.some(n)},a;a=r===`function`?function(...r){return t.excludeMain?e(...r):n(e,t).apply(this,r)}:Object.create(Object.getPrototypeOf(e));for(let r in e){let o=e[r];a[r]=typeof o==`function`&&i(r)?n(o,t):o}return a}})),In=n(((t,n)=>{var i=e(r());function a(e){return Array.isArray(e)?e:[e]}let o=/^\s+$/,s=/(?:[^\\]|^)\\$/,c=/^\\!/,l=/^\\#/,u=/\r?\n/g,d=/^\.*\/|^\.+$/,f=`node-ignore`;typeof Symbol<`u`&&(f=Symbol.for(`node-ignore`));let p=f,m=(e,t,n)=>Object.defineProperty(e,t,{value:n}),h=/([0-z])-([0-z])/g,g=()=>!1,_=e=>e.replace(h,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),v=e=>{let{length:t}=e;return e.slice(0,t-t%2)},y=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${v(r)}${i}`:i===`]`&&r.length%2==0?`[${_(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],b=Object.create(null),x=(e,t)=>{let n=b[e];return n||(n=y.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),b[e]=n),t?new RegExp(n,`i`):new RegExp(n)},S=e=>typeof e==`string`,C=e=>e&&S(e)&&!o.test(e)&&!s.test(e)&&e.indexOf(`#`)!==0,w=e=>e.split(u);var T=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}};let E=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(c,`!`).replace(l,`#`);let i=x(e,t);return new T(n,e,r,i)},D=(e,t)=>{throw new t(e)},O=(e,t,n)=>S(e)?e?!O.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),k=e=>d.test(e);O.isNotRelative=k,O.convert=e=>e;var A=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){m(this,p,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[p]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(C(e)){let t=E(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,a(S(e)?w(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&O.convert(e);return O(i,e,this._allowRelativePaths?g:D),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return a(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let ee=e=>new A(e);if(ee.isPathValid=e=>O(e&&O.convert(e),e,g),ee.default=ee,n.exports=ee,i.default!==void 0&&(i.default.env&&i.default.env.IGNORE_TEST_WIN32||i.default.platform===`win32`)){O.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;O.isNotRelative=t=>e.test(t)||k(t)}})),Ln=n(((e,t)=>{function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function r(e,t,r){return t=t instanceof RegExp?t:new RegExp(n(t),`g`),e.replace(t,r)}t.exports={clean:function(e){if(typeof e!=`string`)throw Error(`Expected a string, received: `+e);return e=r(e,`./`,`/`),e=r(e,`..`,`.`),e=r(e,` `,`-`),e=r(e,/^[~^:?*\\\-]/g,``),e=r(e,/[~^:?*\\]/g,`-`),e=r(e,/[~^:?*\\\-]$/g,``),e=r(e,`@{`,`-`),e=r(e,/\.$/g,``),e=r(e,/\/$/g,``),e=r(e,/\.lock$/g,``),e}}})),Rn=n(((e,t)=>{t.exports=function(e,t){var n=e,r=t,i=n.length,a=r.length,o=!1,s=null,c=i+1,l=[],u=[],d=[],f=``,p=-1,m=0,h=1,g,_,v=function(){i>=a&&(g=n,_=i,n=r,r=g,i=a,a=_,o=!0,c=i+1)},y=function(e,t,n){return{x:e,y:t,k:n}},b=function(e,t){return{elem:e,t}},x=function(e,t,o){var s=t>o?l[e-1+c]:l[e+1+c],d,f=Math.max(t,o);for(d=f-e;d<i&&f<a&&n[d]===r[f];)++d,++f;return l[e+c]=u.length,u[u.length]=new y(d,f,s),f},S=function(e){var t=i=1,i,a=s=0,s,c;for(c=e.length-1;c>=0;--c)for(;a<e[c].x||s<e[c].y;)e[c].y-e[c].x>s-a?(o?d[d.length]=new b(r[s],p):d[d.length]=new b(r[s],h),++i,++s):e[c].y-e[c].x<s-a?(o?d[d.length]=new b(n[a],h):d[d.length]=new b(n[a],p),++t,++a):(d[d.length]=new b(n[a],m),f+=n[a],++t,++i,++a,++s)};return v(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:function(){return s},getlcs:function(){return f},getses:function(){return d},compose:function(){var e=a-i,t=i+a+3,n={},r,o,d,f,p;for(f=0;f<t;++f)n[f]=-1,l[f]=-1;r=-1;do{for(++r,p=-r;p<=e-1;++p)n[p+c]=x(p,n[p-1+c]+1,n[p+1+c]);for(p=e+r;p>=e+1;--p)n[p+c]=x(p,n[p-1+c]+1,n[p+1+c]);n[e+c]=x(e,n[e-1+c]+1,n[e+1+c])}while(n[e+c]!==a);for(s=e+2*r,o=l[e+c],d=[];o!==-1;)d[d.length]=new y(u[o].x,u[o].y,null),o=u[o].k;S(d)}}}})),zn=n(((e,t)=>{var n=Rn();function r(e,t){var r=new n(e,t);r.compose();for(var i=r.getses(),a,o,s=e.length-1,c=t.length-1,l=i.length-1;l>=0;--l)i[l].t===r.SES_COMMON?(o?(o.chain={file1index:s,file2index:c,chain:null},o=o.chain):(a={file1index:s,file2index:c,chain:null},o=a),s--,c--):i[l].t===r.SES_DELETE?s--:i[l].t===r.SES_ADD&&c--;var u={file1index:-1,file2index:-1,chain:null};return o?(o.chain=u,a):u}function i(e,t){for(var n=[],i=e.length,a=t.length,o=r(e,t);o!==null;o=o.chain){var s=i-o.file1index-1,c=a-o.file2index-1;i=o.file1index,a=o.file2index,(s||c)&&n.push({file1:[i+1,s],file2:[a+1,c]})}return n.reverse(),n}function a(e,t,n){var r,a=i(t,e),o=i(t,n),s=[];function c(e,t){s.push([e.file1[0],t,e.file1[1],e.file2[0],e.file2[1]])}for(r=0;r<a.length;r++)c(a[r],0);for(r=0;r<o.length;r++)c(o[r],2);s.sort(function(e,t){return e[0]-t[0]});var l=[],u=0;function d(e){e>u&&(l.push([1,u,e-u]),u=e)}for(var f=0;f<s.length;f++){for(var p=f,m=s[f],h=m[0],g=h+m[2];f<s.length-1;){var _=s[f+1],v=_[0];if(v>g)break;g=Math.max(g,v+_[2]),f++}if(d(h),p==f)m[4]>0&&l.push([m[1],m[3],m[4]]);else{var y={0:[e.length,-1,t.length,-1],2:[n.length,-1,t.length,-1]};for(r=p;r<=f;r++){m=s[r];var b=y[m[1]],x=m[0],S=x+m[2],C=m[3],w=C+m[4];b[0]=Math.min(C,b[0]),b[1]=Math.max(w,b[1]),b[2]=Math.min(x,b[2]),b[3]=Math.max(S,b[3])}var T=y[0][0]+(h-y[0][2]),E=y[0][1]+(g-y[0][3]),D=y[2][0]+(h-y[2][2]),O=y[2][1]+(g-y[2][3]);l.push([-1,T,E-T,h,g-h,D,O-D])}u=g}return d(t.length),l}function o(e,t,n){var r=[],i=[e,t,n],o=a(e,t,n),s=[];function c(){s.length&&r.push({ok:s}),s=[]}function l(e){for(var t=0;t<e.length;t++)s.push(e[t])}function u(t){if(t[2]!=t[6])return!0;for(var r=t[1],i=t[5],a=0;a<t[2];a++)if(e[a+r]!=n[a+i])return!0;return!1}for(var d=0;d<o.length;d++){var f=o[d],p=f[0];p==-1?u(f)?(c(),r.push({conflict:{a:e.slice(f[1],f[1]+f[2]),aIndex:f[1],o:t.slice(f[3],f[3]+f[4]),oIndex:f[3],b:n.slice(f[5],f[5]+f[6]),bIndex:f[5]}})):l(i[0].slice(f[1],f[1]+f[2])):l(i[p].slice(f[1],f[1]+f[2]))}return c(),r}t.exports=o})),Bn=e(n((t=>{var n=e(r()),i=l();Object.defineProperty(t,"__esModule",{value:!0});function a(e){return e&&typeof e==`object`&&`default`in e?e.default:e}var o=a(C()),s=a(O()),c=a(k()),u=a(te()),d=Pn(),f=a(Fn()),p=a(In()),m=a(Ln()),h=a(zn()),g=class e extends Error{constructor(e){super(e),this.caller=``}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(t){let n=new e(t.message);return n.code=t.code,n.data=t.data,n.caller=t.caller,n.stack=t.stack,n}get isIsomorphicGitError(){return!0}},_=class e extends g{constructor(t){super(`Modifying the index is not possible because you have unmerged files: ${t.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=e.code,this.data={filepaths:t}}};_.code=`UnmergedPathsError`;var v=class e extends g{constructor(t){super(`An internal error caused this command to fail.\n\nIf you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.\n\nPlease file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${t}`),this.code=this.name=e.code,this.data={message:t}}};v.code=`InternalError`;var y=class e extends g{constructor(t){super(`The filepath "${t}" contains unsafe character sequences`),this.code=this.name=e.code,this.data={filepath:t}}};y.code=`UnsafeFilepathError`;var b=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let t=this.buffer.slice(this._start,this._start+e);return this._start+=e,t}toString(e,t){let n=this.buffer.toString(e,this._start,this._start+t);return this._start+=t,n}write(e,t,n){let r=this.buffer.write(e,this._start,t,n);return this._start+=t,r}copy(e,t,n){let r=e.copy(this.buffer,this._start,t,n);return this._start+=r,r}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let t=this.buffer.writeUInt8(e,this._start);return this._start+=1,t}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let t=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,t}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let t=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,t}};function x(e,t){return-(e<t)||+(e>t)}function S(e,t){return x(e.path,t.path)}function w(e){let t=e>0?e>>12:0;t!==4&&t!==8&&t!==10&&t!==14&&(t=8);let n=e&511;return n=n&73?493:420,t!==8&&(n=0),(t<<12)+n}let T=2**32;function E(e,t,n,r){if(e!==void 0&&t!==void 0)return[e,t];n===void 0&&(n=r.valueOf());let i=Math.floor(n/1e3);return[i,(n-i*1e3)*1e6]}function D(e){let[t,n]=E(e.ctimeSeconds,e.ctimeNanoseconds,e.ctimeMs,e.ctime),[r,i]=E(e.mtimeSeconds,e.mtimeNanoseconds,e.mtimeMs,e.mtime);return{ctimeSeconds:t%T,ctimeNanoseconds:n%T,mtimeSeconds:r%T,mtimeNanoseconds:i%T,dev:e.dev%T,ino:e.ino%T,mode:w(e.mode%T),uid:e.uid%T,gid:e.gid%T,size:e.size>-1?e.size%T:0}}function A(e){let t=``;for(let n of new Uint8Array(e))n<16&&(t+=`0`),t+=n.toString(16);return t}let ee=null;async function j(e){return ee===null&&(ee=await P()),ee?N(e):M(e)}function M(e){return new s().update(e).digest(`hex`)}async function N(e){return A(await crypto.subtle.digest(`SHA-1`,e))}async function P(){try{return await N(new Uint8Array([]))===`da39a3ee5e6b4b0d3255bfef95601890afd80709`}catch{}return!1}function ne(e){return{assumeValid:!!(e&32768),extended:!!(e&16384),stage:(e&12288)>>12,nameLength:e&4095}}function F(e){let t=e.flags;return t.extended=!1,t.nameLength=Math.min(i.Buffer.from(e.path).length,4095),(t.assumeValid?32768:0)+(t.extended?16384:0)+((t.stage&3)<<12)+(t.nameLength&4095)}var I=class e{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let t=this._entries.get(e.path);t||=(this._entries.set(e.path,e),e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(t){if(i.Buffer.isBuffer(t))return e.fromBuffer(t);if(t===null)return new e(null);throw new v(`invalid type passed to GitIndex.from`)}static async fromBuffer(t){if(t.length===0)throw new v(`Index file is empty (.git/index)`);let n=new e,r=new b(t),i=r.toString(`utf8`,4);if(i!==`DIRC`)throw new v(`Invalid dircache magic file number: ${i}`);let a=await j(t.slice(0,-20)),o=t.slice(-20).toString(`hex`);if(o!==a)throw new v(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${a}`);let s=r.readUInt32BE();if(s!==2)throw new v(`Unsupported dircache version: ${s}`);let c=r.readUInt32BE(),l=0;for(;!r.eof()&&l<c;){let e={};e.ctimeSeconds=r.readUInt32BE(),e.ctimeNanoseconds=r.readUInt32BE(),e.mtimeSeconds=r.readUInt32BE(),e.mtimeNanoseconds=r.readUInt32BE(),e.dev=r.readUInt32BE(),e.ino=r.readUInt32BE(),e.mode=r.readUInt32BE(),e.uid=r.readUInt32BE(),e.gid=r.readUInt32BE(),e.size=r.readUInt32BE(),e.oid=r.slice(20).toString(`hex`),e.flags=ne(r.readUInt16BE());let i=t.indexOf(0,r.tell()+1)-r.tell();if(i<1)throw new v(`Got a path length of: ${i}`);if(e.path=r.toString(`utf8`,i),e.path.includes(`..\\`)||e.path.includes(`../`))throw new y(e.path);let a=8-(r.tell()-12)%8;for(a===0&&(a=8);a--;){let t=r.readUInt8();if(t!==0)throw new v(`Expected 1-8 null characters but got '${t}' after ${e.path}`);if(r.eof())throw new v(`Unexpected end of file`)}e.stages=[],n._addEntry(e),l++}return n}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(S)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(e=>e):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:t,oid:n,stage:r=0}){t||={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0},t=D(t);let a=i.Buffer.from(e),o={ctimeSeconds:t.ctimeSeconds,ctimeNanoseconds:t.ctimeNanoseconds,mtimeSeconds:t.mtimeSeconds,mtimeNanoseconds:t.mtimeNanoseconds,dev:t.dev,ino:t.ino,mode:t.mode||33188,uid:t.uid,gid:t.gid,size:t.size,path:e,oid:n,flags:{assumeValid:!1,extended:!1,stage:r,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(o),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let t of this._entries.keys())t.startsWith(e+`/`)&&this._entries.delete(t);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(`
|
|
11
|
-
`)}static async _entryToBuffer(e){let t=
|
|
10
|
+
https://github.com/browserify/crypto-browserify`)},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}})),Fn=n(((e,t)=>{let n=(e,t)=>function(...n){let r=t.promiseModule;return new r((r,i)=>{t.multiArgs?n.push((...e)=>{t.errorFirst?e[0]?i(e):(e.shift(),r(e)):r(e)}):t.errorFirst?n.push((e,t)=>{e?i(e):r(t)}):n.push(r),e.apply(this,n)})};t.exports=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);let r=typeof e;if(!(e!==null&&(r===`object`||r===`function`)))throw TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${e===null?`null`:r}\``);let i=e=>{let n=t=>typeof t==`string`?e===t:t.test(e);return t.include?t.include.some(n):!t.exclude.some(n)},a;a=r===`function`?function(...r){return t.excludeMain?e(...r):n(e,t).apply(this,r)}:Object.create(Object.getPrototypeOf(e));for(let r in e){let o=e[r];a[r]=typeof o==`function`&&i(r)?n(o,t):o}return a}})),In=n(((t,n)=>{var r=e(x());function i(e){return Array.isArray(e)?e:[e]}let a=/^\s+$/,o=/(?:[^\\]|^)\\$/,s=/^\\!/,c=/^\\#/,l=/\r?\n/g,u=/^\.*\/|^\.+$/,d=`node-ignore`;typeof Symbol<`u`&&(d=Symbol.for(`node-ignore`));let f=d,p=(e,t,n)=>Object.defineProperty(e,t,{value:n}),m=/([0-z])-([0-z])/g,h=()=>!1,g=e=>e.replace(m,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),_=e=>{let{length:t}=e;return e.slice(0,t-t%2)},v=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${_(r)}${i}`:i===`]`&&r.length%2==0?`[${g(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],y=Object.create(null),b=(e,t)=>{let n=y[e];return n||(n=v.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),y[e]=n),t?new RegExp(n,`i`):new RegExp(n)},S=e=>typeof e==`string`,C=e=>e&&S(e)&&!a.test(e)&&!o.test(e)&&e.indexOf(`#`)!==0,w=e=>e.split(l);var T=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}};let E=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(s,`!`).replace(c,`#`);let i=b(e,t);return new T(n,e,r,i)},D=(e,t)=>{throw new t(e)},O=(e,t,n)=>S(e)?e?!O.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),k=e=>u.test(e);O.isNotRelative=k,O.convert=e=>e;var A=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){p(this,f,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[f]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(C(e)){let t=E(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,i(S(e)?w(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&O.convert(e);return O(i,e,this._allowRelativePaths?h:D),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return i(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let ee=e=>new A(e);if(ee.isPathValid=e=>O(e&&O.convert(e),e,h),ee.default=ee,n.exports=ee,r.default!==void 0&&(r.default.env&&r.default.env.IGNORE_TEST_WIN32||r.default.platform===`win32`)){O.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;O.isNotRelative=t=>e.test(t)||k(t)}})),Ln=n(((e,t)=>{function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function r(e,t,r){return t=t instanceof RegExp?t:new RegExp(n(t),`g`),e.replace(t,r)}t.exports={clean:function(e){if(typeof e!=`string`)throw Error(`Expected a string, received: `+e);return e=r(e,`./`,`/`),e=r(e,`..`,`.`),e=r(e,` `,`-`),e=r(e,/^[~^:?*\\\-]/g,``),e=r(e,/[~^:?*\\]/g,`-`),e=r(e,/[~^:?*\\\-]$/g,``),e=r(e,`@{`,`-`),e=r(e,/\.$/g,``),e=r(e,/\/$/g,``),e=r(e,/\.lock$/g,``),e}}})),Rn=n(((e,t)=>{t.exports=function(e,t){var n=e,r=t,i=n.length,a=r.length,o=!1,s=null,c=i+1,l=[],u=[],d=[],f=``,p=-1,m=0,h=1,g,_,v=function(){i>=a&&(g=n,_=i,n=r,r=g,i=a,a=_,o=!0,c=i+1)},y=function(e,t,n){return{x:e,y:t,k:n}},b=function(e,t){return{elem:e,t}},x=function(e,t,o){var s=t>o?l[e-1+c]:l[e+1+c],d,f=Math.max(t,o);for(d=f-e;d<i&&f<a&&n[d]===r[f];)++d,++f;return l[e+c]=u.length,u[u.length]=new y(d,f,s),f},S=function(e){var t=i=1,i,a=s=0,s,c;for(c=e.length-1;c>=0;--c)for(;a<e[c].x||s<e[c].y;)e[c].y-e[c].x>s-a?(o?d[d.length]=new b(r[s],p):d[d.length]=new b(r[s],h),++i,++s):e[c].y-e[c].x<s-a?(o?d[d.length]=new b(n[a],h):d[d.length]=new b(n[a],p),++t,++a):(d[d.length]=new b(n[a],m),f+=n[a],++t,++i,++a,++s)};return v(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:function(){return s},getlcs:function(){return f},getses:function(){return d},compose:function(){var e=a-i,t=i+a+3,n={},r,o,d,f,p;for(f=0;f<t;++f)n[f]=-1,l[f]=-1;r=-1;do{for(++r,p=-r;p<=e-1;++p)n[p+c]=x(p,n[p-1+c]+1,n[p+1+c]);for(p=e+r;p>=e+1;--p)n[p+c]=x(p,n[p-1+c]+1,n[p+1+c]);n[e+c]=x(e,n[e-1+c]+1,n[e+1+c])}while(n[e+c]!==a);for(s=e+2*r,o=l[e+c],d=[];o!==-1;)d[d.length]=new y(u[o].x,u[o].y,null),o=u[o].k;S(d)}}}})),zn=n(((e,t)=>{var n=Rn();function r(e,t){var r=new n(e,t);r.compose();for(var i=r.getses(),a,o,s=e.length-1,c=t.length-1,l=i.length-1;l>=0;--l)i[l].t===r.SES_COMMON?(o?(o.chain={file1index:s,file2index:c,chain:null},o=o.chain):(a={file1index:s,file2index:c,chain:null},o=a),s--,c--):i[l].t===r.SES_DELETE?s--:i[l].t===r.SES_ADD&&c--;var u={file1index:-1,file2index:-1,chain:null};return o?(o.chain=u,a):u}function i(e,t){for(var n=[],i=e.length,a=t.length,o=r(e,t);o!==null;o=o.chain){var s=i-o.file1index-1,c=a-o.file2index-1;i=o.file1index,a=o.file2index,(s||c)&&n.push({file1:[i+1,s],file2:[a+1,c]})}return n.reverse(),n}function a(e,t,n){var r,a=i(t,e),o=i(t,n),s=[];function c(e,t){s.push([e.file1[0],t,e.file1[1],e.file2[0],e.file2[1]])}for(r=0;r<a.length;r++)c(a[r],0);for(r=0;r<o.length;r++)c(o[r],2);s.sort(function(e,t){return e[0]-t[0]});var l=[],u=0;function d(e){e>u&&(l.push([1,u,e-u]),u=e)}for(var f=0;f<s.length;f++){for(var p=f,m=s[f],h=m[0],g=h+m[2];f<s.length-1;){var _=s[f+1],v=_[0];if(v>g)break;g=Math.max(g,v+_[2]),f++}if(d(h),p==f)m[4]>0&&l.push([m[1],m[3],m[4]]);else{var y={0:[e.length,-1,t.length,-1],2:[n.length,-1,t.length,-1]};for(r=p;r<=f;r++){m=s[r];var b=y[m[1]],x=m[0],S=x+m[2],C=m[3],w=C+m[4];b[0]=Math.min(C,b[0]),b[1]=Math.max(w,b[1]),b[2]=Math.min(x,b[2]),b[3]=Math.max(S,b[3])}var T=y[0][0]+(h-y[0][2]),E=y[0][1]+(g-y[0][3]),D=y[2][0]+(h-y[2][2]),O=y[2][1]+(g-y[2][3]);l.push([-1,T,E-T,h,g-h,D,O-D])}u=g}return d(t.length),l}function o(e,t,n){var r=[],i=[e,t,n],o=a(e,t,n),s=[];function c(){s.length&&r.push({ok:s}),s=[]}function l(e){for(var t=0;t<e.length;t++)s.push(e[t])}function u(t){if(t[2]!=t[6])return!0;for(var r=t[1],i=t[5],a=0;a<t[2];a++)if(e[a+r]!=n[a+i])return!0;return!1}for(var d=0;d<o.length;d++){var f=o[d],p=f[0];p==-1?u(f)?(c(),r.push({conflict:{a:e.slice(f[1],f[1]+f[2]),aIndex:f[1],o:t.slice(f[3],f[3]+f[4]),oIndex:f[3],b:n.slice(f[5],f[5]+f[6]),bIndex:f[5]}})):l(i[0].slice(f[1],f[1]+f[2])):l(i[p].slice(f[1],f[1]+f[2]))}return c(),r}t.exports=o})),Bn=e(n((t=>{var n=e(x()),r=a();Object.defineProperty(t,"__esModule",{value:!0});function i(e){return e&&typeof e==`object`&&`default`in e?e.default:e}var o=i(C()),s=i(O()),c=i(k()),l=i(te()),u=Pn(),d=i(Fn()),f=i(In()),p=i(Ln()),m=i(zn()),h=class e extends Error{constructor(e){super(e),this.caller=``}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(t){let n=new e(t.message);return n.code=t.code,n.data=t.data,n.caller=t.caller,n.stack=t.stack,n}get isIsomorphicGitError(){return!0}},g=class e extends h{constructor(t){super(`Modifying the index is not possible because you have unmerged files: ${t.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=e.code,this.data={filepaths:t}}};g.code=`UnmergedPathsError`;var _=class e extends h{constructor(t){super(`An internal error caused this command to fail.\n\nIf you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.\n\nPlease file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${t}`),this.code=this.name=e.code,this.data={message:t}}};_.code=`InternalError`;var v=class e extends h{constructor(t){super(`The filepath "${t}" contains unsafe character sequences`),this.code=this.name=e.code,this.data={filepath:t}}};v.code=`UnsafeFilepathError`;var y=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let t=this.buffer.slice(this._start,this._start+e);return this._start+=e,t}toString(e,t){let n=this.buffer.toString(e,this._start,this._start+t);return this._start+=t,n}write(e,t,n){let r=this.buffer.write(e,this._start,t,n);return this._start+=t,r}copy(e,t,n){let r=e.copy(this.buffer,this._start,t,n);return this._start+=r,r}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let t=this.buffer.writeUInt8(e,this._start);return this._start+=1,t}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let t=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,t}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let t=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,t}};function b(e,t){return-(e<t)||+(e>t)}function S(e,t){return b(e.path,t.path)}function w(e){let t=e>0?e>>12:0;t!==4&&t!==8&&t!==10&&t!==14&&(t=8);let n=e&511;return n=n&73?493:420,t!==8&&(n=0),(t<<12)+n}let T=2**32;function E(e,t,n,r){if(e!==void 0&&t!==void 0)return[e,t];n===void 0&&(n=r.valueOf());let i=Math.floor(n/1e3);return[i,(n-i*1e3)*1e6]}function D(e){let[t,n]=E(e.ctimeSeconds,e.ctimeNanoseconds,e.ctimeMs,e.ctime),[r,i]=E(e.mtimeSeconds,e.mtimeNanoseconds,e.mtimeMs,e.mtime);return{ctimeSeconds:t%T,ctimeNanoseconds:n%T,mtimeSeconds:r%T,mtimeNanoseconds:i%T,dev:e.dev%T,ino:e.ino%T,mode:w(e.mode%T),uid:e.uid%T,gid:e.gid%T,size:e.size>-1?e.size%T:0}}function A(e){let t=``;for(let n of new Uint8Array(e))n<16&&(t+=`0`),t+=n.toString(16);return t}let ee=null;async function j(e){return ee===null&&(ee=await P()),ee?N(e):M(e)}function M(e){return new s().update(e).digest(`hex`)}async function N(e){return A(await crypto.subtle.digest(`SHA-1`,e))}async function P(){try{return await N(new Uint8Array([]))===`da39a3ee5e6b4b0d3255bfef95601890afd80709`}catch{}return!1}function ne(e){return{assumeValid:!!(e&32768),extended:!!(e&16384),stage:(e&12288)>>12,nameLength:e&4095}}function F(e){let t=e.flags;return t.extended=!1,t.nameLength=Math.min(r.Buffer.from(e.path).length,4095),(t.assumeValid?32768:0)+(t.extended?16384:0)+((t.stage&3)<<12)+(t.nameLength&4095)}var I=class e{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let t=this._entries.get(e.path);t||=(this._entries.set(e.path,e),e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(t){if(r.Buffer.isBuffer(t))return e.fromBuffer(t);if(t===null)return new e(null);throw new _(`invalid type passed to GitIndex.from`)}static async fromBuffer(t){if(t.length===0)throw new _(`Index file is empty (.git/index)`);let n=new e,r=new y(t),i=r.toString(`utf8`,4);if(i!==`DIRC`)throw new _(`Invalid dircache magic file number: ${i}`);let a=await j(t.slice(0,-20)),o=t.slice(-20).toString(`hex`);if(o!==a)throw new _(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${a}`);let s=r.readUInt32BE();if(s!==2)throw new _(`Unsupported dircache version: ${s}`);let c=r.readUInt32BE(),l=0;for(;!r.eof()&&l<c;){let e={};e.ctimeSeconds=r.readUInt32BE(),e.ctimeNanoseconds=r.readUInt32BE(),e.mtimeSeconds=r.readUInt32BE(),e.mtimeNanoseconds=r.readUInt32BE(),e.dev=r.readUInt32BE(),e.ino=r.readUInt32BE(),e.mode=r.readUInt32BE(),e.uid=r.readUInt32BE(),e.gid=r.readUInt32BE(),e.size=r.readUInt32BE(),e.oid=r.slice(20).toString(`hex`),e.flags=ne(r.readUInt16BE());let i=t.indexOf(0,r.tell()+1)-r.tell();if(i<1)throw new _(`Got a path length of: ${i}`);if(e.path=r.toString(`utf8`,i),e.path.includes(`..\\`)||e.path.includes(`../`))throw new v(e.path);let a=8-(r.tell()-12)%8;for(a===0&&(a=8);a--;){let t=r.readUInt8();if(t!==0)throw new _(`Expected 1-8 null characters but got '${t}' after ${e.path}`);if(r.eof())throw new _(`Unexpected end of file`)}e.stages=[],n._addEntry(e),l++}return n}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(S)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(e=>e):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:t,oid:n,stage:i=0}){t||={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0},t=D(t);let a=r.Buffer.from(e),o={ctimeSeconds:t.ctimeSeconds,ctimeNanoseconds:t.ctimeNanoseconds,mtimeSeconds:t.mtimeSeconds,mtimeNanoseconds:t.mtimeNanoseconds,dev:t.dev,ino:t.ino,mode:t.mode||33188,uid:t.uid,gid:t.gid,size:t.size,path:e,oid:n,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(o),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let t of this._entries.keys())t.startsWith(e+`/`)&&this._entries.delete(t);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(`
|
|
11
|
+
`)}static async _entryToBuffer(e){let t=r.Buffer.from(e.path),n=Math.ceil((62+t.length+1)/8)*8,i=r.Buffer.alloc(n),a=new y(i),o=D(e);return a.writeUInt32BE(o.ctimeSeconds),a.writeUInt32BE(o.ctimeNanoseconds),a.writeUInt32BE(o.mtimeSeconds),a.writeUInt32BE(o.mtimeNanoseconds),a.writeUInt32BE(o.dev),a.writeUInt32BE(o.ino),a.writeUInt32BE(o.mode),a.writeUInt32BE(o.uid),a.writeUInt32BE(o.gid),a.writeUInt32BE(o.size),a.write(e.oid,20,`hex`),a.writeUInt16BE(F(e)),a.write(e.path,t.length,`utf8`),i}async toObject(){let t=r.Buffer.alloc(12),n=new y(t);n.write(`DIRC`,4,`utf8`),n.writeUInt32BE(2),n.writeUInt32BE(this.entriesFlat.length);let i=[];for(let t of this.entries)if(i.push(e._entryToBuffer(t)),t.stages.length>1)for(let n of t.stages)n&&n!==t&&i.push(e._entryToBuffer(n));i=await Promise.all(i);let a=r.Buffer.concat(i),o=r.Buffer.concat([t,a]),s=await j(o);return r.Buffer.concat([o,r.Buffer.from(s,`hex`)])}};function re(e,t,n=!0,r=!0){let i=D(e),a=D(t);return n&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||r&&i.ino!==a.ino||i.size!==a.size}let L=null,R=Symbol(`IndexCache`);function ie(){return{map:new Map,stats:new Map}}async function z(e,t,n){let[r,i]=await Promise.all([e.lstat(t),e.read(t)]),a=await I.from(i);n.map.set(t,a),n.stats.set(t,r)}async function B(e,t,n){let r=n.stats.get(t);if(r===void 0)return!0;if(r===null)return!1;let i=await e.lstat(t);return i!==null&&re(r,i)}var ae=class{static async acquire({fs:e,gitdir:t,cache:n,allowUnmerged:r=!0},i){n[R]||(n[R]=ie());let a=`${t}/index`;L===null&&(L=new o({maxPending:1/0}));let s,c=[];return await L.acquire(a,async()=>{let t=n[R];await B(e,a,t)&&await z(e,a,t);let o=t.map.get(a);if(c=o.unmergedPaths,c.length&&!r)throw new g(c);if(s=await i(o),o._dirty){let n=await o.toObject();await e.write(a,n),t.stats.set(a,await e.lstat(a)),o._dirty=!1}}),s}};function V(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>-1&&(e=e.slice(t+1)),e}function H(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t===-1?`.`:t===0?`/`:e.slice(0,t)}function oe(e){let t=new Map,n=function(e){if(!t.has(e)){let r={type:`tree`,fullpath:e,basename:V(e),metadata:{},children:[]};t.set(e,r),r.parent=n(H(e)),r.parent&&r.parent!==r&&r.parent.children.push(r)}return t.get(e)},r=function(e,r){if(!t.has(e)){let i={type:`blob`,fullpath:e,basename:V(e),metadata:r,parent:n(H(e)),children:[]};i.parent&&i.parent.children.push(i),t.set(e,i)}return t.get(e)};n(`.`);for(let t of e)r(t.path,t);return t}function se(e){switch(e){case 16384:return`tree`;case 33188:return`blob`;case 33261:return`blob`;case 40960:return`blob`;case 57344:return`commit`}throw new _(`Unexpected GitTree entry mode: ${e.toString(8)}`)}var U=class{constructor({fs:e,gitdir:t,cache:n}){this.treePromise=ae.acquire({fs:e,gitdir:t,cache:n},async function(e){return oe(e.entries)});let r=this;this.ConstructEntry=class{constructor(e){this._fullpath=e,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return r.type(this)}async mode(){return r.mode(this)}async stat(){return r.stat(this)}async content(){return r.content(this)}async oid(){return r.oid(this)}}}async readdir(e){let t=e._fullpath,n=(await this.treePromise).get(t);if(!n||n.type===`blob`)return null;if(n.type!==`tree`)throw Error(`ENOTDIR: not a directory, scandir '${t}'`);let r=n.children.map(e=>e.fullpath);return r.sort(b),r}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let t=(await this.treePromise).get(e._fullpath);if(!t)throw Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=t.type===`tree`?{}:D(t.metadata);e._type=t.type===`tree`?`tree`:se(n.mode),e._mode=n.mode,t.type===`tree`?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){return e._oid===!1&&(e._oid=(await this.treePromise).get(e._fullpath).metadata.oid),e._oid}};let ce=Symbol(`GitWalkSymbol`);function W(){let e=Object.create(null);return Object.defineProperty(e,ce,{value:function({fs:e,gitdir:t,cache:n}){return new U({fs:e,gitdir:t,cache:n})}}),Object.freeze(e),e}var G=class e extends h{constructor(t){super(`Could not find ${t}.`),this.code=this.name=e.code,this.data={what:t}}};G.code=`NotFoundError`;var le=class e extends h{constructor(t,n,r,i){super(`Object ${t} ${i?`at ${i}`:``}was anticipated to be a ${r} but it is a ${n}.`),this.code=this.name=e.code,this.data={oid:t,actual:n,expected:r,filepath:i}}};le.code=`ObjectTypeError`;var K=class e extends h{constructor(t){super(`Expected a 40-char hex object id but saw "${t}".`),this.code=this.name=e.code,this.data={value:t}}};K.code=`InvalidOidError`;var q=class e extends h{constructor(t){super(`Could not find a fetch refspec for remote "${t}". Make sure the config file has an entry like the following:
|
|
12
12
|
[remote "${t}"]
|
|
13
13
|
\tfetch = +refs/heads/*:refs/remotes/origin/*
|
|
14
14
|
`),this.code=this.name=e.code,this.data={remote:t}}};q.code=`NoRefspecError`;var ue=class e{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let t=null;this.parsedConfig=e.trim().split(`
|
|
15
15
|
`).map(e=>{if(/^\s*#/.test(e))return{line:e,comment:!0};let n=e.indexOf(` `);if(e.startsWith(`^`)){let n=e.slice(1);return this.refs.set(t+`^{}`,n),{line:e,ref:t,peeled:n}}else{let r=e.slice(0,n);return t=e.slice(n+1),this.refs.set(t,r),{line:e,ref:t,oid:r}}})}return this}static from(t){return new e(t)}delete(e){this.parsedConfig=this.parsedConfig.filter(t=>t.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
|
|
16
16
|
`)+`
|
|
17
|
-
`}},J=class e{constructor({remotePath:e,localPath:t,force:n,matchPrefix:r}){Object.assign(this,{remotePath:e,localPath:t,force:n,matchPrefix:r})}static from(t){let[n,r,i,a,o]=t.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),s=n===`+`,c=i===`*`;if(c!==(o===`*`))throw new
|
|
17
|
+
`}},J=class e{constructor({remotePath:e,localPath:t,force:n,matchPrefix:r}){Object.assign(this,{remotePath:e,localPath:t,force:n,matchPrefix:r})}static from(t){let[n,r,i,a,o]=t.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),s=n===`+`,c=i===`*`;if(c!==(o===`*`))throw new _(`Invalid refspec`);return new e({remotePath:r,localPath:a,force:s,matchPrefix:c})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,``)}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,``)}else if(e===this.localPath)return this.remotePath;return null}},de=class e{constructor(e=[]){this.rules=e}static from(t){let n=[];for(let e of t)n.push(J.from(e));return new e(n)}add(e){let t=J.from(e);this.rules.push(t)}translate(e){let t=[];for(let n of this.rules)for(let r of e){let e=n.translate(r);e&&t.push([r,e])}return t}translateOne(e){let t=null;for(let n of this.rules){let r=n.translate(e);r&&(t=r)}return t}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,``))}};function fe(e,t){let n=e.replace(/\^\{\}$/,``),r=t.replace(/\^\{\}$/,``),i=-(n<r)||+(n>r);return i===0?e.endsWith(`^{}`)?1:-1:i}
|
|
18
18
|
/*!
|
|
19
19
|
* This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
|
|
20
20
|
* SPDX-License-Identifier: LGPL-3.0-or-later
|
|
@@ -22,9 +22,9 @@ https://github.com/browserify/crypto-browserify`)},e.constants={DH_CHECK_P_NOT_S
|
|
|
22
22
|
*/
|
|
23
23
|
function pe(e,t){let n=``,r=0,i=-1,a=0,o=`\0`;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n.at(-1)!==`.`||n.at(-2)!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length!==0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function me(e){if(!e.length)return`.`;let t=e[0]===`/`,n=e.at(-1)===`/`;return e=pe(e,!t),e.length?(n&&(e+=`/`),t?`/${e}`:e):t?`/`:n?`./`:`.`}function Y(...e){if(e.length===0)return`.`;let t;for(let n=0;n<e.length;++n){let r=e[n];r.length>0&&(t===void 0?t=r:t+=`/`+r)}return t===void 0?`.`:me(t)}let X=e=>{if(typeof e==`number`)return e;e=e.toLowerCase();let t=parseInt(e);return e.endsWith(`k`)&&(t*=1024),e.endsWith(`m`)&&(t*=1024*1024),e.endsWith(`g`)&&(t*=1024*1024*1024),t},Z=e=>{if(typeof e==`boolean`)return e;if(e=e.trim().toLowerCase(),e===`true`||e===`yes`||e===`on`)return!0;if(e===`false`||e===`no`||e===`off`)return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${e}`)},he={core:{filemode:Z,bare:Z,logallrefupdates:Z,symlinks:Z,ignorecase:Z,bigFileThreshold:X}},ge=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,_e=/^[A-Za-z0-9-.]+$/,ve=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,ye=/^[A-Za-z][A-Za-z-]*$/,be=/^(.*?)( *[#;].*)$/,xe=e=>{let t=ge.exec(e);if(t!=null){let[e,n]=t.slice(1);return[e,n]}return null},Se=e=>{let t=ve.exec(e);if(t!=null){let[e,n=`true`]=t.slice(1),r=Ce(n);return[e,Te(r)]}return null},Ce=e=>{let t=be.exec(e);if(t==null)return e;let[n,r]=t.slice(1);return we(n)&&we(r)?`${n}${r}`:n},we=e=>(e.match(/(?:^|[^\\])"/g)||[]).length%2!=0,Te=e=>e.split(``).reduce((e,t,n,r)=>{let i=t===`"`&&r[n-1]!==`\\`,a=t===`\\`&&r[n+1]===`"`;return i||a?e:e+t},``),Ee=e=>e==null?null:e.toLowerCase(),De=(e,t,n)=>[Ee(e),t,Ee(n)].filter(e=>e!=null).join(`.`),Oe=e=>{let t=e.split(`.`),n=t.shift(),r=t.pop(),i=t.length?t.join(`.`):void 0;return{section:n,subsection:i,name:r,path:De(n,i,r),sectionPath:De(n,i,null),isSection:!!n}},ke=(e,t)=>e.reduce((e,n,r)=>t(n)?r:e,-1);var Ae=class e{constructor(e){let t=null,n=null;this.parsedConfig=e?e.split(`
|
|
24
24
|
`).map(e=>{let r=null,i=null,a=e.trim(),o=xe(a),s=o!=null;if(s)[t,n]=o;else{let e=Se(a);e!=null&&([r,i]=e)}let c=De(t,n,r);return{line:e,isSection:s,section:t,subsection:n,name:r,value:i,path:c}}):[]}static from(t){return new e(t)}async get(e,t=!1){let n=Oe(e).path,r=this.parsedConfig.filter(e=>e.path===n).map(({section:e,name:t,value:n})=>{let r=he[e]&&he[e][t];return r?r(n):n});return t?r:r.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(t=>t.isSection&&t.section===e).map(e=>e.subsection)}async deleteSection(e,t){this.parsedConfig=this.parsedConfig.filter(n=>!(n.section===e&&n.subsection===t))}async append(e,t){return this.set(e,t,!0)}async set(e,t,n=!1){let{section:r,subsection:i,name:a,path:o,sectionPath:s,isSection:c}=Oe(e),l=ke(this.parsedConfig,e=>e.path===o);if(t==null)l!==-1&&this.parsedConfig.splice(l,1);else if(l!==-1){let e=this.parsedConfig[l],r=Object.assign({},e,{name:a,value:t,modified:!0});n?this.parsedConfig.splice(l+1,0,r):this.parsedConfig[l]=r}else{let e=this.parsedConfig.findIndex(e=>e.path===s),n={section:r,subsection:i,name:a,value:t,modified:!0,path:o};if(_e.test(r)&&ye.test(a))if(e>=0)this.parsedConfig.splice(e+1,0,n);else{let e={isSection:c,section:r,subsection:i,modified:!0,path:s};this.parsedConfig.push(e,n)}}}toString(){return this.parsedConfig.map(({line:e,section:t,subsection:n,name:r,value:i,modified:a=!1})=>a?r!=null&&i!=null?typeof i==`string`&&/[#;]/.test(i)?`\t${r} = "${i}"`:`\t${r} = ${i}`:n==null?`[${t}]`:`[${t} "${n}"]`:e).join(`
|
|
25
|
-
`)}},je=class{static async get({fs:e,gitdir:t}){let n=await e.read(`${t}/config`,{encoding:`utf8`});return Ae.from(n)}static async save({fs:e,gitdir:t,config:n}){await e.write(`${t}/config`,n.toString(),{encoding:`utf8`})}};let Me=e=>[`${e}`,`refs/${e}`,`refs/tags/${e}`,`refs/heads/${e}`,`refs/remotes/${e}`,`refs/remotes/${e}/HEAD`],Ne=[`config`,`description`,`index`,`shallow`,`commondir`],Pe;async function Fe(e,t){return Pe===void 0&&(Pe=new o),Pe.acquire(e,t)}var Q=class e{static async updateRemoteRefs({fs:t,gitdir:n,remote:r,refs:i,symrefs:a,tags:o,refspecs:s=void 0,prune:c=!1,pruneTags:l=!1}){for(let e of i.values())if(!e.match(/[0-9a-f]{40}/))throw new K(e);let u=await je.get({fs:t,gitdir:n});if(!s){if(s=await u.getall(`remote.${r}.fetch`),s.length===0)throw new q(r);s.unshift(`+HEAD:refs/remotes/${r}/HEAD`)}let d=de.from(s),f=new Map;if(l){let r=await e.listRefs({fs:t,gitdir:n,filepath:`refs/tags`});await e.deleteRefs({fs:t,gitdir:n,refs:r.map(e=>`refs/tags/${e}`)})}if(o){for(let r of i.keys())if(r.startsWith(`refs/tags`)&&!r.endsWith(`^{}`)&&!await e.exists({fs:t,gitdir:n,ref:r})){let e=i.get(r);f.set(r,e)}}let p=d.translate([...i.keys()]);for(let[e,t]of p){let n=i.get(e);f.set(t,n)}let m=d.translate([...a.keys()]);for(let[e,t]of m){let n=a.get(e),r=d.translateOne(n);r&&f.set(t,`ref: ${r}`)}let h=[];if(c){for(let r of d.localNamespaces()){let i=(await e.listRefs({fs:t,gitdir:n,filepath:r})).map(e=>`${r}/${e}`);for(let e of i)f.has(e)||h.push(e)}h.length>0&&await e.deleteRefs({fs:t,gitdir:n,refs:h})}for(let[e,r]of f)await Fe(e,async()=>t.write(Y(n,e),`${r.trim()}\n`,`utf8`));return{pruned:h}}static async writeRef({fs:e,gitdir:t,ref:n,value:r}){if(!r.match(/[0-9a-f]{40}/))throw new K(r);await Fe(n,async()=>e.write(Y(t,n),`${r.trim()}\n`,`utf8`))}static async writeSymbolicRef({fs:e,gitdir:t,ref:n,value:r}){await Fe(n,async()=>e.write(Y(t,n),`ref: ${r.trim()}\n`,`utf8`))}static async deleteRef({fs:t,gitdir:n,ref:r}){return e.deleteRefs({fs:t,gitdir:n,refs:[r]})}static async deleteRefs({fs:e,gitdir:t,refs:n}){await Promise.all(n.map(n=>e.rm(Y(t,n))));let r=await Fe(`packed-refs`,async()=>e.read(`${t}/packed-refs`,{encoding:`utf8`})),i=ue.from(r),a=i.refs.size;for(let e of n)i.refs.has(e)&&i.delete(e);i.refs.size<a&&(r=i.toString(),await Fe(`packed-refs`,async()=>e.write(`${t}/packed-refs`,r,{encoding:`utf8`})))}static async resolve({fs:t,gitdir:n,ref:r,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return r;if(r.startsWith(`ref: `))return r=r.slice(5),e.resolve({fs:t,gitdir:n,ref:r,depth:i});if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let a=await e.packedRefs({fs:t,gitdir:n}),o=Me(r).filter(e=>!Ne.includes(e));for(let r of o){let o=await Fe(r,async()=>await t.read(`${n}/${r}`,{encoding:`utf8`})||a.get(r));if(o)return e.resolve({fs:t,gitdir:n,ref:o.trim(),depth:i})}throw new G(r)}static async exists({fs:t,gitdir:n,ref:r}){try{return await e.expand({fs:t,gitdir:n,ref:r}),!0}catch{return!1}}static async expand({fs:t,gitdir:n,ref:r}){if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let i=await e.packedRefs({fs:t,gitdir:n}),a=Me(r);for(let e of a)if(await Fe(e,async()=>t.exists(`${n}/${e}`))||i.has(e))return e;throw new G(r)}static async expandAgainstMap({ref:e,map:t}){let n=Me(e);for(let e of n)if(await t.has(e))return e;throw new G(e)}static resolveAgainstMap({ref:t,fullref:n=t,depth:r=void 0,map:i}){if(r!==void 0&&(r--,r===-1))return{fullref:n,oid:t};if(t.startsWith(`ref: `))return t=t.slice(5),e.resolveAgainstMap({ref:t,fullref:n,depth:r,map:i});if(t.length===40&&/[0-9a-f]{40}/.test(t))return{fullref:n,oid:t};let a=Me(t);for(let t of a){let n=i.get(t);if(n)return e.resolveAgainstMap({ref:n.trim(),fullref:t,depth:r,map:i})}throw new G(t)}static async packedRefs({fs:e,gitdir:t}){let n=await Fe(`packed-refs`,async()=>e.read(`${t}/packed-refs`,{encoding:`utf8`}));return ue.from(n).refs}static async listRefs({fs:t,gitdir:n,filepath:r}){let i=e.packedRefs({fs:t,gitdir:n}),a=null;try{a=await t.readdirDeep(`${n}/${r}`),a=a.map(e=>e.replace(`${n}/${r}/`,``))}catch{a=[]}for(let e of(await i).keys())e.startsWith(r)&&(e=e.replace(r+`/`,``),a.includes(e)||a.push(e));return a.sort(fe),a}static async listBranches({fs:t,gitdir:n,remote:r}){return r?e.listRefs({fs:t,gitdir:n,filepath:`refs/remotes/${r}`}):e.listRefs({fs:t,gitdir:n,filepath:`refs/heads`})}static async listTags({fs:t,gitdir:n}){return(await e.listRefs({fs:t,gitdir:n,filepath:`refs/tags`})).filter(e=>!e.endsWith(`^{}`))}};function Ie(e,t){return
|
|
26
|
-
`)}toObject(){let e=[...this._entries];return e.sort(Ie),i.Buffer.concat(e.map(e=>{let t=i.Buffer.from(e.mode.replace(/^0/,``)),n=i.Buffer.from(` `),r=i.Buffer.from(e.path,`utf8`),a=i.Buffer.from([0]),o=i.Buffer.from(e.oid,`hex`);return i.Buffer.concat([t,n,r,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Ue=class{static wrap({type:e,object:t}){let n=`${e} ${t.length}\x00`,r=n.length,i=r+t.length,a=new Uint8Array(i);for(let e=0;e<r;e++)a[e]=n.charCodeAt(e);return a.set(t,r),a}static unwrap(e){let t=e.indexOf(32),n=e.indexOf(0),r=e.slice(0,t).toString(`utf8`),a=e.slice(t+1,n).toString(`utf8`),o=e.length-(n+1);if(parseInt(a)!==o)throw new v(`Length mismatch: expected ${a} bytes but got ${o} instead.`);return{type:r,object:i.Buffer.from(e.slice(n+1))}}};async function We({fs:e,gitdir:t,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`,i=await e.read(`${t}/${r}`);return i?{object:i,format:`deflated`,source:r}:null}function Ge(e,t){let n=new b(e),r=Ke(n);if(r!==t.byteLength)throw new v(`applyDelta expected source buffer to be ${r} bytes but the provided buffer was ${t.length} bytes`);let a=Ke(n),o,s=Je(n,t);if(s.byteLength===a)o=s;else{o=i.Buffer.alloc(a);let e=new b(o);for(e.copy(s);!n.eof();)e.copy(Je(n,t));let r=e.tell();if(a!==r)throw new v(`applyDelta expected target buffer to be ${a} bytes but the resulting buffer was ${r} bytes`)}return o}function Ke(e){let t=0,n=0,r=null;do r=e.readUInt8(),t|=(r&127)<<n,n+=7;while(r&128);return t}function qe(e,t,n){let r=0,i=0;for(;n--;)t&1&&(r|=e.readUInt8()<<i),t>>=1,i+=8;return r}function Je(e,t){let n=e.readUInt8();if(n&128){let r=qe(e,n&15,4),i=qe(e,(n&112)>>4,3);return i===0&&(i=65536),t.slice(r,r+i)}else return e.slice(n)}function Ye(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function Xe(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:Ye(e)}var Ze=class{constructor(e){if(i.Buffer===void 0)throw Error(`Missing Buffer dependency`);this.stream=Xe(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:t}=await this.stream.next();return e&&(this._ended=!0,!t)?i.Buffer.alloc(0):(t&&=i.Buffer.from(t),t)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let t=[this.buffer];for(;this.cursor+e>Qe(t);){let e=await this._next();if(this._ended)break;t.push(e)}this.buffer=i.Buffer.concat(t)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function Qe(e){return e.reduce((e,t)=>e+t.length,0)}async function $e(e,t){let n=new Ze(e),r=await n.read(4);if(r=r.toString(`utf8`),r!==`PACK`)throw new v(`Invalid PACK header '${r}'`);let i=await n.read(4);if(i=i.readUInt32BE(0),i!==2)throw new v(`Invalid packfile version: ${i}`);let a=await n.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!n.eof()&&a--;){let e=n.tell(),{type:r,length:i,ofs:o,reference:s}=await et(n),c=new u.Inflate;for(;!c.result;){let l=await n.chunk();if(!l)break;if(c.push(l,!1),c.err)throw new v(`Pako error: ${c.msg}`);if(c.result){if(c.result.length!==i)throw new v(`Inflated object size is different from that stated in packfile.`);await n.undo(),await n.read(l.length-c.strm.avail_in);let u=n.tell();await t({data:c.result,type:r,num:a,offset:e,end:u,reference:s,ofs:o})}}}}async function et(e){let t=await e.byte(),n=t>>4&7,r=t&15;if(t&128){let n=4;do t=await e.byte(),r|=(t&127)<<n,n+=7;while(t&128)}let a,o;if(n===6){let n=0;a=0;let r=[];do t=await e.byte(),a|=(t&127)<<n,n+=7,r.push(t);while(t&128);o=i.Buffer.from(r)}return n===7&&(o=await e.read(20)),{type:n,length:r,ofs:a,reference:o}}let tt=!1;async function nt(e){return tt===null&&(tt=it()),tt?rt(e):u.inflate(e)}async function rt(e){let t=new DecompressionStream(`deflate`),n=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}function it(){try{if(new DecompressionStream(`deflate`))return!0}catch{}return!1}function at(e){let t=[],n=0,r=0;do{n=e.readUInt8();let i=n&127;t.push(i),r=n&128}while(r);return t.reduce((e,t)=>e+1<<7|t,-1)}function ot(e,t){let n=t,r=4,i=null;do i=e.readUInt8(),n|=(i&127)<<r,r+=7;while(i&128);return n}var st=class e{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:t,getExternalRefDelta:n}){let r=new b(t);if(r.slice(4).toString(`hex`)!==`ff744f63`)return;let i=r.readUInt32BE();if(i!==2)throw new v(`Unable to read version ${i} packfile IDX. (Only version 2 supported)`);if(t.byteLength>2048*1024*1024)throw new v(`To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.`);r.seek(r.tell()+1020);let a=r.readUInt32BE(),o=[];for(let e=0;e<a;e++)o[e]=r.slice(20).toString(`hex`);r.seek(r.tell()+4*a);let s=new Map;for(let e=0;e<a;e++)s.set(o[e],r.readUInt32BE());let c=r.slice(20).toString(`hex`);return new e({hashes:o,crcs:{},offsets:s,packfileSha:c,getExternalRefDelta:n})}static async fromPack({pack:t,getExternalRefDelta:n,onProgress:r}){let i={1:`commit`,2:`tree`,3:`blob`,4:`tag`,6:`ofs-delta`,7:`ref-delta`},a={},o=t.slice(-20).toString(`hex`),s=[],l={},u=new Map,d=null,f=null;await $e([t],async({data:e,type:t,reference:n,offset:o,num:s})=>{d===null&&(d=s);let c=Math.floor((d-s)*100/d);c!==f&&r&&await r({phase:`Receiving objects`,loaded:d-s,total:d}),f=c,t=i[t],([`commit`,`tree`,`blob`,`tag`].includes(t)||t===`ofs-delta`||t===`ref-delta`)&&(a[o]={type:t,offset:o})});let p=Object.keys(a).map(Number);for(let[e,n]of p.entries()){let r=e+1===p.length?t.byteLength-20:p[e+1],i=a[n],o=c.buf(t.slice(n,r))>>>0;i.end=r,i.crc=o}let m=new e({pack:Promise.resolve(t),packfileSha:o,crcs:l,hashes:s,offsets:u,getExternalRefDelta:n});f=null;let h=0,g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let e in a){e=Number(e);let t=Math.floor(h*100/d);t!==f&&r&&await r({phase:`Resolving deltas`,loaded:h,total:d}),h++,f=t;let n=a[e];if(!n.oid)try{m.readDepth=0,m.externalReadDepth=0;let{type:t,object:r}=await m.readSlice({start:e});g[m.readDepth]+=1;let i=await j(Ue.wrap({type:t,object:r}));n.oid=i,s.push(i),u.set(i,e),l[i]=n.crc}catch{continue}}return s.sort(),m}async toBuffer(){let e=[],t=(t,n)=>{e.push(i.Buffer.from(t,n))};t(`ff744f63`,`hex`),t(`00000002`,`hex`);let n=new b(i.Buffer.alloc(256*4));for(let e=0;e<256;e++){let t=0;for(let n of this.hashes)parseInt(n.slice(0,2),16)<=e&&t++;n.writeUInt32BE(t)}e.push(n.buffer);for(let e of this.hashes)t(e,`hex`);let r=new b(i.Buffer.alloc(this.hashes.length*4));for(let e of this.hashes)r.writeUInt32BE(this.crcs[e]);e.push(r.buffer);let a=new b(i.Buffer.alloc(this.hashes.length*4));for(let e of this.hashes)a.writeUInt32BE(this.offsets.get(e));e.push(a.buffer),t(this.packfileSha,`hex`);let o=i.Buffer.concat(e),s=await j(o),c=i.Buffer.alloc(20);return c.write(s,`hex`),i.Buffer.concat([o,c])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new v(`Could not read object ${e} from packfile`)}let t=this.offsets.get(e);return this.readSlice({start:t})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let t={16:`commit`,32:`tree`,48:`blob`,64:`tag`,96:`ofs_delta`,112:`ref_delta`},n=await this.pack;if(!n)throw new v(`Could not read packfile data. The packfile may be missing, corrupted, or too large to read into memory.`);let r=n.slice(e),a=new b(r),o=a.readUInt8(),s=o&112,c=t[s];if(c===void 0)throw new v(`Unrecognized type: 0b`+s.toString(2));let l=o&15,u=l;o&128&&(u=ot(a,l));let d=null,f=null;if(c===`ofs_delta`){let t=e-at(a);({object:d,type:c}=await this.readSlice({start:t}))}if(c===`ref_delta`){let e=a.slice(20).toString(`hex`);({object:d,type:c}=await this.read({oid:e}))}let p=r.slice(a.tell());if(f=i.Buffer.from(await nt(p)),f.byteLength!==u)throw new v(`Packfile told us object would have length ${u} but it had length ${f.byteLength}`);return d&&(f=i.Buffer.from(Ge(f,d))),this.readDepth>3&&(this.offsetCache[e]={type:c,object:f}),{type:c,format:`content`,object:f}}};let ct=Symbol(`PackfileCache`);async function lt({fs:e,filename:t,getExternalRefDelta:n,emitter:r,emitterPrefix:i}){let a=await e.read(t);return st.fromIdx({idx:a,getExternalRefDelta:n})}function ut({fs:e,cache:t,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}){t[ct]||(t[ct]=new Map);let o=t[ct].get(n);return o||(o=lt({fs:e,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}),t[ct].set(n,o)),o}let dt=8*1024*1024;async function ft(e,{start:t=0,end:n=e.length}={}){let r=d.createHash(`sha1`);for(let i=t;i<n;i+=dt)r.update(e.subarray(i,Math.min(i+dt,n)));return r.digest(`hex`)}async function pt({fs:e,cache:t,gitdir:n,oid:r,format:i=`content`,getExternalRefDelta:a}){let o=await e.readdir(Y(n,`objects/pack`));o=o.filter(e=>e.endsWith(`.idx`));for(let i of o){let o=`${n}/objects/pack/${i}`,s=await ut({fs:e,cache:t,filename:o,getExternalRefDelta:a});if(s.error)throw new v(s.error);if(s.offsets.has(r)){let t=o.replace(/idx$/,`pack`);s.pack||=e.read(t);let n=await s.pack;if(!n)throw s.pack=null,new v(`Could not read packfile at ${t}. The file may be missing, corrupted, or too large to read into memory.`);if(!s._checksumVerified){let e=s.packfileSha,t=n.subarray(-20),r=Array.from(t).map(e=>e.toString(16).padStart(2,`0`)).join(``);if(r!==e)throw new v(`Packfile trailer mismatch: expected ${e}, got ${r}. The packfile may be corrupted.`);let i=await ft(n,{start:0,end:n.length-20});if(i!==e)throw new v(`Packfile payload corrupted: calculated ${i} but expected ${e}. The packfile may have been tampered with.`);s._checksumVerified=!0}let c=await s.read({oid:r,getExternalRefDelta:a});return c.format=`content`,c.source=`objects/pack/${i.replace(/idx$/,`pack`)}`,c}}return null}async function mt({fs:e,cache:t,gitdir:n,oid:r,format:a=`content`}){let o=r=>mt({fs:e,cache:t,gitdir:n,oid:r}),s;if(r===`4b825dc642cb6eb9a060e54bf8d69288fbee4904`&&(s={format:`wrapped`,object:i.Buffer.from(`tree 0\0`)}),s||=await We({fs:e,gitdir:n,oid:r}),!s){if(s=await pt({fs:e,cache:t,gitdir:n,oid:r,getExternalRefDelta:o}),!s)throw new G(r);return s}if(a===`deflated`||(s.format===`deflated`&&(s.object=i.Buffer.from(await nt(s.object)),s.format=`wrapped`),a===`wrapped`))return s;let c=await j(s.object);if(c!==r)throw new v(`SHA check failed! Expected ${r}, computed ${c}`);let{object:l,type:u}=Ue.unwrap(s.object);if(s.type=u,s.object=l,s.format=`content`,a===`content`)return s;throw new v(`invalid requested format "${a}"`)}var ht=class e extends g{constructor(t,n,r=!0){super(`Failed to create ${t} at ${n} because it already exists.${r?` (Hint: use 'force: true' parameter to overwrite existing ${t}.)`:``}`),this.code=this.name=e.code,this.data={noun:t,where:n,canForce:r}}};ht.code=`AlreadyExistsError`;var gt=class e extends g{constructor(t,n,r){super(`Found multiple ${t} matching "${n}" (${r.join(`, `)}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=e.code,this.data={nouns:t,short:n,matches:r}}};gt.code=`AmbiguousError`;var _t=class e extends g{constructor(t){super(`Your local changes to the following files would be overwritten by checkout: ${t.join(`, `)}`),this.code=this.name=e.code,this.data={filepaths:t}}};_t.code=`CheckoutConflictError`;var vt=class e extends g{constructor(t,n){super(`Cannot cherry-pick merge commit ${t}. Merge commits have ${n} parents and require specifying which parent to use as the base.`),this.code=this.name=e.code,this.data={oid:t,parentCount:n}}};vt.code=`CherryPickMergeCommitError`;var yt=class e extends g{constructor(t){super(`Cannot cherry-pick root commit ${t}. Root commits have no parents.`),this.code=this.name=e.code,this.data={oid:t}}};yt.code=`CherryPickRootCommitError`;var bt=class e extends g{constructor(t,n){super(`Failed to checkout "${t}" because commit ${n} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=e.code,this.data={ref:t,oid:n}}};bt.code=`CommitNotFetchedError`;var xt=class e extends g{constructor(){super(`Empty response from git server.`),this.code=this.name=e.code,this.data={}}};xt.code=`EmptyServerResponseError`;var St=class e extends g{constructor(){super(`A simple fast-forward merge was not possible.`),this.code=this.name=e.code,this.data={}}};St.code=`FastForwardError`;var Ct=class e extends g{constructor(t,n){super(`One or more branches were not updated: ${t}`),this.code=this.name=e.code,this.data={prettyDetails:t,result:n}}};Ct.code=`GitPushError`;var wt=class e extends g{constructor(t,n,r){super(`HTTP Error: ${t} ${n}`),this.code=this.name=e.code,this.data={statusCode:t,statusMessage:n,response:r}}};wt.code=`HttpError`;var Tt=class e extends g{constructor(t){let n=`invalid filepath`;t===`leading-slash`||t===`trailing-slash`?n=`"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.`:t===`directory`&&(n=`"filepath" should not be a directory.`),super(n),this.code=this.name=e.code,this.data={reason:t}}};Tt.code=`InvalidFilepathError`;var Et=class e extends g{constructor(t,n){super(`"${t}" would be an invalid git reference. (Hint: a valid alternative would be "${n}".)`),this.code=this.name=e.code,this.data={ref:t,suggestion:n}}};Et.code=`InvalidRefNameError`;var Dt=class e extends g{constructor(t){super(`Maximum search depth of ${t} exceeded.`),this.code=this.name=e.code,this.data={depth:t}}};Dt.code=`MaxDepthError`;var Ot=class e extends g{constructor(){super(`Merges with conflicts are not supported yet.`),this.code=this.name=e.code,this.data={}}};Ot.code=`MergeNotSupportedError`;var kt=class e extends g{constructor(t,n,r,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${t.toString()}. Fix conflicts then commit the result.`),this.code=this.name=e.code,this.data={filepaths:t,bothModified:n,deleteByUs:r,deleteByTheirs:i}}};kt.code=`MergeConflictError`;var At=class e extends g{constructor(t){super(`No name was provided for ${t} in the argument or in the .git/config file.`),this.code=this.name=e.code,this.data={role:t}}};At.code=`MissingNameError`;var jt=class e extends g{constructor(t){super(`The function requires a "${t}" parameter but none was provided.`),this.code=this.name=e.code,this.data={parameter:t}}};jt.code=`MissingParameterError`;var Mt=class e extends g{constructor(t){super(`There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more`),this.code=this.name=e.code,this.data={errors:t},this.errors=t}};Mt.code=`MultipleGitError`;var Nt=class e extends g{constructor(t,n){super(`Expected "${t}" but received "${n}".`),this.code=this.name=e.code,this.data={expected:t,actual:n}}};Nt.code=`ParseError`;var Pt=class e extends g{constructor(t){let n=``;t===`not-fast-forward`?n=` because it was not a simple fast-forward`:t===`tag-exists`&&(n=` because tag already exists`),super(`Push rejected${n}. Use "force: true" to override.`),this.code=this.name=e.code,this.data={reason:t}}};Pt.code=`PushRejectedError`;var Ft=class e extends g{constructor(t,n){super(`Remote does not support the "${t}" so the "${n}" parameter cannot be used.`),this.code=this.name=e.code,this.data={capability:t,parameter:n}}};Ft.code=`RemoteCapabilityError`;var It=class e extends g{constructor(t,n){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${t}`),this.code=this.name=e.code,this.data={preview:t,response:n}}};It.code=`SmartHttpError`;var Lt=class e extends g{constructor(t,n,r){super(`Git remote "${t}" uses an unrecognized transport protocol: "${n}"`),this.code=this.name=e.code,this.data={url:t,transport:n,suggestion:r}}};Lt.code=`UnknownTransportError`;var Rt=class e extends g{constructor(t){super(`Cannot parse remote URL: "${t}"`),this.code=this.name=e.code,this.data={url:t}}};Rt.code=`UrlParseError`;var zt=class e extends g{constructor(){super(`The operation was canceled.`),this.code=this.name=e.code,this.data={}}};zt.code=`UserCanceledError`;var Bt=class e extends g{constructor(t){super(`Could not merge index: Entry for '${t}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=e.code,this.data={filepath:t}}};Bt.code=`IndexResetError`;var Vt=class e extends g{constructor(t){super(`"${t}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=e.code,this.data={ref:t}}};Vt.code=`NoCommitError`;var Ht=Object.freeze({__proto__:null,AlreadyExistsError:ht,AmbiguousError:gt,CheckoutConflictError:_t,CherryPickMergeCommitError:vt,CherryPickRootCommitError:yt,CommitNotFetchedError:bt,EmptyServerResponseError:xt,FastForwardError:St,GitPushError:Ct,HttpError:wt,InternalError:v,InvalidFilepathError:Tt,InvalidOidError:K,InvalidRefNameError:Et,MaxDepthError:Dt,MergeNotSupportedError:Ot,MergeConflictError:kt,MissingNameError:At,MissingParameterError:jt,MultipleGitError:Mt,NoRefspecError:q,NotFoundError:G,ObjectTypeError:le,ParseError:Nt,PushRejectedError:Pt,RemoteCapabilityError:Ft,SmartHttpError:It,UnknownTransportError:Lt,UnsafeFilepathError:y,UrlParseError:Rt,UserCanceledError:zt,UnmergedPathsError:_,IndexResetError:Bt,NoCommitError:Vt});function Ut({name:e,email:t,timestamp:n,timezoneOffset:r}){return r=Wt(r),`${e} <${t}> ${n} ${r}`}function Wt(e){let t=Gt(Kt(e));e=Math.abs(e);let n=Math.floor(e/60);e-=n*60;let r=String(n),i=String(e);return r.length<2&&(r=`0`+r),i.length<2&&(i=`0`+i),(t===-1?`-`:`+`)+r+i}function Gt(e){return Math.sign(e)||(Object.is(e,-0)?-1:1)}function Kt(e){return e===0?e:-e}function qt(e){return e=e.replace(/\r/g,``),e=e.replace(/^\n+/,``),e=e.replace(/\n+$/,``)+`
|
|
27
|
-
`,e}function Jt(e){let[,t,n,r,i]=e.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:t,email:n,timestamp:Number(r),timezoneOffset:Yt(i)}}function Yt(e){let[,t,n,r]=e.match(/(\+|-)(\d\d)(\d\d)/);return r=(t===`+`?1:-1)*(Number(n)*60+Number(r)),Xt(r)}function Xt(e){return e===0?e:-e}var Zt=class e{constructor(t){if(typeof t==`string`)this._tag=t;else if(
|
|
25
|
+
`)}},je=class{static async get({fs:e,gitdir:t}){let n=await e.read(`${t}/config`,{encoding:`utf8`});return Ae.from(n)}static async save({fs:e,gitdir:t,config:n}){await e.write(`${t}/config`,n.toString(),{encoding:`utf8`})}};let Me=e=>[`${e}`,`refs/${e}`,`refs/tags/${e}`,`refs/heads/${e}`,`refs/remotes/${e}`,`refs/remotes/${e}/HEAD`],Ne=[`config`,`description`,`index`,`shallow`,`commondir`],Pe;async function Fe(e,t){return Pe===void 0&&(Pe=new o),Pe.acquire(e,t)}var Q=class e{static async updateRemoteRefs({fs:t,gitdir:n,remote:r,refs:i,symrefs:a,tags:o,refspecs:s=void 0,prune:c=!1,pruneTags:l=!1}){for(let e of i.values())if(!e.match(/[0-9a-f]{40}/))throw new K(e);let u=await je.get({fs:t,gitdir:n});if(!s){if(s=await u.getall(`remote.${r}.fetch`),s.length===0)throw new q(r);s.unshift(`+HEAD:refs/remotes/${r}/HEAD`)}let d=de.from(s),f=new Map;if(l){let r=await e.listRefs({fs:t,gitdir:n,filepath:`refs/tags`});await e.deleteRefs({fs:t,gitdir:n,refs:r.map(e=>`refs/tags/${e}`)})}if(o){for(let r of i.keys())if(r.startsWith(`refs/tags`)&&!r.endsWith(`^{}`)&&!await e.exists({fs:t,gitdir:n,ref:r})){let e=i.get(r);f.set(r,e)}}let p=d.translate([...i.keys()]);for(let[e,t]of p){let n=i.get(e);f.set(t,n)}let m=d.translate([...a.keys()]);for(let[e,t]of m){let n=a.get(e),r=d.translateOne(n);r&&f.set(t,`ref: ${r}`)}let h=[];if(c){for(let r of d.localNamespaces()){let i=(await e.listRefs({fs:t,gitdir:n,filepath:r})).map(e=>`${r}/${e}`);for(let e of i)f.has(e)||h.push(e)}h.length>0&&await e.deleteRefs({fs:t,gitdir:n,refs:h})}for(let[e,r]of f)await Fe(e,async()=>t.write(Y(n,e),`${r.trim()}\n`,`utf8`));return{pruned:h}}static async writeRef({fs:e,gitdir:t,ref:n,value:r}){if(!r.match(/[0-9a-f]{40}/))throw new K(r);await Fe(n,async()=>e.write(Y(t,n),`${r.trim()}\n`,`utf8`))}static async writeSymbolicRef({fs:e,gitdir:t,ref:n,value:r}){await Fe(n,async()=>e.write(Y(t,n),`ref: ${r.trim()}\n`,`utf8`))}static async deleteRef({fs:t,gitdir:n,ref:r}){return e.deleteRefs({fs:t,gitdir:n,refs:[r]})}static async deleteRefs({fs:e,gitdir:t,refs:n}){await Promise.all(n.map(n=>e.rm(Y(t,n))));let r=await Fe(`packed-refs`,async()=>e.read(`${t}/packed-refs`,{encoding:`utf8`})),i=ue.from(r),a=i.refs.size;for(let e of n)i.refs.has(e)&&i.delete(e);i.refs.size<a&&(r=i.toString(),await Fe(`packed-refs`,async()=>e.write(`${t}/packed-refs`,r,{encoding:`utf8`})))}static async resolve({fs:t,gitdir:n,ref:r,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return r;if(r.startsWith(`ref: `))return r=r.slice(5),e.resolve({fs:t,gitdir:n,ref:r,depth:i});if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let a=await e.packedRefs({fs:t,gitdir:n}),o=Me(r).filter(e=>!Ne.includes(e));for(let r of o){let o=await Fe(r,async()=>await t.read(`${n}/${r}`,{encoding:`utf8`})||a.get(r));if(o)return e.resolve({fs:t,gitdir:n,ref:o.trim(),depth:i})}throw new G(r)}static async exists({fs:t,gitdir:n,ref:r}){try{return await e.expand({fs:t,gitdir:n,ref:r}),!0}catch{return!1}}static async expand({fs:t,gitdir:n,ref:r}){if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let i=await e.packedRefs({fs:t,gitdir:n}),a=Me(r);for(let e of a)if(await Fe(e,async()=>t.exists(`${n}/${e}`))||i.has(e))return e;throw new G(r)}static async expandAgainstMap({ref:e,map:t}){let n=Me(e);for(let e of n)if(await t.has(e))return e;throw new G(e)}static resolveAgainstMap({ref:t,fullref:n=t,depth:r=void 0,map:i}){if(r!==void 0&&(r--,r===-1))return{fullref:n,oid:t};if(t.startsWith(`ref: `))return t=t.slice(5),e.resolveAgainstMap({ref:t,fullref:n,depth:r,map:i});if(t.length===40&&/[0-9a-f]{40}/.test(t))return{fullref:n,oid:t};let a=Me(t);for(let t of a){let n=i.get(t);if(n)return e.resolveAgainstMap({ref:n.trim(),fullref:t,depth:r,map:i})}throw new G(t)}static async packedRefs({fs:e,gitdir:t}){let n=await Fe(`packed-refs`,async()=>e.read(`${t}/packed-refs`,{encoding:`utf8`}));return ue.from(n).refs}static async listRefs({fs:t,gitdir:n,filepath:r}){let i=e.packedRefs({fs:t,gitdir:n}),a=null;try{a=await t.readdirDeep(`${n}/${r}`),a=a.map(e=>e.replace(`${n}/${r}/`,``))}catch{a=[]}for(let e of(await i).keys())e.startsWith(r)&&(e=e.replace(r+`/`,``),a.includes(e)||a.push(e));return a.sort(fe),a}static async listBranches({fs:t,gitdir:n,remote:r}){return r?e.listRefs({fs:t,gitdir:n,filepath:`refs/remotes/${r}`}):e.listRefs({fs:t,gitdir:n,filepath:`refs/heads`})}static async listTags({fs:t,gitdir:n}){return(await e.listRefs({fs:t,gitdir:n,filepath:`refs/tags`})).filter(e=>!e.endsWith(`^{}`))}};function Ie(e,t){return b(Le(e),Le(t))}function Le(e){return e.mode===`040000`?e.path+`/`:e.path}function Re(e){switch(e){case`040000`:return`tree`;case`100644`:return`blob`;case`100755`:return`blob`;case`120000`:return`blob`;case`160000`:return`commit`}throw new _(`Unexpected GitTree entry mode: ${e}`)}function ze(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(32,n);if(r===-1)throw new _(`GitTree: Error parsing buffer at byte location ${n}: Could not find the next space character.`);let i=e.indexOf(0,n);if(i===-1)throw new _(`GitTree: Error parsing buffer at byte location ${n}: Could not find the next null character.`);let a=e.slice(n,r).toString(`utf8`);a===`40000`&&(a=`040000`);let o=Re(a),s=e.slice(r+1,i).toString(`utf8`);if(s.includes(`\\`)||s.includes(`/`))throw new v(s);let c=e.slice(i+1,i+21).toString(`hex`);n=i+21,t.push({mode:a,path:s,oid:c,type:o})}return t}function Be(e){if(typeof e==`number`&&(e=e.toString(8)),e.match(/^0?4.*/))return`040000`;if(e.match(/^1006.*/))return`100644`;if(e.match(/^1007.*/))return`100755`;if(e.match(/^120.*/))return`120000`;if(e.match(/^160.*/))return`160000`;throw new _(`Could not understand file mode: ${e}`)}function Ve(e){return!e.oid&&e.sha&&(e.oid=e.sha),e.mode=Be(e.mode),e.type||=Re(e.mode),e}var He=class e{constructor(e){if(r.Buffer.isBuffer(e))this._entries=ze(e);else if(Array.isArray(e))this._entries=e.map(Ve);else throw new _(`invalid type passed to GitTree constructor`);this._entries.sort(S)}static from(t){return new e(t)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
|
|
26
|
+
`)}toObject(){let e=[...this._entries];return e.sort(Ie),r.Buffer.concat(e.map(e=>{let t=r.Buffer.from(e.mode.replace(/^0/,``)),n=r.Buffer.from(` `),i=r.Buffer.from(e.path,`utf8`),a=r.Buffer.from([0]),o=r.Buffer.from(e.oid,`hex`);return r.Buffer.concat([t,n,i,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Ue=class{static wrap({type:e,object:t}){let n=`${e} ${t.length}\x00`,r=n.length,i=r+t.length,a=new Uint8Array(i);for(let e=0;e<r;e++)a[e]=n.charCodeAt(e);return a.set(t,r),a}static unwrap(e){let t=e.indexOf(32),n=e.indexOf(0),i=e.slice(0,t).toString(`utf8`),a=e.slice(t+1,n).toString(`utf8`),o=e.length-(n+1);if(parseInt(a)!==o)throw new _(`Length mismatch: expected ${a} bytes but got ${o} instead.`);return{type:i,object:r.Buffer.from(e.slice(n+1))}}};async function We({fs:e,gitdir:t,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`,i=await e.read(`${t}/${r}`);return i?{object:i,format:`deflated`,source:r}:null}function Ge(e,t){let n=new y(e),i=Ke(n);if(i!==t.byteLength)throw new _(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${t.length} bytes`);let a=Ke(n),o,s=Je(n,t);if(s.byteLength===a)o=s;else{o=r.Buffer.alloc(a);let e=new y(o);for(e.copy(s);!n.eof();)e.copy(Je(n,t));let i=e.tell();if(a!==i)throw new _(`applyDelta expected target buffer to be ${a} bytes but the resulting buffer was ${i} bytes`)}return o}function Ke(e){let t=0,n=0,r=null;do r=e.readUInt8(),t|=(r&127)<<n,n+=7;while(r&128);return t}function qe(e,t,n){let r=0,i=0;for(;n--;)t&1&&(r|=e.readUInt8()<<i),t>>=1,i+=8;return r}function Je(e,t){let n=e.readUInt8();if(n&128){let r=qe(e,n&15,4),i=qe(e,(n&112)>>4,3);return i===0&&(i=65536),t.slice(r,r+i)}else return e.slice(n)}function Ye(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function Xe(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:Ye(e)}var Ze=class{constructor(e){if(r.Buffer===void 0)throw Error(`Missing Buffer dependency`);this.stream=Xe(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:t}=await this.stream.next();return e&&(this._ended=!0,!t)?r.Buffer.alloc(0):(t&&=r.Buffer.from(t),t)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let t=[this.buffer];for(;this.cursor+e>Qe(t);){let e=await this._next();if(this._ended)break;t.push(e)}this.buffer=r.Buffer.concat(t)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function Qe(e){return e.reduce((e,t)=>e+t.length,0)}async function $e(e,t){let n=new Ze(e),r=await n.read(4);if(r=r.toString(`utf8`),r!==`PACK`)throw new _(`Invalid PACK header '${r}'`);let i=await n.read(4);if(i=i.readUInt32BE(0),i!==2)throw new _(`Invalid packfile version: ${i}`);let a=await n.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!n.eof()&&a--;){let e=n.tell(),{type:r,length:i,ofs:o,reference:s}=await et(n),c=new l.Inflate;for(;!c.result;){let l=await n.chunk();if(!l)break;if(c.push(l,!1),c.err)throw new _(`Pako error: ${c.msg}`);if(c.result){if(c.result.length!==i)throw new _(`Inflated object size is different from that stated in packfile.`);await n.undo(),await n.read(l.length-c.strm.avail_in);let u=n.tell();await t({data:c.result,type:r,num:a,offset:e,end:u,reference:s,ofs:o})}}}}async function et(e){let t=await e.byte(),n=t>>4&7,i=t&15;if(t&128){let n=4;do t=await e.byte(),i|=(t&127)<<n,n+=7;while(t&128)}let a,o;if(n===6){let n=0;a=0;let i=[];do t=await e.byte(),a|=(t&127)<<n,n+=7,i.push(t);while(t&128);o=r.Buffer.from(i)}return n===7&&(o=await e.read(20)),{type:n,length:i,ofs:a,reference:o}}let tt=!1;async function nt(e){return tt===null&&(tt=it()),tt?rt(e):l.inflate(e)}async function rt(e){let t=new DecompressionStream(`deflate`),n=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}function it(){try{if(new DecompressionStream(`deflate`))return!0}catch{}return!1}function at(e){let t=[],n=0,r=0;do{n=e.readUInt8();let i=n&127;t.push(i),r=n&128}while(r);return t.reduce((e,t)=>e+1<<7|t,-1)}function ot(e,t){let n=t,r=4,i=null;do i=e.readUInt8(),n|=(i&127)<<r,r+=7;while(i&128);return n}var st=class e{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:t,getExternalRefDelta:n}){let r=new y(t);if(r.slice(4).toString(`hex`)!==`ff744f63`)return;let i=r.readUInt32BE();if(i!==2)throw new _(`Unable to read version ${i} packfile IDX. (Only version 2 supported)`);if(t.byteLength>2048*1024*1024)throw new _(`To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.`);r.seek(r.tell()+1020);let a=r.readUInt32BE(),o=[];for(let e=0;e<a;e++)o[e]=r.slice(20).toString(`hex`);r.seek(r.tell()+4*a);let s=new Map;for(let e=0;e<a;e++)s.set(o[e],r.readUInt32BE());let c=r.slice(20).toString(`hex`);return new e({hashes:o,crcs:{},offsets:s,packfileSha:c,getExternalRefDelta:n})}static async fromPack({pack:t,getExternalRefDelta:n,onProgress:r}){let i={1:`commit`,2:`tree`,3:`blob`,4:`tag`,6:`ofs-delta`,7:`ref-delta`},a={},o=t.slice(-20).toString(`hex`),s=[],l={},u=new Map,d=null,f=null;await $e([t],async({data:e,type:t,reference:n,offset:o,num:s})=>{d===null&&(d=s);let c=Math.floor((d-s)*100/d);c!==f&&r&&await r({phase:`Receiving objects`,loaded:d-s,total:d}),f=c,t=i[t],([`commit`,`tree`,`blob`,`tag`].includes(t)||t===`ofs-delta`||t===`ref-delta`)&&(a[o]={type:t,offset:o})});let p=Object.keys(a).map(Number);for(let[e,n]of p.entries()){let r=e+1===p.length?t.byteLength-20:p[e+1],i=a[n],o=c.buf(t.slice(n,r))>>>0;i.end=r,i.crc=o}let m=new e({pack:Promise.resolve(t),packfileSha:o,crcs:l,hashes:s,offsets:u,getExternalRefDelta:n});f=null;let h=0,g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let e in a){e=Number(e);let t=Math.floor(h*100/d);t!==f&&r&&await r({phase:`Resolving deltas`,loaded:h,total:d}),h++,f=t;let n=a[e];if(!n.oid)try{m.readDepth=0,m.externalReadDepth=0;let{type:t,object:r}=await m.readSlice({start:e});g[m.readDepth]+=1;let i=await j(Ue.wrap({type:t,object:r}));n.oid=i,s.push(i),u.set(i,e),l[i]=n.crc}catch{continue}}return s.sort(),m}async toBuffer(){let e=[],t=(t,n)=>{e.push(r.Buffer.from(t,n))};t(`ff744f63`,`hex`),t(`00000002`,`hex`);let n=new y(r.Buffer.alloc(256*4));for(let e=0;e<256;e++){let t=0;for(let n of this.hashes)parseInt(n.slice(0,2),16)<=e&&t++;n.writeUInt32BE(t)}e.push(n.buffer);for(let e of this.hashes)t(e,`hex`);let i=new y(r.Buffer.alloc(this.hashes.length*4));for(let e of this.hashes)i.writeUInt32BE(this.crcs[e]);e.push(i.buffer);let a=new y(r.Buffer.alloc(this.hashes.length*4));for(let e of this.hashes)a.writeUInt32BE(this.offsets.get(e));e.push(a.buffer),t(this.packfileSha,`hex`);let o=r.Buffer.concat(e),s=await j(o),c=r.Buffer.alloc(20);return c.write(s,`hex`),r.Buffer.concat([o,c])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new _(`Could not read object ${e} from packfile`)}let t=this.offsets.get(e);return this.readSlice({start:t})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let t={16:`commit`,32:`tree`,48:`blob`,64:`tag`,96:`ofs_delta`,112:`ref_delta`},n=await this.pack;if(!n)throw new _(`Could not read packfile data. The packfile may be missing, corrupted, or too large to read into memory.`);let i=n.slice(e),a=new y(i),o=a.readUInt8(),s=o&112,c=t[s];if(c===void 0)throw new _(`Unrecognized type: 0b`+s.toString(2));let l=o&15,u=l;o&128&&(u=ot(a,l));let d=null,f=null;if(c===`ofs_delta`){let t=e-at(a);({object:d,type:c}=await this.readSlice({start:t}))}if(c===`ref_delta`){let e=a.slice(20).toString(`hex`);({object:d,type:c}=await this.read({oid:e}))}let p=i.slice(a.tell());if(f=r.Buffer.from(await nt(p)),f.byteLength!==u)throw new _(`Packfile told us object would have length ${u} but it had length ${f.byteLength}`);return d&&(f=r.Buffer.from(Ge(f,d))),this.readDepth>3&&(this.offsetCache[e]={type:c,object:f}),{type:c,format:`content`,object:f}}};let ct=Symbol(`PackfileCache`);async function lt({fs:e,filename:t,getExternalRefDelta:n,emitter:r,emitterPrefix:i}){let a=await e.read(t);return st.fromIdx({idx:a,getExternalRefDelta:n})}function ut({fs:e,cache:t,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}){t[ct]||(t[ct]=new Map);let o=t[ct].get(n);return o||(o=lt({fs:e,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}),t[ct].set(n,o)),o}let dt=8*1024*1024;async function ft(e,{start:t=0,end:n=e.length}={}){let r=u.createHash(`sha1`);for(let i=t;i<n;i+=dt)r.update(e.subarray(i,Math.min(i+dt,n)));return r.digest(`hex`)}async function pt({fs:e,cache:t,gitdir:n,oid:r,format:i=`content`,getExternalRefDelta:a}){let o=await e.readdir(Y(n,`objects/pack`));o=o.filter(e=>e.endsWith(`.idx`));for(let i of o){let o=`${n}/objects/pack/${i}`,s=await ut({fs:e,cache:t,filename:o,getExternalRefDelta:a});if(s.error)throw new _(s.error);if(s.offsets.has(r)){let t=o.replace(/idx$/,`pack`);s.pack||=e.read(t);let n=await s.pack;if(!n)throw s.pack=null,new _(`Could not read packfile at ${t}. The file may be missing, corrupted, or too large to read into memory.`);if(!s._checksumVerified){let e=s.packfileSha,t=n.subarray(-20),r=Array.from(t).map(e=>e.toString(16).padStart(2,`0`)).join(``);if(r!==e)throw new _(`Packfile trailer mismatch: expected ${e}, got ${r}. The packfile may be corrupted.`);let i=await ft(n,{start:0,end:n.length-20});if(i!==e)throw new _(`Packfile payload corrupted: calculated ${i} but expected ${e}. The packfile may have been tampered with.`);s._checksumVerified=!0}let c=await s.read({oid:r,getExternalRefDelta:a});return c.format=`content`,c.source=`objects/pack/${i.replace(/idx$/,`pack`)}`,c}}return null}async function mt({fs:e,cache:t,gitdir:n,oid:i,format:a=`content`}){let o=r=>mt({fs:e,cache:t,gitdir:n,oid:r}),s;if(i===`4b825dc642cb6eb9a060e54bf8d69288fbee4904`&&(s={format:`wrapped`,object:r.Buffer.from(`tree 0\0`)}),s||=await We({fs:e,gitdir:n,oid:i}),!s){if(s=await pt({fs:e,cache:t,gitdir:n,oid:i,getExternalRefDelta:o}),!s)throw new G(i);return s}if(a===`deflated`||(s.format===`deflated`&&(s.object=r.Buffer.from(await nt(s.object)),s.format=`wrapped`),a===`wrapped`))return s;let c=await j(s.object);if(c!==i)throw new _(`SHA check failed! Expected ${i}, computed ${c}`);let{object:l,type:u}=Ue.unwrap(s.object);if(s.type=u,s.object=l,s.format=`content`,a===`content`)return s;throw new _(`invalid requested format "${a}"`)}var ht=class e extends h{constructor(t,n,r=!0){super(`Failed to create ${t} at ${n} because it already exists.${r?` (Hint: use 'force: true' parameter to overwrite existing ${t}.)`:``}`),this.code=this.name=e.code,this.data={noun:t,where:n,canForce:r}}};ht.code=`AlreadyExistsError`;var gt=class e extends h{constructor(t,n,r){super(`Found multiple ${t} matching "${n}" (${r.join(`, `)}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=e.code,this.data={nouns:t,short:n,matches:r}}};gt.code=`AmbiguousError`;var _t=class e extends h{constructor(t){super(`Your local changes to the following files would be overwritten by checkout: ${t.join(`, `)}`),this.code=this.name=e.code,this.data={filepaths:t}}};_t.code=`CheckoutConflictError`;var vt=class e extends h{constructor(t,n){super(`Cannot cherry-pick merge commit ${t}. Merge commits have ${n} parents and require specifying which parent to use as the base.`),this.code=this.name=e.code,this.data={oid:t,parentCount:n}}};vt.code=`CherryPickMergeCommitError`;var yt=class e extends h{constructor(t){super(`Cannot cherry-pick root commit ${t}. Root commits have no parents.`),this.code=this.name=e.code,this.data={oid:t}}};yt.code=`CherryPickRootCommitError`;var bt=class e extends h{constructor(t,n){super(`Failed to checkout "${t}" because commit ${n} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=e.code,this.data={ref:t,oid:n}}};bt.code=`CommitNotFetchedError`;var xt=class e extends h{constructor(){super(`Empty response from git server.`),this.code=this.name=e.code,this.data={}}};xt.code=`EmptyServerResponseError`;var St=class e extends h{constructor(){super(`A simple fast-forward merge was not possible.`),this.code=this.name=e.code,this.data={}}};St.code=`FastForwardError`;var Ct=class e extends h{constructor(t,n){super(`One or more branches were not updated: ${t}`),this.code=this.name=e.code,this.data={prettyDetails:t,result:n}}};Ct.code=`GitPushError`;var wt=class e extends h{constructor(t,n,r){super(`HTTP Error: ${t} ${n}`),this.code=this.name=e.code,this.data={statusCode:t,statusMessage:n,response:r}}};wt.code=`HttpError`;var Tt=class e extends h{constructor(t){let n=`invalid filepath`;t===`leading-slash`||t===`trailing-slash`?n=`"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.`:t===`directory`&&(n=`"filepath" should not be a directory.`),super(n),this.code=this.name=e.code,this.data={reason:t}}};Tt.code=`InvalidFilepathError`;var Et=class e extends h{constructor(t,n){super(`"${t}" would be an invalid git reference. (Hint: a valid alternative would be "${n}".)`),this.code=this.name=e.code,this.data={ref:t,suggestion:n}}};Et.code=`InvalidRefNameError`;var Dt=class e extends h{constructor(t){super(`Maximum search depth of ${t} exceeded.`),this.code=this.name=e.code,this.data={depth:t}}};Dt.code=`MaxDepthError`;var Ot=class e extends h{constructor(){super(`Merges with conflicts are not supported yet.`),this.code=this.name=e.code,this.data={}}};Ot.code=`MergeNotSupportedError`;var kt=class e extends h{constructor(t,n,r,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${t.toString()}. Fix conflicts then commit the result.`),this.code=this.name=e.code,this.data={filepaths:t,bothModified:n,deleteByUs:r,deleteByTheirs:i}}};kt.code=`MergeConflictError`;var At=class e extends h{constructor(t){super(`No name was provided for ${t} in the argument or in the .git/config file.`),this.code=this.name=e.code,this.data={role:t}}};At.code=`MissingNameError`;var jt=class e extends h{constructor(t){super(`The function requires a "${t}" parameter but none was provided.`),this.code=this.name=e.code,this.data={parameter:t}}};jt.code=`MissingParameterError`;var Mt=class e extends h{constructor(t){super(`There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more`),this.code=this.name=e.code,this.data={errors:t},this.errors=t}};Mt.code=`MultipleGitError`;var Nt=class e extends h{constructor(t,n){super(`Expected "${t}" but received "${n}".`),this.code=this.name=e.code,this.data={expected:t,actual:n}}};Nt.code=`ParseError`;var Pt=class e extends h{constructor(t){let n=``;t===`not-fast-forward`?n=` because it was not a simple fast-forward`:t===`tag-exists`&&(n=` because tag already exists`),super(`Push rejected${n}. Use "force: true" to override.`),this.code=this.name=e.code,this.data={reason:t}}};Pt.code=`PushRejectedError`;var Ft=class e extends h{constructor(t,n){super(`Remote does not support the "${t}" so the "${n}" parameter cannot be used.`),this.code=this.name=e.code,this.data={capability:t,parameter:n}}};Ft.code=`RemoteCapabilityError`;var It=class e extends h{constructor(t,n){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${t}`),this.code=this.name=e.code,this.data={preview:t,response:n}}};It.code=`SmartHttpError`;var Lt=class e extends h{constructor(t,n,r){super(`Git remote "${t}" uses an unrecognized transport protocol: "${n}"`),this.code=this.name=e.code,this.data={url:t,transport:n,suggestion:r}}};Lt.code=`UnknownTransportError`;var Rt=class e extends h{constructor(t){super(`Cannot parse remote URL: "${t}"`),this.code=this.name=e.code,this.data={url:t}}};Rt.code=`UrlParseError`;var zt=class e extends h{constructor(){super(`The operation was canceled.`),this.code=this.name=e.code,this.data={}}};zt.code=`UserCanceledError`;var Bt=class e extends h{constructor(t){super(`Could not merge index: Entry for '${t}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=e.code,this.data={filepath:t}}};Bt.code=`IndexResetError`;var Vt=class e extends h{constructor(t){super(`"${t}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=e.code,this.data={ref:t}}};Vt.code=`NoCommitError`;var Ht=Object.freeze({__proto__:null,AlreadyExistsError:ht,AmbiguousError:gt,CheckoutConflictError:_t,CherryPickMergeCommitError:vt,CherryPickRootCommitError:yt,CommitNotFetchedError:bt,EmptyServerResponseError:xt,FastForwardError:St,GitPushError:Ct,HttpError:wt,InternalError:_,InvalidFilepathError:Tt,InvalidOidError:K,InvalidRefNameError:Et,MaxDepthError:Dt,MergeNotSupportedError:Ot,MergeConflictError:kt,MissingNameError:At,MissingParameterError:jt,MultipleGitError:Mt,NoRefspecError:q,NotFoundError:G,ObjectTypeError:le,ParseError:Nt,PushRejectedError:Pt,RemoteCapabilityError:Ft,SmartHttpError:It,UnknownTransportError:Lt,UnsafeFilepathError:v,UrlParseError:Rt,UserCanceledError:zt,UnmergedPathsError:g,IndexResetError:Bt,NoCommitError:Vt});function Ut({name:e,email:t,timestamp:n,timezoneOffset:r}){return r=Wt(r),`${e} <${t}> ${n} ${r}`}function Wt(e){let t=Gt(Kt(e));e=Math.abs(e);let n=Math.floor(e/60);e-=n*60;let r=String(n),i=String(e);return r.length<2&&(r=`0`+r),i.length<2&&(i=`0`+i),(t===-1?`-`:`+`)+r+i}function Gt(e){return Math.sign(e)||(Object.is(e,-0)?-1:1)}function Kt(e){return e===0?e:-e}function qt(e){return e=e.replace(/\r/g,``),e=e.replace(/^\n+/,``),e=e.replace(/\n+$/,``)+`
|
|
27
|
+
`,e}function Jt(e){let[,t,n,r,i]=e.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:t,email:n,timestamp:Number(r),timezoneOffset:Yt(i)}}function Yt(e){let[,t,n,r]=e.match(/(\+|-)(\d\d)(\d\d)/);return r=(t===`+`?1:-1)*(Number(n)*60+Number(r)),Xt(r)}function Xt(e){return e===0?e:-e}var Zt=class e{constructor(t){if(typeof t==`string`)this._tag=t;else if(r.Buffer.isBuffer(t))this._tag=t.toString(`utf8`);else if(typeof t==`object`)this._tag=e.render(t);else throw new _(`invalid type passed to GitAnnotatedTag constructor`)}static from(t){return new e(t)}static render(e){return`object ${e.object}
|
|
28
28
|
type ${e.type}
|
|
29
29
|
tag ${e.tag}
|
|
30
30
|
tagger ${Ut(e.tagger)}
|
|
@@ -40,48 +40,48 @@ ${e.gpgsig?e.gpgsig:``}`}justHeaders(){return this._tag.slice(0,this._tag.indexO
|
|
|
40
40
|
-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
|
|
41
41
|
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
|
42
42
|
-----BEGIN PGP SIGNATURE-----`)!==-1)return qt(this._tag.slice(this._tag.indexOf(`-----BEGIN PGP SIGNATURE-----`),this._tag.indexOf(`-----END PGP SIGNATURE-----`)+27))}payload(){return this.withoutSignature()+`
|
|
43
|
-
`}toObject(){return
|
|
43
|
+
`}toObject(){return r.Buffer.from(this._tag,`utf8`)}static async sign(t,n,r){let i=t.payload(),{signature:a}=await n({payload:i,secretKey:r});a=qt(a);let o=i+a;return e.from(o)}};function Qt(e){return e.trim().split(`
|
|
44
44
|
`).map(e=>` `+e).join(`
|
|
45
45
|
`)+`
|
|
46
46
|
`}function $t(e){return e.split(`
|
|
47
47
|
`).map(e=>e.replace(/^ /,``)).join(`
|
|
48
|
-
`)}var en=class e{constructor(t){if(typeof t==`string`)this._commit=t;else if(
|
|
48
|
+
`)}var en=class e{constructor(t){if(typeof t==`string`)this._commit=t;else if(r.Buffer.isBuffer(t))this._commit=t.toString(`utf8`);else if(typeof t==`object`)this._commit=e.render(t);else throw new _(`invalid type passed to GitCommit constructor`)}static fromPayloadSignature({payload:t,signature:n}){let r=e.justHeaders(t),i=e.justMessage(t),a=qt(r+`
|
|
49
49
|
gpgsig`+Qt(n)+`
|
|
50
|
-
`+i);return new e(a)}static from(t){return new e(t)}toObject(){return
|
|
50
|
+
`+i);return new e(a)}static from(t){return new e(t)}toObject(){return r.Buffer.from(this._commit,`utf8`)}headers(){return this.parseHeaders()}message(){return e.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return qt(e.slice(e.indexOf(`
|
|
51
51
|
|
|
52
52
|
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
|
|
53
53
|
|
|
54
54
|
`))}parseHeaders(){let t=e.justHeaders(this._commit).split(`
|
|
55
55
|
`),n=[];for(let e of t)e[0]===` `?n[n.length-1]+=`
|
|
56
56
|
`+e.slice(1):n.push(e);let r={parent:[]};for(let e of n){let t=e.slice(0,e.indexOf(` `)),n=e.slice(e.indexOf(` `)+1);Array.isArray(r[t])?r[t].push(n):r[t]=n}return r.author&&=Jt(r.author),r.committer&&=Jt(r.committer),r}static renderHeaders(e){let t=``;if(e.tree?t+=`tree ${e.tree}\n`:t+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
|
57
|
-
`,e.parent){if(e.parent.length===void 0)throw new
|
|
57
|
+
`,e.parent){if(e.parent.length===void 0)throw new _(`commit 'parent' property should be an array`);for(let n of e.parent)t+=`parent ${n}\n`}let n=e.author;t+=`author ${Ut(n)}\n`;let r=e.committer||e.author;return t+=`committer ${Ut(r)}\n`,e.gpgsig&&(t+=`gpgsig`+Qt(e.gpgsig)),t}static render(t){return e.renderHeaders(t)+`
|
|
58
58
|
`+qt(t.message)}render(){return this._commit}withoutSignature(){let e=qt(this._commit);if(e.indexOf(`
|
|
59
59
|
gpgsig`)===-1)return e;let t=e.slice(0,e.indexOf(`
|
|
60
60
|
gpgsig`)),n=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
|
|
61
61
|
`)+28);return qt(t+`
|
|
62
62
|
`+n)}isolateSignature(){return $t(this._commit.slice(this._commit.indexOf(`-----BEGIN PGP SIGNATURE-----`),this._commit.indexOf(`-----END PGP SIGNATURE-----`)+27))}static async sign(t,n,r){let i=t.withoutSignature(),a=e.justMessage(t._commit),{signature:o}=await n({payload:i,secretKey:r});o=qt(o);let s=e.justHeaders(t._commit)+`
|
|
63
63
|
gpgsig`+Qt(o)+`
|
|
64
|
-
`+a;return e.from(s)}};async function tn({fs:e,cache:t,gitdir:n,oid:r}){if(r===`4b825dc642cb6eb9a060e54bf8d69288fbee4904`)return{tree:He.from([]),oid:r};let{type:i,object:a}=await mt({fs:e,cache:t,gitdir:n,oid:r});if(i===`tag`)return r=Zt.from(a).parse().object,tn({fs:e,cache:t,gitdir:n,oid:r});if(i===`commit`)return r=en.from(a).parse().tree,tn({fs:e,cache:t,gitdir:n,oid:r});if(i!==`tree`)throw new le(r,i,`tree`);return{tree:He.from(a),oid:r}}var nn=class{constructor({fs:e,gitdir:t,ref:n,cache:r}){this.fs=e,this.cache=r,this.gitdir=t,this.mapPromise=(async()=>{let r=new Map,i;try{i=await Q.resolve({fs:e,gitdir:t,ref:n})}catch(e){e instanceof G&&(i=`4b825dc642cb6eb9a060e54bf8d69288fbee4904`)}let a=await tn({fs:e,cache:this.cache,gitdir:t,oid:i});return a.type=`tree`,a.mode=`40000`,r.set(`.`,a),r})();let i=this;this.ConstructEntry=class{constructor(e){this._fullpath=e,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let t=e._fullpath,{fs:n,cache:r,gitdir:i}=this,a=await this.mapPromise,o=a.get(t);if(!o)throw Error(`No obj for ${t}`);let s=o.oid;if(!s)throw Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!==`tree`)return null;let{type:c,object:l}=await mt({fs:n,cache:r,gitdir:i,oid:s});if(c!==o.type)throw new le(s,c,o.type);let u=He.from(l);for(let e of u)a.set(Y(t,e.path),e);return u.entries().map(e=>Y(t,e.path))}async type(e){if(e._type===!1){let{type:t}=(await this.mapPromise).get(e._fullpath);e._type=t}return e._type}async mode(e){if(e._mode===!1){let{mode:t}=(await this.mapPromise).get(e._fullpath);e._mode=w(parseInt(t,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let t=await this.mapPromise,{fs:n,cache:r,gitdir:i}=this,a=t.get(e._fullpath).oid,{type:o,object:s}=await mt({fs:n,cache:r,gitdir:i,oid:a});o===`blob`?e._content=new Uint8Array(s):e._content=void 0}return e._content}async oid(e){return e._oid===!1&&(e._oid=(await this.mapPromise).get(e._fullpath).oid),e._oid}};function rn({ref:e=`HEAD`}={}){let t=Object.create(null);return Object.defineProperty(t,ce,{value:function({fs:t,gitdir:n,cache:r}){return new nn({fs:t,gitdir:n,ref:e,cache:r})}}),Object.freeze(t),t}var an=class{constructor({fs:e,dir:t,gitdir:n,cache:r}){this.fs=e,this.cache=r,this.dir=t,this.gitdir=n,this.config=null;let i=this;this.ConstructEntry=class{constructor(e){this._fullpath=e,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let t=e._fullpath,{fs:n,dir:r}=this,i=await n.readdir(Y(r,t));return i===null?null:i.map(e=>Y(t,e))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:t,dir:n}=this,r=await t.lstat(`${n}/${e._fullpath}`);if(!r)throw Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=r.isDirectory()?`tree`:`blob`;i===`blob`&&!r.isFile()&&!r.isSymbolicLink()&&(i=`special`),e._type=i,r=D(r),e._mode=r.mode,r.size===-1&&e._actualSize&&(r.size=e._actualSize),e._stat=r}return e._stat}async content(e){if(e._content===!1){let{fs:t,dir:n,gitdir:r}=this;if(await e.type()===`tree`)e._content=void 0;else{let i;if(await e.mode()>>12==10)i=await t.readlink(`${n}/${e._fullpath}`);else{let a=await(await this._getGitConfig(t,r)).get(`core.autocrlf`);i=await t.read(`${n}/${e._fullpath}`,{autocrlf:a})}e._actualSize=i.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(i)}}return e._content}async oid(e){if(e._oid===!1){let t=this,{fs:r,gitdir:i,cache:a}=this,o;await ae.acquire({fs:r,gitdir:i,cache:a},async function(a){let s=a.entriesMap.get(e._fullpath),c=await e.stat(),l=await(await t._getGitConfig(r,i)).get(`core.filemode`),u=n.default===void 0||n.default.platform!==`win32`;if(!s||re(c,s,l,u)){let t=await e.content();t===void 0?o=void 0:(o=await j(Ue.wrap({type:`blob`,object:t})),s&&o===s.oid&&(!l||c.mode===s.mode)&&re(c,s,l,u)&&a.insert({filepath:e._fullpath,stats:c,oid:o}))}else o=s.oid}),e._oid=o}return e._oid}async _getGitConfig(e,t){return this.config||=await je.get({fs:e,gitdir:t}),this.config}};function on(){let e=Object.create(null);return Object.defineProperty(e,ce,{value:function({fs:e,dir:t,gitdir:n,cache:r}){return new an({fs:e,dir:t,gitdir:n,cache:r})}}),Object.freeze(e),e}function sn(e,t){let n=t-e;return Array.from({length:n},(t,n)=>e+n)}let cn=Array.prototype.flat===void 0?e=>e.reduce((e,t)=>e.concat(t),[]):e=>e.flat();var ln=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null||e<this.value)&&(this.value=e)}reset(){this.value=null}};function*un(e){let t=new ln,n,r=[],i=e.length;for(let n=0;n<i;n++)r[n]=e[n].next().value,r[n]!==void 0&&t.consider(r[n]);if(t.value!==null)for(;;){let a=[];n=t.value,t.reset();for(let o=0;o<i;o++)r[o]!==void 0&&r[o]===n?(a[o]=r[o],r[o]=e[o].next().value):a[o]=null,r[o]!==void 0&&t.consider(r[o]);if(yield a,t.value===null)return}}async function dn({fs:e,cache:t,dir:n,gitdir:r,trees:i,map:a=async(e,t)=>t,reduce:o=async(e,t)=>{let n=cn(t);return e!==void 0&&n.unshift(e),n},iterate:s=(e,t)=>Promise.all([...t].map(e))}){let c=i.map(i=>i[ce]({fs:e,dir:n,gitdir:r,cache:t})),l=Array(c.length).fill(`.`),u=sn(0,c.length),d=async e=>(u.forEach(t=>{let n=e[t];e[t]=n&&new c[t].ConstructEntry(n)}),{entries:e,children:un((await Promise.all(u.map(t=>{let n=e[t];return n?c[t].readdir(n):[]}))).map(e=>(e===null?[]:e)[Symbol.iterator]()))}),f=async e=>{let{entries:t,children:n}=await d(e),r=t.find(e=>e&&e._fullpath)._fullpath,i=await a(r,t);if(i!==null){let e=await s(f,n);return e=e.filter(e=>e!==void 0),o(i,e)}};return f(l)}async function fn(e,t){let n=await e.readdir(t);n==null?await e.rm(t):n.length?await Promise.all(n.map(n=>{let r=Y(t,n);return e.lstat(r).then(t=>{if(t)return t.isDirectory()?fn(e,r):e.rm(r)})})).then(()=>e.rmdir(t)):await e.rmdir(t)}function pn(e){return mn(e)&&hn(e.then)&&hn(e.catch)}function mn(e){return e&&typeof e==`object`}function hn(e){return typeof e==`function`}function gn(e){return pn((e=>{try{return e.readFile().catch(e=>e)}catch(e){return e}})(e))}let _n=[`readFile`,`writeFile`,`mkdir`,`rmdir`,`unlink`,`stat`,`lstat`,`readdir`,`readlink`,`symlink`];function vn(e,t){if(gn(t))for(let n of _n)e[`_${n}`]=t[n].bind(t);else for(let n of _n)e[`_${n}`]=
|
|
65
|
-
`),n=new TextEncoder().encode(n)}catch{}return typeof n!=`string`&&(n=i.Buffer.from(n)),n}catch{return null}}async write(e,t,n={}){try{await this._writeFile(e,t,n)}catch{await this.mkdir(H(e)),await this._writeFile(e,t,n)}}async mkdir(e,t=!1){try{await this._mkdir(e)}catch(n){if(n===null||n.code===`EEXIST`)return;if(t)throw n;if(n.code===`ENOENT`){let t=H(e);if(t===`.`||t===`/`||t===e)throw n;await this.mkdir(t),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(e){if(e.code!==`ENOENT`)throw e}}async rmdir(e,t){try{t&&t.recursive?await this._rm(e,t):await this._rmdir(e)}catch(e){if(e.code!==`ENOENT`)throw e}}async readdir(e){try{let t=await this._readdir(e);return t.sort(x),t}catch(e){return e.code===`ENOTDIR`?null:[]}}async readdirDeep(e){let t=await this._readdir(e);return(await Promise.all(t.map(async t=>{let n=e+`/`+t;return(await this._stat(n)).isDirectory()?this.readdirDeep(n):n}))).reduce((e,t)=>e.concat(t),[])}async lstat(e){try{return await this._lstat(e)}catch(e){if(e.code===`ENOENT`||(e.code||``).includes(`ENS`))return null;throw e}}async readlink(e,t={encoding:`buffer`}){try{let n=await this._readlink(e,t);return i.Buffer.isBuffer(n)?n:i.Buffer.from(n)}catch(e){if(e.code===`ENOENT`||(e.code||``).includes(`ENS`))return null;throw e}}async writelink(e,t){return this._symlink(t.toString(`utf8`),e)}};function $(e,t){if(t===void 0)throw new jt(e)}function bn(e){return e.startsWith(`/`)||/^[a-zA-Z]:[\\/]/.test(e)}async function xn({fsp:e,dotgit:t}){$(`fsp`,e),$(`dotgit`,t);let n=await e._stat(t).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return n.isDirectory()?t:n.isFile()?e._readFile(t,`utf8`).then(e=>e.trimRight().substr(8)).then(e=>bn(e)?e:Y(H(t),e)):t}async function Sn(e,t){return!e&&!t?!1:e&&!t||!e&&t?!0:!(await e.type()===`tree`&&await t.type()===`tree`||await e.type()===await t.type()&&await e.mode()===await t.mode()&&await e.oid()===await t.oid())}async function Cn({fs:e,dir:t,gitdir:n=Y(t,`.git`),commit:r=`HEAD`,cache:i={}}){try{$(`fs`,e),$(`dir`,t),$(`gitdir`,n);let a=new yn(e),o=[rn({ref:r}),on(),W()],s=[],c=await xn({fsp:a,dotgit:n});await ae.acquire({fs:a,gitdir:c,cache:i},async function(e){s=e.unmergedPaths});let l=await dn({fs:a,cache:i,dir:t,gitdir:c,trees:o,map:async function(e,[t,n,r]){let i=!await Sn(n,r),a=s.includes(e),o=!await Sn(r,t);if(i||a)return t?{path:e,mode:await t.mode(),oid:await t.oid(),type:await t.type(),content:await t.content()}:void 0;if(o)return!1;throw new Bt(e)}});await ae.acquire({fs:a,gitdir:c,cache:i},async function(e){for(let n of l)if(n!==!1){if(!n){await a.rmdir(`${t}/${n.path}`,{recursive:!0}),e.delete({filepath:n.path});continue}if(n.type===`blob`){let r=new TextDecoder().decode(n.content);await a.write(`${t}/${n.path}`,r,{mode:n.mode}),e.insert({filepath:n.path,oid:n.oid,stage:0})}}})}catch(e){throw e.caller=`git.abortMerge`,e}}var wn=class{static async isIgnored({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r}){if(V(r)===`.git`)return!0;if(r===`.`)return!1;let i=``,a=Y(n,`info`,`exclude`);await e.exists(a)&&(i=await e.read(a,`utf8`));let o=[{gitignore:Y(t,`.gitignore`),filepath:r}],s=r.split(`/`).filter(Boolean);for(let e=1;e<s.length;e++){let n=s.slice(0,e).join(`/`),r=s.slice(e).join(`/`);o.push({gitignore:Y(t,n,`.gitignore`),filepath:r})}let c=!1;for(let t of o){let n;try{n=await e.read(t.gitignore,`utf8`)}catch(e){if(e.code===`NOENT`)continue}let r=p().add(i);r.add(n);let a=H(t.filepath);if(a!==`.`&&r.ignores(a))return!0;c=c?!r.test(t.filepath).unignored:r.test(t.filepath).ignored}return c}};async function Tn({fs:e,gitdir:t,object:n,format:r,oid:i}){if(r!==`deflated`)throw new v(`GitObjectStoreLoose expects objects to write to be in deflated format`);let a=`${t}/${`objects/${i.slice(0,2)}/${i.slice(2)}`}`;await e.exists(a)||await e.write(a,n)}let En=null;async function Dn(e){return En===null&&(En=kn()),En?On(e):u.deflate(e)}async function On(e){let t=new CompressionStream(`deflate`),n=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}function kn(){try{return new CompressionStream(`deflate`).writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}async function An({fs:e,gitdir:t,type:n,object:r,format:a=`content`,oid:o=void 0,dryRun:s=!1}){return a!==`deflated`&&(a!==`wrapped`&&(r=Ue.wrap({type:n,object:r})),o=await j(r),r=i.Buffer.from(await Dn(r))),s||await Tn({fs:e,gitdir:t,object:r,format:`deflated`,oid:o}),o}function jn(e){let t;for(;~(t=e.indexOf(92));)e[t]=47;return e}async function Mn({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r,cache:i={},force:a=!1,parallel:o=!0}){try{$(`fs`,e),$(`dir`,t),$(`gitdir`,n),$(`filepath`,r);let s=new yn(e),c=await xn({fsp:s,dotgit:n});await ae.acquire({fs:s,gitdir:c,cache:i},async e=>{let n=await(await je.get({fs:s,gitdir:c})).get(`core.autocrlf`);return Nn({dir:t,gitdir:c,fs:s,filepath:r,index:e,force:a,parallel:o,autocrlf:n})})}catch(e){throw e.caller=`git.add`,e}}async function Nn({dir:e,gitdir:t,fs:n,filepath:r,index:i,force:a,parallel:o,autocrlf:s}){r=Array.isArray(r)?r:[r];let c=r.map(async r=>{if(!a&&await wn.isIgnored({fs:n,dir:e,gitdir:t,filepath:r}))return;let c=await n.lstat(Y(e,r));if(!c)throw new G(r);if(c.isDirectory()){let c=await n.readdir(Y(e,r));if(o){let l=c.map(c=>Nn({dir:e,gitdir:t,fs:n,filepath:[Y(r,c)],index:i,force:a,parallel:o,autocrlf:s}));await Promise.all(l)}else for(let l of c)await Nn({dir:e,gitdir:t,fs:n,filepath:[Y(r,l)],index:i,force:a,parallel:o,autocrlf:s})}else{let a=c.isSymbolicLink()?await n.readlink(Y(e,r)).then(jn):await n.read(Y(e,r),{autocrlf:s});if(a===null)throw new G(r);let o=await An({fs:n,gitdir:t,type:`blob`,object:a});i.insert({filepath:r,stats:c,oid:o})}}),l=await Promise.allSettled(c),u=l.filter(e=>e.status===`rejected`).map(e=>e.reason);if(u.length>1)throw new Mt(u);if(u.length===1)throw u[0];return l.filter(e=>e.status===`fulfilled`&&e.value).map(e=>e.value)}async function Rn({fs:e,gitdir:t,path:n}){return(await je.get({fs:e,gitdir:t})).get(n)}function Bn(e,...t){for(let n of t)if(n)for(let t of Object.keys(n)){let r=n[t];r!==void 0&&(e[t]=r)}return e}async function Vn({fs:e,gitdir:t,author:n,commit:r}){let i=Math.floor(Date.now()/1e3),a=Bn({},{name:await Rn({fs:e,gitdir:t,path:`user.name`}),email:await Rn({fs:e,gitdir:t,path:`user.email`})||``,timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},r?r.author:void 0,n);if(a.name!==void 0)return a}async function Hn({fs:e,gitdir:t,author:n,committer:r,commit:i}){let a=Math.floor(Date.now()/1e3),o=Bn({},{name:await Rn({fs:e,gitdir:t,path:`user.name`}),email:await Rn({fs:e,gitdir:t,path:`user.email`})||``,timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},i?i.committer:void 0,n,r);if(o.name!==void 0)return o}async function Un({fs:e,cache:t,gitdir:n,oid:r}){let{type:i,object:a}=await mt({fs:e,cache:t,gitdir:n,oid:r});if(i===`tag`)return r=Zt.from(a).parse().object,Un({fs:e,cache:t,gitdir:n,oid:r});if(i!==`commit`)throw new le(r,i,`commit`);return{commit:en.from(a),oid:r}}async function Wn({fs:e,cache:t,gitdir:n,oid:r}){let{commit:i,oid:a}=await Un({fs:e,cache:t,gitdir:n,oid:r});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}async function Gn({fs:e,cache:t,onSign:n,gitdir:r,message:i,author:a,committer:o,signingKey:s,amend:c=!1,dryRun:l=!1,noUpdateBranch:u=!1,ref:d,parent:f,tree:p}){let m=!1,h=!1;d||=(h=!(await e.read(`${r}/HEAD`,{encoding:`utf8`})).startsWith(`ref:`),await Q.resolve({fs:e,gitdir:r,ref:`HEAD`,depth:2}));let g,_;try{g=await Q.resolve({fs:e,gitdir:r,ref:d}),_=await Wn({fs:e,gitdir:r,oid:g,cache:{}})}catch{m=!0}if(c&&m)throw new Vt(d);let v=c?await Vn({fs:e,gitdir:r,author:a,commit:_.commit}):await Vn({fs:e,gitdir:r,author:a});if(!v)throw new At(`author`);let y=c?await Hn({fs:e,gitdir:r,author:v,committer:o,commit:_.commit}):await Hn({fs:e,gitdir:r,author:v,committer:o});if(!y)throw new At(`committer`);return ae.acquire({fs:e,gitdir:r,cache:t,allowUnmerged:!1},async function(t){let a=oe(t.entries).get(`.`);if(p||=await Kn({fs:e,gitdir:r,inode:a,dryRun:l}),f=f?await Promise.all(f.map(t=>Q.resolve({fs:e,gitdir:r,ref:t}))):c?_.commit.parent:g?[g]:[],!i)if(c)i=_.commit.message;else throw new jt(`message`);let o=en.from({tree:p,parent:f,author:v,committer:y,message:i});s&&(o=await en.sign(o,n,s));let m=await An({fs:e,gitdir:r,type:`commit`,object:o.toObject(),dryRun:l});return!u&&!l&&await Q.writeRef({fs:e,gitdir:r,ref:h?`HEAD`:d,value:m}),m})}async function Kn({fs:e,gitdir:t,inode:n,dryRun:r}){let i=n.children;for(let n of i)n.type===`tree`&&(n.metadata.mode=`040000`,n.metadata.oid=await Kn({fs:e,gitdir:t,inode:n,dryRun:r}));let a=i.map(e=>({mode:e.metadata.mode,path:e.basename,oid:e.metadata.oid,type:e.type}));return await An({fs:e,gitdir:t,type:`tree`,object:He.from(a).toObject(),dryRun:r})}async function qn({fs:e,cache:t,gitdir:n,oid:r,filepath:i}){if(i.startsWith(`/`))throw new Tt(`leading-slash`);if(i.endsWith(`/`))throw new Tt(`trailing-slash`);let a=r,o=await tn({fs:e,cache:t,gitdir:n,oid:r}),s=o.tree;return r=i===``?o.oid:await Jn({fs:e,cache:t,gitdir:n,tree:s,pathArray:i.split(`/`),oid:a,filepath:i}),r}async function Jn({fs:e,cache:t,gitdir:n,tree:r,pathArray:i,oid:a,filepath:o}){let s=i.shift();for(let c of r)if(c.path===s){if(i.length===0)return c.oid;{let{type:s,object:l}=await mt({fs:e,cache:t,gitdir:n,oid:c.oid});if(s!==`tree`)throw new le(a,s,`tree`,o);return r=He.from(l),Jn({fs:e,cache:t,gitdir:n,tree:r,pathArray:i,oid:a,filepath:o})}}throw new G(`file or directory found at "${a}:${o}"`)}async function Yn({fs:e,cache:t,gitdir:n,oid:r,filepath:i=void 0}){i!==void 0&&(r=await qn({fs:e,cache:t,gitdir:n,oid:r,filepath:i}));let{tree:a,oid:o}=await tn({fs:e,cache:t,gitdir:n,oid:r});return{oid:o,tree:a.entries()}}async function Xn({fs:e,gitdir:t,tree:n}){return await An({fs:e,gitdir:t,type:`tree`,object:He.from(n).toObject(),format:`content`})}async function Zn({fs:e,cache:t,onSign:n,gitdir:r,ref:a,oid:o,note:s,force:c,author:l,committer:u,signingKey:d}){let f;try{f=await Q.resolve({gitdir:r,fs:e,ref:a})}catch(e){if(!(e instanceof G))throw e}let p=(await Yn({fs:e,cache:t,gitdir:r,oid:f||`4b825dc642cb6eb9a060e54bf8d69288fbee4904`})).tree;if(c)p=p.filter(e=>e.path!==o);else for(let e of p)if(e.path===o)throw new ht(`note`,o);typeof s==`string`&&(s=i.Buffer.from(s,`utf8`));let m=await An({fs:e,gitdir:r,type:`blob`,object:s,format:`content`});return p.push({mode:`100644`,path:o,oid:m,type:`blob`}),await Gn({fs:e,cache:t,onSign:n,gitdir:r,ref:a,tree:await Xn({fs:e,gitdir:r,tree:p}),parent:f&&[f],message:`Note added by 'isomorphic-git addNote'
|
|
66
|
-
`,author:l,committer:u,signingKey:d})}async function Qn({fs:e,onSign:t,dir:n,gitdir:r=Y(n,`.git`),ref:i=`refs/notes/commits`,oid:a,note:o,force:s,author:c,committer:l,signingKey:u,cache:d={}}){try{$(`fs`,e),$(`gitdir`,r),$(`oid`,a),$(`note`,o),u&&$(`onSign`,t);let n=new yn(e),f=await Vn({fs:n,gitdir:r,author:c});if(!f)throw new At(`author`);let p=await Hn({fs:n,gitdir:r,author:f,committer:l});if(!p)throw new At(`committer`);return await Zn({fs:n,cache:d,onSign:t,gitdir:await xn({fsp:n,dotgit:r}),ref:i,oid:a,note:o,force:s,author:f,committer:p,signingKey:u})}catch(e){throw e.caller=`git.addNote`,e}}let $n=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function er(e,t){if(typeof e!=`string`)throw TypeError(`Reference name must be a string`);return!$n.test(e)&&(!!t||e.includes(`/`))}async function tr({fs:e,gitdir:t,remote:n,url:r,force:i}){if(!er(n,!0))throw new Et(n,m.clean(n));let a=await je.get({fs:e,gitdir:t});if(!i&&(await a.getSubsections(`remote`)).includes(n)&&r!==await a.get(`remote.${n}.url`))throw new ht(`remote`,n);await a.set(`remote.${n}.url`,r),await a.set(`remote.${n}.fetch`,`+refs/heads/*:refs/remotes/${n}/*`),await je.save({fs:e,gitdir:t,config:a})}async function nr({fs:e,dir:t,gitdir:n=Y(t,`.git`),remote:r,url:i,force:a=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`remote`,r),$(`url`,i);let t=new yn(e);return await tr({fs:t,gitdir:await xn({fsp:t,dotgit:n}),remote:r,url:i,force:a})}catch(e){throw e.caller=`git.addRemote`,e}}async function rr({fs:e,cache:t,onSign:n,gitdir:r,ref:i,tagger:a,message:o=i,gpgsig:s,object:c,signingKey:l,force:u=!1}){if(i=i.startsWith(`refs/tags/`)?i:`refs/tags/${i}`,!u&&await Q.exists({fs:e,gitdir:r,ref:i}))throw new ht(`tag`,i);let d=await Q.resolve({fs:e,gitdir:r,ref:c||`HEAD`}),{type:f}=await mt({fs:e,cache:t,gitdir:r,oid:d}),p=Zt.from({object:d,type:f,tag:i.replace(`refs/tags/`,``),tagger:a,message:o,gpgsig:s});l&&(p=await Zt.sign(p,n,l));let m=await An({fs:e,gitdir:r,type:`tag`,object:p.toObject()});await Q.writeRef({fs:e,gitdir:r,ref:i,value:m})}async function ir({fs:e,onSign:t,dir:n,gitdir:r=Y(n,`.git`),ref:i,tagger:a,message:o=i,gpgsig:s,object:c,signingKey:l,force:u=!1,cache:d={}}){try{$(`fs`,e),$(`gitdir`,r),$(`ref`,i),l&&$(`onSign`,t);let n=new yn(e),f=await xn({fsp:n,dotgit:r}),p=await Vn({fs:n,gitdir:f,author:a});if(!p)throw new At(`tagger`);return await rr({fs:n,cache:d,onSign:t,gitdir:f,ref:i,tagger:p,message:o,gpgsig:s,object:c,signingKey:l,force:u})}catch(e){throw e.caller=`git.annotatedTag`,e}}async function ar({fs:e,gitdir:t,ref:n,object:r,checkout:i=!1,force:a=!1}){if(!er(n,!0))throw new Et(n,m.clean(n));let o=`refs/heads/${n}`;if(!a&&await Q.exists({fs:e,gitdir:t,ref:o}))throw new ht(`branch`,n,!1);let s;try{s=await Q.resolve({fs:e,gitdir:t,ref:r||`HEAD`})}catch{}s&&await Q.writeRef({fs:e,gitdir:t,ref:o,value:s}),i&&await Q.writeSymbolicRef({fs:e,gitdir:t,ref:`HEAD`,value:o})}async function or({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r,object:i,checkout:a=!1,force:o=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r);let t=new yn(e);return await ar({fs:t,gitdir:await xn({fsp:t,dotgit:n}),ref:r,object:i,checkout:a,force:o})}catch(e){throw e.caller=`git.branch`,e}}let sr=(e,t)=>e===`.`||t==null||t.length===0||t===`.`?!0:t.length>=e.length?t.startsWith(e):e.startsWith(t);async function cr({fs:e,cache:t,onProgress:n,onPostCheckout:r,dir:i,gitdir:a,remote:o,ref:s,filepaths:c,noCheckout:l,noUpdateHead:u,dryRun:d,force:f,track:p=!0,nonBlocking:m=!1,batchSize:h=100}){let g;if(r)try{g=await Q.resolve({fs:e,gitdir:a,ref:`HEAD`})}catch{g=`0000000000000000000000000000000000000000`}let _;try{_=await Q.resolve({fs:e,gitdir:a,ref:s})}catch(t){if(s===`HEAD`)throw t;let n=`${o}/${s}`;if(_=await Q.resolve({fs:e,gitdir:a,ref:n}),p){let t=await je.get({fs:e,gitdir:a});await t.set(`branch.${s}.remote`,o),await t.set(`branch.${s}.merge`,`refs/heads/${s}`),await je.save({fs:e,gitdir:a,config:t})}await Q.writeRef({fs:e,gitdir:a,ref:`refs/heads/${s}`,value:_})}if(!l){let o;try{o=await lr({fs:e,cache:t,onProgress:n,dir:i,gitdir:a,ref:s,force:f,filepaths:c})}catch(e){throw e instanceof G&&e.data.what===_?new bt(s,_):e}let l=o.filter(([e])=>e===`conflict`).map(([e,t])=>t);if(l.length>0)throw new _t(l);let u=o.filter(([e])=>e===`error`).map(([e,t])=>t);if(u.length>0)throw new v(u.join(`, `));if(d){r&&await r({previousHead:g,newHead:_,type:c!=null&&c.length>0?`file`:`branch`});return}let p=0,y=o.length;if(await ae.acquire({fs:e,gitdir:a,cache:t},async function(t){await Promise.all(o.filter(([e])=>e===`delete`||e===`delete-index`).map(async function([r,a]){let o=`${i}/${a}`;r===`delete`&&await e.rm(o),t.delete({filepath:a}),n&&await n({phase:`Updating workdir`,loaded:++p,total:y})}))}),await ae.acquire({fs:e,gitdir:a,cache:t},async function(t){for(let[r,a]of o)if(r===`rmdir`||r===`rmdir-index`){let o=`${i}/${a}`;try{r===`rmdir`&&await e.rmdir(o),t.delete({filepath:a}),n&&await n({phase:`Updating workdir`,loaded:++p,total:y})}catch(e){if(e.code===`ENOTEMPTY`)console.log(`Did not delete ${a} because directory is not empty`);else throw e}}}),await Promise.all(o.filter(([e])=>e===`mkdir`||e===`mkdir-index`).map(async function([t,r]){let a=`${i}/${r}`;await e.mkdir(a),n&&await n({phase:`Updating workdir`,loaded:++p,total:y})})),m){let r=await fr(`Update Working Dir`,o.filter(([e])=>e===`create`||e===`create-index`||e===`update`||e===`mkdir-index`).map(([n,r,o,s,c])=>()=>dr({fs:e,cache:t,gitdir:a,dir:i},[n,r,o,s,c])),n,h);await ae.acquire({fs:e,gitdir:a,cache:t,allowUnmerged:!0},async function(e){await fr(`Update Index`,r.map(([t,n,r])=>()=>ur({index:e,fullpath:t,oid:n,stats:r})),n,h)})}else await ae.acquire({fs:e,gitdir:a,cache:t,allowUnmerged:!0},async function(r){let s=await Promise.allSettled(o.filter(([e])=>e===`create`||e===`create-index`||e===`update`||e===`mkdir-index`).map(async function([o,s,c,l,u]){let d=`${i}/${s}`;if(o!==`create-index`&&o!==`mkdir-index`){let{object:n}=await mt({fs:e,cache:t,gitdir:a,oid:c});if(u&&await e.rm(d),l===33188)await e.write(d,n);else if(l===33261)await e.write(d,n,{mode:511});else if(l===40960)await e.writelink(d,n);else throw new v(`Invalid mode 0o${l.toString(8)} detected in blob ${c}`)}let f=await e.lstat(d);l===33261&&(f.mode=493),o===`mkdir-index`&&(f.mode=57344),r.insert({filepath:s,stats:f,oid:c}),n&&await n({phase:`Updating workdir`,loaded:++p,total:y})})),c=[];for(let e of s)e.status===`rejected`&&(c.push(e.reason),console.error(`[isomorphic-git checkout] task rejected:`,e.reason?.stack??e.reason));if(c.length>0)throw new Mt(c)});r&&await r({previousHead:g,newHead:_,type:c!=null&&c.length>0?`file`:`branch`})}if(!u){let t=await Q.expand({fs:e,gitdir:a,ref:s});t.startsWith(`refs/heads`)?await Q.writeSymbolicRef({fs:e,gitdir:a,ref:`HEAD`,value:t}):await Q.writeRef({fs:e,gitdir:a,ref:`HEAD`,value:_})}}async function lr({fs:e,cache:t,onProgress:n,dir:r,gitdir:i,ref:a,force:o,filepaths:s}){let c=0;return dn({fs:e,cache:t,dir:r,gitdir:i,trees:[rn({ref:a}),on(),W()],map:async function(e,[t,r,i]){if(e!==`.`){if(s&&!s.some(t=>sr(e,t)))return null;switch(n&&await n({phase:`Analyzing workdir`,loaded:++c}),[!!i,!!t,!!r].map(Number).join(``)){case`000`:return;case`001`:return o&&s&&s.includes(e)?[`delete`,e]:void 0;case`010`:switch(await t.type()){case`tree`:return[`mkdir`,e];case`blob`:return[`create`,e,await t.oid(),await t.mode()];case`commit`:return[`mkdir-index`,e,await t.oid(),await t.mode()];default:return[`error`,`new entry Unhandled type ${await t.type()}`]}case`011`:switch(`${await t.type()}-${await r.type()}`){case`tree-tree`:return;case`tree-blob`:case`blob-tree`:return[`conflict`,e];case`blob-blob`:return await t.oid()===await r.oid()?await t.mode()===await r.mode()?[`create-index`,e,await t.oid(),await t.mode()]:o?[`update`,e,await t.oid(),await t.mode(),!0]:[`conflict`,e]:o?[`update`,e,await t.oid(),await t.mode(),await t.mode()!==await r.mode()]:[`conflict`,e];case`commit-tree`:return;case`commit-blob`:return[`conflict`,e];default:return[`error`,`new entry Unhandled type ${t.type}`]}case`100`:return[`delete-index`,e];case`101`:switch(await i.type()){case`tree`:return[`rmdir-index`,e];case`blob`:return await i.oid()===await r.oid()||o?[`delete`,e]:[`conflict`,e];case`commit`:return[`rmdir-index`,e];default:return[`error`,`delete entry Unhandled type ${await i.type()}`]}case`110`:case`111`:switch(`${await i.type()}-${await t.type()}`){case`tree-tree`:return;case`blob-blob`:if(await i.oid()===await t.oid()&&await i.mode()===await t.mode()&&!o)return;if(r){if(await r.oid()!==await i.oid()&&await r.oid()!==await t.oid())return o?[`update`,e,await t.oid(),await t.mode(),await t.mode()!==await r.mode()]:[`conflict`,e]}else if(o)return[`update`,e,await t.oid(),await t.mode(),await t.mode()!==await i.mode()];return await t.mode()===await i.mode()?await t.oid()===await i.oid()?void 0:[`update`,e,await t.oid(),await t.mode(),!1]:[`update`,e,await t.oid(),await t.mode(),!0];case`tree-blob`:return[`update-dir-to-blob`,e,await t.oid()];case`blob-tree`:return[`update-blob-to-tree`,e];case`commit-commit`:return[`mkdir-index`,e,await t.oid(),await t.mode()];default:return[`error`,`update entry Unhandled type ${await i.type()}-${await t.type()}`]}}}},reduce:async function(e,t){return t=cn(t),e?e&&e[0]===`rmdir`?(t.push(e),t):(t.unshift(e),t):t}})}async function ur({index:e,fullpath:t,stats:n,oid:r}){try{e.insert({filepath:t,stats:n,oid:r})}catch(e){console.warn(`Error inserting ${t} into index:`,e)}}async function dr({fs:e,cache:t,gitdir:n,dir:r},[i,a,o,s,c]){let l=`${r}/${a}`;if(i!==`create-index`&&i!==`mkdir-index`){let{object:r}=await mt({fs:e,cache:t,gitdir:n,oid:o});if(c&&await e.rm(l),s===33188)await e.write(l,r);else if(s===33261)await e.write(l,r,{mode:511});else if(s===40960)await e.writelink(l,r);else throw new v(`Invalid mode 0o${s.toString(8)} detected in blob ${o}`)}let u=await e.lstat(l);return s===33261&&(u.mode=493),i===`mkdir-index`&&(u.mode=57344),[a,o,u]}async function fr(e,t,n,r){let i=[],a=[];for(let o=0;o<t.length;o+=r){let s=t.slice(o,o+r).map(e=>e());(await Promise.allSettled(s)).forEach(t=>{t.status===`fulfilled`?i.push(t.value):(a.push(t.reason),console.error(`[isomorphic-git ${e}] task rejected:`,t.reason?.stack??t.reason))}),n&&await n({phase:`Updating workdir`,loaded:o+s.length,total:t.length})}if(a.length>0)throw new Mt(a);return i}async function pr({fs:e,onProgress:t,onPostCheckout:n,dir:r,gitdir:i=Y(r,`.git`),remote:a=`origin`,ref:o,filepaths:s,noCheckout:c=!1,noUpdateHead:l=o===void 0,dryRun:u=!1,force:d=!1,track:f=!0,cache:p={},nonBlocking:m=!1,batchSize:h=100}){try{$(`fs`,e),$(`dir`,r),$(`gitdir`,i);let g=o||`HEAD`,_=new yn(e);return await cr({fs:_,cache:p,onProgress:t,onPostCheckout:n,dir:r,gitdir:await xn({fsp:_,dotgit:i}),remote:a,ref:g,filepaths:s,noCheckout:c,noUpdateHead:l,dryRun:u,force:d,track:f,nonBlocking:m,batchSize:h})}catch(e){throw e.caller=`git.checkout`,e}}let mr=/^.*(\r?\n|$)/gm;function hr({branches:e,contents:t}){let n=e[1],r=e[2],i=t[0],a=t[1],o=t[2],s=h(a.match(mr),i.match(mr),o.match(mr)),c=``,l=!0;for(let e of s)e.ok&&(c+=e.ok.join(``)),e.conflict&&(l=!1,c+=`${`<`.repeat(7)} ${n}\n`,c+=e.conflict.a.join(``),c+=`${`=`.repeat(7)}\n`,c+=e.conflict.b.join(``),c+=`${`>`.repeat(7)} ${r}\n`);return{cleanMerge:l,mergedText:c}}async function gr({fs:e,cache:t,dir:n,gitdir:r=Y(n,`.git`),index:i,ourOid:a,baseOid:o,theirOid:s,ourName:c=`ours`,baseName:l=`base`,theirName:u=`theirs`,dryRun:d=!1,abortOnConflict:f=!0,mergeDriver:p}){let m=rn({ref:a}),h=rn({ref:o}),g=rn({ref:s}),_=[],v=[],y=[],b=[],x=await dn({fs:e,cache:t,dir:n,gitdir:r,trees:[m,h,g],map:async function(t,[n,a,o]){let s=V(t);switch(`${await Sn(n,a)}-${await Sn(o,a)}`){case`false-false`:return{mode:await a.mode(),path:s,oid:await a.oid(),type:await a.type()};case`false-true`:return!o&&await n.type()===`tree`?{mode:await n.mode(),path:s,oid:await n.oid(),type:await n.type()}:o?{mode:await o.mode(),path:s,oid:await o.oid(),type:await o.type()}:void 0;case`true-false`:return!n&&await o.type()===`tree`?{mode:await o.mode(),path:s,oid:await o.oid(),type:await o.type()}:n?{mode:await n.mode(),path:s,oid:await n.oid(),type:await n.type()}:void 0;case`true-true`:if(n&&o&&await n.type()===`tree`&&await o.type()===`tree`)return{mode:await n.mode(),path:s,oid:await n.oid(),type:`tree`};if(n&&o&&await n.type()===`blob`&&await o.type()===`blob`)return _r({fs:e,gitdir:r,path:s,ours:n,base:a,theirs:o,ourName:c,baseName:l,theirName:u,mergeDriver:p}).then(async e=>{if(e.cleanMerge)f||i.insert({filepath:t,oid:e.mergeResult.oid,stage:0});else if(_.push(t),v.push(t),!f){let e=``;a&&await a.type()===`blob`&&(e=await a.oid());let r=await n.oid(),s=await o.oid();i.delete({filepath:t}),e&&i.insert({filepath:t,oid:e,stage:1}),i.insert({filepath:t,oid:r,stage:2}),i.insert({filepath:t,oid:s,stage:3})}return e.mergeResult});if(a&&!n&&o&&await a.type()===`blob`&&await o.type()===`blob`){if(_.push(t),y.push(t),!f){let e=await a.oid(),n=await o.oid();i.delete({filepath:t}),i.insert({filepath:t,oid:e,stage:1}),i.insert({filepath:t,oid:n,stage:3})}return{mode:await o.mode(),oid:await o.oid(),type:`blob`,path:s}}if(a&&n&&!o&&await a.type()===`blob`&&await n.type()===`blob`){if(_.push(t),b.push(t),!f){let e=await a.oid(),r=await n.oid();i.delete({filepath:t}),i.insert({filepath:t,oid:e,stage:1}),i.insert({filepath:t,oid:r,stage:2})}return{mode:await n.mode(),oid:await n.oid(),type:`blob`,path:s}}if(a&&!n&&!o&&(await a.type()===`blob`||await a.type()===`tree`))return;throw new Ot}},reduce:_.length!==0&&(!n||f)?void 0:async(t,n)=>{let i=n.filter(Boolean);if(t&&!(t&&t.type===`tree`&&i.length===0&&t.path!==`.`))return(i.length>0||t.path===`.`&&i.length===0)&&(t.oid=await An({fs:e,gitdir:r,type:`tree`,object:new He(i).toObject(),dryRun:d})),t}});return _.length===0?x.oid:(n&&!f&&await dn({fs:e,cache:t,dir:n,gitdir:r,trees:[rn({ref:x.oid})],map:async function(t,[r]){let i=`${n}/${t}`;if(await r.type()===`blob`){let t=await r.mode(),n=new TextDecoder().decode(await r.content());await e.write(i,n,{mode:t})}return!0}}),new kt(_,v,y,b))}async function _r({fs:e,gitdir:t,path:n,ours:r,base:a,theirs:o,ourName:s,theirName:c,baseName:l,dryRun:u,mergeDriver:d=hr}){let f=`blob`,p=`100755`,m=``,h=``;a&&await a.type()===`blob`&&(p=await a.mode(),m=await a.oid(),h=i.Buffer.from(await a.content()).toString(`utf8`));let g=p===await r.mode()?await o.mode():await r.mode();if(await r.oid()===await o.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:n,oid:await r.oid(),type:f}};if(await r.oid()===m)return{cleanMerge:!0,mergeResult:{mode:g,path:n,oid:await o.oid(),type:f}};if(await o.oid()===m)return{cleanMerge:!0,mergeResult:{mode:g,path:n,oid:await r.oid(),type:f}};let _=i.Buffer.from(await r.content()).toString(`utf8`),v=i.Buffer.from(await o.content()).toString(`utf8`),{mergedText:y,cleanMerge:b}=await d({branches:[l,s,c],contents:[h,_,v],path:n});return{cleanMerge:b,mergeResult:{mode:g,path:n,oid:await An({fs:e,gitdir:t,type:`blob`,object:i.Buffer.from(y,`utf8`),dryRun:u}),type:f}}}let vr={stage:W,workdir:on},yr;async function br(e,t){return yr===void 0&&(yr=new o),yr.acquire(e,t)}async function xr(e,t,n,r,i=null){let a=Y(n,r),o=await e.lstat(a);if(!o)throw new G(a);if(o.isDirectory())throw new v(`${a}: file expected, but found directory`);let s=i?await We({fs:e,gitdir:t,oid:i}):void 0,c=s?i:void 0;return s||await br({fs:e,gitdir:t,currentFilepath:a},async()=>{let n=o.isSymbolicLink()?await e.readlink(a).then(jn):await e.read(a);if(n===null)throw new G(a);c=await An({fs:e,gitdir:t,type:`blob`,object:n})}),c}async function Sr({fs:e,dir:t,gitdir:n,entries:r}){async function i(r){return r.type===`tree`?r.oid||(r.oid=await Xn({fs:e,gitdir:n,tree:await Promise.all(r.children.map(i))}),r.mode=16384):r.type===`blob`&&(r.oid=await xr(e,n,t,r.path,r.oid),r.mode=33188),r.path=r.path.split(`/`).pop(),r}return Promise.all(r.map(i))}async function Cr({fs:e,dir:t,gitdir:n,treePair:r}){let i=r[1]===`stage`,a=r.map(e=>typeof e==`string`?vr[e]():e),o=[],s=await dn({fs:e,cache:{},dir:t,gitdir:n,trees:a,map:async(r,[i,a])=>{if(!(r===`.`||await wn.isIgnored({fs:e,dir:t,gitdir:n,filepath:r}))&&a)return(!i||await i.oid()!==await a.oid()&&await a.oid()!==void 0)&&o.push([i,a]),{mode:await a.mode(),path:r,oid:await a.oid(),type:await a.type()}},reduce:async(e,t)=>(t=t.filter(Boolean),e?(e.children=t,e):t.length>0?t:void 0),iterate:async(n,r)=>{let a=[];for(let n of r){let[r,s]=n;i?s&&(await e.exists(`${t}/${s.toString()}`)?a.push(n):o.push([null,s])):r&&(s?a.push(n):o.push([r,null]))}return a.length?Promise.all(a.map(n)):[]}});return o.length===0||s.length===0?null:Xn({fs:e,gitdir:n,tree:(await Sr({fs:e,dir:t,gitdir:n,entries:s})).filter(Boolean).map(e=>({mode:e.mode,path:e.path,oid:e.oid,type:e.type}))})}async function wr({fs:e,dir:t,gitdir:n,stashCommit:r,parentCommit:i,wasStaged:a}){let o=[],s=[],c=await dn({fs:e,cache:{},dir:t,gitdir:n,trees:[rn({ref:i}),rn({ref:r})],map:async(r,[i,c])=>{if(r===`.`||await wn.isIgnored({fs:e,dir:t,gitdir:n,filepath:r}))return;let l=c?await c.type():await i.type();if(l!==`tree`&&l!==`blob`)return;if(!c&&i){let e=l===`tree`?`rmdir`:`rm`;return l===`tree`&&o.push(r),l===`blob`&&a&&s.push({filepath:r,oid:await i.oid()}),{method:e,filepath:r}}let u=await c.oid();if(!i||await i.oid()!==u)return l===`tree`?{method:`mkdir`,filepath:r}:(a&&s.push({filepath:r,oid:u,stats:await e.lstat(Y(t,r))}),{method:`write`,filepath:r,oid:u})}});await br({fs:e,gitdir:n,dirRemoved:o,ops:c},async()=>{for(let r of c){let i=Y(t,r.filepath);switch(r.method){case`rmdir`:await e.rmdir(i);break;case`mkdir`:await e.mkdir(i);break;case`rm`:await e.rm(i);break;case`write`:if(!o.some(e=>i.startsWith(e))){let{object:t}=await mt({fs:e,cache:{},gitdir:n,oid:r.oid});await e.exists(i)&&await e.rm(i),await e.write(i,t)}break}}}),await ae.acquire({fs:e,gitdir:n,cache:{}},async e=>{s.forEach(({filepath:t,stats:n,oid:r})=>{e.insert({filepath:t,stats:n,oid:r})})})}async function Tr({fs:e,cache:t,dir:n,gitdir:r,oid:i,dryRun:a=!1,noUpdateBranch:o=!1,abortOnConflict:s=!0,committer:c,mergeDriver:l}){let{commit:u,oid:d}=await Wn({fs:e,cache:t,gitdir:r,oid:i});if(u.parent.length>1)throw new vt(d,u.parent.length);if(u.parent.length===0)throw new yt(d);let f=await Q.resolve({fs:e,gitdir:r,ref:`HEAD`}),{commit:p}=await Wn({fs:e,cache:t,gitdir:r,oid:f}),m=u.parent[0],{commit:h}=await Wn({fs:e,cache:t,gitdir:r,oid:m}),g=await ae.acquire({fs:e,gitdir:r,cache:t,allowUnmerged:!1},async i=>gr({fs:e,cache:t,dir:n,gitdir:r,index:i,ourOid:p.tree,baseOid:h.tree,theirOid:u.tree,ourName:`HEAD`,baseName:`parent of ${d.slice(0,7)}`,theirName:d.slice(0,7),dryRun:a,abortOnConflict:s,mergeDriver:l}));if(g instanceof kt)throw g;let _=await Gn({fs:e,cache:t,gitdir:r,message:u.message,tree:g,parent:[f],author:u.author,committer:c,dryRun:a,noUpdateBranch:o});return n&&!a&&!o&&await wr({fs:e,dir:n,gitdir:r,stashCommit:_,parentCommit:f,wasStaged:!0}),_}async function Er({fs:e,dir:t,gitdir:n=Y(t,`.git`),oid:r,cache:i={},committer:a,dryRun:o=!1,noUpdateBranch:s=!1,abortOnConflict:c=!0,mergeDriver:l}){try{$(`fs`,e),$(`gitdir`,n),$(`oid`,r);let u=new yn(e),d=await xn({fsp:u,dotgit:n}),{commit:f}=await Wn({fs:u,cache:i,gitdir:d,oid:r});if(f.parent&&f.parent.length>1)return await Tr({fs:u,cache:i,dir:t,gitdir:d,oid:r,dryRun:o,noUpdateBranch:s,abortOnConflict:c,committer:void 0,mergeDriver:l});let p=await Hn({fs:u,gitdir:d,committer:a});if(!p)throw new At(`committer`);return await Tr({fs:u,cache:i,dir:t,gitdir:d,oid:r,dryRun:o,noUpdateBranch:s,abortOnConflict:c,committer:p,mergeDriver:l})}catch(e){throw e.caller=`git.cherryPick`,e}}let Dr=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function Or(e){let t=Dr.exec(e);return t?t[1]===`remotes/`&&e.endsWith(`/HEAD`)?t[2].slice(0,-5):t[2]:e}async function kr({fs:e,gitdir:t,fullname:n=!1,test:r=!1}){let i=await Q.resolve({fs:e,gitdir:t,ref:`HEAD`,depth:2});if(r)try{await Q.resolve({fs:e,gitdir:t,ref:i})}catch{return}if(i.startsWith(`refs/`))return n?i:Or(i)}function Ar(e){return e=e.replace(/^git@([^:]+):/,`https://$1/`),e=e.replace(/^ssh:\/\//,`https://`),e}function jr({username:e=``,password:t=``}){return`Basic ${i.Buffer.from(`${e}:${t}`).toString(`base64`)}`}async function Mr(e,t){let n=Xe(e);for(;;){let{value:e,done:r}=await n.next();if(e&&await t(e),r)break}n.return&&n.return()}async function Nr(e){let t=0,n=[];await Mr(e,e=>{n.push(e),t+=e.byteLength});let r=new Uint8Array(t),i=0;for(let e of n)r.set(e,i),i+=e.byteLength;return r}function Pr(e){let t=e.match(/^https?:\/\/([^/]+)@/);if(t==null)return{url:e,auth:{}};t=t[1];let[n,r]=t.split(`:`);return e=e.replace(`${t}@`,``),{url:e,auth:{username:n,password:r}}}function Fr(e,t){let n=t.toString(16);return`0`.repeat(e-n.length)+n}var Ir=class{static flush(){return i.Buffer.from(`0000`,`utf8`)}static delim(){return i.Buffer.from(`0001`,`utf8`)}static encode(e){typeof e==`string`&&(e=i.Buffer.from(e));let t=Fr(4,e.length+4);return i.Buffer.concat([i.Buffer.from(t,`utf8`),e])}static streamReader(e){let t=new Ze(e);return async function(){try{let e=await t.read(4);return e==null?!0:(e=parseInt(e.toString(`utf8`),16),e===0||e===1?null:await t.read(e-4)??!0)}catch(t){return e.error=t,!0}}}};async function Lr(e){let t={},n;for(;n=await e(),n!==!0;){if(n===null)continue;n=n.toString(`utf8`).replace(/\n$/,``);let e=n.indexOf(`=`);if(e>-1){let r=n.slice(0,e);t[r]=n.slice(e+1)}else t[n]=!0}return{protocolVersion:2,capabilities2:t}}async function Rr(e,{service:t}){let n=new Set,r=new Map,i=new Map,a=Ir.streamReader(e),o=await a();for(;o===null;)o=await a();if(o===!0)throw new xt;if(o.includes(`version 2`))return Lr(a);if(o.toString(`utf8`).replace(/\n$/,``)!==`# service=${t}`)throw new Nt(`# service=${t}\\n`,o.toString(`utf8`));let s=await a();for(;s===null;)s=await a();if(s===!0)return{capabilities:n,refs:r,symrefs:i};if(s=s.toString(`utf8`),s.includes(`version 2`))return Lr(a);let[c,l]=zr(s,`\0`,`\\x00`);if(l.split(` `).map(e=>n.add(e)),c!==`0000000000000000000000000000000000000000 capabilities^{}`){let[e,t]=zr(c,` `,` `);for(r.set(t,e);;){let e=await a();if(e===!0)break;if(e!==null){let[t,n]=zr(e.toString(`utf8`),` `,` `);r.set(n,t)}}}for(let e of n)if(e.startsWith(`symref=`)){let t=e.match(/symref=([^:]+):(.*)/);t.length===3&&i.set(t[1],t[2])}return{protocolVersion:1,capabilities:n,refs:r,symrefs:i}}function zr(e,t,n){let r=e.trim().split(t);if(r.length!==2)throw new Nt(`Two strings separated by '${n}'`,e.toString(`utf8`));return r}let Br=(e,t)=>e.endsWith(`?`)?`${e}${t}`:`${e}/${t.replace(/^https?:\/\//,``)}`,Vr=(e,t)=>{(t.username||t.password)&&(e.Authorization=jr(t)),t.headers&&Object.assign(e,t.headers)},Hr=async e=>{try{let t=i.Buffer.from(await Nr(e.body)),n=t.toString(`utf8`);return{preview:n.length<256?n:n.slice(0,256)+`...`,response:n,data:t}}catch{return{}}};var Ur=class{static async capabilities(){return[`discover`,`connect`]}static async discover({http:e,onProgress:t,onAuth:n,onAuthSuccess:r,onAuthFailure:i,corsProxy:a,service:o,url:s,headers:c,protocolVersion:l}){let{url:u,auth:d}=Pr(s),f=a?Br(a,u):u;(d.username||d.password)&&(c.Authorization=jr(d)),l===2&&(c[`Git-Protocol`]=`version=2`);let p,m,h=!1;do if(p=await e.request({onProgress:t,method:`GET`,url:`${f}/info/refs?service=${o}`,headers:c}),m=!1,p.statusCode===401||p.statusCode===203){let e=h?i:n;if(e){if(d=await e(u,{...d,headers:{...c}}),d&&d.cancel)throw new zt;d&&(Vr(c,d),h=!0,m=!0)}}else p.statusCode===200&&h&&r&&await r(u,d);while(m);if(p.statusCode!==200){let{response:e}=await Hr(p);throw new wt(p.statusCode,p.statusMessage,e)}if(p.headers[`content-type`]===`application/x-${o}-advertisement`){let e=await Rr(p.body,{service:o});return e.auth=d,e}else{let{preview:e,response:t,data:n}=await Hr(p);try{let e=await Rr([n],{service:o});return e.auth=d,e}catch{throw new It(e,t)}}}static async connect({http:e,onProgress:t,corsProxy:n,service:r,url:i,auth:a,body:o,headers:s}){let c=Pr(i);c&&(i=c.url),n&&(i=Br(n,i)),s[`content-type`]=`application/x-${r}-request`,s.accept=`application/x-${r}-result`,Vr(s,a);let l=await e.request({onProgress:t,method:`POST`,url:`${i}/${r}`,body:o,headers:s});if(l.statusCode!==200){let{response:e}=Hr(l);throw new wt(l.statusCode,l.statusMessage,e)}return l}},Wr=class{static getRemoteHelperFor({url:e}){let t=new Map;t.set(`http`,Ur),t.set(`https`,Ur);let n=Gr({url:e});if(!n)throw new Rt(e);if(t.has(n.transport))return t.get(n.transport);throw new Lt(e,n.transport,n.transport===`ssh`?Ar(e):void 0)}};function Gr({url:e}){if(e.startsWith(`git@`))return{transport:`ssh`,address:e};let t=e.match(/(\w+)(:\/\/|::)(.*)/);if(t!==null){if(t[2]===`://`)return{transport:t[1],address:t[0]};if(t[2]===`::`)return{transport:t[1],address:t[3]}}}let Kr=null;var qr=class{static async read({fs:e,gitdir:t}){Kr===null&&(Kr=new o);let n=Y(t,`shallow`),r=new Set;return await Kr.acquire(n,async function(){let t=await e.read(n,{encoding:`utf8`});if(t===null||t.trim()===``)return r;t.trim().split(`
|
|
64
|
+
`+a;return e.from(s)}};async function tn({fs:e,cache:t,gitdir:n,oid:r}){if(r===`4b825dc642cb6eb9a060e54bf8d69288fbee4904`)return{tree:He.from([]),oid:r};let{type:i,object:a}=await mt({fs:e,cache:t,gitdir:n,oid:r});if(i===`tag`)return r=Zt.from(a).parse().object,tn({fs:e,cache:t,gitdir:n,oid:r});if(i===`commit`)return r=en.from(a).parse().tree,tn({fs:e,cache:t,gitdir:n,oid:r});if(i!==`tree`)throw new le(r,i,`tree`);return{tree:He.from(a),oid:r}}var nn=class{constructor({fs:e,gitdir:t,ref:n,cache:r}){this.fs=e,this.cache=r,this.gitdir=t,this.mapPromise=(async()=>{let r=new Map,i;try{i=await Q.resolve({fs:e,gitdir:t,ref:n})}catch(e){e instanceof G&&(i=`4b825dc642cb6eb9a060e54bf8d69288fbee4904`)}let a=await tn({fs:e,cache:this.cache,gitdir:t,oid:i});return a.type=`tree`,a.mode=`40000`,r.set(`.`,a),r})();let i=this;this.ConstructEntry=class{constructor(e){this._fullpath=e,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let t=e._fullpath,{fs:n,cache:r,gitdir:i}=this,a=await this.mapPromise,o=a.get(t);if(!o)throw Error(`No obj for ${t}`);let s=o.oid;if(!s)throw Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!==`tree`)return null;let{type:c,object:l}=await mt({fs:n,cache:r,gitdir:i,oid:s});if(c!==o.type)throw new le(s,c,o.type);let u=He.from(l);for(let e of u)a.set(Y(t,e.path),e);return u.entries().map(e=>Y(t,e.path))}async type(e){if(e._type===!1){let{type:t}=(await this.mapPromise).get(e._fullpath);e._type=t}return e._type}async mode(e){if(e._mode===!1){let{mode:t}=(await this.mapPromise).get(e._fullpath);e._mode=w(parseInt(t,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let t=await this.mapPromise,{fs:n,cache:r,gitdir:i}=this,a=t.get(e._fullpath).oid,{type:o,object:s}=await mt({fs:n,cache:r,gitdir:i,oid:a});o===`blob`?e._content=new Uint8Array(s):e._content=void 0}return e._content}async oid(e){return e._oid===!1&&(e._oid=(await this.mapPromise).get(e._fullpath).oid),e._oid}};function rn({ref:e=`HEAD`}={}){let t=Object.create(null);return Object.defineProperty(t,ce,{value:function({fs:t,gitdir:n,cache:r}){return new nn({fs:t,gitdir:n,ref:e,cache:r})}}),Object.freeze(t),t}var an=class{constructor({fs:e,dir:t,gitdir:n,cache:r}){this.fs=e,this.cache=r,this.dir=t,this.gitdir=n,this.config=null;let i=this;this.ConstructEntry=class{constructor(e){this._fullpath=e,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let t=e._fullpath,{fs:n,dir:r}=this,i=await n.readdir(Y(r,t));return i===null?null:i.map(e=>Y(t,e))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:t,dir:n}=this,r=await t.lstat(`${n}/${e._fullpath}`);if(!r)throw Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=r.isDirectory()?`tree`:`blob`;i===`blob`&&!r.isFile()&&!r.isSymbolicLink()&&(i=`special`),e._type=i,r=D(r),e._mode=r.mode,r.size===-1&&e._actualSize&&(r.size=e._actualSize),e._stat=r}return e._stat}async content(e){if(e._content===!1){let{fs:t,dir:n,gitdir:r}=this;if(await e.type()===`tree`)e._content=void 0;else{let i;if(await e.mode()>>12==10)i=await t.readlink(`${n}/${e._fullpath}`);else{let a=await(await this._getGitConfig(t,r)).get(`core.autocrlf`);i=await t.read(`${n}/${e._fullpath}`,{autocrlf:a})}e._actualSize=i.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(i)}}return e._content}async oid(e){if(e._oid===!1){let t=this,{fs:r,gitdir:i,cache:a}=this,o;await ae.acquire({fs:r,gitdir:i,cache:a},async function(a){let s=a.entriesMap.get(e._fullpath),c=await e.stat(),l=await(await t._getGitConfig(r,i)).get(`core.filemode`),u=n.default===void 0||n.default.platform!==`win32`;if(!s||re(c,s,l,u)){let t=await e.content();t===void 0?o=void 0:(o=await j(Ue.wrap({type:`blob`,object:t})),s&&o===s.oid&&(!l||c.mode===s.mode)&&re(c,s,l,u)&&a.insert({filepath:e._fullpath,stats:c,oid:o}))}else o=s.oid}),e._oid=o}return e._oid}async _getGitConfig(e,t){return this.config||=await je.get({fs:e,gitdir:t}),this.config}};function on(){let e=Object.create(null);return Object.defineProperty(e,ce,{value:function({fs:e,dir:t,gitdir:n,cache:r}){return new an({fs:e,dir:t,gitdir:n,cache:r})}}),Object.freeze(e),e}function sn(e,t){let n=t-e;return Array.from({length:n},(t,n)=>e+n)}let cn=Array.prototype.flat===void 0?e=>e.reduce((e,t)=>e.concat(t),[]):e=>e.flat();var ln=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null||e<this.value)&&(this.value=e)}reset(){this.value=null}};function*un(e){let t=new ln,n,r=[],i=e.length;for(let n=0;n<i;n++)r[n]=e[n].next().value,r[n]!==void 0&&t.consider(r[n]);if(t.value!==null)for(;;){let a=[];n=t.value,t.reset();for(let o=0;o<i;o++)r[o]!==void 0&&r[o]===n?(a[o]=r[o],r[o]=e[o].next().value):a[o]=null,r[o]!==void 0&&t.consider(r[o]);if(yield a,t.value===null)return}}async function dn({fs:e,cache:t,dir:n,gitdir:r,trees:i,map:a=async(e,t)=>t,reduce:o=async(e,t)=>{let n=cn(t);return e!==void 0&&n.unshift(e),n},iterate:s=(e,t)=>Promise.all([...t].map(e))}){let c=i.map(i=>i[ce]({fs:e,dir:n,gitdir:r,cache:t})),l=Array(c.length).fill(`.`),u=sn(0,c.length),d=async e=>(u.forEach(t=>{let n=e[t];e[t]=n&&new c[t].ConstructEntry(n)}),{entries:e,children:un((await Promise.all(u.map(t=>{let n=e[t];return n?c[t].readdir(n):[]}))).map(e=>(e===null?[]:e)[Symbol.iterator]()))}),f=async e=>{let{entries:t,children:n}=await d(e),r=t.find(e=>e&&e._fullpath)._fullpath,i=await a(r,t);if(i!==null){let e=await s(f,n);return e=e.filter(e=>e!==void 0),o(i,e)}};return f(l)}async function fn(e,t){let n=await e.readdir(t);n==null?await e.rm(t):n.length?await Promise.all(n.map(n=>{let r=Y(t,n);return e.lstat(r).then(t=>{if(t)return t.isDirectory()?fn(e,r):e.rm(r)})})).then(()=>e.rmdir(t)):await e.rmdir(t)}function pn(e){return mn(e)&&hn(e.then)&&hn(e.catch)}function mn(e){return e&&typeof e==`object`}function hn(e){return typeof e==`function`}function gn(e){return pn((e=>{try{return e.readFile().catch(e=>e)}catch(e){return e}})(e))}let _n=[`readFile`,`writeFile`,`mkdir`,`rmdir`,`unlink`,`stat`,`lstat`,`readdir`,`readlink`,`symlink`];function vn(e,t){if(gn(t))for(let n of _n)e[`_${n}`]=t[n].bind(t);else for(let n of _n)e[`_${n}`]=d(t[n].bind(t));gn(t)?(t.cp&&(e._cp=t.cp.bind(t)),t.rm?e._rm=t.rm.bind(t):t.rmdir.length>1?e._rm=t.rmdir.bind(t):e._rm=fn.bind(null,e)):(t.cp&&(e._cp=d(t.cp.bind(t))),t.rm?e._rm=d(t.rm.bind(t)):t.rmdir.length>2?e._rm=d(t.rmdir.bind(t)):e._rm=fn.bind(null,e))}var yn=class{constructor(e){if(e._original_unwrapped_fs!==void 0)return e;let t=Object.getOwnPropertyDescriptor(e,`promises`);t&&t.enumerable?vn(this,e.promises):vn(this,e),this._original_unwrapped_fs=e}async exists(e,t={}){try{return await this._stat(e),!0}catch(e){if(e.code===`ENOENT`||e.code===`ENOTDIR`||(e.code||``).includes(`ENS`))return!1;throw console.log(`Unhandled error in "FileSystem.exists()" function`,e),e}}async read(e,t={}){try{let n=await this._readFile(e,t);if(t.autocrlf===`true`)try{n=new TextDecoder(`utf8`,{fatal:!0}).decode(n),n=n.replace(/\r\n/g,`
|
|
65
|
+
`),n=new TextEncoder().encode(n)}catch{}return typeof n!=`string`&&(n=r.Buffer.from(n)),n}catch{return null}}async write(e,t,n={}){try{await this._writeFile(e,t,n)}catch{await this.mkdir(H(e)),await this._writeFile(e,t,n)}}async mkdir(e,t=!1){try{await this._mkdir(e)}catch(n){if(n===null||n.code===`EEXIST`)return;if(t)throw n;if(n.code===`ENOENT`){let t=H(e);if(t===`.`||t===`/`||t===e)throw n;await this.mkdir(t),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(e){if(e.code!==`ENOENT`)throw e}}async rmdir(e,t){try{t&&t.recursive?await this._rm(e,t):await this._rmdir(e)}catch(e){if(e.code!==`ENOENT`)throw e}}async readdir(e){try{let t=await this._readdir(e);return t.sort(b),t}catch(e){return e.code===`ENOTDIR`?null:[]}}async readdirDeep(e){let t=await this._readdir(e);return(await Promise.all(t.map(async t=>{let n=e+`/`+t;return(await this._stat(n)).isDirectory()?this.readdirDeep(n):n}))).reduce((e,t)=>e.concat(t),[])}async lstat(e){try{return await this._lstat(e)}catch(e){if(e.code===`ENOENT`||(e.code||``).includes(`ENS`))return null;throw e}}async readlink(e,t={encoding:`buffer`}){try{let n=await this._readlink(e,t);return r.Buffer.isBuffer(n)?n:r.Buffer.from(n)}catch(e){if(e.code===`ENOENT`||(e.code||``).includes(`ENS`))return null;throw e}}async writelink(e,t){return this._symlink(t.toString(`utf8`),e)}};function $(e,t){if(t===void 0)throw new jt(e)}function bn(e){return e.startsWith(`/`)||/^[a-zA-Z]:[\\/]/.test(e)}async function xn({fsp:e,dotgit:t}){$(`fsp`,e),$(`dotgit`,t);let n=await e._stat(t).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return n.isDirectory()?t:n.isFile()?e._readFile(t,`utf8`).then(e=>e.trimRight().substr(8)).then(e=>bn(e)?e:Y(H(t),e)):t}async function Sn(e,t){return!e&&!t?!1:e&&!t||!e&&t?!0:!(await e.type()===`tree`&&await t.type()===`tree`||await e.type()===await t.type()&&await e.mode()===await t.mode()&&await e.oid()===await t.oid())}async function Cn({fs:e,dir:t,gitdir:n=Y(t,`.git`),commit:r=`HEAD`,cache:i={}}){try{$(`fs`,e),$(`dir`,t),$(`gitdir`,n);let a=new yn(e),o=[rn({ref:r}),on(),W()],s=[],c=await xn({fsp:a,dotgit:n});await ae.acquire({fs:a,gitdir:c,cache:i},async function(e){s=e.unmergedPaths});let l=await dn({fs:a,cache:i,dir:t,gitdir:c,trees:o,map:async function(e,[t,n,r]){let i=!await Sn(n,r),a=s.includes(e),o=!await Sn(r,t);if(i||a)return t?{path:e,mode:await t.mode(),oid:await t.oid(),type:await t.type(),content:await t.content()}:void 0;if(o)return!1;throw new Bt(e)}});await ae.acquire({fs:a,gitdir:c,cache:i},async function(e){for(let n of l)if(n!==!1){if(!n){await a.rmdir(`${t}/${n.path}`,{recursive:!0}),e.delete({filepath:n.path});continue}if(n.type===`blob`){let r=new TextDecoder().decode(n.content);await a.write(`${t}/${n.path}`,r,{mode:n.mode}),e.insert({filepath:n.path,oid:n.oid,stage:0})}}})}catch(e){throw e.caller=`git.abortMerge`,e}}var wn=class{static async isIgnored({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r}){if(V(r)===`.git`)return!0;if(r===`.`)return!1;let i=``,a=Y(n,`info`,`exclude`);await e.exists(a)&&(i=await e.read(a,`utf8`));let o=[{gitignore:Y(t,`.gitignore`),filepath:r}],s=r.split(`/`).filter(Boolean);for(let e=1;e<s.length;e++){let n=s.slice(0,e).join(`/`),r=s.slice(e).join(`/`);o.push({gitignore:Y(t,n,`.gitignore`),filepath:r})}let c=!1;for(let t of o){let n;try{n=await e.read(t.gitignore,`utf8`)}catch(e){if(e.code===`NOENT`)continue}let r=f().add(i);r.add(n);let a=H(t.filepath);if(a!==`.`&&r.ignores(a))return!0;c=c?!r.test(t.filepath).unignored:r.test(t.filepath).ignored}return c}};async function Tn({fs:e,gitdir:t,object:n,format:r,oid:i}){if(r!==`deflated`)throw new _(`GitObjectStoreLoose expects objects to write to be in deflated format`);let a=`${t}/${`objects/${i.slice(0,2)}/${i.slice(2)}`}`;await e.exists(a)||await e.write(a,n)}let En=null;async function Dn(e){return En===null&&(En=kn()),En?On(e):l.deflate(e)}async function On(e){let t=new CompressionStream(`deflate`),n=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}function kn(){try{return new CompressionStream(`deflate`).writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}async function An({fs:e,gitdir:t,type:n,object:i,format:a=`content`,oid:o=void 0,dryRun:s=!1}){return a!==`deflated`&&(a!==`wrapped`&&(i=Ue.wrap({type:n,object:i})),o=await j(i),i=r.Buffer.from(await Dn(i))),s||await Tn({fs:e,gitdir:t,object:i,format:`deflated`,oid:o}),o}function jn(e){let t;for(;~(t=e.indexOf(92));)e[t]=47;return e}async function Mn({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r,cache:i={},force:a=!1,parallel:o=!0}){try{$(`fs`,e),$(`dir`,t),$(`gitdir`,n),$(`filepath`,r);let s=new yn(e),c=await xn({fsp:s,dotgit:n});await ae.acquire({fs:s,gitdir:c,cache:i},async e=>{let n=await(await je.get({fs:s,gitdir:c})).get(`core.autocrlf`);return Nn({dir:t,gitdir:c,fs:s,filepath:r,index:e,force:a,parallel:o,autocrlf:n})})}catch(e){throw e.caller=`git.add`,e}}async function Nn({dir:e,gitdir:t,fs:n,filepath:r,index:i,force:a,parallel:o,autocrlf:s}){r=Array.isArray(r)?r:[r];let c=r.map(async r=>{if(!a&&await wn.isIgnored({fs:n,dir:e,gitdir:t,filepath:r}))return;let c=await n.lstat(Y(e,r));if(!c)throw new G(r);if(c.isDirectory()){let c=await n.readdir(Y(e,r));if(o){let l=c.map(c=>Nn({dir:e,gitdir:t,fs:n,filepath:[Y(r,c)],index:i,force:a,parallel:o,autocrlf:s}));await Promise.all(l)}else for(let l of c)await Nn({dir:e,gitdir:t,fs:n,filepath:[Y(r,l)],index:i,force:a,parallel:o,autocrlf:s})}else{let a=c.isSymbolicLink()?await n.readlink(Y(e,r)).then(jn):await n.read(Y(e,r),{autocrlf:s});if(a===null)throw new G(r);let o=await An({fs:n,gitdir:t,type:`blob`,object:a});i.insert({filepath:r,stats:c,oid:o})}}),l=await Promise.allSettled(c),u=l.filter(e=>e.status===`rejected`).map(e=>e.reason);if(u.length>1)throw new Mt(u);if(u.length===1)throw u[0];return l.filter(e=>e.status===`fulfilled`&&e.value).map(e=>e.value)}async function Rn({fs:e,gitdir:t,path:n}){return(await je.get({fs:e,gitdir:t})).get(n)}function Bn(e,...t){for(let n of t)if(n)for(let t of Object.keys(n)){let r=n[t];r!==void 0&&(e[t]=r)}return e}async function Vn({fs:e,gitdir:t,author:n,commit:r}){let i=Math.floor(Date.now()/1e3),a=Bn({},{name:await Rn({fs:e,gitdir:t,path:`user.name`}),email:await Rn({fs:e,gitdir:t,path:`user.email`})||``,timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},r?r.author:void 0,n);if(a.name!==void 0)return a}async function Hn({fs:e,gitdir:t,author:n,committer:r,commit:i}){let a=Math.floor(Date.now()/1e3),o=Bn({},{name:await Rn({fs:e,gitdir:t,path:`user.name`}),email:await Rn({fs:e,gitdir:t,path:`user.email`})||``,timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},i?i.committer:void 0,n,r);if(o.name!==void 0)return o}async function Un({fs:e,cache:t,gitdir:n,oid:r}){let{type:i,object:a}=await mt({fs:e,cache:t,gitdir:n,oid:r});if(i===`tag`)return r=Zt.from(a).parse().object,Un({fs:e,cache:t,gitdir:n,oid:r});if(i!==`commit`)throw new le(r,i,`commit`);return{commit:en.from(a),oid:r}}async function Wn({fs:e,cache:t,gitdir:n,oid:r}){let{commit:i,oid:a}=await Un({fs:e,cache:t,gitdir:n,oid:r});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}async function Gn({fs:e,cache:t,onSign:n,gitdir:r,message:i,author:a,committer:o,signingKey:s,amend:c=!1,dryRun:l=!1,noUpdateBranch:u=!1,ref:d,parent:f,tree:p}){let m=!1,h=!1;d||=(h=!(await e.read(`${r}/HEAD`,{encoding:`utf8`})).startsWith(`ref:`),await Q.resolve({fs:e,gitdir:r,ref:`HEAD`,depth:2}));let g,_;try{g=await Q.resolve({fs:e,gitdir:r,ref:d}),_=await Wn({fs:e,gitdir:r,oid:g,cache:{}})}catch{m=!0}if(c&&m)throw new Vt(d);let v=c?await Vn({fs:e,gitdir:r,author:a,commit:_.commit}):await Vn({fs:e,gitdir:r,author:a});if(!v)throw new At(`author`);let y=c?await Hn({fs:e,gitdir:r,author:v,committer:o,commit:_.commit}):await Hn({fs:e,gitdir:r,author:v,committer:o});if(!y)throw new At(`committer`);return ae.acquire({fs:e,gitdir:r,cache:t,allowUnmerged:!1},async function(t){let a=oe(t.entries).get(`.`);if(p||=await Kn({fs:e,gitdir:r,inode:a,dryRun:l}),f=f?await Promise.all(f.map(t=>Q.resolve({fs:e,gitdir:r,ref:t}))):c?_.commit.parent:g?[g]:[],!i)if(c)i=_.commit.message;else throw new jt(`message`);let o=en.from({tree:p,parent:f,author:v,committer:y,message:i});s&&(o=await en.sign(o,n,s));let m=await An({fs:e,gitdir:r,type:`commit`,object:o.toObject(),dryRun:l});return!u&&!l&&await Q.writeRef({fs:e,gitdir:r,ref:h?`HEAD`:d,value:m}),m})}async function Kn({fs:e,gitdir:t,inode:n,dryRun:r}){let i=n.children;for(let n of i)n.type===`tree`&&(n.metadata.mode=`040000`,n.metadata.oid=await Kn({fs:e,gitdir:t,inode:n,dryRun:r}));let a=i.map(e=>({mode:e.metadata.mode,path:e.basename,oid:e.metadata.oid,type:e.type}));return await An({fs:e,gitdir:t,type:`tree`,object:He.from(a).toObject(),dryRun:r})}async function qn({fs:e,cache:t,gitdir:n,oid:r,filepath:i}){if(i.startsWith(`/`))throw new Tt(`leading-slash`);if(i.endsWith(`/`))throw new Tt(`trailing-slash`);let a=r,o=await tn({fs:e,cache:t,gitdir:n,oid:r}),s=o.tree;return r=i===``?o.oid:await Jn({fs:e,cache:t,gitdir:n,tree:s,pathArray:i.split(`/`),oid:a,filepath:i}),r}async function Jn({fs:e,cache:t,gitdir:n,tree:r,pathArray:i,oid:a,filepath:o}){let s=i.shift();for(let c of r)if(c.path===s){if(i.length===0)return c.oid;{let{type:s,object:l}=await mt({fs:e,cache:t,gitdir:n,oid:c.oid});if(s!==`tree`)throw new le(a,s,`tree`,o);return r=He.from(l),Jn({fs:e,cache:t,gitdir:n,tree:r,pathArray:i,oid:a,filepath:o})}}throw new G(`file or directory found at "${a}:${o}"`)}async function Yn({fs:e,cache:t,gitdir:n,oid:r,filepath:i=void 0}){i!==void 0&&(r=await qn({fs:e,cache:t,gitdir:n,oid:r,filepath:i}));let{tree:a,oid:o}=await tn({fs:e,cache:t,gitdir:n,oid:r});return{oid:o,tree:a.entries()}}async function Xn({fs:e,gitdir:t,tree:n}){return await An({fs:e,gitdir:t,type:`tree`,object:He.from(n).toObject(),format:`content`})}async function Zn({fs:e,cache:t,onSign:n,gitdir:i,ref:a,oid:o,note:s,force:c,author:l,committer:u,signingKey:d}){let f;try{f=await Q.resolve({gitdir:i,fs:e,ref:a})}catch(e){if(!(e instanceof G))throw e}let p=(await Yn({fs:e,cache:t,gitdir:i,oid:f||`4b825dc642cb6eb9a060e54bf8d69288fbee4904`})).tree;if(c)p=p.filter(e=>e.path!==o);else for(let e of p)if(e.path===o)throw new ht(`note`,o);typeof s==`string`&&(s=r.Buffer.from(s,`utf8`));let m=await An({fs:e,gitdir:i,type:`blob`,object:s,format:`content`});return p.push({mode:`100644`,path:o,oid:m,type:`blob`}),await Gn({fs:e,cache:t,onSign:n,gitdir:i,ref:a,tree:await Xn({fs:e,gitdir:i,tree:p}),parent:f&&[f],message:`Note added by 'isomorphic-git addNote'
|
|
66
|
+
`,author:l,committer:u,signingKey:d})}async function Qn({fs:e,onSign:t,dir:n,gitdir:r=Y(n,`.git`),ref:i=`refs/notes/commits`,oid:a,note:o,force:s,author:c,committer:l,signingKey:u,cache:d={}}){try{$(`fs`,e),$(`gitdir`,r),$(`oid`,a),$(`note`,o),u&&$(`onSign`,t);let n=new yn(e),f=await Vn({fs:n,gitdir:r,author:c});if(!f)throw new At(`author`);let p=await Hn({fs:n,gitdir:r,author:f,committer:l});if(!p)throw new At(`committer`);return await Zn({fs:n,cache:d,onSign:t,gitdir:await xn({fsp:n,dotgit:r}),ref:i,oid:a,note:o,force:s,author:f,committer:p,signingKey:u})}catch(e){throw e.caller=`git.addNote`,e}}let $n=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function er(e,t){if(typeof e!=`string`)throw TypeError(`Reference name must be a string`);return!$n.test(e)&&(!!t||e.includes(`/`))}async function tr({fs:e,gitdir:t,remote:n,url:r,force:i}){if(!er(n,!0))throw new Et(n,p.clean(n));let a=await je.get({fs:e,gitdir:t});if(!i&&(await a.getSubsections(`remote`)).includes(n)&&r!==await a.get(`remote.${n}.url`))throw new ht(`remote`,n);await a.set(`remote.${n}.url`,r),await a.set(`remote.${n}.fetch`,`+refs/heads/*:refs/remotes/${n}/*`),await je.save({fs:e,gitdir:t,config:a})}async function nr({fs:e,dir:t,gitdir:n=Y(t,`.git`),remote:r,url:i,force:a=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`remote`,r),$(`url`,i);let t=new yn(e);return await tr({fs:t,gitdir:await xn({fsp:t,dotgit:n}),remote:r,url:i,force:a})}catch(e){throw e.caller=`git.addRemote`,e}}async function rr({fs:e,cache:t,onSign:n,gitdir:r,ref:i,tagger:a,message:o=i,gpgsig:s,object:c,signingKey:l,force:u=!1}){if(i=i.startsWith(`refs/tags/`)?i:`refs/tags/${i}`,!u&&await Q.exists({fs:e,gitdir:r,ref:i}))throw new ht(`tag`,i);let d=await Q.resolve({fs:e,gitdir:r,ref:c||`HEAD`}),{type:f}=await mt({fs:e,cache:t,gitdir:r,oid:d}),p=Zt.from({object:d,type:f,tag:i.replace(`refs/tags/`,``),tagger:a,message:o,gpgsig:s});l&&(p=await Zt.sign(p,n,l));let m=await An({fs:e,gitdir:r,type:`tag`,object:p.toObject()});await Q.writeRef({fs:e,gitdir:r,ref:i,value:m})}async function ir({fs:e,onSign:t,dir:n,gitdir:r=Y(n,`.git`),ref:i,tagger:a,message:o=i,gpgsig:s,object:c,signingKey:l,force:u=!1,cache:d={}}){try{$(`fs`,e),$(`gitdir`,r),$(`ref`,i),l&&$(`onSign`,t);let n=new yn(e),f=await xn({fsp:n,dotgit:r}),p=await Vn({fs:n,gitdir:f,author:a});if(!p)throw new At(`tagger`);return await rr({fs:n,cache:d,onSign:t,gitdir:f,ref:i,tagger:p,message:o,gpgsig:s,object:c,signingKey:l,force:u})}catch(e){throw e.caller=`git.annotatedTag`,e}}async function ar({fs:e,gitdir:t,ref:n,object:r,checkout:i=!1,force:a=!1}){if(!er(n,!0))throw new Et(n,p.clean(n));let o=`refs/heads/${n}`;if(!a&&await Q.exists({fs:e,gitdir:t,ref:o}))throw new ht(`branch`,n,!1);let s;try{s=await Q.resolve({fs:e,gitdir:t,ref:r||`HEAD`})}catch{}s&&await Q.writeRef({fs:e,gitdir:t,ref:o,value:s}),i&&await Q.writeSymbolicRef({fs:e,gitdir:t,ref:`HEAD`,value:o})}async function or({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r,object:i,checkout:a=!1,force:o=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r);let t=new yn(e);return await ar({fs:t,gitdir:await xn({fsp:t,dotgit:n}),ref:r,object:i,checkout:a,force:o})}catch(e){throw e.caller=`git.branch`,e}}let sr=(e,t)=>e===`.`||t==null||t.length===0||t===`.`?!0:t.length>=e.length?t.startsWith(e):e.startsWith(t);async function cr({fs:e,cache:t,onProgress:n,onPostCheckout:r,dir:i,gitdir:a,remote:o,ref:s,filepaths:c,noCheckout:l,noUpdateHead:u,dryRun:d,force:f,track:p=!0,nonBlocking:m=!1,batchSize:h=100}){let g;if(r)try{g=await Q.resolve({fs:e,gitdir:a,ref:`HEAD`})}catch{g=`0000000000000000000000000000000000000000`}let v;try{v=await Q.resolve({fs:e,gitdir:a,ref:s})}catch(t){if(s===`HEAD`)throw t;let n=`${o}/${s}`;if(v=await Q.resolve({fs:e,gitdir:a,ref:n}),p){let t=await je.get({fs:e,gitdir:a});await t.set(`branch.${s}.remote`,o),await t.set(`branch.${s}.merge`,`refs/heads/${s}`),await je.save({fs:e,gitdir:a,config:t})}await Q.writeRef({fs:e,gitdir:a,ref:`refs/heads/${s}`,value:v})}if(!l){let o;try{o=await lr({fs:e,cache:t,onProgress:n,dir:i,gitdir:a,ref:s,force:f,filepaths:c})}catch(e){throw e instanceof G&&e.data.what===v?new bt(s,v):e}let l=o.filter(([e])=>e===`conflict`).map(([e,t])=>t);if(l.length>0)throw new _t(l);let u=o.filter(([e])=>e===`error`).map(([e,t])=>t);if(u.length>0)throw new _(u.join(`, `));if(d){r&&await r({previousHead:g,newHead:v,type:c!=null&&c.length>0?`file`:`branch`});return}let p=0,y=o.length;if(await ae.acquire({fs:e,gitdir:a,cache:t},async function(t){await Promise.all(o.filter(([e])=>e===`delete`||e===`delete-index`).map(async function([r,a]){let o=`${i}/${a}`;r===`delete`&&await e.rm(o),t.delete({filepath:a}),n&&await n({phase:`Updating workdir`,loaded:++p,total:y})}))}),await ae.acquire({fs:e,gitdir:a,cache:t},async function(t){for(let[r,a]of o)if(r===`rmdir`||r===`rmdir-index`){let o=`${i}/${a}`;try{r===`rmdir`&&await e.rmdir(o),t.delete({filepath:a}),n&&await n({phase:`Updating workdir`,loaded:++p,total:y})}catch(e){if(e.code===`ENOTEMPTY`)console.log(`Did not delete ${a} because directory is not empty`);else throw e}}}),await Promise.all(o.filter(([e])=>e===`mkdir`||e===`mkdir-index`).map(async function([t,r]){let a=`${i}/${r}`;await e.mkdir(a),n&&await n({phase:`Updating workdir`,loaded:++p,total:y})})),m){let r=await fr(`Update Working Dir`,o.filter(([e])=>e===`create`||e===`create-index`||e===`update`||e===`mkdir-index`).map(([n,r,o,s,c])=>()=>dr({fs:e,cache:t,gitdir:a,dir:i},[n,r,o,s,c])),n,h);await ae.acquire({fs:e,gitdir:a,cache:t,allowUnmerged:!0},async function(e){await fr(`Update Index`,r.map(([t,n,r])=>()=>ur({index:e,fullpath:t,oid:n,stats:r})),n,h)})}else await ae.acquire({fs:e,gitdir:a,cache:t,allowUnmerged:!0},async function(r){let s=await Promise.allSettled(o.filter(([e])=>e===`create`||e===`create-index`||e===`update`||e===`mkdir-index`).map(async function([o,s,c,l,u]){let d=`${i}/${s}`;if(o!==`create-index`&&o!==`mkdir-index`){let{object:n}=await mt({fs:e,cache:t,gitdir:a,oid:c});if(u&&await e.rm(d),l===33188)await e.write(d,n);else if(l===33261)await e.write(d,n,{mode:511});else if(l===40960)await e.writelink(d,n);else throw new _(`Invalid mode 0o${l.toString(8)} detected in blob ${c}`)}let f=await e.lstat(d);l===33261&&(f.mode=493),o===`mkdir-index`&&(f.mode=57344),r.insert({filepath:s,stats:f,oid:c}),n&&await n({phase:`Updating workdir`,loaded:++p,total:y})})),c=[];for(let e of s)e.status===`rejected`&&(c.push(e.reason),console.error(`[isomorphic-git checkout] task rejected:`,e.reason?.stack??e.reason));if(c.length>0)throw new Mt(c)});r&&await r({previousHead:g,newHead:v,type:c!=null&&c.length>0?`file`:`branch`})}if(!u){let t=await Q.expand({fs:e,gitdir:a,ref:s});t.startsWith(`refs/heads`)?await Q.writeSymbolicRef({fs:e,gitdir:a,ref:`HEAD`,value:t}):await Q.writeRef({fs:e,gitdir:a,ref:`HEAD`,value:v})}}async function lr({fs:e,cache:t,onProgress:n,dir:r,gitdir:i,ref:a,force:o,filepaths:s}){let c=0;return dn({fs:e,cache:t,dir:r,gitdir:i,trees:[rn({ref:a}),on(),W()],map:async function(e,[t,r,i]){if(e!==`.`){if(s&&!s.some(t=>sr(e,t)))return null;switch(n&&await n({phase:`Analyzing workdir`,loaded:++c}),[!!i,!!t,!!r].map(Number).join(``)){case`000`:return;case`001`:return o&&s&&s.includes(e)?[`delete`,e]:void 0;case`010`:switch(await t.type()){case`tree`:return[`mkdir`,e];case`blob`:return[`create`,e,await t.oid(),await t.mode()];case`commit`:return[`mkdir-index`,e,await t.oid(),await t.mode()];default:return[`error`,`new entry Unhandled type ${await t.type()}`]}case`011`:switch(`${await t.type()}-${await r.type()}`){case`tree-tree`:return;case`tree-blob`:case`blob-tree`:return[`conflict`,e];case`blob-blob`:return await t.oid()===await r.oid()?await t.mode()===await r.mode()?[`create-index`,e,await t.oid(),await t.mode()]:o?[`update`,e,await t.oid(),await t.mode(),!0]:[`conflict`,e]:o?[`update`,e,await t.oid(),await t.mode(),await t.mode()!==await r.mode()]:[`conflict`,e];case`commit-tree`:return;case`commit-blob`:return[`conflict`,e];default:return[`error`,`new entry Unhandled type ${t.type}`]}case`100`:return[`delete-index`,e];case`101`:switch(await i.type()){case`tree`:return[`rmdir-index`,e];case`blob`:return await i.oid()===await r.oid()||o?[`delete`,e]:[`conflict`,e];case`commit`:return[`rmdir-index`,e];default:return[`error`,`delete entry Unhandled type ${await i.type()}`]}case`110`:case`111`:switch(`${await i.type()}-${await t.type()}`){case`tree-tree`:return;case`blob-blob`:if(await i.oid()===await t.oid()&&await i.mode()===await t.mode()&&!o)return;if(r){if(await r.oid()!==await i.oid()&&await r.oid()!==await t.oid())return o?[`update`,e,await t.oid(),await t.mode(),await t.mode()!==await r.mode()]:[`conflict`,e]}else if(o)return[`update`,e,await t.oid(),await t.mode(),await t.mode()!==await i.mode()];return await t.mode()===await i.mode()?await t.oid()===await i.oid()?void 0:[`update`,e,await t.oid(),await t.mode(),!1]:[`update`,e,await t.oid(),await t.mode(),!0];case`tree-blob`:return[`update-dir-to-blob`,e,await t.oid()];case`blob-tree`:return[`update-blob-to-tree`,e];case`commit-commit`:return[`mkdir-index`,e,await t.oid(),await t.mode()];default:return[`error`,`update entry Unhandled type ${await i.type()}-${await t.type()}`]}}}},reduce:async function(e,t){return t=cn(t),e?e&&e[0]===`rmdir`?(t.push(e),t):(t.unshift(e),t):t}})}async function ur({index:e,fullpath:t,stats:n,oid:r}){try{e.insert({filepath:t,stats:n,oid:r})}catch(e){console.warn(`Error inserting ${t} into index:`,e)}}async function dr({fs:e,cache:t,gitdir:n,dir:r},[i,a,o,s,c]){let l=`${r}/${a}`;if(i!==`create-index`&&i!==`mkdir-index`){let{object:r}=await mt({fs:e,cache:t,gitdir:n,oid:o});if(c&&await e.rm(l),s===33188)await e.write(l,r);else if(s===33261)await e.write(l,r,{mode:511});else if(s===40960)await e.writelink(l,r);else throw new _(`Invalid mode 0o${s.toString(8)} detected in blob ${o}`)}let u=await e.lstat(l);return s===33261&&(u.mode=493),i===`mkdir-index`&&(u.mode=57344),[a,o,u]}async function fr(e,t,n,r){let i=[],a=[];for(let o=0;o<t.length;o+=r){let s=t.slice(o,o+r).map(e=>e());(await Promise.allSettled(s)).forEach(t=>{t.status===`fulfilled`?i.push(t.value):(a.push(t.reason),console.error(`[isomorphic-git ${e}] task rejected:`,t.reason?.stack??t.reason))}),n&&await n({phase:`Updating workdir`,loaded:o+s.length,total:t.length})}if(a.length>0)throw new Mt(a);return i}async function pr({fs:e,onProgress:t,onPostCheckout:n,dir:r,gitdir:i=Y(r,`.git`),remote:a=`origin`,ref:o,filepaths:s,noCheckout:c=!1,noUpdateHead:l=o===void 0,dryRun:u=!1,force:d=!1,track:f=!0,cache:p={},nonBlocking:m=!1,batchSize:h=100}){try{$(`fs`,e),$(`dir`,r),$(`gitdir`,i);let g=o||`HEAD`,_=new yn(e);return await cr({fs:_,cache:p,onProgress:t,onPostCheckout:n,dir:r,gitdir:await xn({fsp:_,dotgit:i}),remote:a,ref:g,filepaths:s,noCheckout:c,noUpdateHead:l,dryRun:u,force:d,track:f,nonBlocking:m,batchSize:h})}catch(e){throw e.caller=`git.checkout`,e}}let mr=/^.*(\r?\n|$)/gm;function hr({branches:e,contents:t}){let n=e[1],r=e[2],i=t[0],a=t[1],o=t[2],s=m(a.match(mr),i.match(mr),o.match(mr)),c=``,l=!0;for(let e of s)e.ok&&(c+=e.ok.join(``)),e.conflict&&(l=!1,c+=`${`<`.repeat(7)} ${n}\n`,c+=e.conflict.a.join(``),c+=`${`=`.repeat(7)}\n`,c+=e.conflict.b.join(``),c+=`${`>`.repeat(7)} ${r}\n`);return{cleanMerge:l,mergedText:c}}async function gr({fs:e,cache:t,dir:n,gitdir:r=Y(n,`.git`),index:i,ourOid:a,baseOid:o,theirOid:s,ourName:c=`ours`,baseName:l=`base`,theirName:u=`theirs`,dryRun:d=!1,abortOnConflict:f=!0,mergeDriver:p}){let m=rn({ref:a}),h=rn({ref:o}),g=rn({ref:s}),_=[],v=[],y=[],b=[],x=await dn({fs:e,cache:t,dir:n,gitdir:r,trees:[m,h,g],map:async function(t,[n,a,o]){let s=V(t);switch(`${await Sn(n,a)}-${await Sn(o,a)}`){case`false-false`:return{mode:await a.mode(),path:s,oid:await a.oid(),type:await a.type()};case`false-true`:return!o&&await n.type()===`tree`?{mode:await n.mode(),path:s,oid:await n.oid(),type:await n.type()}:o?{mode:await o.mode(),path:s,oid:await o.oid(),type:await o.type()}:void 0;case`true-false`:return!n&&await o.type()===`tree`?{mode:await o.mode(),path:s,oid:await o.oid(),type:await o.type()}:n?{mode:await n.mode(),path:s,oid:await n.oid(),type:await n.type()}:void 0;case`true-true`:if(n&&o&&await n.type()===`tree`&&await o.type()===`tree`)return{mode:await n.mode(),path:s,oid:await n.oid(),type:`tree`};if(n&&o&&await n.type()===`blob`&&await o.type()===`blob`)return _r({fs:e,gitdir:r,path:s,ours:n,base:a,theirs:o,ourName:c,baseName:l,theirName:u,mergeDriver:p}).then(async e=>{if(e.cleanMerge)f||i.insert({filepath:t,oid:e.mergeResult.oid,stage:0});else if(_.push(t),v.push(t),!f){let e=``;a&&await a.type()===`blob`&&(e=await a.oid());let r=await n.oid(),s=await o.oid();i.delete({filepath:t}),e&&i.insert({filepath:t,oid:e,stage:1}),i.insert({filepath:t,oid:r,stage:2}),i.insert({filepath:t,oid:s,stage:3})}return e.mergeResult});if(a&&!n&&o&&await a.type()===`blob`&&await o.type()===`blob`){if(_.push(t),y.push(t),!f){let e=await a.oid(),n=await o.oid();i.delete({filepath:t}),i.insert({filepath:t,oid:e,stage:1}),i.insert({filepath:t,oid:n,stage:3})}return{mode:await o.mode(),oid:await o.oid(),type:`blob`,path:s}}if(a&&n&&!o&&await a.type()===`blob`&&await n.type()===`blob`){if(_.push(t),b.push(t),!f){let e=await a.oid(),r=await n.oid();i.delete({filepath:t}),i.insert({filepath:t,oid:e,stage:1}),i.insert({filepath:t,oid:r,stage:2})}return{mode:await n.mode(),oid:await n.oid(),type:`blob`,path:s}}if(a&&!n&&!o&&(await a.type()===`blob`||await a.type()===`tree`))return;throw new Ot}},reduce:_.length!==0&&(!n||f)?void 0:async(t,n)=>{let i=n.filter(Boolean);if(t&&!(t&&t.type===`tree`&&i.length===0&&t.path!==`.`))return(i.length>0||t.path===`.`&&i.length===0)&&(t.oid=await An({fs:e,gitdir:r,type:`tree`,object:new He(i).toObject(),dryRun:d})),t}});return _.length===0?x.oid:(n&&!f&&await dn({fs:e,cache:t,dir:n,gitdir:r,trees:[rn({ref:x.oid})],map:async function(t,[r]){let i=`${n}/${t}`;if(await r.type()===`blob`){let t=await r.mode(),n=new TextDecoder().decode(await r.content());await e.write(i,n,{mode:t})}return!0}}),new kt(_,v,y,b))}async function _r({fs:e,gitdir:t,path:n,ours:i,base:a,theirs:o,ourName:s,theirName:c,baseName:l,dryRun:u,mergeDriver:d=hr}){let f=`blob`,p=`100755`,m=``,h=``;a&&await a.type()===`blob`&&(p=await a.mode(),m=await a.oid(),h=r.Buffer.from(await a.content()).toString(`utf8`));let g=p===await i.mode()?await o.mode():await i.mode();if(await i.oid()===await o.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:n,oid:await i.oid(),type:f}};if(await i.oid()===m)return{cleanMerge:!0,mergeResult:{mode:g,path:n,oid:await o.oid(),type:f}};if(await o.oid()===m)return{cleanMerge:!0,mergeResult:{mode:g,path:n,oid:await i.oid(),type:f}};let _=r.Buffer.from(await i.content()).toString(`utf8`),v=r.Buffer.from(await o.content()).toString(`utf8`),{mergedText:y,cleanMerge:b}=await d({branches:[l,s,c],contents:[h,_,v],path:n});return{cleanMerge:b,mergeResult:{mode:g,path:n,oid:await An({fs:e,gitdir:t,type:`blob`,object:r.Buffer.from(y,`utf8`),dryRun:u}),type:f}}}let vr={stage:W,workdir:on},yr;async function br(e,t){return yr===void 0&&(yr=new o),yr.acquire(e,t)}async function xr(e,t,n,r,i=null){let a=Y(n,r),o=await e.lstat(a);if(!o)throw new G(a);if(o.isDirectory())throw new _(`${a}: file expected, but found directory`);let s=i?await We({fs:e,gitdir:t,oid:i}):void 0,c=s?i:void 0;return s||await br({fs:e,gitdir:t,currentFilepath:a},async()=>{let n=o.isSymbolicLink()?await e.readlink(a).then(jn):await e.read(a);if(n===null)throw new G(a);c=await An({fs:e,gitdir:t,type:`blob`,object:n})}),c}async function Sr({fs:e,dir:t,gitdir:n,entries:r}){async function i(r){return r.type===`tree`?r.oid||(r.oid=await Xn({fs:e,gitdir:n,tree:await Promise.all(r.children.map(i))}),r.mode=16384):r.type===`blob`&&(r.oid=await xr(e,n,t,r.path,r.oid),r.mode=33188),r.path=r.path.split(`/`).pop(),r}return Promise.all(r.map(i))}async function Cr({fs:e,dir:t,gitdir:n,treePair:r}){let i=r[1]===`stage`,a=r.map(e=>typeof e==`string`?vr[e]():e),o=[],s=await dn({fs:e,cache:{},dir:t,gitdir:n,trees:a,map:async(r,[i,a])=>{if(!(r===`.`||await wn.isIgnored({fs:e,dir:t,gitdir:n,filepath:r}))&&a)return(!i||await i.oid()!==await a.oid()&&await a.oid()!==void 0)&&o.push([i,a]),{mode:await a.mode(),path:r,oid:await a.oid(),type:await a.type()}},reduce:async(e,t)=>(t=t.filter(Boolean),e?(e.children=t,e):t.length>0?t:void 0),iterate:async(n,r)=>{let a=[];for(let n of r){let[r,s]=n;i?s&&(await e.exists(`${t}/${s.toString()}`)?a.push(n):o.push([null,s])):r&&(s?a.push(n):o.push([r,null]))}return a.length?Promise.all(a.map(n)):[]}});return o.length===0||s.length===0?null:Xn({fs:e,gitdir:n,tree:(await Sr({fs:e,dir:t,gitdir:n,entries:s})).filter(Boolean).map(e=>({mode:e.mode,path:e.path,oid:e.oid,type:e.type}))})}async function wr({fs:e,dir:t,gitdir:n,stashCommit:r,parentCommit:i,wasStaged:a}){let o=[],s=[],c=await dn({fs:e,cache:{},dir:t,gitdir:n,trees:[rn({ref:i}),rn({ref:r})],map:async(r,[i,c])=>{if(r===`.`||await wn.isIgnored({fs:e,dir:t,gitdir:n,filepath:r}))return;let l=c?await c.type():await i.type();if(l!==`tree`&&l!==`blob`)return;if(!c&&i){let e=l===`tree`?`rmdir`:`rm`;return l===`tree`&&o.push(r),l===`blob`&&a&&s.push({filepath:r,oid:await i.oid()}),{method:e,filepath:r}}let u=await c.oid();if(!i||await i.oid()!==u)return l===`tree`?{method:`mkdir`,filepath:r}:(a&&s.push({filepath:r,oid:u,stats:await e.lstat(Y(t,r))}),{method:`write`,filepath:r,oid:u})}});await br({fs:e,gitdir:n,dirRemoved:o,ops:c},async()=>{for(let r of c){let i=Y(t,r.filepath);switch(r.method){case`rmdir`:await e.rmdir(i);break;case`mkdir`:await e.mkdir(i);break;case`rm`:await e.rm(i);break;case`write`:if(!o.some(e=>i.startsWith(e))){let{object:t}=await mt({fs:e,cache:{},gitdir:n,oid:r.oid});await e.exists(i)&&await e.rm(i),await e.write(i,t)}break}}}),await ae.acquire({fs:e,gitdir:n,cache:{}},async e=>{s.forEach(({filepath:t,stats:n,oid:r})=>{e.insert({filepath:t,stats:n,oid:r})})})}async function Tr({fs:e,cache:t,dir:n,gitdir:r,oid:i,dryRun:a=!1,noUpdateBranch:o=!1,abortOnConflict:s=!0,committer:c,mergeDriver:l}){let{commit:u,oid:d}=await Wn({fs:e,cache:t,gitdir:r,oid:i});if(u.parent.length>1)throw new vt(d,u.parent.length);if(u.parent.length===0)throw new yt(d);let f=await Q.resolve({fs:e,gitdir:r,ref:`HEAD`}),{commit:p}=await Wn({fs:e,cache:t,gitdir:r,oid:f}),m=u.parent[0],{commit:h}=await Wn({fs:e,cache:t,gitdir:r,oid:m}),g=await ae.acquire({fs:e,gitdir:r,cache:t,allowUnmerged:!1},async i=>gr({fs:e,cache:t,dir:n,gitdir:r,index:i,ourOid:p.tree,baseOid:h.tree,theirOid:u.tree,ourName:`HEAD`,baseName:`parent of ${d.slice(0,7)}`,theirName:d.slice(0,7),dryRun:a,abortOnConflict:s,mergeDriver:l}));if(g instanceof kt)throw g;let _=await Gn({fs:e,cache:t,gitdir:r,message:u.message,tree:g,parent:[f],author:u.author,committer:c,dryRun:a,noUpdateBranch:o});return n&&!a&&!o&&await wr({fs:e,dir:n,gitdir:r,stashCommit:_,parentCommit:f,wasStaged:!0}),_}async function Er({fs:e,dir:t,gitdir:n=Y(t,`.git`),oid:r,cache:i={},committer:a,dryRun:o=!1,noUpdateBranch:s=!1,abortOnConflict:c=!0,mergeDriver:l}){try{$(`fs`,e),$(`gitdir`,n),$(`oid`,r);let u=new yn(e),d=await xn({fsp:u,dotgit:n}),{commit:f}=await Wn({fs:u,cache:i,gitdir:d,oid:r});if(f.parent&&f.parent.length>1)return await Tr({fs:u,cache:i,dir:t,gitdir:d,oid:r,dryRun:o,noUpdateBranch:s,abortOnConflict:c,committer:void 0,mergeDriver:l});let p=await Hn({fs:u,gitdir:d,committer:a});if(!p)throw new At(`committer`);return await Tr({fs:u,cache:i,dir:t,gitdir:d,oid:r,dryRun:o,noUpdateBranch:s,abortOnConflict:c,committer:p,mergeDriver:l})}catch(e){throw e.caller=`git.cherryPick`,e}}let Dr=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function Or(e){let t=Dr.exec(e);return t?t[1]===`remotes/`&&e.endsWith(`/HEAD`)?t[2].slice(0,-5):t[2]:e}async function kr({fs:e,gitdir:t,fullname:n=!1,test:r=!1}){let i=await Q.resolve({fs:e,gitdir:t,ref:`HEAD`,depth:2});if(r)try{await Q.resolve({fs:e,gitdir:t,ref:i})}catch{return}if(i.startsWith(`refs/`))return n?i:Or(i)}function Ar(e){return e=e.replace(/^git@([^:]+):/,`https://$1/`),e=e.replace(/^ssh:\/\//,`https://`),e}function jr({username:e=``,password:t=``}){return`Basic ${r.Buffer.from(`${e}:${t}`).toString(`base64`)}`}async function Mr(e,t){let n=Xe(e);for(;;){let{value:e,done:r}=await n.next();if(e&&await t(e),r)break}n.return&&n.return()}async function Nr(e){let t=0,n=[];await Mr(e,e=>{n.push(e),t+=e.byteLength});let r=new Uint8Array(t),i=0;for(let e of n)r.set(e,i),i+=e.byteLength;return r}function Pr(e){let t=e.match(/^https?:\/\/([^/]+)@/);if(t==null)return{url:e,auth:{}};t=t[1];let[n,r]=t.split(`:`);return e=e.replace(`${t}@`,``),{url:e,auth:{username:n,password:r}}}function Fr(e,t){let n=t.toString(16);return`0`.repeat(e-n.length)+n}var Ir=class{static flush(){return r.Buffer.from(`0000`,`utf8`)}static delim(){return r.Buffer.from(`0001`,`utf8`)}static encode(e){typeof e==`string`&&(e=r.Buffer.from(e));let t=Fr(4,e.length+4);return r.Buffer.concat([r.Buffer.from(t,`utf8`),e])}static streamReader(e){let t=new Ze(e);return async function(){try{let e=await t.read(4);return e==null?!0:(e=parseInt(e.toString(`utf8`),16),e===0||e===1?null:await t.read(e-4)??!0)}catch(t){return e.error=t,!0}}}};async function Lr(e){let t={},n;for(;n=await e(),n!==!0;){if(n===null)continue;n=n.toString(`utf8`).replace(/\n$/,``);let e=n.indexOf(`=`);if(e>-1){let r=n.slice(0,e);t[r]=n.slice(e+1)}else t[n]=!0}return{protocolVersion:2,capabilities2:t}}async function Rr(e,{service:t}){let n=new Set,r=new Map,i=new Map,a=Ir.streamReader(e),o=await a();for(;o===null;)o=await a();if(o===!0)throw new xt;if(o.includes(`version 2`))return Lr(a);if(o.toString(`utf8`).replace(/\n$/,``)!==`# service=${t}`)throw new Nt(`# service=${t}\\n`,o.toString(`utf8`));let s=await a();for(;s===null;)s=await a();if(s===!0)return{capabilities:n,refs:r,symrefs:i};if(s=s.toString(`utf8`),s.includes(`version 2`))return Lr(a);let[c,l]=zr(s,`\0`,`\\x00`);if(l.split(` `).map(e=>n.add(e)),c!==`0000000000000000000000000000000000000000 capabilities^{}`){let[e,t]=zr(c,` `,` `);for(r.set(t,e);;){let e=await a();if(e===!0)break;if(e!==null){let[t,n]=zr(e.toString(`utf8`),` `,` `);r.set(n,t)}}}for(let e of n)if(e.startsWith(`symref=`)){let t=e.match(/symref=([^:]+):(.*)/);t.length===3&&i.set(t[1],t[2])}return{protocolVersion:1,capabilities:n,refs:r,symrefs:i}}function zr(e,t,n){let r=e.trim().split(t);if(r.length!==2)throw new Nt(`Two strings separated by '${n}'`,e.toString(`utf8`));return r}let Br=(e,t)=>e.endsWith(`?`)?`${e}${t}`:`${e}/${t.replace(/^https?:\/\//,``)}`,Vr=(e,t)=>{(t.username||t.password)&&(e.Authorization=jr(t)),t.headers&&Object.assign(e,t.headers)},Hr=async e=>{try{let t=r.Buffer.from(await Nr(e.body)),n=t.toString(`utf8`);return{preview:n.length<256?n:n.slice(0,256)+`...`,response:n,data:t}}catch{return{}}};var Ur=class{static async capabilities(){return[`discover`,`connect`]}static async discover({http:e,onProgress:t,onAuth:n,onAuthSuccess:r,onAuthFailure:i,corsProxy:a,service:o,url:s,headers:c,protocolVersion:l}){let{url:u,auth:d}=Pr(s),f=a?Br(a,u):u;(d.username||d.password)&&(c.Authorization=jr(d)),l===2&&(c[`Git-Protocol`]=`version=2`);let p,m,h=!1;do if(p=await e.request({onProgress:t,method:`GET`,url:`${f}/info/refs?service=${o}`,headers:c}),m=!1,p.statusCode===401||p.statusCode===203){let e=h?i:n;if(e){if(d=await e(u,{...d,headers:{...c}}),d&&d.cancel)throw new zt;d&&(Vr(c,d),h=!0,m=!0)}}else p.statusCode===200&&h&&r&&await r(u,d);while(m);if(p.statusCode!==200){let{response:e}=await Hr(p);throw new wt(p.statusCode,p.statusMessage,e)}if(p.headers[`content-type`]===`application/x-${o}-advertisement`){let e=await Rr(p.body,{service:o});return e.auth=d,e}else{let{preview:e,response:t,data:n}=await Hr(p);try{let e=await Rr([n],{service:o});return e.auth=d,e}catch{throw new It(e,t)}}}static async connect({http:e,onProgress:t,corsProxy:n,service:r,url:i,auth:a,body:o,headers:s}){let c=Pr(i);c&&(i=c.url),n&&(i=Br(n,i)),s[`content-type`]=`application/x-${r}-request`,s.accept=`application/x-${r}-result`,Vr(s,a);let l=await e.request({onProgress:t,method:`POST`,url:`${i}/${r}`,body:o,headers:s});if(l.statusCode!==200){let{response:e}=Hr(l);throw new wt(l.statusCode,l.statusMessage,e)}return l}},Wr=class{static getRemoteHelperFor({url:e}){let t=new Map;t.set(`http`,Ur),t.set(`https`,Ur);let n=Gr({url:e});if(!n)throw new Rt(e);if(t.has(n.transport))return t.get(n.transport);throw new Lt(e,n.transport,n.transport===`ssh`?Ar(e):void 0)}};function Gr({url:e}){if(e.startsWith(`git@`))return{transport:`ssh`,address:e};let t=e.match(/(\w+)(:\/\/|::)(.*)/);if(t!==null){if(t[2]===`://`)return{transport:t[1],address:t[0]};if(t[2]===`::`)return{transport:t[1],address:t[3]}}}let Kr=null;var qr=class{static async read({fs:e,gitdir:t}){Kr===null&&(Kr=new o);let n=Y(t,`shallow`),r=new Set;return await Kr.acquire(n,async function(){let t=await e.read(n,{encoding:`utf8`});if(t===null||t.trim()===``)return r;t.trim().split(`
|
|
67
67
|
`).map(e=>r.add(e))}),r}static async write({fs:e,gitdir:t,oids:n}){Kr===null&&(Kr=new o);let r=Y(t,`shallow`);if(n.size>0){let t=[...n].join(`
|
|
68
68
|
`)+`
|
|
69
|
-
`;await Kr.acquire(r,async function(){await e.write(r,t,{encoding:`utf8`})})}else await Kr.acquire(r,async function(){await e.rm(r)})}};async function Jr({fs:e,gitdir:t,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`;return e.exists(`${t}/${r}`)}async function Yr({fs:e,cache:t,gitdir:n,oid:r,getExternalRefDelta:i}){let a=await e.readdir(Y(n,`objects/pack`));a=a.filter(e=>e.endsWith(`.idx`));for(let o of a){let a=await ut({fs:e,cache:t,filename:`${n}/objects/pack/${o}`,getExternalRefDelta:i});if(a.error)throw new
|
|
69
|
+
`;await Kr.acquire(r,async function(){await e.write(r,t,{encoding:`utf8`})})}else await Kr.acquire(r,async function(){await e.rm(r)})}};async function Jr({fs:e,gitdir:t,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`;return e.exists(`${t}/${r}`)}async function Yr({fs:e,cache:t,gitdir:n,oid:r,getExternalRefDelta:i}){let a=await e.readdir(Y(n,`objects/pack`));a=a.filter(e=>e.endsWith(`.idx`));for(let o of a){let a=await ut({fs:e,cache:t,filename:`${n}/objects/pack/${o}`,getExternalRefDelta:i});if(a.error)throw new _(a.error);if(a.offsets.has(r))return!0}return!1}async function Xr({fs:e,cache:t,gitdir:n,oid:r,format:i=`content`}){let a=r=>mt({fs:e,cache:t,gitdir:n,oid:r}),o=await Jr({fs:e,gitdir:n,oid:r});return o||=await Yr({fs:e,cache:t,gitdir:n,oid:r,getExternalRefDelta:a}),o}function Zr(e){return e.slice(0,12).toString(`hex`)===`5041434b0000000200000000`}function Qr(e,t){let n=e.map(e=>e.split(`=`,1)[0]);return t.filter(e=>{let t=e.split(`=`,1)[0];return n.includes(t)})}let $r={name:`isomorphic-git`,version:`1.37.6`,agent:`git/isomorphic-git@1.37.6`};var ei=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error(`You cannot write to a FIFO that has already been ended!`);if(this._waiting){let t=this._waiting;this._waiting=null,t({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error(`You cannot call read until the previous call to read has returned!`);return new Promise(e=>{this._waiting=e})}};function ti(e){let t=e.indexOf(`\r`),n=e.indexOf(`
|
|
70
70
|
`);return t===-1&&n===-1?-1:t===-1?n+1:n===-1?t+1:n===t+1?n+1:Math.min(t,n)+1}function ni(e){let t=new ei,n=``;return(async()=>{await Mr(e,e=>{for(e=e.toString(`utf8`),n+=e;;){let e=ti(n);if(e===-1)break;t.write(n.slice(0,e)),n=n.slice(e)}}),n.length>0&&t.write(n),t.end()})(),t}var ri=class{static demux(e){let t=Ir.streamReader(e),n=new ei,r=new ei,i=new ei,a=async function(){let o=await t();if(o===null)return a();if(o===!0){n.end(),i.end(),e.error?r.destroy(e.error):r.end();return}switch(o[0]){case 1:r.write(o.slice(1));break;case 2:i.write(o.slice(1));break;case 3:{let e=o.slice(1);i.write(e),n.end(),i.end(),r.destroy(Error(e.toString(`utf8`)));return}default:n.write(o)}a()};return a(),{packetlines:n,packfile:r,progress:i}}};async function ii(e){let{packetlines:t,packfile:n,progress:r}=ri.demux(e),i=[],a=[],o=[],s=!1,c=!1;return new Promise((l,u)=>{Mr(t,t=>{let d=t.toString(`utf8`).trim();if(d.startsWith(`shallow`)){let e=d.slice(-41).trim();e.length!==40&&u(new K(e)),i.push(e)}else if(d.startsWith(`unshallow`)){let e=d.slice(-41).trim();e.length!==40&&u(new K(e)),a.push(e)}else if(d.startsWith(`ACK`)){let[,e,t]=d.split(` `);o.push({oid:e,status:t}),t||(c=!0)}else d.startsWith(`NAK`)?(s=!0,c=!0):(c=!0,s=!0);c&&(e.error?u(e.error):l({shallows:i,unshallows:a,acks:o,nak:s,packfile:n,progress:r}))}).finally(()=>{c||(e.error?u(e.error):l({shallows:i,unshallows:a,acks:o,nak:s,packfile:n,progress:r}))})})}function ai({capabilities:e=[],wants:t=[],haves:n=[],shallows:r=[],depth:i=null,since:a=null,exclude:o=[]}){let s=[];t=[...new Set(t)];let c=` ${e.join(` `)}`;for(let e of t)s.push(Ir.encode(`want ${e}${c}\n`)),c=``;for(let e of r)s.push(Ir.encode(`shallow ${e}\n`));i!==null&&s.push(Ir.encode(`deepen ${i}\n`)),a!==null&&s.push(Ir.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)}\n`));for(let e of o)s.push(Ir.encode(`deepen-not ${e}\n`));s.push(Ir.flush());for(let e of n)s.push(Ir.encode(`have ${e}\n`));return s.push(Ir.encode(`done
|
|
71
|
-
`)),s}async function oi({fs:e,cache:t,http:n,onProgress:
|
|
71
|
+
`)),s}async function oi({fs:e,cache:t,http:n,onProgress:i,onMessage:a,onAuth:o,onAuthSuccess:s,onAuthFailure:c,gitdir:l,ref:u,remoteRef:d,remote:f,url:p,corsProxy:m,depth:h=null,since:g=null,exclude:_=[],relative:v=!1,tags:y=!1,singleBranch:b=!1,headers:x={},prune:S=!1,pruneTags:C=!1}){let w=u||await kr({fs:e,gitdir:l,test:!0}),T=await je.get({fs:e,gitdir:l}),E=f||w&&await T.get(`branch.${w}.remote`)||`origin`,D=p||await T.get(`remote.${E}.url`);if(D===void 0)throw new jt(`remote OR url`);let O=d||w&&await T.get(`branch.${w}.merge`)||u||`HEAD`;m===void 0&&(m=await T.get(`http.corsProxy`));let k=Wr.getRemoteHelperFor({url:D}),A=await k.discover({http:n,onAuth:o,onAuthSuccess:s,onAuthFailure:c,corsProxy:m,service:`git-upload-pack`,url:D,headers:x,protocolVersion:1}),ee=A.auth,j=A.refs;if(j.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(h!==null&&!A.capabilities.has(`shallow`))throw new Ft(`shallow`,`depth`);if(g!==null&&!A.capabilities.has(`deepen-since`))throw new Ft(`deepen-since`,`since`);if(_.length>0&&!A.capabilities.has(`deepen-not`))throw new Ft(`deepen-not`,`exclude`);if(v===!0&&!A.capabilities.has(`deepen-relative`))throw new Ft(`deepen-relative`,`relative`);let{oid:M,fullref:te}=Q.resolveAgainstMap({ref:O,map:j});for(let e of j.keys())e===te||e===`HEAD`||e.startsWith(`refs/heads/`)||y&&e.startsWith(`refs/tags/`)||j.delete(e);let N=Qr([...A.capabilities],[`multi_ack_detailed`,`no-done`,`side-band-64k`,`ofs-delta`,`agent=${$r.agent}`]);v&&N.push(`deepen-relative`);let P=b?[M]:j.values(),ne=b?[w]:await Q.listRefs({fs:e,gitdir:l,filepath:`refs`}),F=[];for(let n of ne)try{n=await Q.expand({fs:e,gitdir:l,ref:n});let r=await Q.resolve({fs:e,gitdir:l,ref:n});await Xr({fs:e,cache:t,gitdir:l,oid:r})&&F.push(r)}catch{}F=[...new Set(F)];let I=await qr.read({fs:e,gitdir:l}),re=A.capabilities.has(`shallow`)?[...I]:[],L=ai({capabilities:N,wants:P,haves:F,shallows:re,depth:h,since:g,exclude:_}),R=r.Buffer.from(await Nr(L)),ie=await k.connect({http:n,onProgress:i,corsProxy:m,service:`git-upload-pack`,url:D,auth:ee,body:[R],headers:x}),z=await ii(ie.body);ie.headers&&(z.headers=ie.headers);for(let n of z.shallows)if(!I.has(n))try{let{object:r}=await mt({fs:e,cache:t,gitdir:l,oid:n}),i=new en(r),a=await Promise.all(i.headers().parent.map(n=>Xr({fs:e,cache:t,gitdir:l,oid:n})));a.length===0||a.every(e=>e)||I.add(n)}catch{I.add(n)}for(let e of z.unshallows)I.delete(e);if(await qr.write({fs:e,gitdir:l,oids:I}),b){let t=new Map([[te,M]]),n=new Map,r=10,i=te;for(;r--;){let e=A.symrefs.get(i);if(e===void 0)break;n.set(i,e),i=e}let a=j.get(i);a&&t.set(i,a);let{pruned:o}=await Q.updateRemoteRefs({fs:e,gitdir:l,remote:E,refs:t,symrefs:n,tags:y,prune:S});S&&(z.pruned=o)}else{let{pruned:t}=await Q.updateRemoteRefs({fs:e,gitdir:l,remote:E,refs:j,symrefs:A.symrefs,tags:y,prune:S,pruneTags:C});S&&(z.pruned=t)}if(z.HEAD=A.symrefs.get(`HEAD`),z.HEAD===void 0){let{oid:e}=Q.resolveAgainstMap({ref:`HEAD`,map:j});for(let[t,n]of j.entries())if(t!==`HEAD`&&n===e){z.HEAD=t;break}}z.FETCH_HEAD={oid:M,description:`${te.startsWith(`refs/tags`)?`tag`:`branch`} '${Or(te)}' of ${D}`},(i||a)&&Mr(ni(z.progress),async e=>{if(a&&await a(e),i){let t=e.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);t&&await i({phase:t[1].trim(),loaded:parseInt(t[2],10),total:parseInt(t[3],10)})}});let B=r.Buffer.from(await Nr(z.packfile));if(ie.body.error)throw ie.body.error;let ae=B.slice(-20).toString(`hex`),V={defaultBranch:z.HEAD,fetchHead:z.FETCH_HEAD.oid,fetchHeadDescription:z.FETCH_HEAD.description};if(z.headers&&(V.headers=z.headers),S&&(V.pruned=z.pruned),ae!==``&&!Zr(B)){V.packfile=`objects/pack/pack-${ae}.pack`;let n=Y(l,V.packfile);await e.write(n,B);let r=await st.fromPack({pack:B,getExternalRefDelta:n=>mt({fs:e,cache:t,gitdir:l,oid:n}),onProgress:i});await e.write(n.replace(/\.pack$/,`.idx`),await r.toBuffer())}return V}async function si({fs:e,bare:t=!1,dir:n,gitdir:r=t?n:Y(n,`.git`),defaultBranch:i=`master`}){if(await e.exists(r+`/config`))return;let a=[`hooks`,`info`,`objects/info`,`objects/pack`,`refs/heads`,`refs/tags`];a=a.map(e=>r+`/`+e);for(let t of a)await e.mkdir(t);await e.write(r+`/config`,`[core]
|
|
72
72
|
repositoryformatversion = 0
|
|
73
73
|
filemode = false
|
|
74
74
|
\tbare = ${t}\n`+(t?``:` logallrefupdates = true
|
|
75
75
|
`)+` symlinks = false
|
|
76
76
|
ignorecase = true
|
|
77
|
-
`),await e.write(r+`/HEAD`,`ref: refs/heads/${i}\n`)}async function ci({fs:e,cache:t,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,onPostCheckout:c,dir:l,gitdir:u,url:d,corsProxy:f,ref:p,remote:m,depth:h,since:g,exclude:_,relative:v,singleBranch:y,noCheckout:b,noTags:x,headers:S,nonBlocking:C,batchSize:w=100}){try{if(await si({fs:e,gitdir:u}),await tr({fs:e,gitdir:u,remote:m,url:d,force:!1}),f){let t=await je.get({fs:e,gitdir:u});await t.set(`http.corsProxy`,f),await je.save({fs:e,gitdir:u,config:t})}let{defaultBranch:T,fetchHead:E}=await oi({fs:e,cache:t,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:u,ref:p,remote:m,corsProxy:f,depth:h,since:g,exclude:_,relative:v,singleBranch:y,headers:S,tags:!x});if(E===null)return;p||=T,p=p.replace(`refs/heads/`,``),await cr({fs:e,cache:t,onProgress:r,onPostCheckout:c,dir:l,gitdir:u,ref:p,remote:m,noCheckout:b,nonBlocking:C,batchSize:w})}catch(t){throw await e.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>void 0),t}}async function li({fs:e,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:s,dir:c,gitdir:l=Y(c,`.git`),url:u,corsProxy:d=void 0,ref:f=void 0,remote:p=`origin`,depth:m=void 0,since:h=void 0,exclude:g=[],relative:_=!1,singleBranch:v=!1,noCheckout:y=!1,noTags:b=!1,headers:x={},cache:S={},nonBlocking:C=!1,batchSize:w=100}){try{$(`fs`,e),$(`http`,t),$(`gitdir`,l),y||$(`dir`,c),$(`url`,u);let T=new yn(e);return await ci({fs:T,cache:S,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:s,dir:c,gitdir:await xn({fsp:T,dotgit:l}),url:u,corsProxy:d,ref:f,remote:p,depth:m,since:h,exclude:g,relative:_,singleBranch:v,noCheckout:y,noTags:b,headers:x,nonBlocking:C,batchSize:w})}catch(e){throw e.caller=`git.clone`,e}}async function ui({fs:e,onSign:t,dir:n,gitdir:r=Y(n,`.git`),message:i,author:a,committer:o,signingKey:s,amend:c=!1,dryRun:l=!1,noUpdateBranch:u=!1,ref:d,parent:f,tree:p,cache:m={}}){try{$(`fs`,e),c||$(`message`,i),s&&$(`onSign`,t);let n=new yn(e);return await Gn({fs:n,cache:m,onSign:t,gitdir:await xn({fsp:n,dotgit:r}),message:i,author:a,committer:o,signingKey:s,amend:c,dryRun:l,noUpdateBranch:u,ref:d,parent:f,tree:p})}catch(e){throw e.caller=`git.commit`,e}}async function di({fs:e,dir:t,gitdir:n=Y(t,`.git`),fullname:r=!1,test:i=!1}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e);return await kr({fs:t,gitdir:await xn({fsp:t,dotgit:n}),fullname:r,test:i})}catch(e){throw e.caller=`git.currentBranch`,e}}async function fi({fs:e,gitdir:t,ref:n}){if(n=n.startsWith(`refs/heads/`)?n:`refs/heads/${n}`,!await Q.exists({fs:e,gitdir:t,ref:n}))throw new G(n);let r=await Q.expand({fs:e,gitdir:t,ref:n});if(r===await kr({fs:e,gitdir:t,fullname:!0})){let n=await Q.resolve({fs:e,gitdir:t,ref:r});await Q.writeRef({fs:e,gitdir:t,ref:`HEAD`,value:n})}await Q.deleteRef({fs:e,gitdir:t,ref:r});let i=Or(n),a=await je.get({fs:e,gitdir:t});await a.deleteSection(`branch`,i),await je.save({fs:e,gitdir:t,config:a})}async function pi({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r}){try{$(`fs`,e),$(`ref`,r);let t=new yn(e);return await fi({fs:t,gitdir:await xn({fsp:t,dotgit:n}),ref:r})}catch(e){throw e.caller=`git.deleteBranch`,e}}async function mi({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r}){try{$(`fs`,e),$(`ref`,r);let t=new yn(e),i=await xn({fsp:t,dotgit:n});await Q.deleteRef({fs:t,gitdir:i,ref:r})}catch(e){throw e.caller=`git.deleteRef`,e}}async function hi({fs:e,gitdir:t,remote:n}){let r=await je.get({fs:e,gitdir:t});await r.deleteSection(`remote`,n),await je.save({fs:e,gitdir:t,config:r})}async function gi({fs:e,dir:t,gitdir:n=Y(t,`.git`),remote:r}){try{$(`fs`,e),$(`remote`,r);let t=new yn(e);return await hi({fs:t,gitdir:await xn({fsp:t,dotgit:n}),remote:r})}catch(e){throw e.caller=`git.deleteRemote`,e}}async function _i({fs:e,gitdir:t,ref:n}){n=n.startsWith(`refs/tags/`)?n:`refs/tags/${n}`,await Q.deleteRef({fs:e,gitdir:t,ref:n})}async function vi({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r}){try{$(`fs`,e),$(`ref`,r);let t=new yn(e);return await _i({fs:t,gitdir:await xn({fsp:t,dotgit:n}),ref:r})}catch(e){throw e.caller=`git.deleteTag`,e}}async function yi({fs:e,gitdir:t,oid:n}){let r=n.slice(0,2);return(await e.readdir(`${t}/objects/${r}`)).map(e=>`${r}${e}`).filter(e=>e.startsWith(n))}async function bi({fs:e,cache:t,gitdir:n,oid:r,getExternalRefDelta:i}){let a=[],o=await e.readdir(Y(n,`objects/pack`));o=o.filter(e=>e.endsWith(`.idx`));for(let s of o){let o=await ut({fs:e,cache:t,filename:`${n}/objects/pack/${s}`,getExternalRefDelta:i});if(o.error)throw new v(o.error);for(let e of o.offsets.keys())e.startsWith(r)&&a.push(e)}return a}async function xi({fs:e,cache:t,gitdir:n,oid:r}){let i=r=>mt({fs:e,cache:t,gitdir:n,oid:r}),a=await yi({fs:e,gitdir:n,oid:r}),o=await bi({fs:e,cache:t,gitdir:n,oid:r,getExternalRefDelta:i});for(let e of o)a.indexOf(e)===-1&&a.push(e);if(a.length===1)return a[0];throw a.length>1?new gt(`oids`,r,a):new G(`an object matching "${r}"`)}async function Si({fs:e,dir:t,gitdir:n=Y(t,`.git`),oid:r,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oid`,r);let t=new yn(e);return await xi({fs:t,cache:i,gitdir:await xn({fsp:t,dotgit:n}),oid:r})}catch(e){throw e.caller=`git.expandOid`,e}}async function Ci({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r);let t=new yn(e),i=await xn({fsp:t,dotgit:n});return await Q.expand({fs:t,gitdir:i,ref:r})}catch(e){throw e.caller=`git.expandRef`,e}}async function wi({fs:e,cache:t,gitdir:n,oids:r}){let i={},a=r.length,o=r.map((e,t)=>({index:t,oid:e}));for(;o.length;){let r=new Set;for(let{oid:e,index:t}of o)i[e]||(i[e]=new Set),i[e].add(t),i[e].size===a&&r.add(e);if(r.size>0)return[...r];let s=new Map;for(let{oid:r,index:a}of o)try{let{object:o}=await mt({fs:e,cache:t,gitdir:n,oid:r}),{parent:c}=en.from(o).parseHeaders();for(let e of c)(!i[e]||!i[e].has(a))&&s.set(e+`:`+a,{oid:e,index:a})}catch{}o=Array.from(s.values())}return[]}async function Ti({fs:e,cache:t,dir:n,gitdir:r,ours:i,theirs:a,fastForward:o=!0,fastForwardOnly:s=!1,dryRun:c=!1,noUpdateBranch:l=!1,abortOnConflict:u=!0,message:d,author:f,committer:p,signingKey:m,onSign:h,mergeDriver:g,allowUnrelatedHistories:_=!1}){i===void 0&&(i=await kr({fs:e,gitdir:r,fullname:!0})),i=await Q.expand({fs:e,gitdir:r,ref:i}),a=await Q.expand({fs:e,gitdir:r,ref:a});let v=await Q.resolve({fs:e,gitdir:r,ref:i}),y=await Q.resolve({fs:e,gitdir:r,ref:a}),b=await wi({fs:e,cache:t,gitdir:r,oids:[v,y]});if(b.length!==1)if(b.length===0&&_)b.push(`4b825dc642cb6eb9a060e54bf8d69288fbee4904`);else throw new Ot;let x=b[0];if(x===y)return{oid:v,alreadyMerged:!0};if(o&&x===v)return!c&&!l&&await Q.writeRef({fs:e,gitdir:r,ref:i,value:y}),{oid:y,fastForward:!0};{if(s)throw new St;let o=await ae.acquire({fs:e,gitdir:r,cache:t,allowUnmerged:!1},async o=>gr({fs:e,cache:t,dir:n,gitdir:r,index:o,ourOid:v,theirOid:y,baseOid:x,ourName:Or(i),baseName:`base`,theirName:Or(a),dryRun:c,abortOnConflict:u,mergeDriver:g}));if(o instanceof kt)throw o;return d||=`Merge branch '${Or(a)}' into ${Or(i)}`,{oid:await Gn({fs:e,cache:t,gitdir:r,message:d,ref:i,tree:o,parent:[v,y],author:f,committer:p,signingKey:m,onSign:h,dryRun:c,noUpdateBranch:l}),tree:o,mergeCommit:!0}}}async function Ei({fs:e,cache:t,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,dir:c,gitdir:l,ref:u,url:d,remote:f,remoteRef:p,prune:m,pruneTags:h,fastForward:g,fastForwardOnly:_,corsProxy:v,singleBranch:y,headers:b,author:x,committer:S,signingKey:C}){try{if(!u){let t=await kr({fs:e,gitdir:l});if(!t)throw new jt(`ref`);u=t}let{fetchHead:w,fetchHeadDescription:T}=await oi({fs:e,cache:t,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:l,corsProxy:v,ref:u,url:d,remote:f,remoteRef:p,singleBranch:y,headers:b,prune:m,pruneTags:h});await Ti({fs:e,cache:t,gitdir:l,ours:u,theirs:w,fastForward:g,fastForwardOnly:_,message:`Merge ${T}`,author:x,committer:S,signingKey:C,dryRun:!1,noUpdateBranch:!1}),await cr({fs:e,cache:t,onProgress:r,dir:c,gitdir:l,ref:u,remote:f,noCheckout:!1})}catch(e){throw e.caller=`git.pull`,e}}async function Di({fs:e,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:c=Y(s,`.git`),ref:l,url:u,remote:d,remoteRef:f,corsProxy:p,singleBranch:m,headers:h={},cache:g={}}){try{$(`fs`,e),$(`http`,t),$(`gitdir`,c);let _={name:``,email:``,timestamp:Date.now(),timezoneOffset:0},v=new yn(e);return await Ei({fs:v,cache:g,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:await xn({fsp:v,dotgit:c}),ref:l,url:u,remote:d,remoteRef:f,fastForwardOnly:!0,corsProxy:p,singleBranch:m,headers:h,author:_,committer:_})}catch(e){throw e.caller=`git.fastForward`,e}}async function Oi({fs:e,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:c=Y(s,`.git`),ref:l,remote:u,remoteRef:d,url:f,corsProxy:p,depth:m=null,since:h=null,exclude:g=[],relative:_=!1,tags:v=!1,singleBranch:y=!1,headers:b={},prune:x=!1,pruneTags:S=!1,cache:C={}}){try{$(`fs`,e),$(`http`,t),$(`gitdir`,c);let s=new yn(e);return await oi({fs:s,cache:C,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,gitdir:await xn({fsp:s,dotgit:c}),ref:l,remote:u,remoteRef:d,url:f,corsProxy:p,depth:m,since:h,exclude:g,relative:_,tags:v,singleBranch:y,headers:b,prune:x,pruneTags:S})}catch(e){throw e.caller=`git.fetch`,e}}async function ki({fs:e,dir:t,gitdir:n=Y(t,`.git`),oids:r,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oids`,r);let t=new yn(e);return await wi({fs:t,cache:i,gitdir:await xn({fsp:t,dotgit:n}),oids:r})}catch(e){throw e.caller=`git.findMergeBase`,e}}async function Ai({fs:e,filepath:t}){if(await e.exists(Y(t,`.git`)))return t;{let n=H(t);if(n===t)throw new G(`git root for ${t}`);return Ai({fs:e,filepath:n})}}async function ji({fs:e,filepath:t}){try{return $(`fs`,e),$(`filepath`,t),await Ai({fs:new yn(e),filepath:t})}catch(e){throw e.caller=`git.findRoot`,e}}async function Mi({fs:e,dir:t,gitdir:n=Y(t,`.git`),path:r}){try{$(`fs`,e),$(`gitdir`,n),$(`path`,r);let t=new yn(e);return await Rn({fs:t,gitdir:await xn({fsp:t,dotgit:n}),path:r})}catch(e){throw e.caller=`git.getConfig`,e}}async function Ni({fs:e,gitdir:t,path:n}){return(await je.get({fs:e,gitdir:t})).getall(n)}async function Pi({fs:e,dir:t,gitdir:n=Y(t,`.git`),path:r}){try{$(`fs`,e),$(`gitdir`,n),$(`path`,r);let t=new yn(e);return await Ni({fs:t,gitdir:await xn({fsp:t,dotgit:n}),path:r})}catch(e){throw e.caller=`git.getConfigAll`,e}}async function Fi({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:o={},forPush:s=!1}){try{$(`http`,e),$(`url`,a);let c=await Wr.getRemoteHelperFor({url:a}).discover({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:s?`git-receive-pack`:`git-upload-pack`,url:a,headers:o,protocolVersion:1}),l={capabilities:[...c.capabilities]};for(let[e,t]of c.refs){let n=e.split(`/`),r=n.pop(),i=l;for(let e of n)i[e]=i[e]||{},i=i[e];i[r]=t}for(let[e,t]of c.symrefs){let n=e.split(`/`),r=n.pop(),i=l;for(let e of n)i[e]=i[e]||{},i=i[e];i[r]=t}return l}catch(e){throw e.caller=`git.getRemoteInfo`,e}}function Ii(e,t,n,r){let i=[];for(let[a,o]of e.refs){if(t&&!a.startsWith(t))continue;if(a.endsWith(`^{}`)){if(r){let e=a.replace(`^{}`,``),t=i[i.length-1],n=t.ref===e?t:i.find(t=>t.ref===e);if(n===void 0)throw Error(`I did not expect this to happen`);n.peeled=o}continue}let s={ref:a,oid:o};n&&e.symrefs.has(a)&&(s.target=e.symrefs.get(a)),i.push(s)}return i}async function Li({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:o={},forPush:s=!1,protocolVersion:c=2}){try{$(`http`,e),$(`url`,a);let l=await Wr.getRemoteHelperFor({url:a}).discover({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:s?`git-receive-pack`:`git-upload-pack`,url:a,headers:o,protocolVersion:c});if(l.protocolVersion===2)return{protocolVersion:l.protocolVersion,capabilities:l.capabilities2};let u={};for(let e of l.capabilities){let[t,n]=e.split(`=`);n?u[t]=n:u[t]=!0}return{protocolVersion:1,capabilities:u,refs:Ii(l,void 0,!0,!0)}}catch(e){throw e.caller=`git.getRemoteInfo2`,e}}async function Ri({type:e,object:t,format:n=`content`,oid:r=void 0}){return n!==`deflated`&&(n!==`wrapped`&&(t=Ue.wrap({type:e,object:t})),r=await j(t)),{oid:r,object:t}}async function zi({object:e}){try{$(`object`,e),typeof e==`string`?e=i.Buffer.from(e,`utf8`):e instanceof Uint8Array||(e=new Uint8Array(e));let t=`blob`,{oid:n,object:r}=await Ri({type:t,format:`content`,object:e});return{oid:n,type:t,object:r,format:`wrapped`}}catch(e){throw e.caller=`git.hashBlob`,e}}async function Bi({fs:e,cache:t,onProgress:n,dir:r,gitdir:i,filepath:a}){try{a=Y(r,a);let o=await e.read(a),s=await st.fromPack({pack:o,getExternalRefDelta:n=>mt({fs:e,cache:t,gitdir:i,oid:n}),onProgress:n});return await e.write(a.replace(/\.pack$/,`.idx`),await s.toBuffer()),{oids:[...s.hashes]}}catch(e){throw e.caller=`git.indexPack`,e}}async function Vi({fs:e,onProgress:t,dir:n,gitdir:r=Y(n,`.git`),filepath:i,cache:a={}}){try{$(`fs`,e),$(`dir`,n),$(`gitdir`,n),$(`filepath`,i);let o=new yn(e);return await Bi({fs:o,cache:a,onProgress:t,dir:n,gitdir:await xn({fsp:o,dotgit:r}),filepath:i})}catch(e){throw e.caller=`git.indexPack`,e}}async function Hi({fs:e,bare:t=!1,dir:n,gitdir:r=t?n:Y(n,`.git`),defaultBranch:i=`master`}){try{$(`fs`,e),$(`gitdir`,r),t||$(`dir`,n);let a=new yn(e);return await si({fs:a,bare:t,dir:n,gitdir:await xn({fsp:a,dotgit:r}),defaultBranch:i})}catch(e){throw e.caller=`git.init`,e}}async function Ui({fs:e,cache:t,gitdir:n,oid:r,ancestor:i,depth:a}){let o=await qr.read({fs:e,gitdir:n});if(!r)throw new jt(`oid`);if(!i)throw new jt(`ancestor`);if(r===i)return!1;let s=[r],c=new Set,l=0;for(;s.length;){if(l++===a)throw new Dt(a);let r=s.shift(),{type:u,object:d}=await mt({fs:e,cache:t,gitdir:n,oid:r});if(u!==`commit`)throw new le(r,u,`commit`);let f=en.from(d).parse();for(let e of f.parent)if(e===i)return!0;if(!o.has(r))for(let e of f.parent)c.has(e)||(s.push(e),c.add(e))}return!1}async function Wi({fs:e,dir:t,gitdir:n=Y(t,`.git`),oid:r,ancestor:i,depth:a=-1,cache:o={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oid`,r),$(`ancestor`,i);let t=new yn(e);return await Ui({fs:t,cache:o,gitdir:await xn({fsp:t,dotgit:n}),oid:r,ancestor:i,depth:a})}catch(e){throw e.caller=`git.isDescendent`,e}}async function Gi({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r}){try{$(`fs`,e),$(`dir`,t),$(`gitdir`,n),$(`filepath`,r);let i=new yn(e),a=await xn({fsp:i,dotgit:n});return wn.isIgnored({fs:i,dir:t,gitdir:a,filepath:r})}catch(e){throw e.caller=`git.isIgnored`,e}}async function Ki({fs:e,dir:t,gitdir:n=Y(t,`.git`),remote:r}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e),i=await xn({fsp:t,dotgit:n});return Q.listBranches({fs:t,gitdir:i,remote:r})}catch(e){throw e.caller=`git.listBranches`,e}}async function qi({fs:e,gitdir:t,ref:n,cache:r}){if(n){let i=await Q.resolve({gitdir:t,fs:e,ref:n}),a=[];return await Ji({fs:e,cache:r,gitdir:t,oid:i,filenames:a,prefix:``}),a}else return ae.acquire({fs:e,gitdir:t,cache:r},async function(e){return e.entries.map(e=>e.path)})}async function Ji({fs:e,cache:t,gitdir:n,oid:r,filenames:i,prefix:a}){let{tree:o}=await Yn({fs:e,cache:t,gitdir:n,oid:r});for(let r of o)r.type===`tree`?await Ji({fs:e,cache:t,gitdir:n,oid:r.oid,filenames:i,prefix:Y(a,r.path)}):i.push(Y(a,r.path))}async function Yi({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e);return await qi({fs:t,cache:i,gitdir:await xn({fsp:t,dotgit:n}),ref:r})}catch(e){throw e.caller=`git.listFiles`,e}}async function Xi({fs:e,cache:t,gitdir:n,ref:r}){let i;try{i=await Q.resolve({gitdir:n,fs:e,ref:r})}catch(e){if(e instanceof G)return[]}return(await Yn({fs:e,cache:t,gitdir:n,oid:i})).tree.map(e=>({target:e.path,note:e.oid}))}async function Zi({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r=`refs/notes/commits`,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r);let t=new yn(e);return await Xi({fs:t,cache:i,gitdir:await xn({fsp:t,dotgit:n}),ref:r})}catch(e){throw e.caller=`git.listNotes`,e}}async function Qi({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e),i=await xn({fsp:t,dotgit:n});return Q.listRefs({fs:t,gitdir:i,filepath:r})}catch(e){throw e.caller=`git.listRefs`,e}}async function $i({fs:e,gitdir:t}){let n=await je.get({fs:e,gitdir:t}),r=await n.getSubsections(`remote`);return Promise.all(r.map(async e=>({remote:e,url:await n.get(`remote.${e}.url`)})))}async function ea({fs:e,dir:t,gitdir:n=Y(t,`.git`)}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e);return await $i({fs:t,gitdir:await xn({fsp:t,dotgit:n})})}catch(e){throw e.caller=`git.listRemotes`,e}}async function ta(e){let t=Ir.streamReader(e),n=[],r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString(`utf8`).replace(/\n$/,``);let[e,t,...i]=r.split(` `),a={ref:t,oid:e};for(let e of i){let[t,n]=e.split(`:`);t===`symref-target`?a.target=n:t===`peeled`&&(a.peeled=n)}n.push(a)}return n}async function na({prefix:e,symrefs:t,peelTags:n}){let r=[];return r.push(Ir.encode(`command=ls-refs
|
|
78
|
-
`)),r.push(Ir.encode(`agent=${$r.agent}\n`)),(n||t||e)&&r.push(Ir.delim()),n&&r.push(Ir.encode(`peel`)),t&&r.push(Ir.encode(`symrefs`)),e&&r.push(Ir.encode(`ref-prefix ${e}`)),r.push(Ir.flush()),r}async function ra({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:o={},forPush:s=!1,protocolVersion:c=2,prefix:l,symrefs:u,peelTags:d}){try{$(`http`,e),$(`url`,a);let f=await Ur.discover({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:s?`git-receive-pack`:`git-upload-pack`,url:a,headers:o,protocolVersion:c});if(f.protocolVersion===1)return Ii(f,l,u,d);let p=await na({prefix:l,symrefs:u,peelTags:d});return ta((await Ur.connect({http:e,auth:f.auth,headers:o,corsProxy:i,service:s?`git-receive-pack`:`git-upload-pack`,url:a,body:p})).body)}catch(e){throw e.caller=`git.listServerRefs`,e}}async function ia({fs:e,dir:t,gitdir:n=Y(t,`.git`)}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e),r=await xn({fsp:t,dotgit:n});return Q.listTags({fs:t,gitdir:r})}catch(e){throw e.caller=`git.listTags`,e}}function aa(e,t){return e.committer.timestamp-t.committer.timestamp}async function oa({fs:e,cache:t,gitdir:n,oid:r,fileId:i}){if(i===`e69de29bb2d1d6434b8b29ae775ad8c2e48c5391`)return;let a=r,o,s=await tn({fs:e,cache:t,gitdir:n,oid:r}),c=s.tree;return i===s.oid?o=s.path:(o=await sa({fs:e,cache:t,gitdir:n,tree:c,fileId:i,oid:a}),Array.isArray(o)&&(o.length===0?o=void 0:o.length===1&&(o=o[0]))),o}async function sa({fs:e,cache:t,gitdir:n,tree:r,fileId:i,oid:a,filepaths:o=[],parentPath:s=``}){let c=r.entries().map(function(r){let c;return r.oid===i?(c=Y(s,r.path),o.push(c)):r.type===`tree`&&(c=mt({fs:e,cache:t,gitdir:n,oid:r.oid}).then(function({object:c}){return sa({fs:e,cache:t,gitdir:n,tree:He.from(c),fileId:i,oid:a,filepaths:o,parentPath:Y(s,r.path)})})),c});return await Promise.all(c),o}async function ca({fs:e,cache:t,gitdir:n,filepath:r,ref:i,depth:a,since:o,force:s,follow:c}){let l=o===void 0?void 0:Math.floor(o.valueOf()/1e3),u=[],d=await qr.read({fs:e,gitdir:n}),f=[await Wn({fs:e,cache:t,gitdir:n,oid:await Q.resolve({fs:e,gitdir:n,ref:i})})],p,m,h;function g(e){h&&r&&u.push(e)}for(;f.length>0;){let i=f.pop();if(l!==void 0&&i.commit.committer.timestamp<=l)break;if(r){let a;try{a=await qn({fs:e,cache:t,gitdir:n,oid:i.commit.tree,filepath:r}),m&&p!==a&&u.push(m),p=a,m=i,h=!0}catch(a){if(a instanceof G){let o=c&&p;if(o&&(o=await oa({fs:e,cache:t,gitdir:n,oid:i.commit.tree,fileId:p}),o))if(Array.isArray(o)){if(m){let i=await oa({fs:e,cache:t,gitdir:n,oid:m.commit.tree,fileId:p});if(Array.isArray(i))if(o=o.filter(e=>i.indexOf(e)===-1),o.length===1)o=o[0],r=o,m&&u.push(m);else{o=!1,m&&u.push(m);break}}}else r=o,m&&u.push(m);if(!o){if(h&&p&&(u.push(m),!s))break;if(!s&&!c)throw a}m=i,h=!1}else throw a}}else u.push(i);if(a!==void 0&&u.length===a){g(i);break}if(!d.has(i.oid))for(let r of i.commit.parent){let i=await Wn({fs:e,cache:t,gitdir:n,oid:r});f.map(e=>e.oid).includes(i.oid)||f.push(i)}f.length===0&&g(i),f.sort((e,t)=>aa(e.commit,t.commit))}return u}async function la({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r,ref:i=`HEAD`,depth:a,since:o,force:s,follow:c,cache:l={}}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,i);let t=new yn(e);return await ca({fs:t,cache:l,gitdir:await xn({fsp:t,dotgit:n}),filepath:r,ref:i,depth:a,since:o,force:s,follow:c})}catch(e){throw e.caller=`git.log`,e}}async function ua({fs:e,onSign:t,dir:n,gitdir:r=Y(n,`.git`),ours:i,theirs:a,fastForward:o=!0,fastForwardOnly:s=!1,dryRun:c=!1,noUpdateBranch:l=!1,abortOnConflict:u=!0,message:d,author:f,committer:p,signingKey:m,cache:h={},mergeDriver:g,allowUnrelatedHistories:_=!1}){try{$(`fs`,e),m&&$(`onSign`,t);let v=new yn(e),y=await xn({fsp:v,dotgit:r}),b=await Vn({fs:v,gitdir:y,author:f});if(!b&&(!s||!o))throw new At(`author`);let x=await Hn({fs:v,gitdir:y,author:b,committer:p});if(!x&&(!s||!o))throw new At(`committer`);return await Ti({fs:v,cache:h,dir:n,gitdir:y,ours:i,theirs:a,fastForward:o,fastForwardOnly:s,dryRun:c,noUpdateBranch:l,abortOnConflict:u,message:d,author:b,committer:x,signingKey:m,onSign:t,mergeDriver:g,allowUnrelatedHistories:_})}catch(e){throw e.caller=`git.merge`,e}}let da={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function fa({fs:e,cache:t,dir:n,gitdir:
|
|
77
|
+
`),await e.write(r+`/HEAD`,`ref: refs/heads/${i}\n`)}async function ci({fs:e,cache:t,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,onPostCheckout:c,dir:l,gitdir:u,url:d,corsProxy:f,ref:p,remote:m,depth:h,since:g,exclude:_,relative:v,singleBranch:y,noCheckout:b,noTags:x,headers:S,nonBlocking:C,batchSize:w=100}){try{if(await si({fs:e,gitdir:u}),await tr({fs:e,gitdir:u,remote:m,url:d,force:!1}),f){let t=await je.get({fs:e,gitdir:u});await t.set(`http.corsProxy`,f),await je.save({fs:e,gitdir:u,config:t})}let{defaultBranch:T,fetchHead:E}=await oi({fs:e,cache:t,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:u,ref:p,remote:m,corsProxy:f,depth:h,since:g,exclude:_,relative:v,singleBranch:y,headers:S,tags:!x});if(E===null)return;p||=T,p=p.replace(`refs/heads/`,``),await cr({fs:e,cache:t,onProgress:r,onPostCheckout:c,dir:l,gitdir:u,ref:p,remote:m,noCheckout:b,nonBlocking:C,batchSize:w})}catch(t){throw await e.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>void 0),t}}async function li({fs:e,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:s,dir:c,gitdir:l=Y(c,`.git`),url:u,corsProxy:d=void 0,ref:f=void 0,remote:p=`origin`,depth:m=void 0,since:h=void 0,exclude:g=[],relative:_=!1,singleBranch:v=!1,noCheckout:y=!1,noTags:b=!1,headers:x={},cache:S={},nonBlocking:C=!1,batchSize:w=100}){try{$(`fs`,e),$(`http`,t),$(`gitdir`,l),y||$(`dir`,c),$(`url`,u);let T=new yn(e);return await ci({fs:T,cache:S,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:s,dir:c,gitdir:await xn({fsp:T,dotgit:l}),url:u,corsProxy:d,ref:f,remote:p,depth:m,since:h,exclude:g,relative:_,singleBranch:v,noCheckout:y,noTags:b,headers:x,nonBlocking:C,batchSize:w})}catch(e){throw e.caller=`git.clone`,e}}async function ui({fs:e,onSign:t,dir:n,gitdir:r=Y(n,`.git`),message:i,author:a,committer:o,signingKey:s,amend:c=!1,dryRun:l=!1,noUpdateBranch:u=!1,ref:d,parent:f,tree:p,cache:m={}}){try{$(`fs`,e),c||$(`message`,i),s&&$(`onSign`,t);let n=new yn(e);return await Gn({fs:n,cache:m,onSign:t,gitdir:await xn({fsp:n,dotgit:r}),message:i,author:a,committer:o,signingKey:s,amend:c,dryRun:l,noUpdateBranch:u,ref:d,parent:f,tree:p})}catch(e){throw e.caller=`git.commit`,e}}async function di({fs:e,dir:t,gitdir:n=Y(t,`.git`),fullname:r=!1,test:i=!1}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e);return await kr({fs:t,gitdir:await xn({fsp:t,dotgit:n}),fullname:r,test:i})}catch(e){throw e.caller=`git.currentBranch`,e}}async function fi({fs:e,gitdir:t,ref:n}){if(n=n.startsWith(`refs/heads/`)?n:`refs/heads/${n}`,!await Q.exists({fs:e,gitdir:t,ref:n}))throw new G(n);let r=await Q.expand({fs:e,gitdir:t,ref:n});if(r===await kr({fs:e,gitdir:t,fullname:!0})){let n=await Q.resolve({fs:e,gitdir:t,ref:r});await Q.writeRef({fs:e,gitdir:t,ref:`HEAD`,value:n})}await Q.deleteRef({fs:e,gitdir:t,ref:r});let i=Or(n),a=await je.get({fs:e,gitdir:t});await a.deleteSection(`branch`,i),await je.save({fs:e,gitdir:t,config:a})}async function pi({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r}){try{$(`fs`,e),$(`ref`,r);let t=new yn(e);return await fi({fs:t,gitdir:await xn({fsp:t,dotgit:n}),ref:r})}catch(e){throw e.caller=`git.deleteBranch`,e}}async function mi({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r}){try{$(`fs`,e),$(`ref`,r);let t=new yn(e),i=await xn({fsp:t,dotgit:n});await Q.deleteRef({fs:t,gitdir:i,ref:r})}catch(e){throw e.caller=`git.deleteRef`,e}}async function hi({fs:e,gitdir:t,remote:n}){let r=await je.get({fs:e,gitdir:t});await r.deleteSection(`remote`,n),await je.save({fs:e,gitdir:t,config:r})}async function gi({fs:e,dir:t,gitdir:n=Y(t,`.git`),remote:r}){try{$(`fs`,e),$(`remote`,r);let t=new yn(e);return await hi({fs:t,gitdir:await xn({fsp:t,dotgit:n}),remote:r})}catch(e){throw e.caller=`git.deleteRemote`,e}}async function _i({fs:e,gitdir:t,ref:n}){n=n.startsWith(`refs/tags/`)?n:`refs/tags/${n}`,await Q.deleteRef({fs:e,gitdir:t,ref:n})}async function vi({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r}){try{$(`fs`,e),$(`ref`,r);let t=new yn(e);return await _i({fs:t,gitdir:await xn({fsp:t,dotgit:n}),ref:r})}catch(e){throw e.caller=`git.deleteTag`,e}}async function yi({fs:e,gitdir:t,oid:n}){let r=n.slice(0,2);return(await e.readdir(`${t}/objects/${r}`)).map(e=>`${r}${e}`).filter(e=>e.startsWith(n))}async function bi({fs:e,cache:t,gitdir:n,oid:r,getExternalRefDelta:i}){let a=[],o=await e.readdir(Y(n,`objects/pack`));o=o.filter(e=>e.endsWith(`.idx`));for(let s of o){let o=await ut({fs:e,cache:t,filename:`${n}/objects/pack/${s}`,getExternalRefDelta:i});if(o.error)throw new _(o.error);for(let e of o.offsets.keys())e.startsWith(r)&&a.push(e)}return a}async function xi({fs:e,cache:t,gitdir:n,oid:r}){let i=r=>mt({fs:e,cache:t,gitdir:n,oid:r}),a=await yi({fs:e,gitdir:n,oid:r}),o=await bi({fs:e,cache:t,gitdir:n,oid:r,getExternalRefDelta:i});for(let e of o)a.indexOf(e)===-1&&a.push(e);if(a.length===1)return a[0];throw a.length>1?new gt(`oids`,r,a):new G(`an object matching "${r}"`)}async function Si({fs:e,dir:t,gitdir:n=Y(t,`.git`),oid:r,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oid`,r);let t=new yn(e);return await xi({fs:t,cache:i,gitdir:await xn({fsp:t,dotgit:n}),oid:r})}catch(e){throw e.caller=`git.expandOid`,e}}async function Ci({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r);let t=new yn(e),i=await xn({fsp:t,dotgit:n});return await Q.expand({fs:t,gitdir:i,ref:r})}catch(e){throw e.caller=`git.expandRef`,e}}async function wi({fs:e,cache:t,gitdir:n,oids:r}){let i={},a=r.length,o=r.map((e,t)=>({index:t,oid:e}));for(;o.length;){let r=new Set;for(let{oid:e,index:t}of o)i[e]||(i[e]=new Set),i[e].add(t),i[e].size===a&&r.add(e);if(r.size>0)return[...r];let s=new Map;for(let{oid:r,index:a}of o)try{let{object:o}=await mt({fs:e,cache:t,gitdir:n,oid:r}),{parent:c}=en.from(o).parseHeaders();for(let e of c)(!i[e]||!i[e].has(a))&&s.set(e+`:`+a,{oid:e,index:a})}catch{}o=Array.from(s.values())}return[]}async function Ti({fs:e,cache:t,dir:n,gitdir:r,ours:i,theirs:a,fastForward:o=!0,fastForwardOnly:s=!1,dryRun:c=!1,noUpdateBranch:l=!1,abortOnConflict:u=!0,message:d,author:f,committer:p,signingKey:m,onSign:h,mergeDriver:g,allowUnrelatedHistories:_=!1}){i===void 0&&(i=await kr({fs:e,gitdir:r,fullname:!0})),i=await Q.expand({fs:e,gitdir:r,ref:i}),a=await Q.expand({fs:e,gitdir:r,ref:a});let v=await Q.resolve({fs:e,gitdir:r,ref:i}),y=await Q.resolve({fs:e,gitdir:r,ref:a}),b=await wi({fs:e,cache:t,gitdir:r,oids:[v,y]});if(b.length!==1)if(b.length===0&&_)b.push(`4b825dc642cb6eb9a060e54bf8d69288fbee4904`);else throw new Ot;let x=b[0];if(x===y)return{oid:v,alreadyMerged:!0};if(o&&x===v)return!c&&!l&&await Q.writeRef({fs:e,gitdir:r,ref:i,value:y}),{oid:y,fastForward:!0};{if(s)throw new St;let o=await ae.acquire({fs:e,gitdir:r,cache:t,allowUnmerged:!1},async o=>gr({fs:e,cache:t,dir:n,gitdir:r,index:o,ourOid:v,theirOid:y,baseOid:x,ourName:Or(i),baseName:`base`,theirName:Or(a),dryRun:c,abortOnConflict:u,mergeDriver:g}));if(o instanceof kt)throw o;return d||=`Merge branch '${Or(a)}' into ${Or(i)}`,{oid:await Gn({fs:e,cache:t,gitdir:r,message:d,ref:i,tree:o,parent:[v,y],author:f,committer:p,signingKey:m,onSign:h,dryRun:c,noUpdateBranch:l}),tree:o,mergeCommit:!0}}}async function Ei({fs:e,cache:t,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,dir:c,gitdir:l,ref:u,url:d,remote:f,remoteRef:p,prune:m,pruneTags:h,fastForward:g,fastForwardOnly:_,corsProxy:v,singleBranch:y,headers:b,author:x,committer:S,signingKey:C}){try{if(!u){let t=await kr({fs:e,gitdir:l});if(!t)throw new jt(`ref`);u=t}let{fetchHead:w,fetchHeadDescription:T}=await oi({fs:e,cache:t,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,gitdir:l,corsProxy:v,ref:u,url:d,remote:f,remoteRef:p,singleBranch:y,headers:b,prune:m,pruneTags:h});await Ti({fs:e,cache:t,gitdir:l,ours:u,theirs:w,fastForward:g,fastForwardOnly:_,message:`Merge ${T}`,author:x,committer:S,signingKey:C,dryRun:!1,noUpdateBranch:!1}),await cr({fs:e,cache:t,onProgress:r,dir:c,gitdir:l,ref:u,remote:f,noCheckout:!1})}catch(e){throw e.caller=`git.pull`,e}}async function Di({fs:e,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:c=Y(s,`.git`),ref:l,url:u,remote:d,remoteRef:f,corsProxy:p,singleBranch:m,headers:h={},cache:g={}}){try{$(`fs`,e),$(`http`,t),$(`gitdir`,c);let _={name:``,email:``,timestamp:Date.now(),timezoneOffset:0},v=new yn(e);return await Ei({fs:v,cache:g,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:await xn({fsp:v,dotgit:c}),ref:l,url:u,remote:d,remoteRef:f,fastForwardOnly:!0,corsProxy:p,singleBranch:m,headers:h,author:_,committer:_})}catch(e){throw e.caller=`git.fastForward`,e}}async function Oi({fs:e,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:c=Y(s,`.git`),ref:l,remote:u,remoteRef:d,url:f,corsProxy:p,depth:m=null,since:h=null,exclude:g=[],relative:_=!1,tags:v=!1,singleBranch:y=!1,headers:b={},prune:x=!1,pruneTags:S=!1,cache:C={}}){try{$(`fs`,e),$(`http`,t),$(`gitdir`,c);let s=new yn(e);return await oi({fs:s,cache:C,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,gitdir:await xn({fsp:s,dotgit:c}),ref:l,remote:u,remoteRef:d,url:f,corsProxy:p,depth:m,since:h,exclude:g,relative:_,tags:v,singleBranch:y,headers:b,prune:x,pruneTags:S})}catch(e){throw e.caller=`git.fetch`,e}}async function ki({fs:e,dir:t,gitdir:n=Y(t,`.git`),oids:r,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oids`,r);let t=new yn(e);return await wi({fs:t,cache:i,gitdir:await xn({fsp:t,dotgit:n}),oids:r})}catch(e){throw e.caller=`git.findMergeBase`,e}}async function Ai({fs:e,filepath:t}){if(await e.exists(Y(t,`.git`)))return t;{let n=H(t);if(n===t)throw new G(`git root for ${t}`);return Ai({fs:e,filepath:n})}}async function ji({fs:e,filepath:t}){try{return $(`fs`,e),$(`filepath`,t),await Ai({fs:new yn(e),filepath:t})}catch(e){throw e.caller=`git.findRoot`,e}}async function Mi({fs:e,dir:t,gitdir:n=Y(t,`.git`),path:r}){try{$(`fs`,e),$(`gitdir`,n),$(`path`,r);let t=new yn(e);return await Rn({fs:t,gitdir:await xn({fsp:t,dotgit:n}),path:r})}catch(e){throw e.caller=`git.getConfig`,e}}async function Ni({fs:e,gitdir:t,path:n}){return(await je.get({fs:e,gitdir:t})).getall(n)}async function Pi({fs:e,dir:t,gitdir:n=Y(t,`.git`),path:r}){try{$(`fs`,e),$(`gitdir`,n),$(`path`,r);let t=new yn(e);return await Ni({fs:t,gitdir:await xn({fsp:t,dotgit:n}),path:r})}catch(e){throw e.caller=`git.getConfigAll`,e}}async function Fi({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:o={},forPush:s=!1}){try{$(`http`,e),$(`url`,a);let c=await Wr.getRemoteHelperFor({url:a}).discover({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:s?`git-receive-pack`:`git-upload-pack`,url:a,headers:o,protocolVersion:1}),l={capabilities:[...c.capabilities]};for(let[e,t]of c.refs){let n=e.split(`/`),r=n.pop(),i=l;for(let e of n)i[e]=i[e]||{},i=i[e];i[r]=t}for(let[e,t]of c.symrefs){let n=e.split(`/`),r=n.pop(),i=l;for(let e of n)i[e]=i[e]||{},i=i[e];i[r]=t}return l}catch(e){throw e.caller=`git.getRemoteInfo`,e}}function Ii(e,t,n,r){let i=[];for(let[a,o]of e.refs){if(t&&!a.startsWith(t))continue;if(a.endsWith(`^{}`)){if(r){let e=a.replace(`^{}`,``),t=i[i.length-1],n=t.ref===e?t:i.find(t=>t.ref===e);if(n===void 0)throw Error(`I did not expect this to happen`);n.peeled=o}continue}let s={ref:a,oid:o};n&&e.symrefs.has(a)&&(s.target=e.symrefs.get(a)),i.push(s)}return i}async function Li({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:o={},forPush:s=!1,protocolVersion:c=2}){try{$(`http`,e),$(`url`,a);let l=await Wr.getRemoteHelperFor({url:a}).discover({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:s?`git-receive-pack`:`git-upload-pack`,url:a,headers:o,protocolVersion:c});if(l.protocolVersion===2)return{protocolVersion:l.protocolVersion,capabilities:l.capabilities2};let u={};for(let e of l.capabilities){let[t,n]=e.split(`=`);n?u[t]=n:u[t]=!0}return{protocolVersion:1,capabilities:u,refs:Ii(l,void 0,!0,!0)}}catch(e){throw e.caller=`git.getRemoteInfo2`,e}}async function Ri({type:e,object:t,format:n=`content`,oid:r=void 0}){return n!==`deflated`&&(n!==`wrapped`&&(t=Ue.wrap({type:e,object:t})),r=await j(t)),{oid:r,object:t}}async function zi({object:e}){try{$(`object`,e),typeof e==`string`?e=r.Buffer.from(e,`utf8`):e instanceof Uint8Array||(e=new Uint8Array(e));let t=`blob`,{oid:n,object:i}=await Ri({type:t,format:`content`,object:e});return{oid:n,type:t,object:i,format:`wrapped`}}catch(e){throw e.caller=`git.hashBlob`,e}}async function Bi({fs:e,cache:t,onProgress:n,dir:r,gitdir:i,filepath:a}){try{a=Y(r,a);let o=await e.read(a),s=await st.fromPack({pack:o,getExternalRefDelta:n=>mt({fs:e,cache:t,gitdir:i,oid:n}),onProgress:n});return await e.write(a.replace(/\.pack$/,`.idx`),await s.toBuffer()),{oids:[...s.hashes]}}catch(e){throw e.caller=`git.indexPack`,e}}async function Vi({fs:e,onProgress:t,dir:n,gitdir:r=Y(n,`.git`),filepath:i,cache:a={}}){try{$(`fs`,e),$(`dir`,n),$(`gitdir`,n),$(`filepath`,i);let o=new yn(e);return await Bi({fs:o,cache:a,onProgress:t,dir:n,gitdir:await xn({fsp:o,dotgit:r}),filepath:i})}catch(e){throw e.caller=`git.indexPack`,e}}async function Hi({fs:e,bare:t=!1,dir:n,gitdir:r=t?n:Y(n,`.git`),defaultBranch:i=`master`}){try{$(`fs`,e),$(`gitdir`,r),t||$(`dir`,n);let a=new yn(e);return await si({fs:a,bare:t,dir:n,gitdir:await xn({fsp:a,dotgit:r}),defaultBranch:i})}catch(e){throw e.caller=`git.init`,e}}async function Ui({fs:e,cache:t,gitdir:n,oid:r,ancestor:i,depth:a}){let o=await qr.read({fs:e,gitdir:n});if(!r)throw new jt(`oid`);if(!i)throw new jt(`ancestor`);if(r===i)return!1;let s=[r],c=new Set,l=0;for(;s.length;){if(l++===a)throw new Dt(a);let r=s.shift(),{type:u,object:d}=await mt({fs:e,cache:t,gitdir:n,oid:r});if(u!==`commit`)throw new le(r,u,`commit`);let f=en.from(d).parse();for(let e of f.parent)if(e===i)return!0;if(!o.has(r))for(let e of f.parent)c.has(e)||(s.push(e),c.add(e))}return!1}async function Wi({fs:e,dir:t,gitdir:n=Y(t,`.git`),oid:r,ancestor:i,depth:a=-1,cache:o={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oid`,r),$(`ancestor`,i);let t=new yn(e);return await Ui({fs:t,cache:o,gitdir:await xn({fsp:t,dotgit:n}),oid:r,ancestor:i,depth:a})}catch(e){throw e.caller=`git.isDescendent`,e}}async function Gi({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r}){try{$(`fs`,e),$(`dir`,t),$(`gitdir`,n),$(`filepath`,r);let i=new yn(e),a=await xn({fsp:i,dotgit:n});return wn.isIgnored({fs:i,dir:t,gitdir:a,filepath:r})}catch(e){throw e.caller=`git.isIgnored`,e}}async function Ki({fs:e,dir:t,gitdir:n=Y(t,`.git`),remote:r}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e),i=await xn({fsp:t,dotgit:n});return Q.listBranches({fs:t,gitdir:i,remote:r})}catch(e){throw e.caller=`git.listBranches`,e}}async function qi({fs:e,gitdir:t,ref:n,cache:r}){if(n){let i=await Q.resolve({gitdir:t,fs:e,ref:n}),a=[];return await Ji({fs:e,cache:r,gitdir:t,oid:i,filenames:a,prefix:``}),a}else return ae.acquire({fs:e,gitdir:t,cache:r},async function(e){return e.entries.map(e=>e.path)})}async function Ji({fs:e,cache:t,gitdir:n,oid:r,filenames:i,prefix:a}){let{tree:o}=await Yn({fs:e,cache:t,gitdir:n,oid:r});for(let r of o)r.type===`tree`?await Ji({fs:e,cache:t,gitdir:n,oid:r.oid,filenames:i,prefix:Y(a,r.path)}):i.push(Y(a,r.path))}async function Yi({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e);return await qi({fs:t,cache:i,gitdir:await xn({fsp:t,dotgit:n}),ref:r})}catch(e){throw e.caller=`git.listFiles`,e}}async function Xi({fs:e,cache:t,gitdir:n,ref:r}){let i;try{i=await Q.resolve({gitdir:n,fs:e,ref:r})}catch(e){if(e instanceof G)return[]}return(await Yn({fs:e,cache:t,gitdir:n,oid:i})).tree.map(e=>({target:e.path,note:e.oid}))}async function Zi({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r=`refs/notes/commits`,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r);let t=new yn(e);return await Xi({fs:t,cache:i,gitdir:await xn({fsp:t,dotgit:n}),ref:r})}catch(e){throw e.caller=`git.listNotes`,e}}async function Qi({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e),i=await xn({fsp:t,dotgit:n});return Q.listRefs({fs:t,gitdir:i,filepath:r})}catch(e){throw e.caller=`git.listRefs`,e}}async function $i({fs:e,gitdir:t}){let n=await je.get({fs:e,gitdir:t}),r=await n.getSubsections(`remote`);return Promise.all(r.map(async e=>({remote:e,url:await n.get(`remote.${e}.url`)})))}async function ea({fs:e,dir:t,gitdir:n=Y(t,`.git`)}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e);return await $i({fs:t,gitdir:await xn({fsp:t,dotgit:n})})}catch(e){throw e.caller=`git.listRemotes`,e}}async function ta(e){let t=Ir.streamReader(e),n=[],r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString(`utf8`).replace(/\n$/,``);let[e,t,...i]=r.split(` `),a={ref:t,oid:e};for(let e of i){let[t,n]=e.split(`:`);t===`symref-target`?a.target=n:t===`peeled`&&(a.peeled=n)}n.push(a)}return n}async function na({prefix:e,symrefs:t,peelTags:n}){let r=[];return r.push(Ir.encode(`command=ls-refs
|
|
78
|
+
`)),r.push(Ir.encode(`agent=${$r.agent}\n`)),(n||t||e)&&r.push(Ir.delim()),n&&r.push(Ir.encode(`peel`)),t&&r.push(Ir.encode(`symrefs`)),e&&r.push(Ir.encode(`ref-prefix ${e}`)),r.push(Ir.flush()),r}async function ra({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:o={},forPush:s=!1,protocolVersion:c=2,prefix:l,symrefs:u,peelTags:d}){try{$(`http`,e),$(`url`,a);let f=await Ur.discover({http:e,onAuth:t,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:s?`git-receive-pack`:`git-upload-pack`,url:a,headers:o,protocolVersion:c});if(f.protocolVersion===1)return Ii(f,l,u,d);let p=await na({prefix:l,symrefs:u,peelTags:d});return ta((await Ur.connect({http:e,auth:f.auth,headers:o,corsProxy:i,service:s?`git-receive-pack`:`git-upload-pack`,url:a,body:p})).body)}catch(e){throw e.caller=`git.listServerRefs`,e}}async function ia({fs:e,dir:t,gitdir:n=Y(t,`.git`)}){try{$(`fs`,e),$(`gitdir`,n);let t=new yn(e),r=await xn({fsp:t,dotgit:n});return Q.listTags({fs:t,gitdir:r})}catch(e){throw e.caller=`git.listTags`,e}}function aa(e,t){return e.committer.timestamp-t.committer.timestamp}async function oa({fs:e,cache:t,gitdir:n,oid:r,fileId:i}){if(i===`e69de29bb2d1d6434b8b29ae775ad8c2e48c5391`)return;let a=r,o,s=await tn({fs:e,cache:t,gitdir:n,oid:r}),c=s.tree;return i===s.oid?o=s.path:(o=await sa({fs:e,cache:t,gitdir:n,tree:c,fileId:i,oid:a}),Array.isArray(o)&&(o.length===0?o=void 0:o.length===1&&(o=o[0]))),o}async function sa({fs:e,cache:t,gitdir:n,tree:r,fileId:i,oid:a,filepaths:o=[],parentPath:s=``}){let c=r.entries().map(function(r){let c;return r.oid===i?(c=Y(s,r.path),o.push(c)):r.type===`tree`&&(c=mt({fs:e,cache:t,gitdir:n,oid:r.oid}).then(function({object:c}){return sa({fs:e,cache:t,gitdir:n,tree:He.from(c),fileId:i,oid:a,filepaths:o,parentPath:Y(s,r.path)})})),c});return await Promise.all(c),o}async function ca({fs:e,cache:t,gitdir:n,filepath:r,ref:i,depth:a,since:o,force:s,follow:c}){let l=o===void 0?void 0:Math.floor(o.valueOf()/1e3),u=[],d=await qr.read({fs:e,gitdir:n}),f=[await Wn({fs:e,cache:t,gitdir:n,oid:await Q.resolve({fs:e,gitdir:n,ref:i})})],p,m,h;function g(e){h&&r&&u.push(e)}for(;f.length>0;){let i=f.pop();if(l!==void 0&&i.commit.committer.timestamp<=l)break;if(r){let a;try{a=await qn({fs:e,cache:t,gitdir:n,oid:i.commit.tree,filepath:r}),m&&p!==a&&u.push(m),p=a,m=i,h=!0}catch(a){if(a instanceof G){let o=c&&p;if(o&&(o=await oa({fs:e,cache:t,gitdir:n,oid:i.commit.tree,fileId:p}),o))if(Array.isArray(o)){if(m){let i=await oa({fs:e,cache:t,gitdir:n,oid:m.commit.tree,fileId:p});if(Array.isArray(i))if(o=o.filter(e=>i.indexOf(e)===-1),o.length===1)o=o[0],r=o,m&&u.push(m);else{o=!1,m&&u.push(m);break}}}else r=o,m&&u.push(m);if(!o){if(h&&p&&(u.push(m),!s))break;if(!s&&!c)throw a}m=i,h=!1}else throw a}}else u.push(i);if(a!==void 0&&u.length===a){g(i);break}if(!d.has(i.oid))for(let r of i.commit.parent){let i=await Wn({fs:e,cache:t,gitdir:n,oid:r});f.map(e=>e.oid).includes(i.oid)||f.push(i)}f.length===0&&g(i),f.sort((e,t)=>aa(e.commit,t.commit))}return u}async function la({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r,ref:i=`HEAD`,depth:a,since:o,force:s,follow:c,cache:l={}}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,i);let t=new yn(e);return await ca({fs:t,cache:l,gitdir:await xn({fsp:t,dotgit:n}),filepath:r,ref:i,depth:a,since:o,force:s,follow:c})}catch(e){throw e.caller=`git.log`,e}}async function ua({fs:e,onSign:t,dir:n,gitdir:r=Y(n,`.git`),ours:i,theirs:a,fastForward:o=!0,fastForwardOnly:s=!1,dryRun:c=!1,noUpdateBranch:l=!1,abortOnConflict:u=!0,message:d,author:f,committer:p,signingKey:m,cache:h={},mergeDriver:g,allowUnrelatedHistories:_=!1}){try{$(`fs`,e),m&&$(`onSign`,t);let v=new yn(e),y=await xn({fsp:v,dotgit:r}),b=await Vn({fs:v,gitdir:y,author:f});if(!b&&(!s||!o))throw new At(`author`);let x=await Hn({fs:v,gitdir:y,author:b,committer:p});if(!x&&(!s||!o))throw new At(`committer`);return await Ti({fs:v,cache:h,dir:n,gitdir:y,ours:i,theirs:a,fastForward:o,fastForwardOnly:s,dryRun:c,noUpdateBranch:l,abortOnConflict:u,message:d,author:b,committer:x,signingKey:m,onSign:t,mergeDriver:g,allowUnrelatedHistories:_})}catch(e){throw e.caller=`git.merge`,e}}let da={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function fa({fs:e,cache:t,dir:n,gitdir:i=Y(n,`.git`),oids:a}){let o=new s,c=[];function l(e,t){let n=r.Buffer.from(e,t);c.push(n),o.update(n)}async function u({stype:e,object:t}){let n=da[e],i=t.length,a=i>15?128:0,o=i&15;i>>>=4;let s=(a|n|o).toString(16);for(l(s,`hex`);a;)a=i>127?128:0,s=a|i&127,l(Fr(2,s),`hex`),i>>>=7;l(r.Buffer.from(await Dn(t)))}l(`PACK`),l(`00000002`,`hex`),l(Fr(8,a.length),`hex`);for(let n of a){let{type:r,object:a}=await mt({fs:e,cache:t,gitdir:i,oid:n});await u({write:l,object:a,stype:r})}let d=o.digest();return c.push(d),c}async function pa({fs:e,cache:t,gitdir:n,oids:i,write:a}){let o=await fa({fs:e,cache:t,gitdir:n,oids:i}),s=r.Buffer.from(await Nr(o)),c=`pack-${s.slice(-20).toString(`hex`)}.pack`;return a?(await e.write(Y(n,`objects/pack/${c}`),s),{filename:c}):{filename:c,packfile:new Uint8Array(s)}}async function ma({fs:e,dir:t,gitdir:n=Y(t,`.git`),oids:r,write:i=!1,cache:a={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oids`,r);let t=new yn(e);return await pa({fs:t,cache:a,gitdir:await xn({fsp:t,dotgit:n}),oids:r,write:i})}catch(e){throw e.caller=`git.packObjects`,e}}async function ha({fs:e,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:c=Y(s,`.git`),ref:l,url:u,remote:d,remoteRef:f,prune:p=!1,pruneTags:m=!1,fastForward:h=!0,fastForwardOnly:g=!1,corsProxy:_,singleBranch:v,headers:y={},author:b,committer:x,signingKey:S,cache:C={}}){try{$(`fs`,e),$(`gitdir`,c);let w=new yn(e),T=await xn({fsp:w,dotgit:c}),E=await Vn({fs:w,gitdir:T,author:b});if(!E)throw new At(`author`);let D=await Hn({fs:w,gitdir:T,author:E,committer:x});if(!D)throw new At(`committer`);return await Ei({fs:w,cache:C,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,dir:s,gitdir:T,ref:l,url:u,remote:d,remoteRef:f,fastForward:h,fastForwardOnly:g,corsProxy:_,singleBranch:v,headers:y,author:E,committer:D,signingKey:S,prune:p,pruneTags:m})}catch(e){throw e.caller=`git.pull`,e}}async function ga({fs:e,cache:t,dir:n,gitdir:r=Y(n,`.git`),start:i,finish:a}){let o=await qr.read({fs:e,gitdir:r}),s=new Set,c=new Set;for(let t of i)s.add(await Q.resolve({fs:e,gitdir:r,ref:t}));for(let t of a)try{let n=await Q.resolve({fs:e,gitdir:r,ref:t});c.add(n)}catch{}let l=new Set;async function u(n){l.add(n);let{type:i,object:a}=await mt({fs:e,cache:t,gitdir:r,oid:n});if(i===`tag`){let e=Zt.from(a).headers().object;return u(e)}if(i!==`commit`)throw new le(n,i,`commit`);if(!o.has(n))for(n of en.from(a).headers().parent)!c.has(n)&&!l.has(n)&&await u(n)}for(let e of s)await u(e);return l}async function _a({fs:e,cache:t,dir:n,gitdir:r=Y(n,`.git`),oids:i}){let a=new Set;async function o(n){if(a.has(n))return;a.add(n);let{type:i,object:s}=await mt({fs:e,cache:t,gitdir:r,oid:n});if(i===`tag`){let e=Zt.from(s).headers().object;await o(e)}else if(i===`commit`){let e=en.from(s).headers().tree;await o(e)}else if(i===`tree`){let e=He.from(s);for(let t of e)t.type===`blob`&&a.add(t.oid),t.type===`tree`&&await o(t.oid)}}for(let e of i)await o(e);return a}async function va(e){let t={},n=``,r=Ir.streamReader(e),i=await r();for(;i!==!0;)i!==null&&(n+=i.toString(`utf8`)+`
|
|
79
79
|
`),i=await r();let a=n.toString(`utf8`).split(`
|
|
80
80
|
`);if(i=a.shift(),!i.startsWith(`unpack `))throw new Nt(`unpack ok" or "unpack [error message]`,i);t.ok=i===`unpack ok`,t.ok||(t.error=i.slice(7)),t.refs={};for(let e of a){if(e.trim()===``)continue;let n=e.slice(0,2),r=e.slice(3),i=r.indexOf(` `);i===-1&&(i=r.length);let a=r.slice(0,i),o=r.slice(i+1);t.refs[a]={ok:n===`ok`,error:o}}return t}async function ya({capabilities:e=[],triplets:t=[]}){let n=[],r=`\x00 ${e.join(` `)}`;for(let e of t)n.push(Ir.encode(`${e.oldoid} ${e.oid} ${e.fullRef}${r}\n`)),r=``;return n.push(Ir.flush()),n}async function ba({fs:e,cache:t,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:o,onAuthFailure:s,onPrePush:c,gitdir:l,ref:u,remoteRef:d,remote:f,url:p,force:m=!1,delete:h=!1,corsProxy:g,headers:_={}}){let v=u||await kr({fs:e,gitdir:l});if(v===void 0)throw new jt(`ref`);let y=await je.get({fs:e,gitdir:l});f=f||await y.get(`branch.${v}.pushRemote`)||await y.get(`remote.pushDefault`)||await y.get(`branch.${v}.remote`)||`origin`;let b=p||await y.get(`remote.${f}.pushurl`)||await y.get(`remote.${f}.url`);if(b===void 0)throw new jt(`remote OR url`);let x=d||await y.get(`branch.${v}.merge`);if(b===void 0)throw new jt(`remoteRef`);g===void 0&&(g=await y.get(`http.corsProxy`));let S=await Q.expand({fs:e,gitdir:l,ref:v}),C=h?`0000000000000000000000000000000000000000`:await Q.resolve({fs:e,gitdir:l,ref:S}),w=Wr.getRemoteHelperFor({url:b}),T=await w.discover({http:n,onAuth:a,onAuthSuccess:o,onAuthFailure:s,corsProxy:g,service:`git-receive-pack`,url:b,headers:_,protocolVersion:1}),E=T.auth,D;if(!x)D=S;else try{D=await Q.expandAgainstMap({ref:x,map:T.refs})}catch(e){if(e instanceof G)D=x.startsWith(`refs/`)?x:`refs/heads/${x}`;else throw e}let O=T.refs.get(D)||`0000000000000000000000000000000000000000`;if(c&&!await c({remote:f,url:b,localRef:{ref:h?`(delete)`:S,oid:C},remoteRef:{ref:D,oid:O}}))throw new zt;let k=!T.capabilities.has(`no-thin`),A=new Set;if(!h){let n=[...T.refs.values()],r=new Set;if(O!==`0000000000000000000000000000000000000000`){let i=await wi({fs:e,cache:t,gitdir:l,oids:[C,O]});for(let e of i)n.push(e);k&&(r=await _a({fs:e,cache:t,gitdir:l,oids:i}))}if(n.includes(C)||(A=await _a({fs:e,cache:t,gitdir:l,oids:await ga({fs:e,cache:t,gitdir:l,start:[C],finish:n})})),k){try{let n=await Q.resolve({fs:e,gitdir:l,ref:`refs/remotes/${f}/HEAD`,depth:2}),{oid:i}=await Q.resolveAgainstMap({ref:n.replace(`refs/remotes/${f}/`,``),fullref:n,map:T.refs}),a=[i];for(let n of await _a({fs:e,cache:t,gitdir:l,oids:a}))r.add(n)}catch{}for(let e of r)A.delete(e)}if(C===O&&(m=!0),!m){if(S.startsWith(`refs/tags`)&&O!==`0000000000000000000000000000000000000000`)throw new Pt(`tag-exists`);if(C!==`0000000000000000000000000000000000000000`&&O!==`0000000000000000000000000000000000000000`&&!await Ui({fs:e,cache:t,gitdir:l,oid:C,ancestor:O,depth:-1}))throw new Pt(`not-fast-forward`)}}let ee=await ya({capabilities:Qr([...T.capabilities],[`report-status`,`side-band-64k`,`agent=${$r.agent}`]),triplets:[{oldoid:O,oid:C,fullRef:D}]}),j=h?[]:await fa({fs:e,cache:t,gitdir:l,oids:[...A]}),M=await w.connect({http:n,onProgress:r,corsProxy:g,service:`git-receive-pack`,url:b,auth:E,headers:_,body:[...ee,...j]}),{packfile:te,progress:N}=await ri.demux(M.body);i&&Mr(ni(N),async e=>{await i(e)});let P=await va(te);if(M.headers&&(P.headers=M.headers),f&&P.ok&&P.refs[D].ok&&!S.startsWith(`refs/tags`)){let t=`refs/remotes/${f}/${D.replace(`refs/heads`,``)}`;h?await Q.deleteRef({fs:e,gitdir:l,ref:t}):await Q.writeRef({fs:e,gitdir:l,ref:t,value:C})}if(P.ok&&Object.values(P.refs).every(e=>e.ok))return P;throw new Ct(Object.entries(P.refs).filter(([e,t])=>!t.ok).map(([e,t])=>`\n - ${e}: ${t.error}`).join(``),P)}async function xa({fs:e,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPrePush:s,dir:c,gitdir:l=Y(c,`.git`),ref:u,remoteRef:d,remote:f=`origin`,url:p,force:m=!1,delete:h=!1,corsProxy:g,headers:_={},cache:v={}}){try{$(`fs`,e),$(`http`,t),$(`gitdir`,l);let c=new yn(e);return await ba({fs:c,cache:v,http:t,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:o,onPrePush:s,gitdir:await xn({fsp:c,dotgit:l}),ref:u,remoteRef:d,remote:f,url:p,force:m,delete:h,corsProxy:g,headers:_})}catch(e){throw e.caller=`git.push`,e}}async function Sa({fs:e,cache:t,gitdir:n,oid:r}){let{type:i,object:a}=await mt({fs:e,cache:t,gitdir:n,oid:r});if(i===`tag`)return r=Zt.from(a).parse().object,Sa({fs:e,cache:t,gitdir:n,oid:r});if(i!==`blob`)throw new le(r,i,`blob`);return{oid:r,blob:new Uint8Array(a)}}async function Ca({fs:e,cache:t,gitdir:n,oid:r,filepath:i=void 0}){return i!==void 0&&(r=await qn({fs:e,cache:t,gitdir:n,oid:r,filepath:i})),await Sa({fs:e,cache:t,gitdir:n,oid:r})}async function wa({fs:e,dir:t,gitdir:n=Y(t,`.git`),oid:r,filepath:i,cache:a={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oid`,r);let t=new yn(e);return await Ca({fs:t,cache:a,gitdir:await xn({fsp:t,dotgit:n}),oid:r,filepath:i})}catch(e){throw e.caller=`git.readBlob`,e}}async function Ta({fs:e,dir:t,gitdir:n=Y(t,`.git`),oid:r,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oid`,r);let t=new yn(e);return await Wn({fs:t,cache:i,gitdir:await xn({fsp:t,dotgit:n}),oid:r})}catch(e){throw e.caller=`git.readCommit`,e}}async function Ea({fs:e,cache:t,gitdir:n,ref:r=`refs/notes/commits`,oid:i}){let{blob:a}=await Ca({fs:e,cache:t,gitdir:n,oid:await Q.resolve({gitdir:n,fs:e,ref:r}),filepath:i});return a}async function Da({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r=`refs/notes/commits`,oid:i,cache:a={}}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r),$(`oid`,i);let t=new yn(e);return await Ea({fs:t,cache:a,gitdir:await xn({fsp:t,dotgit:n}),ref:r,oid:i})}catch(e){throw e.caller=`git.readNote`,e}}async function Oa({fs:e,dir:t,gitdir:n=Y(t,`.git`),oid:r,format:i=`parsed`,filepath:a=void 0,encoding:o=void 0,cache:s={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oid`,r);let t=new yn(e),c=await xn({fsp:t,dotgit:n});a!==void 0&&(r=await qn({fs:t,cache:s,gitdir:c,oid:r,filepath:a}));let l=await mt({fs:t,cache:s,gitdir:c,oid:r,format:i===`parsed`?`content`:i});if(l.oid=r,i===`parsed`)switch(l.format=`parsed`,l.type){case`commit`:l.object=en.from(l.object).parse();break;case`tree`:l.object=He.from(l.object).entries();break;case`blob`:o?l.object=l.object.toString(o):(l.object=new Uint8Array(l.object),l.format=`content`);break;case`tag`:l.object=Zt.from(l.object).parse();break;default:throw new le(l.oid,l.type,`blob|commit|tag|tree`)}else(l.format===`deflated`||l.format===`wrapped`)&&(l.type=l.format);return l}catch(e){throw e.caller=`git.readObject`,e}}async function ka({fs:e,cache:t,gitdir:n,oid:r}){let{type:i,object:a}=await mt({fs:e,cache:t,gitdir:n,oid:r,format:`content`});if(i!==`tag`)throw new le(r,i,`tag`);let o=Zt.from(a);return{oid:r,tag:o.parse(),payload:o.payload()}}async function Aa({fs:e,dir:t,gitdir:n=Y(t,`.git`),oid:r,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oid`,r);let t=new yn(e);return await ka({fs:t,cache:i,gitdir:await xn({fsp:t,dotgit:n}),oid:r})}catch(e){throw e.caller=`git.readTag`,e}}async function ja({fs:e,dir:t,gitdir:n=Y(t,`.git`),oid:r,filepath:i=void 0,cache:a={}}){try{$(`fs`,e),$(`gitdir`,n),$(`oid`,r);let t=new yn(e);return await Yn({fs:t,cache:a,gitdir:await xn({fsp:t,dotgit:n}),oid:r,filepath:i})}catch(e){throw e.caller=`git.readTree`,e}}async function Ma({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n),$(`filepath`,r);let t=new yn(e),a=await xn({fsp:t,dotgit:n});await ae.acquire({fs:t,gitdir:a,cache:i},async function(e){e.delete({filepath:r})})}catch(e){throw e.caller=`git.remove`,e}}async function Na({fs:e,cache:t,onSign:n,gitdir:r,ref:i=`refs/notes/commits`,oid:a,author:o,committer:s,signingKey:c}){let l;try{l=await Q.resolve({gitdir:r,fs:e,ref:i})}catch(e){if(!(e instanceof G))throw e}let u=(await Yn({fs:e,cache:t,gitdir:r,oid:l||`4b825dc642cb6eb9a060e54bf8d69288fbee4904`})).tree;return u=u.filter(e=>e.path!==a),await Gn({fs:e,cache:t,onSign:n,gitdir:r,ref:i,tree:await Xn({fs:e,gitdir:r,tree:u}),parent:l&&[l],message:`Note removed by 'isomorphic-git removeNote'
|
|
81
|
-
`,author:o,committer:s,signingKey:c})}async function Pa({fs:e,onSign:t,dir:n,gitdir:r=Y(n,`.git`),ref:i=`refs/notes/commits`,oid:a,author:o,committer:s,signingKey:c,cache:l={}}){try{$(`fs`,e),$(`gitdir`,r),$(`oid`,a);let n=new yn(e),u=await xn({fsp:n,dotgit:r}),d=await Vn({fs:n,gitdir:u,author:o});if(!d)throw new At(`author`);let f=await Hn({fs:n,gitdir:u,author:d,committer:s});if(!f)throw new At(`committer`);return await Na({fs:n,cache:l,onSign:t,gitdir:u,ref:i,oid:a,author:d,committer:f,signingKey:c})}catch(e){throw e.caller=`git.removeNote`,e}}async function Fa({fs:e,gitdir:t,oldref:n,ref:r,checkout:i=!1}){if(!er(r,!0))throw new Et(r,
|
|
81
|
+
`,author:o,committer:s,signingKey:c})}async function Pa({fs:e,onSign:t,dir:n,gitdir:r=Y(n,`.git`),ref:i=`refs/notes/commits`,oid:a,author:o,committer:s,signingKey:c,cache:l={}}){try{$(`fs`,e),$(`gitdir`,r),$(`oid`,a);let n=new yn(e),u=await xn({fsp:n,dotgit:r}),d=await Vn({fs:n,gitdir:u,author:o});if(!d)throw new At(`author`);let f=await Hn({fs:n,gitdir:u,author:d,committer:s});if(!f)throw new At(`committer`);return await Na({fs:n,cache:l,onSign:t,gitdir:u,ref:i,oid:a,author:d,committer:f,signingKey:c})}catch(e){throw e.caller=`git.removeNote`,e}}async function Fa({fs:e,gitdir:t,oldref:n,ref:r,checkout:i=!1}){if(!er(r,!0))throw new Et(r,p.clean(r));if(!er(n,!0))throw new Et(n,p.clean(n));let a=`refs/heads/${n}`,o=`refs/heads/${r}`;if(await Q.exists({fs:e,gitdir:t,ref:o}))throw new ht(`branch`,r,!1);let s=await Q.resolve({fs:e,gitdir:t,ref:a,depth:1});await Q.writeRef({fs:e,gitdir:t,ref:o,value:s}),await Q.deleteRef({fs:e,gitdir:t,ref:a});let c=await kr({fs:e,gitdir:t,fullname:!0})===a;(i||c)&&await Q.writeSymbolicRef({fs:e,gitdir:t,ref:`HEAD`,value:o})}async function Ia({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r,oldref:i,checkout:a=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r),$(`oldref`,i);let t=new yn(e);return await Fa({fs:t,gitdir:await xn({fsp:t,dotgit:n}),ref:r,oldref:i,checkout:a})}catch(e){throw e.caller=`git.renameBranch`,e}}async function La({gitdir:e,type:t,object:n}){return j(Ue.wrap({type:t,object:n}))}async function Ra({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r,ref:i,cache:a={}}){try{$(`fs`,e),$(`gitdir`,n),$(`filepath`,r);let o=new yn(e),s=await xn({fsp:o,dotgit:n}),c,l;try{c=await Q.resolve({fs:o,gitdir:s,ref:i||`HEAD`})}catch(e){if(i)throw e}if(c)try{c=await qn({fs:o,cache:a,gitdir:s,oid:c,filepath:r})}catch{c=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},d=t&&await o.read(Y(t,r));d&&(l=await La({gitdir:s,type:`blob`,object:d}),c===l&&(u=await o.lstat(Y(t,r)))),await ae.acquire({fs:o,gitdir:s,cache:a},async function(e){e.delete({filepath:r}),c&&e.insert({filepath:r,stats:u,oid:c})})}catch(e){throw e.caller=`git.reset`,e}}async function za({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r,depth:i}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r);let t=new yn(e),a=await xn({fsp:t,dotgit:n});return await Q.resolve({fs:t,gitdir:a,ref:r,depth:i})}catch(e){throw e.caller=`git.resolveRef`,e}}async function Ba({fs:e,dir:t,gitdir:n=Y(t,`.git`),path:r,value:i,append:a=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`path`,r);let t=new yn(e),o=await xn({fsp:t,dotgit:n}),s=await je.get({fs:t,gitdir:o});a?await s.append(r,i):await s.set(r,i),await je.save({fs:t,gitdir:o,config:s})}catch(e){throw e.caller=`git.setConfig`,e}}async function Va({fs:e,gitdir:t,commit:n}){return await An({fs:e,gitdir:t,type:`commit`,object:en.from(n).toObject(),format:`content`})}var Ha=class e{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),t=Math.abs(Math.floor(e/60)),n=Math.abs(e%60).toString().padStart(2,`0`);return`${e>0?`-`:`+`}${t.toString().padStart(2,`0`)}${n}`}static createStashReflogEntry(t,n,r){let i=t.name.replace(/\s/g,``),a=Math.floor(Date.now()/1e3),o=e.timezoneOffsetForRefLogEntry;return`0000000000000000000000000000000000000000 ${n} ${i} ${t.email} ${a} ${o}\t${r}\n`}static getStashReflogEntry(e,t=!1){return e.split(`
|
|
82
82
|
`).filter(e=>e).reverse().map((e,n)=>t?`stash@{${n}}: ${e.split(` `)[1]}`:e)}},Ua=class e{constructor({fs:e,dir:t,gitdir:n=Y(t,`.git`)}){Object.assign(this,{fs:e,dir:t,gitdir:n,_author:null})}static get refStash(){return`refs/stash`}static get refLogsStash(){return`logs/refs/stash`}get refStashPath(){return Y(this.gitdir,e.refStash)}get refLogsStashPath(){return Y(this.gitdir,e.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Vn({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new At(`author`);return this._author}async getStashSHA(e,t){return await this.fs.exists(this.refStashPath)?(t||await this.readStashReflogs({parsed:!1}))[e].split(` `)[1]:null}async writeStashCommit({message:e,tree:t,parent:n}){return Va({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:t,parent:n,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let t=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>t.length-1))throw new Et(`stash@${e}`,`number that is in range of [0, num of stash pushed]`);let n=await this.getStashSHA(e,t);return n?Wn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(t){return Q.writeRef({fs:this.fs,gitdir:this.gitdir,ref:e.refStash,value:t})}async writeStashReflogEntry({stashCommit:e,message:t}){let n=await this.getAuthor(),r=Ha.createStashReflogEntry(n,e,t),i=this.refLogsStashPath;await br({filepath:i,entry:r},async()=>{let e=await this.fs.exists(i)?await this.fs.read(i,`utf8`):``;await this.fs.write(i,e+r,`utf8`)})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let t=await this.fs.read(this.refLogsStashPath,`utf8`);return Ha.getStashReflogEntry(t,e)}};async function Wa({fs:e,dir:t,gitdir:n,message:r=``}){let i=new Ua({fs:e,dir:t,gitdir:n});await i.getAuthor();let a=await kr({fs:e,gitdir:n,fullname:!1}),o=await Q.resolve({fs:e,gitdir:n,ref:`HEAD`}),s=(await Ta({fs:e,dir:t,gitdir:n,oid:o})).commit.message,c=[o],l=null,u=rn({ref:`HEAD`}),d=await Cr({fs:e,dir:t,gitdir:n,treePair:[rn({ref:`HEAD`}),`stage`]});if(d){let e=await i.writeStashCommit({message:`stash-Index: WIP on ${a} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(e),l=d,u=W()}let f=await Cr({fs:e,dir:t,gitdir:n,treePair:[u,`workdir`]});if(f){let e=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${a} - ${new Date().toISOString()}`,tree:f,parent:[c[c.length-1]]});c.push(e),l=f}if(!l||!d&&!f)throw new G(`changes, nothing to stash`);let p=(r.trim()||`WIP on ${a}`)+`: ${o.substring(0,7)} ${s}`;return{stashCommit:await i.writeStashCommit({message:p,tree:l,parent:c}),stashMsg:p,branch:a,stashMgr:i}}async function Ga({fs:e,dir:t,gitdir:n,message:r=``}){let{stashCommit:i,stashMsg:a,branch:o,stashMgr:s}=await Wa({fs:e,dir:t,gitdir:n,message:r});return await s.writeStashRef(i),await s.writeStashReflogEntry({stashCommit:i,message:a}),await pr({fs:e,dir:t,gitdir:n,ref:o,track:!1,force:!0}),i}async function Ka({fs:e,dir:t,gitdir:n,message:r=``}){let{stashCommit:i}=await Wa({fs:e,dir:t,gitdir:n,message:r});return i}async function qa({fs:e,dir:t,gitdir:n,refIdx:r=0}){let i=await new Ua({fs:e,dir:t,gitdir:n}).readStashCommit(r),{parent:a=null}=i.commit?i.commit:{};if(!(!a||!Array.isArray(a)))for(let r=0;r<a.length-1;r++){let i=(await Wn({fs:e,cache:{},gitdir:n,oid:a[r+1]})).commit.message.startsWith(`stash-Index`);await wr({fs:e,dir:t,gitdir:n,stashCommit:a[r+1],parentCommit:a[r],wasStaged:i})}}async function Ja({fs:e,dir:t,gitdir:n,refIdx:r=0}){let i=new Ua({fs:e,dir:t,gitdir:n});if(!(await i.readStashCommit(r)).commit)return;let a=i.refStashPath;await br(a,async()=>{await e.exists(a)&&await e.rm(a)});let o=await i.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(r,1);let s=i.refLogsStashPath;await br({reflogEntries:o,stashReflogPath:s,stashMgr:i},async()=>{if(o.length){await e.write(s,o.reverse().join(`
|
|
83
83
|
`)+`
|
|
84
|
-
`,`utf8`);let t=o[o.length-1].split(` `)[1];await i.writeStashRef(t)}else await e.rm(s)})}async function Ya({fs:e,dir:t,gitdir:n}){return new Ua({fs:e,dir:t,gitdir:n}).readStashReflogs({parsed:!0})}async function Xa({fs:e,dir:t,gitdir:n}){let r=new Ua({fs:e,dir:t,gitdir:n}),i=[r.refStashPath,r.refLogsStashPath];await br(i,async()=>{await Promise.all(i.map(async t=>{if(await e.exists(t))return e.rm(t)}))})}async function Za({fs:e,dir:t,gitdir:n,refIdx:r=0}){await qa({fs:e,dir:t,gitdir:n,refIdx:r}),await Ja({fs:e,dir:t,gitdir:n,refIdx:r})}async function Qa({fs:e,dir:t,gitdir:n=Y(t,`.git`),op:r=`push`,message:i=``,refIdx:a=0}){$(`fs`,e),$(`dir`,t),$(`gitdir`,n),$(`op`,r);let o={push:Ga,apply:qa,drop:Ja,list:Ya,clear:Xa,pop:Za,create:Ka},s=[`apply`,`drop`,`pop`];try{let c=new yn(e),l=await xn({fsp:c,dotgit:n});[`refs`,`logs`,`logs/refs`].map(e=>Y(l,e)).forEach(async e=>{await c.exists(e)||await c.mkdir(e)});let u=o[r];if(u){if(s.includes(r)&&a<0)throw new Et(`stash@${a}`,`number that is in range of [0, num of stash pushed]`);return await u({fs:c,dir:t,gitdir:l,message:i,refIdx:a})}throw Error(`To be implemented: ${r}`)}catch(e){throw e.caller=`git.stash`,e}}async function $a({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n),$(`filepath`,r);let a=new yn(e),o=await xn({fsp:a,dotgit:n});if(await wn.isIgnored({fs:a,gitdir:o,dir:t,filepath:r}))return`ignored`;let s=await eo({fs:a,cache:i,gitdir:o,tree:await to({fs:a,cache:i,gitdir:o}),path:r}),c=await ae.acquire({fs:a,gitdir:o,cache:i},async function(e){for(let t of e)if(t.path===r)return t;return null}),l=await a.lstat(Y(t,r)),u=s!==null,d=c!==null,f=l!==null,p=async()=>{if(d&&!re(c,l))return c.oid;{let e=await a.read(Y(t,r)),n=await La({gitdir:o,type:`blob`,object:e});return d&&c.oid===n&&l.size!==-1&&ae.acquire({fs:a,gitdir:o,cache:i},async function(e){e.insert({filepath:r,stats:l,oid:n})}),n}};if(!u&&!f&&!d)return`absent`;if(!u&&!f&&d)return`*absent`;if(!u&&f&&!d)return`*added`;if(!u&&f&&d)return await p()===c.oid?`added`:`*added`;if(u&&!f&&!d)return`deleted`;if(u&&!f&&d)return c.oid,`*deleted`;if(u&&f&&!d)return await p()===s?`*undeleted`:`*undeletemodified`;if(u&&f&&d){let e=await p();return e===s?e===c.oid?`unmodified`:`*unmodified`:e===c.oid?`modified`:`*modified`}}catch(e){throw e.caller=`git.status`,e}}async function eo({fs:e,cache:t,gitdir:n,tree:r,path:i}){typeof i==`string`&&(i=i.split(`/`));let a=i.shift();for(let o of r)if(o.path===a){if(i.length===0)return o.oid;let{type:r,object:a}=await mt({fs:e,cache:t,gitdir:n,oid:o.oid});if(r===`tree`)return eo({fs:e,cache:t,gitdir:n,tree:He.from(a),path:i});if(r===`blob`)throw new le(o.oid,r,`blob`,i.join(`/`))}return null}async function to({fs:e,cache:t,gitdir:n}){let r;try{r=await Q.resolve({fs:e,gitdir:n,ref:`HEAD`})}catch(e){if(e instanceof G)return[]}let{tree:i}=await Yn({fs:e,cache:t,gitdir:n,oid:r});return i}async function no({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r=`HEAD`,filepaths:i=[`.`],filter:a,cache:o={},ignored:s=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r);let c=new yn(e);return await dn({fs:c,cache:o,dir:t,gitdir:await xn({fsp:c,dotgit:n}),trees:[rn({ref:r}),on(),W()],map:async function(e,[n,r,o]){if(!n&&!o&&r&&!s&&await wn.isIgnored({fs:c,dir:t,filepath:e})||!i.some(t=>sr(e,t)))return null;if(a&&!a(e))return;let[l,u,d]=await Promise.all([n&&n.type(),r&&r.type(),o&&o.type()]),f=[l,u,d].includes(`blob`);if((l===`tree`||l===`special`)&&!f)return;if(l===`commit`)return null;if((u===`tree`||u===`special`)&&!f)return;if(d===`commit`)return null;if((d===`tree`||d===`special`)&&!f)return;let p=l===`blob`?await n.oid():void 0,m=d===`blob`?await o.oid():void 0,h;l!==`blob`&&u===`blob`&&d!==`blob`?h=`42`:u===`blob`&&(h=await r.oid());let g=[void 0,p,h,m],_=g.map(e=>g.indexOf(e));return _.shift(),[e,..._]}})}catch(e){throw e.caller=`git.statusMatrix`,e}}async function ro({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r,object:i,force:a=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r);let t=new yn(e);if(r===void 0)throw new jt(`ref`);r=r.startsWith(`refs/tags/`)?r:`refs/tags/${r}`;let o=await xn({fsp:t,dotgit:n}),s=await Q.resolve({fs:t,gitdir:o,ref:i||`HEAD`});if(!a&&await Q.exists({fs:t,gitdir:o,ref:r}))throw new ht(`tag`,r);await Q.writeRef({fs:t,gitdir:o,ref:r,value:s})}catch(e){throw e.caller=`git.tag`,e}}async function io({fs:e,dir:t,gitdir:n=Y(t,`.git`),cache:r={},filepath:i,oid:a,mode:o,add:s,remove:c,force:l}){try{$(`fs`,e),$(`gitdir`,n),$(`filepath`,i);let u=new yn(e),d=await xn({fsp:u,dotgit:n});if(c)return await ae.acquire({fs:u,gitdir:d,cache:r},async function(e){if(!l){let e=await u.lstat(Y(t,i));if(e){if(e.isDirectory())throw new Tt(`directory`);return}}e.has({filepath:i})&&e.delete({filepath:i})});let f;if(!a){if(f=await u.lstat(Y(t,i)),!f)throw new G(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new Tt(`directory`)}return await ae.acquire({fs:u,gitdir:d,cache:r},async function(e){if(!s&&!e.has({filepath:i}))throw new G(`file at "${i}" in index and "add" not set`);let n;if(a)n={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:o,uid:0,gid:0,size:0};else{n=f;let e=n.isSymbolicLink()?await u.readlink(Y(t,i)):await u.read(Y(t,i));a=await An({fs:u,gitdir:d,type:`blob`,format:`content`,object:e})}return e.insert({filepath:i,oid:a,stats:n}),a})}catch(e){throw e.caller=`git.updateIndex`,e}}function ao(){try{return $r.version}catch(e){throw e.caller=`git.version`,e}}async function oo({fs:e,dir:t,gitdir:n=Y(t,`.git`),trees:r,map:i,reduce:a,iterate:o,cache:s={}}){try{$(`fs`,e),$(`gitdir`,n),$(`trees`,r);let c=new yn(e);return await dn({fs:c,cache:s,dir:t,gitdir:await xn({fsp:c,dotgit:n}),trees:r,map:i,reduce:a,iterate:o})}catch(e){throw e.caller=`git.walk`,e}}async function so({fs:e,dir:t,gitdir:n=Y(t,`.git`),blob:r}){try{$(`fs`,e),$(`gitdir`,n),$(`blob`,r);let t=new yn(e);return await An({fs:t,gitdir:await xn({fsp:t,dotgit:n}),type:`blob`,object:r,format:`content`})}catch(e){throw e.caller=`git.writeBlob`,e}}async function co({fs:e,dir:t,gitdir:n=Y(t,`.git`),commit:r}){try{$(`fs`,e),$(`gitdir`,n),$(`commit`,r);let t=new yn(e);return await Va({fs:t,gitdir:await xn({fsp:t,dotgit:n}),commit:r})}catch(e){throw e.caller=`git.writeCommit`,e}}async function lo({fs:e,dir:t,gitdir:n=Y(t,`.git`),type:r,object:a,format:o=`parsed`,oid:s,encoding:c=void 0}){try{let t=new yn(e),l=await xn({fsp:t,dotgit:n});if(o===`parsed`){switch(r){case`commit`:a=en.from(a).toObject();break;case`tree`:a=He.from(a).toObject();break;case`blob`:a=i.Buffer.from(a,c);break;case`tag`:a=Zt.from(a).toObject();break;default:throw new le(s||``,r,`blob|commit|tag|tree`)}o=`content`}return s=await An({fs:t,gitdir:l,type:r,object:a,oid:s,format:o}),s}catch(e){throw e.caller=`git.writeObject`,e}}async function uo({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r,value:i,force:a=!1,symbolic:o=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r),$(`value`,i);let t=new yn(e);if(!er(r,!0))throw new Et(r,m.clean(r));let s=await xn({fsp:t,dotgit:n});if(!a&&await Q.exists({fs:t,gitdir:s,ref:r}))throw new ht(`ref`,r);o?await Q.writeSymbolicRef({fs:t,gitdir:s,ref:r,value:i}):(i=await Q.resolve({fs:t,gitdir:s,ref:i}),await Q.writeRef({fs:t,gitdir:s,ref:r,value:i}))}catch(e){throw e.caller=`git.writeRef`,e}}async function fo({fs:e,gitdir:t,tag:n}){return await An({fs:e,gitdir:t,type:`tag`,object:Zt.from(n).toObject(),format:`content`})}async function po({fs:e,dir:t,gitdir:n=Y(t,`.git`),tag:r}){try{$(`fs`,e),$(`gitdir`,n),$(`tag`,r);let t=new yn(e);return await fo({fs:t,gitdir:await xn({fsp:t,dotgit:n}),tag:r})}catch(e){throw e.caller=`git.writeTag`,e}}async function mo({fs:e,dir:t,gitdir:n=Y(t,`.git`),tree:r}){try{$(`fs`,e),$(`gitdir`,n),$(`tree`,r);let t=new yn(e);return await Xn({fs:t,gitdir:await xn({fsp:t,dotgit:n}),tree:r})}catch(e){throw e.caller=`git.writeTree`,e}}var ho={Errors:Ht,STAGE:W,TREE:rn,WORKDIR:on,add:Mn,abortMerge:Cn,addNote:Qn,addRemote:nr,annotatedTag:ir,branch:or,cherryPick:Er,checkout:pr,clone:li,commit:ui,getConfig:Mi,getConfigAll:Pi,setConfig:Ba,currentBranch:di,deleteBranch:pi,deleteRef:mi,deleteRemote:gi,deleteTag:vi,expandOid:Si,expandRef:Ci,fastForward:Di,fetch:Oi,findMergeBase:ki,findRoot:ji,getRemoteInfo:Fi,getRemoteInfo2:Li,hashBlob:zi,indexPack:Vi,init:Hi,isDescendent:Wi,isIgnored:Gi,listBranches:Ki,listFiles:Yi,listNotes:Zi,listRefs:Qi,listRemotes:ea,listServerRefs:ra,listTags:ia,log:la,merge:ua,packObjects:ma,pull:ha,push:xa,readBlob:wa,readCommit:Ta,readNote:Da,readObject:Oa,readTag:Aa,readTree:ja,remove:Ma,removeNote:Pa,renameBranch:Ia,resetIndex:Ra,updateIndex:io,resolveRef:za,status:$a,statusMatrix:no,tag:ro,version:ao,walk:oo,writeBlob:so,writeCommit:co,writeObject:lo,writeRef:uo,writeTag:po,writeTree:mo,stash:Qa};t.Errors=Ht,t.STAGE=W,t.TREE=rn,t.WORKDIR=on,t.abortMerge=Cn,t.add=Mn,t.addNote=Qn,t.addRemote=nr,t.annotatedTag=ir,t.branch=or,t.checkout=pr,t.cherryPick=Er,t.clone=li,t.commit=ui,t.currentBranch=di,t.default=ho,t.deleteBranch=pi,t.deleteRef=mi,t.deleteRemote=gi,t.deleteTag=vi,t.expandOid=Si,t.expandRef=Ci,t.fastForward=Di,t.fetch=Oi,t.findMergeBase=ki,t.findRoot=ji,t.getConfig=Mi,t.getConfigAll=Pi,t.getRemoteInfo=Fi,t.getRemoteInfo2=Li,t.hashBlob=zi,t.indexPack=Vi,t.init=Hi,t.isDescendent=Wi,t.isIgnored=Gi,t.listBranches=Ki,t.listFiles=Yi,t.listNotes=Zi,t.listRefs=Qi,t.listRemotes=ea,t.listServerRefs=ra,t.listTags=ia,t.log=la,t.merge=ua,t.packObjects=ma,t.pull=ha,t.push=xa,t.readBlob=wa,t.readCommit=Ta,t.readNote=Da,t.readObject=Oa,t.readTag=Aa,t.readTree=ja,t.remove=Ma,t.removeNote=Pa,t.renameBranch=Ia,t.resetIndex=Ra,t.resolveRef=za,t.setConfig=Ba,t.stash=Qa,t.status=$a,t.statusMatrix=no,t.tag=ro,t.updateIndex=io,t.version=ao,t.walk=oo,t.writeBlob=so,t.writeCommit=co,t.writeObject=lo,t.writeRef=uo,t.writeTag=po,t.writeTree=mo}))(),1),Vn=l();globalThis.Buffer||(globalThis.Buffer=Vn.Buffer);const Hn={async request({url:e,method:t=`GET`,headers:n={},body:r}){r&&=await Un(r);let i=await fetch(e,{method:t,headers:n,body:r,credentials:`omit`}),a=i.body&&typeof i.body.getReader==`function`?Wn(i.body):[new Uint8Array(await i.arrayBuffer())],o={};for(let[e,t]of i.headers.entries())o[e]=t;return{url:i.url,method:t,statusCode:i.status,statusMessage:i.statusText,body:a,headers:o}}};async function Un(e){let t=[];if(e[Symbol.asyncIterator])for await(let n of e)t.push(n);else if(e[Symbol.iterator])for(let n of e)t.push(n);else if(e.next){let n=await e.nexT();for(;!n.done;)t.push(n.value),n=await e.nexT()}else return e;let n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.length;return r}function Wn(e){let t=e.getReader();return{next(){return t.read()},return(){return t.releaseLock(),{}},[Symbol.asyncIterator](){return this}}}let Gn=null,Kn=null,qn=null,Jn=null,Yn=null;function Xn(e){return e.trim().replace(/^[\\/]+/,``).replace(/[\\/]+$/,``).split(/[\\/]+/).filter(e=>e!==`.`&&e!==``).join(`/`)}const Zn=new class{_map=new Map;_maxSize;constructor(e=2048){this._maxSize=e}clear(){this._map.clear()}get(e){let t=this._map.get(e);return t!==void 0&&(this._map.delete(e),this._map.set(e,t)),t}invalidate(e){let t=e.endsWith(`/`)?e:e+`/`;for(let n of this._map.keys())(n===e||n.startsWith(t))&&this._map.delete(n)}set(e,t){if(this._map.size>=this._maxSize){let e=this._map.keys().next().value;e!==void 0&&this._map.delete(e)}this._map.set(e,t)}};async function Qn(e,t,n={},r=``){let i=e,a=r;for(let e of t){a=a?`${a}/${e}`:e;let t=Zn.get(a);t&&!n.create?i=t:(i=await i.getDirectoryHandle(e,{create:n.create??!1}),Zn.set(a,i))}return i}async function $n(e,t,n={}){let r=Xn(t),i=r.split(`/`).filter(Boolean);if(i.length===0)return e;let a=await Qn(e,i.slice(0,-1),n),o=i[i.length-1];if(n.forceFile||o.includes(`.`))try{return await a.getFileHandle(o,{create:n.create??!1})}catch{}try{let e=await a.getDirectoryHandle(o,{create:n.create??!1}),t=r;return Zn.set(t,e),e}catch{return await a.getFileHandle(o,{create:n.create??!1})}}async function er(e,t,n={}){let r=Xn(t).split(`/`).filter(Boolean);return r.length===0?e:Qn(e,r,n)}async function tr(e,t,n={}){let r=Xn(t).split(`/`).filter(Boolean);if(r.length===0)throw Error(`Cannot resolve '.' as file`);return(await Qn(e,r.slice(0,-1),n)).getFileHandle(r[r.length-1],{create:n.create??!1})}async function nr(e,t){let n=Xn(t).split(`/`).filter(Boolean);if(n.length===0)throw Error(`Cannot get parent of root`);let r=n[n.length-1];return[await Qn(e,n.slice(0,-1)),r]}function rr(e){return e.trim().replace(/\\/g,`/`).replace(/^\/+/,``).replace(/^\.\//,``)}function ir(e){let t=new Map,n=`repos/.git-modes`;function r(e){return e.replace(/\\/g,`/`.replace(/^\/+/,``))}async function i(){try{let r=await(await(await tr(e,n)).getFile()).text(),i=JSON.parse(r);for(let[e,n]of i)t.set(e,n)}catch{}}let a=null;function o(){a===null&&(a=setTimeout(async()=>{a=null;try{let r=await(await tr(e,n,{create:!0})).createWritable(),i=JSON.stringify([...t.entries()]);await r.write(new TextEncoder().encode(i)),await r.close()}catch{}},500))}let s=i(),c={async readFile(t,n){let r=await(await(await tr(e,t)).getFile()).arrayBuffer(),i=typeof n==`string`?n:n?.encoding;return i===`utf8`||i===`utf-8`?new TextDecoder().decode(r):new Uint8Array(r)},async writeFile(n,i,a){let s=await(await tr(e,n,{create:!0})).createWritable();typeof i==`string`&&(i=new TextEncoder().encode(i)),await s.write(i),await s.close();let c=typeof a==`object`&&a?a.mode:void 0,l=r(n);if(c!=null){let e=(c&73)!=0;t.set(l,e?33261:33188),o()}else t.has(l)||t.set(l,33188)},async mkdir(t){await er(e,t,{create:!0})},async rmdir(n){let[i,a]=await nr(e,n);await i.removeEntry(a,{recursive:!0});let o=r(n)+`/`;for(let e of t.keys())(e===r(n)||e.startsWith(o))&&t.delete(e);Zn.invalidate(Xn(n))},async readdir(t){let n=await er(e,t),r=[];for await(let[e]of n.entries())r.push(e);return r},async stat(n){await s;let i;try{i=await $n(e,n)}catch{let e=Error(`ENOENT: no such file or directory, stat '${n}'`);throw e.code=`ENOENT`,e}if(i.kind===`directory`){let e=new Date;return{isDirectory:()=>!0,isFile:()=>!1,isSymbolicLink:()=>!1,size:0,mtimeMs:Date.now(),mode:16877,ino:0,dev:0,nlink:1,uid:0,gid:0,ctime:e,mtime:e}}else{let e=await i.getFile(),a=new Date(e.lastModified),o=r(n),s=t.get(o)??33188;return{isDirectory:()=>!1,isFile:()=>!0,isSymbolicLink:()=>!1,size:e.size,mtimeMs:e.lastModified,mode:s,ino:0,dev:0,nlink:1,uid:0,gid:0,ctime:a,mtime:a}}},async lstat(e){return c.stat(e)},async unlink(n){let[i,a]=await nr(e,n);await i.removeEntry(a),t.delete(r(n))},async symlink(e,t){throw Error(`OPFS does not support symlinks`)},async readlink(e){return await c.readFile(e,`utf8`)}};return{promises:c}}const ar=ir,or=`repos`;function sr(e,t){if(e===`custom`&&t)return t;if(e===`public`)return`https://www.cors-anywhere.com`;let{protocol:n,host:r,hostname:i}=globalThis.location;return i===`localhost`||i===`127.0.0.1`?`${n}//${r}/git-proxy`:`http://${x}:${a}/git-proxy`}async function cr(){return Yn||=(async()=>{if(Gn=Bn.default,Kn=Hn,!qn){let e;try{e=await navigator.storage.getDirectory()}catch(t){console.warn(`OPFS is unavailable for git root, falling back to memory:`,t);let{getMemoryOpfsRoot:n}=await import(`./agent.worker.js`).then(e=>e.v);e=n()}qn=ir(e),Jn=qn.promises}})(),await Yn,{git:Gn,http:Kn,fs:qn,pfs:Jn}}async function lr(e){let t=await cr();if(e){let n=ir(e);return{git:t.git,http:t.http,fs:n,pfs:n.promises,repoDirFn:e=>`repos/${e}`}}return{...t,repoDirFn:dr}}function ur(e){return(e.replace(/\/+$/,``).split(`/`).pop()||`repo`).replace(/\.git$/,``)}function dr(e){return`${or}/${e}`}async function fr(e,t,n){try{await e.getConfig({fs:t,dir:n,path:`core.filemode`})!==!1&&await e.setConfig({fs:t,dir:n,path:`core.filemode`,value:!1})}catch(e){console.error(`Failed to set core.filemode=false:`,e)}}async function pr(e,t){try{await e.mkdir(t)}catch{}}function mr({token:e,username:t,password:n}={}){if(!e&&!t)return{};let r;e?r={Authorization:`Basic ${btoa(`${e}:x-oauth-basic`)}`}:t&&(r={Authorization:`Basic ${btoa(`${t}:${n||``}`)}`});let i=()=>e?{username:e,password:`x-oauth-basic`}:t?{username:t,password:n||``}:{cancel:!0},a=()=>({cancel:!0});return{...r?{headers:r}:{},onAuth:i,onAuthFailure:a}}async function hr({url:e,branch:t,depth:n=20,corsProxy:r,name:i,token:a,username:o,password:s,groupRoot:c}){let{git:l,http:u,fs:d,pfs:f,repoDirFn:p}=await lr(c),m=i||ur(e),h=p(m);r||=sr(`local`),await pr(f,or),await pr(f,h);let g=mr({token:a,username:o,password:s});try{let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.clone(i)}catch{try{let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.fetch(i)}catch{try{await Ir(f,h),await pr(f,h);let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.clone(i)}catch(t){throw Error(`Failed to clone/fetch ${e}: ${t instanceof Error?t.message:String(t)}`)}}}return await fr(l,d,h),m}async function gr({repo:e,ref:t,groupRoot:n}){let{git:r,fs:i,repoDirFn:a}=await lr(n),o=a(e);return await r.checkout({fs:i,dir:o,ref:t,force:!0}),`Checked out ${t} in ${e}`}async function _r({repo:e,name:t,checkout:n=!1,startPoint:r,groupRoot:i}){let{git:a,fs:o,repoDirFn:s}=await lr(i),c=s(e),l={fs:o,dir:c,ref:t};return r&&(l.object=r),await a.branch(l),n?(await a.checkout({fs:o,dir:c,ref:t}),`Created and switched to branch ${t} in ${e}`):`Created branch ${t} in ${e}`}async function vr({repo:e,groupRoot:t}){let{git:n,fs:r,repoDirFn:i}=await lr(t),a=i(e);await fr(n,r,a);let o=await n.statusMatrix({fs:r,dir:a});if(o.length===0)return`Empty repository.`;let s=[];for(let[e,t,n,r]of o){let i=``;if(t===0&&n===2&&r===2)i=`added`;else if(t===0&&n===2&&r===0)i=`new (unstaged)`;else if(t===1&&n===2&&r===2)i=`modified (staged)`;else if(t===1&&n===2&&r===1)i=`modified`;else if(t===1&&n===0&&r===0)i=`deleted`;else if(t===1&&n===1&&r===1)continue;else i=`[${t},${n},${r}]`;s.push(`${i}: ${e}`)}return s.length===0?`On branch ${await n.currentBranch({fs:r,dir:a})||`(detached HEAD)`}\nNothing to commit, working tree clean.`:`On branch ${await n.currentBranch({fs:r,dir:a})||`(detached HEAD)`}\n${s.join(`
|
|
84
|
+
`,`utf8`);let t=o[o.length-1].split(` `)[1];await i.writeStashRef(t)}else await e.rm(s)})}async function Ya({fs:e,dir:t,gitdir:n}){return new Ua({fs:e,dir:t,gitdir:n}).readStashReflogs({parsed:!0})}async function Xa({fs:e,dir:t,gitdir:n}){let r=new Ua({fs:e,dir:t,gitdir:n}),i=[r.refStashPath,r.refLogsStashPath];await br(i,async()=>{await Promise.all(i.map(async t=>{if(await e.exists(t))return e.rm(t)}))})}async function Za({fs:e,dir:t,gitdir:n,refIdx:r=0}){await qa({fs:e,dir:t,gitdir:n,refIdx:r}),await Ja({fs:e,dir:t,gitdir:n,refIdx:r})}async function Qa({fs:e,dir:t,gitdir:n=Y(t,`.git`),op:r=`push`,message:i=``,refIdx:a=0}){$(`fs`,e),$(`dir`,t),$(`gitdir`,n),$(`op`,r);let o={push:Ga,apply:qa,drop:Ja,list:Ya,clear:Xa,pop:Za,create:Ka},s=[`apply`,`drop`,`pop`];try{let c=new yn(e),l=await xn({fsp:c,dotgit:n});[`refs`,`logs`,`logs/refs`].map(e=>Y(l,e)).forEach(async e=>{await c.exists(e)||await c.mkdir(e)});let u=o[r];if(u){if(s.includes(r)&&a<0)throw new Et(`stash@${a}`,`number that is in range of [0, num of stash pushed]`);return await u({fs:c,dir:t,gitdir:l,message:i,refIdx:a})}throw Error(`To be implemented: ${r}`)}catch(e){throw e.caller=`git.stash`,e}}async function $a({fs:e,dir:t,gitdir:n=Y(t,`.git`),filepath:r,cache:i={}}){try{$(`fs`,e),$(`gitdir`,n),$(`filepath`,r);let a=new yn(e),o=await xn({fsp:a,dotgit:n});if(await wn.isIgnored({fs:a,gitdir:o,dir:t,filepath:r}))return`ignored`;let s=await eo({fs:a,cache:i,gitdir:o,tree:await to({fs:a,cache:i,gitdir:o}),path:r}),c=await ae.acquire({fs:a,gitdir:o,cache:i},async function(e){for(let t of e)if(t.path===r)return t;return null}),l=await a.lstat(Y(t,r)),u=s!==null,d=c!==null,f=l!==null,p=async()=>{if(d&&!re(c,l))return c.oid;{let e=await a.read(Y(t,r)),n=await La({gitdir:o,type:`blob`,object:e});return d&&c.oid===n&&l.size!==-1&&ae.acquire({fs:a,gitdir:o,cache:i},async function(e){e.insert({filepath:r,stats:l,oid:n})}),n}};if(!u&&!f&&!d)return`absent`;if(!u&&!f&&d)return`*absent`;if(!u&&f&&!d)return`*added`;if(!u&&f&&d)return await p()===c.oid?`added`:`*added`;if(u&&!f&&!d)return`deleted`;if(u&&!f&&d)return c.oid,`*deleted`;if(u&&f&&!d)return await p()===s?`*undeleted`:`*undeletemodified`;if(u&&f&&d){let e=await p();return e===s?e===c.oid?`unmodified`:`*unmodified`:e===c.oid?`modified`:`*modified`}}catch(e){throw e.caller=`git.status`,e}}async function eo({fs:e,cache:t,gitdir:n,tree:r,path:i}){typeof i==`string`&&(i=i.split(`/`));let a=i.shift();for(let o of r)if(o.path===a){if(i.length===0)return o.oid;let{type:r,object:a}=await mt({fs:e,cache:t,gitdir:n,oid:o.oid});if(r===`tree`)return eo({fs:e,cache:t,gitdir:n,tree:He.from(a),path:i});if(r===`blob`)throw new le(o.oid,r,`blob`,i.join(`/`))}return null}async function to({fs:e,cache:t,gitdir:n}){let r;try{r=await Q.resolve({fs:e,gitdir:n,ref:`HEAD`})}catch(e){if(e instanceof G)return[]}let{tree:i}=await Yn({fs:e,cache:t,gitdir:n,oid:r});return i}async function no({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r=`HEAD`,filepaths:i=[`.`],filter:a,cache:o={},ignored:s=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r);let c=new yn(e);return await dn({fs:c,cache:o,dir:t,gitdir:await xn({fsp:c,dotgit:n}),trees:[rn({ref:r}),on(),W()],map:async function(e,[n,r,o]){if(!n&&!o&&r&&!s&&await wn.isIgnored({fs:c,dir:t,filepath:e})||!i.some(t=>sr(e,t)))return null;if(a&&!a(e))return;let[l,u,d]=await Promise.all([n&&n.type(),r&&r.type(),o&&o.type()]),f=[l,u,d].includes(`blob`);if((l===`tree`||l===`special`)&&!f)return;if(l===`commit`)return null;if((u===`tree`||u===`special`)&&!f)return;if(d===`commit`)return null;if((d===`tree`||d===`special`)&&!f)return;let p=l===`blob`?await n.oid():void 0,m=d===`blob`?await o.oid():void 0,h;l!==`blob`&&u===`blob`&&d!==`blob`?h=`42`:u===`blob`&&(h=await r.oid());let g=[void 0,p,h,m],_=g.map(e=>g.indexOf(e));return _.shift(),[e,..._]}})}catch(e){throw e.caller=`git.statusMatrix`,e}}async function ro({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r,object:i,force:a=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r);let t=new yn(e);if(r===void 0)throw new jt(`ref`);r=r.startsWith(`refs/tags/`)?r:`refs/tags/${r}`;let o=await xn({fsp:t,dotgit:n}),s=await Q.resolve({fs:t,gitdir:o,ref:i||`HEAD`});if(!a&&await Q.exists({fs:t,gitdir:o,ref:r}))throw new ht(`tag`,r);await Q.writeRef({fs:t,gitdir:o,ref:r,value:s})}catch(e){throw e.caller=`git.tag`,e}}async function io({fs:e,dir:t,gitdir:n=Y(t,`.git`),cache:r={},filepath:i,oid:a,mode:o,add:s,remove:c,force:l}){try{$(`fs`,e),$(`gitdir`,n),$(`filepath`,i);let u=new yn(e),d=await xn({fsp:u,dotgit:n});if(c)return await ae.acquire({fs:u,gitdir:d,cache:r},async function(e){if(!l){let e=await u.lstat(Y(t,i));if(e){if(e.isDirectory())throw new Tt(`directory`);return}}e.has({filepath:i})&&e.delete({filepath:i})});let f;if(!a){if(f=await u.lstat(Y(t,i)),!f)throw new G(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new Tt(`directory`)}return await ae.acquire({fs:u,gitdir:d,cache:r},async function(e){if(!s&&!e.has({filepath:i}))throw new G(`file at "${i}" in index and "add" not set`);let n;if(a)n={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:o,uid:0,gid:0,size:0};else{n=f;let e=n.isSymbolicLink()?await u.readlink(Y(t,i)):await u.read(Y(t,i));a=await An({fs:u,gitdir:d,type:`blob`,format:`content`,object:e})}return e.insert({filepath:i,oid:a,stats:n}),a})}catch(e){throw e.caller=`git.updateIndex`,e}}function ao(){try{return $r.version}catch(e){throw e.caller=`git.version`,e}}async function oo({fs:e,dir:t,gitdir:n=Y(t,`.git`),trees:r,map:i,reduce:a,iterate:o,cache:s={}}){try{$(`fs`,e),$(`gitdir`,n),$(`trees`,r);let c=new yn(e);return await dn({fs:c,cache:s,dir:t,gitdir:await xn({fsp:c,dotgit:n}),trees:r,map:i,reduce:a,iterate:o})}catch(e){throw e.caller=`git.walk`,e}}async function so({fs:e,dir:t,gitdir:n=Y(t,`.git`),blob:r}){try{$(`fs`,e),$(`gitdir`,n),$(`blob`,r);let t=new yn(e);return await An({fs:t,gitdir:await xn({fsp:t,dotgit:n}),type:`blob`,object:r,format:`content`})}catch(e){throw e.caller=`git.writeBlob`,e}}async function co({fs:e,dir:t,gitdir:n=Y(t,`.git`),commit:r}){try{$(`fs`,e),$(`gitdir`,n),$(`commit`,r);let t=new yn(e);return await Va({fs:t,gitdir:await xn({fsp:t,dotgit:n}),commit:r})}catch(e){throw e.caller=`git.writeCommit`,e}}async function lo({fs:e,dir:t,gitdir:n=Y(t,`.git`),type:i,object:a,format:o=`parsed`,oid:s,encoding:c=void 0}){try{let t=new yn(e),l=await xn({fsp:t,dotgit:n});if(o===`parsed`){switch(i){case`commit`:a=en.from(a).toObject();break;case`tree`:a=He.from(a).toObject();break;case`blob`:a=r.Buffer.from(a,c);break;case`tag`:a=Zt.from(a).toObject();break;default:throw new le(s||``,i,`blob|commit|tag|tree`)}o=`content`}return s=await An({fs:t,gitdir:l,type:i,object:a,oid:s,format:o}),s}catch(e){throw e.caller=`git.writeObject`,e}}async function uo({fs:e,dir:t,gitdir:n=Y(t,`.git`),ref:r,value:i,force:a=!1,symbolic:o=!1}){try{$(`fs`,e),$(`gitdir`,n),$(`ref`,r),$(`value`,i);let t=new yn(e);if(!er(r,!0))throw new Et(r,p.clean(r));let s=await xn({fsp:t,dotgit:n});if(!a&&await Q.exists({fs:t,gitdir:s,ref:r}))throw new ht(`ref`,r);o?await Q.writeSymbolicRef({fs:t,gitdir:s,ref:r,value:i}):(i=await Q.resolve({fs:t,gitdir:s,ref:i}),await Q.writeRef({fs:t,gitdir:s,ref:r,value:i}))}catch(e){throw e.caller=`git.writeRef`,e}}async function fo({fs:e,gitdir:t,tag:n}){return await An({fs:e,gitdir:t,type:`tag`,object:Zt.from(n).toObject(),format:`content`})}async function po({fs:e,dir:t,gitdir:n=Y(t,`.git`),tag:r}){try{$(`fs`,e),$(`gitdir`,n),$(`tag`,r);let t=new yn(e);return await fo({fs:t,gitdir:await xn({fsp:t,dotgit:n}),tag:r})}catch(e){throw e.caller=`git.writeTag`,e}}async function mo({fs:e,dir:t,gitdir:n=Y(t,`.git`),tree:r}){try{$(`fs`,e),$(`gitdir`,n),$(`tree`,r);let t=new yn(e);return await Xn({fs:t,gitdir:await xn({fsp:t,dotgit:n}),tree:r})}catch(e){throw e.caller=`git.writeTree`,e}}var ho={Errors:Ht,STAGE:W,TREE:rn,WORKDIR:on,add:Mn,abortMerge:Cn,addNote:Qn,addRemote:nr,annotatedTag:ir,branch:or,cherryPick:Er,checkout:pr,clone:li,commit:ui,getConfig:Mi,getConfigAll:Pi,setConfig:Ba,currentBranch:di,deleteBranch:pi,deleteRef:mi,deleteRemote:gi,deleteTag:vi,expandOid:Si,expandRef:Ci,fastForward:Di,fetch:Oi,findMergeBase:ki,findRoot:ji,getRemoteInfo:Fi,getRemoteInfo2:Li,hashBlob:zi,indexPack:Vi,init:Hi,isDescendent:Wi,isIgnored:Gi,listBranches:Ki,listFiles:Yi,listNotes:Zi,listRefs:Qi,listRemotes:ea,listServerRefs:ra,listTags:ia,log:la,merge:ua,packObjects:ma,pull:ha,push:xa,readBlob:wa,readCommit:Ta,readNote:Da,readObject:Oa,readTag:Aa,readTree:ja,remove:Ma,removeNote:Pa,renameBranch:Ia,resetIndex:Ra,updateIndex:io,resolveRef:za,status:$a,statusMatrix:no,tag:ro,version:ao,walk:oo,writeBlob:so,writeCommit:co,writeObject:lo,writeRef:uo,writeTag:po,writeTree:mo,stash:Qa};t.Errors=Ht,t.STAGE=W,t.TREE=rn,t.WORKDIR=on,t.abortMerge=Cn,t.add=Mn,t.addNote=Qn,t.addRemote=nr,t.annotatedTag=ir,t.branch=or,t.checkout=pr,t.cherryPick=Er,t.clone=li,t.commit=ui,t.currentBranch=di,t.default=ho,t.deleteBranch=pi,t.deleteRef=mi,t.deleteRemote=gi,t.deleteTag=vi,t.expandOid=Si,t.expandRef=Ci,t.fastForward=Di,t.fetch=Oi,t.findMergeBase=ki,t.findRoot=ji,t.getConfig=Mi,t.getConfigAll=Pi,t.getRemoteInfo=Fi,t.getRemoteInfo2=Li,t.hashBlob=zi,t.indexPack=Vi,t.init=Hi,t.isDescendent=Wi,t.isIgnored=Gi,t.listBranches=Ki,t.listFiles=Yi,t.listNotes=Zi,t.listRefs=Qi,t.listRemotes=ea,t.listServerRefs=ra,t.listTags=ia,t.log=la,t.merge=ua,t.packObjects=ma,t.pull=ha,t.push=xa,t.readBlob=wa,t.readCommit=Ta,t.readNote=Da,t.readObject=Oa,t.readTag=Aa,t.readTree=ja,t.remove=Ma,t.removeNote=Pa,t.renameBranch=Ia,t.resetIndex=Ra,t.resolveRef=za,t.setConfig=Ba,t.stash=Qa,t.status=$a,t.statusMatrix=no,t.tag=ro,t.updateIndex=io,t.version=ao,t.walk=oo,t.writeBlob=so,t.writeCommit=co,t.writeObject=lo,t.writeRef=uo,t.writeTag=po,t.writeTree=mo}))(),1),Vn=a();globalThis.Buffer||(globalThis.Buffer=Vn.Buffer);const Hn={async request({url:e,method:t=`GET`,headers:n={},body:r}){r&&=await Un(r);let i=await fetch(e,{method:t,headers:n,body:r,credentials:`omit`}),a=i.body&&typeof i.body.getReader==`function`?Wn(i.body):[new Uint8Array(await i.arrayBuffer())],o={};for(let[e,t]of i.headers.entries())o[e]=t;return{url:i.url,method:t,statusCode:i.status,statusMessage:i.statusText,body:a,headers:o}}};async function Un(e){let t=[];if(e[Symbol.asyncIterator])for await(let n of e)t.push(n);else if(e[Symbol.iterator])for(let n of e)t.push(n);else if(e.next){let n=await e.nexT();for(;!n.done;)t.push(n.value),n=await e.nexT()}else return e;let n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.length;return r}function Wn(e){let t=e.getReader();return{next(){return t.read()},return(){return t.releaseLock(),{}},[Symbol.asyncIterator](){return this}}}let Gn=null,Kn=null,qn=null,Jn=null,Yn=null;function Xn(e){return e.trim().replace(/^[\\/]+/,``).replace(/[\\/]+$/,``).split(/[\\/]+/).filter(e=>e!==`.`&&e!==``).join(`/`)}const Zn=new class{_map=new Map;_maxSize;constructor(e=2048){this._maxSize=e}clear(){this._map.clear()}get(e){let t=this._map.get(e);return t!==void 0&&(this._map.delete(e),this._map.set(e,t)),t}invalidate(e){let t=e.endsWith(`/`)?e:e+`/`;for(let n of this._map.keys())(n===e||n.startsWith(t))&&this._map.delete(n)}set(e,t){if(this._map.size>=this._maxSize){let e=this._map.keys().next().value;e!==void 0&&this._map.delete(e)}this._map.set(e,t)}};async function Qn(e,t,n={},r=``){let i=e,a=r;for(let e of t){a=a?`${a}/${e}`:e;let t=Zn.get(a);t&&!n.create?i=t:(i=await i.getDirectoryHandle(e,{create:n.create??!1}),Zn.set(a,i))}return i}async function $n(e,t,n={}){let r=Xn(t),i=r.split(`/`).filter(Boolean);if(i.length===0)return e;let a=await Qn(e,i.slice(0,-1),n),o=i[i.length-1];if(n.forceFile||o.includes(`.`))try{return await a.getFileHandle(o,{create:n.create??!1})}catch{}try{let e=await a.getDirectoryHandle(o,{create:n.create??!1}),t=r;return Zn.set(t,e),e}catch{return await a.getFileHandle(o,{create:n.create??!1})}}async function er(e,t,n={}){let r=Xn(t).split(`/`).filter(Boolean);return r.length===0?e:Qn(e,r,n)}async function tr(e,t,n={}){let r=Xn(t).split(`/`).filter(Boolean);if(r.length===0)throw Error(`Cannot resolve '.' as file`);return(await Qn(e,r.slice(0,-1),n)).getFileHandle(r[r.length-1],{create:n.create??!1})}async function nr(e,t){let n=Xn(t).split(`/`).filter(Boolean);if(n.length===0)throw Error(`Cannot get parent of root`);let r=n[n.length-1];return[await Qn(e,n.slice(0,-1)),r]}function rr(e){return e.trim().replace(/\\/g,`/`).replace(/^\/+/,``).replace(/^\.\//,``)}function ir(e){let t=new Map,n=`repos/.git-modes`;function r(e){return e.replace(/\\/g,`/`.replace(/^\/+/,``))}async function i(){try{let r=await(await(await tr(e,n)).getFile()).text(),i=JSON.parse(r);for(let[e,n]of i)t.set(e,n)}catch{}}let a=null;function o(){a===null&&(a=setTimeout(async()=>{a=null;try{let r=await(await tr(e,n,{create:!0})).createWritable(),i=JSON.stringify([...t.entries()]);await r.write(new TextEncoder().encode(i)),await r.close()}catch{}},500))}let s=i(),c={async readFile(t,n){let r=await(await(await tr(e,t)).getFile()).arrayBuffer(),i=typeof n==`string`?n:n?.encoding;return i===`utf8`||i===`utf-8`?new TextDecoder().decode(r):new Uint8Array(r)},async writeFile(n,i,a){let s=await(await tr(e,n,{create:!0})).createWritable();typeof i==`string`&&(i=new TextEncoder().encode(i)),await s.write(i),await s.close();let c=typeof a==`object`&&a?a.mode:void 0,l=r(n);if(c!=null){let e=(c&73)!=0;t.set(l,e?33261:33188),o()}else t.has(l)||t.set(l,33188)},async mkdir(t){await er(e,t,{create:!0})},async rmdir(n){let[i,a]=await nr(e,n);await i.removeEntry(a,{recursive:!0});let o=r(n)+`/`;for(let e of t.keys())(e===r(n)||e.startsWith(o))&&t.delete(e);Zn.invalidate(Xn(n))},async readdir(t){let n=await er(e,t),r=[];for await(let[e]of n.entries())r.push(e);return r},async stat(n){await s;let i;try{i=await $n(e,n)}catch{let e=Error(`ENOENT: no such file or directory, stat '${n}'`);throw e.code=`ENOENT`,e}if(i.kind===`directory`){let e=new Date;return{isDirectory:()=>!0,isFile:()=>!1,isSymbolicLink:()=>!1,size:0,mtimeMs:Date.now(),mode:16877,ino:0,dev:0,nlink:1,uid:0,gid:0,ctime:e,mtime:e}}else{let e=await i.getFile(),a=new Date(e.lastModified),o=r(n),s=t.get(o)??33188;return{isDirectory:()=>!1,isFile:()=>!0,isSymbolicLink:()=>!1,size:e.size,mtimeMs:e.lastModified,mode:s,ino:0,dev:0,nlink:1,uid:0,gid:0,ctime:a,mtime:a}}},async lstat(e){return c.stat(e)},async unlink(n){let[i,a]=await nr(e,n);await i.removeEntry(a),t.delete(r(n))},async symlink(e,t){throw Error(`OPFS does not support symlinks`)},async readlink(e){return await c.readFile(e,`utf8`)}};return{promises:c}}const ar=ir,or=`repos`;function sr(e,t){if(e===`custom`&&t)return t;if(e===`public`)return`https://www.cors-anywhere.com`;let{protocol:n,host:a,hostname:o}=globalThis.location;return o===`localhost`||o===`127.0.0.1`?`${n}//${a}/git-proxy`:`http://${i}:${r}/git-proxy`}async function cr(){return Yn||=(async()=>{if(Gn=Bn.default,Kn=Hn,!qn){let e;try{e=await navigator.storage.getDirectory()}catch(t){console.warn(`OPFS is unavailable for git root, falling back to memory:`,t);let{getMemoryOpfsRoot:n}=await import(`./agent.worker.js`).then(e=>e.b);e=n()}qn=ir(e),Jn=qn.promises}})(),await Yn,{git:Gn,http:Kn,fs:qn,pfs:Jn}}async function lr(e){let t=await cr();if(e){let n=ir(e);return{git:t.git,http:t.http,fs:n,pfs:n.promises,repoDirFn:e=>`repos/${e}`}}return{...t,repoDirFn:dr}}function ur(e){return(e.replace(/\/+$/,``).split(`/`).pop()||`repo`).replace(/\.git$/,``)}function dr(e){return`${or}/${e}`}async function fr(e,t,n){try{await e.getConfig({fs:t,dir:n,path:`core.filemode`})!==!1&&await e.setConfig({fs:t,dir:n,path:`core.filemode`,value:!1})}catch(e){console.error(`Failed to set core.filemode=false:`,e)}}async function pr(e,t){try{await e.mkdir(t)}catch{}}function mr({token:e,username:t,password:n}={}){if(!e&&!t)return{};let r;e?r={Authorization:`Basic ${btoa(`${e}:x-oauth-basic`)}`}:t&&(r={Authorization:`Basic ${btoa(`${t}:${n||``}`)}`});let i=()=>e?{username:e,password:`x-oauth-basic`}:t?{username:t,password:n||``}:{cancel:!0},a=()=>({cancel:!0});return{...r?{headers:r}:{},onAuth:i,onAuthFailure:a}}async function hr({url:e,branch:t,depth:n=20,corsProxy:r,name:i,token:a,username:o,password:s,groupRoot:c}){let{git:l,http:u,fs:d,pfs:f,repoDirFn:p}=await lr(c),m=i||ur(e),h=p(m);r||=sr(`local`),await pr(f,or),await pr(f,h);let g=mr({token:a,username:o,password:s});try{let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.clone(i)}catch{try{let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.fetch(i)}catch{try{await Ir(f,h),await pr(f,h);let i={fs:d,http:u,dir:h,url:e,singleBranch:!0,depth:n,corsProxy:r,...g};t&&(i.ref=t),await l.clone(i)}catch(t){throw Error(`Failed to clone/fetch ${e}: ${t instanceof Error?t.message:String(t)}`)}}}return await fr(l,d,h),m}async function gr({repo:e,ref:t,groupRoot:n}){let{git:r,fs:i,repoDirFn:a}=await lr(n),o=a(e);return await r.checkout({fs:i,dir:o,ref:t,force:!0}),`Checked out ${t} in ${e}`}async function _r({repo:e,name:t,checkout:n=!1,startPoint:r,groupRoot:i}){let{git:a,fs:o,repoDirFn:s}=await lr(i),c=s(e),l={fs:o,dir:c,ref:t};return r&&(l.object=r),await a.branch(l),n?(await a.checkout({fs:o,dir:c,ref:t}),`Created and switched to branch ${t} in ${e}`):`Created branch ${t} in ${e}`}async function vr({repo:e,groupRoot:t}){let{git:n,fs:r,repoDirFn:i}=await lr(t),a=i(e);await fr(n,r,a);let o=await n.statusMatrix({fs:r,dir:a});if(o.length===0)return`Empty repository.`;let s=[];for(let[e,t,n,r]of o){let i=``;if(t===0&&n===2&&r===2)i=`added`;else if(t===0&&n===2&&r===0)i=`new (unstaged)`;else if(t===1&&n===2&&r===2)i=`modified (staged)`;else if(t===1&&n===2&&r===1)i=`modified`;else if(t===1&&n===0&&r===0)i=`deleted`;else if(t===1&&n===1&&r===1)continue;else i=`[${t},${n},${r}]`;s.push(`${i}: ${e}`)}return s.length===0?`On branch ${await n.currentBranch({fs:r,dir:a})||`(detached HEAD)`}\nNothing to commit, working tree clean.`:`On branch ${await n.currentBranch({fs:r,dir:a})||`(detached HEAD)`}\n${s.join(`
|
|
85
85
|
`)}`}async function yr({repo:e,ref:t,depth:n=10,groupRoot:r}){let{git:i,fs:a,repoDirFn:o}=await lr(r),s={fs:a,dir:o(e),depth:n};t&&(s.ref=t);let c=await i.log(s);return c.length===0?`No commits found.`:c.map(e=>{let t=e.commit,n=new Date(t.author.timestamp*1e3).toISOString();return`${e.oid} ${n} ${t.author.name} — ${t.message.trim().split(`
|
|
86
86
|
`)[0]}`}).join(`
|
|
87
87
|
`)}async function br({repo:e,ref1:t,ref2:n,groupRoot:r}){let{git:i,fs:a,repoDirFn:o}=await lr(r),s=o(e),c=a.promises;if(await fr(i,a,s),!t&&!n){let e=(await i.statusMatrix({fs:a,dir:s})).filter(([,e,t])=>!(e===1&&t===1));if(e.length===0)return`No differences.`;let t=[];for(let[n,r,o]of e)try{if(r===0&&o===2){let e=(await Sr(c,s,n)).split(`
|