@learncard/react 2.3.17 → 2.3.18

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.
@@ -143367,232 +143367,6 @@ var require_src3 = __commonJS({
143367
143367
  };
143368
143368
  }
143369
143369
  });
143370
- var require_erc20_abi = __commonJS({
143371
- "src/wallet/plugins/EthereumPlugin/erc20.abi.json"(exports, module) {
143372
- module.exports = [
143373
- {
143374
- constant: true,
143375
- inputs: [],
143376
- name: "name",
143377
- outputs: [
143378
- {
143379
- name: "",
143380
- type: "string"
143381
- }
143382
- ],
143383
- payable: false,
143384
- stateMutability: "view",
143385
- type: "function"
143386
- },
143387
- {
143388
- constant: false,
143389
- inputs: [
143390
- {
143391
- name: "_spender",
143392
- type: "address"
143393
- },
143394
- {
143395
- name: "_value",
143396
- type: "uint256"
143397
- }
143398
- ],
143399
- name: "approve",
143400
- outputs: [
143401
- {
143402
- name: "",
143403
- type: "bool"
143404
- }
143405
- ],
143406
- payable: false,
143407
- stateMutability: "nonpayable",
143408
- type: "function"
143409
- },
143410
- {
143411
- constant: true,
143412
- inputs: [],
143413
- name: "totalSupply",
143414
- outputs: [
143415
- {
143416
- name: "",
143417
- type: "uint256"
143418
- }
143419
- ],
143420
- payable: false,
143421
- stateMutability: "view",
143422
- type: "function"
143423
- },
143424
- {
143425
- constant: false,
143426
- inputs: [
143427
- {
143428
- name: "_from",
143429
- type: "address"
143430
- },
143431
- {
143432
- name: "_to",
143433
- type: "address"
143434
- },
143435
- {
143436
- name: "_value",
143437
- type: "uint256"
143438
- }
143439
- ],
143440
- name: "transferFrom",
143441
- outputs: [
143442
- {
143443
- name: "",
143444
- type: "bool"
143445
- }
143446
- ],
143447
- payable: false,
143448
- stateMutability: "nonpayable",
143449
- type: "function"
143450
- },
143451
- {
143452
- constant: true,
143453
- inputs: [],
143454
- name: "decimals",
143455
- outputs: [
143456
- {
143457
- name: "",
143458
- type: "uint8"
143459
- }
143460
- ],
143461
- payable: false,
143462
- stateMutability: "view",
143463
- type: "function"
143464
- },
143465
- {
143466
- constant: true,
143467
- inputs: [
143468
- {
143469
- name: "_owner",
143470
- type: "address"
143471
- }
143472
- ],
143473
- name: "balanceOf",
143474
- outputs: [
143475
- {
143476
- name: "balance",
143477
- type: "uint256"
143478
- }
143479
- ],
143480
- payable: false,
143481
- stateMutability: "view",
143482
- type: "function"
143483
- },
143484
- {
143485
- constant: true,
143486
- inputs: [],
143487
- name: "symbol",
143488
- outputs: [
143489
- {
143490
- name: "",
143491
- type: "string"
143492
- }
143493
- ],
143494
- payable: false,
143495
- stateMutability: "view",
143496
- type: "function"
143497
- },
143498
- {
143499
- constant: false,
143500
- inputs: [
143501
- {
143502
- name: "_to",
143503
- type: "address"
143504
- },
143505
- {
143506
- name: "_value",
143507
- type: "uint256"
143508
- }
143509
- ],
143510
- name: "transfer",
143511
- outputs: [
143512
- {
143513
- name: "",
143514
- type: "bool"
143515
- }
143516
- ],
143517
- payable: false,
143518
- stateMutability: "nonpayable",
143519
- type: "function"
143520
- },
143521
- {
143522
- constant: true,
143523
- inputs: [
143524
- {
143525
- name: "_owner",
143526
- type: "address"
143527
- },
143528
- {
143529
- name: "_spender",
143530
- type: "address"
143531
- }
143532
- ],
143533
- name: "allowance",
143534
- outputs: [
143535
- {
143536
- name: "",
143537
- type: "uint256"
143538
- }
143539
- ],
143540
- payable: false,
143541
- stateMutability: "view",
143542
- type: "function"
143543
- },
143544
- {
143545
- payable: true,
143546
- stateMutability: "payable",
143547
- type: "fallback"
143548
- },
143549
- {
143550
- anonymous: false,
143551
- inputs: [
143552
- {
143553
- indexed: true,
143554
- name: "owner",
143555
- type: "address"
143556
- },
143557
- {
143558
- indexed: true,
143559
- name: "spender",
143560
- type: "address"
143561
- },
143562
- {
143563
- indexed: false,
143564
- name: "value",
143565
- type: "uint256"
143566
- }
143567
- ],
143568
- name: "Approval",
143569
- type: "event"
143570
- },
143571
- {
143572
- anonymous: false,
143573
- inputs: [
143574
- {
143575
- indexed: true,
143576
- name: "from",
143577
- type: "address"
143578
- },
143579
- {
143580
- indexed: true,
143581
- name: "to",
143582
- type: "address"
143583
- },
143584
- {
143585
- indexed: false,
143586
- name: "value",
143587
- type: "uint256"
143588
- }
143589
- ],
143590
- name: "Transfer",
143591
- type: "event"
143592
- }
143593
- ];
143594
- }
143595
- });
143596
143370
  if (typeof window === "undefined")
143597
143371
  globalThis.crypto = crypto2;
