@learncard/react 2.3.0 → 2.3.3

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.
Files changed (101) hide show
  1. package/dist/cjs/LearnCardCreditCardBackFace-ecb49e43.js +72 -0
  2. package/dist/cjs/LearnCardCreditCardBackFace-ecb49e43.js.map +1 -0
  3. package/dist/cjs/LearnCardCreditCardFrontFace-54e1206b.js +71 -0
  4. package/dist/cjs/LearnCardCreditCardFrontFace-54e1206b.js.map +1 -0
  5. package/dist/cjs/QRCodeCard-9f777402.js +35 -0
  6. package/dist/cjs/QRCodeCard-9f777402.js.map +1 -0
  7. package/dist/cjs/{VCCard-34e5c166.js → VCCard-5495759e.js} +171 -1068
  8. package/dist/cjs/VCCard-5495759e.js.map +1 -0
  9. package/dist/cjs/{VCDisplayBackFace-e8fb0c83.js → VCDisplayBackFace-d0d79b7a.js} +2 -2
  10. package/dist/cjs/{VCDisplayBackFace-e8fb0c83.js.map → VCDisplayBackFace-d0d79b7a.js.map} +1 -1
  11. package/dist/cjs/{VCDisplayCard-dfda9090.js → VCDisplayCard-36a39706.js} +2 -2
  12. package/dist/cjs/{VCDisplayCard-dfda9090.js.map → VCDisplayCard-36a39706.js.map} +1 -1
  13. package/dist/cjs/{VCVerificationPill-994d1dee.js → VCVerificationPill-84826845.js} +6 -1
  14. package/dist/cjs/VCVerificationPill-84826845.js.map +1 -0
  15. package/dist/cjs/index-82de573c.js +774 -0
  16. package/dist/cjs/index-82de573c.js.map +1 -0
  17. package/dist/cjs/index.js +11 -4
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/index10.js +4 -8
  20. package/dist/cjs/index10.js.map +1 -1
  21. package/dist/cjs/index11.js +3 -17
  22. package/dist/cjs/index11.js.map +1 -1
  23. package/dist/cjs/index12.js +3 -5
  24. package/dist/cjs/index12.js.map +1 -1
  25. package/dist/cjs/index13.js +8 -8
  26. package/dist/cjs/index14.js +21 -0
  27. package/dist/cjs/index14.js.map +1 -1
  28. package/dist/cjs/index15.js +5 -4
  29. package/dist/cjs/index15.js.map +1 -1
  30. package/dist/cjs/index16.js +7 -3
  31. package/dist/cjs/index16.js.map +1 -1
  32. package/dist/cjs/index17.js +0 -6
  33. package/dist/cjs/index17.js.map +1 -1
  34. package/dist/cjs/index18.js +13 -0
  35. package/dist/cjs/index18.js.map +1 -0
  36. package/dist/cjs/index19.js +13 -0
  37. package/dist/cjs/index19.js.map +1 -0
  38. package/dist/cjs/index20.js +11 -0
  39. package/dist/cjs/index20.js.map +1 -0
  40. package/dist/cjs/index5.js +11 -4
  41. package/dist/cjs/index5.js.map +1 -1
  42. package/dist/cjs/index6.js +2 -2
  43. package/dist/cjs/index7.js +3 -3
  44. package/dist/cjs/index8.js +2 -4
  45. package/dist/cjs/index8.js.map +1 -1
  46. package/dist/cjs/index9.js +3 -3
  47. package/dist/esm/LearnCardCreditCardBackFace-4f7eaaa9.js +66 -0
  48. package/dist/esm/LearnCardCreditCardBackFace-4f7eaaa9.js.map +1 -0
  49. package/dist/esm/LearnCardCreditCardFrontFace-e6846114.js +65 -0
  50. package/dist/esm/LearnCardCreditCardFrontFace-e6846114.js.map +1 -0
  51. package/dist/esm/QRCodeCard-11e192b2.js +29 -0
  52. package/dist/esm/QRCodeCard-11e192b2.js.map +1 -0
  53. package/dist/esm/{VCCard-3dba135e.js → VCCard-e39551a6.js} +171 -1068
  54. package/dist/esm/VCCard-e39551a6.js.map +1 -0
  55. package/dist/esm/{VCDisplayBackFace-21fb6c1b.js → VCDisplayBackFace-4ffe5733.js} +2 -2
  56. package/dist/esm/{VCDisplayBackFace-21fb6c1b.js.map → VCDisplayBackFace-4ffe5733.js.map} +1 -1
  57. package/dist/esm/{VCDisplayCard-7abdc260.js → VCDisplayCard-6b0274f9.js} +2 -2
  58. package/dist/esm/{VCDisplayCard-7abdc260.js.map → VCDisplayCard-6b0274f9.js.map} +1 -1
  59. package/dist/esm/{VCVerificationPill-a2885f77.js → VCVerificationPill-14ba1e6c.js} +6 -1
  60. package/dist/esm/VCVerificationPill-14ba1e6c.js.map +1 -0
  61. package/dist/esm/index-aa1098e1.js +768 -0
  62. package/dist/esm/index-aa1098e1.js.map +1 -0
  63. package/dist/esm/index.js +8 -4
  64. package/dist/esm/index.js.map +1 -1
  65. package/dist/esm/index10.js +2 -1
  66. package/dist/esm/index10.js.map +1 -1
  67. package/dist/esm/index11.js +2 -16
  68. package/dist/esm/index11.js.map +1 -1
  69. package/dist/esm/index12.js +2 -4
  70. package/dist/esm/index12.js.map +1 -1
  71. package/dist/esm/index13.js +1 -7
  72. package/dist/esm/index13.js.map +1 -1
  73. package/dist/esm/index14.js +16 -0
  74. package/dist/esm/index14.js.map +1 -1
  75. package/dist/esm/index15.js +4 -3
  76. package/dist/esm/index15.js.map +1 -1
  77. package/dist/esm/index16.js +6 -1
  78. package/dist/esm/index16.js.map +1 -1
  79. package/dist/esm/index17.js +0 -1
  80. package/dist/esm/index17.js.map +1 -1
  81. package/dist/esm/index18.js +5 -0
  82. package/dist/esm/index18.js.map +1 -0
  83. package/dist/esm/index19.js +4 -0
  84. package/dist/esm/index19.js.map +1 -0
  85. package/dist/esm/index20.js +3 -0
  86. package/dist/esm/index20.js.map +1 -0
  87. package/dist/esm/index5.js +8 -4
  88. package/dist/esm/index5.js.map +1 -1
  89. package/dist/esm/index6.js +1 -1
  90. package/dist/esm/index7.js +2 -2
  91. package/dist/esm/index8.js +1 -2
  92. package/dist/esm/index8.js.map +1 -1
  93. package/dist/esm/index9.js +2 -2
  94. package/dist/index.d.ts +107 -3
  95. package/dist/main.css +1 -1
  96. package/dist/main.js +1 -1
  97. package/package.json +4 -3
  98. package/dist/cjs/VCCard-34e5c166.js.map +0 -1
  99. package/dist/cjs/VCVerificationPill-994d1dee.js.map +0 -1
  100. package/dist/esm/VCCard-3dba135e.js.map +0 -1
  101. package/dist/esm/VCVerificationPill-a2885f77.js.map +0 -1
@@ -9,7 +9,7 @@ var https = require('https');
9
9
  var zlib = require('zlib');
10
10
  var crypto__default = require('crypto');
11
11
  var process$1 = require('process');
12
- var VCDisplayCard = require('./VCDisplayCard-dfda9090.js');
12
+ var VCDisplayCard = require('./VCDisplayCard-36a39706.js');
13
13
 
14
14
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
15
 
