@bsv/overlay 0.1.0-alpha.1 → 0.1.0-alpha.2

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 (51) hide show
  1. package/dist/cjs/mod.js +5 -14
  2. package/dist/cjs/mod.js.map +1 -1
  3. package/dist/cjs/package.json +2 -2
  4. package/dist/cjs/src/Engine.js +110 -43
  5. package/dist/cjs/src/Engine.js.map +1 -1
  6. package/dist/cjs/src/storage/knex/KnexStorage.js +25 -3
  7. package/dist/cjs/src/storage/knex/KnexStorage.js.map +1 -1
  8. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  9. package/dist/esm/mod.js +2 -13
  10. package/dist/esm/mod.js.map +1 -1
  11. package/dist/esm/src/Engine.js +110 -43
  12. package/dist/esm/src/Engine.js.map +1 -1
  13. package/dist/esm/src/storage/knex/KnexStorage.js +24 -3
  14. package/dist/esm/src/storage/knex/KnexStorage.js.map +1 -1
  15. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  16. package/dist/types/mod.d.ts +12 -12
  17. package/dist/types/mod.d.ts.map +1 -1
  18. package/dist/types/src/AdmittanceInstructions.d.ts +2 -2
  19. package/dist/types/src/AdmittanceInstructions.d.ts.map +1 -1
  20. package/dist/types/src/Engine.d.ts +46 -26
  21. package/dist/types/src/Engine.d.ts.map +1 -1
  22. package/dist/types/src/LookupAnswer.d.ts.map +1 -1
  23. package/dist/types/src/LookupFormula.d.ts +5 -5
  24. package/dist/types/src/LookupFormula.d.ts.map +1 -1
  25. package/dist/types/src/LookupQuestion.d.ts.map +1 -1
  26. package/dist/types/src/LookupService.d.ts +32 -20
  27. package/dist/types/src/LookupService.d.ts.map +1 -1
  28. package/dist/types/src/Output.d.ts +4 -4
  29. package/dist/types/src/Output.d.ts.map +1 -1
  30. package/dist/types/src/STEAK.d.ts +1 -1
  31. package/dist/types/src/TopicManager.d.ts +5 -5
  32. package/dist/types/src/TopicManager.d.ts.map +1 -1
  33. package/dist/types/src/storage/Storage.d.ts +47 -34
  34. package/dist/types/src/storage/Storage.d.ts.map +1 -1
  35. package/dist/types/src/storage/knex/KnexStorage.d.ts +6 -4
  36. package/dist/types/src/storage/knex/KnexStorage.d.ts.map +1 -1
  37. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  38. package/mod.ts +12 -12
  39. package/package.json +2 -2
  40. package/src/AdmittanceInstructions.ts +8 -8
  41. package/src/Engine.ts +458 -383
  42. package/src/LookupAnswer.ts +7 -7
  43. package/src/LookupFormula.ts +21 -21
  44. package/src/LookupQuestion.ts +9 -9
  45. package/src/LookupService.ts +54 -36
  46. package/src/Output.ts +22 -22
  47. package/src/STEAK.ts +1 -1
  48. package/src/TopicManager.ts +21 -15
  49. package/src/__tests/Engine.test.ts +6 -4
  50. package/src/storage/Storage.ts +49 -34
  51. package/src/storage/knex/KnexStorage.ts +101 -76
@@ -5,43 +5,55 @@ import { Script } from '@bsv/sdk';
5
5
  /**
6
6
  * Defines a Lookup Service interface to be implemented for specific use-cases
7
7
  */
