@0xpolygonid/js-sdk 1.28.0 → 1.28.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/README.md +1 -1
- package/dist/browser/esm/index.js +51 -4
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +52 -4
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/iden3comm/constants.js +3 -1
- package/dist/node/cjs/iden3comm/handlers/index.js +1 -0
- package/dist/node/cjs/iden3comm/handlers/problem-report.js +55 -0
- package/dist/node/cjs/iden3comm/types/index.js +1 -0
- package/dist/node/cjs/iden3comm/types/protocol/problem-report.js +2 -0
- package/dist/node/cjs/schema-processor/jsonld/cache.js +15 -0
- package/dist/node/cjs/verifiable/constants.js +5 -2
- package/dist/node/esm/iden3comm/constants.js +3 -1
- package/dist/node/esm/iden3comm/handlers/index.js +1 -0
- package/dist/node/esm/iden3comm/handlers/problem-report.js +28 -0
- package/dist/node/esm/iden3comm/types/index.js +1 -0
- package/dist/node/esm/iden3comm/types/protocol/problem-report.js +1 -0
- package/dist/node/esm/schema-processor/jsonld/cache.js +15 -0
- package/dist/node/esm/verifiable/constants.js +5 -2
- package/dist/types/iden3comm/constants.d.ts +1 -0
- package/dist/types/iden3comm/handlers/index.d.ts +1 -0
- package/dist/types/iden3comm/handlers/problem-report.d.ts +17 -0
- package/dist/types/iden3comm/types/index.d.ts +1 -0
- package/dist/types/iden3comm/types/protocol/problem-report.d.ts +16 -0
- package/dist/types/verifiable/constants.d.ts +3 -0
- package/package.json +2 -2
|
@@ -7751,7 +7751,9 @@ var PolygonIdSdk = (function (exports) {
|
|
|
7751
7751
|
IDEN3_DISPLAY_METHOD: 'https://schema.iden3.io/core/jsonld/displayMethod.jsonld',
|
|
7752
7752
|
// JSONLDSchemaW3CCredential2018 is a schema for context with VerifiableCredential type
|
|
7753
7753
|
W3C_CREDENTIAL_2018: 'https://www.w3.org/2018/credentials/v1',
|
|
7754
|
-
W3C_VC_DOCUMENT_2018: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","VerifiableCredential":{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","credentialSchema":{"@id":"cred:credentialSchema","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","JsonSchemaValidator2018":"cred:JsonSchemaValidator2018"}},"credentialStatus":{"@id":"cred:credentialStatus","@type":"@id"},"credentialSubject":{"@id":"cred:credentialSubject","@type":"@id"},"evidence":{"@id":"cred:evidence","@type":"@id"},"expirationDate":{"@id":"cred:expirationDate","@type":"xsd:dateTime"},"holder":{"@id":"cred:holder","@type":"@id"},"issued":{"@id":"cred:issued","@type":"xsd:dateTime"},"issuer":{"@id":"cred:issuer","@type":"@id"},"issuanceDate":{"@id":"cred:issuanceDate","@type":"xsd:dateTime"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"refreshService":{"@id":"cred:refreshService","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","ManualRefreshService2018":"cred:ManualRefreshService2018"}},"termsOfUse":{"@id":"cred:termsOfUse","@type":"@id"},"validFrom":{"@id":"cred:validFrom","@type":"xsd:dateTime"},"validUntil":{"@id":"cred:validUntil","@type":"xsd:dateTime"}}},"VerifiablePresentation":{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","holder":{"@id":"cred:holder","@type":"@id"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"verifiableCredential":{"@id":"cred:verifiableCredential","@type":"@id","@container":"@graph"}}},"EcdsaSecp256k1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"EcdsaSecp256r1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"Ed25519Signature2018":{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"RsaSignature2018":{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@version":1.1,"@protected":true,"challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"proof":{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"}}}
|
|
7754
|
+
W3C_VC_DOCUMENT_2018: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","VerifiableCredential":{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","credentialSchema":{"@id":"cred:credentialSchema","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","JsonSchemaValidator2018":"cred:JsonSchemaValidator2018"}},"credentialStatus":{"@id":"cred:credentialStatus","@type":"@id"},"credentialSubject":{"@id":"cred:credentialSubject","@type":"@id"},"evidence":{"@id":"cred:evidence","@type":"@id"},"expirationDate":{"@id":"cred:expirationDate","@type":"xsd:dateTime"},"holder":{"@id":"cred:holder","@type":"@id"},"issued":{"@id":"cred:issued","@type":"xsd:dateTime"},"issuer":{"@id":"cred:issuer","@type":"@id"},"issuanceDate":{"@id":"cred:issuanceDate","@type":"xsd:dateTime"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"refreshService":{"@id":"cred:refreshService","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","ManualRefreshService2018":"cred:ManualRefreshService2018"}},"termsOfUse":{"@id":"cred:termsOfUse","@type":"@id"},"validFrom":{"@id":"cred:validFrom","@type":"xsd:dateTime"},"validUntil":{"@id":"cred:validUntil","@type":"xsd:dateTime"}}},"VerifiablePresentation":{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","cred":"https://www.w3.org/2018/credentials#","sec":"https://w3id.org/security#","holder":{"@id":"cred:holder","@type":"@id"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"},"verifiableCredential":{"@id":"cred:verifiableCredential","@type":"@id","@container":"@graph"}}},"EcdsaSecp256k1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"EcdsaSecp256r1Signature2019":{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"Ed25519Signature2018":{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","xsd":"http://www.w3.org/2001/XMLSchema#","challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"RsaSignature2018":{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@version":1.1,"@protected":true,"challenge":"sec:challenge","created":{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},"domain":"sec:domain","expires":{"@id":"sec:expiration","@type":"xsd:dateTime"},"jws":"sec:jws","nonce":"sec:nonce","proofPurpose":{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","assertionMethod":{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},"proofValue":"sec:proofValue","verificationMethod":{"@id":"sec:verificationMethod","@type":"@id"}}},"proof":{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"}}}`,
|
|
7755
|
+
IDEN3_PROOFS_DEFINITION_DOCUMENT: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","Iden3SparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3SparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"@propagate":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","@vocab":"https://schema.iden3.io/core/vocab/Iden3SparseMerkleTreeProof.md#","xsd":"http://www.w3.org/2001/XMLSchema#","mtp":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@type":"SparseMerkleTreeProof"},"coreClaim":{"@id":"coreClaim","@type":"xsd:string"},"issuerData":{"@id":"issuerData","@context":{"@version":1.1,"state":{"@id":"state","@context":{"txId":{"@id":"txId","@type":"xsd:string"},"blockTimestamp":{"@id":"blockTimestamp","@type":"xsd:integer"},"blockNumber":{"@id":"blockNumber","@type":"xsd:integer"},"rootOfRoots":{"@id":"rootOfRoots","@type":"xsd:string"},"claimsTreeRoot":{"@id":"claimsTreeRoot","@type":"xsd:string"},"revocationTreeRoot":{"@id":"revocationTreeRoot","@type":"xsd:string"},"authCoreClaim":{"@id":"authCoreClaim","@type":"xsd:string"},"value":{"@id":"value","@type":"xsd:string"}}}}}}},"SparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","sec":"https://w3id.org/security#","smt-proof-vocab":"https://schema.iden3.io/core/vocab/SparseMerkleTreeProof.md#","xsd":"http://www.w3.org/2001/XMLSchema#","existence":{"@id":"smt-proof-vocab:existence","@type":"xsd:boolean"},"revocationNonce":{"@id":"smt-proof-vocab:revocationNonce","@type":"xsd:number"},"siblings":{"@id":"smt-proof-vocab:siblings","@container":"@list"},"nodeAux":"@nest","hIndex":{"@id":"smt-proof-vocab:hIndex","@nest":"nodeAux","@type":"xsd:string"},"hValue":{"@id":"smt-proof-vocab:hValue","@nest":"nodeAux","@type":"xsd:string"}}},"BJJSignature2021":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#BJJSignature2021","@context":{"@version":1.1,"@protected":true,"id":"@id","@vocab":"https://schema.iden3.io/core/vocab/BJJSignature2021.md#","@propagate":true,"type":"@type","xsd":"http://www.w3.org/2001/XMLSchema#","coreClaim":{"@id":"coreClaim","@type":"xsd:string"},"issuerData":{"@id":"issuerData","@context":{"@version":1.1,"authCoreClaim":{"@id":"authCoreClaim","@type":"xsd:string"},"mtp":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#SparseMerkleTreeProof","@type":"SparseMerkleTreeProof"},"revocationStatus":{"@id":"revocationStatus","@type":"@id"},"state":{"@id":"state","@context":{"@version":1.1,"rootOfRoots":{"@id":"rootOfRoots","@type":"xsd:string"},"claimsTreeRoot":{"@id":"claimsTreeRoot","@type":"xsd:string"},"revocationTreeRoot":{"@id":"revocationTreeRoot","@type":"xsd:string"},"value":{"@id":"value","@type":"xsd:string"}}}}},"signature":{"@id":"signature","@type":"https://w3id.org/security#multibase"},"domain":"https://w3id.org/security#domain","creator":{"@id":"creator","@type":"http://www.w3.org/2001/XMLSchema#string"},"challenge":"https://w3id.org/security#challenge","created":{"@id":"created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"expires":{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},"nonce":"https://w3id.org/security#nonce","proofPurpose":{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":true,"id":"@id","type":"@type","assertionMethod":{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},"authentication":{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},"capabilityInvocation":{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},"capabilityDelegation":{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},"keyAgreement":{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},"proofValue":{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},"verificationMethod":{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}},"Iden3ReverseSparseMerkleTreeProof":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3ReverseSparseMerkleTreeProof","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-reverse-sparse-merkle-tree-proof-vocab":"https://schema.iden3.io/core/vocab/Iden3ReverseSparseMerkleTreeProof.md#","revocationNonce":"iden3-reverse-sparse-merkle-tree-proof-vocab:revocationNonce","statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-reverse-sparse-merkle-tree-proof-vocab:statusIssuer"}}},"Iden3commRevocationStatusV1.0":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3commRevocationStatusV1.0","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-comm-revocation-statusV1.0-vocab":"https://schema.iden3.io/core/vocab/Iden3commRevocationStatusV1.0.md#","revocationNonce":"iden3-comm-revocation-statusV1.0-vocab:revocationNonce","statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-comm-revocation-statusV1.0-vocab:statusIssuer"}}},"Iden3OnchainSparseMerkleTreeProof2023":{"@id":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3OnchainSparseMerkleTreeProof2023","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3-onchain-sparse-merkle-tree-proof-2023-vocab":"https://schema.iden3.io/core/vocab/Iden3OnchainSparseMerkleTreeProof2023.md#","revocationNonce":"iden3-onchain-sparse-merkle-tree-proof-2023-vocab:revocationNonce","statusIssuer":{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type"},"@id":"iden3-onchain-sparse-merkle-tree-proof-2023-vocab:statusIssuer"}}},"JsonSchema2023":"https://www.w3.org/ns/credentials#JsonSchema2023","Iden3RefreshService2023":"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld#Iden3RefreshService2023"}}`,
|
|
7756
|
+
IDEN3_DISPLAY_METHOD_DEFINITION_DOCUMENT: `{"@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","displayMethod":{"@id":"https://schema.iden3.io/core/vocab/displayMethod.md#displayMethod","@type":"@id","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","Iden3BasicDisplayMethodV1":"https://schema.iden3.io/core/vocab/displayMethod.md#Iden3BasicDisplayMethodV1"}}}}`
|
|
7755
7757
|
},
|
|
7756
7758
|
// JsonSchema2023 JSON schema for verification of Iden3Credential
|
|
7757
7759
|
JSON_SCHEMA_VALIDATOR: 'JsonSchema2023',
|
|
@@ -7766,7 +7768,8 @@ var PolygonIdSdk = (function (exports) {
|
|
|
7766
7768
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON_URL: 'https://schema.iden3.io/core/json/auth.json',
|
|
7767
7769
|
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL: 'https://schema.iden3.io/core/jsonld/auth.jsonld',
|
|
7768
7770
|
AUTH_BJJ_CREDENTIAL_TYPE: 'AuthBJJCredential',
|
|
7769
|
-
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON: `{"$schema":"http://json-schema.org/draft-07/schema#","$metadata":{"uris":{"jsonLdContext":"https://schema.iden3.io/core/jsonld/auth.jsonld","jsonSchema":"https://schema.iden3.io/core/json/auth.json"},"serialization":{"indexDataSlotA":"x","indexDataSlotB":"y"}},"type":"object","required":["@context","id","type","issuanceDate","credentialSubject","credentialSchema","credentialStatus","issuer"],"properties":{"@context":{"type":["string","array","object"]},"id":{"type":"string"},"type":{"type":["string","array"],"items":{"type":"string"}},"issuer":{"type":["string","object"],"format":"uri","required":["id"],"properties":{"id":{"type":"string","format":"uri"}}},"issuanceDate":{"type":"string","format":"date-time"},"expirationDate":{"type":"string","format":"date-time"},"credentialSchema":{"type":"object","required":["id","type"],"properties":{"id":{"type":"string","format":"uri"},"type":{"type":"string"}}},"credentialSubject":{"type":"object","required":["x","y"],"properties":{"id":{"title":"Credential Subject ID","type":"string","format":"uri"},"x":{"type":"string"},"y":{"type":"string"}}}}}
|
|
7771
|
+
AUTH_BJJ_CREDENTIAL_SCHEMA_JSON: `{"$schema":"http://json-schema.org/draft-07/schema#","$metadata":{"uris":{"jsonLdContext":"https://schema.iden3.io/core/jsonld/auth.jsonld","jsonSchema":"https://schema.iden3.io/core/json/auth.json"},"serialization":{"indexDataSlotA":"x","indexDataSlotB":"y"}},"type":"object","required":["@context","id","type","issuanceDate","credentialSubject","credentialSchema","credentialStatus","issuer"],"properties":{"@context":{"type":["string","array","object"]},"id":{"type":"string"},"type":{"type":["string","array"],"items":{"type":"string"}},"issuer":{"type":["string","object"],"format":"uri","required":["id"],"properties":{"id":{"type":"string","format":"uri"}}},"issuanceDate":{"type":"string","format":"date-time"},"expirationDate":{"type":"string","format":"date-time"},"credentialSchema":{"type":"object","required":["id","type"],"properties":{"id":{"type":"string","format":"uri"},"type":{"type":"string"}}},"credentialSubject":{"type":"object","required":["x","y"],"properties":{"id":{"title":"Credential Subject ID","type":"string","format":"uri"},"x":{"type":"string"},"y":{"type":"string"}}}}}`,
|
|
7772
|
+
AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD: `{"@context":[{"@version":1.1,"@protected":true,"id":"@id","type":"@type","AuthBJJCredential":{"@id":"https://schema.iden3.io/core/jsonld/auth.jsonld#AuthBJJCredential","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","iden3_serialization":"iden3:v1:slotIndexA=x&slotIndexB=y","xsd":"http://www.w3.org/2001/XMLSchema#","auth-vocab":"https://schema.iden3.io/core/vocab/auth.md#","x":{"@id":"auth-vocab:x","@type":"xsd:positiveInteger"},"y":{"@id":"auth-vocab:y","@type":"xsd:positiveInteger"}}},"Iden3StateInfo2023":{"@id":"https://schema.iden3.io/core/jsonld/auth.jsonld#Iden3StateInfo2023","@context":{"@version":1.1,"@protected":true,"id":"@id","type":"@type","xsd":"http://www.w3.org/2001/XMLSchema#","@vocab":"https://schema.iden3.io/core/vocab/state-info.md#","@propagate":true,"stateContractAddress":{"@id":"stateContractAddress","@type":"xsd:string"},"published":{"@id":"published","@type":"xsd:boolean"},"info":{"@id":"info","@type":"@id","@context":{"@protected":true,"id":{"@id":"id","@type":"xsd:string"},"state":{"@id":"state","@type":"xsd:string"},"replacedByState":{"@id":"replacedByState","@type":"xsd:string"},"createdAtTimestamp":{"@id":"createdAtTimestamp","@type":"xsd:string"},"replacedAtTimestamp":{"@id":"replacedAtTimestamp","@type":"xsd:string"},"createdAtBlock":{"@id":"createdAtBlock","@type":"xsd:string"},"replacedAtBlock":{"@id":"replacedAtBlock","@type":"xsd:string"}}},"global":{"@id":"global","@type":"@id","@context":{"@protected":true,"sec":"https://w3id.org/security#","root":{"@id":"root","@type":"xsd:string"},"replacedByRoot":{"@id":"replacedByRoot","@type":"xsd:string"},"createdAtTimestamp":{"@id":"createdAtTimestamp","@type":"xsd:string"},"replacedAtTimestamp":{"@id":"replacedAtTimestamp","@type":"xsd:string"},"createdAtBlock":{"@id":"createdAtBlock","@type":"xsd:string"},"replacedAtBlock":{"@id":"replacedAtBlock","@type":"xsd:string"},"proof":{"@id":"sec:proof","@type":"@id","@container":"@graph"}}}}}}]}`
|
|
7770
7773
|
}
|
|
7771
7774
|
});
|
|
7772
7775
|
/**
|
|
@@ -8121,7 +8124,7 @@ var PolygonIdSdk = (function (exports) {
|
|
|
8121
8124
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
8122
8125
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8123
8126
|
*/
|
|
8124
|
-
const dh=Vs,hh=Ml,fh=hl,ph=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e;}async resolve({activeCtx:e,context:t,documentLoader:r,base:n,cycles:i=new Set}){t&&uu(t)&&t["@context"]&&(t=t["@context"]),t=du(t);const o=[];for(const a of t){if(cu(a)){let t=this._get(a);t||(t=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:r,base:n,cycles:i})),lu(t)?o.push(...t):o.push(t);continue}if(null===a){o.push(new pu({document:null}));continue}uu(a)||mu(t);const s=JSON.stringify(a);let l=this._get(s);l||(l=new pu({document:a}),this._cacheResolvedContext({key:s,resolved:l,tag:"static"})),o.push(l);}return o}_get(e){let t=this.perOpCache.get(e);if(!t){const r=this.sharedCache.get(e);r&&(t=r.get("static"),t&&this.perOpCache.set(e,t));}return t}_cacheResolvedContext({key:e,resolved:t,tag:r}){if(this.perOpCache.set(e,t),void 0!==r){let n=this.sharedCache.get(e);n||(n=new Map,this.sharedCache.set(e,n)),n.set(r,t);}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:r,base:n,cycles:i}){t=hu(n,t);const{context:o,remoteDoc:a}=await this._fetchContext({activeCtx:e,url:t,documentLoader:r,cycles:i});yu({context:o,base:n=a.documentUrl||t});const s=await this.resolve({activeCtx:e,context:o,documentLoader:r,base:n,cycles:i});return this._cacheResolvedContext({key:t,resolved:s,tag:a.tag}),s}async _fetchContext({activeCtx:e,url:t,documentLoader:r,cycles:n}){if(n.size>10)throw new fu("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"loading remote context failed":"context overflow",max:10});if(n.has(t))throw new fu("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"recursive context inclusion":"context overflow",url:t});let i,o;n.add(t);try{o=await r(t),i=o.document||null,cu(i)&&(i=JSON.parse(i));}catch(e){throw new fu("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:t,cause:e})}if(!uu(i))throw new fu("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:t});return i="@context"in i?{"@context":i["@context"]}:{"@context":{}},o.contextUrl&&(lu(i["@context"])||(i["@context"]=[i["@context"]]),i["@context"].push(o.contextUrl)),{context:i,remoteDoc:o}}},mh=fh.IdentifierIssuer,yh=tl,gh=au,vh=gu,{expand:wh}=pc,{flatten:bh}=Dc,{fromRDF:_h}=Jc,{toRDF:Eh}=yd,{frameMergedOrDefault:Th,cleanupNull:xh}=kd,{isArray:Ih,isObject:Sh,isString:Rh}=Zs,{isSubjectReference:kh}=el,{expandIri:jh,getInitialContext:Dh,process:Nh,processingMode:Oh}=Uu,{compact:Ch,compactIri:Ah}=uh,{createNodeMap:Mh,createMergedNodeMap:Lh,mergeNodeMaps:Ph}=Sc,{logEventHandler:Bh,logWarningEventHandler:$h,safeEventHandler:Fh,setDefaultEventHandler:Uh,setupEventHandler:qh,strictEventHandler:Yh,unhandledEventHandler:Wh}=Eu,zh=function(e){const t={},r=new gh({max:100});function n(t,{documentLoader:r=e.documentLoader,...n}){if(t&&"compactionMap"in t)throw new yh('"compactionMap" not supported.',"jsonld.OptionsError");if(t&&"expansionMap"in t)throw new yh('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:r},n,t,{eventHandler:qh({options:t})})}return e.compact=async function(t,i,o){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===i)throw new yh("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let a;(o=n(o,{base:Rh(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new mh("_:b"),contextResolver:new ph({sharedCache:r})})).link&&(o.skipExpansion=!0),o.compactToRelative||delete o.base,a=o.skipExpansion?t:await e.expand(t,o);const s=await e.processContext(Dh(o),i,o);let l=await Ch({activeCtx:s,element:a,options:o});o.compactArrays&&!o.graph&&Ih(l)?1===l.length?l=l[0]:0===l.length&&(l={}):o.graph&&Sh(l)&&(l=[l]),Sh(i)&&"@context"in i&&(i=i["@context"]),i=fh.clone(i),Ih(i)||(i=[i]);const u=i;i=[];for(let e=0;e<u.length;++e)(!Sh(u[e])||Object.keys(u[e]).length>0)&&i.push(u[e]);const c=i.length>0;if(1===i.length&&(i=i[0]),Ih(l)){const e=Ah({activeCtx:s,iri:"@graph",relativeTo:{vocab:!0}}),t=l;l={},c&&(l["@context"]=i),l[e]=t;}else if(Sh(l)&&c){const e=l;l={"@context":i};for(const t in e)l[t]=e[t];}return l},e.expand=async function(t,i){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");const o={},a=[];if("expandContext"in(i=n(i,{keepFreeFloatingNodes:!1,contextResolver:new ph({sharedCache:r})}))){const e=fh.clone(i.expandContext);Sh(e)&&"@context"in e?o.expandContext=e:o.expandContext={"@context":e},a.push(o.expandContext);}let s;if(Rh(t)){const r=await e.get(t,i);s=r.documentUrl,o.input=r.document,r.contextUrl&&(o.remoteContext={"@context":r.contextUrl},a.push(o.remoteContext));}else o.input=fh.clone(t);"base"in i||(i.base=s||"");let l=Dh(i);for(const e of a)l=await Nh({activeCtx:l,localCtx:e,options:i});let u=await wh({activeCtx:l,element:o.input,options:i});return Sh(u)&&"@graph"in u&&1===Object.keys(u).length?u=u["@graph"]:null===u&&(u=[]),Ih(u)||(u=[u]),u},e.flatten=async function(t,i,o){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");i="function"==typeof i?null:i||null,o=n(o,{base:Rh(t)?t:"",contextResolver:new ph({sharedCache:r})});const a=await e.expand(t,o),s=bh(a);if(null===i)return s;o.graph=!0,o.skipExpansion=!0;return await e.compact(s,i,o)},e.frame=async function(t,i,o){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(o=n(o,{base:Rh(t)?t:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new ph({sharedCache:r})}),Rh(i)){const t=await e.get(i,o);if(i=t.document,t.contextUrl){let e=i["@context"];e?Ih(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,i["@context"]=e;}}const a=i&&i["@context"]||{},s=await e.processContext(Dh(o),a,o);o.hasOwnProperty("omitGraph")||(o.omitGraph=Oh(s,1.1)),o.hasOwnProperty("pruneBlankNodeIdentifiers")||(o.pruneBlankNodeIdentifiers=Oh(s,1.1));const l=await e.expand(t,o),u={...o};u.isFrame=!0,u.keepFreeFloatingNodes=!0;const c=await e.expand(i,u),d=Object.keys(i).map((e=>jh(s,e,{vocab:!0})));u.merged=!d.includes("@graph"),u.is11=Oh(s,1.1);const h=Th(l,c,u);u.graph=!o.omitGraph,u.skipExpansion=!0,u.link={},u.framing=!0;let f=await e.compact(h,a,u);return u.link={},f=xh(f,u),f},e.link=async function(t,r,n){const i={};return r&&(i["@context"]=r),i["@embed"]="@link",e.frame(t,i,n)},e.normalize=e.canonize=async function(t,i){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(i=n(i,{base:Rh(t)?t:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new ph({sharedCache:r})}))){if("application/n-quads"!==i.inputFormat&&"application/nquads"!==i.inputFormat)throw new yh("Unknown canonicalization input format.","jsonld.CanonizeError");const e=vh.parse(t);return dh.canonize(e,i)}const o={...i};delete o.format,o.produceGeneralizedRdf=!1;const a=await e.toRDF(t,o);return dh.canonize(a,i)},e.fromRDF=async function(e,r){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");r=n(r,{format:Rh(e)?"application/n-quads":void 0});const{format:i}=r;let{rdfParser:o}=r;if(i){if(o=o||t[i],!o)throw new yh("Unknown input format.","jsonld.UnknownFormat",{format:i})}else o=()=>e;const a=await o(e);return _h(a,r)},e.toRDF=async function(t,i){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let o;o=(i=n(i,{base:Rh(t)?t:"",skipExpansion:!1,contextResolver:new ph({sharedCache:r})})).skipExpansion?t:await e.expand(t,i);const a=Eh(o,i);if(i.format){if("application/n-quads"===i.format||"application/nquads"===i.format)return vh.serialize(a);throw new yh("Unknown output format.","jsonld.UnknownFormat",{format:i.format})}return a},e.createNodeMap=async function(t,i){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");i=n(i,{base:Rh(t)?t:"",contextResolver:new ph({sharedCache:r})});const o=await e.expand(t,i);return Lh(o,i)},e.merge=async function(t,i,o){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!Ih(t))throw new TypeError('Could not merge, "docs" must be an array.');i="function"==typeof i?null:i||null,o=n(o,{contextResolver:new ph({sharedCache:r})});const a=await Promise.all(t.map((t=>{const r={...o};return e.expand(t,r)})));let s=!0;"mergeNodes"in o&&(s=o.mergeNodes);const l=o.issuer||new mh("_:b"),u={"@default":{}};for(let e=0;e<a.length;++e){const t=fh.relabelBlankNodes(a[e],{issuer:new mh("_:b"+e+"-")}),r=s||0===e?u:{"@default":{}};if(Mh(t,r,"@default",l),r!==u)for(const e in r){const t=r[e];if(!(e in u)){u[e]=t;continue}const n=u[e];for(const e in t)e in n||(n[e]=t[e]);}}const c=Ph(u),d=[],h=Object.keys(c).sort();for(let e=0;e<h.length;++e){const t=c[h[e]];kh(t)||d.push(t);}if(null===i)return d;o.graph=!0,o.skipExpansion=!0;return await e.compact(d,i,o)},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new yh("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:e})},e.get=async function(t,r){let n;n="function"==typeof r.documentLoader?r.documentLoader:e.documentLoader;const i=await n(t);try{if(!i.document)throw new yh("No remote document found at the given URL.","jsonld.NullRemoteDocument");Rh(i.document)&&(i.document=JSON.parse(i.document));}catch(e){throw new yh("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,i){return i=n(i,{base:"",contextResolver:new ph({sharedCache:r})}),null===t?Dh(i):(t=fh.clone(t),Sh(t)&&"@context"in t||(t={"@context":t}),Nh({activeCtx:e,localCtx:t,options:i}))},e.getContextValue=Uu.getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new yh('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",vh.parse),e.registerRDFParser("application/nquads",vh.parse),e.url=El,e.logEventHandler=Bh,e.logWarningEventHandler=$h,e.safeEventHandler=Fh,e.setDefaultEventHandler=Uh,e.strictEventHandler=Yh,e.unhandledEventHandler=Wh,e.util=fh,Object.assign(e,fh),e.promises=e,e.RequestQueue=wl(),e.JsonLdProcessor=(lh||(lh=1,sh=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}),sh)(e),hh.setupGlobals(e),hh.setupDocumentLoaders(e),e},Gh=function(){return zh((function(){return Gh()}))};zh(Gh);var Hh=Gh;function Jh(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Vh={exports:{}};Vh.exports=function(){function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){if(!s&&Jh)return Jh(a);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[a]={exports:{}};t[a][0].call(u.exports,(function(e){return i(t[a][1][e]||e)}),u,u.exports,e,t,r,n);}return r[a].exports}for(var o=Jh,a=0;a<n.length;a++)i(n[a]);return i}return e}()({1:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;const n="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i="http://www.w3.org/2001/XMLSchema#",o="http://www.w3.org/2000/10/swap/";r.default={xsd:{decimal:`${i}decimal`,boolean:`${i}boolean`,double:`${i}double`,integer:`${i}integer`,string:`${i}string`},rdf:{type:`${n}type`,nil:`${n}nil`,first:`${n}first`,rest:`${n}rest`,langString:`${n}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${o}reify#forSome`,forAll:`${o}reify#forAll`},log:{implies:`${o}log#implies`}};},{}],2:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.Variable=r.Triple=r.Term=r.Quad=r.NamedNode=r.Literal=r.DefaultGraph=r.BlankNode=void 0,r.escapeQuotes=b,r.termFromId=g,r.termToId=v,r.unescapeQuotes=_;var n=i(e("./IRIs"));function i(e){return e&&e.__esModule?e:{default:e}}const{rdf:o,xsd:a}=n.default;let s,l=0;const u=/^"(.*".*)(?="[^"]*$)/,c={namedNode:E,blankNode:T,variable:I,literal:x,defaultGraph:S,quad:R,triple:R};r.default=c;class d{constructor(e){this.id=e;}get value(){return this.id}equals(e){return e instanceof d?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return {termType:this.termType,value:this.value}}}r.Term=d;class h extends d{get termType(){return "NamedNode"}}r.NamedNode=h;class f extends d{get termType(){return "Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&"@"===e[t++]?e.substr(t).toLowerCase():""}get datatype(){return new h(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,r=t<e.length?e[t]:"";return "^"===r?e.substr(t+2):"@"!==r?a.string:o.langString}equals(e){return e instanceof f?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return {termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}}r.Literal=f;class p extends d{constructor(e){super(`_:${e}`);}get termType(){return "BlankNode"}get value(){return this.id.substr(2)}}r.BlankNode=p;class m extends d{constructor(e){super(`?${e}`);}get termType(){return "Variable"}get value(){return this.id.substr(1)}}r.Variable=m;class y extends d{constructor(){return super(""),s||this}get termType(){return "DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}}function g(e,t,r){if(t=t||c,!e)return t.defaultGraph();switch(e[0]){case"?":return t.variable(e.substr(1));case"_":return t.blankNode(e.substr(2));case'"':if(t===c)return new f(e);if('"'===e[e.length-1])return t.literal(e.substr(1,e.length-2));const n=e.lastIndexOf('"',e.length-1);return t.literal(e.substr(1,n-1),"@"===e[n+1]?e.substr(n+2):t.namedNode(e.substr(n+3)));case"[":e=JSON.parse(e);break;default:if(!r||!Array.isArray(e))return t.namedNode(e)}return t.quad(g(e[0],t,!0),g(e[1],t,!0),g(e[2],t,!0),e[3]&&g(e[3],t,!0))}function v(e,t){if("string"==typeof e)return e;if(e instanceof d&&"Quad"!==e.termType)return e.id;if(!e)return s.id;switch(e.termType){case"NamedNode":return e.value;case"BlankNode":return `_:${e.value}`;case"Variable":return `?${e.value}`;case"DefaultGraph":return "";case"Literal":return `"${e.value}"${e.language?`@${e.language}`:e.datatype&&e.datatype.value!==a.string?`^^${e.datatype.value}`:""}`;case"Quad":const r=[v(e.subject,!0),v(e.predicate,!0),v(e.object,!0)];return e.graph&&"DefaultGraph"!==e.graph.termType&&r.push(v(e.graph,!0)),t?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${e.termType}`)}}r.DefaultGraph=y,s=new y;class w extends d{constructor(e,t,r,n){super(""),this._subject=e,this._predicate=t,this._object=r,this._graph=n||s;}get termType(){return "Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return {termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(e){return !!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}}function b(e){return e.replace(u,((e,t)=>`"${t.replace(/"/g,'""')}`))}function _(e){return e.replace(u,((e,t)=>`"${t.replace(/""/g,'"')}`))}function E(e){return new h(e)}function T(e){return new p(e||"n3-"+l++)}function x(e,t){if("string"==typeof t)return new f(`"${e}"@${t.toLowerCase()}`);let r=t?t.value:"";return ""===r&&("boolean"==typeof e?r=a.boolean:"number"==typeof e&&(Number.isFinite(e)?r=Number.isInteger(e)?a.integer:a.double:(r=a.double,Number.isNaN(e)||(e=e>0?"INF":"-INF")))),""===r||r===a.string?new f(`"${e}"`):new f(`"${e}"^^${r}`)}function I(e){return new m(e)}function S(){return s}function R(e,t,r,n){return new w(e,t,r,n)}r.Triple=r.Quad=w;},{"./IRIs":1}],3:[function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=o(e("queue-microtask")),i=o(e("./IRIs"));function o(e){return e&&e.__esModule?e:{default:e}}const{xsd:a}=i.default,s=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,l={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},u=/[\x00-\x20<>\\"\{\}\|\^\`]/,c={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},d=/$0^/;class h{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const e in this)!(e in c)&&this[e]instanceof RegExp&&(this[e]=d);}else this._n3Mode=!1!==e.n3;this._comments=!!e.comments,this._literalClosingPos=0;}_tokenizeToEnd(e,t){let r=this._input,n=r.length;for(;;){let e,s;for(;e=this._newline.exec(r);)this._comments&&(s=this._comment.exec(e[0]))&&i("comment",s[1],"",this._line,e[0].length),r=r.substr(e[0].length,r.length),n=r.length,this._line++;if(!e&&(e=this._whitespace.exec(r))&&(r=r.substr(e[0].length,r.length)),this._endOfFile.test(r))return t&&(this._comments&&(s=this._comment.exec(r))&&i("comment",s[1],"",this._line,r.length),r=null,i("eof","","",this._line,0)),this._input=r;const l=this._line,c=r[0];let d="",h="",f="",p=null,m=0,y=!1;switch(c){case"^":if(r.length<3)break;if("^"!==r[1]){this._n3Mode&&(m=1,d="^");break}if(this._previousMarker="^^",r=r.substr(2),"<"!==r[0]){y=!0;break}case"<":if(p=this._unescapedIri.exec(r))d="IRI",h=p[1];else if(p=this._iri.exec(r)){if(h=this._unescape(p[1]),null===h||u.test(h))return o(this);d="IRI";}else r.length>1&&"<"===r[1]?(d="<<",m=2):this._n3Mode&&r.length>1&&"="===r[1]&&(d="inverse",m=2,h=">");break;case">":r.length>1&&">"===r[1]&&(d=">>",m=2);break;case"_":((p=this._blank.exec(r))||t&&(p=this._blank.exec(`${r} `)))&&(d="blank",f="_",h=p[1]);break;case'"':if(p=this._simpleQuotedString.exec(r))h=p[1];else if(({value:h,matchLength:m}=this._parseLiteral(r)),null===h)return o(this);null===p&&0===m||(d="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(p=this._simpleApostropheString.exec(r))h=p[1];else if(({value:h,matchLength:m}=this._parseLiteral(r)),null===h)return o(this);null===p&&0===m||(d="literal",this._literalClosingPos=0);}break;case"?":this._n3Mode&&(p=this._variable.exec(r))&&(d="var",h=p[0]);break;case"@":"literal"===this._previousMarker&&(p=this._langcode.exec(r))?(d="langcode",h=p[1]):(p=this._keyword.exec(r))&&(d=p[0]);break;case".":if(1===r.length?t:r[1]<"0"||r[1]>"9"){d=".",m=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(p=this._number.exec(r)||t&&(p=this._number.exec(`${r} `)))&&(d="literal",h=p[0],f="string"==typeof p[1]?a.double:"string"==typeof p[2]?a.decimal:a.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(p=this._sparqlKeyword.exec(r))?d=p[0].toUpperCase():y=!0;break;case"f":case"t":(p=this._boolean.exec(r))?(d="literal",h=p[0],f=a.boolean):y=!0;break;case"a":(p=this._shortPredicates.exec(r))?(d="abbreviation",h="a"):y=!0;break;case"=":this._n3Mode&&r.length>1&&(d="abbreviation",">"!==r[1]?(m=1,h="="):(m=2,h=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(m=1,d=c);break;case"{":!this._lineMode&&r.length>=2&&("|"===r[1]?(d="{|",m=2):(d=c,m=1));break;case"|":r.length>=2&&"}"===r[1]&&(d="|}",m=2);break;default:y=!0;}if(y&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(p=this._prefix.exec(r))?((p=this._prefixed.exec(r))||t&&(p=this._prefixed.exec(`${r} `)))&&(d="prefixed",f=p[1]||"",h=this._unescape(p[2])):(d="prefix",h=p[1]||"")),"^^"===this._previousMarker)switch(d){case"prefixed":d="type";break;case"IRI":d="typeIRI";break;default:d="";}if(!d)return t||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?o(this):this._input=r;const g=m||p[0].length,v=i(d,h,f,l,g);this.previousToken=v,this._previousMarker=d,r=r.substr(g,r.length);}function i(t,i,o,a,s){const l=r?n-r.length:n,u={type:t,value:i,prefix:o,line:a,start:l,end:l+s};return e(null,u),u}function o(t){e(t._syntaxError(/^\S*/.exec(r)[0]));}}_unescape(e){let t=!1;const r=e.replace(s,((e,r,n,i)=>{if("string"==typeof r)return String.fromCharCode(Number.parseInt(r,16));if("string"==typeof n){let e=Number.parseInt(n,16);return e<=65535?String.fromCharCode(Number.parseInt(n,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e))}return i in l?l[i]:(t=!0,"")}));return t?null:r}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],r=t.length;let n=Math.max(this._literalClosingPos,r);for(;(n=e.indexOf(t,n))>0;){let t=0;for(;"\\"===e[n-t-1];)t++;if(t%2==0){const t=e.substring(r,n),i=t.split(/\r\n|\r|\n/).length-1,o=n+r;if(1===r&&0!==i||3===r&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:o}}n++;}this._literalClosingPos=e.length-r+1;}return {value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\ufeff")?e.substr(1):e}tokenize(e,r){if(this._line=1,"string"==typeof e){if(this._input=this._readStartingBom(e),"function"!=typeof r){const e=[];let t;if(this._tokenizeToEnd(((r,n)=>r?t=r:e.push(n)),!0),t)throw t;return e}(0, n.default)((()=>this._tokenizeToEnd(r,!0)));}else this._pendingBuffer=null,"function"==typeof e.setEncoding&&e.setEncoding("utf8"),e.on("data",(e=>{null!==this._input&&0!==e.length&&(this._pendingBuffer&&(e=t.concat([this._pendingBuffer,e]),this._pendingBuffer=null),128&e[e.length-1]?this._pendingBuffer=e:(void 0===this._input?this._input=this._readStartingBom("string"==typeof e?e:e.toString()):this._input+=e,this._tokenizeToEnd(r,!1)));})),e.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(r,!0);})),e.on("error",r);}}r.default=h;}).call(this);}).call(this,e("buffer").Buffer);},{"./IRIs":1,buffer:15,"queue-microtask":19}],4:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=a(e("./N3Lexer")),i=a(e("./N3DataFactory")),o=a(e("./IRIs"));function a(e){return e&&e.__esModule?e:{default:e}}let s=0;class l{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&c(this,e.factory);const t="string"==typeof e.format?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(t),i=/trig/.test(t),o=/triple/.test(t),a=/quad/.test(t),s=this._n3Mode=/n3/.test(t),l=o||a;(this._supportsNamedGraphs=!(r||s))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||i||o||s),this._supportsRDFStar=""===t||/star|\*$/.test(t),l&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix="string"!=typeof e.blankNodePrefix?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new n.default({lineMode:l,n3:s}),this._explicitQuantifiers=!!e.explicitQuantifiers;}static _resetBlankNodePrefix(){s=0;}_setBase(e){if(e){const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1];}else this._base="",this._basePath="";}_saveContext(e,t,r,n,i){const o=this._n3Mode;this._contextStack.push({type:e,subject:r,predicate:n,object:i,graph:t,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified));}_restoreContext(e,t){const r=this._contextStack.pop();if(!r||r.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified);}_readInTopContext(e){switch(e.type){case"eof":return null!==this._graph?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let r;switch(e.type){case"IRI":case"typeIRI":const t=this._resolveIRI(e.value);if(null===t)return this._error("Invalid IRI",e);r=this._namedNode(t);break;case"type":case"prefixed":const n=this._prefixes[e.prefix];if(void 0===n)return this._error(`Undefined prefix "${e.prefix}:"`,e);r=this._namedNode(n+e.value);break;case"blank":r=this._blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return !t&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(0===e.prefix.length)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._literal(e.value,this._namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._subject=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${t}`,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if(void 0===(this._predicate=this._readEntity(e)))return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(0===e.prefix.length)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._literal(e.value,this._namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._object=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return "{"===e.type?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return "{"!==e.type?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return "]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=null===this._predicate;return this._restoreContext("blank",e),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,r=null,n=this._readListItem;const i=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,r=this._blankNode(),this.RDF_FIRST,this._subject=t=this._blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;r=this.RDF_NIL;break;case"literal":0===e.prefix.length?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(t=this._literal(e.value,this._namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(t=this._readEntity(e)))return}if(null===r&&(this._subject=r=this._blankNode()),null===i?null===a.predicate?a.subject=r:a.object=r:this._emit(i,this.RDF_REST,r,this._graph),null!==t){if(this._n3Mode&&("IRI"===e.type||"prefixed"===e.type))return this._saveContext("item",this._graph,r,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,t,this._graph);}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const r=this._readEntity(e);if(void 0===r)return;t=this._literal(this._literalValue,r),e=null;break;case"langcode":t=this._literal(this._literalValue,e.value),e=null;}return {token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const r=this._completeLiteral(e);if(r)return this._object=r.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===r.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.token))}_readFormulaTail(e){return "}"!==e.type?this._readPunctuation(e):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,r=this._graph;const n=this._subject,i=this._inversePredicate;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF* syntax",e);const o=this._predicate,a=this._object;this._subject=this._quad(n,o,a,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(r=this._readEntity(e))){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(null!==n){const e=this._predicate,t=this._object;i?this._emit(t,e,n,r):this._emit(n,e,t,r);}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return "."!==e.type?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return "prefix"!==e.type?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if("IRI"!==e.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t="IRI"===e.type&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return "]"!==e.type?this._error("Invalid graph label",e):(this._subject=this._blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):"."!==e.type?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if(void 0!==(t=this._readEntity(e,!0)))break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return ","===e.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const t=this._contextStack,r=t.length&&t[t.length-1];if(r&&"item"===r.type){const t=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,t,this._graph);}return this._afterPath(e)}}_readForwardPath(e){let t,r;const n=this._blankNode();if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(t=this._subject,this._subject=n):(t=this._object,this._object=n),this._emit(t,r,n,this._graph),this._readPath}_readBackwardPath(e){const t=this._blankNode();let r,n;if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(n=this._subject,this._subject=t):(n=this._object,this._object=t),this._emit(t,r,n,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return ">>"!==e.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(e))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(">>"!==e.type)return this._error(`Expected >> but got ${e.type}`,e);const t=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),null===this._subject?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,r,n){this._callback(null,this._quad(e,t,r,n||this.DEFAULTGRAPH));}_error(e,t){const r=new Error(`${e} on line ${t.line}.`);r.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=u;}_resolveIRI(e){return /^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return ("/"===e[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return /^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let r="",n=-1,i=-1,o=0,a="/";for(;n<t;){switch(a){case":":if(i<0&&"/"===e[++n]&&"/"===e[++n])for(;(i=n+1)<t&&"/"!==e[i];)n=i;break;case"?":case"#":n=t;break;case"/":if("."===e[n+1])switch(a=e[1+ ++n],a){case"/":r+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return r+e.substring(o,n)+e.substr(n+1);case".":if(a=e[1+ ++n],void 0===a||"/"===a||"?"===a||"#"===a){if(r+=e.substring(o,n-2),(o=r.lastIndexOf("/"))>=i&&(r=r.substr(0,o)),"/"!==a)return `${r}/${e.substr(n+1)}`;o=n+1;}}}a=e[++n];}return r+e.substring(o)}parse(e,t,r){if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${s++}_`,this._prefixCallback=r||u,this._inversePredicate=!1,this._quantified=Object.create(null),!t){const t=[];let r;if(this._callback=(e,n)=>{e?r=e:n&&t.push(n);},this._lexer.tokenize(e).every((e=>this._readCallback=this._readCallback(e))),r)throw r;return t}this._callback=t,this._lexer.tokenize(e,((e,t)=>{null!==e?(this._callback(e),this._callback=u):this._readCallback&&(this._readCallback=this._readCallback(t));}));}}function u(){}function c(e,t){const r=t.namedNode;e._namedNode=r,e._blankNode=t.blankNode,e._literal=t.literal,e._variable=t.variable,e._quad=t.quad,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=r(o.default.rdf.first),e.RDF_REST=r(o.default.rdf.rest),e.RDF_NIL=r(o.default.rdf.nil),e.N3_FORALL=r(o.default.r.forAll),e.N3_FORSOME=r(o.default.r.forSome),e.ABBREVIATIONS={a:r(o.default.rdf.type),"=":r(o.default.owl.sameAs),">":r(o.default.log.implies)},e.QUANTIFIERS_GRAPH=r("urn:n3:quantifiers");}r.default=l,c(l.prototype,i.default);},{"./IRIs":1,"./N3DataFactory":2,"./N3Lexer":3}],5:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=u(e("./N3DataFactory")),o=s(e("./IRIs")),a=e("./N3Util");function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (l=function(e){return e?r:t})(e)}function u(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=l(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}class c{constructor(e,t){this._size=0,this._graphs=Object.create(null),this._id=0,this._ids=Object.create(null),this._entities=Object.create(null),this._blankNodeIndex=0,t||!e||e[0]||(t=e,e=null),t=t||{},this._factory=t.factory||i.default,e&&this.addQuads(e);}_termFromId(e,t){if("."===e[0]){const t=this._entities,r=e.split(".");return this._factory.quad(this._termFromId(t[r[1]]),this._termFromId(t[r[2]]),this._termFromId(t[r[3]]),r[4]&&this._termFromId(t[r[4]]))}return (0, i.termFromId)(e,t)}_termToNumericId(e){if("Quad"===e.termType){const t=this._termToNumericId(e.subject),r=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let i;return t&&r&&n&&((0, a.isDefaultGraph)(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${r}.${n}.${i}`:`.${t}.${r}.${n}`]}return this._ids[(0, i.termToId)(e)]}_termToNewNumericId(e){const t=e&&"Quad"===e.termType?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${(0, a.isDefaultGraph)(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:(0, i.termToId)(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}get size(){let e=this._size;if(null!==e)return e;e=0;const t=this._graphs;let r,n;for(const i in t)for(const o in r=t[i].subjects)for(const t in n=r[o])e+=Object.keys(n[t]).length;return this._size=e}_addToIndex(e,t,r,n){const i=e[t]||(e[t]={}),o=i[r]||(i[r]={}),a=n in o;return a||(o[n]=null),!a}_removeFromIndex(e,t,r,n){const i=e[t],o=i[r];delete o[n];for(const e in o)return;delete i[r];for(const e in i)return;delete e[t];}*_findInIndex(e,t,r,n,i,o,a,s){let l,u,c;const d=this._entities,h=this._termFromId(s,this._factory),f={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const t in e)if(u=e[t]){f[i]=this._termFromId(d[t],this._factory),r&&((l=u,u={})[r]=l[r]);for(const e in u)if(c=u[e]){f[o]=this._termFromId(d[e],this._factory);const t=n?n in c?[n]:[]:Object.keys(c);for(let e=0;e<t.length;e++)f[a]=this._termFromId(d[t[e]],this._factory),yield this._factory.quad(f.subject,f.predicate,f.object,h);}}}_loop(e,t){for(const r in e)t(r);}_loopByKey0(e,t,r){let n,i;if(n=e[t])for(i in n)r(i);}_loopByKey1(e,t,r){let n,i;for(n in e)i=e[n],i[t]&&r(n);}_loopBy2Keys(e,t,r,n){let i,o,a;if((i=e[t])&&(o=i[r]))for(a in o)n(a);}_countInIndex(e,t,r,n){let i,o,a,s=0;t&&((i=e,e={})[t]=i[t]);for(const t in e)if(o=e[t]){r&&((i=o,o={})[r]=i[r]);for(const e in o)(a=o[e])&&(n?n in a&&s++:s+=Object.keys(a).length);}return s}_getGraphs(e){if(!d(e))return this._graphs;const t={};return t[e]=this._graphs[e],t}_uniqueEntities(e){const t=Object.create(null);return r=>{r in t||(t[r]=!0,e(this._termFromId(this._entities[r],this._factory)));}}add(e){return this.addQuad(e),this}addQuad(e,t,r,n){t||(n=e.graph,r=e.object,t=e.predicate,e=e.subject),n=(0, i.termToId)(n);let o=this._graphs[n];o||(o=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(o)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),r=this._termToNewNumericId(r);const a=this._addToIndex(o.subjects,e,t,r);return this._addToIndex(o.predicates,t,r,e),this._addToIndex(o.objects,r,e,t),this._size=null,a}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t]);}delete(e){return this.removeQuad(e),this}has(e,t,r,n){return e&&e.subject&&({subject:e,predicate:t,object:r,graph:n}=e),!this.readQuads(e,t,r,n).next().done}importStream(e){return e.on("data",(e=>{this.addQuad(e);})),e}removeQuad(e,t,r,n){t||(n=e.graph,r=e.object,t=e.predicate,e=e.subject),n=(0, i.termToId)(n);const o=this._graphs;let a,s,l;if(!((e=e&&this._termToNumericId(e))&&(t=t&&this._termToNumericId(t))&&(r=r&&this._termToNumericId(r))&&(a=o[n])&&(s=a.subjects[e])&&(l=s[t])&&r in l))return !1;for(e in this._removeFromIndex(a.subjects,e,t,r),this._removeFromIndex(a.predicates,t,r,e),this._removeFromIndex(a.objects,r,e,t),null!==this._size&&this._size--,a.subjects)return !0;return delete o[n],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t]);}remove(e){return e.on("data",(e=>{this.removeQuad(e);})),e}removeMatches(e,t,r,i){const o=new n.Readable({objectMode:!0});return o._read=()=>{for(const n of this.readQuads(e,t,r,i))o.push(n);o.push(null);},this.remove(o)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,r,n){return [...this.readQuads(e,t,r,n)]}*readQuads(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l,u;if(!(e&&!(s=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||r&&!(u=this._termToNumericId(r))))for(const e in o)(a=o[e])&&(s?u?yield*this._findInIndex(a.objects,u,s,l,"object","subject","predicate",e):yield*this._findInIndex(a.subjects,s,l,null,"subject","predicate","object",e):l?yield*this._findInIndex(a.predicates,l,u,null,"predicate","object","subject",e):u?yield*this._findInIndex(a.objects,u,null,null,"object","subject","predicate",e):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",e));}match(e,t,r,n){return new h(this,e,t,r,n)}countQuads(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l,u,c=0;if(e&&!(s=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||r&&!(u=this._termToNumericId(r)))return 0;for(const n in o)(a=o[n])&&(c+=e?r?this._countInIndex(a.objects,u,s,l):this._countInIndex(a.subjects,s,l,u):t?this._countInIndex(a.predicates,l,u,s):this._countInIndex(a.objects,u,s,l));return c}forEach(e,t,r,n,i){this.some((t=>(e(t),!1)),t,r,n,i);}every(e,t,r,n,i){let o=!1;const a=!this.some((t=>(o=!0,!e(t))),t,r,n,i);return o&&a}some(e,t,r,n,i){for(const o of this.readQuads(t,r,n,i))if(e(o))return !0;return !1}getSubjects(e,t,r){const n=[];return this.forSubjects((e=>{n.push(e);}),e,t,r),n}forSubjects(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.predicates,s,l,e):this._loopByKey1(a.subjects,s,e):l?this._loopByKey0(a.objects,l,e):this._loop(a.subjects,e));}getPredicates(e,t,r){const n=[];return this.forPredicates((e=>{n.push(e);}),e,t,r),n}forPredicates(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.objects,l,s,e):this._loopByKey0(a.subjects,s,e):l?this._loopByKey1(a.predicates,l,e):this._loop(a.predicates,e));}getObjects(e,t,r){const n=[];return this.forObjects((e=>{n.push(e);}),e,t,r),n}forObjects(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.subjects,s,l,e):this._loopByKey1(a.objects,s,e):l?this._loopByKey0(a.predicates,l,e):this._loop(a.objects,e));}getGraphs(e,t,r){const n=[];return this.forGraphs((e=>{n.push(e);}),e,t,r),n}forGraphs(e,t,r,n){for(const i in this._graphs)this.some((t=>(e(t.graph),!0)),t,r,n,i);}createBlankNode(e){let t,r;if(e)for(t=e=`_:${e}`,r=1;this._ids[t];)t=e+r++;else do{t="_:b"+this._blankNodeIndex++;}while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const r={},n=t?()=>!0:(e,t)=>{throw new Error(`${e.value} ${t}`)},i=this.getQuads(null,o.default.rdf.rest,o.default.rdf.nil,null),a=e?[...i]:[];return i.forEach((t=>{const i=[];let s,l,u=!1;const c=t.graph;let d=t.subject;for(;d&&!u;){const e=this.getQuads(null,null,d,null),t=this.getQuads(d,null,null,null);let r,h=null,f=null,p=null;for(let i=0;i<t.length&&!u;i++)r=t[i],r.graph.equals(c)?s?u=n(d,"has non-list arcs out"):r.predicate.value===o.default.rdf.first?h?u=n(d,"has multiple rdf:first arcs"):a.push(h=r):r.predicate.value===o.default.rdf.rest?f?u=n(d,"has multiple rdf:rest arcs"):a.push(f=r):e.length?u=n(d,"can't be subject and object"):(s=r,l="subject"):u=n(d,"not confined to single graph");for(let t=0;t<e.length&&!u;++t)r=e[t],s?u=n(d,"can't have coreferences"):r.predicate.value===o.default.rdf.rest?p?u=n(d,"has incoming rdf:rest arcs"):p=r:(s=r,l="object");h?i.unshift(h.object):u=n(d,"has no list head"),d=p&&p.subject;}u?e=!1:s&&(r[s[l].value]=i);})),e&&this.removeQuads(a),r}*[Symbol.iterator](){yield*this.readQuads();}}function d(e){return "string"==typeof e||e instanceof String}r.default=c;class h extends n.Readable{constructor(e,t,r,n,i){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:r,object:n,graph:i});}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:r,predicate:n,subject:i}=this,o=this._filtered=new c({factory:e._factory});for(const a of e.readQuads(i,n,r,t))o.addQuad(a);}return this._filtered}get size(){return this.filtered.size}_read(){for(const e of this)this.push(e);this.push(null);}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,t,r,n){return new h(this.filtered,e,t,r,n)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph);}}},{"./IRIs":1,"./N3DataFactory":2,"./N3Util":8,"readable-stream":38}],6:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=o(e("./N3Parser"));function o(e){return e&&e.__esModule?e:{default:e}}class a extends n.Transform{constructor(e){let t,r;super({decodeStrings:!0}),this._readableState.objectMode=!0,new i.default(e).parse({on:(e,n)=>{switch(e){case"data":t=n;break;case"end":r=n;}}},((e,t)=>{e&&this.emit("error",e)||t&&this.push(t);}),((e,t)=>{this.emit("prefix",e,t);})),this._transform=(e,r,n)=>{t(e),n();},this._flush=e=>{r(),e();};}importStream(e){return e.on("data",(e=>{this.write(e);})),e.on("end",(()=>{this.end();})),e.on("error",(e=>{this.emit("error",e);})),this}}r.default=a;},{"./N3Parser":4,"readable-stream":38}],7:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=o(e("./N3Writer"));function o(e){return e&&e.__esModule?e:{default:e}}class a extends n.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});const t=this._writer=new i.default({write:(e,t,r)=>{this.push(e),r&&r();},end:e=>{this.push(null),e&&e();}},e);this._transform=(e,r,n)=>{t.addQuad(e,n);},this._flush=e=>{t.end(e);};}importStream(e){return e.on("data",(e=>{this.write(e);})),e.on("end",(()=>{this.end();})),e.on("error",(e=>{this.emit("error",e);})),e.on("prefix",((e,t)=>{this._writer.addPrefix(e,t);})),this}}r.default=a;},{"./N3Writer":9,"readable-stream":38}],8:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.inDefaultGraph=c,r.isBlankNode=a,r.isDefaultGraph=u,r.isLiteral=s,r.isNamedNode=o,r.isVariable=l,r.prefix=d,r.prefixes=h;var n=i(e("./N3DataFactory"));function i(e){return e&&e.__esModule?e:{default:e}}function o(e){return !!e&&"NamedNode"===e.termType}function a(e){return !!e&&"BlankNode"===e.termType}function s(e){return !!e&&"Literal"===e.termType}function l(e){return !!e&&"Variable"===e.termType}function u(e){return !!e&&"DefaultGraph"===e.termType}function c(e){return u(e.graph)}function d(e,t){return h({"":e.value||e},t)("")}function h(e,t){const r=Object.create(null);for(const t in e)i(t,e[t]);function i(e,n){if("string"==typeof n){const i=Object.create(null);r[e]=e=>i[e]||(i[e]=t.namedNode(n+e));}else if(!(e in r))throw new Error(`Unknown prefix: ${e}`);return r[e]}return t=t||n.default,i}},{"./N3DataFactory":2}],9:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=l(e("./IRIs")),i=s(e("./N3DataFactory")),o=e("./N3Util");function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (a=function(e){return e?r:t})(e)}function s(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=a(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}function l(e){return e&&e.__esModule?e:{default:e}}const u=i.default.defaultGraph(),{rdf:c,xsd:d}=n.default,h=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,f=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,p={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class m extends i.Term{equals(e){return e===this}}class y{constructor(e,t){if(this._prefixRegex=/$0^/,e&&"function"!=typeof e.write&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=void 0===t.end||!!t.end;else {let e="";this._outputStream={write(t,r,n){e+=t,n&&n();},end:t=>{t&&t(null,e);}},this._endStream=!0;}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=u,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseMatcher=new RegExp(`^${v(t.baseIRI)}${t.baseIRI.endsWith("/")?"":"[#?]"}`),this._baseLength=t.baseIRI.length));}get _inDefaultGraph(){return u.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t);}_writeQuad(e,t,r,n,i){try{n.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(u.equals(n)?"":`${this._encodeIriOrBlank(n)} {\n`)),this._graph=n,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(r)}`,i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i);}catch(e){i&&i(e);}}_writeQuadLine(e,t,r,n,i){delete this._prefixMatch,this._write(this.quadToString(e,t,r,n),i);}quadToString(e,t,r,n){return `${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(r)}${n&&n.value?` ${this._encodeIriOrBlank(n)} .\n`:" .\n"}`}quadsToString(e){return e.map((e=>this.quadToString(e.subject,e.predicate,e.object,e.graph))).join("")}_encodeSubject(e){return "Quad"===e.termType?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if("NamedNode"!==e.termType)return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseMatcher&&this._baseMatcher.test(t)&&(t=t.substr(this._baseLength)),h.test(t)&&(t=t.replace(f,g));const r=this._prefixRegex.exec(t);return r?r[1]?this._prefixIRIs[r[1]]+r[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(h.test(t)&&(t=t.replace(f,g)),e.language)return `"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===d.string)return `"${t}"`}else switch(e.datatype.value){case d.string:return `"${t}"`;case d.boolean:if("true"===t||"false"===t)return t;break;case d.integer:if(/^[+-]?\d+$/.test(t))return t;break;case d.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case d.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t}return `"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===c.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:r,graph:n}){return `<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(r)}${(0, o.isDefaultGraph)(n)?"":` ${this._encodeIriOrBlank(n)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,r,n,i){void 0===r?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):"function"==typeof n?this._writeQuad(e,t,r,u,n):this._writeQuad(e,t,r,n||u,i);}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t]);}addPrefix(e,t,r){const n={};n[e]=t,this.addPrefixes(n,r);}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let r=!1;for(let t in e){let n=e[t];"string"!=typeof n&&(n=n.value),r=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[n]=t+=":",this._write(`@prefix ${t} <${n}>.\n`);}if(r){let e="",t="";for(const r in this._prefixIRIs)e+=e?`|${r}`:r,t+=(t?"|":"")+this._prefixIRIs[r];e=v(e),this._prefixRegex=new RegExp(`^(?:${t})[^/]*$|^(${e})([_a-zA-Z][\\-_a-zA-Z0-9]*)$`);}this._write(r?"\n":"",t);}blank(e,t){let r,n,i=e;switch(void 0===e?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),n=i.length){case 0:return new m("[]");case 1:if(r=i[0],!(r.object instanceof m))return new m(`[ ${this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)} ]`);default:let t="[";for(let o=0;o<n;o++)r=i[o],r.predicate.equals(e)?t+=`, ${this._encodeObject(r.object)}`:(t+=`${(o?";\n ":"\n ")+this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)}`,e=r.predicate);return new m(`${t}\n]`)}}list(e){const t=e&&e.length||0,r=new Array(t);for(let n=0;n<t;n++)r[n]=this._encodeObject(e[n]);return new m(`(${r.join(" ")})`)}end(e){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let t=e&&((r,n)=>{t=null,e(r,n);});if(this._endStream)try{return this._outputStream.end(t)}catch(e){}t&&t();}}function g(e){let t=p[e];return void 0===t&&(1===e.length?(t=e.charCodeAt(0).toString(16),t="\\u0000".substr(0,6-t.length)+t):(t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16),t="\\U00000000".substr(0,10-t.length)+t)),t}function v(e){return e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}r.default=y;},{"./IRIs":1,"./N3DataFactory":2,"./N3Util":8}],10:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BlankNode",{enumerable:!0,get:function(){return c.BlankNode}}),Object.defineProperty(r,"DataFactory",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(r,"DefaultGraph",{enumerable:!0,get:function(){return c.DefaultGraph}}),Object.defineProperty(r,"Lexer",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(r,"Literal",{enumerable:!0,get:function(){return c.Literal}}),Object.defineProperty(r,"NamedNode",{enumerable:!0,get:function(){return c.NamedNode}}),Object.defineProperty(r,"Parser",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"Quad",{enumerable:!0,get:function(){return c.Quad}}),Object.defineProperty(r,"Store",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(r,"StreamParser",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"StreamWriter",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(r,"Term",{enumerable:!0,get:function(){return c.Term}}),Object.defineProperty(r,"Triple",{enumerable:!0,get:function(){return c.Triple}}),r.Util=void 0,Object.defineProperty(r,"Variable",{enumerable:!0,get:function(){return c.Variable}}),Object.defineProperty(r,"Writer",{enumerable:!0,get:function(){return o.default}}),r.default=void 0,Object.defineProperty(r,"termFromId",{enumerable:!0,get:function(){return c.termFromId}}),Object.defineProperty(r,"termToId",{enumerable:!0,get:function(){return c.termToId}});var n=f(e("./N3Lexer")),i=f(e("./N3Parser")),o=f(e("./N3Writer")),a=f(e("./N3Store")),s=f(e("./N3StreamParser")),l=f(e("./N3StreamWriter")),u=h(e("./N3Util"));r.Util=u;var c=h(e("./N3DataFactory"));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (d=function(e){return e?r:t})(e)}function h(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=d(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}function f(e){return e&&e.__esModule?e:{default:e}}r.default={Lexer:n.default,Parser:i.default,Writer:o.default,Store:a.default,StreamParser:s.default,StreamWriter:l.default,Util:u,DataFactory:c.default,Term:c.Term,NamedNode:c.NamedNode,Literal:c.Literal,BlankNode:c.BlankNode,Variable:c.Variable,DefaultGraph:c.DefaultGraph,Quad:c.Quad,Triple:c.Triple,termFromId:c.termFromId,termToId:c.termToId};},{"./N3DataFactory":2,"./N3Lexer":3,"./N3Parser":4,"./N3Store":5,"./N3StreamParser":6,"./N3StreamWriter":7,"./N3Util":8,"./N3Writer":9}],11:[function(e,t,r){const{AbortController:n,AbortSignal:i}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;t.exports=n,t.exports.AbortSignal=i,t.exports.default=n;},{}],12:[function(e,t,r){r.byteLength=c,r.toByteArray=h,r.fromByteArray=m;for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s<l;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return -1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n}function d(e,t,r){return 3*(t+r)/4-r}function h(e){var t,r,n=u(e),a=n[0],s=n[1],l=new o(d(e,a,s)),c=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,l[c++]=255&t),1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l}function f(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function p(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(f(n));return i.join("")}function m(e){for(var t,r=e.length,i=r%3,o=[],a=16383,s=0,l=r-i;s<l;s+=a)o.push(p(e,s,s+a>l?l:s+a));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63;},{}],13:[function(e,t,r){var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r];}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=a),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)};},{buffer:15}],14:[function(e,t,r){var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return !0;default:return !1}};function o(e){if(!e)return "utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return "utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return "utf16le";case"latin1":case"binary":return "latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0;}}function a(e){var t=o(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}function s(e){var t;switch(this.encoding=a(e),this.encoding){case"utf16le":this.text=p,this.end=m,t=4;break;case"utf8":this.fillLast=d,t=4;break;case"base64":this.text=y,this.end=g,t=3;break;default:return this.write=v,void(this.end=w)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t);}function l(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function u(e,t,r){var n=t.length-1;if(n<r)return 0;var i=l(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=l(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=l(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}function c(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,"�"}}function d(e){var t=this.lastTotal-this.lastNeed,r=c(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 h(e,t){var r=u(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)}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function p(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 m(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 y(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 g(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function v(e){return e.toString(this.encoding)}function w(e){return e&&e.length?this.write(e):""}r.StringDecoder=s,s.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||""},s.prototype.end=f,s.prototype.text=h,s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length;};},{"safe-buffer":13}],15:[function(e,t,r){(function(t){(function(){var t=e("base64-js"),n=e("ieee754");r.Buffer=s,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return !1}}function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return h(e,t);if(ArrayBuffer.isView(e))return f(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);var i=m(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e,t,r){return u(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}function d(e){return u(e),a(e<0?0:0|y(e))}function h(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|v(e,t),n=a(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function f(e){for(var t=e.length<0?0:0|y(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function p(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return (n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r)).__proto__=s.prototype,n}function m(e){if(s.isBuffer(e)){var t=0|y(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}function y(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function g(e){return +e!=e&&(e=0),s.alloc(+e)}function v(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(i)return n?-1:z(e).length;t=(""+t).toLowerCase(),i=!0;}}function w(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 M(this,t,r);case"utf8":case"utf-8":return D(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return A(this,t,r);case"base64":return j(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0;}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n;}function _(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),Z(r=+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=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):E(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,i){var o,a=1,s=e.length,l=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,l/=2,r/=2;}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=r;o<s;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*a}else -1!==c&&(o-=o-c),c=-1;}else for(r+l>s&&(r=s-l),o=r;o>=0;o--){for(var d=!0,h=0;h<l;h++)if(u(e,o+h)!==u(t,h)){d=!1;break}if(d)return o}return -1}function T(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;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(Z(s))return a;e[r+a]=s;}return a}function x(e,t,r,n){return V(z(t,e.length-r),e,r,n)}function I(e,t,r,n){return V(G(t),e,r,n)}function S(e,t,r,n){return I(e,t,r,n)}function R(e,t,r,n){return V(J(t),e,r,n)}function k(e,t,r,n){return V(H(t,e.length-r),e,r,n)}function j(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function D(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,a,s,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l);}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d;}return O(n)}r.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=o(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(e,t,r){return c(e,t,r)},s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');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},s.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}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(Q(o,Uint8Array)&&(o=s.from(o)),!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length;}return n},s.byteLength=v,s.prototype._isBuffer=!0,s.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)b(this,t,t+1);return this},s.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)b(this,t,t+3),b(this,t+1,t+2);return this},s.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)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?D(this,0,e):w.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s.prototype.compare=function(e,t,r,n,i){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);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),l=Math.min(o,a),u=this.slice(n,i),c=e.slice(t,r),d=0;d<l;++d)if(u[d]!==c[d]){o=u[d],a=c[d];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return _(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return _(this,e,t,r,!1)},s.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 T(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return I(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return R(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0;}},s.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function O(e){var t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=N));return r}function C(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 A(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 M(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+=W(e[o]);return i}function L(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 P(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 B(e,t,r,n,i,o){if(!s.isBuffer(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 $(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 F(e,t,r,i,o){return t=+t,r>>>=0,o||$(e,t,r,4),n.write(e,t,r,i,23,4),r+4}function U(e,t,r,i,o){return t=+t,r>>>=0,o||$(e,t,r,8),n.write(e,t,r,i,52,8),r+8}s.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=s.prototype,n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(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},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(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},s.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(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},s.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(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},s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);B(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},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);B(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},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");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("Index out of range");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=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var o=i-1;o>=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.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),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i);}}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=s.isBuffer(e)?e:s.from(e,n),l=a.length;if(0===l)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=a[o%l];}return this};var q=/[^+/0-9A-Za-z-_]/g;function Y(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return "";for(;e.length%4!=0;)e+="=";return e}function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(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 G(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function H(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}function J(e){return t.toByteArray(Y(e))}function V(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 Q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}}).call(this);}).call(this,e("buffer").Buffer);},{"base64-js":12,buffer:15,ieee754:17}],16:[function(e,t,r){var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};function a(e){console&&console.warn&&console.warn(e);}n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function l(){l.init.call(this);}t.exports=l,t.exports.once=b,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?l.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,o,s;if(c(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=d(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,a(l);}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function m(e,t,r){var n=e._events;if(void 0===n)return [];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?w(i):g(i,i.length)}function y(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function v(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop();}function w(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function b(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r);}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments));}E(e,t,o,{once:!0}),"error"!==t&&_(e,i,{once:!0});}))}function _(e,t,r){"function"==typeof e.on&&E(e,"error",t,r);}function E(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else {if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o);}));}}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e;}}),l.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0;},l.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},l.prototype.getMaxListeners=function(){return d(this)},l.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return !1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=i[e];if(void 0===l)return !1;if("function"==typeof l)o(l,this,t);else {var u=l.length,c=g(l,u);for(r=0;r<u;++r)o(c[r],this,t);}return !0},l.prototype.addListener=function(e,t){return h(this,e,t,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(e,t){return h(this,e,t,!0)},l.prototype.once=function(e,t){return c(t),this.on(e,p(this,e,t)),this},l.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,p(this,e,t)),this},l.prototype.removeListener=function(e,t){var r,n,i,o,a;if(c(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():v(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t);}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},l.prototype.listeners=function(e){return m(this,e,!0)},l.prototype.rawListeners=function(e){return m(this,e,!1)},l.listenerCount=function(e,t){return "function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},l.prototype.listenerCount=y,l.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};},{}],17:[function(e,t,r){r.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,d=r?i-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+d],d+=h,c-=8);if(0===o)o=1-u;else {if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=u;}return (f?-1:1)*a*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<<u)-1,d=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,m=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=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*m;};},{}],18:[function(e,t,r){var n,i,o=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}function u(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a;}catch(e){n=a;}try{i="function"==typeof clearTimeout?clearTimeout:s;}catch(e){i=s;}}();var c,d=[],h=!1,f=-1;function p(){h&&c&&(h=!1,c.length?d=c.concat(d):f=-1,d.length&&m());}function m(){if(!h){var e=l(p);h=!0;for(var t=d.length;t;){for(c=d,d=[];++f<t;)c&&c[f].run();f=-1,t=d.length;}c=null,h=!1,u(e);}}function y(e,t){this.fun=e,this.array=t;}function g(){}o.nextTick=function(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];d.push(new y(e,t)),1!==d.length||h||l(m);},y.prototype.run=function(){this.fun.apply(null,this.array);},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return []},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return "/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0};},{}],19:[function(e,t,r){(function(e){(function(){let r;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:e):e=>(r||(r=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)));}).call(this);}).call(this,void 0!==s?s:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});},{}],20:[function(e,t,r){const{AbortError:n,codes:i}=e("../../ours/errors"),{isNodeStream:o,isWebStream:a,kControllerErrorFunction:s}=e("./utils"),l=e("./end-of-stream"),{ERR_INVALID_ARG_TYPE:u}=i,c=(e,t)=>{if("object"!=typeof e||!("aborted"in e))throw new u(t,"AbortSignal",e)};t.exports.addAbortSignal=function(e,r){if(c(e,"signal"),!o(r)&&!a(r))throw new u("stream",["ReadableStream","WritableStream","Stream"],r);return t.exports.addAbortSignalNoValidate(e,r)},t.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const r=o(t)?()=>{t.destroy(new n(void 0,{cause:e.reason}));}:()=>{t[s](new n(void 0,{cause:e.reason}));};return e.aborted?r():(e.addEventListener("abort",r),l(t,(()=>e.removeEventListener("abort",r)))),t};},{"../../ours/errors":39,"./end-of-stream":26,"./utils":35}],21:[function(e,t,r){const{StringPrototypeSlice:n,SymbolIterator:i,TypedArrayPrototypeSet:o,Uint8Array:a}=e("../../ours/primordials"),{Buffer:s}=e("buffer"),{inspect:l}=e("../../ours/util");t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0;}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length;}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length;}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0;}join(e){if(0===this.length)return "";let t=this.head,r=""+t.data;for(;null!==(t=t.next);)r+=e+t.data;return r}concat(e){if(0===this.length)return s.alloc(0);const t=s.allocUnsafe(e>>>0);let r=this.head,n=0;for(;r;)o(t,r.data,n),n+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(e<r.length){const t=r.slice(0,e);return this.head.data=r.slice(e),t}return e===r.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[i](){for(let e=this.head;e;e=e.next)yield e.data;}_getString(e){let t="",r=this.head,i=0;do{const o=r.data;if(!(e>o.length)){e===o.length?(t+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(o,0,e),this.head=r,r.data=n(o,e));break}t+=o,e-=o.length,++i;}while(null!==(r=r.next));return this.length-=i,t}_getBuffer(e){const t=s.allocUnsafe(e),r=e;let n=this.head,i=0;do{const s=n.data;if(!(e>s.length)){e===s.length?(o(t,s,r-e),++i,n.next?this.head=n.next:this.head=this.tail=null):(o(t,new a(s.buffer,s.byteOffset,e),r-e),this.head=n,n.data=s.slice(e));break}o(t,s,r-e),e-=s.length,++i;}while(null!==(n=n.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return l(this,{...t,depth:0,customInspect:!1})}};},{"../../ours/primordials":40,"../../ours/util":41,buffer:15}],22:[function(e,t,r){const{pipeline:n}=e("./pipeline"),i=e("./duplex"),{destroyer:o}=e("./destroy"),{isNodeStream:a,isReadable:s,isWritable:l,isWebStream:u,isTransformStream:c,isWritableStream:d,isReadableStream:h}=e("./utils"),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:m}}=e("../../ours/errors"),y=e("./end-of-stream");t.exports=function(...e){if(0===e.length)throw new m("streams");if(1===e.length)return i.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=i.from(e[t]);}for(let r=0;r<e.length;++r)if(a(e[r])||u(e[r])){if(r<e.length-1&&!(s(e[r])||h(e[r])||c(e[r])))throw new p(`streams[${r}]`,t[r],"must be readable");if(r>0&&!(l(e[r])||d(e[r])||c(e[r])))throw new p(`streams[${r}]`,t[r],"must be writable")}let r,g,v,w,b;function _(e){const t=w;w=null,t?t(e):e?b.destroy(e):I||x||b.destroy();}const E=e[0],T=n(e,_),x=!!(l(E)||d(E)||c(E)),I=!!(s(T)||h(T)||c(T));if(b=new i({writableObjectMode:!(null==E||!E.writableObjectMode),readableObjectMode:!(null==T||!T.writableObjectMode),writable:x,readable:I}),x){if(a(E))b._write=function(e,t,n){E.write(e,t)?n():r=n;},b._final=function(e){E.end(),g=e;},E.on("drain",(function(){if(r){const e=r;r=null,e();}}));else if(u(E)){const e=(c(E)?E.writable:E).getWriter();b._write=async function(t,r,n){try{await e.ready,e.write(t).catch((()=>{})),n();}catch(e){n(e);}},b._final=async function(t){try{await e.ready,e.close().catch((()=>{})),g=t;}catch(e){t(e);}};}const e=c(T)?T.readable:T;y(e,(()=>{if(g){const e=g;g=null,e();}}));}if(I)if(a(T))T.on("readable",(function(){if(v){const e=v;v=null,e();}})),T.on("end",(function(){b.push(null);})),b._read=function(){for(;;){const e=T.read();if(null===e)return void(v=b._read);if(!b.push(e))return}};else if(u(T)){const e=(c(T)?T.readable:T).getReader();b._read=async function(){for(;;)try{const{value:t,done:r}=await e.read();if(!b.push(t))return;if(r)return void b.push(null)}catch{return}};}return b._destroy=function(e,t){e||null===w||(e=new f),v=null,r=null,g=null,null===w?t(e):(w=t,a(T)&&o(T,e));},b};},{"../../ours/errors":39,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./pipeline":31,"./utils":35}],23:[function(e,t,r){const n=e("process/"),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:o},AbortError:a}=e("../../ours/errors"),{Symbol:s}=e("../../ours/primordials"),{kDestroyed:l,isDestroyed:u,isFinished:c,isServerRequest:d}=e("./utils"),h=s("kDestroy"),f=s("kConstruct");function p(e,t,r){e&&(t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e));}function m(e,t){const r=this._readableState,n=this._writableState,o=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(p(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?y(this,e,t):this.once(h,(function(r){y(this,i(r,e),t);})),this)}function y(e,t,r){let i=!1;function o(t){if(i)return;i=!0;const o=e._readableState,a=e._writableState;p(t,a,o),a&&(a.closed=!0),o&&(o.closed=!0),"function"==typeof r&&r(t),t?n.nextTick(g,e,t):n.nextTick(v,e);}try{e._destroy(t||null,o);}catch(t){o(t);}}function g(e,t){w(e,t),v(e);}function v(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=r&&r.emitClose||null!=t&&t.emitClose)&&e.emit("close");}function w(e,t){const r=e._readableState,n=e._writableState;null!=n&&n.errorEmitted||null!=r&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t));}function b(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable);}function _(e,t,r){const i=e._readableState,o=e._writableState;if(null!=o&&o.destroyed||null!=i&&i.destroyed)return this;null!=i&&i.autoDestroy||null!=o&&o.autoDestroy?e.destroy(t):t&&(o&&!o.errored&&(o.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(w,e,t):w(e,t));}function E(e,t){if("function"!=typeof e._construct)return;const r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),e.listenerCount(f)>1||n.nextTick(T,e);}function T(e){let t=!1;function r(r){if(t)return void _(e,null!=r?r:new o);t=!0;const i=e._readableState,a=e._writableState,s=a||i;i&&(i.constructed=!0),a&&(a.constructed=!0),s.destroyed?e.emit(h,r):r?_(e,r,!0):n.nextTick(x,e);}try{e._construct((e=>{n.nextTick(r,e);}));}catch(e){n.nextTick(r,e);}}function x(e){e.emit(f);}function I(e){return (null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function S(e){e.emit("close");}function R(e,t){e.emit("error",t),n.nextTick(S,e);}function k(e,t){e&&!u(e)&&(t||c(e)||(t=new a),d(e)?(e.socket=null,e.destroy(t)):I(e)?e.abort():I(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?n.nextTick(R,e,t):n.nextTick(S,e),e.destroyed||(e[l]=!0));}t.exports={construct:E,destroyer:k,destroy:m,undestroy:b,errorOrDestroy:_};},{"../../ours/errors":39,"../../ours/primordials":40,"./utils":35,"process/":18}],24:[function(e,t,r){const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:o,ObjectSetPrototypeOf:a}=e("../../ours/primordials");t.exports=u;const s=e("./readable"),l=e("./writable");a(u.prototype,s.prototype),a(u,s);{const e=o(l.prototype);for(let t=0;t<e.length;t++){const r=e[t];u.prototype[r]||(u.prototype[r]=l.prototype[r]);}}function u(e){if(!(this instanceof u))return new u(e);s.call(this,e),l.call(this,e),e?(this.allowHalfOpen=!1!==e.allowHalfOpen,!1===e.readable&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===e.writable&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0;}let c,d;function h(){return void 0===c&&(c={}),c}n(u.prototype,{writable:{__proto__:null,...i(l.prototype,"writable")},writableHighWaterMark:{__proto__:null,...i(l.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...i(l.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...i(l.prototype,"writableBuffer")},writableLength:{__proto__:null,...i(l.prototype,"writableLength")},writableFinished:{__proto__:null,...i(l.prototype,"writableFinished")},writableCorked:{__proto__:null,...i(l.prototype,"writableCorked")},writableEnded:{__proto__:null,...i(l.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...i(l.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e);}}}),u.fromWeb=function(e,t){return h().newStreamDuplexFromReadableWritablePair(e,t)},u.toWeb=function(e){return h().newReadableWritablePairFromDuplex(e)},u.from=function(t){return d||(d=e("./duplexify")),d(t,"body")};},{"../../ours/primordials":40,"./duplexify":25,"./readable":32,"./writable":36}],25:[function(e,t,r){const n=e("process/"),i=e("buffer"),{isReadable:o,isWritable:a,isIterable:s,isNodeStream:l,isReadableNodeStream:u,isWritableNodeStream:c,isDuplexNodeStream:d}=e("./utils"),h=e("./end-of-stream"),{AbortError:f,codes:{ERR_INVALID_ARG_TYPE:p,ERR_INVALID_RETURN_VALUE:m}}=e("../../ours/errors"),{destroyer:y}=e("./destroy"),g=e("./duplex"),v=e("./readable"),{createDeferredPromise:w}=e("../../ours/util"),b=e("./from"),_=globalThis.Blob||i.Blob,E=void 0!==_?function(e){return e instanceof _}:function(e){return !1},T=globalThis.AbortController||e("abort-controller").AbortController,{FunctionPrototypeCall:x}=e("../../ours/primordials");class I extends g{constructor(e){super(e),!1===(null==e?void 0:e.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0);}}function S(e){let{promise:t,resolve:r}=w();const i=new T,o=i.signal;return {value:e(async function*(){for(;;){const e=t;t=null;const{chunk:i,done:a,cb:s}=await e;if(n.nextTick(s),a)return;if(o.aborted)throw new f(void 0,{cause:o.reason});(({promise:t,resolve:r}=w())),yield i;}}(),{signal:o}),write(e,t,n){const i=r;r=null,i({chunk:e,done:!1,cb:n});},final(e){const t=r;r=null,t({done:!0,cb:e});},destroy(e,t){i.abort(),t(e);}}}function R(e){const t=e.readable&&"function"!=typeof e.readable.read?v.wrap(e.readable):e.readable,r=e.writable;let n,i,s,l,u,c=!!o(t),d=!!a(r);function p(e){const t=l;l=null,t?t(e):e&&u.destroy(e);}return u=new I({readableObjectMode:!(null==t||!t.readableObjectMode),writableObjectMode:!(null==r||!r.writableObjectMode),readable:c,writable:d}),d&&(h(r,(e=>{d=!1,e&&y(t,e),p(e);})),u._write=function(e,t,i){r.write(e,t)?i():n=i;},u._final=function(e){r.end(),i=e;},r.on("drain",(function(){if(n){const e=n;n=null,e();}})),r.on("finish",(function(){if(i){const e=i;i=null,e();}}))),c&&(h(t,(e=>{c=!1,e&&y(t,e),p(e);})),t.on("readable",(function(){if(s){const e=s;s=null,e();}})),t.on("end",(function(){u.push(null);})),u._read=function(){for(;;){const e=t.read();if(null===e)return void(s=u._read);if(!u.push(e))return}}),u._destroy=function(e,o){e||null===l||(e=new f),s=null,n=null,i=null,null===l?o(e):(l=o,y(r,e),y(t,e));},u}t.exports=function e(t,r){if(d(t))return t;if(u(t))return R({readable:t});if(c(t))return R({writable:t});if(l(t))return R({writable:!1,readable:!1});if("function"==typeof t){const{value:e,write:i,final:o,destroy:a}=S(t);if(s(e))return b(I,e,{objectMode:!0,write:i,final:o,destroy:a});const l=null==e?void 0:e.then;if("function"==typeof l){let t;const r=x(l,e,(e=>{if(null!=e)throw new m("nully","body",e)}),(e=>{y(t,e);}));return t=new I({objectMode:!0,readable:!1,write:i,final(e){o((async()=>{try{await r,n.nextTick(e,null);}catch(t){n.nextTick(e,t);}}));},destroy:a})}throw new m("Iterable, AsyncIterable or AsyncFunction",r,e)}if(E(t))return e(t.arrayBuffer());if(s(t))return b(I,t,{objectMode:!0,writable:!1});if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return R({readable:null!=t&&t.readable?u(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?c(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});const i=null==t?void 0:t.then;if("function"==typeof i){let e;return x(i,t,(t=>{null!=t&&e.push(t),e.push(null);}),(t=>{y(e,t);})),e=new I({objectMode:!0,writable:!1,read(){}})}throw new p(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./from":27,"./readable":32,"./utils":35,"abort-controller":11,buffer:15,"process/":18}],26:[function(e,t,r){const n=e("process/"),{AbortError:i,codes:o}=e("../../ours/errors"),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:s}=o,{kEmptyObject:l,once:u}=e("../../ours/util"),{validateAbortSignal:c,validateFunction:d,validateObject:h,validateBoolean:f}=e("../validators"),{Promise:p,PromisePrototypeThen:m}=e("../../ours/primordials"),{isClosed:y,isReadable:g,isReadableNodeStream:v,isReadableStream:w,isReadableFinished:b,isReadableErrored:_,isWritable:E,isWritableNodeStream:T,isWritableStream:x,isWritableFinished:I,isWritableErrored:S,isNodeStream:R,willEmitClose:k,kIsClosedPromise:j}=e("./utils");function D(e){return e.setHeader&&"function"==typeof e.abort}const N=()=>{};function O(e,t,r){var o,f;if(2===arguments.length?(r=t,t=l):null==t?t=l:h(t,"options"),d(r,"callback"),c(t.signal,"options.signal"),r=u(r),w(e)||x(e))return C(e,t,r);if(!R(e))throw new a("stream",["ReadableStream","WritableStream","Stream"],e);const p=null!==(o=t.readable)&&void 0!==o?o:v(e),m=null!==(f=t.writable)&&void 0!==f?f:T(e),j=e._writableState,O=e._readableState,A=()=>{e.writable||P();};let M=k(e)&&v(e)===p&&T(e)===m,L=I(e,!1);const P=()=>{L=!0,e.destroyed&&(M=!1),(!M||e.readable&&!p)&&(p&&!B||r.call(e));};let B=b(e,!1);const $=()=>{B=!0,e.destroyed&&(M=!1),(!M||e.writable&&!m)&&(m&&!L||r.call(e));},F=t=>{r.call(e,t);};let U=y(e);const q=()=>{U=!0;const t=S(e)||_(e);return t&&"boolean"!=typeof t?r.call(e,t):p&&!B&&v(e,!0)&&!b(e,!1)?r.call(e,new s):!m||L||I(e,!1)?void r.call(e):r.call(e,new s)},Y=()=>{U=!0;const t=S(e)||_(e);if(t&&"boolean"!=typeof t)return r.call(e,t);r.call(e);},W=()=>{e.req.on("finish",P);};D(e)?(e.on("complete",P),M||e.on("abort",q),e.req?W():e.on("request",W)):m&&!j&&(e.on("end",A),e.on("close",A)),M||"boolean"!=typeof e.aborted||e.on("aborted",q),e.on("end",$),e.on("finish",P),!1!==t.error&&e.on("error",F),e.on("close",q),U?n.nextTick(q):null!=j&&j.errorEmitted||null!=O&&O.errorEmitted?M||n.nextTick(Y):(p||M&&!g(e)||!L&&!1!==E(e))&&(m||M&&!E(e)||!B&&!1!==g(e))?O&&e.req&&e.aborted&&n.nextTick(Y):n.nextTick(Y);const z=()=>{r=N,e.removeListener("aborted",q),e.removeListener("complete",P),e.removeListener("abort",q),e.removeListener("request",W),e.req&&e.req.removeListener("finish",P),e.removeListener("end",A),e.removeListener("close",A),e.removeListener("finish",P),e.removeListener("end",$),e.removeListener("error",F),e.removeListener("close",q);};if(t.signal&&!U){const o=()=>{const n=r;z(),n.call(e,new i(void 0,{cause:t.signal.reason}));};if(t.signal.aborted)n.nextTick(o);else {const n=r;r=u(((...r)=>{t.signal.removeEventListener("abort",o),n.apply(e,r);})),t.signal.addEventListener("abort",o);}}return z}function C(e,t,r){let o=!1,a=N;if(t.signal)if(a=()=>{o=!0,r.call(e,new i(void 0,{cause:t.signal.reason}));},t.signal.aborted)n.nextTick(a);else {const n=r;r=u(((...r)=>{t.signal.removeEventListener("abort",a),n.apply(e,r);})),t.signal.addEventListener("abort",a);}const s=(...t)=>{o||n.nextTick((()=>r.apply(e,t)));};return m(e[j].promise,s,s),N}function A(e,t){var r;let n=!1;return null===t&&(t=l),null!==(r=t)&&void 0!==r&&r.cleanup&&(f(t.cleanup,"cleanup"),n=t.cleanup),new p(((r,i)=>{const o=O(e,t,(e=>{n&&o(),e?i(e):r();}));}))}t.exports=O,t.exports.finished=A;},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./utils":35,"process/":18}],27:[function(e,t,r){const n=e("process/"),{PromisePrototypeThen:i,SymbolAsyncIterator:o,SymbolIterator:a}=e("../../ours/primordials"),{Buffer:s}=e("buffer"),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_NULL_VALUES:u}=e("../../ours/errors").codes;function c(e,t,r){let c,d;if("string"==typeof t||t instanceof s)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null);}});if(t&&t[o])d=!0,c=t[o]();else {if(!t||!t[a])throw new l("iterable",["Iterable"],t);d=!1,c=t[a]();}const h=new e({objectMode:!0,highWaterMark:1,...r});let f=!1;async function p(e){const t=null!=e,r="function"==typeof c.throw;if(t&&r){const{value:t,done:r}=await c.throw(e);if(await t,r)return}if("function"==typeof c.return){const{value:e}=await c.return();await e;}}async function m(){for(;;){try{const{value:e,done:t}=d?await c.next():c.next();if(t)h.push(null);else {const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw f=!1,new u;if(h.push(t))continue;f=!1;}}catch(e){h.destroy(e);}break}}return h._read=function(){f||(f=!0,m());},h._destroy=function(e,t){i(p(e),(()=>n.nextTick(t,e)),(r=>n.nextTick(t,r||e)));},h}t.exports=c;},{"../../ours/errors":39,"../../ours/primordials":40,buffer:15,"process/":18}],28:[function(e,t,r){const{ArrayIsArray:n,ObjectSetPrototypeOf:i}=e("../../ours/primordials"),{EventEmitter:o}=e("events");function a(e){o.call(this,e);}function s(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r);}i(a.prototype,o.prototype),i(a,o),a.prototype.pipe=function(e,t){const 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",l),r.on("close",u));let a=!1;function l(){a||(a=!0,e.end());}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy());}function c(e){d(),0===o.listenerCount(this,"error")&&this.emit("error",e);}function d(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",l),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",d),r.removeListener("close",d),e.removeListener("close",d);}return s(r,"error",c),s(e,"error",c),r.on("end",d),r.on("close",d),e.on("close",d),e.emit("pipe",r),e},t.exports={Stream:a,prependListener:s};},{"../../ours/primordials":40,events:16}],29:[function(e,t,r){const n=globalThis.AbortController||e("abort-controller").AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:o,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:s},AbortError:l}=e("../../ours/errors"),{validateAbortSignal:u,validateInteger:c,validateObject:d}=e("../validators"),h=e("../../ours/primordials").Symbol("kWeak"),{finished:f}=e("./end-of-stream"),p=e("./compose"),{addAbortSignalNoValidate:m}=e("./add-abort-signal"),{isWritable:y,isNodeStream:g}=e("./utils"),{ArrayPrototypePush:v,MathFloor:w,Number:b,NumberIsNaN:_,Promise:E,PromiseReject:T,PromisePrototypeThen:x,Symbol:I}=e("../../ours/primordials"),S=I("kEmpty"),R=I("kEof");function k(e,t){if(null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),g(e)&&!y(e))throw new i("stream",e,"must be writable");const r=p(this,e);return null!=t&&t.signal&&m(t.signal,r),r}function j(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal");let r=1;return null!=(null==t?void 0:t.concurrency)&&(r=w(t.concurrency)),c(r,"concurrency",1),async function*(){var i,o;const a=new n,s=this,u=[],c=a.signal,d={signal:c},h=()=>a.abort();let f,p;null!=t&&null!==(i=t.signal)&&void 0!==i&&i.aborted&&h(),null==t||null===(o=t.signal)||void 0===o||o.addEventListener("abort",h);let m=!1;function y(){m=!0;}async function g(){try{for await(let t of s){var n;if(m)return;if(c.aborted)throw new l;try{t=e(t,d);}catch(e){t=T(e);}t!==S&&("function"==typeof(null===(n=t)||void 0===n?void 0:n.catch)&&t.catch(y),u.push(t),f&&(f(),f=null),!m&&u.length&&u.length>=r&&await new E((e=>{p=e;})));}u.push(R);}catch(e){const t=T(e);x(t,void 0,y),u.push(t);}finally{var i;m=!0,f&&(f(),f=null),null==t||null===(i=t.signal)||void 0===i||i.removeEventListener("abort",h);}}g();try{for(;;){for(;u.length>0;){const e=await u[0];if(e===R)return;if(c.aborted)throw new l;e!==S&&(yield e),u.shift(),p&&(p(),p=null);}await new E((e=>{f=e;}));}}finally{a.abort(),m=!0,p&&(p(),p=null);}}.call(this)}function D(e=void 0){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal"),async function*(){let t=0;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new l({cause:e.signal.reason});yield [t++,n];}}.call(this)}async function N(e,t=void 0){for await(const r of M.call(this,e,t))return !0;return !1}async function O(e,t=void 0){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return !await N.call(this,(async(...t)=>!await e(...t)),t)}async function C(e,t){for await(const r of M.call(this,e,t))return r}async function A(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);async function r(t,r){return await e(t,r),S}for await(const e of j.call(this,r,t));}function M(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);async function r(t,r){return await e(t,r)?t:S}return j.call(this,r,t)}class L extends a{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value";}}async function P(e,t,r){var i;if("function"!=typeof e)throw new o("reducer",["Function","AsyncFunction"],e);null!=r&&d(r,"options"),null!=(null==r?void 0:r.signal)&&u(r.signal,"options.signal");let a=arguments.length>1;if(null!=r&&null!==(i=r.signal)&&void 0!==i&&i.aborted){const e=new l(void 0,{cause:r.signal.reason});throw this.once("error",(()=>{})),await f(this.destroy(e)),e}const s=new n,c=s.signal;if(null!=r&&r.signal){const e={once:!0,[h]:this};r.signal.addEventListener("abort",(()=>s.abort()),e);}let p=!1;try{for await(const n of this){var m;if(p=!0,null!=r&&null!==(m=r.signal)&&void 0!==m&&m.aborted)throw new l;a?t=await e(t,n,{signal:c}):(t=n,a=!0);}if(!p&&!a)throw new L}finally{s.abort();}return t}async function B(e){null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal");const t=[];for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new l(void 0,{cause:e.signal.reason});v(t,n);}return t}function $(e,t){const r=j.call(this,e,t);return async function*(){for await(const e of r)yield*e;}.call(this)}function F(e){if(e=b(e),_(e))return 0;if(e<0)throw new s("number",">= 0",e);return e}function U(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=F(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;e--<=0&&(yield r);}}.call(this)}function q(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=F(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;if(!(e-- >0))return;yield r;}}.call(this)}t.exports.streamReturningOperators={asIndexedPairs:D,drop:U,filter:M,flatMap:$,map:j,take:q,compose:k},t.exports.promiseReturningOperators={every:O,forEach:A,reduce:P,toArray:B,some:N,find:C};},{"../../ours/errors":39,"../../ours/primordials":40,"../validators":37,"./add-abort-signal":20,"./compose":22,"./end-of-stream":26,"./utils":35,"abort-controller":11}],30:[function(e,t,r){const{ObjectSetPrototypeOf:n}=e("../../ours/primordials");t.exports=o;const i=e("./transform");function o(e){if(!(this instanceof o))return new o(e);i.call(this,e);}n(o.prototype,i.prototype),n(o,i),o.prototype._transform=function(e,t,r){r(null,e);};},{"../../ours/primordials":40,"./transform":34}],31:[function(e,t,r){const n=e("process/"),{ArrayIsArray:i,Promise:o,SymbolAsyncIterator:a}=e("../../ours/primordials"),s=e("./end-of-stream"),{once:l}=e("../../ours/util"),u=e("./destroy"),c=e("./duplex"),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:h,ERR_INVALID_RETURN_VALUE:f,ERR_MISSING_ARGS:p,ERR_STREAM_DESTROYED:m,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:g}=e("../../ours/errors"),{validateFunction:v,validateAbortSignal:w}=e("../validators"),{isIterable:b,isReadable:_,isReadableNodeStream:E,isNodeStream:T,isTransformStream:x,isWebStream:I,isReadableStream:S,isReadableEnded:R}=e("./utils"),k=globalThis.AbortController||e("abort-controller").AbortController;let j,D;function N(e,t,r){let n=!1;return e.on("close",(()=>{n=!0;})),{destroy:t=>{n||(n=!0,u.destroyer(e,t||new m("pipe")));},cleanup:s(e,{readable:t,writable:r},(e=>{n=!e;}))}}function O(e){return v(e[e.length-1],"streams[stream.length - 1]"),e.pop()}function C(e){if(b(e))return e;if(E(e))return A(e);throw new h("val",["Readable","Iterable","AsyncIterable"],e)}async function*A(t){D||(D=e("./readable")),yield*D.prototype[a].call(t);}async function M(e,t,r,{end:n}){let i,a=null;const l=e=>{if(e&&(i=e),a){const e=a;a=null,e();}},u=()=>new o(((e,t)=>{i?t(i):a=()=>{i?t(i):e();};}));t.on("drain",l);const c=s(t,{readable:!1},l);try{t.writableNeedDrain&&await u();for await(const r of e)t.write(r)||await u();n&&t.end(),await u(),r();}catch(e){r(i!==e?d(i,e):e);}finally{c(),t.off("drain",l);}}async function L(e,t,r,{end:n}){x(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,n&&await i.close(),r();}catch(e){try{await i.abort(e),r(e);}catch(e){r(e);}}}function P(...e){return B(e,l(O(e)))}function B(t,r,o){if(1===t.length&&i(t[0])&&(t=t[0]),t.length<2)throw new p("streams");const a=new k,s=a.signal,l=null==o?void 0:o.signal,u=[];function d(){A(new g);}let m,y;w(l,"options.signal"),null==l||l.addEventListener("abort",d);const v=[];let R,D=0;function O(e){A(e,0==--D);}function A(e,t){if(!e||m&&"ERR_STREAM_PREMATURE_CLOSE"!==m.code||(m=e),m||t){for(;v.length;)v.shift()(m);null==l||l.removeEventListener("abort",d),a.abort(),t&&(m||u.forEach((e=>e())),n.nextTick(r,m,y));}}for(let F=0;F<t.length;F++){const U=t[F],q=F<t.length-1,Y=F>0,W=q||!1!==(null==o?void 0:o.end),z=F===t.length-1;if(T(U)){if(W){const{destroy:H,cleanup:J}=N(U,q,Y);v.push(H),_(U)&&z&&u.push(J);}function G(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&O(e);}U.on("error",G),_(U)&&z&&u.push((()=>{U.removeListener("error",G);}));}if(0===F)if("function"==typeof U){if(R=U({signal:s}),!b(R))throw new f("Iterable, AsyncIterable or Stream","source",R)}else R=b(U)||E(U)||x(U)?U:c.from(U);else if("function"==typeof U){var P;if(R=x(R)?C(null===(P=R)||void 0===P?void 0:P.readable):C(R),R=U(R,{signal:s}),q){if(!b(R,!0))throw new f("AsyncIterable",`transform[${F-1}]`,R)}else {var B;j||(j=e("./passthrough"));const V=new j({objectMode:!0}),Q=null===(B=R)||void 0===B?void 0:B.then;if("function"==typeof Q)D++,Q.call(R,(e=>{y=e,null!=e&&V.write(e),W&&V.end(),n.nextTick(O);}),(e=>{V.destroy(e),n.nextTick(O,e);}));else if(b(R,!0))D++,M(R,V,O,{end:W});else {if(!S(R)&&!x(R))throw new f("AsyncIterable or Promise","destination",R);{const X=R.readable||R;D++,M(X,V,O,{end:W});}}R=V;const{destroy:Z,cleanup:K}=N(R,!1,!0);v.push(Z),z&&u.push(K);}}else if(T(U)){if(E(R)){D+=2;const ee=$(R,U,O,{end:W});_(U)&&z&&u.push(ee);}else if(x(R)||S(R)){const te=R.readable||R;D++,M(te,U,O,{end:W});}else {if(!b(R))throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],R);D++,M(R,U,O,{end:W});}R=U;}else if(I(U)){if(E(R))D++,L(C(R),U,O,{end:W});else if(S(R)||b(R))D++,L(R,U,O,{end:W});else {if(!x(R))throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],R);D++,L(R.readable,U,O,{end:W});}R=U;}else R=c.from(U);}return (null!=s&&s.aborted||null!=l&&l.aborted)&&n.nextTick(d),R}function $(e,t,r,{end:i}){let o=!1;if(t.on("close",(()=>{o||r(new y);})),e.pipe(t,{end:!1}),i){function a(){o=!0,t.end();}R(e)?n.nextTick(a):e.once("end",a);}else r();return s(e,{readable:!0,writable:!1},(t=>{const n=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once("end",r).once("error",r):r(t);})),s(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:B,pipeline:P};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./passthrough":30,"./readable":32,"./utils":35,"abort-controller":11,"process/":18}],32:[function(e,t,r){const n=e("process/"),{ArrayPrototypeIndexOf:i,NumberIsInteger:o,NumberIsNaN:a,NumberParseInt:s,ObjectDefineProperties:l,ObjectKeys:u,ObjectSetPrototypeOf:c,Promise:d,SafeSet:h,SymbolAsyncIterator:f,Symbol:p}=e("../../ours/primordials");t.exports=$,$.ReadableState=B;const{EventEmitter:m}=e("events"),{Stream:y,prependListener:g}=e("./legacy"),{Buffer:v}=e("buffer"),{addAbortSignal:w}=e("./add-abort-signal"),b=e("./end-of-stream");let _=e("../../ours/util").debuglog("stream",(e=>{_=e;}));const E=e("./buffer_list"),T=e("./destroy"),{getHighWaterMark:x,getDefaultHighWaterMark:I}=e("./state"),{aggregateTwoErrors:S,codes:{ERR_INVALID_ARG_TYPE:R,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_OUT_OF_RANGE:j,ERR_STREAM_PUSH_AFTER_EOF:D,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:N}}=e("../../ours/errors"),{validateObject:O}=e("../validators"),C=p("kPaused"),{StringDecoder:A}=e("string_decoder"),M=e("./from");c($.prototype,y.prototype),c($,y);const L=()=>{},{errorOrDestroy:P}=T;function B(t,r,n){"boolean"!=typeof n&&(n=r instanceof e("./duplex")),this.objectMode=!(!t||!t.objectMode),n&&(this.objectMode=this.objectMode||!(!t||!t.readableObjectMode)),this.highWaterMark=t?x(this,t,"readableHighWaterMark",n):I(!1),this.buffer=new E,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[C]=null,this.errorEmitted=!1,this.emitClose=!t||!1!==t.emitClose,this.autoDestroy=!t||!1!==t.autoDestroy,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new A(t.encoding),this.encoding=t.encoding);}function $(t){if(!(this instanceof $))return new $(t);const r=this instanceof e("./duplex");this._readableState=new B(t,this,r),t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.construct&&(this._construct=t.construct),t.signal&&!r&&w(t.signal,this)),y.call(this,t),T.construct(this,(()=>{this._readableState.needReadable&&J(this,this._readableState);}));}function F(e,t,r,n){_("readableAddChunk",t);const i=e._readableState;let o;if(i.objectMode||("string"==typeof t?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?t=v.from(t,r).toString(i.encoding):(t=v.from(t,r),r=""))):t instanceof v?r="":y._isUint8Array(t)?(t=y._uint8ArrayToBuffer(t),r=""):null!=t&&(o=new R("chunk",["string","Buffer","Uint8Array"],t))),o)P(e,o);else if(null===t)i.reading=!1,z(e,i);else if(i.objectMode||t&&t.length>0)if(n)if(i.endEmitted)P(e,new N);else {if(i.destroyed||i.errored)return !1;U(e,i,t,!0);}else if(i.ended)P(e,new D);else {if(i.destroyed||i.errored)return !1;i.reading=!1,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?U(e,i,t,!1):J(e,i)):U(e,i,t,!1);}else n||(i.reading=!1,J(e,i));return !i.ended&&(i.length<i.highWaterMark||0===i.length)}function U(e,t,r,n){t.flowing&&0===t.length&&!t.sync&&e.listenerCount("data")>0?(t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&G(e)),J(e,t);}$.prototype.destroy=T.destroy,$.prototype._undestroy=T.undestroy,$.prototype._destroy=function(e,t){t(e);},$.prototype[m.captureRejectionSymbol]=function(e){this.destroy(e);},$.prototype.push=function(e,t){return F(this,e,t,!1)},$.prototype.unshift=function(e,t){return F(this,e,t,!0)},$.prototype.isPaused=function(){const e=this._readableState;return !0===e[C]||!1===e.flowing},$.prototype.setEncoding=function(e){const t=new A(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const r=this._readableState.buffer;let n="";for(const e of r)n+=t.write(e);return r.clear(),""!==n&&r.push(n),this._readableState.length=n.length,this};const q=1073741824;function Y(e){if(e>q)throw new j("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}function W(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function z(e,t){if(_("onEofChunk"),!t.ended){if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length);}t.ended=!0,t.sync?G(e):(t.needReadable=!1,t.emittedReadable=!0,H(e));}}function G(e){const t=e._readableState;_("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(_("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(H,e));}function H(e){const t=e._readableState;_("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,te(e);}function J(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(V,e,t));}function V(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){const r=t.length;if(_("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1;}function Q(e,t){return function(){const r=e._readableState;r.awaitDrainWriters===t?(_("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(_("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),r.awaitDrainWriters&&0!==r.awaitDrainWriters.size||!e.listenerCount("data")||e.resume();}}function Z(e){const t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!1===t[C]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null);}function K(e){_("readable nexttick read 0"),e.read(0);}function X(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(ee,e,t));}function ee(e,t){_("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),te(e),t.flowing&&!t.reading&&e.read(0);}function te(e){const t=e._readableState;for(_("flow",t.flowing);t.flowing&&null!==e.read(););}function re(e,t){"function"!=typeof e.read&&(e=$.wrap(e,{objectMode:!0}));const r=ne(e,t);return r.stream=e,r}async function*ne(e,t){let r,n=L;function i(t){this===e?(n(),n=L):n=t;}e.on("readable",i);const o=b(e,{writable:!1},(e=>{r=e?S(r,e):null,n(),n=L;}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else {if(r)throw r;if(null===r)return;await new d(i);}}}catch(e){throw r=S(r,e),r}finally{!r&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==r&&!e._readableState.autoDestroy?(e.off("readable",i),o()):T.destroyer(e,null);}}function ie(e,t){if(0===t.length)return null;let r;return 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}function oe(e){const t=e._readableState;_("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(ae,t,e));}function ae(e,t){if(_("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)n.nextTick(se,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy();}}function se(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end();}let le;function ue(){return void 0===le&&(le={}),le}$.prototype.read=function(e){_("read",e),void 0===e?e=NaN:o(e)||(e=s(e,10));const t=this._readableState,r=e;if(e>t.highWaterMark&&(t.highWaterMark=Y(e)),0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return _("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?oe(this):G(this),null;if(0===(e=W(e,t))&&t.ended)return 0===t.length&&oe(this),null;let n,i=t.needReadable;if(_("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&(i=!0,_("length less than watermark",i)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)i=!1,_("reading, ended or constructing",i);else if(i){_("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0);try{this._read(t.highWaterMark);}catch(e){P(this,e);}t.sync=!1,t.reading||(e=W(r,t));}return n=e>0?ie(e,t):null,null===n?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&oe(this)),null===n||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",n)),n},$.prototype._read=function(e){throw new k("_read()")},$.prototype.pipe=function(e,t){const r=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new h(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),_("pipe count=%d opts=%j",i.pipes.length,t);const o=t&&!1===t.end||e===n.stdout||e===n.stderr?v:s;function a(e,t){_("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,c());}function s(){_("onend"),e.end();}let l;i.endEmitted?n.nextTick(o):r.once("end",o),e.on("unpipe",a);let u=!1;function c(){_("cleanup"),e.removeListener("close",m),e.removeListener("finish",y),l&&e.removeListener("drain",l),e.removeListener("error",p),e.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",v),r.removeListener("data",f),u=!0,l&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&l();}function d(){u||(1===i.pipes.length&&i.pipes[0]===e?(_("false write response, pause",0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(_("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),l||(l=Q(r,e),e.on("drain",l));}function f(t){_("ondata");const r=e.write(t);_("dest.write",r),!1===r&&d();}function p(t){if(_("onerror",t),v(),e.removeListener("error",p),0===e.listenerCount("error")){const r=e._writableState||e._readableState;r&&!r.errorEmitted?P(e,t):e.emit("error",t);}}function m(){e.removeListener("finish",y),v();}function y(){_("onfinish"),e.removeListener("close",m),v();}function v(){_("unpipe"),r.unpipe(e);}return r.on("data",f),g(e,"error",p),e.once("close",m),e.once("finish",y),e.emit("pipe",r),!0===e.writableNeedDrain?i.flowing&&d():i.flowing||(_("pipe resume"),r.resume()),e},$.prototype.unpipe=function(e){const t=this._readableState,r={hasUnpiped:!1};if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit("unpipe",this,{hasUnpiped:!1});return this}const n=i(t.pipes,e);return -1===n||(t.pipes.splice(n,1),0===t.pipes.length&&this.pause(),e.emit("unpipe",this,r)),this},$.prototype.on=function(e,t){const r=y.prototype.on.call(this,e,t),i=this._readableState;return "data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,_("on readable",i.length,i.reading),i.length?G(this):i.reading||n.nextTick(K,this))),r},$.prototype.addListener=$.prototype.on,$.prototype.removeListener=function(e,t){const r=y.prototype.removeListener.call(this,e,t);return "readable"===e&&n.nextTick(Z,this),r},$.prototype.off=$.prototype.removeListener,$.prototype.removeAllListeners=function(e){const t=y.prototype.removeAllListeners.apply(this,arguments);return "readable"!==e&&void 0!==e||n.nextTick(Z,this),t},$.prototype.resume=function(){const e=this._readableState;return e.flowing||(_("resume"),e.flowing=!e.readableListening,X(this,e)),e[C]=!1,this},$.prototype.pause=function(){return _("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(_("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[C]=!0,this},$.prototype.wrap=function(e){let t=!1;e.on("data",(r=>{!this.push(r)&&e.pause&&(t=!0,e.pause());})),e.on("end",(()=>{this.push(null);})),e.on("error",(e=>{P(this,e);})),e.on("close",(()=>{this.destroy();})),e.on("destroy",(()=>{this.destroy();})),this._read=()=>{t&&e.resume&&(t=!1,e.resume());};const r=u(e);for(let t=1;t<r.length;t++){const n=r[t];void 0===this[n]&&"function"==typeof e[n]&&(this[n]=e[n].bind(e));}return this},$.prototype[f]=function(){return re(this)},$.prototype.iterator=function(e){return void 0!==e&&O(e,"options"),re(this,e)},l($.prototype,{readable:{__proto__:null,get(){const e=this._readableState;return !(!e||!1===e.readable||e.destroyed||e.errorEmitted||e.endEmitted)},set(e){this._readableState&&(this._readableState.readable=!!e);}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return !(!1===this._readableState.readable||!this._readableState.destroyed&&!this._readableState.errored||this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e);}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.objectMode}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return !!this._readableState&&this._readableState.closed}},destroyed:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.destroyed},set(e){this._readableState&&(this._readableState.destroyed=e);}},readableEnded:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.endEmitted}}}),l(B.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return !1!==this[C]},set(e){this[C]=!!e;}}}),$._fromList=ie,$.from=function(e,t){return M($,e,t)},$.fromWeb=function(e,t){return ue().newStreamReadableFromReadableStream(e,t)},$.toWeb=function(e,t){return ue().newReadableStreamFromStreamReadable(e,t)},$.wrap=function(e,t){var r,n;return new $({objectMode:null===(r=null!==(n=e.readableObjectMode)&&void 0!==n?n:e.objectMode)||void 0===r||r,...t,destroy(t,r){T.destroyer(e,t),r(t);}}).wrap(e)};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./add-abort-signal":20,"./buffer_list":21,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./from":27,"./legacy":28,"./state":33,buffer:15,events:16,"process/":18,string_decoder:14}],33:[function(e,t,r){const{MathFloor:n,NumberIsInteger:i}=e("../../ours/primordials"),{ERR_INVALID_ARG_VALUE:o}=e("../../ours/errors").codes;function a(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}function s(e){return e?16:16384}function l(e,t,r,l){const u=a(t,l,r);if(null!=u){if(!i(u)||u<0)throw new o(l?`options.${r}`:"options.highWaterMark",u);return n(u)}return s(e.objectMode)}t.exports={getHighWaterMark:l,getDefaultHighWaterMark:s};},{"../../ours/errors":39,"../../ours/primordials":40}],34:[function(e,t,r){const{ObjectSetPrototypeOf:n,Symbol:i}=e("../../ours/primordials");t.exports=u;const{ERR_METHOD_NOT_IMPLEMENTED:o}=e("../../ours/errors").codes,a=e("./duplex"),{getHighWaterMark:s}=e("./state");n(u.prototype,a.prototype),n(u,a);const l=i("kCallback");function u(e){if(!(this instanceof u))return new u(e);const t=e?s(this,e,"readableHighWaterMark",!0):null;0===t&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[l]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d);}function c(e){"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush(((t,r)=>{t?e?e(t):this.destroy(t):(null!=r&&this.push(r),this.push(null),e&&e());}));}function d(){this._final!==c&&c.call(this);}u.prototype._final=c,u.prototype._transform=function(e,t,r){throw new o("_transform()")},u.prototype._write=function(e,t,r){const n=this._readableState,i=this._writableState,o=n.length;this._transform(e,t,((e,t)=>{e?r(e):(null!=t&&this.push(t),i.ended||o===n.length||n.length<n.highWaterMark?r():this[l]=r);}));},u.prototype._read=function(){if(this[l]){const e=this[l];this[l]=null,e();}};},{"../../ours/errors":39,"../../ours/primordials":40,"./duplex":24,"./state":33}],35:[function(e,t,r){const{Symbol:n,SymbolAsyncIterator:i,SymbolIterator:o,SymbolFor:a}=e("../../ours/primordials"),s=n("kDestroyed"),l=n("kIsErrored"),u=n("kIsReadable"),c=n("kIsDisturbed"),d=a("nodejs.webstream.isClosedPromise"),h=a("nodejs.webstream.controllerErrorFunction");function f(e,t=!1){var r;return !(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||t&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(r=e._readableState)||void 0===r?void 0:r.readable)||e._writableState&&!e._readableState)}function p(e){var t;return !(!e||"function"!=typeof e.write||"function"!=typeof e.on||e._readableState&&!1===(null===(t=e._writableState)||void 0===t?void 0:t.writable))}function m(e){return !(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write)}function y(e){return e&&(e._readableState||e._writableState||"function"==typeof e.write&&"function"==typeof e.on||"function"==typeof e.pipe&&"function"==typeof e.on)}function g(e){return !(!e||y(e)||"function"!=typeof e.pipeThrough||"function"!=typeof e.getReader||"function"!=typeof e.cancel)}function v(e){return !(!e||y(e)||"function"!=typeof e.getWriter||"function"!=typeof e.abort)}function w(e){return !(!e||y(e)||"object"!=typeof e.readable||"object"!=typeof e.writable)}function b(e){return g(e)||v(e)||w(e)}function _(e,t){return null!=e&&(!0===t?"function"==typeof e[i]:!1===t?"function"==typeof e[o]:"function"==typeof e[i]||"function"==typeof e[o])}function E(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return !!(e.destroyed||e[s]||null!=n&&n.destroyed)}function T(e){if(!p(e))return null;if(!0===e.writableEnded)return !0;const t=e._writableState;return (null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function x(e,t){if(!p(e))return null;if(!0===e.writableFinished)return !0;const r=e._writableState;return (null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.finished)?null:!!(r.finished||!1===t&&!0===r.ended&&0===r.length))}function I(e){if(!f(e))return null;if(!0===e.readableEnded)return !0;const t=e._readableState;return !(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function S(e,t){if(!f(e))return null;const r=e._readableState;return (null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.endEmitted)?null:!!(r.endEmitted||!1===t&&!0===r.ended&&0===r.length))}function R(e){return e&&null!=e[u]?e[u]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!E(e)&&f(e)&&e.readable&&!S(e)}function k(e){return "boolean"!=typeof(null==e?void 0:e.writable)?null:!E(e)&&p(e)&&e.writable&&!T(e)}function j(e,t){return y(e)?!(!E(e)&&(!1!==(null==t?void 0:t.readable)&&R(e)||!1!==(null==t?void 0:t.writable)&&k(e))):null}function D(e){var t,r;return y(e)?e.writableErrored?e.writableErrored:null!==(t=null===(r=e._writableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null}function N(e){var t,r;return y(e)?e.readableErrored?e.readableErrored:null!==(t=null===(r=e._readableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null}function O(e){if(!y(e))return null;if("boolean"==typeof e.closed)return e.closed;const t=e._writableState,r=e._readableState;return "boolean"==typeof(null==t?void 0:t.closed)||"boolean"==typeof(null==r?void 0:r.closed)?(null==t?void 0:t.closed)||(null==r?void 0:r.closed):"boolean"==typeof e._closed&&C(e)?e._closed:null}function C(e){return "boolean"==typeof e._closed&&"boolean"==typeof e._defaultKeepAlive&&"boolean"==typeof e._removedConnection&&"boolean"==typeof e._removedContLen}function A(e){return "boolean"==typeof e._sent100&&C(e)}function M(e){var t;return "boolean"==typeof e._consuming&&"boolean"==typeof e._dumped&&void 0===(null===(t=e.req)||void 0===t?void 0:t.upgradeOrConnect)}function L(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return !n&&A(e)||!!(n&&n.autoDestroy&&n.emitClose&&!1===n.closed)}function P(e){var t;return !(!e||!(null!==(t=e[c])&&void 0!==t?t:e.readableDidRead||e.readableAborted))}function B(e){var t,r,n,i,o,a,s,u,c,d;return !(!e||!(null!==(t=null!==(r=null!==(n=null!==(i=null!==(o=null!==(a=e[l])&&void 0!==a?a:e.readableErrored)&&void 0!==o?o:e.writableErrored)&&void 0!==i?i:null===(s=e._readableState)||void 0===s?void 0:s.errorEmitted)&&void 0!==n?n:null===(u=e._writableState)||void 0===u?void 0:u.errorEmitted)&&void 0!==r?r:null===(c=e._readableState)||void 0===c?void 0:c.errored)&&void 0!==t?t:null===(d=e._writableState)||void 0===d?void 0:d.errored))}t.exports={kDestroyed:s,isDisturbed:P,kIsDisturbed:c,isErrored:B,kIsErrored:l,isReadable:R,kIsReadable:u,kIsClosedPromise:d,kControllerErrorFunction:h,isClosed:O,isDestroyed:E,isDuplexNodeStream:m,isFinished:j,isIterable:_,isReadableNodeStream:f,isReadableStream:g,isReadableEnded:I,isReadableFinished:S,isReadableErrored:N,isNodeStream:y,isWebStream:b,isWritable:k,isWritableNodeStream:p,isWritableStream:v,isWritableEnded:T,isWritableFinished:x,isWritableErrored:D,isServerRequest:M,isServerResponse:A,willEmitClose:L,isTransformStream:w};},{"../../ours/primordials":40}],36:[function(e,t,r){const n=e("process/"),{ArrayPrototypeSlice:i,Error:o,FunctionPrototypeSymbolHasInstance:a,ObjectDefineProperty:s,ObjectDefineProperties:l,ObjectSetPrototypeOf:u,StringPrototypeToLowerCase:c,Symbol:d,SymbolHasInstance:h}=e("../../ours/primordials");t.exports=A,A.WritableState=O;const{EventEmitter:f}=e("events"),p=e("./legacy").Stream,{Buffer:m}=e("buffer"),y=e("./destroy"),{addAbortSignal:g}=e("./add-abort-signal"),{getHighWaterMark:v,getDefaultHighWaterMark:w}=e("./state"),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:_,ERR_MULTIPLE_CALLBACK:E,ERR_STREAM_CANNOT_PIPE:T,ERR_STREAM_DESTROYED:x,ERR_STREAM_ALREADY_FINISHED:I,ERR_STREAM_NULL_VALUES:S,ERR_STREAM_WRITE_AFTER_END:R,ERR_UNKNOWN_ENCODING:k}=e("../../ours/errors").codes,{errorOrDestroy:j}=y;function D(){}u(A.prototype,p.prototype),u(A,p);const N=d("kOnFinished");function O(t,r,n){"boolean"!=typeof n&&(n=r instanceof e("./duplex")),this.objectMode=!(!t||!t.objectMode),n&&(this.objectMode=this.objectMode||!(!t||!t.writableObjectMode)),this.highWaterMark=t?v(this,t,"writableHighWaterMark",n):w(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const i=!(!t||!1!==t.decodeStrings);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=$.bind(void 0,r),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,C(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||!1!==t.emitClose,this.autoDestroy=!t||!1!==t.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[N]=[];}function C(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0;}function A(t){const r=this instanceof e("./duplex");if(!r&&!a(A,this))return new A(t);this._writableState=new O(t,this,r),t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final),"function"==typeof t.construct&&(this._construct=t.construct),t.signal&&g(t.signal,this)),p.call(this,t),y.construct(this,(()=>{const e=this._writableState;e.writing||Y(this,e),H(this,e);}));}function M(e,t,r,i){const o=e._writableState;if("function"==typeof r)i=r,r=o.defaultEncoding;else {if(r){if("buffer"!==r&&!m.isEncoding(r))throw new k(r)}else r=o.defaultEncoding;"function"!=typeof i&&(i=D);}if(null===t)throw new S;if(!o.objectMode)if("string"==typeof t)!1!==o.decodeStrings&&(t=m.from(t,r),r="buffer");else if(t instanceof m)r="buffer";else {if(!p._isUint8Array(t))throw new b("chunk",["string","Buffer","Uint8Array"],t);t=p._uint8ArrayToBuffer(t),r="buffer";}let a;return o.ending?a=new R:o.destroyed&&(a=new x("write")),a?(n.nextTick(i,a),j(e,a,!0),a):(o.pendingcb++,L(e,o,t,r,i))}function L(e,t,r,n,i){const o=t.objectMode?1:r.length;t.length+=o;const a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:r,encoding:n,callback:i}),t.allBuffers&&"buffer"!==n&&(t.allBuffers=!1),t.allNoop&&i!==D&&(t.allNoop=!1)):(t.writelen=o,t.writecb=i,t.writing=!0,t.sync=!0,e._write(r,n,t.onwrite),t.sync=!1),a&&!t.errored&&!t.destroyed}function P(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new x("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1;}function B(e,t,r,n){--t.pendingcb,n(r),q(t),j(e,r);}function $(e,t){const r=e._writableState,i=r.sync,o=r.writecb;"function"==typeof o?(r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(r.errored||(r.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(B,e,r,t,o):B(e,r,t,o)):(r.buffered.length>r.bufferedIndex&&Y(e,r),i?null!==r.afterWriteTickInfo&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:e,state:r},n.nextTick(F,r.afterWriteTickInfo)):U(e,r,1,o))):j(e,new E);}function F({stream:e,state:t,count:r,cb:n}){return t.afterWriteTickInfo=null,U(e,t,r,n)}function U(e,t,r,n){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&q(t),H(e,t);}function q(e){if(e.writing)return;for(let r=e.bufferedIndex;r<e.buffered.length;++r){var t;const{chunk:n,callback:i}=e.buffered[r],o=e.objectMode?1:n.length;e.length-=o,i(null!==(t=e.errored)&&void 0!==t?t:new x("write"));}const r=e[N].splice(0);for(let t=0;t<r.length;t++){var n;r[t](null!==(n=e.errored)&&void 0!==n?n:new x("end"));}C(e);}function Y(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;const{buffered:r,bufferedIndex:n,objectMode:o}=t,a=r.length-n;if(!a)return;let s=n;if(t.bufferProcessing=!0,a>1&&e._writev){t.pendingcb-=a-1;const n=t.allNoop?D:e=>{for(let t=s;t<r.length;++t)r[t].callback(e);},o=t.allNoop&&0===s?r:i(r,s);o.allBuffers=t.allBuffers,P(e,t,!0,t.length,o,"",n),C(t);}else {do{const{chunk:n,encoding:i,callback:a}=r[s];r[s++]=null,P(e,t,!1,o?1:n.length,n,i,a);}while(s<r.length&&!t.writing);s===r.length?C(t):s>256?(r.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s;}t.bufferProcessing=!1;}function W(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function z(e,t){let r=!1;function i(i){if(r)j(e,null!=i?i:E());else if(r=!0,t.pendingcb--,i){const r=t[N].splice(0);for(let e=0;e<r.length;e++)r[e](i);j(e,i,t.sync);}else W(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,n.nextTick(J,e,t));}t.sync=!0,t.pendingcb++;try{e._final(i);}catch(e){i(e);}t.sync=!1;}function G(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,z(e,t)));}function H(e,t,r){W(t)&&(G(e,t),0===t.pendingcb&&(r?(t.pendingcb++,n.nextTick(((e,t)=>{W(t)?J(e,t):t.pendingcb--;}),e,t)):W(t)&&(t.pendingcb++,J(e,t))));}function J(e,t){t.pendingcb--,t.finished=!0;const r=t[N].splice(0);for(let e=0;e<r.length;e++)r[e]();if(e.emit("finish"),t.autoDestroy){const t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||!1===t.readable))&&e.destroy();}}O.prototype.getBuffer=function(){return i(this.buffered,this.bufferedIndex)},s(O.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}}),s(A,h,{__proto__:null,value:function(e){return !!a(this,e)||this===A&&e&&e._writableState instanceof O}}),A.prototype.pipe=function(){j(this,new T);},A.prototype.write=function(e,t,r){return !0===M(this,e,t,r)},A.prototype.cork=function(){this._writableState.corked++;},A.prototype.uncork=function(){const e=this._writableState;e.corked&&(e.corked--,e.writing||Y(this,e));},A.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=c(e)),!m.isEncoding(e))throw new k(e);return this._writableState.defaultEncoding=e,this},A.prototype._write=function(e,t,r){if(!this._writev)throw new _("_write()");this._writev([{chunk:e,encoding:t}],r);},A.prototype._writev=null,A.prototype.end=function(e,t,r){const i=this._writableState;let a;if("function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e){const r=M(this,e,t);r instanceof o&&(a=r);}return i.corked&&(i.corked=1,this.uncork()),a||(i.errored||i.ending?i.finished?a=new I("end"):i.destroyed&&(a=new x("end")):(i.ending=!0,H(this,i,!0),i.ended=!0)),"function"==typeof r&&(a||i.finished?n.nextTick(r,a):i[N].push(r)),this},l(A.prototype,{closed:{__proto__:null,get(){return !!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get(){return !!this._writableState&&this._writableState.destroyed},set(e){this._writableState&&(this._writableState.destroyed=e);}},writable:{__proto__:null,get(){const e=this._writableState;return !(!e||!1===e.writable||e.destroyed||e.errored||e.ending||e.ended)},set(e){this._writableState&&(this._writableState.writable=!!e);}},writableFinished:{__proto__:null,get(){return !!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get(){return !!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return !!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get(){const e=this._writableState;return !!e&&!e.destroyed&&!e.ending&&e.needDrain}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return !(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});const V=y.destroy;let Q;function Z(){return void 0===Q&&(Q={}),Q}A.prototype.destroy=function(e,t){const r=this._writableState;return !r.destroyed&&(r.bufferedIndex<r.buffered.length||r[N].length)&&n.nextTick(q,r),V.call(this,e,t),this},A.prototype._undestroy=y.undestroy,A.prototype._destroy=function(e,t){t(e);},A.prototype[f.captureRejectionSymbol]=function(e){this.destroy(e);},A.fromWeb=function(e,t){return Z().newStreamWritableFromWritableStream(e,t)},A.toWeb=function(e){return Z().newWritableStreamFromStreamWritable(e)};},{"../../ours/errors":39,"../../ours/primordials":40,"./add-abort-signal":20,"./destroy":23,"./duplex":24,"./legacy":28,"./state":33,buffer:15,events:16,"process/":18}],37:[function(e,t,r){const{ArrayIsArray:n,ArrayPrototypeIncludes:i,ArrayPrototypeJoin:o,ArrayPrototypeMap:a,NumberIsInteger:s,NumberIsNaN:l,NumberMAX_SAFE_INTEGER:u,NumberMIN_SAFE_INTEGER:c,NumberParseInt:d,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:m,StringPrototypeTrim:y}=e("../ours/primordials"),{hideStackFrames:g,codes:{ERR_SOCKET_BAD_PORT:v,ERR_INVALID_ARG_TYPE:w,ERR_INVALID_ARG_VALUE:b,ERR_OUT_OF_RANGE:_,ERR_UNKNOWN_SIGNAL:E}}=e("../ours/errors"),{normalizeEncoding:T}=e("../ours/util"),{isAsyncFunction:x,isArrayBufferView:I}=e("../ours/util").types,S={};function R(e){return e===(0|e)}function k(e){return e===e>>>0}const j=/^[0-7]+$/,D="must be a 32-bit unsigned integer or an octal string";function N(e,t,r){if(void 0===e&&(e=r),"string"==typeof e){if(null===f(j,e))throw new b(t,e,D);e=d(e,8);}return A(e,t),e}const O=g(((e,t,r=c,n=u)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<r||e>n)throw new _(t,`>= ${r} && <= ${n}`,e)})),C=g(((e,t,r=-2147483648,n=2147483647)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<r||e>n)throw new _(t,`>= ${r} && <= ${n}`,e)})),A=g(((e,t,r=!1)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);const n=r?1:0,i=4294967295;if(e<n||e>i)throw new _(t,`>= ${n} && <= ${i}`,e)}));function M(e,t){if("string"!=typeof e)throw new w(t,"string",e)}function L(e,t,r=void 0,n){if("number"!=typeof e)throw new w(t,"number",e);if(null!=r&&e<r||null!=n&&e>n||(null!=r||null!=n)&&l(e))throw new _(t,`${null!=r?`>= ${r}`:""}${null!=r&&null!=n?" && ":""}${null!=n?`<= ${n}`:""}`,e)}const P=g(((e,t,r)=>{if(!i(r,e)){const n=o(a(r,(e=>"string"==typeof e?`'${e}'`:p(e))),", ");throw new b(t,e,"must be one of: "+n)}}));function B(e,t){if("boolean"!=typeof e)throw new w(t,"boolean",e)}function $(e,t,r){return null!=e&&h(e,t)?e[t]:r}const F=g(((e,t,r=null)=>{const i=$(r,"allowArray",!1),o=$(r,"allowFunction",!1);if(!$(r,"nullable",!1)&&null===e||!i&&n(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new w(t,"Object",e)})),U=g(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new w(t,"a dictionary",e)})),q=g(((e,t,r=0)=>{if(!n(e))throw new w(t,"Array",e);if(e.length<r)throw new b(t,e,`must be longer than ${r}`)}));function Y(e,t){q(e,t);for(let r=0;r<e.length;r++)M(e[r],`${t}[${r}]`);}function W(e,t){q(e,t);for(let r=0;r<e.length;r++)B(e[r],`${t}[${r}]`);}function z(e,t="signal"){if(M(e,t),void 0===S[e]){if(void 0!==S[m(e)])throw new E(e+" (signals must use all capital letters)");throw new E(e)}}const G=g(((e,t="buffer")=>{if(!I(e))throw new w(t,["Buffer","TypedArray","DataView"],e)}));function H(e,t){const r=T(t),n=e.length;if("hex"===r&&n%2!=0)throw new b("encoding",t,`is invalid for data of length ${n}`)}function J(e,t="Port",r=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===y(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new v(t,e,r);return 0|e}const V=g(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new w(t,"AbortSignal",e)})),Q=g(((e,t)=>{if("function"!=typeof e)throw new w(t,"Function",e)})),Z=g(((e,t)=>{if("function"!=typeof e||x(e))throw new w(t,"Function",e)})),K=g(((e,t)=>{if(void 0!==e)throw new w(t,"undefined",e)}));function X(e,t,r){if(!i(r,e))throw new w(t,`('${o(r,"|")}')`,e)}const ee=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function te(e,t){if(void 0===e||!f(ee,e))throw new b(t,e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function re(e){if("string"==typeof e)return te(e,"hints"),e;if(n(e)){const t=e.length;let r="";if(0===t)return r;for(let n=0;n<t;n++){const i=e[n];te(i,"hints"),r+=i,n!==t-1&&(r+=", ");}return r}throw new b("hints",e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}t.exports={isInt32:R,isUint32:k,parseFileMode:N,validateArray:q,validateStringArray:Y,validateBooleanArray:W,validateBoolean:B,validateBuffer:G,validateDictionary:U,validateEncoding:H,validateFunction:Q,validateInt32:C,validateInteger:O,validateNumber:L,validateObject:F,validateOneOf:P,validatePlainFunction:Z,validatePort:J,validateSignalName:z,validateString:M,validateUint32:A,validateUndefined:K,validateUnion:X,validateAbortSignal:V,validateLinkHeaderValue:re};},{"../ours/errors":39,"../ours/primordials":40,"../ours/util":41}],38:[function(e,t,r){const n=e("../stream"),i=e("../stream/promises"),o=n.Readable.destroy;t.exports=n.Readable,t.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,t.exports._isUint8Array=n._isUint8Array,t.exports.isDisturbed=n.isDisturbed,t.exports.isErrored=n.isErrored,t.exports.isReadable=n.isReadable,t.exports.Readable=n.Readable,t.exports.Writable=n.Writable,t.exports.Duplex=n.Duplex,t.exports.Transform=n.Transform,t.exports.PassThrough=n.PassThrough,t.exports.addAbortSignal=n.addAbortSignal,t.exports.finished=n.finished,t.exports.destroy=n.destroy,t.exports.destroy=o,t.exports.pipeline=n.pipeline,t.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get:()=>i}),t.exports.Stream=n.Stream,t.exports.default=t.exports;},{"../stream":42,"../stream/promises":43}],39:[function(e,t,r){const{format:n,inspect:i,AggregateError:o}=e("./util"),a=globalThis.AggregateError||o,s=Symbol("kIsNodeError"),l=["string","function","number","object","Function","Object","boolean","bigint","symbol"],u=/^([A-Z][a-z0-9]*)+$/,c="__node_internal_",d={};function h(e,t){if(!e)throw new d.ERR_INTERNAL_ASSERTION(t)}function f(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return `${e.slice(0,r)}${t}`}function p(e,t,r){if("function"==typeof t)return h(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const i=(t.match(/%[dfijoOs]/g)||[]).length;return h(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),0===r.length?t:n(t,...r)}function m(e,t,r){r||(r=Error);class n extends r{constructor(...r){super(p(e,t,r));}toString(){return `${this.name} [${e}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return `${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=e,n.prototype[s]=!0,d[e]=n;}function y(e){const t=c+e.name;return Object.defineProperty(e,"name",{value:t}),e}function g(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new a([t,e],t.message);return r.code=t.code,r}return e||t}class v extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new d.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError";}}m("ERR_ASSERTION","%s",Error),m("ERR_INVALID_ARG_TYPE",((e,t,r)=>{h("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=`${e} `:n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";const o=[],a=[],s=[];for(const e of t)h("string"==typeof e,"All expected entries have to be of type string"),l.includes(e)?o.push(e.toLowerCase()):u.test(e)?a.push(e):(h("object"!==e,'The value "object" should be written as "Object"'),s.push(e));if(a.length>0){const e=o.indexOf("object");-1!==e&&(o.splice(o,e,1),a.push("Object"));}if(o.length>0){switch(o.length){case 1:n+=`of type ${o[0]}`;break;case 2:n+=`one of type ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();n+=`one of type ${o.join(", ")}, or ${e}`;}}(a.length>0||s.length>0)&&(n+=" or ");}if(a.length>0){switch(a.length){case 1:n+=`an instance of ${a[0]}`;break;case 2:n+=`an instance of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();n+=`an instance of ${a.join(", ")}, or ${e}`;}}s.length>0&&(n+=" or ");}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=`${s[0]}`;break;case 2:n+=`one of ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();n+=`one of ${s.join(", ")}, or ${e}`;}}if(null==r)n+=`. Received ${r}`;else if("function"==typeof r&&r.name)n+=`. Received function ${r.name}`;else if("object"==typeof r){var c;null!==(c=r.constructor)&&void 0!==c&&c.name?n+=`. Received an instance of ${r.constructor.name}`:n+=`. Received ${i(r,{depth:-1})}`;}else {let e=i(r,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),n+=`. Received type ${typeof r} (${e})`;}return n}),TypeError),m("ERR_INVALID_ARG_VALUE",((e,t,r="is invalid")=>{let n=i(t);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`}),TypeError),m("ERR_INVALID_RETURN_VALUE",((e,t,r)=>{var n;return `Expected ${e} to be returned from the "${t}" function but got ${null!=r&&null!==(n=r.constructor)&&void 0!==n&&n.name?`instance of ${r.constructor.name}`:"type "+typeof r}.`}),TypeError),m("ERR_MISSING_ARGS",((...e)=>{let t;h(e.length>0,"At least one arg needs to be specified");const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`;}}return `${t} must be specified`}),TypeError),m("ERR_OUT_OF_RANGE",((e,t,r)=>{let n;return h(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>2**32?n=f(String(r)):"bigint"==typeof r?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=f(n)),n+="n"):n=i(r),`The value of "${e}" is out of range. It must be ${t}. Received ${n}`}),RangeError),m("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),m("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),m("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),m("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),m("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),m("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),m("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),m("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),m("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),m("ERR_STREAM_WRITE_AFTER_END","write after end",Error),m("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),t.exports={AbortError:v,aggregateTwoErrors:y(g),hideStackFrames:y,codes:d};},{"./util":41}],40:[function(e,t,r){t.exports={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,r)=>e.slice(t,r),Error:Error,FunctionPrototypeCall:(e,t,...r)=>e.call(t,...r),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),MathFloor:Math.floor,Number:Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,r)=>Object.defineProperty(e,t,r),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise:Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,r)=>e.then(t,r),PromiseReject:e=>Promise.reject(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String:String,StringPrototypeSlice:(e,t,r)=>e.slice(t,r),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.trim(),Symbol:Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet:(e,t,r)=>e.set(t,r),Uint8Array:Uint8Array};},{}],41:[function(e,t,r){const n=e("buffer"),i=Object.getPrototypeOf((async function(){})).constructor,o=globalThis.Blob||n.Blob,a=void 0!==o?function(e){return e instanceof o}:function(e){return !1};class s extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let r=0;r<e.length;r++)t+=` ${e[r].stack}\n`;super(t),this.name="AggregateError",this.errors=e;}}t.exports={AggregateError:s,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...r){t||(t=!0,e.apply(this,r));}},createDeferredPromise:function(){let e,t;return {promise:new Promise(((r,n)=>{e=r,t=n;})),resolve:e,reject:t}},promisify:e=>new Promise(((t,r)=>{e(((e,...n)=>e?r(e):t(...n)));})),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,(function(...[e,r]){const n=t.shift();return "f"===r?n.toFixed(6):"j"===r?JSON.stringify(n):"s"===r&&"object"==typeof n?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return `"${e}"`;if(!e.includes("`")&&!e.includes("${"))return `\`${e}\``}return `'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return `${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return "{}"}},types:{isAsyncFunction:e=>e instanceof i,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:a},t.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom");},{buffer:15}],42:[function(e,t,r){const{Buffer:n}=e("buffer"),{ObjectDefineProperty:i,ObjectKeys:o,ReflectApply:a}=e("./ours/primordials"),{promisify:{custom:s}}=e("./ours/util"),{streamReturningOperators:l,promiseReturningOperators:u}=e("./internal/streams/operators"),{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=e("./ours/errors"),d=e("./internal/streams/compose"),{pipeline:h}=e("./internal/streams/pipeline"),{destroyer:f}=e("./internal/streams/destroy"),p=e("./internal/streams/end-of-stream"),m=e("./stream/promises"),y=e("./internal/streams/utils"),g=t.exports=e("./internal/streams/legacy").Stream;g.isDisturbed=y.isDisturbed,g.isErrored=y.isErrored,g.isReadable=y.isReadable,g.Readable=e("./internal/streams/readable");for(const w of o(l)){const b=l[w];function _(...e){if(new.target)throw c();return g.Readable.from(a(b,this,e))}i(_,"name",{__proto__:null,value:b.name}),i(_,"length",{__proto__:null,value:b.length}),i(g.Readable.prototype,w,{__proto__:null,value:_,enumerable:!1,configurable:!0,writable:!0});}for(const E of o(u)){const T=u[E];function x(...e){if(new.target)throw c();return a(T,this,e)}i(x,"name",{__proto__:null,value:T.name}),i(x,"length",{__proto__:null,value:T.length}),i(g.Readable.prototype,E,{__proto__:null,value:x,enumerable:!1,configurable:!0,writable:!0});}g.Writable=e("./internal/streams/writable"),g.Duplex=e("./internal/streams/duplex"),g.Transform=e("./internal/streams/transform"),g.PassThrough=e("./internal/streams/passthrough"),g.pipeline=h;const{addAbortSignal:v}=e("./internal/streams/add-abort-signal");g.addAbortSignal=v,g.finished=p,g.destroy=f,g.compose=d,i(g,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>m}),i(h,s,{__proto__:null,enumerable:!0,get:()=>m.pipeline}),i(p,s,{__proto__:null,enumerable:!0,get:()=>m.finished}),g.Stream=g,g._isUint8Array=function(e){return e instanceof Uint8Array},g._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)};},{"./internal/streams/add-abort-signal":20,"./internal/streams/compose":22,"./internal/streams/destroy":23,"./internal/streams/duplex":24,"./internal/streams/end-of-stream":26,"./internal/streams/legacy":28,"./internal/streams/operators":29,"./internal/streams/passthrough":30,"./internal/streams/pipeline":31,"./internal/streams/readable":32,"./internal/streams/transform":34,"./internal/streams/utils":35,"./internal/streams/writable":36,"./ours/errors":39,"./ours/primordials":40,"./ours/util":41,"./stream/promises":43,buffer:15}],43:[function(e,t,r){const{ArrayPrototypePop:n,Promise:i}=e("../ours/primordials"),{isIterable:o,isNodeStream:a,isWebStream:s}=e("../internal/streams/utils"),{pipelineImpl:l}=e("../internal/streams/pipeline"),{finished:u}=e("../internal/streams/end-of-stream");function c(...e){return new i(((t,r)=>{let i,u;const c=e[e.length-1];if(c&&"object"==typeof c&&!a(c)&&!o(c)&&!s(c)){const t=n(e);i=t.signal,u=t.end;}l(e,((e,n)=>{e?r(e):t(n);}),{signal:i,end:u});}))}e("../../lib/stream.js"),t.exports={finished:u,pipeline:c};},{"../../lib/stream.js":42,"../internal/streams/end-of-stream":26,"../internal/streams/pipeline":31,"../internal/streams/utils":35,"../ours/primordials":40}]},{},[10])(10);var Qh=Vh.exports;class Zh{constructor(e,t){this.graphName=e,this.idx=t;}toString(){return `${this.graphName}:${this.idx}`}}class Kh{constructor(e,t){this.tp=e,this.val=t;}toString(){return JSON.stringify(this)}static getRefFromQuad(e){return e.termType===rs.IRI?new Kh(rs.IRI,e.value):e.termType===rs.BlankNode?new Kh(rs.BlankNode,e.value):new Kh(rs.Undefined,"")}}class Xh{async loadDocument(e,t=[]){const r=e.startsWith("http:"),n=e.startsWith("https:");if(!r&&!n)throw new rl('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:e});let i=null;const{res:o,body:a}=await rf({url:e}),s={contextUrl:null,documentUrl:e,document:a||null};if(o.status>=400)throw new rl(`URL "${e}" could not be dereferenced: ${o.statusText}`,"jsonld.InvalidUrl",{code:"loading document failed",url:e,httpStatusCode:o.status});const l=o.headers.get("link");let u=o.headers.get("location");const c=o.headers.get("content-type");if(l&&"application/ld+json"!==c&&"application/json"!==c){const t=hl.parseLinkHeader(l),r=t[vl.LINK_HEADER_CONTEXT];if(Array.isArray(r))throw new rl("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:e});r&&(s.contextUrl=r.target),i=t.alternate,i&&"application/ld+json"==i.type&&!(c||"").match(/^application\/(\w*\+)?json$/)&&(u=El.prependBase(e,i.target));}if((i||o.status>=300&&o.status<400)&&u){if(-1===t.length)throw new rl("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:e,httpStatusCode:o.status,redirects:t});if(-1!==t.indexOf(e))throw new rl("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:e,httpStatusCode:o.status,redirects:t});t.push(e);const r=new URL(u,e).href;return this.loadDocument(r,t)}return t.push(e),s}}const ef="cat";async function tf(e,t,r){if(!t&&!r)throw new rl("IPFS is not configured","jsonld.IPFSNotConfigured",{code:"loading document failed",url:nf+e});return null!==t?await async function(e,t){const r=new URL(function(e,t){const r="/api/v0";for(;e.endsWith("/");)e=e.slice(0,-1);return e.endsWith(r)||(e+=r),e+"/"+t}(t,ef));r.searchParams.append("arg",e);const{res:n,body:i}=await rf({url:r,method:"POST"});if(200!=n.status)throw new Error(`Error calling IPFS node: [${n.status}] ${n.statusText}\n${i}`);return {contextUrl:null,document:i||null,documentUrl:nf+e}}(e,t):await async function(e,t){const r=new Xh,n=await r.loadDocument(function(e,t){return function(e){for(;e.endsWith("/");)e=e.slice(0,-1);return e}(e)+"/ipfs/"+function(e){for(;e.startsWith("/");)e=e.slice(1);return e}(t)}(t,e),[]);return n.contextUrl=null,n.documentUrl=nf+e,n}(e,r)}async function rf({url:e,method:t}){const r={};void 0!==t&&(r.method=t);try{(e=new URL(e)).username&&e.password&&(r.headers={...r.headers??{},authorization:`Basic ${btoa(e.username+":"+e.password)}`},e=function(e){const t=new URL(e);return t.username="",t.password="",t.href}(e));const t=await fetch(e,r);if(t.status>=300&&t.status<400)return {res:t,body:null};const n=await t.text();return n&&n.length>0&&n.startsWith("{")?{res:t,body:JSON.parse(n)}:{res:t,body:n}}catch(t){if(t.response)return {res:t.response,body:null};throw new rl("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:e,cause:t})}}const nf="ipfs://";function of(e){return e?.hasher??a}function af(e){const t=e?.ipfsNodeURL??null,r=e?.ipfsGatewayURL??null;return e?.documentLoader??((e=null,t=null)=>async r=>{if(r.startsWith(nf)){const n=r.slice(nf.length);return await tf(n,e,t)}return (new Xh).loadDocument(r,[])})(t,r)}class sf{constructor(e=new Map){this.graphs=e;}static async fromDocument(e,t=af()){const r=await Hh.canonize(e,{format:i.QUADS_FORMAT,documentLoader:t}),n=new Qh.Parser({format:i.QUADS_FORMAT}).parse(r),o=new sf;for(const e of n){const t=e.graph.termType===i.DEFAULT_GRAPH_TERM_TYPE?i.DEFAULT_GRAPH_NODE_NAME:e.graph.value,r=o.graphs.get(t)??[];r.push(e),o.graphs.set(t,r);}return o}static getQuad(e,t){const r=e.graphs.get(t.graphName);if(!r)throw i.ERRORS.GRAPH_NOT_FOUND;if(t.idx>=r.length)throw i.ERRORS.QUAD_NOT_FOUND;return r[t.idx]}static iterGraphsOrdered(e,t){const r=[];for(const t of e.graphs.keys())r.push(t);r.sort(((e,t)=>e.localeCompare(t)));for(const n of r){t(n,e.graphs.get(n));}}static findParent(e,t){const r=sf.findParentInsideGraph(e,t);return r||sf.findGraphParent(e,t)}static findParentInsideGraph(e,t){const r=os(t);let n;const o=e.graphs.get(r);if(!o)return;const a=Kh.getRefFromQuad(t.subject);if(a.tp===rs.Undefined)return;let s=!1;for(let e=0;e<o.length;e++){const l=o[e];if(l.equals(t))continue;const u=Kh.getRefFromQuad(l.object);if(u.tp!==rs.Undefined&&(a?.tp===u?.tp&&a?.val===u?.val)){if(s)throw i.ERRORS.MULTIPLE_PARENTS_FOUND;s=!0,n=new Zh(r,e);}}return n}static findGraphParent(e,t){if(!t.graph)return;const r=Kh.getRefFromQuad(t.graph);if(r.tp===rs.Undefined)return;if(r.tp!==rs.BlankNode)throw new Error("graph parent can only be a blank node");let n,o=!1;for(const[a,s]of e.graphs)for(let e=0;e<s.length;e++){const l=s[e];if(l.equals(t))continue;const u=Kh.getRefFromQuad(l.object);if(u.tp!==rs.Undefined&&r.toString()==u.toString()){if(o)throw i.ERRORS.MULTIPLE_PARENTS_FOUND;o=!0,n=new Zh(a,e);}}if(o)return n;throw i.ERRORS.PARENT_NOT_FOUND}}sf.assertDatasetConsistency=e=>{for(const[t,r]of e.graphs)for(const e of r){if(!t)throw new Error("empty graph name");if(t===i.DEFAULT_GRAPH_NODE_NAME&&e.graph.id)throw new Error("graph should be nil for @default graph");if(!e.graph.id&&t!==i.DEFAULT_GRAPH_NODE_NAME)throw new Error("graph should not be nil for non-@default graph")}};class lf{constructor(e=[],t=a){this.parts=e,this.hasher=t;}reverse(){return this.parts.reverse()}append(e){this.parts=[...this.parts,...e];}prepend(e){this.parts=[...e,...this.parts];}async mtEntry(){const e=this.hasher??a,t=new Array(this.parts.length).fill(BigInt(0));for(let r=0;r<this.parts.length;r+=1){const n=this.parts[r];if("string"==typeof n){const i=ss.encode(n);t[r]=await e.hashBytes(i);}else {if("number"!=typeof n)throw new Error("error: unexpected type "+typeof n);t[r]=BigInt(n);}}return e.hash(t)}async pathFromContext(e,t,r){const n=JSON.parse(e);if(!n["@context"])throw i.ERRORS.CONTEXT_NOT_DEFINED;const o={documentLoader:af(r)},a=await Hh.processContext(null,null,o);let s=await Hh.processContext(a,n,o);const l=t.split(".");for(const e in l){const t=l[e];if(i.DIGITS_ONLY_REGEX.test(t))this.parts.push(parseInt(t));else {const e=s.mappings.get(t);if("object"!=typeof e)throw i.ERRORS.TERM_IS_NOT_DEFINED;const r=e["@id"];if(!r)throw i.ERRORS.NO_ID_ATTR;e["@context"]&&(s=await Hh.processContext(s,e,o)),this.parts.push(r);}}}async typeFromContext(e,t,r){const n=JSON.parse(e);if(!("@context"in n))throw i.ERRORS.PARSED_CONTEXT_IS_NULL;const o={documentLoader:af(r)},a=await Hh.processContext(null,null,o);let s=await Hh.processContext(a,n,o);const l=t.split(".");for(const e in l){const t=uf(s,l[e]);t.hasContext&&(s=await Hh.processContext(s,t.typeDef,o)),this.parts.push(t["@id"]);}return lf.getTypeMapping(s,l[l.length-1])}static getTypeMapping(e,t){let r="";const n=e.mappings.get("@type");n&&(r=n);const i=e.mappings.get(t);return i&&i["@type"]&&(r=i["@type"]),r}static async pathFromDocument(e,t,r,n,o){if(0===r.length)return [];const a=r[0],s=r.slice(1),l={documentLoader:af(o)};if(i.DIGITS_ONLY_REGEX.test(a)){return [parseInt(a),...await lf.pathFromDocument(e,t,s,!0,o)]}if("object"!=typeof t)throw new Error("error: expected type object got "+typeof t);if(Array.isArray(t)){if(!t.length)throw new Error("error: can't generate path on zero-sized array");if(!n)throw i.ERRORS.UNEXPECTED_ARR_ELEMENT;return lf.pathFromDocument(e,t[0],r,!1,o)}if("@context"in t)if(e)e=await Hh.processContext(e,t,l);else {const r=await Hh.processContext(null,null,l);e=await Hh.processContext(r,t,l);}const u=as(Object.keys(t)),c=e;for(const r in u){const n=u[r];if("@type"!==n){const t=e.mappings.get(n);if("object"!=typeof t)continue;if("@type"!==t["@id"])continue}let i=[];if(Array.isArray(t[n]))t[n].forEach((e=>{if("string"!=typeof e)throw new Error("error: @type value must be an array of strings: "+typeof e);i.push(e),i=as(i);}));else {if("string"!=typeof t[n])throw new Error("error: unexpected @type field type: "+typeof t[n]);i.push(t[n]);}for(const t of i){const r=c.mappings.get(t);"object"==typeof r&&"@context"in r&&(e=await Hh.processContext(e,r,l));}break}const d=uf(e,a);if(d.hasContext)if(e)e=await Hh.processContext(e,d.typeDef,l);else {const t=await Hh.processContext(null,null,l);e=await Hh.processContext(t,d.typeDef,l);}const h=await lf.pathFromDocument(e,t[a],s,!0,o);return [d["@id"],...h]}static async newPathFromCtx(e,t,r){const n=new lf([],of(r));return await n.pathFromContext(e,t,r),n}static async fromDocument(e,t,r,n){const o=JSON.parse(t),a=r.split(".");if(0===a.length)throw i.ERRORS.FIELD_PATH_IS_EMPTY;const s=await lf.pathFromDocument(e,o,a,!1,n);return new lf(s,of(n))}static async newTypeFromContext(e,t,r){const n=new lf([],of(r));return await n.typeFromContext(e,t,r)}static async getTypeIDFromContext(e,t,r){const n=JSON.parse(e),i={documentLoader:af(r)},o=await Hh.processContext(null,null,i),a=(await Hh.processContext(o,n,i)).mappings.get(t);if(!a)throw new Error(`looks like ${t} is not a type`);const s=a["@id"];if(!s)throw new Error(`@id attribute is not found for type ${t}`);if("string"!=typeof s)throw new Error(`@id attribute is not a string for type ${t}`);return s}}function uf(e,t){const r=e.mappings.get(t);if("object"!=typeof r)throw i.ERRORS.TERM_IS_NOT_DEFINED;const n=r["@id"];if(!n)throw i.ERRORS.NO_ID_ATTR;if("string"!=typeof n)throw new Error("error: @id attr is not of type string: "+typeof n);return {"@id":n,hasContext:"@context"in r,typeDef:r}}lf.newPath=e=>{const t=new lf;return t.append(e),t},lf.getContextPathKey=async(e,t,r,n)=>{if(""===t)throw i.ERRORS.CTX_TYP_IS_EMPTY;if(""===r)throw i.ERRORS.FIELD_PATH_IS_EMPTY;const o=await lf.newPathFromCtx(e,`${t}.${r}`,n),a=await lf.newPathFromCtx(e,t,n);return new lf(o.parts.slice(a.parts.length))};class cf{constructor(e){this.graph=os(e);const t=e.subject;switch(t.termType){case rs.IRI:this.subject={tp:rs.IRI,val:t.value};break;case rs.BlankNode:this.subject={tp:rs.BlankNode,val:t.value};break;default:throw new Error("invalid subject type")}if(e.predicate.termType!==rs.IRI)throw new Error("invalid predicate type");this.predicate=e.predicate.value;}toString(){return JSON.stringify(this)}}cf.countEntries=e=>{const t=new Map;for(const r of e){const e=new cf(r);let n=t.get(e.toString())??0;t.set(e.toString(),++n);}return t};class df{constructor(e=new Map,t=new Map,r=a){this.parents=e,this.children=t,this.hasher=r;}static getIriValue(e){if(e.predicate.termType===rs.IRI)return e.predicate.value;throw new Error("type is not IRI")}path(e,t,r){const n=new lf([],this.hasher);"number"==typeof r&&n.append([r]);const i=sf.getQuad(t,e),o=df.getIriValue(i);n.append([o]);let a=e;for(;;){const e=this.parents.get(a.toString());if(!e)break;const r=sf.getQuad(t,e),i=new cf(r),o=this.children.get(i.toString());if(!o)throw new Error("parent mapping not found");const s=sf.getQuad(t,a),l=Kh.getRefFromQuad(s.subject),u=o.get(l.toString());if("number"!=typeof u)throw new Error("child not found in parents mapping");const c=df.getIriValue(r);1===o.size?n.append([c]):n.append([u,c]),a=e;}return n.reverse(),n}static async newRelationship(e,t){const r=new df(new Map,new Map,t);return sf.iterGraphsOrdered(e,((t,n)=>{for(let i=0;i<n.length;i++){const o=n[i],a=sf.findParent(e,o);if(!a)continue;const s=new Zh(t,i);r.parents.set(s.toString(),a);const l=sf.getQuad(e,a),u=new cf(l);let c=r.children.get(u.toString());c||(c=new Map,r.children.set(u.toString(),c));const d=Kh.getRefFromQuad(o.subject);if("number"!=typeof c.get(d.toString())){const e=c.size;c.set(d.toString(),e);}}})),r}}class hf{constructor(e,t,r="",n=a){if(this.key=e,this.value=t,this.dataType=r,this.hasher=n,!e.parts.length)throw new Error("key length is zero");(e=>{switch(typeof e){case"boolean":case"string":case"bigint":case"number":return;case"object":if(e instanceof es.Instant)return}throw new Error(`unexpected value type ${typeof e}, expected boolean | number | Temporal.Instant | string`)})(t);}getHasher(){return this.hasher}getKeyMtEntry(){return this.key.mtEntry()}getValueMtEntry(){return hs.mkValueMtEntry(this.getHasher(),this.value)}async getKeyValueMTEntry(){return {k:await this.getKeyMtEntry(),v:await this.getValueMtEntry()}}static async fromDataSet(e,t=a){sf.assertDatasetConsistency(e);if(!e.graphs.get(i.DEFAULT_GRAPH_NODE_NAME).length)throw new Error("@default graph not found in dataset");const r=await df.newRelationship(e,t),n=[];return sf.iterGraphsOrdered(e,((i,o)=>{const a=cf.countEntries(o),s=new Map;for(let l=0;l<o.length;l++){let u="";const c=o[l],d=new Zh(i,l),h=new cf(c);let f;const p=c.object.termType,m=c.object.value;switch(p){case rs.Literal:u=c?.object?.datatype?.value,f=us(u,m,t.prime());break;case rs.IRI:if(!p)throw new Error("object IRI is nil");f=m;break;case rs.BlankNode:if(r.children.get(h.toString()))continue;throw new Error("BlankNode is not supported yet");case"Variable":f=m;break;default:throw new Error("unexpected Quad's Object type")}let y;switch(a.get(h.toString())){case 0:throw new Error("[assertion] key not found in counts");case 1:break;default:const e=h.toString();y=s.get(e)??0,s.set(e,y+1);}const g=r.path(d,e,y),v=new hf(g,f,u,t);n.push(v);}})),n}}hf.newRDFEntry=(e,t)=>{const r=new hf(e,t);switch(typeof t){case"number":case"string":case"boolean":r.value=t;break;default:if(!(t instanceof es.Instant))throw new Error("error: incorrect value type "+typeof t);r.value=t;}return r};class ff{constructor(e=null,i=null,o=a,s=new Map,l=null,u=af()){if(this.srcDoc=e,this.mt=i,this.hasher=o,this.entries=s,this.compacted=l,this.documentLoader=u,!i){const{db:e,writable:i,maxLevels:o}=((e="",n=!0,i=40)=>({db:new j$1(B$2(e)),writable:n,maxLevels:i}))();this.mt=new Jt$1(e,i,o);}}async proof(e){const t=await e.mtEntry(),{proof:r}=await this.mt.generateProof(t);if(r.existence){if(!this.entries.has(t.toString()))throw new Error("error: [assertion] no entry found while existence is true");const e=this.entries.get(t.toString());return {proof:r,value:new hs(e.value,this.hasher)}}return {proof:r}}mkValue(e){return new hs(e,this.hasher)}async resolveDocPath(e,t){const r=await lf.fromDocument(null,this.srcDoc,e,t);return r.hasher=this.hasher,r}async entry(e){const t=await e.mtEntry(),r=this.entries.get(t.toString());if(!r)throw new Error("entry not found");return r}async jsonLDType(e){return (await this.entry(e)).dataType}async root(){return this.mt.root()}rawValue(e){let t=e.parts,r=this.compacted;const n=[];for(;t.length>0;){const e=t[0];if("string"==typeof e){if(n.push(e),r=r[e]??r["@graph"][e],!r)throw new Error("value not found")}else {if("number"!=typeof e)throw new Error(`unexpected type of path ${n.join(" / ")}`);n.push(e.toString()),r=this.rvExtractArrayIdx(r,e);}t=t.slice(1);}return void 0!==r["@value"]?r["@value"]:r}rvExtractArrayIdx(e,t){if(!Array.isArray(e))throw new Error("expected array");if(t<0||t>=e.length)throw new Error("index is out of range");return e[t]}static async merklizeJSONLD(e,t){const r=of(t),n=af(t),i=new ff(e,null,r,new Map,null,n),o=JSON.parse(i.srcDoc),a=await sf.fromDocument(o,n),s=await hf.fromDataSet(a,r);for(const e of s){const t=await e.getKeyMtEntry();i.entries.set(t.toString(),e);}return await(async(e,t)=>{for(const r of t){const{k:t,v:n}=await r.getKeyValueMTEntry();await e.add(t,n);}})(i.mt,s),i.compacted=await Hh.compact(o,{},{documentLoader:n,base:null,compactArrays:!0,compactToRelative:!0}),i}static async hashValue(e,t){return this.hashValueWithHasher(a,e,t)}static async hashValueWithHasher(e,t,r){const n=((e,t)=>{const r=t===ns.Double;switch(typeof e){case"string":return r?is(parseFloat(e)):e;case"boolean":return `${e}`;case"number":return r?is(e):`${e}`;default:throw new Error("unsupported type")}})(r,t),i=us(t,n,e.prime());return await hs.mkValueMtEntry(e,i)}get options(){return {hasher:this.hasher,documentLoader:this.documentLoader}}}
|
|
8127
|
+
const dh=Vs,hh=Ml,fh=hl,ph=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e;}async resolve({activeCtx:e,context:t,documentLoader:r,base:n,cycles:i=new Set}){t&&uu(t)&&t["@context"]&&(t=t["@context"]),t=du(t);const o=[];for(const a of t){if(cu(a)){let t=this._get(a);t||(t=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:r,base:n,cycles:i})),lu(t)?o.push(...t):o.push(t);continue}if(null===a){o.push(new pu({document:null}));continue}uu(a)||mu(t);const s=JSON.stringify(a);let l=this._get(s);l||(l=new pu({document:a}),this._cacheResolvedContext({key:s,resolved:l,tag:"static"})),o.push(l);}return o}_get(e){let t=this.perOpCache.get(e);if(!t){const r=this.sharedCache.get(e);r&&(t=r.get("static"),t&&this.perOpCache.set(e,t));}return t}_cacheResolvedContext({key:e,resolved:t,tag:r}){if(this.perOpCache.set(e,t),void 0!==r){let n=this.sharedCache.get(e);n||(n=new Map,this.sharedCache.set(e,n)),n.set(r,t);}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:r,base:n,cycles:i}){t=hu(n,t);const{context:o,remoteDoc:a}=await this._fetchContext({activeCtx:e,url:t,documentLoader:r,cycles:i});yu({context:o,base:n=a.documentUrl||t});const s=await this.resolve({activeCtx:e,context:o,documentLoader:r,base:n,cycles:i});return this._cacheResolvedContext({key:t,resolved:s,tag:a.tag}),s}async _fetchContext({activeCtx:e,url:t,documentLoader:r,cycles:n}){if(n.size>10)throw new fu("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"loading remote context failed":"context overflow",max:10});if(n.has(t))throw new fu("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"recursive context inclusion":"context overflow",url:t});let i,o;n.add(t);try{o=await r(t),i=o.document||null,cu(i)&&(i=JSON.parse(i));}catch(e){throw new fu("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:t,cause:e})}if(!uu(i))throw new fu("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:t});return i="@context"in i?{"@context":i["@context"]}:{"@context":{}},o.contextUrl&&(lu(i["@context"])||(i["@context"]=[i["@context"]]),i["@context"].push(o.contextUrl)),{context:i,remoteDoc:o}}},mh=fh.IdentifierIssuer,yh=tl,gh=au,vh=gu,{expand:wh}=pc,{flatten:bh}=Dc,{fromRDF:_h}=Jc,{toRDF:Eh}=yd,{frameMergedOrDefault:Th,cleanupNull:xh}=kd,{isArray:Ih,isObject:Sh,isString:Rh}=Zs,{isSubjectReference:kh}=el,{expandIri:jh,getInitialContext:Dh,process:Nh,processingMode:Oh}=Uu,{compact:Ch,compactIri:Ah}=uh,{createNodeMap:Mh,createMergedNodeMap:Lh,mergeNodeMaps:Ph}=Sc,{logEventHandler:Bh,logWarningEventHandler:$h,safeEventHandler:Fh,setDefaultEventHandler:Uh,setupEventHandler:qh,strictEventHandler:Yh,unhandledEventHandler:Wh}=Eu,zh=function(e){const t={},r=new gh({max:100});function n(t,{documentLoader:r=e.documentLoader,...n}){if(t&&"compactionMap"in t)throw new yh('"compactionMap" not supported.',"jsonld.OptionsError");if(t&&"expansionMap"in t)throw new yh('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:r},n,t,{eventHandler:qh({options:t})})}return e.compact=async function(t,i,o){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===i)throw new yh("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let a;(o=n(o,{base:Rh(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new mh("_:b"),contextResolver:new ph({sharedCache:r})})).link&&(o.skipExpansion=!0),o.compactToRelative||delete o.base,a=o.skipExpansion?t:await e.expand(t,o);const s=await e.processContext(Dh(o),i,o);let l=await Ch({activeCtx:s,element:a,options:o});o.compactArrays&&!o.graph&&Ih(l)?1===l.length?l=l[0]:0===l.length&&(l={}):o.graph&&Sh(l)&&(l=[l]),Sh(i)&&"@context"in i&&(i=i["@context"]),i=fh.clone(i),Ih(i)||(i=[i]);const u=i;i=[];for(let e=0;e<u.length;++e)(!Sh(u[e])||Object.keys(u[e]).length>0)&&i.push(u[e]);const c=i.length>0;if(1===i.length&&(i=i[0]),Ih(l)){const e=Ah({activeCtx:s,iri:"@graph",relativeTo:{vocab:!0}}),t=l;l={},c&&(l["@context"]=i),l[e]=t;}else if(Sh(l)&&c){const e=l;l={"@context":i};for(const t in e)l[t]=e[t];}return l},e.expand=async function(t,i){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");const o={},a=[];if("expandContext"in(i=n(i,{keepFreeFloatingNodes:!1,contextResolver:new ph({sharedCache:r})}))){const e=fh.clone(i.expandContext);Sh(e)&&"@context"in e?o.expandContext=e:o.expandContext={"@context":e},a.push(o.expandContext);}let s;if(Rh(t)){const r=await e.get(t,i);s=r.documentUrl,o.input=r.document,r.contextUrl&&(o.remoteContext={"@context":r.contextUrl},a.push(o.remoteContext));}else o.input=fh.clone(t);"base"in i||(i.base=s||"");let l=Dh(i);for(const e of a)l=await Nh({activeCtx:l,localCtx:e,options:i});let u=await wh({activeCtx:l,element:o.input,options:i});return Sh(u)&&"@graph"in u&&1===Object.keys(u).length?u=u["@graph"]:null===u&&(u=[]),Ih(u)||(u=[u]),u},e.flatten=async function(t,i,o){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");i="function"==typeof i?null:i||null,o=n(o,{base:Rh(t)?t:"",contextResolver:new ph({sharedCache:r})});const a=await e.expand(t,o),s=bh(a);if(null===i)return s;o.graph=!0,o.skipExpansion=!0;return await e.compact(s,i,o)},e.frame=async function(t,i,o){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(o=n(o,{base:Rh(t)?t:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new ph({sharedCache:r})}),Rh(i)){const t=await e.get(i,o);if(i=t.document,t.contextUrl){let e=i["@context"];e?Ih(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,i["@context"]=e;}}const a=i&&i["@context"]||{},s=await e.processContext(Dh(o),a,o);o.hasOwnProperty("omitGraph")||(o.omitGraph=Oh(s,1.1)),o.hasOwnProperty("pruneBlankNodeIdentifiers")||(o.pruneBlankNodeIdentifiers=Oh(s,1.1));const l=await e.expand(t,o),u={...o};u.isFrame=!0,u.keepFreeFloatingNodes=!0;const c=await e.expand(i,u),d=Object.keys(i).map((e=>jh(s,e,{vocab:!0})));u.merged=!d.includes("@graph"),u.is11=Oh(s,1.1);const h=Th(l,c,u);u.graph=!o.omitGraph,u.skipExpansion=!0,u.link={},u.framing=!0;let f=await e.compact(h,a,u);return u.link={},f=xh(f,u),f},e.link=async function(t,r,n){const i={};return r&&(i["@context"]=r),i["@embed"]="@link",e.frame(t,i,n)},e.normalize=e.canonize=async function(t,i){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(i=n(i,{base:Rh(t)?t:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new ph({sharedCache:r})}))){if("application/n-quads"!==i.inputFormat&&"application/nquads"!==i.inputFormat)throw new yh("Unknown canonicalization input format.","jsonld.CanonizeError");const e=vh.parse(t);return dh.canonize(e,i)}const o={...i};delete o.format,o.produceGeneralizedRdf=!1;const a=await e.toRDF(t,o);return dh.canonize(a,i)},e.fromRDF=async function(e,r){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");r=n(r,{format:Rh(e)?"application/n-quads":void 0});const{format:i}=r;let{rdfParser:o}=r;if(i){if(o=o||t[i],!o)throw new yh("Unknown input format.","jsonld.UnknownFormat",{format:i})}else o=()=>e;const a=await o(e);return _h(a,r)},e.toRDF=async function(t,i){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let o;o=(i=n(i,{base:Rh(t)?t:"",skipExpansion:!1,contextResolver:new ph({sharedCache:r})})).skipExpansion?t:await e.expand(t,i);const a=Eh(o,i);if(i.format){if("application/n-quads"===i.format||"application/nquads"===i.format)return vh.serialize(a);throw new yh("Unknown output format.","jsonld.UnknownFormat",{format:i.format})}return a},e.createNodeMap=async function(t,i){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");i=n(i,{base:Rh(t)?t:"",contextResolver:new ph({sharedCache:r})});const o=await e.expand(t,i);return Lh(o,i)},e.merge=async function(t,i,o){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!Ih(t))throw new TypeError('Could not merge, "docs" must be an array.');i="function"==typeof i?null:i||null,o=n(o,{contextResolver:new ph({sharedCache:r})});const a=await Promise.all(t.map((t=>{const r={...o};return e.expand(t,r)})));let s=!0;"mergeNodes"in o&&(s=o.mergeNodes);const l=o.issuer||new mh("_:b"),u={"@default":{}};for(let e=0;e<a.length;++e){const t=fh.relabelBlankNodes(a[e],{issuer:new mh("_:b"+e+"-")}),r=s||0===e?u:{"@default":{}};if(Mh(t,r,"@default",l),r!==u)for(const e in r){const t=r[e];if(!(e in u)){u[e]=t;continue}const n=u[e];for(const e in t)e in n||(n[e]=t[e]);}}const c=Ph(u),d=[],h=Object.keys(c).sort();for(let e=0;e<h.length;++e){const t=c[h[e]];kh(t)||d.push(t);}if(null===i)return d;o.graph=!0,o.skipExpansion=!0;return await e.compact(d,i,o)},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new yh("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:e})},e.get=async function(t,r){let n;n="function"==typeof r.documentLoader?r.documentLoader:e.documentLoader;const i=await n(t);try{if(!i.document)throw new yh("No remote document found at the given URL.","jsonld.NullRemoteDocument");Rh(i.document)&&(i.document=JSON.parse(i.document));}catch(e){throw new yh("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,i){return i=n(i,{base:"",contextResolver:new ph({sharedCache:r})}),null===t?Dh(i):(t=fh.clone(t),Sh(t)&&"@context"in t||(t={"@context":t}),Nh({activeCtx:e,localCtx:t,options:i}))},e.getContextValue=Uu.getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new yh('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",vh.parse),e.registerRDFParser("application/nquads",vh.parse),e.url=El,e.logEventHandler=Bh,e.logWarningEventHandler=$h,e.safeEventHandler=Fh,e.setDefaultEventHandler=Uh,e.strictEventHandler=Yh,e.unhandledEventHandler=Wh,e.util=fh,Object.assign(e,fh),e.promises=e,e.RequestQueue=wl(),e.JsonLdProcessor=(lh||(lh=1,sh=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}),sh)(e),hh.setupGlobals(e),hh.setupDocumentLoaders(e),e},Gh=function(){return zh((function(){return Gh()}))};zh(Gh);var Hh=Gh;function Jh(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Vh={exports:{}};Vh.exports=function(){function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){if(!s&&Jh)return Jh(a);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[a]={exports:{}};t[a][0].call(u.exports,(function(e){return i(t[a][1][e]||e)}),u,u.exports,e,t,r,n);}return r[a].exports}for(var o=Jh,a=0;a<n.length;a++)i(n[a]);return i}return e}()({1:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;const n="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i="http://www.w3.org/2001/XMLSchema#",o="http://www.w3.org/2000/10/swap/";r.default={xsd:{decimal:`${i}decimal`,boolean:`${i}boolean`,double:`${i}double`,integer:`${i}integer`,string:`${i}string`},rdf:{type:`${n}type`,nil:`${n}nil`,first:`${n}first`,rest:`${n}rest`,langString:`${n}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${o}reify#forSome`,forAll:`${o}reify#forAll`},log:{implies:`${o}log#implies`}};},{}],2:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.Variable=r.Triple=r.Term=r.Quad=r.NamedNode=r.Literal=r.DefaultGraph=r.BlankNode=void 0,r.escapeQuotes=b,r.termFromId=g,r.termToId=v,r.unescapeQuotes=_;var n=i(e("./IRIs"));function i(e){return e&&e.__esModule?e:{default:e}}const{rdf:o,xsd:a}=n.default;let s,l=0;const u=/^"(.*".*)(?="[^"]*$)/,c={namedNode:E,blankNode:T,variable:I,literal:x,defaultGraph:S,quad:R,triple:R};r.default=c;class d{constructor(e){this.id=e;}get value(){return this.id}equals(e){return e instanceof d?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return {termType:this.termType,value:this.value}}}r.Term=d;class h extends d{get termType(){return "NamedNode"}}r.NamedNode=h;class f extends d{get termType(){return "Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&"@"===e[t++]?e.substr(t).toLowerCase():""}get datatype(){return new h(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,r=t<e.length?e[t]:"";return "^"===r?e.substr(t+2):"@"!==r?a.string:o.langString}equals(e){return e instanceof f?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return {termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}}r.Literal=f;class p extends d{constructor(e){super(`_:${e}`);}get termType(){return "BlankNode"}get value(){return this.id.substr(2)}}r.BlankNode=p;class m extends d{constructor(e){super(`?${e}`);}get termType(){return "Variable"}get value(){return this.id.substr(1)}}r.Variable=m;class y extends d{constructor(){return super(""),s||this}get termType(){return "DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}}function g(e,t,r){if(t=t||c,!e)return t.defaultGraph();switch(e[0]){case"?":return t.variable(e.substr(1));case"_":return t.blankNode(e.substr(2));case'"':if(t===c)return new f(e);if('"'===e[e.length-1])return t.literal(e.substr(1,e.length-2));const n=e.lastIndexOf('"',e.length-1);return t.literal(e.substr(1,n-1),"@"===e[n+1]?e.substr(n+2):t.namedNode(e.substr(n+3)));case"[":e=JSON.parse(e);break;default:if(!r||!Array.isArray(e))return t.namedNode(e)}return t.quad(g(e[0],t,!0),g(e[1],t,!0),g(e[2],t,!0),e[3]&&g(e[3],t,!0))}function v(e,t){if("string"==typeof e)return e;if(e instanceof d&&"Quad"!==e.termType)return e.id;if(!e)return s.id;switch(e.termType){case"NamedNode":return e.value;case"BlankNode":return `_:${e.value}`;case"Variable":return `?${e.value}`;case"DefaultGraph":return "";case"Literal":return `"${e.value}"${e.language?`@${e.language}`:e.datatype&&e.datatype.value!==a.string?`^^${e.datatype.value}`:""}`;case"Quad":const r=[v(e.subject,!0),v(e.predicate,!0),v(e.object,!0)];return e.graph&&"DefaultGraph"!==e.graph.termType&&r.push(v(e.graph,!0)),t?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${e.termType}`)}}r.DefaultGraph=y,s=new y;class w extends d{constructor(e,t,r,n){super(""),this._subject=e,this._predicate=t,this._object=r,this._graph=n||s;}get termType(){return "Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return {termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(e){return !!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}}function b(e){return e.replace(u,((e,t)=>`"${t.replace(/"/g,'""')}`))}function _(e){return e.replace(u,((e,t)=>`"${t.replace(/""/g,'"')}`))}function E(e){return new h(e)}function T(e){return new p(e||"n3-"+l++)}function x(e,t){if("string"==typeof t)return new f(`"${e}"@${t.toLowerCase()}`);let r=t?t.value:"";return ""===r&&("boolean"==typeof e?r=a.boolean:"number"==typeof e&&(Number.isFinite(e)?r=Number.isInteger(e)?a.integer:a.double:(r=a.double,Number.isNaN(e)||(e=e>0?"INF":"-INF")))),""===r||r===a.string?new f(`"${e}"`):new f(`"${e}"^^${r}`)}function I(e){return new m(e)}function S(){return s}function R(e,t,r,n){return new w(e,t,r,n)}r.Triple=r.Quad=w;},{"./IRIs":1}],3:[function(e,t,r){(function(t){(function(){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=o(e("queue-microtask")),i=o(e("./IRIs"));function o(e){return e&&e.__esModule?e:{default:e}}const{xsd:a}=i.default,s=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,l={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},u=/[\x00-\x20<>\\"\{\}\|\^\`]/,c={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},d=/$0^/;class h{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const e in this)!(e in c)&&this[e]instanceof RegExp&&(this[e]=d);}else this._n3Mode=!1!==e.n3;this._comments=!!e.comments,this._literalClosingPos=0;}_tokenizeToEnd(e,t){let r=this._input,n=r.length;for(;;){let e,s;for(;e=this._newline.exec(r);)this._comments&&(s=this._comment.exec(e[0]))&&i("comment",s[1],"",this._line,e[0].length),r=r.substr(e[0].length,r.length),n=r.length,this._line++;if(!e&&(e=this._whitespace.exec(r))&&(r=r.substr(e[0].length,r.length)),this._endOfFile.test(r))return t&&(this._comments&&(s=this._comment.exec(r))&&i("comment",s[1],"",this._line,r.length),r=null,i("eof","","",this._line,0)),this._input=r;const l=this._line,c=r[0];let d="",h="",f="",p=null,m=0,y=!1;switch(c){case"^":if(r.length<3)break;if("^"!==r[1]){this._n3Mode&&(m=1,d="^");break}if(this._previousMarker="^^",r=r.substr(2),"<"!==r[0]){y=!0;break}case"<":if(p=this._unescapedIri.exec(r))d="IRI",h=p[1];else if(p=this._iri.exec(r)){if(h=this._unescape(p[1]),null===h||u.test(h))return o(this);d="IRI";}else r.length>1&&"<"===r[1]?(d="<<",m=2):this._n3Mode&&r.length>1&&"="===r[1]&&(d="inverse",m=2,h=">");break;case">":r.length>1&&">"===r[1]&&(d=">>",m=2);break;case"_":((p=this._blank.exec(r))||t&&(p=this._blank.exec(`${r} `)))&&(d="blank",f="_",h=p[1]);break;case'"':if(p=this._simpleQuotedString.exec(r))h=p[1];else if(({value:h,matchLength:m}=this._parseLiteral(r)),null===h)return o(this);null===p&&0===m||(d="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(p=this._simpleApostropheString.exec(r))h=p[1];else if(({value:h,matchLength:m}=this._parseLiteral(r)),null===h)return o(this);null===p&&0===m||(d="literal",this._literalClosingPos=0);}break;case"?":this._n3Mode&&(p=this._variable.exec(r))&&(d="var",h=p[0]);break;case"@":"literal"===this._previousMarker&&(p=this._langcode.exec(r))?(d="langcode",h=p[1]):(p=this._keyword.exec(r))&&(d=p[0]);break;case".":if(1===r.length?t:r[1]<"0"||r[1]>"9"){d=".",m=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(p=this._number.exec(r)||t&&(p=this._number.exec(`${r} `)))&&(d="literal",h=p[0],f="string"==typeof p[1]?a.double:"string"==typeof p[2]?a.decimal:a.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(p=this._sparqlKeyword.exec(r))?d=p[0].toUpperCase():y=!0;break;case"f":case"t":(p=this._boolean.exec(r))?(d="literal",h=p[0],f=a.boolean):y=!0;break;case"a":(p=this._shortPredicates.exec(r))?(d="abbreviation",h="a"):y=!0;break;case"=":this._n3Mode&&r.length>1&&(d="abbreviation",">"!==r[1]?(m=1,h="="):(m=2,h=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(m=1,d=c);break;case"{":!this._lineMode&&r.length>=2&&("|"===r[1]?(d="{|",m=2):(d=c,m=1));break;case"|":r.length>=2&&"}"===r[1]&&(d="|}",m=2);break;default:y=!0;}if(y&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(p=this._prefix.exec(r))?((p=this._prefixed.exec(r))||t&&(p=this._prefixed.exec(`${r} `)))&&(d="prefixed",f=p[1]||"",h=this._unescape(p[2])):(d="prefix",h=p[1]||"")),"^^"===this._previousMarker)switch(d){case"prefixed":d="type";break;case"IRI":d="typeIRI";break;default:d="";}if(!d)return t||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?o(this):this._input=r;const g=m||p[0].length,v=i(d,h,f,l,g);this.previousToken=v,this._previousMarker=d,r=r.substr(g,r.length);}function i(t,i,o,a,s){const l=r?n-r.length:n,u={type:t,value:i,prefix:o,line:a,start:l,end:l+s};return e(null,u),u}function o(t){e(t._syntaxError(/^\S*/.exec(r)[0]));}}_unescape(e){let t=!1;const r=e.replace(s,((e,r,n,i)=>{if("string"==typeof r)return String.fromCharCode(Number.parseInt(r,16));if("string"==typeof n){let e=Number.parseInt(n,16);return e<=65535?String.fromCharCode(Number.parseInt(n,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e))}return i in l?l[i]:(t=!0,"")}));return t?null:r}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],r=t.length;let n=Math.max(this._literalClosingPos,r);for(;(n=e.indexOf(t,n))>0;){let t=0;for(;"\\"===e[n-t-1];)t++;if(t%2==0){const t=e.substring(r,n),i=t.split(/\r\n|\r|\n/).length-1,o=n+r;if(1===r&&0!==i||3===r&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:o}}n++;}this._literalClosingPos=e.length-r+1;}return {value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\ufeff")?e.substr(1):e}tokenize(e,r){if(this._line=1,"string"==typeof e){if(this._input=this._readStartingBom(e),"function"!=typeof r){const e=[];let t;if(this._tokenizeToEnd(((r,n)=>r?t=r:e.push(n)),!0),t)throw t;return e}(0, n.default)((()=>this._tokenizeToEnd(r,!0)));}else this._pendingBuffer=null,"function"==typeof e.setEncoding&&e.setEncoding("utf8"),e.on("data",(e=>{null!==this._input&&0!==e.length&&(this._pendingBuffer&&(e=t.concat([this._pendingBuffer,e]),this._pendingBuffer=null),128&e[e.length-1]?this._pendingBuffer=e:(void 0===this._input?this._input=this._readStartingBom("string"==typeof e?e:e.toString()):this._input+=e,this._tokenizeToEnd(r,!1)));})),e.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(r,!0);})),e.on("error",r);}}r.default=h;}).call(this);}).call(this,e("buffer").Buffer);},{"./IRIs":1,buffer:15,"queue-microtask":19}],4:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=a(e("./N3Lexer")),i=a(e("./N3DataFactory")),o=a(e("./IRIs"));function a(e){return e&&e.__esModule?e:{default:e}}let s=0;class l{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&c(this,e.factory);const t="string"==typeof e.format?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(t),i=/trig/.test(t),o=/triple/.test(t),a=/quad/.test(t),s=this._n3Mode=/n3/.test(t),l=o||a;(this._supportsNamedGraphs=!(r||s))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||i||o||s),this._supportsRDFStar=""===t||/star|\*$/.test(t),l&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix="string"!=typeof e.blankNodePrefix?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new n.default({lineMode:l,n3:s}),this._explicitQuantifiers=!!e.explicitQuantifiers;}static _resetBlankNodePrefix(){s=0;}_setBase(e){if(e){const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1];}else this._base="",this._basePath="";}_saveContext(e,t,r,n,i){const o=this._n3Mode;this._contextStack.push({type:e,subject:r,predicate:n,object:i,graph:t,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified));}_restoreContext(e,t){const r=this._contextStack.pop();if(!r||r.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified);}_readInTopContext(e){switch(e.type){case"eof":return null!==this._graph?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let r;switch(e.type){case"IRI":case"typeIRI":const t=this._resolveIRI(e.value);if(null===t)return this._error("Invalid IRI",e);r=this._namedNode(t);break;case"type":case"prefixed":const n=this._prefixes[e.prefix];if(void 0===n)return this._error(`Undefined prefix "${e.prefix}:"`,e);r=this._namedNode(n+e.value);break;case"blank":r=this._blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return !t&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(0===e.prefix.length)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._literal(e.value,this._namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._subject=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${t}`,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if(void 0===(this._predicate=this._readEntity(e)))return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(0===e.prefix.length)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._literal(e.value,this._namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._object=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return "{"===e.type?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return "{"!==e.type?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return "]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=null===this._predicate;return this._restoreContext("blank",e),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,r=null,n=this._readListItem;const i=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,r=this._blankNode(),this.RDF_FIRST,this._subject=t=this._blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;r=this.RDF_NIL;break;case"literal":0===e.prefix.length?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(t=this._literal(e.value,this._namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(t=this._readEntity(e)))return}if(null===r&&(this._subject=r=this._blankNode()),null===i?null===a.predicate?a.subject=r:a.object=r:this._emit(i,this.RDF_REST,r,this._graph),null!==t){if(this._n3Mode&&("IRI"===e.type||"prefixed"===e.type))return this._saveContext("item",this._graph,r,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,t,this._graph);}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const r=this._readEntity(e);if(void 0===r)return;t=this._literal(this._literalValue,r),e=null;break;case"langcode":t=this._literal(this._literalValue,e.value),e=null;}return {token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const r=this._completeLiteral(e);if(r)return this._object=r.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===r.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.token))}_readFormulaTail(e){return "}"!==e.type?this._readPunctuation(e):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,r=this._graph;const n=this._subject,i=this._inversePredicate;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF* syntax",e);const o=this._predicate,a=this._object;this._subject=this._quad(n,o,a,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(r=this._readEntity(e))){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(null!==n){const e=this._predicate,t=this._object;i?this._emit(t,e,n,r):this._emit(n,e,t,r);}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return "."!==e.type?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return "prefix"!==e.type?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if("IRI"!==e.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t="IRI"===e.type&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return "]"!==e.type?this._error("Invalid graph label",e):(this._subject=this._blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):"."!==e.type?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if(void 0!==(t=this._readEntity(e,!0)))break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return ","===e.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const t=this._contextStack,r=t.length&&t[t.length-1];if(r&&"item"===r.type){const t=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,t,this._graph);}return this._afterPath(e)}}_readForwardPath(e){let t,r;const n=this._blankNode();if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(t=this._subject,this._subject=n):(t=this._object,this._object=n),this._emit(t,r,n,this._graph),this._readPath}_readBackwardPath(e){const t=this._blankNode();let r,n;if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(n=this._subject,this._subject=t):(n=this._object,this._object=t),this._emit(t,r,n,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return ">>"!==e.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(e))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(">>"!==e.type)return this._error(`Expected >> but got ${e.type}`,e);const t=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),null===this._subject?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,r,n){this._callback(null,this._quad(e,t,r,n||this.DEFAULTGRAPH));}_error(e,t){const r=new Error(`${e} on line ${t.line}.`);r.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=u;}_resolveIRI(e){return /^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return ("/"===e[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return /^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let r="",n=-1,i=-1,o=0,a="/";for(;n<t;){switch(a){case":":if(i<0&&"/"===e[++n]&&"/"===e[++n])for(;(i=n+1)<t&&"/"!==e[i];)n=i;break;case"?":case"#":n=t;break;case"/":if("."===e[n+1])switch(a=e[1+ ++n],a){case"/":r+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return r+e.substring(o,n)+e.substr(n+1);case".":if(a=e[1+ ++n],void 0===a||"/"===a||"?"===a||"#"===a){if(r+=e.substring(o,n-2),(o=r.lastIndexOf("/"))>=i&&(r=r.substr(0,o)),"/"!==a)return `${r}/${e.substr(n+1)}`;o=n+1;}}}a=e[++n];}return r+e.substring(o)}parse(e,t,r){if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${s++}_`,this._prefixCallback=r||u,this._inversePredicate=!1,this._quantified=Object.create(null),!t){const t=[];let r;if(this._callback=(e,n)=>{e?r=e:n&&t.push(n);},this._lexer.tokenize(e).every((e=>this._readCallback=this._readCallback(e))),r)throw r;return t}this._callback=t,this._lexer.tokenize(e,((e,t)=>{null!==e?(this._callback(e),this._callback=u):this._readCallback&&(this._readCallback=this._readCallback(t));}));}}function u(){}function c(e,t){const r=t.namedNode;e._namedNode=r,e._blankNode=t.blankNode,e._literal=t.literal,e._variable=t.variable,e._quad=t.quad,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=r(o.default.rdf.first),e.RDF_REST=r(o.default.rdf.rest),e.RDF_NIL=r(o.default.rdf.nil),e.N3_FORALL=r(o.default.r.forAll),e.N3_FORSOME=r(o.default.r.forSome),e.ABBREVIATIONS={a:r(o.default.rdf.type),"=":r(o.default.owl.sameAs),">":r(o.default.log.implies)},e.QUANTIFIERS_GRAPH=r("urn:n3:quantifiers");}r.default=l,c(l.prototype,i.default);},{"./IRIs":1,"./N3DataFactory":2,"./N3Lexer":3}],5:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=u(e("./N3DataFactory")),o=s(e("./IRIs")),a=e("./N3Util");function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (l=function(e){return e?r:t})(e)}function u(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=l(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}class c{constructor(e,t){this._size=0,this._graphs=Object.create(null),this._id=0,this._ids=Object.create(null),this._entities=Object.create(null),this._blankNodeIndex=0,t||!e||e[0]||(t=e,e=null),t=t||{},this._factory=t.factory||i.default,e&&this.addQuads(e);}_termFromId(e,t){if("."===e[0]){const t=this._entities,r=e.split(".");return this._factory.quad(this._termFromId(t[r[1]]),this._termFromId(t[r[2]]),this._termFromId(t[r[3]]),r[4]&&this._termFromId(t[r[4]]))}return (0, i.termFromId)(e,t)}_termToNumericId(e){if("Quad"===e.termType){const t=this._termToNumericId(e.subject),r=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let i;return t&&r&&n&&((0, a.isDefaultGraph)(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${r}.${n}.${i}`:`.${t}.${r}.${n}`]}return this._ids[(0, i.termToId)(e)]}_termToNewNumericId(e){const t=e&&"Quad"===e.termType?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${(0, a.isDefaultGraph)(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:(0, i.termToId)(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}get size(){let e=this._size;if(null!==e)return e;e=0;const t=this._graphs;let r,n;for(const i in t)for(const o in r=t[i].subjects)for(const t in n=r[o])e+=Object.keys(n[t]).length;return this._size=e}_addToIndex(e,t,r,n){const i=e[t]||(e[t]={}),o=i[r]||(i[r]={}),a=n in o;return a||(o[n]=null),!a}_removeFromIndex(e,t,r,n){const i=e[t],o=i[r];delete o[n];for(const e in o)return;delete i[r];for(const e in i)return;delete e[t];}*_findInIndex(e,t,r,n,i,o,a,s){let l,u,c;const d=this._entities,h=this._termFromId(s,this._factory),f={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const t in e)if(u=e[t]){f[i]=this._termFromId(d[t],this._factory),r&&((l=u,u={})[r]=l[r]);for(const e in u)if(c=u[e]){f[o]=this._termFromId(d[e],this._factory);const t=n?n in c?[n]:[]:Object.keys(c);for(let e=0;e<t.length;e++)f[a]=this._termFromId(d[t[e]],this._factory),yield this._factory.quad(f.subject,f.predicate,f.object,h);}}}_loop(e,t){for(const r in e)t(r);}_loopByKey0(e,t,r){let n,i;if(n=e[t])for(i in n)r(i);}_loopByKey1(e,t,r){let n,i;for(n in e)i=e[n],i[t]&&r(n);}_loopBy2Keys(e,t,r,n){let i,o,a;if((i=e[t])&&(o=i[r]))for(a in o)n(a);}_countInIndex(e,t,r,n){let i,o,a,s=0;t&&((i=e,e={})[t]=i[t]);for(const t in e)if(o=e[t]){r&&((i=o,o={})[r]=i[r]);for(const e in o)(a=o[e])&&(n?n in a&&s++:s+=Object.keys(a).length);}return s}_getGraphs(e){if(!d(e))return this._graphs;const t={};return t[e]=this._graphs[e],t}_uniqueEntities(e){const t=Object.create(null);return r=>{r in t||(t[r]=!0,e(this._termFromId(this._entities[r],this._factory)));}}add(e){return this.addQuad(e),this}addQuad(e,t,r,n){t||(n=e.graph,r=e.object,t=e.predicate,e=e.subject),n=(0, i.termToId)(n);let o=this._graphs[n];o||(o=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(o)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),r=this._termToNewNumericId(r);const a=this._addToIndex(o.subjects,e,t,r);return this._addToIndex(o.predicates,t,r,e),this._addToIndex(o.objects,r,e,t),this._size=null,a}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t]);}delete(e){return this.removeQuad(e),this}has(e,t,r,n){return e&&e.subject&&({subject:e,predicate:t,object:r,graph:n}=e),!this.readQuads(e,t,r,n).next().done}importStream(e){return e.on("data",(e=>{this.addQuad(e);})),e}removeQuad(e,t,r,n){t||(n=e.graph,r=e.object,t=e.predicate,e=e.subject),n=(0, i.termToId)(n);const o=this._graphs;let a,s,l;if(!((e=e&&this._termToNumericId(e))&&(t=t&&this._termToNumericId(t))&&(r=r&&this._termToNumericId(r))&&(a=o[n])&&(s=a.subjects[e])&&(l=s[t])&&r in l))return !1;for(e in this._removeFromIndex(a.subjects,e,t,r),this._removeFromIndex(a.predicates,t,r,e),this._removeFromIndex(a.objects,r,e,t),null!==this._size&&this._size--,a.subjects)return !0;return delete o[n],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t]);}remove(e){return e.on("data",(e=>{this.removeQuad(e);})),e}removeMatches(e,t,r,i){const o=new n.Readable({objectMode:!0});return o._read=()=>{for(const n of this.readQuads(e,t,r,i))o.push(n);o.push(null);},this.remove(o)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,r,n){return [...this.readQuads(e,t,r,n)]}*readQuads(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l,u;if(!(e&&!(s=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||r&&!(u=this._termToNumericId(r))))for(const e in o)(a=o[e])&&(s?u?yield*this._findInIndex(a.objects,u,s,l,"object","subject","predicate",e):yield*this._findInIndex(a.subjects,s,l,null,"subject","predicate","object",e):l?yield*this._findInIndex(a.predicates,l,u,null,"predicate","object","subject",e):u?yield*this._findInIndex(a.objects,u,null,null,"object","subject","predicate",e):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",e));}match(e,t,r,n){return new h(this,e,t,r,n)}countQuads(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l,u,c=0;if(e&&!(s=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||r&&!(u=this._termToNumericId(r)))return 0;for(const n in o)(a=o[n])&&(c+=e?r?this._countInIndex(a.objects,u,s,l):this._countInIndex(a.subjects,s,l,u):t?this._countInIndex(a.predicates,l,u,s):this._countInIndex(a.objects,u,s,l));return c}forEach(e,t,r,n,i){this.some((t=>(e(t),!1)),t,r,n,i);}every(e,t,r,n,i){let o=!1;const a=!this.some((t=>(o=!0,!e(t))),t,r,n,i);return o&&a}some(e,t,r,n,i){for(const o of this.readQuads(t,r,n,i))if(e(o))return !0;return !1}getSubjects(e,t,r){const n=[];return this.forSubjects((e=>{n.push(e);}),e,t,r),n}forSubjects(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.predicates,s,l,e):this._loopByKey1(a.subjects,s,e):l?this._loopByKey0(a.objects,l,e):this._loop(a.subjects,e));}getPredicates(e,t,r){const n=[];return this.forPredicates((e=>{n.push(e);}),e,t,r),n}forPredicates(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.objects,l,s,e):this._loopByKey0(a.subjects,s,e):l?this._loopByKey1(a.predicates,l,e):this._loop(a.predicates,e));}getObjects(e,t,r){const n=[];return this.forObjects((e=>{n.push(e);}),e,t,r),n}forObjects(e,t,r,n){n=n&&(0, i.termToId)(n);const o=this._getGraphs(n);let a,s,l;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(n in o)(a=o[n])&&(s?l?this._loopBy2Keys(a.subjects,s,l,e):this._loopByKey1(a.objects,s,e):l?this._loopByKey0(a.predicates,l,e):this._loop(a.objects,e));}getGraphs(e,t,r){const n=[];return this.forGraphs((e=>{n.push(e);}),e,t,r),n}forGraphs(e,t,r,n){for(const i in this._graphs)this.some((t=>(e(t.graph),!0)),t,r,n,i);}createBlankNode(e){let t,r;if(e)for(t=e=`_:${e}`,r=1;this._ids[t];)t=e+r++;else do{t="_:b"+this._blankNodeIndex++;}while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const r={},n=t?()=>!0:(e,t)=>{throw new Error(`${e.value} ${t}`)},i=this.getQuads(null,o.default.rdf.rest,o.default.rdf.nil,null),a=e?[...i]:[];return i.forEach((t=>{const i=[];let s,l,u=!1;const c=t.graph;let d=t.subject;for(;d&&!u;){const e=this.getQuads(null,null,d,null),t=this.getQuads(d,null,null,null);let r,h=null,f=null,p=null;for(let i=0;i<t.length&&!u;i++)r=t[i],r.graph.equals(c)?s?u=n(d,"has non-list arcs out"):r.predicate.value===o.default.rdf.first?h?u=n(d,"has multiple rdf:first arcs"):a.push(h=r):r.predicate.value===o.default.rdf.rest?f?u=n(d,"has multiple rdf:rest arcs"):a.push(f=r):e.length?u=n(d,"can't be subject and object"):(s=r,l="subject"):u=n(d,"not confined to single graph");for(let t=0;t<e.length&&!u;++t)r=e[t],s?u=n(d,"can't have coreferences"):r.predicate.value===o.default.rdf.rest?p?u=n(d,"has incoming rdf:rest arcs"):p=r:(s=r,l="object");h?i.unshift(h.object):u=n(d,"has no list head"),d=p&&p.subject;}u?e=!1:s&&(r[s[l].value]=i);})),e&&this.removeQuads(a),r}*[Symbol.iterator](){yield*this.readQuads();}}function d(e){return "string"==typeof e||e instanceof String}r.default=c;class h extends n.Readable{constructor(e,t,r,n,i){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:r,object:n,graph:i});}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:r,predicate:n,subject:i}=this,o=this._filtered=new c({factory:e._factory});for(const a of e.readQuads(i,n,r,t))o.addQuad(a);}return this._filtered}get size(){return this.filtered.size}_read(){for(const e of this)this.push(e);this.push(null);}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,t,r,n){return new h(this.filtered,e,t,r,n)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph);}}},{"./IRIs":1,"./N3DataFactory":2,"./N3Util":8,"readable-stream":38}],6:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=o(e("./N3Parser"));function o(e){return e&&e.__esModule?e:{default:e}}class a extends n.Transform{constructor(e){let t,r;super({decodeStrings:!0}),this._readableState.objectMode=!0,new i.default(e).parse({on:(e,n)=>{switch(e){case"data":t=n;break;case"end":r=n;}}},((e,t)=>{e&&this.emit("error",e)||t&&this.push(t);}),((e,t)=>{this.emit("prefix",e,t);})),this._transform=(e,r,n)=>{t(e),n();},this._flush=e=>{r(),e();};}importStream(e){return e.on("data",(e=>{this.write(e);})),e.on("end",(()=>{this.end();})),e.on("error",(e=>{this.emit("error",e);})),this}}r.default=a;},{"./N3Parser":4,"readable-stream":38}],7:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=e("readable-stream"),i=o(e("./N3Writer"));function o(e){return e&&e.__esModule?e:{default:e}}class a extends n.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});const t=this._writer=new i.default({write:(e,t,r)=>{this.push(e),r&&r();},end:e=>{this.push(null),e&&e();}},e);this._transform=(e,r,n)=>{t.addQuad(e,n);},this._flush=e=>{t.end(e);};}importStream(e){return e.on("data",(e=>{this.write(e);})),e.on("end",(()=>{this.end();})),e.on("error",(e=>{this.emit("error",e);})),e.on("prefix",((e,t)=>{this._writer.addPrefix(e,t);})),this}}r.default=a;},{"./N3Writer":9,"readable-stream":38}],8:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.inDefaultGraph=c,r.isBlankNode=a,r.isDefaultGraph=u,r.isLiteral=s,r.isNamedNode=o,r.isVariable=l,r.prefix=d,r.prefixes=h;var n=i(e("./N3DataFactory"));function i(e){return e&&e.__esModule?e:{default:e}}function o(e){return !!e&&"NamedNode"===e.termType}function a(e){return !!e&&"BlankNode"===e.termType}function s(e){return !!e&&"Literal"===e.termType}function l(e){return !!e&&"Variable"===e.termType}function u(e){return !!e&&"DefaultGraph"===e.termType}function c(e){return u(e.graph)}function d(e,t){return h({"":e.value||e},t)("")}function h(e,t){const r=Object.create(null);for(const t in e)i(t,e[t]);function i(e,n){if("string"==typeof n){const i=Object.create(null);r[e]=e=>i[e]||(i[e]=t.namedNode(n+e));}else if(!(e in r))throw new Error(`Unknown prefix: ${e}`);return r[e]}return t=t||n.default,i}},{"./N3DataFactory":2}],9:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=l(e("./IRIs")),i=s(e("./N3DataFactory")),o=e("./N3Util");function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (a=function(e){return e?r:t})(e)}function s(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=a(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}function l(e){return e&&e.__esModule?e:{default:e}}const u=i.default.defaultGraph(),{rdf:c,xsd:d}=n.default,h=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,f=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,p={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class m extends i.Term{equals(e){return e===this}}class y{constructor(e,t){if(this._prefixRegex=/$0^/,e&&"function"!=typeof e.write&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=void 0===t.end||!!t.end;else {let e="";this._outputStream={write(t,r,n){e+=t,n&&n();},end:t=>{t&&t(null,e);}},this._endStream=!0;}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=u,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseMatcher=new RegExp(`^${v(t.baseIRI)}${t.baseIRI.endsWith("/")?"":"[#?]"}`),this._baseLength=t.baseIRI.length));}get _inDefaultGraph(){return u.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t);}_writeQuad(e,t,r,n,i){try{n.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(u.equals(n)?"":`${this._encodeIriOrBlank(n)} {\n`)),this._graph=n,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(r)}`,i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i);}catch(e){i&&i(e);}}_writeQuadLine(e,t,r,n,i){delete this._prefixMatch,this._write(this.quadToString(e,t,r,n),i);}quadToString(e,t,r,n){return `${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(r)}${n&&n.value?` ${this._encodeIriOrBlank(n)} .\n`:" .\n"}`}quadsToString(e){return e.map((e=>this.quadToString(e.subject,e.predicate,e.object,e.graph))).join("")}_encodeSubject(e){return "Quad"===e.termType?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if("NamedNode"!==e.termType)return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseMatcher&&this._baseMatcher.test(t)&&(t=t.substr(this._baseLength)),h.test(t)&&(t=t.replace(f,g));const r=this._prefixRegex.exec(t);return r?r[1]?this._prefixIRIs[r[1]]+r[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(h.test(t)&&(t=t.replace(f,g)),e.language)return `"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===d.string)return `"${t}"`}else switch(e.datatype.value){case d.string:return `"${t}"`;case d.boolean:if("true"===t||"false"===t)return t;break;case d.integer:if(/^[+-]?\d+$/.test(t))return t;break;case d.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case d.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t}return `"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===c.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:r,graph:n}){return `<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(r)}${(0, o.isDefaultGraph)(n)?"":` ${this._encodeIriOrBlank(n)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,r,n,i){void 0===r?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):"function"==typeof n?this._writeQuad(e,t,r,u,n):this._writeQuad(e,t,r,n||u,i);}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t]);}addPrefix(e,t,r){const n={};n[e]=t,this.addPrefixes(n,r);}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let r=!1;for(let t in e){let n=e[t];"string"!=typeof n&&(n=n.value),r=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[n]=t+=":",this._write(`@prefix ${t} <${n}>.\n`);}if(r){let e="",t="";for(const r in this._prefixIRIs)e+=e?`|${r}`:r,t+=(t?"|":"")+this._prefixIRIs[r];e=v(e),this._prefixRegex=new RegExp(`^(?:${t})[^/]*$|^(${e})([_a-zA-Z][\\-_a-zA-Z0-9]*)$`);}this._write(r?"\n":"",t);}blank(e,t){let r,n,i=e;switch(void 0===e?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),n=i.length){case 0:return new m("[]");case 1:if(r=i[0],!(r.object instanceof m))return new m(`[ ${this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)} ]`);default:let t="[";for(let o=0;o<n;o++)r=i[o],r.predicate.equals(e)?t+=`, ${this._encodeObject(r.object)}`:(t+=`${(o?";\n ":"\n ")+this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)}`,e=r.predicate);return new m(`${t}\n]`)}}list(e){const t=e&&e.length||0,r=new Array(t);for(let n=0;n<t;n++)r[n]=this._encodeObject(e[n]);return new m(`(${r.join(" ")})`)}end(e){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let t=e&&((r,n)=>{t=null,e(r,n);});if(this._endStream)try{return this._outputStream.end(t)}catch(e){}t&&t();}}function g(e){let t=p[e];return void 0===t&&(1===e.length?(t=e.charCodeAt(0).toString(16),t="\\u0000".substr(0,6-t.length)+t):(t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16),t="\\U00000000".substr(0,10-t.length)+t)),t}function v(e){return e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}r.default=y;},{"./IRIs":1,"./N3DataFactory":2,"./N3Util":8}],10:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BlankNode",{enumerable:!0,get:function(){return c.BlankNode}}),Object.defineProperty(r,"DataFactory",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(r,"DefaultGraph",{enumerable:!0,get:function(){return c.DefaultGraph}}),Object.defineProperty(r,"Lexer",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(r,"Literal",{enumerable:!0,get:function(){return c.Literal}}),Object.defineProperty(r,"NamedNode",{enumerable:!0,get:function(){return c.NamedNode}}),Object.defineProperty(r,"Parser",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"Quad",{enumerable:!0,get:function(){return c.Quad}}),Object.defineProperty(r,"Store",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(r,"StreamParser",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"StreamWriter",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(r,"Term",{enumerable:!0,get:function(){return c.Term}}),Object.defineProperty(r,"Triple",{enumerable:!0,get:function(){return c.Triple}}),r.Util=void 0,Object.defineProperty(r,"Variable",{enumerable:!0,get:function(){return c.Variable}}),Object.defineProperty(r,"Writer",{enumerable:!0,get:function(){return o.default}}),r.default=void 0,Object.defineProperty(r,"termFromId",{enumerable:!0,get:function(){return c.termFromId}}),Object.defineProperty(r,"termToId",{enumerable:!0,get:function(){return c.termToId}});var n=f(e("./N3Lexer")),i=f(e("./N3Parser")),o=f(e("./N3Writer")),a=f(e("./N3Store")),s=f(e("./N3StreamParser")),l=f(e("./N3StreamWriter")),u=h(e("./N3Util"));r.Util=u;var c=h(e("./N3DataFactory"));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return (d=function(e){return e?r:t})(e)}function h(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return {default:e};var r=d(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o];}return n.default=e,r&&r.set(e,n),n}function f(e){return e&&e.__esModule?e:{default:e}}r.default={Lexer:n.default,Parser:i.default,Writer:o.default,Store:a.default,StreamParser:s.default,StreamWriter:l.default,Util:u,DataFactory:c.default,Term:c.Term,NamedNode:c.NamedNode,Literal:c.Literal,BlankNode:c.BlankNode,Variable:c.Variable,DefaultGraph:c.DefaultGraph,Quad:c.Quad,Triple:c.Triple,termFromId:c.termFromId,termToId:c.termToId};},{"./N3DataFactory":2,"./N3Lexer":3,"./N3Parser":4,"./N3Store":5,"./N3StreamParser":6,"./N3StreamWriter":7,"./N3Util":8,"./N3Writer":9}],11:[function(e,t,r){const{AbortController:n,AbortSignal:i}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;t.exports=n,t.exports.AbortSignal=i,t.exports.default=n;},{}],12:[function(e,t,r){r.byteLength=c,r.toByteArray=h,r.fromByteArray=m;for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s<l;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return -1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n}function d(e,t,r){return 3*(t+r)/4-r}function h(e){var t,r,n=u(e),a=n[0],s=n[1],l=new o(d(e,a,s)),c=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,l[c++]=255&t),1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l}function f(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function p(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(f(n));return i.join("")}function m(e){for(var t,r=e.length,i=r%3,o=[],a=16383,s=0,l=r-i;s<l;s+=a)o.push(p(e,s,s+a>l?l:s+a));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63;},{}],13:[function(e,t,r){var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r];}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=a),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)};},{buffer:15}],14:[function(e,t,r){var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return !0;default:return !1}};function o(e){if(!e)return "utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return "utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return "utf16le";case"latin1":case"binary":return "latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0;}}function a(e){var t=o(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}function s(e){var t;switch(this.encoding=a(e),this.encoding){case"utf16le":this.text=p,this.end=m,t=4;break;case"utf8":this.fillLast=d,t=4;break;case"base64":this.text=y,this.end=g,t=3;break;default:return this.write=v,void(this.end=w)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t);}function l(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function u(e,t,r){var n=t.length-1;if(n<r)return 0;var i=l(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=l(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=l(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}function c(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,"�"}}function d(e){var t=this.lastTotal-this.lastNeed,r=c(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 h(e,t){var r=u(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)}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function p(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 m(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 y(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 g(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function v(e){return e.toString(this.encoding)}function w(e){return e&&e.length?this.write(e):""}r.StringDecoder=s,s.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||""},s.prototype.end=f,s.prototype.text=h,s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length;};},{"safe-buffer":13}],15:[function(e,t,r){(function(t){(function(){var t=e("base64-js"),n=e("ieee754");r.Buffer=s,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return !1}}function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return h(e,t);if(ArrayBuffer.isView(e))return f(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);var i=m(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e,t,r){return u(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}function d(e){return u(e),a(e<0?0:0|y(e))}function h(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|v(e,t),n=a(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function f(e){for(var t=e.length<0?0:0|y(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function p(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return (n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r)).__proto__=s.prototype,n}function m(e){if(s.isBuffer(e)){var t=0|y(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}function y(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function g(e){return +e!=e&&(e=0),s.alloc(+e)}function v(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return J(e).length;default:if(i)return n?-1:z(e).length;t=(""+t).toLowerCase(),i=!0;}}function w(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 M(this,t,r);case"utf8":case"utf-8":return D(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return A(this,t,r);case"base64":return j(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0;}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n;}function _(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),Z(r=+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=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):E(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,i){var o,a=1,s=e.length,l=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,l/=2,r/=2;}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=r;o<s;o++)if(u(e,o)===u(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*a}else -1!==c&&(o-=o-c),c=-1;}else for(r+l>s&&(r=s-l),o=r;o>=0;o--){for(var d=!0,h=0;h<l;h++)if(u(e,o+h)!==u(t,h)){d=!1;break}if(d)return o}return -1}function T(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;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(Z(s))return a;e[r+a]=s;}return a}function x(e,t,r,n){return V(z(t,e.length-r),e,r,n)}function I(e,t,r,n){return V(G(t),e,r,n)}function S(e,t,r,n){return I(e,t,r,n)}function R(e,t,r,n){return V(J(t),e,r,n)}function k(e,t,r,n){return V(H(t,e.length-r),e,r,n)}function j(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function D(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,a,s,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l);}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d;}return O(n)}r.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=o(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(e,t,r){return c(e,t,r)},s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');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},s.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}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(Q(o,Uint8Array)&&(o=s.from(o)),!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length;}return n},s.byteLength=v,s.prototype._isBuffer=!0,s.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)b(this,t,t+1);return this},s.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)b(this,t,t+3),b(this,t+1,t+2);return this},s.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)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?D(this,0,e):w.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s.prototype.compare=function(e,t,r,n,i){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);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),l=Math.min(o,a),u=this.slice(n,i),c=e.slice(t,r),d=0;d<l;++d)if(u[d]!==c[d]){o=u[d],a=c[d];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return _(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return _(this,e,t,r,!1)},s.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 T(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return I(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return R(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0;}},s.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function O(e){var t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=N));return r}function C(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 A(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 M(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+=W(e[o]);return i}function L(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 P(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 B(e,t,r,n,i,o){if(!s.isBuffer(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 $(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 F(e,t,r,i,o){return t=+t,r>>>=0,o||$(e,t,r,4),n.write(e,t,r,i,23,4),r+4}function U(e,t,r,i,o){return t=+t,r>>>=0,o||$(e,t,r,8),n.write(e,t,r,i,52,8),r+8}s.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=s.prototype,n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||P(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},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||P(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},s.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(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},s.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||B(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},s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);B(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},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);B(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},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");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("Index out of range");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=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var o=i-1;o>=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.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),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i);}}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=s.isBuffer(e)?e:s.from(e,n),l=a.length;if(0===l)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=a[o%l];}return this};var q=/[^+/0-9A-Za-z-_]/g;function Y(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return "";for(;e.length%4!=0;)e+="=";return e}function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(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 G(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function H(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}function J(e){return t.toByteArray(Y(e))}function V(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 Q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}}).call(this);}).call(this,e("buffer").Buffer);},{"base64-js":12,buffer:15,ieee754:17}],16:[function(e,t,r){var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};function a(e){console&&console.warn&&console.warn(e);}n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function l(){l.init.call(this);}t.exports=l,t.exports.once=b,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?l.defaultMaxListeners:e._maxListeners}function h(e,t,r,n){var i,o,s;if(c(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=d(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,a(l);}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function m(e,t,r){var n=e._events;if(void 0===n)return [];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?w(i):g(i,i.length)}function y(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function v(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop();}function w(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function b(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r);}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments));}E(e,t,o,{once:!0}),"error"!==t&&_(e,i,{once:!0});}))}function _(e,t,r){"function"==typeof e.on&&E(e,"error",t,r);}function E(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else {if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o);}));}}Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e;}}),l.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0;},l.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},l.prototype.getMaxListeners=function(){return d(this)},l.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return !1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=i[e];if(void 0===l)return !1;if("function"==typeof l)o(l,this,t);else {var u=l.length,c=g(l,u);for(r=0;r<u;++r)o(c[r],this,t);}return !0},l.prototype.addListener=function(e,t){return h(this,e,t,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(e,t){return h(this,e,t,!0)},l.prototype.once=function(e,t){return c(t),this.on(e,p(this,e,t)),this},l.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,p(this,e,t)),this},l.prototype.removeListener=function(e,t){var r,n,i,o,a;if(c(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():v(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t);}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},l.prototype.listeners=function(e){return m(this,e,!0)},l.prototype.rawListeners=function(e){return m(this,e,!1)},l.listenerCount=function(e,t){return "function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},l.prototype.listenerCount=y,l.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};},{}],17:[function(e,t,r){r.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,d=r?i-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+d],d+=h,c-=8);if(0===o)o=1-u;else {if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=u;}return (f?-1:1)*a*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<<u)-1,d=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,m=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=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*m;};},{}],18:[function(e,t,r){var n,i,o=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}function u(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a;}catch(e){n=a;}try{i="function"==typeof clearTimeout?clearTimeout:s;}catch(e){i=s;}}();var c,d=[],h=!1,f=-1;function p(){h&&c&&(h=!1,c.length?d=c.concat(d):f=-1,d.length&&m());}function m(){if(!h){var e=l(p);h=!0;for(var t=d.length;t;){for(c=d,d=[];++f<t;)c&&c[f].run();f=-1,t=d.length;}c=null,h=!1,u(e);}}function y(e,t){this.fun=e,this.array=t;}function g(){}o.nextTick=function(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];d.push(new y(e,t)),1!==d.length||h||l(m);},y.prototype.run=function(){this.fun.apply(null,this.array);},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return []},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return "/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0};},{}],19:[function(e,t,r){(function(e){(function(){let r;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:e):e=>(r||(r=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)));}).call(this);}).call(this,void 0!==s?s:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});},{}],20:[function(e,t,r){const{AbortError:n,codes:i}=e("../../ours/errors"),{isNodeStream:o,isWebStream:a,kControllerErrorFunction:s}=e("./utils"),l=e("./end-of-stream"),{ERR_INVALID_ARG_TYPE:u}=i,c=(e,t)=>{if("object"!=typeof e||!("aborted"in e))throw new u(t,"AbortSignal",e)};t.exports.addAbortSignal=function(e,r){if(c(e,"signal"),!o(r)&&!a(r))throw new u("stream",["ReadableStream","WritableStream","Stream"],r);return t.exports.addAbortSignalNoValidate(e,r)},t.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const r=o(t)?()=>{t.destroy(new n(void 0,{cause:e.reason}));}:()=>{t[s](new n(void 0,{cause:e.reason}));};return e.aborted?r():(e.addEventListener("abort",r),l(t,(()=>e.removeEventListener("abort",r)))),t};},{"../../ours/errors":39,"./end-of-stream":26,"./utils":35}],21:[function(e,t,r){const{StringPrototypeSlice:n,SymbolIterator:i,TypedArrayPrototypeSet:o,Uint8Array:a}=e("../../ours/primordials"),{Buffer:s}=e("buffer"),{inspect:l}=e("../../ours/util");t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0;}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length;}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length;}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0;}join(e){if(0===this.length)return "";let t=this.head,r=""+t.data;for(;null!==(t=t.next);)r+=e+t.data;return r}concat(e){if(0===this.length)return s.alloc(0);const t=s.allocUnsafe(e>>>0);let r=this.head,n=0;for(;r;)o(t,r.data,n),n+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(e<r.length){const t=r.slice(0,e);return this.head.data=r.slice(e),t}return e===r.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[i](){for(let e=this.head;e;e=e.next)yield e.data;}_getString(e){let t="",r=this.head,i=0;do{const o=r.data;if(!(e>o.length)){e===o.length?(t+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(o,0,e),this.head=r,r.data=n(o,e));break}t+=o,e-=o.length,++i;}while(null!==(r=r.next));return this.length-=i,t}_getBuffer(e){const t=s.allocUnsafe(e),r=e;let n=this.head,i=0;do{const s=n.data;if(!(e>s.length)){e===s.length?(o(t,s,r-e),++i,n.next?this.head=n.next:this.head=this.tail=null):(o(t,new a(s.buffer,s.byteOffset,e),r-e),this.head=n,n.data=s.slice(e));break}o(t,s,r-e),e-=s.length,++i;}while(null!==(n=n.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return l(this,{...t,depth:0,customInspect:!1})}};},{"../../ours/primordials":40,"../../ours/util":41,buffer:15}],22:[function(e,t,r){const{pipeline:n}=e("./pipeline"),i=e("./duplex"),{destroyer:o}=e("./destroy"),{isNodeStream:a,isReadable:s,isWritable:l,isWebStream:u,isTransformStream:c,isWritableStream:d,isReadableStream:h}=e("./utils"),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:m}}=e("../../ours/errors"),y=e("./end-of-stream");t.exports=function(...e){if(0===e.length)throw new m("streams");if(1===e.length)return i.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=i.from(e[t]);}for(let r=0;r<e.length;++r)if(a(e[r])||u(e[r])){if(r<e.length-1&&!(s(e[r])||h(e[r])||c(e[r])))throw new p(`streams[${r}]`,t[r],"must be readable");if(r>0&&!(l(e[r])||d(e[r])||c(e[r])))throw new p(`streams[${r}]`,t[r],"must be writable")}let r,g,v,w,b;function _(e){const t=w;w=null,t?t(e):e?b.destroy(e):I||x||b.destroy();}const E=e[0],T=n(e,_),x=!!(l(E)||d(E)||c(E)),I=!!(s(T)||h(T)||c(T));if(b=new i({writableObjectMode:!(null==E||!E.writableObjectMode),readableObjectMode:!(null==T||!T.writableObjectMode),writable:x,readable:I}),x){if(a(E))b._write=function(e,t,n){E.write(e,t)?n():r=n;},b._final=function(e){E.end(),g=e;},E.on("drain",(function(){if(r){const e=r;r=null,e();}}));else if(u(E)){const e=(c(E)?E.writable:E).getWriter();b._write=async function(t,r,n){try{await e.ready,e.write(t).catch((()=>{})),n();}catch(e){n(e);}},b._final=async function(t){try{await e.ready,e.close().catch((()=>{})),g=t;}catch(e){t(e);}};}const e=c(T)?T.readable:T;y(e,(()=>{if(g){const e=g;g=null,e();}}));}if(I)if(a(T))T.on("readable",(function(){if(v){const e=v;v=null,e();}})),T.on("end",(function(){b.push(null);})),b._read=function(){for(;;){const e=T.read();if(null===e)return void(v=b._read);if(!b.push(e))return}};else if(u(T)){const e=(c(T)?T.readable:T).getReader();b._read=async function(){for(;;)try{const{value:t,done:r}=await e.read();if(!b.push(t))return;if(r)return void b.push(null)}catch{return}};}return b._destroy=function(e,t){e||null===w||(e=new f),v=null,r=null,g=null,null===w?t(e):(w=t,a(T)&&o(T,e));},b};},{"../../ours/errors":39,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./pipeline":31,"./utils":35}],23:[function(e,t,r){const n=e("process/"),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:o},AbortError:a}=e("../../ours/errors"),{Symbol:s}=e("../../ours/primordials"),{kDestroyed:l,isDestroyed:u,isFinished:c,isServerRequest:d}=e("./utils"),h=s("kDestroy"),f=s("kConstruct");function p(e,t,r){e&&(t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e));}function m(e,t){const r=this._readableState,n=this._writableState,o=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(p(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?y(this,e,t):this.once(h,(function(r){y(this,i(r,e),t);})),this)}function y(e,t,r){let i=!1;function o(t){if(i)return;i=!0;const o=e._readableState,a=e._writableState;p(t,a,o),a&&(a.closed=!0),o&&(o.closed=!0),"function"==typeof r&&r(t),t?n.nextTick(g,e,t):n.nextTick(v,e);}try{e._destroy(t||null,o);}catch(t){o(t);}}function g(e,t){w(e,t),v(e);}function v(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=r&&r.emitClose||null!=t&&t.emitClose)&&e.emit("close");}function w(e,t){const r=e._readableState,n=e._writableState;null!=n&&n.errorEmitted||null!=r&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t));}function b(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable);}function _(e,t,r){const i=e._readableState,o=e._writableState;if(null!=o&&o.destroyed||null!=i&&i.destroyed)return this;null!=i&&i.autoDestroy||null!=o&&o.autoDestroy?e.destroy(t):t&&(o&&!o.errored&&(o.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(w,e,t):w(e,t));}function E(e,t){if("function"!=typeof e._construct)return;const r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),e.listenerCount(f)>1||n.nextTick(T,e);}function T(e){let t=!1;function r(r){if(t)return void _(e,null!=r?r:new o);t=!0;const i=e._readableState,a=e._writableState,s=a||i;i&&(i.constructed=!0),a&&(a.constructed=!0),s.destroyed?e.emit(h,r):r?_(e,r,!0):n.nextTick(x,e);}try{e._construct((e=>{n.nextTick(r,e);}));}catch(e){n.nextTick(r,e);}}function x(e){e.emit(f);}function I(e){return (null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function S(e){e.emit("close");}function R(e,t){e.emit("error",t),n.nextTick(S,e);}function k(e,t){e&&!u(e)&&(t||c(e)||(t=new a),d(e)?(e.socket=null,e.destroy(t)):I(e)?e.abort():I(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?n.nextTick(R,e,t):n.nextTick(S,e),e.destroyed||(e[l]=!0));}t.exports={construct:E,destroyer:k,destroy:m,undestroy:b,errorOrDestroy:_};},{"../../ours/errors":39,"../../ours/primordials":40,"./utils":35,"process/":18}],24:[function(e,t,r){const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:o,ObjectSetPrototypeOf:a}=e("../../ours/primordials");t.exports=u;const s=e("./readable"),l=e("./writable");a(u.prototype,s.prototype),a(u,s);{const e=o(l.prototype);for(let t=0;t<e.length;t++){const r=e[t];u.prototype[r]||(u.prototype[r]=l.prototype[r]);}}function u(e){if(!(this instanceof u))return new u(e);s.call(this,e),l.call(this,e),e?(this.allowHalfOpen=!1!==e.allowHalfOpen,!1===e.readable&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===e.writable&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0;}let c,d;function h(){return void 0===c&&(c={}),c}n(u.prototype,{writable:{__proto__:null,...i(l.prototype,"writable")},writableHighWaterMark:{__proto__:null,...i(l.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...i(l.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...i(l.prototype,"writableBuffer")},writableLength:{__proto__:null,...i(l.prototype,"writableLength")},writableFinished:{__proto__:null,...i(l.prototype,"writableFinished")},writableCorked:{__proto__:null,...i(l.prototype,"writableCorked")},writableEnded:{__proto__:null,...i(l.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...i(l.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e);}}}),u.fromWeb=function(e,t){return h().newStreamDuplexFromReadableWritablePair(e,t)},u.toWeb=function(e){return h().newReadableWritablePairFromDuplex(e)},u.from=function(t){return d||(d=e("./duplexify")),d(t,"body")};},{"../../ours/primordials":40,"./duplexify":25,"./readable":32,"./writable":36}],25:[function(e,t,r){const n=e("process/"),i=e("buffer"),{isReadable:o,isWritable:a,isIterable:s,isNodeStream:l,isReadableNodeStream:u,isWritableNodeStream:c,isDuplexNodeStream:d}=e("./utils"),h=e("./end-of-stream"),{AbortError:f,codes:{ERR_INVALID_ARG_TYPE:p,ERR_INVALID_RETURN_VALUE:m}}=e("../../ours/errors"),{destroyer:y}=e("./destroy"),g=e("./duplex"),v=e("./readable"),{createDeferredPromise:w}=e("../../ours/util"),b=e("./from"),_=globalThis.Blob||i.Blob,E=void 0!==_?function(e){return e instanceof _}:function(e){return !1},T=globalThis.AbortController||e("abort-controller").AbortController,{FunctionPrototypeCall:x}=e("../../ours/primordials");class I extends g{constructor(e){super(e),!1===(null==e?void 0:e.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0);}}function S(e){let{promise:t,resolve:r}=w();const i=new T,o=i.signal;return {value:e(async function*(){for(;;){const e=t;t=null;const{chunk:i,done:a,cb:s}=await e;if(n.nextTick(s),a)return;if(o.aborted)throw new f(void 0,{cause:o.reason});(({promise:t,resolve:r}=w())),yield i;}}(),{signal:o}),write(e,t,n){const i=r;r=null,i({chunk:e,done:!1,cb:n});},final(e){const t=r;r=null,t({done:!0,cb:e});},destroy(e,t){i.abort(),t(e);}}}function R(e){const t=e.readable&&"function"!=typeof e.readable.read?v.wrap(e.readable):e.readable,r=e.writable;let n,i,s,l,u,c=!!o(t),d=!!a(r);function p(e){const t=l;l=null,t?t(e):e&&u.destroy(e);}return u=new I({readableObjectMode:!(null==t||!t.readableObjectMode),writableObjectMode:!(null==r||!r.writableObjectMode),readable:c,writable:d}),d&&(h(r,(e=>{d=!1,e&&y(t,e),p(e);})),u._write=function(e,t,i){r.write(e,t)?i():n=i;},u._final=function(e){r.end(),i=e;},r.on("drain",(function(){if(n){const e=n;n=null,e();}})),r.on("finish",(function(){if(i){const e=i;i=null,e();}}))),c&&(h(t,(e=>{c=!1,e&&y(t,e),p(e);})),t.on("readable",(function(){if(s){const e=s;s=null,e();}})),t.on("end",(function(){u.push(null);})),u._read=function(){for(;;){const e=t.read();if(null===e)return void(s=u._read);if(!u.push(e))return}}),u._destroy=function(e,o){e||null===l||(e=new f),s=null,n=null,i=null,null===l?o(e):(l=o,y(r,e),y(t,e));},u}t.exports=function e(t,r){if(d(t))return t;if(u(t))return R({readable:t});if(c(t))return R({writable:t});if(l(t))return R({writable:!1,readable:!1});if("function"==typeof t){const{value:e,write:i,final:o,destroy:a}=S(t);if(s(e))return b(I,e,{objectMode:!0,write:i,final:o,destroy:a});const l=null==e?void 0:e.then;if("function"==typeof l){let t;const r=x(l,e,(e=>{if(null!=e)throw new m("nully","body",e)}),(e=>{y(t,e);}));return t=new I({objectMode:!0,readable:!1,write:i,final(e){o((async()=>{try{await r,n.nextTick(e,null);}catch(t){n.nextTick(e,t);}}));},destroy:a})}throw new m("Iterable, AsyncIterable or AsyncFunction",r,e)}if(E(t))return e(t.arrayBuffer());if(s(t))return b(I,t,{objectMode:!0,writable:!1});if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return R({readable:null!=t&&t.readable?u(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?c(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});const i=null==t?void 0:t.then;if("function"==typeof i){let e;return x(i,t,(t=>{null!=t&&e.push(t),e.push(null);}),(t=>{y(e,t);})),e=new I({objectMode:!0,writable:!1,read(){}})}throw new p(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./from":27,"./readable":32,"./utils":35,"abort-controller":11,buffer:15,"process/":18}],26:[function(e,t,r){const n=e("process/"),{AbortError:i,codes:o}=e("../../ours/errors"),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:s}=o,{kEmptyObject:l,once:u}=e("../../ours/util"),{validateAbortSignal:c,validateFunction:d,validateObject:h,validateBoolean:f}=e("../validators"),{Promise:p,PromisePrototypeThen:m}=e("../../ours/primordials"),{isClosed:y,isReadable:g,isReadableNodeStream:v,isReadableStream:w,isReadableFinished:b,isReadableErrored:_,isWritable:E,isWritableNodeStream:T,isWritableStream:x,isWritableFinished:I,isWritableErrored:S,isNodeStream:R,willEmitClose:k,kIsClosedPromise:j}=e("./utils");function D(e){return e.setHeader&&"function"==typeof e.abort}const N=()=>{};function O(e,t,r){var o,f;if(2===arguments.length?(r=t,t=l):null==t?t=l:h(t,"options"),d(r,"callback"),c(t.signal,"options.signal"),r=u(r),w(e)||x(e))return C(e,t,r);if(!R(e))throw new a("stream",["ReadableStream","WritableStream","Stream"],e);const p=null!==(o=t.readable)&&void 0!==o?o:v(e),m=null!==(f=t.writable)&&void 0!==f?f:T(e),j=e._writableState,O=e._readableState,A=()=>{e.writable||P();};let M=k(e)&&v(e)===p&&T(e)===m,L=I(e,!1);const P=()=>{L=!0,e.destroyed&&(M=!1),(!M||e.readable&&!p)&&(p&&!B||r.call(e));};let B=b(e,!1);const $=()=>{B=!0,e.destroyed&&(M=!1),(!M||e.writable&&!m)&&(m&&!L||r.call(e));},F=t=>{r.call(e,t);};let U=y(e);const q=()=>{U=!0;const t=S(e)||_(e);return t&&"boolean"!=typeof t?r.call(e,t):p&&!B&&v(e,!0)&&!b(e,!1)?r.call(e,new s):!m||L||I(e,!1)?void r.call(e):r.call(e,new s)},Y=()=>{U=!0;const t=S(e)||_(e);if(t&&"boolean"!=typeof t)return r.call(e,t);r.call(e);},W=()=>{e.req.on("finish",P);};D(e)?(e.on("complete",P),M||e.on("abort",q),e.req?W():e.on("request",W)):m&&!j&&(e.on("end",A),e.on("close",A)),M||"boolean"!=typeof e.aborted||e.on("aborted",q),e.on("end",$),e.on("finish",P),!1!==t.error&&e.on("error",F),e.on("close",q),U?n.nextTick(q):null!=j&&j.errorEmitted||null!=O&&O.errorEmitted?M||n.nextTick(Y):(p||M&&!g(e)||!L&&!1!==E(e))&&(m||M&&!E(e)||!B&&!1!==g(e))?O&&e.req&&e.aborted&&n.nextTick(Y):n.nextTick(Y);const z=()=>{r=N,e.removeListener("aborted",q),e.removeListener("complete",P),e.removeListener("abort",q),e.removeListener("request",W),e.req&&e.req.removeListener("finish",P),e.removeListener("end",A),e.removeListener("close",A),e.removeListener("finish",P),e.removeListener("end",$),e.removeListener("error",F),e.removeListener("close",q);};if(t.signal&&!U){const o=()=>{const n=r;z(),n.call(e,new i(void 0,{cause:t.signal.reason}));};if(t.signal.aborted)n.nextTick(o);else {const n=r;r=u(((...r)=>{t.signal.removeEventListener("abort",o),n.apply(e,r);})),t.signal.addEventListener("abort",o);}}return z}function C(e,t,r){let o=!1,a=N;if(t.signal)if(a=()=>{o=!0,r.call(e,new i(void 0,{cause:t.signal.reason}));},t.signal.aborted)n.nextTick(a);else {const n=r;r=u(((...r)=>{t.signal.removeEventListener("abort",a),n.apply(e,r);})),t.signal.addEventListener("abort",a);}const s=(...t)=>{o||n.nextTick((()=>r.apply(e,t)));};return m(e[j].promise,s,s),N}function A(e,t){var r;let n=!1;return null===t&&(t=l),null!==(r=t)&&void 0!==r&&r.cleanup&&(f(t.cleanup,"cleanup"),n=t.cleanup),new p(((r,i)=>{const o=O(e,t,(e=>{n&&o(),e?i(e):r();}));}))}t.exports=O,t.exports.finished=A;},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./utils":35,"process/":18}],27:[function(e,t,r){const n=e("process/"),{PromisePrototypeThen:i,SymbolAsyncIterator:o,SymbolIterator:a}=e("../../ours/primordials"),{Buffer:s}=e("buffer"),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_NULL_VALUES:u}=e("../../ours/errors").codes;function c(e,t,r){let c,d;if("string"==typeof t||t instanceof s)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null);}});if(t&&t[o])d=!0,c=t[o]();else {if(!t||!t[a])throw new l("iterable",["Iterable"],t);d=!1,c=t[a]();}const h=new e({objectMode:!0,highWaterMark:1,...r});let f=!1;async function p(e){const t=null!=e,r="function"==typeof c.throw;if(t&&r){const{value:t,done:r}=await c.throw(e);if(await t,r)return}if("function"==typeof c.return){const{value:e}=await c.return();await e;}}async function m(){for(;;){try{const{value:e,done:t}=d?await c.next():c.next();if(t)h.push(null);else {const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw f=!1,new u;if(h.push(t))continue;f=!1;}}catch(e){h.destroy(e);}break}}return h._read=function(){f||(f=!0,m());},h._destroy=function(e,t){i(p(e),(()=>n.nextTick(t,e)),(r=>n.nextTick(t,r||e)));},h}t.exports=c;},{"../../ours/errors":39,"../../ours/primordials":40,buffer:15,"process/":18}],28:[function(e,t,r){const{ArrayIsArray:n,ObjectSetPrototypeOf:i}=e("../../ours/primordials"),{EventEmitter:o}=e("events");function a(e){o.call(this,e);}function s(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r);}i(a.prototype,o.prototype),i(a,o),a.prototype.pipe=function(e,t){const 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",l),r.on("close",u));let a=!1;function l(){a||(a=!0,e.end());}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy());}function c(e){d(),0===o.listenerCount(this,"error")&&this.emit("error",e);}function d(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",l),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",d),r.removeListener("close",d),e.removeListener("close",d);}return s(r,"error",c),s(e,"error",c),r.on("end",d),r.on("close",d),e.on("close",d),e.emit("pipe",r),e},t.exports={Stream:a,prependListener:s};},{"../../ours/primordials":40,events:16}],29:[function(e,t,r){const n=globalThis.AbortController||e("abort-controller").AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:o,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:s},AbortError:l}=e("../../ours/errors"),{validateAbortSignal:u,validateInteger:c,validateObject:d}=e("../validators"),h=e("../../ours/primordials").Symbol("kWeak"),{finished:f}=e("./end-of-stream"),p=e("./compose"),{addAbortSignalNoValidate:m}=e("./add-abort-signal"),{isWritable:y,isNodeStream:g}=e("./utils"),{ArrayPrototypePush:v,MathFloor:w,Number:b,NumberIsNaN:_,Promise:E,PromiseReject:T,PromisePrototypeThen:x,Symbol:I}=e("../../ours/primordials"),S=I("kEmpty"),R=I("kEof");function k(e,t){if(null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),g(e)&&!y(e))throw new i("stream",e,"must be writable");const r=p(this,e);return null!=t&&t.signal&&m(t.signal,r),r}function j(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal");let r=1;return null!=(null==t?void 0:t.concurrency)&&(r=w(t.concurrency)),c(r,"concurrency",1),async function*(){var i,o;const a=new n,s=this,u=[],c=a.signal,d={signal:c},h=()=>a.abort();let f,p;null!=t&&null!==(i=t.signal)&&void 0!==i&&i.aborted&&h(),null==t||null===(o=t.signal)||void 0===o||o.addEventListener("abort",h);let m=!1;function y(){m=!0;}async function g(){try{for await(let t of s){var n;if(m)return;if(c.aborted)throw new l;try{t=e(t,d);}catch(e){t=T(e);}t!==S&&("function"==typeof(null===(n=t)||void 0===n?void 0:n.catch)&&t.catch(y),u.push(t),f&&(f(),f=null),!m&&u.length&&u.length>=r&&await new E((e=>{p=e;})));}u.push(R);}catch(e){const t=T(e);x(t,void 0,y),u.push(t);}finally{var i;m=!0,f&&(f(),f=null),null==t||null===(i=t.signal)||void 0===i||i.removeEventListener("abort",h);}}g();try{for(;;){for(;u.length>0;){const e=await u[0];if(e===R)return;if(c.aborted)throw new l;e!==S&&(yield e),u.shift(),p&&(p(),p=null);}await new E((e=>{f=e;}));}}finally{a.abort(),m=!0,p&&(p(),p=null);}}.call(this)}function D(e=void 0){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal"),async function*(){let t=0;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new l({cause:e.signal.reason});yield [t++,n];}}.call(this)}async function N(e,t=void 0){for await(const r of M.call(this,e,t))return !0;return !1}async function O(e,t=void 0){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return !await N.call(this,(async(...t)=>!await e(...t)),t)}async function C(e,t){for await(const r of M.call(this,e,t))return r}async function A(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);async function r(t,r){return await e(t,r),S}for await(const e of j.call(this,r,t));}function M(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);async function r(t,r){return await e(t,r)?t:S}return j.call(this,r,t)}class L extends a{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value";}}async function P(e,t,r){var i;if("function"!=typeof e)throw new o("reducer",["Function","AsyncFunction"],e);null!=r&&d(r,"options"),null!=(null==r?void 0:r.signal)&&u(r.signal,"options.signal");let a=arguments.length>1;if(null!=r&&null!==(i=r.signal)&&void 0!==i&&i.aborted){const e=new l(void 0,{cause:r.signal.reason});throw this.once("error",(()=>{})),await f(this.destroy(e)),e}const s=new n,c=s.signal;if(null!=r&&r.signal){const e={once:!0,[h]:this};r.signal.addEventListener("abort",(()=>s.abort()),e);}let p=!1;try{for await(const n of this){var m;if(p=!0,null!=r&&null!==(m=r.signal)&&void 0!==m&&m.aborted)throw new l;a?t=await e(t,n,{signal:c}):(t=n,a=!0);}if(!p&&!a)throw new L}finally{s.abort();}return t}async function B(e){null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&u(e.signal,"options.signal");const t=[];for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new l(void 0,{cause:e.signal.reason});v(t,n);}return t}function $(e,t){const r=j.call(this,e,t);return async function*(){for await(const e of r)yield*e;}.call(this)}function F(e){if(e=b(e),_(e))return 0;if(e<0)throw new s("number",">= 0",e);return e}function U(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=F(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;e--<=0&&(yield r);}}.call(this)}function q(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&u(t.signal,"options.signal"),e=F(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new l;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new l;if(!(e-- >0))return;yield r;}}.call(this)}t.exports.streamReturningOperators={asIndexedPairs:D,drop:U,filter:M,flatMap:$,map:j,take:q,compose:k},t.exports.promiseReturningOperators={every:O,forEach:A,reduce:P,toArray:B,some:N,find:C};},{"../../ours/errors":39,"../../ours/primordials":40,"../validators":37,"./add-abort-signal":20,"./compose":22,"./end-of-stream":26,"./utils":35,"abort-controller":11}],30:[function(e,t,r){const{ObjectSetPrototypeOf:n}=e("../../ours/primordials");t.exports=o;const i=e("./transform");function o(e){if(!(this instanceof o))return new o(e);i.call(this,e);}n(o.prototype,i.prototype),n(o,i),o.prototype._transform=function(e,t,r){r(null,e);};},{"../../ours/primordials":40,"./transform":34}],31:[function(e,t,r){const n=e("process/"),{ArrayIsArray:i,Promise:o,SymbolAsyncIterator:a}=e("../../ours/primordials"),s=e("./end-of-stream"),{once:l}=e("../../ours/util"),u=e("./destroy"),c=e("./duplex"),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:h,ERR_INVALID_RETURN_VALUE:f,ERR_MISSING_ARGS:p,ERR_STREAM_DESTROYED:m,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:g}=e("../../ours/errors"),{validateFunction:v,validateAbortSignal:w}=e("../validators"),{isIterable:b,isReadable:_,isReadableNodeStream:E,isNodeStream:T,isTransformStream:x,isWebStream:I,isReadableStream:S,isReadableEnded:R}=e("./utils"),k=globalThis.AbortController||e("abort-controller").AbortController;let j,D;function N(e,t,r){let n=!1;return e.on("close",(()=>{n=!0;})),{destroy:t=>{n||(n=!0,u.destroyer(e,t||new m("pipe")));},cleanup:s(e,{readable:t,writable:r},(e=>{n=!e;}))}}function O(e){return v(e[e.length-1],"streams[stream.length - 1]"),e.pop()}function C(e){if(b(e))return e;if(E(e))return A(e);throw new h("val",["Readable","Iterable","AsyncIterable"],e)}async function*A(t){D||(D=e("./readable")),yield*D.prototype[a].call(t);}async function M(e,t,r,{end:n}){let i,a=null;const l=e=>{if(e&&(i=e),a){const e=a;a=null,e();}},u=()=>new o(((e,t)=>{i?t(i):a=()=>{i?t(i):e();};}));t.on("drain",l);const c=s(t,{readable:!1},l);try{t.writableNeedDrain&&await u();for await(const r of e)t.write(r)||await u();n&&t.end(),await u(),r();}catch(e){r(i!==e?d(i,e):e);}finally{c(),t.off("drain",l);}}async function L(e,t,r,{end:n}){x(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,n&&await i.close(),r();}catch(e){try{await i.abort(e),r(e);}catch(e){r(e);}}}function P(...e){return B(e,l(O(e)))}function B(t,r,o){if(1===t.length&&i(t[0])&&(t=t[0]),t.length<2)throw new p("streams");const a=new k,s=a.signal,l=null==o?void 0:o.signal,u=[];function d(){A(new g);}let m,y;w(l,"options.signal"),null==l||l.addEventListener("abort",d);const v=[];let R,D=0;function O(e){A(e,0==--D);}function A(e,t){if(!e||m&&"ERR_STREAM_PREMATURE_CLOSE"!==m.code||(m=e),m||t){for(;v.length;)v.shift()(m);null==l||l.removeEventListener("abort",d),a.abort(),t&&(m||u.forEach((e=>e())),n.nextTick(r,m,y));}}for(let F=0;F<t.length;F++){const U=t[F],q=F<t.length-1,Y=F>0,W=q||!1!==(null==o?void 0:o.end),z=F===t.length-1;if(T(U)){if(W){const{destroy:H,cleanup:J}=N(U,q,Y);v.push(H),_(U)&&z&&u.push(J);}function G(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&O(e);}U.on("error",G),_(U)&&z&&u.push((()=>{U.removeListener("error",G);}));}if(0===F)if("function"==typeof U){if(R=U({signal:s}),!b(R))throw new f("Iterable, AsyncIterable or Stream","source",R)}else R=b(U)||E(U)||x(U)?U:c.from(U);else if("function"==typeof U){var P;if(R=x(R)?C(null===(P=R)||void 0===P?void 0:P.readable):C(R),R=U(R,{signal:s}),q){if(!b(R,!0))throw new f("AsyncIterable",`transform[${F-1}]`,R)}else {var B;j||(j=e("./passthrough"));const V=new j({objectMode:!0}),Q=null===(B=R)||void 0===B?void 0:B.then;if("function"==typeof Q)D++,Q.call(R,(e=>{y=e,null!=e&&V.write(e),W&&V.end(),n.nextTick(O);}),(e=>{V.destroy(e),n.nextTick(O,e);}));else if(b(R,!0))D++,M(R,V,O,{end:W});else {if(!S(R)&&!x(R))throw new f("AsyncIterable or Promise","destination",R);{const X=R.readable||R;D++,M(X,V,O,{end:W});}}R=V;const{destroy:Z,cleanup:K}=N(R,!1,!0);v.push(Z),z&&u.push(K);}}else if(T(U)){if(E(R)){D+=2;const ee=$(R,U,O,{end:W});_(U)&&z&&u.push(ee);}else if(x(R)||S(R)){const te=R.readable||R;D++,M(te,U,O,{end:W});}else {if(!b(R))throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],R);D++,M(R,U,O,{end:W});}R=U;}else if(I(U)){if(E(R))D++,L(C(R),U,O,{end:W});else if(S(R)||b(R))D++,L(R,U,O,{end:W});else {if(!x(R))throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],R);D++,L(R.readable,U,O,{end:W});}R=U;}else R=c.from(U);}return (null!=s&&s.aborted||null!=l&&l.aborted)&&n.nextTick(d),R}function $(e,t,r,{end:i}){let o=!1;if(t.on("close",(()=>{o||r(new y);})),e.pipe(t,{end:!1}),i){function a(){o=!0,t.end();}R(e)?n.nextTick(a):e.once("end",a);}else r();return s(e,{readable:!0,writable:!1},(t=>{const n=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once("end",r).once("error",r):r(t);})),s(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:B,pipeline:P};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./passthrough":30,"./readable":32,"./utils":35,"abort-controller":11,"process/":18}],32:[function(e,t,r){const n=e("process/"),{ArrayPrototypeIndexOf:i,NumberIsInteger:o,NumberIsNaN:a,NumberParseInt:s,ObjectDefineProperties:l,ObjectKeys:u,ObjectSetPrototypeOf:c,Promise:d,SafeSet:h,SymbolAsyncIterator:f,Symbol:p}=e("../../ours/primordials");t.exports=$,$.ReadableState=B;const{EventEmitter:m}=e("events"),{Stream:y,prependListener:g}=e("./legacy"),{Buffer:v}=e("buffer"),{addAbortSignal:w}=e("./add-abort-signal"),b=e("./end-of-stream");let _=e("../../ours/util").debuglog("stream",(e=>{_=e;}));const E=e("./buffer_list"),T=e("./destroy"),{getHighWaterMark:x,getDefaultHighWaterMark:I}=e("./state"),{aggregateTwoErrors:S,codes:{ERR_INVALID_ARG_TYPE:R,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_OUT_OF_RANGE:j,ERR_STREAM_PUSH_AFTER_EOF:D,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:N}}=e("../../ours/errors"),{validateObject:O}=e("../validators"),C=p("kPaused"),{StringDecoder:A}=e("string_decoder"),M=e("./from");c($.prototype,y.prototype),c($,y);const L=()=>{},{errorOrDestroy:P}=T;function B(t,r,n){"boolean"!=typeof n&&(n=r instanceof e("./duplex")),this.objectMode=!(!t||!t.objectMode),n&&(this.objectMode=this.objectMode||!(!t||!t.readableObjectMode)),this.highWaterMark=t?x(this,t,"readableHighWaterMark",n):I(!1),this.buffer=new E,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[C]=null,this.errorEmitted=!1,this.emitClose=!t||!1!==t.emitClose,this.autoDestroy=!t||!1!==t.autoDestroy,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new A(t.encoding),this.encoding=t.encoding);}function $(t){if(!(this instanceof $))return new $(t);const r=this instanceof e("./duplex");this._readableState=new B(t,this,r),t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.construct&&(this._construct=t.construct),t.signal&&!r&&w(t.signal,this)),y.call(this,t),T.construct(this,(()=>{this._readableState.needReadable&&J(this,this._readableState);}));}function F(e,t,r,n){_("readableAddChunk",t);const i=e._readableState;let o;if(i.objectMode||("string"==typeof t?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?t=v.from(t,r).toString(i.encoding):(t=v.from(t,r),r=""))):t instanceof v?r="":y._isUint8Array(t)?(t=y._uint8ArrayToBuffer(t),r=""):null!=t&&(o=new R("chunk",["string","Buffer","Uint8Array"],t))),o)P(e,o);else if(null===t)i.reading=!1,z(e,i);else if(i.objectMode||t&&t.length>0)if(n)if(i.endEmitted)P(e,new N);else {if(i.destroyed||i.errored)return !1;U(e,i,t,!0);}else if(i.ended)P(e,new D);else {if(i.destroyed||i.errored)return !1;i.reading=!1,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?U(e,i,t,!1):J(e,i)):U(e,i,t,!1);}else n||(i.reading=!1,J(e,i));return !i.ended&&(i.length<i.highWaterMark||0===i.length)}function U(e,t,r,n){t.flowing&&0===t.length&&!t.sync&&e.listenerCount("data")>0?(t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&G(e)),J(e,t);}$.prototype.destroy=T.destroy,$.prototype._undestroy=T.undestroy,$.prototype._destroy=function(e,t){t(e);},$.prototype[m.captureRejectionSymbol]=function(e){this.destroy(e);},$.prototype.push=function(e,t){return F(this,e,t,!1)},$.prototype.unshift=function(e,t){return F(this,e,t,!0)},$.prototype.isPaused=function(){const e=this._readableState;return !0===e[C]||!1===e.flowing},$.prototype.setEncoding=function(e){const t=new A(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const r=this._readableState.buffer;let n="";for(const e of r)n+=t.write(e);return r.clear(),""!==n&&r.push(n),this._readableState.length=n.length,this};const q=1073741824;function Y(e){if(e>q)throw new j("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}function W(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function z(e,t){if(_("onEofChunk"),!t.ended){if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length);}t.ended=!0,t.sync?G(e):(t.needReadable=!1,t.emittedReadable=!0,H(e));}}function G(e){const t=e._readableState;_("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(_("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(H,e));}function H(e){const t=e._readableState;_("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,te(e);}function J(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(V,e,t));}function V(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){const r=t.length;if(_("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1;}function Q(e,t){return function(){const r=e._readableState;r.awaitDrainWriters===t?(_("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(_("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),r.awaitDrainWriters&&0!==r.awaitDrainWriters.size||!e.listenerCount("data")||e.resume();}}function Z(e){const t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!1===t[C]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null);}function K(e){_("readable nexttick read 0"),e.read(0);}function X(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(ee,e,t));}function ee(e,t){_("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),te(e),t.flowing&&!t.reading&&e.read(0);}function te(e){const t=e._readableState;for(_("flow",t.flowing);t.flowing&&null!==e.read(););}function re(e,t){"function"!=typeof e.read&&(e=$.wrap(e,{objectMode:!0}));const r=ne(e,t);return r.stream=e,r}async function*ne(e,t){let r,n=L;function i(t){this===e?(n(),n=L):n=t;}e.on("readable",i);const o=b(e,{writable:!1},(e=>{r=e?S(r,e):null,n(),n=L;}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else {if(r)throw r;if(null===r)return;await new d(i);}}}catch(e){throw r=S(r,e),r}finally{!r&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==r&&!e._readableState.autoDestroy?(e.off("readable",i),o()):T.destroyer(e,null);}}function ie(e,t){if(0===t.length)return null;let r;return 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}function oe(e){const t=e._readableState;_("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(ae,t,e));}function ae(e,t){if(_("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)n.nextTick(se,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy();}}function se(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end();}let le;function ue(){return void 0===le&&(le={}),le}$.prototype.read=function(e){_("read",e),void 0===e?e=NaN:o(e)||(e=s(e,10));const t=this._readableState,r=e;if(e>t.highWaterMark&&(t.highWaterMark=Y(e)),0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return _("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?oe(this):G(this),null;if(0===(e=W(e,t))&&t.ended)return 0===t.length&&oe(this),null;let n,i=t.needReadable;if(_("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&(i=!0,_("length less than watermark",i)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)i=!1,_("reading, ended or constructing",i);else if(i){_("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0);try{this._read(t.highWaterMark);}catch(e){P(this,e);}t.sync=!1,t.reading||(e=W(r,t));}return n=e>0?ie(e,t):null,null===n?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&oe(this)),null===n||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",n)),n},$.prototype._read=function(e){throw new k("_read()")},$.prototype.pipe=function(e,t){const r=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new h(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),_("pipe count=%d opts=%j",i.pipes.length,t);const o=t&&!1===t.end||e===n.stdout||e===n.stderr?v:s;function a(e,t){_("onunpipe"),e===r&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,c());}function s(){_("onend"),e.end();}let l;i.endEmitted?n.nextTick(o):r.once("end",o),e.on("unpipe",a);let u=!1;function c(){_("cleanup"),e.removeListener("close",m),e.removeListener("finish",y),l&&e.removeListener("drain",l),e.removeListener("error",p),e.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",v),r.removeListener("data",f),u=!0,l&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&l();}function d(){u||(1===i.pipes.length&&i.pipes[0]===e?(_("false write response, pause",0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(_("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),l||(l=Q(r,e),e.on("drain",l));}function f(t){_("ondata");const r=e.write(t);_("dest.write",r),!1===r&&d();}function p(t){if(_("onerror",t),v(),e.removeListener("error",p),0===e.listenerCount("error")){const r=e._writableState||e._readableState;r&&!r.errorEmitted?P(e,t):e.emit("error",t);}}function m(){e.removeListener("finish",y),v();}function y(){_("onfinish"),e.removeListener("close",m),v();}function v(){_("unpipe"),r.unpipe(e);}return r.on("data",f),g(e,"error",p),e.once("close",m),e.once("finish",y),e.emit("pipe",r),!0===e.writableNeedDrain?i.flowing&&d():i.flowing||(_("pipe resume"),r.resume()),e},$.prototype.unpipe=function(e){const t=this._readableState,r={hasUnpiped:!1};if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit("unpipe",this,{hasUnpiped:!1});return this}const n=i(t.pipes,e);return -1===n||(t.pipes.splice(n,1),0===t.pipes.length&&this.pause(),e.emit("unpipe",this,r)),this},$.prototype.on=function(e,t){const r=y.prototype.on.call(this,e,t),i=this._readableState;return "data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,_("on readable",i.length,i.reading),i.length?G(this):i.reading||n.nextTick(K,this))),r},$.prototype.addListener=$.prototype.on,$.prototype.removeListener=function(e,t){const r=y.prototype.removeListener.call(this,e,t);return "readable"===e&&n.nextTick(Z,this),r},$.prototype.off=$.prototype.removeListener,$.prototype.removeAllListeners=function(e){const t=y.prototype.removeAllListeners.apply(this,arguments);return "readable"!==e&&void 0!==e||n.nextTick(Z,this),t},$.prototype.resume=function(){const e=this._readableState;return e.flowing||(_("resume"),e.flowing=!e.readableListening,X(this,e)),e[C]=!1,this},$.prototype.pause=function(){return _("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(_("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[C]=!0,this},$.prototype.wrap=function(e){let t=!1;e.on("data",(r=>{!this.push(r)&&e.pause&&(t=!0,e.pause());})),e.on("end",(()=>{this.push(null);})),e.on("error",(e=>{P(this,e);})),e.on("close",(()=>{this.destroy();})),e.on("destroy",(()=>{this.destroy();})),this._read=()=>{t&&e.resume&&(t=!1,e.resume());};const r=u(e);for(let t=1;t<r.length;t++){const n=r[t];void 0===this[n]&&"function"==typeof e[n]&&(this[n]=e[n].bind(e));}return this},$.prototype[f]=function(){return re(this)},$.prototype.iterator=function(e){return void 0!==e&&O(e,"options"),re(this,e)},l($.prototype,{readable:{__proto__:null,get(){const e=this._readableState;return !(!e||!1===e.readable||e.destroyed||e.errorEmitted||e.endEmitted)},set(e){this._readableState&&(this._readableState.readable=!!e);}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return !(!1===this._readableState.readable||!this._readableState.destroyed&&!this._readableState.errored||this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e);}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.objectMode}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return !!this._readableState&&this._readableState.closed}},destroyed:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.destroyed},set(e){this._readableState&&(this._readableState.destroyed=e);}},readableEnded:{__proto__:null,enumerable:!1,get(){return !!this._readableState&&this._readableState.endEmitted}}}),l(B.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return !1!==this[C]},set(e){this[C]=!!e;}}}),$._fromList=ie,$.from=function(e,t){return M($,e,t)},$.fromWeb=function(e,t){return ue().newStreamReadableFromReadableStream(e,t)},$.toWeb=function(e,t){return ue().newReadableStreamFromStreamReadable(e,t)},$.wrap=function(e,t){var r,n;return new $({objectMode:null===(r=null!==(n=e.readableObjectMode)&&void 0!==n?n:e.objectMode)||void 0===r||r,...t,destroy(t,r){T.destroyer(e,t),r(t);}}).wrap(e)};},{"../../ours/errors":39,"../../ours/primordials":40,"../../ours/util":41,"../validators":37,"./add-abort-signal":20,"./buffer_list":21,"./destroy":23,"./duplex":24,"./end-of-stream":26,"./from":27,"./legacy":28,"./state":33,buffer:15,events:16,"process/":18,string_decoder:14}],33:[function(e,t,r){const{MathFloor:n,NumberIsInteger:i}=e("../../ours/primordials"),{ERR_INVALID_ARG_VALUE:o}=e("../../ours/errors").codes;function a(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}function s(e){return e?16:16384}function l(e,t,r,l){const u=a(t,l,r);if(null!=u){if(!i(u)||u<0)throw new o(l?`options.${r}`:"options.highWaterMark",u);return n(u)}return s(e.objectMode)}t.exports={getHighWaterMark:l,getDefaultHighWaterMark:s};},{"../../ours/errors":39,"../../ours/primordials":40}],34:[function(e,t,r){const{ObjectSetPrototypeOf:n,Symbol:i}=e("../../ours/primordials");t.exports=u;const{ERR_METHOD_NOT_IMPLEMENTED:o}=e("../../ours/errors").codes,a=e("./duplex"),{getHighWaterMark:s}=e("./state");n(u.prototype,a.prototype),n(u,a);const l=i("kCallback");function u(e){if(!(this instanceof u))return new u(e);const t=e?s(this,e,"readableHighWaterMark",!0):null;0===t&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[l]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d);}function c(e){"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush(((t,r)=>{t?e?e(t):this.destroy(t):(null!=r&&this.push(r),this.push(null),e&&e());}));}function d(){this._final!==c&&c.call(this);}u.prototype._final=c,u.prototype._transform=function(e,t,r){throw new o("_transform()")},u.prototype._write=function(e,t,r){const n=this._readableState,i=this._writableState,o=n.length;this._transform(e,t,((e,t)=>{e?r(e):(null!=t&&this.push(t),i.ended||o===n.length||n.length<n.highWaterMark?r():this[l]=r);}));},u.prototype._read=function(){if(this[l]){const e=this[l];this[l]=null,e();}};},{"../../ours/errors":39,"../../ours/primordials":40,"./duplex":24,"./state":33}],35:[function(e,t,r){const{Symbol:n,SymbolAsyncIterator:i,SymbolIterator:o,SymbolFor:a}=e("../../ours/primordials"),s=n("kDestroyed"),l=n("kIsErrored"),u=n("kIsReadable"),c=n("kIsDisturbed"),d=a("nodejs.webstream.isClosedPromise"),h=a("nodejs.webstream.controllerErrorFunction");function f(e,t=!1){var r;return !(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||t&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(r=e._readableState)||void 0===r?void 0:r.readable)||e._writableState&&!e._readableState)}function p(e){var t;return !(!e||"function"!=typeof e.write||"function"!=typeof e.on||e._readableState&&!1===(null===(t=e._writableState)||void 0===t?void 0:t.writable))}function m(e){return !(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write)}function y(e){return e&&(e._readableState||e._writableState||"function"==typeof e.write&&"function"==typeof e.on||"function"==typeof e.pipe&&"function"==typeof e.on)}function g(e){return !(!e||y(e)||"function"!=typeof e.pipeThrough||"function"!=typeof e.getReader||"function"!=typeof e.cancel)}function v(e){return !(!e||y(e)||"function"!=typeof e.getWriter||"function"!=typeof e.abort)}function w(e){return !(!e||y(e)||"object"!=typeof e.readable||"object"!=typeof e.writable)}function b(e){return g(e)||v(e)||w(e)}function _(e,t){return null!=e&&(!0===t?"function"==typeof e[i]:!1===t?"function"==typeof e[o]:"function"==typeof e[i]||"function"==typeof e[o])}function E(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return !!(e.destroyed||e[s]||null!=n&&n.destroyed)}function T(e){if(!p(e))return null;if(!0===e.writableEnded)return !0;const t=e._writableState;return (null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function x(e,t){if(!p(e))return null;if(!0===e.writableFinished)return !0;const r=e._writableState;return (null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.finished)?null:!!(r.finished||!1===t&&!0===r.ended&&0===r.length))}function I(e){if(!f(e))return null;if(!0===e.readableEnded)return !0;const t=e._readableState;return !(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function S(e,t){if(!f(e))return null;const r=e._readableState;return (null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.endEmitted)?null:!!(r.endEmitted||!1===t&&!0===r.ended&&0===r.length))}function R(e){return e&&null!=e[u]?e[u]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!E(e)&&f(e)&&e.readable&&!S(e)}function k(e){return "boolean"!=typeof(null==e?void 0:e.writable)?null:!E(e)&&p(e)&&e.writable&&!T(e)}function j(e,t){return y(e)?!(!E(e)&&(!1!==(null==t?void 0:t.readable)&&R(e)||!1!==(null==t?void 0:t.writable)&&k(e))):null}function D(e){var t,r;return y(e)?e.writableErrored?e.writableErrored:null!==(t=null===(r=e._writableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null}function N(e){var t,r;return y(e)?e.readableErrored?e.readableErrored:null!==(t=null===(r=e._readableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null}function O(e){if(!y(e))return null;if("boolean"==typeof e.closed)return e.closed;const t=e._writableState,r=e._readableState;return "boolean"==typeof(null==t?void 0:t.closed)||"boolean"==typeof(null==r?void 0:r.closed)?(null==t?void 0:t.closed)||(null==r?void 0:r.closed):"boolean"==typeof e._closed&&C(e)?e._closed:null}function C(e){return "boolean"==typeof e._closed&&"boolean"==typeof e._defaultKeepAlive&&"boolean"==typeof e._removedConnection&&"boolean"==typeof e._removedContLen}function A(e){return "boolean"==typeof e._sent100&&C(e)}function M(e){var t;return "boolean"==typeof e._consuming&&"boolean"==typeof e._dumped&&void 0===(null===(t=e.req)||void 0===t?void 0:t.upgradeOrConnect)}function L(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return !n&&A(e)||!!(n&&n.autoDestroy&&n.emitClose&&!1===n.closed)}function P(e){var t;return !(!e||!(null!==(t=e[c])&&void 0!==t?t:e.readableDidRead||e.readableAborted))}function B(e){var t,r,n,i,o,a,s,u,c,d;return !(!e||!(null!==(t=null!==(r=null!==(n=null!==(i=null!==(o=null!==(a=e[l])&&void 0!==a?a:e.readableErrored)&&void 0!==o?o:e.writableErrored)&&void 0!==i?i:null===(s=e._readableState)||void 0===s?void 0:s.errorEmitted)&&void 0!==n?n:null===(u=e._writableState)||void 0===u?void 0:u.errorEmitted)&&void 0!==r?r:null===(c=e._readableState)||void 0===c?void 0:c.errored)&&void 0!==t?t:null===(d=e._writableState)||void 0===d?void 0:d.errored))}t.exports={kDestroyed:s,isDisturbed:P,kIsDisturbed:c,isErrored:B,kIsErrored:l,isReadable:R,kIsReadable:u,kIsClosedPromise:d,kControllerErrorFunction:h,isClosed:O,isDestroyed:E,isDuplexNodeStream:m,isFinished:j,isIterable:_,isReadableNodeStream:f,isReadableStream:g,isReadableEnded:I,isReadableFinished:S,isReadableErrored:N,isNodeStream:y,isWebStream:b,isWritable:k,isWritableNodeStream:p,isWritableStream:v,isWritableEnded:T,isWritableFinished:x,isWritableErrored:D,isServerRequest:M,isServerResponse:A,willEmitClose:L,isTransformStream:w};},{"../../ours/primordials":40}],36:[function(e,t,r){const n=e("process/"),{ArrayPrototypeSlice:i,Error:o,FunctionPrototypeSymbolHasInstance:a,ObjectDefineProperty:s,ObjectDefineProperties:l,ObjectSetPrototypeOf:u,StringPrototypeToLowerCase:c,Symbol:d,SymbolHasInstance:h}=e("../../ours/primordials");t.exports=A,A.WritableState=O;const{EventEmitter:f}=e("events"),p=e("./legacy").Stream,{Buffer:m}=e("buffer"),y=e("./destroy"),{addAbortSignal:g}=e("./add-abort-signal"),{getHighWaterMark:v,getDefaultHighWaterMark:w}=e("./state"),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:_,ERR_MULTIPLE_CALLBACK:E,ERR_STREAM_CANNOT_PIPE:T,ERR_STREAM_DESTROYED:x,ERR_STREAM_ALREADY_FINISHED:I,ERR_STREAM_NULL_VALUES:S,ERR_STREAM_WRITE_AFTER_END:R,ERR_UNKNOWN_ENCODING:k}=e("../../ours/errors").codes,{errorOrDestroy:j}=y;function D(){}u(A.prototype,p.prototype),u(A,p);const N=d("kOnFinished");function O(t,r,n){"boolean"!=typeof n&&(n=r instanceof e("./duplex")),this.objectMode=!(!t||!t.objectMode),n&&(this.objectMode=this.objectMode||!(!t||!t.writableObjectMode)),this.highWaterMark=t?v(this,t,"writableHighWaterMark",n):w(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const i=!(!t||!1!==t.decodeStrings);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=$.bind(void 0,r),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,C(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||!1!==t.emitClose,this.autoDestroy=!t||!1!==t.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[N]=[];}function C(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0;}function A(t){const r=this instanceof e("./duplex");if(!r&&!a(A,this))return new A(t);this._writableState=new O(t,this,r),t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final),"function"==typeof t.construct&&(this._construct=t.construct),t.signal&&g(t.signal,this)),p.call(this,t),y.construct(this,(()=>{const e=this._writableState;e.writing||Y(this,e),H(this,e);}));}function M(e,t,r,i){const o=e._writableState;if("function"==typeof r)i=r,r=o.defaultEncoding;else {if(r){if("buffer"!==r&&!m.isEncoding(r))throw new k(r)}else r=o.defaultEncoding;"function"!=typeof i&&(i=D);}if(null===t)throw new S;if(!o.objectMode)if("string"==typeof t)!1!==o.decodeStrings&&(t=m.from(t,r),r="buffer");else if(t instanceof m)r="buffer";else {if(!p._isUint8Array(t))throw new b("chunk",["string","Buffer","Uint8Array"],t);t=p._uint8ArrayToBuffer(t),r="buffer";}let a;return o.ending?a=new R:o.destroyed&&(a=new x("write")),a?(n.nextTick(i,a),j(e,a,!0),a):(o.pendingcb++,L(e,o,t,r,i))}function L(e,t,r,n,i){const o=t.objectMode?1:r.length;t.length+=o;const a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:r,encoding:n,callback:i}),t.allBuffers&&"buffer"!==n&&(t.allBuffers=!1),t.allNoop&&i!==D&&(t.allNoop=!1)):(t.writelen=o,t.writecb=i,t.writing=!0,t.sync=!0,e._write(r,n,t.onwrite),t.sync=!1),a&&!t.errored&&!t.destroyed}function P(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new x("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1;}function B(e,t,r,n){--t.pendingcb,n(r),q(t),j(e,r);}function $(e,t){const r=e._writableState,i=r.sync,o=r.writecb;"function"==typeof o?(r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(r.errored||(r.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(B,e,r,t,o):B(e,r,t,o)):(r.buffered.length>r.bufferedIndex&&Y(e,r),i?null!==r.afterWriteTickInfo&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:e,state:r},n.nextTick(F,r.afterWriteTickInfo)):U(e,r,1,o))):j(e,new E);}function F({stream:e,state:t,count:r,cb:n}){return t.afterWriteTickInfo=null,U(e,t,r,n)}function U(e,t,r,n){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&q(t),H(e,t);}function q(e){if(e.writing)return;for(let r=e.bufferedIndex;r<e.buffered.length;++r){var t;const{chunk:n,callback:i}=e.buffered[r],o=e.objectMode?1:n.length;e.length-=o,i(null!==(t=e.errored)&&void 0!==t?t:new x("write"));}const r=e[N].splice(0);for(let t=0;t<r.length;t++){var n;r[t](null!==(n=e.errored)&&void 0!==n?n:new x("end"));}C(e);}function Y(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;const{buffered:r,bufferedIndex:n,objectMode:o}=t,a=r.length-n;if(!a)return;let s=n;if(t.bufferProcessing=!0,a>1&&e._writev){t.pendingcb-=a-1;const n=t.allNoop?D:e=>{for(let t=s;t<r.length;++t)r[t].callback(e);},o=t.allNoop&&0===s?r:i(r,s);o.allBuffers=t.allBuffers,P(e,t,!0,t.length,o,"",n),C(t);}else {do{const{chunk:n,encoding:i,callback:a}=r[s];r[s++]=null,P(e,t,!1,o?1:n.length,n,i,a);}while(s<r.length&&!t.writing);s===r.length?C(t):s>256?(r.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s;}t.bufferProcessing=!1;}function W(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function z(e,t){let r=!1;function i(i){if(r)j(e,null!=i?i:E());else if(r=!0,t.pendingcb--,i){const r=t[N].splice(0);for(let e=0;e<r.length;e++)r[e](i);j(e,i,t.sync);}else W(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,n.nextTick(J,e,t));}t.sync=!0,t.pendingcb++;try{e._final(i);}catch(e){i(e);}t.sync=!1;}function G(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,z(e,t)));}function H(e,t,r){W(t)&&(G(e,t),0===t.pendingcb&&(r?(t.pendingcb++,n.nextTick(((e,t)=>{W(t)?J(e,t):t.pendingcb--;}),e,t)):W(t)&&(t.pendingcb++,J(e,t))));}function J(e,t){t.pendingcb--,t.finished=!0;const r=t[N].splice(0);for(let e=0;e<r.length;e++)r[e]();if(e.emit("finish"),t.autoDestroy){const t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||!1===t.readable))&&e.destroy();}}O.prototype.getBuffer=function(){return i(this.buffered,this.bufferedIndex)},s(O.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}}),s(A,h,{__proto__:null,value:function(e){return !!a(this,e)||this===A&&e&&e._writableState instanceof O}}),A.prototype.pipe=function(){j(this,new T);},A.prototype.write=function(e,t,r){return !0===M(this,e,t,r)},A.prototype.cork=function(){this._writableState.corked++;},A.prototype.uncork=function(){const e=this._writableState;e.corked&&(e.corked--,e.writing||Y(this,e));},A.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=c(e)),!m.isEncoding(e))throw new k(e);return this._writableState.defaultEncoding=e,this},A.prototype._write=function(e,t,r){if(!this._writev)throw new _("_write()");this._writev([{chunk:e,encoding:t}],r);},A.prototype._writev=null,A.prototype.end=function(e,t,r){const i=this._writableState;let a;if("function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e){const r=M(this,e,t);r instanceof o&&(a=r);}return i.corked&&(i.corked=1,this.uncork()),a||(i.errored||i.ending?i.finished?a=new I("end"):i.destroyed&&(a=new x("end")):(i.ending=!0,H(this,i,!0),i.ended=!0)),"function"==typeof r&&(a||i.finished?n.nextTick(r,a):i[N].push(r)),this},l(A.prototype,{closed:{__proto__:null,get(){return !!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get(){return !!this._writableState&&this._writableState.destroyed},set(e){this._writableState&&(this._writableState.destroyed=e);}},writable:{__proto__:null,get(){const e=this._writableState;return !(!e||!1===e.writable||e.destroyed||e.errored||e.ending||e.ended)},set(e){this._writableState&&(this._writableState.writable=!!e);}},writableFinished:{__proto__:null,get(){return !!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get(){return !!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return !!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get(){const e=this._writableState;return !!e&&!e.destroyed&&!e.ending&&e.needDrain}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return !(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});const V=y.destroy;let Q;function Z(){return void 0===Q&&(Q={}),Q}A.prototype.destroy=function(e,t){const r=this._writableState;return !r.destroyed&&(r.bufferedIndex<r.buffered.length||r[N].length)&&n.nextTick(q,r),V.call(this,e,t),this},A.prototype._undestroy=y.undestroy,A.prototype._destroy=function(e,t){t(e);},A.prototype[f.captureRejectionSymbol]=function(e){this.destroy(e);},A.fromWeb=function(e,t){return Z().newStreamWritableFromWritableStream(e,t)},A.toWeb=function(e){return Z().newWritableStreamFromStreamWritable(e)};},{"../../ours/errors":39,"../../ours/primordials":40,"./add-abort-signal":20,"./destroy":23,"./duplex":24,"./legacy":28,"./state":33,buffer:15,events:16,"process/":18}],37:[function(e,t,r){const{ArrayIsArray:n,ArrayPrototypeIncludes:i,ArrayPrototypeJoin:o,ArrayPrototypeMap:a,NumberIsInteger:s,NumberIsNaN:l,NumberMAX_SAFE_INTEGER:u,NumberMIN_SAFE_INTEGER:c,NumberParseInt:d,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:m,StringPrototypeTrim:y}=e("../ours/primordials"),{hideStackFrames:g,codes:{ERR_SOCKET_BAD_PORT:v,ERR_INVALID_ARG_TYPE:w,ERR_INVALID_ARG_VALUE:b,ERR_OUT_OF_RANGE:_,ERR_UNKNOWN_SIGNAL:E}}=e("../ours/errors"),{normalizeEncoding:T}=e("../ours/util"),{isAsyncFunction:x,isArrayBufferView:I}=e("../ours/util").types,S={};function R(e){return e===(0|e)}function k(e){return e===e>>>0}const j=/^[0-7]+$/,D="must be a 32-bit unsigned integer or an octal string";function N(e,t,r){if(void 0===e&&(e=r),"string"==typeof e){if(null===f(j,e))throw new b(t,e,D);e=d(e,8);}return A(e,t),e}const O=g(((e,t,r=c,n=u)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<r||e>n)throw new _(t,`>= ${r} && <= ${n}`,e)})),C=g(((e,t,r=-2147483648,n=2147483647)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);if(e<r||e>n)throw new _(t,`>= ${r} && <= ${n}`,e)})),A=g(((e,t,r=!1)=>{if("number"!=typeof e)throw new w(t,"number",e);if(!s(e))throw new _(t,"an integer",e);const n=r?1:0,i=4294967295;if(e<n||e>i)throw new _(t,`>= ${n} && <= ${i}`,e)}));function M(e,t){if("string"!=typeof e)throw new w(t,"string",e)}function L(e,t,r=void 0,n){if("number"!=typeof e)throw new w(t,"number",e);if(null!=r&&e<r||null!=n&&e>n||(null!=r||null!=n)&&l(e))throw new _(t,`${null!=r?`>= ${r}`:""}${null!=r&&null!=n?" && ":""}${null!=n?`<= ${n}`:""}`,e)}const P=g(((e,t,r)=>{if(!i(r,e)){const n=o(a(r,(e=>"string"==typeof e?`'${e}'`:p(e))),", ");throw new b(t,e,"must be one of: "+n)}}));function B(e,t){if("boolean"!=typeof e)throw new w(t,"boolean",e)}function $(e,t,r){return null!=e&&h(e,t)?e[t]:r}const F=g(((e,t,r=null)=>{const i=$(r,"allowArray",!1),o=$(r,"allowFunction",!1);if(!$(r,"nullable",!1)&&null===e||!i&&n(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new w(t,"Object",e)})),U=g(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new w(t,"a dictionary",e)})),q=g(((e,t,r=0)=>{if(!n(e))throw new w(t,"Array",e);if(e.length<r)throw new b(t,e,`must be longer than ${r}`)}));function Y(e,t){q(e,t);for(let r=0;r<e.length;r++)M(e[r],`${t}[${r}]`);}function W(e,t){q(e,t);for(let r=0;r<e.length;r++)B(e[r],`${t}[${r}]`);}function z(e,t="signal"){if(M(e,t),void 0===S[e]){if(void 0!==S[m(e)])throw new E(e+" (signals must use all capital letters)");throw new E(e)}}const G=g(((e,t="buffer")=>{if(!I(e))throw new w(t,["Buffer","TypedArray","DataView"],e)}));function H(e,t){const r=T(t),n=e.length;if("hex"===r&&n%2!=0)throw new b("encoding",t,`is invalid for data of length ${n}`)}function J(e,t="Port",r=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===y(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new v(t,e,r);return 0|e}const V=g(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new w(t,"AbortSignal",e)})),Q=g(((e,t)=>{if("function"!=typeof e)throw new w(t,"Function",e)})),Z=g(((e,t)=>{if("function"!=typeof e||x(e))throw new w(t,"Function",e)})),K=g(((e,t)=>{if(void 0!==e)throw new w(t,"undefined",e)}));function X(e,t,r){if(!i(r,e))throw new w(t,`('${o(r,"|")}')`,e)}const ee=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function te(e,t){if(void 0===e||!f(ee,e))throw new b(t,e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function re(e){if("string"==typeof e)return te(e,"hints"),e;if(n(e)){const t=e.length;let r="";if(0===t)return r;for(let n=0;n<t;n++){const i=e[n];te(i,"hints"),r+=i,n!==t-1&&(r+=", ");}return r}throw new b("hints",e,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}t.exports={isInt32:R,isUint32:k,parseFileMode:N,validateArray:q,validateStringArray:Y,validateBooleanArray:W,validateBoolean:B,validateBuffer:G,validateDictionary:U,validateEncoding:H,validateFunction:Q,validateInt32:C,validateInteger:O,validateNumber:L,validateObject:F,validateOneOf:P,validatePlainFunction:Z,validatePort:J,validateSignalName:z,validateString:M,validateUint32:A,validateUndefined:K,validateUnion:X,validateAbortSignal:V,validateLinkHeaderValue:re};},{"../ours/errors":39,"../ours/primordials":40,"../ours/util":41}],38:[function(e,t,r){const n=e("../stream"),i=e("../stream/promises"),o=n.Readable.destroy;t.exports=n.Readable,t.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,t.exports._isUint8Array=n._isUint8Array,t.exports.isDisturbed=n.isDisturbed,t.exports.isErrored=n.isErrored,t.exports.isReadable=n.isReadable,t.exports.Readable=n.Readable,t.exports.Writable=n.Writable,t.exports.Duplex=n.Duplex,t.exports.Transform=n.Transform,t.exports.PassThrough=n.PassThrough,t.exports.addAbortSignal=n.addAbortSignal,t.exports.finished=n.finished,t.exports.destroy=n.destroy,t.exports.destroy=o,t.exports.pipeline=n.pipeline,t.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get:()=>i}),t.exports.Stream=n.Stream,t.exports.default=t.exports;},{"../stream":42,"../stream/promises":43}],39:[function(e,t,r){const{format:n,inspect:i,AggregateError:o}=e("./util"),a=globalThis.AggregateError||o,s=Symbol("kIsNodeError"),l=["string","function","number","object","Function","Object","boolean","bigint","symbol"],u=/^([A-Z][a-z0-9]*)+$/,c="__node_internal_",d={};function h(e,t){if(!e)throw new d.ERR_INTERNAL_ASSERTION(t)}function f(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return `${e.slice(0,r)}${t}`}function p(e,t,r){if("function"==typeof t)return h(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const i=(t.match(/%[dfijoOs]/g)||[]).length;return h(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),0===r.length?t:n(t,...r)}function m(e,t,r){r||(r=Error);class n extends r{constructor(...r){super(p(e,t,r));}toString(){return `${this.name} [${e}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return `${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=e,n.prototype[s]=!0,d[e]=n;}function y(e){const t=c+e.name;return Object.defineProperty(e,"name",{value:t}),e}function g(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new a([t,e],t.message);return r.code=t.code,r}return e||t}class v extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new d.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError";}}m("ERR_ASSERTION","%s",Error),m("ERR_INVALID_ARG_TYPE",((e,t,r)=>{h("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=`${e} `:n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";const o=[],a=[],s=[];for(const e of t)h("string"==typeof e,"All expected entries have to be of type string"),l.includes(e)?o.push(e.toLowerCase()):u.test(e)?a.push(e):(h("object"!==e,'The value "object" should be written as "Object"'),s.push(e));if(a.length>0){const e=o.indexOf("object");-1!==e&&(o.splice(o,e,1),a.push("Object"));}if(o.length>0){switch(o.length){case 1:n+=`of type ${o[0]}`;break;case 2:n+=`one of type ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();n+=`one of type ${o.join(", ")}, or ${e}`;}}(a.length>0||s.length>0)&&(n+=" or ");}if(a.length>0){switch(a.length){case 1:n+=`an instance of ${a[0]}`;break;case 2:n+=`an instance of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();n+=`an instance of ${a.join(", ")}, or ${e}`;}}s.length>0&&(n+=" or ");}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=`${s[0]}`;break;case 2:n+=`one of ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();n+=`one of ${s.join(", ")}, or ${e}`;}}if(null==r)n+=`. Received ${r}`;else if("function"==typeof r&&r.name)n+=`. Received function ${r.name}`;else if("object"==typeof r){var c;null!==(c=r.constructor)&&void 0!==c&&c.name?n+=`. Received an instance of ${r.constructor.name}`:n+=`. Received ${i(r,{depth:-1})}`;}else {let e=i(r,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),n+=`. Received type ${typeof r} (${e})`;}return n}),TypeError),m("ERR_INVALID_ARG_VALUE",((e,t,r="is invalid")=>{let n=i(t);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`}),TypeError),m("ERR_INVALID_RETURN_VALUE",((e,t,r)=>{var n;return `Expected ${e} to be returned from the "${t}" function but got ${null!=r&&null!==(n=r.constructor)&&void 0!==n&&n.name?`instance of ${r.constructor.name}`:"type "+typeof r}.`}),TypeError),m("ERR_MISSING_ARGS",((...e)=>{let t;h(e.length>0,"At least one arg needs to be specified");const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`;}}return `${t} must be specified`}),TypeError),m("ERR_OUT_OF_RANGE",((e,t,r)=>{let n;return h(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>2**32?n=f(String(r)):"bigint"==typeof r?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=f(n)),n+="n"):n=i(r),`The value of "${e}" is out of range. It must be ${t}. Received ${n}`}),RangeError),m("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),m("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),m("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),m("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),m("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),m("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),m("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),m("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),m("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),m("ERR_STREAM_WRITE_AFTER_END","write after end",Error),m("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),t.exports={AbortError:v,aggregateTwoErrors:y(g),hideStackFrames:y,codes:d};},{"./util":41}],40:[function(e,t,r){t.exports={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,r)=>e.slice(t,r),Error:Error,FunctionPrototypeCall:(e,t,...r)=>e.call(t,...r),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),MathFloor:Math.floor,Number:Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,r)=>Object.defineProperty(e,t,r),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise:Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,r)=>e.then(t,r),PromiseReject:e=>Promise.reject(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String:String,StringPrototypeSlice:(e,t,r)=>e.slice(t,r),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.trim(),Symbol:Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet:(e,t,r)=>e.set(t,r),Uint8Array:Uint8Array};},{}],41:[function(e,t,r){const n=e("buffer"),i=Object.getPrototypeOf((async function(){})).constructor,o=globalThis.Blob||n.Blob,a=void 0!==o?function(e){return e instanceof o}:function(e){return !1};class s extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let r=0;r<e.length;r++)t+=` ${e[r].stack}\n`;super(t),this.name="AggregateError",this.errors=e;}}t.exports={AggregateError:s,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...r){t||(t=!0,e.apply(this,r));}},createDeferredPromise:function(){let e,t;return {promise:new Promise(((r,n)=>{e=r,t=n;})),resolve:e,reject:t}},promisify:e=>new Promise(((t,r)=>{e(((e,...n)=>e?r(e):t(...n)));})),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,(function(...[e,r]){const n=t.shift();return "f"===r?n.toFixed(6):"j"===r?JSON.stringify(n):"s"===r&&"object"==typeof n?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return `"${e}"`;if(!e.includes("`")&&!e.includes("${"))return `\`${e}\``}return `'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return `${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return "{}"}},types:{isAsyncFunction:e=>e instanceof i,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:a},t.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom");},{buffer:15}],42:[function(e,t,r){const{Buffer:n}=e("buffer"),{ObjectDefineProperty:i,ObjectKeys:o,ReflectApply:a}=e("./ours/primordials"),{promisify:{custom:s}}=e("./ours/util"),{streamReturningOperators:l,promiseReturningOperators:u}=e("./internal/streams/operators"),{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=e("./ours/errors"),d=e("./internal/streams/compose"),{pipeline:h}=e("./internal/streams/pipeline"),{destroyer:f}=e("./internal/streams/destroy"),p=e("./internal/streams/end-of-stream"),m=e("./stream/promises"),y=e("./internal/streams/utils"),g=t.exports=e("./internal/streams/legacy").Stream;g.isDisturbed=y.isDisturbed,g.isErrored=y.isErrored,g.isReadable=y.isReadable,g.Readable=e("./internal/streams/readable");for(const w of o(l)){const b=l[w];function _(...e){if(new.target)throw c();return g.Readable.from(a(b,this,e))}i(_,"name",{__proto__:null,value:b.name}),i(_,"length",{__proto__:null,value:b.length}),i(g.Readable.prototype,w,{__proto__:null,value:_,enumerable:!1,configurable:!0,writable:!0});}for(const E of o(u)){const T=u[E];function x(...e){if(new.target)throw c();return a(T,this,e)}i(x,"name",{__proto__:null,value:T.name}),i(x,"length",{__proto__:null,value:T.length}),i(g.Readable.prototype,E,{__proto__:null,value:x,enumerable:!1,configurable:!0,writable:!0});}g.Writable=e("./internal/streams/writable"),g.Duplex=e("./internal/streams/duplex"),g.Transform=e("./internal/streams/transform"),g.PassThrough=e("./internal/streams/passthrough"),g.pipeline=h;const{addAbortSignal:v}=e("./internal/streams/add-abort-signal");g.addAbortSignal=v,g.finished=p,g.destroy=f,g.compose=d,i(g,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>m}),i(h,s,{__proto__:null,enumerable:!0,get:()=>m.pipeline}),i(p,s,{__proto__:null,enumerable:!0,get:()=>m.finished}),g.Stream=g,g._isUint8Array=function(e){return e instanceof Uint8Array},g._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)};},{"./internal/streams/add-abort-signal":20,"./internal/streams/compose":22,"./internal/streams/destroy":23,"./internal/streams/duplex":24,"./internal/streams/end-of-stream":26,"./internal/streams/legacy":28,"./internal/streams/operators":29,"./internal/streams/passthrough":30,"./internal/streams/pipeline":31,"./internal/streams/readable":32,"./internal/streams/transform":34,"./internal/streams/utils":35,"./internal/streams/writable":36,"./ours/errors":39,"./ours/primordials":40,"./ours/util":41,"./stream/promises":43,buffer:15}],43:[function(e,t,r){const{ArrayPrototypePop:n,Promise:i}=e("../ours/primordials"),{isIterable:o,isNodeStream:a,isWebStream:s}=e("../internal/streams/utils"),{pipelineImpl:l}=e("../internal/streams/pipeline"),{finished:u}=e("../internal/streams/end-of-stream");function c(...e){return new i(((t,r)=>{let i,u;const c=e[e.length-1];if(c&&"object"==typeof c&&!a(c)&&!o(c)&&!s(c)){const t=n(e);i=t.signal,u=t.end;}l(e,((e,n)=>{e?r(e):t(n);}),{signal:i,end:u});}))}e("../../lib/stream.js"),t.exports={finished:u,pipeline:c};},{"../../lib/stream.js":42,"../internal/streams/end-of-stream":26,"../internal/streams/pipeline":31,"../internal/streams/utils":35,"../ours/primordials":40}]},{},[10])(10);var Qh=Vh.exports;class Zh{constructor(e,t){this.graphName=e,this.idx=t;}toString(){return `${this.graphName}:${this.idx}`}}class Kh{constructor(e,t){this.tp=e,this.val=t;}toString(){return JSON.stringify(this)}static getRefFromQuad(e){return e.termType===rs.IRI?new Kh(rs.IRI,e.value):e.termType===rs.BlankNode?new Kh(rs.BlankNode,e.value):new Kh(rs.Undefined,"")}}class Xh{async loadDocument(e,t=[]){const r=e.startsWith("http:"),n=e.startsWith("https:");if(!r&&!n)throw new rl('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:e});let i=null;const{res:o,body:a}=await rf({url:e}),s={contextUrl:void 0,documentUrl:e,document:a||null};if(o.status>=400)throw new rl(`URL "${e}" could not be dereferenced: ${o.statusText}`,"jsonld.InvalidUrl",{code:"loading document failed",url:e,httpStatusCode:o.status});const l=o.headers.get("link");let u=o.headers.get("location");const c=o.headers.get("content-type");if(l&&"application/ld+json"!==c&&"application/json"!==c){const t=hl.parseLinkHeader(l),r=t[vl.LINK_HEADER_CONTEXT];if(Array.isArray(r))throw new rl("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:e});r&&(s.contextUrl=r.target),i=t.alternate,i&&"application/ld+json"==i.type&&!(c||"").match(/^application\/(\w*\+)?json$/)&&(u=El.prependBase(e,i.target));}if((i||o.status>=300&&o.status<400)&&u){if(-1===t.length)throw new rl("URL could not be dereferenced; there were too many redirects.","jsonld.TooManyRedirects",{code:"loading document failed",url:e,httpStatusCode:o.status,redirects:t});if(-1!==t.indexOf(e))throw new rl("URL could not be dereferenced; infinite redirection was detected.","jsonld.InfiniteRedirectDetected",{code:"recursive context inclusion",url:e,httpStatusCode:o.status,redirects:t});t.push(e);const r=new URL(u,e).href;return this.loadDocument(r,t)}return t.push(e),s}}const ef="cat";async function tf(e,t,r){if(!t&&!r)throw new rl("IPFS is not configured","jsonld.IPFSNotConfigured",{code:"loading document failed",url:nf+e});return null!==t?await async function(e,t){const r=new URL(function(e,t){const r="/api/v0";for(;e.endsWith("/");)e=e.slice(0,-1);return e.endsWith(r)||(e+=r),e+"/"+t}(t,ef));r.searchParams.append("arg",e);const{res:n,body:i}=await rf({url:r,method:"POST"});if(200!=n.status)throw new Error(`Error calling IPFS node: [${n.status}] ${n.statusText}\n${i}`);return {contextUrl:void 0,document:i||null,documentUrl:nf+e}}(e,t):await async function(e,t){const r=new Xh,n=await r.loadDocument(function(e,t){return function(e){for(;e.endsWith("/");)e=e.slice(0,-1);return e}(e)+"/ipfs/"+function(e){for(;e.startsWith("/");)e=e.slice(1);return e}(t)}(t,e),[]);return n.contextUrl=null,n.documentUrl=nf+e,n}(e,r)}async function rf({url:e,method:t}){const r={};void 0!==t&&(r.method=t);try{(e=new URL(e)).username&&e.password&&(r.headers={...r.headers??{},authorization:`Basic ${btoa(e.username+":"+e.password)}`},e=function(e){const t=new URL(e);return t.username="",t.password="",t.href}(e));const t=await fetch(e,r);if(t.status>=300&&t.status<400)return {res:t,body:null};const n=await t.text();return n&&n.length>0&&n.startsWith("{")?{res:t,body:JSON.parse(n)}:{res:t,body:n}}catch(t){if(t.response)return {res:t.response,body:null};throw new rl("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:e,cause:t})}}const nf="ipfs://";function of(e){return e?.hasher??a}function af(e){const t=e?.ipfsNodeURL??null,r=e?.ipfsGatewayURL??null;return e?.documentLoader??((e=null,t=null)=>async r=>{if(r.startsWith(nf)){const n=r.slice(nf.length);return await tf(n,e,t)}return (new Xh).loadDocument(r,[])})(t,r)}class sf{constructor(e=new Map){this.graphs=e;}static async fromDocument(e,t=af()){const r=await Hh.canonize(e,{format:i.QUADS_FORMAT,documentLoader:t}),n=new Qh.Parser({format:i.QUADS_FORMAT}).parse(r),o=new sf;for(const e of n){const t=e.graph.termType===i.DEFAULT_GRAPH_TERM_TYPE?i.DEFAULT_GRAPH_NODE_NAME:e.graph.value,r=o.graphs.get(t)??[];r.push(e),o.graphs.set(t,r);}return o}static getQuad(e,t){const r=e.graphs.get(t.graphName);if(!r)throw i.ERRORS.GRAPH_NOT_FOUND;if(t.idx>=r.length)throw i.ERRORS.QUAD_NOT_FOUND;return r[t.idx]}static iterGraphsOrdered(e,t){const r=[];for(const t of e.graphs.keys())r.push(t);r.sort(((e,t)=>e.localeCompare(t)));for(const n of r){t(n,e.graphs.get(n));}}static findParent(e,t){const r=sf.findParentInsideGraph(e,t);return r||sf.findGraphParent(e,t)}static findParentInsideGraph(e,t){const r=os(t);let n;const o=e.graphs.get(r);if(!o)return;const a=Kh.getRefFromQuad(t.subject);if(a.tp===rs.Undefined)return;let s=!1;for(let e=0;e<o.length;e++){const l=o[e];if(l.equals(t))continue;const u=Kh.getRefFromQuad(l.object);if(u.tp!==rs.Undefined&&(a?.tp===u?.tp&&a?.val===u?.val)){if(s)throw i.ERRORS.MULTIPLE_PARENTS_FOUND;s=!0,n=new Zh(r,e);}}return n}static findGraphParent(e,t){if(!t.graph)return;const r=Kh.getRefFromQuad(t.graph);if(r.tp===rs.Undefined)return;if(r.tp!==rs.BlankNode)throw new Error("graph parent can only be a blank node");let n,o=!1;for(const[a,s]of e.graphs)for(let e=0;e<s.length;e++){const l=s[e];if(l.equals(t))continue;const u=Kh.getRefFromQuad(l.object);if(u.tp!==rs.Undefined&&r.toString()==u.toString()){if(o)throw i.ERRORS.MULTIPLE_PARENTS_FOUND;o=!0,n=new Zh(a,e);}}if(o)return n;throw i.ERRORS.PARENT_NOT_FOUND}}sf.assertDatasetConsistency=e=>{for(const[t,r]of e.graphs)for(const e of r){if(!t)throw new Error("empty graph name");if(t===i.DEFAULT_GRAPH_NODE_NAME&&e.graph.id)throw new Error("graph should be nil for @default graph");if(!e.graph.id&&t!==i.DEFAULT_GRAPH_NODE_NAME)throw new Error("graph should not be nil for non-@default graph")}};class lf{constructor(e=[],t=a){this.parts=e,this.hasher=t;}reverse(){return this.parts.reverse()}append(e){this.parts=[...this.parts,...e];}prepend(e){this.parts=[...e,...this.parts];}async mtEntry(){const e=this.hasher??a,t=new Array(this.parts.length).fill(BigInt(0));for(let r=0;r<this.parts.length;r+=1){const n=this.parts[r];if("string"==typeof n){const i=ss.encode(n);t[r]=await e.hashBytes(i);}else {if("number"!=typeof n)throw new Error("error: unexpected type "+typeof n);t[r]=BigInt(n);}}return e.hash(t)}async pathFromContext(e,t,r){const n=JSON.parse(e);if(!n["@context"])throw i.ERRORS.CONTEXT_NOT_DEFINED;const o={documentLoader:af(r)},a=await Hh.processContext(null,null,o);let s=await Hh.processContext(a,n,o);const l=t.split(".");for(const e in l){const t=l[e];if(i.DIGITS_ONLY_REGEX.test(t))this.parts.push(parseInt(t));else {const e=s.mappings.get(t);if("object"!=typeof e)throw i.ERRORS.TERM_IS_NOT_DEFINED;const r=e["@id"];if(!r)throw i.ERRORS.NO_ID_ATTR;e["@context"]&&(s=await Hh.processContext(s,e,o)),this.parts.push(r);}}}async typeFromContext(e,t,r){const n=JSON.parse(e);if(!("@context"in n))throw i.ERRORS.PARSED_CONTEXT_IS_NULL;const o={documentLoader:af(r)},a=await Hh.processContext(null,null,o);let s=await Hh.processContext(a,n,o);const l=t.split(".");for(const e in l){const t=uf(s,l[e]);t.hasContext&&(s=await Hh.processContext(s,t.typeDef,o)),this.parts.push(t["@id"]);}return lf.getTypeMapping(s,l[l.length-1])}static getTypeMapping(e,t){let r="";const n=e.mappings.get("@type");n&&(r=n);const i=e.mappings.get(t);return i&&i["@type"]&&(r=i["@type"]),r}static async pathFromDocument(e,t,r,n,o){if(0===r.length)return [];const a=r[0],s=r.slice(1),l={documentLoader:af(o)};if(i.DIGITS_ONLY_REGEX.test(a)){return [parseInt(a),...await lf.pathFromDocument(e,t,s,!0,o)]}if("object"!=typeof t)throw new Error("error: expected type object got "+typeof t);if(Array.isArray(t)){if(!t.length)throw new Error("error: can't generate path on zero-sized array");if(!n)throw i.ERRORS.UNEXPECTED_ARR_ELEMENT;return lf.pathFromDocument(e,t[0],r,!1,o)}if("@context"in t)if(e)e=await Hh.processContext(e,t,l);else {const r=await Hh.processContext(null,null,l);e=await Hh.processContext(r,t,l);}const u=as(Object.keys(t)),c=e;for(const r in u){const n=u[r];if("@type"!==n){const t=e.mappings.get(n);if("object"!=typeof t)continue;if("@type"!==t["@id"])continue}let i=[];if(Array.isArray(t[n]))t[n].forEach((e=>{if("string"!=typeof e)throw new Error("error: @type value must be an array of strings: "+typeof e);i.push(e),i=as(i);}));else {if("string"!=typeof t[n])throw new Error("error: unexpected @type field type: "+typeof t[n]);i.push(t[n]);}for(const t of i){const r=c.mappings.get(t);"object"==typeof r&&"@context"in r&&(e=await Hh.processContext(e,r,l));}break}const d=uf(e,a);if(d.hasContext)if(e)e=await Hh.processContext(e,d.typeDef,l);else {const t=await Hh.processContext(null,null,l);e=await Hh.processContext(t,d.typeDef,l);}const h=await lf.pathFromDocument(e,t[a],s,!0,o);return [d["@id"],...h]}static async newPathFromCtx(e,t,r){const n=new lf([],of(r));return await n.pathFromContext(e,t,r),n}static async fromDocument(e,t,r,n){const o=JSON.parse(t),a=r.split(".");if(0===a.length)throw i.ERRORS.FIELD_PATH_IS_EMPTY;const s=await lf.pathFromDocument(e,o,a,!1,n);return new lf(s,of(n))}static async newTypeFromContext(e,t,r){const n=new lf([],of(r));return await n.typeFromContext(e,t,r)}static async getTypeIDFromContext(e,t,r){const n=JSON.parse(e),i={documentLoader:af(r)},o=await Hh.processContext(null,null,i),a=(await Hh.processContext(o,n,i)).mappings.get(t);if(!a)throw new Error(`looks like ${t} is not a type`);const s=a["@id"];if(!s)throw new Error(`@id attribute is not found for type ${t}`);if("string"!=typeof s)throw new Error(`@id attribute is not a string for type ${t}`);return s}}function uf(e,t){const r=e.mappings.get(t);if("object"!=typeof r)throw i.ERRORS.TERM_IS_NOT_DEFINED;const n=r["@id"];if(!n)throw i.ERRORS.NO_ID_ATTR;if("string"!=typeof n)throw new Error("error: @id attr is not of type string: "+typeof n);return {"@id":n,hasContext:"@context"in r,typeDef:r}}lf.newPath=e=>{const t=new lf;return t.append(e),t},lf.getContextPathKey=async(e,t,r,n)=>{if(""===t)throw i.ERRORS.CTX_TYP_IS_EMPTY;if(""===r)throw i.ERRORS.FIELD_PATH_IS_EMPTY;const o=await lf.newPathFromCtx(e,`${t}.${r}`,n),a=await lf.newPathFromCtx(e,t,n);return new lf(o.parts.slice(a.parts.length))};class cf{constructor(e){this.graph=os(e);const t=e.subject;switch(t.termType){case rs.IRI:this.subject={tp:rs.IRI,val:t.value};break;case rs.BlankNode:this.subject={tp:rs.BlankNode,val:t.value};break;default:throw new Error("invalid subject type")}if(e.predicate.termType!==rs.IRI)throw new Error("invalid predicate type");this.predicate=e.predicate.value;}toString(){return JSON.stringify(this)}}cf.countEntries=e=>{const t=new Map;for(const r of e){const e=new cf(r);let n=t.get(e.toString())??0;t.set(e.toString(),++n);}return t};class df{constructor(e=new Map,t=new Map,r=a){this.parents=e,this.children=t,this.hasher=r;}static getIriValue(e){if(e.predicate.termType===rs.IRI)return e.predicate.value;throw new Error("type is not IRI")}path(e,t,r){const n=new lf([],this.hasher);"number"==typeof r&&n.append([r]);const i=sf.getQuad(t,e),o=df.getIriValue(i);n.append([o]);let a=e;for(;;){const e=this.parents.get(a.toString());if(!e)break;const r=sf.getQuad(t,e),i=new cf(r),o=this.children.get(i.toString());if(!o)throw new Error("parent mapping not found");const s=sf.getQuad(t,a),l=Kh.getRefFromQuad(s.subject),u=o.get(l.toString());if("number"!=typeof u)throw new Error("child not found in parents mapping");const c=df.getIriValue(r);1===o.size?n.append([c]):n.append([u,c]),a=e;}return n.reverse(),n}static async newRelationship(e,t){const r=new df(new Map,new Map,t);return sf.iterGraphsOrdered(e,((t,n)=>{for(let i=0;i<n.length;i++){const o=n[i],a=sf.findParent(e,o);if(!a)continue;const s=new Zh(t,i);r.parents.set(s.toString(),a);const l=sf.getQuad(e,a),u=new cf(l);let c=r.children.get(u.toString());c||(c=new Map,r.children.set(u.toString(),c));const d=Kh.getRefFromQuad(o.subject);if("number"!=typeof c.get(d.toString())){const e=c.size;c.set(d.toString(),e);}}})),r}}class hf{constructor(e,t,r="",n=a){if(this.key=e,this.value=t,this.dataType=r,this.hasher=n,!e.parts.length)throw new Error("key length is zero");(e=>{switch(typeof e){case"boolean":case"string":case"bigint":case"number":return;case"object":if(e instanceof es.Instant)return}throw new Error(`unexpected value type ${typeof e}, expected boolean | number | Temporal.Instant | string`)})(t);}getHasher(){return this.hasher}getKeyMtEntry(){return this.key.mtEntry()}getValueMtEntry(){return hs.mkValueMtEntry(this.getHasher(),this.value)}async getKeyValueMTEntry(){return {k:await this.getKeyMtEntry(),v:await this.getValueMtEntry()}}static async fromDataSet(e,t=a){sf.assertDatasetConsistency(e);if(!e.graphs.get(i.DEFAULT_GRAPH_NODE_NAME).length)throw new Error("@default graph not found in dataset");const r=await df.newRelationship(e,t),n=[];return sf.iterGraphsOrdered(e,((i,o)=>{const a=cf.countEntries(o),s=new Map;for(let l=0;l<o.length;l++){let u="";const c=o[l],d=new Zh(i,l),h=new cf(c);let f;const p=c.object.termType,m=c.object.value;switch(p){case rs.Literal:u=c?.object?.datatype?.value,f=us(u,m,t.prime());break;case rs.IRI:if(!p)throw new Error("object IRI is nil");f=m;break;case rs.BlankNode:if(r.children.get(h.toString()))continue;throw new Error("BlankNode is not supported yet");case"Variable":f=m;break;default:throw new Error("unexpected Quad's Object type")}let y;switch(a.get(h.toString())){case 0:throw new Error("[assertion] key not found in counts");case 1:break;default:const e=h.toString();y=s.get(e)??0,s.set(e,y+1);}const g=r.path(d,e,y),v=new hf(g,f,u,t);n.push(v);}})),n}}hf.newRDFEntry=(e,t)=>{const r=new hf(e,t);switch(typeof t){case"number":case"string":case"boolean":r.value=t;break;default:if(!(t instanceof es.Instant))throw new Error("error: incorrect value type "+typeof t);r.value=t;}return r};class ff{constructor(e=null,i=null,o=a,s=new Map,l=null,u=af()){if(this.srcDoc=e,this.mt=i,this.hasher=o,this.entries=s,this.compacted=l,this.documentLoader=u,!i){const{db:e,writable:i,maxLevels:o}=((e="",n=!0,i=40)=>({db:new j$1(B$2(e)),writable:n,maxLevels:i}))();this.mt=new Jt$1(e,i,o);}}async proof(e){const t=await e.mtEntry(),{proof:r}=await this.mt.generateProof(t);if(r.existence){if(!this.entries.has(t.toString()))throw new Error("error: [assertion] no entry found while existence is true");const e=this.entries.get(t.toString());return {proof:r,value:new hs(e.value,this.hasher)}}return {proof:r}}mkValue(e){return new hs(e,this.hasher)}async resolveDocPath(e,t){const r=await lf.fromDocument(null,this.srcDoc,e,t);return r.hasher=this.hasher,r}async entry(e){const t=await e.mtEntry(),r=this.entries.get(t.toString());if(!r)throw new Error("entry not found");return r}async jsonLDType(e){return (await this.entry(e)).dataType}async root(){return this.mt.root()}rawValue(e){let t=e.parts,r=this.compacted;const n=[];for(;t.length>0;){const e=t[0];if("string"==typeof e){if(n.push(e),r=r[e]??r["@graph"][e],!r)throw new Error("value not found")}else {if("number"!=typeof e)throw new Error(`unexpected type of path ${n.join(" / ")}`);n.push(e.toString()),r=this.rvExtractArrayIdx(r,e);}t=t.slice(1);}return void 0!==r["@value"]?r["@value"]:r}rvExtractArrayIdx(e,t){if(!Array.isArray(e))throw new Error("expected array");if(t<0||t>=e.length)throw new Error("index is out of range");return e[t]}static async merklizeJSONLD(e,t){const r=of(t),n=af(t),i=new ff(e,null,r,new Map,null,n),o=JSON.parse(i.srcDoc),a=await sf.fromDocument(o,n),s=await hf.fromDataSet(a,r);for(const e of s){const t=await e.getKeyMtEntry();i.entries.set(t.toString(),e);}return await(async(e,t)=>{for(const r of t){const{k:t,v:n}=await r.getKeyValueMTEntry();await e.add(t,n);}})(i.mt,s),i.compacted=await Hh.compact(o,{},{documentLoader:n,base:null,compactArrays:!0,compactToRelative:!0}),i}static async hashValue(e,t){return this.hashValueWithHasher(a,e,t)}static async hashValueWithHasher(e,t,r){const n=((e,t)=>{const r=t===ns.Double;switch(typeof e){case"string":return r?is(parseFloat(e)):e;case"boolean":return `${e}`;case"number":return r?is(e):`${e}`;default:throw new Error("unsupported type")}})(r,t),i=us(t,n,e.prime());return await hs.mkValueMtEntry(e,i)}get options(){return {hasher:this.hasher,documentLoader:this.documentLoader}}}
|
|
8125
8128
|
|
|
8126
8129
|
var index = /*#__PURE__*/Object.freeze({
|
|
8127
8130
|
__proto__: null,
|
|
@@ -30520,12 +30523,27 @@ var PolygonIdSdk = (function (exports) {
|
|
|
30520
30523
|
* @returns Promise<DocumentLoader>
|
|
30521
30524
|
*/
|
|
30522
30525
|
const doc = JSON.parse(VerifiableConstants.JSONLD_SCHEMA.W3C_VC_DOCUMENT_2018);
|
|
30526
|
+
const docIden3Proofs = JSON.parse(VerifiableConstants.JSONLD_SCHEMA.IDEN3_PROOFS_DEFINITION_DOCUMENT);
|
|
30527
|
+
const docIden3DisplayMethod = JSON.parse(VerifiableConstants.JSONLD_SCHEMA.IDEN3_DISPLAY_METHOD_DEFINITION_DOCUMENT);
|
|
30528
|
+
const docIden3AuthBJJ = JSON.parse(VerifiableConstants.AUTH.AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD);
|
|
30523
30529
|
const cacheLoader = (opts) => {
|
|
30524
30530
|
const cache = new Map();
|
|
30525
30531
|
cache.set(VerifiableConstants.JSONLD_SCHEMA.W3C_CREDENTIAL_2018, {
|
|
30526
30532
|
document: doc,
|
|
30527
30533
|
documentUrl: VerifiableConstants.JSONLD_SCHEMA.W3C_CREDENTIAL_2018
|
|
30528
30534
|
});
|
|
30535
|
+
cache.set(VerifiableConstants.JSONLD_SCHEMA.IDEN3_CREDENTIAL, {
|
|
30536
|
+
document: docIden3Proofs,
|
|
30537
|
+
documentUrl: VerifiableConstants.JSONLD_SCHEMA.IDEN3_PROOFS_DEFINITION_DOCUMENT
|
|
30538
|
+
});
|
|
30539
|
+
cache.set(VerifiableConstants.JSONLD_SCHEMA.IDEN3_DISPLAY_METHOD, {
|
|
30540
|
+
document: docIden3DisplayMethod,
|
|
30541
|
+
documentUrl: VerifiableConstants.JSONLD_SCHEMA.IDEN3_DISPLAY_METHOD_DEFINITION_DOCUMENT
|
|
30542
|
+
});
|
|
30543
|
+
cache.set(VerifiableConstants.AUTH.AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD_URL, {
|
|
30544
|
+
document: docIden3AuthBJJ,
|
|
30545
|
+
documentUrl: VerifiableConstants.AUTH.AUTH_BJJ_CREDENTIAL_SCHEMA_JSONLD
|
|
30546
|
+
});
|
|
30529
30547
|
return async (url) => {
|
|
30530
30548
|
let remoteDoc = cache.get(url);
|
|
30531
30549
|
if (remoteDoc) {
|
|
@@ -58513,7 +58531,9 @@ var PolygonIdSdk = (function (exports) {
|
|
|
58513
58531
|
// DiscoveryProtocolQueriesMessageType is type for didcomm discovery protocol queries
|
|
58514
58532
|
DISCOVERY_PROTOCOL_QUERIES_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}discover-features/2.0/queries`,
|
|
58515
58533
|
// DiscoveryProtocolDiscloseMessageType is type for didcomm discovery protocol disclose
|
|
58516
|
-
DISCOVERY_PROTOCOL_DISCLOSE_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}discover-features/2.0/disclose
|
|
58534
|
+
DISCOVERY_PROTOCOL_DISCLOSE_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}discover-features/2.0/disclose`,
|
|
58535
|
+
// ProblemReportMessageType is type for didcomm problem report
|
|
58536
|
+
PROBLEM_REPORT_MESSAGE_TYPE: `${DIDCOMM_PROTOCOL}report-problem/2.0/problem-report`
|
|
58517
58537
|
});
|
|
58518
58538
|
/**
|
|
58519
58539
|
* Media types for iden3 comm communication protocol
|
|
@@ -82927,6 +82947,33 @@ var PolygonIdSdk = (function (exports) {
|
|
|
82927
82947
|
}
|
|
82928
82948
|
}
|
|
82929
82949
|
|
|
82950
|
+
/**
|
|
82951
|
+
* @beta
|
|
82952
|
+
* createProblemReportMessage is a function to create didcomm protocol problem report message
|
|
82953
|
+
* @param pthid - parent thread id
|
|
82954
|
+
* @param code - problem report code
|
|
82955
|
+
* @param opts - problem report options
|
|
82956
|
+
* @returns `ProblemReportMessage`
|
|
82957
|
+
*/
|
|
82958
|
+
function createProblemReportMessage(pthid, code, opts) {
|
|
82959
|
+
const uuidv4 = v4();
|
|
82960
|
+
return {
|
|
82961
|
+
id: uuidv4,
|
|
82962
|
+
pthid: pthid,
|
|
82963
|
+
typ: MediaType.PlainMessage,
|
|
82964
|
+
type: PROTOCOL_MESSAGE_TYPE.PROBLEM_REPORT_MESSAGE_TYPE,
|
|
82965
|
+
ack: opts?.ack,
|
|
82966
|
+
body: {
|
|
82967
|
+
code: code,
|
|
82968
|
+
comment: opts?.comment,
|
|
82969
|
+
args: opts?.args,
|
|
82970
|
+
escalate_to: opts?.escalate_to
|
|
82971
|
+
},
|
|
82972
|
+
from: opts?.from,
|
|
82973
|
+
to: opts?.to
|
|
82974
|
+
};
|
|
82975
|
+
}
|
|
82976
|
+
|
|
82930
82977
|
const allOperations = Object.values(QueryOperators);
|
|
82931
82978
|
const v2Operations = [
|
|
82932
82979
|
exports.Operators.NOOP,
|
|
@@ -85110,6 +85157,7 @@ var PolygonIdSdk = (function (exports) {
|
|
|
85110
85157
|
exports.createDiscoveryFeatureQueryMessage = createDiscoveryFeatureQueryMessage;
|
|
85111
85158
|
exports.createPayment = createPayment;
|
|
85112
85159
|
exports.createPaymentRequest = createPaymentRequest;
|
|
85160
|
+
exports.createProblemReportMessage = createProblemReportMessage;
|
|
85113
85161
|
exports.createProposal = createProposal;
|
|
85114
85162
|
exports.createProposalRequest = createProposalRequest;
|
|
85115
85163
|
exports.createSchemaHash = createSchemaHash;
|