gitframes 1.2.35

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 (94) hide show
  1. package/LICENCE +202 -0
  2. package/README.md +77 -0
  3. package/dist/audio/index.d.mts +2 -0
  4. package/dist/audio/index.mjs +6 -0
  5. package/dist/audio-C0YslYEG.d.mts +32 -0
  6. package/dist/audio-C0YslYEG.d.mts.map +1 -0
  7. package/dist/audio-C4kiPbrV.mjs +1866 -0
  8. package/dist/audio-C4kiPbrV.mjs.map +1 -0
  9. package/dist/audio-CiXUMGyk.mjs +578 -0
  10. package/dist/audio-CiXUMGyk.mjs.map +1 -0
  11. package/dist/chunk-GMkBE123.mjs +47 -0
  12. package/dist/client-Dyypr8tt.mjs +66 -0
  13. package/dist/client-Dyypr8tt.mjs.map +1 -0
  14. package/dist/dist-C37594c6.mjs +27195 -0
  15. package/dist/dist-C37594c6.mjs.map +1 -0
  16. package/dist/dist-CMF9eNLB.mjs +4062 -0
  17. package/dist/dist-CMF9eNLB.mjs.map +1 -0
  18. package/dist/dist-cjs--KIl7Gqy.mjs +6 -0
  19. package/dist/dist-cjs-B-_4TVjP.mjs +66 -0
  20. package/dist/dist-cjs-B-_4TVjP.mjs.map +1 -0
  21. package/dist/dist-cjs-B3TIyZ3K.mjs +437 -0
  22. package/dist/dist-cjs-B3TIyZ3K.mjs.map +1 -0
  23. package/dist/dist-cjs-Bsz2eGzl.mjs +9069 -0
  24. package/dist/dist-cjs-Bsz2eGzl.mjs.map +1 -0
  25. package/dist/dist-cjs-BuJ2FXob.mjs +181 -0
  26. package/dist/dist-cjs-BuJ2FXob.mjs.map +1 -0
  27. package/dist/dist-cjs-C-FMsqmo.mjs +1091 -0
  28. package/dist/dist-cjs-C-FMsqmo.mjs.map +1 -0
  29. package/dist/dist-cjs-C4b9TCXd.mjs +48 -0
  30. package/dist/dist-cjs-C4b9TCXd.mjs.map +1 -0
  31. package/dist/dist-cjs-C817PNLc.mjs +51 -0
  32. package/dist/dist-cjs-C817PNLc.mjs.map +1 -0
  33. package/dist/dist-cjs-CBnnS4k8.mjs +43 -0
  34. package/dist/dist-cjs-CBnnS4k8.mjs.map +1 -0
  35. package/dist/dist-cjs-CWbeD0Mu.mjs +64 -0
  36. package/dist/dist-cjs-CWbeD0Mu.mjs.map +1 -0
  37. package/dist/dist-cjs-ChXEJ1ro.mjs +85 -0
  38. package/dist/dist-cjs-ChXEJ1ro.mjs.map +1 -0
  39. package/dist/dist-cjs-CslF8Dju.mjs +153 -0
  40. package/dist/dist-cjs-CslF8Dju.mjs.map +1 -0
  41. package/dist/dist-cjs-D52jYyEm.mjs +98 -0
  42. package/dist/dist-cjs-D52jYyEm.mjs.map +1 -0
  43. package/dist/dist-cjs-DhWYgNfa.mjs +209 -0
  44. package/dist/dist-cjs-DhWYgNfa.mjs.map +1 -0
  45. package/dist/dist-cjs-DssYqayv.mjs +5015 -0
  46. package/dist/dist-cjs-DssYqayv.mjs.map +1 -0
  47. package/dist/dist-cjs-Du6DnSjo.mjs +137 -0
  48. package/dist/dist-cjs-Du6DnSjo.mjs.map +1 -0
  49. package/dist/dist-cjs-b-oBQaxe.mjs +323 -0
  50. package/dist/dist-cjs-b-oBQaxe.mjs.map +1 -0
  51. package/dist/effects/index.d.mts +2 -0
  52. package/dist/effects/index.mjs +4 -0
  53. package/dist/effects-4t4qk-BR.mjs +21130 -0
  54. package/dist/effects-4t4qk-BR.mjs.map +1 -0
  55. package/dist/event-streams-B0YUBtyM.mjs +204 -0
  56. package/dist/event-streams-B0YUBtyM.mjs.map +1 -0
  57. package/dist/fonts/index.d.mts +2 -0
  58. package/dist/fonts/index.mjs +3 -0
  59. package/dist/fonts-Dn18r_ST.mjs +188 -0
  60. package/dist/fonts-Dn18r_ST.mjs.map +1 -0
  61. package/dist/index-B1557AUi.d.mts +928 -0
  62. package/dist/index-B1557AUi.d.mts.map +1 -0
  63. package/dist/index-DSaMXGoA.d.mts +65 -0
  64. package/dist/index-DSaMXGoA.d.mts.map +1 -0
  65. package/dist/index-FICUHo4P.d.mts +69 -0
  66. package/dist/index-FICUHo4P.d.mts.map +1 -0
  67. package/dist/index-YZsTjqut.d.mts +147 -0
  68. package/dist/index-YZsTjqut.d.mts.map +1 -0
  69. package/dist/index.d.mts +736 -0
  70. package/dist/index.d.mts.map +1 -0
  71. package/dist/index.mjs +7135 -0
  72. package/dist/index.mjs.map +1 -0
  73. package/dist/package-5RsA21g-.mjs +6 -0
  74. package/dist/package-5RsA21g-.mjs.map +1 -0
  75. package/dist/react/index.d.mts +3 -0
  76. package/dist/react/index.mjs +4 -0
  77. package/dist/renderer/index.d.mts +2 -0
  78. package/dist/renderer/index.mjs +6 -0
  79. package/dist/renderer-DVi31fSv.mjs +23274 -0
  80. package/dist/renderer-DVi31fSv.mjs.map +1 -0
  81. package/dist/renderers-CLJQRPVU-CMZnHNK0.mjs +49 -0
  82. package/dist/renderers-CLJQRPVU-CMZnHNK0.mjs.map +1 -0
  83. package/dist/signals/index.d.mts +9 -0
  84. package/dist/signals/index.mjs +8 -0
  85. package/dist/signals-BB_kdndF.mjs +227 -0
  86. package/dist/signals-BB_kdndF.mjs.map +1 -0
  87. package/dist/signin-CVUAIuED.mjs +865 -0
  88. package/dist/signin-CVUAIuED.mjs.map +1 -0
  89. package/dist/sso-oidc-D1GnNQYW.mjs +1051 -0
  90. package/dist/sso-oidc-D1GnNQYW.mjs.map +1 -0
  91. package/dist/sts-Bz-e3kNW.mjs +6 -0
  92. package/dist/sts-I4KhuCBs.mjs +1395 -0
  93. package/dist/sts-I4KhuCBs.mjs.map +1 -0
  94. package/package.json +174 -0
