@blockcerts/blockcerts-verifier 1.57.0 → 1.57.1
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/.eslintrc.js +2 -1
- package/README.md +1 -1
- package/bundle-stats.html +4889 -0
- package/dist/EcdsaSecp256k1Signature2019-01e33e56-6efe219a.js +4 -0
- package/dist/Ed25519Signature2020-722d8d24-df100275.js +74 -0
- package/dist/HashlinkVerifier-40818bdd-2156022a.js +11 -0
- package/dist/MerkleProof2017-ac8d147b-dd9968ca.js +1 -0
- package/dist/MerkleProof2019-6596bc5f-6920f4ea.js +3 -0
- package/dist/Suite-e65d26ad-9eb797e9.js +1 -0
- package/dist/_commonjs-dynamic-modules-1e49c0dd-3e972b61.js +1 -0
- package/dist/checkRevocationStatusList2021-904b13ff-ca07e61e.js +17 -0
- package/dist/controlVerificationMethod-80d0e7f0-27e88021.js +1 -0
- package/dist/did-key-common.esm-2e9ab4e3-8e1d8d48.js +9 -0
- package/dist/did-key-ed25519.esm-54d2cbca-52ecc5b1.js +1 -0
- package/dist/did-key-secp256k1.esm-8a01b23c-75ec86fd.js +1 -0
- package/dist/elliptic-a9d84078-bc51730e.js +1 -0
- package/dist/ensureNotRevoked-2dc26afb-7b9df556.js +1 -0
- package/dist/ensureValidIssuingKey-b950fb8b-b8fdc4d0.js +1 -0
- package/dist/index-0469d008-3e0eb763.js +1 -0
- package/dist/index-69ba64e7.js +1 -0
- package/dist/index-6d4132ca-27a349f3.js +3 -0
- package/dist/index-85f56501-cfd39fda.js +4 -0
- package/dist/index-a93e1e88-967d29f5.js +1 -0
- package/dist/index.es-1e7b4e77.js +56 -0
- package/dist/jsonld-6909fb49-1ef9cd75.js +75 -0
- package/dist/jsonld-signatures-8ecbbaa2-fff3092d.js +66 -0
- package/dist/main.js +621 -1030
- package/dist/pako.esm-7a9981ef-ce496ef7.js +2 -0
- package/dist/purify-b8d8e122.js +2 -0
- package/dist/sha256-71400caa-e7398231.js +1 -0
- package/dist/tslib.es6-28b6776b-35eb20e3.js +1 -0
- package/dist/verifier-es-b337491f.js +120 -0
- package/dist/x25519-08f432f1-3fdac820.js +1 -0
- package/package.json +4 -2
- package/rollup.config.mjs +15 -5
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
function e(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function t(e,t){return"string"!=typeof e?(console.warn("Trying to test a non string variable"),!1):0===e.indexOf(t)}var r,n;!function(e){e.blockcypher="blockcypher",e.blockstream="blockstream",e.etherscan="etherscan"}(r||(r={})),function(e){e.V1_1="1.1",e.V1_2="1.2"}(n||(n={}));var i=n;const o={formatValidation:{label:"Format validation",labelPending:"Validating format",subSteps:[]},hashComparison:{label:"Hash comparison",labelPending:"Comparing hash",subSteps:[]},statusCheck:{label:"Status check",labelPending:"Checking record status",subSteps:[]}};var a=Object.freeze({__proto__:null,final:"final",formatValidation:"formatValidation",hashComparison:"hashComparison",statusCheck:"statusCheck",language:o}),s={"en-US":{steps:{formatValidationLabel:"Format validation",formatValidationLabelPending:"Validating format",hashComparisonLabel:"Hash comparison",hashComparisonLabelPending:"Comparing hash",statusCheckLabel:"Status check",statusCheckLabelPending:"Checking record status"},subSteps:{getTransactionIdLabel:"Get transaction ID",getTransactionIdLabelPending:"Getting transaction ID",computeLocalHashLabel:"Compute local hash",computeLocalHashLabelPending:"Computing local hash",fetchRemoteHashLabel:"Fetch remote hash",fetchRemoteHashLabelPending:"Fetching remote hash",getIssuerProfileLabel:"Get issuer profile",getIssuerProfileLabelPending:"Getting issuer profile",parseIssuerKeysLabel:"Parse issuer keys",parseIssuerKeysLabelPending:"Parsing issuer keys",compareHashesLabel:"Compare hashes",compareHashesLabelPending:"Comparing hashes",checkMerkleRootLabel:"Check Merkle Root",checkMerkleRootLabelPending:"Checking Merkle Root",checkReceiptLabel:"Check Receipt",checkReceiptLabelPending:"Checking Receipt",checkIssuerSignatureLabel:"Check Issuer Signature",checkIssuerSignatureLabelPending:"Checking Issuer Signature",checkAuthenticityLabel:"Check Authenticity",checkAuthenticityLabelPending:"Checking Authenticity",checkRevokedStatusLabel:"Check Revoked Status",checkRevokedStatusLabelPending:"Checking Revoked Status",checkExpiresDateLabel:"Check Expiration Date",checkExpiresDateLabelPending:"Checking Expiration Date"},revocation:{preReason:"Reason given:",reason:"This certificate has been revoked by the issuer."},success:{mocknet:{label:"This Mocknet credential passed all checks",description:"Mocknet credentials are used for test purposes only. They are not recorded on a blockchain, and they should not be considered verified Blockcerts."},blockchain:{label:"Verified",description:"This is a valid ${chain} certificate.",linkText:"View transaction link"}},errors:{certificateNotValid:"This is not a valid certificate",checkEtherScanConfirmations:"Number of transaction confirmations were less than the minimum required, according to EtherScan API",couldNotConfirmTx:"Could not confirm the transaction",ensureHashesEqual:"Computed hash does not match remote hash",ensureIssuerSignature:"Issuer key does not match derived address.",ensureMerkleRootEqual:"Merkle root does not match remote hash.",ensureNotExpired:"This certificate has expired.",ensureValidReceipt:"The receipt is malformed. There was a problem navigating the merkle tree in the receipt.",failedJsonLdNormalization:"Failed JSON-LD normalization",foundUnmappedFields:"Found unmapped fields during JSON-LD normalization",invalidIssuingAddressCreationTime:"The specified issuing address was created after the transaction occurred.",invalidIssuingAddressRevoked:"The specified issuing address was revoked by the issuer before the transaction occurred.",invalidIssuingAddressExpired:"The specified issuing address expired before the transaction occurred.",invalidIssuingAddressUnknown:"The address used to issue this Blockcerts does not belong to the claimed issuer.",getChain:"Didn't recognize chain value",getIssuerProfile:"Unable to get issuer profile",getRevokedAssertions:"Unable to get revocation assertions",getTransactionId:"Cannot verify this certificate without a transaction ID to compare against.",invalidMerkleReceipt:"Invalid Merkle Receipt. Proof hash did not match Merkle root",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"Cannot verify this certificate without a transaction ID to compare against.",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",lookForTxCouldNotConfirm:"Could not confirm the transaction. No blockchain apis returned a response. This could be because of rate limiting.",lookForTxDifferentAddresses:"Issuing addresses returned by the blockchain APIs were different",lookForTxDifferentRemoteHashes:"Remote hashes returned by the blockchain APIs were different",lookForTxInvalidAppConfig:"Invalid application configuration; check the CONFIG.MinimumBlockchainExplorers configuration value",lookForTxInvalidChain:"Invalid chain; does not map to known BlockchainExplorers.",parseBlockCypherResponse:"Number of transaction confirmations were less than the minimum required, according to Blockcypher API",parseBlockstreamResponse:"Number of transaction confirmations were less than the minimum required, according to Blockstream API",parseIssuerKeys:"Unable to parse JSON out of issuer identification data.",unableToGetRemoteHash:"Unable to get remote hash"}},fr:{steps:{formatValidationLabel:"Validation du format",formatValidationLabelPending:"Validation du format",hashComparisonLabel:"Comparaison du hash",hashComparisonLabelPending:"Comparaison du hash",statusCheckLabel:"Vérification du status",statusCheckLabelPending:"Vérification du status"},subSteps:{getTransactionIdLabel:"Obtention de l'identifiant de transaction",getTransactionIdLabelPending:"Obtention de l'identifiant de transaction",computeLocalHashLabel:"Calcul du hash local",computeLocalHashLabelPending:"Calcul du hash local",fetchRemoteHashLabel:"Récupération du hash distant",fetchRemoteHashLabelPending:"Récupération du hash distant",getIssuerProfileLabel:"Obtention du profil de l'émetteur",getIssuerProfileLabelPending:"Obtention du profil de l'émetteur",parseIssuerKeysLabel:"Traitement des clés de l'émetteur",parseIssuerKeysLabelPending:"Traitement des clés de l'émetteur",compareHashesLabel:"Comparaison des hash",compareHashesLabelPending:"Comparaison des hashs",checkMerkleRootLabel:"Vérification du Merkle Root",checkMerkleRootLabelPending:"Vérification du Merkle Root",checkReceiptLabel:"Vérification du reçu",checkReceiptLabelPending:"Vérification du reçu",checkIssuerSignatureLabel:"Vérification de la signature de l'émetteur",checkIssuerSignatureLabelPending:"Vérification de la signature de l'émetteur",checkAuthenticityLabel:"Vérification de l'authenticité",checkAuthenticityLabelPending:"Vérification de l'authenticité",checkRevokedStatusLabel:"Vérification du status de révocation",checkRevokedStatusLabelPending:"Vérification du status de révocation",checkExpiresDateLabel:"Vérification de la date d'expiration",checkExpiresDateLabelPending:"Vérification de la date d'expiration"},revocation:{preReason:"Raison :",reason:"Ce certificat a été révoqué par l'émetteur."},success:{mocknet:{label:"Cet enregistrement Mocknet a été vérifié",description:"Le mode Mocknet est utilisé à des fins de tests uniquement. Ce Blockcert n'a pas été enregistré sur une blockchain, et en tant que tel ne peut pas être considéré un Blockcert valide."},blockchain:{label:"Vérifié",description:"Ceci est un certificat ${chain} valide.",linkText:"Voir la transaction"}},errors:{certificateNotValid:"Certificat invalide",checkEtherScanConfirmations:"Le nombre de confirmations de transaction n'atteint pas le minimum requis, d'après l'API EtherScan",couldNotConfirmTx:"Impossible de confirmer la transaction",ensureHashesEqual:"Calcul du hash local différent du hash distant",ensureIssuerSignature:"La clé de l'émetteur ne correspond pas à l'adresse dérivée",ensureMerkleRootEqual:"Le Merkle root ne correspond pas au hash distant",ensureNotExpired:"Certificat expiré",ensureValidReceipt:"Erreur d'écriture du reçu. Un problème est survenu lors de la navigation de l'arbre Merkle du reçu.",failedJsonLdNormalization:"Erreur de normalisation JSON-LD",foundUnmappedFields:"Champs non liés découverts durant la normalisation JSON-LD",invalidIssuingAddressCreationTime:"L'adresse d'émission utilisée a été créée après la transaction d'enregistrement.",invalidIssuingAddressRevoked:"L'adresse d'émission utilisée a été décommissionnée par l'émetteur avant la transaction d'enregistrement.",invalidIssuingAddressExpired:"L'adresse d'émission utilisée a expiré avant la transaction.",invalidIssuingAddressUnknown:"L'adresse utilisée pour émettre ce Blockcerts n'appartient à l'émetteur déclaré.",getChain:"Valeur de chaine non reconnue",getIssuerProfile:"Profil de l'émetteur indisponible",getRevokedAssertions:"Impossible d'obtenir les raisons de revocation",getTransactionId:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",invalidMerkleReceipt:"Reçu Merkle invalide. Hash de preuve différent du Merkle root",invalidMerkleVersion:"La version du Merkle utilisé est incompatible avec la version Blockcerts.",isTransactionIdValid:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",issuerProfileNotSet:"l'URL de l'émetteur n'est pas définie",issuerProfileInvalid:"le document distant ne semble pas être un profil d'émetteur valide",lookForTxCouldNotConfirm:"Impossible de confirmer la transaction. Aucune API blockchain n'a répondu. Potentiellement dû à une limite de débit réseau.",lookForTxDifferentAddresses:"Les adresses d'émission reçues de l'API blockchain ne concordent pas",lookForTxDifferentRemoteHashes:"Les hashs distants reçus de l'API blockchain ne concordent pas",lookForTxInvalidAppConfig:"Configuration de l'application invalide : vérifiez la valeur de configuration de CONFIG.MinimumBlockchainExplorers",lookForTxInvalidChain:"Chaine invalide : non liée à un BlockchainExplorers connu",parseBlockCypherResponse:"Le nombre de confirmations de transaction n'atteint pas le minimum requis, d'après l'API Blockcypher",parseBlockstreamResponse:"Le nombre de confirmations de transaction n'atteint pas le minimum requis, d'après l'API Blockstream",parseIssuerKeys:"Impossible de lire le JSON d'identification de l'émetteur",unableToGetRemoteHash:"Impossible d'obtenir le hash distant"}},es:{steps:{formatValidationLabel:"Validación de formato",formatValidationLabelPending:"Validando el formato",hashComparisonLabel:"Comparación de cadena binaria",hashComparisonLabelPending:"Comparando cadena binaria",statusCheckLabel:"Estado de Verificación",statusCheckLabelPending:"Verificando Estado de Grabación"},subSteps:{getTransactionIdLabel:"Obtener Identificación de Transacción",getTransactionIdLabelPending:"Obteniendo Identificación de Transacción",computeLocalHashLabel:"Calcular cadena binaria local",computeLocalHashLabelPending:"Calculando cadena binaria local",fetchRemoteHashLabel:"Obtener cadena binaria remota",fetchRemoteHashLabelPending:"Obeniendo cadena binaria remota",getIssuerProfileLabel:"Obtener perfil de emisor",getIssuerProfileLabelPending:"Obteniendo perfil de emisor",parseIssuerKeysLabel:"Analizar claves del emisor",parseIssuerKeysLabelPending:"Analizando claves del emisor",compareHashesLabel:"Comparar cadenas binarias",compareHashesLabelPending:"Comparando cadenas binarias",checkMerkleRootLabel:"Verificar Merkle Root",checkMerkleRootLabelPending:"Verificando Merkle Root",checkReceiptLabel:"Verificar Recibo",checkReceiptLabelPending:"Verificando Recibo",checkIssuerSignatureLabel:"Verificar Firma del Emisor",checkIssuerSignatureLabelPending:"Verificando Firma del Emisor",checkAuthenticityLabel:"Verificar Autenticidad",checkAuthenticityLabelPending:"Verificando Autenticidad",checkRevokedStatusLabel:"Verificar Estado de Revocación",checkRevokedStatusLabelPending:"Verificando Estado de Revocación",checkExpiresDateLabel:"Verificar Fechas de Expiración",checkExpiresDateLabelPending:"Verificando Fechas de Expiración"},revocation:{preReason:"Razón dada:",reason:"Este certificado ha sido revocado por el emisor"},success:{mocknet:{label:"Esta credencial de Mocknet pasó todas las comprobaciones",description:"Las credenciales de Mocknet se usan solo con fines de prueba. No se graban en una cadena de bloques, y no se deben considerar Blockcerts Verificados."},blockchain:{label:"Verificado",description:"Este es un certificado válido de ${chain}.",linkText:"Ver enlace de transacción"}},errors:{certificateNotValid:"Este no es un certificado válido",checkEtherScanConfirmations:"El número de transacciones confirmadas son menores que el mínimo requerido, de acuerdo al API EtherScan",couldNotConfirmTx:"No se ha podido confirmar la transacción",ensureHashesEqual:"La cadena binaria calculada no corresponde con la cadena binaria remota",ensureIssuerSignature:"La llave del emisor no corresponde con la dirección obtenida",ensureMerkleRootEqual:"La raíz Merkle no corresponde con la cadena binaria remota",ensureNotExpired:"Este certificado ha expirado",ensureValidReceipt:"El recibo está malformado. Hubo un problema navegando el árbol Merkle en el recibo",failedJsonLdNormalization:"La normalización del JSON-LD ha fallado",foundUnmappedFields:"Se han encontrado campos no mapeados durante la normalización de JSON-LD",invalidIssuingAddressCreationTime:"The specified issuing address was created after the transaction occurred.",invalidIssuingAddressRevoked:"The specified issuing address was revoked by the issuer before the transaction occurred.",invalidIssuingAddressExpired:"The specified issuing address expired before the transaction occurred.",invalidIssuingAddressUnknown:"The address used to issue this Blockcerts does not belong to the claimed issuer.",getChain:"Valor de cadena no reconocido",getIssuerProfile:"No se ha podido obtener el perfil del emisor",getRevokedAssertions:"No se ha podido obtener aseveraciones de revocación",getTransactionId:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",invalidMerkleReceipt:"Recibo Merkle inválido. La cadena binaria de prueba no corresponde con la raíz Merkle",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",issuerProfileNotSet:"URL del emisor no definido",issuerProfileInvalid:"el documento recogido no parece ser un perfil de emisor valido",lookForTxCouldNotConfirm:"No se ha podido confirmar la transacción. Ninguna del las APIs de blockchain generó una respuesta. Esto puede ser causado por limitaciones de tasa.",lookForTxDifferentAddresses:"Las direcciones emisoras generadas por las APIs del blockchain son distintas",lookForTxDifferentRemoteHashes:"Las cadenas binarias remotas generadas por las APIs del blockchain son distintas",lookForTxInvalidAppConfig:"Configuración de aplicación inválida; cheque el valor de configuración CONFIG.MinimumBlockchainExplorers",lookForTxInvalidChain:"Cadena inválida; no corresponde a BlockchainExplorers reconocidos",parseBlockCypherResponse:"El número de transacciones confirmadas son menores que el mínimo requerido, de acuerdo al API Blockcypher",parseBlockstreamResponse:"El número de transacciones confirmadas son menores que el mínimo requerido, de acuerdo al API Blockstream",parseIssuerKeys:"No se ha podido analizar el JSON de la información de identificación del emisor",unableToGetRemoteHash:"No se ha podido obtener la cadena binaria remota"}},mt:{steps:{formatValidationLabel:"Validazzjoni tal-format",formatValidationLabelPending:"Il-format qed jiġi vvalidat",hashComparisonLabel:"Paragun tal-Hash",hashComparisonLabelPending:"Il-hash qed jiġi pparagunat",statusCheckLabel:"Status check",statusCheckLabelPending:"Ir-record status qed jiġi ċċekkjat"},subSteps:{getTransactionIdLabel:"Ikseb l-ID ta' tranżazzjoni",getTransactionIdLabelPending:"L-ID ta' tranżazzjoni qed tiġi mniżżla",computeLocalHashLabel:"Ikkalkula l-hash lokali",computeLocalHashLabelPending:"Il-hash lokali qed jiġi kkalkulat",fetchRemoteHashLabel:"Fittex ir-remote hash",fetchRemoteHashLabelPending:"Ir-remote hash qed jiġi mfittex",getIssuerProfileLabel:"Ikseb il-profil tal-emittent",getIssuerProfileLabelPending:"Il-profil tal-emittent qed jiġi mniżżel",parseIssuerKeysLabel:"Estratta ċ-ċwievet tal-emittent",parseIssuerKeysLabelPending:"Iċ-ċwievet tal-emittent qed jiġu estratti",compareHashesLabel:"Ikkumpara l-hashes",compareHashesLabelPending:"Il-hashes qed jiġu kkomparati",checkMerkleRootLabel:"Iċċekkja l-Merkle Root",checkMerkleRootLabelPending:"Il-Merkle Root Qed Tiġi Ċċekkjata",checkReceiptLabel:"Iċċekkja l-Irċevuta",checkReceiptLabelPending:"L-Irċevuta Qed Tiġi Ċċekkjata",checkIssuerSignatureLabel:"Iċċekkja l-Firma tal-Emittent",checkIssuerSignatureLabelPending:"Il-Firma tal-Emittent Qed Tiġi Ċċekkjata",checkAuthenticityLabel:"Iċċekkja l-Awtentiċità",checkAuthenticityLabelPending:"L-Awtentiċità Qed Tiġi Ċċekkjata",checkRevokedStatusLabel:"Iċċekkja l-Istatus Revokat",checkRevokedStatusLabelPending:"L-Istatus Revokat Qed Jiġi Ċċekkjat",checkExpiresDateLabel:"Iċċekkja d-Data ta' Skadenza",checkExpiresDateLabelPending:"Id-Data ta' Skadenza Qed Tiġi Ċċekkjata"},revocation:{preReason:"Raġuni mogħtija:",reason:"Dan iċ-ċertifikat ġie revokat mill-emittent."},success:{mocknet:{label:"Din il-kredenzjali tal-Mocknet għaddiet il-kontrolli kollha",description:"Il-kredenzjali tal-Mocknet jintużaw biss għal skopijiet ta 'ttestjar. Dawn mhumiex irreġistrati fuq blockchain, u ma għandhomx jiġu kkunsidrati bħala blockcerts verifikati."},blockchain:{label:"Ivverifikat",description:"Dan huwa ċertifikat ${chain} huwa validu.",linkText:"Ara l-link tat-transazzjoni"}},errors:{certificateNotValid:"Dan mhux ċertifikat validu",checkEtherScanConfirmations:"In-numru ta' konfermi tat-tranżazzjonijiet kienu inqas mill-minimu meħtieġ, skont EtherScan API",couldNotConfirmTx:"Ma setgħetx tiġi kkonfermata t-tranżazzjoni",ensureHashesEqual:"Il-hash ikkalkulat ma jikkorrispondix mar-remote hash",ensureIssuerSignature:"Iċ-ċavetta tal-emittent ma taqbilx mal-indirizz derivat",ensureMerkleRootEqual:"Merkle root ma taqbilx mar-remote hash",ensureNotExpired:"Dan iċ-ċertifikat skada",ensureValidReceipt:"L-irċevuta hija malformata. Kien hemm problema fin-navigazzjoni tal-merkle tree fl-irċevuta",failedJsonLdNormalization:"In-normalizzazzjoni ta' JSON-LD ma rnexxietx",foundUnmappedFields:"Instabu unmapped fields matul in-normalizzazzjoni JSON-LD",invalidIssuingAddressCreationTime:"L-indirizz elettroniku tal-ħruġ speċifikat inħoloq wara li seħħet it-tranżazzjoni.",invalidIssuingAddressRevoked:"L-indirizz elettroniku tal-ħruġ speċifikat ġie revokat mill-emittent qabel ma seħħet it-tranżazzjoni.",invalidIssuingAddressExpired:"L-indirizz elettroniku tal-ħruġ speċifikat skada qabel ma seħħet it-tranżazzjoni.",invalidIssuingAddressUnknown:"L-indirizz elettroniku użat biex jinħarġu dawn il-Blockcerts ma jappartjenix għall-emittent mitlub.",getChain:"Iċ-chain value ma ntgħarafx",getIssuerProfile:"Mhux possibbli jinkiseb il-profil tal-emittent",getRevokedAssertions:"Mhux possibbli jinkisbu dikjarazzjonijiet revokati",getTransactionId:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",invalidMerkleReceipt:"Irċevuta Merkle invalida. Il-proof hash ma kienx jaqbel mal-Merkle root",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",lookForTxCouldNotConfirm:"It-tranżazzjoni ma setgħetx tiġi kkonferma. L-ebda blockchain apis ma rritorna rispons. Dan jista' jkun minħabba limitazzjoni tar-rata",lookForTxDifferentAddresses:"L-indirizzi tal-ħruġ mibgħuta lura mill-blockchain APIs kienu differenti",lookForTxDifferentRemoteHashes:"Ir-remote hashes mibgħuta lura mill-blockchain APIs kienu differenti",lookForTxInvalidAppConfig:"Konfigurazzjoni tal-applikazzjoni invalida; Iċċekkja l-valur konfigurattiv f' CONFIG.MinimumBlockchainExplorers",lookForTxInvalidChain:"Chain invalidu; BlockchainExplorers mhux qed isib chain magħrufa",parseBlockCypherResponse:"In-numru ta' konfermi tat-tranżazzjonijiet kienu inqas mill-minimu meħtieġ, skont Blockcypher API",parseBlockstreamResponse:"In-numru ta' konfermi tat-tranżazzjonijiet kienu inqas mill-minimu meħtieġ, skont Blockstream API",parseIssuerKeys:"Ma jistax jiġi estratt JSON mid-data tal-identifikazzjoni tal-emittent",unableToGetRemoteHash:"Mhux possibbli jinkiseb ir-remote hash"}},"it-IT":{steps:{formatValidationLabel:"Convalidare formato",formatValidationLabelPending:"Convalida formato",hashComparisonLabel:"Confrontare hash",hashComparisonLabelPending:"Confronta hash",statusCheckLabel:"Verificare stato",statusCheckLabelPending:"Verifica stato del record"},subSteps:{getTransactionIdLabel:"Ottenere ID transazione",getTransactionIdLabelPending:"Ottieni ID transazione",computeLocalHashLabel:"Calcolare hash locale",computeLocalHashLabelPending:"Calcola hash locale",fetchRemoteHashLabel:"Recuperare hash remoto",fetchRemoteHashLabelPending:"Recupera hash remoto",getIssuerProfileLabel:"Ottenere profilo issuer",getIssuerProfileLabelPending:"Ottieni profilo issuer",parseIssuerKeysLabel:"Analizzare chiavi issuer",parseIssuerKeysLabelPending:"Analizza chiavi issuer",compareHashesLabel:"Confrontare gli hash",compareHashesLabelPending:"Confronto hash",checkMerkleRootLabel:"Controllare radice di Merkle",checkMerkleRootLabelPending:"Controllo radice di Merkle",checkReceiptLabel:"Verificare ricevuta",checkReceiptLabelPending:"Verifica ricevuta",checkIssuerSignatureLabel:"Verificare firma Issuer",checkIssuerSignatureLabelPending:"Verifica firma Issuer",checkAuthenticityLabel:"Verificare autenticità",checkAuthenticityLabelPending:"Verifica autenticità",checkRevokedStatusLabel:"Verificare stato revocato",checkRevokedStatusLabelPending:"Verifica stato revocato",checkExpiresDateLabel:"Verificare data di scadenza",checkExpiresDateLabelPending:"Verifica data di scadenza"},revocation:{preReason:"Motivo indicato:",reason:"Questo certificato è stato revocato dall'emittente."},success:{mocknet:{label:"Questo Blockcert simulato ha superato tutti i controlli.",description:"La modalità Mocknet è utilizzata solo dagli emittenti per testare il loro flusso di lavoro localmente. Questo Blockcert non è stato registrato su una blockchain e non dovrebbe essere considerato un Blockcert verificato."},blockchain:{label:"Verificato",description:"Questo è un certificato ${chain} valido.",linkText:"Vedi la transazione"}},errors:{certificateNotValid:"Questo non è un certificato valido",checkEtherScanConfirmations:"Il numero di conferme delle transazioni era inferiore al minimo richiesto, secondo l'API EtherScan",couldNotConfirmTx:"Impossibile confermare la transazione",ensureHashesEqual:"L'hash calcolato non corrisponde all'hash remoto",ensureIssuerSignature:"La chiave dell'issuer non corrisponde all'indirizzo derivato.",ensureMerkleRootEqual:"La radice di Merkle non corrisponde all'hash remoto.",ensureNotExpired:"Questo certificato è scaduto.",ensureValidReceipt:"La ricevuta è malformata. C'è stato un problema nella navigazione dell'albero di Merkle nella ricevuta.",failedJsonLdNormalization:"Normalizzazione JSON-LD fallita",foundUnmappedFields:"Campi non mappati trovati durante la normalizzazione JSON-LD",invalidIssuingAddressCreationTime:"The specified issuing address was created after the transaction occurred.",invalidIssuingAddressRevoked:"The specified issuing address was revoked by the issuer before the transaction occurred.",invalidIssuingAddressExpired:"The specified issuing address expired before the transaction occurred.",invalidIssuingAddressUnknown:"The address used to issue this Blockcerts does not belong to the claimed issuer.",getChain:"Il valore della catena non è stato riconosciuto",getIssuerProfile:"Impossibile ottenere il profilo dell'emittente",getRevokedAssertions:"Impossibile ottenere le asserzioni di revoca",getTransactionId:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",invalidMerkleReceipt:"Ricevuta Merkle non valida. L'hash di prova non corrisponde alla radice di Merkle",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",lookForTxCouldNotConfirm:"Impossibile confermare la transazione. Nessuna API blockchain ha risposto. Potrebbe essere a causa della limitazione della velocità.",lookForTxDifferentAddresses:"Gli indirizzi di emissione restituiti dalle API blockchain erano diversi",lookForTxDifferentRemoteHashes:"Gli hash remoti restituiti dalle API blockchain erano diversi",lookForTxInvalidAppConfig:"Configurazione dell'applicazione non valida, verificare il valore di configurazione di CONFIG.MinimumBlockchainExplorers",lookForTxInvalidChain:"Catena non valida; non mappa BlockchainExplorers noti.",parseBlockCypherResponse:"Il numero di conferme delle transazioni era inferiore al minimo richiesto, secondo l'API Blockcypher",parseBlockstreamResponse:"Il numero di conferme delle transazioni era inferiore al minimo richiesto, secondo l'API Blockstream",parseIssuerKeys:"Impossibile analizzare JSON dai dati di identificazione dell'emittente.",unableToGetRemoteHash:"Impossibile ottenere l'hash remoto"}},ja:{steps:{formatValidationLabel:"フォーマットの検証",formatValidationLabelPending:"フォーマットを検証しています",hashComparisonLabel:"ハッシュの照合",hashComparisonLabelPending:"ハッシュを照合しています",statusCheckLabel:"ステータスの確認",statusCheckLabelPending:"ステータスを確認しています"},subSteps:{getTransactionIdLabel:"取引IDの取得",getTransactionIdLabelPending:"取引IDを取得しています",computeLocalHashLabel:"ローカルハッシュの算出",computeLocalHashLabelPending:"ローカルハッシュを算出しています",fetchRemoteHashLabel:"リモートハッシュのフェッチ",fetchRemoteHashLabelPending:"リモートハッシュをフェッチしています",getIssuerProfileLabel:"発行者プロフィールの取得",getIssuerProfileLabelPending:"発行者プロフィールを取得しています",parseIssuerKeysLabel:"発行者の鍵のパース",parseIssuerKeysLabelPending:"発行者の鍵をパースしています",compareHashesLabel:"ハッシュの照合",compareHashesLabelPending:"ハッシュを照合しています",checkMerkleRootLabel:"Merkle Rootの確認",checkMerkleRootLabelPending:"Merkle Rootを確認しています",checkReceiptLabel:"レシートの確認",checkReceiptLabelPending:"レシートを確認しています",checkIssuerSignatureLabel:"発行者の署名の確認",checkIssuerSignatureLabelPending:"発行者の署名を確認しています",checkAuthenticityLabel:"真正性の確認",checkAuthenticityLabelPending:"真正性を確認しています",checkRevokedStatusLabel:"取消ステータスの確認",checkRevokedStatusLabelPending:"取消ステータスを確認しています",checkExpiresDateLabel:"有効期限の確認",checkExpiresDateLabelPending:"有効期限を確認しています"},revocation:{preReason:"理由:",reason:"この証明書は発行者によって取り消されました。"},success:{mocknet:{label:"このMocknetの証明書は全てのチェックを通過しました。",description:"Mocknetの証明書はテスト用のものです。ブロックチェーンに記録されませんし、認証済みのBlockcertとして扱われません。"},blockchain:{label:"認証されました",description:"この証明書は有効な${chain}証明書です。",linkText:"取引を確認する"}},errors:{certificateNotValid:"この証明書は有効ではありません",checkEtherScanConfirmations:"EtherScan APIによると、必要最小限の取引確認の数に達しませんでした",couldNotConfirmTx:"取引を確認できませんでした",ensureHashesEqual:"算出されたハッシュがリモートハッシュと一致しませんでした",ensureIssuerSignature:"発行者の鍵が得られたアドレスと一致しませんでした",ensureMerkleRootEqual:"Merkle rootがリモートハッシュと一致しませんでした",ensureNotExpired:"この証明書の有効期限が切れています",ensureValidReceipt:"レシートが異常です。レシート内のMerkle treeを辿る際に問題が発生しました。",failedJsonLdNormalization:"JSON-LDの正規化に失敗しました",foundUnmappedFields:"JSON-LDの正規化時にマップされていないフィールドを検出しました",invalidIssuingAddressCreationTime:"The specified issuing address was created after the transaction occurred.",invalidIssuingAddressRevoked:"The specified issuing address was revoked by the issuer before the transaction occurred.",invalidIssuingAddressExpired:"The specified issuing address expired before the transaction occurred.",invalidIssuingAddressUnknown:"The address used to issue this Blockcerts does not belong to the claimed issuer.",getChain:"チェーンの値を認識できませんでした",getIssuerProfile:"発行者プロフィールを取得できません",getRevokedAssertions:"取消assertionsを取得できません",getTransactionId:"照合のための取引IDがないため、この証明書を認証できません。",invalidMerkleReceipt:"Merkleレシートが無効です。証明ハッシュがMerkle rootと一致しませんでした。",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"照合するための取引IDがないため、この証明書を認証できません。",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",lookForTxCouldNotConfirm:"取引を確認できませんでした。全てのブロックチェーンAPIが返信しませんでした。 レート制限が原因になっている可能性があります。",lookForTxDifferentAddresses:"ブロックチェーンAPIから返された発行者アドレスが異なっていました",lookForTxDifferentRemoteHashes:"ブロックチェーンAPIから返されたリモートハッシュが異なっていました",lookForTxInvalidAppConfig:"アプリケーション設定が無効です。CONFIG.MinimumBlockchainExplorersの設定値を確認して下さい。",lookForTxInvalidChain:"チェーンが無効です。既知のBlockchainExplorersにマップできません。",parseBlockCypherResponse:"Blockcypher APIによると、必要最小限の取引確認の数に達しませんでした",parseBlockstreamResponse:"Blockstream APIによると、必要最小限の取引確認の数に達しませんでした",parseIssuerKeys:"発行者識別データからJSONをパースできません",unableToGetRemoteHash:"リモートハッシュを取得できません"}}};function c(e,t){return s["en-US"].subSteps[`${e}${t}`]}const u={formatValidation:["getTransactionId","computeLocalHash","fetchRemoteHash","getIssuerProfile","parseIssuerKeys"],hashComparison:["compareHashes","checkMerkleRoot","checkReceipt"],statusCheck:["checkIssuerSignature","checkAuthenticity","checkRevokedStatus","checkExpiresDate"]},f=Object.keys(u).reduce(((e,t)=>{return Object.assign(e,u[r=t].reduce(((e,t)=>(e[t]={code:t,label:c(t,"Label"),labelPending:c(t,"LabelPending"),parentStep:r},e)),{}));var r}),{});var l,d=Object.freeze({__proto__:null,getTransactionId:"getTransactionId",computeLocalHash:"computeLocalHash",fetchRemoteHash:"fetchRemoteHash",getIssuerProfile:"getIssuerProfile",parseIssuerKeys:"parseIssuerKeys",compareHashes:"compareHashes",checkMerkleRoot:"checkMerkleRoot",checkReceipt:"checkReceipt",checkIssuerSignature:"checkIssuerSignature",checkAuthenticity:"checkAuthenticity",checkRevokedStatus:"checkRevokedStatus",checkExpiresDate:"checkExpiresDate",language:f}),h=Object.freeze({__proto__:null,FAILURE:"failure",STARTING:"starting",SUCCESS:"success"});!function(e){e.Bitcoin="bitcoin",e.Ethmain="ethmain",e.Ethropst="ethropst",e.Ethrinkeby="ethrinkeby",e.Mocknet="mocknet",e.Regtest="regtest",e.Testnet="testnet"}(l||(l={}));const p={[l.Bitcoin]:{code:l.Bitcoin,name:"Bitcoin",prefixes:["6a20","OP_RETURN "],signatureValue:"bitcoinMainnet",transactionTemplates:{full:"https://blockchain.info/tx/{transaction_id}",raw:"https://blockchain.info/rawtx/{transaction_id}"}},[l.Ethmain]:{code:l.Ethmain,name:"Ethereum",prefixes:["0x"],signatureValue:"ethereumMainnet",transactionTemplates:{full:"https://etherscan.io/tx/{transaction_id}",raw:"https://etherscan.io/tx/{transaction_id}"}},[l.Ethropst]:{code:l.Ethropst,name:"Ethereum Testnet",signatureValue:"ethereumRopsten",transactionTemplates:{full:"https://ropsten.etherscan.io/tx/{transaction_id}",raw:"https://ropsten.etherscan.io/getRawTx?tx={transaction_id}"}},[l.Ethrinkeby]:{code:l.Ethrinkeby,name:"Ethereum Testnet",signatureValue:"ethereumRinkeby",transactionTemplates:{full:"https://rinkeby.etherscan.io/tx/{transaction_id}",raw:"https://rinkeby.etherscan.io/getRawTx?tx={transaction_id}"}},[l.Mocknet]:{code:l.Mocknet,name:"Mocknet",test:!0,signatureValue:"mockchain",transactionTemplates:{full:"",raw:""}},[l.Regtest]:{code:l.Regtest,name:"Mocknet",test:!0,signatureValue:"bitcoinRegtest",transactionTemplates:{full:"",raw:""}},[l.Testnet]:{code:l.Testnet,name:"Bitcoin Testnet",signatureValue:"bitcoinTestnet",transactionTemplates:{full:"https://testnet.blockchain.info/tx/{transaction_id}",raw:"https://testnet.blockchain.info/rawtx/{transaction_id}"}}},b="mainnet",g="testnet";var y={"@context":[{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",extensions:"https://w3id.org/openbadges/extensions#",validation:"obi:validation",xsd:"http://www.w3.org/2001/XMLSchema#",schema:"http://schema.org/",sec:"https://w3id.org/security#",Assertion:"bc:Assertion",Certificate:"bc:Certificate",Issuer:"bc:Issuer",BlockchainCertificate:"bc:BlockchainCertificate",CertificateDocument:"bc:CertificateDocument",issuer:{"@id":"bc:issuer","@type":"@id"},blockchaincertificate:{"@id":"bc:blockchaincertificate","@type":"@id"},certificate:{"@id":"bc:certificate","@type":"@id"},document:{"@id":"bc:document","@type":"@id"},assertion:{"@id":"bc:assertion","@type":"@id"},verify:{"@id":"bc:verify","@type":"@id"},recipient:{"@id":"bc:recipient","@type":"@id"},receipt:{"@id":"bc:receipt","@type":"@id"},publicKey:{"@id":"bc:publicKey"},revocationKey:{"@id":"bc:revocationKey"},"image:signature":{"@id":"bc:image:signature"},signature:{"@id":"bc:signature"},familyName:{"@id":"schema:familyName"},givenName:{"@id":"schema:givenName"},jobTitle:{"@id":"schema:jobTitle"},signer:{"@id":"bc:signer","@type":"@id"},"attribute-signed":{"@id":"bc:attribute-signed"},"ECDSA(secp256k1)":"bc:SignedBadge",subtitle:{"@id":"bc:subtitle"},email:"schema:email",hashed:{"@id":"obi:hashed","@type":"xsd:boolean"},image:{"@id":"schema:image","@type":"@id"},salt:{"@id":"obi:salt"},identity:{"@id":"obi:identityHash"},issuedOn:{"@id":"obi:issueDate","@type":"xsd:dateTime"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},evidence:{"@id":"obi:evidence","@type":"@id"},criteria:{"@id":"obi:criteria","@type":"@id"},tags:{"@id":"schema:keywords"},alignment:{"@id":"obi:alignment","@type":"@id"},revocationList:{"@id":"obi:revocationList","@type":"@id"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},url:{"@id":"schema:url","@type":"@id"},uid:{"@id":"obi:uid"},TypeValidation:"obi:TypeValidation",FrameValidation:"obi:FrameValidation",validatesType:"obi:validatesType",validationSchema:"obi:validationSchema",validationFrame:"obi:validationFrame",ChainpointSHA224v2:"cp:ChainpointSHA224v2",ChainpointSHA256v2:"cp:ChainpointSHA256v2",ChainpointSHA384v2:"cp:ChainpointSHA384v2",ChainpointSHA512v2:"cp:ChainpointSHA512v2","ChainpointSHA3-224v2":"cp:ChainpointSHA3-224v2","ChainpointSHA3-256v2":"cp:ChainpointSHA3-256v2","ChainpointSHA3-384v2":"cp:ChainpointSHA3-384v2","ChainpointSHA3-512v2":"cp:ChainpointSHA3-512v2",BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"}],validation:[{type:"TypeValidation",validatesType:"Assertion",validationSchema:"https://w3id.org/blockcerts/schema/1.2/assertion-1.2.json"},{type:"TypeValidation",validatesType:"Certificate",validationSchema:"https://w3id.org/blockcerts/schema/1.2/certificate-1.2.json"},{type:"TypeValidation",validatesType:"Issuer",validationSchema:"https://w3id.org/blockcerts/schema/1.2/issuer-1.2.json"},{type:"TypeValidation",validatesType:"CertificateDocument",validationSchema:"https://w3id.org/blockcerts/schema/1.2/certificate-document-1.2.json"},{type:"TypeValidation",validatesType:"BlockchainCertificate",validationSchema:"https://w3id.org/blockcerts/schema/1.2/blockchain-certificate-1.2.json"},{type:"TypeValidation",validatesType:"BlockchainReceipt",validationSchema:"https://w3id.org/blockcerts/schema/1.2/blockchain-receipt-1.2.json"}]},m={"@context":{id:"@id",type:"@type",extensions:"https://w3id.org/openbadges/extensions#",obi:"https://w3id.org/openbadges#",validation:"obi:validation",cred:"https://w3id.org/credentials#",dc:"http://purl.org/dc/terms/",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",AlignmentObject:"schema:AlignmentObject",CryptographicKey:"sec:Key",Endorsement:"cred:Credential",Assertion:"obi:Assertion",BadgeClass:"obi:BadgeClass",Criteria:"obi:Criteria",Evidence:"obi:Evidence",Extension:"obi:Extension",FrameValidation:"obi:FrameValidation",IdentityObject:"obi:IdentityObject",Image:"obi:Image",HostedBadge:"obi:HostedBadge",hosted:"obi:HostedBadge",Issuer:"obi:Issuer",Profile:"obi:Profile",RevocationList:"obi:RevocationList",SignedBadge:"obi:SignedBadge",signed:"obi:SignedBadge",TypeValidation:"obi:TypeValidation",VerificationObject:"obi:VerificationObject",author:{"@id":"schema:author","@type":"@id"},caption:{"@id":"schema:caption"},claim:{"@id":"cred:claim","@type":"@id"},created:{"@id":"dc:created","@type":"xsd:dateTime"},creator:{"@id":"dc:creator","@type":"@id"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},endorsement:{"@id":"cred:credential","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},genre:{"@id":"schema:genre"},image:{"@id":"schema:image","@type":"@id"},name:{"@id":"schema:name"},owner:{"@id":"sec:owner","@type":"@id"},publicKey:{"@id":"sec:publicKey","@type":"@id"},publicKeyPem:{"@id":"sec:publicKeyPem"},related:{"@id":"dc:relation","@type":"@id"},startsWith:{"@id":"http://purl.org/dqm-vocabulary/v1/dqm#startsWith"},tags:{"@id":"schema:keywords"},targetDescription:{"@id":"schema:targetDescription"},targetFramework:{"@id":"schema:targetFramework"},targetName:{"@id":"schema:targetName"},targetUrl:{"@id":"schema:targetUrl"},telephone:{"@id":"schema:telephone"},url:{"@id":"schema:url","@type":"@id"},version:{"@id":"schema:version"},alignment:{"@id":"obi:alignment","@type":"@id"},allowedOrigins:{"@id":"obi:allowedOrigins"},audience:{"@id":"obi:audience"},badge:{"@id":"obi:badge","@type":"@id"},criteria:{"@id":"obi:criteria","@type":"@id"},endorsementComment:{"@id":"obi:endorsementComment"},evidence:{"@id":"obi:evidence","@type":"@id"},hashed:{"@id":"obi:hashed","@type":"xsd:boolean"},identity:{"@id":"obi:identityHash"},issuedOn:{"@id":"obi:issueDate","@type":"xsd:dateTime"},issuer:{"@id":"obi:issuer","@type":"@id"},narrative:{"@id":"obi:narrative"},recipient:{"@id":"obi:recipient","@type":"@id"},revocationList:{"@id":"obi:revocationList","@type":"@id"},revocationReason:{"@id":"obi:revocationReason"},revoked:{"@id":"obi:revoked","@type":"xsd:boolean"},revokedAssertions:{"@id":"obi:revoked"},salt:{"@id":"obi:salt"},targetCode:{"@id":"obi:targetCode"},uid:{"@id":"obi:uid"},validatesType:"obi:validatesType",validationFrame:"obi:validationFrame",validationSchema:"obi:validationSchema",verification:{"@id":"obi:verify","@type":"@id"},verificationProperty:{"@id":"obi:verificationProperty"},verify:"verification"}};const v={};v["https://w3id.org/blockcerts/v1"]=y,v["https://w3id.org/openbadges/v2"]=m,v["https://openbadgespec.org/v2/context.json"]=m;const w={locale:"en-US"};var _=Object.freeze({__proto__:null,isMainnet:function(e){return t(e,"1")||t(e,"ecdsa-koblitz-pubkey:1")}}),S={locale:"en-US"};function x(e,t){return e&&t?s[S.locale]?s[S.locale][e]?s[S.locale][e][t]?s[S.locale][e][t]||"":"[missing locale item data]":"[missing locale group data]":"[missing locale data]":""}function k(){return Object.keys(s)}var E=Object.freeze({__proto__:null,detectLocale:function(){return navigator.language||navigator.userLanguage||navigator.browserLanguage||w.locale},ensureIsSupported:function(e){let t;const r=Ei.i18n.getSupportedLanguages().map((e=>e.toLowerCase()));if(t=r.indexOf(e.toLowerCase())>-1,!t){const n=e.substr(0,2).toLowerCase(),i=r.map((e=>e.split("-")[0])).indexOf(n);t=i>-1,t&&(e=r[i])}return t||(e=w.locale),function(e){const t=e.split("-");return t.length>1?`${t[0].toLowerCase()}-${t[1].toUpperCase()}`:t[0].toLowerCase()}(e)},getText:x,getSupportedLanguages:k});function I(e=""){return _.isMainnet(e)?p.bitcoin:p.testnet}function O(e){const t=Object.keys(p).map((e=>p[e])).find((t=>t.signatureValue===e));if(void 0===t)throw new Error(x("errors","getChain"));return t}class T{constructor(e,t,r,n){this.publicKey=e,this.created=t,this.revoked=r,this.expires=n}}class A{constructor(e,t,r){this.image=e,this.jobTitle=t,this.name=r}}class P extends Error{constructor(e,t){super(t),this.stepCode=e}}var C=Object.freeze({__proto__:null,isMockChain:function(e){if(e){const t="string"==typeof e?e:e.code;return!!Object.keys(p).some((e=>e===t))&&!!p[t].test}return!1}}),M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function R(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function N(e,t){return e(t={exports:{}},t.exports),t.exports}function L(e){return e&&e.default||e}var j=N((function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,i="[object Arguments]",o="[object Boolean]",a="[object Date]",s="[object Function]",c="[object GeneratorFunction]",u="[object Map]",f="[object Number]",l="[object Object]",d="[object Promise]",h="[object RegExp]",p="[object Set]",b="[object String]",g="[object Symbol]",y="[object WeakMap]",m="[object ArrayBuffer]",v="[object DataView]",w="[object Float32Array]",_="[object Float64Array]",S="[object Int8Array]",x="[object Int16Array]",k="[object Int32Array]",E="[object Uint8Array]",I="[object Uint8ClampedArray]",O="[object Uint16Array]",T="[object Uint32Array]",A=/\w*$/,P=/^\[object .+?Constructor\]$/,C=/^(?:0|[1-9]\d*)$/,R={};R[i]=R["[object Array]"]=R[m]=R[v]=R[o]=R[a]=R[w]=R[_]=R[S]=R[x]=R[k]=R[u]=R[f]=R[l]=R[h]=R[p]=R[b]=R[g]=R[E]=R[I]=R[O]=R[T]=!0,R["[object Error]"]=R[s]=R[y]=!1;var N="object"==typeof M&&M&&M.Object===Object&&M,L="object"==typeof self&&self&&self.Object===Object&&self,j=N||L||Function("return this")(),D=t&&!t.nodeType&&t,B=D&&e&&!e.nodeType&&e,U=B&&B.exports===D;function H(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function V(e,t,r,n){var i=-1,o=e?e.length:0;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function q(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function z(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function K(e,t){return function(r){return e(t(r))}}function W(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var J,G=Array.prototype,X=Function.prototype,$=Object.prototype,Y=j["__core-js_shared__"],Q=(J=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||""))?"Symbol(src)_1."+J:"",Z=X.toString,ee=$.hasOwnProperty,te=$.toString,re=RegExp("^"+Z.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=U?j.Buffer:void 0,ie=j.Symbol,oe=j.Uint8Array,ae=K(Object.getPrototypeOf,Object),se=Object.create,ce=$.propertyIsEnumerable,ue=G.splice,fe=Object.getOwnPropertySymbols,le=ne?ne.isBuffer:void 0,de=K(Object.keys,Object),he=je(j,"DataView"),pe=je(j,"Map"),be=je(j,"Promise"),ge=je(j,"Set"),ye=je(j,"WeakMap"),me=je(Object,"create"),ve=Fe(he),we=Fe(pe),_e=Fe(be),Se=Fe(ge),xe=Fe(ye),ke=ie?ie.prototype:void 0,Ee=ke?ke.valueOf:void 0;function Ie(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Te(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ae(e){this.__data__=new Oe(e)}function Pe(e,t,r){var n=e[t];ee.call(e,t)&&Ve(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function Ce(e,t){for(var r=e.length;r--;)if(Ve(e[r][0],t))return r;return-1}function Me(e,t,r,n,d,y,P){var C;if(n&&(C=y?n(e,d,y,P):n(e)),void 0!==C)return C;if(!Je(e))return e;var M=qe(e);if(M){if(C=function(e){var t=e.length,r=e.constructor(t);return t&&"string"==typeof e[0]&&ee.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!t)return function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(e,C)}else{var N=Be(e),L=N==s||N==c;if(Ke(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(N==l||N==i||L&&!y){if(q(e))return y?e:{};if(C=function(e){return"function"!=typeof e.constructor||He(e)?{}:Je(t=ae(e))?se(t):{};var t}(L?{}:e),!t)return function(e,t){return Ne(e,De(e),t)}(e,function(e,t){return e&&Ne(t,Ge(t),e)}(C,e))}else{if(!R[N])return y?e:{};C=function(e,t,r,n){var i,s=e.constructor;switch(t){case m:return Re(e);case o:case a:return new s(+e);case v:return function(e,t){var r=t?Re(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,n);case w:case _:case S:case x:case k:case E:case I:case O:case T:return function(e,t){var r=t?Re(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,n);case u:return function(e,t,r){return V(t?r(z(e),!0):z(e),H,new e.constructor)}(e,n,r);case f:case b:return new s(e);case h:return function(e){var t=new e.constructor(e.source,A.exec(e));return t.lastIndex=e.lastIndex,t}(e);case p:return function(e,t,r){return V(t?r(W(e),!0):W(e),F,new e.constructor)}(e,n,r);case g:return i=e,Ee?Object(Ee.call(i)):{}}}(e,N,Me,t)}}P||(P=new Ae);var j=P.get(e);if(j)return j;if(P.set(e,C),!M)var D=r?function(e){return function(e,t,r){var n=t(e);return qe(e)?n:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(n,r(e))}(e,Ge,De)}(e):Ge(e);return function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r););}(D||e,(function(i,o){D&&(i=e[o=i]),Pe(C,o,Me(i,t,r,n,o,e,P))})),C}function Re(e){var t=new e.constructor(e.byteLength);return new oe(t).set(new oe(e)),t}function Ne(e,t,r,n){r||(r={});for(var i=-1,o=t.length;++i<o;){var a=t[i],s=n?n(r[a],e[a],a,r,e):void 0;Pe(r,a,void 0===s?e[a]:s)}return r}function Le(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function je(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Je(e)||(t=e,Q&&Q in t))&&(We(e)||q(e)?re:P).test(Fe(e));var t}(r)?r:void 0}Ie.prototype.clear=function(){this.__data__=me?me(null):{}},Ie.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ie.prototype.get=function(e){var t=this.__data__;if(me){var n=t[e];return n===r?void 0:n}return ee.call(t,e)?t[e]:void 0},Ie.prototype.has=function(e){var t=this.__data__;return me?void 0!==t[e]:ee.call(t,e)},Ie.prototype.set=function(e,t){return this.__data__[e]=me&&void 0===t?r:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,r=Ce(t,e);return!(r<0||(r==t.length-1?t.pop():ue.call(t,r,1),0))},Oe.prototype.get=function(e){var t=this.__data__,r=Ce(t,e);return r<0?void 0:t[r][1]},Oe.prototype.has=function(e){return Ce(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var r=this.__data__,n=Ce(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Te.prototype.clear=function(){this.__data__={hash:new Ie,map:new(pe||Oe),string:new Ie}},Te.prototype.delete=function(e){return Le(this,e).delete(e)},Te.prototype.get=function(e){return Le(this,e).get(e)},Te.prototype.has=function(e){return Le(this,e).has(e)},Te.prototype.set=function(e,t){return Le(this,e).set(e,t),this},Ae.prototype.clear=function(){this.__data__=new Oe},Ae.prototype.delete=function(e){return this.__data__.delete(e)},Ae.prototype.get=function(e){return this.__data__.get(e)},Ae.prototype.has=function(e){return this.__data__.has(e)},Ae.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Oe){var n=r.__data__;if(!pe||n.length<199)return n.push([e,t]),this;r=this.__data__=new Te(n)}return r.set(e,t),this};var De=fe?K(fe,Object):function(){return[]},Be=function(e){return te.call(e)};function Ue(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||C.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||$)}function Fe(e){if(null!=e){try{return Z.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ve(e,t){return e===t||e!=e&&t!=t}(he&&Be(new he(new ArrayBuffer(1)))!=v||pe&&Be(new pe)!=u||be&&Be(be.resolve())!=d||ge&&Be(new ge)!=p||ye&&Be(new ye)!=y)&&(Be=function(e){var t=te.call(e),r=t==l?e.constructor:void 0,n=r?Fe(r):void 0;if(n)switch(n){case ve:return v;case we:return u;case _e:return d;case Se:return p;case xe:return y}return t});var qe=Array.isArray;function ze(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}(e.length)&&!We(e)}var Ke=le||function(){return!1};function We(e){var t=Je(e)?te.call(e):"";return t==s||t==c}function Je(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ge(e){return ze(e)?function(e,t){var r=qe(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&ze(e)}(e)&&ee.call(e,"callee")&&(!ce.call(e,"callee")||te.call(e)==i)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,o=!!n;for(var a in e)!t&&!ee.call(e,a)||o&&("length"==a||Ue(a,n))||r.push(a);return r}(e):function(e){if(!He(e))return de(e);var t=[];for(var r in Object(e))ee.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return Me(e,!0,!0)}}));function D(e){return j(e)}const B={[b]:["getTransactionId","computeLocalHash","fetchRemoteHash","getIssuerProfile","parseIssuerKeys","compareHashes","checkMerkleRoot","checkReceipt","checkRevokedStatus","checkAuthenticity","checkExpiresDate"],[g]:["computeLocalHash","compareHashes","checkReceipt","checkExpiresDate"]};var U=Object.freeze({__proto__:null,getChain:function(e,t=null){const r=t||{};if(r.anchors){const e=r.anchors[0];if(e.chain)return O(e.chain);if("string"==typeof e)return function(e){const t={btc:{chainName:p.bitcoin.name},eth:{chainName:p.ethmain.name}},r=e.split(":"),n=r.findIndex((e=>Object.keys(t).includes(e)));if(n>-1){const e=r[n],i=r[n+1];return O(t[e].chainName.toLowerCase()+function(e){const t=e.substr(0,1),r=e.substr(1,e.length-1);return t.toUpperCase()+r.toLowerCase()}(i))}return I()}(e)}return I(e)},generateRevocationReason:function(e){return e=(e=e.trim()).length>0?` ${x("revocation","preReason")} ${e}${"."!==e.slice(-1)?".":""}`:"",`${x("revocation","reason")}${e}`},getTransactionId:function(e={}){try{const{anchors:t}=e,r=t[0];if(r.sourceId)return r.sourceId;if("string"==typeof r)return r.split(":").pop()}catch(e){throw new P("",x("errors","getTransactionId"))}},getTransactionLink:function(e,t,r=!1){return e&&t?t.transactionTemplates[r?"raw":"full"].replace("{transaction_id}",e):""},getVerificationMap:function(e){if(!e)return[];const t=C.isMockChain(e)?g:b;return function(e){const t=function(e){const t=D(o);return e.forEach((e=>t[e.parentStep].subSteps.push(e))),t}(e.map((e=>({...Object.assign({},f[e]),label:x("subSteps",`${e}Label`),labelPending:x("subSteps",`${e}LabelPending`)}))));return r=t,Object.keys(r).map((e=>({...r[e],code:e,label:x("steps",`${e}Label`),labelPending:x("steps",`${e}LabelPending`)})));var r}(Object.assign(B)[t])}}),H="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},F=[],V=[],q="undefined"!=typeof Uint8Array?Uint8Array:Array,z=!1;function K(){z=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)F[t]=e[t],V[e.charCodeAt(t)]=t;V["-".charCodeAt(0)]=62,V["_".charCodeAt(0)]=63}function W(e,t,r){for(var n,i,o=[],a=t;a<r;a+=3)n=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(F[(i=n)>>18&63]+F[i>>12&63]+F[i>>6&63]+F[63&i]);return o.join("")}function J(e){var t;z||K();for(var r=e.length,n=r%3,i="",o=[],a=16383,s=0,c=r-n;s<c;s+=a)o.push(W(e,s,s+a>c?c:s+a));return 1===n?(t=e[r-1],i+=F[t>>2],i+=F[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=F[t>>10],i+=F[t>>4&63],i+=F[t<<2&63],i+="="),o.push(i),o.join("")}function G(e,t,r,n,i){var o,a,s=8*i-n-1,c=(1<<s)-1,u=c>>1,f=-7,l=r?i-1:0,d=r?-1:1,h=e[t+l];for(l+=d,o=h&(1<<-f)-1,h>>=-f,f+=s;f>0;o=256*o+e[t+l],l+=d,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=256*a+e[t+l],l+=d,f-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),o-=u}return(h?-1:1)*a*Math.pow(2,o-n)}function X(e,t,r,n,i,o){var a,s,c,u=8*o-i-1,f=(1<<u)-1,l=f>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,b=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+l>=1?d/c:d*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=f?(s=0,a=f):a+l>=1?(s=(t*c-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[r+h]=255&s,h+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+h]=255&a,h+=p,a/=256,u-=8);e[r+h-p]|=128*b}var $={}.toString,Y=Array.isArray||function(e){return"[object Array]"==$.call(e)};te.TYPED_ARRAY_SUPPORT=void 0===H.TYPED_ARRAY_SUPPORT||H.TYPED_ARRAY_SUPPORT;var Q=Z();function Z(){return te.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ee(e,t){if(Z()<t)throw new RangeError("Invalid typed array length");return te.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=te.prototype:(null===e&&(e=new te(t)),e.length=t),e}function te(e,t,r){if(!(te.TYPED_ARRAY_SUPPORT||this instanceof te))return new te(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return ie(this,e)}return re(this,e,t,r)}function re(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),te.TYPED_ARRAY_SUPPORT?(e=t).__proto__=te.prototype:e=oe(e,t),e}(e,t,r,n):"string"==typeof t?function(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!te.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|ce(t,r),i=(e=ee(e,n)).write(t,r);return i!==n&&(e=e.slice(0,i)),e}(e,t,r):function(e,t){if(se(t)){var r=0|ae(t.length);return 0===(e=ee(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?ee(e,0):oe(e,t);if("Buffer"===t.type&&Y(t.data))return oe(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function ne(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function ie(e,t){if(ne(t),e=ee(e,t<0?0:0|ae(t)),!te.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function oe(e,t){var r=t.length<0?0:0|ae(t.length);e=ee(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function ae(e){if(e>=Z())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z().toString(16)+" bytes");return 0|e}function se(e){return!(null==e||!e._isBuffer)}function ce(e,t){if(se(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Ne(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Le(e).length;default:if(n)return Ne(e).length;t=(""+t).toLowerCase(),n=!0}}function ue(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return xe(this,t,r);case"utf8":case"utf-8":return we(this,t,r);case"ascii":return _e(this,t,r);case"latin1":case"binary":return Se(this,t,r);case"base64":return ve(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ke(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function fe(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function le(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=te.from(t,n)),se(t))return 0===t.length?-1:de(e,t,r,n,i);if("number"==typeof t)return t&=255,te.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):de(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function de(e,t,r,n,i){var o,a=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var f=-1;for(o=r;o<s;o++)if(u(e,o)===u(t,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===c)return f*a}else-1!==f&&(o-=o-f),f=-1}else for(r+c>s&&(r=s-c),o=r;o>=0;o--){for(var l=!0,d=0;d<c;d++)if(u(e,o+d)!==u(t,d)){l=!1;break}if(l)return o}return-1}function he(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[r+a]=s}return a}function pe(e,t,r,n){return je(Ne(t,e.length-r),e,r,n)}function be(e,t,r,n){return je(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function ge(e,t,r,n){return be(e,t,r,n)}function ye(e,t,r,n){return je(Le(t),e,r,n)}function me(e,t,r,n){return je(function(e,t){for(var r,n,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function ve(e,t,r){return 0===t&&r===e.length?J(e):J(e.slice(t,r))}function we(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,a,s,c,u=e[i],f=null,l=u>239?4:u>223?3:u>191?2:1;if(i+l<=r)switch(l){case 1:u<128&&(f=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(f=c);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(c=(15&u)<<12|(63&o)<<6|63&a)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(c=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(f=c)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}function _e(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function Se(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function xe(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=Re(e[o]);return i}function ke(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function Ee(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function Ie(e,t,r,n,i,o){if(!se(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function Oe(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Te(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function Ae(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Pe(e,t,r,n,i){return i||Ae(e,0,r,4),X(e,t,r,n,23,4),r+4}function Ce(e,t,r,n,i){return i||Ae(e,0,r,8),X(e,t,r,n,52,8),r+8}te.poolSize=8192,te._augment=function(e){return e.__proto__=te.prototype,e},te.from=function(e,t,r){return re(null,e,t,r)},te.TYPED_ARRAY_SUPPORT&&(te.prototype.__proto__=Uint8Array.prototype,te.__proto__=Uint8Array),te.alloc=function(e,t,r){return function(e,t,r,n){return ne(t),t<=0?ee(e,t):void 0!==r?"string"==typeof n?ee(e,t).fill(r,n):ee(e,t).fill(r):ee(e,t)}(null,e,t,r)},te.allocUnsafe=function(e){return ie(null,e)},te.allocUnsafeSlow=function(e){return ie(null,e)},te.isBuffer=De,te.compare=function(e,t){if(!se(e)||!se(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},te.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},te.concat=function(e,t){if(!Y(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return te.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=te.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(!se(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},te.byteLength=ce,te.prototype._isBuffer=!0,te.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)fe(this,t,t+1);return this},te.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)fe(this,t,t+3),fe(this,t+1,t+2);return this},te.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)fe(this,t,t+7),fe(this,t+1,t+6),fe(this,t+2,t+5),fe(this,t+3,t+4);return this},te.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?we(this,0,e):ue.apply(this,arguments)},te.prototype.equals=function(e){if(!se(e))throw new TypeError("Argument must be a Buffer");return this===e||0===te.compare(this,e)},te.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},te.prototype.compare=function(e,t,r,n,i){if(!se(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),c=this.slice(n,i),u=e.slice(t,r),f=0;f<s;++f)if(c[f]!==u[f]){o=c[f],a=u[f];break}return o<a?-1:a<o?1:0},te.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},te.prototype.indexOf=function(e,t,r){return le(this,e,t,r,!0)},te.prototype.lastIndexOf=function(e,t,r){return le(this,e,t,r,!1)},te.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return he(this,e,t,r);case"utf8":case"utf-8":return pe(this,e,t,r);case"ascii":return be(this,e,t,r);case"latin1":case"binary":return ge(this,e,t,r);case"base64":return ye(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return me(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},te.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},te.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),te.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=te.prototype;else{var i=t-e;r=new te(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},te.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Ee(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},te.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Ee(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},te.prototype.readUInt8=function(e,t){return t||Ee(e,1,this.length),this[e]},te.prototype.readUInt16LE=function(e,t){return t||Ee(e,2,this.length),this[e]|this[e+1]<<8},te.prototype.readUInt16BE=function(e,t){return t||Ee(e,2,this.length),this[e]<<8|this[e+1]},te.prototype.readUInt32LE=function(e,t){return t||Ee(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},te.prototype.readUInt32BE=function(e,t){return t||Ee(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},te.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Ee(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},te.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Ee(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},te.prototype.readInt8=function(e,t){return t||Ee(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},te.prototype.readInt16LE=function(e,t){t||Ee(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},te.prototype.readInt16BE=function(e,t){t||Ee(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},te.prototype.readInt32LE=function(e,t){return t||Ee(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},te.prototype.readInt32BE=function(e,t){return t||Ee(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},te.prototype.readFloatLE=function(e,t){return t||Ee(e,4,this.length),G(this,e,!0,23,4)},te.prototype.readFloatBE=function(e,t){return t||Ee(e,4,this.length),G(this,e,!1,23,4)},te.prototype.readDoubleLE=function(e,t){return t||Ee(e,8,this.length),G(this,e,!0,52,8)},te.prototype.readDoubleBE=function(e,t){return t||Ee(e,8,this.length),G(this,e,!1,52,8)},te.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||Ie(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},te.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||Ie(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},te.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Ie(this,e,t,1,255,0),te.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},te.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Ie(this,e,t,2,65535,0),te.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Oe(this,e,t,!0),t+2},te.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Ie(this,e,t,2,65535,0),te.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Oe(this,e,t,!1),t+2},te.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Ie(this,e,t,4,4294967295,0),te.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Te(this,e,t,!0),t+4},te.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Ie(this,e,t,4,4294967295,0),te.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Te(this,e,t,!1),t+4},te.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Ie(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<r&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},te.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Ie(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},te.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Ie(this,e,t,1,127,-128),te.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},te.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Ie(this,e,t,2,32767,-32768),te.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Oe(this,e,t,!0),t+2},te.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Ie(this,e,t,2,32767,-32768),te.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Oe(this,e,t,!1),t+2},te.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Ie(this,e,t,4,2147483647,-2147483648),te.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Te(this,e,t,!0),t+4},te.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Ie(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),te.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Te(this,e,t,!1),t+4},te.prototype.writeFloatLE=function(e,t,r){return Pe(this,e,t,!0,r)},te.prototype.writeFloatBE=function(e,t,r){return Pe(this,e,t,!1,r)},te.prototype.writeDoubleLE=function(e,t,r){return Ce(this,e,t,!0,r)},te.prototype.writeDoubleBE=function(e,t,r){return Ce(this,e,t,!1,r)},te.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;i>=0;--i)e[i+t]=this[i+r];else if(o<1e3||!te.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},te.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!te.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var a=se(e)?e:Ne(new te(e,n).toString()),s=a.length;for(o=0;o<r-t;++o)this[o+t]=a[o%s]}return this};var Me=/[^+\/0-9A-Za-z-_]/g;function Re(e){return e<16?"0"+e.toString(16):e.toString(16)}function Ne(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Le(e){return function(e){var t,r,n,i,o,a;z||K();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new q(3*s/4-o),n=o>0?s-4:s;var c=0;for(t=0,r=0;t<n;t+=4,r+=3)i=V[e.charCodeAt(t)]<<18|V[e.charCodeAt(t+1)]<<12|V[e.charCodeAt(t+2)]<<6|V[e.charCodeAt(t+3)],a[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=255&i;return 2===o?(i=V[e.charCodeAt(t)]<<2|V[e.charCodeAt(t+1)]>>4,a[c++]=255&i):1===o&&(i=V[e.charCodeAt(t)]<<10|V[e.charCodeAt(t+1)]<<4|V[e.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Me,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function je(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function De(e){return null!=e&&(!!e._isBuffer||Be(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Be(e.slice(0,0))}(e))}function Be(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Ue=Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:Q,Buffer:te,SlowBuffer:function(e){return+e!=e&&(e=0),te.alloc(+e)},isBuffer:De});function He(){throw new Error("setTimeout has not been defined")}function Fe(){throw new Error("clearTimeout has not been defined")}var Ve=He,qe=Fe;function ze(e){if(Ve===setTimeout)return setTimeout(e,0);if((Ve===He||!Ve)&&setTimeout)return Ve=setTimeout,setTimeout(e,0);try{return Ve(e,0)}catch(t){try{return Ve.call(null,e,0)}catch(t){return Ve.call(this,e,0)}}}"function"==typeof H.setTimeout&&(Ve=setTimeout),"function"==typeof H.clearTimeout&&(qe=clearTimeout);var Ke,We=[],Je=!1,Ge=-1;function Xe(){Je&&Ke&&(Je=!1,Ke.length?We=Ke.concat(We):Ge=-1,We.length&&$e())}function $e(){if(!Je){var e=ze(Xe);Je=!0;for(var t=We.length;t;){for(Ke=We,We=[];++Ge<t;)Ke&&Ke[Ge].run();Ge=-1,t=We.length}Ke=null,Je=!1,function(e){if(qe===clearTimeout)return clearTimeout(e);if((qe===Fe||!qe)&&clearTimeout)return qe=clearTimeout,clearTimeout(e);try{qe(e)}catch(t){try{return qe.call(null,e)}catch(t){return qe.call(this,e)}}}(e)}}function Ye(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];We.push(new Qe(e,t)),1!==We.length||Je||ze($e)}function Qe(e,t){this.fun=e,this.array=t}function Ze(){}Qe.prototype.run=function(){this.fun.apply(null,this.array)};var et=Ze,tt=Ze,rt=Ze,nt=Ze,it=Ze,ot=Ze,at=Ze,st=H.performance||{},ct=st.now||st.mozNow||st.msNow||st.oNow||st.webkitNow||function(){return(new Date).getTime()},ut=new Date,ft={nextTick:Ye,title:"browser",browser:!0,env:{},argv:[],version:"11.0.0",versions:{},on:et,addListener:tt,once:rt,off:nt,removeListener:it,removeAllListeners:ot,emit:at,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*ct.call(st),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ut)/1e3}},lt=/[^\x20-\x7E]/,dt=/[\x2E\u3002\uFF0E\uFF61]/g,ht={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},pt=Math.floor,bt=String.fromCharCode;
|
|
16
|
+
/*! https://mths.be/punycode v1.4.1 by @mathias */function gt(e){throw new RangeError(ht[e])}function yt(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function mt(e,t,r){var n=0;for(e=r?pt(e/700):e>>1,e+=pt(e/t);e>455;n+=36)e=pt(e/35);return pt(n+36*e/(e+38))}function vt(e){return function(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]);var i=function(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}((e=e.replace(dt,".")).split("."),(function(e){return lt.test(e)?"xn--"+function(e){var t,r,n,i,o,a,s,c,u,f,l,d,h,p,b,g=[];for(d=(e=function(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}(e)).length,t=128,r=0,o=72,a=0;a<d;++a)(l=e[a])<128&&g.push(bt(l));for(n=i=g.length,i&&g.push("-");n<d;){for(s=2147483647,a=0;a<d;++a)(l=e[a])>=t&&l<s&&(s=l);for(s-t>pt((2147483647-r)/(h=n+1))&>("overflow"),r+=(s-t)*h,t=s,a=0;a<d;++a)if((l=e[a])<t&&++r>2147483647&>("overflow"),l==t){for(c=r,u=36;!(c<(f=u<=o?1:u>=o+26?26:u-o));u+=36)b=c-f,p=36-f,g.push(bt(yt(f+b%p,0))),c=pt(b/p);g.push(bt(yt(c,0))),o=mt(r,h,n==i),r=0,++n}++r,++t}return g.join("")}(e):e})).join(".");return n+i}(e)}var wt="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},_t=/%[sdj%]/g;function St(e){if(!Nt(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(It(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,i=n.length,o=String(e).replace(_t,(function(e){if("%%"===e)return"%";if(r>=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),a=n[r];r<i;a=n[++r])Rt(a)||!Dt(a)?o+=" "+a:o+=" "+It(a);return o}function xt(e,t){if(Lt(H.process))return function(){return xt(e,t).apply(this,arguments)};var r=!1;return function(){return r||(console.error(t),r=!0),e.apply(this,arguments)}}var kt,Et={};function It(e,t){var r={seen:[],stylize:Tt};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Mt(t)?r.showHidden=t:t&&function(e,t){if(!t||!Dt(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]]}(r,t),Lt(r.showHidden)&&(r.showHidden=!1),Lt(r.depth)&&(r.depth=2),Lt(r.colors)&&(r.colors=!1),Lt(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Ot),At(r,e,r.depth)}function Ot(e,t){var r=It.styles[t];return r?"["+It.colors[r][0]+"m"+e+"["+It.colors[r][1]+"m":e}function Tt(e,t){return e}function At(e,t,r){if(e.customInspect&&t&&Ht(t.inspect)&&t.inspect!==It&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return Nt(n)||(n=At(e,n,r)),n}var i=function(e,t){if(Lt(t))return e.stylize("undefined","undefined");if(Nt(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return"number"==typeof t?e.stylize(""+t,"number"):Mt(t)?e.stylize(""+t,"boolean"):Rt(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),Ut(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Pt(t);if(0===o.length){if(Ht(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(jt(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Bt(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Ut(t))return Pt(t)}var c,u,f="",l=!1,d=["{","}"];return c=t,Array.isArray(c)&&(l=!0,d=["[","]"]),Ht(t)&&(f=" [Function"+(t.name?": "+t.name:"")+"]"),jt(t)&&(f=" "+RegExp.prototype.toString.call(t)),Bt(t)&&(f=" "+Date.prototype.toUTCString.call(t)),Ut(t)&&(f=" "+Pt(t)),0!==o.length||l&&0!=t.length?r<0?jt(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=l?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a<s;++a)Vt(t,String(a))?o.push(Ct(e,t,r,n,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(Ct(e,t,r,n,i,!0))})),o}(e,t,r,a,o):o.map((function(n){return Ct(e,t,r,a,n,l)})),e.seen.pop(),function(e,t,r){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(u,f,d)):d[0]+f+d[1]}function Pt(e){return"["+Error.prototype.toString.call(e)+"]"}function Ct(e,t,r,n,i,o){var a,s,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),Vt(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=Rt(r)?At(e,c.value,null):At(e,c.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),Lt(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function Mt(e){return"boolean"==typeof e}function Rt(e){return null===e}function Nt(e){return"string"==typeof e}function Lt(e){return void 0===e}function jt(e){return Dt(e)&&"[object RegExp]"===Ft(e)}function Dt(e){return"object"==typeof e&&null!==e}function Bt(e){return Dt(e)&&"[object Date]"===Ft(e)}function Ut(e){return Dt(e)&&("[object Error]"===Ft(e)||e instanceof Error)}function Ht(e){return"function"==typeof e}function Ft(e){return Object.prototype.toString.call(e)}function Vt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function qt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}It.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},It.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var zt=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function Kt(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function Wt(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var Jt=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t};function Gt(e,t,r,n){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var s=e.length;a>0&&s>a&&(s=a);for(var c=0;c<s;++c){var u,f,l,d,h=e[c].replace(o,"%20"),p=h.indexOf(r);p>=0?(u=h.substr(0,p),f=h.substr(p+1)):(u=h,f=""),l=decodeURIComponent(u),d=decodeURIComponent(f),qt(i,l)?zt(i[l])?i[l].push(d):i[l]=[i[l],d]:i[l]=d}return i}var Xt={parse:ur,resolve:function(e,t){return ur(e,!1,!0).resolve(t)},resolveObject:function(e,t){return e?ur(e,!1,!0).resolveObject(t):t},format:function(e){return Nt(e)&&(e=fr({},e)),lr(e)},Url:$t};function $t(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Yt=/^([a-z0-9.+-]+:)/i,Qt=/:[0-9]*$/,Zt=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,er=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),tr=["'"].concat(er),rr=["%","/","?",";","#"].concat(tr),nr=["/","?","#"],ir=/^[+a-z0-9A-Z_-]{0,63}$/,or=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ar={javascript:!0,"javascript:":!0},sr={javascript:!0,"javascript:":!0},cr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function ur(e,t,r){if(e&&Dt(e)&&e instanceof $t)return e;var n=new $t;return n.parse(e,t,r),n}function fr(e,t,r,n){if(!Nt(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),o=-1!==i&&i<t.indexOf("#")?"?":"#",a=t.split(o);a[0]=a[0].replace(/\\/g,"/");var s=t=a.join(o);if(s=s.trim(),!n&&1===t.split("#").length){var c=Zt.exec(s);if(c)return e.path=s,e.href=s,e.pathname=c[1],c[2]?(e.search=c[2],e.query=r?Gt(e.search.substr(1)):e.search.substr(1)):r&&(e.search="",e.query={}),e}var u,f,l,d,h=Yt.exec(s);if(h){var p=(h=h[0]).toLowerCase();e.protocol=p,s=s.substr(h.length)}if(n||h||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var b="//"===s.substr(0,2);!b||h&&sr[h]||(s=s.substr(2),e.slashes=!0)}if(!sr[h]&&(b||h&&!cr[h])){var g,y,m=-1;for(u=0;u<nr.length;u++)-1!==(f=s.indexOf(nr[u]))&&(-1===m||f<m)&&(m=f);for(-1!==(y=-1===m?s.lastIndexOf("@"):s.lastIndexOf("@",m))&&(g=s.slice(0,y),s=s.slice(y+1),e.auth=decodeURIComponent(g)),m=-1,u=0;u<rr.length;u++)-1!==(f=s.indexOf(rr[u]))&&(-1===m||f<m)&&(m=f);-1===m&&(m=s.length),e.host=s.slice(0,m),s=s.slice(m),dr(e),e.hostname=e.hostname||"";var v="["===e.hostname[0]&&"]"===e.hostname[e.hostname.length-1];if(!v){var w=e.hostname.split(/\./);for(u=0,l=w.length;u<l;u++){var _=w[u];if(_&&!_.match(ir)){for(var S="",x=0,k=_.length;x<k;x++)_.charCodeAt(x)>127?S+="x":S+=_[x];if(!S.match(ir)){var E=w.slice(0,u),I=w.slice(u+1),O=_.match(or);O&&(E.push(O[1]),I.unshift(O[2])),I.length&&(s="/"+I.join(".")+s),e.hostname=E.join(".");break}}}}e.hostname.length>255?e.hostname="":e.hostname=e.hostname.toLowerCase(),v||(e.hostname=vt(e.hostname)),d=e.port?":"+e.port:"";var T=e.hostname||"";e.host=T+d,e.href+=e.host,v&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!ar[p])for(u=0,l=tr.length;u<l;u++){var A=tr[u];if(-1!==s.indexOf(A)){var P=encodeURIComponent(A);P===A&&(P=escape(A)),s=s.split(A).join(P)}}var C=s.indexOf("#");-1!==C&&(e.hash=s.substr(C),s=s.slice(0,C));var M=s.indexOf("?");if(-1!==M?(e.search=s.substr(M),e.query=s.substr(M+1),r&&(e.query=Gt(e.query)),s=s.slice(0,M)):r&&(e.search="",e.query={}),s&&(e.pathname=s),cr[p]&&e.hostname&&!e.pathname&&(e.pathname="/"),e.pathname||e.search){d=e.pathname||"";var R=e.search||"";e.path=d+R}return e.href=lr(e),e}function lr(e){var t=e.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var r=e.protocol||"",n=e.pathname||"",i=e.hash||"",o=!1,a="";e.host?o=t+e.host:e.hostname&&(o=t+(-1===e.hostname.indexOf(":")?e.hostname:"["+this.hostname+"]"),e.port&&(o+=":"+e.port)),e.query&&Dt(e.query)&&Object.keys(e.query).length&&(a=function(e,t,r,n){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Wt(Jt(e),(function(n){var i=encodeURIComponent(Kt(n))+r;return zt(e[n])?Wt(e[n],(function(e){return i+encodeURIComponent(Kt(e))})).join(t):i+encodeURIComponent(Kt(e[n]))})).join(t):""}(e.query));var s=e.search||a&&"?"+a||"";return r&&":"!==r.substr(-1)&&(r+=":"),e.slashes||(!r||cr[r])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),r+o+(n=n.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(s=s.replace("#","%23"))+i}function dr(e){var t=e.host,r=Qt.exec(t);r&&(":"!==(r=r[0])&&(e.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(e.hostname=t)}$t.prototype.parse=function(e,t,r){return fr(this,e,t,r)},$t.prototype.format=function(){return lr(this)},$t.prototype.resolve=function(e){return this.resolveObject(ur(e,!1,!0)).format()},$t.prototype.resolveObject=function(e){if(Nt(e)){var t=new $t;t.parse(e,!1,!0),e=t}for(var r,n=new $t,i=Object.keys(this),o=0;o<i.length;o++){var a=i[o];n[a]=this[a]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),c=0;c<s.length;c++){var u=s[c];"protocol"!==u&&(n[u]=e[u])}return cr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!cr[e.protocol]){for(var f=Object.keys(e),l=0;l<f.length;l++){var d=f[l];n[d]=e[d]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||sr[e.protocol])n.pathname=e.pathname;else{for(r=(e.pathname||"").split("/");r.length&&!(e.host=r.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==r[0]&&r.unshift(""),r.length<2&&r.unshift(""),n.pathname=r.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var h=n.pathname||"",p=n.search||"";n.path=h+p}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var b,g=n.pathname&&"/"===n.pathname.charAt(0),y=e.host||e.pathname&&"/"===e.pathname.charAt(0),m=y||g||n.host&&e.pathname,v=m,w=n.pathname&&n.pathname.split("/")||[],_=n.protocol&&!cr[n.protocol];if(r=e.pathname&&e.pathname.split("/")||[],_&&(n.hostname="",n.port=null,n.host&&(""===w[0]?w[0]=n.host:w.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===r[0]?r[0]=e.host:r.unshift(e.host)),e.host=null),m=m&&(""===r[0]||""===w[0])),y)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,w=r;else if(r.length)w||(w=[]),w.pop(),w=w.concat(r),n.search=e.search,n.query=e.query;else if(null!=e.search)return _&&(n.hostname=n.host=w.shift(),(b=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=b.shift(),n.host=n.hostname=b.shift())),n.search=e.search,n.query=e.query,Rt(n.pathname)&&Rt(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!w.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=w.slice(-1)[0],x=(n.host||e.host||w.length>1)&&("."===S||".."===S)||""===S,k=0,E=w.length;E>=0;E--)"."===(S=w[E])?w.splice(E,1):".."===S?(w.splice(E,1),k++):k&&(w.splice(E,1),k--);if(!m&&!v)for(;k--;k)w.unshift("..");!m||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),x&&"/"!==w.join("/").substr(-1)&&w.push("");var I=""===w[0]||w[0]&&"/"===w[0].charAt(0);return _&&(n.hostname=n.host=I?"":w.length?w.shift():"",(b=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=b.shift(),n.host=n.hostname=b.shift())),(m=m||n.host&&w.length)&&!I&&w.unshift(""),w.length?n.pathname=w.join("/"):(n.pathname=null,n.path=null),Rt(n.pathname)&&Rt(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},$t.prototype.parseHost=function(){return dr(this)};var hr,pr,br={},gr=Er(H.fetch)&&Er(H.ReadableStream);function yr(e){pr||(pr=new H.XMLHttpRequest).open("GET",H.location.host?"/":"https://example.com");try{return pr.responseType=e,pr.responseType===e}catch(e){return!1}}var mr=void 0!==H.ArrayBuffer,vr=mr&&Er(H.ArrayBuffer.prototype.slice),wr=mr&&yr("arraybuffer"),_r=!gr&&vr&&yr("ms-stream"),Sr=!gr&&mr&&yr("moz-chunked-arraybuffer"),xr=Er(pr.overrideMimeType),kr=Er(H.VBArray);function Er(e){return"function"==typeof e}function Ir(){}function Or(){Or.init.call(this)}function Tr(e){return void 0===e._maxListeners?Or.defaultMaxListeners:e._maxListeners}function Ar(e,t,r,n){var i,o,a,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]):(o=e._events=new Ir,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),!a.warned&&(i=Tr(e))&&i>0&&a.length>i){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=r,++e._eventsCount;return e}function Pr(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function Cr(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function Mr(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}function Rr(){this.head=null,this.tail=null,this.length=0}pr=null,Ir.prototype=Object.create(null),Or.EventEmitter=Or,Or.usingDomains=!1,Or.prototype.domain=void 0,Or.prototype._events=void 0,Or.prototype._maxListeners=void 0,Or.defaultMaxListeners=10,Or.init=function(){this.domain=null,Or.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Ir,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Or.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Or.prototype.getMaxListeners=function(){return Tr(this)},Or.prototype.emit=function(e){var t,r,n,i,o,a,s,c="error"===e;if(a=this._events)c=c&&null==a.error;else if(!c)return!1;if(s=this.domain,c){if(t=arguments[1],!s){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=a[e]))return!1;var f="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=Mr(e,n),o=0;o<n;++o)i[o].call(r)}(r,f,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,o=Mr(e,i),a=0;a<i;++a)o[a].call(r,n)}(r,f,this,arguments[1]);break;case 3:!function(e,t,r,n,i){if(t)e.call(r,n,i);else for(var o=e.length,a=Mr(e,o),s=0;s<o;++s)a[s].call(r,n,i)}(r,f,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,i,o){if(t)e.call(r,n,i,o);else for(var a=e.length,s=Mr(e,a),c=0;c<a;++c)s[c].call(r,n,i,o)}(r,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];!function(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,o=Mr(e,i),a=0;a<i;++a)o[a].apply(r,n)}(r,f,this,i)}return!0},Or.prototype.addListener=function(e,t){return Ar(this,e,t,!1)},Or.prototype.on=Or.prototype.addListener,Or.prototype.prependListener=function(e,t){return Ar(this,e,t,!0)},Or.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,Pr(this,e,t)),this},Or.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,Pr(this,e,t)),this},Or.prototype.removeListener=function(e,t){var r,n,i,o,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new Ir:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new Ir,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,a||t)}return this},Or.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new Ir,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new Ir:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o<i.length;++o)"removeListener"!==(n=i[o])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new Ir,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},Or.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[]},Or.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Cr.call(e,t)},Or.prototype.listenerCount=Cr,Or.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]},Rr.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},Rr.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},Rr.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},Rr.prototype.clear=function(){this.head=this.tail=null,this.length=0},Rr.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},Rr.prototype.concat=function(e){if(0===this.length)return te.alloc(0);if(1===this.length)return this.head.data;for(var t=te.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t};var Nr=te.isEncoding||function(e){switch(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 Lr(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!Nr(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=Dr;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Br;break;default:return void(this.write=jr)}this.charBuffer=new te(6),this.charReceived=0,this.charLength=0}function jr(e){return e.toString(this.encoding)}function Dr(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function Br(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}Lr.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived<this.charLength)return"";if(e=e.slice(r,e.length),!((n=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&n<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var n,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(n=t.charCodeAt(i))>=55296&&n<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},Lr.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},Lr.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t};var Ur=Object.freeze({__proto__:null,StringDecoder:Lr});Vr.ReadableState=Fr;var Hr=function(e){return Lt(kt)&&(kt=""),e=e.toUpperCase(),Et[e]||(new RegExp("\\b"+e+"\\b","i").test(kt)?Et[e]=function(){var t=St.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:Et[e]=function(){}),Et[e]}("stream");function Fr(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof gn&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.buffer=new Rr,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.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new Lr(e.encoding),this.encoding=e.encoding)}function Vr(e){if(!(this instanceof Vr))return new Vr(e);this._readableState=new Fr(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),Or.call(this)}function qr(e,t,r,n,i){var o=function(e,t){var r=null;return De(t)||"string"==typeof t||null==t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}(t,r);if(o)e.emit("error",o);else if(null===r)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,Kr(e)}}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var c;!t.decoder||i||n||(r=t.decoder.write(r),c=!t.objectMode&&0===r.length),i||(t.reading=!1),c||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Kr(e))),function(e,t){t.readingMore||(t.readingMore=!0,Ye(Jr,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}function zr(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Kr(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Hr("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Ye(Wr,e):Wr(e))}function Wr(e){Hr("emit readable"),e.emit("readable"),$r(e)}function Jr(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(Hr("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function Gr(e){Hr("readable nexttick read 0"),e.read(0)}function Xr(e,t){t.reading||(Hr("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),$r(e),t.flowing&&!t.reading&&e.read(0)}function $r(e){var t=e._readableState;for(Hr("flow",t.flowing);t.flowing&&null!==e.read(););}function Yr(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;return e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,n=1,i=r.data;for(e-=i.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0==(e-=a)){a===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=te.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0==(e-=a)){a===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++i}return t.length-=i,r}(e,t),n}(e,t.buffer,t.decoder),r);var r}function Qr(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Ye(Zr,t,e))}function Zr(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function en(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function tn(){}function rn(e,t,r){this.chunk=e,this.encoding=t,this.callback=r,this.next=null}function nn(e,t){Object.defineProperty(this,"buffer",{get:xt((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof gn&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?Ye(i,n):i(n),e._writableState.errorEmitted=!0,e.emit("error",n)}(e,r,n,t,i);else{var o=un(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||cn(e,r),n?Ye(sn,e,r,o,i):sn(e,r,o,i)}}(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 dn(this)}function on(e){if(!(this instanceof on||this instanceof gn))return new on(e);this._writableState=new nn(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),Or.call(this)}function an(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function sn(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),ln(e,t)}function cn(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0;r;)i[a]=r,r=r.next,a+=1;an(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 dn(t)}else{for(;r;){var s=r.chunk,c=r.encoding,u=r.callback;if(an(e,t,!1,t.objectMode?1:s.length,s,c,u),r=r.next,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=r,t.bufferProcessing=!1}function un(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function fn(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function ln(e,t){var r=un(t);return r&&(0===t.pendingcb?(fn(e,t),t.finished=!0,e.emit("finish")):fn(e,t)),r}function dn(e){var t=this;this.next=null,this.entry=null,this.finish=function(r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}wt(Vr,Or),Vr.prototype.push=function(e,t){var r=this._readableState;return r.objectMode||"string"!=typeof e||(t=t||r.defaultEncoding)!==r.encoding&&(e=te.from(e,t),t=""),qr(this,r,e,t,!1)},Vr.prototype.unshift=function(e){return qr(this,this._readableState,e,"",!0)},Vr.prototype.isPaused=function(){return!1===this._readableState.flowing},Vr.prototype.setEncoding=function(e){return this._readableState.decoder=new Lr(e),this._readableState.encoding=e,this},Vr.prototype.read=function(e){Hr("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return Hr("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Qr(this):Kr(this),null;if(0===(e=zr(e,t))&&t.ended)return 0===t.length&&Qr(this),null;var n,i=t.needReadable;return Hr("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&Hr("length less than watermark",i=!0),t.ended||t.reading?Hr("reading or ended",i=!1):i&&(Hr("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=zr(r,t))),null===(n=e>0?Yr(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Qr(this)),null!==n&&this.emit("data",n),n},Vr.prototype._read=function(e){this.emit("error",new Error("not implemented"))},Vr.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,Hr("pipe count=%d opts=%j",n.pipesCount,t);var i=t&&!1===t.end?u:a;function o(e){Hr("onunpipe"),e===r&&u()}function a(){Hr("onend"),e.end()}n.endEmitted?Ye(i):r.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;Hr("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,$r(e))}}(r);e.on("drain",s);var c=!1;function u(){Hr("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",d),e.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",u),r.removeListener("data",l),c=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var f=!1;function l(t){Hr("ondata"),f=!1,!1!==e.write(t)||f||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==en(n.pipes,e))&&!c&&(Hr("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,f=!0),r.pause())}function d(t){Hr("onerror",t),b(),e.removeListener("error",d),0===("error",e.listeners("error").length)&&e.emit("error",t)}function h(){e.removeListener("finish",p),b()}function p(){Hr("onfinish"),e.removeListener("close",h),b()}function b(){Hr("unpipe"),r.unpipe(e)}return r.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",h),e.once("finish",p),e.emit("pipe",r),n.flowing||(Hr("pipe resume"),r.resume()),e},Vr.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<n;i++)r[i].emit("unpipe",this);return this}var o=en(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},Vr.prototype.on=function(e,t){var r=Or.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&Kr(this):Ye(Gr,this))}return r},Vr.prototype.addListener=Vr.prototype.on,Vr.prototype.resume=function(){var e=this._readableState;return e.flowing||(Hr("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Ye(Xr,e,t))}(this,e)),this},Vr.prototype.pause=function(){return Hr("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(Hr("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Vr.prototype.wrap=function(e){var t=this._readableState,r=!1,n=this;for(var i in e.on("end",(function(){if(Hr("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&n.push(e)}n.push(null)})),e.on("data",(function(i){Hr("wrapped data"),t.decoder&&(i=t.decoder.write(i)),t.objectMode&&null==i||(t.objectMode||i&&i.length)&&(n.push(i)||(r=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));return function(e,t){for(var r=0,n=e.length;r<n;r++)t(e[r])}(["error","close","destroy","pause","resume"],(function(t){e.on(t,n.emit.bind(n,t))})),n._read=function(t){Hr("wrapped _read",t),r&&(r=!1,e.resume())},n},Vr._fromList=Yr,on.WritableState=nn,wt(on,Or),nn.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},on.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},on.prototype.write=function(e,t,r){var n=this._writableState,i=!1;return"function"==typeof t&&(r=t,t=null),te.isBuffer(e)?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=tn),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),Ye(t,r)}(this,r):function(e,t,r,n){var i=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):te.isBuffer(r)||"string"==typeof r||void 0===r||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),Ye(n,o),i=!1),i}(this,n,e,r)&&(n.pendingcb++,i=function(e,t,r,n,i){r=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=te.from(t,r)),t}(t,r,n),te.isBuffer(r)&&(n="buffer");var o=t.objectMode?1:r.length;t.length+=o;var a=t.length<t.highWaterMark;if(a||(t.needDrain=!0),t.writing||t.corked){var s=t.lastBufferedRequest;t.lastBufferedRequest=new rn(r,n,i),s?s.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else an(e,t,!1,o,r,n,i);return a}(this,n,e,t,r)),i},on.prototype.cork=function(){this._writableState.corked++},on.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||cn(this,e))},on.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},on.prototype._write=function(e,t,r){r(new Error("not implemented"))},on.prototype._writev=null,on.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,ln(e,t),r&&(t.finished?Ye(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r)},wt(gn,Vr);for(var hn=Object.keys(on.prototype),pn=0;pn<hn.length;pn++){var bn=hn[pn];gn.prototype[bn]||(gn.prototype[bn]=on.prototype[bn])}function gn(e){if(!(this instanceof gn))return new gn(e);Vr.call(this,e),on.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",yn)}function yn(){this.allowHalfOpen||this._writableState.ended||Ye(mn,this)}function mn(e){e.end()}function vn(e){this.afterTransform=function(t,r){return function(e,t,r){var n=e._transformState;n.transforming=!1;var i=n.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,null!=r&&e.push(r),i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}(e,t,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function wn(e){if(!(this instanceof wn))return new wn(e);gn.call(this,e),this._transformState=new vn(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(e){_n(t,e)})):_n(t)}))}function _n(e,t){if(t)return e.emit("error",t);var r=e._writableState,n=e._transformState;if(r.length)throw new Error("Calling transform done when ws.length != 0");if(n.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}function Sn(e){if(!(this instanceof Sn))return new Sn(e);wn.call(this,e)}function xn(){Or.call(this)}wt(wn,gn),wn.prototype.push=function(e,t){return this._transformState.needTransform=!1,gn.prototype.push.call(this,e,t)},wn.prototype._transform=function(e,t,r){throw new Error("Not implemented")},wn.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},wn.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},wt(Sn,wn),Sn.prototype._transform=function(e,t,r){r(null,e)},wt(xn,Or),xn.Readable=Vr,xn.Writable=on,xn.Duplex=gn,xn.Transform=wn,xn.PassThrough=Sn,xn.Stream=xn,xn.prototype.pipe=function(e,t){var r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",i),e._isStdio||t&&!1===t.end||(r.on("end",a),r.on("close",s));var o=!1;function a(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){if(u(),0===Or.listenerCount(this,"error"))throw e}function u(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",u),r.removeListener("close",u),e.removeListener("close",u)}return r.on("error",c),e.on("error",c),r.on("end",u),r.on("close",u),e.on("close",u),e.emit("pipe",r),e};function kn(e,t,r){var n,i=this;if(Vr.call(i),i._mode=r,i.headers={},i.rawHeaders=[],i.trailers={},i.rawTrailers=[],i.on("end",(function(){Ye((function(){i.emit("close")}))})),"fetch"===r){i._fetchResponse=t,i.url=t.url,i.statusCode=t.status,i.statusMessage=t.statusText;for(var o,a,s=t.headers[Symbol.iterator]();o=(a=s.next()).value,!a.done;)i.headers[o[0].toLowerCase()]=o[1],i.rawHeaders.push(o[0],o[1]);var c=t.body.getReader();(n=function(){c.read().then((function(e){i._destroyed||(e.done?i.push(null):(i.push(new te(e.value)),n()))}))})()}else if(i._xhr=e,i._pos=0,i.url=e.responseURL,i.statusCode=e.status,i.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===i.headers[r]&&(i.headers[r]=[]),i.headers[r].push(t[2])):void 0!==i.headers[r]?i.headers[r]+=", "+t[2]:i.headers[r]=t[2],i.rawHeaders.push(t[1],t[2])}})),i._charset="x-user-defined",!xr){var u=i.rawHeaders["mime-type"];if(u){var f=u.match(/;\s*charset=([^;])(;|$)/);f&&(i._charset=f[1].toLowerCase())}i._charset||(i._charset="utf-8")}}function En(e){var t,r=this;on.call(r),r._opts=e,r._body=[],r._headers={},e.auth&&r.setHeader("Authorization","Basic "+new te(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(t){r.setHeader(t,e.headers[t])}));var n=!0;if("disable-fetch"===e.mode)n=!1,t=!0;else if("prefer-streaming"===e.mode)t=!1;else if("allow-wrong-content-type"===e.mode)t=!xr;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");t=!0}r._mode=function(e,t){return gr&&t?"fetch":Sr?"moz-chunked-arraybuffer":_r?"ms-stream":wr&&e?"arraybuffer":kr&&e?"text:vbarray":"text"}(t,n),r.on("finish",(function(){r._onFinish()}))}wt(kn,Vr),kn.prototype._read=function(){},kn.prototype._onXHRProgress=function(){var e=this,t=e._xhr,r=null;switch(e._mode){case"text:vbarray":if(4!==t.readyState)break;try{r=new H.VBArray(t.responseBody).toArray()}catch(e){}if(null!==r){e.push(new te(r));break}case"text":try{r=t.responseText}catch(t){e._mode="text:vbarray";break}if(r.length>e._pos){var n=r.substr(e._pos);if("x-user-defined"===e._charset){for(var i=new te(n.length),o=0;o<n.length;o++)i[o]=255&n.charCodeAt(o);e.push(i)}else e.push(n,e._charset);e._pos=r.length}break;case"arraybuffer":if(4!==t.readyState||!t.response)break;r=t.response,e.push(new te(new Uint8Array(r)));break;case"moz-chunked-arraybuffer":if(r=t.response,3!==t.readyState||!r)break;e.push(new te(new Uint8Array(r)));break;case"ms-stream":if(r=t.response,3!==t.readyState)break;var a=new H.MSStreamReader;a.onprogress=function(){a.result.byteLength>e._pos&&(e.push(new te(new Uint8Array(a.result.slice(e._pos)))),e._pos=a.result.byteLength)},a.onload=function(){e.push(null)},a.readAsArrayBuffer(r)}4===e._xhr.readyState&&"ms-stream"!==e._mode&&e.push(null)},wt(En,on);var In=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];function On(e,t){"string"==typeof e&&(e=ur(e));var r=-1===H.location.protocol.search(/^https?:$/)?"http:":"",n=e.protocol||r,i=e.hostname||e.host,o=e.port,a=e.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(o?":"+o:"")+a,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var s=new En(e);return t&&s.on("response",t),s}function Tn(){}En.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===In.indexOf(r)&&(this._headers[r]={name:e,value:t})},En.prototype.getHeader=function(e){return this._headers[e.toLowerCase()].value},En.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},En.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t,r=e._opts,n=e._headers;if("POST"!==r.method&&"PUT"!==r.method&&"PATCH"!==r.method||(t=function(){if(void 0!==hr)return hr;try{new H.Blob([new ArrayBuffer(1)]),hr=!0}catch(e){hr=!1}return hr}()?new H.Blob(e._body.map((function(e){return function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(De(e)){for(var t=new Uint8Array(e.length),r=e.length,n=0;n<r;n++)t[n]=e[n];return t.buffer}throw new Error("Argument must be a Buffer")}(e)})),{type:(n["content-type"]||{}).value||""}):te.concat(e._body).toString()),"fetch"===e._mode){var i=Object.keys(n).map((function(e){return[n[e].name,n[e].value]}));H.fetch(e._opts.url,{method:e._opts.method,headers:i,body:t,mode:"cors",credentials:r.withCredentials?"include":"same-origin"}).then((function(t){e._fetchResponse=t,e._connect()}),(function(t){e.emit("error",t)}))}else{var o=e._xhr=new H.XMLHttpRequest;try{o.open(e._opts.method,e._opts.url,!0)}catch(t){return void Ye((function(){e.emit("error",t)}))}"responseType"in o&&(o.responseType=e._mode.split(":")[0]),"withCredentials"in o&&(o.withCredentials=!!r.withCredentials),"text"===e._mode&&"overrideMimeType"in o&&o.overrideMimeType("text/plain; charset=x-user-defined"),Object.keys(n).forEach((function(e){o.setRequestHeader(n[e].name,n[e].value)})),e._response=null,o.onreadystatechange=function(){switch(o.readyState){case 3:case 4:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(o.onprogress=function(){e._onXHRProgress()}),o.onerror=function(){e._destroyed||e.emit("error",new Error("XHR error"))};try{o.send(t)}catch(t){return void Ye((function(){e.emit("error",t)}))}}}},En.prototype._onXHRProgress=function(){var e=this;(function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}})(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress())},En.prototype._connect=function(){var e=this;e._destroyed||(e._response=new kn(e._xhr,e._fetchResponse,e._mode),e.emit("response",e._response))},En.prototype._write=function(e,t,r){this._body.push(e),r()},En.prototype.abort=En.prototype.destroy=function(){var e=this;e._destroyed=!0,e._response&&(e._response._destroyed=!0),e._xhr&&e._xhr.abort()},En.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),on.prototype.end.call(this,e,t,r)},En.prototype.flushHeaders=function(){},En.prototype.setTimeout=function(){},En.prototype.setNoDelay=function(){},En.prototype.setSocketKeepAlive=function(){},Tn.defaultMaxSockets=4;var An={request:On,get:function(e,t){var r=On(e,t);return r.end(),r},Agent:Tn,METHODS:["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],STATUS_CODES:{100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},Pn=br.spawn,Cn=function(){var e,t,r=this,n=An,i=An,o={},a=!1,s={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},c={},u={},f=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],l=["TRACE","TRACK","CONNECT"],d=!1,h=!1,p={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.status=null,this.statusText=null,this.withCredentials=!1,this.open=function(e,t,r,n,i){if(this.abort(),h=!1,!function(e){return e&&-1===l.indexOf(e)}(e))throw new Error("SecurityError: Request method not allowed");o={method:e,url:t.toString(),async:"boolean"!=typeof r||r,user:n||null,password:i||null},b(this.OPENED)},this.setDisableHeaderCheck=function(e){a=e},this.setRequestHeader=function(e,t){if(this.readyState!==this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(function(e){return a||e&&-1===f.indexOf(e.toLowerCase())}(e)){if(d)throw new Error("INVALID_STATE_ERR: send flag is true");e=u[e.toLowerCase()]||e,u[e.toLowerCase()]=e,c[e]=c[e]?c[e]+", "+t:t}else console.warn('Refused to set unsafe header "'+e+'"')},this.getResponseHeader=function(e){return"string"==typeof e&&this.readyState>this.OPENED&&t&&t.headers&&t.headers[e.toLowerCase()]&&!h?t.headers[e.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||h)return"";var e="";for(var r in t.headers)"set-cookie"!==r&&"set-cookie2"!==r&&(e+=r+": "+t.headers[r]+"\r\n");return e.substr(0,e.length-2)},this.getRequestHeader=function(e){return"string"==typeof e&&u[e.toLowerCase()]?c[u[e.toLowerCase()]]:""},this.send=function(a){if(this.readyState!==this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(d)throw new Error("INVALID_STATE_ERR: send has already been called");var f,l=!1,p=!1,g=Xt.parse(o.url);switch(g.protocol){case"https:":l=!0;case"http:":f=g.hostname;break;case"file:":p=!0;break;case void 0:case null:case"":f="localhost";break;default:throw new Error("Protocol not supported.")}if(p){if("GET"!==o.method)throw new Error("XMLHttpRequest: Only GET method is supported");if(o.async)br.readFile(g.pathname,"utf8",(function(e,t){e?r.handleError(e):(r.status=200,r.responseText=t,b(r.DONE))}));else try{this.responseText=br.readFileSync(g.pathname,"utf8"),this.status=200,b(r.DONE)}catch(e){this.handleError(e)}}else{var y=g.port||(l?443:80),m=g.pathname+(g.search?g.search:"");for(var v in s)u[v.toLowerCase()]||(c[v]=s[v]);if(c.Host=f,l&&443===y||80===y||(c.Host+=":"+g.port),o.user){void 0===o.password&&(o.password="");var w=new te(o.user+":"+o.password);c.Authorization="Basic "+w.toString("base64")}"GET"===o.method||"HEAD"===o.method?a=null:a?(c["Content-Length"]=De(a)?a.length:te.byteLength(a),c["Content-Type"]||(c["Content-Type"]="text/plain;charset=UTF-8")):"POST"===o.method&&(c["Content-Length"]=0);var _={host:f,port:y,path:m,method:o.method,headers:c,agent:!1,withCredentials:r.withCredentials};if(h=!1,o.async){var S=l?i.request:n.request;d=!0,r.dispatchEvent("readystatechange");var x=function(e){r.handleError(e)};e=S(_,(function n(i){if(301!==(t=i).statusCode&&302!==t.statusCode&&303!==t.statusCode&&307!==t.statusCode)t.setEncoding("utf8"),b(r.HEADERS_RECEIVED),r.status=t.statusCode,t.on("data",(function(e){e&&(r.responseText+=e),d&&b(r.LOADING)})),t.on("end",(function(){d&&(b(r.DONE),d=!1)})),t.on("error",(function(e){r.handleError(e)}));else{o.url=t.headers.location;var a=Xt.parse(o.url);f=a.hostname;var s={hostname:a.hostname,port:a.port,path:a.path,method:303===t.statusCode?"GET":o.method,headers:c,withCredentials:r.withCredentials};(e=S(s,n).on("error",x)).end()}})).on("error",x),a&&e.write(a),e.end(),r.dispatchEvent("loadstart")}else{var k=".node-xmlhttprequest-content-"+ft.pid,E=".node-xmlhttprequest-sync-"+ft.pid;br.writeFileSync(E,"","utf8");for(var I="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(l?"s":"")+".request;var options = "+JSON.stringify(_)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+k+"', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText}}), 'utf8');fs.unlinkSync('"+E+"');});response.on('error', function(error) {fs.writeFileSync('"+k+"', JSON.stringify({err: error}), 'utf8');fs.unlinkSync('"+E+"');});}).on('error', function(error) {fs.writeFileSync('"+k+"', JSON.stringify({err: error}), 'utf8');fs.unlinkSync('"+E+"');});"+(a?"req.write('"+JSON.stringify(a).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",O=Pn(ft.argv[0],["-e",I]);br.existsSync(E););var T=JSON.parse(br.readFileSync(k,"utf8"));O.stdin.end(),br.unlinkSync(k),T.err?r.handleError(T.err):(t=T.data,r.status=T.data.statusCode,r.responseText=T.data.text,b(r.DONE))}}},this.handleError=function(e){this.status=0,this.statusText=e,this.responseText=e.stack,h=!0,b(this.DONE),this.dispatchEvent("error")},this.abort=function(){e&&(e.abort(),e=null),c=s,this.status=0,this.responseText="",this.responseXML="",h=!0,this.readyState===this.UNSENT||this.readyState===this.OPENED&&!d||this.readyState===this.DONE||(d=!1,b(this.DONE)),this.readyState=this.UNSENT,this.dispatchEvent("abort")},this.addEventListener=function(e,t){e in p||(p[e]=[]),p[e].push(t)},this.removeEventListener=function(e,t){e in p&&(p[e]=p[e].filter((function(e){return e!==t})))},this.dispatchEvent=function(e){if("function"==typeof r["on"+e]&&r["on"+e](),e in p)for(var t=0,n=p[e].length;t<n;t++)p[e][t].call(r)};var b=function(e){e!=r.LOADING&&r.readyState===e||(r.readyState=e,(o.async||r.readyState<r.OPENED||r.readyState===r.DONE)&&r.dispatchEvent("readystatechange"),r.readyState!==r.DONE||h||(r.dispatchEvent("load"),r.dispatchEvent("loadend")))}},Mn=6e4,Rn=60*Mn,Nn=24*Rn,Ln=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return r*Nn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Rn;case"minutes":case"minute":case"mins":case"min":case"m":return r*Mn;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);return t>=Nn?jn(e,t,Nn,"day"):t>=Rn?jn(e,t,Rn,"hour"):t>=Mn?jn(e,t,Mn,"minute"):t>=1e3?jn(e,t,1e3,"second"):e+" ms"}(e):function(e){var t=Math.abs(e);return t>=Nn?Math.round(e/Nn)+"d":t>=Rn?Math.round(e/Rn)+"h":t>=Mn?Math.round(e/Mn)+"m":t>=1e3?Math.round(e/1e3)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function jn(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}var Dn=N((function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==ft&&"env"in ft&&(e=ft.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=function(e){function t(e){let n,i=null;function o(...e){if(!o.enabled)return;const r=o,i=Number(new Date),a=i-(n||i);r.diff=a,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];n=o.call(r,t),e.splice(s,1),s--}return n})),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=r,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null===i?t.enabled(e):i,set:e=>{i=e}}),"function"==typeof t.init&&t.init(o),o}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Ln,t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}));Dn.formatArgs,Dn.save,Dn.load,Dn.useColors,Dn.storage,Dn.destroy,Dn.colors,Dn.log;const Bn=Dn("request");function Un(e){return new Promise(((t,r)=>{let n=e.url;n||r(new Error("URL is missing")),"http://"===n.substr(0,7)&&(console.warn(`Upgrading requested url ${n} to https protocol.`),n=n.replace("http://","https://"));const i=new("undefined"==typeof XMLHttpRequest?Cn:XMLHttpRequest);i.onload=()=>{if(i.status>=200&&i.status<300)t(i.responseText);else{const e=`Error fetching url:${n}; status code:${i.status}`;r(new Error(e))}},i.ontimeout=e=>{console.log("ontimeout",e)},i.onreadystatechange=()=>{404===i.status&&r(new Error(`Error fetching url:${n}; status code:${i.status}`))},i.onerror=()=>{Bn(`Request failed with error ${i.responseText}`),r(new Error(i.responseText))},i.open(e.method||"GET",n),e.body?i.send(JSON.stringify(e.body)):i.send()}))}var Hn,Fn;!function(e){e.blockcypher="blockcypher",e.blockstream="blockstream",e.etherscan="etherscan"}(Hn||(Hn={})),function(e){e.Bitcoin="bitcoin",e.Ethmain="ethmain",e.Ethropst="ethropst",e.Ethrinkeby="ethrinkeby",e.Mocknet="mocknet",e.Regtest="regtest",e.Testnet="testnet"}(Fn||(Fn={}));const Vn={[Fn.Bitcoin]:{code:Fn.Bitcoin,name:"Bitcoin",prefixes:["6a20","OP_RETURN "],signatureValue:"bitcoinMainnet",transactionTemplates:{full:"https://blockchain.info/tx/{transaction_id}",raw:"https://blockchain.info/rawtx/{transaction_id}"}},[Fn.Ethmain]:{code:Fn.Ethmain,name:"Ethereum",prefixes:["0x"],signatureValue:"ethereumMainnet",transactionTemplates:{full:"https://etherscan.io/tx/{transaction_id}",raw:"https://etherscan.io/tx/{transaction_id}"}},[Fn.Ethropst]:{code:Fn.Ethropst,name:"Ethereum Testnet",signatureValue:"ethereumRopsten",transactionTemplates:{full:"https://ropsten.etherscan.io/tx/{transaction_id}",raw:"https://ropsten.etherscan.io/getRawTx?tx={transaction_id}"}},[Fn.Ethrinkeby]:{code:Fn.Ethrinkeby,name:"Ethereum Testnet",signatureValue:"ethereumRinkeby",transactionTemplates:{full:"https://rinkeby.etherscan.io/tx/{transaction_id}",raw:"https://rinkeby.etherscan.io/getRawTx?tx={transaction_id}"}},[Fn.Mocknet]:{code:Fn.Mocknet,name:"Mocknet",test:!0,signatureValue:"mockchain",transactionTemplates:{full:"",raw:""}},[Fn.Regtest]:{code:Fn.Regtest,name:"Mocknet",test:!0,signatureValue:"bitcoinRegtest",transactionTemplates:{full:"",raw:""}},[Fn.Testnet]:{code:Fn.Testnet,name:"Bitcoin Testnet",signatureValue:"bitcoinTestnet",transactionTemplates:{full:"https://testnet.blockchain.info/tx/{transaction_id}",raw:"https://testnet.blockchain.info/rawtx/{transaction_id}"}}};function qn(e){return e!==Vn.bitcoin.code&&e!==Vn.ethmain.code}const zn=1;var Kn=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};function Wn(e,t,r=[]){return Kn(this,void 0,void 0,(function*(){if((e=Array.from(e)).length<t)throw new Error("Could not retrieve tx data");const n=e.map(((e,t)=>e.then((()=>t)).catch((e=>{throw t}))));return Promise.race(n).then((n=>(e.splice(n,1)[0].then((e=>r.push(e))),1===t?r:Wn(e,t-1,r)))).catch((n=>(e.splice(n,1),Wn(e,t,r))))}))}function Jn({explorerAPI:e,transactionIdPlaceholder:t="{transaction_id}",transactionId:r="",isTestApi:n=!1}){const{serviceURL:i}=e;let o="string"==typeof i?i:n?i.test:i.main;return o=o.replace(t,r),o=function(e,t){if(!t.key)return e;if(t.key&&!t.keyPropertyName)throw new Error(`No keyPropertyName defined for explorerAPI ${t.serviceName}`);return function(e,t,r){const n=e.includes("?")?"&":"?";return`${e}${n}${t}=${r}`}(e,t.keyPropertyName,t.key)}(o,e),o}var Gn=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};function Xn(e){return Gn(this,void 0,void 0,(function*(){return yield new Promise(((t,r)=>{const n=e.url;n||r(new Error("URL is missing"));const i=new("undefined"==typeof XMLHttpRequest?Cn:XMLHttpRequest);i.onload=()=>{if(i.status>=200&&i.status<300)t(i.responseText);else{console.log(i.responseText);const e=`Error fetching url:${n}; status code:${i.status}`;r(new Error(e))}},i.ontimeout=e=>{console.log("ontimeout",e)},i.onreadystatechange=()=>{404===i.status&&r(new Error(`Error fetching url:${n}; status code:${i.status}`))},i.onerror=()=>{console.error(`Request failed with error ${i.responseText}`),r(new Error(i.responseText))},i.open(e.method||"GET",n),e.body?i.send(JSON.stringify(e.body)):i.send()}))}))}function $n(e,t){return"string"!=typeof e?(console.warn("Trying to test a non string variable"),!1):0===e.indexOf(t)}function Yn(e,t){for(let r=0;r<t.length;r++){const n=t[r];if($n(e,n))return e.slice(n.length)}return e}var Qn=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const Zn="https://api.etherscan.io/api?module=proxy",ei="https://api-ropsten.etherscan.io/api?module=proxy",ti={serviceURL:{main:`${Zn}&action=eth_getTransactionByHash&txhash={transaction_id}`,test:`${ei}&action=eth_getTransactionByHash&txhash={transaction_id}`},serviceName:Hn.etherscan,parsingFunction:function({jsonResponse:e,chain:t,key:r,keyPropertyName:n}){return Qn(this,void 0,void 0,(function*(){const i={serviceURL:{main:`${Zn}&action=eth_getBlockByNumber&boolean=true&tag={transaction_id}`,test:`${ei}&action=eth_getBlockByNumber&boolean=true&tag={transaction_id}`}},o={serviceURL:{main:`${Zn}&action=eth_blockNumber`,test:`${ei}&action=eth_blockNumber`}},a=yield function(e,t){return Qn(this,void 0,void 0,(function*(){const a=e.result.blockNumber,s=Jn({explorerAPI:Object.assign(Object.assign({},i),{key:r,keyPropertyName:n}),transactionId:a,isTestApi:qn(t)});try{const e=yield Xn({url:s}),i=JSON.parse(e).result;return yield function(e,t){return Qn(this,void 0,void 0,(function*(){const i=Jn({explorerAPI:Object.assign(Object.assign({},o),{key:r,keyPropertyName:n}),isTestApi:qn(e)});let a;try{a=yield Xn({url:i})}catch(e){throw new Error("Unable to get remote hash")}const s=JSON.parse(a).result;if(s-t<1)throw new Error("Not enough");return s}))}(t,a),i}catch(e){throw new Error("Unable to get remote hash")}}))}(e,t);return function(e,t){const r=e.result,n=new Date(1e3*parseInt(t.timestamp,16)),i=r.from;return{remoteHash:Yn(r.input,Vn.ethmain.prefixes),issuingAddress:i,time:n,revokedAddresses:[]}}(e,a)}))},priority:-1};function ri(e){return""===e?"":function(e){const t=Date.parse(e);if(t)return new Date(t);const r=function(e){let t=e.slice(0,-5).split(/\D/).map((function(e){return parseInt(e,10)||0}));t[1]-=1,t=new Date(Date.UTC.apply(Date,t));const r=e.slice(-5);let n=parseInt(r,10)/100;return"+"===r.slice(0,1)&&(n*=-1),t.setHours(t.getHours()+n),t.getTime()}(e);return r||function(e){let t,r;const n=/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*)?)([zZ]|([+\-])(\d\d):?(\d\d))?$/.exec(e)||[];return n[1]?(t=n[1].split(/\D/).map((function(e){return parseInt(e,10)||0})),t[1]-=1,t=new Date(Date.UTC.apply(Date,t)),t.getDate()?(n[5]&&(r=parseInt(n[5],10)/100*60,n[6]&&(r+=parseInt(n[6],10)),"+"===n[4]&&(r*=-1),r&&t.setUTCMinutes(t.getUTCMinutes()+r)),t):null):null}(e)}(`${e}`)}function ni(e){return new Date(1e3*e)}const ii={serviceURL:{main:"https://api.blockcypher.com/v1/eth/main/txs/{transaction_id}?limit=500",test:"https://api.blockcypher.com/v1/beth/test/txs/{transaction_id}?limit=500"},serviceName:Hn.blockcypher,parsingFunction:function({jsonResponse:e}){if(e.confirmations<1)throw new Error("Not enough");const t=ri(e.received),r=e.outputs,n=r[r.length-1];let i=e.inputs[0].addresses[0];const o=Yn(n.script,Vn.ethmain.prefixes);return i=function(e,t){for(let r=0;r<t.length;r++){const n=t[r];if(!$n(e,n))return`${n}${e}`}return e}(i,Vn.ethmain.prefixes),{remoteHash:o,issuingAddress:i,time:t,revokedAddresses:r.filter((e=>!!e.spent_by)).map((e=>e.addresses[0]))}},priority:-1},oi={serviceURL:{main:"https://blockstream.info/api/tx/{transaction_id}",test:"https://blockstream.info/testnet/api/tx/{transaction_id}"},serviceName:Hn.blockstream,parsingFunction:function({jsonResponse:e}){if(!e.status.confirmed)throw new Error("Number of transaction confirmations were less than the minimum required, according to Blockstream API");const t=ni(e.status.block_time),r=e.vout,n=r[r.length-1],i=e.vout[0].scriptpubkey_address;return{remoteHash:Yn(n.scriptpubkey,Vn.bitcoin.prefixes),issuingAddress:i,time:t,revokedAddresses:r.filter((e=>!!e.scriptpubkey_address)).map((e=>e.scriptpubkey_address))}},priority:-1},ai={serviceURL:{main:"https://api.blockcypher.com/v1/btc/main/txs/{transaction_id}?limit=500",test:"https://api.blockcypher.com/v1/btc/test3/txs/{transaction_id}?limit=500"},serviceName:Hn.blockcypher,parsingFunction:function({jsonResponse:e}){if(e.confirmations<1)throw new Error("Number of transaction confirmations were less than the minimum required, according to Blockcypher API");const t=ri(e.received),r=e.outputs,n=r[r.length-1],i=e.inputs[0].addresses[0];return{remoteHash:Yn(n.script,Vn.bitcoin.prefixes),issuingAddress:i,time:t,revokedAddresses:r.filter((e=>!!e.spent_by)).map((e=>e.addresses[0]))}},priority:-1};var si=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};function ci(e){return e.map((e=>({getTxData:(t,r)=>si(this,void 0,void 0,(function*(){return yield function(e,t,r){return si(this,void 0,void 0,(function*(){const n=Jn({explorerAPI:e,transactionId:t,isTestApi:qn(r)});try{const t=yield Xn({url:n});return yield e.parsingFunction(Object.assign({jsonResponse:JSON.parse(t),chain:r},e))}catch(e){throw new Error("Unable to get remote hash")}}))}(e,t,r)})),priority:e.priority})))}const ui=[ai,oi],fi=[ti,ii];var li=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};function di({serviceUrl:e,transactionId:t}){return li(this,void 0,void 0,(function*(){const r={method:"eth_getTransactionByHash",jsonrpc:"2.0",id:"getbyhash",params:["0x"+t]},n=yield Xn({url:e,body:r,method:"POST"}),i=JSON.parse(n),o={method:"eth_getBlockByNumber",jsonrpc:"2.0",id:"blockbynumber",params:[i.result.blockNumber,!0]},a=yield Xn({url:e,body:o,method:"POST"}),s=JSON.parse(a),c=i.result,u=s.result,f=new Date(1e3*parseInt(u.timestamp,16)),l=c.from;return{remoteHash:Yn(c.input,["0x"]),issuingAddress:l,time:f,revokedAddresses:[]}}))}var hi=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};function pi({serviceUrl:e,transactionId:t}){return hi(this,void 0,void 0,(function*(){const r={method:"getrawtransaction",jsonrpc:"2.0",id:"rpctest",params:[t,!0]},n=yield Xn({url:e,body:r,method:"POST"}),i=JSON.parse(n).result;return{issuingAddress:i.vout[0].scriptPubKey.addresses[0],remoteHash:Yn(i.vout[1].scriptPubKey.asm,["6a20","OP_RETURN "]),time:ni(i.blocktime),revokedAddresses:i.vout.filter((e=>!!e.scriptPubKey.addresses)).map((e=>e.scriptPubKey.addresses)).flat()}}))}var bi=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const gi=[];function yi(e=[],t=[],r=!1){const n=e.map((e=>e.serviceName)).filter((e=>!!e)).filter((e=>!!Hn[e]));return n.length?t.reduce(((t,i)=>{if(n.includes(i.serviceName)){const r=Object.assign({},i),n=e.find((e=>e.serviceName===i.serviceName));if(function(e){if(e.key&&!e.keyPropertyName)throw new Error(`Property keyPropertyName is not set for ${e.serviceName}. Cannot pass the key property to the service.`);return!0}(n)){const i=Object.assign(r,n);t.push(i);const o=e.findIndex((e=>e.serviceName===i.serviceName));gi.includes(o)||gi.push(o)}}else t.push(i);return r&&function(e,t){gi.forEach((t=>e.splice(t,1)))}(e),t}),[]):t}function mi(e){return e.map((e=>(e.parsingFunction||(e.parsingFunction="btc"===e.chainType?pi:di),e))).map((e=>({getTxData:t=>bi(this,void 0,void 0,(function*(){return yield e.parsingFunction(Object.assign(Object.assign({},e),{transactionId:t}))})),priority:e.priority})))}var vi=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))};function wi(e,t){var r;switch(e){case Vn[Fn.Bitcoin].code:case Vn[Fn.Regtest].code:case Vn[Fn.Testnet].code:case Vn[Fn.Mocknet].code:return t.bitcoin;case Vn[Fn.Ethmain].code:case Vn[Fn.Ethropst].code:case Vn[Fn.Ethrinkeby].code:return t.ethereum;default:if(!(null===(r=t.custom)||void 0===r?void 0:r.length))throw new Error("Chain is not natively supported. Use custom explorers to retrieve tx data.");return t.custom}}function _i(e){return vi(this,void 0,void 0,(function*(){let t;try{t=yield Wn(e,zn)}catch(e){throw new Error(`Transaction lookup error: ${e.message}`)}if(!t||0===t.length)throw new Error("Could not confirm transaction data.");const r=t[0];for(let e=1;e<t.length;e++){const n=t[e];if(r.issuingAddress!==n.issuingAddress)throw new Error("Issuing addresses do not match consistently");if(r.remoteHash!==n.remoteHash)throw new Error("Remote hashes do not match consistently")}return r}))}function Si(e,t,r,n){return vi(this,void 0,void 0,(function*(){try{const i=function(e,t,r){if(zn>e.length)throw new Error("Invalid application configuration; check the CONFIG.MinimumBlockchainExplorers configuration value");const n=[],i=e.length;for(let o=0;o<i;o++)n.push(e[o].getTxData(t,r));return n}(e[t],r,n);return yield _i(i)}catch(i){if(t<e.length-1)return t++,yield Si(e,t,r,n);throw i}}))}function xi(e){return""===e?0:function(e){const t=Date.parse(e);if(t)return new Date(t);const r=function(e){let t=e.slice(0,-5).split(/\D/).map((function(e){return parseInt(e,10)||0}));t[1]-=1,t=new Date(Date.UTC.apply(Date,t));const r=e.slice(-5);let n=parseInt(r,10)/100;return"+"===r.slice(0,1)&&(n*=-1),t.setHours(t.getHours()+n),t}(e);return r||function(e){let t,r;const n=/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*)?)([zZ]|([+\-])(\d\d):?(\d\d))?$/.exec(e)||[];return n[1]?(t=n[1].split(/\D/).map((function(e){return parseInt(e,10)||0})),t[1]-=1,t=new Date(Date.UTC.apply(Date,t)),t.getDate()?(n[5]&&(r=parseInt(n[5],10)/100*60,n[6]&&(r+=parseInt(n[6],10)),"+"===n[4]&&(r*=-1),r&&t.setUTCMinutes(t.getUTCMinutes()+r)),t):null):null}(e)}(`${e}`).getTime()}function ki(e,t=null){const r=e.created?xi(e.created):null,n=e.revoked?xi(e.revoked):null,i=e.expires?xi(e.expires):null;let o=t;return t||(o=(e.id||e.publicKey).replace("ecdsa-koblitz-pubkey:","")),new T(o,r,n,i)}var Ei={addresses:_,certificates:U,chains:C,i18n:E,verifier:Object.freeze({__proto__:null,getIssuerProfile:function(t){return e(this,void 0,void 0,(function*(){const e=x("errors","getIssuerProfile");if(!t)throw new P("getIssuerProfile",`${e} - ${x("errors","issuerProfileNotSet")}`);if("object"==typeof t&&(t=t.id),!function(e){return/^(ftp|http|https):\/\/[^ "]+$/.test(e)}(t))throw new P("getIssuerProfile",`${e} - ${x("errors","issuerProfileNotSet")}`);let r=yield Un({url:t}).catch((()=>{throw new P("getIssuerProfile",e)}));if(r=JSON.parse(r),!function(e){const{issuer_key:t,revocation_key:r,issuerKeys:n,revocationKeys:i}=e;return!(!t||!r)||!(!n||!i)}(r))throw new P("getIssuerProfile",`${e} - ${x("errors","issuerProfileInvalid")}`);return r}))},getRevokedAssertions:function(t,r){var n;return e(this,void 0,void 0,(function*(){if(!t)return[];const e=x("errors","getRevokedAssertions");r&&(t=function(e,t,r){const n=e.includes("?")?"&":"?";return`${e}${n}assertionId=${r}`}(t,0,encodeURIComponent(r)));const i=yield Un({url:t}).catch((()=>{throw new P("parseIssuerKeys",e)})),o=JSON.parse(i);return null!==(n=o.revokedAssertions)&&void 0!==n?n:[]}))},lookForTx:function({transactionId:e,chain:t,explorerAPIs:r=[]}){return vi(this,void 0,void 0,(function*(){const n=function(e){const{bitcoin:t,ethereum:r}={bitcoin:ci(yi(n=e,ui)),ethereum:ci(yi(n,fi))};var n;const{custom:i}=function(e){return{custom:mi(e)}}(e.filter((e=>"rpc"===e.apiType)));return{bitcoin:t,ethereum:r,custom:[...i,...ci(e.filter((e=>"rpc"!==e.apiType)))]}}(r),i=function({defaultAPIs:e,customAPIs:t}){const r=[e];if(null==t?void 0:t.length){const e=t[0].priority;r.splice(e,0,t)}const n=e.concat(t).length;if(zn>n)throw new Error("Invalid application configuration; check the CONFIG.MinimumBlockchainExplorers configuration value");return r}({defaultAPIs:wi(t,n),customAPIs:n.custom});return yield Si(i,0,e,t)}))},parseIssuerKeys:function(e){try{const t={};if("@context"in e){const r=e.publicKey||e.publicKeys;for(let e=0;e<r.length;e++){const n=ki(r[e]);t[n.publicKey]=n}}else{const r=ki({},(e.issuerKeys||[])[0].key);t[r.publicKey]=r}return t}catch(e){throw new P("parseIssuerKeys",x("errors","parseIssuerKeys"))}},parseRevocationKey:function(e){return e&&Object.prototype.hasOwnProperty.call(e,"revocationKeys")&&e.revocationKeys.length>0?e.revocationKeys[0].key:null}})};const Ii={1:function(e){var t,r;const n=e.certificate||e.document.certificate,o=e.recipient||e.document.recipient,a=e.document.assertion,s=e.receipt,c=void 0===s?i.V1_1:i.V1_2;let{image:u,description:f,issuer:l,subtitle:d}=n;const h=o.publicKey,p=Ei.certificates.getChain(h),b=a.expires,g=a.uid,y=a.issuedOn,m=a.metadataJson,v=`${o.givenName} ${o.familyName}`,w=a.id,_=o.revocationKey||null,S=l.image,x=e.document.signature,k=function(e,t){const r=[];switch(t){case i.V1_1:case i.V1_2:if(e.constructor===Array)for(const t in e){const n=e[t],i="jobTitle"in n?n.jobTitle:null,o="name"in n?n.name:null,a=new A(n.image,i,o);r.push(a)}else{const t=new A(e,null,null);r.push(t)}break;case i.V2_0:for(const t in e){const n=e[t],i=new A(n.image,n.jobTitle,n.name);r.push(i)}}return r}(null===(r=null===(t=e.document)||void 0===t?void 0:t.assertion)||void 0===r?void 0:r["image:signature"],c);return"object"==typeof d&&(d=d.display?d.content:""),{certificateImage:u,chain:p,description:f,expires:b,id:g,issuedOn:y,issuer:l,metadataJson:m,name:n.title||n.name,publicKey:h,receipt:s,recipientFullName:v,recordLink:w,revocationKey:_,sealImage:S,signature:x,signatureImage:k,subtitle:d,version:c}}};function Oi(t){return e(this,void 0,void 0,(function*(){try{const e=function(e){"string"==typeof e&&(e=[e]);const t=e.filter((e=>"string"==typeof e)).find((e=>e.toLowerCase().indexOf("blockcerts")>0)).split("/").filter((e=>""!==e)),r=Object.keys(Ii);return parseInt(r.filter((e=>function(e,t){return e.some((e=>e.includes(`v${t}`)||e.includes(`${t}.`)))}(t,e.toString())))[0],10)}(t["@context"]);if(1!==e){const e="The document you are trying to parse is not Blockcerts V1. Please refer to cert-verifier-js to parse and verify newer versions: https://github.com/blockchain-certificates/cert-verifier-js";return console.warn(e),{isFormatValid:!1,error:e}}const r=yield Ii[e](t);return r.isFormatValid=!0,r}catch(e){return{isFormatValid:!1,error:e}}}))}var Ti=N((function(e,t){var r;t=e.exports=W,r="object"==typeof ft&&ft.env&&ft.env.NODE_DEBUG&&/\bsemver\b/i.test(ft.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:function(){},t.SEMVER_SPEC_VERSION="2.0.0";var n=Number.MAX_SAFE_INTEGER||9007199254740991,i=t.re=[],o=t.src=[],a=0,s=a++;o[s]="0|[1-9]\\d*";var c=a++;o[c]="[0-9]+";var u=a++;o[u]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var f=a++;o[f]="("+o[s]+")\\.("+o[s]+")\\.("+o[s]+")";var l=a++;o[l]="("+o[c]+")\\.("+o[c]+")\\.("+o[c]+")";var d=a++;o[d]="(?:"+o[s]+"|"+o[u]+")";var h=a++;o[h]="(?:"+o[c]+"|"+o[u]+")";var p=a++;o[p]="(?:-("+o[d]+"(?:\\."+o[d]+")*))";var b=a++;o[b]="(?:-?("+o[h]+"(?:\\."+o[h]+")*))";var g=a++;o[g]="[0-9A-Za-z-]+";var y=a++;o[y]="(?:\\+("+o[g]+"(?:\\."+o[g]+")*))";var m=a++,v="v?"+o[f]+o[p]+"?"+o[y]+"?";o[m]="^"+v+"$";var w="[v=\\s]*"+o[l]+o[b]+"?"+o[y]+"?",_=a++;o[_]="^"+w+"$";var S=a++;o[S]="((?:<|>)?=?)";var x=a++;o[x]=o[c]+"|x|X|\\*";var k=a++;o[k]=o[s]+"|x|X|\\*";var E=a++;o[E]="[v=\\s]*("+o[k]+")(?:\\.("+o[k]+")(?:\\.("+o[k]+")(?:"+o[p]+")?"+o[y]+"?)?)?";var I=a++;o[I]="[v=\\s]*("+o[x]+")(?:\\.("+o[x]+")(?:\\.("+o[x]+")(?:"+o[b]+")?"+o[y]+"?)?)?";var O=a++;o[O]="^"+o[S]+"\\s*"+o[E]+"$";var T=a++;o[T]="^"+o[S]+"\\s*"+o[I]+"$";var A=a++;o[A]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var P=a++;o[P]="(?:~>?)";var C=a++;o[C]="(\\s*)"+o[P]+"\\s+",i[C]=new RegExp(o[C],"g");var M=a++;o[M]="^"+o[P]+o[E]+"$";var R=a++;o[R]="^"+o[P]+o[I]+"$";var N=a++;o[N]="(?:\\^)";var L=a++;o[L]="(\\s*)"+o[N]+"\\s+",i[L]=new RegExp(o[L],"g");var j=a++;o[j]="^"+o[N]+o[E]+"$";var D=a++;o[D]="^"+o[N]+o[I]+"$";var B=a++;o[B]="^"+o[S]+"\\s*("+w+")$|^$";var U=a++;o[U]="^"+o[S]+"\\s*("+v+")$|^$";var H=a++;o[H]="(\\s*)"+o[S]+"\\s*("+w+"|"+o[E]+")",i[H]=new RegExp(o[H],"g");var F=a++;o[F]="^\\s*("+o[E]+")\\s+-\\s+("+o[E]+")\\s*$";var V=a++;o[V]="^\\s*("+o[I]+")\\s+-\\s+("+o[I]+")\\s*$";var q=a++;o[q]="(<|>)?=?\\s*\\*";for(var z=0;z<35;z++)r(z,o[z]),i[z]||(i[z]=new RegExp(o[z]));function K(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof W)return e;if("string"!=typeof e)return null;if(e.length>256)return null;if(!(t.loose?i[_]:i[m]).test(e))return null;try{return new W(e,t)}catch(e){return null}}function W(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof W){if(e.loose===t.loose)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>256)throw new TypeError("version is longer than 256 characters");if(!(this instanceof W))return new W(e,t);r("SemVer",e,t),this.options=t,this.loose=!!t.loose;var o=e.trim().match(t.loose?i[_]:i[m]);if(!o)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+o[1],this.minor=+o[2],this.patch=+o[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");o[4]?this.prerelease=o[4].split(".").map((function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t<n)return t}return e})):this.prerelease=[],this.build=o[5]?o[5].split("."):[],this.format()}t.parse=K,t.valid=function(e,t){var r=K(e,t);return r?r.version:null},t.clean=function(e,t){var r=K(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null},t.SemVer=W,W.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},W.prototype.toString=function(){return this.version},W.prototype.compare=function(e){return r("SemVer.compare",this.version,this.options,e),e instanceof W||(e=new W(e,this.options)),this.compareMain(e)||this.comparePre(e)},W.prototype.compareMain=function(e){return e instanceof W||(e=new W(e,this.options)),G(this.major,e.major)||G(this.minor,e.minor)||G(this.patch,e.patch)},W.prototype.comparePre=function(e){if(e instanceof W||(e=new W(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var t=0;do{var n=this.prerelease[t],i=e.prerelease[t];if(r("prerelease compare",t,n,i),void 0===n&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===n)return-1;if(n!==i)return G(n,i)}while(++t)},W.prototype.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var r=this.prerelease.length;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);-1===r&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this},t.inc=function(e,t,r,n){"string"==typeof r&&(n=r,r=void 0);try{return new W(e,r).inc(t,n).version}catch(e){return null}},t.diff=function(e,t){if(Q(e,t))return null;var r=K(e),n=K(t),i="";if(r.prerelease.length||n.prerelease.length){i="pre";var o="prerelease"}for(var a in r)if(("major"===a||"minor"===a||"patch"===a)&&r[a]!==n[a])return i+a;return o},t.compareIdentifiers=G;var J=/^[0-9]+$/;function G(e,t){var r=J.test(e),n=J.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1}function X(e,t,r){return new W(e,r).compare(new W(t,r))}function $(e,t,r){return X(e,t,r)>0}function Y(e,t,r){return X(e,t,r)<0}function Q(e,t,r){return 0===X(e,t,r)}function Z(e,t,r){return 0!==X(e,t,r)}function ee(e,t,r){return X(e,t,r)>=0}function te(e,t,r){return X(e,t,r)<=0}function re(e,t,r,n){switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return Q(e,r,n);case"!=":return Z(e,r,n);case">":return $(e,r,n);case">=":return ee(e,r,n);case"<":return Y(e,r,n);case"<=":return te(e,r,n);default:throw new TypeError("Invalid operator: "+t)}}function ne(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof ne){if(e.loose===!!t.loose)return e;e=e.value}if(!(this instanceof ne))return new ne(e,t);r("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===ie?this.value="":this.value=this.operator+this.semver.version,r("comp",this)}t.rcompareIdentifiers=function(e,t){return G(t,e)},t.major=function(e,t){return new W(e,t).major},t.minor=function(e,t){return new W(e,t).minor},t.patch=function(e,t){return new W(e,t).patch},t.compare=X,t.compareLoose=function(e,t){return X(e,t,!0)},t.rcompare=function(e,t,r){return X(t,e,r)},t.sort=function(e,r){return e.sort((function(e,n){return t.compare(e,n,r)}))},t.rsort=function(e,r){return e.sort((function(e,n){return t.rcompare(e,n,r)}))},t.gt=$,t.lt=Y,t.eq=Q,t.neq=Z,t.gte=ee,t.lte=te,t.cmp=re,t.Comparator=ne;var ie={};function oe(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof oe)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new oe(e.raw,t);if(e instanceof ne)return new oe(e.value,t);if(!(this instanceof oe))return new oe(e,t);if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((function(e){return this.parseRange(e.trim())}),this).filter((function(e){return e.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+e);this.format()}function ae(e){return!e||"x"===e.toLowerCase()||"*"===e}function se(e,t,r,n,i,o,a,s,c,u,f,l,d){return((t=ae(r)?"":ae(n)?">="+r+".0.0":ae(i)?">="+r+"."+n+".0":">="+t)+" "+(s=ae(c)?"":ae(u)?"<"+(+c+1)+".0.0":ae(f)?"<"+c+"."+(+u+1)+".0":l?"<="+c+"."+u+"."+f+"-"+l:"<="+s)).trim()}function ce(e,t,n){for(var i=0;i<e.length;i++)if(!e[i].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(i=0;i<e.length;i++)if(r(e[i].semver),e[i].semver!==ie&&e[i].semver.prerelease.length>0){var o=e[i].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}return!1}return!0}function ue(e,t,r){try{t=new oe(t,r)}catch(e){return!1}return t.test(e)}function fe(e,t,r,n){var i,o,a,s,c;switch(e=new W(e,n),t=new oe(t,n),r){case">":i=$,o=te,a=Y,s=">",c=">=";break;case"<":i=Y,o=ee,a=$,s="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ue(e,t,n))return!1;for(var u=0;u<t.set.length;++u){var f=t.set[u],l=null,d=null;if(f.forEach((function(e){e.semver===ie&&(e=new ne(">=0.0.0")),l=l||e,d=d||e,i(e.semver,l.semver,n)?l=e:a(e.semver,d.semver,n)&&(d=e)})),l.operator===s||l.operator===c)return!1;if((!d.operator||d.operator===s)&&o(e,d.semver))return!1;if(d.operator===c&&a(e,d.semver))return!1}return!0}ne.prototype.parse=function(e){var t=this.options.loose?i[B]:i[U],r=e.match(t);if(!r)throw new TypeError("Invalid comparator: "+e);this.operator=r[1],"="===this.operator&&(this.operator=""),r[2]?this.semver=new W(r[2],this.options.loose):this.semver=ie},ne.prototype.toString=function(){return this.value},ne.prototype.test=function(e){return r("Comparator.test",e,this.options.loose),this.semver===ie||("string"==typeof e&&(e=new W(e,this.options)),re(e,this.operator,this.semver,this.options))},ne.prototype.intersects=function(e,t){if(!(e instanceof ne))throw new TypeError("a Comparator is required");var r;if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return r=new oe(e.value,t),ue(this.value,r,t);if(""===e.operator)return r=new oe(this.value,t),ue(e.semver,r,t);var n=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),o=this.semver.version===e.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),s=re(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),c=re(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return n||i||o&&a||s||c},t.Range=oe,oe.prototype.format=function(){return this.range=this.set.map((function(e){return e.join(" ").trim()})).join("||").trim(),this.range},oe.prototype.toString=function(){return this.range},oe.prototype.parseRange=function(e){var t=this.options.loose;e=e.trim();var n=t?i[V]:i[F];e=e.replace(n,se),r("hyphen replace",e),e=e.replace(i[H],"$1$2$3"),r("comparator trim",e,i[H]),e=(e=(e=e.replace(i[C],"$1~")).replace(i[L],"$1^")).split(/\s+/).join(" ");var o=t?i[B]:i[U],a=e.split(" ").map((function(e){return function(e,t){return r("comp",e,t),e=function(e,t){return e.trim().split(/\s+/).map((function(e){return function(e,t){r("caret",e,t);var n=t.loose?i[D]:i[j];return e.replace(n,(function(t,n,i,o,a){var s;return r("caret",e,t,n,i,o,a),ae(n)?s="":ae(i)?s=">="+n+".0.0 <"+(+n+1)+".0.0":ae(o)?s="0"===n?">="+n+"."+i+".0 <"+n+"."+(+i+1)+".0":">="+n+"."+i+".0 <"+(+n+1)+".0.0":a?(r("replaceCaret pr",a),s="0"===n?"0"===i?">="+n+"."+i+"."+o+"-"+a+" <"+n+"."+i+"."+(+o+1):">="+n+"."+i+"."+o+"-"+a+" <"+n+"."+(+i+1)+".0":">="+n+"."+i+"."+o+"-"+a+" <"+(+n+1)+".0.0"):(r("no pr"),s="0"===n?"0"===i?">="+n+"."+i+"."+o+" <"+n+"."+i+"."+(+o+1):">="+n+"."+i+"."+o+" <"+n+"."+(+i+1)+".0":">="+n+"."+i+"."+o+" <"+(+n+1)+".0.0"),r("caret return",s),s}))}(e,t)})).join(" ")}(e,t),r("caret",e),e=function(e,t){return e.trim().split(/\s+/).map((function(e){return function(e,t){var n=t.loose?i[R]:i[M];return e.replace(n,(function(t,n,i,o,a){var s;return r("tilde",e,t,n,i,o,a),ae(n)?s="":ae(i)?s=">="+n+".0.0 <"+(+n+1)+".0.0":ae(o)?s=">="+n+"."+i+".0 <"+n+"."+(+i+1)+".0":a?(r("replaceTilde pr",a),s=">="+n+"."+i+"."+o+"-"+a+" <"+n+"."+(+i+1)+".0"):s=">="+n+"."+i+"."+o+" <"+n+"."+(+i+1)+".0",r("tilde return",s),s}))}(e,t)})).join(" ")}(e,t),r("tildes",e),e=function(e,t){return r("replaceXRanges",e,t),e.split(/\s+/).map((function(e){return function(e,t){e=e.trim();var n=t.loose?i[T]:i[O];return e.replace(n,(function(t,n,i,o,a,s){r("xRange",e,t,n,i,o,a,s);var c=ae(i),u=c||ae(o),f=u||ae(a);return"="===n&&f&&(n=""),c?t=">"===n||"<"===n?"<0.0.0":"*":n&&f?(u&&(o=0),a=0,">"===n?(n=">=",u?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):"<="===n&&(n="<",u?i=+i+1:o=+o+1),t=n+i+"."+o+"."+a):u?t=">="+i+".0.0 <"+(+i+1)+".0.0":f&&(t=">="+i+"."+o+".0 <"+i+"."+(+o+1)+".0"),r("xRange return",t),t}))}(e,t)})).join(" ")}(e,t),r("xrange",e),e=function(e,t){return r("replaceStars",e,t),e.trim().replace(i[q],"")}(e,t),r("stars",e),e}(e,this.options)}),this).join(" ").split(/\s+/);return this.options.loose&&(a=a.filter((function(e){return!!e.match(o)}))),a.map((function(e){return new ne(e,this.options)}),this)},oe.prototype.intersects=function(e,t){if(!(e instanceof oe))throw new TypeError("a Range is required");return this.set.some((function(r){return r.every((function(r){return e.set.some((function(e){return e.every((function(e){return r.intersects(e,t)}))}))}))}))},t.toComparators=function(e,t){return new oe(e,t).set.map((function(e){return e.map((function(e){return e.value})).join(" ").trim().split(" ")}))},oe.prototype.test=function(e){if(!e)return!1;"string"==typeof e&&(e=new W(e,this.options));for(var t=0;t<this.set.length;t++)if(ce(this.set[t],e,this.options))return!0;return!1},t.satisfies=ue,t.maxSatisfying=function(e,t,r){var n=null,i=null;try{var o=new oe(t,r)}catch(e){return null}return e.forEach((function(e){o.test(e)&&(n&&-1!==i.compare(e)||(i=new W(n=e,r)))})),n},t.minSatisfying=function(e,t,r){var n=null,i=null;try{var o=new oe(t,r)}catch(e){return null}return e.forEach((function(e){o.test(e)&&(n&&1!==i.compare(e)||(i=new W(n=e,r)))})),n},t.minVersion=function(e,t){e=new oe(e,t);var r=new W("0.0.0");if(e.test(r))return r;if(r=new W("0.0.0-0"),e.test(r))return r;r=null;for(var n=0;n<e.set.length;++n)e.set[n].forEach((function(e){var t=new W(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":r&&!$(r,t)||(r=t);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+e.operator)}}));return r&&e.test(r)?r:null},t.validRange=function(e,t){try{return new oe(e,t).range||"*"}catch(e){return null}},t.ltr=function(e,t,r){return fe(e,t,"<",r)},t.gtr=function(e,t,r){return fe(e,t,">",r)},t.outside=fe,t.prerelease=function(e,t){var r=K(e,t);return r&&r.prerelease.length?r.prerelease:null},t.intersects=function(e,t,r){return e=new oe(e,r),t=new oe(t,r),e.intersects(t)},t.coerce=function(e){if(e instanceof W)return e;if("string"!=typeof e)return null;var t=e.match(i[A]);return null==t?null:K(t[1]+"."+(t[2]||"0")+"."+(t[3]||"0"))}}));Ti.SEMVER_SPEC_VERSION,Ti.re,Ti.src,Ti.parse,Ti.valid,Ti.clean,Ti.SemVer,Ti.inc,Ti.diff,Ti.compareIdentifiers,Ti.rcompareIdentifiers,Ti.major,Ti.minor,Ti.patch,Ti.compare,Ti.compareLoose,Ti.rcompare,Ti.sort,Ti.rsort,Ti.gt,Ti.lt,Ti.eq,Ti.neq,Ti.gte,Ti.lte,Ti.cmp,Ti.Comparator,Ti.Range,Ti.toComparators,Ti.satisfies,Ti.maxSatisfying,Ti.minSatisfying,Ti.minVersion,Ti.validRange,Ti.ltr,Ti.gtr,Ti.outside,Ti.prerelease,Ti.intersects,Ti.coerce;const Ai={};var Pi=Ai;const Ci="function"==typeof setImmediate&&setImmediate,Mi=Ci?e=>Ci(e):e=>setTimeout(e,0);function Ri(e,t,r){try{return e(t,r)}catch(e){Ye((()=>{throw e}))}}Ai.nextTick="object"==typeof ft?Ye:Mi,Ai.setImmediate=Ci?Mi:Ai.nextTick,Ai.clone=function(e){if(e&&"object"==typeof e){let t;if(Array.isArray(e)){t=[];for(let r=0;r<e.length;++r)t[r]=Ai.clone(e[r])}else if(Ai.isObject(e)){t={};for(const r in e)t[r]=Ai.clone(e[r])}else t=e.toString();return t}return e},Ai.isObject=e=>"[object Object]"===Object.prototype.toString.call(e),Ai.isUndefined=e=>void 0===e,Ai.callbackify=e=>async function(...t){const r=t[t.length-1];let n;"function"==typeof r&&t.pop();try{n=await e.apply(null,t)}catch(e){if("function"==typeof r)return Ri(r,e);throw e}return"function"==typeof r?Ri(r,null,n):n};var Ni=class e{constructor(e){this.prefix=e,this.counter=0,this.existing={}}clone(){const t=new e(this.prefix);return t.counter=this.counter,t.existing=Pi.clone(this.existing),t}getId(e){if(e&&e in this.existing)return this.existing[e];const t=this.prefix+this.counter;return this.counter+=1,e&&(this.existing[e]=t),t}hasId(e){return e in this.existing}},Li={options:{usePureJavaScript:!1}};Li.md=Li.md||{},Li.md.algorithms=Li.md.algorithms||{};var ji={},Di=ji,Bi={};ji.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,o=t.length,a=t.charAt(0),s=[0];for(i=0;i<e.length;++i){for(var c=0,u=e[i];c<s.length;++c)u+=s[c]<<8,s[c]=u%o,u=u/o|0;for(;u>0;)s.push(u%o),u=u/o|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=a;for(i=s.length-1;i>=0;--i)n+=t[s[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),o=[0];for(r=0;r<e.length();++r){for(var a=0,s=e.at(r);a<o.length;++a)s+=o[a]<<8,o[a]=s%n,s=s/n|0;for(;s>0;)o.push(s%n),s=s/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=i;for(r=o.length-1;r>=0;--r)c+=t[o[r]];return c}(e,t);if(r){var f=new RegExp(".{1,"+r+"}","g");n=n.match(f).join("\r\n")}return n},ji.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var r=Bi[t];if(!r){r=Bi[t]=[];for(var n=0;n<t.length;++n)r[t.charCodeAt(n)]=n}e=e.replace(/\s/g,"");var i=t.length,o=t.charAt(0),a=[0];for(n=0;n<e.length;n++){var s=r[e.charCodeAt(n)];if(void 0===s)return;for(var c=0,u=s;c<a.length;++c)u+=a[c]*i,a[c]=255&u,u>>=8;for(;u>0;)a.push(255&u),u>>=8}for(var f=0;e[f]===o&&f<e.length-1;++f)a.push(0);return te.from(a.reverse())},N((function(e){var t=e.exports=Li.util=Li.util||{};function r(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function n(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(t.isArrayBuffer(e)||t.isArrayBufferView(e))if(e instanceof te)this.data=e.toString("binary");else{var r=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,r)}catch(e){for(var i=0;i<r.length;++i)this.putByte(r[i])}}else(e instanceof n||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("function"==typeof setImmediate)return t.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(t.nextTick=function(e){return setImmediate(e)});if(t.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",r=[];t.setImmediate=function(t){r.push(t),1===r.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(t){if(t.source===window&&t.data===e){t.stopPropagation();var n=r.slice();r.length=0,n.forEach((function(e){e()}))}}),!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),i=!0,o=document.createElement("div");r=[],new MutationObserver((function(){var e=r.slice();r.length=0,e.forEach((function(e){e()}))})).observe(o,{attributes:!0});var a=t.setImmediate;t.setImmediate=function(e){Date.now()-n>15?(n=Date.now(),a(e)):(r.push(e),1===r.length&&o.setAttribute("a",i=!i))}}t.nextTick=t.setImmediate}(),t.isNodejs=void 0!==ft&&ft.versions&&ft.versions.node,t.globalScope=t.isNodejs?M:"undefined"==typeof self?window:self,t.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},t.isArrayBufferView=function(e){return e&&t.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},t.ByteBuffer=n,t.ByteStringBuffer=n,t.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},t.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},t.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},t.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},t.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},t.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},t.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(t.encodeUtf8(e))},t.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},t.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},t.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},t.ByteStringBuffer.prototype.putInt=function(e,t){r(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},t.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},t.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},t.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},t.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},t.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},t.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},t.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},t.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},t.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},t.ByteStringBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},t.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},t.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},t.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},t.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},t.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},t.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},t.ByteStringBuffer.prototype.copy=function(){var e=t.createBuffer(this.data);return e.read=this.read,e},t.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},t.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},t.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},t.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},t.ByteStringBuffer.prototype.toString=function(){return t.decodeUtf8(this.bytes())},t.DataBuffer=function(e,r){r=r||{},this.read=r.readOffset||0,this.growSize=r.growSize||1024;var n=t.isArrayBuffer(e),i=t.isArrayBufferView(e);if(n||i)return this.data=n?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in r?r.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in r&&(this.write=r.writeOffset)},t.DataBuffer.prototype.length=function(){return this.write-this.read},t.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},t.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},t.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},t.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},t.DataBuffer.prototype.putBytes=function(e,r){if(t.isArrayBufferView(e)){var n=(i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-i.byteOffset;return this.accommodate(n),new Uint8Array(this.data.buffer,this.write).set(i),this.write+=n,this}if(t.isArrayBuffer(e)){var i=new Uint8Array(e);return this.accommodate(i.byteLength),new Uint8Array(this.data.buffer).set(i,this.write),this.write+=i.byteLength,this}if(e instanceof t.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&t.isArrayBufferView(e.data))return i=new Uint8Array(e.data.byteLength,e.read,e.length()),this.accommodate(i.byteLength),new Uint8Array(e.data.byteLength,this.write).set(i),this.write+=i.byteLength,this;if(e instanceof t.ByteStringBuffer&&(e=e.data,r="binary"),r=r||"binary","string"==typeof e){var o;if("hex"===r)return this.accommodate(Math.ceil(e.length/2)),o=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.hex.decode(e,o,this.write),this;if("base64"===r)return this.accommodate(3*Math.ceil(e.length/4)),o=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.base64.decode(e,o,this.write),this;if("utf8"===r&&(e=t.encodeUtf8(e),r="binary"),"binary"===r||"raw"===r)return this.accommodate(e.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.raw.decode(o),this;if("utf16"===r)return this.accommodate(2*e.length),o=new Uint16Array(this.data.buffer,this.write),this.write+=t.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+r)}throw Error("Invalid parameter: "+e)},t.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},t.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},t.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},t.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},t.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},t.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},t.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},t.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},t.DataBuffer.prototype.putInt=function(e,t){r(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},t.DataBuffer.prototype.putSignedInt=function(e,t){return r(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},t.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},t.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},t.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},t.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},t.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},t.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},t.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},t.DataBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},t.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},t.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},t.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},t.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},t.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},t.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},t.DataBuffer.prototype.copy=function(){return new t.DataBuffer(this)},t.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},t.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},t.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},t.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},t.DataBuffer.prototype.toString=function(e){var r=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return t.binary.raw.encode(r);if("hex"===e)return t.binary.hex.encode(r);if("base64"===e)return t.binary.base64.encode(r);if("utf8"===e)return t.text.utf8.decode(r);if("utf16"===e)return t.text.utf16.decode(r);throw new Error("Invalid encoding: "+e)},t.createBuffer=function(e,r){return r=r||"raw",void 0!==e&&"utf8"===r&&(e=t.encodeUtf8(e)),new t.ByteBuffer(e)},t.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},t.xorBytes=function(e,t,r){for(var n="",i="",o="",a=0,s=0;r>0;--r,++a)i=e.charCodeAt(a)^t.charCodeAt(a),s>=10&&(n+=o,o="",s=0),o+=String.fromCharCode(i),++s;return n+o},t.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},t.bytesToHex=function(e){return t.createBuffer(e).toHex()},t.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],a="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";t.encode64=function(e,t){for(var r,n,o,a="",s="",c=0;c<e.length;)r=e.charCodeAt(c++),n=e.charCodeAt(c++),o=e.charCodeAt(c++),a+=i.charAt(r>>2),a+=i.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=i.charAt((15&n)<<2|o>>6),a+=isNaN(o)?"=":i.charAt(63&o)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+a},t.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,a="",s=0;s<e.length;)t=o[e.charCodeAt(s++)-43],r=o[e.charCodeAt(s++)-43],n=o[e.charCodeAt(s++)-43],i=o[e.charCodeAt(s++)-43],a+=String.fromCharCode(t<<2|r>>4),64!==n&&(a+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(a+=String.fromCharCode((3&n)<<6|i)));return a},t.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},t.decodeUtf8=function(e){return decodeURIComponent(escape(e))},t.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:Di.encode,decode:Di.decode}},t.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},t.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o);return t?i-r:n},t.binary.hex.encode=t.bytesToHex,t.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var i=0,o=r=r||0;for(1&e.length&&(i=1,n[o++]=parseInt(e[0],16));i<e.length;i+=2)n[o++]=parseInt(e.substr(i,2),16);return t?o-r:n},t.binary.base64.encode=function(e,t){for(var r,n,o,a="",s="",c=0;c<e.byteLength;)r=e[c++],n=e[c++],o=e[c++],a+=i.charAt(r>>2),a+=i.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=i.charAt((15&n)<<2|o>>6),a+=isNaN(o)?"=":i.charAt(63&o)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+a},t.binary.base64.decode=function(e,t,r){var n,i,a,s,c=t;c||(c=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,f=r=r||0;u<e.length;)n=o[e.charCodeAt(u++)-43],i=o[e.charCodeAt(u++)-43],a=o[e.charCodeAt(u++)-43],s=o[e.charCodeAt(u++)-43],c[f++]=n<<2|i>>4,64!==a&&(c[f++]=(15&i)<<4|a>>2,64!==s&&(c[f++]=(3&a)<<6|s));return t?f-r:c.subarray(0,f)},t.binary.base58.encode=function(e,r){return t.binary.baseN.encode(e,a,r)},t.binary.base58.decode=function(e,r){return t.binary.baseN.decode(e,a,r)},t.text={utf8:{},utf16:{}},t.text.utf8.encode=function(e,r,n){e=t.encodeUtf8(e);var i=r;i||(i=new Uint8Array(e.length));for(var o=n=n||0,a=0;a<e.length;++a)i[o++]=e.charCodeAt(a);return r?o-n:i},t.text.utf8.decode=function(e){return t.decodeUtf8(String.fromCharCode.apply(null,e))},t.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var i=new Uint16Array(n.buffer),o=r=r||0,a=r,s=0;s<e.length;++s)i[a++]=e.charCodeAt(s),o+=2;return t?o-r:n},t.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},t.deflate=function(e,r,n){if(r=t.decode64(e.deflate(t.encode64(r)).rval),n){var i=2;32&r.charCodeAt(1)&&(i=6),r=r.substring(i,r.length-4)}return r},t.inflate=function(e,r,n){var i=e.inflate(t.encode64(r)).rval;return null===i?null:t.decode64(i)};var s=function(e,r,n){if(!e)throw new Error("WebStorage not available.");var i;if(null===n?i=e.removeItem(r):(n=t.encode64(JSON.stringify(n)),i=e.setItem(r,n)),void 0!==i&&!0!==i.rval){var o=new Error(i.error.message);throw o.id=i.error.id,o.name=i.error.name,o}},c=function(e,r){if(!e)throw new Error("WebStorage not available.");var n=e.getItem(r);if(e.init)if(null===n.rval){if(n.error){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}n=null}else n=n.rval;return null!==n&&(n=JSON.parse(t.decode64(n))),n},u=function(e,t,r,n){var i=c(e,t);null===i&&(i={}),i[r]=n,s(e,t,i)},f=function(e,t,r){var n=c(e,t);return null!==n&&(n=r in n?n[r]:null),n},l=function(e,t,r){var n=c(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var o in n){i=!1;break}i&&(n=null),s(e,t,n)}},d=function(e,t){s(e,t,null)},h=function(e,t,r){var n,i=null;void 0===r&&(r=["web","flash"]);var o=!1,a=null;for(var s in r){n=r[s];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),o="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),o=!0)}catch(e){a=e}if(o)break}if(!o)throw a;return i};t.setItem=function(e,t,r,n,i){h(u,arguments,i)},t.getItem=function(e,t,r,n){return h(f,arguments,n)},t.removeItem=function(e,t,r,n){h(l,arguments,n)},t.clearItems=function(e,t,r){h(d,arguments,r)},t.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),n=null===r?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?(80!==n.port&&"http"===n.scheme||443!==n.port&&"https"===n.scheme)&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var p=null;t.getQueryVariables=function(e){var t,r=function(e){for(var t={},r=e.split("&"),n=0;n<r.length;n++){var i,o,a=r[n].indexOf("=");a>0?(i=r[n].substring(0,a),o=r[n].substring(a+1)):(i=r[n],o=null),i in t||(t[i]=[]),i in Object.prototype||null===o||t[i].push(unescape(o))}return t};return void 0===e?(null===p&&(p="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=p):t=r(e),t},t.parseFragment=function(e){var r=e,n="",i=e.indexOf("?");i>0&&(r=e.substring(0,i),n=e.substring(i+1));var o=r.split("/");return o.length>0&&""===o[0]&&o.shift(),{pathString:r,queryString:n,path:o,query:""===n?{}:t.getQueryVariables(n)}},t.makeRequest=function(e){var r=t.parseFragment(e),n={path:r.pathString,query:r.queryString,getPath:function(e){return void 0===e?r.path:r.path[e]},getQuery:function(e,t){var n;return void 0===e?n=r.query:(n=r.query[e])&&void 0!==t&&(n=n[t]),n},getQueryLast:function(e,t){var r=n.getQuery(e);return r?r[r.length-1]:t}};return n},t.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},t.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},t.format=function(e){for(var t,r,n=/%./g,i=0,o=[],a=0;t=n.exec(e);){(r=e.substring(a,n.lastIndex-2)).length>0&&o.push(r),a=n.lastIndex;var s=t[0][1];switch(s){case"s":case"o":i<arguments.length?o.push(arguments[1+i++]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+s+"?>")}}return o.push(e.substring(a)),o.join("")},t.formatNumber=function(e,t,r,n){var i=e,o=isNaN(t=Math.abs(t))?2:t,a=void 0===r?",":r,s=void 0===n?".":n,c=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",f=u.length>3?u.length%3:0;return c+(f?u.substr(0,f)+s:"")+u.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+s)+(o?a+Math.abs(i-u).toFixed(o).slice(2):"")},t.formatSize=function(e){return e>=1073741824?t.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?t.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?t.formatNumber(e/1024,0)+" KiB":t.formatNumber(e,0)+" bytes"},t.bytesFromIP=function(e){return-1!==e.indexOf(".")?t.bytesFromIPv4(e):-1!==e.indexOf(":")?t.bytesFromIPv6(e):null},t.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var r=t.createBuffer(),n=0;n<e.length;++n){var i=parseInt(e[n],10);if(isNaN(i))return null;r.putByte(i)}return r.getBytes()},t.bytesFromIPv6=function(e){for(var r=0,n=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++r,!0}))).length+r),i=t.createBuffer(),o=0;o<8;++o)if(e[o]&&0!==e[o].length){var a=t.hexToBytes(e[o]);a.length<2&&i.putByte(0),i.putBytes(a)}else i.fillWithByte(0,n),n=0;return i.getBytes()},t.bytesToIP=function(e){return 4===e.length?t.bytesToIPv4(e):16===e.length?t.bytesToIPv6(e):null},t.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},t.bytesToIPv6=function(e){if(16!==e.length)return null;for(var r=[],n=[],i=0,o=0;o<e.length;o+=2){for(var a=t.bytesToHex(e[o]+e[o+1]);"0"===a[0]&&"0"!==a;)a=a.substr(1);if("0"===a){var s=n[n.length-1],c=r.length;s&&c===s.end+1?(s.end=c,s.end-s.start>n[i].end-n[i].start&&(i=n.length-1)):n.push({start:c,end:c})}r.push(a)}if(n.length>0){var u=n[i];u.end-u.start>0&&(r.splice(u.start,u.end-u.start+1,""),0===u.start&&r.unshift(""),7===u.end&&r.push(""))}return r.join(":")},t.estimateCores=function(e,r){if("function"==typeof e&&(r=e,e={}),e=e||{},"cores"in t&&!e.update)return r(null,t.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return t.cores=navigator.hardwareConcurrency,r(null,t.cores);if("undefined"==typeof Worker)return t.cores=1,r(null,t.cores);if("undefined"==typeof Blob)return t.cores=2,r(null,t.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){var t=Date.now(),r=t+4;self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(i,o,a){if(0===o){var s=Math.floor(i.reduce((function(e,t){return e+t}),0)/i.length);return t.cores=Math.max(1,s),URL.revokeObjectURL(n),r(null,t.cores)}!function(e,t){for(var r=[],i=[],o=0;o<e;++o){var a=new Worker(n);a.addEventListener("message",(function(n){if(i.push(n.data),i.length===e){for(var o=0;o<e;++o)r[o].terminate();t(null,i)}})),r.push(a)}for(o=0;o<e;++o)r[o].postMessage(o)}(a,(function(t,r){i.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],o=r[n]=[],a=0;a<e;++a)if(n!==a){var s=t[a];(i.st>s.st&&i.st<s.et||s.st>i.st&&s.st<i.et)&&o.push(a)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(a,r)),e(i,o-1,a)}))}([],5,16)}})),N((function(e){var t=e.exports=Li.sha1=Li.sha1||{};Li.md.sha1=Li.md.algorithms.sha1=t,t.create=function(){n||(r=String.fromCharCode(128),r+=Li.util.fillString(String.fromCharCode(0),64),n=!0);var e=null,t=Li.util.createBuffer(),o=new Array(80),a={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=Li.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},a}};return a.start(),a.update=function(r,n){"utf8"===n&&(r=Li.util.encodeUtf8(r));var s=r.length;a.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=s[1],s[1]=s[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(r),i(e,o,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var n=Li.util.createBuffer();n.putBytes(t.bytes());var s,c=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;n.putBytes(r.substr(0,a.blockLength-c));for(var u=8*a.fullMessageLength[0],f=0;f<a.fullMessageLength.length-1;++f)u+=(s=8*a.fullMessageLength[f+1])/4294967296>>>0,n.putInt32(u>>>0),u=s>>>0;n.putInt32(u);var l={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};i(l,o,n);var d=Li.util.createBuffer();return d.putInt32(l.h0),d.putInt32(l.h1),d.putInt32(l.h2),d.putInt32(l.h3),d.putInt32(l.h4),d},a};var r=null,n=!1;function i(e,t,r){for(var n,i,o,a,s,c,u,f=r.length();f>=64;){for(i=e.h0,o=e.h1,a=e.h2,s=e.h3,c=e.h4,u=0;u<16;++u)n=r.getInt32(),t[u]=n,n=(i<<5|i>>>27)+(s^o&(a^s))+c+1518500249+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<20;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(i<<5|i>>>27)+(s^o&(a^s))+c+1518500249+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<32;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(i<<5|i>>>27)+(o^a^s)+c+1859775393+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<40;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o^a^s)+c+1859775393+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<60;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o&a|s&(o^a))+c+2400959708+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<80;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o^a^s)+c+3395469782+n,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+a|0,e.h3=e.h3+s|0,e.h4=e.h4+c|0,f-=64}}})),N((function(e){var t=e.exports=Li.sha256=Li.sha256||{};Li.md.sha256=Li.md.algorithms.sha256=t,t.create=function(){n||(r=String.fromCharCode(128),r+=Li.util.fillString(String.fromCharCode(0),64),i=[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],n=!0);var e=null,t=Li.util.createBuffer(),a=new Array(64),s={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){s.messageLength=0,s.fullMessageLength=s.messageLength64=[];for(var r=s.messageLengthSize/4,n=0;n<r;++n)s.fullMessageLength.push(0);return t=Li.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},s}};return s.start(),s.update=function(r,n){"utf8"===n&&(r=Li.util.encodeUtf8(r));var i=r.length;s.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var c=s.fullMessageLength.length-1;c>=0;--c)s.fullMessageLength[c]+=i[1],i[1]=i[0]+(s.fullMessageLength[c]/4294967296>>>0),s.fullMessageLength[c]=s.fullMessageLength[c]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(r),o(e,a,t),(t.read>2048||0===t.length())&&t.compact(),s},s.digest=function(){var n=Li.util.createBuffer();n.putBytes(t.bytes());var i,c=s.fullMessageLength[s.fullMessageLength.length-1]+s.messageLengthSize&s.blockLength-1;n.putBytes(r.substr(0,s.blockLength-c));for(var u=8*s.fullMessageLength[0],f=0;f<s.fullMessageLength.length-1;++f)u+=(i=8*s.fullMessageLength[f+1])/4294967296>>>0,n.putInt32(u>>>0),u=i>>>0;n.putInt32(u);var l={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};o(l,a,n);var d=Li.util.createBuffer();return d.putInt32(l.h0),d.putInt32(l.h1),d.putInt32(l.h2),d.putInt32(l.h3),d.putInt32(l.h4),d.putInt32(l.h5),d.putInt32(l.h6),d.putInt32(l.h7),d},s};var r=null,n=!1,i=null;function o(e,t,r){for(var n,o,a,s,c,u,f,l,d,h,p,b,g,y=r.length();y>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,o=((o=t[c-15])>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,t[c]=n+t[c-7]+o+t[c-16]|0;for(u=e.h0,f=e.h1,l=e.h2,d=e.h3,h=e.h4,p=e.h5,b=e.h6,g=e.h7,c=0;c<64;++c)a=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),s=u&f|l&(u^f),n=g+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(b^h&(p^b))+i[c]+t[c],g=b,b=p,p=h,h=d+n>>>0,d=l,l=f,f=u,u=n+(o=a+s)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+f|0,e.h2=e.h2+l|0,e.h3=e.h3+d|0,e.h4=e.h4+h|0,e.h5=e.h5+p|0,e.h6=e.h6+b|0,e.h7=e.h7+g|0,y-=64}}}));var Ui=class{constructor(e){this.md=Li.md[e].create()}update(e){this.md.update(e,"utf8")}digest(){return this.md.digest().toHex()}},Hi=class{constructor(e){this.list=e.sort(),this.done=!1,this.left={};for(let t=0;t<e.length;++t)this.left[e[t]]=!0}hasNext(){return!this.done}next(){const e=this.list.slice();let t=null,r=0;const n=this.list.length;for(let e=0;e<n;++e){const i=this.list[e],o=this.left[i];(null===t||i>t)&&(o&&e>0&&i>this.list[e-1]||!o&&e<n-1&&i>this.list[e+1])&&(t=i,r=e)}if(null===t)this.done=!0;else{const e=this.left[t]?r-1:r+1;this.list[r]=this.list[e],this.list[e]=t;for(let e=0;e<n;++e)this.list[e]>t&&(this.left[this.list[e]]=!this.left[this.list[e]])}return e}};const Fi="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",Vi="http://www.w3.org/2001/XMLSchema#string",qi={eoln:/(?:\r\n)|(?:\n)|(?:\r)/g};qi.empty=new RegExp("^[ \\t]*$"),qi.quad=new RegExp('^[ \\t]*(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]+(?:<([^:]+:[^>]*)>)[ \\t]+(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?)|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^(?:<([^:]+:[^>]*)>))|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))[ \\t]*(?:\\.|(?:(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]*\\.))[ \\t]*$');var zi=class e{static parse(e){const t=[],r={},n=e.split(qi.eoln);let i=0;for(const e of n){if(i++,qi.empty.test(e))continue;const n=e.match(qi.quad);if(null===n)throw new Error("N-Quads parse error on line "+i+".");const o={};if(void 0!==n[1]?o.subject={termType:"NamedNode",value:n[1]}:o.subject={termType:"BlankNode",value:n[2]},o.predicate={termType:"NamedNode",value:n[3]},void 0!==n[4]?o.object={termType:"NamedNode",value:n[4]}:void 0!==n[5]?o.object={termType:"BlankNode",value:n[5]}:(o.object={termType:"Literal",value:void 0,datatype:{termType:"NamedNode"}},void 0!==n[7]?o.object.datatype.value=n[7]:void 0!==n[8]?(o.object.datatype.value=Fi,o.object.language=n[8]):o.object.datatype.value=Vi,o.object.value=Gi(n[6])),void 0!==n[9]?o.graph={termType:"NamedNode",value:n[9]}:void 0!==n[10]?o.graph={termType:"BlankNode",value:n[10]}:o.graph={termType:"DefaultGraph",value:""},o.graph.value in r){let e=!0;const n=r[o.graph.value];for(const t of n)if(Ki(t,o)){e=!1;break}e&&(n.push(o),t.push(o))}else r[o.graph.value]=[o],t.push(o)}return t}static serialize(t){Array.isArray(t)||(t=e.legacyDatasetToQuads(t));const r=[];for(const n of t)r.push(e.serializeQuad(n));return r.sort().join("")}static serializeQuad(e){const t=e.subject,r=e.predicate,n=e.object,i=e.graph;let o="";return[t,r].forEach((e=>{"NamedNode"===e.termType?o+="<"+e.value+">":o+=e.value,o+=" "})),"NamedNode"===n.termType?o+="<"+n.value+">":"BlankNode"===n.termType?o+=n.value:(o+='"'+function(e){return e.replace(Wi,(function(e){switch(e){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}}))}(n.value)+'"',n.datatype.value===Fi?n.language&&(o+="@"+n.language):n.datatype.value!==Vi&&(o+="^^<"+n.datatype.value+">")),"NamedNode"===i.termType?o+=" <"+i.value+">":"BlankNode"===i.termType&&(o+=" "+i.value),o+=" .\n",o}static legacyDatasetToQuads(e){const t=[],r={"blank node":"BlankNode",IRI:"NamedNode",literal:"Literal"};for(const n in e)e[n].forEach((e=>{const i={};for(const t in e){const n=e[t],o={termType:r[n.type],value:n.value};"Literal"===o.termType&&(o.datatype={termType:"NamedNode"},"datatype"in n&&(o.datatype.value=n.datatype),"language"in n?("datatype"in n||(o.datatype.value=Fi),o.language=n.language):"datatype"in n||(o.datatype.value=Vi)),i[t]=o}i.graph="@default"===n?{termType:"DefaultGraph",value:""}:{termType:n.startsWith("_:")?"BlankNode":"NamedNode",value:n},t.push(i)}));return t}};function Ki(e,t){for(const r in e)if(e[r].termType!==t[r].termType||e[r].value!==t[r].value)return!1;return"Literal"!==e.object.termType||e.object.datatype.termType===t.object.datatype.termType&&e.object.datatype.value===t.object.datatype.value&&e.object.language===t.object.language}const Wi=/["\\\n\r]/g,Ji=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function Gi(e){return e.replace(Ji,(function(e,t,r,n){if(t)switch(t){case"t":return"\t";case"b":return"\b";case"n":return"\n";case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(r)return String.fromCharCode(parseInt(r,16));if(n)throw new Error("Unsupported U escape")}))}const Xi={subject:"s",object:"o",graph:"g"};var $i=class extends class{constructor({maxCallStackDepth:e=500,maxTotalCallStackDepth:t=4294967295,timeSlice:r=10}={}){this.schedule={},this.schedule.MAX_DEPTH=e,this.schedule.MAX_TOTAL_DEPTH=t,this.schedule.depth=0,this.schedule.totalDepth=0,this.schedule.timeSlice=r}doWork(e,t){const r=this.schedule;if(r.totalDepth>=r.MAX_TOTAL_DEPTH)return t(new Error("Maximum total call stack depth exceeded; canonicalization aborting."));!function n(){if(r.depth===r.MAX_DEPTH)return r.depth=0,r.running=!1,Pi.nextTick(n);const i=Date.now();if(r.running||(r.start=Date.now(),r.deadline=r.start+r.timeSlice),i<r.deadline)return r.running=!0,r.depth++,r.totalDepth++,e(((e,n)=>{r.depth--,r.totalDepth--,t(e,n)}));r.depth=0,r.running=!1,Pi.setImmediate(n)}()}forEach(e,t,r){const n=this;let i,o,a=0;if(Array.isArray(e))o=e.length,i=()=>a!==o&&(i.value=e[a++],i.key=a,!0);else{const t=Object.keys(e);o=t.length,i=()=>a!==o&&(i.key=t[a++],i.value=e[i.key],!0)}!function e(o){return o?r(o):i()?n.doWork((()=>t(i.value,i.key,e))):void r()}()}waterfall(e,t){const r=this;r.forEach(e,((e,t,n)=>r.doWork(e,n)),t)}whilst(e,t,r){const n=this;!function i(o){return o?r(o):e()?void n.doWork(t,i):r()}()}}{constructor(e){super(e=e||{}),this.name="URDNA2015",this.options=Object.assign({},e),this.blankNodeInfo={},this.hashToBlankNodes={},this.canonicalIssuer=new Ni("_:c14n"),this.hashAlgorithm="sha256",this.quads}main(e,t){const r=this;let n;r.schedule.start=Date.now(),r.quads=e;const i={};r.waterfall([t=>{r.forEach(e,((e,t,n)=>{r.forEachComponent(e,(t=>{if("BlankNode"!==t.termType)return;const n=t.value;n in r.blankNodeInfo?r.blankNodeInfo[n].quads.push(e):(i[n]=!0,r.blankNodeInfo[n]={quads:[e]})})),n()}),t)},e=>{let t=!0;r.whilst((()=>t),(e=>{t=!1,r.hashToBlankNodes={},r.waterfall([e=>{r.forEach(i,((e,t,n)=>{r.hashFirstDegreeQuads(t,((e,i)=>{if(e)return n(e);i in r.hashToBlankNodes?r.hashToBlankNodes[i].push(t):r.hashToBlankNodes[i]=[t],n()}))}),e)},e=>{const n=Object.keys(r.hashToBlankNodes).sort();r.forEach(n,((e,n,o)=>{const a=r.hashToBlankNodes[e];if(a.length>1)return o();const s=a[0];r.canonicalIssuer.getId(s),delete i[s],delete r.hashToBlankNodes[e],t=!0,o()}),e)}],e)}),e)},e=>{const t=Object.keys(r.hashToBlankNodes).sort();r.forEach(t,((e,t,n)=>{const i=[],o=r.hashToBlankNodes[e];r.waterfall([e=>{r.forEach(o,((e,t,n)=>{if(r.canonicalIssuer.hasId(e))return n();const o=new Ni("_:b");o.getId(e),r.hashNDegreeQuads(e,o,((e,t)=>{if(e)return n(e);i.push(t),n()}))}),e)},e=>{i.sort(((e,t)=>e.hash<t.hash?-1:e.hash>t.hash?1:0)),r.forEach(i,((e,t,n)=>{for(const t in e.issuer.existing)r.canonicalIssuer.getId(t);n()}),e)}],n)}),e)},e=>{const t=[];r.waterfall([e=>{r.forEach(r.quads,((e,n,i)=>{r.forEachComponent(e,(e=>{"BlankNode"!==e.termType||e.value.startsWith(r.canonicalIssuer.prefix)||(e.value=r.canonicalIssuer.getId(e.value))})),t.push(zi.serializeQuad(e)),i()}),e)},e=>(t.sort(),n=t.join(""),e())],e)}],(e=>t(e,n)))}hashFirstDegreeQuads(e,t){const r=this,n=r.blankNodeInfo[e];if("hash"in n)return t(null,n.hash);const i=[],o=n.quads;r.forEach(o,((t,n,o)=>{const a={predicate:t.predicate};r.forEachComponent(t,((t,n)=>{a[n]=r.modifyFirstDegreeComponent(e,t,n)})),i.push(zi.serializeQuad(a)),o()}),(e=>{if(e)return t(e);i.sort();const o=new Ui(r.hashAlgorithm);for(let e=0;e<i.length;++e)o.update(i[e]);n.hash=o.digest(),t(null,n.hash)}))}hashRelatedBlankNode(e,t,r,n,i){const o=this;let a;o.waterfall([t=>o.canonicalIssuer.hasId(e)?(a=o.canonicalIssuer.getId(e),t()):r.hasId(e)?(a=r.getId(e),t()):void o.hashFirstDegreeQuads(e,((e,r)=>{if(e)return t(e);a=r,t()}))],(e=>{if(e)return i(e);const r=new Ui(o.hashAlgorithm);return r.update(n),"g"!==n&&r.update(o.getRelatedPredicate(t)),r.update(a),i(null,r.digest())}))}hashNDegreeQuads(e,t,r){const n=this;let i;const o=new Ui(n.hashAlgorithm);n.waterfall([r=>n.createHashToRelated(e,t,((e,t)=>{if(e)return r(e);i=t,r()})),e=>{const r=Object.keys(i).sort();n.forEach(r,((e,r,a)=>{o.update(e);let s,c="";const u=new Hi(i[e]);n.whilst((()=>u.hasNext()),(e=>{const r=u.next();let i=t.clone(),o="";const a=[];n.waterfall([t=>{n.forEach(r,((t,r,s)=>{if(n.canonicalIssuer.hasId(t)?o+=n.canonicalIssuer.getId(t):(i.hasId(t)||a.push(t),o+=i.getId(t)),0!==c.length&&o>c)return e();s()}),t)},t=>{n.forEach(a,((t,r,a)=>{n.hashNDegreeQuads(t,i,((r,n)=>r?a(r):(o+=i.getId(t),o+="<"+n.hash+">",i=n.issuer,0!==c.length&&o>c?e():void a())))}),t)},e=>{(0===c.length||o<c)&&(c=o,s=i),e()}],e)}),(e=>{if(e)return a(e);o.update(c),t=s,a()}))}),e)}],(e=>{r(e,{hash:o.digest(),issuer:t})}))}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType||((t=Pi.clone(t)).value=t.value===e?"_:a":"_:z"),t}getRelatedPredicate(e){return"<"+e.predicate.value+">"}createHashToRelated(e,t,r){const n=this,i={},o=n.blankNodeInfo[e].quads;n.forEach(o,((r,o,a)=>{n.forEach(r,((o,a,s)=>{if("predicate"===a||"BlankNode"!==o.termType||o.value===e)return s();const c=o.value,u=Xi[a];n.hashRelatedBlankNode(c,r,t,u,((e,t)=>{if(e)return s(e);t in i?i[t].push(c):i[t]=[c],s()}))}),a)}),(e=>r(e,i)))}forEachComponent(e,t){for(const r in e)"predicate"!==r&&t(e[r],r,e)}},Yi=class extends $i{constructor(e){super(e),this.name="URGNA2012",this.hashAlgorithm="sha1"}modifyFirstDegreeComponent(e,t,r){return"BlankNode"!==t.termType||((t=Pi.clone(t)).value="name"===r?"_:g":t.value===e?"_:a":"_:z"),t}getRelatedPredicate(e){return e.predicate.value}createHashToRelated(e,t,r){const n=this,i={},o=n.blankNodeInfo[e].quads;n.forEach(o,((r,o,a)=>{let s,c;if("BlankNode"===r.subject.termType&&r.subject.value!==e)c=r.subject.value,s="p";else{if("BlankNode"!==r.object.termType||r.object.value===e)return a();c=r.object.value,s="r"}n.hashRelatedBlankNode(c,r,t,s,((e,t)=>{if(e)return a(e);t in i?i[t].push(c):i[t]=[c],a()}))}),(e=>r(e,i)))}};const Qi={subject:"s",object:"o",graph:"g"};var Zi=class{constructor(){this.name="URDNA2015",this.blankNodeInfo={},this.hashToBlankNodes={},this.canonicalIssuer=new Ni("_:c14n"),this.hashAlgorithm="sha256",this.quads}main(e){const t=this;t.quads=e;const r={};for(const n of e)t.forEachComponent(n,(e=>{if("BlankNode"!==e.termType)return;const i=e.value;i in t.blankNodeInfo?t.blankNodeInfo[i].quads.push(n):(r[i]=!0,t.blankNodeInfo[i]={quads:[n]})}));let n=!0;for(;n;){n=!1,t.hashToBlankNodes={};for(const e in r){const r=t.hashFirstDegreeQuads(e);r in t.hashToBlankNodes?t.hashToBlankNodes[r].push(e):t.hashToBlankNodes[r]=[e]}const e=Object.keys(t.hashToBlankNodes).sort();for(let i=0;i<e.length;++i){const o=e[i],a=t.hashToBlankNodes[o];if(a.length>1)continue;const s=a[0];t.canonicalIssuer.getId(s),delete r[s],delete t.hashToBlankNodes[o],n=!0}}const i=Object.keys(t.hashToBlankNodes).sort();for(let e=0;e<i.length;++e){const r=[],n=i[e],o=t.hashToBlankNodes[n];for(let e=0;e<o.length;++e){const n=o[e];if(t.canonicalIssuer.hasId(n))continue;const i=new Ni("_:b");i.getId(n);const a=t.hashNDegreeQuads(n,i);r.push(a)}r.sort(((e,t)=>e.hash<t.hash?-1:e.hash>t.hash?1:0));for(let e=0;e<r.length;++e){const n=r[e];for(const e in n.issuer.existing)t.canonicalIssuer.getId(e)}}const o=[];for(let e=0;e<t.quads.length;++e){const r=t.quads[e];t.forEachComponent(r,(e=>{"BlankNode"!==e.termType||e.value.startsWith(t.canonicalIssuer.prefix)||(e.value=t.canonicalIssuer.getId(e.value))})),o.push(zi.serializeQuad(r))}return o.sort(),o.join("")}hashFirstDegreeQuads(e){const t=this,r=t.blankNodeInfo[e];if("hash"in r)return r.hash;const n=[],i=r.quads;for(let r=0;r<i.length;++r){const o=i[r],a={predicate:o.predicate};t.forEachComponent(o,((r,n)=>{a[n]=t.modifyFirstDegreeComponent(e,r,n)})),n.push(zi.serializeQuad(a))}n.sort();const o=new Ui(t.hashAlgorithm);for(let e=0;e<n.length;++e)o.update(n[e]);return r.hash=o.digest(),r.hash}hashRelatedBlankNode(e,t,r,n){const i=this;let o;o=i.canonicalIssuer.hasId(e)?i.canonicalIssuer.getId(e):r.hasId(e)?r.getId(e):i.hashFirstDegreeQuads(e);const a=new Ui(i.hashAlgorithm);return a.update(n),"g"!==n&&a.update(i.getRelatedPredicate(t)),a.update(o),a.digest()}hashNDegreeQuads(e,t){const r=this,n=new Ui(r.hashAlgorithm),i=r.createHashToRelated(e,t),o=Object.keys(i).sort();for(let e=0;e<o.length;++e){const a=o[e];n.update(a);let s,c="";const u=new Hi(i[a]);for(;u.hasNext();){const e=u.next();let n=t.clone(),i="";const o=[];let a=!1;for(let t=0;t<e.length;++t){const s=e[t];if(r.canonicalIssuer.hasId(s)?i+=r.canonicalIssuer.getId(s):(n.hasId(s)||o.push(s),i+=n.getId(s)),0!==c.length&&i>c){a=!0;break}}if(!a){for(let e=0;e<o.length;++e){const t=o[e],s=r.hashNDegreeQuads(t,n);if(i+=n.getId(t),i+="<"+s.hash+">",n=s.issuer,0!==c.length&&i>c){a=!0;break}}a||(0===c.length||i<c)&&(c=i,s=n)}}n.update(c),t=s}return{hash:n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType||((t=Pi.clone(t)).value=t.value===e?"_:a":"_:z"),t}getRelatedPredicate(e){return"<"+e.predicate.value+">"}createHashToRelated(e,t){const r=this,n={},i=r.blankNodeInfo[e].quads;for(let o=0;o<i.length;++o){const a=i[o];for(const i in a){const o=a[i];if("predicate"===i||"BlankNode"!==o.termType||o.value===e)continue;const s=o.value,c=Qi[i],u=r.hashRelatedBlankNode(s,a,t,c);u in n?n[u].push(s):n[u]=[s]}}return n}forEachComponent(e,t){for(const r in e)"predicate"!==r&&t(e[r],r,e)}},eo=class extends Zi{constructor(){super(),this.name="URGNA2012",this.hashAlgorithm="sha1"}modifyFirstDegreeComponent(e,t,r){return"BlankNode"!==t.termType||((t=Pi.clone(t)).value="name"===r?"_:g":t.value===e?"_:a":"_:z"),t}getRelatedPredicate(e){return e.predicate.value}createHashToRelated(e,t){const r=this,n={},i=r.blankNodeInfo[e].quads;for(let o=0;o<i.length;++o){const a=i[o];let s,c;if("BlankNode"===a.subject.termType&&a.subject.value!==e)c=a.subject.value,s="p";else{if("BlankNode"!==a.object.termType||a.object.value===e)continue;c=a.object.value,s="r"}const u=r.hashRelatedBlankNode(c,a,t,s);u in n?n[u].push(c):n[u]=[c]}return n}},to=L(Object.freeze({__proto__:null,default:{}}));let ro;try{ro=to}catch(e){}const no={};var io=no;no.NQuads=zi,no.IdentifierIssuer=Ni,no._rdfCanonizeNative=function(e){return e&&(ro=e),ro},no.canonize=Pi.callbackify((async function(e,t){let r;const n=new Promise(((e,t)=>{r=(r,n)=>{if(r)return t(r);e(n)}}));if(Array.isArray(e)||(e=no.NQuads.legacyDatasetToQuads(e)),t.useNative){if(!ro)throw new Error("rdf-canonize-native not available");ro.canonize(e,t,r)}else if("URDNA2015"===t.algorithm)new $i(t).main(e,r);else{if("URGNA2012"!==t.algorithm)throw"algorithm"in t?new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.");new Yi(t).main(e,r)}return n})),no.canonizeSync=function(e,t){if(Array.isArray(e)||(e=no.NQuads.legacyDatasetToQuads(e)),t.useNative){if(ro)return ro.canonizeSync(e,t);throw new Error("rdf-canonize-native not available")}if("URDNA2015"===t.algorithm)return new Zi(t).main(e);if("URGNA2012"===t.algorithm)return new eo(t).main(e);if(!("algorithm"in t))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm)};const oo={};var ao=oo;oo.isArray=Array.isArray,oo.isBoolean=e=>"boolean"==typeof e||"[object Boolean]"===Object.prototype.toString.call(e),oo.isDouble=e=>oo.isNumber(e)&&-1!==String(e).indexOf("."),oo.isEmptyObject=e=>oo.isObject(e)&&0===Object.keys(e).length,oo.isNumber=e=>"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e),oo.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),oo.isObject=e=>"[object Object]"===Object.prototype.toString.call(e),oo.isString=e=>"string"==typeof e||"[object String]"===Object.prototype.toString.call(e),oo.isUndefined=e=>void 0===e;const so={};var co=so;so.isSubject=e=>!(!ao.isObject(e)||"@value"in e||"@set"in e||"@list"in e)&&(Object.keys(e).length>1||!("@id"in e)),so.isSubjectReference=e=>ao.isObject(e)&&1===Object.keys(e).length&&"@id"in e,so.isValue=e=>ao.isObject(e)&&"@value"in e,so.isList=e=>ao.isObject(e)&&"@list"in e,so.isGraph=e=>ao.isObject(e)&&"@graph"in e&&1===Object.keys(e).filter((e=>"@id"!==e&&"@index"!==e)).length,so.isSimpleGraph=e=>so.isGraph(e)&&!("@id"in e),so.isBlankNode=e=>!!ao.isObject(e)&&("@id"in e?0===e["@id"].indexOf("_:"):0===Object.keys(e).length||!("@value"in e||"@set"in e||"@list"in e));var uo=class extends Error{constructor(e="An unspecified JSON-LD error occurred.",t="jsonld.Error",r={}){super(e),this.name=t,this.message=e,this.details=r}};const fo=io.IdentifierIssuer,lo=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,ho=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,po=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,bo="application/ld+json, application/json",go={};var yo=go;go.IdentifierIssuer=fo;const mo="function"==typeof setImmediate&&setImmediate,vo=mo?e=>mo(e):e=>setTimeout(e,0);function wo(e,t,r){go.nextTick((()=>e(t,r)))}function _o(e,t){if(ao.isArray(t))for(let r=0;r<t.length;++r)t[r]=_o(e,t[r]);else if(co.isList(t))t["@list"]=_o(e,t["@list"]);else if(ao.isObject(t)){co.isBlankNode(t)&&(t["@id"]=e.getId(t["@id"]));const r=Object.keys(t).sort();for(let n=0;n<r.length;++n){const i=r[n];"@id"!==i&&(t[i]=_o(e,t[i]))}}return t}go.nextTick="object"==typeof ft?Ye:vo,go.setImmediate=mo?vo:go.nextTick,go.clone=function(e){if(e&&"object"==typeof e){let t;if(ao.isArray(e)){t=[];for(let r=0;r<e.length;++r)t[r]=go.clone(e[r])}else if(e instanceof Map){t=new Map;for(const[r,n]of e)t.set(r,go.clone(n))}else if(e instanceof Set){t=new Set;for(const r of e)t.add(go.clone(r))}else if(ao.isObject(e)){t={};for(const r in e)t[r]=go.clone(e[r])}else t=e.toString();return t}return e},go.asArray=function(e){return Array.isArray(e)?e:[e]},go.buildHeaders=(e={})=>{if(Object.keys(e).some((e=>"accept"===e.toLowerCase())))throw new RangeError('Accept header may not be specified; only "'+bo+'" is supported.');return Object.assign({Accept:bo},e)},go.parseLinkHeader=e=>{const t={},r=e.match(lo);for(let e=0;e<r.length;++e){let n=r[e].match(ho);if(!n)continue;const i={target:n[1]},o=n[2];for(;n=po.exec(o);)i[n[1]]=void 0===n[2]?n[3]:n[2];const a=i.rel||"";Array.isArray(t[a])?t[a].push(i):t.hasOwnProperty(a)?t[a]=[t[a],i]:t[a]=i}return t},go.validateTypeValue=e=>{if(ao.isString(e)||ao.isEmptyObject(e))return;let t=!1;if(ao.isArray(e)){t=!0;for(let r=0;r<e.length;++r)if(!ao.isString(e[r])){t=!1;break}}if(!t)throw new uo('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, or an empty object.',"jsonld.SyntaxError",{code:"invalid type value",value:e})},go.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){const r=e[t];return!ao.isArray(r)||r.length>0}return!1},go.hasValue=(e,t,r)=>{if(go.hasProperty(e,t)){let n=e[t];const i=co.isList(n);if(ao.isArray(n)||i){i&&(n=n["@list"]);for(let e=0;e<n.length;++e)if(go.compareValues(r,n[e]))return!0}else if(!ao.isArray(r))return go.compareValues(r,n)}return!1},go.addValue=(e,t,r,n)=>{if("propertyIsArray"in(n=n||{})||(n.propertyIsArray=!1),"valueIsArray"in n||(n.valueIsArray=!1),"allowDuplicate"in n||(n.allowDuplicate=!0),n.valueIsArray)e[t]=r;else if(ao.isArray(r)){0===r.length&&n.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]);for(let i=0;i<r.length;++i)go.addValue(e,t,r[i],n)}else if(e.hasOwnProperty(t)){const i=!n.allowDuplicate&&go.hasValue(e,t,r);ao.isArray(e[t])||i&&!n.propertyIsArray||(e[t]=[e[t]]),i||e[t].push(r)}else e[t]=n.propertyIsArray?[r]:r},go.getValues=(e,t)=>[].concat(e[t]||[]),go.removeProperty=(e,t)=>{delete e[t]},go.removeValue=(e,t,r,n)=>{"propertyIsArray"in(n=n||{})||(n.propertyIsArray=!1);const i=go.getValues(e,t).filter((e=>!go.compareValues(e,r)));0===i.length?go.removeProperty(e,t):1!==i.length||n.propertyIsArray?e[t]=i:e[t]=i[0]},go.relabelBlankNodes=(e,t)=>_o((t=t||{}).issuer||new fo("_:b"),e),go.compareValues=(e,t)=>e===t||!(!co.isValue(e)||!co.isValue(t)||e["@value"]!==t["@value"]||e["@type"]!==t["@type"]||e["@language"]!==t["@language"]||e["@index"]!==t["@index"])||!!(ao.isObject(e)&&"@id"in e&&ao.isObject(t)&&"@id"in t)&&e["@id"]===t["@id"],go.compareShortestLeast=(e,t)=>e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1,go.normalizeDocumentLoader=e=>e.length<2?go.callbackify(e):async function(t){const r=arguments[1];return new Promise(((n,i)=>{try{e(t,((e,t)=>{if("function"==typeof r)return wo(r,e,t);e?i(e):n(t)}))}catch(e){if("function"==typeof r)return wo(r,e);i(e)}}))},go.callbackify=e=>async function(...t){const r=t[t.length-1];let n;"function"==typeof r&&t.pop();try{n=await e.apply(null,t)}catch(e){if("function"==typeof r)return wo(r,e);throw e}return"function"==typeof r?wo(r,null,n):n};var So=io.NQuads;const xo="http://www.w3.org/1999/02/22-rdf-syntax-ns#",ko="http://www.w3.org/2001/XMLSchema#";var Eo={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",RDF:xo,RDF_LIST:xo+"List",RDF_FIRST:xo+"first",RDF_REST:xo+"rest",RDF_NIL:xo+"nil",RDF_TYPE:xo+"type",RDF_PLAIN_LITERAL:xo+"PlainLiteral",RDF_XML_LITERAL:xo+"XMLLiteral",RDF_JSON_LITERAL:xo+"JSON",RDF_OBJECT:xo+"object",RDF_LANGSTRING:xo+"langString",XSD:ko,XSD_BOOLEAN:ko+"boolean",XSD_DOUBLE:ko+"double",XSD_INTEGER:ko+"integer",XSD_STRING:ko+"string"};const{RDF_LANGSTRING:Io,RDF_PLAIN_LITERAL:Oo,RDF_OBJECT:To,RDF_XML_LITERAL:Ao,XSD_STRING:Po}=Eo;let Co;Co="undefined"!=typeof Node?Node:{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};const{clone:Mo}=yo,Ro={};var No=Ro;Ro.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},Ro.parse=(e,t)=>{const r={},n=Ro.parsers[t||"full"],i=n.regex.exec(e);let o=n.keys.length;for(;o--;)r[n.keys[o]]=void 0===i[o]?null:i[o];return("https"===r.scheme&&"443"===r.port||"http"===r.scheme&&"80"===r.port)&&(r.href=r.href.replace(":"+r.port,""),r.authority=r.authority.replace(":"+r.port,""),r.port=null),r.normalizedPath=Ro.removeDotSegments(r.path),r},Ro.prependBase=(e,t)=>{if(null===e)return t;if(-1!==t.indexOf(":"))return t;ao.isString(e)&&(e=Ro.parse(e||""));const r=Ro.parse(t),n={protocol:e.protocol||""};if(null!==r.authority)n.authority=r.authority,n.path=r.path,n.query=r.query;else if(n.authority=e.authority,""===r.path)n.path=e.path,null!==r.query?n.query=r.query:n.query=e.query;else{if(0===r.path.indexOf("/"))n.path=r.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf("/")+1),t.length>0&&"/"!==t.substr(-1)&&(t+="/"),t+=r.path,n.path=t}n.query=r.query}""!==r.path&&(n.path=Ro.removeDotSegments(n.path));let i=n.protocol;return null!==n.authority&&(i+="//"+n.authority),i+=n.path,null!==n.query&&(i+="?"+n.query),null!==r.fragment&&(i+="#"+r.fragment),""===i&&(i="./"),i},Ro.removeBase=(e,t)=>{if(null===e)return t;ao.isString(e)&&(e=Ro.parse(e||""));let r="";if(""!==e.href?r+=(e.protocol||"")+"//"+(e.authority||""):t.indexOf("//")&&(r+="//"),0!==t.indexOf(r))return t;const n=Ro.parse(t.substr(r.length)),i=e.normalizedPath.split("/"),o=n.normalizedPath.split("/"),a=n.fragment||n.query?0:1;for(;i.length>0&&o.length>a&&i[0]===o[0];)i.shift(),o.shift();let s="";if(i.length>0){i.pop();for(let e=0;e<i.length;++e)s+="../"}return s+=o.join("/"),null!==n.query&&(s+="?"+n.query),null!==n.fragment&&(s+="#"+n.fragment),""===s&&(s="./"),s},Ro.removeDotSegments=e=>{if(0===e.length)return"";const t=e.split("/"),r=[];for(;t.length>0;){const e=t.shift(),n=0===t.length;"."!==e?".."!==e?r.push(e):(r.pop(),n&&r.push("")):n&&r.push("")}return r.length>0&&""!==r[0]&&r.unshift(""),1===r.length&&""===r[0]?"/":r.join("/")};const Lo=/^([A-Za-z][A-Za-z0-9+-.]*|_):/;Ro.isAbsolute=e=>ao.isString(e)&&Lo.test(e),Ro.isRelative=e=>ao.isString(e);const{isArray:jo,isObject:Do,isString:Bo,isUndefined:Uo}=ao,{isAbsolute:Ho,isRelative:Fo,prependBase:Vo,parse:qo}=No,{asArray:zo,compareShortestLeast:Ko}=yo,Wo=new Map,Jo={};var Go=Jo;function Xo(e,t,r,n,i,o){if(null===t||!Bo(t)||Jo.isKeyword(t))return t;if(n&&n.hasOwnProperty(t)&&!0!==i.get(t)&&Jo.createTermDefinition(e,n,t,i,o),e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext),(r=r||{}).vocab){const r=e.mappings.get(t);if(null===r)return null;if(r)return r["@id"]}const a=t.indexOf(":");if(-1!==a){const r=t.substr(0,a),s=t.substr(a+1);return"_"===r||0===s.indexOf("//")?t:(n&&n.hasOwnProperty(r)&&Jo.createTermDefinition(e,n,r,i,o),e.mappings.has(r)?e.mappings.get(r)["@id"]+s:t)}return r.vocab&&"@vocab"in e?e["@vocab"]+t:r.base?Vo(e["@base"],t):t}function $o(e,t,r,n){if(jo(e))for(const i of e)$o(i,t,r,n);else if(Do(e))for(const i in e){if("@context"!==i){$o(e[i],t,r,n);continue}const o=e[i];if(jo(o)){let e=o.length;for(let i=0;i<e;++i){const a=o[i];if(Bo(a)){const s=Vo(n,a),c=t.get(s);r?jo(c)?(Array.prototype.splice.apply(o,[i,1].concat(c)),i+=c.length-1,e=o.length):!1!==c&&(o[i]=c):void 0===c&&t.set(s,!1)}else for(const e in a)Do(a[e])&&$o(a[e],t,r,n)}}else if(Bo(o)){const a=Vo(n,o),s=t.get(a);r?!1!==s&&(e[i]=s):void 0===s&&t.set(a,!1)}else for(const e in o)Do(o[e])&&$o(o[e],t,r,n)}}function Yo(e,t){if(!e||"object"!=typeof e||!t||"object"!=typeof t)return e===t;const r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!Yo(e[r],t[r]))return!1;return!0}const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r in e){let n=e[r],i=t[r];if("@container"===r&&Array.isArray(n)&&Array.isArray(i)&&(n=n.slice().sort(),i=i.slice().sort()),!Yo(n,i))return!1}return!0}Jo.cache=new class{constructor(e=100){this.order=[],this.cache=new Map,this.size=e}get(e,t){const r=this.cache.get(e);if(r){const e=JSON.stringify(t);return r.get(e)||null}return null}set(e,t,r){if(this.order.length===this.size){const e=this.order.shift();this.cache.get(e.activeCtx).delete(e.localCtx)}const n=JSON.stringify(t);this.order.push({activeCtx:e,localCtx:n});let i=this.cache.get(e);i||(i=new Map,this.cache.set(e,i)),i.set(n,Mo(r))}},Jo.process=({activeCtx:e,localCtx:t,options:r,isPropertyTermScopedContext:n=!1,isTypeScopedContext:i=!1})=>{Do(t)&&"@context"in t&&jo(t["@context"])&&(t=t["@context"]);const o=zo(t);if(0===o.length)return e;const a=e.previousContext||e;if(n&&e.previousContext)return(e=e.clone()).isPropertyTermScoped=!0,e.previousContext=Jo.process({activeCtx:e.previousContext,localCtx:o,options:r,isPropertyTermScopedContext:n}),e;let s=e;for(let c=0;c<o.length;++c){let u=o[c];if(e=s,null===u){if(!n&&0!==Object.keys(e.protected).length){const n=r&&r.protectedMode||"error";if("error"===n)throw new uo("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});if("warn"===n){console.warn("WARNING: invalid context nullification");const t=e;s=e=Jo.getInitialContext(r).clone();for(const[r,n]of Object.entries(t.protected))n&&(e.mappings[r]=yo.clone(t.mappings[r]));e.protected=yo.clone(t.protected),Jo.cache&&Jo.cache.set(t,u,s);continue}throw new uo("Invalid protectedMode.","jsonld.SyntaxError",{code:"invalid protected mode",context:t,protectedMode:n})}s=e=Jo.getInitialContext(r).clone(),i&&(s.previousContext=a.clone());continue}if(Jo.cache){const t=Jo.cache.get(e,u);if(t){s=e=t;continue}}if(Do(u)&&"@context"in u&&(u=u["@context"]),!Do(u))throw new uo("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:u});s=s.clone();const f=new Map;if("@version"in u){if(1.1!==u["@version"])throw new uo("Unsupported JSON-LD version: "+u["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:u});if(e.processingMode&&"json-ld-1.0"===e.processingMode)throw new uo("@version: "+u["@version"]+" not compatible with "+e.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:u});s.processingMode="json-ld-1.1",s["@version"]=u["@version"],f.set("@version",!0)}if(s.processingMode=s.processingMode||e.processingMode||"json-ld-1.0","@base"in u){let t=u["@base"];if(null===t);else if(Ho(t))t=qo(t);else{if(!Fo(t))throw new uo('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:u});t=qo(Vo(e["@base"].href,t))}s["@base"]=t,f.set("@base",!0)}if("@vocab"in u){const e=u["@vocab"];if(null===e)delete s["@vocab"];else{if(!Bo(e))throw new uo('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:u});if(!Ho(e))throw new uo('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:u});s["@vocab"]=e}f.set("@vocab",!0)}if("@language"in u){const e=u["@language"];if(null===e)delete s["@language"];else{if(!Bo(e))throw new uo('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:u});s["@language"]=e.toLowerCase()}f.set("@language",!0)}f.set("@protected",u["@protected"]||!1);for(const e in u)Jo.createTermDefinition(s,u,e,f,r,n);i&&!s.previousContext&&(s.previousContext=a.clone()),Jo.cache&&Jo.cache.set(e,u,s)}return s},Jo.createTermDefinition=(e,t,r,n,i,o=!1)=>{if(n.has(r)){if(n.get(r))return;throw new uo("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:t,term:r})}if(n.set(r,!1),Jo.isKeyword(r))throw new uo("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:r});if(""===r)throw new uo("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:t});const a=e.mappings.get(r);let s;if(e.mappings.has(r)&&e.mappings.delete(r),t.hasOwnProperty(r)&&(s=t[r]),null===s||Do(s)&&null===s["@id"])return e.mappings.set(r,null),void n.set(r,!0);let c=!1;if(Bo(s)&&(c=!0,s={"@id":s}),!Do(s))throw new uo("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:t});const u={};e.mappings.set(r,u),u.reverse=!1;const f=["@container","@id","@language","@reverse","@type"];Jo.processingMode(e,1.1)&&f.push("@context","@nest","@prefix","@protected");for(const e in s)if(!f.includes(e))throw new uo("Invalid JSON-LD syntax; a term definition must not contain "+e,"jsonld.SyntaxError",{code:"invalid term definition",context:t});const l=r.indexOf(":");if(u._termHasColon=-1!==l,"@reverse"in s){if("@id"in s)throw new uo("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});if("@nest"in s)throw new uo("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});const r=s["@reverse"];if(!Bo(r))throw new uo("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});const o=Xo(e,r,{vocab:!0,base:!1},t,n,i);if(!Ho(o))throw new uo("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});u["@id"]=o,u.reverse=!0}else if("@id"in s){let o=s["@id"];if(!Bo(o))throw new uo("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(o!==r){if(o=Xo(e,o,{vocab:!0,base:!1},t,n,i),!Ho(o)&&!Jo.isKeyword(o))throw new uo("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});u["@id"]=o,u._prefix=!u._termHasColon&&o.match(/[:\/\?#\[\]@]$/)&&(c||Jo.processingMode(e,1))}}if(!("@id"in u))if(u._termHasColon){const o=r.substr(0,l);if(t.hasOwnProperty(o)&&Jo.createTermDefinition(e,t,o,n,i),e.mappings.has(o)){const t=r.substr(l+1);u["@id"]=e.mappings.get(o)["@id"]+t}else u["@id"]=r}else{if(!("@vocab"in e))throw new uo("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t,term:r});u["@id"]=e["@vocab"]+r}if((!0===s["@protected"]||!0===n.get("@protected")&&!1!==s["@protected"])&&(e.protected[r]=!0,u.protected=!0),n.set(r,!0),"@type"in s){let r=s["@type"];if(!Bo(r))throw new uo("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if("@id"!==r&&"@vocab"!==r&&"@json"!==r){if(r=Xo(e,r,{vocab:!0,base:!1},t,n,i),!Ho(r))throw new uo("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if(0===r.indexOf("_:"))throw new uo("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}u["@type"]=r}if("@container"in s){const r=Bo(s["@container"])?[s["@container"]]:s["@container"]||[],n=["@list","@set","@index","@language"];let i=!0;const o=r.includes("@set");if(Jo.processingMode(e,1.1))if(n.push("@graph","@id","@type"),r.includes("@list")){if(1!==r.length)throw new uo("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else if(r.includes("@graph")){if(r.some((e=>"@graph"!==e&&"@id"!==e&&"@index"!==e&&"@set"!==e)))throw new uo("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else i&=r.length<=(o?2:1);else i&=!jo(s["@container"]),i&=r.length<=1;if(i&=r.every((e=>n.includes(e))),i&=!(o&&r.includes("@list")),!i)throw new uo("Invalid JSON-LD syntax; @context @container value must be one of the following: "+n.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:t});if(u.reverse&&!r.every((e=>["@index","@set"].includes(e))))throw new uo("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});u["@container"]=r}if("@context"in s&&(u["@context"]=s["@context"]),"@language"in s&&!("@type"in s)){let e=s["@language"];if(null!==e&&!Bo(e))throw new uo("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:t});null!==e&&(e=e.toLowerCase()),u["@language"]=e}if("@prefix"in s){if(u._termHasColon)throw new uo("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:t});if("boolean"!=typeof s["@prefix"])throw new uo("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:t});u._prefix=!0===s["@prefix"]}if("@nest"in s){const e=s["@nest"];if(!Bo(e)||"@nest"!==e&&0===e.indexOf("@"))throw new uo("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:t});u["@nest"]=e}
|
|
17
|
+
// disallow aliasing @context and @preserve
|
|
18
|
+
const d=u["@id"];if("@context"===d||"@preserve"===d)throw new uo("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:t});if(a&&a.protected&&!o&&(e.protected[r]=!0,u.protected=!0,!Yo(a,u))){const e=i&&i.protectedMode||"error";if("error"===e)throw new uo("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:t,term:r});if("warn"===e)return void console.warn("WARNING: protected term redefinition",{term:r});throw new uo("Invalid protectedMode.","jsonld.SyntaxError",{code:"invalid protected mode",context:t,term:r,protectedMode:e})}},Jo.expandIri=(e,t,r,n)=>Xo(e,t,r,void 0,void 0,n),Jo.getInitialContext=e=>{const t=qo(e.base||""),r=JSON.stringify({base:t,processingMode:e.processingMode}),n=Wo.get(r);if(n)return n;const i={"@base":t,processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:function(){const e=this;if(e.inverse)return e.inverse;const t=e.inverse={},r=e.fastCurieMap={},n={},i=e["@language"]||"@none",s=e.mappings,c=[...s.keys()].sort(Ko);for(const e of c){const o=s.get(e);if(null===o)continue;let c=o["@container"]||"@none";c=[].concat(c).sort().join("");const u=zo(o["@id"]);for(const s of u){let u=t[s];const f=Jo.isKeyword(s);if(u)f||o._termHasColon||n[s].push(e);else if(t[s]=u={},!f&&!o._termHasColon){n[s]=[e];const t={iri:s,terms:n[s]};s[0]in r?r[s[0]].push(t):r[s[0]]=[t]}if(u[c]||(u[c]={"@language":{},"@type":{},"@any":{}}),u=u[c],a(e,u["@any"],"@none"),o.reverse)a(e,u["@type"],"@reverse");else if("@type"in o)a(e,u["@type"],o["@type"]);else if("@language"in o){const t=o["@language"]||"@null";a(e,u["@language"],t)}else a(e,u["@language"],i),a(e,u["@type"],"@none"),a(e,u["@language"],"@none")}}for(const e in r)o(r,e,1);return t},clone:function(){const e={};return e["@base"]=this["@base"],e.mappings=yo.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=yo.clone(this.protected),this.previousContext&&(e.isPropertyTermScoped=this.previousContext.isPropertyTermScoped,e.previousContext=this.previousContext.clone()),e.revertTypeScopedContext=this.revertTypeScopedContext,"@language"in this&&(e["@language"]=this["@language"]),"@vocab"in this&&(e["@vocab"]=this["@vocab"]),e},revertTypeScopedContext:function(){return this.previousContext?this.previousContext.clone():this},protected:{}};return 1e4===Wo.size&&Wo.clear(),Wo.set(r,i),i;function o(e,t,r){const n=e[t],i=e[t]={};let a,s;for(const e of n)a=e.iri,s=r>=a.length?"":a[r],s in i?i[s].push(e):i[s]=[e];for(const e in i)""!==e&&o(i,e,r+1)}function a(e,t,r){t.hasOwnProperty(r)||(t[r]=e)}},Jo.getContextValue=(e,t,r)=>{if(null===t){if("@context"===r)return;return null}if(e.mappings.has(t)){const n=e.mappings.get(t);if(Uo(r))return n;if(n.hasOwnProperty(r))return n[r]}return"@language"===r&&e.hasOwnProperty(r)?e[r]:"@context"!==r?null:void 0},Jo.getAllContexts=async(e,t)=>async function(e,t){const r=yo.normalizeDocumentLoader(t.documentLoader);return await async function e(r,n,i){if(n.size>10)throw new uo("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"loading remote context failed",max:10});const o=new Map;if($o(r,o,!1,t.base),0===o.size)return;const a=[...o.keys()].filter((e=>!1===o.get(e)));return Promise.all(a.map((async a=>{if(n.has(a))throw new uo("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"recursive context inclusion",url:a});const s=new Set(n);let c,u;s.add(a);try{c=await i(a),u=c.document||null,Bo(u)&&(u=JSON.parse(u))}catch(e){throw new uo("Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.","jsonld.InvalidUrl",{code:"loading remote context failed",url:a,cause:e})}if(!Do(u))throw new uo("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:a});u="@context"in u?{"@context":u["@context"]}:{"@context":{}},c.contextUrl&&(jo(u["@context"])||(u["@context"]=[u["@context"]]),u["@context"].push(c.contextUrl)),await e(u,s,i),o.set(a,u["@context"]),$o(r,o,!0,t.base)})))}(e,new Set,r),e}(e,t),Jo.processingMode=(e,t)=>t.toString()>="1.1"?e.processingMode&&e.processingMode>="json-ld-"+t.toString():!e.processingMode||"json-ld-1.0"===e.processingMode,Jo.isKeyword=e=>{if(!Bo(e))return!1;switch(e){case"@base":case"@container":case"@context":case"@default":case"@embed":case"@explicit":case"@graph":case"@id":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1};const{isArray:Qo,isObject:Zo,isEmptyObject:ea,isString:ta,isUndefined:ra}=ao,{isList:na,isValue:ia,isGraph:oa}=co,{expandIri:aa,getContextValue:sa,isKeyword:ca,process:ua,processingMode:fa}=Go,{isAbsolute:la}=No,{addValue:da,asArray:ha,getValues:pa,validateTypeValue:ba}=yo,ga={};var ya=ga;function ma({activeCtx:e,activeProperty:t,expandedActiveProperty:r,element:n,expandedParent:i,options:o={},insideList:a,expansionMap:s}){const c=Object.keys(n).sort(),u=[];for(const f of c){let c,l=n[f];if("@context"===f)continue;let d=aa(e,f,{vocab:!0},o);if((null===d||!la(d)&&!ca(d))&&(d=s({unmappedProperty:f,activeCtx:e,activeProperty:t,parent:n,options:o,insideList:a,value:l,expandedParent:i}),void 0===d))continue;if(ca(d)){if("@reverse"===r)throw new uo("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:l});if(d in i)throw new uo("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:d})}if("@id"===d){if(!ta(l)){if(!o.isFrame)throw new uo('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:l});if(Zo(l)){if(!ea(l))throw new uo('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:l})}else{if(!Qo(l))throw new uo('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:l});if(!l.every((e=>ta(e))))throw new uo('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:l})}}da(i,"@id",ha(l).map((t=>ta(t)?aa(e,t,{base:!0},o):t)),{propertyIsArray:o.isFrame});continue}if("@type"===d){ba(l),da(i,"@type",ha(l).map((t=>ta(t)?aa(e.previousContext||e,t,{base:!0,vocab:!0},o):t)),{propertyIsArray:o.isFrame});continue}if("@graph"===d&&!Zo(l)&&!Qo(l))throw new uo('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:l});if("@value"===d){da(i,"@value",l,{propertyIsArray:o.isFrame});continue}if("@language"===d){if(null===l)continue;if(!ta(l)&&!o.isFrame)throw new uo('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:l});l=ha(l).map((e=>ta(e)?e.toLowerCase():e)),da(i,"@language",l,{propertyIsArray:o.isFrame});continue}if("@index"===d){if(!ta(l))throw new uo('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:l});da(i,"@index",l);continue}if("@reverse"===d){if(!Zo(l))throw new uo('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:l});if(c=ga.expand({activeCtx:e,activeProperty:"@reverse",element:l,options:o,expansionMap:s}),"@reverse"in c)for(const e in c["@reverse"])da(i,e,c["@reverse"][e],{propertyIsArray:!0});let t=i["@reverse"]||null;for(const e in c){if("@reverse"===e)continue;null===t&&(t=i["@reverse"]={}),da(t,e,[],{propertyIsArray:!0});const r=c[e];for(let n=0;n<r.length;++n){const i=r[n];if(ia(i)||na(i))throw new uo('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:c});da(t,e,i,{propertyIsArray:!0})}}continue}if("@nest"===d){u.push(f);continue}let h=e;const p=sa(e,f,"@context");ra(p)||(h=ua({activeCtx:e,localCtx:p,isPropertyTermScopedContext:!0,options:o}));const b=sa(h,f,"@container")||[];if(b.includes("@language")&&Zo(l))c=va(h,l,o);else if(b.includes("@index")&&Zo(l)){const e=b.includes("@graph");c=wa({activeCtx:h,options:o,activeProperty:f,value:l,expansionMap:s,asGraph:e,indexKey:"@index"})}else if(b.includes("@id")&&Zo(l)){const e=b.includes("@graph");c=wa({activeCtx:h,options:o,activeProperty:f,value:l,expansionMap:s,asGraph:e,indexKey:"@id"})}else if(b.includes("@type")&&Zo(l))c=wa({activeCtx:h.revertTypeScopedContext(),options:o,activeProperty:f,value:l,expansionMap:s,asGraph:!1,indexKey:"@type"});else{const n="@list"===d;if(n||"@set"===d){let e=t;n&&"@graph"===r&&(e=null),c=ga.expand({activeCtx:h,activeProperty:e,element:l,options:o,insideList:n,expansionMap:s})}else c="@json"===sa(e,f,"@type")?{"@type":"@json","@value":l}:ga.expand({activeCtx:h,activeProperty:f,element:l,options:o,insideList:!1,expansionMap:s})}if(null===c&&"@value"!==d&&(c=s({unmappedValue:l,expandedProperty:d,activeCtx:h,activeProperty:t,parent:n,options:o,insideList:a,key:f,expandedParent:i}),void 0===c))continue;if("@list"!==d&&!na(c)&&b.includes("@list")&&(c={"@list":ha(c)}),b.includes("@graph")&&!b.some((e=>"@id"===e||"@index"===e))&&(c=ha(c).map((e=>oa(e)?e:{"@graph":ha(e)}))),h.mappings.has(f)&&h.mappings.get(f).reverse){const e=i["@reverse"]=i["@reverse"]||{};c=ha(c);for(let t=0;t<c.length;++t){const r=c[t];if(ia(r)||na(r))throw new uo('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:c});da(e,d,r,{propertyIsArray:!0})}continue}const g=!["@index","@id","@type","@value","@language"].includes(d);da(i,d,c,{propertyIsArray:g})}if("@value"in n){const t=n["@value"];if("@json"===n["@type"]&&fa(e,1.1));else if((Zo(t)||Qo(t))&&!o.isFrame)throw new uo('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:t})}for(const c of u){const u=Qo(n[c])?n[c]:[n[c]];for(const n of u){if(!Zo(n)||Object.keys(n).some((t=>"@value"===aa(e,t,{vocab:!0},o))))throw new uo("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:n});ma({activeCtx:e,activeProperty:t,expandedActiveProperty:r,element:n,expandedParent:i,options:o,insideList:a,expansionMap:s})}}}function va(e,t,r){const n=[],i=Object.keys(t).sort();for(const o of i){const i=aa(e,o,{vocab:!0},r);let a=t[o];Qo(a)||(a=[a]);for(const e of a){if(null===e)continue;if(!ta(e))throw new uo("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:t});const r={"@value":e};"@none"!==i&&(r["@language"]=o.toLowerCase()),n.push(r)}}return n}function wa({activeCtx:e,options:t,activeProperty:r,value:n,expansionMap:i,asGraph:o,indexKey:a}){const s=[],c=Object.keys(n).sort(),u="@type"===a;for(let f of c){if(u){const r=sa(e,f,"@context");ra(r)||(e=ua({activeCtx:e,localCtx:r,isTypeScopedContext:!0,options:t}))}let c=n[f];Qo(c)||(c=[c]);const l=aa(e,f,{vocab:!0},t);"@id"===a?f=aa(e,f,{base:!0},t):u&&(f=l),c=ga.expand({activeCtx:e,activeProperty:r,element:c,options:t,insideList:!1,insideIndex:!0,expansionMap:i});for(let e of c)o&&!oa(e)&&(e={"@graph":[e]}),"@type"===a?"@none"===l||(e["@type"]?e["@type"]=[f].concat(e["@type"]):e["@type"]=[f]):"@none"===l||a in e||(e[a]=f),s.push(e)}return s}ga.expand=({activeCtx:e,activeProperty:t=null,element:r,options:n={},insideList:i=!1,insideIndex:o=!1,typeScopedContext:a=null,expansionMap:s=(()=>{})})=>{if(null==r)return null;if("@default"===t&&(n=Object.assign({},n,{isFrame:!1})),!Qo(r)&&!Zo(r)){if(!i&&(null===t||"@graph"===aa(e,t,{vocab:!0},n))){const o=s({unmappedValue:r,activeCtx:e,activeProperty:t,options:n,insideList:i});return void 0===o?null:o}return function({activeCtx:e,activeProperty:t,value:r,options:n}){if(null==r)return null;const i=aa(e,t,{vocab:!0},n);if("@id"===i)return aa(e,r,{base:!0},n);if("@type"===i)return aa(e,r,{vocab:!0,base:!0},n);const o=sa(e,t,"@type");if(("@id"===o||"@graph"===i)&&ta(r))return{"@id":aa(e,r,{base:!0},n)};if("@vocab"===o&&ta(r))return{"@id":aa(e,r,{vocab:!0,base:!0},n)};if(ca(i))return r;const a={};if(o&&!["@id","@vocab"].includes(o))a["@type"]=o;else if(ta(r)){const r=sa(e,t,"@language");null!==r&&(a["@language"]=r)}return["boolean","number","string"].includes(typeof r)||(r=r.toString()),a["@value"]=r,a}({activeCtx:e,activeProperty:t,value:r,options:n})}if(Qo(r)){let c=[];const u=sa(e,t,"@container")||[];i=i||u.includes("@list");for(let u=0;u<r.length;++u){let f=ga.expand({activeCtx:e,activeProperty:t,element:r[u],options:n,expansionMap:s,insideIndex:o,typeScopedContext:a});i&&Qo(f)&&(f={"@list":f}),null===f&&(f=s({unmappedValue:r[u],activeCtx:e,activeProperty:t,parent:r,index:u,options:n,expandedParent:c,insideList:i}),void 0===f)||(Qo(f)?c=c.concat(f):c.push(f))}return c}const c=aa(e,t,{vocab:!0},n);a=a||(e.previousContext?e:null);let u=Object.keys(r).sort(),f=!o;if(f&&a&&u.length<=2&&!u.includes("@context"))for(const t of u){const r=aa(a,t,{vocab:!0},n);if("@value"===r){f=!1,e=a;break}if("@id"===r&&1===u.length){f=!1;break}}f&&(e=e.revertTypeScopedContext()),"@context"in r&&(e=ua({activeCtx:e,localCtx:r["@context"],options:n}));for(const t of u)if("@type"===aa(e,t,{vocab:!0},n)){const i=r[t],o=Array.isArray(i)?i.length>1?i.slice().sort():i:[i];for(const t of o){const r=sa(e.previousContext||e,t,"@context");ra(r)||(e=ua({activeCtx:e,localCtx:r,options:n,isTypeScopedContext:!0}))}}let l={};ma({activeCtx:e,activeProperty:t,expandedActiveProperty:c,element:r,expandedParent:l,options:n,insideList:i,typeScopedContext:a,expansionMap:s}),u=Object.keys(l);let d=u.length;if("@value"in l){if("@type"in l&&"@language"in l)throw new uo('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:l});let o=d-1;if("@type"in l&&(o-=1),"@index"in l&&(o-=1),"@language"in l&&(o-=1),0!==o)throw new uo('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and at most one other property which can be "@type" or "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:l});const a=null===l["@value"]?[]:ha(l["@value"]),c=pa(l,"@type");if(0===a.length){const o=s({unmappedValue:l,activeCtx:e,activeProperty:t,element:r,options:n,insideList:i});l=void 0!==o?o:null}else{if(!a.every((e=>ta(e)||ea(e)))&&"@language"in l)throw new uo("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:l});if(fa(e,1.1)&&c.includes("@json")&&1===c.length);else if(!c.every((e=>la(e)&&!(ta(e)&&0===e.indexOf("_:"))||ea(e))))throw new uo('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:l})}}else if("@type"in l&&!Qo(l["@type"]))l["@type"]=[l["@type"]];else if("@set"in l||"@list"in l){if(d>1&&(2!==d||!("@index"in l)))throw new uo('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:l});"@set"in l&&(l=l["@set"],u=Object.keys(l),d=u.length)}else if(1===d&&"@language"in l){const o=s(l,{unmappedValue:l,activeCtx:e,activeProperty:t,element:r,options:n,insideList:i});l=void 0!==o?o:null}if(Zo(l)&&!n.keepFreeFloatingNodes&&!i&&(null===t||"@graph"===c)&&(0===d||"@value"in l||"@list"in l||1===d&&"@id"in l)){const o=s({unmappedValue:l,activeCtx:e,activeProperty:t,element:r,options:n,insideList:i});l=void 0!==o?o:null}return l};const{isKeyword:_a}=Go,Sa={};var xa=Sa;Sa.createMergedNodeMap=(e,t)=>{const r=(t=t||{}).issuer||new yo.IdentifierIssuer("_:b"),n={"@default":{}};return Sa.createNodeMap(e,n,"@default",r),Sa.mergeNodeMaps(n)},Sa.createNodeMap=(e,t,r,n,i,o)=>{if(ao.isArray(e)){for(const i of e)Sa.createNodeMap(i,t,r,n,void 0,o);return}if(!ao.isObject(e))return void(o&&o.push(e));if(co.isValue(e)){if("@type"in e){let t=e["@type"];0===t.indexOf("_:")&&(e["@type"]=t=n.getId(t))}return void(o&&o.push(e))}if(o&&co.isList(e)){const a=[];return Sa.createNodeMap(e["@list"],t,r,n,i,a),void o.push({"@list":a})}if("@type"in e){const t=e["@type"];for(const e of t)0===e.indexOf("_:")&&n.getId(e)}ao.isUndefined(i)&&(i=co.isBlankNode(e)?n.getId(e["@id"]):e["@id"]),o&&o.push({"@id":i});const a=t[r],s=a[i]=a[i]||{};s["@id"]=i;const c=Object.keys(e).sort();for(let o of c){if("@id"===o)continue;if("@reverse"===o){const o={"@id":i},s=e["@reverse"];for(const e in s){const i=s[e];for(const s of i){let i=s["@id"];co.isBlankNode(s)&&(i=n.getId(i)),Sa.createNodeMap(s,t,r,n,i),yo.addValue(a[i],e,o,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===o){i in t||(t[i]={}),Sa.createNodeMap(e[o],t,i,n);continue}if("@type"!==o&&_a(o)){if("@index"===o&&o in s&&(e[o]!==s[o]||e[o]["@id"]!==s[o]["@id"]))throw new uo("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:s});s[o]=e[o];continue}const c=e[o];if(0===o.indexOf("_:")&&(o=n.getId(o)),0!==c.length)for(let e of c)if("@type"===o&&(e=0===e.indexOf("_:")?n.getId(e):e),co.isSubject(e)||co.isSubjectReference(e)){const i=co.isBlankNode(e)?n.getId(e["@id"]):e["@id"];yo.addValue(s,o,{"@id":i},{propertyIsArray:!0,allowDuplicate:!1}),Sa.createNodeMap(e,t,r,n,i)}else if(co.isValue(e))yo.addValue(s,o,e,{propertyIsArray:!0,allowDuplicate:!1});else if(co.isList(e)){const a=[];Sa.createNodeMap(e["@list"],t,r,n,i,a),e={"@list":a},yo.addValue(s,o,e,{propertyIsArray:!0,allowDuplicate:!1})}else Sa.createNodeMap(e,t,r,n,i),yo.addValue(s,o,e,{propertyIsArray:!0,allowDuplicate:!1});else yo.addValue(s,o,[],{propertyIsArray:!0})}},Sa.mergeNodeMapGraphs=e=>{const t={};for(const r of Object.keys(e).sort())for(const n of Object.keys(e[r]).sort()){const i=e[r][n];n in t||(t[n]={"@id":n});const o=t[n];for(const e of Object.keys(i).sort())if(_a(e))o[e]=yo.clone(i[e]);else for(const t of i[e])yo.addValue(o,e,yo.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},Sa.mergeNodeMaps=e=>{const t=e["@default"],r=Object.keys(e).sort();for(const n of r){if("@default"===n)continue;const r=e[n];let i=t[n];i?"@graph"in i||(i["@graph"]=[]):t[n]=i={"@id":n,"@graph":[]};const o=i["@graph"];for(const e of Object.keys(r).sort()){const t=r[e];co.isSubjectReference(t)||o.push(t)}}return t};const{isSubjectReference:ka}=co,{createMergedNodeMap:Ea}=xa,Ia={};var Oa=Ia;Ia.flatten=e=>{const t=Ea(e),r=[],n=Object.keys(t).sort();for(let e=0;e<n.length;++e){const i=t[n[e]];ka(i)||r.push(i)}return r};const{RDF_LIST:Ta,RDF_FIRST:Aa,RDF_REST:Pa,RDF_NIL:Ca,RDF_TYPE:Ma,RDF_JSON_LITERAL:Ra,XSD_BOOLEAN:Na,XSD_DOUBLE:La,XSD_INTEGER:ja,XSD_STRING:Da}=Eo,Ba={};var Ua=Ba;function Ha(e,t){if(e.termType.endsWith("Node"))return{"@id":e.value};const r={"@value":e.value};if(e.language)r["@language"]=e.language;else{let n=e.datatype.value;if(n||(n=Da),n===Ra){n="@json";try{r["@value"]=JSON.parse(r["@value"])}catch(e){throw new uo("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:r["@value"],cause:e})}}if(t){if(n===Na)"true"===r["@value"]?r["@value"]=!0:"false"===r["@value"]&&(r["@value"]=!1);else if(ao.isNumeric(r["@value"]))if(n===ja){const e=parseInt(r["@value"],10);e.toFixed(0)===r["@value"]&&(r["@value"]=e)}else n===La&&(r["@value"]=parseFloat(r["@value"]));[Na,ja,La,Da].includes(n)||(r["@type"]=n)}else n!==Da&&(r["@type"]=n)}return r}Ba.fromRDF=async(e,{useRdfType:t=!1,useNativeTypes:r=!1})=>{const n={},i={"@default":n},o={};for(const a of e){const e="DefaultGraph"===a.graph.termType?"@default":a.graph.value;e in i||(i[e]={}),"@default"===e||e in n||(n[e]={"@id":e});const s=i[e],c=a.subject.value,u=a.predicate.value,f=a.object;c in s||(s[c]={"@id":c});const l=s[c],d=f.termType.endsWith("Node");if(d&&!(f.value in s)&&(s[f.value]={"@id":f.value}),u===Ma&&!t&&d){yo.addValue(l,"@type",f.value,{propertyIsArray:!0});continue}const h=Ha(f,r);if(yo.addValue(l,u,h,{propertyIsArray:!0}),d)if(f.value===Ca){const e=s[f.value];"usages"in e||(e.usages=[]),e.usages.push({node:l,property:u,value:h})}else f.value in o?o[f.value]=!1:o[f.value]={node:l,property:u,value:h}}for(const e in i){const t=i[e];if(!(Ca in t))continue;const r=t[Ca];if(r.usages){for(let e of r.usages){let r=e.node,n=e.property,i=e.value;const a=[],s=[];let c=Object.keys(r).length;for(;n===Pa&&ao.isObject(o[r["@id"]])&&ao.isArray(r[Aa])&&1===r[Aa].length&&ao.isArray(r[Pa])&&1===r[Pa].length&&(3===c||4===c&&ao.isArray(r["@type"])&&1===r["@type"].length&&r["@type"][0]===Ta)&&(a.push(r[Aa][0]),s.push(r["@id"]),e=o[r["@id"]],r=e.node,n=e.property,i=e.value,c=Object.keys(r).length,co.isBlankNode(r)););delete i["@id"],i["@list"]=a.reverse();for(const e of s)delete t[e]}delete r.usages}}const a=[],s=Object.keys(n).sort();for(const e of s){const t=n[e];if(e in i){const r=t["@graph"]=[],n=i[e],o=Object.keys(n).sort();for(const e of o){const t=n[e];co.isSubjectReference(t)||r.push(t)}}co.isSubjectReference(t)||a.push(t)}return a};var Fa=function e(t){return null===t||"object"!=typeof t||null!=t.toJSON?JSON.stringify(t):Array.isArray(t)?"["+t.reduce(((t,r,n)=>t+(0===n?"":",")+e(void 0===r||"symbol"==typeof r?null:r)),"")+"]":"{"+Object.keys(t).sort().reduce(((r,n,i)=>void 0===t[n]||"symbol"==typeof t[n]?r:r+(0===r.length?"":",")+e(n)+":"+e(t[n])),"")+"}"};const{createNodeMap:Va}=xa,{isKeyword:qa}=Go,{RDF_FIRST:za,RDF_REST:Ka,RDF_NIL:Wa,RDF_TYPE:Ja,RDF_JSON_LITERAL:Ga,RDF_LANGSTRING:Xa,XSD_BOOLEAN:$a,XSD_DOUBLE:Ya,XSD_INTEGER:Qa,XSD_STRING:Za}=Eo,{isAbsolute:es}=No,ts={};var rs=ts;function ns(e,t,r,n,i){const o=Object.keys(t).sort();for(const a of o){const o=t[a],s=Object.keys(o).sort();for(let t of s){const s=o[t];if("@type"===t)t=Ja;else if(qa(t))continue;for(const o of s){const s={termType:a.startsWith("_:")?"BlankNode":"NamedNode",value:a};if(!es(a))continue;const c={termType:t.startsWith("_:")?"BlankNode":"NamedNode",value:t};if(!es(t))continue;if("BlankNode"===c.termType&&!i.produceGeneralizedRdf)continue;const u=is(o,n,e,r);u&&e.push({subject:s,predicate:c,object:u,graph:r})}}}}function is(e,t,r,n){const i={};if(co.isValue(e)){i.termType="Literal",i.value=void 0,i.datatype={termType:"NamedNode"};let t=e["@value"];const r=e["@type"]||null;"@json"===r?(i.value=Fa(t),i.datatype.value=Ga):ao.isBoolean(t)?(i.value=t.toString(),i.datatype.value=r||$a):ao.isDouble(t)||r===Ya?(ao.isDouble(t)||(t=parseFloat(t)),i.value=t.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),i.datatype.value=r||Ya):ao.isNumber(t)?(i.value=t.toFixed(0),i.datatype.value=r||Qa):"@language"in e?(i.value=t,i.datatype.value=r||Xa,i.language=e["@language"]):(i.value=t,i.datatype.value=r||Za)}else if(co.isList(e)){const o=function(e,t,r,n){const i={termType:"NamedNode",value:za},o={termType:"NamedNode",value:Ka},a={termType:"NamedNode",value:Wa},s=e.pop(),c=s?{termType:"BlankNode",value:t.getId()}:a;let u=c;for(const a of e){const e=is(a,t,r,n),s={termType:"BlankNode",value:t.getId()};r.push({subject:u,predicate:i,object:e,graph:n}),r.push({subject:u,predicate:o,object:s,graph:n}),u=s}if(s){const e=is(s,t,r,n);r.push({subject:u,predicate:i,object:e,graph:n}),r.push({subject:u,predicate:o,object:a,graph:n})}return c}(e["@list"],t,r,n);i.termType=o.termType,i.value=o.value}else{const t=ao.isObject(e)?e["@id"]:e;i.termType=t.startsWith("_:")?"BlankNode":"NamedNode",i.value=t}return"NamedNode"!==i.termType||es(i.value)?i:null}ts.toRDF=(e,t)=>{const r=new yo.IdentifierIssuer("_:b"),n={"@default":{}};Va(e,n,"@default",r);const i=[],o=Object.keys(n).sort();for(const e of o){let o;if("@default"===e)o={termType:"DefaultGraph",value:""};else{if(!es(e))continue;o=e.startsWith("_:")?{termType:"BlankNode"}:{termType:"NamedNode"},o.value=e}ns(i,n[e],o,r,t)}return i};const{isKeyword:os}=Go,{createNodeMap:as,mergeNodeMapGraphs:ss}=xa,cs={};var us=cs;function fs(e){const t={};for(const r in e)void 0!==e[r]&&(t["@"+r]=[e[r]]);return[t]}function ls(e,t,r){for(let n=r.length-1;n>=0;--n){const i=r[n];if(i.graph===t&&i.subject["@id"]===e["@id"])return!0}return!1}function ds(e,t,r){const n="@"+r;let i=n in e?e[n][0]:t[r];return"embed"===r&&(!0===i?i="@last":!1===i?i="@never":"@always"!==i&&"@never"!==i&&"@link"!==i&&(i="@last")),i}function hs(e){if(!ao.isArray(e)||1!==e.length||!ao.isObject(e[0]))throw new uo("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:e})}function ps(e,t,r,n){let i=!0,o=!1;for(const a in r){let s=!1;const c=yo.getValues(t,a),u=0===yo.getValues(r,a).length;if(os(a)){if("@id"!==a&&"@type"!==a)continue;if(i=!1,"@id"===a){if(r["@id"].length>=0&&!ao.isEmptyObject(r["@id"][0]))return r["@id"].includes(c[0]);s=!0;continue}if("@type"in r)if(u){if(c.length>0)return!1;s=!0}else{if(1!==r["@type"].length||!ao.isEmptyObject(r["@type"][0])){for(const e of r["@type"])if(c.some((t=>t===e)))return!0;return!1}s=c.length>0}}const f=yo.getValues(r,a)[0];let l=!1;if(f&&(hs([f]),l="@default"in f),i=!1,0!==c.length||!l){if(c.length>0&&u)return!1;if(void 0===f){if(c.length>0)return!1;s=!0}else if(ao.isObject(f))s=c.length>0;else if(co.isValue(f))s=c.some((e=>ms(f,e)));else if(co.isSubject(f)||co.isSubjectReference(f))s=c.some((t=>ys(e,f,t,n)));else if(co.isList(f)){const t=f["@list"][0];if(co.isList(c[0])){const r=c[0]["@list"];co.isValue(t)?s=r.some((e=>ms(t,e))):(co.isSubject(t)||co.isSubjectReference(t))&&(s=r.some((r=>ys(e,t,r,n))))}else s=!1}if(!s&&n.requireAll)return!1;o=o||s}}return i||o}function bs(e,t){const r=e.uniqueEmbeds[e.graph],n=r[t],i=n.parent,o=n.property,a={"@id":t};if(ao.isArray(i)){for(let e=0;e<i.length;++e)if(yo.compareValues(i[e],a)){i[e]=a;break}}else{const e=ao.isArray(i[o]);yo.removeValue(i,o,a,{propertyIsArray:e}),yo.addValue(i,o,a,{propertyIsArray:e})}const s=e=>{const t=Object.keys(r);for(const n of t)n in r&&ao.isObject(r[n].parent)&&r[n].parent["@id"]===e&&(delete r[n],s(n))};s(t)}function gs(e,t,r){ao.isObject(e)?yo.addValue(e,t,r,{propertyIsArray:!0}):e.push(r)}function ys(e,t,r,n){if(!("@id"in r))return!1;const i=e.subjects[r["@id"]];return i&&ps(e,i,t,n)}function ms(e,t){const r=t["@value"],n=t["@type"],i=t["@language"],o=e["@value"]?ao.isArray(e["@value"])?e["@value"]:[e["@value"]]:[],a=e["@type"]?ao.isArray(e["@type"])?e["@type"]:[e["@type"]]:[],s=e["@language"]?ao.isArray(e["@language"])?e["@language"]:[e["@language"]]:[];return 0===o.length&&0===a.length&&0===s.length||!(!o.includes(r)&&!ao.isEmptyObject(o[0]))&&!!(!n&&0===a.length||a.includes(n)||n&&ao.isEmptyObject(a[0]))&&!!(!i&&0===s.length||s.includes(i)||i&&ao.isEmptyObject(s[0]))}cs.frameMergedOrDefault=(e,t,r)=>{const n={options:r,graph:"@default",graphMap:{"@default":{}},graphStack:[],subjectStack:[],link:{},bnodeMap:{}},i=new yo.IdentifierIssuer("_:b");as(e,n.graphMap,"@default",i),r.merged&&(n.graphMap["@merged"]=ss(n.graphMap),n.graph="@merged"),n.subjects=n.graphMap[n.graph];const o=[];return cs.frame(n,Object.keys(n.subjects).sort(),t,o),r.pruneBlankNodeIdentifiers&&(r.bnodesToClear=Object.keys(n.bnodeMap).filter((e=>1===n.bnodeMap[e].length))),o},cs.frame=(e,t,r,n,i=null)=>{hs(r),r=r[0];const o=e.options,a={embed:ds(r,o,"embed"),explicit:ds(r,o,"explicit"),requireAll:ds(r,o,"requireAll")},s=function(e,t,r,n){const i={};for(const o of t){const t=e.graphMap[e.graph][o];ps(e,t,r,n)&&(i[o]=t)}return i}(e,t,r,a),c=Object.keys(s).sort();for(const t of c){const c=s[t];if("@link"===a.embed&&t in e.link){gs(n,i,e.link[t]);continue}null===i?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{};const u={};if(u["@id"]=t,0===t.indexOf("_:")&&yo.addValue(e.bnodeMap,t,u,{propertyIsArray:!0}),e.link[t]=u,"@never"===a.embed||ls(c,e.graph,e.subjectStack))gs(n,i,u);else{if("@last"===a.embed&&(t in e.uniqueEmbeds[e.graph]&&bs(e,t),e.uniqueEmbeds[e.graph][t]={parent:n,property:i}),e.subjectStack.push({subject:c,graph:e.graph}),t in e.graphMap){let n=!1,i=null;"@graph"in r?(i=r["@graph"][0],ao.isObject(i)||(i={}),n=!("@merged"===t||"@default"===t)):(n="@merged"!==e.graph,i={}),n&&(e.graphStack.push(e.graph),e.graph=t,cs.frame(e,Object.keys(e.graphMap[t]).sort(),[i],u,"@graph"),e.graph=e.graphStack.pop)}for(const t of Object.keys(c).sort())if(os(t)){if(u[t]=yo.clone(c[t]),"@type"===t)for(const t of c["@type"])0===t.indexOf("_:")&&yo.addValue(e.bnodeMap,t,u,{propertyIsArray:!0})}else if(!a.explicit||t in r)for(let n of c[t]){const i=t in r?r[t]:fs(a);if(co.isList(n)){const i={"@list":[]};gs(u,t,i);const o=n["@list"];for(const s in o)if(n=o[s],co.isSubjectReference(n)){const o=t in r?r[t][0]["@list"]:fs(a);cs.frame(e,[n["@id"]],o,i,"@list")}else gs(i,"@list",yo.clone(n))}else co.isSubjectReference(n)?cs.frame(e,[n["@id"]],i,u,t):ms(i[0],n)&&gs(u,t,yo.clone(n))}for(const e of Object.keys(r).sort()){if(os(e))continue;const t=r[e][0]||{};if(!ds(t,o,"omitDefault")&&!(e in u)){let r="@null";"@default"in t&&(r=yo.clone(t["@default"])),ao.isArray(r)||(r=[r]),u[e]=[{"@preserve":r}]}}if("@reverse"in r)for(const n of Object.keys(r["@reverse"]).sort()){const o=r["@reverse"][n];for(const r of Object.keys(e.subjects))yo.getValues(e.subjects[r],n).some((e=>e["@id"]===t))&&(u["@reverse"]=u["@reverse"]||{},yo.addValue(u["@reverse"],n,[],{propertyIsArray:!0}),cs.frame(e,[r],o,u["@reverse"][n],i))}gs(n,i,u),e.subjectStack.pop()}}};const{isArray:vs,isObject:ws,isString:_s,isUndefined:Ss}=ao,{isList:xs,isValue:ks,isGraph:Es,isSimpleGraph:Is,isSubjectReference:Os}=co,{expandIri:Ts,getContextValue:As,isKeyword:Ps,process:Cs}=Go,{removeBase:Ms}=No,{addValue:Rs,asArray:Ns,compareShortestLeast:Ls}=yo,js={};var Ds=js;function Bs(e,t,r){if("@nest"!==Ts(e,t,{vocab:!0},r))throw new uo("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}js.compact=({activeCtx:e,activeProperty:t=null,element:r,options:n={},compactionMap:i=(()=>{})})=>{if(vs(r)){let o=[];for(let a=0;a<r.length;++a){let s=js.compact({activeCtx:e,activeProperty:t,element:r[a],options:n,compactionMap:i});null===s&&(s=i({unmappedValue:r[a],activeCtx:e,activeProperty:t,parent:r,index:a,options:n}),void 0===s)||o.push(s)}return n.compactArrays&&1===o.length&&0===(As(e,t,"@container")||[]).length&&(o=o[0]),o}const o=As(e,t,"@context");if(Ss(o)||(e=Cs({activeCtx:e,localCtx:o,isPropertyTermScopedContext:!0,options:n})),ws(r)){if(n.link&&"@id"in r&&n.link.hasOwnProperty(r["@id"])){const e=n.link[r["@id"]];for(let t=0;t<e.length;++t)if(e[t].expanded===r)return e[t].compacted}if(ks(r)||Os(r)){const i=js.compactValue({activeCtx:e,activeProperty:t,value:r,options:n});return n.link&&Os(r)&&(n.link.hasOwnProperty(r["@id"])||(n.link[r["@id"]]=[]),n.link[r["@id"]].push({expanded:r,compacted:i})),i}if(xs(r)&&(As(e,t,"@container")||[]).includes("@list"))return js.compact({activeCtx:e,activeProperty:t,element:r["@list"],options:n,compactionMap:i});const o="@reverse"===t,a={};e=e.revertTypeScopedContext(),n.link&&"@id"in r&&(n.link.hasOwnProperty(r["@id"])||(n.link[r["@id"]]=[]),n.link[r["@id"]].push({expanded:r,compacted:a}));let s=r["@type"]||[];s.length>1&&(s=Array.from(s).sort());const c=e;for(const t of s){const r=js.compactIri({activeCtx:c,iri:t,relativeTo:{vocab:!0}}),i=As(c,r,"@context");Ss(i)||(e=Cs({activeCtx:e,localCtx:i,options:n,isTypeScopedContext:!0}))}const u=Object.keys(r).sort();for(const s of u){const c=r[s];if("@id"!==s&&"@type"!==s)if("@reverse"!==s)if("@preserve"!==s)if("@index"!==s)if("@graph"!==s&&"@list"!==s&&Ps(s)){const t=js.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});Rs(a,t,c)}else{if(!vs(c))throw new uo("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(0===c.length){const t=js.compactIri({activeCtx:e,iri:s,value:c,relativeTo:{vocab:!0},reverse:o}),r=e.mappings.has(t)?e.mappings.get(t)["@nest"]:null;let i=a;r&&(Bs(e,r,n),ws(a[r])||(a[r]={}),i=a[r]),Rs(i,t,c,{propertyIsArray:!0})}for(const t of c){const r=js.compactIri({activeCtx:e,iri:s,value:t,relativeTo:{vocab:!0},reverse:o}),c=e.mappings.has(r)?e.mappings.get(r)["@nest"]:null;let u=a;c&&(Bs(e,c,n),ws(a[c])||(a[c]={}),u=a[c]);const f=As(e,r,"@container")||[],l=Es(t),d=xs(t);let h;d?h=t["@list"]:l&&(h=t["@graph"]);let p=js.compact({activeCtx:e,activeProperty:r,element:d||l?h:t,options:n,compactionMap:i});if(d){if(vs(p)||(p=[p]),f.includes("@list")){Rs(u,r,p,{valueIsArray:!0,allowDuplicate:!0});continue}p={[js.compactIri({activeCtx:e,iri:"@list",relativeTo:{vocab:!0}})]:p},"@index"in t&&(p[js.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"])}if(l)if(f.includes("@graph")&&(f.includes("@id")||f.includes("@index")&&Is(t))){let i;u.hasOwnProperty(r)?i=u[r]:u[r]=i={};const o=(f.includes("@id")?t["@id"]:t["@index"])||js.compactIri({activeCtx:e,iri:"@none",vocab:!0});Rs(i,o,p,{propertyIsArray:!n.compactArrays||f.includes("@set")})}else f.includes("@graph")&&Is(t)||(vs(p)&&1===p.length&&n.compactArrays&&(p=p[0]),p={[js.compactIri({activeCtx:e,iri:"@graph",relativeTo:{vocab:!0}})]:p},"@id"in t&&(p[js.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t["@id"]),"@index"in t&&(p[js.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"])),Rs(u,r,p,{propertyIsArray:!n.compactArrays||f.includes("@set")});else if(f.includes("@language")||f.includes("@index")||f.includes("@id")||f.includes("@type")){let n,i;if(u.hasOwnProperty(r)?n=u[r]:u[r]=n={},f.includes("@language"))ks(p)&&(p=p["@value"]),i=t["@language"];else if(f.includes("@index"))i=t["@index"];else if(f.includes("@id")){const t=js.compactIri({activeCtx:e,iri:"@id",vocab:!0});i=p[t],delete p[t]}else if(f.includes("@type")){const t=js.compactIri({activeCtx:e,iri:"@type",vocab:!0});let r;switch([i,...r]=Ns(p[t]||[]),r.length){case 0:delete p[t];break;case 1:p[t]=r[0];break;default:p[t]=r}}i||(i=js.compactIri({activeCtx:e,iri:"@none",vocab:!0})),Rs(n,i,p,{propertyIsArray:f.includes("@set")})}else{const e=!n.compactArrays||f.includes("@set")||f.includes("@list")||vs(p)&&0===p.length||"@list"===s||"@graph"===s;Rs(u,r,p,{propertyIsArray:e})}}}else{if((As(e,t,"@container")||[]).includes("@index"))continue;const r=js.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});Rs(a,r,c)}else{const r=js.compact({activeCtx:e,activeProperty:t,element:c,options:n,compactionMap:i});vs(r)&&0===r.length||Rs(a,s,r)}else{const t=js.compact({activeCtx:e,activeProperty:"@reverse",element:c,options:n,compactionMap:i});for(const r in t)if(e.mappings.has(r)&&e.mappings.get(r).reverse){const i=t[r],o=(As(e,r,"@container")||[]).includes("@set")||!n.compactArrays;Rs(a,r,i,{propertyIsArray:o}),delete t[r]}if(Object.keys(t).length>0){const r=js.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});Rs(a,r,t)}}else{const t="@type"===s,r=t&&e.previousContext||e;let n=Ns(c).map((e=>js.compactIri({activeCtx:r,iri:e,relativeTo:{vocab:t}})));1===n.length&&(n=n[0]);const i=js.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}}),o=vs(n)&&0===c.length;Rs(a,i,n,{propertyIsArray:o})}}return a}return r},js.compactIri=({activeCtx:e,iri:t,value:r=null,relativeTo:n={vocab:!1},reverse:i=!1})=>{if(null===t)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);const o=e.getInverse();if(Ps(t)&&t in o&&"@none"in o[t]&&"@type"in o[t]["@none"]&&"@none"in o[t]["@none"]["@type"])return o[t]["@none"]["@type"]["@none"];if(n.vocab&&t in o){const n=e["@language"]||"@none",o=[];ws(r)&&"@index"in r&&!("@graph"in r)&&o.push("@index","@index@set"),ws(r)&&"@preserve"in r&&(r=r["@preserve"][0]),Es(r)?("@index"in r&&o.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in r&&o.push("@graph@id","@graph@id@set"),o.push("@graph","@graph@set","@set"),"@index"in r||o.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in r||o.push("@graph@id","@graph@id@set")):ws(r)&&!ks(r)&&o.push("@id","@id@set","@type","@set@type");let a="@language",s="@null";if(i)a="@type",s="@reverse",o.push("@set");else if(xs(r)){"@index"in r||o.push("@list");const e=r["@list"];if(0===e.length)a="@any",s="@none";else{let t=0===e.length?n:null,r=null;for(let n=0;n<e.length;++n){const i=e[n];let o="@none",a="@none";if(ks(i)?"@language"in i?o=i["@language"]:"@type"in i?a=i["@type"]:o="@null":a="@id",null===t?t=o:o!==t&&ks(i)&&(t="@none"),null===r?r=a:a!==r&&(r="@none"),"@none"===t&&"@none"===r)break}t=t||"@none",r=r||"@none","@none"!==r?(a="@type",s=r):s=t}}else ks(r)?"@language"in r&&!("@index"in r)?(o.push("@language","@language@set"),s=r["@language"]):"@type"in r&&(a="@type",s=r["@type"]):(a="@type",s="@id"),o.push("@set");o.push("@none"),ws(r)&&!("@index"in r)&&o.push("@index","@index@set"),ks(r)&&1===Object.keys(r).length&&o.push("@language","@language@set");const c=function(e,t,r,n,i,o){null===o&&(o="@null");const a=[];if("@id"!==o&&"@reverse"!==o||!Os(r))a.push(o);else{"@reverse"===o&&a.push("@reverse");const t=js.compactIri({activeCtx:e,iri:r["@id"],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)["@id"]===r["@id"]?a.push.apply(a,["@vocab","@id"]):a.push.apply(a,["@id","@vocab"])}a.push("@none");const s=e.inverse[t];for(let e=0;e<n.length;++e){const t=n[e];if(!(t in s))continue;const r=s[t][i];for(let e=0;e<a.length;++e){const t=a[e];if(t in r)return r[t]}}return null}(e,t,r,o,a,s);if(null!==c)return c}if(n.vocab&&"@vocab"in e){const r=e["@vocab"];if(0===t.indexOf(r)&&t!==r){const n=t.substr(r.length);if(!e.mappings.has(n))return n}}let a=null;const s=[];let c=e.fastCurieMap;const u=t.length-1;for(let e=0;e<u&&t[e]in c;++e)c=c[t[e]],""in c&&s.push(c[""][0]);for(let n=s.length-1;n>=0;--n){const i=s[n],o=i.terms;for(const n of o){const o=n+":"+t.substr(i.iri.length);e.mappings.get(n)._prefix&&(!e.mappings.has(o)||null===r&&e.mappings.get(o)["@id"]===t)&&(null===a||Ls(o,a)<0)&&(a=o)}}return null!==a?a:n.vocab?t:Ms(e["@base"],t)},js.compactValue=({activeCtx:e,activeProperty:t,value:r,options:n})=>{if(ks(r)){const n=As(e,t,"@type"),i=As(e,t,"@language"),o=As(e,t,"@container")||[],a="@index"in r&&!o.includes("@index");if(!a&&(r["@type"]===n||r["@language"]===i))return r["@value"];const s=Object.keys(r).length,c=1===s||2===s&&"@index"in r&&!a,u="@language"in e,f=_s(r["@value"]),l=e.mappings.has(t)&&null===e.mappings.get(t)["@language"];if(c&&(!u||!f||l))return r["@value"];const d={};return a&&(d[js.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=r["@index"]),"@type"in r?d[js.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}})]=js.compactIri({activeCtx:e,iri:r["@type"],relativeTo:{vocab:!0}}):"@language"in r&&(d[js.compactIri({activeCtx:e,iri:"@language",relativeTo:{vocab:!0}})]=r["@language"]),d[js.compactIri({activeCtx:e,iri:"@value",relativeTo:{vocab:!0}})]=r["@value"],d}const i=Ts(e,t,{vocab:!0},n),o=As(e,t,"@type"),a=js.compactIri({activeCtx:e,iri:r["@id"],relativeTo:{vocab:"@vocab"===o}});return"@id"===o||"@vocab"===o||"@graph"===i?a:{[js.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]:a}},
|
|
19
|
+
/**
|
|
20
|
+
* Removes the @preserve keywords as the last step of the compaction
|
|
21
|
+
* algorithm when it is running on framed output.
|
|
22
|
+
*
|
|
23
|
+
* @param ctx the active context used to compact the input.
|
|
24
|
+
* @param input the framed, compacted output.
|
|
25
|
+
* @param options the compaction options used.
|
|
26
|
+
*
|
|
27
|
+
* @return the resulting output.
|
|
28
|
+
*/
|
|
29
|
+
js.removePreserve=(e,t,r)=>{if(vs(t)){const n=[];for(let i=0;i<t.length;++i){const o=js.removePreserve(e,t[i],r);null!==o&&n.push(o)}t=n}else if(ws(t)){
|
|
30
|
+
// remove @preserve
|
|
31
|
+
if("@preserve"in t)return"@null"===t["@preserve"]?null:t["@preserve"];if(ks(t))return t;if(xs(t))return t["@list"]=js.removePreserve(e,t["@list"],r),t;const n=js.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}});if(t.hasOwnProperty(n)){const e=t[n];if(r.link.hasOwnProperty(e)){const n=r.link[e].indexOf(t);if(-1!==n)return r.link[e][n];r.link[e].push(t)}else r.link[e]=[t]}const i=js.compactIri({activeCtx:e,iri:"@graph",relativeTo:{vocab:!0}});for(const o in t){if(o===n&&r.bnodesToClear.includes(t[o])){delete t[n];continue}let a=js.removePreserve(e,t[o],r);const s=As(e,o,"@container")||[];r.compactArrays&&vs(a)&&1===a.length&&0===s.length&&o!==i&&(a=a[0]),t[o]=a}}return t};const{callbackify:Us,normalizeDocumentLoader:Hs}=yo;var Fs=class{constructor(){this._requests={},this.add=Us(this.add.bind(this))}wrapLoader(e){const t=this;return t._loader=Hs(e),function(){return t.add.apply(t,arguments)}}async add(e){const t=this;let r=t._requests[e];if(r)return Promise.resolve(r);r=t._requests[e]=t._loader(e);try{return await r}finally{delete t._requests[e]}}};const{parseLinkHeader:Vs,buildHeaders:qs}=yo,{LINK_HEADER_REL:zs}=Eo;var Ks=({secure:e,strictSSL:t=!0,maxRedirects:r=-1,request:n,headers:i={}}={strictSSL:!0,maxRedirects:-1,headers:{}})=>{i=qs(i),n=n||to;const o=to;return(new Fs).wrapLoader((function(e){return a(e,[])}));async function a(s,c){if(0!==s.indexOf("http:")&&0!==s.indexOf("https:"))throw new uo('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:s});if(e&&0!==s.indexOf("https"))throw new uo('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:s});let u,f=null;if(null!==f)return f;try{u=await function(e,t){return new Promise(((r,n)=>{e(t,((e,t,i)=>{e?n(e):r({res:t,body:i})}))}))}(n,{url:s,headers:i,strictSSL:t,followRedirect:!1})}catch(e){throw new uo("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:s,cause:e})}const{res:l,body:d}=u;f={contextUrl:null,documentUrl:s,document:d||null};const h=o.STATUS_CODES[l.statusCode];if(l.statusCode>=400)throw new uo("URL could not be dereferenced: "+h,"jsonld.InvalidUrl",{code:"loading document failed",url:s,httpStatusCode:l.statusCode});if(l.headers.link&&"application/ld+json"!==l.headers["content-type"]){const e=Vs(l.headers.link)[zs];if(Array.isArray(e))throw new uo("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:s});e&&(f.contextUrl=e.target)}if(l.statusCode>=300&&l.statusCode<400&&l.headers.location){if(c.length===r)throw new uo("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:s,httpStatusCode:l.statusCode,redirects:c});if(-1!==c.indexOf(s))throw new uo("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:s,httpStatusCode:l.statusCode,redirects:c});return c.push(s),a(l.headers.location,c)}return c.push(s),f}};const{parseLinkHeader:Ws,buildHeaders:Js}=yo,{LINK_HEADER_REL:Gs}=Eo,Xs=/(^|(\r\n))link:/i;var $s=({secure:e,headers:t={},xhr:r}={headers:{}})=>(t=Js(t),(new Fs).wrapLoader((async function(n){if(0!==n.indexOf("http:")&&0!==n.indexOf("https:"))throw new uo('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:n});if(e&&0!==n.indexOf("https"))throw new uo('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:n});let i;try{i=await function(e,t,r){const n=new(e=e||XMLHttpRequest);return new Promise(((e,i)=>{n.onload=()=>e(n),n.onerror=e=>i(e),n.open("GET",t,!0);for(const e in r)n.setRequestHeader(e,r[e]);n.send()}))}(r,n,t)}catch(e){throw new uo("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:n,cause:e})}if(i.status>=400)throw new uo("URL could not be dereferenced: "+i.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:n,httpStatusCode:i.status});const o={contextUrl:null,documentUrl:n,document:i.response},a=i.getResponseHeader("Content-Type");let s;if(Xs.test(i.getAllResponseHeaders())&&(s=i.getResponseHeader("Link")),s&&"application/ld+json"!==a){if(s=Ws(s)[Gs],Array.isArray(s))throw new uo("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:n});s&&(o.contextUrl=s.target)}return o})));
|
|
32
|
+
/**
|
|
33
|
+
* A JavaScript implementation of the JSON-LD API.
|
|
34
|
+
*
|
|
35
|
+
* @author Dave Longley
|
|
36
|
+
*
|
|
37
|
+
* @license BSD 3-Clause License
|
|
38
|
+
* Copyright (c) 2011-2017 Digital Bazaar, Inc.
|
|
39
|
+
* All rights reserved.
|
|
40
|
+
*
|
|
41
|
+
* Redistribution and use in source and binary forms, with or without
|
|
42
|
+
* modification, are permitted provided that the following conditions are met:
|
|
43
|
+
*
|
|
44
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
45
|
+
* this list of conditions and the following disclaimer.
|
|
46
|
+
*
|
|
47
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
48
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
49
|
+
* documentation and/or other materials provided with the distribution.
|
|
50
|
+
*
|
|
51
|
+
* Neither the name of the Digital Bazaar, Inc. nor the names of its
|
|
52
|
+
* contributors may be used to endorse or promote products derived from
|
|
53
|
+
* this software without specific prior written permission.
|
|
54
|
+
*
|
|
55
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
56
|
+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
57
|
+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
58
|
+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
59
|
+
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
60
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
|
61
|
+
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
62
|
+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
63
|
+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
64
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
65
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
66
|
+
*/const Ys=yo.IdentifierIssuer,{expand:Qs}=ya,{flatten:Zs}=Oa,{fromRDF:ec}=Ua,{toRDF:tc}=rs,{frameMergedOrDefault:rc}=us,{isArray:nc,isObject:ic,isString:oc}=ao,{isSubjectReference:ac}=co,{getInitialContext:sc,process:cc,getAllContexts:uc}=Go,{compact:fc,compactIri:lc,removePreserve:dc}=Ds,{createNodeMap:hc,createMergedNodeMap:pc,mergeNodeMaps:bc}=xa,gc=void 0!==ft&&ft.versions&&ft.versions.node,yc=!gc&&("undefined"!=typeof window||"undefined"!=typeof self),mc=function(e){const t={};function r(t,{documentLoader:r=e.documentLoader,...n}){return Object.assign({},{documentLoader:r},n,t)}return e.compact=yo.callbackify((async function(t,n,i){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===n)throw new uo("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let o;(i=r(i,{base:oc(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new Ys("_:b")})).link&&(i.skipExpansion=!0),i.compactToRelative||delete i.base,o=i.skipExpansion?t:await e.expand(t,i);const a=await e.processContext(sc(i),n,i);let s=fc({activeCtx:a,element:o,options:i,compactionMap:i.compactionMap});i.compactArrays&&!i.graph&&nc(s)?1===s.length?s=s[0]:0===s.length&&(s={}):i.graph&&ic(s)&&(s=[s]),ic(n)&&"@context"in n&&(n=n["@context"]),n=yo.clone(n),nc(n)||(n=[n]);const c=n;n=[];for(let e=0;e<c.length;++e)(!ic(c[e])||Object.keys(c[e]).length>0)&&n.push(c[e]);const u=n.length>0;if(1===n.length&&(n=n[0]),nc(s)){const e=lc({activeCtx:a,iri:"@graph",relativeTo:{vocab:!0}}),t=s;s={},u&&(s["@context"]=n),s[e]=t}else if(ic(s)&&u){const e=s;s={"@context":n};for(const t in e)s[t]=e[t]}if(i.framing){const e=lc({activeCtx:a,iri:"@graph",relativeTo:{vocab:!0}});
|
|
67
|
+
// remove @preserve from results
|
|
68
|
+
i.link={},s[e]=dc(a,s[e],i)}return s})),e.expand=yo.callbackify((async function(t,n){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");!1===(n=r(n,{keepFreeFloatingNodes:!1})).expansionMap&&(n.expansionMap=void 0);const i={},o=[];if("expandContext"in n){const e=yo.clone(n.expandContext);ic(e)&&"@context"in e?i.expandContext=e:i.expandContext={"@context":e},o.push(i.expandContext)}let a;if(oc(t)){const r=await e.get(t,n);a=r.documentUrl,i.input=r.document,r.contextUrl&&(i.remoteContext={"@context":r.contextUrl},o.push(i.remoteContext))}else i.input=yo.clone(t);"base"in n||(n.base=a||""),await uc(i,n);let s=sc(n);o.forEach((e=>{s=cc({activeCtx:s,localCtx:e,options:n})}));let c=Qs({activeCtx:s,element:i.input,options:n,expansionMap:n.expansionMap});return ic(c)&&"@graph"in c&&1===Object.keys(c).length?c=c["@graph"]:null===c&&(c=[]),nc(c)||(c=[c]),c})),e.flatten=yo.callbackify((async function(t,n,i){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");n="function"==typeof n?null:n||null,i=r(i,{base:oc(t)?t:""});const o=await e.expand(t,i),a=Zs(o);if(null===n)return a;i.graph=!0,i.skipExpansion=!0;return await e.compact(a,n,i)})),e.frame=yo.callbackify((async function(t,n,i){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(i=r(i,{base:oc(t)?t:"",embed:"@last",explicit:!1,requireAll:!0,omitDefault:!1,pruneBlankNodeIdentifiers:!0,bnodesToClear:[]}),oc(n)){const t=await e.get(n,i);if(n=t.document,t.contextUrl){let e=n["@context"];e?nc(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,n["@context"]=e}}const o=n&&n["@context"]||{},a=await e.expand(t,i),s=yo.clone(i);s.isFrame=!0,s.keepFreeFloatingNodes=!0;const c=await e.expand(n,s);s.merged=!("@graph"in n);const u=rc(a,c,s);s.graph=!0,s.skipExpansion=!0,s.link={},s.framing=!0;return await e.compact(u,o,s)})),e.link=yo.callbackify((async function(t,r,n){const i={};return r&&(i["@context"]=r),i["@embed"]="@link",e.frame(t,i,n)})),e.normalize=e.canonize=yo.callbackify((async function(t,n){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(n=r(n,{base:oc(t)?t:"",algorithm:"URDNA2015",skipExpansion:!1}))){if("application/n-quads"!==n.inputFormat&&"application/nquads"!==n.inputFormat)throw new uo("Unknown canonicalization input format.","jsonld.CanonizeError");const e=So.parse(t);return io.canonize(e,n)}const i=yo.clone(n);delete i.format,i.produceGeneralizedRdf=!1;const o=await e.toRDF(t,i);return io.canonize(o,n)})),e.fromRDF=yo.callbackify((async function(e,n){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");n=r(n,{format:oc(e)?"application/n-quads":void 0});const{format:i}=n;let o,{rdfParser:a}=n;if(i){if(a=a||t[i],!a)throw new uo("Unknown input format.","jsonld.UnknownFormat",{format:i})}else a=()=>e;return o=a.length>1?new Promise(((t,r)=>{a(e,((e,n)=>{e?r(e):t(n)}))})):Promise.resolve(a(e)),o=await o,Array.isArray(o)||(o=So.legacyDatasetToQuads(o)),ec(o,n)})),e.toRDF=yo.callbackify((async function(t,n){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let i;i=(n=r(n,{base:oc(t)?t:"",skipExpansion:!1})).skipExpansion?t:await e.expand(t,n);const o=tc(i,n);if(n.format){if("application/n-quads"===n.format||"application/nquads"===n.format)return await So.serialize(o);throw new uo("Unknown output format.","jsonld.UnknownFormat",{format:n.format})}return o})),e.createNodeMap=yo.callbackify((async function(t,n){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");n=r(n,{base:oc(t)?t:""});const i=await e.expand(t,n);return pc(i,n)})),e.merge=yo.callbackify((async function(t,n,i){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!nc(t))throw new TypeError('Could not merge, "docs" must be an array.');n="function"==typeof n?null:n||null,i=r(i,{});const o=await Promise.all(t.map((t=>{const r=Object.assign({},i);return e.expand(t,r)})));let a=!0;"mergeNodes"in i&&(a=i.mergeNodes);const s=i.issuer||new Ys("_:b"),c={"@default":{}};for(let e=0;e<o.length;++e){const t=yo.relabelBlankNodes(o[e],{issuer:new Ys("_:b"+e+"-")}),r=a||0===e?c:{"@default":{}};if(hc(t,r,"@default",s),r!==c)for(const e in r){const t=r[e];if(!(e in c)){c[e]=t;continue}const n=c[e];for(const e in t)e in n||(n[e]=t[e])}}const u=bc(c),f=[],l=Object.keys(u).sort();for(let e=0;e<l.length;++e){const t=u[l[e]];ac(t)||f.push(t)}if(null===n)return f;i.graph=!0,i.skipExpansion=!0;return await e.compact(f,n,i)})),Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=yo.normalizeDocumentLoader(t)}),e.documentLoader=async e=>{throw new uo("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:e})},e.loadDocument=yo.callbackify((async function(){return e.documentLoader.apply(null,arguments)})),e.get=yo.callbackify((async function(t,r){let n;n="function"==typeof r.documentLoader?yo.normalizeDocumentLoader(r.documentLoader):e.documentLoader;const i=await n(t);try{if(!i.document)throw new uo("No remote document found at the given URL.","jsonld.NullRemoteDocument");oc(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new uo("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:e,remoteDoc:i})}return i})),e.processContext=yo.callbackify((async function(e,t,n){if(n=r(n,{base:""}),null===t)return sc(n);t=yo.clone(t),ic(t)&&"@context"in t||(t={"@context":t});const i=await uc(t,n);return cc({activeCtx:e,localCtx:i,options:n})})),e.getContextValue=Go.getContextValue,e.documentLoaders={},e.documentLoaders.node=Ks,e.documentLoaders.xhr=$s,e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new uo('Unknown document loader type: "'+t+'"',"jsonld.UnknownDocumentLoader",{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,r){t[e]=r},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser("application/n-quads",So.parse),e.registerRDFParser("application/nquads",So.parse),e.registerRDFParser("rdfa-api",class{parse(e){const t={"@default":[]},r=e.getSubjects();for(let n=0;n<r.length;++n){const i=r[n];if(null===i)continue;const o=e.getSubjectTriples(i);if(null===o)continue;const a=o.predicates;for(const e in a){const r=a[e].objects;for(let n=0;n<r.length;++n){const o=r[n],a={};0===i.indexOf("_:")?a.subject={type:"blank node",value:i}:a.subject={type:"IRI",value:i},0===e.indexOf("_:")?a.predicate={type:"blank node",value:e}:a.predicate={type:"IRI",value:e};let s=o.value;if(o.type===Ao){const e=new("undefined"==typeof XMLSerializer?to.XMLSerializer:XMLSerializer);s="";for(let t=0;t<o.value.length;t++)o.value[t].nodeType===Co.ELEMENT_NODE?s+=e.serializeToString(o.value[t]):o.value[t].nodeType===Co.TEXT_NODE&&(s+=o.value[t].nodeValue)}a.object={},o.type===To?0===o.value.indexOf("_:")?a.object.type="blank node":a.object.type="IRI":(a.object.type="literal",o.type===Oo?o.language?(a.object.datatype=Io,a.object.language=o.language):a.object.datatype=Po:a.object.datatype=o.type),a.object.value=s,t["@default"].push(a)}}}return t}}.parse),e.url=No,e.util=yo,Object.assign(e,yo),e.promises=e,e.RequestQueue=Fs,e.JsonLdProcessor=(e=>{class t{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,r){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):e.compact(t,r)},t.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):e.flatten(t)},t})(e),yc&&void 0===M.JsonLdProcessor&&Object.defineProperty(M,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor}),gc?e.useDocumentLoader("node"):"undefined"!=typeof XMLHttpRequest&&e.useDocumentLoader("xhr"),e},vc=function(){return mc((function(){return vc()}))};mc(vc);var wc=vc;const _c={};var Sc=_c;_c.isArray=Array.isArray,_c.isBoolean=e=>"boolean"==typeof e||"[object Boolean]"===Object.prototype.toString.call(e),_c.isDouble=e=>_c.isNumber(e)&&-1!==String(e).indexOf("."),_c.isEmptyObject=e=>_c.isObject(e)&&0===Object.keys(e).length,_c.isNumber=e=>"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e),_c.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),_c.isObject=e=>"[object Object]"===Object.prototype.toString.call(e),_c.isString=e=>"string"==typeof e||"[object String]"===Object.prototype.toString.call(e),_c.isUndefined=e=>void 0===e;const xc={};var kc=xc;xc.isSubject=e=>!(!Sc.isObject(e)||"@value"in e||"@set"in e||"@list"in e)&&(Object.keys(e).length>1||!("@id"in e)),xc.isSubjectReference=e=>Sc.isObject(e)&&1===Object.keys(e).length&&"@id"in e,xc.isValue=e=>Sc.isObject(e)&&"@value"in e,xc.isList=e=>Sc.isObject(e)&&"@list"in e,xc.isGraph=e=>Sc.isObject(e)&&"@graph"in e&&1===Object.keys(e).filter((e=>"@id"!==e&&"@index"!==e)).length,xc.isSimpleGraph=e=>xc.isGraph(e)&&!("@id"in e),xc.isBlankNode=e=>!!Sc.isObject(e)&&("@id"in e?0===e["@id"].indexOf("_:"):0===Object.keys(e).length||!("@value"in e||"@set"in e||"@list"in e));var Ec=class extends Error{constructor(e="An unspecified JSON-LD error occurred.",t="jsonld.Error",r={}){super(e),this.name=t,this.message=e,this.details=r}};function Ic(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Oc(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Ic(o,n,i,a,s,"next",e)}function s(e){Ic(o,n,i,a,s,"throw",e)}a(void 0)}))}}const Tc=io.IdentifierIssuer,Ac=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,Pc=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,Cc=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,Mc="application/ld+json, application/json",Rc={};var Nc=Rc;Rc.IdentifierIssuer=Tc;const Lc="function"==typeof setImmediate&&setImmediate,jc=Lc?e=>Lc(e):e=>setTimeout(e,0);function Dc(e,t,r){Rc.nextTick((()=>e(t,r)))}function Bc(e,t){if(Sc.isArray(t))for(let r=0;r<t.length;++r)t[r]=Bc(e,t[r]);else if(kc.isList(t))t["@list"]=Bc(e,t["@list"]);else if(Sc.isObject(t)){kc.isBlankNode(t)&&(t["@id"]=e.getId(t["@id"]));const r=Object.keys(t).sort();for(let n=0;n<r.length;++n){const i=r[n];"@id"!==i&&(t[i]=Bc(e,t[i]))}}return t}Rc.nextTick="object"==typeof ft?Ye:jc,Rc.setImmediate=Lc?jc:Rc.nextTick,Rc.clone=function(e){if(e&&"object"==typeof e){let t;if(Sc.isArray(e)){t=[];for(let r=0;r<e.length;++r)t[r]=Rc.clone(e[r])}else if(e instanceof Map){t=new Map;for(const[r,n]of e)t.set(r,Rc.clone(n))}else if(e instanceof Set){t=new Set;for(const r of e)t.add(Rc.clone(r))}else if(Sc.isObject(e)){t={};for(const r in e)t[r]=Rc.clone(e[r])}else t=e.toString();return t}return e},Rc.asArray=function(e){return Array.isArray(e)?e:[e]},Rc.buildHeaders=(e={})=>{if(Object.keys(e).some((e=>"accept"===e.toLowerCase())))throw new RangeError('Accept header may not be specified; only "'+Mc+'" is supported.');return Object.assign({Accept:Mc},e)},Rc.parseLinkHeader=e=>{const t={},r=e.match(Ac);for(let e=0;e<r.length;++e){let n=r[e].match(Pc);if(!n)continue;const i={target:n[1]},o=n[2];for(;n=Cc.exec(o);)i[n[1]]=void 0===n[2]?n[3]:n[2];const a=i.rel||"";Array.isArray(t[a])?t[a].push(i):t.hasOwnProperty(a)?t[a]=[t[a],i]:t[a]=i}return t},Rc.validateTypeValue=e=>{if(Sc.isString(e)||Sc.isEmptyObject(e))return;let t=!1;if(Sc.isArray(e)){t=!0;for(let r=0;r<e.length;++r)if(!Sc.isString(e[r])){t=!1;break}}if(!t)throw new Ec('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, or an empty object.',"jsonld.SyntaxError",{code:"invalid type value",value:e})},Rc.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){const r=e[t];return!Sc.isArray(r)||r.length>0}return!1},Rc.hasValue=(e,t,r)=>{if(Rc.hasProperty(e,t)){let n=e[t];const i=kc.isList(n);if(Sc.isArray(n)||i){i&&(n=n["@list"]);for(let e=0;e<n.length;++e)if(Rc.compareValues(r,n[e]))return!0}else if(!Sc.isArray(r))return Rc.compareValues(r,n)}return!1},Rc.addValue=(e,t,r,n)=>{if("propertyIsArray"in(n=n||{})||(n.propertyIsArray=!1),"valueIsArray"in n||(n.valueIsArray=!1),"allowDuplicate"in n||(n.allowDuplicate=!0),n.valueIsArray)e[t]=r;else if(Sc.isArray(r)){0===r.length&&n.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]);for(let i=0;i<r.length;++i)Rc.addValue(e,t,r[i],n)}else if(e.hasOwnProperty(t)){const i=!n.allowDuplicate&&Rc.hasValue(e,t,r);Sc.isArray(e[t])||i&&!n.propertyIsArray||(e[t]=[e[t]]),i||e[t].push(r)}else e[t]=n.propertyIsArray?[r]:r},Rc.getValues=(e,t)=>[].concat(e[t]||[]),Rc.removeProperty=(e,t)=>{delete e[t]},Rc.removeValue=(e,t,r,n)=>{"propertyIsArray"in(n=n||{})||(n.propertyIsArray=!1);const i=Rc.getValues(e,t).filter((e=>!Rc.compareValues(e,r)));0===i.length?Rc.removeProperty(e,t):1!==i.length||n.propertyIsArray?e[t]=i:e[t]=i[0]},Rc.relabelBlankNodes=(e,t)=>Bc((t=t||{}).issuer||new Tc("_:b"),e),Rc.compareValues=(e,t)=>e===t||!(!kc.isValue(e)||!kc.isValue(t)||e["@value"]!==t["@value"]||e["@type"]!==t["@type"]||e["@language"]!==t["@language"]||e["@index"]!==t["@index"])||!!(Sc.isObject(e)&&"@id"in e&&Sc.isObject(t)&&"@id"in t)&&e["@id"]===t["@id"],Rc.compareShortestLeast=(e,t)=>e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1,Rc.normalizeDocumentLoader=e=>e.length<2?Rc.callbackify(e):function(){var t=Oc((function*(t){const r=arguments[1];return new Promise(((n,i)=>{try{e(t,((e,t)=>{if("function"==typeof r)return Dc(r,e,t);e?i(e):n(t)}))}catch(e){if("function"==typeof r)return Dc(r,e);i(e)}}))}));return function(e){return t.apply(this,arguments)}}(),Rc.callbackify=e=>function(){var t=Oc((function*(...t){const r=t[t.length-1];let n;"function"==typeof r&&t.pop();try{n=yield e.apply(null,t)}catch(e){if("function"==typeof r)return Dc(r,e);throw e}return"function"==typeof r?Dc(r,null,n):n}));return function(){return t.apply(this,arguments)}}();var Uc=io.NQuads;const Hc="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Fc="http://www.w3.org/2001/XMLSchema#";var Vc={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",RDF:Hc,RDF_LIST:Hc+"List",RDF_FIRST:Hc+"first",RDF_REST:Hc+"rest",RDF_NIL:Hc+"nil",RDF_TYPE:Hc+"type",RDF_PLAIN_LITERAL:Hc+"PlainLiteral",RDF_XML_LITERAL:Hc+"XMLLiteral",RDF_JSON_LITERAL:Hc+"JSON",RDF_OBJECT:Hc+"object",RDF_LANGSTRING:Hc+"langString",XSD:Fc,XSD_BOOLEAN:Fc+"boolean",XSD_DOUBLE:Fc+"double",XSD_INTEGER:Fc+"integer",XSD_STRING:Fc+"string"};const{RDF_LANGSTRING:qc,RDF_PLAIN_LITERAL:zc,RDF_OBJECT:Kc,RDF_XML_LITERAL:Wc,XSD_STRING:Jc}=Vc;let Gc;Gc="undefined"!=typeof Node?Node:{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};const{clone:Xc}=Nc,$c={};var Yc=$c;$c.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},$c.parse=(e,t)=>{const r={},n=$c.parsers[t||"full"],i=n.regex.exec(e);let o=n.keys.length;for(;o--;)r[n.keys[o]]=void 0===i[o]?null:i[o];return("https"===r.scheme&&"443"===r.port||"http"===r.scheme&&"80"===r.port)&&(r.href=r.href.replace(":"+r.port,""),r.authority=r.authority.replace(":"+r.port,""),r.port=null),r.normalizedPath=$c.removeDotSegments(r.path),r},$c.prependBase=(e,t)=>{if(null===e)return t;if(-1!==t.indexOf(":"))return t;Sc.isString(e)&&(e=$c.parse(e||""));const r=$c.parse(t),n={protocol:e.protocol||""};if(null!==r.authority)n.authority=r.authority,n.path=r.path,n.query=r.query;else if(n.authority=e.authority,""===r.path)n.path=e.path,null!==r.query?n.query=r.query:n.query=e.query;else{if(0===r.path.indexOf("/"))n.path=r.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf("/")+1),t.length>0&&"/"!==t.substr(-1)&&(t+="/"),t+=r.path,n.path=t}n.query=r.query}""!==r.path&&(n.path=$c.removeDotSegments(n.path));let i=n.protocol;return null!==n.authority&&(i+="//"+n.authority),i+=n.path,null!==n.query&&(i+="?"+n.query),null!==r.fragment&&(i+="#"+r.fragment),""===i&&(i="./"),i},$c.removeBase=(e,t)=>{if(null===e)return t;Sc.isString(e)&&(e=$c.parse(e||""));let r="";if(""!==e.href?r+=(e.protocol||"")+"//"+(e.authority||""):t.indexOf("//")&&(r+="//"),0!==t.indexOf(r))return t;const n=$c.parse(t.substr(r.length)),i=e.normalizedPath.split("/"),o=n.normalizedPath.split("/"),a=n.fragment||n.query?0:1;for(;i.length>0&&o.length>a&&i[0]===o[0];)i.shift(),o.shift();let s="";if(i.length>0){i.pop();for(let e=0;e<i.length;++e)s+="../"}return s+=o.join("/"),null!==n.query&&(s+="?"+n.query),null!==n.fragment&&(s+="#"+n.fragment),""===s&&(s="./"),s},$c.removeDotSegments=e=>{if(0===e.length)return"";const t=e.split("/"),r=[];for(;t.length>0;){const e=t.shift(),n=0===t.length;"."!==e?".."!==e?r.push(e):(r.pop(),n&&r.push("")):n&&r.push("")}return r.length>0&&""!==r[0]&&r.unshift(""),1===r.length&&""===r[0]?"/":r.join("/")};const Qc=/^([A-Za-z][A-Za-z0-9+-.]*|_):/;function Zc(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function eu(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Zc(o,n,i,a,s,"next",e)}function s(e){Zc(o,n,i,a,s,"throw",e)}a(void 0)}))}}$c.isAbsolute=e=>Sc.isString(e)&&Qc.test(e),$c.isRelative=e=>Sc.isString(e);const{isArray:tu,isObject:ru,isString:nu,isUndefined:iu}=Sc,{isAbsolute:ou,isRelative:au,prependBase:su,parse:cu}=Yc,{asArray:uu,compareShortestLeast:fu}=Nc,lu=new Map,du={};var hu=du;function pu(e,t,r,n,i,o){if(null===t||!nu(t)||du.isKeyword(t))return t;if(n&&n.hasOwnProperty(t)&&!0!==i.get(t)&&du.createTermDefinition(e,n,t,i,o),e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext),(r=r||{}).vocab){const r=e.mappings.get(t);if(null===r)return null;if(r)return r["@id"]}const a=t.indexOf(":");if(-1!==a){const r=t.substr(0,a),s=t.substr(a+1);return"_"===r||0===s.indexOf("//")?t:(n&&n.hasOwnProperty(r)&&du.createTermDefinition(e,n,r,i,o),e.mappings.has(r)?e.mappings.get(r)["@id"]+s:t)}return r.vocab&&"@vocab"in e?e["@vocab"]+t:r.base?su(e["@base"],t):t}function bu(){return(bu=eu((function*(e,t){const r=Nc.normalizeDocumentLoader(t.documentLoader);return yield n(e,new Set,r),e;function n(e,t,r){return i.apply(this,arguments)}function i(){return(i=eu((function*(e,r,i){if(r.size>10)throw new Ec("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"loading remote context failed",max:10});const o=new Map;if(gu(e,o,!1,t.base),0===o.size)return;const a=[...o.keys()].filter((e=>!1===o.get(e)));return Promise.all(a.map(function(){var a=eu((function*(a){if(r.has(a))throw new Ec("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"recursive context inclusion",url:a});const s=new Set(r);let c,u;s.add(a);try{c=yield i(a),u=c.document||null,nu(u)&&(u=JSON.parse(u))}catch(e){throw new Ec("Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.","jsonld.InvalidUrl",{code:"loading remote context failed",url:a,cause:e})}if(!ru(u))throw new Ec("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:a});u="@context"in u?{"@context":u["@context"]}:{"@context":{}},c.contextUrl&&(tu(u["@context"])||(u["@context"]=[u["@context"]]),u["@context"].push(c.contextUrl)),yield n(u,s,i),o.set(a,u["@context"]),gu(e,o,!0,t.base)}));return function(e){return a.apply(this,arguments)}}()))}))).apply(this,arguments)}}))).apply(this,arguments)}function gu(e,t,r,n){if(tu(e))for(const i of e)gu(i,t,r,n);else if(ru(e))for(const i in e){if("@context"!==i){gu(e[i],t,r,n);continue}const o=e[i];if(tu(o)){let e=o.length;for(let i=0;i<e;++i){const a=o[i];if(nu(a)){const s=su(n,a),c=t.get(s);r?tu(c)?(Array.prototype.splice.apply(o,[i,1].concat(c)),i+=c.length-1,e=o.length):!1!==c&&(o[i]=c):void 0===c&&t.set(s,!1)}else for(const e in a)ru(a[e])&&gu(a[e],t,r,n)}}else if(nu(o)){const a=su(n,o),s=t.get(a);r?!1!==s&&(e[i]=s):void 0===s&&t.set(a,!1)}else for(const e in o)ru(o[e])&&gu(o[e],t,r,n)}}function yu(e,t){if(!e||"object"!=typeof e||!t||"object"!=typeof t)return e===t;const r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!yu(e[r],t[r]))return!1;return!0}const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r in e){let n=e[r],i=t[r];if("@container"===r&&Array.isArray(n)&&Array.isArray(i)&&(n=n.slice().sort(),i=i.slice().sort()),!yu(n,i))return!1}return!0}du.cache=new class{constructor(e=100){this.order=[],this.cache=new Map,this.size=e}get(e,t){const r=this.cache.get(e);if(r){const e=JSON.stringify(t);return r.get(e)||null}return null}set(e,t,r){if(this.order.length===this.size){const e=this.order.shift();this.cache.get(e.activeCtx).delete(e.localCtx)}const n=JSON.stringify(t);this.order.push({activeCtx:e,localCtx:n});let i=this.cache.get(e);i||(i=new Map,this.cache.set(e,i)),i.set(n,Xc(r))}},du.process=({activeCtx:e,localCtx:t,options:r,isPropertyTermScopedContext:n=!1,isTypeScopedContext:i=!1})=>{ru(t)&&"@context"in t&&tu(t["@context"])&&(t=t["@context"]);const o=uu(t);if(0===o.length)return e;const a=e.previousContext||e;if(n&&e.previousContext)return(e=e.clone()).isPropertyTermScoped=!0,e.previousContext=du.process({activeCtx:e.previousContext,localCtx:o,options:r,isPropertyTermScopedContext:n}),e;let s=e;for(let c=0;c<o.length;++c){let u=o[c];if(e=s,null===u){if(!n&&0!==Object.keys(e.protected).length){const n=r&&r.protectedMode||"error";if("error"===n)throw new Ec("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});if("warn"===n){console.warn("WARNING: invalid context nullification");const t=e;s=e=du.getInitialContext(r).clone();for(const[r,n]of Object.entries(t.protected))n&&(e.mappings[r]=Nc.clone(t.mappings[r]));e.protected=Nc.clone(t.protected),du.cache&&du.cache.set(t,u,s);continue}throw new Ec("Invalid protectedMode.","jsonld.SyntaxError",{code:"invalid protected mode",context:t,protectedMode:n})}s=e=du.getInitialContext(r).clone(),i&&(s.previousContext=a.clone());continue}if(du.cache){const t=du.cache.get(e,u);if(t){s=e=t;continue}}if(ru(u)&&"@context"in u&&(u=u["@context"]),!ru(u))throw new Ec("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:u});s=s.clone();const f=new Map;if("@version"in u){if(1.1!==u["@version"])throw new Ec("Unsupported JSON-LD version: "+u["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:u});if(e.processingMode&&"json-ld-1.0"===e.processingMode)throw new Ec("@version: "+u["@version"]+" not compatible with "+e.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:u});s.processingMode="json-ld-1.1",s["@version"]=u["@version"],f.set("@version",!0)}if(s.processingMode=s.processingMode||e.processingMode||"json-ld-1.0","@base"in u){let t=u["@base"];if(null===t);else if(ou(t))t=cu(t);else{if(!au(t))throw new Ec('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:u});t=cu(su(e["@base"].href,t))}s["@base"]=t,f.set("@base",!0)}if("@vocab"in u){const e=u["@vocab"];if(null===e)delete s["@vocab"];else{if(!nu(e))throw new Ec('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:u});if(!ou(e))throw new Ec('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:u});s["@vocab"]=e}f.set("@vocab",!0)}if("@language"in u){const e=u["@language"];if(null===e)delete s["@language"];else{if(!nu(e))throw new Ec('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:u});s["@language"]=e.toLowerCase()}f.set("@language",!0)}f.set("@protected",u["@protected"]||!1);for(const e in u)du.createTermDefinition(s,u,e,f,r,n);i&&!s.previousContext&&(s.previousContext=a.clone()),du.cache&&du.cache.set(e,u,s)}return s},du.createTermDefinition=(e,t,r,n,i,o=!1)=>{if(n.has(r)){if(n.get(r))return;throw new Ec("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:t,term:r})}if(n.set(r,!1),du.isKeyword(r))throw new Ec("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:r});if(""===r)throw new Ec("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:t});const a=e.mappings.get(r);let s;if(e.mappings.has(r)&&e.mappings.delete(r),t.hasOwnProperty(r)&&(s=t[r]),null===s||ru(s)&&null===s["@id"])return e.mappings.set(r,null),void n.set(r,!0);let c=!1;if(nu(s)&&(c=!0,s={"@id":s}),!ru(s))throw new Ec("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:t});const u={};e.mappings.set(r,u),u.reverse=!1;const f=["@container","@id","@language","@reverse","@type"];du.processingMode(e,1.1)&&f.push("@context","@nest","@prefix","@protected");for(const e in s)if(!f.includes(e))throw new Ec("Invalid JSON-LD syntax; a term definition must not contain "+e,"jsonld.SyntaxError",{code:"invalid term definition",context:t});const l=r.indexOf(":");if(u._termHasColon=-1!==l,"@reverse"in s){if("@id"in s)throw new Ec("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});if("@nest"in s)throw new Ec("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});const r=s["@reverse"];if(!nu(r))throw new Ec("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});const o=pu(e,r,{vocab:!0,base:!1},t,n,i);if(!ou(o))throw new Ec("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});u["@id"]=o,u.reverse=!0}else if("@id"in s){let o=s["@id"];if(!nu(o))throw new Ec("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(o!==r){if(o=pu(e,o,{vocab:!0,base:!1},t,n,i),!ou(o)&&!du.isKeyword(o))throw new Ec("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});u["@id"]=o,u._prefix=!u._termHasColon&&o.match(/[:\/\?#\[\]@]$/)&&(c||du.processingMode(e,1))}}if(!("@id"in u))if(u._termHasColon){const o=r.substr(0,l);if(t.hasOwnProperty(o)&&du.createTermDefinition(e,t,o,n,i),e.mappings.has(o)){const t=r.substr(l+1);u["@id"]=e.mappings.get(o)["@id"]+t}else u["@id"]=r}else{if(!("@vocab"in e))throw new Ec("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t,term:r});u["@id"]=e["@vocab"]+r}if((!0===s["@protected"]||!0===n.get("@protected")&&!1!==s["@protected"])&&(e.protected[r]=!0,u.protected=!0),n.set(r,!0),"@type"in s){let r=s["@type"];if(!nu(r))throw new Ec("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if("@id"!==r&&"@vocab"!==r&&"@json"!==r){if(r=pu(e,r,{vocab:!0,base:!1},t,n,i),!ou(r))throw new Ec("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if(0===r.indexOf("_:"))throw new Ec("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}u["@type"]=r}if("@container"in s){const r=nu(s["@container"])?[s["@container"]]:s["@container"]||[],n=["@list","@set","@index","@language"];let i=!0;const o=r.includes("@set");if(du.processingMode(e,1.1))if(n.push("@graph","@id","@type"),r.includes("@list")){if(1!==r.length)throw new Ec("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else if(r.includes("@graph")){if(r.some((e=>"@graph"!==e&&"@id"!==e&&"@index"!==e&&"@set"!==e)))throw new Ec("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else i&=r.length<=(o?2:1);else i&=!tu(s["@container"]),i&=r.length<=1;if(i&=r.every((e=>n.includes(e))),i&=!(o&&r.includes("@list")),!i)throw new Ec("Invalid JSON-LD syntax; @context @container value must be one of the following: "+n.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:t});if(u.reverse&&!r.every((e=>["@index","@set"].includes(e))))throw new Ec("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});u["@container"]=r}if("@context"in s&&(u["@context"]=s["@context"]),"@language"in s&&!("@type"in s)){let e=s["@language"];if(null!==e&&!nu(e))throw new Ec("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:t});null!==e&&(e=e.toLowerCase()),u["@language"]=e}if("@prefix"in s){if(u._termHasColon)throw new Ec("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:t});if("boolean"!=typeof s["@prefix"])throw new Ec("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:t});u._prefix=!0===s["@prefix"]}if("@nest"in s){const e=s["@nest"];if(!nu(e)||"@nest"!==e&&0===e.indexOf("@"))throw new Ec("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:t});u["@nest"]=e}// disallow aliasing @context and @preserve
|
|
69
|
+
const d=u["@id"];if("@context"===d||"@preserve"===d)throw new Ec("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:t});if(a&&a.protected&&!o&&(e.protected[r]=!0,u.protected=!0,!yu(a,u))){const e=i&&i.protectedMode||"error";if("error"===e)throw new Ec("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:t,term:r});if("warn"===e)return void console.warn("WARNING: protected term redefinition",{term:r});throw new Ec("Invalid protectedMode.","jsonld.SyntaxError",{code:"invalid protected mode",context:t,term:r,protectedMode:e})}},du.expandIri=(e,t,r,n)=>pu(e,t,r,void 0,void 0,n),du.getInitialContext=e=>{const t=cu(e.base||""),r=JSON.stringify({base:t,processingMode:e.processingMode}),n=lu.get(r);if(n)return n;const i={"@base":t,processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:function(){const e=this;if(e.inverse)return e.inverse;const t=e.inverse={},r=e.fastCurieMap={},n={},i=e["@language"]||"@none",s=e.mappings,c=[...s.keys()].sort(fu);for(const e of c){const o=s.get(e);if(null===o)continue;let c=o["@container"]||"@none";c=[].concat(c).sort().join("");const u=uu(o["@id"]);for(const s of u){let u=t[s];const f=du.isKeyword(s);if(u)f||o._termHasColon||n[s].push(e);else if(t[s]=u={},!f&&!o._termHasColon){n[s]=[e];const t={iri:s,terms:n[s]};s[0]in r?r[s[0]].push(t):r[s[0]]=[t]}if(u[c]||(u[c]={"@language":{},"@type":{},"@any":{}}),u=u[c],a(e,u["@any"],"@none"),o.reverse)a(e,u["@type"],"@reverse");else if("@type"in o)a(e,u["@type"],o["@type"]);else if("@language"in o){const t=o["@language"]||"@null";a(e,u["@language"],t)}else a(e,u["@language"],i),a(e,u["@type"],"@none"),a(e,u["@language"],"@none")}}for(const e in r)o(r,e,1);return t},clone:function(){const e={};return e["@base"]=this["@base"],e.mappings=Nc.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=Nc.clone(this.protected),this.previousContext&&(e.isPropertyTermScoped=this.previousContext.isPropertyTermScoped,e.previousContext=this.previousContext.clone()),e.revertTypeScopedContext=this.revertTypeScopedContext,"@language"in this&&(e["@language"]=this["@language"]),"@vocab"in this&&(e["@vocab"]=this["@vocab"]),e},revertTypeScopedContext:function(){return this.previousContext?this.previousContext.clone():this},protected:{}};return 1e4===lu.size&&lu.clear(),lu.set(r,i),i;function o(e,t,r){const n=e[t],i=e[t]={};let a,s;for(const e of n)a=e.iri,s=r>=a.length?"":a[r],s in i?i[s].push(e):i[s]=[e];for(const e in i)""!==e&&o(i,e,r+1)}function a(e,t,r){t.hasOwnProperty(r)||(t[r]=e)}},du.getContextValue=(e,t,r)=>{if(null===t){if("@context"===r)return;return null}if(e.mappings.has(t)){const n=e.mappings.get(t);if(iu(r))return n;if(n.hasOwnProperty(r))return n[r]}return"@language"===r&&e.hasOwnProperty(r)?e[r]:"@context"!==r?null:void 0},du.getAllContexts=function(){var e=eu((function*(e,t){return function(e,t){return bu.apply(this,arguments)}(e,t)}));return function(t,r){return e.apply(this,arguments)}}(),du.processingMode=(e,t)=>t.toString()>="1.1"?e.processingMode&&e.processingMode>="json-ld-"+t.toString():!e.processingMode||"json-ld-1.0"===e.processingMode,du.isKeyword=e=>{if(!nu(e))return!1;switch(e){case"@base":case"@container":case"@context":case"@default":case"@embed":case"@explicit":case"@graph":case"@id":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1};const{isArray:mu,isObject:vu,isEmptyObject:wu,isString:_u,isUndefined:Su}=Sc,{isList:xu,isValue:ku,isGraph:Eu}=kc,{expandIri:Iu,getContextValue:Ou,isKeyword:Tu,process:Au,processingMode:Pu}=hu,{isAbsolute:Cu}=Yc,{addValue:Mu,asArray:Ru,getValues:Nu,validateTypeValue:Lu}=Nc,ju={};var Du=ju;function Bu({activeCtx:e,activeProperty:t,expandedActiveProperty:r,element:n,expandedParent:i,options:o={},insideList:a,expansionMap:s}){const c=Object.keys(n).sort(),u=[];for(const f of c){let c,l=n[f];if("@context"===f)continue;let d=Iu(e,f,{vocab:!0},o);if((null===d||!Cu(d)&&!Tu(d))&&(d=s({unmappedProperty:f,activeCtx:e,activeProperty:t,parent:n,options:o,insideList:a,value:l,expandedParent:i}),void 0===d))continue;if(Tu(d)){if("@reverse"===r)throw new Ec("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:l});if(d in i)throw new Ec("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:d})}if("@id"===d){if(!_u(l)){if(!o.isFrame)throw new Ec('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:l});if(vu(l)){if(!wu(l))throw new Ec('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:l})}else{if(!mu(l))throw new Ec('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:l});if(!l.every((e=>_u(e))))throw new Ec('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:l})}}Mu(i,"@id",Ru(l).map((t=>_u(t)?Iu(e,t,{base:!0},o):t)),{propertyIsArray:o.isFrame});continue}if("@type"===d){Lu(l),Mu(i,"@type",Ru(l).map((t=>_u(t)?Iu(e.previousContext||e,t,{base:!0,vocab:!0},o):t)),{propertyIsArray:o.isFrame});continue}if("@graph"===d&&!vu(l)&&!mu(l))throw new Ec('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:l});if("@value"===d){Mu(i,"@value",l,{propertyIsArray:o.isFrame});continue}if("@language"===d){if(null===l)continue;if(!_u(l)&&!o.isFrame)throw new Ec('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:l});l=Ru(l).map((e=>_u(e)?e.toLowerCase():e)),Mu(i,"@language",l,{propertyIsArray:o.isFrame});continue}if("@index"===d){if(!_u(l))throw new Ec('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:l});Mu(i,"@index",l);continue}if("@reverse"===d){if(!vu(l))throw new Ec('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:l});if(c=ju.expand({activeCtx:e,activeProperty:"@reverse",element:l,options:o,expansionMap:s}),"@reverse"in c)for(const e in c["@reverse"])Mu(i,e,c["@reverse"][e],{propertyIsArray:!0});let t=i["@reverse"]||null;for(const e in c){if("@reverse"===e)continue;null===t&&(t=i["@reverse"]={}),Mu(t,e,[],{propertyIsArray:!0});const r=c[e];for(let n=0;n<r.length;++n){const i=r[n];if(ku(i)||xu(i))throw new Ec('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:c});Mu(t,e,i,{propertyIsArray:!0})}}continue}if("@nest"===d){u.push(f);continue}let h=e;const p=Ou(e,f,"@context");Su(p)||(h=Au({activeCtx:e,localCtx:p,isPropertyTermScopedContext:!0,options:o}));const b=Ou(h,f,"@container")||[];if(b.includes("@language")&&vu(l))c=Uu(h,l,o);else if(b.includes("@index")&&vu(l)){const e=b.includes("@graph");c=Hu({activeCtx:h,options:o,activeProperty:f,value:l,expansionMap:s,asGraph:e,indexKey:"@index"})}else if(b.includes("@id")&&vu(l)){const e=b.includes("@graph");c=Hu({activeCtx:h,options:o,activeProperty:f,value:l,expansionMap:s,asGraph:e,indexKey:"@id"})}else if(b.includes("@type")&&vu(l))c=Hu({activeCtx:h.revertTypeScopedContext(),options:o,activeProperty:f,value:l,expansionMap:s,asGraph:!1,indexKey:"@type"});else{const n="@list"===d;if(n||"@set"===d){let e=t;n&&"@graph"===r&&(e=null),c=ju.expand({activeCtx:h,activeProperty:e,element:l,options:o,insideList:n,expansionMap:s})}else c="@json"===Ou(e,f,"@type")?{"@type":"@json","@value":l}:ju.expand({activeCtx:h,activeProperty:f,element:l,options:o,insideList:!1,expansionMap:s})}if(null===c&&"@value"!==d&&(c=s({unmappedValue:l,expandedProperty:d,activeCtx:h,activeProperty:t,parent:n,options:o,insideList:a,key:f,expandedParent:i}),void 0===c))continue;if("@list"!==d&&!xu(c)&&b.includes("@list")&&(c={"@list":Ru(c)}),b.includes("@graph")&&!b.some((e=>"@id"===e||"@index"===e))&&(c=Ru(c).map((e=>Eu(e)?e:{"@graph":Ru(e)}))),h.mappings.has(f)&&h.mappings.get(f).reverse){const e=i["@reverse"]=i["@reverse"]||{};c=Ru(c);for(let t=0;t<c.length;++t){const r=c[t];if(ku(r)||xu(r))throw new Ec('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:c});Mu(e,d,r,{propertyIsArray:!0})}continue}const g=!["@index","@id","@type","@value","@language"].includes(d);Mu(i,d,c,{propertyIsArray:g})}if("@value"in n){const t=n["@value"];if("@json"===n["@type"]&&Pu(e,1.1));else if((vu(t)||mu(t))&&!o.isFrame)throw new Ec('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:t})}for(const c of u){const u=mu(n[c])?n[c]:[n[c]];for(const n of u){if(!vu(n)||Object.keys(n).some((t=>"@value"===Iu(e,t,{vocab:!0},o))))throw new Ec("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:n});Bu({activeCtx:e,activeProperty:t,expandedActiveProperty:r,element:n,expandedParent:i,options:o,insideList:a,expansionMap:s})}}}function Uu(e,t,r){const n=[],i=Object.keys(t).sort();for(const o of i){const i=Iu(e,o,{vocab:!0},r);let a=t[o];mu(a)||(a=[a]);for(const e of a){if(null===e)continue;if(!_u(e))throw new Ec("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:t});const r={"@value":e};"@none"!==i&&(r["@language"]=o.toLowerCase()),n.push(r)}}return n}function Hu({activeCtx:e,options:t,activeProperty:r,value:n,expansionMap:i,asGraph:o,indexKey:a}){const s=[],c=Object.keys(n).sort(),u="@type"===a;for(let f of c){if(u){const r=Ou(e,f,"@context");Su(r)||(e=Au({activeCtx:e,localCtx:r,isTypeScopedContext:!0,options:t}))}let c=n[f];mu(c)||(c=[c]);const l=Iu(e,f,{vocab:!0},t);"@id"===a?f=Iu(e,f,{base:!0},t):u&&(f=l),c=ju.expand({activeCtx:e,activeProperty:r,element:c,options:t,insideList:!1,insideIndex:!0,expansionMap:i});for(let e of c)o&&!Eu(e)&&(e={"@graph":[e]}),"@type"===a?"@none"===l||(e["@type"]?e["@type"]=[f].concat(e["@type"]):e["@type"]=[f]):"@none"===l||a in e||(e[a]=f),s.push(e)}return s}ju.expand=({activeCtx:e,activeProperty:t=null,element:r,options:n={},insideList:i=!1,insideIndex:o=!1,typeScopedContext:a=null,expansionMap:s=(()=>{})})=>{if(null==r)return null;if("@default"===t&&(n=Object.assign({},n,{isFrame:!1})),!mu(r)&&!vu(r)){if(!i&&(null===t||"@graph"===Iu(e,t,{vocab:!0},n))){const o=s({unmappedValue:r,activeCtx:e,activeProperty:t,options:n,insideList:i});return void 0===o?null:o}return function({activeCtx:e,activeProperty:t,value:r,options:n}){if(null==r)return null;const i=Iu(e,t,{vocab:!0},n);if("@id"===i)return Iu(e,r,{base:!0},n);if("@type"===i)return Iu(e,r,{vocab:!0,base:!0},n);const o=Ou(e,t,"@type");if(("@id"===o||"@graph"===i)&&_u(r))return{"@id":Iu(e,r,{base:!0},n)};if("@vocab"===o&&_u(r))return{"@id":Iu(e,r,{vocab:!0,base:!0},n)};if(Tu(i))return r;const a={};if(o&&!["@id","@vocab"].includes(o))a["@type"]=o;else if(_u(r)){const r=Ou(e,t,"@language");null!==r&&(a["@language"]=r)}return["boolean","number","string"].includes(typeof r)||(r=r.toString()),a["@value"]=r,a}({activeCtx:e,activeProperty:t,value:r,options:n})}if(mu(r)){let c=[];const u=Ou(e,t,"@container")||[];i=i||u.includes("@list");for(let u=0;u<r.length;++u){let f=ju.expand({activeCtx:e,activeProperty:t,element:r[u],options:n,expansionMap:s,insideIndex:o,typeScopedContext:a});i&&mu(f)&&(f={"@list":f}),null===f&&(f=s({unmappedValue:r[u],activeCtx:e,activeProperty:t,parent:r,index:u,options:n,expandedParent:c,insideList:i}),void 0===f)||(mu(f)?c=c.concat(f):c.push(f))}return c}const c=Iu(e,t,{vocab:!0},n);a=a||(e.previousContext?e:null);let u=Object.keys(r).sort(),f=!o;if(f&&a&&u.length<=2&&!u.includes("@context"))for(const t of u){const r=Iu(a,t,{vocab:!0},n);if("@value"===r){f=!1,e=a;break}if("@id"===r&&1===u.length){f=!1;break}}f&&(e=e.revertTypeScopedContext()),"@context"in r&&(e=Au({activeCtx:e,localCtx:r["@context"],options:n}));for(const t of u)if("@type"===Iu(e,t,{vocab:!0},n)){const i=r[t],o=Array.isArray(i)?i.length>1?i.slice().sort():i:[i];for(const t of o){const r=Ou(e.previousContext||e,t,"@context");Su(r)||(e=Au({activeCtx:e,localCtx:r,options:n,isTypeScopedContext:!0}))}}let l={};Bu({activeCtx:e,activeProperty:t,expandedActiveProperty:c,element:r,expandedParent:l,options:n,insideList:i,typeScopedContext:a,expansionMap:s}),u=Object.keys(l);let d=u.length;if("@value"in l){if("@type"in l&&"@language"in l)throw new Ec('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:l});let o=d-1;if("@type"in l&&(o-=1),"@index"in l&&(o-=1),"@language"in l&&(o-=1),0!==o)throw new Ec('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and at most one other property which can be "@type" or "@language".',"jsonld.SyntaxError",{code:"invalid value object",element:l});const a=null===l["@value"]?[]:Ru(l["@value"]),c=Nu(l,"@type");if(0===a.length){const o=s({unmappedValue:l,activeCtx:e,activeProperty:t,element:r,options:n,insideList:i});l=void 0!==o?o:null}else{if(!a.every((e=>_u(e)||wu(e)))&&"@language"in l)throw new Ec("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:l});if(Pu(e,1.1)&&c.includes("@json")&&1===c.length);else if(!c.every((e=>Cu(e)&&!(_u(e)&&0===e.indexOf("_:"))||wu(e))))throw new Ec('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:l})}}else if("@type"in l&&!mu(l["@type"]))l["@type"]=[l["@type"]];else if("@set"in l||"@list"in l){if(d>1&&(2!==d||!("@index"in l)))throw new Ec('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:l});"@set"in l&&(l=l["@set"],u=Object.keys(l),d=u.length)}else if(1===d&&"@language"in l){const o=s(l,{unmappedValue:l,activeCtx:e,activeProperty:t,element:r,options:n,insideList:i});l=void 0!==o?o:null}if(vu(l)&&!n.keepFreeFloatingNodes&&!i&&(null===t||"@graph"===c)&&(0===d||"@value"in l||"@list"in l||1===d&&"@id"in l)){const o=s({unmappedValue:l,activeCtx:e,activeProperty:t,element:r,options:n,insideList:i});l=void 0!==o?o:null}return l};const{isKeyword:Fu}=hu,Vu={};var qu=Vu;Vu.createMergedNodeMap=(e,t)=>{const r=(t=t||{}).issuer||new Nc.IdentifierIssuer("_:b"),n={"@default":{}};return Vu.createNodeMap(e,n,"@default",r),Vu.mergeNodeMaps(n)},Vu.createNodeMap=(e,t,r,n,i,o)=>{if(Sc.isArray(e)){for(const i of e)Vu.createNodeMap(i,t,r,n,void 0,o);return}if(!Sc.isObject(e))return void(o&&o.push(e));if(kc.isValue(e)){if("@type"in e){let t=e["@type"];0===t.indexOf("_:")&&(e["@type"]=t=n.getId(t))}return void(o&&o.push(e))}if(o&&kc.isList(e)){const a=[];return Vu.createNodeMap(e["@list"],t,r,n,i,a),void o.push({"@list":a})}if("@type"in e){const t=e["@type"];for(const e of t)0===e.indexOf("_:")&&n.getId(e)}Sc.isUndefined(i)&&(i=kc.isBlankNode(e)?n.getId(e["@id"]):e["@id"]),o&&o.push({"@id":i});const a=t[r],s=a[i]=a[i]||{};s["@id"]=i;const c=Object.keys(e).sort();for(let o of c){if("@id"===o)continue;if("@reverse"===o){const o={"@id":i},s=e["@reverse"];for(const e in s){const i=s[e];for(const s of i){let i=s["@id"];kc.isBlankNode(s)&&(i=n.getId(i)),Vu.createNodeMap(s,t,r,n,i),Nc.addValue(a[i],e,o,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===o){i in t||(t[i]={}),Vu.createNodeMap(e[o],t,i,n);continue}if("@type"!==o&&Fu(o)){if("@index"===o&&o in s&&(e[o]!==s[o]||e[o]["@id"]!==s[o]["@id"]))throw new Ec("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:s});s[o]=e[o];continue}const c=e[o];if(0===o.indexOf("_:")&&(o=n.getId(o)),0!==c.length)for(let e of c)if("@type"===o&&(e=0===e.indexOf("_:")?n.getId(e):e),kc.isSubject(e)||kc.isSubjectReference(e)){const i=kc.isBlankNode(e)?n.getId(e["@id"]):e["@id"];Nc.addValue(s,o,{"@id":i},{propertyIsArray:!0,allowDuplicate:!1}),Vu.createNodeMap(e,t,r,n,i)}else if(kc.isValue(e))Nc.addValue(s,o,e,{propertyIsArray:!0,allowDuplicate:!1});else if(kc.isList(e)){const a=[];Vu.createNodeMap(e["@list"],t,r,n,i,a),e={"@list":a},Nc.addValue(s,o,e,{propertyIsArray:!0,allowDuplicate:!1})}else Vu.createNodeMap(e,t,r,n,i),Nc.addValue(s,o,e,{propertyIsArray:!0,allowDuplicate:!1});else Nc.addValue(s,o,[],{propertyIsArray:!0})}},Vu.mergeNodeMapGraphs=e=>{const t={};for(const r of Object.keys(e).sort())for(const n of Object.keys(e[r]).sort()){const i=e[r][n];n in t||(t[n]={"@id":n});const o=t[n];for(const e of Object.keys(i).sort())if(Fu(e))o[e]=Nc.clone(i[e]);else for(const t of i[e])Nc.addValue(o,e,Nc.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},Vu.mergeNodeMaps=e=>{const t=e["@default"],r=Object.keys(e).sort();for(const n of r){if("@default"===n)continue;const r=e[n];let i=t[n];i?"@graph"in i||(i["@graph"]=[]):t[n]=i={"@id":n,"@graph":[]};const o=i["@graph"];for(const e of Object.keys(r).sort()){const t=r[e];kc.isSubjectReference(t)||o.push(t)}}return t};const{isSubjectReference:zu}=kc,{createMergedNodeMap:Ku}=qu,Wu={};var Ju=Wu;function Gu(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}Wu.flatten=e=>{const t=Ku(e),r=[],n=Object.keys(t).sort();for(let e=0;e<n.length;++e){const i=t[n[e]];zu(i)||r.push(i)}return r};const{RDF_LIST:Xu,RDF_FIRST:$u,RDF_REST:Yu,RDF_NIL:Qu,RDF_TYPE:Zu,RDF_JSON_LITERAL:ef,XSD_BOOLEAN:tf,XSD_DOUBLE:rf,XSD_INTEGER:nf,XSD_STRING:of}=Vc,af={};var sf=af;function cf(e,t){if(e.termType.endsWith("Node"))return{"@id":e.value};const r={"@value":e.value};if(e.language)r["@language"]=e.language;else{let n=e.datatype.value;if(n||(n=of),n===ef){n="@json";try{r["@value"]=JSON.parse(r["@value"])}catch(e){throw new Ec("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:r["@value"],cause:e})}}if(t){if(n===tf)"true"===r["@value"]?r["@value"]=!0:"false"===r["@value"]&&(r["@value"]=!1);else if(Sc.isNumeric(r["@value"]))if(n===nf){const e=parseInt(r["@value"],10);e.toFixed(0)===r["@value"]&&(r["@value"]=e)}else n===rf&&(r["@value"]=parseFloat(r["@value"]));[tf,nf,rf,of].includes(n)||(r["@type"]=n)}else n!==of&&(r["@type"]=n)}return r}af.fromRDF=function(){var e,t=(e=function*(e,{useRdfType:t=!1,useNativeTypes:r=!1}){const n={},i={"@default":n},o={};for(const a of e){const e="DefaultGraph"===a.graph.termType?"@default":a.graph.value;e in i||(i[e]={}),"@default"===e||e in n||(n[e]={"@id":e});const s=i[e],c=a.subject.value,u=a.predicate.value,f=a.object;c in s||(s[c]={"@id":c});const l=s[c],d=f.termType.endsWith("Node");if(d&&!(f.value in s)&&(s[f.value]={"@id":f.value}),u===Zu&&!t&&d){Nc.addValue(l,"@type",f.value,{propertyIsArray:!0});continue}const h=cf(f,r);if(Nc.addValue(l,u,h,{propertyIsArray:!0}),d)if(f.value===Qu){const e=s[f.value];"usages"in e||(e.usages=[]),e.usages.push({node:l,property:u,value:h})}else f.value in o?o[f.value]=!1:o[f.value]={node:l,property:u,value:h}}for(const e in i){const t=i[e];if(!(Qu in t))continue;const r=t[Qu];if(r.usages){for(let e of r.usages){let r=e.node,n=e.property,i=e.value;const a=[],s=[];let c=Object.keys(r).length;for(;n===Yu&&Sc.isObject(o[r["@id"]])&&Sc.isArray(r[$u])&&1===r[$u].length&&Sc.isArray(r[Yu])&&1===r[Yu].length&&(3===c||4===c&&Sc.isArray(r["@type"])&&1===r["@type"].length&&r["@type"][0]===Xu)&&(a.push(r[$u][0]),s.push(r["@id"]),e=o[r["@id"]],r=e.node,n=e.property,i=e.value,c=Object.keys(r).length,kc.isBlankNode(r)););delete i["@id"],i["@list"]=a.reverse();for(const e of s)delete t[e]}delete r.usages}}const a=[],s=Object.keys(n).sort();for(const e of s){const t=n[e];if(e in i){const r=t["@graph"]=[],n=i[e],o=Object.keys(n).sort();for(const e of o){const t=n[e];kc.isSubjectReference(t)||r.push(t)}}kc.isSubjectReference(t)||a.push(t)}return a},function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Gu(o,n,i,a,s,"next",e)}function s(e){Gu(o,n,i,a,s,"throw",e)}a(void 0)}))});return function(e,r){return t.apply(this,arguments)}}();const{createNodeMap:uf}=qu,{isKeyword:ff}=hu,{RDF_FIRST:lf,RDF_REST:df,RDF_NIL:hf,RDF_TYPE:pf,RDF_JSON_LITERAL:bf,RDF_LANGSTRING:gf,XSD_BOOLEAN:yf,XSD_DOUBLE:mf,XSD_INTEGER:vf,XSD_STRING:wf}=Vc,{isAbsolute:_f}=Yc,Sf={};var xf=Sf;function kf(e,t,r,n,i){const o=Object.keys(t).sort();for(const a of o){const o=t[a],s=Object.keys(o).sort();for(let t of s){const s=o[t];if("@type"===t)t=pf;else if(ff(t))continue;for(const o of s){const s={termType:a.startsWith("_:")?"BlankNode":"NamedNode",value:a};if(!_f(a))continue;const c={termType:t.startsWith("_:")?"BlankNode":"NamedNode",value:t};if(!_f(t))continue;if("BlankNode"===c.termType&&!i.produceGeneralizedRdf)continue;const u=Ef(o,n,e,r);u&&e.push({subject:s,predicate:c,object:u,graph:r})}}}}function Ef(e,t,r,n){const i={};if(kc.isValue(e)){i.termType="Literal",i.value=void 0,i.datatype={termType:"NamedNode"};let t=e["@value"];const r=e["@type"]||null;"@json"===r?(i.value=Fa(t),i.datatype.value=bf):Sc.isBoolean(t)?(i.value=t.toString(),i.datatype.value=r||yf):Sc.isDouble(t)||r===mf?(Sc.isDouble(t)||(t=parseFloat(t)),i.value=t.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),i.datatype.value=r||mf):Sc.isNumber(t)?(i.value=t.toFixed(0),i.datatype.value=r||vf):"@language"in e?(i.value=t,i.datatype.value=r||gf,i.language=e["@language"]):(i.value=t,i.datatype.value=r||wf)}else if(kc.isList(e)){const o=function(e,t,r,n){const i={termType:"NamedNode",value:lf},o={termType:"NamedNode",value:df},a={termType:"NamedNode",value:hf},s=e.pop(),c=s?{termType:"BlankNode",value:t.getId()}:a;let u=c;for(const a of e){const e=Ef(a,t,r,n),s={termType:"BlankNode",value:t.getId()};r.push({subject:u,predicate:i,object:e,graph:n}),r.push({subject:u,predicate:o,object:s,graph:n}),u=s}if(s){const e=Ef(s,t,r,n);r.push({subject:u,predicate:i,object:e,graph:n}),r.push({subject:u,predicate:o,object:a,graph:n})}return c}(e["@list"],t,r,n);i.termType=o.termType,i.value=o.value}else{const t=Sc.isObject(e)?e["@id"]:e;i.termType=t.startsWith("_:")?"BlankNode":"NamedNode",i.value=t}return"NamedNode"!==i.termType||_f(i.value)?i:null}Sf.toRDF=(e,t)=>{const r=new Nc.IdentifierIssuer("_:b"),n={"@default":{}};uf(e,n,"@default",r);const i=[],o=Object.keys(n).sort();for(const e of o){let o;if("@default"===e)o={termType:"DefaultGraph",value:""};else{if(!_f(e))continue;o=e.startsWith("_:")?{termType:"BlankNode"}:{termType:"NamedNode"},o.value=e}kf(i,n[e],o,r,t)}return i};const{isKeyword:If}=hu,{createNodeMap:Of,mergeNodeMapGraphs:Tf}=qu,Af={};var Pf=Af;function Cf(e){const t={};for(const r in e)void 0!==e[r]&&(t["@"+r]=[e[r]]);return[t]}function Mf(e,t,r){for(let n=r.length-1;n>=0;--n){const i=r[n];if(i.graph===t&&i.subject["@id"]===e["@id"])return!0}return!1}function Rf(e,t,r){const n="@"+r;let i=n in e?e[n][0]:t[r];return"embed"===r&&(!0===i?i="@last":!1===i?i="@never":"@always"!==i&&"@never"!==i&&"@link"!==i&&(i="@last")),i}function Nf(e){if(!Sc.isArray(e)||1!==e.length||!Sc.isObject(e[0]))throw new Ec("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:e})}function Lf(e,t,r,n){let i=!0,o=!1;for(const a in r){let s=!1;const c=Nc.getValues(t,a),u=0===Nc.getValues(r,a).length;if(If(a)){if("@id"!==a&&"@type"!==a)continue;if(i=!1,"@id"===a){if(r["@id"].length>=0&&!Sc.isEmptyObject(r["@id"][0]))return r["@id"].includes(c[0]);s=!0;continue}if("@type"in r)if(u){if(c.length>0)return!1;s=!0}else{if(1!==r["@type"].length||!Sc.isEmptyObject(r["@type"][0])){for(const e of r["@type"])if(c.some((t=>t===e)))return!0;return!1}s=c.length>0}}const f=Nc.getValues(r,a)[0];let l=!1;if(f&&(Nf([f]),l="@default"in f),i=!1,0!==c.length||!l){if(c.length>0&&u)return!1;if(void 0===f){if(c.length>0)return!1;s=!0}else if(Sc.isObject(f))s=c.length>0;else if(kc.isValue(f))s=c.some((e=>Uf(f,e)));else if(kc.isSubject(f)||kc.isSubjectReference(f))s=c.some((t=>Bf(e,f,t,n)));else if(kc.isList(f)){const t=f["@list"][0];if(kc.isList(c[0])){const r=c[0]["@list"];kc.isValue(t)?s=r.some((e=>Uf(t,e))):(kc.isSubject(t)||kc.isSubjectReference(t))&&(s=r.some((r=>Bf(e,t,r,n))))}else s=!1}if(!s&&n.requireAll)return!1;o=o||s}}return i||o}function jf(e,t){const r=e.uniqueEmbeds[e.graph],n=r[t],i=n.parent,o=n.property,a={"@id":t};if(Sc.isArray(i)){for(let e=0;e<i.length;++e)if(Nc.compareValues(i[e],a)){i[e]=a;break}}else{const e=Sc.isArray(i[o]);Nc.removeValue(i,o,a,{propertyIsArray:e}),Nc.addValue(i,o,a,{propertyIsArray:e})}const s=e=>{const t=Object.keys(r);for(const n of t)n in r&&Sc.isObject(r[n].parent)&&r[n].parent["@id"]===e&&(delete r[n],s(n))};s(t)}function Df(e,t,r){Sc.isObject(e)?Nc.addValue(e,t,r,{propertyIsArray:!0}):e.push(r)}function Bf(e,t,r,n){if(!("@id"in r))return!1;const i=e.subjects[r["@id"]];return i&&Lf(e,i,t,n)}function Uf(e,t){const r=t["@value"],n=t["@type"],i=t["@language"],o=e["@value"]?Sc.isArray(e["@value"])?e["@value"]:[e["@value"]]:[],a=e["@type"]?Sc.isArray(e["@type"])?e["@type"]:[e["@type"]]:[],s=e["@language"]?Sc.isArray(e["@language"])?e["@language"]:[e["@language"]]:[];return 0===o.length&&0===a.length&&0===s.length||!(!o.includes(r)&&!Sc.isEmptyObject(o[0]))&&!!(!n&&0===a.length||a.includes(n)||n&&Sc.isEmptyObject(a[0]))&&!!(!i&&0===s.length||s.includes(i)||i&&Sc.isEmptyObject(s[0]))}Af.frameMergedOrDefault=(e,t,r)=>{const n={options:r,graph:"@default",graphMap:{"@default":{}},graphStack:[],subjectStack:[],link:{},bnodeMap:{}},i=new Nc.IdentifierIssuer("_:b");Of(e,n.graphMap,"@default",i),r.merged&&(n.graphMap["@merged"]=Tf(n.graphMap),n.graph="@merged"),n.subjects=n.graphMap[n.graph];const o=[];return Af.frame(n,Object.keys(n.subjects).sort(),t,o),r.pruneBlankNodeIdentifiers&&(r.bnodesToClear=Object.keys(n.bnodeMap).filter((e=>1===n.bnodeMap[e].length))),o},Af.frame=(e,t,r,n,i=null)=>{Nf(r),r=r[0];const o=e.options,a={embed:Rf(r,o,"embed"),explicit:Rf(r,o,"explicit"),requireAll:Rf(r,o,"requireAll")},s=function(e,t,r,n){const i={};for(const o of t){const t=e.graphMap[e.graph][o];Lf(e,t,r,n)&&(i[o]=t)}return i}(e,t,r,a),c=Object.keys(s).sort();for(const t of c){const c=s[t];if("@link"===a.embed&&t in e.link){Df(n,i,e.link[t]);continue}null===i?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{};const u={};if(u["@id"]=t,0===t.indexOf("_:")&&Nc.addValue(e.bnodeMap,t,u,{propertyIsArray:!0}),e.link[t]=u,"@never"===a.embed||Mf(c,e.graph,e.subjectStack))Df(n,i,u);else{if("@last"===a.embed&&(t in e.uniqueEmbeds[e.graph]&&jf(e,t),e.uniqueEmbeds[e.graph][t]={parent:n,property:i}),e.subjectStack.push({subject:c,graph:e.graph}),t in e.graphMap){let n=!1,i=null;"@graph"in r?(i=r["@graph"][0],Sc.isObject(i)||(i={}),n=!("@merged"===t||"@default"===t)):(n="@merged"!==e.graph,i={}),n&&(e.graphStack.push(e.graph),e.graph=t,Af.frame(e,Object.keys(e.graphMap[t]).sort(),[i],u,"@graph"),e.graph=e.graphStack.pop)}for(const t of Object.keys(c).sort())if(If(t)){if(u[t]=Nc.clone(c[t]),"@type"===t)for(const t of c["@type"])0===t.indexOf("_:")&&Nc.addValue(e.bnodeMap,t,u,{propertyIsArray:!0})}else if(!a.explicit||t in r)for(let n of c[t]){const i=t in r?r[t]:Cf(a);if(kc.isList(n)){const i={"@list":[]};Df(u,t,i);const o=n["@list"];for(const s in o)if(n=o[s],kc.isSubjectReference(n)){const o=t in r?r[t][0]["@list"]:Cf(a);Af.frame(e,[n["@id"]],o,i,"@list")}else Df(i,"@list",Nc.clone(n))}else kc.isSubjectReference(n)?Af.frame(e,[n["@id"]],i,u,t):Uf(i[0],n)&&Df(u,t,Nc.clone(n))}for(const e of Object.keys(r).sort()){if(If(e))continue;const t=r[e][0]||{};if(!Rf(t,o,"omitDefault")&&!(e in u)){let r="@null";"@default"in t&&(r=Nc.clone(t["@default"])),Sc.isArray(r)||(r=[r]),u[e]=[{"@preserve":r}]}}if("@reverse"in r)for(const n of Object.keys(r["@reverse"]).sort()){const o=r["@reverse"][n];for(const r of Object.keys(e.subjects))Nc.getValues(e.subjects[r],n).some((e=>e["@id"]===t))&&(u["@reverse"]=u["@reverse"]||{},Nc.addValue(u["@reverse"],n,[],{propertyIsArray:!0}),Af.frame(e,[r],o,u["@reverse"][n],i))}Df(n,i,u),e.subjectStack.pop()}}};const{isArray:Hf,isObject:Ff,isString:Vf,isUndefined:qf}=Sc,{isList:zf,isValue:Kf,isGraph:Wf,isSimpleGraph:Jf,isSubjectReference:Gf}=kc,{expandIri:Xf,getContextValue:$f,isKeyword:Yf,process:Qf}=hu,{removeBase:Zf}=Yc,{addValue:el,asArray:tl,compareShortestLeast:rl}=Nc,nl={};var il=nl;function ol(e,t,r){if("@nest"!==Xf(e,t,{vocab:!0},r))throw new Ec("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}function al(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}nl.compact=({activeCtx:e,activeProperty:t=null,element:r,options:n={},compactionMap:i=(()=>{})})=>{if(Hf(r)){let o=[];for(let a=0;a<r.length;++a){let s=nl.compact({activeCtx:e,activeProperty:t,element:r[a],options:n,compactionMap:i});null===s&&(s=i({unmappedValue:r[a],activeCtx:e,activeProperty:t,parent:r,index:a,options:n}),void 0===s)||o.push(s)}return n.compactArrays&&1===o.length&&0===($f(e,t,"@container")||[]).length&&(o=o[0]),o}const o=$f(e,t,"@context");if(qf(o)||(e=Qf({activeCtx:e,localCtx:o,isPropertyTermScopedContext:!0,options:n})),Ff(r)){if(n.link&&"@id"in r&&n.link.hasOwnProperty(r["@id"])){const e=n.link[r["@id"]];for(let t=0;t<e.length;++t)if(e[t].expanded===r)return e[t].compacted}if(Kf(r)||Gf(r)){const i=nl.compactValue({activeCtx:e,activeProperty:t,value:r,options:n});return n.link&&Gf(r)&&(n.link.hasOwnProperty(r["@id"])||(n.link[r["@id"]]=[]),n.link[r["@id"]].push({expanded:r,compacted:i})),i}if(zf(r)&&($f(e,t,"@container")||[]).includes("@list"))return nl.compact({activeCtx:e,activeProperty:t,element:r["@list"],options:n,compactionMap:i});const o="@reverse"===t,a={};e=e.revertTypeScopedContext(),n.link&&"@id"in r&&(n.link.hasOwnProperty(r["@id"])||(n.link[r["@id"]]=[]),n.link[r["@id"]].push({expanded:r,compacted:a}));let s=r["@type"]||[];s.length>1&&(s=Array.from(s).sort());const c=e;for(const t of s){const r=nl.compactIri({activeCtx:c,iri:t,relativeTo:{vocab:!0}}),i=$f(c,r,"@context");qf(i)||(e=Qf({activeCtx:e,localCtx:i,options:n,isTypeScopedContext:!0}))}const u=Object.keys(r).sort();for(const s of u){const c=r[s];if("@id"!==s&&"@type"!==s)if("@reverse"!==s)if("@preserve"!==s)if("@index"!==s)if("@graph"!==s&&"@list"!==s&&Yf(s)){const t=nl.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});el(a,t,c)}else{if(!Hf(c))throw new Ec("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(0===c.length){const t=nl.compactIri({activeCtx:e,iri:s,value:c,relativeTo:{vocab:!0},reverse:o}),r=e.mappings.has(t)?e.mappings.get(t)["@nest"]:null;let i=a;r&&(ol(e,r,n),Ff(a[r])||(a[r]={}),i=a[r]),el(i,t,c,{propertyIsArray:!0})}for(const t of c){const r=nl.compactIri({activeCtx:e,iri:s,value:t,relativeTo:{vocab:!0},reverse:o}),c=e.mappings.has(r)?e.mappings.get(r)["@nest"]:null;let u=a;c&&(ol(e,c,n),Ff(a[c])||(a[c]={}),u=a[c]);const f=$f(e,r,"@container")||[],l=Wf(t),d=zf(t);let h;d?h=t["@list"]:l&&(h=t["@graph"]);let p=nl.compact({activeCtx:e,activeProperty:r,element:d||l?h:t,options:n,compactionMap:i});if(d){if(Hf(p)||(p=[p]),f.includes("@list")){el(u,r,p,{valueIsArray:!0,allowDuplicate:!0});continue}p={[nl.compactIri({activeCtx:e,iri:"@list",relativeTo:{vocab:!0}})]:p},"@index"in t&&(p[nl.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"])}if(l)if(f.includes("@graph")&&(f.includes("@id")||f.includes("@index")&&Jf(t))){let i;u.hasOwnProperty(r)?i=u[r]:u[r]=i={};const o=(f.includes("@id")?t["@id"]:t["@index"])||nl.compactIri({activeCtx:e,iri:"@none",vocab:!0});el(i,o,p,{propertyIsArray:!n.compactArrays||f.includes("@set")})}else f.includes("@graph")&&Jf(t)||(Hf(p)&&1===p.length&&n.compactArrays&&(p=p[0]),p={[nl.compactIri({activeCtx:e,iri:"@graph",relativeTo:{vocab:!0}})]:p},"@id"in t&&(p[nl.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t["@id"]),"@index"in t&&(p[nl.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"])),el(u,r,p,{propertyIsArray:!n.compactArrays||f.includes("@set")});else if(f.includes("@language")||f.includes("@index")||f.includes("@id")||f.includes("@type")){let n,i;if(u.hasOwnProperty(r)?n=u[r]:u[r]=n={},f.includes("@language"))Kf(p)&&(p=p["@value"]),i=t["@language"];else if(f.includes("@index"))i=t["@index"];else if(f.includes("@id")){const t=nl.compactIri({activeCtx:e,iri:"@id",vocab:!0});i=p[t],delete p[t]}else if(f.includes("@type")){const t=nl.compactIri({activeCtx:e,iri:"@type",vocab:!0});let r;switch([i,...r]=tl(p[t]||[]),r.length){case 0:delete p[t];break;case 1:p[t]=r[0];break;default:p[t]=r}}i||(i=nl.compactIri({activeCtx:e,iri:"@none",vocab:!0})),el(n,i,p,{propertyIsArray:f.includes("@set")})}else{const e=!n.compactArrays||f.includes("@set")||f.includes("@list")||Hf(p)&&0===p.length||"@list"===s||"@graph"===s;el(u,r,p,{propertyIsArray:e})}}}else{if(($f(e,t,"@container")||[]).includes("@index"))continue;const r=nl.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});el(a,r,c)}else{const r=nl.compact({activeCtx:e,activeProperty:t,element:c,options:n,compactionMap:i});Hf(r)&&0===r.length||el(a,s,r)}else{const t=nl.compact({activeCtx:e,activeProperty:"@reverse",element:c,options:n,compactionMap:i});for(const r in t)if(e.mappings.has(r)&&e.mappings.get(r).reverse){const i=t[r],o=($f(e,r,"@container")||[]).includes("@set")||!n.compactArrays;el(a,r,i,{propertyIsArray:o}),delete t[r]}if(Object.keys(t).length>0){const r=nl.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});el(a,r,t)}}else{const t="@type"===s,r=t&&e.previousContext||e;let n=tl(c).map((e=>nl.compactIri({activeCtx:r,iri:e,relativeTo:{vocab:t}})));1===n.length&&(n=n[0]);const i=nl.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}}),o=Hf(n)&&0===c.length;el(a,i,n,{propertyIsArray:o})}}return a}return r},nl.compactIri=({activeCtx:e,iri:t,value:r=null,relativeTo:n={vocab:!1},reverse:i=!1})=>{if(null===t)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);const o=e.getInverse();if(Yf(t)&&t in o&&"@none"in o[t]&&"@type"in o[t]["@none"]&&"@none"in o[t]["@none"]["@type"])return o[t]["@none"]["@type"]["@none"];if(n.vocab&&t in o){const n=e["@language"]||"@none",o=[];Ff(r)&&"@index"in r&&!("@graph"in r)&&o.push("@index","@index@set"),Ff(r)&&"@preserve"in r&&(r=r["@preserve"][0]),Wf(r)?("@index"in r&&o.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in r&&o.push("@graph@id","@graph@id@set"),o.push("@graph","@graph@set","@set"),"@index"in r||o.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in r||o.push("@graph@id","@graph@id@set")):Ff(r)&&!Kf(r)&&o.push("@id","@id@set","@type","@set@type");let a="@language",s="@null";if(i)a="@type",s="@reverse",o.push("@set");else if(zf(r)){"@index"in r||o.push("@list");const e=r["@list"];if(0===e.length)a="@any",s="@none";else{let t=0===e.length?n:null,r=null;for(let n=0;n<e.length;++n){const i=e[n];let o="@none",a="@none";if(Kf(i)?"@language"in i?o=i["@language"]:"@type"in i?a=i["@type"]:o="@null":a="@id",null===t?t=o:o!==t&&Kf(i)&&(t="@none"),null===r?r=a:a!==r&&(r="@none"),"@none"===t&&"@none"===r)break}t=t||"@none",r=r||"@none","@none"!==r?(a="@type",s=r):s=t}}else Kf(r)?"@language"in r&&!("@index"in r)?(o.push("@language","@language@set"),s=r["@language"]):"@type"in r&&(a="@type",s=r["@type"]):(a="@type",s="@id"),o.push("@set");o.push("@none"),Ff(r)&&!("@index"in r)&&o.push("@index","@index@set"),Kf(r)&&1===Object.keys(r).length&&o.push("@language","@language@set");const c=function(e,t,r,n,i,o){null===o&&(o="@null");const a=[];if("@id"!==o&&"@reverse"!==o||!Gf(r))a.push(o);else{"@reverse"===o&&a.push("@reverse");const t=nl.compactIri({activeCtx:e,iri:r["@id"],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)["@id"]===r["@id"]?a.push.apply(a,["@vocab","@id"]):a.push.apply(a,["@id","@vocab"])}a.push("@none");const s=e.inverse[t];for(let e=0;e<n.length;++e){const t=n[e];if(!(t in s))continue;const r=s[t][i];for(let e=0;e<a.length;++e){const t=a[e];if(t in r)return r[t]}}return null}(e,t,r,o,a,s);if(null!==c)return c}if(n.vocab&&"@vocab"in e){const r=e["@vocab"];if(0===t.indexOf(r)&&t!==r){const n=t.substr(r.length);if(!e.mappings.has(n))return n}}let a=null;const s=[];let c=e.fastCurieMap;const u=t.length-1;for(let e=0;e<u&&t[e]in c;++e)c=c[t[e]],""in c&&s.push(c[""][0]);for(let n=s.length-1;n>=0;--n){const i=s[n],o=i.terms;for(const n of o){const o=n+":"+t.substr(i.iri.length);e.mappings.get(n)._prefix&&(!e.mappings.has(o)||null===r&&e.mappings.get(o)["@id"]===t)&&(null===a||rl(o,a)<0)&&(a=o)}}return null!==a?a:n.vocab?t:Zf(e["@base"],t)},nl.compactValue=({activeCtx:e,activeProperty:t,value:r,options:n})=>{if(Kf(r)){const n=$f(e,t,"@type"),i=$f(e,t,"@language"),o=$f(e,t,"@container")||[],a="@index"in r&&!o.includes("@index");if(!a&&(r["@type"]===n||r["@language"]===i))return r["@value"];const s=Object.keys(r).length,c=1===s||2===s&&"@index"in r&&!a,u="@language"in e,f=Vf(r["@value"]),l=e.mappings.has(t)&&null===e.mappings.get(t)["@language"];if(c&&(!u||!f||l))return r["@value"];const d={};return a&&(d[nl.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=r["@index"]),"@type"in r?d[nl.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}})]=nl.compactIri({activeCtx:e,iri:r["@type"],relativeTo:{vocab:!0}}):"@language"in r&&(d[nl.compactIri({activeCtx:e,iri:"@language",relativeTo:{vocab:!0}})]=r["@language"]),d[nl.compactIri({activeCtx:e,iri:"@value",relativeTo:{vocab:!0}})]=r["@value"],d}const i=Xf(e,t,{vocab:!0},n),o=$f(e,t,"@type"),a=nl.compactIri({activeCtx:e,iri:r["@id"],relativeTo:{vocab:"@vocab"===o}});return"@id"===o||"@vocab"===o||"@graph"===i?a:{[nl.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]:a}},
|
|
70
|
+
/**
|
|
71
|
+
* Removes the @preserve keywords as the last step of the compaction
|
|
72
|
+
* algorithm when it is running on framed output.
|
|
73
|
+
*
|
|
74
|
+
* @param ctx the active context used to compact the input.
|
|
75
|
+
* @param input the framed, compacted output.
|
|
76
|
+
* @param options the compaction options used.
|
|
77
|
+
*
|
|
78
|
+
* @return the resulting output.
|
|
79
|
+
*/
|
|
80
|
+
nl.removePreserve=(e,t,r)=>{if(Hf(t)){const n=[];for(let i=0;i<t.length;++i){const o=nl.removePreserve(e,t[i],r);null!==o&&n.push(o)}t=n}else if(Ff(t)){
|
|
81
|
+
// remove @preserve
|
|
82
|
+
if("@preserve"in t)return"@null"===t["@preserve"]?null:t["@preserve"];if(Kf(t))return t;if(zf(t))return t["@list"]=nl.removePreserve(e,t["@list"],r),t;const n=nl.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}});if(t.hasOwnProperty(n)){const e=t[n];if(r.link.hasOwnProperty(e)){const n=r.link[e].indexOf(t);if(-1!==n)return r.link[e][n];r.link[e].push(t)}else r.link[e]=[t]}const i=nl.compactIri({activeCtx:e,iri:"@graph",relativeTo:{vocab:!0}});for(const o in t){if(o===n&&r.bnodesToClear.includes(t[o])){delete t[n];continue}let a=nl.removePreserve(e,t[o],r);const s=$f(e,o,"@container")||[];r.compactArrays&&Hf(a)&&1===a.length&&0===s.length&&o!==i&&(a=a[0]),t[o]=a}}return t};const{callbackify:sl,normalizeDocumentLoader:cl}=Nc;var ul=class{constructor(){this._requests={},this.add=sl(this.add.bind(this))}wrapLoader(e){const t=this;return t._loader=cl(e),function(){return t.add.apply(t,arguments)}}add(e){var t,r=this;return(t=function*(){const t=r;let n=t._requests[e];if(n)return Promise.resolve(n);n=t._requests[e]=t._loader(e);try{return yield n}finally{delete t._requests[e]}},function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(e){al(o,n,i,a,s,"next",e)}function s(e){al(o,n,i,a,s,"throw",e)}a(void 0)}))})()}};function fl(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}const{parseLinkHeader:ll,buildHeaders:dl}=Nc,{LINK_HEADER_REL:hl}=Vc;var pl=({secure:e,strictSSL:t=!0,maxRedirects:r=-1,request:n,headers:i={}}={strictSSL:!0,maxRedirects:-1,headers:{}})=>{i=dl(i),n=n||to;const o=to;return(new ul).wrapLoader((function(e){return a(e,[])}));function a(e,t){return s.apply(this,arguments)}function s(){return(s=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){fl(o,n,i,a,s,"next",e)}function s(e){fl(o,n,i,a,s,"throw",e)}a(void 0)}))}}((function*(s,c){if(0!==s.indexOf("http:")&&0!==s.indexOf("https:"))throw new Ec('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:s});if(e&&0!==s.indexOf("https"))throw new Ec('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:s});let u,f=null;if(null!==f)return f;try{u=yield function(e,t){return new Promise(((r,n)=>{e(t,((e,t,i)=>{e?n(e):r({res:t,body:i})}))}))}(n,{url:s,headers:i,strictSSL:t,followRedirect:!1})}catch(e){throw new Ec("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:s,cause:e})}const{res:l,body:d}=u;f={contextUrl:null,documentUrl:s,document:d||null};const h=o.STATUS_CODES[l.statusCode];if(l.statusCode>=400)throw new Ec("URL could not be dereferenced: "+h,"jsonld.InvalidUrl",{code:"loading document failed",url:s,httpStatusCode:l.statusCode});if(l.headers.link&&"application/ld+json"!==l.headers["content-type"]){const e=ll(l.headers.link)[hl];if(Array.isArray(e))throw new Ec("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:s});e&&(f.contextUrl=e.target)}if(l.statusCode>=300&&l.statusCode<400&&l.headers.location){if(c.length===r)throw new Ec("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:s,httpStatusCode:l.statusCode,redirects:c});if(-1!==c.indexOf(s))throw new Ec("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:s,httpStatusCode:l.statusCode,redirects:c});return c.push(s),a(l.headers.location,c)}return c.push(s),f}))).apply(this,arguments)}};function bl(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}const{parseLinkHeader:gl,buildHeaders:yl}=Nc,{LINK_HEADER_REL:ml}=Vc,vl=/(^|(\r\n))link:/i;var wl=({secure:e,headers:t={},xhr:r}={headers:{}})=>{return t=yl(t),(new ul).wrapLoader((function(e){return n.apply(this,arguments)}));function n(){return(n=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){bl(o,n,i,a,s,"next",e)}function s(e){bl(o,n,i,a,s,"throw",e)}a(void 0)}))}}((function*(n){if(0!==n.indexOf("http:")&&0!==n.indexOf("https:"))throw new Ec('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:n});if(e&&0!==n.indexOf("https"))throw new Ec('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:n});let i;try{i=yield function(e,t,r){const n=new(e=e||XMLHttpRequest);return new Promise(((e,i)=>{n.onload=()=>e(n),n.onerror=e=>i(e),n.open("GET",t,!0);for(const e in r)n.setRequestHeader(e,r[e]);n.send()}))}(r,n,t)}catch(e){throw new Ec("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:n,cause:e})}if(i.status>=400)throw new Ec("URL could not be dereferenced: "+i.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:n,httpStatusCode:i.status});const o={contextUrl:null,documentUrl:n,document:i.response},a=i.getResponseHeader("Content-Type");let s;if(vl.test(i.getAllResponseHeaders())&&(s=i.getResponseHeader("Link")),s&&"application/ld+json"!==a){if(s=gl(s)[ml],Array.isArray(s))throw new Ec("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:n});s&&(o.contextUrl=s.target)}return o}))).apply(this,arguments)}};function _l(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Sl(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){_l(o,n,i,a,s,"next",e)}function s(e){_l(o,n,i,a,s,"throw",e)}a(void 0)}))}}
|
|
83
|
+
/**
|
|
84
|
+
* A JavaScript implementation of the JSON-LD API.
|
|
85
|
+
*
|
|
86
|
+
* @author Dave Longley
|
|
87
|
+
*
|
|
88
|
+
* @license BSD 3-Clause License
|
|
89
|
+
* Copyright (c) 2011-2017 Digital Bazaar, Inc.
|
|
90
|
+
* All rights reserved.
|
|
91
|
+
*
|
|
92
|
+
* Redistribution and use in source and binary forms, with or without
|
|
93
|
+
* modification, are permitted provided that the following conditions are met:
|
|
94
|
+
*
|
|
95
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
96
|
+
* this list of conditions and the following disclaimer.
|
|
97
|
+
*
|
|
98
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
99
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
100
|
+
* documentation and/or other materials provided with the distribution.
|
|
101
|
+
*
|
|
102
|
+
* Neither the name of the Digital Bazaar, Inc. nor the names of its
|
|
103
|
+
* contributors may be used to endorse or promote products derived from
|
|
104
|
+
* this software without specific prior written permission.
|
|
105
|
+
*
|
|
106
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
107
|
+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
108
|
+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
109
|
+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
110
|
+
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
111
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
|
112
|
+
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
113
|
+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
114
|
+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
115
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
116
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
117
|
+
*/const xl=Nc.IdentifierIssuer,{expand:kl}=Du,{flatten:El}=Ju,{fromRDF:Il}=sf,{toRDF:Ol}=xf,{frameMergedOrDefault:Tl}=Pf,{isArray:Al,isObject:Pl,isString:Cl}=Sc,{isSubjectReference:Ml}=kc,{getInitialContext:Rl,process:Nl,getAllContexts:Ll}=hu,{compact:jl,compactIri:Dl,removePreserve:Bl}=il,{createNodeMap:Ul,createMergedNodeMap:Hl,mergeNodeMaps:Fl}=qu,Vl=void 0!==ft&&ft.versions&&ft.versions.node,ql=!Vl&&("undefined"!=typeof window||"undefined"!=typeof self),zl=function(e){const t={};function r(t,r){let{documentLoader:n=e.documentLoader}=r,i=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(r,["documentLoader"]);return Object.assign({},{documentLoader:n},i,t)}return e.compact=Nc.callbackify(function(){var t=Sl((function*(t,n,i){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===n)throw new Ec("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let o;(i=r(i,{base:Cl(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new xl("_:b")})).link&&(i.skipExpansion=!0),i.compactToRelative||delete i.base,o=i.skipExpansion?t:yield e.expand(t,i);const a=yield e.processContext(Rl(i),n,i);let s=jl({activeCtx:a,element:o,options:i,compactionMap:i.compactionMap});i.compactArrays&&!i.graph&&Al(s)?1===s.length?s=s[0]:0===s.length&&(s={}):i.graph&&Pl(s)&&(s=[s]),Pl(n)&&"@context"in n&&(n=n["@context"]),n=Nc.clone(n),Al(n)||(n=[n]);const c=n;n=[];for(let e=0;e<c.length;++e)(!Pl(c[e])||Object.keys(c[e]).length>0)&&n.push(c[e]);const u=n.length>0;if(1===n.length&&(n=n[0]),Al(s)){const e=Dl({activeCtx:a,iri:"@graph",relativeTo:{vocab:!0}}),t=s;s={},u&&(s["@context"]=n),s[e]=t}else if(Pl(s)&&u){const e=s;s={"@context":n};for(const t in e)s[t]=e[t]}if(i.framing){const e=Dl({activeCtx:a,iri:"@graph",relativeTo:{vocab:!0}});// remove @preserve from results
|
|
118
|
+
i.link={},s[e]=Bl(a,s[e],i)}return s}));return function(e,r,n){return t.apply(this,arguments)}}()),e.expand=Nc.callbackify(function(){var t=Sl((function*(t,n){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");!1===(n=r(n,{keepFreeFloatingNodes:!1})).expansionMap&&(n.expansionMap=void 0);const i={},o=[];if("expandContext"in n){const e=Nc.clone(n.expandContext);Pl(e)&&"@context"in e?i.expandContext=e:i.expandContext={"@context":e},o.push(i.expandContext)}let a;if(Cl(t)){const r=yield e.get(t,n);a=r.documentUrl,i.input=r.document,r.contextUrl&&(i.remoteContext={"@context":r.contextUrl},o.push(i.remoteContext))}else i.input=Nc.clone(t);"base"in n||(n.base=a||""),yield Ll(i,n);let s=Rl(n);o.forEach((e=>{s=Nl({activeCtx:s,localCtx:e,options:n})}));let c=kl({activeCtx:s,element:i.input,options:n,expansionMap:n.expansionMap});return Pl(c)&&"@graph"in c&&1===Object.keys(c).length?c=c["@graph"]:null===c&&(c=[]),Al(c)||(c=[c]),c}));return function(e,r){return t.apply(this,arguments)}}()),e.flatten=Nc.callbackify(function(){var t=Sl((function*(t,n,i){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");n="function"==typeof n?null:n||null,i=r(i,{base:Cl(t)?t:""});const o=yield e.expand(t,i),a=El(o);if(null===n)return a;i.graph=!0,i.skipExpansion=!0;return yield e.compact(a,n,i)}));return function(e,r,n){return t.apply(this,arguments)}}()),e.frame=Nc.callbackify(function(){var t=Sl((function*(t,n,i){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(i=r(i,{base:Cl(t)?t:"",embed:"@last",explicit:!1,requireAll:!0,omitDefault:!1,pruneBlankNodeIdentifiers:!0,bnodesToClear:[]}),Cl(n)){const t=yield e.get(n,i);if(n=t.document,t.contextUrl){let e=n["@context"];e?Al(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,n["@context"]=e}}const o=n&&n["@context"]||{},a=yield e.expand(t,i),s=Nc.clone(i);s.isFrame=!0,s.keepFreeFloatingNodes=!0;const c=yield e.expand(n,s);s.merged=!("@graph"in n);const u=Tl(a,c,s);s.graph=!0,s.skipExpansion=!0,s.link={},s.framing=!0;return yield e.compact(u,o,s)}));return function(e,r,n){return t.apply(this,arguments)}}()),e.link=Nc.callbackify(function(){var t=Sl((function*(t,r,n){const i={};return r&&(i["@context"]=r),i["@embed"]="@link",e.frame(t,i,n)}));return function(e,r,n){return t.apply(this,arguments)}}()),e.normalize=e.canonize=Nc.callbackify(function(){var t=Sl((function*(t,n){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(n=r(n,{base:Cl(t)?t:"",algorithm:"URDNA2015",skipExpansion:!1}))){if("application/n-quads"!==n.inputFormat&&"application/nquads"!==n.inputFormat)throw new Ec("Unknown canonicalization input format.","jsonld.CanonizeError");const e=Uc.parse(t);return io.canonize(e,n)}const i=Nc.clone(n);delete i.format,i.produceGeneralizedRdf=!1;const o=yield e.toRDF(t,i);return io.canonize(o,n)}));return function(e,r){return t.apply(this,arguments)}}()),e.fromRDF=Nc.callbackify(function(){var e=Sl((function*(e,n){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");n=r(n,{format:Cl(e)?"application/n-quads":void 0});const{format:i}=n;let o,{rdfParser:a}=n;if(i){if(a=a||t[i],!a)throw new Ec("Unknown input format.","jsonld.UnknownFormat",{format:i})}else a=()=>e;return o=a.length>1?new Promise(((t,r)=>{a(e,((e,n)=>{e?r(e):t(n)}))})):Promise.resolve(a(e)),o=yield o,Array.isArray(o)||(o=Uc.legacyDatasetToQuads(o)),Il(o,n)}));return function(t,r){return e.apply(this,arguments)}}()),e.toRDF=Nc.callbackify(function(){var t=Sl((function*(t,n){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let i;i=(n=r(n,{base:Cl(t)?t:"",skipExpansion:!1})).skipExpansion?t:yield e.expand(t,n);const o=Ol(i,n);if(n.format){if("application/n-quads"===n.format||"application/nquads"===n.format)return yield Uc.serialize(o);throw new Ec("Unknown output format.","jsonld.UnknownFormat",{format:n.format})}return o}));return function(e,r){return t.apply(this,arguments)}}()),e.createNodeMap=Nc.callbackify(function(){var t=Sl((function*(t,n){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");n=r(n,{base:Cl(t)?t:""});const i=yield e.expand(t,n);return Hl(i,n)}));return function(e,r){return t.apply(this,arguments)}}()),e.merge=Nc.callbackify(function(){var t=Sl((function*(t,n,i){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!Al(t))throw new TypeError('Could not merge, "docs" must be an array.');n="function"==typeof n?null:n||null,i=r(i,{});const o=yield Promise.all(t.map((t=>{const r=Object.assign({},i);return e.expand(t,r)})));let a=!0;"mergeNodes"in i&&(a=i.mergeNodes);const s=i.issuer||new xl("_:b"),c={"@default":{}};for(let e=0;e<o.length;++e){const t=Nc.relabelBlankNodes(o[e],{issuer:new xl("_:b"+e+"-")}),r=a||0===e?c:{"@default":{}};if(Ul(t,r,"@default",s),r!==c)for(const e in r){const t=r[e];if(!(e in c)){c[e]=t;continue}const n=c[e];for(const e in t)e in n||(n[e]=t[e])}}const u=Fl(c),f=[],l=Object.keys(u).sort();for(let e=0;e<l.length;++e){const t=u[l[e]];Ml(t)||f.push(t)}if(null===n)return f;i.graph=!0,i.skipExpansion=!0;return yield e.compact(f,n,i)}));return function(e,r,n){return t.apply(this,arguments)}}()),Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=Nc.normalizeDocumentLoader(t)}),e.documentLoader=function(){var e=Sl((function*(e){throw new Ec("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:e})}));return function(t){return e.apply(this,arguments)}}(),e.loadDocument=Nc.callbackify(Sl((function*(){return e.documentLoader.apply(null,arguments)}))),e.get=Nc.callbackify(function(){var t=Sl((function*(t,r){let n;n="function"==typeof r.documentLoader?Nc.normalizeDocumentLoader(r.documentLoader):e.documentLoader;const i=yield n(t);try{if(!i.document)throw new Ec("No remote document found at the given URL.","jsonld.NullRemoteDocument");Cl(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new Ec("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:e,remoteDoc:i})}return i}));return function(e,r){return t.apply(this,arguments)}}()),e.processContext=Nc.callbackify(function(){var e=Sl((function*(e,t,n){if(n=r(n,{base:""}),null===t)return Rl(n);t=Nc.clone(t),Pl(t)&&"@context"in t||(t={"@context":t});const i=yield Ll(t,n);return Nl({activeCtx:e,localCtx:i,options:n})}));return function(t,r,n){return e.apply(this,arguments)}}()),e.getContextValue=hu.getContextValue,e.documentLoaders={},e.documentLoaders.node=pl,e.documentLoaders.xhr=wl,e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new Ec('Unknown document loader type: "'+t+'"',"jsonld.UnknownDocumentLoader",{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,r){t[e]=r},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser("application/n-quads",Uc.parse),e.registerRDFParser("application/nquads",Uc.parse),e.registerRDFParser("rdfa-api",class{parse(e){const t={"@default":[]},r=e.getSubjects();for(let n=0;n<r.length;++n){const i=r[n];if(null===i)continue;const o=e.getSubjectTriples(i);if(null===o)continue;const a=o.predicates;for(const e in a){const r=a[e].objects;for(let n=0;n<r.length;++n){const o=r[n],a={};0===i.indexOf("_:")?a.subject={type:"blank node",value:i}:a.subject={type:"IRI",value:i},0===e.indexOf("_:")?a.predicate={type:"blank node",value:e}:a.predicate={type:"IRI",value:e};let s=o.value;if(o.type===Wc){const e=new("undefined"==typeof XMLSerializer?to.XMLSerializer:XMLSerializer);s="";for(let t=0;t<o.value.length;t++)o.value[t].nodeType===Gc.ELEMENT_NODE?s+=e.serializeToString(o.value[t]):o.value[t].nodeType===Gc.TEXT_NODE&&(s+=o.value[t].nodeValue)}a.object={},o.type===Kc?0===o.value.indexOf("_:")?a.object.type="blank node":a.object.type="IRI":(a.object.type="literal",o.type===zc?o.language?(a.object.datatype=qc,a.object.language=o.language):a.object.datatype=Jc:a.object.datatype=o.type),a.object.value=s,t["@default"].push(a)}}}return t}}.parse),e.url=Yc,e.util=Nc,Object.assign(e,Nc),e.promises=e,e.RequestQueue=ul,e.JsonLdProcessor=(e=>{class t{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,r){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):e.compact(t,r)},t.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):e.flatten(t)},t})(e),ql&&void 0===M.JsonLdProcessor&&Object.defineProperty(M,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor}),Vl?e.useDocumentLoader("node"):"undefined"!=typeof XMLHttpRequest&&e.useDocumentLoader("xhr"),e},Kl=function(){return zl((function(){return Kl()}))};zl(Kl);var Wl=Kl,Jl=N((function(e){Ti.gte(ft.version,"8.6.0")?e.exports=wc:e.exports=Wl}));Jl.jsonld;var Gl=N((function(e){!function(t){var r={bytesToHex:function(e){return function(e){return e.map((function(e){return 2,(t=e.toString(16)).length>2?t:Array(2-t.length+1).join("0")+t;var t})).join("")}(e)},hexToBytes:function(e){if(e.length%2==1)throw new Error("hexToBytes can't have a string with an odd number of characters.");return 0===e.indexOf("0x")&&(e=e.slice(2)),e.match(/../g).map((function(e){return parseInt(e,16)}))}};e.exports?e.exports=r:t.convertHex=r}(M)})),Xl=N((function(e){!function(t){var r={bytesToString:function(e){return e.map((function(e){return String.fromCharCode(e)})).join("")},stringToBytes:function(e){return e.split("").map((function(e){return e.charCodeAt(0)}))}};r.UTF8={bytesToString:function(e){return decodeURIComponent(escape(r.bytesToString(e)))},stringToBytes:function(e){return r.stringToBytes(unescape(encodeURIComponent(e)))}},e.exports?e.exports=r:t.convertString=r}(M)})),$l=N((function(e){!function(t){var r={};e.exports?(r.bytesToHex=Gl.bytesToHex,r.convertString=Xl,e.exports=a):(r.bytesToHex=t.convertHex.bytesToHex,r.convertString=t.convertString,t.sha256=a);var n=[];!function(){function e(e){for(var t=Math.sqrt(e),r=2;r<=t;r++)if(!(e%r))return!1;return!0}function t(e){return 4294967296*(e-(0|e))|0}for(var r=2,i=0;i<64;)e(r)&&(n[i]=t(Math.pow(r,1/3)),i++),r++}();var i=[],o=function(e,t,r){for(var o=e[0],a=e[1],s=e[2],c=e[3],u=e[4],f=e[5],l=e[6],d=e[7],h=0;h<64;h++){if(h<16)i[h]=0|t[r+h];else{var p=i[h-15],b=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,g=i[h-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;i[h]=b+i[h-7]+y+i[h-16]}var m=o&a^o&s^a&s,v=(o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22),w=d+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&f^~u&l)+n[h]+i[h];d=l,l=f,f=u,u=c+w|0,c=s,s=a,a=o,o=w+(v+m)|0}e[0]=e[0]+o|0,e[1]=e[1]+a|0,e[2]=e[2]+s|0,e[3]=e[3]+c|0,e[4]=e[4]+u|0,e[5]=e[5]+f|0,e[6]=e[6]+l|0,e[7]=e[7]+d|0};function a(e,t){e.constructor===String&&(e=r.convertString.UTF8.stringToBytes(e));var n=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],i=function(e){for(var t=[],r=0,n=0;r<e.length;r++,n+=8)t[n>>>5]|=e[r]<<24-n%32;return t}(e),a=8*e.length;i[a>>5]|=128<<24-a%32,i[15+(a+64>>9<<4)]=a;for(var s=0;s<i.length;s+=16)o(n,i,s);var c=function(e){for(var t=[],r=0;r<32*e.length;r+=8)t.push(e[r>>>5]>>>24-r%32&255);return t}(n);return t&&t.asBytes?c:t&&t.asString?r.convertString.bytesToString(c):r.bytesToHex(c)}a.x2=function(e,t){return a(a(e,{asBytes:!0}),t)}}(M)}));function Yl(e){e=e.trim();const t=[];for(let r=0;r<e.length;r+=2)t.push(parseInt(e.substring(r,r+2),16));return t}var Ql=N((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),Zl=N((function(e,t){
|
|
119
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
120
|
+
var r=Ue.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=Ue:(n(Ue,t),t.Buffer=i),i.prototype=Object.create(r.prototype),n(r,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return Ue.SlowBuffer(e)}}));Zl.Buffer;var ed=Or.EventEmitter;function td(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var nd=Ue.Buffer,id=to.inspect,od=id&&id.custom||"inspect";function ad(e,t,r){nd.prototype.copy.call(e,t,r)}var sd=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t;return(t=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return nd.alloc(0);for(var t=nd.allocUnsafe(e>>>0),r=this.head,n=0;r;)ad(r.data,t,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=nd.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:od,value:function(e,t){return id(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?td(Object(r),!0).forEach((function(t){rd(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):td(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}();function cd(e,t){fd(e,t),ud(e)}function ud(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function fd(e,t){e.emit("error",t)}var ld=function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Ye(fd,this,e)):Ye(fd,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?Ye(ud,r):(r._writableState.errorEmitted=!0,Ye(cd,r,e)):Ye(cd,r,e):t?(Ye(ud,r),t(e)):Ye(ud,r)})),this)},dd=function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},hd=function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)},pd={};function bd(e,t,r){r||(r=Error);var n=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);n.prototype.name=r.name,n.prototype.code=e,pd[e]=n}function gd(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}bd("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),bd("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,o;if("string"==typeof t&&(i="not ",t.substr(0,4)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-9,r)===t}(e," argument"))o="The ".concat(e," ").concat(n," ").concat(gd(t,"type"));else{var a=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+1>e.length)&&-1!==e.indexOf(".",r)}(e)?"property":"argument";o='The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(gd(t,"type"))}return o+". Received type ".concat(typeof r)}),TypeError),bd("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),bd("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),bd("ERR_STREAM_PREMATURE_CLOSE","Premature close"),bd("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),bd("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),bd("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),bd("ERR_STREAM_WRITE_AFTER_END","write after end"),bd("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),bd("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),bd("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");var yd={codes:pd},md=yd.codes.ERR_INVALID_OPT_VALUE,vd=function(e,t,r,n){var i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new md(n?r:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384};function wd(e){try{if(!M.localStorage)return!1}catch(e){return!1}var t=M.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}var _d,Sd=Fd;function xd(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(undefined),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}Fd.WritableState=Hd;var kd,Ed=function(e,t){if(wd("noDeprecation"))return e;var r=!1;return function(){if(!r){if(wd("throwDeprecation"))throw new Error(t);wd("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}},Id=Ue.Buffer,Od=M.Uint8Array||function(){},Td=vd,Ad=yd.codes,Pd=Ad.ERR_INVALID_ARG_TYPE,Cd=Ad.ERR_METHOD_NOT_IMPLEMENTED,Md=Ad.ERR_MULTIPLE_CALLBACK,Rd=Ad.ERR_STREAM_CANNOT_PIPE,Nd=Ad.ERR_STREAM_DESTROYED,Ld=Ad.ERR_STREAM_NULL_VALUES,jd=Ad.ERR_STREAM_WRITE_AFTER_END,Dd=Ad.ERR_UNKNOWN_ENCODING,Bd=hd;function Ud(){}function Hd(e,t,r){_d=_d||Xd,e=e||{},"boolean"!=typeof r&&(r=t instanceof _d),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=Td(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=!1===e.decodeStrings;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new Md;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(Ye(i,n),Ye(Jd,e,t),e._writableState.errorEmitted=!0,Bd(e,n)):(i(n),e._writableState.errorEmitted=!0,Bd(e,n),Jd(e,t))}(e,r,n,t,i);else{var o=Kd(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||zd(e,r),n?Ye(qd,e,r,o,i):qd(e,r,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new xd(this)}function Fd(e){var t=this instanceof(_d=_d||Xd);if(!t&&!kd.call(Fd,this))return new Fd(e);this._writableState=new Hd(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),ed.call(this)}function Vd(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new Nd("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function qd(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),Jd(e,t)}function zd(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,s=!0;r;)i[a]=r,r.isBuf||(s=!1),r=r.next,a+=1;i.allBuffers=s,Vd(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 xd(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,u=r.encoding,f=r.callback;if(Vd(e,t,!1,t.objectMode?1:c.length,c,u,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function Kd(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function Wd(e,t){e._final((function(r){t.pendingcb--,r&&Bd(e,r),t.prefinished=!0,e.emit("prefinish"),Jd(e,t)}))}function Jd(e,t){var r=Kd(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,Ye(Wd,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}Ql(Fd,ed),Hd.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(Hd.prototype,"buffer",{get:Ed((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(kd=Function.prototype[Symbol.hasInstance],Object.defineProperty(Fd,Symbol.hasInstance,{value:function(e){return!!kd.call(this,e)||this===Fd&&e&&e._writableState instanceof Hd}})):kd=function(e){return e instanceof this},Fd.prototype.pipe=function(){Bd(this,new Rd)},Fd.prototype.write=function(e,t,r){var n,i=this._writableState,o=!1,a=!i.objectMode&&(n=e,Id.isBuffer(n)||n instanceof Od);return a&&!Id.isBuffer(e)&&(e=function(e){return Id.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=Ud),i.ending?function(e,t){var r=new jd;Bd(e,r),Ye(t,r)}(this,r):(a||function(e,t,r,n){var i;return null===r?i=new Ld:"string"==typeof r||t.objectMode||(i=new Pd("chunk",["string","Buffer"],r)),!i||(Bd(e,i),Ye(n,i),!1)}(this,i,e,r))&&(i.pendingcb++,o=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=Id.from(t,r)),t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Vd(e,t,!1,s,n,i,o);return c}(this,i,a,e,t,r)),o},Fd.prototype.cork=function(){this._writableState.corked++},Fd.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||zd(this,e))},Fd.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new Dd(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Fd.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Fd.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Fd.prototype._write=function(e,t,r){r(new Cd("_write()"))},Fd.prototype._writev=null,Fd.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,Jd(e,t),r&&(t.finished?Ye(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(Fd.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Fd.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),Fd.prototype.destroy=ld,Fd.prototype._undestroy=dd,Fd.prototype._destroy=function(e,t){t(e)};var Gd=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},Xd=Zd;Ql(Zd,Lh);for(var $d=Gd(Sd.prototype),Yd=0;Yd<$d.length;Yd++){var Qd=$d[Yd];Zd.prototype[Qd]||(Zd.prototype[Qd]=Sd.prototype[Qd])}function Zd(e){if(!(this instanceof Zd))return new Zd(e);Lh.call(this,e),Sd.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",eh)))}function eh(){this._writableState.ended||Ye(th,this)}function th(e){e.end()}Object.defineProperty(Zd.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(Zd.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Zd.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Zd.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});var rh=Zl.Buffer,nh=rh.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},ih=oh;function oh(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(rh.isEncoding===nh||!nh(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=ch,this.end=uh,t=4;break;case"utf8":this.fillLast=sh,t=4;break;case"base64":this.text=fh,this.end=lh,t=3;break;default:return this.write=dh,void(this.end=hh)}this.lastNeed=0,this.lastTotal=0,this.lastChar=rh.allocUnsafe(t)}function ah(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function sh(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function ch(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function uh(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function fh(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?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-r))}function lh(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function dh(e){return e.toString(this.encoding)}function hh(e){return e&&e.length?this.write(e):""}oh.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},oh.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},oh.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=ah(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=ah(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=ah(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},oh.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};var ph={StringDecoder:ih},bh=yd.codes.ERR_STREAM_PREMATURE_CLOSE;function gh(){}var yh,mh=function e(t,r,n){if("function"==typeof r)return e(t,null,r);r||(r={}),n=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(n||gh);var i=r.readable||!1!==r.readable&&t.readable,o=r.writable||!1!==r.writable&&t.writable,a=function(){t.writable||c()},s=t._writableState&&t._writableState.finished,c=function(){o=!1,s=!0,i||n.call(t)},u=t._readableState&&t._readableState.endEmitted,f=function(){i=!1,u=!0,o||n.call(t)},l=function(e){n.call(t,e)},d=function(){var e;return i&&!u?(t._readableState&&t._readableState.ended||(e=new bh),n.call(t,e)):o&&!s?(t._writableState&&t._writableState.ended||(e=new bh),n.call(t,e)):void 0},h=function(){t.req.on("finish",c)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",c),t.on("abort",d),t.req?h():t.on("request",h)):o&&!t._writableState&&(t.on("end",a),t.on("close",a)),t.on("end",f),t.on("finish",c),!1!==r.error&&t.on("error",l),t.on("close",d),function(){t.removeListener("complete",c),t.removeListener("abort",d),t.removeListener("request",h),t.req&&t.req.removeListener("finish",c),t.removeListener("end",a),t.removeListener("close",a),t.removeListener("finish",c),t.removeListener("end",f),t.removeListener("error",l),t.removeListener("close",d)}};function vh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var wh=Symbol("lastResolve"),_h=Symbol("lastReject"),Sh=Symbol("error"),xh=Symbol("ended"),kh=Symbol("lastPromise"),Eh=Symbol("handlePromise"),Ih=Symbol("stream");function Oh(e,t){return{value:e,done:t}}function Th(e){var t=e[wh];if(null!==t){var r=e[Ih].read();null!==r&&(e[kh]=null,e[wh]=null,e[_h]=null,t(Oh(r,!1)))}}function Ah(e){Ye(Th,e)}var Ph,Ch=Object.getPrototypeOf((function(){})),Mh=Object.setPrototypeOf((vh(yh={get stream(){return this[Ih]},next:function(){var e=this,t=this[Sh];if(null!==t)return Promise.reject(t);if(this[xh])return Promise.resolve(Oh(void 0,!0));if(this[Ih].destroyed)return new Promise((function(t,r){Ye((function(){e[Sh]?r(e[Sh]):t(Oh(void 0,!0))}))}));var r,n=this[kh];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[xh]?r(Oh(void 0,!0)):t[Eh](r,n)}),n)}}(n,this));else{var i=this[Ih].read();if(null!==i)return Promise.resolve(Oh(i,!1));r=new Promise(this[Eh])}return this[kh]=r,r}},Symbol.asyncIterator,(function(){return this})),vh(yh,"return",(function(){var e=this;return new Promise((function(t,r){e[Ih].destroy(null,(function(e){e?r(e):t(Oh(void 0,!0))}))}))})),yh),Ch),Rh=function(e){var t,r=Object.create(Mh,(vh(t={},Ih,{value:e,writable:!0}),vh(t,wh,{value:null,writable:!0}),vh(t,_h,{value:null,writable:!0}),vh(t,Sh,{value:null,writable:!0}),vh(t,xh,{value:e._readableState.endEmitted,writable:!0}),vh(t,Eh,{value:function(e,t){var n=r[Ih].read();n?(r[kh]=null,r[wh]=null,r[_h]=null,e(Oh(n,!1))):(r[wh]=e,r[_h]=t)},writable:!0}),t));return r[kh]=null,mh(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[_h];return null!==t&&(r[kh]=null,r[wh]=null,r[_h]=null,t(e)),void(r[Sh]=e)}var n=r[wh];null!==n&&(r[kh]=null,r[wh]=null,r[_h]=null,n(Oh(void 0,!0))),r[xh]=!0})),e.on("readable",Ah.bind(null,r)),r},Nh=function(){throw new Error("Readable.from is not available in the browser")},Lh=Qh;Qh.ReadableState=Yh;var jh,Dh=function(e,t){return e.listeners(t).length},Bh=Ue.Buffer,Uh=M.Uint8Array||function(){};jh=to&&to.debuglog?to.debuglog("stream"):function(){};var Hh,Fh,Vh,qh=vd,zh=yd.codes,Kh=zh.ERR_INVALID_ARG_TYPE,Wh=zh.ERR_STREAM_PUSH_AFTER_EOF,Jh=zh.ERR_METHOD_NOT_IMPLEMENTED,Gh=zh.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Ql(Qh,ed);var Xh=hd,$h=["error","close","destroy","pause","resume"];function Yh(e,t,r){Ph=Ph||Xd,e=e||{},"boolean"!=typeof r&&(r=t instanceof Ph),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=qh(this,e,"readableHighWaterMark",r),this.buffer=new sd,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(Hh||(Hh=ph.StringDecoder),this.decoder=new Hh(e.encoding),this.encoding=e.encoding)}function Qh(e){if(Ph=Ph||Xd,!(this instanceof Qh))return new Qh(e);var t=this instanceof Ph;this._readableState=new Yh(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),ed.call(this)}function Zh(e,t,r,n,i){jh("readableAddChunk",t);var o,a=e._readableState;if(null===t)a.reading=!1,function(e,t){if(jh("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?rp(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,np(e)))}}(e,a);else if(i||(o=function(e,t){var r,n;return n=t,Bh.isBuffer(n)||n instanceof Uh||"string"==typeof t||void 0===t||e.objectMode||(r=new Kh("chunk",["string","Buffer","Uint8Array"],t)),r}(a,t)),o)Xh(e,o);else if(a.objectMode||t&&t.length>0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===Bh.prototype||(t=function(e){return Bh.from(e)}(t)),n)a.endEmitted?Xh(e,new Gh):ep(e,a,t,!0);else if(a.ended)Xh(e,new Wh);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?ep(e,a,t,!1):ip(e,a)):ep(e,a,t,!1)}else n||(a.reading=!1,ip(e,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function ep(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&rp(e)),ip(e,t)}function tp(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=1073741824?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function rp(e){var t=e._readableState;jh("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(jh("emitReadable",t.flowing),t.emittedReadable=!0,Ye(np,e))}function np(e){var t=e._readableState;jh("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,up(e)}function ip(e,t){t.readingMore||(t.readingMore=!0,Ye(op,e,t))}function op(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(jh("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function ap(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function sp(e){jh("readable nexttick read 0"),e.read(0)}function cp(e,t){jh("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),up(e),t.flowing&&!t.reading&&e.read(0)}function up(e){var t=e._readableState;for(jh("flow",t.flowing);t.flowing&&null!==e.read(););}function fp(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function lp(e){var t=e._readableState;jh("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,Ye(dp,t,e))}function dp(e,t){if(jh("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function hp(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}Object.defineProperty(Qh.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),Qh.prototype.destroy=ld,Qh.prototype._undestroy=dd,Qh.prototype._destroy=function(e,t){t(e)},Qh.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=Bh.from(e,t),t=""),r=!0),Zh(this,e,t,!1,r)},Qh.prototype.unshift=function(e){return Zh(this,e,null,!0,!1)},Qh.prototype.isPaused=function(){return!1===this._readableState.flowing},Qh.prototype.setEncoding=function(e){Hh||(Hh=ph.StringDecoder);var t=new Hh(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";null!==r;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this},Qh.prototype.read=function(e){jh("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return jh("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?lp(this):rp(this),null;if(0===(e=tp(e,t))&&t.ended)return 0===t.length&&lp(this),null;var n,i=t.needReadable;return jh("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&jh("length less than watermark",i=!0),t.ended||t.reading?jh("reading or ended",i=!1):i&&(jh("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=tp(r,t))),null===(n=e>0?fp(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&lp(this)),null!==n&&this.emit("data",n),n},Qh.prototype._read=function(e){Xh(this,new Jh("_read()"))},Qh.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,jh("pipe count=%d opts=%j",n.pipesCount,t);var i=t&&!1===t.end||e===ft.stdout||e===ft.stderr?d:o;function o(){jh("onend"),e.end()}n.endEmitted?Ye(i):r.once("end",i),e.on("unpipe",(function t(i,h){jh("onunpipe"),i===r&&h&&!1===h.hasUnpiped&&(h.hasUnpiped=!0,jh("cleanup"),e.removeListener("close",f),e.removeListener("finish",l),e.removeListener("drain",a),e.removeListener("error",u),e.removeListener("unpipe",t),r.removeListener("end",o),r.removeListener("end",d),r.removeListener("data",c),s=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||a())}));var a=function(e){return function(){var t=e._readableState;jh("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&Dh(e,"data")&&(t.flowing=!0,up(e))}}(r);e.on("drain",a);var s=!1;function c(t){jh("ondata");var i=e.write(t);jh("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==hp(n.pipes,e))&&!s&&(jh("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function u(t){jh("onerror",t),d(),e.removeListener("error",u),0===Dh(e,"error")&&Xh(e,t)}function f(){e.removeListener("finish",l),d()}function l(){jh("onfinish"),e.removeListener("close",f),d()}function d(){jh("unpipe"),r.unpipe(e)}return r.on("data",c),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",u),e.once("close",f),e.once("finish",l),e.emit("pipe",r),n.flowing||(jh("pipe resume"),r.resume()),e},Qh.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=hp(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},Qh.prototype.on=function(e,t){var r=ed.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,jh("on readable",n.length,n.reading),n.length?rp(this):n.reading||Ye(sp,this))),r},Qh.prototype.addListener=Qh.prototype.on,Qh.prototype.removeListener=function(e,t){var r=ed.prototype.removeListener.call(this,e,t);return"readable"===e&&Ye(ap,this),r},Qh.prototype.removeAllListeners=function(e){var t=ed.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||Ye(ap,this),t},Qh.prototype.resume=function(){var e=this._readableState;return e.flowing||(jh("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Ye(cp,e,t))}(this,e)),e.paused=!1,this},Qh.prototype.pause=function(){return jh("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(jh("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Qh.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(jh("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){jh("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<$h.length;o++)e.on($h[o],this.emit.bind(this,$h[o]));return this._read=function(t){jh("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(Qh.prototype[Symbol.asyncIterator]=function(){return void 0===Fh&&(Fh=Rh),Fh(this)}),Object.defineProperty(Qh.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(Qh.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Qh.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),Qh._fromList=fp,Object.defineProperty(Qh.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(Qh.from=function(e,t){return void 0===Vh&&(Vh=Nh),Vh(Qh,e,t)});var pp=_p,bp=yd.codes,gp=bp.ERR_METHOD_NOT_IMPLEMENTED,yp=bp.ERR_MULTIPLE_CALLBACK,mp=bp.ERR_TRANSFORM_ALREADY_TRANSFORMING,vp=bp.ERR_TRANSFORM_WITH_LENGTH_0;function wp(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new yp);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function _p(e){if(!(this instanceof _p))return new _p(e);Xd.call(this,e),this._transformState={afterTransform:wp.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",Sp)}function Sp(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?xp(this,null,null):this._flush((function(t,r){xp(e,t,r)}))}function xp(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new vp;if(e._transformState.transforming)throw new mp;return e.push(null)}Ql(_p,Xd),_p.prototype.push=function(e,t){return this._transformState.needTransform=!1,Xd.prototype.push.call(this,e,t)},_p.prototype._transform=function(e,t,r){r(new gp("_transform()"))},_p.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},_p.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},_p.prototype._destroy=function(e,t){Xd.prototype._destroy.call(this,e,(function(e){t(e)}))};var kp,Ep=Ip;function Ip(e){if(!(this instanceof Ip))return new Ip(e);pp.call(this,e)}Ql(Ip,pp),Ip.prototype._transform=function(e,t,r){r(null,e)};var Op=yd.codes,Tp=Op.ERR_MISSING_ARGS,Ap=Op.ERR_STREAM_DESTROYED;function Pp(e){if(e)throw e}function Cp(e){e()}function Mp(e,t){return e.pipe(t)}var Rp=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=function(e){return e.length?"function"!=typeof e[e.length-1]?Pp:e.pop():Pp}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Tp("streams");var o=t.map((function(e,r){var a=r<t.length-1;return function(e,t,r,n){n=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(n);var i=!1;e.on("close",(function(){i=!0})),void 0===kp&&(kp=mh),kp(e,{readable:t,writable:r},(function(e){if(e)return n(e);i=!0,n()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void n(t||new Ap("pipe"))}}(e,a,r>0,(function(e){n||(n=e),e&&o.forEach(Cp),a||(o.forEach(Cp),i(n))}))}));return t.reduce(Mp)},Np=N((function(e,t){(t=e.exports=Lh).Stream=t,t.Readable=t,t.Writable=Sd,t.Duplex=Xd,t.Transform=pp,t.PassThrough=Ep,t.finished=mh,t.pipeline=Rp}));Np.Stream,Np.Readable,Np.Writable,Np.Duplex,Np.Transform,Np.PassThrough,Np.finished,Np.pipeline;var Lp=Zl.Buffer,jp=Np.Transform;function Dp(e){jp.call(this),this._block=Lp.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}Ql(Dp,jp),Dp.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},Dp.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},Dp.prototype.update=function(e,t){if(function(e,t){if(!Lp.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");Lp.isBuffer(e)||(e=Lp.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)r[i++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var o=0,a=8*e.length;a>0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},Dp.prototype._update=function(){throw new Error("_update is not implemented")},Dp.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},Dp.prototype._digest=function(){throw new Error("_digest is not implemented")};var Bp=Dp,Up=Zl.Buffer,Hp=new Array(16);function Fp(){Bp.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function Vp(e,t){return e<<t|e>>>32-t}function qp(e,t,r,n,i,o,a){return Vp(e+(t&r|~t&n)+i+o|0,a)+t|0}function zp(e,t,r,n,i,o,a){return Vp(e+(t&n|r&~n)+i+o|0,a)+t|0}function Kp(e,t,r,n,i,o,a){return Vp(e+(t^r^n)+i+o|0,a)+t|0}function Wp(e,t,r,n,i,o,a){return Vp(e+(r^(t|~n))+i+o|0,a)+t|0}Ql(Fp,Bp),Fp.prototype._update=function(){for(var e=Hp,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;r=qp(r,n,i,o,e[0],3614090360,7),o=qp(o,r,n,i,e[1],3905402710,12),i=qp(i,o,r,n,e[2],606105819,17),n=qp(n,i,o,r,e[3],3250441966,22),r=qp(r,n,i,o,e[4],4118548399,7),o=qp(o,r,n,i,e[5],1200080426,12),i=qp(i,o,r,n,e[6],2821735955,17),n=qp(n,i,o,r,e[7],4249261313,22),r=qp(r,n,i,o,e[8],1770035416,7),o=qp(o,r,n,i,e[9],2336552879,12),i=qp(i,o,r,n,e[10],4294925233,17),n=qp(n,i,o,r,e[11],2304563134,22),r=qp(r,n,i,o,e[12],1804603682,7),o=qp(o,r,n,i,e[13],4254626195,12),i=qp(i,o,r,n,e[14],2792965006,17),r=zp(r,n=qp(n,i,o,r,e[15],1236535329,22),i,o,e[1],4129170786,5),o=zp(o,r,n,i,e[6],3225465664,9),i=zp(i,o,r,n,e[11],643717713,14),n=zp(n,i,o,r,e[0],3921069994,20),r=zp(r,n,i,o,e[5],3593408605,5),o=zp(o,r,n,i,e[10],38016083,9),i=zp(i,o,r,n,e[15],3634488961,14),n=zp(n,i,o,r,e[4],3889429448,20),r=zp(r,n,i,o,e[9],568446438,5),o=zp(o,r,n,i,e[14],3275163606,9),i=zp(i,o,r,n,e[3],4107603335,14),n=zp(n,i,o,r,e[8],1163531501,20),r=zp(r,n,i,o,e[13],2850285829,5),o=zp(o,r,n,i,e[2],4243563512,9),i=zp(i,o,r,n,e[7],1735328473,14),r=Kp(r,n=zp(n,i,o,r,e[12],2368359562,20),i,o,e[5],4294588738,4),o=Kp(o,r,n,i,e[8],2272392833,11),i=Kp(i,o,r,n,e[11],1839030562,16),n=Kp(n,i,o,r,e[14],4259657740,23),r=Kp(r,n,i,o,e[1],2763975236,4),o=Kp(o,r,n,i,e[4],1272893353,11),i=Kp(i,o,r,n,e[7],4139469664,16),n=Kp(n,i,o,r,e[10],3200236656,23),r=Kp(r,n,i,o,e[13],681279174,4),o=Kp(o,r,n,i,e[0],3936430074,11),i=Kp(i,o,r,n,e[3],3572445317,16),n=Kp(n,i,o,r,e[6],76029189,23),r=Kp(r,n,i,o,e[9],3654602809,4),o=Kp(o,r,n,i,e[12],3873151461,11),i=Kp(i,o,r,n,e[15],530742520,16),r=Wp(r,n=Kp(n,i,o,r,e[2],3299628645,23),i,o,e[0],4096336452,6),o=Wp(o,r,n,i,e[7],1126891415,10),i=Wp(i,o,r,n,e[14],2878612391,15),n=Wp(n,i,o,r,e[5],4237533241,21),r=Wp(r,n,i,o,e[12],1700485571,6),o=Wp(o,r,n,i,e[3],2399980690,10),i=Wp(i,o,r,n,e[10],4293915773,15),n=Wp(n,i,o,r,e[1],2240044497,21),r=Wp(r,n,i,o,e[8],1873313359,6),o=Wp(o,r,n,i,e[15],4264355552,10),i=Wp(i,o,r,n,e[6],2734768916,15),n=Wp(n,i,o,r,e[13],1309151649,21),r=Wp(r,n,i,o,e[4],4149444226,6),o=Wp(o,r,n,i,e[11],3174756917,10),i=Wp(i,o,r,n,e[2],718787259,15),n=Wp(n,i,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},Fp.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=Up.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var Jp=Fp,Gp=Ue.Buffer,Xp=new Array(16),$p=[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],Yp=[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],Qp=[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],Zp=[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],eb=[0,1518500249,1859775393,2400959708,2840853838],tb=[1352829926,1548603684,1836072691,2053994217,0];function rb(){Bp.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function nb(e,t){return e<<t|e>>>32-t}function ib(e,t,r,n,i,o,a,s){return nb(e+(t^r^n)+o+a|0,s)+i|0}function ob(e,t,r,n,i,o,a,s){return nb(e+(t&r|~t&n)+o+a|0,s)+i|0}function ab(e,t,r,n,i,o,a,s){return nb(e+((t|~r)^n)+o+a|0,s)+i|0}function sb(e,t,r,n,i,o,a,s){return nb(e+(t&n|r&~n)+o+a|0,s)+i|0}function cb(e,t,r,n,i,o,a,s){return nb(e+(t^(r|~n))+o+a|0,s)+i|0}Ql(rb,Bp),rb.prototype._update=function(){for(var e=Xp,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,c=0|this._b,u=0|this._c,f=0|this._d,l=0|this._e,d=0;d<80;d+=1){var h,p;d<16?(h=ib(r,n,i,o,a,e[$p[d]],eb[0],Qp[d]),p=cb(s,c,u,f,l,e[Yp[d]],tb[0],Zp[d])):d<32?(h=ob(r,n,i,o,a,e[$p[d]],eb[1],Qp[d]),p=sb(s,c,u,f,l,e[Yp[d]],tb[1],Zp[d])):d<48?(h=ab(r,n,i,o,a,e[$p[d]],eb[2],Qp[d]),p=ab(s,c,u,f,l,e[Yp[d]],tb[2],Zp[d])):d<64?(h=sb(r,n,i,o,a,e[$p[d]],eb[3],Qp[d]),p=ob(s,c,u,f,l,e[Yp[d]],tb[3],Zp[d])):(h=cb(r,n,i,o,a,e[$p[d]],eb[4],Qp[d]),p=ib(s,c,u,f,l,e[Yp[d]],tb[4],Zp[d])),r=a,a=o,o=nb(i,10),i=n,n=h,s=l,l=f,f=nb(u,10),u=c,c=p}var b=this._b+i+f|0;this._b=this._c+o+l|0,this._c=this._d+a+s|0,this._d=this._e+r+c|0,this._e=this._a+n+u|0,this._a=b},rb.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=Gp.alloc?Gp.alloc(20):new Gp(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};var ub=rb,fb=Zl.Buffer;function lb(e,t){this._block=fb.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}lb.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=fb.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,o=this._len,a=0;a<i;){for(var s=o%n,c=Math.min(i-a,n-s),u=0;u<c;u++)r[s+u]=e[a+u];a+=c,(o+=c)%n==0&&this._update(r)}return this._len+=i,this},lb.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},lb.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var db=lb,hb=Zl.Buffer,pb=[1518500249,1859775393,-1894007588,-899497514],bb=new Array(80);function gb(){this.init(),this._w=bb,db.call(this,64,56)}function yb(e){return e<<30|e>>>2}function mb(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}Ql(gb,db),gb.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},gb.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,c=0;c<16;++c)r[c]=e.readInt32BE(4*c);for(;c<80;++c)r[c]=r[c-3]^r[c-8]^r[c-14]^r[c-16];for(var u=0;u<80;++u){var f=~~(u/20),l=0|((t=n)<<5|t>>>27)+mb(f,i,o,a)+s+r[u]+pb[f];s=a,a=o,o=yb(i),i=n,n=l}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},gb.prototype._hash=function(){var e=hb.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var vb=gb,wb=Zl.Buffer,_b=[1518500249,1859775393,-1894007588,-899497514],Sb=new Array(80);function xb(){this.init(),this._w=Sb,db.call(this,64,56)}function kb(e){return e<<5|e>>>27}function Eb(e){return e<<30|e>>>2}function Ib(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}Ql(xb,db),xb.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},xb.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,c=0;c<16;++c)r[c]=e.readInt32BE(4*c);for(;c<80;++c)r[c]=(t=r[c-3]^r[c-8]^r[c-14]^r[c-16])<<1|t>>>31;for(var u=0;u<80;++u){var f=~~(u/20),l=kb(n)+Ib(f,i,o,a)+s+r[u]+_b[f]|0;s=a,a=o,o=Eb(i),i=n,n=l}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},xb.prototype._hash=function(){var e=wb.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Ob=xb,Tb=Zl.Buffer,Ab=[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],Pb=new Array(64);function Cb(){this.init(),this._w=Pb,db.call(this,64,56)}function Mb(e,t,r){return r^e&(t^r)}function Rb(e,t,r){return e&t|r&(e|t)}function Nb(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Lb(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function jb(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function Db(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Ql(Cb,db),Cb.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},Cb.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._f,c=0|this._g,u=0|this._h,f=0;f<16;++f)t[f]=e.readInt32BE(4*f);for(;f<64;++f)t[f]=Db(t[f-2])+t[f-7]+jb(t[f-15])+t[f-16]|0;for(var l=0;l<64;++l){var d=u+Lb(a)+Mb(a,s,c)+Ab[l]+t[l]|0,h=Nb(r)+Rb(r,n,i)|0;u=c,c=s,s=a,a=o+d|0,o=i,i=n,n=r,r=d+h|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=s+this._f|0,this._g=c+this._g|0,this._h=u+this._h|0},Cb.prototype._hash=function(){var e=Tb.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};var Bb=Cb,Ub=Zl.Buffer,Hb=new Array(64);function Fb(){this.init(),this._w=Hb,db.call(this,64,56)}Ql(Fb,Bb),Fb.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},Fb.prototype._hash=function(){var e=Ub.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};var Vb=Fb,qb=Zl.Buffer,zb=[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],Kb=new Array(160);function Wb(){this.init(),this._w=Kb,db.call(this,128,112)}function Jb(e,t,r){return r^e&(t^r)}function Gb(e,t,r){return e&t|r&(e|t)}function Xb(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function $b(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Yb(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Qb(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Zb(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function eg(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function tg(e,t){return e>>>0<t>>>0?1:0}Ql(Wb,db),Wb.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},Wb.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,c=0|this._gh,u=0|this._hh,f=0|this._al,l=0|this._bl,d=0|this._cl,h=0|this._dl,p=0|this._el,b=0|this._fl,g=0|this._gl,y=0|this._hl,m=0;m<32;m+=2)t[m]=e.readInt32BE(4*m),t[m+1]=e.readInt32BE(4*m+4);for(;m<160;m+=2){var v=t[m-30],w=t[m-30+1],_=Yb(v,w),S=Qb(w,v),x=Zb(v=t[m-4],w=t[m-4+1]),k=eg(w,v),E=t[m-14],I=t[m-14+1],O=t[m-32],T=t[m-32+1],A=S+I|0,P=_+E+tg(A,S)|0;P=(P=P+x+tg(A=A+k|0,k)|0)+O+tg(A=A+T|0,T)|0,t[m]=P,t[m+1]=A}for(var C=0;C<160;C+=2){P=t[C],A=t[C+1];var M=Gb(r,n,i),R=Gb(f,l,d),N=Xb(r,f),L=Xb(f,r),j=$b(a,p),D=$b(p,a),B=zb[C],U=zb[C+1],H=Jb(a,s,c),F=Jb(p,b,g),V=y+D|0,q=u+j+tg(V,y)|0;q=(q=(q=q+H+tg(V=V+F|0,F)|0)+B+tg(V=V+U|0,U)|0)+P+tg(V=V+A|0,A)|0;var z=L+R|0,K=N+M+tg(z,L)|0;u=c,y=g,c=s,g=b,s=a,b=p,a=o+q+tg(p=h+V|0,h)|0,o=i,h=d,i=n,d=l,n=r,l=f,r=q+K+tg(f=V+z|0,V)|0}this._al=this._al+f|0,this._bl=this._bl+l|0,this._cl=this._cl+d|0,this._dl=this._dl+h|0,this._el=this._el+p|0,this._fl=this._fl+b|0,this._gl=this._gl+g|0,this._hl=this._hl+y|0,this._ah=this._ah+r+tg(this._al,f)|0,this._bh=this._bh+n+tg(this._bl,l)|0,this._ch=this._ch+i+tg(this._cl,d)|0,this._dh=this._dh+o+tg(this._dl,h)|0,this._eh=this._eh+a+tg(this._el,p)|0,this._fh=this._fh+s+tg(this._fl,b)|0,this._gh=this._gh+c+tg(this._gl,g)|0,this._hh=this._hh+u+tg(this._hl,y)|0},Wb.prototype._hash=function(){var e=qb.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+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};var rg=Wb,ng=Zl.Buffer,ig=new Array(160);function og(){this.init(),this._w=ig,db.call(this,128,112)}Ql(og,rg),og.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},og.prototype._hash=function(){var e=ng.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+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};var ag=og,sg=N((function(e){var t=e.exports=function(e){e=e.toLowerCase();var r=t[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r};t.sha=vb,t.sha1=Ob,t.sha224=Vb,t.sha256=Bb,t.sha384=ag,t.sha512=rg})),cg=Zl.Buffer,ug=xn.Transform,fg=Ur.StringDecoder;function lg(e){ug.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}Ql(lg,ug),lg.prototype.update=function(e,t,r){"string"==typeof e&&(e=cg.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},lg.prototype.setAutoPadding=function(){},lg.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},lg.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},lg.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},lg.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},lg.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},lg.prototype._finalOrDigest=function(e){var t=this.__final()||cg.alloc(0);return e&&(t=this._toString(t,e,!0)),t},lg.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new fg(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n};var dg=lg;function hg(e){dg.call(this,"digest"),this._hash=e}Ql(hg,dg),hg.prototype._update=function(e){this._hash.update(e)},hg.prototype._final=function(){return this._hash.digest()};var pg=function(e){return"md5"===(e=e.toLowerCase())?new Jp:"rmd160"===e||"ripemd160"===e?new ub:new hg(sg(e))},bg=Zl.Buffer,gg=bg.alloc(128);function yg(e,t){dg.call(this,"digest"),"string"==typeof t&&(t=bg.from(t)),this._alg=e,this._key=t,t.length>64?t=e(t):t.length<64&&(t=bg.concat([t,gg],64));for(var r=this._ipad=bg.allocUnsafe(64),n=this._opad=bg.allocUnsafe(64),i=0;i<64;i++)r[i]=54^t[i],n[i]=92^t[i];this._hash=[r]}Ql(yg,dg),yg.prototype._update=function(e){this._hash.push(e)},yg.prototype._final=function(){var e=this._alg(bg.concat(this._hash));return this._alg(bg.concat([this._opad,e]))};var mg=yg,vg=function(e){return(new Jp).update(e).digest()},wg=Zl.Buffer,_g=wg.alloc(128);function Sg(e,t){dg.call(this,"digest"),"string"==typeof t&&(t=wg.from(t));var r="sha512"===e||"sha384"===e?128:64;this._alg=e,this._key=t,t.length>r?t=("rmd160"===e?new ub:sg(e)).update(t).digest():t.length<r&&(t=wg.concat([t,_g],r));for(var n=this._ipad=wg.allocUnsafe(r),i=this._opad=wg.allocUnsafe(r),o=0;o<r;o++)n[o]=54^t[o],i[o]=92^t[o];this._hash="rmd160"===e?new ub:sg(e),this._hash.update(n)}Ql(Sg,dg),Sg.prototype._update=function(e){this._hash.update(e)},Sg.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new ub:sg(this._alg)).update(this._opad).update(e).digest()};var xg=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new Sg("rmd160",t):"md5"===e?new mg(vg,t):new Sg(e,t)},kg=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.hash160=function(e){const t=pg("sha256").update(e).digest();try{return pg("rmd160").update(t).digest()}catch(e){return pg("ripemd160").update(t).digest()}},t.hmacSHA512=function(e,t){return xg("sha512",e).update(t).digest()}}));R(kg),kg.hash160,kg.hmacSHA512;var Eg=Zl.Buffer,Ig=function(e){for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<58;n++){var i=e.charAt(n),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=n}var a=58,s=e.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return Eg.alloc(0);var r=0;if(" "!==e[r]){for(var n=0,i=0;e[r]===s;)n++,r++;for(var o=(e.length-r)*c+1>>>0,u=new Uint8Array(o);e[r];){var f=t[e.charCodeAt(r)];if(255===f)return;for(var l=0,d=o-1;(0!==f||l<i)&&-1!==d;d--,l++)f+=a*u[d]>>>0,u[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=l,r++}if(" "!==e[r]){for(var h=o-i;h!==o&&0===u[h];)h++;var p=Eg.allocUnsafe(n+(o-h));p.fill(0,0,n);for(var b=n;h!==o;)p[b++]=u[h++];return p}}}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=Eg.from(t)),!Eg.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var c=(o-i)*u+1>>>0,f=new Uint8Array(c);i!==o;){for(var l=t[i],d=0,h=c-1;(0!==l||d<n)&&-1!==h;h--,d++)l+=256*f[h]>>>0,f[h]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");n=d,i++}for(var p=c-n;p!==c&&0===f[p];)p++;for(var b=s.repeat(r);p<c;++p)b+=e.charAt(f[p]);return b},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw new Error("Non-base58 character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),Og=Zl.Buffer,Tg=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=e(t);return Ig.encode(Og.concat([t,r],t.length+4))},decode:function(e){var r=t(Ig.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=Ig.decodeUnsafe(e);if(r)return t(r)}}}((function(e){var t=pg("sha256").update(e).digest();return pg("sha256").update(t).digest()})),Ag=N((function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:to.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof 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,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=s(e,t,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=s(e,t,n)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,f=r;f<s;f+=n)u=c(e,f,f+n,t),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var l=1;for(u=c(e,f,e.length,t),f=0;f<a;f++)l*=t;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},i.prototype.copy=function(e){e.words=new 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&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],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],l=[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];function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u<n;u++){for(var f=c>>>26,l=67108863&c,d=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=d;h++){var p=u-h|0;f+=(a=(i=0|e.words[p])*(o=0|t.words[h])+l)/67108864|0,l=67108863&a}r.words[u]=0|l,c=0|f}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],c=(16777215&(s<<i|o)).toString(16);n=0!=(o=s>>>24-i&16777215)||a!==this.length-1?u[6-c.length]+c+n:c+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var d=f[e],h=l[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?b+n:u[d-b.length]+b+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return r(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,c="le"===t,u=new e(o),f=this.clone();if(c){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),u[s]=a;for(;s<o;s++)u[s]=0}else{for(s=0;s<o-i;s++)u[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),u[o-s-1]=a}return u},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},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 r(0==(this.negative|e.negative)),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){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),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,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),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){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},i.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o<n.length;o++)t=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<r.length;o++)t=(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(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(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a<n.length;a++)o=(t=(0|r.words[a])-(0|n.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<r.length;a++)o=(t=(0|r.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,r){var n,i,o,a=e.words,s=t.words,c=r.words,u=0,f=0|a[0],l=8191&f,d=f>>>13,h=0|a[1],p=8191&h,b=h>>>13,g=0|a[2],y=8191&g,m=g>>>13,v=0|a[3],w=8191&v,_=v>>>13,S=0|a[4],x=8191&S,k=S>>>13,E=0|a[5],I=8191&E,O=E>>>13,T=0|a[6],A=8191&T,P=T>>>13,C=0|a[7],M=8191&C,R=C>>>13,N=0|a[8],L=8191&N,j=N>>>13,D=0|a[9],B=8191&D,U=D>>>13,H=0|s[0],F=8191&H,V=H>>>13,q=0|s[1],z=8191&q,K=q>>>13,W=0|s[2],J=8191&W,G=W>>>13,X=0|s[3],$=8191&X,Y=X>>>13,Q=0|s[4],Z=8191&Q,ee=Q>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,fe=0|s[8],le=8191&fe,de=fe>>>13,he=0|s[9],pe=8191&he,be=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(u+(n=Math.imul(l,F))|0)+((8191&(i=(i=Math.imul(l,V))+Math.imul(d,F)|0))<<13)|0;u=((o=Math.imul(d,V))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,V))+Math.imul(b,F)|0,o=Math.imul(b,V);var ye=(u+(n=n+Math.imul(l,z)|0)|0)+((8191&(i=(i=i+Math.imul(l,K)|0)+Math.imul(d,z)|0))<<13)|0;u=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,F),i=(i=Math.imul(y,V))+Math.imul(m,F)|0,o=Math.imul(m,V),n=n+Math.imul(p,z)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(b,z)|0,o=o+Math.imul(b,K)|0;var me=(u+(n=n+Math.imul(l,J)|0)|0)+((8191&(i=(i=i+Math.imul(l,G)|0)+Math.imul(d,J)|0))<<13)|0;u=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,V))+Math.imul(_,F)|0,o=Math.imul(_,V),n=n+Math.imul(y,z)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(m,z)|0,o=o+Math.imul(m,K)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(b,J)|0,o=o+Math.imul(b,G)|0;var ve=(u+(n=n+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,Y)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(x,F),i=(i=Math.imul(x,V))+Math.imul(k,F)|0,o=Math.imul(k,V),n=n+Math.imul(w,z)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,z)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(y,J)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,G)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,Y)|0;var we=(u+(n=n+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(I,F),i=(i=Math.imul(I,V))+Math.imul(O,F)|0,o=Math.imul(O,V),n=n+Math.imul(x,z)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(k,z)|0,o=o+Math.imul(k,K)|0,n=n+Math.imul(w,J)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,ee)|0;var _e=(u+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(d,re)|0))<<13)|0;u=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(A,F),i=(i=Math.imul(A,V))+Math.imul(P,F)|0,o=Math.imul(P,V),n=n+Math.imul(I,z)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(O,z)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,G)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var Se=(u+(n=n+Math.imul(l,oe)|0)|0)+((8191&(i=(i=i+Math.imul(l,ae)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(M,F),i=(i=Math.imul(M,V))+Math.imul(R,F)|0,o=Math.imul(R,V),n=n+Math.imul(A,z)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(P,z)|0,o=o+Math.imul(P,K)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,Y)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,ae)|0;var xe=(u+(n=n+Math.imul(l,ce)|0)|0)+((8191&(i=(i=i+Math.imul(l,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(L,F),i=(i=Math.imul(L,V))+Math.imul(j,F)|0,o=Math.imul(j,V),n=n+Math.imul(M,z)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(R,z)|0,o=o+Math.imul(R,K)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(b,ce)|0,o=o+Math.imul(b,ue)|0;var ke=(u+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,de)|0)+Math.imul(d,le)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(U,F)|0,o=Math.imul(U,V),n=n+Math.imul(L,z)|0,i=(i=i+Math.imul(L,K)|0)+Math.imul(j,z)|0,o=o+Math.imul(j,K)|0,n=n+Math.imul(M,J)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(R,J)|0,o=o+Math.imul(R,G)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(k,re)|0,o=o+Math.imul(k,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(y,ce)|0,i=(i=i+Math.imul(y,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0,n=n+Math.imul(p,le)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(b,le)|0,o=o+Math.imul(b,de)|0;var Ee=(u+(n=n+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,be)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(B,z),i=(i=Math.imul(B,K))+Math.imul(U,z)|0,o=Math.imul(U,K),n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,G)|0)+Math.imul(j,J)|0,o=o+Math.imul(j,G)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(R,$)|0,o=o+Math.imul(R,Y)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,ae)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,ue)|0,n=n+Math.imul(y,le)|0,i=(i=i+Math.imul(y,de)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,de)|0;var Ie=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;u=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(B,J),i=(i=Math.imul(B,G))+Math.imul(U,J)|0,o=Math.imul(U,G),n=n+Math.imul(L,$)|0,i=(i=i+Math.imul(L,Y)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,Y)|0,n=n+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,ee)|0,n=n+Math.imul(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(P,re)|0,o=o+Math.imul(P,ne)|0,n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(k,ce)|0,o=o+Math.imul(k,ue)|0,n=n+Math.imul(w,le)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(_,le)|0,o=o+Math.imul(_,de)|0;var Oe=(u+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,be)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,be)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(B,$),i=(i=Math.imul(B,Y))+Math.imul(U,$)|0,o=Math.imul(U,Y),n=n+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(j,Z)|0,o=o+Math.imul(j,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(R,re)|0,o=o+Math.imul(R,ne)|0,n=n+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,n=n+Math.imul(x,le)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(k,le)|0,o=o+Math.imul(k,de)|0;var Te=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,be)|0)+Math.imul(_,pe)|0))<<13)|0;u=((o=o+Math.imul(_,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(B,Z),i=(i=Math.imul(B,ee))+Math.imul(U,Z)|0,o=Math.imul(U,ee),n=n+Math.imul(L,re)|0,i=(i=i+Math.imul(L,ne)|0)+Math.imul(j,re)|0,o=o+Math.imul(j,ne)|0,n=n+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,ae)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,ae)|0,n=n+Math.imul(A,ce)|0,i=(i=i+Math.imul(A,ue)|0)+Math.imul(P,ce)|0,o=o+Math.imul(P,ue)|0,n=n+Math.imul(I,le)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(O,le)|0,o=o+Math.imul(O,de)|0;var Ae=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,be)|0)+Math.imul(k,pe)|0))<<13)|0;u=((o=o+Math.imul(k,be)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(B,re),i=(i=Math.imul(B,ne))+Math.imul(U,re)|0,o=Math.imul(U,ne),n=n+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,ae)|0)+Math.imul(j,oe)|0,o=o+Math.imul(j,ae)|0,n=n+Math.imul(M,ce)|0,i=(i=i+Math.imul(M,ue)|0)+Math.imul(R,ce)|0,o=o+Math.imul(R,ue)|0,n=n+Math.imul(A,le)|0,i=(i=i+Math.imul(A,de)|0)+Math.imul(P,le)|0,o=o+Math.imul(P,de)|0;var Pe=(u+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,be)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(B,oe),i=(i=Math.imul(B,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),n=n+Math.imul(L,ce)|0,i=(i=i+Math.imul(L,ue)|0)+Math.imul(j,ce)|0,o=o+Math.imul(j,ue)|0,n=n+Math.imul(M,le)|0,i=(i=i+Math.imul(M,de)|0)+Math.imul(R,le)|0,o=o+Math.imul(R,de)|0;var Ce=(u+(n=n+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,be)|0)+Math.imul(P,pe)|0))<<13)|0;u=((o=o+Math.imul(P,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(B,ce),i=(i=Math.imul(B,ue))+Math.imul(U,ce)|0,o=Math.imul(U,ue),n=n+Math.imul(L,le)|0,i=(i=i+Math.imul(L,de)|0)+Math.imul(j,le)|0,o=o+Math.imul(j,de)|0;var Me=(u+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,be)|0)+Math.imul(R,pe)|0))<<13)|0;u=((o=o+Math.imul(R,be)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(B,le),i=(i=Math.imul(B,de))+Math.imul(U,le)|0,o=Math.imul(U,de);var Re=(u+(n=n+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,be)|0)+Math.imul(j,pe)|0))<<13)|0;u=((o=o+Math.imul(j,be)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863;var Ne=(u+(n=Math.imul(B,pe))|0)+((8191&(i=(i=Math.imul(B,be))+Math.imul(U,pe)|0))<<13)|0;return u=((o=Math.imul(U,be))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=ge,c[1]=ye,c[2]=me,c[3]=ve,c[4]=we,c[5]=_e,c[6]=Se,c[7]=xe,c[8]=ke,c[9]=Ee,c[10]=Ie,c[11]=Oe,c[12]=Te,c[13]=Ae,c[14]=Pe,c[15]=Ce,c[16]=Me,c[17]=Re,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function p(e,t,r){return(new b).mulp(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(h=d),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?h(this,e,t):r<63?d(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var a=i;i=0;for(var s=67108863&n,c=Math.min(o,t.length-1),u=Math.max(0,o-e.length+1);u<=c;u++){var f=o-u,l=(0|e.words[f])*(0|t.words[u]),d=67108863&l;s=67108863&(d=d+s|0),i+=(a=(a=a+(l/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):p(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=i.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},b.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},b.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a<o;a++)n[a]=t[e[a]],i[a]=r[e[a]]},b.prototype.transform=function(e,t,r,n,i,o){this.permute(o,e,t,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,c=Math.cos(2*Math.PI/s),u=Math.sin(2*Math.PI/s),f=0;f<i;f+=s)for(var l=c,d=u,h=0;h<a;h++){var p=r[f+h],b=n[f+h],g=r[f+h+a],y=n[f+h+a],m=l*g-d*y;y=l*y+d*g,g=m,r[f+h]=p+g,n[f+h]=b+y,r[f+h+a]=p-g,n[f+h+a]=b-y,h!==s&&(m=c*l-u*d,d=c*d+u*l,l=m)}},b.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},b.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},b.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},b.prototype.convert13b=function(e,t,n,i){for(var o=0,a=0;a<t;a++)o+=0|e[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},b.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},b.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),c=new Array(n),u=new Array(n),f=new Array(n),l=new Array(n),d=r.words;d.length=n,this.convert13b(e.words,e.length,a,n),this.convert13b(t.words,t.length,u,n),this.transform(a,o,s,c,n,i),this.transform(u,o,f,l,n,i);for(var h=0;h<n;h++){var p=s[h]*f[h]-c[h]*l[h];c[h]=s[h]*l[h]+c[h]*f[h],s[h]=p}return this.conjugate(s,c,n),this.transform(s,c,d,o,n,i),this.conjugate(d,o,n),this.normalize13b(d,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),p(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,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=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=(e.words[n]&1<<i)>>>i}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var o=r.sqr();n<t.length;n++,o=o.sqr())0!==t[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,c=(0|this.words[t])-s<<n;this.words[t]=c|a,a=s>>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,c=n;if(i-=a,i=Math.max(0,i),c){for(var u=0;u<a;u++)c.words[u]=this.words[u];c.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var f=0;for(u=this.length-1;u>=0&&(0!==f||u>=i);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&s}return c&&0!==f&&(c.words[c.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},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){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n||!(this.words[n]&i))},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},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(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&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]-=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,n){var i,o,a=e.length+n;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+s;var c=(0|e.words[i])*t;s=((o-=67108863&c)>>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,a=0|o.words[o.length-1];0!=(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,c=n.length-o.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var f=n.clone()._ishlnsubmul(o,1,c);0===f.negative&&(n=f,s&&(s.words[c]=1));for(var l=c-1;l>=0;l--){var d=67108864*(0|n.words[o.length+l])+(0|n.words[o.length+l-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,l);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,l),n.isZero()||(n.negative^=1);s&&(s.words[l]=d)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{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);var o,a,s},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 r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},i.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var f=n.clone(),l=t.clone();!t.isZero();){for(var d=0,h=1;0==(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(f),a.isub(l)),o.iushrn(1),a.iushrn(1);for(var p=0,b=1;0==(n.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(f),c.isub(l)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s),a.isub(c)):(n.isub(t),s.isub(o),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,f=1;0==(t.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var l=0,d=1;0==(n.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(n.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},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-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},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 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new S(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(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 r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={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()}function m(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){S.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)}y.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},n(m,y),m.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&r,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},m.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,y),n(w,y),n(_,y),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new m;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return g[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,u).cmp(c);)f.redIAdd(c);for(var l=this.pow(f,o),d=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var b=h,g=0;0!==b.cmp(s);g++)b=b.redSqr();r(g<p);var y=this.pow(l,new i(1).iushln(p-g-1));d=d.redMul(y),l=y.redSqr(),h=h.redMul(l),p=g}return d},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var o=r[0],a=0,s=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],f=c-1;f>=0;f--){var l=u>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==l||0!==a?(a<<=1,a|=l,(4==++s||0===n&&0===f)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}c=26}return o},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new x(e)},n(x,S),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,M)})),Pg="lib/elliptic.js",Cg=["lib"],Mg={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/"},Rg={type:"git",url:"git@github.com:indutny/elliptic"},Ng=["EC","Elliptic","curve","Cryptography"],Lg="Fedor Indutny <fedor@indutny.com>",jg={url:"https://github.com/indutny/elliptic/issues"},Dg="https://github.com/indutny/elliptic",Bg={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"},Ug={"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"},Hg={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:Pg,files:Cg,scripts:Mg,repository:Rg,keywords:Ng,author:Lg,license:"MIT",bugs:jg,homepage:Dg,devDependencies:Bg,dependencies:Ug},Fg=Object.freeze({__proto__:null,name:"elliptic",version:"6.5.4",description:"EC cryptography",main:Pg,files:Cg,scripts:Mg,repository:Rg,keywords:Ng,author:Lg,license:"MIT",bugs:jg,homepage:Dg,devDependencies:Bg,dependencies:Ug,default:Hg}),Vg=qg;function qg(e,t){if(!e)throw new Error(t||"Assertion failed")}qg.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var zg,Kg=N((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16));else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),o=i>>8,a=255&i;o?r.push(o,a):r.push(a)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),Wg=N((function(e,t){var r=t;r.assert=Vg,r.toArray=Kg.toArray,r.zero2=Kg.zero2,r.toHex=Kg.toHex,r.encode=Kg.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<<t+1,o=e.clone(),a=0;a<n.length;a++){var s,c=o.andln(i-1);o.isOdd()?(s=c>(i>>1)-1?(i>>1)-c:c,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),a=0==(1&c)?0:3!=(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c,r[0].push(a),s=0==(1&u)?0:3!=(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new Ag(e,"hex","le")}})),Jg=function(e){return zg||(zg=new Gg(null)),zg.generate(e)};function Gg(e){this.rand=e}var Xg=Gg;if(Gg.prototype.generate=function(e){return this._rand(e)},Gg.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?Gg.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?Gg.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(Gg.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var $g=to;if("function"!=typeof $g.randomBytes)throw new Error("Not supported");Gg.prototype._rand=function(e){return $g.randomBytes(e)}}catch(e){}Jg.Rand=Xg;var Yg=Wg.getNAF,Qg=Wg.getJSF,Zg=Wg.assert;function ey(e,t){this.type=e,this.p=new Ag(t.p,16),this.red=t.prime?Ag.red(t.prime):Ag.mont(this.p),this.zero=new Ag(0).toRed(this.red),this.one=new Ag(1).toRed(this.red),this.two=new Ag(2).toRed(this.red),this.n=t.n&&new Ag(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),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))}var ty=ey;function ry(e,t){this.curve=e,this.type=t,this.precomputed=null}ey.prototype.point=function(){throw new Error("Not implemented")},ey.prototype.validate=function(){throw new Error("Not implemented")},ey.prototype._fixedNafMul=function(e,t){Zg(e.precomputed);var r=e._getDoubles(),n=Yg(t,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var o,a,s=[];for(o=0;o<n.length;o+=r.step){a=0;for(var c=o+r.step-1;c>=o;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),f=this.jpoint(null,null,null),l=i;l>0;l--){for(o=0;o<s.length;o++)(a=s[o])===l?f=f.mixedAdd(r.points[o]):a===-l&&(f=f.mixedAdd(r.points[o].neg()));u=u.add(f)}return u.toP()},ey.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=Yg(t,r,this._bitLength),a=this.jpoint(null,null,null),s=o.length-1;s>=0;s--){for(var c=0;s>=0&&0===o[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=o[s];Zg(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},ey.prototype._wnafMulAdd=function(e,t,r,n,i){var o,a,s,c=this._wnafT1,u=this._wnafT2,f=this._wnafT3,l=0;for(o=0;o<n;o++){var d=(s=t[o])._getNAFPoints(e);c[o]=d.wnd,u[o]=d.points}for(o=n-1;o>=1;o-=2){var h=o-1,p=o;if(1===c[h]&&1===c[p]){var b=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(b[1]=t[h].add(t[p]),b[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(b[1]=t[h].toJ().mixedAdd(t[p]),b[2]=t[h].add(t[p].neg())):(b[1]=t[h].toJ().mixedAdd(t[p]),b[2]=t[h].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=Qg(r[h],r[p]);for(l=Math.max(y[0].length,l),f[h]=new Array(l),f[p]=new Array(l),a=0;a<l;a++){var m=0|y[0][a],v=0|y[1][a];f[h][a]=g[3*(m+1)+(v+1)],f[p][a]=0,u[h]=b}}else f[h]=Yg(r[h],c[h],this._bitLength),f[p]=Yg(r[p],c[p],this._bitLength),l=Math.max(f[h].length,l),l=Math.max(f[p].length,l)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(o=l;o>=0;o--){for(var S=0;o>=0;){var x=!0;for(a=0;a<n;a++)_[a]=0|f[a][o],0!==_[a]&&(x=!1);if(!x)break;S++,o--}if(o>=0&&S++,w=w.dblp(S),o<0)break;for(a=0;a<n;a++){var k=_[a];0!==k&&(k>0?s=u[a][k-1>>1]:k<0&&(s=u[a][-k-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o<n;o++)u[o]=null;return i?w:w.toP()},ey.BasePoint=ry,ry.prototype.eq=function(){throw new Error("Not implemented")},ry.prototype.validate=function(){return this.curve.validate(this)},ey.prototype.decodePoint=function(e,t){e=Wg.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?Zg(e[e.length-1]%2==0):7===e[0]&&Zg(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},ry.prototype.encodeCompressed=function(e){return this.encode(e,!0)},ry.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},ry.prototype.encode=function(e,t){return Wg.encode(this._encode(t),e)},ry.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},ry.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)},ry.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)n=n.dbl();r.push(n)}return{step:e,points:r}},ry.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},ry.prototype._getBeta=function(){return null},ry.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var ny=Wg.assert;function iy(e){ty.call(this,"short",e),this.a=new Ag(e.a,16).toRed(this.red),this.b=new Ag(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Ql(iy,ty);var oy=iy;function ay(e,t,r,n){ty.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new Ag(t,16),this.y=new Ag(r,16),n&&(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)}function sy(e,t,r,n){ty.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Ag(0)):(this.x=new Ag(t,16),this.y=new Ag(r,16),this.z=new Ag(n,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}function cy(e){ty.call(this,"mont",e),this.a=new Ag(e.a,16).toRed(this.red),this.b=new Ag(e.b,16).toRed(this.red),this.i4=new Ag(4).toRed(this.red).redInvm(),this.two=new Ag(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}iy.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new Ag(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new Ag(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],ny(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new Ag(e.a,16),b:new Ag(e.b,16)}})):this._getEndoBasis(r)}}},iy.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Ag.mont(e),r=new Ag(2).toRed(t).redInvm(),n=r.redNeg(),i=new Ag(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},iy.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,a,s,c,u,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,d=this.n.clone(),h=new Ag(1),p=new Ag(0),b=new Ag(0),g=new Ag(1),y=0;0!==l.cmpn(0);){var m=d.div(l);c=d.sub(m.mul(l)),u=b.sub(m.mul(h));var v=g.sub(m.mul(p));if(!n&&c.cmp(f)<0)t=s.neg(),r=h,n=c.neg(),i=u;else if(n&&2==++y)break;s=c,d=l,l=c,b=h,h=u,g=p,p=v}o=c.neg(),a=u;var w=n.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(w)>=0&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},iy.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},iy.prototype.pointFromX=function(e,t){(e=new Ag(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},iy.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},iy.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[o],c=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),c=c.neg(!0)),n[2*o]=s,n[2*o+1]=c,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var u=this._wnafMulAdd(1,n,i,2*o,r),f=0;f<2*o;f++)n[f]=null,i[f]=null;return u},Ql(ay,ty.BasePoint),iy.prototype.point=function(e,t,r){return new ay(this,e,t,r)},iy.prototype.pointFromJSON=function(e,t){return ay.fromJSON(this,e,t)},ay.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 r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},ay.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]},ay.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var o=t[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},ay.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)+">"},ay.prototype.isInfinity=function(){return this.inf},ay.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))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},ay.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},ay.prototype.getX=function(){return this.x.fromRed()},ay.prototype.getY=function(){return this.y.fromRed()},ay.prototype.mul=function(e){return e=new Ag(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)},ay.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},ay.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},ay.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},ay.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},ay.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Ql(sy,ty.BasePoint),iy.prototype.jpoint=function(e,t,r){return new sy(this,e,t,r)},sy.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},sy.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},sy.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),f=u.redMul(s),l=n.redMul(u),d=c.redSqr().redIAdd(f).redISub(l).redISub(l),h=c.redMul(l.redISub(d)).redISub(o.redMul(f)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,h,p)},sy.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),f=r.redMul(c),l=s.redSqr().redIAdd(u).redISub(f).redISub(f),d=s.redMul(f.redISub(l)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(l,d,h)},sy.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,c=s.redSqr().redSqr(),u=a.redAdd(a);for(t=0;t<e;t++){var f=o.redSqr(),l=u.redSqr(),d=l.redSqr(),h=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(c)),p=o.redMul(l),b=h.redSqr().redISub(p.redAdd(p)),g=p.redISub(b),y=h.redMul(g);y=y.redIAdd(y).redISub(d);var m=u.redMul(s);t+1<e&&(c=c.redMul(d)),o=b,s=m,u=y}return this.curve.jpoint(o,u.redMul(i),s)},sy.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},sy.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n),c=s.redSqr().redISub(a).redISub(a),u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),l=this.y.redSqr(),d=l.redSqr(),h=this.x.redAdd(l).redSqr().redISub(f).redISub(d);h=h.redIAdd(h);var p=f.redAdd(f).redIAdd(f),b=p.redSqr(),g=d.redIAdd(d);g=(g=g.redIAdd(g)).redIAdd(g),e=b.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},sy.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=s.redSqr().redISub(a).redISub(a);e=c;var u=o.redIAdd(o);u=(u=u.redIAdd(u)).redIAdd(u),t=s.redMul(a.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),l=this.y.redSqr(),d=this.x.redMul(l),h=this.x.redSub(f).redMul(this.x.redAdd(f));h=h.redAdd(h).redIAdd(h);var p=d.redIAdd(d),b=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(b),r=this.y.redAdd(this.z).redSqr().redISub(l).redISub(f);var g=l.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=h.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},sy.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=t.redSqr(),a=r.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(a),f=s.redSqr().redISub(u.redAdd(u)),l=u.redISub(f),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=s.redMul(l).redISub(d),p=r.redAdd(r).redMul(n);return this.curve.jpoint(f,h,p)},sy.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(n),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(c),f=t.redMul(u);f=(f=f.redIAdd(f)).redIAdd(f);var l=this.x.redMul(s).redISub(f);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var h=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(l,d,h)},sy.prototype.mul=function(e,t){return e=new Ag(e,t),this.curve._wnafMul(this,e)},sy.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},sy.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},sy.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)+">"},sy.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Ql(cy,ty);var uy=cy;function fy(e,t,r){ty.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Ag(t,16),this.z=new Ag(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}cy.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},Ql(fy,ty.BasePoint),cy.prototype.decodePoint=function(e,t){return this.point(Wg.toArray(e,t),1)},cy.prototype.point=function(e,t){return new fy(this,e,t)},cy.prototype.pointFromJSON=function(e){return fy.fromJSON(this,e)},fy.prototype.precompute=function(){},fy.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},fy.fromJSON=function(e,t){return new fy(e,t[0],t[1]||e.one)},fy.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)+">"},fy.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},fy.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},fy.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},fy.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=i.redMul(n),s=t.z.redMul(o.redAdd(a).redSqr()),c=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,c)},fy.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},fy.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},fy.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},fy.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},fy.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},fy.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var ly=Wg.assert;function dy(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,ty.call(this,"edwards",e),this.a=new Ag(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Ag(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Ag(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),ly(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}Ql(dy,ty);var hy=dy;function py(e,t,r,n,i){ty.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(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 Ag(t,16),this.y=new Ag(r,16),this.z=n?new Ag(n,16):this.curve.one,this.t=i&&new Ag(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.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()))))}dy.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},dy.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},dy.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},dy.prototype.pointFromX=function(e,t){(e=new Ag(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},dy.prototype.pointFromY=function(e,t){(e=new Ag(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),i=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},dy.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},Ql(py,ty.BasePoint),dy.prototype.pointFromJSON=function(e){return py.fromJSON(this,e)},dy.prototype.point=function(e,t,r,n){return new py(this,e,t,r,n)},py.fromJSON=function(e,t){return new py(e,t[0],t[1],t[2])},py.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)+">"},py.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},py.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),a=o.redSub(r),s=n.redSub(t),c=i.redMul(a),u=o.redMul(s),f=i.redMul(s),l=a.redMul(o);return this.curve.point(c,u,l,f)},py.prototype._projDbl=function(){var e,t,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=a.redSub(s).redISub(c).redMul(o),t=u.redMul(n.redSub(c)),r=u.redMul(o))}else n=s.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(s.redISub(c)),r=n.redMul(o);return this.curve.point(e,t,r)},py.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},py.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=i.redSub(n),s=i.redAdd(n),c=r.redAdd(t),u=o.redMul(a),f=s.redMul(c),l=o.redMul(c),d=a.redMul(s);return this.curve.point(u,f,d,l)},py.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),c=i.redSub(s),u=i.redAdd(s),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),l=n.redMul(c).redMul(f);return this.curve.twisted?(t=n.redMul(u).redMul(a.redSub(this.curve._mulA(o))),r=c.redMul(u)):(t=n.redMul(u).redMul(a.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(l,t,r)},py.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},py.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},py.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},py.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},py.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=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},py.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},py.prototype.getX=function(){return this.normalize(),this.x.fromRed()},py.prototype.getY=function(){return this.normalize(),this.y.fromRed()},py.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},py.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},py.prototype.toP=py.prototype.normalize,py.prototype.mixedAdd=py.prototype.add;var by=N((function(e,t){var r=t;r.base=ty,r.short=oy,r.mont=uy,r.edwards=hy}));function gy(e,t){return 55296==(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function yy(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function my(e){return 1===e.length?"0"+e:e}function vy(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}var wy={inherits:Ql,toArray:function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(var n=0,i=0;i<e.length;i++){var o=e.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=63&o|128):gy(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i<e.length;i++)r[i]=0|e[i];return r},toHex:function(e){for(var t="",r=0;r<e.length;r++)t+=my(e[r].toString(16));return t},htonl:yy,toHex32:function(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];"little"===t&&(i=yy(i)),r+=vy(i.toString(16))}return r},zero2:my,zero8:vy,join32:function(e,t,r,n){var i=r-t;Vg(i%4==0);for(var o=new Array(i/4),a=0,s=t;a<o.length;a++,s+=4){var c;c="big"===n?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],o[a]=c>>>0}return o},split32:function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n<e.length;n++,i+=4){var o=e[n];"big"===t?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},rotr32:function(e,t){return e>>>t|e<<32-t},rotl32:function(e,t){return e<<t|e>>>32-t},sum32:function(e,t){return e+t>>>0},sum32_3:function(e,t,r){return e+t+r>>>0},sum32_4:function(e,t,r,n){return e+t+r+n>>>0},sum32_5:function(e,t,r,n,i){return e+t+r+n+i>>>0},sum64:function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o<n?1:0)+r+i;e[t]=a>>>0,e[t+1]=o},sum64_hi:function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},sum64_lo:function(e,t,r,n){return t+n>>>0},sum64_4_hi:function(e,t,r,n,i,o,a,s){var c=0,u=t;return c+=(u=u+n>>>0)<t?1:0,c+=(u=u+o>>>0)<o?1:0,e+r+i+a+(c+=(u=u+s>>>0)<s?1:0)>>>0},sum64_4_lo:function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},sum64_5_hi:function(e,t,r,n,i,o,a,s,c,u){var f=0,l=t;return f+=(l=l+n>>>0)<t?1:0,f+=(l=l+o>>>0)<o?1:0,f+=(l=l+s>>>0)<s?1:0,e+r+i+a+c+(f+=(l=l+u>>>0)<u?1:0)>>>0},sum64_5_lo:function(e,t,r,n,i,o,a,s,c,u){return t+n+o+s+u>>>0},rotr64_hi:function(e,t,r){return(t<<32-r|e>>>r)>>>0},rotr64_lo:function(e,t,r){return(e<<32-r|t>>>r)>>>0},shr64_hi:function(e,t,r){return e>>>r},shr64_lo:function(e,t,r){return(e<<32-r|t>>>r)>>>0}};function _y(){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}var Sy=_y;_y.prototype.update=function(e,t){if(e=wy.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=wy.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},_y.prototype.digest=function(e){return this.update(this._pad()),Vg(null===this.pending),this._digest(e)},_y.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=e>>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n};var xy={BlockHash:Sy},ky=wy.rotr32;function Ey(e,t,r){return e&t^~e&r}function Iy(e,t,r){return e&t^e&r^t&r}function Oy(e,t,r){return e^t^r}var Ty=function(e,t,r,n){return 0===e?Ey(t,r,n):1===e||3===e?Oy(t,r,n):2===e?Iy(t,r,n):void 0},Ay=Ey,Py=Iy,Cy=function(e){return ky(e,2)^ky(e,13)^ky(e,22)},My=function(e){return ky(e,6)^ky(e,11)^ky(e,25)},Ry=function(e){return ky(e,7)^ky(e,18)^e>>>3},Ny=function(e){return ky(e,17)^ky(e,19)^e>>>10},Ly=wy.rotl32,jy=wy.sum32,Dy=wy.sum32_5,By=Ty,Uy=xy.BlockHash,Hy=[1518500249,1859775393,2400959708,3395469782];function Fy(){if(!(this instanceof Fy))return new Fy;Uy.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}wy.inherits(Fy,Uy);var Vy=Fy;Fy.blockSize=512,Fy.outSize=160,Fy.hmacStrength=80,Fy.padLength=64,Fy.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Ly(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],c=this.h[4];for(n=0;n<r.length;n++){var u=~~(n/20),f=Dy(Ly(i,5),By(u,o,a,s),c,r[n],Hy[u]);c=s,s=a,a=Ly(o,30),o=i,i=f}this.h[0]=jy(this.h[0],i),this.h[1]=jy(this.h[1],o),this.h[2]=jy(this.h[2],a),this.h[3]=jy(this.h[3],s),this.h[4]=jy(this.h[4],c)},Fy.prototype._digest=function(e){return"hex"===e?wy.toHex32(this.h,"big"):wy.split32(this.h,"big")};var qy=wy.sum32,zy=wy.sum32_4,Ky=wy.sum32_5,Wy=Ay,Jy=Py,Gy=Cy,Xy=My,$y=Ry,Yy=Ny,Qy=xy.BlockHash,Zy=[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 em(){if(!(this instanceof em))return new em;Qy.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Zy,this.W=new Array(64)}wy.inherits(em,Qy);var tm=em;function rm(){if(!(this instanceof rm))return new rm;tm.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}em.blockSize=512,em.outSize=256,em.hmacStrength=192,em.padLength=64,em.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=zy(Yy(r[n-2]),r[n-7],$y(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],c=this.h[4],u=this.h[5],f=this.h[6],l=this.h[7];for(Vg(this.k.length===r.length),n=0;n<r.length;n++){var d=Ky(l,Xy(c),Wy(c,u,f),this.k[n],r[n]),h=qy(Gy(i),Jy(i,o,a));l=f,f=u,u=c,c=qy(s,d),s=a,a=o,o=i,i=qy(d,h)}this.h[0]=qy(this.h[0],i),this.h[1]=qy(this.h[1],o),this.h[2]=qy(this.h[2],a),this.h[3]=qy(this.h[3],s),this.h[4]=qy(this.h[4],c),this.h[5]=qy(this.h[5],u),this.h[6]=qy(this.h[6],f),this.h[7]=qy(this.h[7],l)},em.prototype._digest=function(e){return"hex"===e?wy.toHex32(this.h,"big"):wy.split32(this.h,"big")},wy.inherits(rm,tm);var nm=rm;rm.blockSize=512,rm.outSize=224,rm.hmacStrength=192,rm.padLength=64,rm.prototype._digest=function(e){return"hex"===e?wy.toHex32(this.h.slice(0,7),"big"):wy.split32(this.h.slice(0,7),"big")};var im=wy.rotr64_hi,om=wy.rotr64_lo,am=wy.shr64_hi,sm=wy.shr64_lo,cm=wy.sum64,um=wy.sum64_hi,fm=wy.sum64_lo,lm=wy.sum64_4_hi,dm=wy.sum64_4_lo,hm=wy.sum64_5_hi,pm=wy.sum64_5_lo,bm=xy.BlockHash,gm=[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 ym(){if(!(this instanceof ym))return new ym;bm.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=gm,this.W=new Array(160)}wy.inherits(ym,bm);var mm=ym;function vm(e,t,r,n,i){var o=e&r^~e&i;return o<0&&(o+=4294967296),o}function wm(e,t,r,n,i,o){var a=t&n^~t&o;return a<0&&(a+=4294967296),a}function _m(e,t,r,n,i){var o=e&r^e&i^r&i;return o<0&&(o+=4294967296),o}function Sm(e,t,r,n,i,o){var a=t&n^t&o^n&o;return a<0&&(a+=4294967296),a}function xm(e,t){var r=im(e,t,28)^im(t,e,2)^im(t,e,7);return r<0&&(r+=4294967296),r}function km(e,t){var r=om(e,t,28)^om(t,e,2)^om(t,e,7);return r<0&&(r+=4294967296),r}function Em(e,t){var r=im(e,t,14)^im(e,t,18)^im(t,e,9);return r<0&&(r+=4294967296),r}function Im(e,t){var r=om(e,t,14)^om(e,t,18)^om(t,e,9);return r<0&&(r+=4294967296),r}function Om(e,t){var r=im(e,t,1)^im(e,t,8)^am(e,t,7);return r<0&&(r+=4294967296),r}function Tm(e,t){var r=om(e,t,1)^om(e,t,8)^sm(e,t,7);return r<0&&(r+=4294967296),r}function Am(e,t){var r=im(e,t,19)^im(t,e,29)^am(e,t,6);return r<0&&(r+=4294967296),r}function Pm(e,t){var r=om(e,t,19)^om(t,e,29)^sm(e,t,6);return r<0&&(r+=4294967296),r}function Cm(){if(!(this instanceof Cm))return new Cm;mm.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}ym.blockSize=1024,ym.outSize=512,ym.hmacStrength=192,ym.padLength=128,ym.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var i=Am(r[n-4],r[n-3]),o=Pm(r[n-4],r[n-3]),a=r[n-14],s=r[n-13],c=Om(r[n-30],r[n-29]),u=Tm(r[n-30],r[n-29]),f=r[n-32],l=r[n-31];r[n]=lm(i,o,a,s,c,u,f,l),r[n+1]=dm(i,o,a,s,c,u,f,l)}},ym.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],c=this.h[5],u=this.h[6],f=this.h[7],l=this.h[8],d=this.h[9],h=this.h[10],p=this.h[11],b=this.h[12],g=this.h[13],y=this.h[14],m=this.h[15];Vg(this.k.length===r.length);for(var v=0;v<r.length;v+=2){var w=y,_=m,S=Em(l,d),x=Im(l,d),k=vm(l,0,h,0,b),E=wm(0,d,0,p,0,g),I=this.k[v],O=this.k[v+1],T=r[v],A=r[v+1],P=hm(w,_,S,x,k,E,I,O,T,A),C=pm(w,_,S,x,k,E,I,O,T,A);w=xm(n,i),_=km(n,i),S=_m(n,0,o,0,s),x=Sm(0,i,0,a,0,c);var M=um(w,_,S,x),R=fm(w,_,S,x);y=b,m=g,b=h,g=p,h=l,p=d,l=um(u,f,P,C),d=fm(f,f,P,C),u=s,f=c,s=o,c=a,o=n,a=i,n=um(P,C,M,R),i=fm(P,C,M,R)}cm(this.h,0,n,i),cm(this.h,2,o,a),cm(this.h,4,s,c),cm(this.h,6,u,f),cm(this.h,8,l,d),cm(this.h,10,h,p),cm(this.h,12,b,g),cm(this.h,14,y,m)},ym.prototype._digest=function(e){return"hex"===e?wy.toHex32(this.h,"big"):wy.split32(this.h,"big")},wy.inherits(Cm,mm);var Mm=Cm;Cm.blockSize=1024,Cm.outSize=384,Cm.hmacStrength=192,Cm.padLength=128,Cm.prototype._digest=function(e){return"hex"===e?wy.toHex32(this.h.slice(0,12),"big"):wy.split32(this.h.slice(0,12),"big")};var Rm={sha1:Vy,sha224:nm,sha256:tm,sha384:Mm,sha512:mm},Nm=wy.rotl32,Lm=wy.sum32,jm=wy.sum32_3,Dm=wy.sum32_4,Bm=xy.BlockHash;function Um(){if(!(this instanceof Um))return new Um;Bm.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}wy.inherits(Um,Bm);var Hm=Um;function Fm(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function Vm(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function qm(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}Um.blockSize=512,Um.outSize=160,Um.hmacStrength=192,Um.padLength=64,Um.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=r,c=n,u=i,f=o,l=a,d=0;d<80;d++){var h=Lm(Nm(Dm(r,Fm(d,n,i,o),e[zm[d]+t],Vm(d)),Wm[d]),a);r=a,a=o,o=Nm(i,10),i=n,n=h,h=Lm(Nm(Dm(s,Fm(79-d,c,u,f),e[Km[d]+t],qm(d)),Jm[d]),l),s=l,l=f,f=Nm(u,10),u=c,c=h}h=jm(this.h[1],i,f),this.h[1]=jm(this.h[2],o,l),this.h[2]=jm(this.h[3],a,s),this.h[3]=jm(this.h[4],r,c),this.h[4]=jm(this.h[0],n,u),this.h[0]=h},Um.prototype._digest=function(e){return"hex"===e?wy.toHex32(this.h,"little"):wy.split32(this.h,"little")};var zm=[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],Km=[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],Wm=[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],Jm=[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],Gm={ripemd160:Hm};function Xm(e,t,r){if(!(this instanceof Xm))return new Xm(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(wy.toArray(t,r))}var $m=Xm;Xm.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),Vg(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)},Xm.prototype.update=function(e,t){return this.inner.update(e,t),this},Xm.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)};var Ym=N((function(e,t){var r=t;r.utils=wy,r.common=xy,r.sha=Rm,r.ripemd=Gm,r.hmac=$m,r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160})),Qm={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"]]}},Zm=N((function(e,t){var r,n=t,i=Wg.assert;function o(e){"short"===e.type?this.curve=new by.short(e):"edwards"===e.type?this.curve=new by.edwards(e):this.curve=new by.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")}function a(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new o(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=o,a("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:Ym.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("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:Ym.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("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:Ym.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("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:Ym.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"]}),a("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:Ym.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"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ym.sha256,gRed:!1,g:["9"]}),a("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:Ym.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=Qm}catch(e){r=void 0}a("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:Ym.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function ev(e){if(!(this instanceof ev))return new ev(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=Kg.toArray(e.entropy,e.entropyEnc||"hex"),r=Kg.toArray(e.nonce,e.nonceEnc||"hex"),n=Kg.toArray(e.pers,e.persEnc||"hex");Vg(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var tv=ev;ev.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},ev.prototype._hmac=function(){return new Ym.hmac(this.hash,this.K)},ev.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())},ev.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=Kg.toArray(e,t),r=Kg.toArray(r,n),Vg(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},ev.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=Kg.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,e);return this._update(r),this._reseed++,Kg.encode(o,t)};var rv=Wg.assert;function nv(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)}var iv=nv;nv.fromPublic=function(e,t,r){return t instanceof nv?t:new nv(e,{pub:t,pubEnc:r})},nv.fromPrivate=function(e,t,r){return t instanceof nv?t:new nv(e,{priv:t,privEnc:r})},nv.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"}},nv.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},nv.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},nv.prototype._importPrivate=function(e,t){this.priv=new Ag(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},nv.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?rv(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||rv(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},nv.prototype.derive=function(e){return e.validate()||rv(e.validate(),"public point not validated"),e.mul(this.priv).getX()},nv.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},nv.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},nv.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var ov=Wg.assert;function av(e,t){if(e instanceof av)return e;this._importDER(e,t)||(ov(e.r&&e.s,"Signature without r or s"),this.r=new Ag(e.r,16),this.s=new Ag(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var sv=av;function cv(){this.place=0}function uv(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=t.place;o<n;o++,a++)i<<=8,i|=e[a],i>>>=0;return!(i<=127)&&(t.place=a,i)}function fv(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function lv(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}av.prototype._importDER=function(e,t){e=Wg.toArray(e,t);var r=new cv;if(48!==e[r.place++])return!1;var n=uv(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=uv(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var a=uv(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;var s=e.slice(r.place,a+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new Ag(o),this.s=new Ag(s),this.recoveryParam=null,!0},av.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=fv(t),r=fv(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];lv(n,t.length),(n=n.concat(t)).push(2),lv(n,r.length);var i=n.concat(r),o=[48];return lv(o,i.length),o=o.concat(i),Wg.encode(o,e)};var dv=Wg.assert;function hv(e){if(!(this instanceof hv))return new hv(e);"string"==typeof e&&(dv(Object.prototype.hasOwnProperty.call(Zm,e),"Unknown curve "+e),e=Zm[e]),e instanceof Zm.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}var pv=hv;hv.prototype.keyPair=function(e){return new iv(this,e)},hv.prototype.keyFromPrivate=function(e,t){return iv.fromPrivate(this,e,t)},hv.prototype.keyFromPublic=function(e,t){return iv.fromPublic(this,e,t)},hv.prototype.genKeyPair=function(e){e||(e={});for(var t=new tv({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Jg(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new Ag(2));;){var i=new Ag(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},hv.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},hv.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new Ag(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new tv({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new Ag(1)),u=0;;u++){var f=n.k?n.k(u):new Ag(s.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(c)>=0)){var l=this.g.mul(f);if(!l.isInfinity()){var d=l.getX(),h=d.umod(this.n);if(0!==h.cmpn(0)){var p=f.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var b=(l.getY().isOdd()?1:0)|(0!==d.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),b^=1),new sv({r:h,s:p,recoveryParam:b})}}}}}},hv.prototype.verify=function(e,t,r,n){e=this._truncateToN(new Ag(e,16)),r=this.keyFromPublic(r,n);var i=(t=new sv(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},hv.prototype.recoverPubKey=function(e,t,r,n){dv((3&r)===r,"The recovery param is more than two bits"),t=new sv(t,n);var i=this.n,o=new Ag(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var f=t.r.invm(i),l=i.sub(o).mul(f).umod(i),d=s.mul(f).umod(i);return this.g.mulAdd(l,a,d)},hv.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new sv(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var bv=Wg.assert,gv=Wg.parseBytes,yv=Wg.cachedProperty;function mv(e,t){this.eddsa=e,this._secret=gv(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=gv(t.pub)}mv.fromPublic=function(e,t){return t instanceof mv?t:new mv(e,{pub:t})},mv.fromSecret=function(e,t){return t instanceof mv?t:new mv(e,{secret:t})},mv.prototype.secret=function(){return this._secret},yv(mv,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),yv(mv,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),yv(mv,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),yv(mv,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),yv(mv,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),yv(mv,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),mv.prototype.sign=function(e){return bv(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},mv.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},mv.prototype.getSecret=function(e){return bv(this._secret,"KeyPair is public only"),Wg.encode(this.secret(),e)},mv.prototype.getPublic=function(e){return Wg.encode(this.pubBytes(),e)};var vv=mv,wv=Wg.assert,_v=Wg.cachedProperty,Sv=Wg.parseBytes;function xv(e,t){this.eddsa=e,"object"!=typeof t&&(t=Sv(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),wv(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof Ag&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}_v(xv,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),_v(xv,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),_v(xv,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),_v(xv,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),xv.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},xv.prototype.toHex=function(){return Wg.encode(this.toBytes(),"hex").toUpperCase()};var kv=xv,Ev=Wg.assert,Iv=Wg.parseBytes;function Ov(e){if(Ev("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof Ov))return new Ov(e);e=Zm[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=Ym.sha512}var Tv=Ov;Ov.prototype.sign=function(e,t){e=Iv(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},Ov.prototype.verify=function(e,t,r){e=Iv(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},Ov.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Wg.intFromLE(e.digest()).umod(this.curve.n)},Ov.prototype.keyFromPublic=function(e){return vv.fromPublic(this,e)},Ov.prototype.keyFromSecret=function(e){return vv.fromSecret(this,e)},Ov.prototype.makeSignature=function(e){return e instanceof kv?e:new kv(this,e)},Ov.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},Ov.prototype.decodePoint=function(e){var t=(e=Wg.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=0!=(128&e[t]),i=Wg.intFromLE(r);return this.curve.pointFromY(i,n)},Ov.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},Ov.prototype.decodeInt=function(e){return Wg.intFromLE(e)},Ov.prototype.isPoint=function(e){return e instanceof this.pointClass};var Av=L(Fg),Pv=N((function(e,t){var r=t;r.version=Av.version,r.utils=Wg,r.rand=Jg,r.curve=by,r.curves=Zm,r.ec=pv,r.eddsa=Tv}));const Cv=te.alloc(1,1),Mv=te.alloc(1,0);const Rv=new Pv.ec("secp256k1"),Nv=te.alloc(32,0),Lv=te.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),jv=te.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex"),Dv=Rv.curve.n,Bv=Dv.shrn(1),Uv=Rv.curve.g;function Hv(e){return De(e)&&32===e.length}function Fv(e){return!!Hv(e)&&e.compare(Lv)<0}function Vv(e){if(!De(e))return!1;if(e.length<33)return!1;const t=e[0],r=e.slice(1,33);if(0===r.compare(Nv))return!1;if(r.compare(jv)>=0)return!1;if((2===t||3===t)&&33===e.length){try{Gv(e)}catch(e){return!1}return!0}const n=e.slice(33);return 0!==n.compare(Nv)&&!(n.compare(jv)>=0)&&4===t&&65===e.length}function qv(e){return 4!==e[0]}function zv(e){return!!Hv(e)&&e.compare(Nv)>0&&e.compare(Lv)<0}function Kv(e,t){return void 0===e&&void 0!==t?qv(t):void 0===e||e}function Wv(e){return new Ag(e)}function Jv(e){return e.toArrayLike(te,"be",32)}function Gv(e){return Rv.curve.decodePoint(e)}function Xv(e,t){return te.from(e._encode(t))}function $v(e,t,r){if(!Hv(e))throw new TypeError("Expected Hash");if(!zv(t))throw new TypeError("Expected Private");if(void 0!==r&&!Hv(r))throw new TypeError("Expected Extra Data (32 bytes)");const n=Wv(t),i=Wv(e);let o,a;(function(e,t,r,n,i){let o=te.alloc(32,0),a=te.alloc(32,1);o=xg("sha256",o).update(a).update(Mv).update(t).update(e).update(i||"").digest(),a=xg("sha256",o).update(a).digest(),o=xg("sha256",o).update(a).update(Cv).update(t).update(e).update(i||"").digest(),a=xg("sha256",o).update(a).digest(),a=xg("sha256",o).update(a).digest();let s=a;for(;!n(s)||!r(s);)o=xg("sha256",o).update(a).update(Mv).digest(),a=xg("sha256",o).update(a).digest(),a=xg("sha256",o).update(a).digest(),s=a})(e,t,(function(e){const t=Wv(e),r=Uv.mul(t);return!r.isInfinity()&&(o=r.x.umod(Dv),0!==o.isZero()&&(a=t.invm(Dv).mul(i.add(n.mul(o))).umod(Dv),0!==a.isZero()))}),zv,r),a.cmp(Bv)>0&&(a=Dv.sub(a));const s=te.allocUnsafe(64);return Jv(o).copy(s,0),Jv(a).copy(s,32),s}var Yv={isPoint:Vv,isPointCompressed:function(e){return!!Vv(e)&&qv(e)},isPrivate:zv,pointAdd:function(e,t,r){if(!Vv(e))throw new TypeError("Expected Point");if(!Vv(t))throw new TypeError("Expected Point");const n=Gv(e),i=Gv(t),o=n.add(i);return o.isInfinity()?null:Xv(o,Kv(r,e))},pointAddScalar:function(e,t,r){if(!Vv(e))throw new TypeError("Expected Point");if(!Fv(t))throw new TypeError("Expected Tweak");const n=Kv(r,e),i=Gv(e);if(0===t.compare(Nv))return Xv(i,n);const o=Wv(t),a=Uv.mul(o),s=i.add(a);return s.isInfinity()?null:Xv(s,n)},pointCompress:function(e,t){if(!Vv(e))throw new TypeError("Expected Point");const r=Gv(e);if(r.isInfinity())throw new TypeError("Expected Point");return Xv(r,Kv(t,e))},pointFromScalar:function(e,t){if(!zv(e))throw new TypeError("Expected Private");const r=Wv(e),n=Uv.mul(r);return n.isInfinity()?null:Xv(n,Kv(t))},pointMultiply:function(e,t,r){if(!Vv(e))throw new TypeError("Expected Point");if(!Fv(t))throw new TypeError("Expected Tweak");const n=Kv(r,e),i=Gv(e),o=Wv(t),a=i.mul(o);return a.isInfinity()?null:Xv(a,n)},privateAdd:function(e,t){if(!zv(e))throw new TypeError("Expected Private");if(!Fv(t))throw new TypeError("Expected Tweak");const r=Wv(e),n=Wv(t),i=Jv(r.add(n).umod(Dv));return zv(i)?i:null},privateSub:function(e,t){if(!zv(e))throw new TypeError("Expected Private");if(!Fv(t))throw new TypeError("Expected Tweak");const r=Wv(e),n=Wv(t),i=Jv(r.sub(n).umod(Dv));return zv(i)?i:null},sign:function(e,t){return $v(e,t)},signWithEntropy:function(e,t,r){return $v(e,t,r)},verify:function(e,t,r,n){if(!Hv(e))throw new TypeError("Expected Hash");if(!Vv(t))throw new TypeError("Expected Point");if(!function(e){const t=e.slice(0,32),r=e.slice(32,64);return De(e)&&64===e.length&&t.compare(Lv)<0&&r.compare(Lv)<0}(r))throw new TypeError("Expected Signature");const i=Gv(t),o=Wv(r.slice(0,32)),a=Wv(r.slice(32,64));if(n&&a.cmp(Bv)>0)return!1;if(o.gtn(0)<=0)return!1;if(a.gtn(0)<=0)return!1;const s=Wv(e),c=a.invm(Dv),u=s.mul(c).umod(Dv),f=o.mul(c).umod(Dv),l=Uv.mulAdd(u,i,f);return!l.isInfinity()&&l.x.umod(Dv).eq(o)}},Qv={Array:function(e){return null!=e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return null==e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var Zv in Qv.Null=Qv.Nil,Qv)Qv[Zv].toJSON=function(e){return e}.bind(null,Zv);var ew=Qv;function tw(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function rw(e){return ew.Nil(e)?"":tw(e.constructor)}function nw(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function iw(e){return ew.Function(e)?e.toJSON?e.toJSON():tw(e):ew.Array(e)?"Array":e&&ew.Object(e)?"Object":void 0!==e?e:""}function ow(e,t,r){var n=function(e){return ew.Function(e)?"":ew.String(e)?JSON.stringify(e):e&&ew.Object(e)?"":e}(t);return"Expected "+iw(e)+", got"+(""!==r?" "+r:"")+(""!==n?" "+n:"")}function aw(e,t,r){r=r||rw(t),this.message=ow(e,t,r),nw(this,aw),this.__type=e,this.__value=t,this.__valueTypeName=r}function sw(e,t,r,n,i){e?(i=i||rw(n),this.message=function(e,t,r,n,i){var o='" of type ';return"key"===t&&(o='" with key type '),ow('property "'+iw(r)+o+iw(e),n,i)}(e,r,t,n,i)):this.message='Unexpected property "'+t+'"',nw(this,aw),this.__label=r,this.__property=t,this.__type=e,this.__value=n,this.__valueTypeName=i}aw.prototype=Object.create(Error.prototype),aw.prototype.constructor=aw,sw.prototype=Object.create(Error.prototype),sw.prototype.constructor=aw;var cw=aw,uw=sw,fw=function(e,t){return new aw(e,{},t)},lw=function(e,t,r){return e instanceof sw?(t=t+"."+e.__property,e=new sw(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof aw&&(e=new sw(e.__type,t,r,e.__value,e.__valueTypeName)),nw(e),e},dw=iw,hw=rw;function pw(e){return De(e)}function bw(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function gw(e,t){var r=e.toJSON();function n(n){if(!e(n))return!1;if(n.length===t)return!0;throw fw(r+"(Length: "+t+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var yw=gw.bind(null,ew.Array),mw=gw.bind(null,pw),vw=gw.bind(null,bw),ww=gw.bind(null,ew.String),_w=Math.pow(2,53)-1,Sw={ArrayN:yw,Buffer:pw,BufferN:mw,Finite:function(e){return"number"==typeof e&&isFinite(e)},Hex:bw,HexN:vw,Int8:function(e){return e<<24>>24===e},Int16:function(e){return e<<16>>16===e},Int32:function(e){return(0|e)===e},Int53:function(e){return"number"==typeof e&&e>=-_w&&e<=_w&&Math.floor(e)===e},Range:function(e,t,r){function n(n,i){return r(n,i)&&n>e&&n<t}return r=r||ew.Number,n.toJSON=function(){return`${r.toJSON()} between [${e}, ${t}]`},n},StringN:ww,UInt8:function(e){return(255&e)===e},UInt16:function(e){return(65535&e)===e},UInt32:function(e){return e>>>0===e},UInt53:function(e){return"number"==typeof e&&e>=0&&e<=_w&&Math.floor(e)===e}};for(var xw in Sw)Sw[xw].toJSON=function(e){return e}.bind(null,xw);var kw=Sw,Ew=dw,Iw=cw,Ow=uw,Tw=lw,Aw=hw,Pw={arrayOf:function(e,t){function r(r,n){return!!ew.Array(r)&&!ew.Nil(r)&&!(void 0!==t.minLength&&r.length<t.minLength)&&!(void 0!==t.maxLength&&r.length>t.maxLength)&&(void 0===t.length||r.length===t.length)&&r.every((function(t,r){try{return Mw(e,t,n)}catch(e){throw Tw(e,r)}}))}return e=Cw(e),t=t||{},r.toJSON=function(){var r="["+Ew(e)+"]";return void 0!==t.length?r+="{"+t.length+"}":void 0===t.minLength&&void 0===t.maxLength||(r+="{"+(void 0===t.minLength?0:t.minLength)+","+(void 0===t.maxLength?1/0:t.maxLength)+"}"),r},r},maybe:function e(t){function r(r,n){return ew.Nil(r)||t(r,n,e)}return t=Cw(t),r.toJSON=function(){return"?"+Ew(t)},r},map:function(e,t){function r(r,n){if(!ew.Object(r))return!1;if(ew.Nil(r))return!1;for(var i in r){try{t&&Mw(t,i,n)}catch(e){throw Tw(e,i,"key")}try{var o=r[i];Mw(e,o,n)}catch(e){throw Tw(e,i)}}return!0}return e=Cw(e),t&&(t=Cw(t)),r.toJSON=t?function(){return"{"+Ew(t)+": "+Ew(e)+"}"}:function(){return"{"+Ew(e)+"}"},r},object:function(e){var t={};for(var r in e)t[r]=Cw(e[r]);function n(e,r){if(!ew.Object(e))return!1;if(ew.Nil(e))return!1;var n;try{for(n in t)Mw(t[n],e[n],r)}catch(e){throw Tw(e,n)}if(r)for(n in e)if(!t[n])throw new Ow(void 0,n);return!0}return n.toJSON=function(){return Ew(t)},n},anyOf:function(){var e=[].slice.call(arguments).map(Cw);function t(t,r){return e.some((function(e){try{return Mw(e,t,r)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(Ew).join("|")},t},allOf:function(){var e=[].slice.call(arguments).map(Cw);function t(t,r){return e.every((function(e){try{return Mw(e,t,r)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(Ew).join(" & ")},t},quacksLike:function(e){function t(t){return e===Aw(t)}return t.toJSON=function(){return e},t},tuple:function(){var e=[].slice.call(arguments).map(Cw);function t(t,r){return!ew.Nil(t)&&!ew.Nil(t.length)&&(!r||t.length===e.length)&&e.every((function(e,n){try{return Mw(e,t[n],r)}catch(e){throw Tw(e,n)}}))}return t.toJSON=function(){return"("+e.map(Ew).join(", ")+")"},t},value:function(e){function t(t){return t===e}return t.toJSON=function(){return e},t}};function Cw(e){if(ew.String(e))return"?"===e[0]?Pw.maybe(e.slice(1)):ew[e]||Pw.quacksLike(e);if(e&&ew.Object(e)){if(ew.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return Pw.arrayOf(e[0])}return Pw.object(e)}return ew.Function(e)?e:Pw.value(e)}function Mw(e,t,r,n){if(ew.Function(e)){if(e(t,r))return!0;throw new Iw(n||e,t)}return Mw(Cw(e),t,r)}for(var Rw in Pw.oneOf=Pw.anyOf,ew)Mw[Rw]=ew[Rw];for(Rw in Pw)Mw[Rw]=Pw[Rw];for(Rw in kw)Mw[Rw]=kw[Rw];Mw.compile=Cw,Mw.TfTypeError=Iw,Mw.TfPropertyTypeError=Ow;var Nw=Mw;function Lw(e,t){if(void 0!==t&&e[0]!==t)throw new Error("Invalid network version");if(33===e.length)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(34!==e.length)throw new Error("Invalid WIF length");if(1!==e[33])throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function jw(e,t,r){var n=new te(r?34:33);return n.writeUInt8(e,0),t.copy(n,1),r&&(n[33]=1),n}var Dw=function(e,t){return Lw(Tg.decode(e),t)},Bw=function(e,t,r){return"number"==typeof e?Tg.encode(jw(e,t,r)):Tg.encode(jw(e.version,e.privateKey,e.compressed))},Uw=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=Nw.BufferN(32),n=Nw.compile({wif:Nw.UInt8,bip32:{public:Nw.UInt32,private:Nw.UInt32}}),i={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},o=2147483648,a=Math.pow(2,31)-1;function s(e){return Nw.String(e)&&null!==e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function c(e){return Nw.UInt32(e)&&e<=a}class u{constructor(e,t,r,i,o=0,a=0,s=0){this.__D=e,this.__Q=t,this.chainCode=r,this.network=i,this.__DEPTH=o,this.__INDEX=a,this.__PARENT_FINGERPRINT=s,Nw(n,i),this.lowR=!1}get depth(){return this.__DEPTH}get index(){return this.__INDEX}get parentFingerprint(){return this.__PARENT_FINGERPRINT}get publicKey(){return void 0===this.__Q&&(this.__Q=Yv.pointFromScalar(this.__D,!0)),this.__Q}get privateKey(){return this.__D}get identifier(){return kg.hash160(this.publicKey)}get fingerprint(){return this.identifier.slice(0,4)}get compressed(){return!0}isNeutered(){return void 0===this.__D}neutered(){return d(this.publicKey,this.chainCode,this.network,this.depth,this.index,this.parentFingerprint)}toBase58(){const e=this.network,t=this.isNeutered()?e.bip32.public:e.bip32.private,r=te.allocUnsafe(78);return r.writeUInt32BE(t,0),r.writeUInt8(this.depth,4),r.writeUInt32BE(this.parentFingerprint,5),r.writeUInt32BE(this.index,9),this.chainCode.copy(r,13),this.isNeutered()?this.publicKey.copy(r,45):(r.writeUInt8(0,45),this.privateKey.copy(r,46)),Tg.encode(r)}toWIF(){if(!this.privateKey)throw new TypeError("Missing private key");return Bw(this.network.wif,this.privateKey,!0)}derive(e){Nw(Nw.UInt32,e);const t=e>=o,r=te.allocUnsafe(37);if(t){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");r[0]=0,this.privateKey.copy(r,1),r.writeUInt32BE(e,33)}else this.publicKey.copy(r,0),r.writeUInt32BE(e,33);const n=kg.hmacSHA512(this.chainCode,r),i=n.slice(0,32),a=n.slice(32);if(!Yv.isPrivate(i))return this.derive(e+1);let s;if(this.isNeutered()){const t=Yv.pointAddScalar(this.publicKey,i,!0);if(null===t)return this.derive(e+1);s=d(t,a,this.network,this.depth+1,e,this.fingerprint.readUInt32BE(0))}else{const t=Yv.privateAdd(this.privateKey,i);if(null==t)return this.derive(e+1);s=l(t,a,this.network,this.depth+1,e,this.fingerprint.readUInt32BE(0))}return s}deriveHardened(e){return Nw(c,e),this.derive(e+o)}derivePath(e){Nw(s,e);let t=e.split("/");if("m"===t[0]){if(this.parentFingerprint)throw new TypeError("Expected master, got child");t=t.slice(1)}return t.reduce(((e,t)=>{let r;return"'"===t.slice(-1)?(r=parseInt(t.slice(0,-1),10),e.deriveHardened(r)):(r=parseInt(t,10),e.derive(r))}),this)}sign(e,t){if(!this.privateKey)throw new Error("Missing private key");if(void 0===t&&(t=this.lowR),!1===t)return Yv.sign(e,this.privateKey);{let t=Yv.sign(e,this.privateKey);const r=te.alloc(32,0);let n=0;for(;t[0]>127;)n++,r.writeUIntLE(n,0,6),t=Yv.signWithEntropy(e,this.privateKey,r);return t}}verify(e,t){return Yv.verify(e,this.publicKey,t)}}function f(e,t,r){return l(e,t,r)}function l(e,t,n,o,a,s){if(Nw({privateKey:r,chainCode:r},{privateKey:e,chainCode:t}),n=n||i,!Yv.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return new u(e,void 0,t,n,o,a,s)}function d(e,t,n,o,a,s){if(Nw({publicKey:Nw.BufferN(33),chainCode:r},{publicKey:e,chainCode:t}),n=n||i,!Yv.isPoint(e))throw new TypeError("Point is not on the curve");return new u(void 0,e,t,n,o,a,s)}t.fromBase58=function(e,t){const r=Tg.decode(e);if(78!==r.length)throw new TypeError("Invalid buffer length");t=t||i;const n=r.readUInt32BE(0);if(n!==t.bip32.private&&n!==t.bip32.public)throw new TypeError("Invalid network version");const o=r[4],a=r.readUInt32BE(5);if(0===o&&0!==a)throw new TypeError("Invalid parent fingerprint");const s=r.readUInt32BE(9);if(0===o&&0!==s)throw new TypeError("Invalid index");const c=r.slice(13,45);let u;if(n===t.bip32.private){if(0!==r.readUInt8(45))throw new TypeError("Invalid private key");u=l(r.slice(46,78),c,t,o,s,a)}else u=d(r.slice(45,78),c,t,o,s,a);return u},t.fromPrivateKey=f,t.fromPublicKey=function(e,t,r){return d(e,t,r)},t.fromSeed=function(e,t){if(Nw(Nw.Buffer,e),e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");t=t||i;const r=kg.hmacSHA512(te.from("Bitcoin seed","utf8"),e);return f(r.slice(0,32),r.slice(32),t)}}));R(Uw),Uw.fromBase58,Uw.fromPrivateKey,Uw.fromPublicKey,Uw.fromSeed;var Hw=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.fromSeed=Uw.fromSeed,t.fromBase58=Uw.fromBase58,t.fromPublicKey=Uw.fromPublicKey,t.fromPrivateKey=Uw.fromPrivateKey}));R(Hw),Hw.fromSeed,Hw.fromBase58,Hw.fromPublicKey,Hw.fromPrivateKey;var Fw=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},t.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},t.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}}));R(Fw),Fw.bitcoin,Fw.regtest,Fw.testnet;var Vw=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e,t,r){t=t||4,r=void 0===r||r;const n=e.length;if(0===n)return 0;if(n>t)throw new TypeError("Script number overflow");if(r&&0==(127&e[n-1])&&(n<=1||0==(128&e[n-2])))throw new Error("Non-minimally encoded script number");if(5===n){const t=e.readUInt32LE(0),r=e.readUInt8(4);return 128&r?-(4294967296*(-129&r)+t):4294967296*r+t}let i=0;for(let t=0;t<n;++t)i|=e[t]<<8*t;return 128&e[n-1]?-(i&~(128<<8*(n-1))):i},t.encode=function(e){let t=Math.abs(e);const r=(n=t)>2147483647?5:n>8388607?4:n>32767?3:n>127?2:n>0?1:0;var n;const i=te.allocUnsafe(r),o=e<0;for(let e=0;e<r;++e)i.writeUInt8(255&t,e),t>>=8;return 128&i[r-1]?i.writeUInt8(o?128:0,r-1):o&&(i[r-1]|=128),i}}));R(Vw),Vw.decode,Vw.encode;var qw=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=Math.pow(2,31)-1;function n(e){return Nw.String(e)&&!!e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}t.UInt31=function(e){return Nw.UInt32(e)&&e<=r},t.BIP32Path=n,n.toJSON=()=>"BIP32 derivation path",t.Signer=function(e){return(Nw.Buffer(e.publicKey)||"function"==typeof e.getPublicKey)&&"function"==typeof e.sign},t.Satoshi=function(e){return Nw.UInt53(e)&&e<=21e14},t.ECPoint=Nw.quacksLike("Point"),t.Network=Nw.compile({messagePrefix:Nw.oneOf(Nw.Buffer,Nw.String),bip32:{public:Nw.UInt32,private:Nw.UInt32},pubKeyHash:Nw.UInt8,scriptHash:Nw.UInt8,wif:Nw.UInt8}),t.Buffer256bit=Nw.BufferN(32),t.Hash160bit=Nw.BufferN(20),t.Hash256bit=Nw.BufferN(32),t.Number=Nw.Number,t.Array=Nw.Array,t.Boolean=Nw.Boolean,t.String=Nw.String,t.Buffer=Nw.Buffer,t.Hex=Nw.Hex,t.maybe=Nw.maybe,t.tuple=Nw.tuple,t.UInt8=Nw.UInt8,t.UInt32=Nw.UInt32,t.Function=Nw.Function,t.BufferN=Nw.BufferN,t.Null=Nw.Null,t.oneOf=Nw.oneOf}));R(qw),qw.UInt31,qw.BIP32Path,qw.Signer,qw.Satoshi,qw.ECPoint,qw.Network,qw.Buffer256bit,qw.Hash160bit,qw.Hash256bit,qw.Number,qw.Array,qw.Boolean,qw.String,qw.Buffer,qw.Hex,qw.maybe,qw.tuple,qw.UInt8,qw.UInt32,qw.Function,qw.BufferN,qw.Null,qw.oneOf;var zw=Zl.Buffer,Kw=function(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;var t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;var r=e[5+t];return!(0===r||6+t+r!==e.length||128&e[4]||t>1&&0===e[4]&&!(128&e[5])||128&e[t+6]||r>1&&0===e[t+6]&&!(128&e[t+7]))},Ww=function(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var r=e[5+t];if(0===r)throw new Error("S length is zero");if(6+t+r!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(r>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}},Jw=function(e,t){var r=e.length,n=t.length;if(0===r)throw new Error("R length is zero");if(0===n)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(n>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(r>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(n>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var i=zw.allocUnsafe(6+r+n);return i[0]=48,i[1]=i.length-2,i[2]=2,i[3]=e.length,e.copy(i,4),i[4+r]=2,i[5+r]=t.length,t.copy(i,6+r),i},Gw=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=te.alloc(1,0);function n(e){let t=0;for(;0===e[t];)++t;return t===e.length?r:128&(e=e.slice(t))[0]?te.concat([r,e],1+e.length):e}function i(e){0===e[0]&&(e=e.slice(1));const t=te.alloc(32,0),r=Math.max(0,32-e.length);return e.copy(t,r),t}t.decode=function(e){const t=e.readUInt8(e.length-1),r=-129&t;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);const n=Ww(e.slice(0,-1)),o=i(n.r),a=i(n.s);return{signature:te.concat([o,a],64),hashType:t}},t.encode=function(e,t){Nw({signature:qw.BufferN(64),hashType:qw.UInt8},{signature:e,hashType:t});const r=-129&t;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);const i=te.allocUnsafe(1);i.writeUInt8(t,0);const o=n(e.slice(0,32)),a=n(e.slice(32,64));return te.concat([Jw(o,a),i])}}));R(Gw),Gw.decode,Gw.encode;var Xw=L(Object.freeze({__proto__:null,OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255,default:{OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255}}));function $w(e){return e<Xw.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}var Yw={encodingLength:$w,encode:function(e,t,r){var n=$w(t);return 1===n?e.writeUInt8(t,r):2===n?(e.writeUInt8(Xw.OP_PUSHDATA1,r),e.writeUInt8(t,r+1)):3===n?(e.writeUInt8(Xw.OP_PUSHDATA2,r),e.writeUInt16LE(t,r+1)):(e.writeUInt8(Xw.OP_PUSHDATA4,r),e.writeUInt32LE(t,r+1)),n},decode:function(e,t){var r,n,i=e.readUInt8(t);if(i<Xw.OP_PUSHDATA1)r=i,n=1;else if(i===Xw.OP_PUSHDATA1){if(t+2>e.length)return null;r=e.readUInt8(t+1),n=2}else if(i===Xw.OP_PUSHDATA2){if(t+3>e.length)return null;r=e.readUInt16LE(t+1),n=3}else{if(t+5>e.length)return null;if(i!==Xw.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=e.readUInt32LE(t+1),n=5}return{opcode:i,number:r,size:n}}},Qw={};for(var Zw in Xw)Qw[Xw[Zw]]=Zw;var e_=Qw,t_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.OPS=Xw;const r=t.OPS.OP_RESERVED;function n(e){return qw.Buffer(e)||function(e){return qw.Number(e)&&(e===t.OPS.OP_0||e>=t.OPS.OP_1&&e<=t.OPS.OP_16||e===t.OPS.OP_1NEGATE)}(e)}function i(e){return qw.Array(e)&&e.every(n)}function o(e){return 0===e.length?t.OPS.OP_0:1===e.length?e[0]>=1&&e[0]<=16?r+e[0]:129===e[0]?t.OPS.OP_1NEGATE:void 0:void 0}function a(e){return De(e)}function s(e){return De(e)}function c(e){if(a(e))return e;Nw(qw.Array,e);const t=e.reduce(((e,t)=>s(t)?1===t.length&&void 0!==o(t)?e+1:e+Yw.encodingLength(t.length)+t.length:e+1),0),r=te.allocUnsafe(t);let n=0;if(e.forEach((e=>{if(s(e)){const t=o(e);if(void 0!==t)return r.writeUInt8(t,n),void(n+=1);n+=Yw.encode(r,e.length,n),e.copy(r,n),n+=e.length}else r.writeUInt8(e,n),n+=1})),n!==r.length)throw new Error("Could not decode chunks");return r}function u(e){if(r=e,qw.Array(r))return e;var r;Nw(qw.Buffer,e);const n=[];let i=0;for(;i<e.length;){const r=e[i];if(r>t.OPS.OP_0&&r<=t.OPS.OP_PUSHDATA4){const t=Yw.decode(e,i);if(null===t)return null;if(i+=t.size,i+t.number>e.length)return null;const r=e.slice(i,i+t.number);i+=t.number;const a=o(r);void 0!==a?n.push(a):n.push(r)}else n.push(r),i+=1}return n}function f(e){const t=-129&e;return t>0&&t<4}t.isPushOnly=i,t.compile=c,t.decompile=u,t.toASM=function(e){return a(e)&&(e=u(e)),e.map((e=>{if(s(e)){const t=o(e);if(void 0===t)return e.toString("hex");e=t}return e_[e]})).join(" ")},t.fromASM=function(e){return Nw(qw.String,e),c(e.split(" ").map((e=>void 0!==t.OPS[e]?t.OPS[e]:(Nw(qw.Hex,e),te.from(e,"hex")))))},t.toStack=function(e){return e=u(e),Nw(i,e),e.map((e=>s(e)?e:e===t.OPS.OP_0?te.allocUnsafe(0):Vw.encode(e-r)))},t.isCanonicalPubKey=function(e){return Yv.isPoint(e)},t.isDefinedHashType=f,t.isCanonicalScriptSignature=function(e){return!!De(e)&&!!f(e[e.length-1])&&Kw(e.slice(0,-1))},t.number=Vw,t.signature=Gw}));R(t_),t_.OPS,t_.isPushOnly,t_.compile,t_.decompile,t_.toASM,t_.fromASM,t_.toStack,t_.isCanonicalPubKey,t_.isDefinedHashType,t_.isCanonicalScriptSignature,t_.number,t_.signature;var r_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.prop=function(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=r.call(this);return this[t]=e,e},set(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})},t.value=function(e){let t;return()=>(void 0!==t||(t=e()),t)}}));R(r_),r_.prop,r_.value;var n_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_.OPS;t.p2data=function(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),Nw({network:Nw.maybe(Nw.Object),output:Nw.maybe(Nw.Buffer),data:Nw.maybe(Nw.arrayOf(Nw.Buffer))},e);const n={name:"embed",network:e.network||Fw.bitcoin};if(r_.prop(n,"output",(()=>{if(e.data)return t_.compile([r.OP_RETURN].concat(e.data))})),r_.prop(n,"data",(()=>{if(e.output)return t_.decompile(e.output).slice(1)})),t.validate&&e.output){const t=t_.decompile(e.output);if(t[0]!==r.OP_RETURN)throw new TypeError("Output is invalid");if(!t.slice(1).every(Nw.Buffer))throw new TypeError("Output is invalid");if(e.data&&!function(e,t){return e.length===t.length&&e.every(((e,r)=>e.equals(t[r])))}(e.data,n.data))throw new TypeError("Data mismatch")}return Object.assign(n,e)}}));R(n_),n_.p2data;var i_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_.OPS,n=r.OP_RESERVED;function i(e,t){return e.length===t.length&&e.every(((e,r)=>e.equals(t[r])))}t.p2ms=function(e,t){if(!(e.input||e.output||e.pubkeys&&void 0!==e.m||e.signatures))throw new TypeError("Not enough data");function o(e){return t_.isCanonicalScriptSignature(e)||void 0!==(t.allowIncomplete&&e===r.OP_0)}t=Object.assign({validate:!0},t||{}),Nw({network:Nw.maybe(Nw.Object),m:Nw.maybe(Nw.Number),n:Nw.maybe(Nw.Number),output:Nw.maybe(Nw.Buffer),pubkeys:Nw.maybe(Nw.arrayOf(Yv.isPoint)),signatures:Nw.maybe(Nw.arrayOf(o)),input:Nw.maybe(Nw.Buffer)},e);const a={network:e.network||Fw.bitcoin};let s=[],c=!1;function u(e){c||(c=!0,s=t_.decompile(e),a.m=s[0]-n,a.n=s[s.length-2]-n,a.pubkeys=s.slice(1,-2))}if(r_.prop(a,"output",(()=>{if(e.m&&a.n&&e.pubkeys)return t_.compile([].concat(n+e.m,e.pubkeys,n+a.n,r.OP_CHECKMULTISIG))})),r_.prop(a,"m",(()=>{if(a.output)return u(a.output),a.m})),r_.prop(a,"n",(()=>{if(a.pubkeys)return a.pubkeys.length})),r_.prop(a,"pubkeys",(()=>{if(e.output)return u(e.output),a.pubkeys})),r_.prop(a,"signatures",(()=>{if(e.input)return t_.decompile(e.input).slice(1)})),r_.prop(a,"input",(()=>{if(e.signatures)return t_.compile([r.OP_0].concat(e.signatures))})),r_.prop(a,"witness",(()=>{if(a.input)return[]})),r_.prop(a,"name",(()=>{if(a.m&&a.n)return`p2ms(${a.m} of ${a.n})`})),t.validate){if(e.output){if(u(e.output),!Nw.Number(s[0]))throw new TypeError("Output is invalid");if(!Nw.Number(s[s.length-2]))throw new TypeError("Output is invalid");if(s[s.length-1]!==r.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(a.m<=0||a.n>16||a.m>a.n||a.n!==s.length-3)throw new TypeError("Output is invalid");if(!a.pubkeys.every((e=>Yv.isPoint(e))))throw new TypeError("Output is invalid");if(void 0!==e.m&&e.m!==a.m)throw new TypeError("m mismatch");if(void 0!==e.n&&e.n!==a.n)throw new TypeError("n mismatch");if(e.pubkeys&&!i(e.pubkeys,a.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(a.n=e.pubkeys.length,a.n<a.m)throw new TypeError("Pubkey count cannot be less than m")}if(e.signatures){if(e.signatures.length<a.m)throw new TypeError("Not enough signatures provided");if(e.signatures.length>a.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==r.OP_0)throw new TypeError("Input is invalid");if(0===a.signatures.length||!a.signatures.every(o))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!i(e.signatures,a.signatures))throw new TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(a,e)}}));R(i_),i_.p2ms;var o_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_.OPS;t.p2pk=function(e,t){if(!(e.input||e.output||e.pubkey||e.input||e.signature))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),Nw({network:Nw.maybe(Nw.Object),output:Nw.maybe(Nw.Buffer),pubkey:Nw.maybe(Yv.isPoint),signature:Nw.maybe(t_.isCanonicalScriptSignature),input:Nw.maybe(Nw.Buffer)},e);const n=r_.value((()=>t_.decompile(e.input))),i={name:"p2pk",network:e.network||Fw.bitcoin};if(r_.prop(i,"output",(()=>{if(e.pubkey)return t_.compile([e.pubkey,r.OP_CHECKSIG])})),r_.prop(i,"pubkey",(()=>{if(e.output)return e.output.slice(1,-1)})),r_.prop(i,"signature",(()=>{if(e.input)return n()[0]})),r_.prop(i,"input",(()=>{if(e.signature)return t_.compile([e.signature])})),r_.prop(i,"witness",(()=>{if(i.input)return[]})),t.validate){if(e.output){if(e.output[e.output.length-1]!==r.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!Yv.isPoint(i.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(i.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(i.input))throw new TypeError("Signature mismatch");if(e.input){if(1!==n().length)throw new TypeError("Input is invalid");if(!t_.isCanonicalScriptSignature(i.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(i,e)}}));R(o_),o_.p2pk;var a_=N((function(e,t){function r(e){try{return pg("rmd160").update(e).digest()}catch(t){return pg("ripemd160").update(e).digest()}}function n(e){return pg("sha256").update(e).digest()}Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=r,t.sha1=function(e){return pg("sha1").update(e).digest()},t.sha256=n,t.hash160=function(e){return r(n(e))},t.hash256=function(e){return n(n(e))}}));R(a_),a_.ripemd160,a_.sha1,a_.sha256,a_.hash160,a_.hash256;var s_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_.OPS;t.p2pkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),Nw({network:Nw.maybe(Nw.Object),address:Nw.maybe(Nw.String),hash:Nw.maybe(Nw.BufferN(20)),output:Nw.maybe(Nw.BufferN(25)),pubkey:Nw.maybe(Yv.isPoint),signature:Nw.maybe(t_.isCanonicalScriptSignature),input:Nw.maybe(Nw.Buffer)},e);const n=r_.value((()=>{const t=Tg.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),i=r_.value((()=>t_.decompile(e.input))),o=e.network||Fw.bitcoin,a={name:"p2pkh",network:o};if(r_.prop(a,"address",(()=>{if(!a.hash)return;const e=te.allocUnsafe(21);return e.writeUInt8(o.pubKeyHash,0),a.hash.copy(e,1),Tg.encode(e)})),r_.prop(a,"hash",(()=>e.output?e.output.slice(3,23):e.address?n().hash:e.pubkey||a.pubkey?a_.hash160(e.pubkey||a.pubkey):void 0)),r_.prop(a,"output",(()=>{if(a.hash)return t_.compile([r.OP_DUP,r.OP_HASH160,a.hash,r.OP_EQUALVERIFY,r.OP_CHECKSIG])})),r_.prop(a,"pubkey",(()=>{if(e.input)return i()[1]})),r_.prop(a,"signature",(()=>{if(e.input)return i()[0]})),r_.prop(a,"input",(()=>{if(e.pubkey&&e.signature)return t_.compile([e.signature,e.pubkey])})),r_.prop(a,"witness",(()=>{if(a.input)return[]})),t.validate){let t=te.from([]);if(e.address){if(n().version!==o.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==n().hash.length)throw new TypeError("Invalid address");t=n().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==r.OP_DUP||e.output[1]!==r.OP_HASH160||20!==e.output[2]||e.output[23]!==r.OP_EQUALVERIFY||e.output[24]!==r.OP_CHECKSIG)throw new TypeError("Output is invalid");const n=e.output.slice(3,23);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.pubkey){const r=a_.hash160(e.pubkey);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.input){const r=i();if(2!==r.length)throw new TypeError("Input is invalid");if(!t_.isCanonicalScriptSignature(r[0]))throw new TypeError("Input has invalid signature");if(!Yv.isPoint(r[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(r[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(r[1]))throw new TypeError("Pubkey mismatch");const n=a_.hash160(r[1]);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(a,e)}}));R(s_),s_.p2pkh;var c_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_.OPS;t.p2sh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),Nw({network:Nw.maybe(Nw.Object),address:Nw.maybe(Nw.String),hash:Nw.maybe(Nw.BufferN(20)),output:Nw.maybe(Nw.BufferN(23)),redeem:Nw.maybe({network:Nw.maybe(Nw.Object),output:Nw.maybe(Nw.Buffer),input:Nw.maybe(Nw.Buffer),witness:Nw.maybe(Nw.arrayOf(Nw.Buffer))}),input:Nw.maybe(Nw.Buffer),witness:Nw.maybe(Nw.arrayOf(Nw.Buffer))},e);let n=e.network;n||(n=e.redeem&&e.redeem.network||Fw.bitcoin);const i={network:n},o=r_.value((()=>{const t=Tg.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),a=r_.value((()=>t_.decompile(e.input))),s=r_.value((()=>{const t=a();return{network:n,output:t[t.length-1],input:t_.compile(t.slice(0,-1)),witness:e.witness||[]}}));if(r_.prop(i,"address",(()=>{if(!i.hash)return;const e=te.allocUnsafe(21);return e.writeUInt8(i.network.scriptHash,0),i.hash.copy(e,1),Tg.encode(e)})),r_.prop(i,"hash",(()=>e.output?e.output.slice(2,22):e.address?o().hash:i.redeem&&i.redeem.output?a_.hash160(i.redeem.output):void 0)),r_.prop(i,"output",(()=>{if(i.hash)return t_.compile([r.OP_HASH160,i.hash,r.OP_EQUAL])})),r_.prop(i,"redeem",(()=>{if(e.input)return s()})),r_.prop(i,"input",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.output)return t_.compile([].concat(t_.decompile(e.redeem.input),e.redeem.output))})),r_.prop(i,"witness",(()=>i.redeem&&i.redeem.witness?i.redeem.witness:i.input?[]:void 0)),r_.prop(i,"name",(()=>{const e=["p2sh"];return void 0!==i.redeem&&e.push(i.redeem.name),e.join("-")})),t.validate){let t=te.from([]);if(e.address){if(o().version!==n.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==o().hash.length)throw new TypeError("Invalid address");t=o().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(23!==e.output.length||e.output[0]!==r.OP_HASH160||20!==e.output[1]||e.output[22]!==r.OP_EQUAL)throw new TypeError("Output is invalid");const n=e.output.slice(2,22);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}const i=e=>{if(e.output){const r=t_.decompile(e.output);if(!r||r.length<1)throw new TypeError("Redeem.output too short");const n=a_.hash160(e.output);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.input){const t=e.input.length>0,r=e.witness&&e.witness.length>0;if(!t&&!r)throw new TypeError("Empty input");if(t&&r)throw new TypeError("Input and witness provided");if(t){const t=t_.decompile(e.input);if(!t_.isPushOnly(t))throw new TypeError("Non push-only scriptSig")}}};if(e.input){const e=a();if(!e||e.length<1)throw new TypeError("Input too short");if(!De(s().output))throw new TypeError("Input is invalid");i(s())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==n)throw new TypeError("Network mismatch");if(e.input){const t=s();if(e.redeem.output&&!e.redeem.output.equals(t.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(t.input))throw new TypeError("Redeem.input mismatch")}i(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every(((e,r)=>e.equals(t[r])))}(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(i,e)}}));R(c_),c_.p2sh;for(var u_="qpzry9x8gf2tvdw0s3jn54khce6mua7l",f_={},l_=0;l_<32;l_++){var d_=u_.charAt(l_);if(void 0!==f_[d_])throw new TypeError(d_+" is ambiguous");f_[d_]=l_}function h_(e){var t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function p_(e){for(var t=1,r=0;r<e.length;++r){var n=e.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+e+")";t=h_(t)^n>>5}for(t=h_(t),r=0;r<e.length;++r){var i=e.charCodeAt(r);t=h_(t)^31&i}return t}function b_(e,t){if(t=t||90,e.length<8)return e+" too short";if(e.length>t)return"Exceeds length limit";var r=e.toLowerCase(),n=e.toUpperCase();if(e!==r&&e!==n)return"Mixed-case string "+e;var i=(e=r).lastIndexOf("1");if(-1===i)return"No separator character for "+e;if(0===i)return"Missing prefix for "+e;var o=e.slice(0,i),a=e.slice(i+1);if(a.length<6)return"Data too short";var s=p_(o);if("string"==typeof s)return s;for(var c=[],u=0;u<a.length;++u){var f=a.charAt(u),l=f_[f];if(void 0===l)return"Unknown character "+f;s=h_(s)^l,u+6>=a.length||c.push(l)}return 1!==s?"Invalid checksum for "+e:{prefix:o,words:c}}function g_(e,t,r,n){for(var i=0,o=0,a=(1<<r)-1,s=[],c=0;c<e.length;++c)for(i=i<<t|e[c],o+=t;o>=r;)o-=r,s.push(i>>o&a);if(n)o>0&&s.push(i<<r-o&a);else{if(o>=t)return"Excess padding";if(i<<r-o&a)return"Non-zero padding"}return s}var y_=function(e){var t=b_.apply(null,arguments);if("object"==typeof t)return t;throw new Error(t)},m_=function(e,t,r){if(r=r||90,e.length+7+t.length>r)throw new TypeError("Exceeds length limit");var n=p_(e=e.toLowerCase());if("string"==typeof n)throw new Error(n);for(var i=e+"1",o=0;o<t.length;++o){var a=t[o];if(a>>5!=0)throw new Error("Non 5-bit word");n=h_(n)^a,i+=u_.charAt(a)}for(o=0;o<6;++o)n=h_(n);for(n^=1,o=0;o<6;++o)i+=u_.charAt(n>>5*(5-o)&31);return i},v_=function(e){var t=g_(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},w_=function(e){var t=g_(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)},__=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_.OPS,n=te.alloc(0);t.p2wpkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),Nw({address:Nw.maybe(Nw.String),hash:Nw.maybe(Nw.BufferN(20)),input:Nw.maybe(Nw.BufferN(0)),network:Nw.maybe(Nw.Object),output:Nw.maybe(Nw.BufferN(22)),pubkey:Nw.maybe(Yv.isPoint),signature:Nw.maybe(t_.isCanonicalScriptSignature),witness:Nw.maybe(Nw.arrayOf(Nw.Buffer))},e);const i=r_.value((()=>{const t=y_(e.address),r=t.words.shift(),n=w_(t.words);return{version:r,prefix:t.prefix,data:te.from(n)}})),o=e.network||Fw.bitcoin,a={name:"p2wpkh",network:o};if(r_.prop(a,"address",(()=>{if(!a.hash)return;const e=v_(a.hash);return e.unshift(0),m_(o.bech32,e)})),r_.prop(a,"hash",(()=>e.output?e.output.slice(2,22):e.address?i().data:e.pubkey||a.pubkey?a_.hash160(e.pubkey||a.pubkey):void 0)),r_.prop(a,"output",(()=>{if(a.hash)return t_.compile([r.OP_0,a.hash])})),r_.prop(a,"pubkey",(()=>e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0)),r_.prop(a,"signature",(()=>{if(e.witness)return e.witness[0]})),r_.prop(a,"input",(()=>{if(a.witness)return n})),r_.prop(a,"witness",(()=>{if(e.pubkey&&e.signature)return[e.signature,e.pubkey]})),t.validate){let t=te.from([]);if(e.address){if(o&&o.bech32!==i().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==i().version)throw new TypeError("Invalid address version");if(20!==i().data.length)throw new TypeError("Invalid address data");t=i().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(22!==e.output.length||e.output[0]!==r.OP_0||20!==e.output[1])throw new TypeError("Output is invalid");if(t.length>0&&!t.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");t=e.output.slice(2)}if(e.pubkey){const r=a_.hash160(e.pubkey);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");if(t=r,!Yv.isPoint(e.pubkey)||33!==e.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(2!==e.witness.length)throw new TypeError("Witness is invalid");if(!t_.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!Yv.isPoint(e.witness[1])||33!==e.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");const r=a_.hash160(e.witness[1]);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch")}}return Object.assign(a,e)}}));R(__),__.p2wpkh;var S_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_.OPS,n=te.alloc(0);function i(e){return!(!De(e)||65!==e.length||4!==e[0]||!Yv.isPoint(e))}t.p2wsh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),Nw({network:Nw.maybe(Nw.Object),address:Nw.maybe(Nw.String),hash:Nw.maybe(Nw.BufferN(32)),output:Nw.maybe(Nw.BufferN(34)),redeem:Nw.maybe({input:Nw.maybe(Nw.Buffer),network:Nw.maybe(Nw.Object),output:Nw.maybe(Nw.Buffer),witness:Nw.maybe(Nw.arrayOf(Nw.Buffer))}),input:Nw.maybe(Nw.BufferN(0)),witness:Nw.maybe(Nw.arrayOf(Nw.Buffer))},e);const o=r_.value((()=>{const t=y_(e.address),r=t.words.shift(),n=w_(t.words);return{version:r,prefix:t.prefix,data:te.from(n)}})),a=r_.value((()=>t_.decompile(e.redeem.input)));let s=e.network;s||(s=e.redeem&&e.redeem.network||Fw.bitcoin);const c={network:s};if(r_.prop(c,"address",(()=>{if(!c.hash)return;const e=v_(c.hash);return e.unshift(0),m_(s.bech32,e)})),r_.prop(c,"hash",(()=>e.output?e.output.slice(2):e.address?o().data:c.redeem&&c.redeem.output?a_.sha256(c.redeem.output):void 0)),r_.prop(c,"output",(()=>{if(c.hash)return t_.compile([r.OP_0,c.hash])})),r_.prop(c,"redeem",(()=>{if(e.witness)return{output:e.witness[e.witness.length-1],input:n,witness:e.witness.slice(0,-1)}})),r_.prop(c,"input",(()=>{if(c.witness)return n})),r_.prop(c,"witness",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){const t=t_.toStack(a());return c.redeem=Object.assign({witness:t},e.redeem),c.redeem.input=n,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)})),r_.prop(c,"name",(()=>{const e=["p2wsh"];return void 0!==c.redeem&&e.push(c.redeem.name),e.join("-")})),t.validate){let t=te.from([]);if(e.address){if(o().prefix!==s.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==o().version)throw new TypeError("Invalid address version");if(32!==o().data.length)throw new TypeError("Invalid address data");t=o().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(34!==e.output.length||e.output[0]!==r.OP_0||32!==e.output[1])throw new TypeError("Output is invalid");const n=e.output.slice(2);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.redeem){if(e.redeem.network&&e.redeem.network!==s)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){if(0===t_.decompile(e.redeem.output).length)throw new TypeError("Redeem.output is invalid");const r=a_.sha256(e.redeem.output);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.redeem.input&&!t_.isPushOnly(a()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every(((e,r)=>e.equals(t[r])))}(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&a().some(i)||e.redeem.output&&(t_.decompile(e.redeem.output)||[]).some(i))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){const t=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&!e.redeem.output.equals(t))throw new TypeError("Witness and redeem.output mismatch");if(e.witness.some(i)||(t_.decompile(t)||[]).some(i))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(c,e)}}));R(S_),S_.p2wsh;var x_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.embed=n_.p2data,t.p2ms=i_.p2ms,t.p2pk=o_.p2pk,t.p2pkh=s_.p2pkh,t.p2sh=c_.p2sh,t.p2wpkh=__.p2wpkh,t.p2wsh=S_.p2wsh}));R(x_),x_.embed,x_.p2ms,x_.p2pk,x_.p2pkh,x_.p2sh,x_.p2wpkh,x_.p2wsh;var k_=N((function(e,t){function r(e){const t=Tg.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");return{version:t.readUInt8(0),hash:t.slice(1)}}function n(e){const t=y_(e),r=w_(t.words.slice(1));return{version:t.words[0],prefix:t.prefix,data:te.from(r)}}Object.defineProperty(t,"__esModule",{value:!0}),t.fromBase58Check=r,t.fromBech32=n,t.toBase58Check=function(e,t){Nw(qw.tuple(qw.Hash160bit,qw.UInt8),arguments);const r=te.allocUnsafe(21);return r.writeUInt8(t,0),e.copy(r,1),Tg.encode(r)},t.toBech32=function(e,t,r){const n=v_(e);return n.unshift(t),m_(r,n)},t.fromOutputScript=function(e,t){t=t||Fw.bitcoin;try{return x_.p2pkh({output:e,network:t}).address}catch(e){}try{return x_.p2sh({output:e,network:t}).address}catch(e){}try{return x_.p2wpkh({output:e,network:t}).address}catch(e){}try{return x_.p2wsh({output:e,network:t}).address}catch(e){}throw new Error(t_.toASM(e)+" has no matching Address")},t.toOutputScript=function(e,t){let i,o;t=t||Fw.bitcoin;try{i=r(e)}catch(e){}if(i){if(i.version===t.pubKeyHash)return x_.p2pkh({hash:i.hash}).output;if(i.version===t.scriptHash)return x_.p2sh({hash:i.hash}).output}else{try{o=n(e)}catch(e){}if(o){if(o.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===o.version){if(20===o.data.length)return x_.p2wpkh({hash:o.data}).output;if(32===o.data.length)return x_.p2wsh({hash:o.data}).output}}}throw new Error(e+" has no matching Script")}}));R(k_),k_.fromBase58Check,k_.fromBech32,k_.toBase58Check,k_.toBech32,k_.fromOutputScript,k_.toOutputScript;var E_=N((function(e){var t=65536,r=Zl.Buffer,n=M.crypto||M.msCrypto;n&&n.getRandomValues?e.exports=function(e,i){if(e>4294967295)throw new RangeError("requested too many random bytes");var o=r.allocUnsafe(e);if(e>0)if(e>t)for(var a=0;a<e;a+=t)n.getRandomValues(o.slice(a,a+t));else n.getRandomValues(o);return"function"==typeof i?Ye((function(){i(null,o)})):o}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}})),I_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=Nw.maybe(Nw.compile({compressed:qw.maybe(qw.Boolean),network:qw.maybe(qw.Network)}));class n{constructor(e,t,r){this.__D=e,this.__Q=t,this.lowR=!1,void 0===r&&(r={}),this.compressed=void 0===r.compressed||r.compressed,this.network=r.network||Fw.bitcoin,void 0!==t&&(this.__Q=Yv.pointCompress(t,this.compressed))}get privateKey(){return this.__D}get publicKey(){return this.__Q||(this.__Q=Yv.pointFromScalar(this.__D,this.compressed)),this.__Q}toWIF(){if(!this.__D)throw new Error("Missing private key");return Bw(this.network.wif,this.__D,this.compressed)}sign(e,t){if(!this.__D)throw new Error("Missing private key");if(void 0===t&&(t=this.lowR),!1===t)return Yv.sign(e,this.__D);{let t=Yv.sign(e,this.__D);const r=te.alloc(32,0);let n=0;for(;t[0]>127;)n++,r.writeUIntLE(n,0,6),t=Yv.signWithEntropy(e,this.__D,r);return t}}verify(e,t){return Yv.verify(e,this.publicKey,t)}}function i(e,t){if(Nw(qw.Buffer256bit,e),!Yv.isPrivate(e))throw new TypeError("Private key not in range [1, n)");return Nw(r,t),new n(e,void 0,t)}t.fromPrivateKey=i,t.fromPublicKey=function(e,t){return Nw(Yv.isPoint,e),Nw(r,t),new n(void 0,e,t)},t.fromWIF=function(e,t){const r=Dw(e),n=r.version;if(qw.Array(t)){if(!(t=t.filter((e=>n===e.wif)).pop()))throw new Error("Unknown network version")}else if(t=t||Fw.bitcoin,n!==t.wif)throw new Error("Invalid network version");return i(r.privateKey,{compressed:r.compressed,network:t})},t.makeRandom=function(e){Nw(r,e),void 0===e&&(e={});const t=e.rng||E_;let n;do{n=t(32),Nw(qw.Buffer256bit,n)}while(!Yv.isPrivate(n));return i(n,e)}}));R(I_),I_.fromPrivateKey,I_.fromPublicKey,I_.fromWIF,I_.makeRandom;var O_=Zl.Buffer;function T_(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function A_(e){return T_(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var P_={encode:function e(t,r,n){if(T_(t),r||(r=O_.allocUnsafe(A_(t))),!O_.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return n||(n=0),t<253?(r.writeUInt8(t,n),e.bytes=1):t<=65535?(r.writeUInt8(253,n),r.writeUInt16LE(t,n+1),e.bytes=3):t<=4294967295?(r.writeUInt8(254,n),r.writeUInt32LE(t,n+1),e.bytes=5):(r.writeUInt8(255,n),r.writeUInt32LE(t>>>0,n+1),r.writeUInt32LE(t/4294967296|0,n+5),e.bytes=9),r},decode:function e(t,r){if(!O_.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var n=t.readUInt8(r);if(n<253)return e.bytes=1,n;if(253===n)return e.bytes=3,t.readUInt16LE(r+1);if(254===n)return e.bytes=5,t.readUInt32LE(r+1);e.bytes=9;var i=t.readUInt32LE(r+1),o=4294967296*t.readUInt32LE(r+5)+i;return T_(o),o},encodingLength:A_},C_=N((function(e,t){function r(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function n(e,t){const n=e.readUInt32LE(t);let i=e.readUInt32LE(t+4);return i*=4294967296,r(i+n,9007199254740991),i+n}function i(e,t,n){return r(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8}Object.defineProperty(t,"__esModule",{value:!0}),t.readUInt64LE=n,t.writeUInt64LE=i,t.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,r=0;for(let n=0;n<e.length/2;n++)r=e[n],e[n]=e[t],e[t]=r,t--;return e},t.cloneBuffer=function(e){const t=te.allocUnsafe(e.length);return e.copy(t),t},t.BufferWriter=class{constructor(e,t=0){this.buffer=e,this.offset=t,Nw(qw.tuple(qw.Buffer,qw.UInt32),[e,t])}writeUInt8(e){this.offset=this.buffer.writeUInt8(e,this.offset)}writeInt32(e){this.offset=this.buffer.writeInt32LE(e,this.offset)}writeUInt32(e){this.offset=this.buffer.writeUInt32LE(e,this.offset)}writeUInt64(e){this.offset=i(this.buffer,e,this.offset)}writeVarInt(e){P_.encode(e,this.buffer,this.offset),this.offset+=P_.encode.bytes}writeSlice(e){if(this.buffer.length<this.offset+e.length)throw new Error("Cannot write slice out of bounds");this.offset+=e.copy(this.buffer,this.offset)}writeVarSlice(e){this.writeVarInt(e.length),this.writeSlice(e)}writeVector(e){this.writeVarInt(e.length),e.forEach((e=>this.writeVarSlice(e)))}},t.BufferReader=class{constructor(e,t=0){this.buffer=e,this.offset=t,Nw(qw.tuple(qw.Buffer,qw.UInt32),[e,t])}readUInt8(){const e=this.buffer.readUInt8(this.offset);return this.offset++,e}readInt32(){const e=this.buffer.readInt32LE(this.offset);return this.offset+=4,e}readUInt32(){const e=this.buffer.readUInt32LE(this.offset);return this.offset+=4,e}readUInt64(){const e=n(this.buffer,this.offset);return this.offset+=8,e}readVarInt(){const e=P_.decode(this.buffer,this.offset);return this.offset+=P_.decode.bytes,e}readSlice(e){if(this.buffer.length<this.offset+e)throw new Error("Cannot read slice out of bounds");const t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const e=this.readVarInt(),t=[];for(let r=0;r<e;r++)t.push(this.readVarSlice());return t}}}));R(C_),C_.readUInt64LE,C_.writeUInt64LE,C_.reverseBuffer,C_.cloneBuffer,C_.BufferWriter,C_.BufferReader;var M_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_;function n(e){const t=e.length;return P_.encodingLength(t)+t}const i=te.allocUnsafe(0),o=[],a=te.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),s=te.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),c=te.from("ffffffffffffffff","hex"),u={script:i,valueBuffer:c};class f{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(e,t){const r=new C_.BufferReader(e),n=new f;n.version=r.readInt32();const i=r.readUInt8(),a=r.readUInt8();let s=!1;i===f.ADVANCED_TRANSACTION_MARKER&&a===f.ADVANCED_TRANSACTION_FLAG?s=!0:r.offset-=2;const c=r.readVarInt();for(let e=0;e<c;++e)n.ins.push({hash:r.readSlice(32),index:r.readUInt32(),script:r.readVarSlice(),sequence:r.readUInt32(),witness:o});const u=r.readVarInt();for(let e=0;e<u;++e)n.outs.push({value:r.readUInt64(),script:r.readVarSlice()});if(s){for(let e=0;e<c;++e)n.ins[e].witness=r.readVector();if(!n.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(n.locktime=r.readUInt32(),t)return n;if(r.offset!==e.length)throw new Error("Transaction has unexpected data");return n}static fromHex(e){return f.fromBuffer(te.from(e,"hex"),!1)}static isCoinbaseHash(e){Nw(qw.Hash256bit,e);for(let t=0;t<32;++t)if(0!==e[t])return!1;return!0}isCoinbase(){return 1===this.ins.length&&f.isCoinbaseHash(this.ins[0].hash)}addInput(e,t,r,n){return Nw(qw.tuple(qw.Hash256bit,qw.UInt32,qw.maybe(qw.UInt32),qw.maybe(qw.Buffer)),arguments),qw.Null(r)&&(r=f.DEFAULT_SEQUENCE),this.ins.push({hash:e,index:t,script:n||i,sequence:r,witness:o})-1}addOutput(e,t){return Nw(qw.tuple(qw.Buffer,qw.Satoshi),arguments),this.outs.push({script:e,value:t})-1}hasWitnesses(){return this.ins.some((e=>0!==e.witness.length))}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(e=!0){const t=e&&this.hasWitnesses();return(t?10:8)+P_.encodingLength(this.ins.length)+P_.encodingLength(this.outs.length)+this.ins.reduce(((e,t)=>e+40+n(t.script)),0)+this.outs.reduce(((e,t)=>e+8+n(t.script)),0)+(t?this.ins.reduce(((e,t)=>e+function(e){const t=e.length;return P_.encodingLength(t)+e.reduce(((e,t)=>e+n(t)),0)}(t.witness)),0):0)}clone(){const e=new f;return e.version=this.version,e.locktime=this.locktime,e.ins=this.ins.map((e=>({hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness}))),e.outs=this.outs.map((e=>({script:e.script,value:e.value}))),e}hashForSignature(e,t,n){if(Nw(qw.tuple(qw.UInt32,qw.Buffer,qw.Number),arguments),e>=this.ins.length)return s;const o=t_.compile(t_.decompile(t).filter((e=>e!==r.OPS.OP_CODESEPARATOR))),a=this.clone();if((31&n)===f.SIGHASH_NONE)a.outs=[],a.ins.forEach(((t,r)=>{r!==e&&(t.sequence=0)}));else if((31&n)===f.SIGHASH_SINGLE){if(e>=this.outs.length)return s;a.outs.length=e+1;for(let t=0;t<e;t++)a.outs[t]=u;a.ins.forEach(((t,r)=>{r!==e&&(t.sequence=0)}))}n&f.SIGHASH_ANYONECANPAY?(a.ins=[a.ins[e]],a.ins[0].script=o):(a.ins.forEach((e=>{e.script=i})),a.ins[e].script=o);const c=te.allocUnsafe(a.byteLength(!1)+4);return c.writeInt32LE(n,c.length-4),a.__toBuffer(c,0,!1),a_.hash256(c)}hashForWitnessV0(e,t,r,i){Nw(qw.tuple(qw.UInt32,qw.Buffer,qw.Satoshi,qw.UInt32),arguments);let o,s=te.from([]),c=a,u=a,l=a;if(i&f.SIGHASH_ANYONECANPAY||(s=te.allocUnsafe(36*this.ins.length),o=new C_.BufferWriter(s,0),this.ins.forEach((e=>{o.writeSlice(e.hash),o.writeUInt32(e.index)})),u=a_.hash256(s)),i&f.SIGHASH_ANYONECANPAY||(31&i)===f.SIGHASH_SINGLE||(31&i)===f.SIGHASH_NONE||(s=te.allocUnsafe(4*this.ins.length),o=new C_.BufferWriter(s,0),this.ins.forEach((e=>{o.writeUInt32(e.sequence)})),l=a_.hash256(s)),(31&i)!==f.SIGHASH_SINGLE&&(31&i)!==f.SIGHASH_NONE){const e=this.outs.reduce(((e,t)=>e+8+n(t.script)),0);s=te.allocUnsafe(e),o=new C_.BufferWriter(s,0),this.outs.forEach((e=>{o.writeUInt64(e.value),o.writeVarSlice(e.script)})),c=a_.hash256(s)}else if((31&i)===f.SIGHASH_SINGLE&&e<this.outs.length){const t=this.outs[e];s=te.allocUnsafe(8+n(t.script)),o=new C_.BufferWriter(s,0),o.writeUInt64(t.value),o.writeVarSlice(t.script),c=a_.hash256(s)}s=te.allocUnsafe(156+n(t)),o=new C_.BufferWriter(s,0);const d=this.ins[e];return o.writeUInt32(this.version),o.writeSlice(u),o.writeSlice(l),o.writeSlice(d.hash),o.writeUInt32(d.index),o.writeVarSlice(t),o.writeUInt64(r),o.writeUInt32(d.sequence),o.writeSlice(c),o.writeUInt32(this.locktime),o.writeUInt32(i),a_.hash256(s)}getHash(e){return e&&this.isCoinbase()?te.alloc(32,0):a_.hash256(this.__toBuffer(void 0,void 0,e))}getId(){return C_.reverseBuffer(this.getHash(!1)).toString("hex")}toBuffer(e,t){return this.__toBuffer(e,t,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(e,t){Nw(qw.tuple(qw.Number,qw.Buffer),arguments),this.ins[e].script=t}setWitness(e,t){Nw(qw.tuple(qw.Number,[qw.Buffer]),arguments),this.ins[e].witness=t}__toBuffer(e,t,r=!1){e||(e=te.allocUnsafe(this.byteLength(r)));const n=new C_.BufferWriter(e,t||0);n.writeInt32(this.version);const i=r&&this.hasWitnesses();return i&&(n.writeUInt8(f.ADVANCED_TRANSACTION_MARKER),n.writeUInt8(f.ADVANCED_TRANSACTION_FLAG)),n.writeVarInt(this.ins.length),this.ins.forEach((e=>{n.writeSlice(e.hash),n.writeUInt32(e.index),n.writeVarSlice(e.script),n.writeUInt32(e.sequence)})),n.writeVarInt(this.outs.length),this.outs.forEach((e=>{void 0!==e.value?n.writeUInt64(e.value):n.writeSlice(e.valueBuffer),n.writeVarSlice(e.script)})),i&&this.ins.forEach((e=>{n.writeVector(e.witness)})),n.writeUInt32(this.locktime),void 0!==t?e.slice(t,n.offset):e}}f.DEFAULT_SEQUENCE=4294967295,f.SIGHASH_ALL=1,f.SIGHASH_NONE=2,f.SIGHASH_SINGLE=3,f.SIGHASH_ANYONECANPAY=128,f.ADVANCED_TRANSACTION_MARKER=0,f.ADVANCED_TRANSACTION_FLAG=1,t.Transaction=f}));R(M_),M_.Transaction;var R_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=new TypeError("Cannot compute merkle root for zero transactions"),n=new TypeError("Cannot compute witness commit for non-segwit block");class i{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(e){if(e.length<80)throw new Error("Buffer too small (< 80 bytes)");const t=new C_.BufferReader(e),r=new i;if(r.version=t.readInt32(),r.prevHash=t.readSlice(32),r.merkleRoot=t.readSlice(32),r.timestamp=t.readUInt32(),r.bits=t.readUInt32(),r.nonce=t.readUInt32(),80===e.length)return r;const n=()=>{const e=M_.Transaction.fromBuffer(t.buffer.slice(t.offset),!0);return t.offset+=e.byteLength(),e},o=t.readVarInt();r.transactions=[];for(let e=0;e<o;++e){const e=n();r.transactions.push(e)}const a=r.getWitnessCommit();return a&&(r.witnessCommit=a),r}static fromHex(e){return i.fromBuffer(te.from(e,"hex"))}static calculateTarget(e){const t=((4278190080&e)>>24)-3,r=8388607&e,n=te.alloc(32,0);return n.writeUIntBE(r,29-t,3),n}static calculateMerkleRoot(e,t){if(Nw([{getHash:qw.Function}],e),0===e.length)throw r;if(t&&!o(e))throw n;const i=function(e,t){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof t)throw TypeError("Expected digest Function");for(var r=e.length,n=e.concat();r>1;){for(var i=0,o=0;o<r;o+=2,++i){var a=n[o],s=o+1===r?a:n[o+1],c=te.concat([a,s]);n[i]=t(c)}r=i}return n[0]}(e.map((e=>e.getHash(t))),a_.hash256);return t?a_.hash256(te.concat([i,e[0].ins[0].witness[0]])):i}getWitnessCommit(){if(!o(this.transactions))return null;const e=this.transactions[0].outs.filter((e=>e.script.slice(0,6).equals(te.from("6a24aa21a9ed","hex")))).map((e=>e.script.slice(6,38)));if(0===e.length)return null;const t=e[e.length-1];return t instanceof te&&32===t.length?t:null}hasWitnessCommit(){return this.witnessCommit instanceof te&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(e=this.transactions)instanceof Array&&e.some((e=>"object"==typeof e&&e.ins instanceof Array&&e.ins.some((e=>"object"==typeof e&&e.witness instanceof Array&&e.witness.length>0))));var e}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(e,t=!0){return e||!this.transactions?80:80+P_.encodingLength(this.transactions.length)+this.transactions.reduce(((e,r)=>e+r.byteLength(t)),0)}getHash(){return a_.hash256(this.toBuffer(!0))}getId(){return C_.reverseBuffer(this.getHash()).toString("hex")}getUTCDate(){const e=new Date(0);return e.setUTCSeconds(this.timestamp),e}toBuffer(e){const t=te.allocUnsafe(this.byteLength(e)),r=new C_.BufferWriter(t);return r.writeInt32(this.version),r.writeSlice(this.prevHash),r.writeSlice(this.merkleRoot),r.writeUInt32(this.timestamp),r.writeUInt32(this.bits),r.writeUInt32(this.nonce),e||!this.transactions||(P_.encode(this.transactions.length,t,r.offset),r.offset+=P_.encode.bytes,this.transactions.forEach((e=>{const n=e.byteLength();e.toBuffer(t,r.offset),r.offset+=n}))),t}toHex(e){return this.toBuffer(e).toString("hex")}checkTxRoots(){const e=this.hasWitnessCommit();return!(!e&&this.hasWitness())&&this.__checkMerkleRoot()&&(!e||this.__checkWitnessCommit())}checkProofOfWork(){const e=C_.reverseBuffer(this.getHash()),t=i.calculateTarget(this.bits);return e.compare(t)<=0}__checkMerkleRoot(){if(!this.transactions)throw r;const e=i.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(e)}__checkWitnessCommit(){if(!this.transactions)throw r;if(!this.hasWitnessCommit())throw n;const e=i.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(e)}}function o(e){return e instanceof Array&&e[0]&&e[0].ins&&e[0].ins instanceof Array&&e[0].ins[0]&&e[0].ins[0].witness&&e[0].ins[0].witness instanceof Array&&e[0].ins[0].witness.length>0}t.Block=i}));R(R_),R_.Block;var N_=N((function(e,t){var r,n,i;Object.defineProperty(t,"__esModule",{value:!0}),(r=t.GlobalTypes||(t.GlobalTypes={}))[r.UNSIGNED_TX=0]="UNSIGNED_TX",r[r.GLOBAL_XPUB=1]="GLOBAL_XPUB",t.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],(n=t.InputTypes||(t.InputTypes={}))[n.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",n[n.WITNESS_UTXO=1]="WITNESS_UTXO",n[n.PARTIAL_SIG=2]="PARTIAL_SIG",n[n.SIGHASH_TYPE=3]="SIGHASH_TYPE",n[n.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",n[n.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",n[n.BIP32_DERIVATION=6]="BIP32_DERIVATION",n[n.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",n[n.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",n[n.POR_COMMITMENT=9]="POR_COMMITMENT",t.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment"],(i=t.OutputTypes||(t.OutputTypes={}))[i.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",i[i.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",i[i.BIP32_DERIVATION=2]="BIP32_DERIVATION",t.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation"]}));R(N_),N_.GlobalTypes,N_.GLOBAL_TYPE_NAMES,N_.InputTypes,N_.INPUT_TYPE_NAMES,N_.OutputTypes,N_.OUTPUT_TYPE_NAMES;var L_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){if(e.key[0]!==N_.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+e.key.toString("hex"));if(79!==e.key.length||![2,3].includes(e.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const t=e.key.slice(1),r={masterFingerprint:e.value.slice(0,4),extendedPubkey:t,path:"m"};for(const t of(e=>[...Array(e).keys()])(e.value.length/4-1)){const n=e.value.readUInt32LE(4*t+4),i=!!(2147483648&n),o=2147483647&n;r.path+="/"+o.toString(10)+(i?"'":"")}return r},t.encode=function(e){const t=te.from([N_.GlobalTypes.GLOBAL_XPUB]),r=te.concat([t,e.extendedPubkey]),n=e.path.split("/"),i=te.allocUnsafe(4*n.length);e.masterFingerprint.copy(i,0);let o=4;return n.slice(1).forEach((e=>{const t="'"===e.slice(-1);let r=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(r+=2147483648),i.writeUInt32LE(r,o),o+=4})),{key:r,value:i}},t.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",t.check=function(e){const t=e.extendedPubkey,r=e.masterFingerprint,n=e.path;return De(t)&&78===t.length&&[2,3].indexOf(t[45])>-1&&De(r)&&4===r.length&&"string"==typeof n&&!!n.match(/^m(\/\d+'?)+$/)},t.canAddToArray=function(e,t,r){const n=t.extendedPubkey.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.extendedPubkey.equals(t.extendedPubkey))).length)}}));R(L_),L_.decode,L_.encode,L_.expected,L_.check,L_.canAddToArray;var j_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.encode=function(e){return{key:te.from([N_.GlobalTypes.UNSIGNED_TX]),value:e.toBuffer()}}}));R(j_),j_.encode;var D_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){if(e.key[0]!==N_.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+e.key.toString("hex"));return e.value},t.encode=function(e){return{key:te.from([N_.InputTypes.FINAL_SCRIPTSIG]),value:e}},t.expected="Buffer",t.check=function(e){return De(e)},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptSig}}));R(D_),D_.decode,D_.encode,D_.expected,D_.check,D_.canAdd;var B_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){if(e.key[0]!==N_.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+e.key.toString("hex"));return e.value},t.encode=function(e){return{key:te.from([N_.InputTypes.FINAL_SCRIPTWITNESS]),value:e}},t.expected="Buffer",t.check=function(e){return De(e)},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptWitness}}));R(B_),B_.decode,B_.encode,B_.expected,B_.check,B_.canAdd;var U_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){if(e.key[0]!==N_.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+e.key.toString("hex"));return e.value},t.encode=function(e){return{key:te.from([N_.InputTypes.NON_WITNESS_UTXO]),value:e}},t.expected="Buffer",t.check=function(e){return De(e)},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.nonWitnessUtxo}}));R(U_),U_.decode,U_.encode,U_.expected,U_.check,U_.canAdd;var H_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){if(e.key[0]!==N_.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+e.key.toString("hex"));if(34!==e.key.length&&66!==e.key.length||![2,3,4].includes(e.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1),signature:e.value}},t.encode=function(e){const t=te.from([N_.InputTypes.PARTIAL_SIG]);return{key:te.concat([t,e.pubkey]),value:e.signature}},t.expected="{ pubkey: Buffer; signature: Buffer; }",t.check=function(e){return De(e.pubkey)&&De(e.signature)&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&function(e){if(!De(e)||e.length<9)return!1;if(48!==e[0])return!1;if(e.length!==e[1]+3)return!1;if(2!==e[2])return!1;const t=e[3];if(t>33||t<1)return!1;if(2!==e[3+t+1])return!1;const r=e[3+t+2];return!(r>33||r<1)&&e.length===3+t+2+r+2}(e.signature)},t.canAddToArray=function(e,t,r){const n=t.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)}}));R(H_),H_.decode,H_.encode,H_.expected,H_.check,H_.canAddToArray;var F_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){if(e.key[0]!==N_.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+e.key.toString("hex"));return e.value.toString("utf8")},t.encode=function(e){return{key:te.from([N_.InputTypes.POR_COMMITMENT]),value:te.from(e,"utf8")}},t.expected="string",t.check=function(e){return"string"==typeof e},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.porCommitment}}));R(F_),F_.decode,F_.encode,F_.expected,F_.check,F_.canAdd;var V_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){if(e.key[0]!==N_.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+e.key.toString("hex"));return e.value.readUInt32LE(0)},t.encode=function(e){const t=te.from([N_.InputTypes.SIGHASH_TYPE]),r=te.allocUnsafe(4);return r.writeUInt32LE(e,0),{key:t,value:r}},t.expected="number",t.check=function(e){return"number"==typeof e},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.sighashType}}));R(V_),V_.decode,V_.encode,V_.expected,V_.check,V_.canAdd;var q_=N((function(e,t){function r(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function n(e){return r(e),e<253?1:e<=65535?3:e<=4294967295?5:9}Object.defineProperty(t,"__esModule",{value:!0}),t.encode=function e(t,i,o){if(r(t),i||(i=te.allocUnsafe(n(t))),!De(i))throw new TypeError("buffer must be a Buffer instance");return o||(o=0),t<253?(i.writeUInt8(t,o),Object.assign(e,{bytes:1})):t<=65535?(i.writeUInt8(253,o),i.writeUInt16LE(t,o+1),Object.assign(e,{bytes:3})):t<=4294967295?(i.writeUInt8(254,o),i.writeUInt32LE(t,o+1),Object.assign(e,{bytes:5})):(i.writeUInt8(255,o),i.writeUInt32LE(t>>>0,o+1),i.writeUInt32LE(t/4294967296|0,o+5),Object.assign(e,{bytes:9})),i},t.decode=function e(t,n){if(!De(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);const i=t.readUInt8(n);if(i<253)return Object.assign(e,{bytes:1}),i;if(253===i)return Object.assign(e,{bytes:3}),t.readUInt16LE(n+1);if(254===i)return Object.assign(e,{bytes:5}),t.readUInt32LE(n+1);{Object.assign(e,{bytes:9});const i=t.readUInt32LE(n+1),o=4294967296*t.readUInt32LE(n+5)+i;return r(o),o}},t.encodingLength=n}));R(q_),q_.encode,q_.decode,q_.encodingLength;var z_=N((function(e,t){function r(e){const t=e.key.length,r=e.value.length,n=q_.encodingLength(t),i=q_.encodingLength(r),o=te.allocUnsafe(n+t+i+r);return q_.encode(t,o,0),e.key.copy(o,n),q_.encode(r,o,n+t),e.value.copy(o,n+t+i),o}function n(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}Object.defineProperty(t,"__esModule",{value:!0}),t.range=e=>[...Array(e).keys()],t.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,r=0;for(let n=0;n<e.length/2;n++)r=e[n],e[n]=e[t],e[t]=r,t--;return e},t.keyValsToBuffer=function(e){const t=e.map(r);return t.push(te.from([0])),te.concat(t)},t.keyValToBuffer=r,t.readUInt64LE=function(e,t){const r=e.readUInt32LE(t);let i=e.readUInt32LE(t+4);return i*=4294967296,n(i+r,9007199254740991),i+r},t.writeUInt64LE=function(e,t,r){return n(t,9007199254740991),e.writeInt32LE(-1&t,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8}}));R(z_),z_.range,z_.reverseBuffer,z_.keyValsToBuffer,z_.keyValToBuffer,z_.readUInt64LE,z_.writeUInt64LE;var K_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){if(e.key[0]!==N_.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+e.key.toString("hex"));const t=z_.readUInt64LE(e.value,0);let r=8;const n=q_.decode(e.value,r);r+=q_.encodingLength(n);const i=e.value.slice(r);if(i.length!==n)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:i,value:t}},t.encode=function(e){const{script:t,value:r}=e,n=q_.encodingLength(t.length),i=te.allocUnsafe(8+n+t.length);return z_.writeUInt64LE(i,r,0),q_.encode(t.length,i,8),t.copy(i,8+n),{key:te.from([N_.InputTypes.WITNESS_UTXO]),value:i}},t.expected="{ script: Buffer; value: number; }",t.check=function(e){return De(e.script)&&"number"==typeof e.value},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.witnessUtxo}}));R(K_),K_.decode,K_.encode,K_.expected,K_.check,K_.canAdd;var W_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+t.key.toString("hex"));if(34!==t.key.length&&66!==t.key.length||![2,3,4].includes(t.key[1]))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+t.key.toString("hex"));if(t.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const r=t.key.slice(1),n={masterFingerprint:t.value.slice(0,4),pubkey:r,path:"m"};for(const e of(e=>[...Array(e).keys()])(t.value.length/4-1)){const r=t.value.readUInt32LE(4*e+4),i=!!(2147483648&r),o=2147483647&r;n.path+="/"+o.toString(10)+(i?"'":"")}return n},encode:function(t){const r=te.from([e]),n=te.concat([r,t.pubkey]),i=t.path.split("/"),o=te.allocUnsafe(4*i.length);t.masterFingerprint.copy(o,0);let a=4;return i.slice(1).forEach((e=>{const t="'"===e.slice(-1);let r=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(r+=2147483648),o.writeUInt32LE(r,a),a+=4})),{key:n,value:o}},check:function(e){return De(e.pubkey)&&De(e.masterFingerprint)&&"string"==typeof e.path&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(e,t,r){const n=t.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)}}}}));R(W_),W_.makeConverter;var J_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.makeChecker=function(e){return function(t){let r;if(e.includes(t.key[0])&&(r=t.key.slice(1),33!==r.length&&65!==r.length||![2,3,4].includes(r[0])))throw new Error("Format Error: invalid pubkey in key 0x"+t.key.toString("hex"));return r}}}));R(J_),J_.makeChecker;var G_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:te.from([e]),value:t}},check:function(e){return De(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.redeemScript}}}}));R(G_),G_.makeConverter;var X_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:te.from([e]),value:t}},check:function(e){return De(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.witnessScript}}}}));R(X_),X_.makeConverter;var $_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r={unsignedTx:j_,globalXpub:L_,checkPubkey:J_.makeChecker([])};t.globals=r;const n={nonWitnessUtxo:U_,partialSig:H_,sighashType:V_,finalScriptSig:D_,finalScriptWitness:B_,porCommitment:F_,witnessUtxo:K_,bip32Derivation:W_.makeConverter(N_.InputTypes.BIP32_DERIVATION),redeemScript:G_.makeConverter(N_.InputTypes.REDEEM_SCRIPT),witnessScript:X_.makeConverter(N_.InputTypes.WITNESS_SCRIPT),checkPubkey:J_.makeChecker([N_.InputTypes.PARTIAL_SIG,N_.InputTypes.BIP32_DERIVATION])};t.inputs=n;const i={bip32Derivation:W_.makeConverter(N_.OutputTypes.BIP32_DERIVATION),redeemScript:G_.makeConverter(N_.OutputTypes.REDEEM_SCRIPT),witnessScript:X_.makeConverter(N_.OutputTypes.WITNESS_SCRIPT),checkPubkey:J_.makeChecker([N_.OutputTypes.BIP32_DERIVATION])};t.outputs=i}));R($_),$_.globals,$_.inputs,$_.outputs;var Y_=N((function(e,t){function r(e,t,r){if(!t.equals(te.from([r])))throw new Error(`Format Error: Invalid ${e} key: ${t.toString("hex")}`)}function n(e,{globalMapKeyVals:t,inputKeyVals:n,outputKeyVals:i}){const o={unsignedTx:e};let a=0;for(const e of t)switch(e.key[0]){case N_.GlobalTypes.UNSIGNED_TX:if(r("global",e.key,N_.GlobalTypes.UNSIGNED_TX),a>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");a++;break;case N_.GlobalTypes.GLOBAL_XPUB:void 0===o.globalXpub&&(o.globalXpub=[]),o.globalXpub.push($_.globals.globalXpub.decode(e));break;default:o.unknownKeyVals||(o.unknownKeyVals=[]),o.unknownKeyVals.push(e)}const s=n.length,c=i.length,u=[],f=[];for(const e of z_.range(s)){const t={};for(const i of n[e])switch($_.inputs.checkPubkey(i),i.key[0]){case N_.InputTypes.NON_WITNESS_UTXO:if(r("input",i.key,N_.InputTypes.NON_WITNESS_UTXO),void 0!==t.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");t.nonWitnessUtxo=$_.inputs.nonWitnessUtxo.decode(i);break;case N_.InputTypes.WITNESS_UTXO:if(r("input",i.key,N_.InputTypes.WITNESS_UTXO),void 0!==t.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");t.witnessUtxo=$_.inputs.witnessUtxo.decode(i);break;case N_.InputTypes.PARTIAL_SIG:void 0===t.partialSig&&(t.partialSig=[]),t.partialSig.push($_.inputs.partialSig.decode(i));break;case N_.InputTypes.SIGHASH_TYPE:if(r("input",i.key,N_.InputTypes.SIGHASH_TYPE),void 0!==t.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");t.sighashType=$_.inputs.sighashType.decode(i);break;case N_.InputTypes.REDEEM_SCRIPT:if(r("input",i.key,N_.InputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");t.redeemScript=$_.inputs.redeemScript.decode(i);break;case N_.InputTypes.WITNESS_SCRIPT:if(r("input",i.key,N_.InputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");t.witnessScript=$_.inputs.witnessScript.decode(i);break;case N_.InputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push($_.inputs.bip32Derivation.decode(i));break;case N_.InputTypes.FINAL_SCRIPTSIG:r("input",i.key,N_.InputTypes.FINAL_SCRIPTSIG),t.finalScriptSig=$_.inputs.finalScriptSig.decode(i);break;case N_.InputTypes.FINAL_SCRIPTWITNESS:r("input",i.key,N_.InputTypes.FINAL_SCRIPTWITNESS),t.finalScriptWitness=$_.inputs.finalScriptWitness.decode(i);break;case N_.InputTypes.POR_COMMITMENT:r("input",i.key,N_.InputTypes.POR_COMMITMENT),t.porCommitment=$_.inputs.porCommitment.decode(i);break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(i)}u.push(t)}for(const e of z_.range(c)){const t={};for(const n of i[e])switch($_.outputs.checkPubkey(n),n.key[0]){case N_.OutputTypes.REDEEM_SCRIPT:if(r("output",n.key,N_.OutputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");t.redeemScript=$_.outputs.redeemScript.decode(n);break;case N_.OutputTypes.WITNESS_SCRIPT:if(r("output",n.key,N_.OutputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");t.witnessScript=$_.outputs.witnessScript.decode(n);break;case N_.OutputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push($_.outputs.bip32Derivation.decode(n));break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(n)}f.push(t)}return{globalMap:o,inputs:u,outputs:f}}Object.defineProperty(t,"__esModule",{value:!0}),t.psbtFromBuffer=function(e,t){let r=0;function i(){const t=q_.decode(e,r);r+=q_.encodingLength(t);const n=e.slice(r,r+t);return r+=t,n}function o(){return{key:i(),value:i()}}function a(){if(r>=e.length)throw new Error("Format Error: Unexpected End of PSBT");const t=0===e.readUInt8(r);return t&&r++,t}if(1886610036!==function(){const t=e.readUInt32BE(r);return r+=4,t}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const t=e.readUInt8(r);return r+=1,t}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const s=[],c={};for(;!a();){const e=o(),t=e.key.toString("hex");if(c[t])throw new Error("Format Error: Keys must be unique for global keymap: key "+t);c[t]=1,s.push(e)}const u=s.filter((e=>e.key[0]===N_.GlobalTypes.UNSIGNED_TX));if(1!==u.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const f=t(u[0].value),{inputCount:l,outputCount:d}=f.getInputOutputCounts(),h=[],p=[];for(const e of z_.range(l)){const t={},r=[];for(;!a();){const n=o(),i=n.key.toString("hex");if(t[i])throw new Error("Format Error: Keys must be unique for each input: input index "+e+" key "+i);t[i]=1,r.push(n)}h.push(r)}for(const e of z_.range(d)){const t={},r=[];for(;!a();){const n=o(),i=n.key.toString("hex");if(t[i])throw new Error("Format Error: Keys must be unique for each output: output index "+e+" key "+i);t[i]=1,r.push(n)}p.push(r)}return n(f,{globalMapKeyVals:s,inputKeyVals:h,outputKeyVals:p})},t.checkKeyBuffer=r,t.psbtFromKeyVals=n}));R(Y_),Y_.psbtFromBuffer,Y_.checkKeyBuffer,Y_.psbtFromKeyVals;var Q_=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.psbtToBuffer=function({globalMap:e,inputs:t,outputs:r}){const{globalKeyVals:n,inputKeyVals:o,outputKeyVals:a}=i({globalMap:e,inputs:t,outputs:r}),s=z_.keyValsToBuffer(n),c=e=>0===e.length?[te.from([0])]:e.map(z_.keyValsToBuffer),u=c(o),f=c(a),l=te.allocUnsafe(5);return l.writeUIntBE(482972169471,0,5),te.concat([l,s].concat(u,f))};const r=(e,t)=>e.key.compare(t.key);function n(e,t){const n=new Set,i=Object.entries(e).reduce(((e,[r,i])=>{if("unknownKeyVals"===r)return e;const o=t[r];if(void 0===o)return e;const a=(Array.isArray(i)?i:[i]).map(o.encode);return a.map((e=>e.key.toString("hex"))).forEach((e=>{if(n.has(e))throw new Error("Serialize Error: Duplicate key: "+e);n.add(e)})),e.concat(a)}),[]),o=e.unknownKeyVals?e.unknownKeyVals.filter((e=>!n.has(e.key.toString("hex")))):[];return i.concat(o).sort(r)}function i({globalMap:e,inputs:t,outputs:r}){return{globalKeyVals:n(e,$_.globals),inputKeyVals:t.map((e=>n(e,$_.inputs))),outputKeyVals:r.map((e=>n(e,$_.outputs)))}}t.psbtToKeyVals=i}));R(Q_),Q_.psbtToBuffer,Q_.psbtToKeyVals;var Z_=N((function(e,t){function r(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),r(Y_),r(Q_)}));R(Z_);var eS=N((function(e,t){function r(e,t,r){return n=>{if(e.has(n))return;const i=r.filter((e=>e.key.toString("hex")===n))[0];t.push(i),e.add(n)}}function n(e){return e.globalMap.unsignedTx}function i(e){const t=new Set;return e.forEach((e=>{const r=e.key.toString("hex");if(t.has(r))throw new Error("Combine: KeyValue Map keys should be unique");t.add(r)})),t}Object.defineProperty(t,"__esModule",{value:!0}),t.combine=function(e){const t=e[0],o=Z_.psbtToKeyVals(t),a=e.slice(1);if(0===a.length)throw new Error("Combine: Nothing to combine");const s=n(t);if(void 0===s)throw new Error("Combine: Self missing transaction");const c=i(o.globalKeyVals),u=o.inputKeyVals.map(i),f=o.outputKeyVals.map(i);for(const e of a){const t=n(e);if(void 0===t||!t.toBuffer().equals(s.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const a=Z_.psbtToKeyVals(e);i(a.globalKeyVals).forEach(r(c,o.globalKeyVals,a.globalKeyVals)),a.inputKeyVals.map(i).forEach(((e,t)=>e.forEach(r(u[t],o.inputKeyVals[t],a.inputKeyVals[t])))),a.outputKeyVals.map(i).forEach(((e,t)=>e.forEach(r(f[t],o.outputKeyVals[t],a.outputKeyVals[t]))))}return Z_.psbtFromKeyVals(s,{globalMapKeyVals:o.globalKeyVals,inputKeyVals:o.inputKeyVals,outputKeyVals:o.outputKeyVals})}}));R(eS),eS.combine;var tS=N((function(e,t){function r(e,t){const r=e[t];if(void 0===r)throw new Error(`No input #${t}`);return r}function n(e,t,r,n){throw new Error(`Data for ${e} key ${t} is incorrect: Expected ${r} and got ${JSON.stringify(n)}`)}function i(e){return(t,r)=>{for(const i of Object.keys(t)){const o=t[i],{canAdd:a,canAddToArray:s,check:c,expected:u}=$_[e+"s"][i]||{};if(c)if(!!s){if(!Array.isArray(o)||r[i]&&!Array.isArray(r[i]))throw new Error(`Key type ${i} must be an array`);o.every(c)||n(e,i,u,o);const t=r[i]||[],a=new Set;if(!o.every((e=>s(t,e,a))))throw new Error("Can not add duplicate data to array");r[i]=t.concat(o)}else{if(c(o)||n(e,i,u,o),!a(r,o))throw new Error(`Can not add duplicate data to ${e}`);r[i]=o}}}}Object.defineProperty(t,"__esModule",{value:!0}),t.checkForInput=r,t.checkForOutput=function(e,t){const r=e[t];if(void 0===r)throw new Error(`No output #${t}`);return r},t.checkHasKey=function(e,t,r){if(e.key[0]<r)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(t&&0!==t.filter((t=>t.key.equals(e.key))).length)throw new Error(`Duplicate Key: ${e.key.toString("hex")}`)},t.getEnumLength=function(e){let t=0;return Object.keys(e).forEach((e=>{Number(isNaN(Number(e)))&&t++})),t},t.inputCheckUncleanFinalized=function(e,t){let r=!1;if(t.nonWitnessUtxo||t.witnessUtxo){const e=!!t.redeemScript,n=!!t.witnessScript,i=!e||!!t.finalScriptSig,o=!n||!!t.finalScriptWitness,a=!!t.finalScriptSig||!!t.finalScriptWitness;r=i&&o&&a}if(!1===r)throw new Error(`Input #${e} has too much or too little data to clean`)},t.updateGlobal=i("global"),t.updateInput=i("input"),t.updateOutput=i("output"),t.addInputAttributes=function(e,n){const i=r(e,e.length-1);t.updateInput(n,i)},t.addOutputAttributes=function(e,n){const i=r(e,e.length-1);t.updateOutput(n,i)},t.defaultVersionSetter=function(e,t){if(!De(t)||t.length<4)throw new Error("Set Version: Invalid Transaction");return t.writeUInt32LE(e,0),t},t.defaultLocktimeSetter=function(e,t){if(!De(t)||t.length<4)throw new Error("Set Locktime: Invalid Transaction");return t.writeUInt32LE(e,t.length-4),t}}));R(tS),tS.checkForInput,tS.checkForOutput,tS.checkHasKey,tS.getEnumLength,tS.inputCheckUncleanFinalized,tS.updateGlobal,tS.updateInput,tS.updateOutput,tS.addInputAttributes,tS.addOutputAttributes,tS.defaultVersionSetter,tS.defaultLocktimeSetter;var rS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Psbt=class{constructor(e){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:e}}static fromBase64(e,t){const r=te.from(e,"base64");return this.fromBuffer(r,t)}static fromHex(e,t){const r=te.from(e,"hex");return this.fromBuffer(r,t)}static fromBuffer(e,t){const r=Z_.psbtFromBuffer(e,t),n=new this(r.globalMap.unsignedTx);return Object.assign(n,r),n}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return Z_.psbtToBuffer(this)}updateGlobal(e){return tS.updateGlobal(e,this.globalMap),this}updateInput(e,t){const r=tS.checkForInput(this.inputs,e);return tS.updateInput(t,r),this}updateOutput(e,t){const r=tS.checkForOutput(this.outputs,e);return tS.updateOutput(t,r),this}addUnknownKeyValToGlobal(e){return tS.checkHasKey(e,this.globalMap.unknownKeyVals,tS.getEnumLength(N_.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(e),this}addUnknownKeyValToInput(e,t){const r=tS.checkForInput(this.inputs,e);return tS.checkHasKey(t,r.unknownKeyVals,tS.getEnumLength(N_.InputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(t),this}addUnknownKeyValToOutput(e,t){const r=tS.checkForOutput(this.outputs,e);return tS.checkHasKey(t,r.unknownKeyVals,tS.getEnumLength(N_.OutputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(t),this}addInput(e){this.globalMap.unsignedTx.addInput(e),this.inputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],r=this.inputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(r,e))),tS.addInputAttributes(this.inputs,e),this}addOutput(e){this.globalMap.unsignedTx.addOutput(e),this.outputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],r=this.outputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(r,e))),tS.addOutputAttributes(this.outputs,e),this}clearFinalizedInput(e){const t=tS.checkForInput(this.inputs,e);tS.inputCheckUncleanFinalized(e,t);for(const e of Object.keys(t))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(e)||delete t[e];return this}combine(...e){const t=eS.combine([this].concat(e));return Object.assign(this,t),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}}}));R(rS),rS.Psbt;var nS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r={network:Fw.bitcoin,maximumFeeRate:5e3};class n{constructor(e={},t=new rS.Psbt(new o)){this.data=t,this.opts=Object.assign({},r,e),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const n=(e,t,r,n)=>Object.defineProperty(e,t,{enumerable:r,writable:n});n(this,"__CACHE",!1,!0),n(this,"opts",!1,!0)}static fromBase64(e,t={}){const r=te.from(e,"base64");return this.fromBuffer(r,t)}static fromHex(e,t={}){const r=te.from(e,"hex");return this.fromBuffer(r,t)}static fromBuffer(e,t={}){const r=rS.Psbt.fromBuffer(e,i),o=new n(t,r);var a,s;return a=o.__CACHE.__TX,s=o.__CACHE,a.ins.forEach((e=>{w(s,e)})),o}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(e){this.setVersion(e)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(e){this.setLocktime(e)}get txInputs(){return this.__CACHE.__TX.ins.map((e=>({hash:C_.cloneBuffer(e.hash),index:e.index,sequence:e.sequence})))}get txOutputs(){return this.__CACHE.__TX.outs.map((e=>{let t;try{t=k_.fromOutputScript(e.script,this.opts.network)}catch(e){}return{script:C_.cloneBuffer(e.script),value:e.value,address:t}}))}combine(...e){return this.data.combine(...e.map((e=>e.data))),this}clone(){const e=n.fromBuffer(this.data.toBuffer());return e.opts=JSON.parse(JSON.stringify(this.opts)),e}setMaximumFeeRate(e){y(e),this.opts.maximumFeeRate=e}setVersion(e){y(e),m(this.data.inputs,"setVersion");const t=this.__CACHE;return t.__TX.version=e,t.__EXTRACTED_TX=void 0,this}setLocktime(e){y(e),m(this.data.inputs,"setLocktime");const t=this.__CACHE;return t.__TX.locktime=e,t.__EXTRACTED_TX=void 0,this}setInputSequence(e,t){y(t),m(this.data.inputs,"setInputSequence");const r=this.__CACHE;if(r.__TX.ins.length<=e)throw new Error("Input index too high");return r.__TX.ins[e].sequence=t,r.__EXTRACTED_TX=void 0,this}addInputs(e){return e.forEach((e=>this.addInput(e))),this}addInput(e){if(arguments.length>1||!e||void 0===e.hash||void 0===e.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");m(this.data.inputs,"addInput"),e.witnessScript&&j(e.witnessScript);const t=this.__CACHE;this.data.addInput(e),w(t,t.__TX.ins[t.__TX.ins.length-1]);const r=this.data.inputs.length-1,n=this.data.inputs[r];return n.nonWitnessUtxo&&P(this.__CACHE,n,r),t.__FEE=void 0,t.__FEE_RATE=void 0,t.__EXTRACTED_TX=void 0,this}addOutputs(e){return e.forEach((e=>this.addOutput(e))),this}addOutput(e){if(arguments.length>1||!e||void 0===e.value||void 0===e.address&&void 0===e.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");m(this.data.inputs,"addOutput");const{address:t}=e;if("string"==typeof t){const{network:r}=this.opts,n=k_.toOutputScript(t,r);e=Object.assign(e,{script:n})}const r=this.__CACHE;return this.data.addOutput(e),r.__FEE=void 0,r.__FEE_RATE=void 0,r.__EXTRACTED_TX=void 0,this}extractTransaction(e){if(!this.data.inputs.every(c))throw new Error("Not finalized");const t=this.__CACHE;if(e||function(e,t,r){const n=t.__FEE_RATE||e.getFeeRate(),i=t.__EXTRACTED_TX.virtualSize(),o=n*i;if(n>=r.maximumFeeRate)throw new Error(`Warning: You are paying around ${(o/1e8).toFixed(8)} in fees, which is ${n} satoshi per byte for a transaction with a VSize of ${i} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}(this,t,this.opts),t.__EXTRACTED_TX)return t.__EXTRACTED_TX;const r=t.__TX.clone();return C(this.data.inputs,r,t,!0),r}getFeeRate(){return k("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return k("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return tS.checkForInput(this.data.inputs,0),U(this.data.inputs.length).forEach((e=>this.finalizeInput(e))),this}finalizeInput(e,t=E){const r=tS.checkForInput(this.data.inputs,e),{script:n,isP2SH:i,isP2WSH:o,isSegwit:a}=function(e,t,r){const n=r.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!t.redeemScript,i.isP2WSH=!!t.witnessScript,t.witnessScript)i.script=t.witnessScript;else if(t.redeemScript)i.script=t.redeemScript;else if(t.nonWitnessUtxo){const o=M(r,t,e),a=n.ins[e].index;i.script=o.outs[a].script}else t.witnessUtxo&&(i.script=t.witnessUtxo.script);return(t.witnessScript||h(i.script))&&(i.isSegwit=!0),i}(e,r,this.__CACHE);if(!n)throw new Error(`No script found for input #${e}`);!function(e){if(!e.sighashType||!e.partialSig)return;const{partialSig:t,sighashType:r}=e;t.forEach((e=>{const{hashType:t}=t_.signature.decode(e.signature);if(r!==t)throw new Error("Signature sighash does not match input sighash type")}))}(r);const{finalScriptSig:s,finalScriptWitness:c}=t(e,r,n,a,i,o);if(s&&this.data.updateInput(e,{finalScriptSig:s}),c&&this.data.updateInput(e,{finalScriptWitness:c}),!s&&!c)throw new Error(`Unknown error finalizing input #${e}`);return this.data.clearFinalizedInput(e),this}getInputType(e){const t=tS.checkForInput(this.data.inputs,e),r=L(R(e,t,this.__CACHE),e,"input",t.redeemScript||function(e){if(!e)return;const t=t_.decompile(e);if(!t)return;const r=t[t.length-1];if(!De(r)||N(r)||(n=r,t_.isCanonicalScriptSignature(n)))return;var n;return t_.decompile(r)?r:void 0}(t.finalScriptSig),t.witnessScript||function(e){if(!e)return;const t=A(e),r=t[t.length-1];if(N(r))return;return t_.decompile(r)?r:void 0}(t.finalScriptWitness));return("raw"===r.type?"":r.type+"-")+B(r.meaningfulScript)}inputHasPubkey(e,t){return function(e,t,r,n){const i=R(r,t,n),{meaningfulScript:o}=L(i,r,"input",t.redeemScript,t.witnessScript);return D(e,o)}(t,tS.checkForInput(this.data.inputs,e),e,this.__CACHE)}inputHasHDKey(e,t){const r=tS.checkForInput(this.data.inputs,e),n=g(t);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}outputHasPubkey(e,t){return function(e,t,r,n){const i=n.__TX.outs[r].script,{meaningfulScript:o}=L(i,r,"output",t.redeemScript,t.witnessScript);return D(e,o)}(t,tS.checkForOutput(this.data.outputs,e),e,this.__CACHE)}outputHasHDKey(e,t){const r=tS.checkForOutput(this.data.outputs,e),n=g(t);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}validateSignaturesOfAllInputs(){return tS.checkForInput(this.data.inputs,0),U(this.data.inputs.length).map((e=>this.validateSignaturesOfInput(e))).reduce(((e,t)=>!0===t&&e),!0)}validateSignaturesOfInput(e,t){const r=this.data.inputs[e],n=(r||{}).partialSig;if(!r||!n||n.length<1)throw new Error("No signatures to validate");const i=t?n.filter((e=>e.pubkey.equals(t))):n;if(i.length<1)throw new Error("No signatures for this pubkey");const o=[];let a,s,c;for(const t of i){const n=t_.signature.decode(t.signature),{hash:i,script:u}=c!==n.hashType?O(e,Object.assign({},r,{sighashType:n.hashType}),this.__CACHE,!0):{hash:a,script:s};c=n.hashType,a=i,s=u,v(t.pubkey,u,"verify");const f=I_.fromPublicKey(t.pubkey);o.push(f.verify(i,n.signature))}return o.every((e=>!0===e))}signAllInputsHD(e,t=[M_.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");const r=[];for(const n of U(this.data.inputs.length))try{this.signInputHD(n,e,t),r.push(!0)}catch(e){r.push(!1)}if(r.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(e,t=[M_.Transaction.SIGHASH_ALL]){return new Promise(((r,n)=>{if(!e||!e.publicKey||!e.fingerprint)return n(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const r of U(this.data.inputs.length))o.push(this.signInputHDAsync(r,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return n(new Error("No inputs were signed"));r()}))}))}signInputHD(e,t,r=[M_.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");return T(e,this.data.inputs,t).forEach((t=>this.signInput(e,t,r))),this}signInputHDAsync(e,t,r=[M_.Transaction.SIGHASH_ALL]){return new Promise(((n,i)=>{if(!t||!t.publicKey||!t.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=T(e,this.data.inputs,t).map((t=>this.signInputAsync(e,t,r)));return Promise.all(o).then((()=>{n()})).catch(i)}))}signAllInputs(e,t=[M_.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const r=[];for(const n of U(this.data.inputs.length))try{this.signInput(n,e,t),r.push(!0)}catch(e){r.push(!1)}if(r.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsAsync(e,t=[M_.Transaction.SIGHASH_ALL]){return new Promise(((r,n)=>{if(!e||!e.publicKey)return n(new Error("Need Signer to sign input"));const i=[],o=[];for(const[r]of this.data.inputs.entries())o.push(this.signInputAsync(r,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return n(new Error("No inputs were signed"));r()}))}))}signInput(e,t,r=[M_.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const{hash:n,sighashType:i}=I(this.data.inputs,e,t.publicKey,this.__CACHE,r),o=[{pubkey:t.publicKey,signature:t_.signature.encode(t.sign(n),i)}];return this.data.updateInput(e,{partialSig:o}),this}signInputAsync(e,t,r=[M_.Transaction.SIGHASH_ALL]){return Promise.resolve().then((()=>{if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const{hash:n,sighashType:i}=I(this.data.inputs,e,t.publicKey,this.__CACHE,r);return Promise.resolve(t.sign(n)).then((r=>{const n=[{pubkey:t.publicKey,signature:t_.signature.encode(r,i)}];this.data.updateInput(e,{partialSig:n})}))}))}toBuffer(){return a(this.__CACHE),this.data.toBuffer()}toHex(){return a(this.__CACHE),this.data.toHex()}toBase64(){return a(this.__CACHE),this.data.toBase64()}updateGlobal(e){return this.data.updateGlobal(e),this}updateInput(e,t){return t.witnessScript&&j(t.witnessScript),this.data.updateInput(e,t),t.nonWitnessUtxo&&P(this.__CACHE,this.data.inputs[e],e),this}updateOutput(e,t){return this.data.updateOutput(e,t),this}addUnknownKeyValToGlobal(e){return this.data.addUnknownKeyValToGlobal(e),this}addUnknownKeyValToInput(e,t){return this.data.addUnknownKeyValToInput(e,t),this}addUnknownKeyValToOutput(e,t){return this.data.addUnknownKeyValToOutput(e,t),this}clearFinalizedInput(e){return this.data.clearFinalizedInput(e),this}}t.Psbt=n;const i=e=>new o(e);class o{constructor(e=te.from([2,0,0,0,0,0,0,0,0,0])){this.tx=M_.Transaction.fromBuffer(e),function(e){if(!e.ins.every((e=>e.script&&0===e.script.length&&e.witness&&0===e.witness.length)))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(e){if(void 0===e.hash||void 0===e.index||!De(e.hash)&&"string"!=typeof e.hash||"number"!=typeof e.index)throw new Error("Error adding input.");const t="string"==typeof e.hash?C_.reverseBuffer(te.from(e.hash,"hex")):e.hash;this.tx.addInput(t,e.index,e.sequence)}addOutput(e){if(void 0===e.script||void 0===e.value||!De(e.script)||"number"!=typeof e.value)throw new Error("Error adding output.");this.tx.addOutput(e.script,e.value)}toBuffer(){return this.tx.toBuffer()}}function a(e){if(!1!==e.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function s(e,t,r){if(!t)return!1;let n;if(n=r?r.map((e=>{const r=I_.fromPublicKey(e,{compressed:!0}).publicKey;return t.find((e=>e.pubkey.equals(r)))})).filter((e=>!!e)):t,n.length>e)throw new Error("Too many signatures");return n.length===e}function c(e){return!!e.finalScriptSig||!!e.finalScriptWitness}function u(e){return t=>{try{return e({output:t}),!0}catch(e){return!1}}}const f=u(x_.p2ms),l=u(x_.p2pk),d=u(x_.p2pkh),h=u(x_.p2wpkh),p=u(x_.p2wsh),b=u(x_.p2sh);function g(e){return t=>!!t.masterFingerprint.equals(e.fingerprint)&&!!e.derivePath(t.path).publicKey.equals(t.pubkey)}function y(e){if("number"!=typeof e||e!==Math.floor(e)||e>4294967295||e<0)throw new Error("Invalid 32 bit integer")}function m(e,t){e.forEach((e=>{let r=!1,n=[];if(0===(e.partialSig||[]).length){if(!e.finalScriptSig&&!e.finalScriptWitness)return;n=function(e){const t=e.finalScriptSig&&t_.decompile(e.finalScriptSig)||[],r=e.finalScriptWitness&&t_.decompile(e.finalScriptWitness)||[];return t.concat(r).filter((e=>De(e)&&t_.isCanonicalScriptSignature(e))).map((e=>({signature:e})))}(e)}else n=e.partialSig;if(n.forEach((e=>{const{hashType:n}=t_.signature.decode(e.signature),i=[];switch(n&M_.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&n){case M_.Transaction.SIGHASH_ALL:break;case M_.Transaction.SIGHASH_SINGLE:case M_.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}-1===i.indexOf(t)&&(r=!0)})),r)throw new Error("Can not modify transaction, signatures exist.")}))}function v(e,t,r){if(!D(e,t))throw new Error(`Can not ${r} for this input with the key ${e.toString("hex")}`)}function w(e,t){const r=C_.reverseBuffer(te.from(t.hash)).toString("hex")+":"+t.index;if(e.__TX_IN_CACHE[r])throw new Error("Duplicate input detected.");e.__TX_IN_CACHE[r]=1}function _(e,t){return(r,n,i,o)=>{const a=e({redeem:{output:i}}).output;if(!n.equals(a))throw new Error(`${t} for ${o} #${r} doesn't match the scriptPubKey in the prevout`)}}const S=_(x_.p2sh,"Redeem script"),x=_(x_.p2wsh,"Witness script");function k(e,t,r,n){if(!r.every(c))throw new Error(`PSBT must be finalized to calculate ${t}`);if("__FEE_RATE"===e&&n.__FEE_RATE)return n.__FEE_RATE;if("__FEE"===e&&n.__FEE)return n.__FEE;let i,o=!0;return n.__EXTRACTED_TX?(i=n.__EXTRACTED_TX,o=!1):i=n.__TX.clone(),C(r,i,n,o),"__FEE_RATE"===e?n.__FEE_RATE:"__FEE"===e?n.__FEE:void 0}function E(e,t,r,n,i,o){const a=B(r);if(!function(e,t,r){switch(r){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return s(1,e.partialSig);case"multisig":const r=x_.p2ms({output:t});return s(r.m,e.partialSig,r.pubkeys);default:return!1}}(t,r,a))throw new Error(`Can not finalize input #${e}`);return function(e,t,r,n,i,o){let a,s;const c=function(e,t,r){let n;switch(t){case"multisig":const t=function(e,t){return x_.p2ms({output:e}).pubkeys.map((e=>(t.filter((t=>t.pubkey.equals(e)))[0]||{}).signature)).filter((e=>!!e))}(e,r);n=x_.p2ms({output:e,signatures:t});break;case"pubkey":n=x_.p2pk({output:e,signature:r[0].signature});break;case"pubkeyhash":n=x_.p2pkh({output:e,pubkey:r[0].pubkey,signature:r[0].signature});break;case"witnesspubkeyhash":n=x_.p2wpkh({output:e,pubkey:r[0].pubkey,signature:r[0].signature})}return n}(e,t,r),u=o?x_.p2wsh({redeem:c}):null,f=i?x_.p2sh({redeem:u||c}):null;return n?(s=function(e){let t=te.allocUnsafe(0);function r(e){const r=t.length,n=q_.encodingLength(e);t=te.concat([t,te.allocUnsafe(n)]),q_.encode(e,t,r)}function n(e){r(e.length),function(e){t=te.concat([t,te.from(e)])}(e)}var i;return r((i=e).length),i.forEach(n),t}(u?u.witness:c.witness),f&&(a=f.input)):a=f?f.input:c.input,{finalScriptSig:a,finalScriptWitness:s}}(r,a,t.partialSig,n,i,o)}function I(e,t,r,n,i){const o=tS.checkForInput(e,t),{hash:a,sighashType:s,script:c}=O(t,o,n,!1,i);return v(r,c,"sign"),{hash:a,sighashType:s}}function O(e,t,r,n,i){const o=r.__TX,a=t.sighashType||M_.Transaction.SIGHASH_ALL;if(i&&i.indexOf(a)<0){const e=function(e){let t=e&M_.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&e){case M_.Transaction.SIGHASH_ALL:t+="SIGHASH_ALL";break;case M_.Transaction.SIGHASH_SINGLE:t+="SIGHASH_SINGLE";break;case M_.Transaction.SIGHASH_NONE:t+="SIGHASH_NONE"}return t}(a);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${e}`)}let s,c;if(t.nonWitnessUtxo){const n=M(r,t,e),i=o.ins[e].hash,a=n.getHash();if(!i.equals(a))throw new Error(`Non-witness UTXO hash for input #${e} doesn't match the hash specified in the prevout`);const s=o.ins[e].index;c=n.outs[s]}else{if(!t.witnessUtxo)throw new Error("Need a Utxo input item for signing");c=t.witnessUtxo}const{meaningfulScript:u,type:f}=L(c.script,e,"input",t.redeemScript,t.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(f)>=0)s=o.hashForWitnessV0(e,u,c.value,a);else if(h(u)){const t=x_.p2pkh({hash:u.slice(2)}).output;s=o.hashForWitnessV0(e,t,c.value,a)}else{if(void 0===t.nonWitnessUtxo&&!1===r.__UNSAFE_SIGN_NONSEGWIT)throw new Error(`Input #${e} has witnessUtxo but non-segwit script: ${u.toString("hex")}`);n||!1===r.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as the old TransactionBuilder class when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),s=o.hashForSignature(e,u,a)}return{script:u,sighashType:a,hash:s}}function T(e,t,r){const n=tS.checkForInput(t,e);if(!n.bip32Derivation||0===n.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=n.bip32Derivation.map((e=>e.masterFingerprint.equals(r.fingerprint)?e:void 0)).filter((e=>!!e));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");return i.map((e=>{const t=r.derivePath(e.path);if(!e.pubkey.equals(t.publicKey))throw new Error("pubkey did not match bip32Derivation");return t}))}function A(e){let t=0;function r(){const r=q_.decode(e,t);return t+=q_.decode.bytes,r}function n(){return function(r){return t+=r,e.slice(t-r,t)}(r())}return function(){const e=r(),t=[];for(let r=0;r<e;r++)t.push(n());return t}()}function P(e,t,r){e.__NON_WITNESS_UTXO_BUF_CACHE[r]=t.nonWitnessUtxo;const n=M_.Transaction.fromBuffer(t.nonWitnessUtxo);e.__NON_WITNESS_UTXO_TX_CACHE[r]=n;const i=e,o=r;delete t.nonWitnessUtxo,Object.defineProperty(t,"nonWitnessUtxo",{enumerable:!0,get(){const e=i.__NON_WITNESS_UTXO_BUF_CACHE[o],t=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==e)return e;{const e=t.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e,e}},set(e){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e}})}function C(e,t,r,n){let i=0;e.forEach(((e,o)=>{if(n&&e.finalScriptSig&&(t.ins[o].script=e.finalScriptSig),n&&e.finalScriptWitness&&(t.ins[o].witness=A(e.finalScriptWitness)),e.witnessUtxo)i+=e.witnessUtxo.value;else if(e.nonWitnessUtxo){const n=M(r,e,o),a=t.ins[o].index,s=n.outs[a];i+=s.value}}));const o=t.outs.reduce(((e,t)=>e+t.value),0),a=i-o;if(a<0)throw new Error("Outputs are spending more than Inputs");const s=t.virtualSize();r.__FEE=a,r.__EXTRACTED_TX=t,r.__FEE_RATE=Math.floor(a/s)}function M(e,t,r){const n=e.__NON_WITNESS_UTXO_TX_CACHE;return n[r]||P(e,t,r),n[r]}function R(e,t,r){if(void 0!==t.witnessUtxo)return t.witnessUtxo.script;if(void 0!==t.nonWitnessUtxo)return M(r,t,e).outs[r.__TX.ins[e].index].script;throw new Error("Can't find pubkey in input without Utxo data")}function N(e){return 33===e.length&&t_.isCanonicalPubKey(e)}function L(e,t,r,n,i){const o=b(e),a=o&&n&&p(n),s=p(e);if(o&&void 0===n)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((s||a)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let c;return a?(c=i,S(t,e,n,r),x(t,n,i,r),j(c)):s?(c=i,x(t,e,i,r),j(c)):o?(c=n,S(t,e,n,r)):c=e,{meaningfulScript:c,type:a?"p2sh-p2wsh":o?"p2sh":s?"p2wsh":"raw"}}function j(e){if(h(e)||b(e))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function D(e,t){const r=a_.hash160(e),n=t_.decompile(t);if(null===n)throw new Error("Unknown script error");return n.some((t=>"number"!=typeof t&&(t.equals(e)||t.equals(r))))}function B(e){return h(e)?"witnesspubkeyhash":d(e)?"pubkeyhash":f(e)?"multisig":l(e)?"pubkey":"nonstandard"}function U(e){return[...Array(e).keys()]}}));R(nS),nS.Psbt;var iS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_;function n(e){return e===r.OPS.OP_0||t_.isCanonicalScriptSignature(e)}function i(e,t){const i=t_.decompile(e);return!(i.length<2)&&i[0]===r.OPS.OP_0&&(t?i.slice(1).every(n):i.slice(1).every(t_.isCanonicalScriptSignature))}t.check=i,i.toJSON=()=>"multisig input"}));R(iS),iS.check;var oS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_,n=r.OPS.OP_RESERVED;function i(e,t){const i=t_.decompile(e);if(i.length<4)return!1;if(i[i.length-1]!==r.OPS.OP_CHECKMULTISIG)return!1;if(!qw.Number(i[0]))return!1;if(!qw.Number(i[i.length-2]))return!1;const o=i[0]-n,a=i[i.length-2]-n;return!(o<=0)&&(!(a>16)&&(!(o>a)&&(a===i.length-3&&(!!t||i.slice(1,-2).every(t_.isCanonicalPubKey)))))}t.check=i,i.toJSON=()=>"multi-sig output"}));R(oS),oS.check;var aS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.input=iS,t.output=oS}));R(aS),aS.input,aS.output;var sS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_.OPS;function n(e){const t=t_.compile(e);return t.length>1&&t[0]===r.OP_RETURN}t.check=n,n.toJSON=()=>"null data output";const i={check:n};t.output=i}));R(sS),sS.check,sS.output;var cS=N((function(e,t){function r(e){const t=t_.decompile(e);return 1===t.length&&t_.isCanonicalScriptSignature(t[0])}Object.defineProperty(t,"__esModule",{value:!0}),t.check=r,r.toJSON=()=>"pubKey input"}));R(cS),cS.check;var uS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_;function n(e){const t=t_.decompile(e);return 2===t.length&&t_.isCanonicalPubKey(t[0])&&t[1]===r.OPS.OP_CHECKSIG}t.check=n,n.toJSON=()=>"pubKey output"}));R(uS),uS.check;var fS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.input=cS,t.output=uS}));R(fS),fS.input,fS.output;var lS=N((function(e,t){function r(e){const t=t_.decompile(e);return 2===t.length&&t_.isCanonicalScriptSignature(t[0])&&t_.isCanonicalPubKey(t[1])}Object.defineProperty(t,"__esModule",{value:!0}),t.check=r,r.toJSON=()=>"pubKeyHash input"}));R(lS),lS.check;var dS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_;function n(e){const t=t_.compile(e);return 25===t.length&&t[0]===r.OPS.OP_DUP&&t[1]===r.OPS.OP_HASH160&&20===t[2]&&t[23]===r.OPS.OP_EQUALVERIFY&&t[24]===r.OPS.OP_CHECKSIG}t.check=n,n.toJSON=()=>"pubKeyHash output"}));R(dS),dS.check;var hS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.input=lS,t.output=dS}));R(hS),hS.input,hS.output;var pS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_;function n(e){const t=t_.compile(e);return 22===t.length&&t[0]===r.OPS.OP_0&&20===t[1]}t.check=n,n.toJSON=()=>"Witness pubKeyHash output"}));R(pS),pS.check;var bS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_;function n(e){const t=t_.compile(e);return 34===t.length&&t[0]===r.OPS.OP_0&&32===t[1]}t.check=n,n.toJSON=()=>"Witness scriptHash output"}));R(bS),bS.check;var gS=N((function(e,t){function r(e,t){const r=t_.decompile(e);if(r.length<1)return!1;const n=r[r.length-1];if(!De(n))return!1;const i=t_.decompile(t_.compile(r.slice(0,-1))),o=t_.decompile(n);return!!o&&!!t_.isPushOnly(i)&&(1===r.length?bS.check(o)||pS.check(o):!(!hS.input.check(i)||!hS.output.check(o))||!(!aS.input.check(i,t)||!aS.output.check(o))||!(!fS.input.check(i)||!fS.output.check(o)))}Object.defineProperty(t,"__esModule",{value:!0}),t.check=r,r.toJSON=()=>"scriptHash input"}));R(gS),gS.check;var yS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_;function n(e){const t=t_.compile(e);return 23===t.length&&t[0]===r.OPS.OP_HASH160&&20===t[1]&&t[22]===r.OPS.OP_EQUAL}t.check=n,n.toJSON=()=>"scriptHash output"}));R(yS),yS.check;var mS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.input=gS,t.output=yS}));R(mS),mS.input,mS.output;var vS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_,n=te.from("aa21a9ed","hex");function i(e){const t=t_.compile(e);return t.length>37&&t[0]===r.OPS.OP_RETURN&&36===t[1]&&t.slice(2,6).equals(n)}t.check=i,i.toJSON=()=>"Witness commitment output",t.encode=function(e){Nw(qw.Hash256bit,e);const t=te.allocUnsafe(36);return n.copy(t,0),e.copy(t,4),t_.compile([r.OPS.OP_RETURN,t])},t.decode=function(e){return Nw(i,e),t_.decompile(e)[1].slice(4,36)}}));R(vS),vS.check,vS.encode,vS.decode;var wS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.output=vS}));R(wS),wS.output;var _S=N((function(e,t){function r(e){const t=t_.decompile(e);return 2===t.length&&t_.isCanonicalScriptSignature(t[0])&&(r=t[1],t_.isCanonicalPubKey(r)&&33===r.length);var r}Object.defineProperty(t,"__esModule",{value:!0}),t.check=r,r.toJSON=()=>"witnessPubKeyHash input"}));R(_S),_S.check;var SS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.input=_S,t.output=pS}));R(SS),SS.input,SS.output;var xS=N((function(e,t){function r(e,t){if(Nw(Nw.Array,e),e.length<1)return!1;const r=e[e.length-1];if(!De(r))return!1;const n=t_.decompile(r);if(!n||0===n.length)return!1;const i=t_.compile(e.slice(0,-1));return!(!hS.input.check(i)||!hS.output.check(n))||!(!aS.input.check(i,t)||!aS.output.check(n))||!(!fS.input.check(i)||!fS.output.check(n))}Object.defineProperty(t,"__esModule",{value:!0}),t.check=r,r.toJSON=()=>"witnessScriptHash input"}));R(xS),xS.check;var kS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.input=xS,t.output=bS}));R(kS),kS.input,kS.output;var ES=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r={P2MS:"multisig",NONSTANDARD:"nonstandard",NULLDATA:"nulldata",P2PK:"pubkey",P2PKH:"pubkeyhash",P2SH:"scripthash",P2WPKH:"witnesspubkeyhash",P2WSH:"witnessscripthash",WITNESS_COMMITMENT:"witnesscommitment"};t.types=r,t.output=function(e){if(SS.output.check(e))return r.P2WPKH;if(kS.output.check(e))return r.P2WSH;if(hS.output.check(e))return r.P2PKH;if(mS.output.check(e))return r.P2SH;const t=t_.decompile(e);if(!t)throw new TypeError("Invalid script");return aS.output.check(t)?r.P2MS:fS.output.check(t)?r.P2PK:wS.output.check(t)?r.WITNESS_COMMITMENT:sS.output.check(t)?r.NULLDATA:r.NONSTANDARD},t.input=function(e,t){const n=t_.decompile(e);if(!n)throw new TypeError("Invalid script");return hS.input.check(n)?r.P2PKH:mS.input.check(n,t)?r.P2SH:aS.input.check(n,t)?r.P2MS:fS.input.check(n)?r.P2PK:r.NONSTANDARD},t.witness=function(e,t){const n=t_.decompile(e);if(!n)throw new TypeError("Invalid script");return SS.input.check(n)?r.P2WPKH:kS.input.check(n,t)?r.P2WSH:r.NONSTANDARD}}));R(ES),ES.types,ES.output,ES.input,ES.witness;var IS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=t_,n=ES.types,i=new Set(["p2pkh","p2pk","p2wpkh","p2ms","p2sh-p2pkh","p2sh-p2pk","p2sh-p2wpkh","p2sh-p2ms","p2wsh-p2pkh","p2wsh-p2pk","p2wsh-p2ms","p2sh-p2wsh-p2pkh","p2sh-p2wsh-p2pk","p2sh-p2wsh-p2ms"]);function o(e,t,r){try{Nw(e,t)}catch(e){throw new Error(r)}}class a{constructor(e=Fw.bitcoin,t=2500){this.network=e,this.maximumFeeRate=t,this.__PREV_TX_SET={},this.__INPUTS=[],this.__TX=new M_.Transaction,this.__TX.version=2,this.__USE_LOW_R=!1,console.warn("Deprecation Warning: TransactionBuilder will be removed in the future. (v6.x.x or later) Please use the Psbt class instead. Examples of usage are available in the transactions-psbt.js integration test file on our Github. A high level explanation is available in the psbt.ts and psbt.js files as well.")}static fromTransaction(e,t){const r=new a(t);return r.setVersion(e.version),r.setLockTime(e.locktime),e.outs.forEach((e=>{r.addOutput(e.script,e.value)})),e.ins.forEach((e=>{r.__addInputUnsafe(e.hash,e.index,{sequence:e.sequence,script:e.script,witness:e.witness})})),r.__INPUTS.forEach(((t,r)=>{!function(e,t,r){if(e.redeemScriptType!==n.P2MS||!e.redeemScript)return;if(e.pubkeys.length===e.signatures.length)return;const i=e.signatures.concat();e.signatures=e.pubkeys.map((n=>{const o=I_.fromPublicKey(n);let a;return i.some(((n,s)=>{if(!n)return!1;const c=t_.signature.decode(n),u=t.hashForSignature(r,e.redeemScript,c.hashType);return!!o.verify(u,c.signature)&&(i[s]=void 0,a=n,!0)})),a}))}(t,e,r)})),r}setLowR(e){return Nw(Nw.maybe(Nw.Boolean),e),void 0===e&&(e=!0),this.__USE_LOW_R=e,e}setLockTime(e){if(Nw(qw.UInt32,e),this.__INPUTS.some((e=>!!e.signatures&&e.signatures.some((e=>void 0!==e)))))throw new Error("No, this would invalidate signatures");this.__TX.locktime=e}setVersion(e){Nw(qw.UInt32,e),this.__TX.version=e}addInput(e,t,r,n){if(!this.__canModifyInputs())throw new Error("No, this would invalidate signatures");let i;if("string"==typeof(o=e)||o instanceof String)e=C_.reverseBuffer(te.from(e,"hex"));else if(function(e){return e instanceof M_.Transaction}(e)){const r=e.outs[t];n=r.script,i=r.value,e=e.getHash(!1)}var o;return this.__addInputUnsafe(e,t,{sequence:r,prevOutScript:n,value:i})}addOutput(e,t){if(!this.__canModifyOutputs())throw new Error("No, this would invalidate signatures");return"string"==typeof e&&(e=k_.toOutputScript(e,this.network)),this.__TX.addOutput(e,t)}build(){return this.__build(!1)}buildIncomplete(){return this.__build(!0)}sign(e,t,r,a,s,u){!function({input:e,ourPubKey:t,keyPair:r,signatureHash:n,hashType:i,useLowR:o}){let a=!1;for(const[s,c]of e.pubkeys.entries()){if(!t.equals(c))continue;if(e.signatures[s])throw new Error("Signature already exists");if(33!==t.length&&e.hasWitness)throw new Error("BIP143 rejects uncompressed public keys in P2WPKH or P2WSH");const u=r.sign(n,o);e.signatures[s]=t_.signature.encode(u,i),a=!0}if(!a)throw new Error("Key pair cannot sign for this input")}(function(e,t,r,a,s,u,l,d,h,p,b){let g;if("number"==typeof s)console.warn("DEPRECATED: TransactionBuilder sign method arguments will change in v6, please use the TxbSignArg interface"),g=s;else{if("object"!=typeof s)throw new TypeError("TransactionBuilder sign first arg must be TxbSignArg or number");!function(e,t){if(!i.has(t.prevOutScriptType))throw new TypeError(`Unknown prevOutScriptType "${t.prevOutScriptType}"`);o(Nw.Number,t.vin,"sign must include vin parameter as Number (input index)"),o(qw.Signer,t.keyPair,"sign must include keyPair parameter as Signer interface"),o(Nw.maybe(Nw.Number),t.hashType,"sign hashType parameter must be a number");const r=(e[t.vin]||[]).prevOutType,n=t.prevOutScriptType;switch(n){case"p2pkh":if(r&&"pubkeyhash"!==r)throw new TypeError(`input #${t.vin} is not of type p2pkh: ${r}`);o(Nw.value(void 0),t.witnessScript,`${n} requires NO witnessScript`),o(Nw.value(void 0),t.redeemScript,`${n} requires NO redeemScript`),o(Nw.value(void 0),t.witnessValue,`${n} requires NO witnessValue`);break;case"p2pk":if(r&&"pubkey"!==r)throw new TypeError(`input #${t.vin} is not of type p2pk: ${r}`);o(Nw.value(void 0),t.witnessScript,`${n} requires NO witnessScript`),o(Nw.value(void 0),t.redeemScript,`${n} requires NO redeemScript`),o(Nw.value(void 0),t.witnessValue,`${n} requires NO witnessValue`);break;case"p2wpkh":if(r&&"witnesspubkeyhash"!==r)throw new TypeError(`input #${t.vin} is not of type p2wpkh: ${r}`);o(Nw.value(void 0),t.witnessScript,`${n} requires NO witnessScript`),o(Nw.value(void 0),t.redeemScript,`${n} requires NO redeemScript`),o(qw.Satoshi,t.witnessValue,`${n} requires witnessValue`);break;case"p2ms":if(r&&"multisig"!==r)throw new TypeError(`input #${t.vin} is not of type p2ms: ${r}`);o(Nw.value(void 0),t.witnessScript,`${n} requires NO witnessScript`),o(Nw.value(void 0),t.redeemScript,`${n} requires NO redeemScript`),o(Nw.value(void 0),t.witnessValue,`${n} requires NO witnessValue`);break;case"p2sh-p2wpkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${t.vin} is not of type p2sh-p2wpkh: ${r}`);o(Nw.value(void 0),t.witnessScript,`${n} requires NO witnessScript`),o(Nw.Buffer,t.redeemScript,`${n} requires redeemScript`),o(qw.Satoshi,t.witnessValue,`${n} requires witnessValue`);break;case"p2sh-p2ms":case"p2sh-p2pk":case"p2sh-p2pkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${t.vin} is not of type ${n}: ${r}`);o(Nw.value(void 0),t.witnessScript,`${n} requires NO witnessScript`),o(Nw.Buffer,t.redeemScript,`${n} requires redeemScript`),o(Nw.value(void 0),t.witnessValue,`${n} requires NO witnessValue`);break;case"p2wsh-p2ms":case"p2wsh-p2pk":case"p2wsh-p2pkh":if(r&&"witnessscripthash"!==r)throw new TypeError(`input #${t.vin} is not of type ${n}: ${r}`);o(Nw.Buffer,t.witnessScript,`${n} requires witnessScript`),o(Nw.value(void 0),t.redeemScript,`${n} requires NO redeemScript`),o(qw.Satoshi,t.witnessValue,`${n} requires witnessValue`);break;case"p2sh-p2wsh-p2ms":case"p2sh-p2wsh-p2pk":case"p2sh-p2wsh-p2pkh":if(r&&"scripthash"!==r)throw new TypeError(`input #${t.vin} is not of type ${n}: ${r}`);o(Nw.Buffer,t.witnessScript,`${n} requires witnessScript`),o(Nw.Buffer,t.redeemScript,`${n} requires witnessScript`),o(qw.Satoshi,t.witnessValue,`${n} requires witnessScript`)}}(t,s),({vin:g,keyPair:u,redeemScript:l,hashType:d,witnessValue:h,witnessScript:p}=s)}if(void 0===u)throw new Error("sign requires keypair");if(u.network&&u.network!==e)throw new TypeError("Inconsistent network");if(!t[g])throw new Error("No input at index: "+g);if(r(d=d||M_.Transaction.SIGHASH_ALL))throw new Error("Transaction needs outputs");const y=t[g];if(void 0!==y.redeemScript&&l&&!y.redeemScript.equals(l))throw new Error("Inconsistent redeemScript");const m=u.publicKey||u.getPublicKey&&u.getPublicKey();if(!f(y)){if(void 0!==h){if(void 0!==y.value&&y.value!==h)throw new Error("Input did not match witnessValue");Nw(qw.Satoshi,h),y.value=h}if(!f(y)){const e=function(e,t,r,i){if(r&&i){const o=x_.p2wsh({redeem:{output:i}}),a=x_.p2wsh({output:r}),s=x_.p2sh({redeem:{output:r}}),u=x_.p2sh({redeem:o});if(!o.hash.equals(a.hash))throw new Error("Witness script inconsistent with prevOutScript");if(!s.hash.equals(u.hash))throw new Error("Redeem script inconsistent with prevOutScript");const f=c(o.redeem.output,t);if(!f.pubkeys)throw new Error(f.type+" not supported as witnessScript ("+t_.toASM(i)+")");e.signatures&&e.signatures.some((e=>void 0!==e))&&(f.signatures=e.signatures);const l=i;if(f.type===n.P2WPKH)throw new Error("P2SH(P2WSH(P2WPKH)) is a consensus failure");return{redeemScript:r,redeemScriptType:n.P2WSH,witnessScript:i,witnessScriptType:f.type,prevOutType:n.P2SH,prevOutScript:s.output,hasWitness:!0,signScript:l,signType:f.type,pubkeys:f.pubkeys,signatures:f.signatures,maxSignatures:f.maxSignatures}}if(r){const i=x_.p2sh({redeem:{output:r}});if(e.prevOutScript){let t;try{t=x_.p2sh({output:e.prevOutScript})}catch(e){throw new Error("PrevOutScript must be P2SH")}if(!i.hash.equals(t.hash))throw new Error("Redeem script inconsistent with prevOutScript")}const o=c(i.redeem.output,t);if(!o.pubkeys)throw new Error(o.type+" not supported as redeemScript ("+t_.toASM(r)+")");e.signatures&&e.signatures.some((e=>void 0!==e))&&(o.signatures=e.signatures);let a=r;return o.type===n.P2WPKH&&(a=x_.p2pkh({pubkey:o.pubkeys[0]}).output),{redeemScript:r,redeemScriptType:o.type,prevOutType:n.P2SH,prevOutScript:i.output,hasWitness:o.type===n.P2WPKH,signScript:a,signType:o.type,pubkeys:o.pubkeys,signatures:o.signatures,maxSignatures:o.maxSignatures}}if(i){const r=x_.p2wsh({redeem:{output:i}});if(e.prevOutScript){const t=x_.p2wsh({output:e.prevOutScript});if(!r.hash.equals(t.hash))throw new Error("Witness script inconsistent with prevOutScript")}const o=c(r.redeem.output,t);if(!o.pubkeys)throw new Error(o.type+" not supported as witnessScript ("+t_.toASM(i)+")");e.signatures&&e.signatures.some((e=>void 0!==e))&&(o.signatures=e.signatures);const a=i;if(o.type===n.P2WPKH)throw new Error("P2WSH(P2WPKH) is a consensus failure");return{witnessScript:i,witnessScriptType:o.type,prevOutType:n.P2WSH,prevOutScript:r.output,hasWitness:!0,signScript:a,signType:o.type,pubkeys:o.pubkeys,signatures:o.signatures,maxSignatures:o.maxSignatures}}if(e.prevOutType&&e.prevOutScript){if(e.prevOutType===n.P2SH)throw new Error("PrevOutScript is "+e.prevOutType+", requires redeemScript");if(e.prevOutType===n.P2WSH)throw new Error("PrevOutScript is "+e.prevOutType+", requires witnessScript");if(!e.prevOutScript)throw new Error("PrevOutScript is missing");const r=c(e.prevOutScript,t);if(!r.pubkeys)throw new Error(r.type+" not supported ("+t_.toASM(e.prevOutScript)+")");e.signatures&&e.signatures.some((e=>void 0!==e))&&(r.signatures=e.signatures);let i=e.prevOutScript;return r.type===n.P2WPKH&&(i=x_.p2pkh({pubkey:r.pubkeys[0]}).output),{prevOutType:r.type,prevOutScript:e.prevOutScript,hasWitness:r.type===n.P2WPKH,signScript:i,signType:r.type,pubkeys:r.pubkeys,signatures:r.signatures,maxSignatures:r.maxSignatures}}const o=x_.p2pkh({pubkey:t}).output;return{prevOutType:n.P2PKH,prevOutScript:o,hasWitness:!1,signScript:o,signType:n.P2PKH,pubkeys:[t],signatures:[void 0]}}(y,m,l,p);Object.assign(y,e)}if(!f(y))throw Error(y.prevOutType+" not supported")}let v;return v=y.hasWitness?a.hashForWitnessV0(g,y.signScript,y.value,d):a.hashForSignature(g,y.signScript,d),{input:y,ourPubKey:m,keyPair:u,signatureHash:v,hashType:d,useLowR:!!b}}(this.network,this.__INPUTS,this.__needsOutputs.bind(this),this.__TX,e,t,r,a,s,u,this.__USE_LOW_R))}__addInputUnsafe(e,t,r){if(M_.Transaction.isCoinbaseHash(e))throw new Error("coinbase inputs not supported");const n=e.toString("hex")+":"+t;if(void 0!==this.__PREV_TX_SET[n])throw new Error("Duplicate TxOut: "+n);let i={};if(void 0!==r.script&&(i=s(r.script,r.witness||[])),void 0!==r.value&&(i.value=r.value),!i.prevOutScript&&r.prevOutScript){let e;if(!i.pubkeys&&!i.signatures){const t=c(r.prevOutScript);t.pubkeys&&(i.pubkeys=t.pubkeys,i.signatures=t.signatures),e=t.type}i.prevOutScript=r.prevOutScript,i.prevOutType=e||ES.output(r.prevOutScript)}const o=this.__TX.addInput(e,t,r.sequence,r.scriptSig);return this.__INPUTS[o]=i,this.__PREV_TX_SET[n]=!0,o}__build(e){if(!e){if(!this.__TX.ins.length)throw new Error("Transaction has no inputs");if(!this.__TX.outs.length)throw new Error("Transaction has no outputs")}const t=this.__TX.clone();if(this.__INPUTS.forEach(((r,i)=>{if(!r.prevOutType&&!e)throw new Error("Transaction is not complete");const o=u(r.prevOutType,r,e);if(o)t.setInputScript(i,o.input),t.setWitness(i,o.witness);else{if(!e&&r.prevOutType===n.NONSTANDARD)throw new Error("Unknown input type");if(!e)throw new Error("Not enough information")}})),!e&&this.__overMaximumFees(t.virtualSize()))throw new Error("Transaction has absurd fees");return t}__canModifyInputs(){return this.__INPUTS.every((e=>!e.signatures||e.signatures.every((e=>!e||0!=(l(e)&M_.Transaction.SIGHASH_ANYONECANPAY)))))}__needsOutputs(e){return e===M_.Transaction.SIGHASH_ALL?0===this.__TX.outs.length:0===this.__TX.outs.length&&this.__INPUTS.some((e=>!!e.signatures&&e.signatures.some((e=>!!e&&!(l(e)&M_.Transaction.SIGHASH_NONE)))))}__canModifyOutputs(){const e=this.__TX.ins.length,t=this.__TX.outs.length;return this.__INPUTS.every((r=>void 0===r.signatures||r.signatures.every((r=>{if(!r)return!0;const n=31&l(r);return n===M_.Transaction.SIGHASH_NONE||n===M_.Transaction.SIGHASH_SINGLE&&e<=t}))))}__overMaximumFees(e){return(this.__INPUTS.reduce(((e,t)=>e+(t.value>>>0)),0)-this.__TX.outs.reduce(((e,t)=>e+t.value),0))/e>this.maximumFeeRate}}function s(e,t,r,i){if(0===e.length&&0===t.length)return{};if(!r){let i=ES.input(e,!0),o=ES.witness(t,!0);i===n.NONSTANDARD&&(i=void 0),o===n.NONSTANDARD&&(o=void 0),r=i||o}switch(r){case n.P2WPKH:{const{output:e,pubkey:r,signature:i}=x_.p2wpkh({witness:t});return{prevOutScript:e,prevOutType:n.P2WPKH,pubkeys:[r],signatures:[i]}}case n.P2PKH:{const{output:t,pubkey:r,signature:i}=x_.p2pkh({input:e});return{prevOutScript:t,prevOutType:n.P2PKH,pubkeys:[r],signatures:[i]}}case n.P2PK:{const{signature:t}=x_.p2pk({input:e});return{prevOutType:n.P2PK,pubkeys:[void 0],signatures:[t]}}case n.P2MS:{const{m:t,pubkeys:r,signatures:o}=x_.p2ms({input:e,output:i},{allowIncomplete:!0});return{prevOutType:n.P2MS,pubkeys:r,signatures:o,maxSignatures:t}}}if(r===n.P2SH){const{output:r,redeem:i}=x_.p2sh({input:e,witness:t}),o=ES.output(i.output),a=s(i.input,i.witness,o,i.output);return a.prevOutType?{prevOutScript:r,prevOutType:n.P2SH,redeemScript:i.output,redeemScriptType:a.prevOutType,witnessScript:a.witnessScript,witnessScriptType:a.witnessScriptType,pubkeys:a.pubkeys,signatures:a.signatures}:{}}if(r===n.P2WSH){const{output:r,redeem:i}=x_.p2wsh({input:e,witness:t}),o=ES.output(i.output);let a;return a=o===n.P2WPKH?s(i.input,i.witness,o):s(t_.compile(i.witness),[],o,i.output),a.prevOutType?{prevOutScript:r,prevOutType:n.P2WSH,witnessScript:i.output,witnessScriptType:a.prevOutType,pubkeys:a.pubkeys,signatures:a.signatures}:{}}return{prevOutType:n.NONSTANDARD,prevOutScript:e}}function c(e,t){Nw(qw.Buffer,e);const r=ES.output(e);switch(r){case n.P2PKH:{if(!t)return{type:r};const n=x_.p2pkh({output:e}).hash,i=a_.hash160(t);return n.equals(i)?{type:r,pubkeys:[t],signatures:[void 0]}:{type:r}}case n.P2WPKH:{if(!t)return{type:r};const n=x_.p2wpkh({output:e}).hash,i=a_.hash160(t);return n.equals(i)?{type:r,pubkeys:[t],signatures:[void 0]}:{type:r}}case n.P2PK:return{type:r,pubkeys:[x_.p2pk({output:e}).pubkey],signatures:[void 0]};case n.P2MS:{const t=x_.p2ms({output:e});return{type:r,pubkeys:t.pubkeys,signatures:t.pubkeys.map((()=>{})),maxSignatures:t.m}}}return{type:r}}function u(e,t,i){const o=t.pubkeys||[];let a=t.signatures||[];switch(e){case n.P2PKH:if(0===o.length)break;if(0===a.length)break;return x_.p2pkh({pubkey:o[0],signature:a[0]});case n.P2WPKH:if(0===o.length)break;if(0===a.length)break;return x_.p2wpkh({pubkey:o[0],signature:a[0]});case n.P2PK:if(0===o.length)break;if(0===a.length)break;return x_.p2pk({signature:a[0]});case n.P2MS:{const e=t.maxSignatures;a=i?a.map((e=>e||r.OPS.OP_0)):a.filter((e=>e));const n=!i||e===a.length;return x_.p2ms({m:e,pubkeys:o,signatures:a},{allowIncomplete:i,validate:n})}case n.P2SH:{const e=u(t.redeemScriptType,t,i);if(!e)return;return x_.p2sh({redeem:{output:e.output||t.redeemScript,input:e.input,witness:e.witness}})}case n.P2WSH:{const e=u(t.witnessScriptType,t,i);if(!e)return;return x_.p2wsh({redeem:{output:t.witnessScript,input:e.input,witness:e.witness}})}}}function f(e){return void 0!==e.signScript&&void 0!==e.signType&&void 0!==e.pubkeys&&void 0!==e.signatures&&e.signatures.length===e.pubkeys.length&&e.pubkeys.length>0&&(!1===e.hasWitness||void 0!==e.value)}function l(e){return e.readUInt8(e.length-1)}t.TransactionBuilder=a}));R(IS),IS.TransactionBuilder;var OS=N((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.bip32=Hw,t.address=k_,t.crypto=a_,t.ECPair=I_,t.networks=Fw,t.payments=x_,t.script=t_,t.Block=R_.Block,t.Psbt=nS.Psbt;var r=t_;t.opcodes=r.OPS,t.Transaction=M_.Transaction,t.TransactionBuilder=IS.TransactionBuilder}));R(OS),OS.bitcoin,OS.bip32,OS.address,OS.crypto,OS.ECPair,OS.networks,OS.payments,OS.script,OS.Block,OS.Psbt,OS.opcodes,OS.Transaction,OS.TransactionBuilder;const TS=Dn("Verifier");class AS{constructor({certificateJson:e,chain:t,expires:r,id:n,issuer:i,receipt:o,revocationKey:a,transactionId:s,version:c,explorerAPIs:u}){this.chain=t,this.expires=r,this.id=n,this.issuer=i,this.receipt=o,this.revocationKey=a,this.version=c,this.transactionId=s,this.explorerAPIs=u;let f=e.document;f||(f=this._retrieveDocumentBeforeIssuance(e)),this.documentToVerify=Object.assign({},f),this._stepsStatuses=[]}verify(t=(()=>{})){return e(this,void 0,void 0,(function*(){if(this._stepCallback=t,this.version===i.V1_1)throw new P("","Verification of 1.1 certificates is not supported by this component. See the python cert-verifier for legacy verification");Ei.chains.isMockChain(this.chain)?yield this._verifyV2Mock():yield this._verifyMain();const e=this._stepsStatuses.find((e=>"failure"===e.status));return e?this._failed(e):this._succeed()}))}_getRevocationListUrl(e){var t;return(null===(t=this.issuer)||void 0===t?void 0:t.revocationList)?this.issuer.revocationList:e.revocationList}_doAction(t,r){return e(this,void 0,void 0,(function*(){if(this._isFailing())return;let e;t&&(e=Ei.i18n.getText("subSteps",`${t}LabelPending`),TS(e),this._updateStatusCallback(t,e,"starting"));try{const n=yield r();return t&&(this._updateStatusCallback(t,e,"success"),this._stepsStatuses.push({step:t,label:e,status:"success"})),n}catch(r){t&&(this._updateStatusCallback(t,e,"failure",r.message),this._stepsStatuses.push({code:t,label:e,status:"failure",errorMessage:r.message}))}}))}_stepCallback(e){}_verifyMain(){return e(this,void 0,void 0,(function*(){yield this.getTransactionId(),yield this.computeLocalHash(),yield this.fetchRemoteHash(),yield this.getIssuerProfile(),yield this.parseIssuerKeys(),yield this.compareHashes(),yield this.checkMerkleRoot(),yield this.checkReceipt(),yield this.checkRevokedStatus(),yield this.checkAuthenticity(),yield this.checkExpiresDate()}))}_verifyV2Mock(){return e(this,void 0,void 0,(function*(){yield this.computeLocalHash(),yield this.compareHashes(),yield this.checkReceipt(),yield this.checkExpiresDate()}))}getTransactionId(){return e(this,void 0,void 0,(function*(){yield this._doAction("getTransactionId",(()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new P("getTransactionId",x("errors","isTransactionIdValid"))}(this.transactionId)))}))}computeLocalHash(){return e(this,void 0,void 0,(function*(){this.localHash=yield this._doAction("computeLocalHash",(()=>e(this,void 0,void 0,(function*(){return yield function(t,r){return e(this,void 0,void 0,(function*(){let e=t["@context"];const i=t;!function(e){return e===n.V1_1||e===n.V1_2}(r)&&(e.find((e=>e===Object(e)&&"@vocab"in e))?e=null:e.push({"@vocab":"http://fallback.org/"}));const o="undefined"!=typeof window&&void 0!==window.XMLHttpRequest?Jl.documentLoaders.xhr():Jl.documentLoaders.node();Jl.documentLoader=function(e,t){return e in v?t(null,{contextUrl:null,document:v[e],documentUrl:e}):o(e,t)};const a={algorithm:"URDNA2015",format:"application/nquads"};return e&&(a.expandContext=e),new Promise(((e,t)=>{Jl.normalize(i,a,((r,n)=>{if(r)console.error(r),t(new P("computeLocalHash",x("errors","failedJsonLdNormalization")));else{const r=function(e){const t=/<http:\/\/fallback\.org\/(.*)>/.exec(e);if(t){const e=[];for(let r=0;r<t.length;r++)e.push(t[r]);return e}return null}(n);r?t(new P("computeLocalHash",`${x("errors","foundUnmappedFields")}: ${r.join(", ")}`)):e($l(function(e){const t=[];for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<55296||n>=57344?t.push(224|n>>12,128|n>>6&63,128|63&n):(r++,n=65536+((1023&n)<<10|1023&e.charCodeAt(r)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return t}(n)))}}))}))}))}(this.documentToVerify,this.version)}))))}))}fetchRemoteHash(){return e(this,void 0,void 0,(function*(){this.txData=yield this._doAction("fetchRemoteHash",(()=>e(this,void 0,void 0,(function*(){return yield Ei.verifier.lookForTx({transactionId:this.transactionId,chain:this.chain.code,explorerAPIs:this.explorerAPIs})}))))}))}getIssuerProfile(){return e(this,void 0,void 0,(function*(){this.issuer=yield this._doAction("getIssuerProfile",(()=>e(this,void 0,void 0,(function*(){return yield Ei.verifier.getIssuerProfile(this.issuer)}))))}))}parseIssuerKeys(){return e(this,void 0,void 0,(function*(){this.issuerPublicKeyList=yield this._doAction("parseIssuerKeys",(()=>Ei.verifier.parseIssuerKeys(this.issuer)))}))}compareHashes(){return e(this,void 0,void 0,(function*(){yield this._doAction("compareHashes",(()=>{!function(e,t){if(e!==t)throw new P("compareHashes",x("errors","ensureHashesEqual"))}(this.localHash,this.receipt.targetHash)}))}))}checkMerkleRoot(){return e(this,void 0,void 0,(function*(){yield this._doAction("checkMerkleRoot",(()=>function(e,t){if(e!==t)throw new P("checkMerkleRoot",x("errors","ensureMerkleRootEqual"));return!0}(this.receipt.merkleRoot,this.txData.remoteHash)))}))}checkReceipt(){return e(this,void 0,void 0,(function*(){yield this._doAction("checkReceipt",(()=>function(e){let t=e.targetHash;const r=e.merkleRoot;try{const r=e.proof||e.path;if(r)for(const e in r){const n=r[e];let i;if(void 0!==n.left)i=Yl(`${n.left}${t}`),t=$l(i);else{if(void 0===n.right)throw new P("checkReceipt","Trigger catch error.");i=Yl(`${t}${n.right}`),t=$l(i)}}}catch(e){throw new P("checkReceipt",x("errors","ensureValidReceipt"))}if(t!==r)throw new P("checkReceipt",x("errors","invalidMerkleReceipt"))}(this.receipt)))}))}checkRevokedStatus(){var t;return e(this,void 0,void 0,(function*(){let r,n;this.version===i.V1_2?(n=(null===(t=this.txData)||void 0===t?void 0:t.revokedAddresses)||[],r=[Ei.verifier.parseRevocationKey(this.issuer),this.revocationKey]):(n=yield this._doAction(null,(()=>e(this,void 0,void 0,(function*(){return yield Ei.verifier.getRevokedAssertions(this._getRevocationListUrl(this.issuer),this.id)})))),r=this.id),yield this._doAction("checkRevokedStatus",(()=>function(e,t){if(!e||!t)return;Array.isArray(t)||(t=[t]);const r=function(e=[],t=[]){return e.filter((e=>-1!==t.indexOf(e))).filter(((e,t,r)=>r.indexOf(e)===t))}(t=t.filter((e=>null!=e)),e.map((e=>e.id)));if(r.length>0){const t=e.findIndex((e=>e.id===r[0]));if(t>-1)throw new P("checkRevokedStatus",Ei.certificates.generateRevocationReason(e[t].revocationReason))}}(n,r)))}))}checkAuthenticity(){return e(this,void 0,void 0,(function*(){yield this._doAction("checkAuthenticity",(()=>function(e,t,r){let n="";const i=function(e,t){let r=null;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&n.toLowerCase()===t.toLowerCase()&&(r=n);return e[r]}(e,t),o=xi(r);if(i?(i.created&&o<=i.created&&(n="invalidIssuingAddressCreationTime"),i.revoked&&o>=i.revoked&&(n="invalidIssuingAddressRevoked"),i.expires&&o>=i.expires&&(n="invalidIssuingAddressExpired")):n="invalidIssuingAddressUnknown",n)throw new P("checkAuthenticity",x("errors",n))}(this.issuerPublicKeyList,this.txData.issuingAddress,this.txData.time)))}))}checkExpiresDate(){return e(this,void 0,void 0,(function*(){yield this._doAction("checkExpiresDate",(()=>function(e=null){if(!e)return;const t=xi(e);if(new Date>=t)throw new P("checkExpiresDate",x("errors","ensureNotExpired"))}(this.expires)))}))}_failed(e){const t=e.errorMessage;return TS(`failure:${t}`),this._setFinalStep({status:"failure",message:t})}_isFailing(){return this._stepsStatuses.some((e=>"failure"===e.status))}_retrieveDocumentBeforeIssuance(e){const t=Object.assign({},e);return delete t.signature,t}_succeed(){const e=Ei.chains.isMockChain(this.chain)?Ei.i18n.getText("success","mocknet"):Ei.i18n.getText("success","blockchain");return TS(e),this._setFinalStep({status:"success",message:e})}_setFinalStep({status:e,message:t}){return{code:"final",status:e,message:t}}_updateStatusCallback(e,t,r,n=""){if(null!=e){const i={code:e,label:t,status:r};n&&(i.errorMessage=n),this._stepCallback(i)}}}class PS{constructor(e,t={}){if(this.explorerAPIs=[],this._setOptions(t),"object"!=typeof e)try{e=JSON.parse(e)}catch(e){throw new Error(Ei.i18n.getText("errors","certificateNotValid"))}this.certificateJson=D(e)}init(){return e(this,void 0,void 0,(function*(){yield this.parseJson(this.certificateJson)}))}parseJson(t){return e(this,void 0,void 0,(function*(){const e=yield Oi(t);if(!e.isFormatValid)throw new Error(e.error);this._setProperties(e)}))}verify(t){return e(this,void 0,void 0,(function*(){const e=new AS({certificateJson:this.certificateJson,chain:this.chain,expires:this.expires,id:this.id,issuer:this.issuer,receipt:this.receipt,revocationKey:this.revocationKey,transactionId:this.transactionId,version:this.version,explorerAPIs:D(this.explorerAPIs)});return yield e.verify(t)}))}_setOptions(e){this.options=Object.assign({},w,e),this.locale=Ei.i18n.ensureIsSupported("auto"===this.options.locale?Ei.i18n.detectLocale():this.options.locale),this.explorerAPIs=this.options.explorerAPIs||[],S.locale=this.locale}_setProperties({certificateImage:e,chain:t,description:r,expires:n,id:i,isFormatValid:o,issuedOn:a,issuer:s,metadataJson:c,name:u,publicKey:f,receipt:l,recipientFullName:d,recordLink:h,revocationKey:p,sealImage:b,signature:g,signatureImage:y,subtitle:m,version:v}){this.isFormatValid=o,this.certificateImage=e,this.chain=t,this.description=r,this.expires=n,this.id=i,this.issuedOn=a,this.issuer=s,this.metadataJson=c,this.name=u,this.publicKey=f,this.receipt=l,this.recipientFullName=d,this.recordLink=h,this.revocationKey=p,this.sealImage=b,this.signature=g,this.signatureImage=y,this.subtitle=m,this.verificationSteps=Ei.certificates.getVerificationMap(t),this.version=v,this._setTransactionDetails()}_setTransactionDetails(){this.transactionId=Ei.certificates.getTransactionId(this.receipt),this.rawTransactionLink=Ei.certificates.getTransactionLink(this.transactionId,this.chain,!0),this.transactionLink=Ei.certificates.getTransactionLink(this.transactionId,this.chain)}}export{p as BLOCKCHAINS,i as CERTIFICATE_VERSIONS,PS as Certificate,a as STEPS,d as SUB_STEPS,A as SignatureImage,h as VERIFICATION_STATUSES,k as getSupportedLanguages};
|