@incodetech/tri-sdk 0.1.0 → 0.1.2-dev-20260528

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 (65) hide show
  1. package/dist/bundle-analysis.html +4950 -0
  2. package/dist/chunks/index-BAwek9Id.cjs +489 -0
  3. package/dist/chunks/index-BAwek9Id.cjs.map +1 -0
  4. package/dist/chunks/index-BBnHO5vA.js +477 -0
  5. package/dist/chunks/index-BBnHO5vA.js.map +1 -0
  6. package/dist/chunks/index-BMVAKptw.cjs +432 -0
  7. package/dist/chunks/index-BMVAKptw.cjs.map +1 -0
  8. package/dist/chunks/index-BYO0AI0T.js +420 -0
  9. package/dist/chunks/index-BYO0AI0T.js.map +1 -0
  10. package/dist/chunks/index-B_sPgtA6.cjs +489 -0
  11. package/dist/chunks/index-B_sPgtA6.cjs.map +1 -0
  12. package/dist/chunks/index-BlclLEsV.js +420 -0
  13. package/dist/chunks/index-BlclLEsV.js.map +1 -0
  14. package/dist/chunks/index-BxmW7qox.cjs +432 -0
  15. package/dist/chunks/index-BxmW7qox.cjs.map +1 -0
  16. package/dist/chunks/index-CECrIW-A.js +420 -0
  17. package/dist/chunks/index-CECrIW-A.js.map +1 -0
  18. package/dist/chunks/index-CKUPedC4.cjs +432 -0
  19. package/dist/chunks/index-CKUPedC4.cjs.map +1 -0
  20. package/dist/chunks/index-DUZ-lBzx.js +477 -0
  21. package/dist/chunks/index-DUZ-lBzx.js.map +1 -0
  22. package/dist/chunks/index-NNGWKwfy.js +420 -0
  23. package/dist/chunks/index-NNGWKwfy.js.map +1 -0
  24. package/dist/chunks/index-SQXEe_Yi.cjs +432 -0
  25. package/dist/chunks/index-SQXEe_Yi.cjs.map +1 -0
  26. package/dist/chunks/index-kx-dpbK_.cjs +432 -0
  27. package/dist/chunks/index-kx-dpbK_.cjs.map +1 -0
  28. package/dist/chunks/index-uSwsY9-F.js +420 -0
  29. package/dist/chunks/index-uSwsY9-F.js.map +1 -0
  30. package/dist/chunks/start-B4n8DLY_.cjs +5554 -0
  31. package/dist/chunks/start-B4n8DLY_.cjs.map +1 -0
  32. package/dist/chunks/start-BnvikGDT.cjs +5059 -0
  33. package/dist/chunks/start-BnvikGDT.cjs.map +1 -0
  34. package/dist/chunks/start-CJOOPw78.cjs +5554 -0
  35. package/dist/chunks/start-CJOOPw78.cjs.map +1 -0
  36. package/dist/chunks/start-CMqC8j2A.cjs +5561 -0
  37. package/dist/chunks/start-CMqC8j2A.cjs.map +1 -0
  38. package/dist/chunks/start-CkLlbFOM.cjs +5554 -0
  39. package/dist/chunks/start-CkLlbFOM.cjs.map +1 -0
  40. package/dist/chunks/start-CrKx_Alk.js +5552 -0
  41. package/dist/chunks/start-CrKx_Alk.js.map +1 -0
  42. package/dist/chunks/start-CwAEBqvW.js +5057 -0
  43. package/dist/chunks/start-CwAEBqvW.js.map +1 -0
  44. package/dist/chunks/start-CymdUpX5.js +5060 -0
  45. package/dist/chunks/start-CymdUpX5.js.map +1 -0
  46. package/dist/chunks/start-DTFRIfeO.js +5552 -0
  47. package/dist/chunks/start-DTFRIfeO.js.map +1 -0
  48. package/dist/chunks/start-Dpgr8IbP.js +5559 -0
  49. package/dist/chunks/start-Dpgr8IbP.js.map +1 -0
  50. package/dist/chunks/start-Dtnxf7k4.cjs +5554 -0
  51. package/dist/chunks/start-Dtnxf7k4.cjs.map +1 -0
  52. package/dist/chunks/start-DwQtOigF.cjs +5062 -0
  53. package/dist/chunks/start-DwQtOigF.cjs.map +1 -0
  54. package/dist/chunks/start-MKWGpbIO.js +5552 -0
  55. package/dist/chunks/start-MKWGpbIO.js.map +1 -0
  56. package/dist/chunks/start-y4ZhvkRa.js +5552 -0
  57. package/dist/chunks/start-y4ZhvkRa.js.map +1 -0
  58. package/dist/index.d.ts +166 -37
  59. package/dist/tri.cjs.js +2 -5467
  60. package/dist/tri.cjs.js.map +1 -1
  61. package/dist/tri.esm.js +1 -5470
  62. package/dist/tri.esm.js.map +1 -1
  63. package/dist/tri.umd.js +2567 -2500
  64. package/dist/tri.umd.js.map +1 -1
  65. package/package.json +5 -7
