@hyperscale0/hsx 1.0.0-rc.1 → 1.0.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -239
- package/LICENSE.md +356 -0
- package/NOTICE.md +8 -0
- package/README.md +45 -43
- package/bin/hsx.ts +0 -5
- package/dist/bin/hsx.d.ts +0 -4
- package/dist/bin/hsx.d.ts.map +1 -1
- package/dist/bin/hsx.js +0 -4
- package/dist/bin/hsx.js.map +1 -1
- package/dist/src/ast.d.ts +113 -302
- package/dist/src/ast.d.ts.map +1 -1
- package/dist/src/ast.js +7 -47
- package/dist/src/ast.js.map +1 -1
- package/dist/src/attachment-economics.d.ts +5 -0
- package/dist/src/attachment-economics.d.ts.map +1 -0
- package/dist/src/attachment-economics.js +55 -0
- package/dist/src/attachment-economics.js.map +1 -0
- package/dist/src/binding-contract.d.ts +22 -0
- package/dist/src/binding-contract.d.ts.map +1 -0
- package/dist/src/binding-contract.js +74 -0
- package/dist/src/binding-contract.js.map +1 -0
- package/dist/src/cli.d.ts +4 -17
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +92 -259
- package/dist/src/cli.js.map +1 -1
- package/dist/src/compile.d.ts +34 -68
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +2949 -118
- package/dist/src/compile.js.map +1 -1
- package/dist/src/cost.d.ts +8 -75
- package/dist/src/cost.d.ts.map +1 -1
- package/dist/src/cost.js +54 -364
- package/dist/src/cost.js.map +1 -1
- package/dist/src/diagnostics.d.ts +14 -9
- package/dist/src/diagnostics.d.ts.map +1 -1
- package/dist/src/diagnostics.js +39 -416
- package/dist/src/diagnostics.js.map +1 -1
- package/dist/src/examples-bundle.d.ts +3 -0
- package/dist/src/examples-bundle.d.ts.map +1 -0
- package/dist/src/examples-bundle.js +18 -0
- package/dist/src/examples-bundle.js.map +1 -0
- package/dist/src/examples.d.ts +10 -0
- package/dist/src/examples.d.ts.map +1 -0
- package/dist/src/examples.js +2 -0
- package/dist/src/examples.js.map +1 -0
- package/dist/src/format.d.ts +8 -7
- package/dist/src/format.d.ts.map +1 -1
- package/dist/src/format.js +9 -175
- package/dist/src/format.js.map +1 -1
- package/dist/src/header-source.d.ts +3 -0
- package/dist/src/header-source.d.ts.map +1 -0
- package/dist/src/header-source.js +41 -0
- package/dist/src/header-source.js.map +1 -0
- package/dist/src/headers.d.ts +64 -0
- package/dist/src/headers.d.ts.map +1 -0
- package/dist/src/headers.js +167 -0
- package/dist/src/headers.js.map +1 -0
- package/dist/src/index.d.ts +8 -11
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -8
- package/dist/src/index.js.map +1 -1
- package/dist/src/keywords.d.ts +56 -0
- package/dist/src/keywords.d.ts.map +1 -0
- package/dist/src/keywords.js +133 -0
- package/dist/src/keywords.js.map +1 -0
- package/dist/src/language.d.ts +26 -0
- package/dist/src/language.d.ts.map +1 -0
- package/dist/src/language.js +440 -0
- package/dist/src/language.js.map +1 -0
- package/dist/src/lex.d.ts +13 -28
- package/dist/src/lex.d.ts.map +1 -1
- package/dist/src/lex.js +119 -145
- package/dist/src/lex.js.map +1 -1
- package/dist/src/parse.d.ts +4 -17
- package/dist/src/parse.d.ts.map +1 -1
- package/dist/src/parse.js +484 -1036
- package/dist/src/parse.js.map +1 -1
- package/dist/src/std-bundle.d.ts +2 -0
- package/dist/src/std-bundle.d.ts.map +1 -0
- package/dist/src/std-bundle.js +15 -0
- package/dist/src/std-bundle.js.map +1 -0
- package/dist/src/std-library.d.ts +5 -0
- package/dist/src/std-library.d.ts.map +1 -0
- package/dist/src/std-library.js +5 -0
- package/dist/src/std-library.js.map +1 -0
- package/dist/src/tunables.d.ts +7 -0
- package/dist/src/tunables.d.ts.map +1 -0
- package/dist/src/tunables.js +27 -0
- package/dist/src/tunables.js.map +1 -0
- package/docs/README.md +528 -23
- package/docs/assets/brand/hsx-horizontal-white.svg +1 -0
- package/docs/assets/brand/hsx-horizontal.svg +1 -0
- package/docs/assets/brand/hsx-stacked-white.svg +1 -0
- package/docs/assets/brand/hsx-stacked.svg +1 -0
- package/docs/assets/brand/manifest.json +30 -0
- package/docs/assets/hsx.svg +11 -0
- package/examples/cards.hsx +34 -0
- package/examples/collections.hsx +37 -0
- package/examples/cost-table.json +633 -385
- package/examples/escrow.hsx +24 -0
- package/examples/financing.hsx +32 -0
- package/examples/insurance.hsx +30 -0
- package/examples/lending.hsx +57 -0
- package/examples/library.hsx +15 -0
- package/examples/marketplace.hsx +32 -0
- package/examples/money.hsx +19 -0
- package/examples/rental-deposit.hsx +60 -0
- package/examples/repair-approval.hsx +44 -0
- package/examples/reporting.hsx +28 -0
- package/examples/savings.hsx +21 -0
- package/examples/serviced.hsx +25 -0
- package/examples/wallet.hsx +24 -0
- package/package.json +27 -17
- package/src/ast.ts +84 -411
- package/src/attachment-economics.ts +103 -0
- package/src/binding-contract.ts +104 -0
- package/src/cli.ts +98 -309
- package/src/compile.ts +4063 -212
- package/src/cost.ts +71 -574
- package/src/diagnostics.ts +57 -437
- package/src/examples-bundle.ts +19 -0
- package/src/examples.ts +9 -0
- package/src/format.ts +12 -256
- package/src/header-source.ts +54 -0
- package/src/headers.ts +195 -0
- package/src/index.ts +16 -29
- package/src/keywords.ts +134 -0
- package/src/language.ts +629 -0
- package/src/lex.ts +131 -192
- package/src/parse.ts +489 -1195
- package/src/std-bundle.ts +15 -0
- package/src/std-library.ts +7 -0
- package/src/tunables.ts +36 -0
- package/std/cards.hsx +85 -0
- package/std/collections.hsx +90 -0
- package/std/escrow.hsx +73 -0
- package/std/financing.hsx +683 -0
- package/std/insurance.hsx +89 -0
- package/std/lending.hsx +138 -0
- package/std/marketplace.hsx +123 -0
- package/std/money.hsx +173 -0
- package/std/reporting.hsx +753 -0
- package/std/savings.hsx +68 -0
- package/std/wallet.hsx +57 -0
- package/LICENSE +0 -661
- package/LICENSING.md +0 -52
- package/TRADEMARKS.md +0 -35
- package/dist/src/emit.d.ts +0 -35
- package/dist/src/emit.d.ts.map +0 -1
- package/dist/src/emit.js +0 -359
- package/dist/src/emit.js.map +0 -1
- package/dist/src/entry-overrides.d.ts +0 -58
- package/dist/src/entry-overrides.d.ts.map +0 -1
- package/dist/src/entry-overrides.js +0 -284
- package/dist/src/entry-overrides.js.map +0 -1
- package/dist/src/ir.d.ts +0 -66
- package/dist/src/ir.d.ts.map +0 -1
- package/dist/src/ir.js +0 -15
- package/dist/src/ir.js.map +0 -1
- package/dist/src/limits.d.ts +0 -21
- package/dist/src/limits.d.ts.map +0 -1
- package/dist/src/limits.js +0 -21
- package/dist/src/limits.js.map +0 -1
- package/dist/src/modules.d.ts +0 -36
- package/dist/src/modules.d.ts.map +0 -1
- package/dist/src/modules.js +0 -372
- package/dist/src/modules.js.map +0 -1
- package/dist/src/typecheck.d.ts +0 -8
- package/dist/src/typecheck.d.ts.map +0 -1
- package/dist/src/typecheck.js +0 -2958
- package/dist/src/typecheck.js.map +0 -1
- package/dist/src/version.d.ts +0 -5
- package/dist/src/version.d.ts.map +0 -1
- package/dist/src/version.js +0 -5
- package/dist/src/version.js.map +0 -1
- package/docs/guide/01-first-program.md +0 -24
- package/docs/guide/02-money.md +0 -25
- package/docs/guide/03-instruments.md +0 -22
- package/docs/guide/04-lifecycles.md +0 -25
- package/docs/guide/05-fees-and-splits.md +0 -45
- package/docs/guide/06-schedules.md +0 -22
- package/docs/guide/07-composition.md +0 -46
- package/docs/guide/08-writing-a-module.md +0 -26
- package/docs/guide/09-cost.md +0 -24
- package/docs/guide/10-diagnostics.md +0 -27
- package/docs/llms-full.txt +0 -1738
- package/docs/llms.txt +0 -45
- package/docs/reference/cli.md +0 -33
- package/docs/reference/diagnostics.md +0 -619
- package/docs/reference/grammar.md +0 -39
- package/docs/reference/std/advance.md +0 -35
- package/docs/reference/std/cancellable_booking.md +0 -35
- package/docs/reference/std/captured_payment.md +0 -43
- package/docs/reference/std/conditional_disbursement.md +0 -33
- package/docs/reference/std/credit_facility.md +0 -35
- package/docs/reference/std/held_payment.md +0 -64
- package/docs/reference/std/instant_transfer.md +0 -30
- package/docs/reference/std/metered.md +0 -27
- package/docs/reference/std/pooled_split.md +0 -26
- package/docs/reference/std/premium_forward.md +0 -39
- package/docs/reference/std/reconciled_payout.md +0 -33
- package/docs/reference/std/recurring_collection.md +0 -25
- package/docs/reference/std/rotating_pool.md +0 -42
- package/docs/reference/std/scheduled.md +0 -51
- package/docs/reference/std/security_deposit.md +0 -46
- package/docs/reference/std/settlement_batch.md +0 -42
- package/docs/reference/std/swap.md +0 -46
- package/docs/reference/std/threshold_pool.md +0 -47
- package/docs/reference/std/weighted_distribution.md +0 -39
- package/docs/reference/types.md +0 -20
- package/docs/reference/udl-output.md +0 -14
- package/docs/sessions/2026-09-02-two-instruments.hsx +0 -21
- package/docs/sessions/2026-09-02-two-instruments.md +0 -41
- package/examples/01-first-program/README.md +0 -45
- package/examples/01-first-program/tip-jar.hsx +0 -17
- package/examples/02-imports-and-archetypes/README.md +0 -99
- package/examples/02-imports-and-archetypes/photo-booth.hsx +0 -37
- package/examples/03-diagnostics/README.md +0 -68
- package/examples/03-diagnostics/corner-shop-fixed.hsx +0 -22
- package/examples/03-diagnostics/corner-shop.hsx +0 -19
- package/examples/04-complete-product/README.md +0 -87
- package/examples/04-complete-product/study-hall.hsx +0 -67
- package/examples/05-watch-club/README.md +0 -9
- package/examples/05-watch-club/watch-club.hsx +0 -124
- package/examples/README.md +0 -18
- package/examples/advance/README.md +0 -3
- package/examples/advance/advance.hsx +0 -13
- package/examples/advance/advance.udl +0 -339
- package/examples/cancellable_booking/README.md +0 -3
- package/examples/cancellable_booking/cancellable_booking.hsx +0 -14
- package/examples/cancellable_booking/cancellable_booking.udl +0 -391
- package/examples/captured_payment/README.md +0 -3
- package/examples/captured_payment/captured_payment.hsx +0 -21
- package/examples/captured_payment/captured_payment.udl +0 -677
- package/examples/conditional_disbursement/README.md +0 -3
- package/examples/conditional_disbursement/conditional_disbursement.hsx +0 -17
- package/examples/conditional_disbursement/conditional_disbursement.udl +0 -412
- package/examples/credit_facility/README.md +0 -3
- package/examples/credit_facility/credit_facility.hsx +0 -27
- package/examples/credit_facility/credit_facility.udl +0 -1373
- package/examples/held_payment/README.md +0 -3
- package/examples/held_payment/held_payment.hsx +0 -13
- package/examples/held_payment/held_payment.udl +0 -507
- package/examples/instant_transfer/README.md +0 -3
- package/examples/instant_transfer/instant_transfer.hsx +0 -16
- package/examples/instant_transfer/instant_transfer.udl +0 -364
- package/examples/metered/README.md +0 -3
- package/examples/metered/metered.hsx +0 -13
- package/examples/metered/metered.udl +0 -247
- package/examples/pooled_split/README.md +0 -3
- package/examples/pooled_split/pooled_split.hsx +0 -15
- package/examples/pooled_split/pooled_split.udl +0 -425
- package/examples/premium_forward/README.md +0 -3
- package/examples/premium_forward/premium_forward.hsx +0 -19
- package/examples/premium_forward/premium_forward.udl +0 -594
- package/examples/reconciled_payout/README.md +0 -3
- package/examples/reconciled_payout/reconciled_payout.hsx +0 -13
- package/examples/reconciled_payout/reconciled_payout.udl +0 -303
- package/examples/recurring_collection/README.md +0 -3
- package/examples/recurring_collection/recurring_collection.hsx +0 -21
- package/examples/recurring_collection/recurring_collection.udl +0 -1130
- package/examples/rotating_pool/README.md +0 -3
- package/examples/rotating_pool/rotating_pool.hsx +0 -18
- package/examples/rotating_pool/rotating_pool.udl +0 -4352
- package/examples/scheduled/README.md +0 -3
- package/examples/scheduled/scheduled.hsx +0 -12
- package/examples/scheduled/scheduled.udl +0 -335
- package/examples/security_deposit/README.md +0 -3
- package/examples/security_deposit/security_deposit.hsx +0 -21
- package/examples/security_deposit/security_deposit.udl +0 -293
- package/examples/settlement_batch/README.md +0 -3
- package/examples/settlement_batch/settlement_batch.hsx +0 -19
- package/examples/settlement_batch/settlement_batch.udl +0 -753
- package/examples/swap/README.md +0 -3
- package/examples/swap/swap.hsx +0 -19
- package/examples/swap/swap.udl +0 -876
- package/examples/threshold_pool/README.md +0 -3
- package/examples/threshold_pool/threshold_pool.hsx +0 -16
- package/examples/threshold_pool/threshold_pool.udl +0 -667
- package/examples/weighted_distribution/README.md +0 -3
- package/examples/weighted_distribution/weighted_distribution.hsx +0 -20
- package/examples/weighted_distribution/weighted_distribution.udl +0 -337
- package/skills/hsx/SKILL.md +0 -483
- package/src/emit.ts +0 -447
- package/src/entry-overrides.ts +0 -428
- package/src/ir.ts +0 -99
- package/src/limits.ts +0 -20
- package/src/modules.ts +0 -444
- package/src/typecheck.ts +0 -3876
- package/src/version.ts +0 -5
- package/std/SEMANTICS.md +0 -130
- package/std/settlements/advance.hsx +0 -177
- package/std/settlements/cancellable_booking.hsx +0 -87
- package/std/settlements/captured_payment.hsx +0 -144
- package/std/settlements/conditional_disbursement.hsx +0 -185
- package/std/settlements/credit_facility.hsx +0 -167
- package/std/settlements/held_payment.hsx +0 -578
- package/std/settlements/index.hsx +0 -3
- package/std/settlements/instant_transfer.hsx +0 -190
- package/std/settlements/metered.hsx +0 -67
- package/std/settlements/pooled_split.hsx +0 -68
- package/std/settlements/premium_forward.hsx +0 -257
- package/std/settlements/reconciled_payout.hsx +0 -77
- package/std/settlements/recurring_collection.hsx +0 -27
- package/std/settlements/rotating_pool.hsx +0 -252
- package/std/settlements/scheduled.hsx +0 -641
- package/std/settlements/security_deposit.hsx +0 -166
- package/std/settlements/settlement_batch.hsx +0 -122
- package/std/settlements/swap.hsx +0 -1114
- package/std/settlements/threshold_pool.hsx +0 -221
- package/std/settlements/weighted_distribution.hsx +0 -141
package/LICENSING.md
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Licensing
|
|
2
|
-
|
|
3
|
-
The code in this repository is Copyright 2026 Hyperscale LLC and is licensed
|
|
4
|
-
under the GNU Affero General Public License version 3 only
|
|
5
|
-
(`AGPL-3.0-only`). The full text is in [`LICENSE`](./LICENSE).
|
|
6
|
-
|
|
7
|
-
## What the AGPL asks of you
|
|
8
|
-
|
|
9
|
-
Two obligations matter in practice.
|
|
10
|
-
|
|
11
|
-
**If you distribute a copy in object form**, modified or not, you make its
|
|
12
|
-
Corresponding Source available under the same license.
|
|
13
|
-
|
|
14
|
-
**If you run a modified copy as a network service**, section 13 applies: the
|
|
15
|
-
users interacting with it over the network get an offer of the source of the
|
|
16
|
-
version you are running. Compiling HSX with an unmodified copy behind your own
|
|
17
|
-
service does not trigger this. Changing the lexer, the parser, the lowering, or
|
|
18
|
-
the emitted IR and then serving that change does.
|
|
19
|
-
|
|
20
|
-
Using `@hyperscale0/hsx` as a library inside your own program is a combined
|
|
21
|
-
work under the AGPL. If that does not fit how you ship, take the commercial
|
|
22
|
-
license instead.
|
|
23
|
-
|
|
24
|
-
## Commercial license
|
|
25
|
-
|
|
26
|
-
Hyperscale LLC sells a commercial license to organisations that cannot accept
|
|
27
|
-
the AGPL, for the usual reasons: a proprietary product that links the compiler,
|
|
28
|
-
a hosted service you will not open, a procurement policy that refuses copyleft.
|
|
29
|
-
It grants the same code under ordinary commercial terms with no source
|
|
30
|
-
obligation.
|
|
31
|
-
|
|
32
|
-
Ask through <https://hyperscale0.ai>.
|
|
33
|
-
|
|
34
|
-
## The license covers code, not marks
|
|
35
|
-
|
|
36
|
-
"Hyperscale" and "HSX" are trademarks of Hyperscale LLC. A copyright license
|
|
37
|
-
says nothing about trademarks in either direction, so
|
|
38
|
-
[`TRADEMARKS.md`](./TRADEMARKS.md) draws that boundary.
|
|
39
|
-
|
|
40
|
-
## The language is not the compiler
|
|
41
|
-
|
|
42
|
-
HSX the language and its output contract are separate from this compiler. The
|
|
43
|
-
canonical UDL schema published by the UDL repository and the fixtures under
|
|
44
|
-
[`examples/`](./examples) are data describing a language, and anyone may write their own compiler,
|
|
45
|
-
formatter, or runtime against them, in any language, under any license, without
|
|
46
|
-
touching this code.
|
|
47
|
-
|
|
48
|
-
What you may then say about it is a trademark question, not a copyright one.
|
|
49
|
-
[`TRADEMARKS.md`](./TRADEMARKS.md) has the rule: claim compatibility with an
|
|
50
|
-
HSX IR version only when your implementation emits IR that validates against
|
|
51
|
-
that version's published schema, from the published example programs,
|
|
52
|
-
unmodified.
|
package/TRADEMARKS.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Trademarks
|
|
2
|
-
|
|
3
|
-
"Hyperscale" and "HSX" are trademarks of Hyperscale LLC.
|
|
4
|
-
|
|
5
|
-
The AGPL covers the code in this repository and nothing else. It grants no
|
|
6
|
-
rights to the marks, and it never mentions them: a copyright license says
|
|
7
|
-
nothing about trademarks either way. This file draws that boundary so nobody
|
|
8
|
-
has to guess where it sits.
|
|
9
|
-
|
|
10
|
-
What that means in practice:
|
|
11
|
-
|
|
12
|
-
- **Yes.** Say your project uses HSX, compiles HSX, or reads its internal lowering record.
|
|
13
|
-
Say it in your README, your docs, your talk, and your package description.
|
|
14
|
-
Fork this repository and keep the notices intact.
|
|
15
|
-
- **Yes.** Publish an HSX implementation or tool in another language, and name
|
|
16
|
-
it in a way that describes what it does: `hsx-rs`, `hsx-lsp`, `tree-sitter-hsx`.
|
|
17
|
-
- **No.** Name your project, company, or product in a way that suggests
|
|
18
|
-
Hyperscale LLC published it or endorses it. `@hyperscale0/*` on npm and the
|
|
19
|
-
`hyperscale0` GitHub organisation are ours.
|
|
20
|
-
- **No.** Use the marks or our logo in a way that implies affiliation,
|
|
21
|
-
sponsorship, or certification we have not given.
|
|
22
|
-
|
|
23
|
-
## Claiming compatibility
|
|
24
|
-
|
|
25
|
-
An independent implementation may say it "implements HSX IR version X" only
|
|
26
|
-
while it emits canonical UDL that validates against the UDL schema published
|
|
27
|
-
for that version, from the published example programs, unmodified. The UDL
|
|
28
|
-
schema and the programs in [`examples/`](./examples) are the whole
|
|
29
|
-
test: no edited fixture, no local relaxation of the schema.
|
|
30
|
-
|
|
31
|
-
That claim is a statement about your implementation, so keep the marks out of
|
|
32
|
-
its name and off its logo, and do not present it as endorsement or
|
|
33
|
-
certification by Hyperscale LLC. We certify nothing; the schema does.
|
|
34
|
-
|
|
35
|
-
If you are unsure, open an issue and ask. Nobody has ever regretted asking.
|
package/dist/src/emit.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type UdlDocument, type UdlIssueCode } from "@hyperscale0/udl";
|
|
2
|
-
import type { JsonValue, TypedInstrument, TypedProgram } from "./ir.ts";
|
|
3
|
-
export interface OriginMapEntry {
|
|
4
|
-
readonly path: string;
|
|
5
|
-
readonly span: {
|
|
6
|
-
readonly end: number;
|
|
7
|
-
readonly start: number;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export interface GeneralLoweringIssue {
|
|
11
|
-
readonly code: string;
|
|
12
|
-
readonly fix: string;
|
|
13
|
-
readonly message: string;
|
|
14
|
-
readonly path: string;
|
|
15
|
-
readonly span: {
|
|
16
|
-
readonly end: number;
|
|
17
|
-
readonly start: number;
|
|
18
|
-
};
|
|
19
|
-
readonly udlCode: UdlIssueCode;
|
|
20
|
-
}
|
|
21
|
-
export type GeneralLowerResult = {
|
|
22
|
-
readonly issues: readonly GeneralLoweringIssue[];
|
|
23
|
-
readonly ok: false;
|
|
24
|
-
} | {
|
|
25
|
-
readonly ok: true;
|
|
26
|
-
readonly value: {
|
|
27
|
-
readonly canonicalUdl: string;
|
|
28
|
-
readonly document: UdlDocument;
|
|
29
|
-
readonly frame: Record<string, JsonValue>;
|
|
30
|
-
readonly originMap: readonly OriginMapEntry[];
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export declare function lowerGeneralProgram(program: TypedProgram): GeneralLowerResult;
|
|
34
|
-
export declare function requiredFields(instrument: TypedInstrument): string[];
|
|
35
|
-
//# sourceMappingURL=emit.d.ts.map
|
package/dist/src/emit.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe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ist/src/emit.js
DELETED
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
import { serializeUdl, validateUdl, } from "@hyperscale0/udl";
|
|
2
|
-
export function lowerGeneralProgram(program) {
|
|
3
|
-
const candidate = {
|
|
4
|
-
instruments: program.instruments.map((instrument) => ({
|
|
5
|
-
...instrument.slots,
|
|
6
|
-
actionOrder: instrument.actions.map((action) => action.name),
|
|
7
|
-
actions: Object.fromEntries(instrument.actions.map((action) => [action.name, action.slots])),
|
|
8
|
-
fields: Object.fromEntries(instrument.fields.map((field) => [field.name, field.schema])),
|
|
9
|
-
id: instrument.id,
|
|
10
|
-
required: requiredFields(instrument),
|
|
11
|
-
})),
|
|
12
|
-
product: program.name,
|
|
13
|
-
subjects: program.subjects.map((subject) => ({
|
|
14
|
-
declaredValue: subject.declaredValue,
|
|
15
|
-
kind: subject.kind,
|
|
16
|
-
schema: subject.schema,
|
|
17
|
-
title: subject.title,
|
|
18
|
-
version: subject.version,
|
|
19
|
-
})),
|
|
20
|
-
title: program.title,
|
|
21
|
-
udl: 1,
|
|
22
|
-
version: 1,
|
|
23
|
-
};
|
|
24
|
-
const frame = frameFor(program);
|
|
25
|
-
const unresolved = [
|
|
26
|
-
...unresolvedCompilerMarkers(candidate),
|
|
27
|
-
...unresolvedCompilerMarkers(frame, "$.frame"),
|
|
28
|
-
];
|
|
29
|
-
if (unresolved.length > 0) {
|
|
30
|
-
const origins = originMapFor(program);
|
|
31
|
-
return {
|
|
32
|
-
issues: unresolved.map(({ marker, path }) => ({
|
|
33
|
-
code: "HSX1603",
|
|
34
|
-
fix: "correct the compile-time block keys or parameter bindings",
|
|
35
|
-
message: `${path}: emitted value contains unresolved compiler marker ${marker}`,
|
|
36
|
-
path,
|
|
37
|
-
span: originForUdlPath(path, origins)?.span ?? program.origin,
|
|
38
|
-
udlCode: "UDL1003",
|
|
39
|
-
})),
|
|
40
|
-
ok: false,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
const validation = validateUdl(candidate);
|
|
44
|
-
if (!validation.ok) {
|
|
45
|
-
const origins = originMapFor(program);
|
|
46
|
-
return {
|
|
47
|
-
issues: validation.issues.map((issue) => {
|
|
48
|
-
const origin = originForUdlPath(issue.path, origins);
|
|
49
|
-
return {
|
|
50
|
-
code: issue.category === "invalid_semantics" ? "HSX1602" : "HSX1601",
|
|
51
|
-
fix: "correct the named clause so it matches the targeted UDL definition",
|
|
52
|
-
message: `${issue.path}: ${issue.message}`,
|
|
53
|
-
path: issue.path,
|
|
54
|
-
span: origin?.span ?? program.origin,
|
|
55
|
-
udlCode: issue.code,
|
|
56
|
-
};
|
|
57
|
-
}),
|
|
58
|
-
ok: false,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
const document = validation.value;
|
|
62
|
-
return {
|
|
63
|
-
ok: true,
|
|
64
|
-
value: {
|
|
65
|
-
canonicalUdl: serializeUdl(document),
|
|
66
|
-
document,
|
|
67
|
-
frame,
|
|
68
|
-
originMap: originMapFor(program),
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
const COMPILER_MARKERS = ["__hsx_none__", "invalid_compile_time_name"];
|
|
73
|
-
function unresolvedCompilerMarkers(value, path = "$") {
|
|
74
|
-
if (typeof value === "string") {
|
|
75
|
-
return COMPILER_MARKERS.filter((marker) => value.includes(marker)).map((marker) => ({ marker, path }));
|
|
76
|
-
}
|
|
77
|
-
if (Array.isArray(value)) {
|
|
78
|
-
return value.flatMap((item, index) => unresolvedCompilerMarkers(item, `${path}[${index}]`));
|
|
79
|
-
}
|
|
80
|
-
if (!value || typeof value !== "object")
|
|
81
|
-
return [];
|
|
82
|
-
return Object.entries(value).flatMap(([key, item]) => {
|
|
83
|
-
const childPath = /^[A-Za-z_][A-Za-z0-9_]*$/.test(key)
|
|
84
|
-
? `${path}.${key}`
|
|
85
|
-
: `${path}[${JSON.stringify(key)}]`;
|
|
86
|
-
const keyIssues = COMPILER_MARKERS.filter((marker) => key.includes(marker)).map((marker) => ({ marker, path: childPath }));
|
|
87
|
-
return [...keyIssues, ...unresolvedCompilerMarkers(item, childPath)];
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function originForUdlPath(path, origins) {
|
|
91
|
-
return ([...origins]
|
|
92
|
-
.filter((entry) => path === entry.path ||
|
|
93
|
-
path.startsWith(`${entry.path}.`) ||
|
|
94
|
-
path.startsWith(`${entry.path}[`))
|
|
95
|
-
.sort((left, right) => right.path.length - left.path.length)[0] ??
|
|
96
|
-
origins.find((entry) => entry.path === "$"));
|
|
97
|
-
}
|
|
98
|
-
export function requiredFields(instrument) {
|
|
99
|
-
const explicit = instrument.slots.required;
|
|
100
|
-
if (Array.isArray(explicit) &&
|
|
101
|
-
explicit.every((field) => typeof field === "string")) {
|
|
102
|
-
return [...explicit];
|
|
103
|
-
}
|
|
104
|
-
const required = new Set(instrument.fields
|
|
105
|
-
.filter((field) => field.required)
|
|
106
|
-
.map((field) => field.name));
|
|
107
|
-
const partyFields = instrument.slots.parties &&
|
|
108
|
-
typeof instrument.slots.parties === "object" &&
|
|
109
|
-
!Array.isArray(instrument.slots.parties)
|
|
110
|
-
? Object.values(instrument.slots.parties).filter((value) => typeof value === "string" && required.has(value))
|
|
111
|
-
: [];
|
|
112
|
-
return [
|
|
113
|
-
...new Set(partyFields),
|
|
114
|
-
...instrument.fields
|
|
115
|
-
.map((field) => field.name)
|
|
116
|
-
.filter((name) => required.has(name) && !partyFields.includes(name)),
|
|
117
|
-
];
|
|
118
|
-
}
|
|
119
|
-
function frameFor(program) {
|
|
120
|
-
const actors = new Map();
|
|
121
|
-
const moneyEvents = [];
|
|
122
|
-
const design = [];
|
|
123
|
-
const fees = [];
|
|
124
|
-
const mechanics = new Set();
|
|
125
|
-
const eventKeys = new Set();
|
|
126
|
-
const ensureActor = (rawKey, role) => {
|
|
127
|
-
const key = frameKey(rawKey);
|
|
128
|
-
if (!actors.has(key)) {
|
|
129
|
-
actors.set(key, {
|
|
130
|
-
key,
|
|
131
|
-
label: titleize(key),
|
|
132
|
-
maxCount: 1,
|
|
133
|
-
minCount: 1,
|
|
134
|
-
role,
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return key;
|
|
138
|
-
};
|
|
139
|
-
const uniqueEventKey = (raw) => {
|
|
140
|
-
const base = frameKey(raw);
|
|
141
|
-
let key = base;
|
|
142
|
-
let ordinal = 2;
|
|
143
|
-
while (eventKeys.has(key)) {
|
|
144
|
-
const suffix = `_${ordinal}`;
|
|
145
|
-
key = `${base.slice(0, 40 - suffix.length)}${suffix}`;
|
|
146
|
-
ordinal += 1;
|
|
147
|
-
}
|
|
148
|
-
eventKeys.add(key);
|
|
149
|
-
return key;
|
|
150
|
-
};
|
|
151
|
-
for (const instrument of program.instruments) {
|
|
152
|
-
const actorByField = new Map();
|
|
153
|
-
const parties = instrument.slots.parties;
|
|
154
|
-
if (parties && typeof parties === "object" && !Array.isArray(parties)) {
|
|
155
|
-
for (const [role, value] of Object.entries(parties)) {
|
|
156
|
-
if (typeof value !== "string")
|
|
157
|
-
continue;
|
|
158
|
-
const actor = ensureActor(role, frameActorRole(role, "source"));
|
|
159
|
-
actorByField.set(value, actor);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
for (const action of instrument.actions) {
|
|
163
|
-
if (action.slots.due)
|
|
164
|
-
mechanics.add("recurring_billing");
|
|
165
|
-
const moves = action.slots.moves;
|
|
166
|
-
if (!Array.isArray(moves))
|
|
167
|
-
continue;
|
|
168
|
-
moves.forEach((move, index) => {
|
|
169
|
-
if (moneyEvents.length >= 20)
|
|
170
|
-
return;
|
|
171
|
-
if (!move || typeof move !== "object" || Array.isArray(move))
|
|
172
|
-
return;
|
|
173
|
-
const bind = move.bind &&
|
|
174
|
-
typeof move.bind === "object" &&
|
|
175
|
-
!Array.isArray(move.bind)
|
|
176
|
-
? move.bind
|
|
177
|
-
: {};
|
|
178
|
-
const source = frameActorForBinding(bind.sourceAccountId, actorByField, "source", ensureActor);
|
|
179
|
-
const destination = frameActorForBinding(bind.destinationAccountId, actorByField, "destination", ensureActor);
|
|
180
|
-
const operation = typeof move.operation === "string" ? move.operation : "transfer";
|
|
181
|
-
if (source === "escrow" || destination === "escrow") {
|
|
182
|
-
mechanics.add("escrow");
|
|
183
|
-
}
|
|
184
|
-
moneyEvents.push({
|
|
185
|
-
allocationTotalBps: 0,
|
|
186
|
-
amount: bindingWords(bind.amount) || "the declared amount",
|
|
187
|
-
amountDependencies: [],
|
|
188
|
-
amountMode: "fixed",
|
|
189
|
-
amountSchedule: [],
|
|
190
|
-
distribution: "single",
|
|
191
|
-
fromActor: source,
|
|
192
|
-
key: uniqueEventKey(typeof move.key === "string"
|
|
193
|
-
? move.key
|
|
194
|
-
: `${instrument.id}_${action.name}_${index + 1}`),
|
|
195
|
-
kind: frameEventKind(operation, source, destination),
|
|
196
|
-
label: `${titleize(action.name)} movement`,
|
|
197
|
-
occurrence: action.slots.due ? "repeatable" : "once",
|
|
198
|
-
timing: action.name === "create" ? "on_create" : "on_lifecycle",
|
|
199
|
-
toActor: destination,
|
|
200
|
-
trigger: `when ${action.name.replaceAll("_", " ")} runs`,
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
if (design.length < 10) {
|
|
205
|
-
design.push(`${instrument.id}: ${instrument.fields.length} fields and ${instrument.actions.length} actions`);
|
|
206
|
-
}
|
|
207
|
-
const feeRules = instrument.slots.feeRules;
|
|
208
|
-
if (Array.isArray(feeRules)) {
|
|
209
|
-
feeRules.forEach((fee, index) => {
|
|
210
|
-
if (fees.length >= 4)
|
|
211
|
-
return;
|
|
212
|
-
if (!fee || typeof fee !== "object" || Array.isArray(fee))
|
|
213
|
-
return;
|
|
214
|
-
fees.push({
|
|
215
|
-
label: `${titleize(instrument.id)} fee ${index + 1}`,
|
|
216
|
-
on: typeof fee.baseField === "string"
|
|
217
|
-
? fee.baseField
|
|
218
|
-
: `${instrument.id} movement`,
|
|
219
|
-
structure: typeof fee.position === "string"
|
|
220
|
-
? `${fee.position.replaceAll("_", " ")} fee`
|
|
221
|
-
: "declared fee",
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
if (actors.size === 0)
|
|
227
|
-
ensureActor("platform", "platform");
|
|
228
|
-
if (moneyEvents.length === 0) {
|
|
229
|
-
const actor = actors.keys().next().value ?? "platform";
|
|
230
|
-
moneyEvents.push({
|
|
231
|
-
allocationTotalBps: 0,
|
|
232
|
-
amount: "the declared settlement amount",
|
|
233
|
-
amountDependencies: [],
|
|
234
|
-
amountMode: "fixed",
|
|
235
|
-
amountSchedule: [],
|
|
236
|
-
distribution: "single",
|
|
237
|
-
fromActor: actor,
|
|
238
|
-
key: uniqueEventKey(`${program.name}_create`),
|
|
239
|
-
kind: "charge",
|
|
240
|
-
label: `${program.title} movement`,
|
|
241
|
-
occurrence: "once",
|
|
242
|
-
timing: "on_create",
|
|
243
|
-
toActor: actor,
|
|
244
|
-
trigger: "when the settlement is created",
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
if (mechanics.size === 0)
|
|
248
|
-
mechanics.add("escrow");
|
|
249
|
-
return {
|
|
250
|
-
actors: [...actors.values()],
|
|
251
|
-
confidence: "high",
|
|
252
|
-
conservationGroups: [],
|
|
253
|
-
design,
|
|
254
|
-
feePolicy: fees.length > 0 ? "defined" : "none",
|
|
255
|
-
fees,
|
|
256
|
-
headline: program.title,
|
|
257
|
-
mechanics: [...mechanics],
|
|
258
|
-
moneyEvents,
|
|
259
|
-
offPlatform: [],
|
|
260
|
-
openQuestions: [],
|
|
261
|
-
rules: [],
|
|
262
|
-
subjects: program.subjects.map((subject) => ({
|
|
263
|
-
kind: subject.kind,
|
|
264
|
-
title: subject.title,
|
|
265
|
-
})),
|
|
266
|
-
summary: `${program.title} compiles ${program.instruments.length} financial instrument${program.instruments.length === 1 ? "" : "s"}.`,
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
function frameActorForBinding(value, actorByField, direction, ensureActor) {
|
|
270
|
-
const path = bindingWords(value);
|
|
271
|
-
if (path.includes("escrowAccountId"))
|
|
272
|
-
return "escrow";
|
|
273
|
-
const field = path.startsWith("fields.")
|
|
274
|
-
? path.slice("fields.".length)
|
|
275
|
-
: path;
|
|
276
|
-
const declared = actorByField.get(field);
|
|
277
|
-
if (declared)
|
|
278
|
-
return declared;
|
|
279
|
-
if (field.toLowerCase().includes("platform")) {
|
|
280
|
-
return ensureActor("platform", "platform");
|
|
281
|
-
}
|
|
282
|
-
return ensureActor(direction === "source" ? "payer" : "beneficiary", direction === "source" ? "payer" : "beneficiary");
|
|
283
|
-
}
|
|
284
|
-
function frameActorRole(role, direction) {
|
|
285
|
-
return [
|
|
286
|
-
"payer",
|
|
287
|
-
"beneficiary",
|
|
288
|
-
"platform",
|
|
289
|
-
"provider",
|
|
290
|
-
"guardian",
|
|
291
|
-
"holder",
|
|
292
|
-
].includes(role)
|
|
293
|
-
? role
|
|
294
|
-
: direction === "source"
|
|
295
|
-
? "payer"
|
|
296
|
-
: "beneficiary";
|
|
297
|
-
}
|
|
298
|
-
function frameEventKind(operation, source, destination) {
|
|
299
|
-
if (operation.endsWith(".reserve"))
|
|
300
|
-
return "hold";
|
|
301
|
-
if (operation.endsWith(".void") || operation.endsWith(".return")) {
|
|
302
|
-
return "refund";
|
|
303
|
-
}
|
|
304
|
-
if (operation.startsWith("payout."))
|
|
305
|
-
return "payout";
|
|
306
|
-
if (source === "escrow" || destination === "escrow")
|
|
307
|
-
return "release";
|
|
308
|
-
return "charge";
|
|
309
|
-
}
|
|
310
|
-
function frameKey(value) {
|
|
311
|
-
const snake = value
|
|
312
|
-
.replace(/([a-z0-9])([A-Z])/g, "$1_$2")
|
|
313
|
-
.replace(/[^A-Za-z0-9]+/g, "_")
|
|
314
|
-
.replace(/^_+|_+$/g, "")
|
|
315
|
-
.toLowerCase();
|
|
316
|
-
const leading = /^[a-z]/.test(snake) ? snake : `event_${snake}`;
|
|
317
|
-
return leading.slice(0, 40) || "event";
|
|
318
|
-
}
|
|
319
|
-
function bindingWords(value) {
|
|
320
|
-
if (typeof value === "string")
|
|
321
|
-
return value;
|
|
322
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
323
|
-
return "";
|
|
324
|
-
const binding = value;
|
|
325
|
-
if (binding.from === "const" && typeof binding.value === "string")
|
|
326
|
-
return binding.value;
|
|
327
|
-
if (typeof binding.path === "string")
|
|
328
|
-
return binding.path;
|
|
329
|
-
return "";
|
|
330
|
-
}
|
|
331
|
-
function originMapFor(program) {
|
|
332
|
-
const entries = [{ path: "$", span: program.origin }];
|
|
333
|
-
program.subjects.forEach((subject, index) => {
|
|
334
|
-
entries.push({ path: `$.subjects[${index}]`, span: subject.origin });
|
|
335
|
-
});
|
|
336
|
-
program.instruments.forEach((instrument, index) => {
|
|
337
|
-
const base = `$.instruments[${index}]`;
|
|
338
|
-
entries.push({ path: base, span: instrument.origin });
|
|
339
|
-
instrument.fields.forEach((field) => {
|
|
340
|
-
entries.push({
|
|
341
|
-
path: `${base}.fields.${field.name}`,
|
|
342
|
-
span: field.origin,
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
instrument.actions.forEach((action) => {
|
|
346
|
-
entries.push({
|
|
347
|
-
path: `${base}.actions.${action.name}`,
|
|
348
|
-
span: action.origin,
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
return entries;
|
|
353
|
-
}
|
|
354
|
-
function titleize(value) {
|
|
355
|
-
return value
|
|
356
|
-
.replaceAll("_", " ")
|
|
357
|
-
.replace(/\b[a-z]/g, (letter) => letter.toUpperCase());
|
|
358
|
-
}
|
|
359
|
-
//# sourceMappingURL=emit.js.map
|
package/dist/src/emit.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/emit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,GAGZ,MAAM,kBAAkB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E;gBACpC,IAAI,EAAE,KAAK,CAAC,MAAM;aACnB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YACpC,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,GAAG,IAAI,YAAY,MAAM,CAAC,IAAI,EAAE;gBACtC,IAAI,EAAE,MAAM,CAAC,MAAM;aACpB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,KAAK;SACT,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;SACpB,OAAO,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Data-driven replacement of existing settlement entries. This is not syntax:
|
|
3
|
-
* callers select a slot that already exists in the parsed program, replace its
|
|
4
|
-
* literal value, then run the ordinary general compiler again.
|
|
5
|
-
*/
|
|
6
|
-
import type { Program } from "./ast.ts";
|
|
7
|
-
export type ProgramEntryOverrideValue = {
|
|
8
|
-
readonly kind: "integer";
|
|
9
|
-
readonly value: number;
|
|
10
|
-
} | {
|
|
11
|
-
readonly kind: "basis_points";
|
|
12
|
-
readonly value: number;
|
|
13
|
-
} | {
|
|
14
|
-
readonly currency: string;
|
|
15
|
-
readonly kind: "money";
|
|
16
|
-
readonly value: number;
|
|
17
|
-
} | {
|
|
18
|
-
readonly kind: "duration";
|
|
19
|
-
readonly value: string;
|
|
20
|
-
};
|
|
21
|
-
export type ProgramEntryOverrideBounds = {
|
|
22
|
-
readonly max: number;
|
|
23
|
-
readonly min: number;
|
|
24
|
-
} | {
|
|
25
|
-
readonly currency: string;
|
|
26
|
-
readonly max: number;
|
|
27
|
-
readonly min: number;
|
|
28
|
-
} | {
|
|
29
|
-
readonly max: string;
|
|
30
|
-
readonly min: string;
|
|
31
|
-
};
|
|
32
|
-
export interface ProgramEntryOverride {
|
|
33
|
-
readonly bounds: ProgramEntryOverrideBounds;
|
|
34
|
-
readonly settlement: string;
|
|
35
|
-
/** Entry keys below the settlement body, for example `["fees", "merchant"]`. */
|
|
36
|
-
readonly path: readonly [string, ...string[]];
|
|
37
|
-
readonly value: ProgramEntryOverrideValue;
|
|
38
|
-
}
|
|
39
|
-
export interface ProgramEntryOverrideIssue {
|
|
40
|
-
readonly code: "invalid_bounds" | "invalid_target" | "invalid_value" | "missing_settlement";
|
|
41
|
-
readonly message: string;
|
|
42
|
-
readonly settlement: string;
|
|
43
|
-
readonly path: readonly string[];
|
|
44
|
-
}
|
|
45
|
-
type OverrideResult = {
|
|
46
|
-
readonly ok: true;
|
|
47
|
-
readonly program: Program;
|
|
48
|
-
} | {
|
|
49
|
-
readonly issues: readonly ProgramEntryOverrideIssue[];
|
|
50
|
-
readonly ok: false;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Applies every override atomically. A missing or non-literal slot returns
|
|
54
|
-
* issues and no program, so callers never lower a partially configured shape.
|
|
55
|
-
*/
|
|
56
|
-
export declare function overrideProgramEntries(program: Program, overrides: readonly ProgramEntryOverride[]): OverrideResult;
|
|
57
|
-
export {};
|
|
58
|
-
//# sourceMappingURL=entry-overrides.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry-overrides.d.ts","sourceRoot":"","sources":["../../src/entry-overrides.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAKV,OAAO,EACR,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,yBAAyB,GACjC;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,QAAQ,CA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