@@ -90231,979 +90231,6 @@ class Crypto extends Crypto$1 {
90231
90231
 
90232
90232
  var crypto2 = new Crypto();
90233
90233
 
90234
- /**
90235
- * @author Toru Nagashima <https://github.com/mysticatea>
90236
- * @copyright 2015 Toru Nagashima. All rights reserved.
90237
- * See LICENSE file in root directory for full license.
90238
- */
90239
- /**
90240
- * @typedef {object} PrivateData
90241
- * @property {EventTarget} eventTarget The event target.
90242
- * @property {{type:string}} event The original event object.
90243
- * @property {number} eventPhase The current event phase.
90244
- * @property {EventTarget|null} currentTarget The current event target.
90245
- * @property {boolean} canceled The flag to prevent default.
90246
- * @property {boolean} stopped The flag to stop propagation.
90247
- * @property {boolean} immediateStopped The flag to stop propagation immediately.
90248
- * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
90249
- * @property {number} timeStamp The unix time.
90250
- * @private
90251
- */
90252
-
90253
- /**
90254
- * Private data for event wrappers.
90255
- * @type {WeakMap<Event, PrivateData>}
90256
- * @private
90257
- */
90258
- const privateData = new WeakMap();
90259
-
90260
- /**
90261
- * Cache for wrapper classes.
90262
- * @type {WeakMap<Object, Function>}
90263
- * @private
90264
- */
90265
- const wrappers = new WeakMap();
90266
-
90267
- /**
90268
- * Get private data.
90269
- * @param {Event} event The event object to get private data.
90270
- * @returns {PrivateData} The private data of the event.
90271
- * @private
90272
- */
90273
- function pd(event) {
90274
- const retv = privateData.get(event);
90275
- console.assert(
90276
- retv != null,
90277
- "'this' is expected an Event object, but got",
90278
- event
90279
- );
90280
- return retv
90281
- }
90282
-
90283
- /**
90284
- * https://dom.spec.whatwg.org/#set-the-canceled-flag
90285
- * @param data {PrivateData} private data.
90286
- */
90287
- function setCancelFlag(data) {
90288
- if (data.passiveListener != null) {
90289
- if (
90290
- typeof console !== "undefined" &&
90291
- typeof console.error === "function"
90292
- ) {
90293
- console.error(
90294
- "Unable to preventDefault inside passive event listener invocation.",
90295
- data.passiveListener
90296
- );
90297
- }
90298
- return
90299
- }
90300
- if (!data.event.cancelable) {
90301
- return
90302
- }
90303
-
90304
- data.canceled = true;
90305
- if (typeof data.event.preventDefault === "function") {
90306
- data.event.preventDefault();
90307
- }
90308
- }
90309
-
90310
- /**
90311
- * @see https://dom.spec.whatwg.org/#interface-event
90312
- * @private
90313
- */
90314
- /**
90315
- * The event wrapper.
90316
- * @constructor
90317
- * @param {EventTarget} eventTarget The event target of this dispatching.
90318
- * @param {Event|{type:string}} event The original event to wrap.
90319
- */
90320
- function Event(eventTarget, event) {
90321
- privateData.set(this, {
90322
- eventTarget,
90323
- event,
90324
- eventPhase: 2,
90325
- currentTarget: eventTarget,
90326
- canceled: false,
90327
- stopped: false,
90328
- immediateStopped: false,
90329
- passiveListener: null,
90330
- timeStamp: event.timeStamp || Date.now(),
90331
- });
90332
-
90333
- // https://heycam.github.io/webidl/#Unforgeable
90334
- Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
90335
-
90336
- // Define accessors
90337
- const keys = Object.keys(event);
90338
- for (let i = 0; i < keys.length; ++i) {
90339
- const key = keys[i];
90340
- if (!(key in this)) {
90341
- Object.defineProperty(this, key, defineRedirectDescriptor(key));
90342
- }
90343
- }
90344
- }
90345
-
90346
- // Should be enumerable, but class methods are not enumerable.
90347
- Event.prototype = {
90348
- /**
90349
- * The type of this event.
90350
- * @type {string}
90351
- */
90352
- get type() {
90353
- return pd(this).event.type
90354
- },
90355
-
90356
- /**
90357
- * The target of this event.
90358
- * @type {EventTarget}
90359
- */
90360
- get target() {
90361
- return pd(this).eventTarget
90362
- },
90363
-
90364
- /**
90365
- * The target of this event.
90366
- * @type {EventTarget}
90367
- */
90368
- get currentTarget() {
90369
- return pd(this).currentTarget
90370
- },
90371
-
90372
- /**
90373
- * @returns {EventTarget[]} The composed path of this event.
90374
- */
90375
- composedPath() {
90376
- const currentTarget = pd(this).currentTarget;
90377
- if (currentTarget == null) {
90378
- return []
90379
- }
90380
- return [currentTarget]
90381
- },
90382
-
90383
- /**
90384
- * Constant of NONE.
90385
- * @type {number}
90386
- */
90387
- get NONE() {
90388
- return 0
90389
- },
90390
-
90391
- /**
90392
- * Constant of CAPTURING_PHASE.
90393
- * @type {number}
90394
- */
90395
- get CAPTURING_PHASE() {
90396
- return 1
90397
- },
90398
-
90399
- /**
90400
- * Constant of AT_TARGET.
90401
- * @type {number}
90402
- */
90403
- get AT_TARGET() {
90404
- return 2
90405
- },
90406
-
90407
- /**
90408
- * Constant of BUBBLING_PHASE.
90409
- * @type {number}
90410
- */
90411
- get BUBBLING_PHASE() {
90412
- return 3
90413
- },
90414
-
90415
- /**
90416
- * The target of this event.
90417
- * @type {number}
90418
- */
90419
- get eventPhase() {
90420
- return pd(this).eventPhase
90421
- },
90422
-
90423
- /**
90424
- * Stop event bubbling.
90425
- * @returns {void}
90426
- */
90427
- stopPropagation() {
90428
- const data = pd(this);
90429
-
90430
- data.stopped = true;
90431
- if (typeof data.event.stopPropagation === "function") {
90432
- data.event.stopPropagation();
90433
- }
90434
- },
90435
-
90436
- /**
90437
- * Stop event bubbling.
90438
- * @returns {void}
90439
- */
90440
- stopImmediatePropagation() {
90441
- const data = pd(this);
90442
-
90443
- data.stopped = true;
90444
- data.immediateStopped = true;
90445
- if (typeof data.event.stopImmediatePropagation === "function") {
90446
- data.event.stopImmediatePropagation();
90447
- }
90448
- },
90449
-
90450
- /**
90451
- * The flag to be bubbling.
90452
- * @type {boolean}
90453
- */
90454
- get bubbles() {
90455
- return Boolean(pd(this).event.bubbles)
90456
- },
90457
-
90458
- /**
90459
- * The flag to be cancelable.
90460
- * @type {boolean}
90461
- */
90462
- get cancelable() {
90463
- return Boolean(pd(this).event.cancelable)
90464
- },
90465
-
90466
- /**
90467
- * Cancel this event.
90468
- * @returns {void}
90469
- */
90470
- preventDefault() {
90471
- setCancelFlag(pd(this));
90472
- },
90473
-
90474
- /**
90475
- * The flag to indicate cancellation state.
90476
- * @type {boolean}
90477
- */
90478
- get defaultPrevented() {
90479
- return pd(this).canceled
90480
- },
90481
-
90482
- /**
90483
- * The flag to be composed.
90484
- * @type {boolean}
90485
- */
90486
- get composed() {
90487
- return Boolean(pd(this).event.composed)
90488
- },
90489
-
90490
- /**
90491
- * The unix time of this event.
90492
- * @type {number}
90493
- */
90494
- get timeStamp() {
90495
- return pd(this).timeStamp
90496
- },
90497
-
90498
- /**
90499
- * The target of this event.
90500
- * @type {EventTarget}
90501
- * @deprecated
90502
- */
90503
- get srcElement() {
90504
- return pd(this).eventTarget
90505
- },
90506
-
90507
- /**
90508
- * The flag to stop event bubbling.
90509
- * @type {boolean}
90510
- * @deprecated
90511
- */
90512
- get cancelBubble() {
90513
- return pd(this).stopped
90514
- },
90515
- set cancelBubble(value) {
90516
- if (!value) {
90517
- return
90518
- }
90519
- const data = pd(this);
90520
-
90521
- data.stopped = true;
90522
- if (typeof data.event.cancelBubble === "boolean") {
90523
- data.event.cancelBubble = true;
90524
- }
90525
- },
90526
-
90527
- /**
90528
- * The flag to indicate cancellation state.
90529
- * @type {boolean}
90530
- * @deprecated
90531
- */
90532
- get returnValue() {
90533
- return !pd(this).canceled
90534
- },
90535
- set returnValue(value) {
90536
- if (!value) {
90537
- setCancelFlag(pd(this));
90538
- }
90539
- },
90540
-
90541
- /**
90542
- * Initialize this event object. But do nothing under event dispatching.
90543
- * @param {string} type The event type.
90544
- * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
90545
- * @param {boolean} [cancelable=false] The flag to be possible to cancel.
90546
- * @deprecated
90547
- */
90548
- initEvent() {
90549
- // Do nothing.
90550
- },
90551
- };
90552
-
90553
- // `constructor` is not enumerable.
90554
- Object.defineProperty(Event.prototype, "constructor", {
90555
- value: Event,
90556
- configurable: true,
90557
- writable: true,
90558
- });
90559
-
90560
- // Ensure `event instanceof window.Event` is `true`.
90561
- if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
90562
- Object.setPrototypeOf(Event.prototype, window.Event.prototype);
90563
-
90564
- // Make association for wrappers.
90565
- wrappers.set(window.Event.prototype, Event);
90566
- }
90567
-
90568
- /**
90569
- * Get the property descriptor to redirect a given property.
90570
- * @param {string} key Property name to define property descriptor.
90571
- * @returns {PropertyDescriptor} The property descriptor to redirect the property.
90572
- * @private
90573
- */
90574
- function defineRedirectDescriptor(key) {
90575
- return {
90576
- get() {
90577
- return pd(this).event[key]
90578
- },
90579
- set(value) {
90580
- pd(this).event[key] = value;
90581
- },
90582
- configurable: true,
90583
- enumerable: true,
90584
- }
90585
- }
90586
-
90587
- /**
90588
- * Get the property descriptor to call a given method property.
90589
- * @param {string} key Property name to define property descriptor.
90590
- * @returns {PropertyDescriptor} The property descriptor to call the method property.
90591
- * @private
90592
- */
90593
- function defineCallDescriptor(key) {
90594
- return {
90595
- value() {
90596
- const event = pd(this).event;
90597
- return event[key].apply(event, arguments)
90598
- },
90599
- configurable: true,
90600
- enumerable: true,
90601
- }
90602
- }
90603
-
90604
- /**
90605
- * Define new wrapper class.
90606
- * @param {Function} BaseEvent The base wrapper class.
90607
- * @param {Object} proto The prototype of the original event.
90608
- * @returns {Function} The defined wrapper class.
90609
- * @private
90610
- */
90611
- function defineWrapper(BaseEvent, proto) {
90612
- const keys = Object.keys(proto);
90613
- if (keys.length === 0) {
90614
- return BaseEvent
90615
- }
90616
-
90617
- /** CustomEvent */
90618
- function CustomEvent(eventTarget, event) {
90619
- BaseEvent.call(this, eventTarget, event);
90620
- }
90621
-
90622
- CustomEvent.prototype = Object.create(BaseEvent.prototype, {
90623
- constructor: { value: CustomEvent, configurable: true, writable: true },
90624
- });
90625
-
90626
- // Define accessors.
90627
- for (let i = 0; i < keys.length; ++i) {
90628
- const key = keys[i];
90629
- if (!(key in BaseEvent.prototype)) {
90630
- const descriptor = Object.getOwnPropertyDescriptor(proto, key);
90631
- const isFunc = typeof descriptor.value === "function";
90632
- Object.defineProperty(
90633
- CustomEvent.prototype,
90634
- key,
90635
- isFunc
90636
- ? defineCallDescriptor(key)
90637
- : defineRedirectDescriptor(key)
90638
- );
90639
- }
90640
- }
90641
-
90642
- return CustomEvent
90643
- }
90644
-
90645
- /**
90646
- * Get the wrapper class of a given prototype.
90647
- * @param {Object} proto The prototype of the original event to get its wrapper.
90648
- * @returns {Function} The wrapper class.
90649
- * @private
90650
- */
90651
- function getWrapper(proto) {
90652
- if (proto == null || proto === Object.prototype) {
90653
- return Event
90654
- }
90655
-
90656
- let wrapper = wrappers.get(proto);
90657
- if (wrapper == null) {
90658
- wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
90659
- wrappers.set(proto, wrapper);
90660
- }
90661
- return wrapper
90662
- }
90663
-
90664
- /**
90665
- * Wrap a given event to management a dispatching.
90666
- * @param {EventTarget} eventTarget The event target of this dispatching.
90667
- * @param {Object} event The event to wrap.
90668
- * @returns {Event} The wrapper instance.
90669
- * @private
90670
- */
90671
- function wrapEvent(eventTarget, event) {
90672
- const Wrapper = getWrapper(Object.getPrototypeOf(event));
90673
- return new Wrapper(eventTarget, event)
90674
- }
90675
-
90676
- /**
90677
- * Get the immediateStopped flag of a given event.
90678
- * @param {Event} event The event to get.
90679
- * @returns {boolean} The flag to stop propagation immediately.
90680
- * @private
90681
- */
90682
- function isStopped(event) {
90683
- return pd(event).immediateStopped
90684
- }
90685
-
90686
- /**
90687
- * Set the current event phase of a given event.
90688
- * @param {Event} event The event to set current target.
90689
- * @param {number} eventPhase New event phase.
90690
- * @returns {void}
90691
- * @private
90692
- */
90693
- function setEventPhase(event, eventPhase) {
90694
- pd(event).eventPhase = eventPhase;
90695
- }
90696
-
90697
- /**
90698
- * Set the current target of a given event.
90699
- * @param {Event} event The event to set current target.
90700
- * @param {EventTarget|null} currentTarget New current target.
90701
- * @returns {void}
90702
- * @private
90703
- */
90704
- function setCurrentTarget(event, currentTarget) {
90705
- pd(event).currentTarget = currentTarget;
90706
- }
90707
-
90708
- /**
90709
- * Set a passive listener of a given event.
90710
- * @param {Event} event The event to set current target.
90711
- * @param {Function|null} passiveListener New passive listener.
90712
- * @returns {void}
90713
- * @private
90714
- */
90715
- function setPassiveListener(event, passiveListener) {
90716
- pd(event).passiveListener = passiveListener;
90717
- }
90718
-
90719
- /**
90720
- * @typedef {object} ListenerNode
90721
- * @property {Function} listener
90722
- * @property {1|2|3} listenerType
90723
- * @property {boolean} passive
90724
- * @property {boolean} once
90725
- * @property {ListenerNode|null} next
90726
- * @private
90727
- */
90728
-
90729
- /**
90730
- * @type {WeakMap<object, Map<string, ListenerNode>>}
90731
- * @private
90732
- */
90733
- const listenersMap = new WeakMap();
90734
-
90735
- // Listener types
90736
- const CAPTURE = 1;
90737
- const BUBBLE = 2;
90738
- const ATTRIBUTE = 3;
90739
-
90740
- /**
90741
- * Check whether a given value is an object or not.
90742
- * @param {any} x The value to check.
90743
- * @returns {boolean} `true` if the value is an object.
90744
- */
90745
- function isObject(x) {
90746
- return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax
90747
- }
90748
-
90749
- /**
90750
- * Get listeners.
90751
- * @param {EventTarget} eventTarget The event target to get.
90752
- * @returns {Map<string, ListenerNode>} The listeners.
90753
- * @private
90754
- */
90755
- function getListeners(eventTarget) {
90756
- const listeners = listenersMap.get(eventTarget);
90757
- if (listeners == null) {
90758
- throw new TypeError(
90759
- "'this' is expected an EventTarget object, but got another value."
90760
- )
90761
- }
90762
- return listeners
90763
- }
90764
-
90765
- /**
90766
- * Get the property descriptor for the event attribute of a given event.
90767
- * @param {string} eventName The event name to get property descriptor.
90768
- * @returns {PropertyDescriptor} The property descriptor.
90769
- * @private
90770
- */
90771
- function defineEventAttributeDescriptor(eventName) {
90772
- return {
90773
- get() {
90774
- const listeners = getListeners(this);
90775
- let node = listeners.get(eventName);
90776
- while (node != null) {
90777
- if (node.listenerType === ATTRIBUTE) {
90778
- return node.listener
90779
- }
90780
- node = node.next;
90781
- }
90782
- return null
90783
- },
90784
-
90785
- set(listener) {
90786
- if (typeof listener !== "function" && !isObject(listener)) {
90787
- listener = null; // eslint-disable-line no-param-reassign
90788
- }
90789
- const listeners = getListeners(this);
90790
-
90791
- // Traverse to the tail while removing old value.
90792
- let prev = null;
90793
- let node = listeners.get(eventName);
90794
- while (node != null) {
90795
- if (node.listenerType === ATTRIBUTE) {
90796
- // Remove old value.
90797
- if (prev !== null) {
90798
- prev.next = node.next;
90799
- } else if (node.next !== null) {
90800
- listeners.set(eventName, node.next);
90801
- } else {
90802
- listeners.delete(eventName);
90803
- }
90804
- } else {
90805
- prev = node;
90806
- }
90807
-
90808
- node = node.next;
90809
- }
90810
-
90811
- // Add new value.
90812
- if (listener !== null) {
90813
- const newNode = {
90814
- listener,
90815
- listenerType: ATTRIBUTE,
90816
- passive: false,
90817
- once: false,
90818
- next: null,
90819
- };
90820
- if (prev === null) {
90821
- listeners.set(eventName, newNode);
90822
- } else {
90823
- prev.next = newNode;
90824
- }
90825
- }
90826
- },
90827
- configurable: true,
90828
- enumerable: true,
90829
- }
90830
- }
90831
-
90832
- /**
90833
- * Define an event attribute (e.g. `eventTarget.onclick`).
90834
- * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
90835
- * @param {string} eventName The event name to define.
90836
- * @returns {void}
90837
- */
90838
- function defineEventAttribute(eventTargetPrototype, eventName) {
90839
- Object.defineProperty(
90840
- eventTargetPrototype,
90841
- `on${eventName}`,
90842
- defineEventAttributeDescriptor(eventName)
90843
- );
90844
- }
90845
-
90846
- /**
90847
- * Define a custom EventTarget with event attributes.
90848
- * @param {string[]} eventNames Event names for event attributes.
90849
- * @returns {EventTarget} The custom EventTarget.
90850
- * @private
90851
- */
90852
- function defineCustomEventTarget(eventNames) {
90853
- /** CustomEventTarget */
90854
- function CustomEventTarget() {
90855
- EventTarget.call(this);
90856
- }
90857
-
90858
- CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
90859
- constructor: {
90860
- value: CustomEventTarget,
90861
- configurable: true,
90862
- writable: true,
90863
- },
90864
- });
90865
-
90866
- for (let i = 0; i < eventNames.length; ++i) {
90867
- defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
90868
- }
90869
-
90870
- return CustomEventTarget
90871
- }
90872
-
90873
- /**
90874
- * EventTarget.
90875
- *
90876
- * - This is constructor if no arguments.
90877
- * - This is a function which returns a CustomEventTarget constructor if there are arguments.
90878
- *
90879
- * For example:
90880
- *
90881
- * class A extends EventTarget {}
90882
- * class B extends EventTarget("message") {}
90883
- * class C extends EventTarget("message", "error") {}
90884
- * class D extends EventTarget(["message", "error"]) {}
90885
- */
90886
- function EventTarget() {
90887
- /*eslint-disable consistent-return */
90888
- if (this instanceof EventTarget) {
90889
- listenersMap.set(this, new Map());
90890
- return
90891
- }
90892
- if (arguments.length === 1 && Array.isArray(arguments[0])) {
90893
- return defineCustomEventTarget(arguments[0])
90894
- }
90895
- if (arguments.length > 0) {
90896
- const types = new Array(arguments.length);
90897
- for (let i = 0; i < arguments.length; ++i) {
90898
- types[i] = arguments[i];
90899
- }
90900
- return defineCustomEventTarget(types)
90901
- }
90902
- throw new TypeError("Cannot call a class as a function")
90903
- /*eslint-enable consistent-return */
90904
- }
90905
-
90906
- // Should be enumerable, but class methods are not enumerable.
90907
- EventTarget.prototype = {
90908
- /**
90909
- * Add a given listener to this event target.
90910
- * @param {string} eventName The event name to add.
90911
- * @param {Function} listener The listener to add.
90912
- * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
90913
- * @returns {void}
90914
- */
90915
- addEventListener(eventName, listener, options) {
90916
- if (listener == null) {
90917
- return
90918
- }
90919
- if (typeof listener !== "function" && !isObject(listener)) {
90920
- throw new TypeError("'listener' should be a function or an object.")
90921
- }
90922
-
90923
- const listeners = getListeners(this);
90924
- const optionsIsObj = isObject(options);
90925
- const capture = optionsIsObj
90926
- ? Boolean(options.capture)
90927
- : Boolean(options);
90928
- const listenerType = capture ? CAPTURE : BUBBLE;
90929
- const newNode = {
90930
- listener,
90931
- listenerType,
90932
- passive: optionsIsObj && Boolean(options.passive),
90933
- once: optionsIsObj && Boolean(options.once),
90934
- next: null,
90935
- };
90936
-
90937
- // Set it as the first node if the first node is null.
90938
- let node = listeners.get(eventName);
90939
- if (node === undefined) {
90940
- listeners.set(eventName, newNode);
90941
- return
90942
- }
90943
-
90944
- // Traverse to the tail while checking duplication..
90945
- let prev = null;
90946
- while (node != null) {
90947
- if (
90948
- node.listener === listener &&
90949
- node.listenerType === listenerType
90950
- ) {
90951
- // Should ignore duplication.
90952
- return
90953
- }
90954
- prev = node;
90955
- node = node.next;
90956
- }
90957
-
90958
- // Add it.
90959
- prev.next = newNode;
90960
- },
90961
-
90962
- /**
90963
- * Remove a given listener from this event target.
90964
- * @param {string} eventName The event name to remove.
90965
- * @param {Function} listener The listener to remove.
90966
- * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
90967
- * @returns {void}
90968
- */
90969
- removeEventListener(eventName, listener, options) {
90970
- if (listener == null) {
90971
- return
90972
- }
90973
-
90974
- const listeners = getListeners(this);
90975
- const capture = isObject(options)
90976
- ? Boolean(options.capture)
90977
- : Boolean(options);
90978
- const listenerType = capture ? CAPTURE : BUBBLE;
90979
-
90980
- let prev = null;
90981
- let node = listeners.get(eventName);
90982
- while (node != null) {
90983
- if (
90984
- node.listener === listener &&
90985
- node.listenerType === listenerType
90986
- ) {
90987
- if (prev !== null) {
90988
- prev.next = node.next;
90989
- } else if (node.next !== null) {
90990
- listeners.set(eventName, node.next);
90991
- } else {
90992
- listeners.delete(eventName);
90993
- }
90994
- return
90995
- }
90996
-
90997
- prev = node;
90998
- node = node.next;
90999
- }
91000
- },
91001
-
91002
- /**
91003
- * Dispatch a given event.
91004
- * @param {Event|{type:string}} event The event to dispatch.
91005
- * @returns {boolean} `false` if canceled.
91006
- */
91007
- dispatchEvent(event) {
91008
- if (event == null || typeof event.type !== "string") {
91009
- throw new TypeError('"event.type" should be a string.')
91010
- }
91011
-
91012
- // If listeners aren't registered, terminate.
91013
- const listeners = getListeners(this);
91014
- const eventName = event.type;
91015
- let node = listeners.get(eventName);
91016
- if (node == null) {
91017
- return true
91018
- }
91019
-
91020
- // Since we cannot rewrite several properties, so wrap object.
91021
- const wrappedEvent = wrapEvent(this, event);
91022
-
91023
- // This doesn't process capturing phase and bubbling phase.
91024
- // This isn't participating in a tree.
91025
- let prev = null;
91026
- while (node != null) {
91027
- // Remove this listener if it's once
91028
- if (node.once) {
91029
- if (prev !== null) {
91030
- prev.next = node.next;
91031
- } else if (node.next !== null) {
91032
- listeners.set(eventName, node.next);
91033
- } else {
91034
- listeners.delete(eventName);
91035
- }
91036
- } else {
91037
- prev = node;
91038
- }
91039
-
91040
- // Call this listener
91041
- setPassiveListener(
91042
- wrappedEvent,
91043
- node.passive ? node.listener : null
91044
- );
91045
- if (typeof node.listener === "function") {
91046
- try {
91047
- node.listener.call(this, wrappedEvent);
91048
- } catch (err) {
91049
- if (
91050
- typeof console !== "undefined" &&
91051
- typeof console.error === "function"
91052
- ) {
91053
- console.error(err);
91054
- }
91055
- }
91056
- } else if (
91057
- node.listenerType !== ATTRIBUTE &&
91058
- typeof node.listener.handleEvent === "function"
91059
- ) {
91060
- node.listener.handleEvent(wrappedEvent);
91061
- }
91062
-
91063
- // Break if `event.stopImmediatePropagation` was called.
91064
- if (isStopped(wrappedEvent)) {
91065
- break
91066
- }
91067
-
91068
- node = node.next;
91069
- }
91070
- setPassiveListener(wrappedEvent, null);
91071
- setEventPhase(wrappedEvent, 0);
91072
- setCurrentTarget(wrappedEvent, null);
91073
-
91074
- return !wrappedEvent.defaultPrevented
91075
- },
91076
- };
91077
-
91078
- // `constructor` is not enumerable.
91079
- Object.defineProperty(EventTarget.prototype, "constructor", {
91080
- value: EventTarget,
91081
- configurable: true,
91082
- writable: true,
91083
- });
91084
-
91085
- // Ensure `eventTarget instanceof window.EventTarget` is `true`.
91086
- if (
91087
- typeof window !== "undefined" &&
91088
- typeof window.EventTarget !== "undefined"
91089
- ) {
91090
- Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
91091
- }
91092
-
91093
- /**
91094
- * @author Toru Nagashima <https://github.com/mysticatea>
91095
- * See LICENSE file in root directory for full license.
91096
- */
91097
-
91098
- /**
91099
- * The signal class.
91100
- * @see https://dom.spec.whatwg.org/#abortsignal
91101
- */
91102
- class AbortSignal extends EventTarget {
91103
- /**
91104
- * AbortSignal cannot be constructed directly.
91105
- */
91106
- constructor() {
91107
- super();
91108
- throw new TypeError("AbortSignal cannot be constructed directly");
91109
- }
91110
- /**
91111
- * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
91112
- */
91113
- get aborted() {
91114
- const aborted = abortedFlags.get(this);
91115
- if (typeof aborted !== "boolean") {
91116
- throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
91117
- }
91118
- return aborted;
91119
- }
91120
- }
91121
- defineEventAttribute(AbortSignal.prototype, "abort");
91122
- /**
91123
- * Create an AbortSignal object.
91124
- */
91125
- function createAbortSignal() {
91126
- const signal = Object.create(AbortSignal.prototype);
91127
- EventTarget.call(signal);
91128
- abortedFlags.set(signal, false);
91129
- return signal;
91130
- }
91131
- /**
91132
- * Abort a given signal.
91133
- */
91134
- function abortSignal(signal) {
91135
- if (abortedFlags.get(signal) !== false) {
91136
- return;
91137
- }
91138
- abortedFlags.set(signal, true);
91139
- signal.dispatchEvent({ type: "abort" });
91140
- }
91141
- /**
91142
- * Aborted flag for each instances.
91143
- */
91144
- const abortedFlags = new WeakMap();
91145
- // Properties should be enumerable.
91146
- Object.defineProperties(AbortSignal.prototype, {
91147
- aborted: { enumerable: true },
91148
- });
91149
- // `toString()` should return `"[object AbortSignal]"`
91150
- if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
91151
- Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
91152
- configurable: true,
91153
- value: "AbortSignal",
91154
- });
91155
- }
91156
-
91157
- /**
91158
- * The AbortController.
91159
- * @see https://dom.spec.whatwg.org/#abortcontroller
91160
- */
91161
- class AbortController$1 {
91162
- /**
91163
- * Initialize this controller.
91164
- */
91165
- constructor() {
91166
- signals.set(this, createAbortSignal());
91167
- }
91168
- /**
91169
- * Returns the `AbortSignal` object associated with this object.
91170
- */
91171
- get signal() {
91172
- return getSignal(this);
91173
- }
91174
- /**
91175
- * Abort and signal to any observers that the associated activity is to be aborted.
91176
- */
91177
- abort() {
91178
- abortSignal(getSignal(this));
91179
- }
91180
- }
91181
- /**
91182
- * Associated signals.
91183
- */
91184
- const signals = new WeakMap();
91185
- /**
91186
- * Get the associated signal of a given controller.
91187
- */
91188
- function getSignal(controller) {
91189
- const signal = signals.get(controller);
91190
- if (signal == null) {
91191
- throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
91192
- }
91193
- return signal;
91194
- }
91195
- // Properties should be enumerable.
91196
- Object.defineProperties(AbortController$1.prototype, {
91197
- signal: { enumerable: true },
91198
- abort: { enumerable: true },
91199
- });
91200
- if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
91201
- Object.defineProperty(AbortController$1.prototype, Symbol.toStringTag, {
91202
- configurable: true,
91203
- value: "AbortController",
91204
- });
91205
- }
91206
-
91207
90234
  var __create = Object.create;