@@ -0,0 +1,420 @@
1
+ /**
2
+ * @module lib/logger
3
+ *
4
+ * @description
5
+ * Singleton logger for the TRI SDK. This is the **only** sanctioned site for
6
+ * `console.*` calls inside `packages/core`. All other modules must import and
7
+ * use the exported `logger` instance rather than calling `console` directly.
8
+ *
9
+ * ### Debug gating
10
+ * Non-fatal methods (`warn`, `error`, `info`) are no-ops when `DEBUG` is
11
+ * `false`. Set `logger.DEBUG = true` — typically driven by the `debug` field
12
+ * in `TRIConfig` — to activate them. No string concatenation happens in the
13
+ * fast path (early return before any allocation).
14
+ *
15
+ * `fatal` always emits regardless of `DEBUG`; use it only for messages that
16
+ * must surface in production (hard misconfigurations, blocked environments).
17
+ *
18
+ * ### Message format
19
+ * `[prefix] message` — prefix is wrapped in square brackets and prepended to
20
+ * the message with a single space. Extra `args` are forwarded to the underlying
21
+ * `console.*` method unchanged so error objects and context values render with
22
+ * full browser-console expansion.
23
+ */
24
+ const SDK_PREFIX = 'TRI';
25
+ class Logger {
26
+ constructor() {
27
+ this.debugValue = false;
28
+ }
29
+ /** Returns the singleton Logger instance. */
30
+ static get instance() {
31
+ if (!Logger.singleton) {
32
+ Logger.singleton = new Logger();
33
+ }
34
+ return Logger.singleton;
35
+ }
36
+ /** Exposed read-only view of the current debug state. */
37
+ get _DEBUG() {
38
+ return this.debugValue;
39
+ }
40
+ get DEBUG() {
41
+ return this.debugValue;
42
+ }
43
+ set DEBUG(value) {
44
+ this.debugValue = value;
45
+ }
46
+ /** @inheritdoc LoggerInterface.warn */
47
+ warn(prefix, message, ...args) {
48
+ if (!this.debugValue)
49
+ return;
50
+ this._log('warn', prefix, message, ...args);
51
+ }
52
+ /** @inheritdoc LoggerInterface.error */
53
+ error(prefix, message, ...args) {
54
+ if (!this.debugValue)
55
+ return;
56
+ this._log('error', prefix, message, ...args);
57
+ }
58
+ /** @inheritdoc LoggerInterface.info */
59
+ info(prefix, message, ...args) {
60
+ if (!this.debugValue)
61
+ return;
62
+ this._log('info', prefix, message, ...args);
63
+ }
64
+ /** @inheritdoc LoggerInterface.fatal */
65
+ fatal(level, prefix, message, ...args) {
66
+ this._log(level, prefix, message, ...args);
67
+ }
68
+ _log(level, prefix, message, ...args) {
69
+ const modulePrefix = prefix ? `[${prefix}]` : '';
70
+ console[level](`[${SDK_PREFIX}]${modulePrefix} ${message}`, ...args);
71
+ }
72
+ }
73
+ /** Singleton logger instance. Import and use this throughout `packages/core`. */
74
+ const logger = Logger.instance;
75
+
76
+ /**
77
+ * @module sdk/internal/env
78
+ *
79
+ * @description
80
+ * Environment constants and URL resolver for the SDK preflight. This module
81
+ * is part of the **static bundle** — it imports only primitive types and the
82
+ * logger singleton, so it carries no collector-factory cost.
83
+ *
84
+ * Anything that must run before the lazy chunk loads (e.g. `sdk.ts` deciding
85
+ * whether to even fetch the bundle) should import from here rather than from
86
+ * the full `sdk/constants` module.
87
+ *
88
+ * @internal
89
+ */
90
+ /** How long (ms) to wait for a dynamic `import()` before giving up. */
91
+ const DYNAMIC_IMPORT_TIMEOUT_MS = 10000;
92
+ /** Default value for the `debug` flag when the host omits it. */
93
+ const DEFAULT_DEBUG = false;
94
+ /** Default `apiVersion` string when the host omits it. */
95
+ const DEFAULT_API_VERSION = '1.0';
96
+ /**
97
+ * Lookup from a `TriEnv` value to its corresponding base API URL.
98
+ * Entries with an empty string are **not yet provisioned**; hosts attempting
99
+ * to use them will receive a fatal error at SDK start.
100
+ */
101
+ const ENV_TO_BASE_API_URL_LOOKUP = {
102
+ STAGE_K8S: 'https://falcon-ingest-k8s.stage.incodetest.com',
103
+ SAAS: 'http://localhost:8080',
104
+ STAGE: '',
105
+ DEMO: '',
106
+ DEMO_K8S: ''
107
+ };
108
+ /**
109
+ * All known `TriEnv` keys (including those not yet provisioned with a URL).
110
+ * Used to distinguish a typo/unsupported env from a known-but-unprovisioned one.
111
+ */
112
+ const SUPPORTED_ENVS = Object.keys(ENV_TO_BASE_API_URL_LOOKUP);
113
+ /**
114
+ * Base API URLs that are fully provisioned and accepted at SDK start.
115
+ * Derived from `ENV_TO_BASE_API_URL_LOOKUP` by filtering empty strings.
116
+ */
117
+ const SUPPORTED_API_URLS = Object.values(ENV_TO_BASE_API_URL_LOOKUP).filter(Boolean);
118
+ /**
119
+ * Resolves a `TriEnv` value to its base API URL.
120
+ *
121
+ * Returns `undefined` (and logs a fatal) when:
122
+ * - the env is not a known `TriEnv` key, or
123
+ * - the env is known but not yet provisioned (empty URL).
124
+ */
125
+ function resolveBaseApiURLFromEnv(env) {
126
+ if (!SUPPORTED_ENVS.includes(env)) {
127
+ logger.fatal('error', 'SDK', 'Provided environment is not supported:', env, 'Supported environments are:', SUPPORTED_ENVS.join(', '));
128
+ return undefined;
129
+ }
130
+ const url = ENV_TO_BASE_API_URL_LOOKUP[env];
131
+ if (!url) {
132
+ logger.fatal('error', 'SDK', `env "${env}" is not yet provisioned with a base URL.`);
133
+ return undefined;
134
+ }
135
+ return url;
136
+ }
137
+
138
+ /**
139
+ * @module sdk/internal/preflight-config
140
+ *
141
+ * @description
142
+ * Lightweight config validator that runs in the **static bundle** before the
143
+ * lazy chunk is ever fetched. Its only job is to extract the three values
144
+ * needed for the collection-status preflight check (`apiKey`, `baseApiURL`,
145
+ * `debug`) and return them — or log a fatal and return `null` when the host
146
+ * config is unusable.
147
+ *
148
+ * The full `resolveTRIConfig` function (in `sdk/helpers.ts`) performs a
149
+ * superset of this validation and lives in the lazy chunk. This module exists
150
+ * solely to keep the static bundle free of `COLLECTORS_CONFIG` and every
151
+ * transitively-imported collector factory.
152
+ *
153
+ * @internal
154
+ */
155
+ /**
156
+ * Extracts and validates the preflight-critical fields from the host-supplied
157
+ * config. Returns `null` (with a fatal log) when any required field is missing
158
+ * or the resolved URL is not provisioned.
159
+ */
160
+ function resolvePreflightConfig(config) {
161
+ if (!config?.apiKey) {
162
+ logger.fatal('error', 'SDK', 'apiKey is required.');
163
+ return null;
164
+ }
165
+ let baseApiURL;
166
+ if (config.apiURL) {
167
+ if (!SUPPORTED_API_URLS.includes(config.apiURL)) {
168
+ logger.fatal('error', 'SDK', 'Provided apiURL is not supported:', config.apiURL, 'Supported API URLs are:', SUPPORTED_API_URLS.join(', '));
169
+ return null;
170
+ }
171
+ baseApiURL = config.apiURL;
172
+ }
173
+ else if (config.env) {
174
+ baseApiURL = resolveBaseApiURLFromEnv(config.env);
175
+ }
176
+ if (!baseApiURL) {
177
+ logger.fatal('error', 'SDK', "Couldn't initialise SDK — neither apiURL nor env were provided, or the provided value has no provisioned URL.");
178
+ return null;
179
+ }
180
+ return {
181
+ apiKey: config.apiKey,
182
+ baseApiURL,
183
+ debug: config.debug ?? DEFAULT_DEBUG,
184
+ };
185
+ }
186
+
187
+ // Pin timer globals at module evaluation time — same hazard model as `_fetch` in
188
+ // lib/http/http.ts. Host APM SDKs and instrumentation libraries routinely wrap
189
+ // setTimeout; capturing the originals ensures our HTTP timeout and retry timers
190
+ // are immune to those patches.
191
+ const _setTimeout = globalThis.setTimeout.bind(globalThis);
192
+ const _clearTimeout = globalThis.clearTimeout.bind(globalThis);
193
+ function safeSync(fn, finallyFn) {
194
+ try {
195
+ return fn();
196
+ }
197
+ catch (error) {
198
+ logger.warn('utils', 'safeSync swallowed error:', error);
199
+ }
200
+ finally {
201
+ }
202
+ }
203
+ async function safeAsync(fn) {
204
+ try {
205
+ return await fn();
206
+ }
207
+ catch (error) {
208
+ logger.warn('utils', 'safeAsync swallowed error:', error);
209
+ }
210
+ }
211
+ function safeListener(fn) {
212
+ return (event) => safeSync(() => fn(event));
213
+ }
214
+ function safeTimer(fn) {
215
+ return (...args) => {
216
+ try {
217
+ fn(...args);
218
+ }
219
+ catch (error) {
220
+ logger.warn('utils', 'safeTimer swallowed error:', error);
221
+ }
222
+ };
223
+ }
224
+ function safeSetTimeout(fn, delay) {
225
+ return _setTimeout(safeTimer(fn), delay);
226
+ }
227
+ function safeClearTimeout(id) {
228
+ if (id === null)
229
+ return;
230
+ try {
231
+ _clearTimeout(id);
232
+ }
233
+ catch (error) {
234
+ logger.warn('utils', 'safeClearTimeout swallowed error:', error);
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Singleton entry-point for the TRI SDK.
240
+ *
241
+ * Obtain the instance via `TRI.instance`; the constructor is private.
242
+ *
243
+ * ### Life-cycle states
244
+ * The instance moves through three states:
245
+ * - `'idle'` — not started, or fully stopped.
246
+ * - `'starting'` — `start()` has been called; preflight and lazy bundle load in progress.
247
+ * - `'started'` — all managers are running and `reportEvent()` is active.
248
+ *
249
+ * ### Never throws
250
+ * All public methods are fire-and-forget. Errors are logged via `logger` and
251
+ * swallowed so the host application is never disrupted.
252
+ *
253
+ * ### Bundle split
254
+ * Only the preflight config validator and collection-status check live in the
255
+ * static bundle. The full manager wiring (`internal/start.ts`) is dynamically
256
+ * imported only when the backend confirms collection is enabled, keeping the
257
+ * initial page-load cost minimal.
258
+ */
259
+ let TRI$1 = class TRI {
260
+ constructor() {
261
+ /**
262
+ * Monotonically-increasing counter incremented by every `start()` and
263
+ * `stop()` call. Each in-flight `runStart` captures its own generation value
264
+ * and bails out after every `await` if the counter has moved on, preventing
265
+ * orphaned manager instances from being installed after a concurrent stop.
266
+ */
267
+ this.startGeneration = 0;
268
+ this.startState = 'idle';
269
+ // All manager fields are set after the lazy chunk loads successfully.
270
+ this.falconServiceManager = null;
271
+ this.activityManager = null;
272
+ this.transportManager = null;
273
+ this.tabManager = null;
274
+ this.lifecycleManager = null;
275
+ this.collectorManager = null;
276
+ this.eventReportManager = null;
277
+ }
278
+ static get instance() {
279
+ if (!TRI._instance) {
280
+ TRI._instance = new TRI();
281
+ }
282
+ return TRI._instance;
283
+ }
284
+ /**
285
+ * @description Starts the TRI SDK. Fire-and-forget and idempotent — a second
286
+ * call while the SDK is starting or already started is a no-op. Checks the
287
+ * backend `/collection-status` endpoint and only loads the full manager bundle
288
+ * when collection is enabled. Safe to call in SSR environments; if `document`
289
+ * is unavailable the function logs a fatal and returns without throwing.
290
+ */
291
+ start(config) {
292
+ if (this.startState !== 'idle') {
293
+ logger.warn('Start', 'start() called more than once — ignoring.');
294
+ return;
295
+ }
296
+ this.startState = 'starting';
297
+ const generation = ++this.startGeneration;
298
+ void this.runStart(config, generation);
299
+ }
300
+ /**
301
+ * @description Stops all collectors, flushes pending events, and tears down
302
+ * every manager. Safe to call more than once. After `stop()`, `start()` may be
303
+ * called again with a fresh config. Any in-flight `start()` is cancelled at
304
+ * the next async checkpoint.
305
+ */
306
+ stop() {
307
+ ++this.startGeneration;
308
+ this.startState = 'idle';
309
+ this.lifecycleManager?.stop();
310
+ this.lifecycleManager = null;
311
+ this.activityManager?.stop();
312
+ this.activityManager = null;
313
+ this.transportManager?.stop();
314
+ this.transportManager = null;
315
+ this.tabManager?.stop();
316
+ this.tabManager = null;
317
+ this.collectorManager?.stop();
318
+ this.collectorManager = null;
319
+ this.eventReportManager?.stop();
320
+ this.eventReportManager = null;
321
+ this.falconServiceManager = null;
322
+ logger.DEBUG = DEFAULT_DEBUG;
323
+ }
324
+ /**
325
+ * @description Reports a host-defined event to the TRI backend. Fire-and-forget —
326
+ * never throws and never returns a promise the host must handle. Drops the
327
+ * event silently (with a dev warning) if called before `start` completes.
328
+ */
329
+ reportEvent(name, metadata) {
330
+ if (this.shouldEarlyEscapeReport()) {
331
+ return;
332
+ }
333
+ void safeAsync(() => this.eventReportManager.report(name, metadata));
334
+ }
335
+ async runStart(config, generation) {
336
+ if (typeof document === 'undefined') {
337
+ logger.fatal('error', 'Start', 'start() called in a non-browser environment. The SDK will not start.');
338
+ this.startState = 'idle';
339
+ return;
340
+ }
341
+ // resolvePreflightConfig runs entirely in the static bundle — no collector
342
+ // factories are loaded at this point.
343
+ const preflight = resolvePreflightConfig(config);
344
+ if (!preflight) {
345
+ this.startState = 'idle';
346
+ return;
347
+ }
348
+ // Bail if stop() or a concurrent start() invalidated this run.
349
+ if (this.startGeneration !== generation) {
350
+ return;
351
+ }
352
+ // Flip DEBUG only after the SDK is confirmed to start.
353
+ logger.DEBUG = preflight.debug;
354
+ // Dynamically import the lazy chunk with a hard timeout so a slow/dead
355
+ // CDN does not hang the host application indefinitely.
356
+ let startModule;
357
+ try {
358
+ startModule = await Promise.race([
359
+ import('./start-MKWGpbIO.js'),
360
+ new Promise((_, reject) => setTimeout(() => reject(new Error('dynamic import timed out')), DYNAMIC_IMPORT_TIMEOUT_MS))
361
+ ]);
362
+ }
363
+ catch (error) {
364
+ logger.error('Start', 'Failed to load manager bundle:', error);
365
+ if (this.startGeneration === generation) {
366
+ this.startState = 'idle';
367
+ }
368
+ return;
369
+ }
370
+ if (this.startGeneration !== generation) {
371
+ return;
372
+ }
373
+ // The lazy chunk receives the raw config and runs the full resolver internally.
374
+ const managers = await startModule.start(config);
375
+ if (this.startGeneration !== generation) {
376
+ // A concurrent stop() (or new start()) raced us — discard what we built.
377
+ if (managers) {
378
+ managers.lifecycleManager?.stop();
379
+ managers.tabManager?.stop();
380
+ managers.transportManager?.stop();
381
+ void managers.activityManager?.stop();
382
+ }
383
+ return;
384
+ }
385
+ if (!managers) {
386
+ // internal/start.ts already logged the reason.
387
+ this.startState = 'idle';
388
+ return;
389
+ }
390
+ this.falconServiceManager = managers.falconServiceManager;
391
+ this.activityManager = managers.activityManager;
392
+ this.transportManager = managers.transportManager;
393
+ this.tabManager = managers.tabManager;
394
+ this.lifecycleManager = managers.lifecycleManager;
395
+ this.collectorManager = managers.collectorManager;
396
+ this.eventReportManager = managers.eventReportManager;
397
+ this.startState = 'started';
398
+ }
399
+ /**
400
+ * Returns `true` (and logs a dev warning) when `reportEvent()` should be a
401
+ * no-op. Guards against calling before the SDK is fully started, or when
402
+ * the `eventReportManager` is unexpectedly absent.
403
+ */
404
+ shouldEarlyEscapeReport() {
405
+ if (this.startState !== 'started') {
406
+ logger.warn('ReportEvent', 'reportEvent() called before start() completed.');
407
+ return true;
408
+ }
409
+ if (!this.eventReportManager) {
410
+ logger.warn('ReportEvent', 'eventReportManager not available.');
411
+ return true;
412
+ }
413
+ return false;
414
+ }
415
+ };
416
+
417
+ const TRI = TRI$1.instance;
418
+
419
+ export { DEFAULT_API_VERSION as D, SUPPORTED_API_URLS as S, TRI as T, DEFAULT_DEBUG as a, safeClearTimeout as b, safeListener as c, safeSetTimeout as d, safeSync as e, logger as l, resolveBaseApiURLFromEnv as r, safeAsync as s };
420
+ //# sourceMappingURL=index-CECrIW-A.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CECrIW-A.js","sources":["../../src/lib/logger/logger.ts","../../src/sdk/internal/env.ts","../../src/sdk/internal/preflight-config.ts","../../src/utils/fire-and-forget.ts","../../src/sdk/sdk.ts","../../src/index.ts"],"sourcesContent":[null,null,null,null,null,null],"names":["TRIClass"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AAKH,MAAM,UAAU,GAAG,KAAK;MAEX,MAAM,CAAA;AAKjB,IAAA,WAAA,GAAA;QAFQ,IAAA,CAAA,UAAU,GAAY,KAAK;IAEZ;;AAGhB,IAAA,WAAW,QAAQ,GAAA;AACxB,QAAA,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;AACrB,YAAA,MAAM,CAAC,SAAS,GAAG,IAAI,MAAM,EAAE;QACjC;QACA,OAAO,MAAM,CAAC,SAAS;IACzB;;AAGA,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,UAAU;IACxB;AAEA,IAAA,IAAI,KAAK,GAAA;QACP,OAAO,IAAI,CAAC,UAAU;IACxB;IAEA,IAAI,KAAK,CAAC,KAAc,EAAA;AACtB,QAAA,IAAI,CAAC,UAAU,GAAG,KAAK;IACzB;;AAGA,IAAA,IAAI,CAAC,MAAc,EAAE,OAAe,EAAE,GAAG,IAAe,EAAA;QACtD,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE;AACtB,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC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