143598
143372
  var addPluginToWallet = /* @__PURE__ */ __name((wallet, plugin) => __async$1(void 0, null, function* () {
@@ -150613,7 +150387,7 @@ function toUint8Array(str) {
150613
150387
  return new Uint8Array(bytes);
150614
150388
  }
150615
150389
  __name(toUint8Array, "toUint8Array");
150616
- var import_key_did_resolver = __toESM(require_lib());
150390
+ __toESM(require_lib());
150617
150391
  var import_ed255192 = __toESM(require_ed25519(), 1);
150618
150392
  var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify(), 1);
150619
150393
  var B642 = "base64pad";
@@ -155810,836 +155584,1281 @@ var CeramicClient = class {
155810
155584
  }
155811
155585
  };
155812
155586
  __name(CeramicClient, "CeramicClient");
155813
- var getCeramicClientFromWalletSuite = /* @__PURE__ */ __name((wallet, ceramicEndpoint) => __async$1(void 0, null, function* () {
155814
- const client = new CeramicClient(ceramicEndpoint);
155815
- const resolver = __spreadValues({}, import_key_did_resolver.default.getResolver());
155816
- const did = new DID({ resolver });
155817
- client.did = did;
155818
- const key2 = wallet.pluginMethods.getKey();
155819
- const ceramicProvider = new Ed25519Provider(toUint8Array(key2));
155820
- client.did.setProvider(ceramicProvider);
155821
- yield client.did.authenticate();
155822
- return client;
155823
- }), "getCeramicClientFromWalletSuite");
155824
- var getIDXPlugin = /* @__PURE__ */ __name((_0, _1) => __async$1(void 0, [_0, _1], function* (wallet, { modelData, credentialAlias, ceramicEndpoint, defaultContentFamily }) {
155825
- const ceramic = yield getCeramicClientFromWalletSuite(wallet, ceramicEndpoint);
155826
- const loader = new TileLoader({ ceramic });
155827
- const dataStore = new DIDDataStore({ ceramic, model: modelData });
155828
- const getCredentialsListFromIdx = /* @__PURE__ */ __name((..._02) => __async$1(void 0, [..._02], function* (alias = credentialAlias) {
155829
- return (yield dataStore.get(alias)) || { credentials: [] };
155830
- }), "getCredentialsListFromIdx");
155831
- const addCredentialStreamIdToIdx = /* @__PURE__ */ __name((record, alias) => __async$1(void 0, null, function* () {
155832
- if (!record)
155833
- throw new Error("record is required");
155834
- if (!record.id)
155835
- throw Error("No streamId provided");
155836
- if (record.id.indexOf("ceramic://") === -1)
155837
- record.id = "ceramic://" + record.id;
155838
- if (!alias)
155839
- alias = credentialAlias;
155840
- const existing = yield getCredentialsListFromIdx(alias);
155841
- const indexOfExistingCredential = existing.credentials.findIndex((credential) => {
155842
- return credential.title === record.title;
155843
- });
155844
- if (indexOfExistingCredential > -1) {
155845
- existing.credentials[indexOfExistingCredential] = __spreadValues({
155846
- storageType: "ceramic"
155847
- }, record);
155848
- } else
155849
- existing.credentials.push(__spreadValues({ storageType: "ceramic" }, record));
155850
- return dataStore.set(alias, existing);
155851
- }), "addCredentialStreamIdToIdx");
155852
- const removeCredentialFromIdx = /* @__PURE__ */ __name((title, alias) => __async$1(void 0, null, function* () {
155853
- if (!title)
155854
- throw new Error("record is required");
155855
- if (!alias)
155856
- alias = credentialAlias;
155857
- const existing = yield getCredentialsListFromIdx(alias);
155858
- existing.credentials = existing.credentials.filter((credential) => credential.title !== title);
155859
- return dataStore.set(alias, existing);
155860
- }), "removeCredentialFromIdx");
155861
- const publishContentToCeramic = /* @__PURE__ */ __name((_02, ..._12) => __async$1(void 0, [_02, ..._12], function* (content, metadata = {}, options = {}) {
155862
- if (!content)
155863
- throw new Error("content is required");
155864
- if (!metadata.controllers)
155865
- metadata.controllers = [ceramic.did.id];
155866
- if (!metadata.family)
155867
- metadata.family = defaultContentFamily;
155868
- if (!("pin" in options))
155869
- options.pin = true;
155870
- const doc = yield TileDocument.create(ceramic, content, metadata, options);
155871
- return doc.id.toString();
155872
- }), "publishContentToCeramic");
155873
- const readContentFromCeramic = /* @__PURE__ */ __name((streamId) => __async$1(void 0, null, function* () {
155874
- var _a;
155875
- return (_a = yield loader.load(streamId)) == null ? void 0 : _a.content;
155876
- }), "readContentFromCeramic");
155877
- return {
155878
- pluginMethods: {
155879
- getCredentialsListFromIdx: (_02, ..._12) => __async$1(void 0, [_02, ..._12], function* (_wallet, alias = credentialAlias) {
155880
- return getCredentialsListFromIdx(alias);
155881
- }),
155882
- publishContentToCeramic: (_wallet, cred) => __async$1(void 0, null, function* () {
155883
- return publishContentToCeramic(cred);
155884
- }),
155885
- readContentFromCeramic: (_wallet, streamId) => __async$1(void 0, null, function* () {
155886
- return readContentFromCeramic(streamId);
155887
- }),
155888
- getVerifiableCredentialFromIdx: (_wallet, title) => __async$1(void 0, null, function* () {
155889
- var _a;
155890
- const credentialList = yield getCredentialsListFromIdx();
155891
- const credential = (_a = credentialList == null ? void 0 : credentialList.credentials) == null ? void 0 : _a.find((cred) => (cred == null ? void 0 : cred.title) === title);
155892
- return credential && (yield readContentFromCeramic(credential.id));
155893
- }),
155894
- getVerifiableCredentialsFromIdx: () => __async$1(void 0, null, function* () {
155895
- var _a, _b;
155896
- const credentialList = yield getCredentialsListFromIdx();
155897
- const streamIds = (_b = (_a = credentialList == null ? void 0 : credentialList.credentials) == null ? void 0 : _a.map((credential) => credential == null ? void 0 : credential.id)) != null ? _b : [];
155898
- return Promise.all(streamIds.map((streamId) => __async$1(void 0, null, function* () {
155899
- return readContentFromCeramic(streamId);
155900
- })));
155901
- }),
155902
- addVerifiableCredentialInIdx: (_02, _12) => __async$1(void 0, [_02, _12], function* (_wallet, { title, id }) {
155903
- return addCredentialStreamIdToIdx({ title, id });
155904
- }),
155905
- removeVerifiableCredentialInIdx: (_wallet, title) => __async$1(void 0, null, function* () {
155906
- return removeCredentialFromIdx(title);
155907
- })
155908
- }
155909
- };
155910
- }), "getIDXPlugin");
155911
- var ED25519_METHODS = ["key", "tz", "pkh:tz", "pkh:tezos", "pkh:sol", "pkh:solana"];
155912
- var SECP256K1_METHODS = [
155913
- "key",
155914
- "tz",
155915
- "ethr",
155916
- "pkh:tz",
155917
- "pkh:tezos",
155918
- "pkh:eth",
155919
- "pkh:celo",
155920
- "pkh:poly",
155921
- "pkh:btc",
155922
- "pkh:doge",
155923
- "pkh:eip155",
155924
- "pkh:bip122"
155925
- ];
155926
- var isHex = /* @__PURE__ */ __name((str) => /^[0-9a-f]+$/i.test(str), "isHex");
155927
- var getAlgorithmForDidMethod = /* @__PURE__ */ __name((didMethod) => {
155928
- if (ED25519_METHODS.includes(didMethod))
155929
- return "ed25519";
155930
- if (SECP256K1_METHODS.includes(didMethod) || didMethod.startsWith("pkh:eip155:") || didMethod.startsWith("pkh:bip122:")) {
155931
- return "secp256k1";
155932
- }
155933
- throw new Error("Unspported Did Method");
155934
- }, "getAlgorithmForDidMethod");
155935
- var getDidKeyPlugin = /* @__PURE__ */ __name((wallet, key2) => __async$1(void 0, null, function* () {
155936
- if (key2.length === 0)
155937
- throw new Error("Please don't use an empty string for a key!");
155938
- if (!isHex(key2))
155939
- throw new Error("Key must be a hexadecimal string!");
155940
- if (key2.length > 64)
155941
- throw new Error("Key must be less than 64 characters");
155942
- const seed = key2.padStart(64, "0");
155943
- const seedBytes = toUint8Array(seed);
155944
- const memoizedDids = {};
155945
- const keyPairs = {
155946
- ed25519: wallet.pluginMethods.generateEd25519KeyFromBytes(seedBytes),
155947
- secp256k1: wallet.pluginMethods.generateSecp256k1KeyFromBytes(seedBytes)
155948
- };
155949
- return {
155950
- pluginMethods: {
155951
- getSubjectDid: (_wallet, type) => {
155952
- if (!memoizedDids[type]) {
155953
- const algorithm = getAlgorithmForDidMethod(type);
155954
- memoizedDids[type] = wallet.pluginMethods.keyToDid(type, keyPairs[algorithm]);
155955
- }
155956
- return memoizedDids[type];
155957
- },
155958
- getSubjectKeypair: (_wallet, type = "ed25519") => {
155959
- if (!keyPairs[type])
155960
- throw new Error("Unsupported algorithm");
155961
- return keyPairs[type];
155962
- },
155963
- getKey: () => seed
155964
- }
155965
- };
155966
- }), "getDidKeyPlugin");
155967
- var ExpirationPlugin = /* @__PURE__ */ __name((wallet) => ({
155968
- pluginMethods: {
155969
- verifyCredential: (_wallet, credential) => __async$1(void 0, null, function* () {
155970
- const verificationCheck = yield wallet.pluginMethods.verifyCredential(credential);
155971
- if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {
155972
- verificationCheck.errors.push("expiration error: Credential is expired");
155973
- } else {
155974
- verificationCheck.checks.push("expiration");
155975
- }
155976
- return verificationCheck;
155977
- })
155587
+ var wasm;
155588
+ var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
155589
+ cachedTextDecoder.decode();
155590
+ var cachegetUint8Memory0 = null;
155591
+ function getUint8Memory0() {
155592
+ if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
155593
+ cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
155978
155594
  }
155979
- }), "ExpirationPlugin");
155980
- var recycleDependents = /* @__PURE__ */ __name((_methods) => ({}), "recycleDependents");
155981
- var issueCredential = /* @__PURE__ */ __name((initWallet) => {
155982
- return (wallet, credential) => __async$1(void 0, null, function* () {
155983
- const kp = wallet.pluginMethods.getSubjectKeypair();
155984
- if (!kp)
155985
- throw new Error("Cannot issue credential: Could not get subject keypair");
155986
- const options = {
155987
- verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
155988
- proofPurpose: "assertionMethod"
155989
- };
155990
- return initWallet.pluginMethods.issueCredential(credential, options, kp);
155991
- });
155992
- }, "issueCredential");
155993
- var verifyCredential = /* @__PURE__ */ __name((initWallet) => {
155994
- return (_wallet, credential) => __async$1(void 0, null, function* () {
155995
- return initWallet.pluginMethods.verifyCredential(credential);
155996
- });
155997
- }, "verifyCredential");
155998
- var issuePresentation = /* @__PURE__ */ __name((initWallet) => {
155999
- return (wallet, presentation) => __async$1(void 0, null, function* () {
156000
- const kp = wallet.pluginMethods.getSubjectKeypair();
156001
- if (!kp)
156002
- throw new Error("Cannot issue credential: Could not get subject keypair");
156003
- const options = {
156004
- verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
156005
- proofPurpose: "assertionMethod"
156006
- };
156007
- return initWallet.pluginMethods.issuePresentation(presentation, options, kp);
156008
- });
156009
- }, "issuePresentation");
156010
- var verifyPresentation = /* @__PURE__ */ __name((initWallet) => {
156011
- return (_wallet, presentation) => __async$1(void 0, null, function* () {
156012
- return initWallet.pluginMethods.verifyPresentation(presentation);
156013
- });
156014
- }, "verifyPresentation");
156015
- var getVCPlugin = /* @__PURE__ */ __name((wallet) => __async$1(void 0, null, function* () {
156016
- return {
156017
- pluginMethods: __spreadProps(__spreadValues({}, recycleDependents(wallet.pluginMethods)), {
156018
- issueCredential: issueCredential(wallet),
156019
- verifyCredential: verifyCredential(wallet),
156020
- issuePresentation: issuePresentation(wallet),
156021
- verifyPresentation: verifyPresentation(wallet),
156022
- getTestVc: (_wallet, subject = "did:example:d23dd687a7dc6787646f2eb98d0") => {
156023
- const did = _wallet.pluginMethods.getSubjectDid("key");
156024
- return {
156025
- "@context": ["https://www.w3.org/2018/credentials/v1"],
156026
- id: "http://example.org/credentials/3731",
156027
- type: ["VerifiableCredential"],
156028
- issuer: did,
156029
- issuanceDate: "2020-08-19T21:41:50Z",
156030
- credentialSubject: { id: subject }
156031
- };
156032
- },
156033
- getTestVp: (_wallet, _credential) => __async$1(void 0, null, function* () {
156034
- const credential = _credential || (yield _wallet.pluginMethods.issueCredential(_wallet.pluginMethods.getTestVc()));
156035
- const did = _wallet.pluginMethods.getSubjectDid("key");
156036
- return {
156037
- "@context": ["https://www.w3.org/2018/credentials/v1"],
156038
- type: ["VerifiablePresentation"],
156039
- holder: did,
156040
- verifiableCredential: credential
156041
- };
156042
- })
156043
- })
156044
- };
156045
- }), "getVCPlugin");
156046
- var getEthereumPlugin = /* @__PURE__ */ __name((initWallet, config2) => {
156047
- const { address, infuraProjectId, network = "mainnet" } = config2;
156048
- let provider;
156049
- if (infuraProjectId) {
156050
- provider = new InfuraProvider(network, infuraProjectId);
156051
- } else {
156052
- provider = getDefaultProvider(network);
156053
- }
156054
- const checkErc20TokenBalance = /* @__PURE__ */ __name((tokenContractAddress) => __async$1(void 0, null, function* () {
156055
- if (!address) {
156056
- throw new Error("Can't check balance: No address provided.");
156057
- }
156058
- const erc20Abi = require_erc20_abi();
156059
- const contract = new Contract(tokenContractAddress, erc20Abi, provider);
156060
- const balance = yield contract.balanceOf(address);
156061
- const formattedBalance = formatUnits(balance);
156062
- return formattedBalance;
156063
- }), "checkErc20TokenBalance");
155595
+ return cachegetUint8Memory0;
155596
+ }
155597
+ __name(getUint8Memory0, "getUint8Memory0");
155598
+ function getStringFromWasm0(ptr, len) {
155599
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
155600
+ }
155601
+ __name(getStringFromWasm0, "getStringFromWasm0");
155602
+ var heap = new Array(32).fill(void 0);
155603
+ heap.push(void 0, null, true, false);
155604
+ var heap_next = heap.length;
155605
+ function addHeapObject(obj) {
155606
+ if (heap_next === heap.length)
155607
+ heap.push(heap.length + 1);
155608
+ const idx = heap_next;
155609
+ heap_next = heap[idx];
155610
+ heap[idx] = obj;
155611
+ return idx;
155612
+ }
155613
+ __name(addHeapObject, "addHeapObject");
155614
+ function getObject(idx) {
155615
+ return heap[idx];
155616
+ }
155617
+ __name(getObject, "getObject");
155618
+ function dropObject(idx) {
155619
+ if (idx < 36)
155620
+ return;
155621
+ heap[idx] = heap_next;
155622
+ heap_next = idx;
155623
+ }
155624
+ __name(dropObject, "dropObject");
155625
+ function takeObject(idx) {
155626
+ const ret = getObject(idx);
155627
+ dropObject(idx);
155628
+ return ret;
155629
+ }
155630
+ __name(takeObject, "takeObject");
155631
+ var WASM_VECTOR_LEN = 0;
155632
+ var cachedTextEncoder = new TextEncoder("utf-8");
155633
+ var encodeString2 = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
155634
+ return cachedTextEncoder.encodeInto(arg, view);
155635
+ } : function(arg, view) {
155636
+ const buf2 = cachedTextEncoder.encode(arg);
155637
+ view.set(buf2);
156064
155638
  return {
156065
- pluginMethods: {
156066
- checkMyEth: () => __async$1(void 0, null, function* () {
156067
- if (!address) {
156068
- throw new Error("Can't check ETH: No ethereum address provided.");
156069
- }
156070
- const balance = yield provider.getBalance(address);
156071
- const formattedBalance = formatEther(balance);
156072
- return formattedBalance;
156073
- }),
156074
- checkMyDai: () => __async$1(void 0, null, function* () {
156075
- const daiAddress = "0x6B175474E89094C44Da98b954EedeAC495271d0F";
156076
- const daiBalance = yield checkErc20TokenBalance(daiAddress);
156077
- return daiBalance;
156078
- }),
156079
- checkMyUsdc: () => __async$1(void 0, null, function* () {
156080
- const usdcAddress = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
156081
- const usdcBalance = yield checkErc20TokenBalance(usdcAddress);
156082
- return usdcBalance;
156083
- })
156084
- }
155639
+ read: arg.length,
155640
+ written: buf2.length
156085
155641
  };
156086
- }, "getEthereumPlugin");
156087
- var util;
156088
- (function(util2) {
156089
- function assertNever(_x) {
156090
- throw new Error();
155642
+ };
155643
+ function passStringToWasm0(arg, malloc, realloc) {
155644
+ if (realloc === void 0) {
155645
+ const buf2 = cachedTextEncoder.encode(arg);
155646
+ const ptr2 = malloc(buf2.length);
155647
+ getUint8Memory0().subarray(ptr2, ptr2 + buf2.length).set(buf2);
155648
+ WASM_VECTOR_LEN = buf2.length;
155649
+ return ptr2;
156091
155650
  }
156092
- __name(assertNever, "assertNever");
156093
- util2.assertNever = assertNever;
156094
- util2.arrayToEnum = (items) => {
156095
- const obj = {};
156096
- for (const item of items) {
156097
- obj[item] = item;
156098
- }
156099
- return obj;
156100
- };
156101
- util2.getValidEnumValues = (obj) => {
156102
- const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
156103
- const filtered = {};
156104
- for (const k of validKeys) {
156105
- filtered[k] = obj[k];
155651
+ let len = arg.length;
155652
+ let ptr = malloc(len);
155653
+ const mem = getUint8Memory0();
155654
+ let offset = 0;
155655
+ for (; offset < len; offset++) {
155656
+ const code5 = arg.charCodeAt(offset);
155657
+ if (code5 > 127)
155658
+ break;
155659
+ mem[ptr + offset] = code5;
155660
+ }
155661
+ if (offset !== len) {
155662
+ if (offset !== 0) {
155663
+ arg = arg.slice(offset);
156106
155664
  }
156107
- return util2.objectValues(filtered);
156108
- };
156109
- util2.objectValues = (obj) => {
156110
- return util2.objectKeys(obj).map(function(e) {
156111
- return obj[e];
156112
- });
156113
- };
156114
- util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
156115
- const keys = [];
156116
- for (const key2 in object) {
156117
- if (Object.prototype.hasOwnProperty.call(object, key2)) {
156118
- keys.push(key2);
156119
- }
156120
- }
156121
- return keys;
156122
- };
156123
- util2.find = (arr, checker) => {
156124
- for (const item of arr) {
156125
- if (checker(item))
156126
- return item;
156127
- }
156128
- return void 0;
156129
- };
156130
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
156131
- function joinValues(array, separator = " | ") {
156132
- return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
155665
+ ptr = realloc(ptr, len, len = offset + arg.length * 3);
155666
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
155667
+ const ret = encodeString2(arg, view);
155668
+ offset += ret.written;
156133
155669
  }
156134
- __name(joinValues, "joinValues");
156135
- util2.joinValues = joinValues;
156136
- })(util || (util = {}));
156137
- var ZodParsedType = util.arrayToEnum([
156138
- "string",
156139
- "nan",
156140
- "number",
156141
- "integer",
156142
- "float",
156143
- "boolean",
156144
- "date",
156145
- "bigint",
156146
- "symbol",
156147
- "function",
156148
- "undefined",
156149
- "null",
156150
- "array",
156151
- "object",
156152
- "unknown",
156153
- "promise",
156154
- "void",
156155
- "never",
156156
- "map",
156157
- "set"
156158
- ]);
156159
- var getParsedType = /* @__PURE__ */ __name((data) => {
156160
- const t = typeof data;
156161
- switch (t) {
156162
- case "undefined":
156163
- return ZodParsedType.undefined;
156164
- case "string":
156165
- return ZodParsedType.string;
156166
- case "number":
156167
- return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
156168
- case "boolean":
156169
- return ZodParsedType.boolean;
156170
- case "function":
156171
- return ZodParsedType.function;
156172
- case "bigint":
156173
- return ZodParsedType.bigint;
156174
- case "object":
156175
- if (Array.isArray(data)) {
156176
- return ZodParsedType.array;
156177
- }
156178
- if (data === null) {
156179
- return ZodParsedType.null;
156180
- }
156181
- if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
156182
- return ZodParsedType.promise;
156183
- }
156184
- if (typeof Map !== "undefined" && data instanceof Map) {
156185
- return ZodParsedType.map;
156186
- }
156187
- if (typeof Set !== "undefined" && data instanceof Set) {
156188
- return ZodParsedType.set;
156189
- }
156190
- if (typeof Date !== "undefined" && data instanceof Date) {
156191
- return ZodParsedType.date;
156192
- }
156193
- return ZodParsedType.object;
156194
- default:
156195
- return ZodParsedType.unknown;
155670
+ WASM_VECTOR_LEN = offset;
155671
+ return ptr;
155672
+ }
155673
+ __name(passStringToWasm0, "passStringToWasm0");
155674
+ function isLikeNone(x) {
155675
+ return x === void 0 || x === null;
155676
+ }
155677
+ __name(isLikeNone, "isLikeNone");
155678
+ var cachegetInt32Memory0 = null;
155679
+ function getInt32Memory0() {
155680
+ if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
155681
+ cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
156196
155682
  }
156197
- }, "getParsedType");
156198
- var ZodIssueCode = util.arrayToEnum([
156199
- "invalid_type",
156200
- "invalid_literal",
156201
- "custom",
156202
- "invalid_union",
156203
- "invalid_union_discriminator",
156204
- "invalid_enum_value",
156205
- "unrecognized_keys",
156206
- "invalid_arguments",
156207
- "invalid_return_type",
156208
- "invalid_date",
156209
- "invalid_string",
156210
- "too_small",
156211
- "too_big",
156212
- "invalid_intersection_types",
156213
- "not_multiple_of"
156214
- ]);
156215
- var quotelessJson = /* @__PURE__ */ __name((obj) => {
156216
- const json = JSON.stringify(obj, null, 2);
156217
- return json.replace(/"([^"]+)":/g, "$1:");
156218
- }, "quotelessJson");
156219
- var ZodError = class extends Error {
156220
- constructor(issues) {
156221
- super();
156222
- this.issues = [];
156223
- this.addIssue = (sub) => {
156224
- this.issues = [...this.issues, sub];
156225
- };
156226
- this.addIssues = (subs = []) => {
156227
- this.issues = [...this.issues, ...subs];
156228
- };
156229
- const actualProto = new.target.prototype;
156230
- if (Object.setPrototypeOf) {
156231
- Object.setPrototypeOf(this, actualProto);
155683
+ return cachegetInt32Memory0;
155684
+ }
155685
+ __name(getInt32Memory0, "getInt32Memory0");
155686
+ function debugString(val) {
155687
+ const type = typeof val;
155688
+ if (type == "number" || type == "boolean" || val == null) {
155689
+ return `${val}`;
155690
+ }
155691
+ if (type == "string") {
155692
+ return `"${val}"`;
155693
+ }
155694
+ if (type == "symbol") {
155695
+ const description = val.description;
155696
+ if (description == null) {
155697
+ return "Symbol";
156232
155698
  } else {
156233
- this.__proto__ = actualProto;
155699
+ return `Symbol(${description})`;
156234
155700
  }
156235
- this.name = "ZodError";
156236
- this.issues = issues;
156237
155701
  }
156238
- get errors() {
156239
- return this.issues;
155702
+ if (type == "function") {
155703
+ const name5 = val.name;
155704
+ if (typeof name5 == "string" && name5.length > 0) {
155705
+ return `Function(${name5})`;
155706
+ } else {
155707
+ return "Function";
155708
+ }
156240
155709
  }
156241
- format(_mapper) {
156242
- const mapper = _mapper || function(issue) {
156243
- return issue.message;
156244
- };
156245
- const fieldErrors = { _errors: [] };
156246
- const processError = /* @__PURE__ */ __name((error) => {
156247
- for (const issue of error.issues) {
156248
- if (issue.code === "invalid_union") {
156249
- issue.unionErrors.map(processError);
156250
- } else if (issue.code === "invalid_return_type") {
156251
- processError(issue.returnTypeError);
156252
- } else if (issue.code === "invalid_arguments") {
156253
- processError(issue.argumentsError);
156254
- } else if (issue.path.length === 0) {
156255
- fieldErrors._errors.push(mapper(issue));
156256
- } else {
156257
- let curr = fieldErrors;
156258
- let i = 0;
156259
- while (i < issue.path.length) {
156260
- const el = issue.path[i];
156261
- const terminal = i === issue.path.length - 1;
156262
- if (!terminal) {
156263
- curr[el] = curr[el] || { _errors: [] };
156264
- } else {
156265
- curr[el] = curr[el] || { _errors: [] };
156266
- curr[el]._errors.push(mapper(issue));
156267
- }
156268
- curr = curr[el];
156269
- i++;
156270
- }
156271
- }
156272
- }
156273
- }, "processError");
156274
- processError(this);
156275
- return fieldErrors;
155710
+ if (Array.isArray(val)) {
155711
+ const length2 = val.length;
155712
+ let debug = "[";
155713
+ if (length2 > 0) {
155714
+ debug += debugString(val[0]);
155715
+ }
155716
+ for (let i = 1; i < length2; i++) {
155717
+ debug += ", " + debugString(val[i]);
155718
+ }
155719
+ debug += "]";
155720
+ return debug;
156276
155721
  }
156277
- toString() {
156278
- return this.message;
155722
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
155723
+ let className;
155724
+ if (builtInMatches.length > 1) {
155725
+ className = builtInMatches[1];
155726
+ } else {
155727
+ return toString.call(val);
156279
155728
  }
156280
- get message() {
156281
- return JSON.stringify(this.issues, null, 2);
155729
+ if (className == "Object") {
155730
+ try {
155731
+ return "Object(" + JSON.stringify(val) + ")";
155732
+ } catch (_) {
155733
+ return "Object";
155734
+ }
156282
155735
  }
156283
- get isEmpty() {
156284
- return this.issues.length === 0;
155736
+ if (val instanceof Error) {
155737
+ return `${val.name}: ${val.message}
155738
+ ${val.stack}`;
156285
155739
  }
156286
- flatten(mapper = (issue) => issue.message) {
156287
- const fieldErrors = {};
156288
- const formErrors = [];
156289
- for (const sub of this.issues) {
156290
- if (sub.path.length > 0) {
156291
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
156292
- fieldErrors[sub.path[0]].push(mapper(sub));
155740
+ return className;
155741
+ }
155742
+ __name(debugString, "debugString");
155743
+ function makeMutClosure(arg0, arg1, dtor, f) {
155744
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
155745
+ const real = /* @__PURE__ */ __name((...args) => {
155746
+ state.cnt++;
155747
+ const a = state.a;
155748
+ state.a = 0;
155749
+ try {
155750
+ return f(a, state.b, ...args);
155751
+ } finally {
155752
+ if (--state.cnt === 0) {
155753
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
156293
155754
  } else {
156294
- formErrors.push(mapper(sub));
155755
+ state.a = a;
156295
155756
  }
156296
155757
  }
156297
- return { formErrors, fieldErrors };
156298
- }
156299
- get formErrors() {
156300
- return this.flatten();
156301
- }
156302
- };
156303
- __name(ZodError, "ZodError");
156304
- ZodError.create = (issues) => {
156305
- const error = new ZodError(issues);
156306
- return error;
156307
- };
156308
- var defaultErrorMap = /* @__PURE__ */ __name((issue, _ctx) => {
156309
- let message;
156310
- switch (issue.code) {
156311
- case ZodIssueCode.invalid_type:
156312
- if (issue.received === ZodParsedType.undefined) {
156313
- message = "Required";
156314
- } else {
156315
- message = `Expected ${issue.expected}, received ${issue.received}`;
156316
- }
156317
- break;
156318
- case ZodIssueCode.invalid_literal:
156319
- message = `Invalid literal value, expected ${JSON.stringify(issue.expected)}`;
156320
- break;
156321
- case ZodIssueCode.unrecognized_keys:
156322
- message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
156323
- break;
156324
- case ZodIssueCode.invalid_union:
156325
- message = `Invalid input`;
156326
- break;
156327
- case ZodIssueCode.invalid_union_discriminator:
156328
- message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
156329
- break;
156330
- case ZodIssueCode.invalid_enum_value:
156331
- message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
156332
- break;
156333
- case ZodIssueCode.invalid_arguments:
156334
- message = `Invalid function arguments`;
156335
- break;
156336
- case ZodIssueCode.invalid_return_type:
156337
- message = `Invalid function return type`;
156338
- break;
156339
- case ZodIssueCode.invalid_date:
156340
- message = `Invalid date`;
156341
- break;
156342
- case ZodIssueCode.invalid_string:
156343
- if (issue.validation !== "regex")
156344
- message = `Invalid ${issue.validation}`;
156345
- else
156346
- message = "Invalid";
156347
- break;
156348
- case ZodIssueCode.too_small:
156349
- if (issue.type === "array")
156350
- message = `Array must contain ${issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
156351
- else if (issue.type === "string")
156352
- message = `String must contain ${issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
156353
- else if (issue.type === "number")
156354
- message = `Number must be greater than ${issue.inclusive ? `or equal to ` : ``}${issue.minimum}`;
156355
- else
156356
- message = "Invalid input";
156357
- break;
156358
- case ZodIssueCode.too_big:
156359
- if (issue.type === "array")
156360
- message = `Array must contain ${issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
156361
- else if (issue.type === "string")
156362
- message = `String must contain ${issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
156363
- else if (issue.type === "number")
156364
- message = `Number must be less than ${issue.inclusive ? `or equal to ` : ``}${issue.maximum}`;
156365
- else
156366
- message = "Invalid input";
156367
- break;
156368
- case ZodIssueCode.custom:
156369
- message = `Invalid input`;
156370
- break;
156371
- case ZodIssueCode.invalid_intersection_types:
156372
- message = `Intersection results could not be merged`;
156373
- break;
156374
- case ZodIssueCode.not_multiple_of:
156375
- message = `Number must be a multiple of ${issue.multipleOf}`;
156376
- break;
156377
- default:
156378
- message = _ctx.defaultError;
156379
- util.assertNever(issue);
156380
- }
156381
- return { message };
156382
- }, "defaultErrorMap");
156383
- var overrideErrorMap = defaultErrorMap;
156384
- var setErrorMap = /* @__PURE__ */ __name((map2) => {
156385
- overrideErrorMap = map2;
156386
- }, "setErrorMap");
156387
- var makeIssue = /* @__PURE__ */ __name((params) => {
156388
- const { data, path, errorMaps, issueData } = params;
156389
- const fullPath = [...path, ...issueData.path || []];
156390
- const fullIssue = __spreadProps(__spreadValues({}, issueData), {
156391
- path: fullPath
156392
- });
156393
- let errorMessage = "";
156394
- const maps = errorMaps.filter((m) => !!m).slice().reverse();
156395
- for (const map2 of maps) {
156396
- errorMessage = map2(fullIssue, { data, defaultError: errorMessage }).message;
156397
- }
156398
- return __spreadProps(__spreadValues({}, issueData), {
156399
- path: fullPath,
156400
- message: issueData.message || errorMessage
156401
- });
156402
- }, "makeIssue");
156403
- var EMPTY_PATH = [];
156404
- function addIssueToContext(ctx, issueData) {
156405
- const issue = makeIssue({
156406
- issueData,
156407
- data: ctx.data,
156408
- path: ctx.path,
156409
- errorMaps: [
156410
- ctx.common.contextualErrorMap,
156411
- ctx.schemaErrorMap,
156412
- overrideErrorMap,
156413
- defaultErrorMap
156414
- ].filter((x) => !!x)
156415
- });
156416
- ctx.common.issues.push(issue);
155758
+ }, "real");
155759
+ real.original = state;
155760
+ return real;
156417
155761
  }
156418
- __name(addIssueToContext, "addIssueToContext");
156419
- var ParseStatus = class {
156420
- constructor() {
156421
- this.value = "valid";
156422
- }
156423
- dirty() {
156424
- if (this.value === "valid")
156425
- this.value = "dirty";
156426
- }
156427
- abort() {
156428
- if (this.value !== "aborted")
156429
- this.value = "aborted";
156430
- }
156431
- static mergeArray(status, results) {
156432
- const arrayValue = [];
156433
- for (const s of results) {
156434
- if (s.status === "aborted")
156435
- return INVALID;
156436
- if (s.status === "dirty")
156437
- status.dirty();
156438
- arrayValue.push(s.value);
155762
+ __name(makeMutClosure, "makeMutClosure");
155763
+ function __wbg_adapter_24(arg0, arg1, arg2) {
155764
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(arg0, arg1, addHeapObject(arg2));
155765
+ }
155766
+ __name(__wbg_adapter_24, "__wbg_adapter_24");
155767
+ function passArray8ToWasm0(arg, malloc) {
155768
+ const ptr = malloc(arg.length * 1);
155769
+ getUint8Memory0().set(arg, ptr / 1);
155770
+ WASM_VECTOR_LEN = arg.length;
155771
+ return ptr;
155772
+ }
155773
+ __name(passArray8ToWasm0, "passArray8ToWasm0");
155774
+ function generateEd25519KeyFromBytes(bytes) {
155775
+ try {
155776
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
155777
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
155778
+ const len0 = WASM_VECTOR_LEN;
155779
+ wasm.generateEd25519KeyFromBytes(retptr, ptr0, len0);
155780
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
155781
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
155782
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
155783
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
155784
+ var ptr1 = r0;
155785
+ var len1 = r1;
155786
+ if (r3) {
155787
+ ptr1 = 0;
155788
+ len1 = 0;
155789
+ throw takeObject(r2);
156439
155790
  }
156440
- return { status: status.value, value: arrayValue };
155791
+ return getStringFromWasm0(ptr1, len1);
155792
+ } finally {
155793
+ wasm.__wbindgen_add_to_stack_pointer(16);
155794
+ wasm.__wbindgen_free(ptr1, len1);
156441
155795
  }
156442
- static mergeObjectAsync(status, pairs) {
156443
- return __async$1(this, null, function* () {
156444
- const syncPairs = [];
156445
- for (const pair of pairs) {
156446
- syncPairs.push({
156447
- key: yield pair.key,
156448
- value: yield pair.value
156449
- });
156450
- }
156451
- return ParseStatus.mergeObjectSync(status, syncPairs);
156452
- });
155796
+ }
155797
+ __name(generateEd25519KeyFromBytes, "generateEd25519KeyFromBytes");
155798
+ function generateSecp256k1KeyFromBytes(bytes) {
155799
+ try {
155800
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
155801
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
155802
+ const len0 = WASM_VECTOR_LEN;
155803
+ wasm.generateSecp256k1KeyFromBytes(retptr, ptr0, len0);
155804
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
155805
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
155806
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
155807
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
155808
+ var ptr1 = r0;
155809
+ var len1 = r1;
155810
+ if (r3) {
155811
+ ptr1 = 0;
155812
+ len1 = 0;
155813
+ throw takeObject(r2);
155814
+ }
155815
+ return getStringFromWasm0(ptr1, len1);
155816
+ } finally {
155817
+ wasm.__wbindgen_add_to_stack_pointer(16);
155818
+ wasm.__wbindgen_free(ptr1, len1);
156453
155819
  }
156454
- static mergeObjectSync(status, pairs) {
156455
- const finalObject = {};
156456
- for (const pair of pairs) {
156457
- const { key: key2, value } = pair;
156458
- if (key2.status === "aborted")
156459
- return INVALID;
156460
- if (value.status === "aborted")
156461
- return INVALID;
156462
- if (key2.status === "dirty")
156463
- status.dirty();
156464
- if (value.status === "dirty")
156465
- status.dirty();
156466
- if (typeof value.value !== "undefined" || pair.alwaysSet) {
156467
- finalObject[key2.value] = value.value;
156468
- }
155820
+ }
155821
+ __name(generateSecp256k1KeyFromBytes, "generateSecp256k1KeyFromBytes");
155822
+ function keyToDID(method_pattern, jwk) {
155823
+ try {
155824
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
155825
+ const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155826
+ const len0 = WASM_VECTOR_LEN;
155827
+ const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155828
+ const len1 = WASM_VECTOR_LEN;
155829
+ wasm.keyToDID(retptr, ptr0, len0, ptr1, len1);
155830
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
155831
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
155832
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
155833
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
155834
+ var ptr2 = r0;
155835
+ var len2 = r1;
155836
+ if (r3) {
155837
+ ptr2 = 0;
155838
+ len2 = 0;
155839
+ throw takeObject(r2);
156469
155840
  }
156470
- return { status: status.value, value: finalObject };
155841
+ return getStringFromWasm0(ptr2, len2);
155842
+ } finally {
155843
+ wasm.__wbindgen_add_to_stack_pointer(16);
155844
+ wasm.__wbindgen_free(ptr2, len2);
156471
155845
  }
156472
- };
156473
- __name(ParseStatus, "ParseStatus");
156474
- var INVALID = Object.freeze({
156475
- status: "aborted"
156476
- });
156477
- var DIRTY = /* @__PURE__ */ __name((value) => ({ status: "dirty", value }), "DIRTY");
156478
- var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
156479
- var isAborted = /* @__PURE__ */ __name((x) => x.status === "aborted", "isAborted");
156480
- var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
156481
- var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
156482
- var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
156483
- var errorUtil;
156484
- (function(errorUtil2) {
156485
- errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
156486
- errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
156487
- })(errorUtil || (errorUtil = {}));
156488
- var ParseInputLazyPath = class {
156489
- constructor(parent, value, path, key2) {
156490
- this.parent = parent;
156491
- this.data = value;
156492
- this._path = path;
156493
- this._key = key2;
156494
- }
156495
- get path() {
156496
- return this._path.concat(this._key);
155846
+ }
155847
+ __name(keyToDID, "keyToDID");
155848
+ function keyToVerificationMethod(method_pattern, jwk) {
155849
+ const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155850
+ const len0 = WASM_VECTOR_LEN;
155851
+ const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155852
+ const len1 = WASM_VECTOR_LEN;
155853
+ const ret = wasm.keyToVerificationMethod(ptr0, len0, ptr1, len1);
155854
+ return takeObject(ret);
155855
+ }
155856
+ __name(keyToVerificationMethod, "keyToVerificationMethod");
155857
+ function issueCredential(credential, proof_options, key2) {
155858
+ const ptr0 = passStringToWasm0(credential, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155859
+ const len0 = WASM_VECTOR_LEN;
155860
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155861
+ const len1 = WASM_VECTOR_LEN;
155862
+ const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155863
+ const len2 = WASM_VECTOR_LEN;
155864
+ const ret = wasm.issueCredential(ptr0, len0, ptr1, len1, ptr2, len2);
155865
+ return takeObject(ret);
155866
+ }
155867
+ __name(issueCredential, "issueCredential");
155868
+ function verifyCredential(vc, proof_options) {
155869
+ const ptr0 = passStringToWasm0(vc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155870
+ const len0 = WASM_VECTOR_LEN;
155871
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155872
+ const len1 = WASM_VECTOR_LEN;
155873
+ const ret = wasm.verifyCredential(ptr0, len0, ptr1, len1);
155874
+ return takeObject(ret);
155875
+ }
155876
+ __name(verifyCredential, "verifyCredential");
155877
+ function issuePresentation(presentation, proof_options, key2) {
155878
+ const ptr0 = passStringToWasm0(presentation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155879
+ const len0 = WASM_VECTOR_LEN;
155880
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155881
+ const len1 = WASM_VECTOR_LEN;
155882
+ const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155883
+ const len2 = WASM_VECTOR_LEN;
155884
+ const ret = wasm.issuePresentation(ptr0, len0, ptr1, len1, ptr2, len2);
155885
+ return takeObject(ret);
155886
+ }
155887
+ __name(issuePresentation, "issuePresentation");
155888
+ function verifyPresentation(vp, proof_options) {
155889
+ const ptr0 = passStringToWasm0(vp, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155890
+ const len0 = WASM_VECTOR_LEN;
155891
+ const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155892
+ const len1 = WASM_VECTOR_LEN;
155893
+ const ret = wasm.verifyPresentation(ptr0, len0, ptr1, len1);
155894
+ return takeObject(ret);
155895
+ }
155896
+ __name(verifyPresentation, "verifyPresentation");
155897
+ function handleError(f, args) {
155898
+ try {
155899
+ return f.apply(this, args);
155900
+ } catch (e) {
155901
+ wasm.__wbindgen_exn_store(addHeapObject(e));
156497
155902
  }
156498
- };
156499
- __name(ParseInputLazyPath, "ParseInputLazyPath");
156500
- var handleResult = /* @__PURE__ */ __name((ctx, result) => {
156501
- if (isValid(result)) {
156502
- return { success: true, data: result.value };
156503
- } else {
156504
- if (!ctx.common.issues.length) {
156505
- throw new Error("Validation failed but no issues detected.");
155903
+ }
155904
+ __name(handleError, "handleError");
155905
+ function getArrayU8FromWasm0(ptr, len) {
155906
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
155907
+ }
155908
+ __name(getArrayU8FromWasm0, "getArrayU8FromWasm0");
155909
+ function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
155910
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
155911
+ }
155912
+ __name(__wbg_adapter_110, "__wbg_adapter_110");
155913
+ function load(module, imports) {
155914
+ return __async$1(this, null, function* () {
155915
+ if (typeof Response === "function" && module instanceof Response) {
155916
+ if (typeof WebAssembly.instantiateStreaming === "function") {
155917
+ try {
155918
+ return yield WebAssembly.instantiateStreaming(module, imports);
155919
+ } catch (e) {
155920
+ if (module.headers.get("Content-Type") != "application/wasm") {
155921
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
155922
+ } else {
155923
+ throw e;
155924
+ }
155925
+ }
155926
+ }
155927
+ const bytes = yield module.arrayBuffer();
155928
+ return yield WebAssembly.instantiate(bytes, imports);
155929
+ } else {
155930
+ const instance = yield WebAssembly.instantiate(module, imports);
155931
+ if (instance instanceof WebAssembly.Instance) {
155932
+ return { instance, module };
155933
+ } else {
155934
+ return instance;
155935
+ }
156506
155936
  }
156507
- const error = new ZodError(ctx.common.issues);
156508
- return { success: false, error };
156509
- }
156510
- }, "handleResult");
156511
- function processCreateParams(params) {
156512
- if (!params)
156513
- return {};
156514
- const { errorMap, invalid_type_error, required_error, description } = params;
156515
- if (errorMap && (invalid_type_error || required_error)) {
156516
- throw new Error(`Can't use "invalid" or "required" in conjunction with custom error map.`);
156517
- }
156518
- if (errorMap)
156519
- return { errorMap, description };
156520
- const customMap = /* @__PURE__ */ __name((iss, ctx) => {
156521
- if (iss.code !== "invalid_type")
156522
- return { message: ctx.defaultError };
156523
- if (typeof ctx.data === "undefined" && required_error)
156524
- return { message: required_error };
156525
- if (params.invalid_type_error)
156526
- return { message: params.invalid_type_error };
156527
- return { message: ctx.defaultError };
156528
- }, "customMap");
156529
- return { errorMap: customMap, description };
155937
+ });
156530
155938
  }
156531
- __name(processCreateParams, "processCreateParams");
156532
- var ZodType = class {
156533
- constructor(def) {
156534
- this.spa = this.safeParseAsync;
156535
- this.superRefine = this._refinement;
156536
- this._def = def;
156537
- this.parse = this.parse.bind(this);
156538
- this.safeParse = this.safeParse.bind(this);
156539
- this.parseAsync = this.parseAsync.bind(this);
156540
- this.safeParseAsync = this.safeParseAsync.bind(this);
156541
- this.spa = this.spa.bind(this);
156542
- this.refine = this.refine.bind(this);
156543
- this.refinement = this.refinement.bind(this);
156544
- this.superRefine = this.superRefine.bind(this);
156545
- this.optional = this.optional.bind(this);
156546
- this.nullable = this.nullable.bind(this);
156547
- this.nullish = this.nullish.bind(this);
156548
- this.array = this.array.bind(this);
156549
- this.promise = this.promise.bind(this);
156550
- this.or = this.or.bind(this);
156551
- this.and = this.and.bind(this);
156552
- this.transform = this.transform.bind(this);
156553
- this.default = this.default.bind(this);
156554
- this.describe = this.describe.bind(this);
156555
- this.isNullable = this.isNullable.bind(this);
156556
- this.isOptional = this.isOptional.bind(this);
156557
- }
156558
- get description() {
156559
- return this._def.description;
156560
- }
156561
- _getType(input) {
156562
- return getParsedType(input.data);
156563
- }
156564
- _getOrReturnCtx(input, ctx) {
156565
- return ctx || {
156566
- common: input.parent.common,
156567
- data: input.data,
156568
- parsedType: getParsedType(input.data),
156569
- schemaErrorMap: this._def.errorMap,
156570
- path: input.path,
156571
- parent: input.parent
155939
+ __name(load, "load");
155940
+ function init2(input) {
155941
+ return __async$1(this, null, function* () {
155942
+ const imports = {};
155943
+ imports.wbg = {};
155944
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
155945
+ const ret = getStringFromWasm0(arg0, arg1);
155946
+ return addHeapObject(ret);
156572
155947
  };
156573
- }
156574
- _processInputParams(input) {
156575
- return {
156576
- status: new ParseStatus(),
156577
- ctx: {
156578
- common: input.parent.common,
156579
- data: input.data,
156580
- parsedType: getParsedType(input.data),
156581
- schemaErrorMap: this._def.errorMap,
156582
- path: input.path,
156583
- parent: input.parent
155948
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
155949
+ takeObject(arg0);
155950
+ };
155951
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
155952
+ const obj = takeObject(arg0).original;
155953
+ if (obj.cnt-- == 1) {
155954
+ obj.a = 0;
155955
+ return true;
156584
155956
  }
155957
+ const ret = false;
155958
+ return ret;
156585
155959
  };
156586
- }
156587
- _parseSync(input) {
156588
- const result = this._parse(input);
156589
- if (isAsync(result)) {
156590
- throw new Error("Synchronous parse encountered promise.");
156591
- }
156592
- return result;
156593
- }
156594
- _parseAsync(input) {
156595
- const result = this._parse(input);
156596
- return Promise.resolve(result);
156597
- }
156598
- parse(data, params) {
156599
- const result = this.safeParse(data, params);
156600
- if (result.success)
156601
- return result.data;
156602
- throw result.error;
156603
- }
156604
- safeParse(data, params) {
156605
- var _a;
156606
- const ctx = {
156607
- common: {
156608
- issues: [],
156609
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
156610
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
156611
- },
156612
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
156613
- schemaErrorMap: this._def.errorMap,
156614
- parent: null,
156615
- data,
156616
- parsedType: getParsedType(data)
155960
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
155961
+ const ret = getObject(arg0);
155962
+ return addHeapObject(ret);
156617
155963
  };
156618
- const result = this._parseSync({ data, path: ctx.path, parent: ctx });
156619
- return handleResult(ctx, result);
156620
- }
156621
- parseAsync(data, params) {
156622
- return __async$1(this, null, function* () {
156623
- const result = yield this.safeParseAsync(data, params);
156624
- if (result.success)
156625
- return result.data;
156626
- throw result.error;
156627
- });
156628
- }
156629
- safeParseAsync(data, params) {
156630
- return __async$1(this, null, function* () {
156631
- const ctx = {
156632
- common: {
156633
- issues: [],
156634
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
156635
- async: true
156636
- },
156637
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
156638
- schemaErrorMap: this._def.errorMap,
156639
- parent: null,
156640
- data,
156641
- parsedType: getParsedType(data)
156642
- };
155964
+ imports.wbg.__wbg_fetch_811d43d6bdcad5b1 = function(arg0) {
155965
+ const ret = fetch(getObject(arg0));
155966
+ return addHeapObject(ret);
155967
+ };
155968
+ imports.wbg.__wbg_fetch_bf56e2a9f0644e3f = function(arg0, arg1) {
155969
+ const ret = getObject(arg0).fetch(getObject(arg1));
155970
+ return addHeapObject(ret);
155971
+ };
155972
+ imports.wbg.__wbg_new_89d7f088c1c45353 = function() {
155973
+ return handleError(function() {
155974
+ const ret = new Headers();
155975
+ return addHeapObject(ret);
155976
+ }, arguments);
155977
+ };
155978
+ imports.wbg.__wbg_append_f4f93bc73c45ee3e = function() {
155979
+ return handleError(function(arg0, arg1, arg2, arg3, arg4) {
155980
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
155981
+ }, arguments);
155982
+ };
155983
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
155984
+ const obj = getObject(arg1);
155985
+ const ret = typeof obj === "string" ? obj : void 0;
155986
+ var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155987
+ var len0 = WASM_VECTOR_LEN;
155988
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
155989
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
155990
+ };
155991
+ imports.wbg.__wbg_instanceof_Response_ccfeb62399355bcd = function(arg0) {
155992
+ const ret = getObject(arg0) instanceof Response;
155993
+ return ret;
155994
+ };
155995
+ imports.wbg.__wbg_url_06c0f822d68d195c = function(arg0, arg1) {
155996
+ const ret = getObject(arg1).url;
155997
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155998
+ const len0 = WASM_VECTOR_LEN;
155999
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
156000
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
156001
+ };
156002
+ imports.wbg.__wbg_status_600fd8b881393898 = function(arg0) {
156003
+ const ret = getObject(arg0).status;
156004
+ return ret;
156005
+ };
156006
+ imports.wbg.__wbg_headers_9e7f2c05a9b962ea = function(arg0) {
156007
+ const ret = getObject(arg0).headers;
156008
+ return addHeapObject(ret);
156009
+ };
156010
+ imports.wbg.__wbg_arrayBuffer_5a99283a3954c850 = function() {
156011
+ return handleError(function(arg0) {
156012
+ const ret = getObject(arg0).arrayBuffer();
156013
+ return addHeapObject(ret);
156014
+ }, arguments);
156015
+ };
156016
+ imports.wbg.__wbg_newwithstrandinit_fd99688f189f053e = function() {
156017
+ return handleError(function(arg0, arg1, arg2) {
156018
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
156019
+ return addHeapObject(ret);
156020
+ }, arguments);
156021
+ };
156022
+ imports.wbg.__wbindgen_is_object = function(arg0) {
156023
+ const val = getObject(arg0);
156024
+ const ret = typeof val === "object" && val !== null;
156025
+ return ret;
156026
+ };
156027
+ imports.wbg.__wbg_self_86b4b13392c7af56 = function() {
156028
+ return handleError(function() {
156029
+ const ret = self.self;
156030
+ return addHeapObject(ret);
156031
+ }, arguments);
156032
+ };
156033
+ imports.wbg.__wbg_crypto_b8c92eaac23d0d80 = function(arg0) {
156034
+ const ret = getObject(arg0).crypto;
156035
+ return addHeapObject(ret);
156036
+ };
156037
+ imports.wbg.__wbg_msCrypto_9ad6677321a08dd8 = function(arg0) {
156038
+ const ret = getObject(arg0).msCrypto;
156039
+ return addHeapObject(ret);
156040
+ };
156041
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
156042
+ const ret = getObject(arg0) === void 0;
156043
+ return ret;
156044
+ };
156045
+ imports.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81 = function() {
156046
+ const ret = module;
156047
+ return addHeapObject(ret);
156048
+ };
156049
+ imports.wbg.__wbg_require_f5521a5b85ad2542 = function(arg0, arg1, arg2) {
156050
+ const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
156051
+ return addHeapObject(ret);
156052
+ };
156053
+ imports.wbg.__wbg_getRandomValues_dd27e6b0652b3236 = function(arg0) {
156054
+ const ret = getObject(arg0).getRandomValues;
156055
+ return addHeapObject(ret);
156056
+ };
156057
+ imports.wbg.__wbg_getRandomValues_e57c9b75ddead065 = function(arg0, arg1) {
156058
+ getObject(arg0).getRandomValues(getObject(arg1));
156059
+ };
156060
+ imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function(arg0, arg1, arg2) {
156061
+ getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
156062
+ };
156063
+ imports.wbg.__wbindgen_is_function = function(arg0) {
156064
+ const ret = typeof getObject(arg0) === "function";
156065
+ return ret;
156066
+ };
156067
+ imports.wbg.__wbg_newnoargs_e23b458e372830de = function(arg0, arg1) {
156068
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
156069
+ return addHeapObject(ret);
156070
+ };
156071
+ imports.wbg.__wbg_next_cabb70b365520721 = function(arg0) {
156072
+ const ret = getObject(arg0).next;
156073
+ return addHeapObject(ret);
156074
+ };
156075
+ imports.wbg.__wbg_next_bf3d83fc18df496e = function() {
156076
+ return handleError(function(arg0) {
156077
+ const ret = getObject(arg0).next();
156078
+ return addHeapObject(ret);
156079
+ }, arguments);
156080
+ };
156081
+ imports.wbg.__wbg_done_040f966faa9a72b3 = function(arg0) {
156082
+ const ret = getObject(arg0).done;
156083
+ return ret;
156084
+ };
156085
+ imports.wbg.__wbg_value_419afbd9b9574c4c = function(arg0) {
156086
+ const ret = getObject(arg0).value;
156087
+ return addHeapObject(ret);
156088
+ };
156089
+ imports.wbg.__wbg_iterator_4832ef1f15b0382b = function() {
156090
+ const ret = Symbol.iterator;
156091
+ return addHeapObject(ret);
156092
+ };
156093
+ imports.wbg.__wbg_get_a9cab131e3152c49 = function() {
156094
+ return handleError(function(arg0, arg1) {
156095
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
156096
+ return addHeapObject(ret);
156097
+ }, arguments);
156098
+ };
156099
+ imports.wbg.__wbg_call_ae78342adc33730a = function() {
156100
+ return handleError(function(arg0, arg1) {
156101
+ const ret = getObject(arg0).call(getObject(arg1));
156102
+ return addHeapObject(ret);
156103
+ }, arguments);
156104
+ };
156105
+ imports.wbg.__wbg_new_36359baae5a47e27 = function() {
156106
+ const ret = new Object();
156107
+ return addHeapObject(ret);
156108
+ };
156109
+ imports.wbg.__wbg_call_3ed288a247f13ea5 = function() {
156110
+ return handleError(function(arg0, arg1, arg2) {
156111
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
156112
+ return addHeapObject(ret);
156113
+ }, arguments);
156114
+ };
156115
+ imports.wbg.__wbg_getTime_bffb1c09df09618b = function(arg0) {
156116
+ const ret = getObject(arg0).getTime();
156117
+ return ret;
156118
+ };
156119
+ imports.wbg.__wbg_new0_0ff7eb5c1486f3ec = function() {
156120
+ const ret = new Date();
156121
+ return addHeapObject(ret);
156122
+ };
156123
+ imports.wbg.__wbg_new_37705eed627d5ed9 = function(arg0, arg1) {
156124
+ try {
156125
+ var state0 = { a: arg0, b: arg1 };
156126
+ var cb0 = /* @__PURE__ */ __name((arg02, arg12) => {
156127
+ const a = state0.a;
156128
+ state0.a = 0;
156129
+ try {
156130
+ return __wbg_adapter_110(a, state0.b, arg02, arg12);
156131
+ } finally {
156132
+ state0.a = a;
156133
+ }
156134
+ }, "cb0");
156135
+ const ret = new Promise(cb0);
156136
+ return addHeapObject(ret);
156137
+ } finally {
156138
+ state0.a = state0.b = 0;
156139
+ }
156140
+ };
156141
+ imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function(arg0) {
156142
+ const ret = Promise.resolve(getObject(arg0));
156143
+ return addHeapObject(ret);
156144
+ };
156145
+ imports.wbg.__wbg_then_ce526c837d07b68f = function(arg0, arg1) {
156146
+ const ret = getObject(arg0).then(getObject(arg1));
156147
+ return addHeapObject(ret);
156148
+ };
156149
+ imports.wbg.__wbg_then_842e65b843962f56 = function(arg0, arg1, arg2) {
156150
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
156151
+ return addHeapObject(ret);
156152
+ };
156153
+ imports.wbg.__wbg_self_99737b4dcdf6f0d8 = function() {
156154
+ return handleError(function() {
156155
+ const ret = self.self;
156156
+ return addHeapObject(ret);
156157
+ }, arguments);
156158
+ };
156159
+ imports.wbg.__wbg_window_9b61fbbf3564c4fb = function() {
156160
+ return handleError(function() {
156161
+ const ret = window.window;
156162
+ return addHeapObject(ret);
156163
+ }, arguments);
156164
+ };
156165
+ imports.wbg.__wbg_globalThis_8e275ef40caea3a3 = function() {
156166
+ return handleError(function() {
156167
+ const ret = globalThis.globalThis;
156168
+ return addHeapObject(ret);
156169
+ }, arguments);
156170
+ };
156171
+ imports.wbg.__wbg_global_5de1e0f82bddcd27 = function() {
156172
+ return handleError(function() {
156173
+ const ret = global.global;
156174
+ return addHeapObject(ret);
156175
+ }, arguments);
156176
+ };
156177
+ imports.wbg.__wbg_buffer_7af23f65f6c64548 = function(arg0) {
156178
+ const ret = getObject(arg0).buffer;
156179
+ return addHeapObject(ret);
156180
+ };
156181
+ imports.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974 = function(arg0, arg1, arg2) {
156182
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
156183
+ return addHeapObject(ret);
156184
+ };
156185
+ imports.wbg.__wbg_new_cc9018bd6f283b6f = function(arg0) {
156186
+ const ret = new Uint8Array(getObject(arg0));
156187
+ return addHeapObject(ret);
156188
+ };
156189
+ imports.wbg.__wbg_set_f25e869e4565d2a2 = function(arg0, arg1, arg2) {
156190
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
156191
+ };
156192
+ imports.wbg.__wbg_length_0acb1cf9bbaf8519 = function(arg0) {
156193
+ const ret = getObject(arg0).length;
156194
+ return ret;
156195
+ };
156196
+ imports.wbg.__wbg_newwithlength_8f0657faca9f1422 = function(arg0) {
156197
+ const ret = new Uint8Array(arg0 >>> 0);
156198
+ return addHeapObject(ret);
156199
+ };
156200
+ imports.wbg.__wbg_subarray_da527dbd24eafb6b = function(arg0, arg1, arg2) {
156201
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
156202
+ return addHeapObject(ret);
156203
+ };
156204
+ imports.wbg.__wbg_has_ce995ec88636803d = function() {
156205
+ return handleError(function(arg0, arg1) {
156206
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
156207
+ return ret;
156208
+ }, arguments);
156209
+ };
156210
+ imports.wbg.__wbg_set_93b1c87ee2af852e = function() {
156211
+ return handleError(function(arg0, arg1, arg2) {
156212
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
156213
+ return ret;
156214
+ }, arguments);
156215
+ };
156216
+ imports.wbg.__wbg_stringify_c760003feffcc1f2 = function() {
156217
+ return handleError(function(arg0) {
156218
+ const ret = JSON.stringify(getObject(arg0));
156219
+ return addHeapObject(ret);
156220
+ }, arguments);
156221
+ };
156222
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
156223
+ const ret = debugString(getObject(arg1));
156224
+ const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
156225
+ const len0 = WASM_VECTOR_LEN;
156226
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
156227
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
156228
+ };
156229
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
156230
+ throw new Error(getStringFromWasm0(arg0, arg1));
156231
+ };
156232
+ imports.wbg.__wbindgen_memory = function() {
156233
+ const ret = wasm.memory;
156234
+ return addHeapObject(ret);
156235
+ };
156236
+ imports.wbg.__wbindgen_closure_wrapper10913 = function(arg0, arg1, arg2) {
156237
+ const ret = makeMutClosure(arg0, arg1, 3725, __wbg_adapter_24);
156238
+ return addHeapObject(ret);
156239
+ };
156240
+ if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
156241
+ input = fetch(input);
156242
+ }
156243
+ const { instance, module } = yield load(yield input, imports);
156244
+ wasm = instance.exports;
156245
+ init2.__wbindgen_wasm_module = module;
156246
+ return wasm;
156247
+ });
156248
+ }
156249
+ __name(init2, "init");
156250
+ var didkit_wasm_default = init2;
156251
+ var initialized = false;
156252
+ var init3 = /* @__PURE__ */ __name((arg = "https://cdn.filestackcontent.com/dlXanMvQCGDR76JXcBkA") => __async$1(void 0, null, function* () {
156253
+ if (initialized)
156254
+ return;
156255
+ initialized = true;
156256
+ return didkit_wasm_default(arg);
156257
+ }), "init");
156258
+ var didkit_default = init3;
156259
+ var getDidKitPlugin = /* @__PURE__ */ __name((input) => __async$1(void 0, null, function* () {
156260
+ yield didkit_default(input);
156261
+ const memoizedDids = {};
156262
+ return {
156263
+ pluginMethods: {
156264
+ generateEd25519KeyFromBytes: (_wallet, bytes) => JSON.parse(generateEd25519KeyFromBytes(bytes)),
156265
+ generateSecp256k1KeyFromBytes: (_wallet, bytes) => JSON.parse(generateSecp256k1KeyFromBytes(bytes)),
156266
+ keyToDid: (_wallet, type, keypair) => {
156267
+ const memoizedDid = memoizedDids[type];
156268
+ if (!memoizedDid) {
156269
+ const did = keyToDID(type, JSON.stringify(keypair));
156270
+ memoizedDids[type] = did;
156271
+ return did;
156272
+ }
156273
+ return memoizedDid;
156274
+ },
156275
+ keyToVerificationMethod: (_wallet, type, keypair) => __async$1(void 0, null, function* () {
156276
+ return keyToVerificationMethod(type, JSON.stringify(keypair));
156277
+ }),
156278
+ issueCredential: (_wallet, credential, options, keypair) => __async$1(void 0, null, function* () {
156279
+ return JSON.parse(yield issueCredential(JSON.stringify(credential), JSON.stringify(options), JSON.stringify(keypair)));
156280
+ }),
156281
+ verifyCredential: (_wallet, credential) => __async$1(void 0, null, function* () {
156282
+ return JSON.parse(yield verifyCredential(JSON.stringify(credential), "{}"));
156283
+ }),
156284
+ issuePresentation: (_wallet, presentation, options, keypair) => __async$1(void 0, null, function* () {
156285
+ return JSON.parse(yield issuePresentation(JSON.stringify(presentation), JSON.stringify(options), JSON.stringify(keypair)));
156286
+ }),
156287
+ verifyPresentation: (_wallet, presentation) => __async$1(void 0, null, function* () {
156288
+ return JSON.parse(yield verifyPresentation(JSON.stringify(presentation), "{}"));
156289
+ })
156290
+ }
156291
+ };
156292
+ }), "getDidKitPlugin");
156293
+ var ExpirationPlugin = /* @__PURE__ */ __name((wallet) => ({
156294
+ pluginMethods: {
156295
+ verifyCredential: (_wallet, credential) => __async$1(void 0, null, function* () {
156296
+ const verificationCheck = yield wallet.pluginMethods.verifyCredential(credential);
156297
+ if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {
156298
+ verificationCheck.errors.push("expiration error: Credential is expired");
156299
+ } else {
156300
+ verificationCheck.checks.push("expiration");
156301
+ }
156302
+ return verificationCheck;
156303
+ })
156304
+ }
156305
+ }), "ExpirationPlugin");
156306
+ var util;
156307
+ (function(util2) {
156308
+ function assertNever(_x) {
156309
+ throw new Error();
156310
+ }
156311
+ __name(assertNever, "assertNever");
156312
+ util2.assertNever = assertNever;
156313
+ util2.arrayToEnum = (items) => {
156314
+ const obj = {};
156315
+ for (const item of items) {
156316
+ obj[item] = item;
156317
+ }
156318
+ return obj;
156319
+ };
156320
+ util2.getValidEnumValues = (obj) => {
156321
+ const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
156322
+ const filtered = {};
156323
+ for (const k of validKeys) {
156324
+ filtered[k] = obj[k];
156325
+ }
156326
+ return util2.objectValues(filtered);
156327
+ };
156328
+ util2.objectValues = (obj) => {
156329
+ return util2.objectKeys(obj).map(function(e) {
156330
+ return obj[e];
156331
+ });
156332
+ };
156333
+ util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
156334
+ const keys = [];
156335
+ for (const key2 in object) {
156336
+ if (Object.prototype.hasOwnProperty.call(object, key2)) {
156337
+ keys.push(key2);
156338
+ }
156339
+ }
156340
+ return keys;
156341
+ };
156342
+ util2.find = (arr, checker) => {
156343
+ for (const item of arr) {
156344
+ if (checker(item))
156345
+ return item;
156346
+ }
156347
+ return void 0;
156348
+ };
156349
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
156350
+ function joinValues(array, separator = " | ") {
156351
+ return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
156352
+ }
156353
+ __name(joinValues, "joinValues");
156354
+ util2.joinValues = joinValues;
156355
+ })(util || (util = {}));
156356
+ var ZodParsedType = util.arrayToEnum([
156357
+ "string",
156358
+ "nan",
156359
+ "number",
156360
+ "integer",
156361
+ "float",
156362
+ "boolean",
156363
+ "date",
156364
+ "bigint",
156365
+ "symbol",
156366
+ "function",
156367
+ "undefined",
156368
+ "null",
156369
+ "array",
156370
+ "object",
156371
+ "unknown",
156372
+ "promise",
156373
+ "void",
156374
+ "never",
156375
+ "map",
156376
+ "set"
156377
+ ]);
156378
+ var getParsedType = /* @__PURE__ */ __name((data) => {
156379
+ const t = typeof data;
156380
+ switch (t) {
156381
+ case "undefined":
156382
+ return ZodParsedType.undefined;
156383
+ case "string":
156384
+ return ZodParsedType.string;
156385
+ case "number":
156386
+ return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
156387
+ case "boolean":
156388
+ return ZodParsedType.boolean;
156389
+ case "function":
156390
+ return ZodParsedType.function;
156391
+ case "bigint":
156392
+ return ZodParsedType.bigint;
156393
+ case "object":
156394
+ if (Array.isArray(data)) {
156395
+ return ZodParsedType.array;
156396
+ }
156397
+ if (data === null) {
156398
+ return ZodParsedType.null;
156399
+ }
156400
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
156401
+ return ZodParsedType.promise;
156402
+ }
156403
+ if (typeof Map !== "undefined" && data instanceof Map) {
156404
+ return ZodParsedType.map;
156405
+ }
156406
+ if (typeof Set !== "undefined" && data instanceof Set) {
156407
+ return ZodParsedType.set;
156408
+ }
156409
+ if (typeof Date !== "undefined" && data instanceof Date) {
156410
+ return ZodParsedType.date;
156411
+ }
156412
+ return ZodParsedType.object;
156413
+ default:
156414
+ return ZodParsedType.unknown;
156415
+ }
156416
+ }, "getParsedType");
156417
+ var ZodIssueCode = util.arrayToEnum([
156418
+ "invalid_type",
156419
+ "invalid_literal",
156420
+ "custom",
156421
+ "invalid_union",
156422
+ "invalid_union_discriminator",
156423
+ "invalid_enum_value",
156424
+ "unrecognized_keys",
156425
+ "invalid_arguments",
156426
+ "invalid_return_type",
156427
+ "invalid_date",
156428
+ "invalid_string",
156429
+ "too_small",
156430
+ "too_big",
156431
+ "invalid_intersection_types",
156432
+ "not_multiple_of"
156433
+ ]);
156434
+ var quotelessJson = /* @__PURE__ */ __name((obj) => {
156435
+ const json = JSON.stringify(obj, null, 2);
156436
+ return json.replace(/"([^"]+)":/g, "$1:");
156437
+ }, "quotelessJson");
156438
+ var ZodError = class extends Error {
156439
+ constructor(issues) {
156440
+ super();
156441
+ this.issues = [];
156442
+ this.addIssue = (sub) => {
156443
+ this.issues = [...this.issues, sub];
156444
+ };
156445
+ this.addIssues = (subs = []) => {
156446
+ this.issues = [...this.issues, ...subs];
156447
+ };
156448
+ const actualProto = new.target.prototype;
156449
+ if (Object.setPrototypeOf) {
156450
+ Object.setPrototypeOf(this, actualProto);
156451
+ } else {
156452
+ this.__proto__ = actualProto;
156453
+ }
156454
+ this.name = "ZodError";
156455
+ this.issues = issues;
156456
+ }
156457
+ get errors() {
156458
+ return this.issues;
156459
+ }
156460
+ format(_mapper) {
156461
+ const mapper = _mapper || function(issue) {
156462
+ return issue.message;
156463
+ };
156464
+ const fieldErrors = { _errors: [] };
156465
+ const processError = /* @__PURE__ */ __name((error) => {
156466
+ for (const issue of error.issues) {
156467
+ if (issue.code === "invalid_union") {
156468
+ issue.unionErrors.map(processError);
156469
+ } else if (issue.code === "invalid_return_type") {
156470
+ processError(issue.returnTypeError);
156471
+ } else if (issue.code === "invalid_arguments") {
156472
+ processError(issue.argumentsError);
156473
+ } else if (issue.path.length === 0) {
156474
+ fieldErrors._errors.push(mapper(issue));
156475
+ } else {
156476
+ let curr = fieldErrors;
156477
+ let i = 0;
156478
+ while (i < issue.path.length) {
156479
+ const el = issue.path[i];
156480
+ const terminal = i === issue.path.length - 1;
156481
+ if (!terminal) {
156482
+ curr[el] = curr[el] || { _errors: [] };
156483
+ } else {
156484
+ curr[el] = curr[el] || { _errors: [] };
156485
+ curr[el]._errors.push(mapper(issue));
156486
+ }
156487
+ curr = curr[el];
156488
+ i++;
156489
+ }
156490
+ }
156491
+ }
156492
+ }, "processError");
156493
+ processError(this);
156494
+ return fieldErrors;
156495
+ }
156496
+ toString() {
156497
+ return this.message;
156498
+ }
156499
+ get message() {
156500
+ return JSON.stringify(this.issues, null, 2);
156501
+ }
156502
+ get isEmpty() {
156503
+ return this.issues.length === 0;
156504
+ }
156505
+ flatten(mapper = (issue) => issue.message) {
156506
+ const fieldErrors = {};
156507
+ const formErrors = [];
156508
+ for (const sub of this.issues) {
156509
+ if (sub.path.length > 0) {
156510
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
156511
+ fieldErrors[sub.path[0]].push(mapper(sub));
156512
+ } else {
156513
+ formErrors.push(mapper(sub));
156514
+ }
156515
+ }
156516
+ return { formErrors, fieldErrors };
156517
+ }
156518
+ get formErrors() {
156519
+ return this.flatten();
156520
+ }
156521
+ };
156522
+ __name(ZodError, "ZodError");
156523
+ ZodError.create = (issues) => {
156524
+ const error = new ZodError(issues);
156525
+ return error;
156526
+ };
156527
+ var defaultErrorMap = /* @__PURE__ */ __name((issue, _ctx) => {
156528
+ let message;
156529
+ switch (issue.code) {
156530
+ case ZodIssueCode.invalid_type:
156531
+ if (issue.received === ZodParsedType.undefined) {
156532
+ message = "Required";
156533
+ } else {
156534
+ message = `Expected ${issue.expected}, received ${issue.received}`;
156535
+ }
156536
+ break;
156537
+ case ZodIssueCode.invalid_literal:
156538
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected)}`;
156539
+ break;
156540
+ case ZodIssueCode.unrecognized_keys:
156541
+ message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
156542
+ break;
156543
+ case ZodIssueCode.invalid_union:
156544
+ message = `Invalid input`;
156545
+ break;
156546
+ case ZodIssueCode.invalid_union_discriminator:
156547
+ message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
156548
+ break;
156549
+ case ZodIssueCode.invalid_enum_value:
156550
+ message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
156551
+ break;
156552
+ case ZodIssueCode.invalid_arguments:
156553
+ message = `Invalid function arguments`;
156554
+ break;
156555
+ case ZodIssueCode.invalid_return_type:
156556
+ message = `Invalid function return type`;
156557
+ break;
156558
+ case ZodIssueCode.invalid_date:
156559
+ message = `Invalid date`;
156560
+ break;
156561
+ case ZodIssueCode.invalid_string:
156562
+ if (issue.validation !== "regex")
156563
+ message = `Invalid ${issue.validation}`;
156564
+ else
156565
+ message = "Invalid";
156566
+ break;
156567
+ case ZodIssueCode.too_small:
156568
+ if (issue.type === "array")
156569
+ message = `Array must contain ${issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
156570
+ else if (issue.type === "string")
156571
+ message = `String must contain ${issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
156572
+ else if (issue.type === "number")
156573
+ message = `Number must be greater than ${issue.inclusive ? `or equal to ` : ``}${issue.minimum}`;
156574
+ else
156575
+ message = "Invalid input";
156576
+ break;
156577
+ case ZodIssueCode.too_big:
156578
+ if (issue.type === "array")
156579
+ message = `Array must contain ${issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
156580
+ else if (issue.type === "string")
156581
+ message = `String must contain ${issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
156582
+ else if (issue.type === "number")
156583
+ message = `Number must be less than ${issue.inclusive ? `or equal to ` : ``}${issue.maximum}`;
156584
+ else
156585
+ message = "Invalid input";
156586
+ break;
156587
+ case ZodIssueCode.custom:
156588
+ message = `Invalid input`;
156589
+ break;
156590
+ case ZodIssueCode.invalid_intersection_types:
156591
+ message = `Intersection results could not be merged`;
156592
+ break;
156593
+ case ZodIssueCode.not_multiple_of:
156594
+ message = `Number must be a multiple of ${issue.multipleOf}`;
156595
+ break;
156596
+ default:
156597
+ message = _ctx.defaultError;
156598
+ util.assertNever(issue);
156599
+ }
156600
+ return { message };
156601
+ }, "defaultErrorMap");
156602
+ var overrideErrorMap = defaultErrorMap;
156603
+ var setErrorMap = /* @__PURE__ */ __name((map2) => {
156604
+ overrideErrorMap = map2;
156605
+ }, "setErrorMap");
156606
+ var makeIssue = /* @__PURE__ */ __name((params) => {
156607
+ const { data, path, errorMaps, issueData } = params;
156608
+ const fullPath = [...path, ...issueData.path || []];
156609
+ const fullIssue = __spreadProps(__spreadValues({}, issueData), {
156610
+ path: fullPath
156611
+ });
156612
+ let errorMessage = "";
156613
+ const maps = errorMaps.filter((m) => !!m).slice().reverse();
156614
+ for (const map2 of maps) {
156615
+ errorMessage = map2(fullIssue, { data, defaultError: errorMessage }).message;
156616
+ }
156617
+ return __spreadProps(__spreadValues({}, issueData), {
156618
+ path: fullPath,
156619
+ message: issueData.message || errorMessage
156620
+ });
156621
+ }, "makeIssue");
156622
+ var EMPTY_PATH = [];
156623
+ function addIssueToContext(ctx, issueData) {
156624
+ const issue = makeIssue({
156625
+ issueData,
156626
+ data: ctx.data,
156627
+ path: ctx.path,
156628
+ errorMaps: [
156629
+ ctx.common.contextualErrorMap,
156630
+ ctx.schemaErrorMap,
156631
+ overrideErrorMap,
156632
+ defaultErrorMap
156633
+ ].filter((x) => !!x)
156634
+ });
156635
+ ctx.common.issues.push(issue);
156636
+ }
156637
+ __name(addIssueToContext, "addIssueToContext");
156638
+ var ParseStatus = class {
156639
+ constructor() {
156640
+ this.value = "valid";
156641
+ }
156642
+ dirty() {
156643
+ if (this.value === "valid")
156644
+ this.value = "dirty";
156645
+ }
156646
+ abort() {
156647
+ if (this.value !== "aborted")
156648
+ this.value = "aborted";
156649
+ }
156650
+ static mergeArray(status, results) {
156651
+ const arrayValue = [];
156652
+ for (const s of results) {
156653
+ if (s.status === "aborted")
156654
+ return INVALID;
156655
+ if (s.status === "dirty")
156656
+ status.dirty();
156657
+ arrayValue.push(s.value);
156658
+ }
156659
+ return { status: status.value, value: arrayValue };
156660
+ }
156661
+ static mergeObjectAsync(status, pairs) {
156662
+ return __async$1(this, null, function* () {
156663
+ const syncPairs = [];
156664
+ for (const pair of pairs) {
156665
+ syncPairs.push({
156666
+ key: yield pair.key,
156667
+ value: yield pair.value
156668
+ });
156669
+ }
156670
+ return ParseStatus.mergeObjectSync(status, syncPairs);
156671
+ });
156672
+ }
156673
+ static mergeObjectSync(status, pairs) {
156674
+ const finalObject = {};
156675
+ for (const pair of pairs) {
156676
+ const { key: key2, value } = pair;
156677
+ if (key2.status === "aborted")
156678
+ return INVALID;
156679
+ if (value.status === "aborted")
156680
+ return INVALID;
156681
+ if (key2.status === "dirty")
156682
+ status.dirty();
156683
+ if (value.status === "dirty")
156684
+ status.dirty();
156685
+ if (typeof value.value !== "undefined" || pair.alwaysSet) {
156686
+ finalObject[key2.value] = value.value;
156687
+ }
156688
+ }
156689
+ return { status: status.value, value: finalObject };
156690
+ }
156691
+ };
156692
+ __name(ParseStatus, "ParseStatus");
156693
+ var INVALID = Object.freeze({
156694
+ status: "aborted"
156695
+ });
156696
+ var DIRTY = /* @__PURE__ */ __name((value) => ({ status: "dirty", value }), "DIRTY");
156697
+ var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
156698
+ var isAborted = /* @__PURE__ */ __name((x) => x.status === "aborted", "isAborted");
156699
+ var isDirty = /* @__PURE__ */ __name((x) => x.status === "dirty", "isDirty");
156700
+ var isValid = /* @__PURE__ */ __name((x) => x.status === "valid", "isValid");
156701
+ var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== void 0 && x instanceof Promise, "isAsync");
156702
+ var errorUtil;
156703
+ (function(errorUtil2) {
156704
+ errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
156705
+ errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
156706
+ })(errorUtil || (errorUtil = {}));
156707
+ var ParseInputLazyPath = class {
156708
+ constructor(parent, value, path, key2) {
156709
+ this.parent = parent;
156710
+ this.data = value;
156711
+ this._path = path;
156712
+ this._key = key2;
156713
+ }
156714
+ get path() {
156715
+ return this._path.concat(this._key);
156716
+ }
156717
+ };
156718
+ __name(ParseInputLazyPath, "ParseInputLazyPath");
156719
+ var handleResult = /* @__PURE__ */ __name((ctx, result) => {
156720
+ if (isValid(result)) {
156721
+ return { success: true, data: result.value };
156722
+ } else {
156723
+ if (!ctx.common.issues.length) {
156724
+ throw new Error("Validation failed but no issues detected.");
156725
+ }
156726
+ const error = new ZodError(ctx.common.issues);
156727
+ return { success: false, error };
156728
+ }
156729
+ }, "handleResult");
156730
+ function processCreateParams(params) {
156731
+ if (!params)
156732
+ return {};
156733
+ const { errorMap, invalid_type_error, required_error, description } = params;
156734
+ if (errorMap && (invalid_type_error || required_error)) {
156735
+ throw new Error(`Can't use "invalid" or "required" in conjunction with custom error map.`);
156736
+ }
156737
+ if (errorMap)
156738
+ return { errorMap, description };
156739
+ const customMap = /* @__PURE__ */ __name((iss, ctx) => {
156740
+ if (iss.code !== "invalid_type")
156741
+ return { message: ctx.defaultError };
156742
+ if (typeof ctx.data === "undefined" && required_error)
156743
+ return { message: required_error };
156744
+ if (params.invalid_type_error)
156745
+ return { message: params.invalid_type_error };
156746
+ return { message: ctx.defaultError };
156747
+ }, "customMap");
156748
+ return { errorMap: customMap, description };
156749
+ }
156750
+ __name(processCreateParams, "processCreateParams");
156751
+ var ZodType = class {
156752
+ constructor(def) {
156753
+ this.spa = this.safeParseAsync;
156754
+ this.superRefine = this._refinement;
156755
+ this._def = def;
156756
+ this.parse = this.parse.bind(this);
156757
+ this.safeParse = this.safeParse.bind(this);
156758
+ this.parseAsync = this.parseAsync.bind(this);
156759
+ this.safeParseAsync = this.safeParseAsync.bind(this);
156760
+ this.spa = this.spa.bind(this);
156761
+ this.refine = this.refine.bind(this);
156762
+ this.refinement = this.refinement.bind(this);
156763
+ this.superRefine = this.superRefine.bind(this);
156764
+ this.optional = this.optional.bind(this);
156765
+ this.nullable = this.nullable.bind(this);
156766
+ this.nullish = this.nullish.bind(this);
156767
+ this.array = this.array.bind(this);
156768
+ this.promise = this.promise.bind(this);
156769
+ this.or = this.or.bind(this);
156770
+ this.and = this.and.bind(this);
156771
+ this.transform = this.transform.bind(this);
156772
+ this.default = this.default.bind(this);
156773
+ this.describe = this.describe.bind(this);
156774
+ this.isNullable = this.isNullable.bind(this);
156775
+ this.isOptional = this.isOptional.bind(this);
156776
+ }
156777
+ get description() {
156778
+ return this._def.description;
156779
+ }
156780
+ _getType(input) {
156781
+ return getParsedType(input.data);
156782
+ }
156783
+ _getOrReturnCtx(input, ctx) {
156784
+ return ctx || {
156785
+ common: input.parent.common,
156786
+ data: input.data,
156787
+ parsedType: getParsedType(input.data),
156788
+ schemaErrorMap: this._def.errorMap,
156789
+ path: input.path,
156790
+ parent: input.parent
156791
+ };
156792
+ }
156793
+ _processInputParams(input) {
156794
+ return {
156795
+ status: new ParseStatus(),
156796
+ ctx: {
156797
+ common: input.parent.common,
156798
+ data: input.data,
156799
+ parsedType: getParsedType(input.data),
156800
+ schemaErrorMap: this._def.errorMap,
156801
+ path: input.path,
156802
+ parent: input.parent
156803
+ }
156804
+ };
156805
+ }
156806
+ _parseSync(input) {
156807
+ const result = this._parse(input);
156808
+ if (isAsync(result)) {
156809
+ throw new Error("Synchronous parse encountered promise.");
156810
+ }
156811
+ return result;
156812
+ }
156813
+ _parseAsync(input) {
156814
+ const result = this._parse(input);
156815
+ return Promise.resolve(result);
156816
+ }
156817
+ parse(data, params) {
156818
+ const result = this.safeParse(data, params);
156819
+ if (result.success)
156820
+ return result.data;
156821
+ throw result.error;
156822
+ }
156823
+ safeParse(data, params) {
156824
+ var _a;
156825
+ const ctx = {
156826
+ common: {
156827
+ issues: [],
156828
+ async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
156829
+ contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
156830
+ },
156831
+ path: (params === null || params === void 0 ? void 0 : params.path) || [],
156832
+ schemaErrorMap: this._def.errorMap,
156833
+ parent: null,
156834
+ data,
156835
+ parsedType: getParsedType(data)
156836
+ };
156837
+ const result = this._parseSync({ data, path: ctx.path, parent: ctx });
156838
+ return handleResult(ctx, result);
156839
+ }
156840
+ parseAsync(data, params) {
156841
+ return __async$1(this, null, function* () {
156842
+ const result = yield this.safeParseAsync(data, params);
156843
+ if (result.success)
156844
+ return result.data;
156845
+ throw result.error;
156846
+ });
156847
+ }
156848
+ safeParseAsync(data, params) {
156849
+ return __async$1(this, null, function* () {
156850
+ const ctx = {
156851
+ common: {
156852
+ issues: [],
156853
+ contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
156854
+ async: true
156855
+ },
156856
+ path: (params === null || params === void 0 ? void 0 : params.path) || [],
156857
+ schemaErrorMap: this._def.errorMap,
156858
+ parent: null,
156859
+ data,
156860
+ parsedType: getParsedType(data)
156861
+ };
156643
156862
  const maybeAsyncResult = this._parse({ data, path: [], parent: ctx });
156644
156863
  const result = yield isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult);
156645
156864
  return handleResult(ctx, result);
@@ -159899,1543 +160118,788 @@ var formatters2 = {
159899
160118
  }
159900
160119
  return addLeadingZeros(weekYear, token.length);
159901
160120
  },
159902
- R: function(date, token) {
159903
- var isoWeekYear = getUTCISOWeekYear(date);
159904
- return addLeadingZeros(isoWeekYear, token.length);
159905
- },
159906
- u: function(date, token) {
159907
- var year = date.getUTCFullYear();
159908
- return addLeadingZeros(year, token.length);
159909
- },
159910
- Q: function(date, token, localize2) {
159911
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
159912
- switch (token) {
159913
- case "Q":
159914
- return String(quarter);
159915
- case "QQ":
159916
- return addLeadingZeros(quarter, 2);
159917
- case "Qo":
159918
- return localize2.ordinalNumber(quarter, {
159919
- unit: "quarter"
159920
- });
159921
- case "QQQ":
159922
- return localize2.quarter(quarter, {
159923
- width: "abbreviated",
159924
- context: "formatting"
159925
- });
159926
- case "QQQQQ":
159927
- return localize2.quarter(quarter, {
159928
- width: "narrow",
159929
- context: "formatting"
159930
- });
159931
- case "QQQQ":
159932
- default:
159933
- return localize2.quarter(quarter, {
159934
- width: "wide",
159935
- context: "formatting"
159936
- });
159937
- }
159938
- },
159939
- q: function(date, token, localize2) {
159940
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
159941
- switch (token) {
159942
- case "q":
159943
- return String(quarter);
159944
- case "qq":
159945
- return addLeadingZeros(quarter, 2);
159946
- case "qo":
159947
- return localize2.ordinalNumber(quarter, {
159948
- unit: "quarter"
159949
- });
159950
- case "qqq":
159951
- return localize2.quarter(quarter, {
159952
- width: "abbreviated",
159953
- context: "standalone"
159954
- });
159955
- case "qqqqq":
159956
- return localize2.quarter(quarter, {
159957
- width: "narrow",
159958
- context: "standalone"
159959
- });
159960
- case "qqqq":
159961
- default:
159962
- return localize2.quarter(quarter, {
159963
- width: "wide",
159964
- context: "standalone"
159965
- });
159966
- }
159967
- },
159968
- M: function(date, token, localize2) {
159969
- var month = date.getUTCMonth();
159970
- switch (token) {
159971
- case "M":
159972
- case "MM":
159973
- return lightFormatters_default.M(date, token);
159974
- case "Mo":
159975
- return localize2.ordinalNumber(month + 1, {
159976
- unit: "month"
159977
- });
159978
- case "MMM":
159979
- return localize2.month(month, {
159980
- width: "abbreviated",
159981
- context: "formatting"
159982
- });
159983
- case "MMMMM":
159984
- return localize2.month(month, {
159985
- width: "narrow",
159986
- context: "formatting"
159987
- });
159988
- case "MMMM":
159989
- default:
159990
- return localize2.month(month, {
159991
- width: "wide",
159992
- context: "formatting"
159993
- });
159994
- }
159995
- },
159996
- L: function(date, token, localize2) {
159997
- var month = date.getUTCMonth();
159998
- switch (token) {
159999
- case "L":
160000
- return String(month + 1);
160001
- case "LL":
160002
- return addLeadingZeros(month + 1, 2);
160003
- case "Lo":
160004
- return localize2.ordinalNumber(month + 1, {
160005
- unit: "month"
160006
- });
160007
- case "LLL":
160008
- return localize2.month(month, {
160009
- width: "abbreviated",
160010
- context: "standalone"
160011
- });
160012
- case "LLLLL":
160013
- return localize2.month(month, {
160014
- width: "narrow",
160015
- context: "standalone"
160016
- });
160017
- case "LLLL":
160018
- default:
160019
- return localize2.month(month, {
160020
- width: "wide",
160021
- context: "standalone"
160022
- });
160023
- }
160024
- },
160025
- w: function(date, token, localize2, options) {
160026
- var week = getUTCWeek(date, options);
160027
- if (token === "wo") {
160028
- return localize2.ordinalNumber(week, {
160029
- unit: "week"
160030
- });
160031
- }
160032
- return addLeadingZeros(week, token.length);
160033
- },
160034
- I: function(date, token, localize2) {
160035
- var isoWeek = getUTCISOWeek(date);
160036
- if (token === "Io") {
160037
- return localize2.ordinalNumber(isoWeek, {
160038
- unit: "week"
160039
- });
160040
- }
160041
- return addLeadingZeros(isoWeek, token.length);
160042
- },
160043
- d: function(date, token, localize2) {
160044
- if (token === "do") {
160045
- return localize2.ordinalNumber(date.getUTCDate(), {
160046
- unit: "date"
160047
- });
160048
- }
160049
- return lightFormatters_default.d(date, token);
160050
- },
160051
- D: function(date, token, localize2) {
160052
- var dayOfYear = getUTCDayOfYear(date);
160053
- if (token === "Do") {
160054
- return localize2.ordinalNumber(dayOfYear, {
160055
- unit: "dayOfYear"
160056
- });
160057
- }
160058
- return addLeadingZeros(dayOfYear, token.length);
160059
- },
160060
- E: function(date, token, localize2) {
160061
- var dayOfWeek = date.getUTCDay();
160062
- switch (token) {
160063
- case "E":
160064
- case "EE":
160065
- case "EEE":
160066
- return localize2.day(dayOfWeek, {
160067
- width: "abbreviated",
160068
- context: "formatting"
160069
- });
160070
- case "EEEEE":
160071
- return localize2.day(dayOfWeek, {
160072
- width: "narrow",
160073
- context: "formatting"
160074
- });
160075
- case "EEEEEE":
160076
- return localize2.day(dayOfWeek, {
160077
- width: "short",
160078
- context: "formatting"
160079
- });
160080
- case "EEEE":
160081
- default:
160082
- return localize2.day(dayOfWeek, {
160083
- width: "wide",
160084
- context: "formatting"
160085
- });
160086
- }
160087
- },
160088
- e: function(date, token, localize2, options) {
160089
- var dayOfWeek = date.getUTCDay();
160090
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
160091
- switch (token) {
160092
- case "e":
160093
- return String(localDayOfWeek);
160094
- case "ee":
160095
- return addLeadingZeros(localDayOfWeek, 2);
160096
- case "eo":
160097
- return localize2.ordinalNumber(localDayOfWeek, {
160098
- unit: "day"
160099
- });
160100
- case "eee":
160101
- return localize2.day(dayOfWeek, {
160102
- width: "abbreviated",
160103
- context: "formatting"
160104
- });
160105
- case "eeeee":
160106
- return localize2.day(dayOfWeek, {
160107
- width: "narrow",
160108
- context: "formatting"
160109
- });
160110
- case "eeeeee":
160111
- return localize2.day(dayOfWeek, {
160112
- width: "short",
160113
- context: "formatting"
160114
- });
160115
- case "eeee":
160116
- default:
160117
- return localize2.day(dayOfWeek, {
160118
- width: "wide",
160119
- context: "formatting"
160120
- });
160121
- }
160122
- },
160123
- c: function(date, token, localize2, options) {
160124
- var dayOfWeek = date.getUTCDay();
160125
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
160126
- switch (token) {
160127
- case "c":
160128
- return String(localDayOfWeek);
160129
- case "cc":
160130
- return addLeadingZeros(localDayOfWeek, token.length);
160131
- case "co":
160132
- return localize2.ordinalNumber(localDayOfWeek, {
160133
- unit: "day"
160134
- });
160135
- case "ccc":
160136
- return localize2.day(dayOfWeek, {
160137
- width: "abbreviated",
160138
- context: "standalone"
160139
- });
160140
- case "ccccc":
160141
- return localize2.day(dayOfWeek, {
160142
- width: "narrow",
160143
- context: "standalone"
160144
- });
160145
- case "cccccc":
160146
- return localize2.day(dayOfWeek, {
160147
- width: "short",
160148
- context: "standalone"
160149
- });
160150
- case "cccc":
160151
- default:
160152
- return localize2.day(dayOfWeek, {
160153
- width: "wide",
160154
- context: "standalone"
160155
- });
160156
- }
160121
+ R: function(date, token) {
160122
+ var isoWeekYear = getUTCISOWeekYear(date);
160123
+ return addLeadingZeros(isoWeekYear, token.length);
160157
160124
  },
160158
- i: function(date, token, localize2) {
160159
- var dayOfWeek = date.getUTCDay();
160160
- var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
160125
+ u: function(date, token) {
160126
+ var year = date.getUTCFullYear();
160127
+ return addLeadingZeros(year, token.length);
160128
+ },
160129
+ Q: function(date, token, localize2) {
160130
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
160161
160131
  switch (token) {
160162
- case "i":
160163
- return String(isoDayOfWeek);
160164
- case "ii":
160165
- return addLeadingZeros(isoDayOfWeek, token.length);
160166
- case "io":
160167
- return localize2.ordinalNumber(isoDayOfWeek, {
160168
- unit: "day"
160132
+ case "Q":
160133
+ return String(quarter);
160134
+ case "QQ":
160135
+ return addLeadingZeros(quarter, 2);
160136
+ case "Qo":
160137
+ return localize2.ordinalNumber(quarter, {
160138
+ unit: "quarter"
160169
160139
  });
160170
- case "iii":
160171
- return localize2.day(dayOfWeek, {
160140
+ case "QQQ":
160141
+ return localize2.quarter(quarter, {
160172
160142
  width: "abbreviated",
160173
160143
  context: "formatting"
160174
160144
  });
160175
- case "iiiii":
160176
- return localize2.day(dayOfWeek, {
160145
+ case "QQQQQ":
160146
+ return localize2.quarter(quarter, {
160177
160147
  width: "narrow",
160178
160148
  context: "formatting"
160179
160149
  });
160180
- case "iiiiii":
160181
- return localize2.day(dayOfWeek, {
160182
- width: "short",
160183
- context: "formatting"
160184
- });
160185
- case "iiii":
160150
+ case "QQQQ":
160186
160151
  default:
160187
- return localize2.day(dayOfWeek, {
160152
+ return localize2.quarter(quarter, {
160188
160153
  width: "wide",
160189
160154
  context: "formatting"
160190
160155
  });
160191
160156
  }
160192
160157
  },
160193
- a: function(date, token, localize2) {
160194
- var hours = date.getUTCHours();
160195
- var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
160158
+ q: function(date, token, localize2) {
160159
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
160196
160160
  switch (token) {
160197
- case "a":
160198
- case "aa":
160199
- return localize2.dayPeriod(dayPeriodEnumValue, {
160200
- width: "abbreviated",
160201
- context: "formatting"
160161
+ case "q":
160162
+ return String(quarter);
160163
+ case "qq":
160164
+ return addLeadingZeros(quarter, 2);
160165
+ case "qo":
160166
+ return localize2.ordinalNumber(quarter, {
160167
+ unit: "quarter"
160202
160168
  });
160203
- case "aaa":
160204
- return localize2.dayPeriod(dayPeriodEnumValue, {
160169
+ case "qqq":
160170
+ return localize2.quarter(quarter, {
160205
160171
  width: "abbreviated",
160206
- context: "formatting"
160207
- }).toLowerCase();
160208
- case "aaaaa":
160209
- return localize2.dayPeriod(dayPeriodEnumValue, {
160172
+ context: "standalone"
160173
+ });
160174
+ case "qqqqq":
160175
+ return localize2.quarter(quarter, {
160210
160176
  width: "narrow",
160211
- context: "formatting"
160177
+ context: "standalone"
160212
160178
  });
160213
- case "aaaa":
160179
+ case "qqqq":
160214
160180
  default:
160215
- return localize2.dayPeriod(dayPeriodEnumValue, {
160181
+ return localize2.quarter(quarter, {
160216
160182
  width: "wide",
160217
- context: "formatting"
160183
+ context: "standalone"
160218
160184
  });
160219
160185
  }
160220
160186
  },
160221
- b: function(date, token, localize2) {
160222
- var hours = date.getUTCHours();
160223
- var dayPeriodEnumValue;
160224
- if (hours === 12) {
160225
- dayPeriodEnumValue = dayPeriodEnum.noon;
160226
- } else if (hours === 0) {
160227
- dayPeriodEnumValue = dayPeriodEnum.midnight;
160228
- } else {
160229
- dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
160230
- }
160187
+ M: function(date, token, localize2) {
160188
+ var month = date.getUTCMonth();
160231
160189
  switch (token) {
160232
- case "b":
160233
- case "bb":
160234
- return localize2.dayPeriod(dayPeriodEnumValue, {
160235
- width: "abbreviated",
160236
- context: "formatting"
160190
+ case "M":
160191
+ case "MM":
160192
+ return lightFormatters_default.M(date, token);
160193
+ case "Mo":
160194
+ return localize2.ordinalNumber(month + 1, {
160195
+ unit: "month"
160237
160196
  });
160238
- case "bbb":
160239
- return localize2.dayPeriod(dayPeriodEnumValue, {
160197
+ case "MMM":
160198
+ return localize2.month(month, {
160240
160199
  width: "abbreviated",
160241
160200
  context: "formatting"
160242
- }).toLowerCase();
160243
- case "bbbbb":
160244
- return localize2.dayPeriod(dayPeriodEnumValue, {
160201
+ });
160202
+ case "MMMMM":
160203
+ return localize2.month(month, {
160245
160204
  width: "narrow",
160246
160205
  context: "formatting"
160247
160206
  });
160248
- case "bbbb":
160207
+ case "MMMM":
160249
160208
  default:
160250
- return localize2.dayPeriod(dayPeriodEnumValue, {
160209
+ return localize2.month(month, {
160251
160210
  width: "wide",
160252
160211
  context: "formatting"
160253
160212
  });
160254
160213
  }
160255
160214
  },
160256
- B: function(date, token, localize2) {
160257
- var hours = date.getUTCHours();
160258
- var dayPeriodEnumValue;
160259
- if (hours >= 17) {
160260
- dayPeriodEnumValue = dayPeriodEnum.evening;
160261
- } else if (hours >= 12) {
160262
- dayPeriodEnumValue = dayPeriodEnum.afternoon;
160263
- } else if (hours >= 4) {
160264
- dayPeriodEnumValue = dayPeriodEnum.morning;
160265
- } else {
160266
- dayPeriodEnumValue = dayPeriodEnum.night;
160267
- }
160215
+ L: function(date, token, localize2) {
160216
+ var month = date.getUTCMonth();
160268
160217
  switch (token) {
160269
- case "B":
160270
- case "BB":
160271
- case "BBB":
160272
- return localize2.dayPeriod(dayPeriodEnumValue, {
160218
+ case "L":
160219
+ return String(month + 1);
160220
+ case "LL":
160221
+ return addLeadingZeros(month + 1, 2);
160222
+ case "Lo":
160223
+ return localize2.ordinalNumber(month + 1, {
160224
+ unit: "month"
160225
+ });
160226
+ case "LLL":
160227
+ return localize2.month(month, {
160273
160228
  width: "abbreviated",
160274
- context: "formatting"
160229
+ context: "standalone"
160275
160230
  });
160276
- case "BBBBB":
160277
- return localize2.dayPeriod(dayPeriodEnumValue, {
160231
+ case "LLLLL":
160232
+ return localize2.month(month, {
160278
160233
  width: "narrow",
160279
- context: "formatting"
160234
+ context: "standalone"
160280
160235
  });
160281
- case "BBBB":
160236
+ case "LLLL":
160282
160237
  default:
160283
- return localize2.dayPeriod(dayPeriodEnumValue, {
160238
+ return localize2.month(month, {
160284
160239
  width: "wide",
160285
- context: "formatting"
160240
+ context: "standalone"
160286
160241
  });
160287
160242
  }
160288
160243
  },
160289
- h: function(date, token, localize2) {
160290
- if (token === "ho") {
160291
- var hours = date.getUTCHours() % 12;
160292
- if (hours === 0)
160293
- hours = 12;
160294
- return localize2.ordinalNumber(hours, {
160295
- unit: "hour"
160296
- });
160297
- }
160298
- return lightFormatters_default.h(date, token);
160299
- },
160300
- H: function(date, token, localize2) {
160301
- if (token === "Ho") {
160302
- return localize2.ordinalNumber(date.getUTCHours(), {
160303
- unit: "hour"
160304
- });
160305
- }
160306
- return lightFormatters_default.H(date, token);
160307
- },
160308
- K: function(date, token, localize2) {
160309
- var hours = date.getUTCHours() % 12;
160310
- if (token === "Ko") {
160311
- return localize2.ordinalNumber(hours, {
160312
- unit: "hour"
160313
- });
160314
- }
160315
- return addLeadingZeros(hours, token.length);
160316
- },
160317
- k: function(date, token, localize2) {
160318
- var hours = date.getUTCHours();
160319
- if (hours === 0)
160320
- hours = 24;
160321
- if (token === "ko") {
160322
- return localize2.ordinalNumber(hours, {
160323
- unit: "hour"
160324
- });
160325
- }
160326
- return addLeadingZeros(hours, token.length);
160327
- },
160328
- m: function(date, token, localize2) {
160329
- if (token === "mo") {
160330
- return localize2.ordinalNumber(date.getUTCMinutes(), {
160331
- unit: "minute"
160244
+ w: function(date, token, localize2, options) {
160245
+ var week = getUTCWeek(date, options);
160246
+ if (token === "wo") {
160247
+ return localize2.ordinalNumber(week, {
160248
+ unit: "week"
160332
160249
  });
160333
160250
  }
160334
- return lightFormatters_default.m(date, token);
160251
+ return addLeadingZeros(week, token.length);
160335
160252
  },
160336
- s: function(date, token, localize2) {
160337
- if (token === "so") {
160338
- return localize2.ordinalNumber(date.getUTCSeconds(), {
160339
- unit: "second"
160253
+ I: function(date, token, localize2) {
160254
+ var isoWeek = getUTCISOWeek(date);
160255
+ if (token === "Io") {
160256
+ return localize2.ordinalNumber(isoWeek, {
160257
+ unit: "week"
160340
160258
  });
160341
160259
  }
160342
- return lightFormatters_default.s(date, token);
160343
- },
160344
- S: function(date, token) {
160345
- return lightFormatters_default.S(date, token);
160346
- },
160347
- X: function(date, token, _localize, options) {
160348
- var originalDate = options._originalDate || date;
160349
- var timezoneOffset = originalDate.getTimezoneOffset();
160350
- if (timezoneOffset === 0) {
160351
- return "Z";
160352
- }
160353
- switch (token) {
160354
- case "X":
160355
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
160356
- case "XXXX":
160357
- case "XX":
160358
- return formatTimezone(timezoneOffset);
160359
- case "XXXXX":
160360
- case "XXX":
160361
- default:
160362
- return formatTimezone(timezoneOffset, ":");
160363
- }
160260
+ return addLeadingZeros(isoWeek, token.length);
160364
160261
  },
160365
- x: function(date, token, _localize, options) {
160366
- var originalDate = options._originalDate || date;
160367
- var timezoneOffset = originalDate.getTimezoneOffset();
160368
- switch (token) {
160369
- case "x":
160370
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
160371
- case "xxxx":
160372
- case "xx":
160373
- return formatTimezone(timezoneOffset);
160374
- case "xxxxx":
160375
- case "xxx":
160376
- default:
160377
- return formatTimezone(timezoneOffset, ":");
160262
+ d: function(date, token, localize2) {
160263
+ if (token === "do") {
160264
+ return localize2.ordinalNumber(date.getUTCDate(), {
160265
+ unit: "date"
160266
+ });
160378
160267
  }
160268
+ return lightFormatters_default.d(date, token);
160379
160269
  },
160380
- O: function(date, token, _localize, options) {
160381
- var originalDate = options._originalDate || date;
160382
- var timezoneOffset = originalDate.getTimezoneOffset();
160383
- switch (token) {
160384
- case "O":
160385
- case "OO":
160386
- case "OOO":
160387
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
160388
- case "OOOO":
160389
- default:
160390
- return "GMT" + formatTimezone(timezoneOffset, ":");
160270
+ D: function(date, token, localize2) {
160271
+ var dayOfYear = getUTCDayOfYear(date);
160272
+ if (token === "Do") {
160273
+ return localize2.ordinalNumber(dayOfYear, {
160274
+ unit: "dayOfYear"
160275
+ });
160391
160276
  }
160277
+ return addLeadingZeros(dayOfYear, token.length);
160392
160278
  },
160393
- z: function(date, token, _localize, options) {
160394
- var originalDate = options._originalDate || date;
160395
- var timezoneOffset = originalDate.getTimezoneOffset();
160279
+ E: function(date, token, localize2) {
160280
+ var dayOfWeek = date.getUTCDay();
160396
160281
  switch (token) {
160397
- case "z":
160398
- case "zz":
160399
- case "zzz":
160400
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
160401
- case "zzzz":
160282
+ case "E":
160283
+ case "EE":
160284
+ case "EEE":
160285
+ return localize2.day(dayOfWeek, {
160286
+ width: "abbreviated",
160287
+ context: "formatting"
160288
+ });
160289
+ case "EEEEE":
160290
+ return localize2.day(dayOfWeek, {
160291
+ width: "narrow",
160292
+ context: "formatting"
160293
+ });
160294
+ case "EEEEEE":
160295
+ return localize2.day(dayOfWeek, {
160296
+ width: "short",
160297
+ context: "formatting"
160298
+ });
160299
+ case "EEEE":
160402
160300
  default:
160403
- return "GMT" + formatTimezone(timezoneOffset, ":");
160301
+ return localize2.day(dayOfWeek, {
160302
+ width: "wide",
160303
+ context: "formatting"
160304
+ });
160404
160305
  }
160405
160306
  },
160406
- t: function(date, token, _localize, options) {
160407
- var originalDate = options._originalDate || date;
160408
- var timestamp = Math.floor(originalDate.getTime() / 1e3);
160409
- return addLeadingZeros(timestamp, token.length);
160410
- },
160411
- T: function(date, token, _localize, options) {
160412
- var originalDate = options._originalDate || date;
160413
- var timestamp = originalDate.getTime();
160414
- return addLeadingZeros(timestamp, token.length);
160415
- }
160416
- };
160417
- function formatTimezoneShort(offset, dirtyDelimiter) {
160418
- var sign5 = offset > 0 ? "-" : "+";
160419
- var absOffset = Math.abs(offset);
160420
- var hours = Math.floor(absOffset / 60);
160421
- var minutes = absOffset % 60;
160422
- if (minutes === 0) {
160423
- return sign5 + String(hours);
160424
- }
160425
- var delimiter = dirtyDelimiter || "";
160426
- return sign5 + String(hours) + delimiter + addLeadingZeros(minutes, 2);
160427
- }
160428
- __name(formatTimezoneShort, "formatTimezoneShort");
160429
- function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
160430
- if (offset % 60 === 0) {
160431
- var sign5 = offset > 0 ? "-" : "+";
160432
- return sign5 + addLeadingZeros(Math.abs(offset) / 60, 2);
160433
- }
160434
- return formatTimezone(offset, dirtyDelimiter);
160435
- }
160436
- __name(formatTimezoneWithOptionalMinutes, "formatTimezoneWithOptionalMinutes");
160437
- function formatTimezone(offset, dirtyDelimiter) {
160438
- var delimiter = dirtyDelimiter || "";
160439
- var sign5 = offset > 0 ? "-" : "+";
160440
- var absOffset = Math.abs(offset);
160441
- var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
160442
- var minutes = addLeadingZeros(absOffset % 60, 2);
160443
- return sign5 + hours + delimiter + minutes;
160444
- }
160445
- __name(formatTimezone, "formatTimezone");
160446
- var formatters_default = formatters2;
160447
- function dateLongFormatter(pattern, formatLong2) {
160448
- switch (pattern) {
160449
- case "P":
160450
- return formatLong2.date({
160451
- width: "short"
160452
- });
160453
- case "PP":
160454
- return formatLong2.date({
160455
- width: "medium"
160456
- });
160457
- case "PPP":
160458
- return formatLong2.date({
160459
- width: "long"
160460
- });
160461
- case "PPPP":
160462
- default:
160463
- return formatLong2.date({
160464
- width: "full"
160465
- });
160466
- }
160467
- }
160468
- __name(dateLongFormatter, "dateLongFormatter");
160469
- function timeLongFormatter(pattern, formatLong2) {
160470
- switch (pattern) {
160471
- case "p":
160472
- return formatLong2.time({
160473
- width: "short"
160474
- });
160475
- case "pp":
160476
- return formatLong2.time({
160477
- width: "medium"
160478
- });
160479
- case "ppp":
160480
- return formatLong2.time({
160481
- width: "long"
160482
- });
160483
- case "pppp":
160484
- default:
160485
- return formatLong2.time({
160486
- width: "full"
160487
- });
160488
- }
160489
- }
160490
- __name(timeLongFormatter, "timeLongFormatter");
160491
- function dateTimeLongFormatter(pattern, formatLong2) {
160492
- var matchResult = pattern.match(/(P+)(p+)?/) || [];
160493
- var datePattern = matchResult[1];
160494
- var timePattern = matchResult[2];
160495
- if (!timePattern) {
160496
- return dateLongFormatter(pattern, formatLong2);
160497
- }
160498
- var dateTimeFormat;
160499
- switch (datePattern) {
160500
- case "P":
160501
- dateTimeFormat = formatLong2.dateTime({
160502
- width: "short"
160503
- });
160504
- break;
160505
- case "PP":
160506
- dateTimeFormat = formatLong2.dateTime({
160507
- width: "medium"
160508
- });
160509
- break;
160510
- case "PPP":
160511
- dateTimeFormat = formatLong2.dateTime({
160512
- width: "long"
160513
- });
160514
- break;
160515
- case "PPPP":
160516
- default:
160517
- dateTimeFormat = formatLong2.dateTime({
160518
- width: "full"
160519
- });
160520
- break;
160521
- }
160522
- return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
160523
- }
160524
- __name(dateTimeLongFormatter, "dateTimeLongFormatter");
160525
- var longFormatters = {
160526
- p: timeLongFormatter,
160527
- P: dateTimeLongFormatter
160528
- };
160529
- var longFormatters_default = longFormatters;
160530
- var protectedDayOfYearTokens = ["D", "DD"];
160531
- var protectedWeekYearTokens = ["YY", "YYYY"];
160532
- function isProtectedDayOfYearToken(token) {
160533
- return protectedDayOfYearTokens.indexOf(token) !== -1;
160534
- }
160535
- __name(isProtectedDayOfYearToken, "isProtectedDayOfYearToken");
160536
- function isProtectedWeekYearToken(token) {
160537
- return protectedWeekYearTokens.indexOf(token) !== -1;
160538
- }
160539
- __name(isProtectedWeekYearToken, "isProtectedWeekYearToken");
160540
- function throwProtectedError(token, format2, input) {
160541
- if (token === "YYYY") {
160542
- throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
160543
- } else if (token === "YY") {
160544
- throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
160545
- } else if (token === "D") {
160546
- throw new RangeError("Use `d` instead of `D` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
160547
- } else if (token === "DD") {
160548
- throw new RangeError("Use `dd` instead of `DD` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
160549
- }
160550
- }
160551
- __name(throwProtectedError, "throwProtectedError");
160552
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
160553
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
160554
- var escapedStringRegExp = /^'([^]*?)'?$/;
160555
- var doubleQuoteRegExp = /''/g;
160556
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
160557
- function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
160558
- requiredArgs(2, arguments);
160559
- var formatStr = String(dirtyFormatStr);
160560
- var options = dirtyOptions || {};
160561
- var locale2 = options.locale || en_US_default;
160562
- var localeFirstWeekContainsDate = locale2.options && locale2.options.firstWeekContainsDate;
160563
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
160564
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
160565
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
160566
- throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
160567
- }
160568
- var localeWeekStartsOn = locale2.options && locale2.options.weekStartsOn;
160569
- var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
160570
- var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn);
160571
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
160572
- throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
160573
- }
160574
- if (!locale2.localize) {
160575
- throw new RangeError("locale must contain localize property");
160576
- }
160577
- if (!locale2.formatLong) {
160578
- throw new RangeError("locale must contain formatLong property");
160579
- }
160580
- var originalDate = toDate(dirtyDate);
160581
- if (!isValid2(originalDate)) {
160582
- throw new RangeError("Invalid time value");
160583
- }
160584
- var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
160585
- var utcDate = subMilliseconds(originalDate, timezoneOffset);
160586
- var formatterOptions = {
160587
- firstWeekContainsDate,
160588
- weekStartsOn,
160589
- locale: locale2,
160590
- _originalDate: originalDate
160591
- };
160592
- var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) {
160593
- var firstCharacter = substring[0];
160594
- if (firstCharacter === "p" || firstCharacter === "P") {
160595
- var longFormatter = longFormatters_default[firstCharacter];
160596
- return longFormatter(substring, locale2.formatLong, formatterOptions);
160307
+ e: function(date, token, localize2, options) {
160308
+ var dayOfWeek = date.getUTCDay();
160309
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
160310
+ switch (token) {
160311
+ case "e":
160312
+ return String(localDayOfWeek);
160313
+ case "ee":
160314
+ return addLeadingZeros(localDayOfWeek, 2);
160315
+ case "eo":
160316
+ return localize2.ordinalNumber(localDayOfWeek, {
160317
+ unit: "day"
160318
+ });
160319
+ case "eee":
160320
+ return localize2.day(dayOfWeek, {
160321
+ width: "abbreviated",
160322
+ context: "formatting"
160323
+ });
160324
+ case "eeeee":
160325
+ return localize2.day(dayOfWeek, {
160326
+ width: "narrow",
160327
+ context: "formatting"
160328
+ });
160329
+ case "eeeeee":
160330
+ return localize2.day(dayOfWeek, {
160331
+ width: "short",
160332
+ context: "formatting"
160333
+ });
160334
+ case "eeee":
160335
+ default:
160336
+ return localize2.day(dayOfWeek, {
160337
+ width: "wide",
160338
+ context: "formatting"
160339
+ });
160597
160340
  }
160598
- return substring;
160599
- }).join("").match(formattingTokensRegExp).map(function(substring) {
160600
- if (substring === "''") {
160601
- return "'";
160341
+ },
160342
+ c: function(date, token, localize2, options) {
160343
+ var dayOfWeek = date.getUTCDay();
160344
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
160345
+ switch (token) {
160346
+ case "c":
160347
+ return String(localDayOfWeek);
160348
+ case "cc":
160349
+ return addLeadingZeros(localDayOfWeek, token.length);
160350
+ case "co":
160351
+ return localize2.ordinalNumber(localDayOfWeek, {
160352
+ unit: "day"
160353
+ });
160354
+ case "ccc":
160355
+ return localize2.day(dayOfWeek, {
160356
+ width: "abbreviated",
160357
+ context: "standalone"
160358
+ });
160359
+ case "ccccc":
160360
+ return localize2.day(dayOfWeek, {
160361
+ width: "narrow",
160362
+ context: "standalone"
160363
+ });
160364
+ case "cccccc":
160365
+ return localize2.day(dayOfWeek, {
160366
+ width: "short",
160367
+ context: "standalone"
160368
+ });
160369
+ case "cccc":
160370
+ default:
160371
+ return localize2.day(dayOfWeek, {
160372
+ width: "wide",
160373
+ context: "standalone"
160374
+ });
160602
160375
  }
160603
- var firstCharacter = substring[0];
160604
- if (firstCharacter === "'") {
160605
- return cleanEscapedString(substring);
160376
+ },
160377
+ i: function(date, token, localize2) {
160378
+ var dayOfWeek = date.getUTCDay();
160379
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
160380
+ switch (token) {
160381
+ case "i":
160382
+ return String(isoDayOfWeek);
160383
+ case "ii":
160384
+ return addLeadingZeros(isoDayOfWeek, token.length);
160385
+ case "io":
160386
+ return localize2.ordinalNumber(isoDayOfWeek, {
160387
+ unit: "day"
160388
+ });
160389
+ case "iii":
160390
+ return localize2.day(dayOfWeek, {
160391
+ width: "abbreviated",
160392
+ context: "formatting"
160393
+ });
160394
+ case "iiiii":
160395
+ return localize2.day(dayOfWeek, {
160396
+ width: "narrow",
160397
+ context: "formatting"
160398
+ });
160399
+ case "iiiiii":
160400
+ return localize2.day(dayOfWeek, {
160401
+ width: "short",
160402
+ context: "formatting"
160403
+ });
160404
+ case "iiii":
160405
+ default:
160406
+ return localize2.day(dayOfWeek, {
160407
+ width: "wide",
160408
+ context: "formatting"
160409
+ });
160606
160410
  }
160607
- var formatter = formatters_default[firstCharacter];
160608
- if (formatter) {
160609
- if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
160610
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
160611
- }
160612
- if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
160613
- throwProtectedError(substring, dirtyFormatStr, dirtyDate);
160614
- }
160615
- return formatter(utcDate, substring, locale2.localize, formatterOptions);
160411
+ },
160412
+ a: function(date, token, localize2) {
160413
+ var hours = date.getUTCHours();
160414
+ var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
160415
+ switch (token) {
160416
+ case "a":
160417
+ case "aa":
160418
+ return localize2.dayPeriod(dayPeriodEnumValue, {
160419
+ width: "abbreviated",
160420
+ context: "formatting"
160421
+ });
160422
+ case "aaa":
160423
+ return localize2.dayPeriod(dayPeriodEnumValue, {
160424
+ width: "abbreviated",
160425
+ context: "formatting"
160426
+ }).toLowerCase();
160427
+ case "aaaaa":
160428
+ return localize2.dayPeriod(dayPeriodEnumValue, {
160429
+ width: "narrow",
160430
+ context: "formatting"
160431
+ });
160432
+ case "aaaa":
160433
+ default:
160434
+ return localize2.dayPeriod(dayPeriodEnumValue, {
160435
+ width: "wide",
160436
+ context: "formatting"
160437
+ });
160616
160438
  }
160617
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
160618
- throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
160439
+ },
160440
+ b: function(date, token, localize2) {
160441
+ var hours = date.getUTCHours();
160442
+ var dayPeriodEnumValue;
160443
+ if (hours === 12) {
160444
+ dayPeriodEnumValue = dayPeriodEnum.noon;
160445
+ } else if (hours === 0) {
160446
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
160447
+ } else {
160448
+ dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
160619
160449
  }
160620
- return substring;
160621
- }).join("");
160622
- return result;
160623
- }
160624
- __name(format, "format");
160625
- function cleanEscapedString(input) {
160626
- return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
160627
- }
160628
- __name(cleanEscapedString, "cleanEscapedString");
160629
- var transformErrorCheck = /* @__PURE__ */ __name((error, _credential) => {
160630
- const prefix = error.split(" error")[0];
160631
- return prefix || error;
160632
- }, "transformErrorCheck");
160633
- var transformErrorMessage = /* @__PURE__ */ __name((error, credential) => {
160634
- if (error.startsWith("expiration")) {
160635
- return credential.expirationDate ? `Invalid \u2022 Expired ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Invalid \u2022 Expired";
160636
- }
160637
- return error;
160638
- }, "transformErrorMessage");
160639
- var transformCheckMessage = /* @__PURE__ */ __name((check, credential) => {
160640
- return {
160641
- proof: "Valid",
160642
- expiration: credential.expirationDate ? `Valid \u2022 Expires ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Valid \u2022 Does Not Expire"
160643
- }[check] || check;
160644
- }, "transformCheckMessage");
160645
- var verifyCredential2 = /* @__PURE__ */ __name((wallet) => {
160646
- return (credential) => __async$1(void 0, null, function* () {
160647
- const rawVerificationCheck = yield wallet.pluginMethods.verifyCredential(credential);
160648
- const verificationItems = [];
160649
- rawVerificationCheck.errors.forEach((error) => {
160650
- verificationItems.push({
160651
- status: VerificationStatusEnum.Failed,
160652
- check: transformErrorCheck(error, credential),
160653
- details: transformErrorMessage(error, credential)
160450
+ switch (token) {
160451
+ case "b":
160452
+ case "bb":
160453
+ return localize2.dayPeriod(dayPeriodEnumValue, {
160454
+ width: "abbreviated",
160455
+ context: "formatting"
160456
+ });
160457
+ case "bbb":
160458
+ return localize2.dayPeriod(dayPeriodEnumValue, {
160459
+ width: "abbreviated",
160460
+ context: "formatting"
160461
+ }).toLowerCase();
160462
+ case "bbbbb":
160463
+ return localize2.dayPeriod(dayPeriodEnumValue, {
160464
+ width: "narrow",
160465
+ context: "formatting"
160466
+ });
160467
+ case "bbbb":
160468
+ default:
160469
+ return localize2.dayPeriod(dayPeriodEnumValue, {
160470
+ width: "wide",
160471
+ context: "formatting"
160472
+ });
160473
+ }
160474
+ },
160475
+ B: function(date, token, localize2) {
160476
+ var hours = date.getUTCHours();
160477
+ var dayPeriodEnumValue;
160478
+ if (hours >= 17) {
160479
+ dayPeriodEnumValue = dayPeriodEnum.evening;
160480
+ } else if (hours >= 12) {
160481
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
160482
+ } else if (hours >= 4) {
160483
+ dayPeriodEnumValue = dayPeriodEnum.morning;
160484
+ } else {
160485
+ dayPeriodEnumValue = dayPeriodEnum.night;
160486
+ }
160487
+ switch (token) {
160488
+ case "B":
160489
+ case "BB":
160490
+ case "BBB":
160491
+ return localize2.dayPeriod(dayPeriodEnumValue, {
160492
+ width: "abbreviated",
160493
+ context: "formatting"
160494
+ });
160495
+ case "BBBBB":
160496
+ return localize2.dayPeriod(dayPeriodEnumValue, {
160497
+ width: "narrow",
160498
+ context: "formatting"
160499
+ });
160500
+ case "BBBB":
160501
+ default:
160502
+ return localize2.dayPeriod(dayPeriodEnumValue, {
160503
+ width: "wide",
160504
+ context: "formatting"
160505
+ });
160506
+ }
160507
+ },
160508
+ h: function(date, token, localize2) {
160509
+ if (token === "ho") {
160510
+ var hours = date.getUTCHours() % 12;
160511
+ if (hours === 0)
160512
+ hours = 12;
160513
+ return localize2.ordinalNumber(hours, {
160514
+ unit: "hour"
160654
160515
  });
160655
- });
160656
- rawVerificationCheck.warnings.forEach((warning) => {
160657
- verificationItems.push({
160658
- status: VerificationStatusEnum.Error,
160659
- check: "hmm",
160660
- message: warning
160516
+ }
160517
+ return lightFormatters_default.h(date, token);
160518
+ },
160519
+ H: function(date, token, localize2) {
160520
+ if (token === "Ho") {
160521
+ return localize2.ordinalNumber(date.getUTCHours(), {
160522
+ unit: "hour"
160661
160523
  });
160662
- });
160663
- rawVerificationCheck.checks.forEach((check) => {
160664
- verificationItems.push({
160665
- status: VerificationStatusEnum.Success,
160666
- check,
160667
- message: transformCheckMessage(check, credential)
160524
+ }
160525
+ return lightFormatters_default.H(date, token);
160526
+ },
160527
+ K: function(date, token, localize2) {
160528
+ var hours = date.getUTCHours() % 12;
160529
+ if (token === "Ko") {
160530
+ return localize2.ordinalNumber(hours, {
160531
+ unit: "hour"
160668
160532
  });
160669
- });
160670
- return verificationItems;
160671
- });
160672
- }, "verifyCredential");
160673
- var defaultCeramicIDXArgs = {
160674
- modelData: {
160675
- definitions: {
160676
- MyVerifiableCredentials: "kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"
160677
- },
160678
- schemas: {
160679
- AchievementVerifiableCredential: "ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",
160680
- VerifiableCredentialsList: "ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"
160681
- },
160682
- tiles: {}
160533
+ }
160534
+ return addLeadingZeros(hours, token.length);
160683
160535
  },
160684
- credentialAlias: "MyVerifiableCredentials",
160685
- ceramicEndpoint: "https://ceramic-node.welibrary.io:7007",
160686
- defaultContentFamily: "SuperSkills"
160687
- };
160688
- var defaultEthereumArgs = {
160689
- address: "",
160690
- infuraProjectId: "",
160691
- network: "mainnet"
160692
- };
160693
- var wasm;
160694
- var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
160695
- cachedTextDecoder.decode();
160696
- var cachegetUint8Memory0 = null;
160697
- function getUint8Memory0() {
160698
- if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
160699
- cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
160700
- }
160701
- return cachegetUint8Memory0;
160702
- }
160703
- __name(getUint8Memory0, "getUint8Memory0");
160704
- function getStringFromWasm0(ptr, len) {
160705
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
160706
- }
160707
- __name(getStringFromWasm0, "getStringFromWasm0");
160708
- var heap = new Array(32).fill(void 0);
160709
- heap.push(void 0, null, true, false);
160710
- var heap_next = heap.length;
160711
- function addHeapObject(obj) {
160712
- if (heap_next === heap.length)
160713
- heap.push(heap.length + 1);
160714
- const idx = heap_next;
160715
- heap_next = heap[idx];
160716
- heap[idx] = obj;
160717
- return idx;
160718
- }
160719
- __name(addHeapObject, "addHeapObject");
160720
- function getObject(idx) {
160721
- return heap[idx];
160722
- }
160723
- __name(getObject, "getObject");
160724
- function dropObject(idx) {
160725
- if (idx < 36)
160726
- return;
160727
- heap[idx] = heap_next;
160728
- heap_next = idx;
160729
- }
160730
- __name(dropObject, "dropObject");
160731
- function takeObject(idx) {
160732
- const ret = getObject(idx);
160733
- dropObject(idx);
160734
- return ret;
160735
- }
160736
- __name(takeObject, "takeObject");
160737
- var WASM_VECTOR_LEN = 0;
160738
- var cachedTextEncoder = new TextEncoder("utf-8");
160739
- var encodeString2 = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
160740
- return cachedTextEncoder.encodeInto(arg, view);
160741
- } : function(arg, view) {
160742
- const buf2 = cachedTextEncoder.encode(arg);
160743
- view.set(buf2);
160744
- return {
160745
- read: arg.length,
160746
- written: buf2.length
160747
- };
160748
- };
160749
- function passStringToWasm0(arg, malloc, realloc) {
160750
- if (realloc === void 0) {
160751
- const buf2 = cachedTextEncoder.encode(arg);
160752
- const ptr2 = malloc(buf2.length);
160753
- getUint8Memory0().subarray(ptr2, ptr2 + buf2.length).set(buf2);
160754
- WASM_VECTOR_LEN = buf2.length;
160755
- return ptr2;
160756
- }
160757
- let len = arg.length;
160758
- let ptr = malloc(len);
160759
- const mem = getUint8Memory0();
160760
- let offset = 0;
160761
- for (; offset < len; offset++) {
160762
- const code5 = arg.charCodeAt(offset);
160763
- if (code5 > 127)
160764
- break;
160765
- mem[ptr + offset] = code5;
160766
- }
160767
- if (offset !== len) {
160768
- if (offset !== 0) {
160769
- arg = arg.slice(offset);
160536
+ k: function(date, token, localize2) {
160537
+ var hours = date.getUTCHours();
160538
+ if (hours === 0)
160539
+ hours = 24;
160540
+ if (token === "ko") {
160541
+ return localize2.ordinalNumber(hours, {
160542
+ unit: "hour"
160543
+ });
160770
160544
  }
160771
- ptr = realloc(ptr, len, len = offset + arg.length * 3);
160772
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
160773
- const ret = encodeString2(arg, view);
160774
- offset += ret.written;
160775
- }
160776
- WASM_VECTOR_LEN = offset;
160777
- return ptr;
160778
- }
160779
- __name(passStringToWasm0, "passStringToWasm0");
160780
- function isLikeNone(x) {
160781
- return x === void 0 || x === null;
160782
- }
160783
- __name(isLikeNone, "isLikeNone");
160784
- var cachegetInt32Memory0 = null;
160785
- function getInt32Memory0() {
160786
- if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
160787
- cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
160788
- }
160789
- return cachegetInt32Memory0;
160790
- }
160791
- __name(getInt32Memory0, "getInt32Memory0");
160792
- function debugString(val) {
160793
- const type = typeof val;
160794
- if (type == "number" || type == "boolean" || val == null) {
160795
- return `${val}`;
160796
- }
160797
- if (type == "string") {
160798
- return `"${val}"`;
160799
- }
160800
- if (type == "symbol") {
160801
- const description = val.description;
160802
- if (description == null) {
160803
- return "Symbol";
160804
- } else {
160805
- return `Symbol(${description})`;
160545
+ return addLeadingZeros(hours, token.length);
160546
+ },
160547
+ m: function(date, token, localize2) {
160548
+ if (token === "mo") {
160549
+ return localize2.ordinalNumber(date.getUTCMinutes(), {
160550
+ unit: "minute"
160551
+ });
160806
160552
  }
160807
- }
160808
- if (type == "function") {
160809
- const name5 = val.name;
160810
- if (typeof name5 == "string" && name5.length > 0) {
160811
- return `Function(${name5})`;
160812
- } else {
160813
- return "Function";
160553
+ return lightFormatters_default.m(date, token);
160554
+ },
160555
+ s: function(date, token, localize2) {
160556
+ if (token === "so") {
160557
+ return localize2.ordinalNumber(date.getUTCSeconds(), {
160558
+ unit: "second"
160559
+ });
160814
160560
  }
160815
- }
160816
- if (Array.isArray(val)) {
160817
- const length2 = val.length;
160818
- let debug = "[";
160819
- if (length2 > 0) {
160820
- debug += debugString(val[0]);
160561
+ return lightFormatters_default.s(date, token);
160562
+ },
160563
+ S: function(date, token) {
160564
+ return lightFormatters_default.S(date, token);
160565
+ },
160566
+ X: function(date, token, _localize, options) {
160567
+ var originalDate = options._originalDate || date;
160568
+ var timezoneOffset = originalDate.getTimezoneOffset();
160569
+ if (timezoneOffset === 0) {
160570
+ return "Z";
160821
160571
  }
160822
- for (let i = 1; i < length2; i++) {
160823
- debug += ", " + debugString(val[i]);
160572
+ switch (token) {
160573
+ case "X":
160574
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
160575
+ case "XXXX":
160576
+ case "XX":
160577
+ return formatTimezone(timezoneOffset);
160578
+ case "XXXXX":
160579
+ case "XXX":
160580
+ default:
160581
+ return formatTimezone(timezoneOffset, ":");
160824
160582
  }
160825
- debug += "]";
160826
- return debug;
160827
- }
160828
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
160829
- let className;
160830
- if (builtInMatches.length > 1) {
160831
- className = builtInMatches[1];
160832
- } else {
160833
- return toString.call(val);
160834
- }
160835
- if (className == "Object") {
160836
- try {
160837
- return "Object(" + JSON.stringify(val) + ")";
160838
- } catch (_) {
160839
- return "Object";
160583
+ },
160584
+ x: function(date, token, _localize, options) {
160585
+ var originalDate = options._originalDate || date;
160586
+ var timezoneOffset = originalDate.getTimezoneOffset();
160587
+ switch (token) {
160588
+ case "x":
160589
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
160590
+ case "xxxx":
160591
+ case "xx":
160592
+ return formatTimezone(timezoneOffset);
160593
+ case "xxxxx":
160594
+ case "xxx":
160595
+ default:
160596
+ return formatTimezone(timezoneOffset, ":");
160840
160597
  }
160841
- }
160842
- if (val instanceof Error) {
160843
- return `${val.name}: ${val.message}
160844
- ${val.stack}`;
160845
- }
160846
- return className;
160847
- }
160848
- __name(debugString, "debugString");
160849
- function makeMutClosure(arg0, arg1, dtor, f) {
160850
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
160851
- const real = /* @__PURE__ */ __name((...args) => {
160852
- state.cnt++;
160853
- const a = state.a;
160854
- state.a = 0;
160855
- try {
160856
- return f(a, state.b, ...args);
160857
- } finally {
160858
- if (--state.cnt === 0) {
160859
- wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
160860
- } else {
160861
- state.a = a;
160862
- }
160598
+ },
160599
+ O: function(date, token, _localize, options) {
160600
+ var originalDate = options._originalDate || date;
160601
+ var timezoneOffset = originalDate.getTimezoneOffset();
160602
+ switch (token) {
160603
+ case "O":
160604
+ case "OO":
160605
+ case "OOO":
160606
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
160607
+ case "OOOO":
160608
+ default:
160609
+ return "GMT" + formatTimezone(timezoneOffset, ":");
160863
160610
  }
160864
- }, "real");
160865
- real.original = state;
160866
- return real;
160867
- }
160868
- __name(makeMutClosure, "makeMutClosure");
160869
- function __wbg_adapter_24(arg0, arg1, arg2) {
160870
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(arg0, arg1, addHeapObject(arg2));
160871
- }
160872
- __name(__wbg_adapter_24, "__wbg_adapter_24");
160873
- function passArray8ToWasm0(arg, malloc) {
160874
- const ptr = malloc(arg.length * 1);
160875
- getUint8Memory0().set(arg, ptr / 1);
160876
- WASM_VECTOR_LEN = arg.length;
160877
- return ptr;
160878
- }
160879
- __name(passArray8ToWasm0, "passArray8ToWasm0");
160880
- function generateEd25519KeyFromBytes(bytes) {
160881
- try {
160882
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
160883
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
160884
- const len0 = WASM_VECTOR_LEN;
160885
- wasm.generateEd25519KeyFromBytes(retptr, ptr0, len0);
160886
- var r0 = getInt32Memory0()[retptr / 4 + 0];
160887
- var r1 = getInt32Memory0()[retptr / 4 + 1];
160888
- var r2 = getInt32Memory0()[retptr / 4 + 2];
160889
- var r3 = getInt32Memory0()[retptr / 4 + 3];
160890
- var ptr1 = r0;
160891
- var len1 = r1;
160892
- if (r3) {
160893
- ptr1 = 0;
160894
- len1 = 0;
160895
- throw takeObject(r2);
160611
+ },
160612
+ z: function(date, token, _localize, options) {
160613
+ var originalDate = options._originalDate || date;
160614
+ var timezoneOffset = originalDate.getTimezoneOffset();
160615
+ switch (token) {
160616
+ case "z":
160617
+ case "zz":
160618
+ case "zzz":
160619
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
160620
+ case "zzzz":
160621
+ default:
160622
+ return "GMT" + formatTimezone(timezoneOffset, ":");
160896
160623
  }
160897
- return getStringFromWasm0(ptr1, len1);
160898
- } finally {
160899
- wasm.__wbindgen_add_to_stack_pointer(16);
160900
- wasm.__wbindgen_free(ptr1, len1);
160624
+ },
160625
+ t: function(date, token, _localize, options) {
160626
+ var originalDate = options._originalDate || date;
160627
+ var timestamp = Math.floor(originalDate.getTime() / 1e3);
160628
+ return addLeadingZeros(timestamp, token.length);
160629
+ },
160630
+ T: function(date, token, _localize, options) {
160631
+ var originalDate = options._originalDate || date;
160632
+ var timestamp = originalDate.getTime();
160633
+ return addLeadingZeros(timestamp, token.length);
160901
160634
  }
160902
- }
160903
- __name(generateEd25519KeyFromBytes, "generateEd25519KeyFromBytes");
160904
- function generateSecp256k1KeyFromBytes(bytes) {
160905
- try {
160906
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
160907
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
160908
- const len0 = WASM_VECTOR_LEN;
160909
- wasm.generateSecp256k1KeyFromBytes(retptr, ptr0, len0);
160910
- var r0 = getInt32Memory0()[retptr / 4 + 0];
160911
- var r1 = getInt32Memory0()[retptr / 4 + 1];
160912
- var r2 = getInt32Memory0()[retptr / 4 + 2];
160913
- var r3 = getInt32Memory0()[retptr / 4 + 3];
160914
- var ptr1 = r0;
160915
- var len1 = r1;
160916
- if (r3) {
160917
- ptr1 = 0;
160918
- len1 = 0;
160919
- throw takeObject(r2);
160920
- }
160921
- return getStringFromWasm0(ptr1, len1);
160922
- } finally {
160923
- wasm.__wbindgen_add_to_stack_pointer(16);
160924
- wasm.__wbindgen_free(ptr1, len1);
160635
+ };
160636
+ function formatTimezoneShort(offset, dirtyDelimiter) {
160637
+ var sign5 = offset > 0 ? "-" : "+";
160638
+ var absOffset = Math.abs(offset);
160639
+ var hours = Math.floor(absOffset / 60);
160640
+ var minutes = absOffset % 60;
160641
+ if (minutes === 0) {
160642
+ return sign5 + String(hours);
160925
160643
  }
160644
+ var delimiter = dirtyDelimiter || "";
160645
+ return sign5 + String(hours) + delimiter + addLeadingZeros(minutes, 2);
160926
160646
  }
160927
- __name(generateSecp256k1KeyFromBytes, "generateSecp256k1KeyFromBytes");
160928
- function keyToDID(method_pattern, jwk) {
160929
- try {
160930
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
160931
- const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160932
- const len0 = WASM_VECTOR_LEN;
160933
- const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160934
- const len1 = WASM_VECTOR_LEN;
160935
- wasm.keyToDID(retptr, ptr0, len0, ptr1, len1);
160936
- var r0 = getInt32Memory0()[retptr / 4 + 0];
160937
- var r1 = getInt32Memory0()[retptr / 4 + 1];
160938
- var r2 = getInt32Memory0()[retptr / 4 + 2];
160939
- var r3 = getInt32Memory0()[retptr / 4 + 3];
160940
- var ptr2 = r0;
160941
- var len2 = r1;
160942
- if (r3) {
160943
- ptr2 = 0;
160944
- len2 = 0;
160945
- throw takeObject(r2);
160946
- }
160947
- return getStringFromWasm0(ptr2, len2);
160948
- } finally {
160949
- wasm.__wbindgen_add_to_stack_pointer(16);
160950
- wasm.__wbindgen_free(ptr2, len2);
160647
+ __name(formatTimezoneShort, "formatTimezoneShort");
160648
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
160649
+ if (offset % 60 === 0) {
160650
+ var sign5 = offset > 0 ? "-" : "+";
160651
+ return sign5 + addLeadingZeros(Math.abs(offset) / 60, 2);
160951
160652
  }
160653
+ return formatTimezone(offset, dirtyDelimiter);
160952
160654
  }
160953
- __name(keyToDID, "keyToDID");
160954
- function keyToVerificationMethod(method_pattern, jwk) {
160955
- const ptr0 = passStringToWasm0(method_pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160956
- const len0 = WASM_VECTOR_LEN;
160957
- const ptr1 = passStringToWasm0(jwk, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160958
- const len1 = WASM_VECTOR_LEN;
160959
- const ret = wasm.keyToVerificationMethod(ptr0, len0, ptr1, len1);
160960
- return takeObject(ret);
160961
- }
160962
- __name(keyToVerificationMethod, "keyToVerificationMethod");
160963
- function issueCredential2(credential, proof_options, key2) {
160964
- const ptr0 = passStringToWasm0(credential, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160965
- const len0 = WASM_VECTOR_LEN;
160966
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160967
- const len1 = WASM_VECTOR_LEN;
160968
- const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160969
- const len2 = WASM_VECTOR_LEN;
160970
- const ret = wasm.issueCredential(ptr0, len0, ptr1, len1, ptr2, len2);
160971
- return takeObject(ret);
160972
- }
160973
- __name(issueCredential2, "issueCredential");
160974
- function verifyCredential3(vc, proof_options) {
160975
- const ptr0 = passStringToWasm0(vc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160976
- const len0 = WASM_VECTOR_LEN;
160977
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160978
- const len1 = WASM_VECTOR_LEN;
160979
- const ret = wasm.verifyCredential(ptr0, len0, ptr1, len1);
160980
- return takeObject(ret);
160655
+ __name(formatTimezoneWithOptionalMinutes, "formatTimezoneWithOptionalMinutes");
160656
+ function formatTimezone(offset, dirtyDelimiter) {
160657
+ var delimiter = dirtyDelimiter || "";
160658
+ var sign5 = offset > 0 ? "-" : "+";
160659
+ var absOffset = Math.abs(offset);
160660
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
160661
+ var minutes = addLeadingZeros(absOffset % 60, 2);
160662
+ return sign5 + hours + delimiter + minutes;
160981
160663
  }
160982
- __name(verifyCredential3, "verifyCredential");
160983
- function issuePresentation2(presentation, proof_options, key2) {
160984
- const ptr0 = passStringToWasm0(presentation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160985
- const len0 = WASM_VECTOR_LEN;
160986
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160987
- const len1 = WASM_VECTOR_LEN;
160988
- const ptr2 = passStringToWasm0(key2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160989
- const len2 = WASM_VECTOR_LEN;
160990
- const ret = wasm.issuePresentation(ptr0, len0, ptr1, len1, ptr2, len2);
160991
- return takeObject(ret);
160664
+ __name(formatTimezone, "formatTimezone");
160665
+ var formatters_default = formatters2;
160666
+ function dateLongFormatter(pattern, formatLong2) {
160667
+ switch (pattern) {
160668
+ case "P":
160669
+ return formatLong2.date({
160670
+ width: "short"
160671
+ });
160672
+ case "PP":
160673
+ return formatLong2.date({
160674
+ width: "medium"
160675
+ });
160676
+ case "PPP":
160677
+ return formatLong2.date({
160678
+ width: "long"
160679
+ });
160680
+ case "PPPP":
160681
+ default:
160682
+ return formatLong2.date({
160683
+ width: "full"
160684
+ });
160685
+ }
160992
160686
  }
160993
- __name(issuePresentation2, "issuePresentation");
160994
- function verifyPresentation2(vp, proof_options) {
160995
- const ptr0 = passStringToWasm0(vp, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160996
- const len0 = WASM_VECTOR_LEN;
160997
- const ptr1 = passStringToWasm0(proof_options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160998
- const len1 = WASM_VECTOR_LEN;
160999
- const ret = wasm.verifyPresentation(ptr0, len0, ptr1, len1);
161000
- return takeObject(ret);
160687
+ __name(dateLongFormatter, "dateLongFormatter");
160688
+ function timeLongFormatter(pattern, formatLong2) {
160689
+ switch (pattern) {
160690
+ case "p":
160691
+ return formatLong2.time({
160692
+ width: "short"
160693
+ });
160694
+ case "pp":
160695
+ return formatLong2.time({
160696
+ width: "medium"
160697
+ });
160698
+ case "ppp":
160699
+ return formatLong2.time({
160700
+ width: "long"
160701
+ });
160702
+ case "pppp":
160703
+ default:
160704
+ return formatLong2.time({
160705
+ width: "full"
160706
+ });
160707
+ }
161001
160708
  }
161002
- __name(verifyPresentation2, "verifyPresentation");
161003
- function handleError(f, args) {
161004
- try {
161005
- return f.apply(this, args);
161006
- } catch (e) {
161007
- wasm.__wbindgen_exn_store(addHeapObject(e));
160709
+ __name(timeLongFormatter, "timeLongFormatter");
160710
+ function dateTimeLongFormatter(pattern, formatLong2) {
160711
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
160712
+ var datePattern = matchResult[1];
160713
+ var timePattern = matchResult[2];
160714
+ if (!timePattern) {
160715
+ return dateLongFormatter(pattern, formatLong2);
161008
160716
  }
160717
+ var dateTimeFormat;
160718
+ switch (datePattern) {
160719
+ case "P":
160720
+ dateTimeFormat = formatLong2.dateTime({
160721
+ width: "short"
160722
+ });
160723
+ break;
160724
+ case "PP":
160725
+ dateTimeFormat = formatLong2.dateTime({
160726
+ width: "medium"
160727
+ });
160728
+ break;
160729
+ case "PPP":
160730
+ dateTimeFormat = formatLong2.dateTime({
160731
+ width: "long"
160732
+ });
160733
+ break;
160734
+ case "PPPP":
160735
+ default:
160736
+ dateTimeFormat = formatLong2.dateTime({
160737
+ width: "full"
160738
+ });
160739
+ break;
160740
+ }
160741
+ return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
161009
160742
  }
161010
- __name(handleError, "handleError");
161011
- function getArrayU8FromWasm0(ptr, len) {
161012
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
160743
+ __name(dateTimeLongFormatter, "dateTimeLongFormatter");
160744
+ var longFormatters = {
160745
+ p: timeLongFormatter,
160746
+ P: dateTimeLongFormatter
160747
+ };
160748
+ var longFormatters_default = longFormatters;
160749
+ var protectedDayOfYearTokens = ["D", "DD"];
160750
+ var protectedWeekYearTokens = ["YY", "YYYY"];
160751
+ function isProtectedDayOfYearToken(token) {
160752
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
161013
160753
  }
161014
- __name(getArrayU8FromWasm0, "getArrayU8FromWasm0");
161015
- function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
161016
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
160754
+ __name(isProtectedDayOfYearToken, "isProtectedDayOfYearToken");
160755
+ function isProtectedWeekYearToken(token) {
160756
+ return protectedWeekYearTokens.indexOf(token) !== -1;
161017
160757
  }
161018
- __name(__wbg_adapter_110, "__wbg_adapter_110");
161019
- function load(module, imports) {
161020
- return __async$1(this, null, function* () {
161021
- if (typeof Response === "function" && module instanceof Response) {
161022
- if (typeof WebAssembly.instantiateStreaming === "function") {
161023
- try {
161024
- return yield WebAssembly.instantiateStreaming(module, imports);
161025
- } catch (e) {
161026
- if (module.headers.get("Content-Type") != "application/wasm") {
161027
- console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
161028
- } else {
161029
- throw e;
161030
- }
161031
- }
161032
- }
161033
- const bytes = yield module.arrayBuffer();
161034
- return yield WebAssembly.instantiate(bytes, imports);
161035
- } else {
161036
- const instance = yield WebAssembly.instantiate(module, imports);
161037
- if (instance instanceof WebAssembly.Instance) {
161038
- return { instance, module };
161039
- } else {
161040
- return instance;
161041
- }
161042
- }
161043
- });
160758
+ __name(isProtectedWeekYearToken, "isProtectedWeekYearToken");
160759
+ function throwProtectedError(token, format2, input) {
160760
+ if (token === "YYYY") {
160761
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
160762
+ } else if (token === "YY") {
160763
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
160764
+ } else if (token === "D") {
160765
+ throw new RangeError("Use `d` instead of `D` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
160766
+ } else if (token === "DD") {
160767
+ throw new RangeError("Use `dd` instead of `DD` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
160768
+ }
161044
160769
  }
161045
- __name(load, "load");
161046
- function init2(input) {
161047
- return __async$1(this, null, function* () {
161048
- const imports = {};
161049
- imports.wbg = {};
161050
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
161051
- const ret = getStringFromWasm0(arg0, arg1);
161052
- return addHeapObject(ret);
161053
- };
161054
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
161055
- takeObject(arg0);
161056
- };
161057
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
161058
- const obj = takeObject(arg0).original;
161059
- if (obj.cnt-- == 1) {
161060
- obj.a = 0;
161061
- return true;
161062
- }
161063
- const ret = false;
161064
- return ret;
161065
- };
161066
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
161067
- const ret = getObject(arg0);
161068
- return addHeapObject(ret);
161069
- };
161070
- imports.wbg.__wbg_fetch_811d43d6bdcad5b1 = function(arg0) {
161071
- const ret = fetch(getObject(arg0));
161072
- return addHeapObject(ret);
161073
- };
161074
- imports.wbg.__wbg_fetch_bf56e2a9f0644e3f = function(arg0, arg1) {
161075
- const ret = getObject(arg0).fetch(getObject(arg1));
161076
- return addHeapObject(ret);
161077
- };
161078
- imports.wbg.__wbg_new_89d7f088c1c45353 = function() {
161079
- return handleError(function() {
161080
- const ret = new Headers();
161081
- return addHeapObject(ret);
161082
- }, arguments);
161083
- };
161084
- imports.wbg.__wbg_append_f4f93bc73c45ee3e = function() {
161085
- return handleError(function(arg0, arg1, arg2, arg3, arg4) {
161086
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
161087
- }, arguments);
161088
- };
161089
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
161090
- const obj = getObject(arg1);
161091
- const ret = typeof obj === "string" ? obj : void 0;
161092
- var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
161093
- var len0 = WASM_VECTOR_LEN;
161094
- getInt32Memory0()[arg0 / 4 + 1] = len0;
161095
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
161096
- };
161097
- imports.wbg.__wbg_instanceof_Response_ccfeb62399355bcd = function(arg0) {
161098
- const ret = getObject(arg0) instanceof Response;
161099
- return ret;
161100
- };
161101
- imports.wbg.__wbg_url_06c0f822d68d195c = function(arg0, arg1) {
161102
- const ret = getObject(arg1).url;
161103
- const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
161104
- const len0 = WASM_VECTOR_LEN;
161105
- getInt32Memory0()[arg0 / 4 + 1] = len0;
161106
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
161107
- };
161108
- imports.wbg.__wbg_status_600fd8b881393898 = function(arg0) {
161109
- const ret = getObject(arg0).status;
161110
- return ret;
161111
- };
161112
- imports.wbg.__wbg_headers_9e7f2c05a9b962ea = function(arg0) {
161113
- const ret = getObject(arg0).headers;
161114
- return addHeapObject(ret);
161115
- };
161116
- imports.wbg.__wbg_arrayBuffer_5a99283a3954c850 = function() {
161117
- return handleError(function(arg0) {
161118
- const ret = getObject(arg0).arrayBuffer();
161119
- return addHeapObject(ret);
161120
- }, arguments);
161121
- };
161122
- imports.wbg.__wbg_newwithstrandinit_fd99688f189f053e = function() {
161123
- return handleError(function(arg0, arg1, arg2) {
161124
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
161125
- return addHeapObject(ret);
161126
- }, arguments);
161127
- };
161128
- imports.wbg.__wbindgen_is_object = function(arg0) {
161129
- const val = getObject(arg0);
161130
- const ret = typeof val === "object" && val !== null;
161131
- return ret;
161132
- };
161133
- imports.wbg.__wbg_self_86b4b13392c7af56 = function() {
161134
- return handleError(function() {
161135
- const ret = self.self;
161136
- return addHeapObject(ret);
161137
- }, arguments);
161138
- };
161139
- imports.wbg.__wbg_crypto_b8c92eaac23d0d80 = function(arg0) {
161140
- const ret = getObject(arg0).crypto;
161141
- return addHeapObject(ret);
161142
- };
161143
- imports.wbg.__wbg_msCrypto_9ad6677321a08dd8 = function(arg0) {
161144
- const ret = getObject(arg0).msCrypto;
161145
- return addHeapObject(ret);
161146
- };
161147
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
161148
- const ret = getObject(arg0) === void 0;
161149
- return ret;
161150
- };
161151
- imports.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81 = function() {
161152
- const ret = module;
161153
- return addHeapObject(ret);
161154
- };
161155
- imports.wbg.__wbg_require_f5521a5b85ad2542 = function(arg0, arg1, arg2) {
161156
- const ret = getObject(arg0).require(getStringFromWasm0(arg1, arg2));
161157
- return addHeapObject(ret);
161158
- };
161159
- imports.wbg.__wbg_getRandomValues_dd27e6b0652b3236 = function(arg0) {
161160
- const ret = getObject(arg0).getRandomValues;
161161
- return addHeapObject(ret);
161162
- };
161163
- imports.wbg.__wbg_getRandomValues_e57c9b75ddead065 = function(arg0, arg1) {
161164
- getObject(arg0).getRandomValues(getObject(arg1));
161165
- };
161166
- imports.wbg.__wbg_randomFillSync_d2ba53160aec6aba = function(arg0, arg1, arg2) {
161167
- getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
161168
- };
161169
- imports.wbg.__wbindgen_is_function = function(arg0) {
161170
- const ret = typeof getObject(arg0) === "function";
161171
- return ret;
161172
- };
161173
- imports.wbg.__wbg_newnoargs_e23b458e372830de = function(arg0, arg1) {
161174
- const ret = new Function(getStringFromWasm0(arg0, arg1));
161175
- return addHeapObject(ret);
161176
- };
161177
- imports.wbg.__wbg_next_cabb70b365520721 = function(arg0) {
161178
- const ret = getObject(arg0).next;
161179
- return addHeapObject(ret);
161180
- };
161181
- imports.wbg.__wbg_next_bf3d83fc18df496e = function() {
161182
- return handleError(function(arg0) {
161183
- const ret = getObject(arg0).next();
161184
- return addHeapObject(ret);
161185
- }, arguments);
161186
- };
161187
- imports.wbg.__wbg_done_040f966faa9a72b3 = function(arg0) {
161188
- const ret = getObject(arg0).done;
161189
- return ret;
161190
- };
161191
- imports.wbg.__wbg_value_419afbd9b9574c4c = function(arg0) {
161192
- const ret = getObject(arg0).value;
161193
- return addHeapObject(ret);
161194
- };
161195
- imports.wbg.__wbg_iterator_4832ef1f15b0382b = function() {
161196
- const ret = Symbol.iterator;
161197
- return addHeapObject(ret);
161198
- };
161199
- imports.wbg.__wbg_get_a9cab131e3152c49 = function() {
161200
- return handleError(function(arg0, arg1) {
161201
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
161202
- return addHeapObject(ret);
161203
- }, arguments);
161204
- };
161205
- imports.wbg.__wbg_call_ae78342adc33730a = function() {
161206
- return handleError(function(arg0, arg1) {
161207
- const ret = getObject(arg0).call(getObject(arg1));
161208
- return addHeapObject(ret);
161209
- }, arguments);
161210
- };
161211
- imports.wbg.__wbg_new_36359baae5a47e27 = function() {
161212
- const ret = new Object();
161213
- return addHeapObject(ret);
161214
- };
161215
- imports.wbg.__wbg_call_3ed288a247f13ea5 = function() {
161216
- return handleError(function(arg0, arg1, arg2) {
161217
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
161218
- return addHeapObject(ret);
161219
- }, arguments);
161220
- };
161221
- imports.wbg.__wbg_getTime_bffb1c09df09618b = function(arg0) {
161222
- const ret = getObject(arg0).getTime();
161223
- return ret;
161224
- };
161225
- imports.wbg.__wbg_new0_0ff7eb5c1486f3ec = function() {
161226
- const ret = new Date();
161227
- return addHeapObject(ret);
161228
- };
161229
- imports.wbg.__wbg_new_37705eed627d5ed9 = function(arg0, arg1) {
161230
- try {
161231
- var state0 = { a: arg0, b: arg1 };
161232
- var cb0 = /* @__PURE__ */ __name((arg02, arg12) => {
161233
- const a = state0.a;
161234
- state0.a = 0;
161235
- try {
161236
- return __wbg_adapter_110(a, state0.b, arg02, arg12);
161237
- } finally {
161238
- state0.a = a;
161239
- }
161240
- }, "cb0");
161241
- const ret = new Promise(cb0);
161242
- return addHeapObject(ret);
161243
- } finally {
161244
- state0.a = state0.b = 0;
160770
+ __name(throwProtectedError, "throwProtectedError");
160771
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
160772
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
160773
+ var escapedStringRegExp = /^'([^]*?)'?$/;
160774
+ var doubleQuoteRegExp = /''/g;
160775
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
160776
+ function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
160777
+ requiredArgs(2, arguments);
160778
+ var formatStr = String(dirtyFormatStr);
160779
+ var options = dirtyOptions || {};
160780
+ var locale2 = options.locale || en_US_default;
160781
+ var localeFirstWeekContainsDate = locale2.options && locale2.options.firstWeekContainsDate;
160782
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
160783
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
160784
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
160785
+ throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
160786
+ }
160787
+ var localeWeekStartsOn = locale2.options && locale2.options.weekStartsOn;
160788
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
160789
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn);
160790
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
160791
+ throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
160792
+ }
160793
+ if (!locale2.localize) {
160794
+ throw new RangeError("locale must contain localize property");
160795
+ }
160796
+ if (!locale2.formatLong) {
160797
+ throw new RangeError("locale must contain formatLong property");
160798
+ }
160799
+ var originalDate = toDate(dirtyDate);
160800
+ if (!isValid2(originalDate)) {
160801
+ throw new RangeError("Invalid time value");
160802
+ }
160803
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
160804
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
160805
+ var formatterOptions = {
160806
+ firstWeekContainsDate,
160807
+ weekStartsOn,
160808
+ locale: locale2,
160809
+ _originalDate: originalDate
160810
+ };
160811
+ var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) {
160812
+ var firstCharacter = substring[0];
160813
+ if (firstCharacter === "p" || firstCharacter === "P") {
160814
+ var longFormatter = longFormatters_default[firstCharacter];
160815
+ return longFormatter(substring, locale2.formatLong, formatterOptions);
160816
+ }
160817
+ return substring;
160818
+ }).join("").match(formattingTokensRegExp).map(function(substring) {
160819
+ if (substring === "''") {
160820
+ return "'";
160821
+ }
160822
+ var firstCharacter = substring[0];
160823
+ if (firstCharacter === "'") {
160824
+ return cleanEscapedString(substring);
160825
+ }
160826
+ var formatter = formatters_default[firstCharacter];
160827
+ if (formatter) {
160828
+ if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
160829
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
161245
160830
  }
161246
- };
161247
- imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function(arg0) {
161248
- const ret = Promise.resolve(getObject(arg0));
161249
- return addHeapObject(ret);
161250
- };
161251
- imports.wbg.__wbg_then_ce526c837d07b68f = function(arg0, arg1) {
161252
- const ret = getObject(arg0).then(getObject(arg1));
161253
- return addHeapObject(ret);
161254
- };
161255
- imports.wbg.__wbg_then_842e65b843962f56 = function(arg0, arg1, arg2) {
161256
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
161257
- return addHeapObject(ret);
161258
- };
161259
- imports.wbg.__wbg_self_99737b4dcdf6f0d8 = function() {
161260
- return handleError(function() {
161261
- const ret = self.self;
161262
- return addHeapObject(ret);
161263
- }, arguments);
161264
- };
161265
- imports.wbg.__wbg_window_9b61fbbf3564c4fb = function() {
161266
- return handleError(function() {
161267
- const ret = window.window;
161268
- return addHeapObject(ret);
161269
- }, arguments);
161270
- };
161271
- imports.wbg.__wbg_globalThis_8e275ef40caea3a3 = function() {
161272
- return handleError(function() {
161273
- const ret = globalThis.globalThis;
161274
- return addHeapObject(ret);
161275
- }, arguments);
161276
- };
161277
- imports.wbg.__wbg_global_5de1e0f82bddcd27 = function() {
161278
- return handleError(function() {
161279
- const ret = global.global;
161280
- return addHeapObject(ret);
161281
- }, arguments);
161282
- };
161283
- imports.wbg.__wbg_buffer_7af23f65f6c64548 = function(arg0) {
161284
- const ret = getObject(arg0).buffer;
161285
- return addHeapObject(ret);
161286
- };
161287
- imports.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974 = function(arg0, arg1, arg2) {
161288
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
161289
- return addHeapObject(ret);
161290
- };
161291
- imports.wbg.__wbg_new_cc9018bd6f283b6f = function(arg0) {
161292
- const ret = new Uint8Array(getObject(arg0));
161293
- return addHeapObject(ret);
161294
- };
161295
- imports.wbg.__wbg_set_f25e869e4565d2a2 = function(arg0, arg1, arg2) {
161296
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
161297
- };
161298
- imports.wbg.__wbg_length_0acb1cf9bbaf8519 = function(arg0) {
161299
- const ret = getObject(arg0).length;
161300
- return ret;
161301
- };
161302
- imports.wbg.__wbg_newwithlength_8f0657faca9f1422 = function(arg0) {
161303
- const ret = new Uint8Array(arg0 >>> 0);
161304
- return addHeapObject(ret);
161305
- };
161306
- imports.wbg.__wbg_subarray_da527dbd24eafb6b = function(arg0, arg1, arg2) {
161307
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
161308
- return addHeapObject(ret);
161309
- };
161310
- imports.wbg.__wbg_has_ce995ec88636803d = function() {
161311
- return handleError(function(arg0, arg1) {
161312
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
161313
- return ret;
161314
- }, arguments);
161315
- };
161316
- imports.wbg.__wbg_set_93b1c87ee2af852e = function() {
161317
- return handleError(function(arg0, arg1, arg2) {
161318
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
161319
- return ret;
161320
- }, arguments);
161321
- };
161322
- imports.wbg.__wbg_stringify_c760003feffcc1f2 = function() {
161323
- return handleError(function(arg0) {
161324
- const ret = JSON.stringify(getObject(arg0));
161325
- return addHeapObject(ret);
161326
- }, arguments);
161327
- };
161328
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
161329
- const ret = debugString(getObject(arg1));
161330
- const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
161331
- const len0 = WASM_VECTOR_LEN;
161332
- getInt32Memory0()[arg0 / 4 + 1] = len0;
161333
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
161334
- };
161335
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
161336
- throw new Error(getStringFromWasm0(arg0, arg1));
161337
- };
161338
- imports.wbg.__wbindgen_memory = function() {
161339
- const ret = wasm.memory;
161340
- return addHeapObject(ret);
161341
- };
161342
- imports.wbg.__wbindgen_closure_wrapper10913 = function(arg0, arg1, arg2) {
161343
- const ret = makeMutClosure(arg0, arg1, 3725, __wbg_adapter_24);
161344
- return addHeapObject(ret);
161345
- };
161346
- if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
161347
- input = fetch(input);
160831
+ if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
160832
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
160833
+ }
160834
+ return formatter(utcDate, substring, locale2.localize, formatterOptions);
161348
160835
  }
161349
- const { instance, module } = yield load(yield input, imports);
161350
- wasm = instance.exports;
161351
- init2.__wbindgen_wasm_module = module;
161352
- return wasm;
161353
- });
160836
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
160837
+ throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
160838
+ }
160839
+ return substring;
160840
+ }).join("");
160841
+ return result;
161354
160842
  }
161355
- __name(init2, "init");
161356
- var didkit_wasm_default = init2;
161357
- var initialized = false;
161358
- var init3 = /* @__PURE__ */ __name((arg = "https://cdn.filestackcontent.com/dlXanMvQCGDR76JXcBkA") => __async$1(void 0, null, function* () {
161359
- if (initialized)
161360
- return;
161361
- initialized = true;
161362
- return didkit_wasm_default(arg);
161363
- }), "init");
161364
- var didkit_default = init3;
161365
- var getDidKitPlugin = /* @__PURE__ */ __name((input) => __async$1(void 0, null, function* () {
161366
- yield didkit_default(input);
161367
- const memoizedDids = {};
160843
+ __name(format, "format");
160844
+ function cleanEscapedString(input) {
160845
+ return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
160846
+ }
160847
+ __name(cleanEscapedString, "cleanEscapedString");
160848
+ var transformErrorCheck = /* @__PURE__ */ __name((error, _credential) => {
160849
+ const prefix = error.split(" error")[0];
160850
+ return prefix || error;
160851
+ }, "transformErrorCheck");
160852
+ var transformErrorMessage = /* @__PURE__ */ __name((error, credential) => {
160853
+ if (error.startsWith("expiration")) {
160854
+ return credential.expirationDate ? `Invalid \u2022 Expired ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Invalid \u2022 Expired";
160855
+ }
160856
+ return error;
160857
+ }, "transformErrorMessage");
160858
+ var transformCheckMessage = /* @__PURE__ */ __name((check, credential) => {
161368
160859
  return {
161369
- pluginMethods: {
161370
- generateEd25519KeyFromBytes: (_wallet, bytes) => JSON.parse(generateEd25519KeyFromBytes(bytes)),
161371
- generateSecp256k1KeyFromBytes: (_wallet, bytes) => JSON.parse(generateSecp256k1KeyFromBytes(bytes)),
161372
- keyToDid: (_wallet, type, keypair) => {
161373
- const memoizedDid = memoizedDids[type];
161374
- if (!memoizedDid) {
161375
- const did = keyToDID(type, JSON.stringify(keypair));
161376
- memoizedDids[type] = did;
161377
- return did;
161378
- }
161379
- return memoizedDid;
161380
- },
161381
- keyToVerificationMethod: (_wallet, type, keypair) => __async$1(void 0, null, function* () {
161382
- return keyToVerificationMethod(type, JSON.stringify(keypair));
161383
- }),
161384
- issueCredential: (_wallet, credential, options, keypair) => __async$1(void 0, null, function* () {
161385
- return JSON.parse(yield issueCredential2(JSON.stringify(credential), JSON.stringify(options), JSON.stringify(keypair)));
161386
- }),
161387
- verifyCredential: (_wallet, credential) => __async$1(void 0, null, function* () {
161388
- return JSON.parse(yield verifyCredential3(JSON.stringify(credential), "{}"));
161389
- }),
161390
- issuePresentation: (_wallet, presentation, options, keypair) => __async$1(void 0, null, function* () {
161391
- return JSON.parse(yield issuePresentation2(JSON.stringify(presentation), JSON.stringify(options), JSON.stringify(keypair)));
161392
- }),
161393
- verifyPresentation: (_wallet, presentation) => __async$1(void 0, null, function* () {
161394
- return JSON.parse(yield verifyPresentation2(JSON.stringify(presentation), "{}"));
161395
- })
161396
- }
161397
- };
161398
- }), "getDidKitPlugin");
161399
- var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async$1(void 0, [_0, ..._1], function* (key2, {
161400
- ceramicIdx = defaultCeramicIDXArgs,
161401
- didkit,
161402
- defaultContents = [],
161403
- ethereumConfig = defaultEthereumArgs
160860
+ proof: "Valid",
160861
+ expiration: credential.expirationDate ? `Valid \u2022 Expires ${format(new Date(credential.expirationDate), "dd MMM yyyy").toUpperCase()}` : "Valid \u2022 Does Not Expire"
160862
+ }[check] || check;
160863
+ }, "transformCheckMessage");
160864
+ var verifyCredential3 = /* @__PURE__ */ __name((wallet) => {
160865
+ return (credential) => __async$1(void 0, null, function* () {
160866
+ const rawVerificationCheck = yield wallet.pluginMethods.verifyCredential(credential);
160867
+ const verificationItems = [];
160868
+ rawVerificationCheck.errors.forEach((error) => {
160869
+ verificationItems.push({
160870
+ status: VerificationStatusEnum.Failed,
160871
+ check: transformErrorCheck(error, credential),
160872
+ details: transformErrorMessage(error, credential)
160873
+ });
160874
+ });
160875
+ rawVerificationCheck.warnings.forEach((warning) => {
160876
+ verificationItems.push({
160877
+ status: VerificationStatusEnum.Error,
160878
+ check: "hmm",
160879
+ message: warning
160880
+ });
160881
+ });
160882
+ rawVerificationCheck.checks.forEach((check) => {
160883
+ verificationItems.push({
160884
+ status: VerificationStatusEnum.Success,
160885
+ check,
160886
+ message: transformCheckMessage(check, credential)
160887
+ });
160888
+ });
160889
+ return verificationItems;
160890
+ });
160891
+ }, "verifyCredential");
160892
+ var emptyWallet = /* @__PURE__ */ __name((..._0) => __async$1(void 0, [..._0], function* ({
160893
+ didkit
161404
160894
  } = {}) {
161405
- const didkitWallet = yield (yield generateWallet(defaultContents)).addPlugin(yield getDidKitPlugin(didkit));
161406
- const didkeyWallet = yield didkitWallet.addPlugin(yield getDidKeyPlugin(didkitWallet, key2));
161407
- const didkeyAndVCWallet = yield didkeyWallet.addPlugin(yield getVCPlugin(didkeyWallet));
161408
- const idxWallet = yield didkeyAndVCWallet.addPlugin(yield getIDXPlugin(didkeyAndVCWallet, ceramicIdx));
161409
- const expirationWallet = yield idxWallet.addPlugin(ExpirationPlugin(idxWallet));
161410
- const wallet = yield expirationWallet.addPlugin(getEthereumPlugin(expirationWallet, ethereumConfig));
160895
+ const didkitWallet = yield (yield generateWallet()).addPlugin(yield getDidKitPlugin(didkit));
160896
+ const wallet = yield didkitWallet.addPlugin(ExpirationPlugin(didkitWallet));
161411
160897
  return {
161412
160898
  _wallet: wallet,
161413
- did: (type = "key") => wallet.pluginMethods.getSubjectDid(type),
161414
- keypair: (type = "ed25519") => wallet.pluginMethods.getSubjectKeypair(type),
161415
- issueCredential: wallet.pluginMethods.issueCredential,
161416
- verifyCredential: verifyCredential2(wallet),
161417
- issuePresentation: wallet.pluginMethods.issuePresentation,
161418
- verifyPresentation: wallet.pluginMethods.verifyPresentation,
161419
- getCredential: wallet.pluginMethods.getVerifiableCredentialFromIdx,
161420
- getCredentials: wallet.pluginMethods.getVerifiableCredentialsFromIdx,
161421
- getCredentialsList: () => __async$1(void 0, null, function* () {
161422
- return (yield wallet.pluginMethods.getCredentialsListFromIdx()).credentials;
161423
- }),
161424
- publishCredential: wallet.pluginMethods.publishContentToCeramic,
161425
- addCredential: (credential) => __async$1(void 0, null, function* () {
161426
- yield wallet.pluginMethods.addVerifiableCredentialInIdx(credential);
161427
- }),
161428
- removeCredential: (title) => __async$1(void 0, null, function* () {
161429
- yield wallet.pluginMethods.removeVerifiableCredentialInIdx(title);
161430
- }),
161431
- readFromCeramic: wallet.pluginMethods.readContentFromCeramic,
161432
- getTestVc: wallet.pluginMethods.getTestVc,
161433
- getTestVp: wallet.pluginMethods.getTestVp,
161434
- checkMyEth: wallet.pluginMethods.checkMyEth,
161435
- checkMyDai: wallet.pluginMethods.checkMyDai,
161436
- checkMyUsdc: wallet.pluginMethods.checkMyUsdc
160899
+ verifyCredential: verifyCredential3(wallet),
160900
+ verifyPresentation: wallet.pluginMethods.verifyPresentation
161437
160901
  };
161438
- }), "walletFromKey");
160902
+ }), "emptyWallet");
161439
160903
  /*!
161440
160904
  * https://github.com/Starcounter-Jack/JSON-Patch
161441
160905
  * (c) 2017-2021 Joachim Wester
@@ -161480,13 +160944,13 @@ const VCCard = ({ credential, issueeOverride, className = "" }) => {
161480
160944
  const [vcVerification, setVCVerification] = useState([]);
161481
160945
  useEffect(() => {
161482
160946
  const verify = () => __async(void 0, null, function* () {
161483
- const wallet = yield walletFromKey("");
160947
+ const wallet = yield emptyWallet();
161484
160948
  const verification = yield wallet.verifyCredential(credential);
161485
160949
  setVCVerification(verification);
161486
160950
  setLoading(false);
161487
160951
  });
161488
160952
  verify();
161489
- }, []);
160953
+ }, [credential]);
161490
160954
  return /* @__PURE__ */ React.createElement(VCDisplayCard, {
161491
160955
  credential,
161492
160956
  issueeOverride,
@@ -161497,4 +160961,4 @@ const VCCard = ({ credential, issueeOverride, className = "" }) => {
161497
160961
  };
161498
160962
 
161499
160963
  export { VCCard as V };
161500
- //# sourceMappingURL=VCCard-53ba862f.js.map
160964
+ //# sourceMappingURL=VCCard-9a58a5f4.js.map