91208
90235
  var __defProp = Object.defineProperty;
91209
90236
  var __defProps = Object.defineProperties;
@@ -118804,10 +117831,10 @@ var require_lodash = __commonJS({
118804
117831
  return "";
118805
117832
  }
118806
117833
  __name(toSource, "toSource");
118807
- function cloneDeep3(value) {
117834
+ function cloneDeep5(value) {
118808
117835
  return baseClone(value, true, true);
118809
117836
  }
118810
- __name(cloneDeep3, "cloneDeep");
117837
+ __name(cloneDeep5, "cloneDeep");
118811
117838
  function eq4(value, other) {
118812
117839
  return value === other || value !== value && other !== other;
118813
117840
  }
@@ -118856,7 +117883,7 @@ var require_lodash = __commonJS({
118856
117883
  return false;
118857
117884
  }
118858
117885
  __name(stubFalse, "stubFalse");
118859
- module.exports = cloneDeep3;
117886
+ module.exports = cloneDeep5;
118860
117887
  }
118861
117888
  });
118862
117889
  var require_tslib = __commonJS({
@@ -121241,9 +120268,8 @@ var init2 = /* @__PURE__ */ __name((arg = "https://cdn.filestackcontent.com/jXEx
121241
120268
  return didkit_wasm_default(arg);
121242
120269
  }), "init");
121243
120270
  var didkit_default = init2;
121244
- if (!window) {
120271
+ if (typeof window === "undefined")
121245
120272
  globalThis.crypto = crypto2;
121246
- }
121247
120273
  var addPluginToWallet = /* @__PURE__ */ __name((wallet, plugin) => __async$1(void 0, null, function* () {
121248
120274
  return generateWallet(wallet.contents, {
121249
120275
  plugins: [...wallet.plugins, plugin]
@@ -129515,6 +128541,7 @@ var fast_json_patch_default = Object.assign({}, core_exports, duplex_exports, {
129515
128541
  escapePathComponent,
129516
128542
  unescapePathComponent
129517
128543
  });
128544
+ var import_lodash3 = __toESM(require_lodash(), 1);
129518
128545
  var import_random3 = __toESM(require_random(), 1);
129519
128546
  var SyncOptions;
129520
128547
  (function(SyncOptions2) {
@@ -131261,11 +130288,6 @@ var Stream = class extends Observable {
131261
130288
  get api() {
131262
130289
  return this._context.api;
131263
130290
  }
131264
- get metadata() {
131265
- var _a;
131266
- const { next, metadata } = this.state$.value;
131267
- return (0, import_lodash.default)((_a = next == null ? void 0 : next.metadata) != null ? _a : metadata);
131268
- }
131269
130291
  get content() {
131270
130292
  var _a;
131271
130293
  const { next, content } = this.state$.value;
@@ -131309,16 +130331,6 @@ function StreamStatic() {
131309
130331
  }
131310
130332
  __name(StreamStatic, "StreamStatic");
131311
130333
  var import_cross_fetch = __toESM(require_browser_ponyfill(), 1);
131312
- function polyfillAbortController() {
131313
- if (!globalThis.AbortController) {
131314
- globalThis.AbortController = AbortController$1;
131315
- }
131316
- if (!globalThis.AbortSignal) {
131317
- globalThis.AbortSignal = AbortSignal;
131318
- }
131319
- }
131320
- __name(polyfillAbortController, "polyfillAbortController");
131321
- polyfillAbortController();
131322
130334
  function mergeAbortSignals(signals) {
131323
130335
  const controller = new AbortController();
131324
130336
  if (signals.length === 0) {
@@ -131352,6 +130364,21 @@ var TimedAbortSignal = class {
131352
130364
  }
131353
130365
  };
131354
130366
  __name(TimedAbortSignal, "TimedAbortSignal");
130367
+ function abortable2(original, fn) {
130368
+ return __async$1(this, null, function* () {
130369
+ const controller = new AbortController();
130370
+ const onAbort = /* @__PURE__ */ __name(() => {
130371
+ controller.abort();
130372
+ }, "onAbort");
130373
+ original.addEventListener("abort", onAbort);
130374
+ if (original.aborted)
130375
+ controller.abort();
130376
+ return fn(controller.signal).finally(() => {
130377
+ original.removeEventListener("abort", onAbort);
130378
+ });
130379
+ });
130380
+ }
130381
+ __name(abortable2, "abortable");
131355
130382
  var DEFAULT_FETCH_TIMEOUT = 60 * 1e3 * 3;
131356
130383
  function fetchJson(_0) {
131357
130384
  return __async$1(this, arguments, function* (url, opts = {}) {
@@ -131363,8 +130390,10 @@ function fetchJson(_0) {
131363
130390
  }
131364
130391
  const timeoutLength = opts.timeout || DEFAULT_FETCH_TIMEOUT;
131365
130392
  const timedAbortSignal = new TimedAbortSignal(timeoutLength);
131366
- opts.signal = opts.signal ? mergeAbortSignals([opts.signal, timedAbortSignal.signal]) : timedAbortSignal.signal;
131367
- const res = yield (0, import_cross_fetch.default)(String(url), opts).finally(() => timedAbortSignal.clear());
130393
+ const signal = opts.signal ? mergeAbortSignals([opts.signal, timedAbortSignal.signal]) : timedAbortSignal.signal;
130394
+ const res = yield abortable2(signal, (abortSignal) => {
130395
+ return (0, import_cross_fetch.default)(String(url), __spreadProps(__spreadValues({}, opts), { signal: abortSignal }));
130396
+ }).finally(() => timedAbortSignal.clear());
131368
130397
  if (!res.ok) {
131369
130398
  const text = yield res.text();
131370
130399
  throw new Error(`HTTP request to '${url}' failed with status '${res.statusText}': ${text}`);
@@ -131528,6 +130557,16 @@ var StreamUtils = class {
131528
130557
  }
131529
130558
  return true;
131530
130559
  }
130560
+ static assertCommitLinksToState(state, commit) {
130561
+ const streamId = this.streamIdFromState(state);
130562
+ if (commit.id && !commit.id.equals(state.log[0].cid)) {
130563
+ throw new Error(`Invalid genesis CID in commit for StreamID ${streamId.toString()}. Found: ${commit.id}, expected ${state.log[0].cid}`);
130564
+ }
130565
+ const expectedPrev = state.log[state.log.length - 1].cid;
130566
+ if (!commit.prev.equals(expectedPrev)) {
130567
+ throw new Error(`Commit doesn't properly point to previous commit in log. Expected ${expectedPrev}, found 'prev' ${commit.prev}`);
130568
+ }
130569
+ }
131531
130570
  static convertCommitToSignedCommitContainer(commit, ipfs) {
131532
130571
  return __async$1(this, null, function* () {
131533
130572
  if (StreamUtils.isSignedCommit(commit)) {
@@ -131658,6 +130697,11 @@ var TileDocument = TileDocument_1 = /* @__PURE__ */ __name(class TileDocument2 e
131658
130697
  get content() {
131659
130698
  return super.content;
131660
130699
  }
130700
+ get metadata() {
130701
+ var _a;
130702
+ const { next, metadata } = this.state$.value;
130703
+ return (0, import_lodash3.default)((_a = next == null ? void 0 : next.metadata) != null ? _a : metadata);
130704
+ }
131661
130705
  static create(_0, _1, _2) {
131662
130706
  return __async$1(this, arguments, function* (ceramic, content, metadata, opts = {}) {
131663
130707
  opts = __spreadValues(__spreadValues({}, DEFAULT_CREATE_OPTS), opts);
@@ -131718,7 +130762,7 @@ var TileDocument = TileDocument_1 = /* @__PURE__ */ __name(class TileDocument2 e
131718
130762
  header,
131719
130763
  data: jsonPatch,
131720
130764
  prev: this.tip,
131721
- id: this.state$.id.cid
130765
+ id: this.id.cid
131722
130766
  };
131723
130767
  const commit = yield TileDocument_1._signDagJWS(this.api, rawCommit);
131724
130768
  const updated = yield this.api.applyCommit(this.id, commit, opts);
@@ -132742,6 +131786,7 @@ var Document = class extends Observable {
132742
131786
  }
132743
131787
  };
132744
131788
  __name(Document, "Document");
131789
+ var import_lodash4 = __toESM(require_lodash(), 1);
132745
131790
  var __decorate5 = function(decorators, target, key2, desc) {
132746
131791
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d;
132747
131792
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -132772,6 +131817,11 @@ var Caip10Link = Caip10Link_1 = /* @__PURE__ */ __name(class Caip10Link2 extends
132772
131817
  get did() {
132773
131818
  return this.content;
132774
131819
  }
131820
+ get metadata() {
131821
+ var _a;
131822
+ const { next, metadata } = this.state$.value;
131823
+ return (0, import_lodash4.default)((_a = next == null ? void 0 : next.metadata) != null ? _a : metadata);
131824
+ }
132775
131825
  static fromAccount(_0, _1) {
132776
131826
  return __async$1(this, arguments, function* (ceramic, accountId, opts = {}) {
132777
131827
  opts = __spreadValues(__spreadValues({}, DEFAULT_CREATE_OPTS2), opts);
@@ -132836,7 +131886,7 @@ var Caip10Link = Caip10Link_1 = /* @__PURE__ */ __name(class Caip10Link2 extends
132836
131886
  };
132837
131887
  }
132838
131888
  makeCommit(proof) {
132839
- return { data: proof, prev: this.tip, id: this.state$.id.cid };
131889
+ return { data: proof, prev: this.tip, id: this.id.cid };
132840
131890
  }
132841
131891
  makeReadOnly() {
132842
131892
  this.setDidProof = throwReadOnlyError2;
@@ -132902,6 +131952,9 @@ var Model = Model_1 = /* @__PURE__ */ __name(class Model2 extends Stream {
132902
131952
  get content() {
132903
131953
  return super.content;
132904
131954
  }
131955
+ get metadata() {
131956
+ return { controller: this.state$.value.metadata.controllers[0], model: Model_1.MODEL };
131957
+ }
132905
131958
  static create(ceramic, content, metadata) {
132906
131959
  return __async$1(this, null, function* () {
132907
131960
  Model_1.assertComplete(content);
@@ -132996,6 +132049,12 @@ var Model = Model_1 = /* @__PURE__ */ __name(class Model2 extends Stream {
132996
132049
  };
132997
132050
  }
132998
132051
  static _makeGenesis(signer, content, metadata) {
132052
+ return __async$1(this, null, function* () {
132053
+ const commit = yield this._makeRawGenesis(signer, content, metadata);
132054
+ return Model_1._signDagJWS(signer, commit);
132055
+ });
132056
+ }
132057
+ static _makeRawGenesis(signer, content, metadata) {
132999
132058
  return __async$1(this, null, function* () {
133000
132059
  if (content == null) {
133001
132060
  throw new Error(`Genesis content cannot be null`);
@@ -133013,8 +132072,7 @@ var Model = Model_1 = /* @__PURE__ */ __name(class Model2 extends Stream {
133013
132072
  unique: (0, import_random4.randomBytes)(12),
133014
132073
  model: Model_1.MODEL.bytes
133015
132074
  };
133016
- const commit = { data: content, header };
133017
- return Model_1._signDagJWS(signer, commit);
132075
+ return { data: content, header };
133018
132076
  });
133019
132077
  }
133020
132078
  makeReadOnly() {
@@ -133093,6 +132151,10 @@ var ModelInstanceDocument = ModelInstanceDocument_1 = /* @__PURE__ */ __name(cla
133093
132151
  get content() {
133094
132152
  return super.content;
133095
132153
  }
132154
+ get metadata() {
132155
+ const metadata = this.state$.value.metadata;
132156
+ return { controller: metadata.controllers[0], model: metadata.model };
132157
+ }
133096
132158
  static create(_0, _1, _2) {
133097
132159
  return __async$1(this, arguments, function* (ceramic, content, metadata, opts = {}) {
133098
132160
  opts = __spreadValues(__spreadValues({}, DEFAULT_CREATE_OPTS3), opts);
@@ -133126,7 +132188,7 @@ var ModelInstanceDocument = ModelInstanceDocument_1 = /* @__PURE__ */ __name(cla
133126
132188
  const rawCommit = {
133127
132189
  data: jsonPatch,
133128
132190
  prev: this.tip,
133129
- id: this.state$.id.cid
132191
+ id: this.id.cid
133130
132192
  };
133131
132193
  const commit = yield ModelInstanceDocument_1._signDagJWS(this.api, rawCommit);
133132
132194
  const updated = yield this.api.applyCommit(this.id, commit, opts);
@@ -133155,6 +132217,12 @@ var ModelInstanceDocument = ModelInstanceDocument_1 = /* @__PURE__ */ __name(cla
133155
132217
  };
133156
132218
  }
133157
132219
  static _makeGenesis(signer, content, metadata) {
132220
+ return __async$1(this, null, function* () {
132221
+ const commit = yield this._makeRawGenesis(signer, content, metadata);
132222
+ return ModelInstanceDocument_1._signDagJWS(signer, commit);
132223
+ });
132224
+ }
132225
+ static _makeRawGenesis(signer, content, metadata) {
133158
132226
  return __async$1(this, null, function* () {
133159
132227
  if (!metadata.model) {
133160
132228
  throw new Error(`Must specify a 'model' when creating a ModelInstanceDocument`);
@@ -133172,8 +132240,7 @@ var ModelInstanceDocument = ModelInstanceDocument_1 = /* @__PURE__ */ __name(cla
133172
132240
  unique: (0, import_random5.randomBytes)(12),
133173
132241
  model: metadata.model.bytes
133174
132242
  };
133175
- const commit = { data: content, header };
133176
- return ModelInstanceDocument_1._signDagJWS(signer, commit);
132243
+ return { data: content, header };
133177
132244
  });
133178
132245
  }
133179
132246
  static _signDagJWS(signer, commit) {
@@ -133251,9 +132318,14 @@ var RemoteIndexApi = class {
133251
132318
  queryURL.searchParams.set(key2, query[key2]);
133252
132319
  }
133253
132320
  const response = yield this._fetchJson(queryURL);
133254
- const entries = response.entries.map(StreamUtils.deserializeState);
132321
+ const edges = response.edges.map((e) => {
132322
+ return {
132323
+ cursor: e.cursor,
132324
+ node: StreamUtils.deserializeState(e.node)
132325
+ };
132326
+ });
133255
132327
  return {
133256
- entries,
132328
+ edges,
133257
132329
  pageInfo: response.pageInfo
133258
132330
  };
133259
132331
  });
@@ -133301,10 +132373,10 @@ var CeramicClient = class {
133301
132373
  if (found) {
133302
132374
  if (!StreamUtils.statesEqual(stream.state, found.state))
133303
132375
  found.next(stream.state);
133304
- return this.buildStream(found);
132376
+ return this.buildStreamFromDocument(found);
133305
132377
  } else {
133306
132378
  this._streamCache.set(stream.id.toString(), stream);
133307
- return this.buildStream(stream);
132379
+ return this.buildStreamFromDocument(stream);
133308
132380
  }
133309
132381
  });
133310
132382
  }
@@ -133319,7 +132391,7 @@ var CeramicClient = class {
133319
132391
  stream = yield Document.load(streamRef, this._apiUrl, this._config.syncInterval, opts);
133320
132392
  this._streamCache.set(stream.id.toString(), stream);
133321
132393
  }
133322
- return this.buildStream(stream);
132394
+ return this.buildStreamFromDocument(stream);
133323
132395
  });
133324
132396
  }
133325
132397
  multiQuery(queries, timeout) {
@@ -133340,7 +132412,7 @@ var CeramicClient = class {
133340
132412
  const [k, v] = e;
133341
132413
  const state = StreamUtils.deserializeState(v);
133342
132414
  const stream = new Document(state, this._apiUrl, this._config.syncInterval);
133343
- acc[k] = this.buildStream(stream);
132415
+ acc[k] = this.buildStreamFromDocument(stream);
133344
132416
  return acc;
133345
132417
  }, {});
133346
132418
  });
@@ -133357,10 +132429,10 @@ var CeramicClient = class {
133357
132429
  const fromCache = this._streamCache.get(effectiveStreamId.toString());
133358
132430
  if (fromCache) {
133359
132431
  fromCache.next(document.state);
133360
- return this.buildStream(document);
132432
+ return this.buildStreamFromDocument(document);
133361
132433
  } else {
133362
132434
  this._streamCache.set(effectiveStreamId.toString(), document);
133363
- return this.buildStream(document);
132435
+ return this.buildStreamFromDocument(document);
133364
132436
  }
133365
132437
  });
133366
132438
  }
@@ -133379,16 +132451,15 @@ var CeramicClient = class {
133379
132451
  addStreamHandler(streamHandler) {
133380
132452
  this._streamConstructors[streamHandler.name] = streamHandler.stream_constructor;
133381
132453
  }
133382
- findStreamConstructor(type) {
133383
- const constructor = this._streamConstructors[type];
133384
- if (constructor) {
133385
- return constructor;
133386
- } else {
133387
- throw new Error(`Failed to find constructor for stream ${type}`);
133388
- }
132454
+ buildStreamFromState(state) {
132455
+ const stream$ = new Document(state, this._apiUrl, this._config.syncInterval);
132456
+ return this.buildStreamFromDocument(stream$);
133389
132457
  }
133390
- buildStream(stream) {
133391
- const streamConstructor = this.findStreamConstructor(stream.state.type);
132458
+ buildStreamFromDocument(stream) {
132459
+ const type = stream.state.type;
132460
+ const streamConstructor = this._streamConstructors[type];
132461
+ if (!streamConstructor)
132462
+ throw new Error(`Failed to find constructor for stream ${type}`);
133392
132463
  return new streamConstructor(stream, this.context);
133393
132464
  }
133394
132465
  setDID(did) {
@@ -133495,15 +132566,15 @@ var getIDXPlugin = /* @__PURE__ */ __name((_0, _1) => __async$1(void 0, [_0, _1]
133495
132566
  };
133496
132567
  }), "getIDXPlugin");
133497
132568
  var isHex = /* @__PURE__ */ __name((str) => /^[0-9a-f]+$/i.test(str), "isHex");
133498
- var getDidKeyPlugin = /* @__PURE__ */ __name((key2) => __async$1(void 0, null, function* () {
132569
+ var getDidKeyPlugin = /* @__PURE__ */ __name((wallet, key2) => __async$1(void 0, null, function* () {
133499
132570
  if (key2.length === 0)
133500
132571
  throw new Error("Please don't use an empty string for a key!");
133501
132572
  if (!isHex(key2))
133502
132573
  throw new Error("Key must be a hexadecimal string!");
133503
132574
  if (key2.length > 64)
133504
132575
  throw new Error("Key must be less than 64 characters");
133505
- const keypair = JSON.parse(generateEd25519KeyFromBytes(toUint8Array(key2.padStart(64, "0"))));
133506
- const did = keyToDID("key", JSON.stringify(keypair));
132576
+ const keypair = wallet.pluginMethods.generateEd25519KeyFromBytes(toUint8Array(key2.padStart(64, "0")));
132577
+ const did = wallet.pluginMethods.keyToDid("key", keypair);
133507
132578
  return {
133508
132579
  pluginMethods: {
133509
132580
  getSubjectDid: () => did,
@@ -133525,55 +132596,57 @@ var ExpirationPlugin = /* @__PURE__ */ __name((wallet) => ({
133525
132596
  })
133526
132597
  }
133527
132598
  }), "ExpirationPlugin");
133528
- var issueCredential2 = /* @__PURE__ */ __name((wallet, credential) => __async$1(void 0, null, function* () {
133529
- const _kp = wallet.pluginMethods.getSubjectKeypair();
133530
- if (!_kp)
133531
- throw new Error("Cannot issue credential: Could not get subject keypair");
133532
- const kp = JSON.stringify(_kp);
133533
- const options = JSON.stringify({
133534
- verificationMethod: yield keyToVerificationMethod("key", kp),
133535
- proofPurpose: "assertionMethod"
132599
+ var issueCredential2 = /* @__PURE__ */ __name((initWallet) => {
132600
+ return (wallet, credential) => __async$1(void 0, null, function* () {
132601
+ const kp = wallet.pluginMethods.getSubjectKeypair();
132602
+ if (!kp)
132603
+ throw new Error("Cannot issue credential: Could not get subject keypair");
132604
+ const options = {
132605
+ verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
132606
+ proofPurpose: "assertionMethod"
132607
+ };
132608
+ return initWallet.pluginMethods.issueCredential(credential, options, kp);
132609
+ });
132610
+ }, "issueCredential");
132611
+ var verifyCredential2 = /* @__PURE__ */ __name((initWallet) => {
132612
+ return (_wallet, credential) => __async$1(void 0, null, function* () {
132613
+ return initWallet.pluginMethods.verifyCredential(credential);
133536
132614
  });
133537
- return JSON.parse(yield issueCredential(JSON.stringify(credential), options, kp));
133538
- }), "issueCredential");
133539
- var verifyCredential2 = /* @__PURE__ */ __name((credential) => __async$1(void 0, null, function* () {
133540
- return JSON.parse(yield verifyCredential(JSON.stringify(credential), "{}"));
133541
- }), "verifyCredential");
133542
- var issuePresentation2 = /* @__PURE__ */ __name((wallet, credential) => __async$1(void 0, null, function* () {
133543
- const did = wallet.pluginMethods.getSubjectDid();
133544
- if (!did)
133545
- throw new Error("Cannot create presentation: No holder key found");
133546
- const holder = did;
133547
- const _kp = wallet.pluginMethods.getSubjectKeypair();
133548
- if (!_kp)
133549
- throw new Error("Cannot issue credential: Could not get subject keypair");
133550
- const kp = JSON.stringify(_kp);
133551
- const options = JSON.stringify({
133552
- verificationMethod: yield keyToVerificationMethod("key", kp),
133553
- proofPurpose: "assertionMethod"
132615
+ }, "verifyCredential");
132616
+ var issuePresentation2 = /* @__PURE__ */ __name((initWallet) => {
132617
+ return (wallet, credential) => __async$1(void 0, null, function* () {
132618
+ const did = wallet.pluginMethods.getSubjectDid();
132619
+ if (!did)
132620
+ throw new Error("Cannot create presentation: No holder key found");
132621
+ const holder = did;
132622
+ const kp = wallet.pluginMethods.getSubjectKeypair();
132623
+ if (!kp)
132624
+ throw new Error("Cannot issue credential: Could not get subject keypair");
132625
+ const options = {
132626
+ verificationMethod: yield initWallet.pluginMethods.keyToVerificationMethod("key", kp),
132627
+ proofPurpose: "assertionMethod"
132628
+ };
132629
+ const presentation = {
132630
+ "@context": ["https://www.w3.org/2018/credentials/v1"],
132631
+ type: ["VerifiablePresentation"],
132632
+ holder,
132633
+ verifiableCredential: credential
132634
+ };
132635
+ return initWallet.pluginMethods.issuePresentation(presentation, options, kp);
133554
132636
  });
133555
- const presentation = JSON.stringify({
133556
- "@context": ["https://www.w3.org/2018/credentials/v1"],
133557
- type: ["VerifiablePresentation"],
133558
- holder,
133559
- verifiableCredential: credential
132637
+ }, "issuePresentation");
132638
+ var verifyPresentation2 = /* @__PURE__ */ __name((initWallet) => {
132639
+ return (_wallet, presentation) => __async$1(void 0, null, function* () {
132640
+ return initWallet.pluginMethods.verifyPresentation(presentation);
133560
132641
  });
133561
- return JSON.parse(yield issuePresentation(presentation, options, kp));
133562
- }), "issuePresentation");
133563
- var verifyPresentation2 = /* @__PURE__ */ __name((presentation) => __async$1(void 0, null, function* () {
133564
- return JSON.parse(yield verifyPresentation(JSON.stringify(presentation), "{}"));
133565
- }), "verifyPresentation");
132642
+ }, "verifyPresentation");
133566
132643
  var getVCPlugin = /* @__PURE__ */ __name((wallet) => __async$1(void 0, null, function* () {
133567
132644
  return {
133568
132645
  pluginMethods: __spreadProps(__spreadValues({}, wallet.pluginMethods), {
133569
- issueCredential: issueCredential2,
133570
- verifyCredential: (_wallet, credential) => __async$1(void 0, null, function* () {
133571
- return verifyCredential2(credential);
133572
- }),
133573
- issuePresentation: issuePresentation2,
133574
- verifyPresentation: (_wallet, presentation) => __async$1(void 0, null, function* () {
133575
- return verifyPresentation2(presentation);
133576
- }),
132646
+ issueCredential: issueCredential2(wallet),
132647
+ verifyCredential: verifyCredential2(wallet),
132648
+ issuePresentation: issuePresentation2(wallet),
132649
+ verifyPresentation: verifyPresentation2(wallet),
133577
132650
  getTestVc: (_wallet, subject = "did:example:d23dd687a7dc6787646f2eb98d0") => {
133578
132651
  const did = _wallet.pluginMethods.getSubjectDid();
133579
132652
  return {
@@ -136614,6 +135687,11 @@ var UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
136614
135687
  UnsignedAchievementCredentialValidator.extend({
136615
135688
  proof: ProofValidator.or(ProofValidator.array())
136616
135689
  });
135690
+ mod.object({
135691
+ checks: mod.string().array(),
135692
+ warnings: mod.string().array(),
135693
+ errors: mod.string().array()
135694
+ });
136617
135695
  var VerificationStatusValidator = mod.enum(["Success", "Failed", "Error"]);
136618
135696
  var VerificationStatusEnum = VerificationStatusValidator.enum;
136619
135697
  mod.object({
@@ -138184,13 +137262,38 @@ var defaultCeramicIDXArgs = {
138184
137262
  ceramicEndpoint: "https://ceramic-node.welibrary.io:7007",
138185
137263
  defaultContentFamily: "SuperSkills"
138186
137264
  };
137265
+ var getDidKitPlugin = /* @__PURE__ */ __name((input) => __async$1(void 0, null, function* () {
137266
+ yield didkit_default(input);
137267
+ return {
137268
+ pluginMethods: {
137269
+ generateEd25519KeyFromBytes: (_wallet, bytes) => JSON.parse(generateEd25519KeyFromBytes(bytes)),
137270
+ keyToDid: (_wallet, type, keypair) => keyToDID(type, JSON.stringify(keypair)),
137271
+ keyToVerificationMethod: (_wallet, type, keypair) => __async$1(void 0, null, function* () {
137272
+ return keyToVerificationMethod(type, JSON.stringify(keypair));
137273
+ }),
137274
+ issueCredential: (_wallet, credential, options, keypair) => __async$1(void 0, null, function* () {
137275
+ return JSON.parse(yield issueCredential(JSON.stringify(credential), JSON.stringify(options), JSON.stringify(keypair)));
137276
+ }),
137277
+ verifyCredential: (_wallet, credential) => __async$1(void 0, null, function* () {
137278
+ return JSON.parse(yield verifyCredential(JSON.stringify(credential), "{}"));
137279
+ }),
137280
+ issuePresentation: (presentation, options, keypair) => __async$1(void 0, null, function* () {
137281
+ return issuePresentation(JSON.stringify(presentation), JSON.stringify(options), JSON.stringify(keypair));
137282
+ }),
137283
+ verifyPresentation: (_wallet, presentation) => __async$1(void 0, null, function* () {
137284
+ return JSON.parse(yield verifyPresentation(JSON.stringify(presentation), "{}"));
137285
+ })
137286
+ }
137287
+ };
137288
+ }), "getDidKitPlugin");
138187
137289
  var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async$1(void 0, [_0, ..._1], function* (key2, {
138188
137290
  ceramicIdx = defaultCeramicIDXArgs,
138189
137291
  didkit,
138190
137292
  defaultContents = []
138191
137293
  } = {}) {
138192
137294
  yield didkit_default(didkit);
138193
- const didkeyWallet = yield (yield generateWallet(defaultContents)).addPlugin(yield getDidKeyPlugin(key2));
137295
+ const didkitWallet = yield (yield generateWallet(defaultContents)).addPlugin(yield getDidKitPlugin(didkit));
137296
+ const didkeyWallet = yield didkitWallet.addPlugin(yield getDidKeyPlugin(didkitWallet, key2));
138194
137297
  const didkeyAndVCWallet = yield didkeyWallet.addPlugin(yield getVCPlugin(didkeyWallet));
138195
137298
  const idxWallet = yield didkeyAndVCWallet.addPlugin(yield getIDXPlugin(didkeyAndVCWallet, ceramicIdx));
138196
137299
  const wallet = yield idxWallet.addPlugin(ExpirationPlugin(idxWallet));
@@ -138277,4 +137380,4 @@ const VCCard = ({ credential, issueeOverride, className = "" }) => {
138277
137380
  };
138278
137381
 
138279
137382
  exports.VCCard = VCCard;
138280
- //# sourceMappingURL=VCCard-34e5c166.js.map
137383
+ //# sourceMappingURL=VCCard-5495759e.js.map