8
- export default interface LookupService {
8
+ export interface LookupService {
9
9
  /**
10
10
  * Process the event when a new UTXO is let into a topic
11
- * @param txid
12
- * @param outputIndex
13
- * @param outputScript
14
- * @param topic
11
+ * @param txid - The transaction ID (TXID) of the transaction where the new UTXO resides.
12
+ * @param outputIndex - The index of the transaction output (UTXO) within the transaction.
13
+ * @param outputScript - The script associated with the transaction output.
14
+ * @param topic - The topic to which the new UTXO is being added.
15
+ * @returns A promise that resolves when the processing of the new UTXO is complete.
15
16
  */
16
- outputAdded?(txid: string, outputIndex: number, outputScript: Script, topic: string): Promise<void>;
17
+ outputAdded?: (txid: string, outputIndex: number, outputScript: Script, topic: string) => Promise<void>;
17
18
  /**
18
- * Process the spend event for a UTXO
19
- * @param txid
20
- * @param outputIndex
21
- * @param topic
19
+ * Processes the spend event for a UTXO.
20
+ *
21
+ * @param txid - The transaction ID of the spent UTXO.
22
+ * @param outputIndex - The index of the transaction output that was spent.
23
+ * @param topic - The topic from which the UTXO was spent.
24
+ *
25
+ * @returns A promise that resolves when processing is complete.
22
26
  */
23
- outputSpent?(txid: string, outputIndex: number, topic: string): Promise<void>;
27
+ outputSpent?: (txid: string, outputIndex: number, topic: string) => Promise<void>;
24
28
  /**
25
- * Process the deletion event for a UTXO
26
- * @param txid
27
- * @param outputIndex
28
- * @param topic
29
- */
30
- outputDeleted?(txid: string, outputIndex: number, topic: string): Promise<void>;
29
+ * Processes the deletion event for a UTXO.
30
+ *
31
+ * @param txid - The transaction ID of the deleted UTXO.
32
+ * @param outputIndex - The index of the transaction output that was deleted.
33
+ * @param topic - The topic from which the UTXO was deleted.
34
+ *
35
+ * @returns A promise that resolves when processing is complete.
36
+ */
37
+ outputDeleted?: (txid: string, outputIndex: number, topic: string) => Promise<void>;
31
38
  /**
32
39
  * Queries the lookup service for information
33
40
  * @param question — The question to be answered by the lookup service
34
41
  * @returns — The Lookup Answer or Lookup Formula used to answer the question
35
42
  */
36
- lookup(question: LookupQuestion): Promise<LookupAnswer | LookupFormula>;
43
+ lookup: (question: LookupQuestion) => Promise<LookupAnswer | LookupFormula>;
37
44
  /**
38
45
  * Returns a Markdown-formatted documentation string for the lookup service.
46
+ *
47
+ * @returns A promise that resolves to a documentation string.
39
48
  */
40
- getDocumentation(): Promise<string>;
49
+ getDocumentation: () => Promise<string>;
41
50
  /**
42
51
  * Returns a metadata object that can be used to identify the lookup service.
52
+ *
53
+ * @returns A promise that resolves to a metadata object containing the name, short description,
54
+ * and optional properties such as icon URL, version, and information URL.
43
55
  */
44
- getMetaData(): Promise<{
56
+ getMetaData: () => Promise<{
45
57
  name: string;
46
58
  shortDescription: string;
47
59
  iconURL?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"LookupService.d.ts","sourceRoot":"","sources":["../../../src/LookupService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,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,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC;;GAEG;AACH,MAAM,WAAW,aAAa;IAE5B;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEvG;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEjF;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEnF;;;;OAIG;IACH,MAAM,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,OAAO,CAAC,YAAY,GAAG,aAAa,CAAC,CAAA;IAE3E;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IAEvC;;;;;OAKG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC;QACzB,IAAI,EAAE,MAAM,CAAA;QACZ,gBAAgB,EAAE,MAAM,CAAA;QACxB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB,CAAC,CAAA;CACH"}
@@ -17,14 +17,14 @@ export type Output = {
17
17
  /** The transaction data for the output */
18
18
  beef: number[];
19
19
  /** Outputs consumed by the transaction associated with the output */
20
- outputsConsumed: {
20
+ outputsConsumed: Array<{
21
21
  txid: string;
22
22
  outputIndex: number;
23
- }[];
23
+ }>;
24
24
  /** Outputs consuming this output */
25
- consumedBy: {
25
+ consumedBy: Array<{
26
26
  txid: string;
27
27
  outputIndex: number;
28
- }[];
28
+ }>;
29
29
  };
30
30
  //# sourceMappingURL=Output.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Output.d.ts","sourceRoot":"","sources":["../../../src/Output.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACjB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,2BAA2B;IAC3B,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,kCAAkC;IAClC,KAAK,EAAE,OAAO,CAAA;IACd,0CAA0C;IAC1C,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,qEAAqE;IACrE,eAAe,EAAE;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;KACtB,EAAE,CAAA;IACH,oCAAoC;IACpC,UAAU,EAAE;QACR,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;KACtB,EAAE,CAAA;CACN,CAAA"}
1
+ {"version":3,"file":"Output.d.ts","sourceRoot":"","sources":["../../../src/Output.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,2BAA2B;IAC3B,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,kCAAkC;IAClC,KAAK,EAAE,OAAO,CAAA;IACd,0CAA0C;IAC1C,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,qEAAqE;IACrE,eAAe,EAAE,KAAK,CAAC;QACrB,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;IACF,oCAAoC;IACpC,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH,CAAA"}
@@ -1,4 +1,4 @@
1
- import { AdmittanceInstructions } from "./AdmittanceInstructions.js";
1
+ import { AdmittanceInstructions } from './AdmittanceInstructions.js';
2
2
  /**
3
3
  * Submitted Transaction Execution AcKnowledgment
4
4
  *
@@ -2,21 +2,21 @@ import { AdmittanceInstructions } from './AdmittanceInstructions.js';
2
2
  /**
3
3
  * Defines a Topic Manager interface that can be implemented for specific use-cases
4
4
  */
5
- export default interface TopicManager {
5
+ export interface TopicManager {
6
6
  /**
7
7
  * Returns instructions that denote which outputs from the provided transaction to admit into the topic, and which previous coins should be retained.
8
- * Accepts the transaction in BEEF format and an array of those input indicies which spend previously-admitted outputs from the same topic.
8
+ * Accepts the transaction in BEEF format and an array of those input indices which spend previously-admitted outputs from the same topic.
9
9
  * The transaction's BEEF structure will always contain the transactions associated with previous coins for reference (if any), regardless of whether the current transaction was directly proven.
10
10
  */
11
- identifyAdmissibleOutputs(beef: number[], previousCoins: number[]): Promise<AdmittanceInstructions>;
11
+ identifyAdmissibleOutputs: (beef: number[], previousCoins: number[]) => Promise<AdmittanceInstructions>;
12
12
  /**
13
13
  * Returns a Markdown-formatted documentation string for the topic manager.
14
14
  */
15
- getDocumentation(): Promise<string>;
15
+ getDocumentation: () => Promise<string>;
16
16
  /**
17
17
  * Returns a metadata object that can be used to identify the topic manager.
18
18
  */
19
- getMetaData(): Promise<{
19
+ getMetaData: () => Promise<{
20
20
  name: string;
21
21
  shortDescription: string;
22
22
  iconURL?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"TopicManager.d.ts","sourceRoot":"","sources":["../../../src/TopicManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,YAAY;IACjC;;;;OAIG;IACH,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAEnG;;MAEE;IACF,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IAEnC;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAClI"}
1
+ {"version":3,"file":"TopicManager.d.ts","sourceRoot":"","sources":["../../../src/TopicManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,yBAAyB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAEvG;;MAEE;IACF,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IAEvC;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC;QACzB,IAAI,EAAE,MAAM,CAAA;QACZ,gBAAgB,EAAE,MAAM,CAAA;QACxB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB,CAAC,CAAA;CACH"}
@@ -1,6 +1,6 @@
1
1
  import type { Output } from '../Output.js';
2
2
  /**
3
- * Representa a transaction that has been applied to a topic.
3
+ * Represents a transaction that has been applied to a topic.
4
4
  */
5
5
  interface AppliedTransaction {
6
6
  /** TXID of the applied transaction */
@@ -11,55 +11,68 @@ interface AppliedTransaction {
11
11
  /**
12
12
  * Defines the Storage Engine interface used internally by the Overlay Services Engine.
13
13
  */
14
- export default interface Storage {
14
+ export interface Storage {
15
15
  /**
16
- * Adds a new output to storage
17
- * @param utxo — The output to add
18
- */
16
+ * Adds a new output to storage
17
+ * @param utxo — The output to add
18
+ */
19
19
  insertOutput: (utxo: Output) => Promise<void>;
20
20
  /**
21
- * Finds an output from storage
22
- * @param txid — TXID of hte output to find
23
- * @param outputIndex — Output index for the output to find
24
- * @param topic — The topic in which the output is stored
25
- * @param spent — Whether the output must be spent to be returned
26
- */
21
+ * Finds an output from storage
22
+ * @param txid — TXID of hte output to find
23
+ * @param outputIndex — Output index for the output to find
24
+ * @param topic — The topic in which the output is stored
25
+ * @param spent — Whether the output must be spent to be returned
26
+ */
27
27
  findOutput: (txid: string, outputIndex: number, topic?: string, spent?: boolean) => Promise<Output | null>;
28
28
  /**
29
- * Deletes an output from storage
30
- * @param txid — The TXID of the output to delete
31
- * @param outputIndex — The index of the output to delete
32
- * @param topic — The topic where the output should be deleted
33
- */
29
+ * Finds outputs with a matching transaction ID from storage
30
+ * @param txid — TXID of the outputs to find
31
+ */
32
+ findOutputsForTransaction: (txid: string) => Promise<Output[]>;
33
+ /**
34
+ * Deletes an output from storage
35
+ * @param txid — The TXID of the output to delete
36
+ * @param outputIndex — The index of the output to delete
37
+ * @param topic — The topic where the output should be deleted
38
+ */
34
39
  deleteOutput: (txid: string, outputIndex: number, topic: string) => Promise<void>;
35
40
  /**
36
- * Updates a UTXO as spent
37
- * @param txid — TXID of the output to update
38
- * @param outputIndex — Index of the output to update
39
- * @param topic — Topic in which the output should be updated
40
- */
41
+ * Updates a UTXO as spent
42
+ * @param txid — TXID of the output to update
43
+ * @param outputIndex — Index of the output to update
44
+ * @param topic — Topic in which the output should be updated
45
+ */
41
46
  markUTXOAsSpent: (txid: string, outputIndex: number, topic: string) => Promise<void>;
42
47
  /**
43
- * Updates which outputs are consumed by this output
44
- * @param txid — TXID of the output to update
45
- * @param outputIndex — Index of the output to update
46
- * @param topic — Topic in which the output should be updated
47
- * @param consumedBy — The new set of outputs consumed by this output
48
- */
48
+ * Updates which outputs are consumed by this output
49
+ * @param txid — TXID of the output to update
50
+ * @param outputIndex — Index of the output to update
51
+ * @param topic — Topic in which the output should be updated
52
+ * @param consumedBy — The new set of outputs consumed by this output
53
+ */
49
54
  updateConsumedBy: (txid: string, outputIndex: number, topic: string, consumedBy: Array<{
50
55
  txid: string;
51
56
  outputIndex: number;
52
57
  }>) => Promise<void>;
53
58
  /**
54
- * Inserts record of the applied transaction
55
- * @param tx — The transaction to insert
56
- */
59
+ * Updates the beef data on an output
60
+ * @param txid — TXID of the output to update
61
+ * @param outputIndex — Index of the output to update
62
+ * @param topic — Topic in which the output should be updated
63
+ * @param beef - BEEF data to update
64
+ */
65
+ updateOutputBeef: (txid: string, outputIndex: number, topic: string, beef: number[]) => Promise<void>;
66
+ /**
67
+ * Inserts record of the applied transaction
68
+ * @param tx — The transaction to insert
69
+ */
57
70
  insertAppliedTransaction: (tx: AppliedTransaction) => Promise<void>;
58
71
  /**
59
- * Checks if a duplicate transaction exists
60
- * @param tx — Transaction to check
61
- * @returns Whether the transaction is already applied
62
- */
72
+ * Checks if a duplicate transaction exists
73
+ * @param tx — Transaction to check
74
+ * @returns Whether the transaction is already applied
75
+ */
63
76
  doesAppliedTransactionExist: (tx: AppliedTransaction) => Promise<boolean>;
64
77
  }
65
78
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../../../../src/storage/Storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C;;GAEG;AACH,UAAU,kBAAkB;IAC1B,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,8CAA8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EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAErG;;;OAGG;IACH,wBAAwB,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEnE;;;;OAIG;IACH,2BAA2B,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC1E"}
@@ -1,17 +1,19 @@
1
- import Storage from '../Storage.js';
1
+ import { Storage } from '../Storage.js';
2
2
  import { Knex } from 'knex';
3
3
  import type { Output } from '../../Output.js';
4
- export default class KnexStorage implements Storage {
4
+ export declare class KnexStorage implements Storage {
5
5
  knex: Knex;
6
6
  constructor(knex: Knex);
7
7
  findOutput(txid: string, outputIndex: number, topic?: string, spent?: boolean): Promise<Output | null>;
8
+ findOutputsForTransaction(txid: string): Promise<Output[]>;
8
9
  deleteOutput(txid: string, outputIndex: number, topic: string): Promise<void>;
9
10
  insertOutput(output: Output): Promise<void>;
10
11
  markUTXOAsSpent(txid: string, outputIndex: number, topic?: string): Promise<void>;
11
- updateConsumedBy(txid: string, outputIndex: number, topic: string, consumedBy: {
12
+ updateConsumedBy(txid: string, outputIndex: number, topic: string, consumedBy: Array<{
12
13
  txid: string;
13
14
  outputIndex: number;
14
- }[]): Promise<void>;
15
+ }>): Promise<void>;
16
+ updateOutputBeef(txid: string, outputIndex: number, topic: string, beef: number[]): Promise<void>;
15
17
  insertAppliedTransaction(tx: {
16
18
  txid: string;
17
19
  topic: string;
@@ -1 +1 @@
1
- {"version":3,"file":"KnexStorage.d.ts","sourceRoot":"","sources":["../../../../../src/storage/knex/KnexStorage.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAE7C,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,OAAO;IAC/C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