@@ -0,0 +1,204 @@
1
+ import { n as __esmMin } from "./chunk-GMkBE123.mjs";
2
+ import { t as require_dist_cjs } from "./dist-cjs-C817PNLc.mjs";
3
+
4
+ //#region ../../node_modules/.pnpm/@smithy+core@3.23.12/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js
5
+ var import_dist_cjs, EventStreamSerde;
6
+ var init_EventStreamSerde = __esmMin((() => {
7
+ import_dist_cjs = require_dist_cjs();
8
+ EventStreamSerde = class {
9
+ marshaller;
10
+ serializer;
11
+ deserializer;
12
+ serdeContext;
13
+ defaultContentType;
14
+ constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType }) {
15
+ this.marshaller = marshaller;
16
+ this.serializer = serializer;
17
+ this.deserializer = deserializer;
18
+ this.serdeContext = serdeContext;
19
+ this.defaultContentType = defaultContentType;
20
+ }
21
+ async serializeEventStream({ eventStream, requestSchema, initialRequest }) {
22
+ const marshaller = this.marshaller;
23
+ const eventStreamMember = requestSchema.getEventStreamMember();
24
+ const unionSchema = requestSchema.getMemberSchema(eventStreamMember);
25
+ const serializer = this.serializer;
26
+ const defaultContentType = this.defaultContentType;
27
+ const initialRequestMarker = Symbol("initialRequestMarker");
28
+ const eventStreamIterable = { async *[Symbol.asyncIterator]() {
29
+ if (initialRequest) {
30
+ const headers = {
31
+ ":event-type": {
32
+ type: "string",
33
+ value: "initial-request"
34
+ },
35
+ ":message-type": {
36
+ type: "string",
37
+ value: "event"
38
+ },
39
+ ":content-type": {
40
+ type: "string",
41
+ value: defaultContentType
42
+ }
43
+ };
44
+ serializer.write(requestSchema, initialRequest);
45
+ const body = serializer.flush();
46
+ yield {
47
+ [initialRequestMarker]: true,
48
+ headers,
49
+ body
50
+ };
51
+ }
52
+ for await (const page of eventStream) yield page;
53
+ } };
54
+ return marshaller.serialize(eventStreamIterable, (event) => {
55
+ if (event[initialRequestMarker]) return {
56
+ headers: event.headers,
57
+ body: event.body
58
+ };
59
+ const unionMember = Object.keys(event).find((key) => {
60
+ return key !== "__type";
61
+ }) ?? "";
62
+ const { additionalHeaders, body, eventType, explicitPayloadContentType } = this.writeEventBody(unionMember, unionSchema, event);
63
+ return {
64
+ headers: {
65
+ ":event-type": {
66
+ type: "string",
67
+ value: eventType
68
+ },
69
+ ":message-type": {
70
+ type: "string",
71
+ value: "event"
72
+ },
73
+ ":content-type": {
74
+ type: "string",
75
+ value: explicitPayloadContentType ?? defaultContentType
76
+ },
77
+ ...additionalHeaders
78
+ },
79
+ body
80
+ };
81
+ });
82
+ }
83
+ async deserializeEventStream({ response, responseSchema, initialResponseContainer }) {
84
+ const marshaller = this.marshaller;
85
+ const eventStreamMember = responseSchema.getEventStreamMember();
86
+ const memberSchemas = responseSchema.getMemberSchema(eventStreamMember).getMemberSchemas();
87
+ const initialResponseMarker = Symbol("initialResponseMarker");
88
+ const asyncIterable = marshaller.deserialize(response.body, async (event) => {
89
+ const unionMember = Object.keys(event).find((key) => {
90
+ return key !== "__type";
91
+ }) ?? "";
92
+ const body = event[unionMember].body;
93
+ if (unionMember === "initial-response") {
94
+ const dataObject = await this.deserializer.read(responseSchema, body);
95
+ delete dataObject[eventStreamMember];
96
+ return {
97
+ [initialResponseMarker]: true,
98
+ ...dataObject
99
+ };
100
+ } else if (unionMember in memberSchemas) {
101
+ const eventStreamSchema = memberSchemas[unionMember];
102
+ if (eventStreamSchema.isStructSchema()) {
103
+ const out = {};
104
+ let hasBindings = false;
105
+ for (const [name, member] of eventStreamSchema.structIterator()) {
106
+ const { eventHeader, eventPayload } = member.getMergedTraits();
107
+ hasBindings = hasBindings || Boolean(eventHeader || eventPayload);
108
+ if (eventPayload) {
109
+ if (member.isBlobSchema()) out[name] = body;
110
+ else if (member.isStringSchema()) out[name] = (this.serdeContext?.utf8Encoder ?? import_dist_cjs.toUtf8)(body);
111
+ else if (member.isStructSchema()) out[name] = await this.deserializer.read(member, body);
112
+ } else if (eventHeader) {
113
+ const value = event[unionMember].headers[name]?.value;
114
+ if (value != null) if (member.isNumericSchema()) if (value && typeof value === "object" && "bytes" in value) out[name] = BigInt(value.toString());
115
+ else out[name] = Number(value);
116
+ else out[name] = value;
117
+ }
118
+ }
119
+ if (hasBindings) return { [unionMember]: out };
120
+ if (body.byteLength === 0) return { [unionMember]: {} };
121
+ }
122
+ return { [unionMember]: await this.deserializer.read(eventStreamSchema, body) };
123
+ } else return { $unknown: event };
124
+ });
125
+ const asyncIterator = asyncIterable[Symbol.asyncIterator]();
126
+ const firstEvent = await asyncIterator.next();
127
+ if (firstEvent.done) return asyncIterable;
128
+ if (firstEvent.value?.[initialResponseMarker]) {
129
+ if (!responseSchema) throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");
130
+ for (const [key, value] of Object.entries(firstEvent.value)) initialResponseContainer[key] = value;
131
+ }
132
+ return { async *[Symbol.asyncIterator]() {
133
+ if (!firstEvent?.value?.[initialResponseMarker]) yield firstEvent.value;
134
+ while (true) {
135
+ const { done, value } = await asyncIterator.next();
136
+ if (done) break;
137
+ yield value;
138
+ }
139
+ } };
140
+ }
141
+ writeEventBody(unionMember, unionSchema, event) {
142
+ const serializer = this.serializer;
143
+ let eventType = unionMember;
144
+ let explicitPayloadMember = null;
145
+ let explicitPayloadContentType;
146
+ const isKnownSchema = unionSchema.getSchema()[4].includes(unionMember);
147
+ const additionalHeaders = {};
148
+ if (!isKnownSchema) {
149
+ const [type, value] = event[unionMember];
150
+ eventType = type;
151
+ serializer.write(15, value);
152
+ } else {
153
+ const eventSchema = unionSchema.getMemberSchema(unionMember);
154
+ if (eventSchema.isStructSchema()) {
155
+ for (const [memberName, memberSchema] of eventSchema.structIterator()) {
156
+ const { eventHeader, eventPayload } = memberSchema.getMergedTraits();
157
+ if (eventPayload) explicitPayloadMember = memberName;
158
+ else if (eventHeader) {
159
+ const value = event[unionMember][memberName];
160
+ let type = "binary";
161
+ if (memberSchema.isNumericSchema()) if ((-2) ** 31 <= value && value <= 2 ** 31 - 1) type = "integer";
162
+ else type = "long";
163
+ else if (memberSchema.isTimestampSchema()) type = "timestamp";
164
+ else if (memberSchema.isStringSchema()) type = "string";
165
+ else if (memberSchema.isBooleanSchema()) type = "boolean";
166
+ if (value != null) {
167
+ additionalHeaders[memberName] = {
168
+ type,
169
+ value
170
+ };
171
+ delete event[unionMember][memberName];
172
+ }
173
+ }
174
+ }
175
+ if (explicitPayloadMember !== null) {
176
+ const payloadSchema = eventSchema.getMemberSchema(explicitPayloadMember);
177
+ if (payloadSchema.isBlobSchema()) explicitPayloadContentType = "application/octet-stream";
178
+ else if (payloadSchema.isStringSchema()) explicitPayloadContentType = "text/plain";
179
+ serializer.write(payloadSchema, event[unionMember][explicitPayloadMember]);
180
+ } else serializer.write(eventSchema, event[unionMember]);
181
+ } else if (eventSchema.isUnitSchema()) serializer.write(eventSchema, {});
182
+ else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");
183
+ }
184
+ const messageSerialization = serializer.flush() ?? new Uint8Array();
185
+ return {
186
+ body: typeof messageSerialization === "string" ? (this.serdeContext?.utf8Decoder ?? import_dist_cjs.fromUtf8)(messageSerialization) : messageSerialization,
187
+ eventType,
188
+ explicitPayloadContentType,
189
+ additionalHeaders
190
+ };
191
+ }
192
+ };
193
+ }));
194
+
195
+ //#endregion
196
+ //#region ../../node_modules/.pnpm/@smithy+core@3.23.12/node_modules/@smithy/core/dist-es/submodules/event-streams/index.js
197
+ var init_event_streams = __esmMin((() => {
198
+ init_EventStreamSerde();
199
+ }));
200
+
201
+ //#endregion
202
+ init_event_streams();
203
+ export { EventStreamSerde };
204
+ //# sourceMappingURL=event-streams-B0YUBtyM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-streams-B0YUBtyM.mjs","names":["toUtf8","fromUtf8"],"sources":["../../../node_modules/.pnpm/@smithy+core@3.23.12/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js","../../../node_modules/.pnpm/@smithy+core@3.23.12/node_modules/@smithy/core/dist-es/submodules/event-streams/index.js"],"sourcesContent":["import { fromUtf8, toUtf8 } from \"@smithy/util-utf8\";\nexport class EventStreamSerde {\n marshaller;\n serializer;\n deserializer;\n serdeContext;\n defaultContentType;\n constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType, }) {\n this.marshaller = marshaller;\n this.serializer = serializer;\n this.deserializer = deserializer;\n this.serdeContext = serdeContext;\n this.defaultContentType = defaultContentType;\n }\n async serializeEventStream({ eventStream, requestSchema, initialRequest, }) {\n const marshaller = this.marshaller;\n const eventStreamMember = requestSchema.getEventStreamMember();\n const unionSchema = requestSchema.getMemberSchema(eventStreamMember);\n const serializer = this.serializer;\n const defaultContentType = this.defaultContentType;\n const initialRequestMarker = Symbol(\"initialRequestMarker\");\n const eventStreamIterable = {\n async *[Symbol.asyncIterator]() {\n if (initialRequest) {\n const headers = {\n \":event-type\": { type: \"string\", value: \"initial-request\" },\n \":message-type\": { type: \"string\", value: \"event\" },\n \":content-type\": { type: \"string\", value: defaultContentType },\n };\n serializer.write(requestSchema, initialRequest);\n const body = serializer.flush();\n yield {\n [initialRequestMarker]: true,\n headers,\n body,\n };\n }\n for await (const page of eventStream) {\n yield page;\n }\n },\n };\n return marshaller.serialize(eventStreamIterable, (event) => {\n if (event[initialRequestMarker]) {\n return {\n headers: event.headers,\n body: event.body,\n };\n }\n const unionMember = Object.keys(event).find((key) => {\n return key !== \"__type\";\n }) ?? \"\";\n const { additionalHeaders, body, eventType, explicitPayloadContentType } = this.writeEventBody(unionMember, unionSchema, event);\n const headers = {\n \":event-type\": { type: \"string\", value: eventType },\n \":message-type\": { type: \"string\", value: \"event\" },\n \":content-type\": { type: \"string\", value: explicitPayloadContentType ?? defaultContentType },\n ...additionalHeaders,\n };\n return {\n headers,\n body,\n };\n });\n }\n async deserializeEventStream({ response, responseSchema, initialResponseContainer, }) {\n const marshaller = this.marshaller;\n const eventStreamMember = responseSchema.getEventStreamMember();\n const unionSchema = responseSchema.getMemberSchema(eventStreamMember);\n const memberSchemas = unionSchema.getMemberSchemas();\n const initialResponseMarker = Symbol(\"initialResponseMarker\");\n const asyncIterable = marshaller.deserialize(response.body, async (event) => {\n const unionMember = Object.keys(event).find((key) => {\n return key !== \"__type\";\n }) ?? \"\";\n const body = event[unionMember].body;\n if (unionMember === \"initial-response\") {\n const dataObject = await this.deserializer.read(responseSchema, body);\n delete dataObject[eventStreamMember];\n return {\n [initialResponseMarker]: true,\n ...dataObject,\n };\n }\n else if (unionMember in memberSchemas) {\n const eventStreamSchema = memberSchemas[unionMember];\n if (eventStreamSchema.isStructSchema()) {\n const out = {};\n let hasBindings = false;\n for (const [name, member] of eventStreamSchema.structIterator()) {\n const { eventHeader, eventPayload } = member.getMergedTraits();\n hasBindings = hasBindings || Boolean(eventHeader || eventPayload);\n if (eventPayload) {\n if (member.isBlobSchema()) {\n out[name] = body;\n }\n else if (member.isStringSchema()) {\n out[name] = (this.serdeContext?.utf8Encoder ?? toUtf8)(body);\n }\n else if (member.isStructSchema()) {\n out[name] = await this.deserializer.read(member, body);\n }\n }\n else if (eventHeader) {\n const value = event[unionMember].headers[name]?.value;\n if (value != null) {\n if (member.isNumericSchema()) {\n if (value && typeof value === \"object\" && \"bytes\" in value) {\n out[name] = BigInt(value.toString());\n }\n else {\n out[name] = Number(value);\n }\n }\n else {\n out[name] = value;\n }\n }\n }\n }\n if (hasBindings) {\n return {\n [unionMember]: out,\n };\n }\n if (body.byteLength === 0) {\n return {\n [unionMember]: {},\n };\n }\n }\n return {\n [unionMember]: await this.deserializer.read(eventStreamSchema, body),\n };\n }\n else {\n return {\n $unknown: event,\n };\n }\n });\n const asyncIterator = asyncIterable[Symbol.asyncIterator]();\n const firstEvent = await asyncIterator.next();\n if (firstEvent.done) {\n return asyncIterable;\n }\n if (firstEvent.value?.[initialResponseMarker]) {\n if (!responseSchema) {\n throw new Error(\"@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.\");\n }\n for (const [key, value] of Object.entries(firstEvent.value)) {\n initialResponseContainer[key] = value;\n }\n }\n return {\n async *[Symbol.asyncIterator]() {\n if (!firstEvent?.value?.[initialResponseMarker]) {\n yield firstEvent.value;\n }\n while (true) {\n const { done, value } = await asyncIterator.next();\n if (done) {\n break;\n }\n yield value;\n }\n },\n };\n }\n writeEventBody(unionMember, unionSchema, event) {\n const serializer = this.serializer;\n let eventType = unionMember;\n let explicitPayloadMember = null;\n let explicitPayloadContentType;\n const isKnownSchema = (() => {\n const struct = unionSchema.getSchema();\n return struct[4].includes(unionMember);\n })();\n const additionalHeaders = {};\n if (!isKnownSchema) {\n const [type, value] = event[unionMember];\n eventType = type;\n serializer.write(15, value);\n }\n else {\n const eventSchema = unionSchema.getMemberSchema(unionMember);\n if (eventSchema.isStructSchema()) {\n for (const [memberName, memberSchema] of eventSchema.structIterator()) {\n const { eventHeader, eventPayload } = memberSchema.getMergedTraits();\n if (eventPayload) {\n explicitPayloadMember = memberName;\n }\n else if (eventHeader) {\n const value = event[unionMember][memberName];\n let type = \"binary\";\n if (memberSchema.isNumericSchema()) {\n if ((-2) ** 31 <= value && value <= 2 ** 31 - 1) {\n type = \"integer\";\n }\n else {\n type = \"long\";\n }\n }\n else if (memberSchema.isTimestampSchema()) {\n type = \"timestamp\";\n }\n else if (memberSchema.isStringSchema()) {\n type = \"string\";\n }\n else if (memberSchema.isBooleanSchema()) {\n type = \"boolean\";\n }\n if (value != null) {\n additionalHeaders[memberName] = {\n type,\n value,\n };\n delete event[unionMember][memberName];\n }\n }\n }\n if (explicitPayloadMember !== null) {\n const payloadSchema = eventSchema.getMemberSchema(explicitPayloadMember);\n if (payloadSchema.isBlobSchema()) {\n explicitPayloadContentType = \"application/octet-stream\";\n }\n else if (payloadSchema.isStringSchema()) {\n explicitPayloadContentType = \"text/plain\";\n }\n serializer.write(payloadSchema, event[unionMember][explicitPayloadMember]);\n }\n else {\n serializer.write(eventSchema, event[unionMember]);\n }\n }\n else if (eventSchema.isUnitSchema()) {\n serializer.write(eventSchema, {});\n }\n else {\n throw new Error(\"@smithy/core/event-streams - non-struct member not supported in event stream union.\");\n }\n }\n const messageSerialization = serializer.flush() ?? new Uint8Array();\n const body = typeof messageSerialization === \"string\"\n ? (this.serdeContext?.utf8Decoder ?? fromUtf8)(messageSerialization)\n : messageSerialization;\n return {\n body,\n eventType,\n explicitPayloadContentType,\n additionalHeaders,\n };\n }\n}\n","export * from \"./EventStreamSerde\";\n"],"x_google_ignoreList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aACA,yBAAwB;eAEnB,aAAa;OAClB,MAAM,QAAQ,MAAM,aAAa;OACjC,IAAI,OAAO;AACX,WAAI,aAAa,iBAAiB,CAC9B,KAAK,QAAO,MAAM,SAAS,SAAS,KAAK,KAAK,EAC1C,QAAO;WAGP,QAAO;gBAGN,aAAa,mBAAmB,CACrC,QAAO;gBAEF,aAAa,gBAAgB,CAClC,QAAO;gBAEF,aAAa,iBAAiB,CACnC,QAAO;AAEX,WAAI,SAAS,MAAM;AACf,0BAAkB,cAAc;SAC5B;SACA;SACH;AACD,eAAO,MAAM,aAAa;;;;AAItC,SAAI,0BAA0B,MAAM;MAChC,MAAM,gBAAgB,YAAY,gBAAgB,sBAAsB;AACxE,UAAI,cAAc,cAAc,CAC5B,8BAA6B;eAExB,cAAc,gBAAgB,CACnC,8BAA6B;AAEjC,iBAAW,MAAM,eAAe,MAAM,aAAa,uBAAuB;WAG1E,YAAW,MAAM,aAAa,MAAM,aAAa;eAGhD,YAAY,cAAc,CAC/B,YAAW,MAAM,aAAa,EAAE,CAAC;QAGjC,OAAM,IAAI,MAAM,sFAAsF;;GAG9G,MAAM,uBAAuB,WAAW,OAAO,IAAI,IAAI,YAAY;AAInE,UAAO;IACH,MAJS,OAAO,yBAAyB,YACtC,KAAK,cAAc,eAAeC,0BAAU,qBAAqB,GAClE;IAGF;IACA;IACA;IACH"}
@@ -0,0 +1,2 @@
1
+ import { n as RegisterFontOptions, r as RegisteredFont, t as FontManager } from "../index-DSaMXGoA.mjs";
2
+ export { FontManager, RegisterFontOptions, RegisteredFont };
@@ -0,0 +1,3 @@
1
+ import { t as FontManager } from "../fonts-Dn18r_ST.mjs";
2
+
3
+ export { FontManager };
@@ -0,0 +1,188 @@
1
+ import { S as SlugFontCache, et as registerHeadlessFont } from "./dist-C37594c6.mjs";
2
+ import * as fontkit from "fontkit";
3
+ import path from "node:path";
4
+ import fs from "node:fs/promises";
5
+
6
+ //#region src/fonts/manager.ts
7
+ const SFNT_TRUETYPE_1 = 65536;
8
+ const SFNT_TRUETYPE_TRUE = 1953658213;
9
+ const SFNT_TRUETYPE_TYP1 = 1954115633;
10
+ const SFNT_OPENTYPE_CFF = 1330926671;
11
+ const SFNT_COLLECTION = 1953784678;
12
+ function validateFontBinaryHeader(bytes, sourceLabel) {
13
+ if (bytes.length < 12) throw new Error(`Invalid font binary for "${sourceLabel}": File size (${bytes.length} bytes) is too small to be a valid TrueType or OpenType font.`);
14
+ const tag = (bytes[0] ?? 0) << 24 | (bytes[1] ?? 0) << 16 | (bytes[2] ?? 0) << 8 | (bytes[3] ?? 0);
15
+ if (tag === SFNT_TRUETYPE_1 || tag === SFNT_TRUETYPE_TRUE || tag === SFNT_TRUETYPE_TYP1 || tag === SFNT_COLLECTION) return "truetype";
16
+ if (tag === SFNT_OPENTYPE_CFF) return "opentype";
17
+ const hexTag = (tag >>> 0).toString(16).padStart(8, "0");
18
+ throw new Error(`Invalid font format for "${sourceLabel}": Expected a valid TrueType (.ttf) or OpenType (.otf) font binary. Found header tag: 0x${hexTag}.`);
19
+ }
20
+ async function resolveSourceBuffer(source) {
21
+ if (source instanceof Uint8Array) return { buffer: source };
22
+ if (typeof source !== "string") throw new TypeError(`Font source must be a file path string or Uint8Array, received: ${typeof source}`);
23
+ let cleanPath = source;
24
+ if (cleanPath.startsWith("http://") || cleanPath.startsWith("https://")) {
25
+ const res = await fetch(cleanPath);
26
+ if (!res.ok) throw new Error(`Failed to download font from "${cleanPath}": HTTP ${res.status} ${res.statusText}`);
27
+ const arrayBuffer = await res.arrayBuffer();
28
+ return {
29
+ buffer: new Uint8Array(arrayBuffer),
30
+ filePath: cleanPath
31
+ };
32
+ }
33
+ if (cleanPath.startsWith("file://")) try {
34
+ cleanPath = new URL(cleanPath).pathname;
35
+ } catch {
36
+ cleanPath = cleanPath.replace(/^file:\/\//, "");
37
+ }
38
+ const candidates = [
39
+ cleanPath,
40
+ path.resolve(process.cwd(), cleanPath),
41
+ path.resolve(process.cwd(), "assets/fonts", cleanPath),
42
+ path.resolve(process.cwd(), "assets/fonts", path.basename(cleanPath))
43
+ ];
44
+ let currentDir = process.cwd();
45
+ for (let i = 0; i < 5; i++) {
46
+ candidates.push(path.resolve(currentDir, cleanPath));
47
+ candidates.push(path.resolve(currentDir, "assets/fonts", path.basename(cleanPath)));
48
+ const parent = path.dirname(currentDir);
49
+ if (parent === currentDir) break;
50
+ currentDir = parent;
51
+ }
52
+ let resolvedPath = null;
53
+ let fileBuffer = null;
54
+ for (const candidate of candidates) try {
55
+ if ((await fs.stat(candidate)).isFile()) {
56
+ resolvedPath = candidate;
57
+ fileBuffer = await fs.readFile(candidate);
58
+ break;
59
+ }
60
+ } catch {}
61
+ if (!resolvedPath || !fileBuffer) throw new Error(`Font file not found: "${source}". Checked candidate locations:\n - ${candidates.join("\n - ")}`);
62
+ return {
63
+ buffer: new Uint8Array(fileBuffer.buffer, fileBuffer.byteOffset, fileBuffer.byteLength),
64
+ filePath: resolvedPath
65
+ };
66
+ }
67
+ /**
68
+ * Central singleton manager for font registration, TTF validation, and compositor typography binding.
69
+ */
70
+ var FontManager = class FontManager {
71
+ static instance = null;
72
+ fonts = /* @__PURE__ */ new Map();
73
+ constructor() {}
74
+ /**
75
+ * Returns the singleton FontManager instance.
76
+ */
77
+ static getInstance() {
78
+ if (!FontManager.instance) FontManager.instance = new FontManager();
79
+ return FontManager.instance;
80
+ }
81
+ /**
82
+ * Registers a TrueType/OpenType font into the Gitframes engine with validation.
83
+ */
84
+ static async register(optionsOrFamilyOrSource, source) {
85
+ return FontManager.getInstance().register(optionsOrFamilyOrSource, source);
86
+ }
87
+ /**
88
+ * Retrieves registered font metadata by family name.
89
+ */
90
+ static get(family) {
91
+ return FontManager.getInstance().get(family);
92
+ }
93
+ /**
94
+ * Checks if a font family has been registered.
95
+ */
96
+ static has(family) {
97
+ return FontManager.getInstance().has(family);
98
+ }
99
+ /**
100
+ * Returns all currently registered fonts.
101
+ */
102
+ static getAll() {
103
+ return FontManager.getInstance().getAll();
104
+ }
105
+ /**
106
+ * Returns relative or absolute file paths of all registered fonts for composition spec serialization.
107
+ */
108
+ static getRegisteredFontPaths() {
109
+ return FontManager.getInstance().getRegisteredFontPaths();
110
+ }
111
+ /**
112
+ * Clears all registered fonts from the manager.
113
+ */
114
+ static clear() {
115
+ FontManager.getInstance().clear();
116
+ }
117
+ /**
118
+ * Instance registration method with format validation and Slug WebGPU cache population.
119
+ */
120
+ async register(optionsOrFamilyOrSource, source) {
121
+ let family;
122
+ let rawSource;
123
+ let weight;
124
+ let style;
125
+ if (typeof optionsOrFamilyOrSource === "object" && optionsOrFamilyOrSource !== null) {
126
+ family = optionsOrFamilyOrSource.family;
127
+ rawSource = optionsOrFamilyOrSource.source;
128
+ weight = optionsOrFamilyOrSource.weight;
129
+ style = optionsOrFamilyOrSource.style;
130
+ } else if (typeof optionsOrFamilyOrSource === "string" && source !== void 0) {
131
+ family = optionsOrFamilyOrSource;
132
+ rawSource = source;
133
+ } else if (typeof optionsOrFamilyOrSource === "string") {
134
+ family = void 0;
135
+ rawSource = optionsOrFamilyOrSource;
136
+ } else throw new TypeError("Invalid arguments passed to FontManager.register");
137
+ const { buffer, filePath } = await resolveSourceBuffer(rawSource);
138
+ const sourceLabel = filePath ?? (typeof rawSource === "string" ? rawSource : "Uint8Array");
139
+ const format = validateFontBinaryHeader(buffer, sourceLabel);
140
+ let parsedFontkit;
141
+ try {
142
+ const parsed = fontkit.create(buffer);
143
+ if (parsed && "fonts" in parsed && Array.isArray(parsed.fonts) && parsed.fonts.length > 0) parsedFontkit = parsed.fonts[0];
144
+ else parsedFontkit = parsed;
145
+ } catch (err) {
146
+ const msg = err instanceof Error ? err.message : String(err);
147
+ throw new Error(`Failed to parse TrueType/OpenType font binary for "${sourceLabel}": ${msg}`);
148
+ }
149
+ const detectedFamily = parsedFontkit.familyName || parsedFontkit.postscriptName || path.parse(sourceLabel).name;
150
+ const resolvedFamily = family?.trim() || detectedFamily;
151
+ const registered = {
152
+ family: resolvedFamily,
153
+ source: rawSource,
154
+ filePath,
155
+ format,
156
+ postscriptName: parsedFontkit.postscriptName,
157
+ unitsPerEm: parsedFontkit.unitsPerEm,
158
+ weight,
159
+ style
160
+ };
161
+ this.fonts.set(resolvedFamily, registered);
162
+ if (filePath) await registerHeadlessFont(resolvedFamily, filePath);
163
+ SlugFontCache.parsedFontCache.set(resolvedFamily, parsedFontkit);
164
+ return registered;
165
+ }
166
+ get(family) {
167
+ return this.fonts.get(family);
168
+ }
169
+ has(family) {
170
+ return this.fonts.has(family);
171
+ }
172
+ getAll() {
173
+ return Array.from(this.fonts.values());
174
+ }
175
+ getRegisteredFontPaths() {
176
+ const paths = [];
177
+ for (const font of this.fonts.values()) if (font.filePath) paths.push(font.filePath);
178
+ else if (typeof font.source === "string") paths.push(font.source);
179
+ return paths;
180
+ }
181
+ clear() {
182
+ this.fonts.clear();
183
+ }
184
+ };
185
+
186
+ //#endregion
187
+ export { FontManager as t };
188
+ //# sourceMappingURL=fonts-Dn18r_ST.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fonts-Dn18r_ST.mjs","names":[],"sources":["../src/fonts/manager.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n\tregisterHeadlessFont,\n\tSlugFontCache,\n} from \"@gitframes/webgpu-renderers\";\nimport * as fontkit from \"fontkit\";\n\nexport interface RegisterFontOptions {\n\tfamily?: string;\n\tsource: string | Uint8Array;\n\tweight?: number | string;\n\tstyle?: \"normal\" | \"italic\" | \"oblique\";\n}\n\nexport interface RegisteredFont {\n\tfamily: string;\n\tsource: string | Uint8Array;\n\tfilePath?: string;\n\tformat: \"truetype\" | \"opentype\";\n\tpostscriptName?: string;\n\tunitsPerEm?: number;\n\tweight?: number | string;\n\tstyle?: string;\n}\n\ninterface ResolvedSource {\n\tbuffer: Uint8Array;\n\tfilePath?: string;\n}\n\nconst SFNT_TRUETYPE_1 = 0x00010000;\nconst SFNT_TRUETYPE_TRUE = 0x74727565; // 'true'\nconst SFNT_TRUETYPE_TYP1 = 0x74797031; // 'typ1'\nconst SFNT_OPENTYPE_CFF = 0x4f54544f; // 'OTTO'\nconst SFNT_COLLECTION = 0x74746366; // 'ttcf'\n\nfunction validateFontBinaryHeader(\n\tbytes: Uint8Array,\n\tsourceLabel: string,\n): \"truetype\" | \"opentype\" {\n\tif (bytes.length < 12) {\n\t\tthrow new Error(\n\t\t\t`Invalid font binary for \"${sourceLabel}\": File size (${bytes.length} bytes) is too small to be a valid TrueType or OpenType font.`,\n\t\t);\n\t}\n\n\tconst tag =\n\t\t((bytes[0] ?? 0) << 24) |\n\t\t((bytes[1] ?? 0) << 16) |\n\t\t((bytes[2] ?? 0) << 8) |\n\t\t(bytes[3] ?? 0);\n\n\tif (\n\t\ttag === SFNT_TRUETYPE_1 ||\n\t\ttag === SFNT_TRUETYPE_TRUE ||\n\t\ttag === SFNT_TRUETYPE_TYP1 ||\n\t\ttag === SFNT_COLLECTION\n\t) {\n\t\treturn \"truetype\";\n\t}\n\n\tif (tag === SFNT_OPENTYPE_CFF) {\n\t\treturn \"opentype\";\n\t}\n\n\tconst hexTag = (tag >>> 0).toString(16).padStart(8, \"0\");\n\tthrow new Error(\n\t\t`Invalid font format for \"${sourceLabel}\": Expected a valid TrueType (.ttf) or OpenType (.otf) font binary. Found header tag: 0x${hexTag}.`,\n\t);\n}\n\nasync function resolveSourceBuffer(\n\tsource: string | Uint8Array,\n): Promise<ResolvedSource> {\n\tif (source instanceof Uint8Array) {\n\t\treturn { buffer: source };\n\t}\n\n\tif (typeof source !== \"string\") {\n\t\tthrow new TypeError(\n\t\t\t`Font source must be a file path string or Uint8Array, received: ${typeof source}`,\n\t\t);\n\t}\n\n\tlet cleanPath = source;\n\tif (cleanPath.startsWith(\"http://\") || cleanPath.startsWith(\"https://\")) {\n\t\tconst res = await fetch(cleanPath);\n\t\tif (!res.ok) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to download font from \"${cleanPath}\": HTTP ${res.status} ${res.statusText}`,\n\t\t\t);\n\t\t}\n\t\tconst arrayBuffer = await res.arrayBuffer();\n\t\treturn {\n\t\t\tbuffer: new Uint8Array(arrayBuffer),\n\t\t\tfilePath: cleanPath,\n\t\t};\n\t}\n\n\tif (cleanPath.startsWith(\"file://\")) {\n\t\ttry {\n\t\t\tcleanPath = new URL(cleanPath).pathname;\n\t\t} catch {\n\t\t\tcleanPath = cleanPath.replace(/^file:\\/\\//, \"\");\n\t\t}\n\t}\n\n\tconst candidates: string[] = [\n\t\tcleanPath,\n\t\tpath.resolve(process.cwd(), cleanPath),\n\t\tpath.resolve(process.cwd(), \"assets/fonts\", cleanPath),\n\t\tpath.resolve(process.cwd(), \"assets/fonts\", path.basename(cleanPath)),\n\t];\n\n\t// Upward traversal to locate fonts in parent monorepo roots\n\tlet currentDir = process.cwd();\n\tfor (let i = 0; i < 5; i++) {\n\t\tcandidates.push(path.resolve(currentDir, cleanPath));\n\t\tcandidates.push(\n\t\t\tpath.resolve(currentDir, \"assets/fonts\", path.basename(cleanPath)),\n\t\t);\n\t\tconst parent = path.dirname(currentDir);\n\t\tif (parent === currentDir) break;\n\t\tcurrentDir = parent;\n\t}\n\n\tlet resolvedPath: string | null = null;\n\tlet fileBuffer: Buffer | null = null;\n\n\tfor (const candidate of candidates) {\n\t\ttry {\n\t\t\tconst stat = await fs.stat(candidate);\n\t\t\tif (stat.isFile()) {\n\t\t\t\tresolvedPath = candidate;\n\t\t\t\tfileBuffer = await fs.readFile(candidate);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Continue searching next candidate\n\t\t}\n\t}\n\n\tif (!resolvedPath || !fileBuffer) {\n\t\tthrow new Error(\n\t\t\t`Font file not found: \"${source}\". Checked candidate locations:\\n - ${candidates.join(\"\\n - \")}`,\n\t\t);\n\t}\n\n\treturn {\n\t\tbuffer: new Uint8Array(\n\t\t\tfileBuffer.buffer,\n\t\t\tfileBuffer.byteOffset,\n\t\t\tfileBuffer.byteLength,\n\t\t),\n\t\tfilePath: resolvedPath,\n\t};\n}\n\n/**\n * Central singleton manager for font registration, TTF validation, and compositor typography binding.\n */\nexport class FontManager {\n\tprivate static instance: FontManager | null = null;\n\tprivate readonly fonts = new Map<string, RegisteredFont>();\n\n\tprivate constructor() {}\n\n\t/**\n\t * Returns the singleton FontManager instance.\n\t */\n\tpublic static getInstance(): FontManager {\n\t\tif (!FontManager.instance) {\n\t\t\tFontManager.instance = new FontManager();\n\t\t}\n\t\treturn FontManager.instance;\n\t}\n\n\t/**\n\t * Registers a TrueType/OpenType font into the Gitframes engine with validation.\n\t */\n\tpublic static async register(\n\t\toptionsOrFamilyOrSource: RegisterFontOptions | string,\n\t\tsource?: string | Uint8Array,\n\t): Promise<RegisteredFont> {\n\t\treturn FontManager.getInstance().register(optionsOrFamilyOrSource, source);\n\t}\n\n\t/**\n\t * Retrieves registered font metadata by family name.\n\t */\n\tpublic static get(family: string): RegisteredFont | undefined {\n\t\treturn FontManager.getInstance().get(family);\n\t}\n\n\t/**\n\t * Checks if a font family has been registered.\n\t */\n\tpublic static has(family: string): boolean {\n\t\treturn FontManager.getInstance().has(family);\n\t}\n\n\t/**\n\t * Returns all currently registered fonts.\n\t */\n\tpublic static getAll(): RegisteredFont[] {\n\t\treturn FontManager.getInstance().getAll();\n\t}\n\n\t/**\n\t * Returns relative or absolute file paths of all registered fonts for composition spec serialization.\n\t */\n\tpublic static getRegisteredFontPaths(): string[] {\n\t\treturn FontManager.getInstance().getRegisteredFontPaths();\n\t}\n\n\t/**\n\t * Clears all registered fonts from the manager.\n\t */\n\tpublic static clear(): void {\n\t\tFontManager.getInstance().clear();\n\t}\n\n\t/**\n\t * Instance registration method with format validation and Slug WebGPU cache population.\n\t */\n\tpublic async register(\n\t\toptionsOrFamilyOrSource: RegisterFontOptions | string,\n\t\tsource?: string | Uint8Array,\n\t): Promise<RegisteredFont> {\n\t\tlet family: string | undefined;\n\t\tlet rawSource: string | Uint8Array;\n\t\tlet weight: number | string | undefined;\n\t\tlet style: \"normal\" | \"italic\" | \"oblique\" | undefined;\n\n\t\tif (\n\t\t\ttypeof optionsOrFamilyOrSource === \"object\" &&\n\t\t\toptionsOrFamilyOrSource !== null\n\t\t) {\n\t\t\tfamily = optionsOrFamilyOrSource.family;\n\t\t\trawSource = optionsOrFamilyOrSource.source;\n\t\t\tweight = optionsOrFamilyOrSource.weight;\n\t\t\tstyle = optionsOrFamilyOrSource.style;\n\t\t} else if (\n\t\t\ttypeof optionsOrFamilyOrSource === \"string\" &&\n\t\t\tsource !== undefined\n\t\t) {\n\t\t\tfamily = optionsOrFamilyOrSource;\n\t\t\trawSource = source;\n\t\t} else if (typeof optionsOrFamilyOrSource === \"string\") {\n\t\t\tfamily = undefined;\n\t\t\trawSource = optionsOrFamilyOrSource;\n\t\t} else {\n\t\t\tthrow new TypeError(\"Invalid arguments passed to FontManager.register\");\n\t\t}\n\n\t\tconst { buffer, filePath } = await resolveSourceBuffer(rawSource);\n\t\tconst sourceLabel =\n\t\t\tfilePath ?? (typeof rawSource === \"string\" ? rawSource : \"Uint8Array\");\n\t\tconst format = validateFontBinaryHeader(buffer, sourceLabel);\n\n\t\tlet parsedFontkit: fontkit.Font;\n\t\ttry {\n\t\t\tconst parsed = fontkit.create(buffer as unknown as Buffer);\n\t\t\tif (\n\t\t\t\tparsed &&\n\t\t\t\t\"fonts\" in parsed &&\n\t\t\t\tArray.isArray(parsed.fonts) &&\n\t\t\t\tparsed.fonts.length > 0\n\t\t\t) {\n\t\t\t\tparsedFontkit = parsed.fonts[0] as fontkit.Font;\n\t\t\t} else {\n\t\t\t\tparsedFontkit = parsed as fontkit.Font;\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst msg = err instanceof Error ? err.message : String(err);\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to parse TrueType/OpenType font binary for \"${sourceLabel}\": ${msg}`,\n\t\t\t);\n\t\t}\n\n\t\tconst detectedFamily =\n\t\t\tparsedFontkit.familyName ||\n\t\t\tparsedFontkit.postscriptName ||\n\t\t\tpath.parse(sourceLabel).name;\n\t\tconst resolvedFamily = family?.trim() || detectedFamily;\n\n\t\tconst registered: RegisteredFont = {\n\t\t\tfamily: resolvedFamily,\n\t\t\tsource: rawSource,\n\t\t\tfilePath,\n\t\t\tformat,\n\t\t\tpostscriptName: parsedFontkit.postscriptName,\n\t\t\tunitsPerEm: parsedFontkit.unitsPerEm,\n\t\t\tweight,\n\t\t\tstyle,\n\t\t};\n\n\t\tthis.fonts.set(resolvedFamily, registered);\n\n\t\t// Populate headless font registries\n\t\tif (filePath) {\n\t\t\tawait registerHeadlessFont(resolvedFamily, filePath);\n\t\t}\n\t\tSlugFontCache.parsedFontCache.set(resolvedFamily, parsedFontkit);\n\n\t\treturn registered;\n\t}\n\n\tpublic get(family: string): RegisteredFont | undefined {\n\t\treturn this.fonts.get(family);\n\t}\n\n\tpublic has(family: string): boolean {\n\t\treturn this.fonts.has(family);\n\t}\n\n\tpublic getAll(): RegisteredFont[] {\n\t\treturn Array.from(this.fonts.values());\n\t}\n\n\tpublic getRegisteredFontPaths(): string[] {\n\t\tconst paths: string[] = [];\n\t\tfor (const font of this.fonts.values()) {\n\t\t\tif (font.filePath) {\n\t\t\t\tpaths.push(font.filePath);\n\t\t\t} else if (typeof font.source === \"string\") {\n\t\t\t\tpaths.push(font.source);\n\t\t\t}\n\t\t}\n\t\treturn paths;\n\t}\n\n\tpublic clear(): void {\n\t\tthis.fonts.clear();\n\t}\n}\n"],"mappings":";;;;;;AA+BA,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB;AAC1B,MAAM,kBAAkB;AAExB,SAAS,yBACR,OACA,aAC0B;AAC1B,KAAI,MAAM,SAAS,GAClB,OAAM,IAAI,MACT,4BAA4B,YAAY,gBAAgB,MAAM,OAAO,+DACrE;CAGF,MAAM,OACH,MAAM,MAAM,MAAM,MAClB,MAAM,MAAM,MAAM,MAClB,MAAM,MAAM,MAAM,KACnB,MAA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