@app-swiss-knife/react-native-sdk 0.2.4 → 0.2.7

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 (27) hide show
  1. package/android/src/main/java/com/swissknife/purchases/SwissKnifePurchasesModule.kt +18 -1
  2. package/android/vendor/java/com/appswissknife/context/DeviceContext.kt +1 -1
  3. package/android/vendor/java/com/appswissknife/crashreporting/SKCrashReporting.kt +150 -8
  4. package/android/vendor/java/com/appswissknife/net/IngestClient.kt +1 -1
  5. package/android/vendor/java/com/appswissknife/purchases/BillingClientGateway.kt +53 -9
  6. package/ios/SwissKnifePurchases.swift +16 -1
  7. package/ios/vendor/SwissKnifeiOS/Context/DeviceContext.swift +1 -1
  8. package/ios/vendor/SwissKnifeiOS/CrashReporting/SKCrashReporting.swift +171 -4
  9. package/lib/commonjs/modules/crash-reporting.js +260 -5
  10. package/lib/commonjs/modules/crash-reporting.js.map +1 -1
  11. package/lib/commonjs/purchases.js +195 -32
  12. package/lib/commonjs/purchases.js.map +1 -1
  13. package/lib/module/modules/crash-reporting.js +260 -5
  14. package/lib/module/modules/crash-reporting.js.map +1 -1
  15. package/lib/module/purchases.js +196 -33
  16. package/lib/module/purchases.js.map +1 -1
  17. package/lib/typescript/commonjs/modules/crash-reporting.d.ts +39 -0
  18. package/lib/typescript/commonjs/modules/crash-reporting.d.ts.map +1 -1
  19. package/lib/typescript/commonjs/purchases.d.ts +65 -13
  20. package/lib/typescript/commonjs/purchases.d.ts.map +1 -1
  21. package/lib/typescript/module/modules/crash-reporting.d.ts +39 -0
  22. package/lib/typescript/module/modules/crash-reporting.d.ts.map +1 -1
  23. package/lib/typescript/module/purchases.d.ts +65 -13
  24. package/lib/typescript/module/purchases.d.ts.map +1 -1
  25. package/package.json +2 -1
  26. package/src/modules/crash-reporting.ts +274 -4
  27. package/src/purchases.ts +196 -33
@@ -7,6 +7,7 @@ exports.Purchases = void 0;
7
7
  exports.__throwIfCoreNotConfigured = throwIfCoreNotConfigured;
8
8
  exports.__throwIfNotConfigured = throwIfNotConfigured;
9
9
  exports.default = void 0;
10
+ var _identity = require("./identity.js");
10
11
  var _module = require("./native/module.js");
11
12
  var _spec = require("./native/spec.js");
12
13
  var _types = require("./types.js");
@@ -45,9 +46,14 @@ function nativeBoolean(read) {
45
46
  const customerInfoSubscriptions = new Map();
46
47
 
47
48
  /**
48
- * Guard for surfaces that genuinely need the PURCHASE engine — the store APIs
49
- * and the RC-parity identity aliases that route through the store gateway on
50
- * Android. Checks the JS "configure was called" flag.
49
+ * Guard for surfaces that genuinely need the PURCHASE engine — `getOfferings`,
50
+ * `purchasePackage`, `restorePurchases` and friends. Checks the JS "configure
51
+ * was called" flag.
52
+ *
53
+ * The RC-parity identity aliases used to sit here too, on the grounds that the
54
+ * legacy native bridge methods they called meant different things on iOS and
55
+ * Android. They now delegate to `Identity` and sit on
56
+ * {@link throwIfCoreNotConfigured} — see the block above `logIn`.
51
57
  */
52
58
  function throwIfNotConfigured() {
53
59
  if (!configured) {
@@ -86,6 +92,66 @@ async function throwIfCoreNotConfigured() {
86
92
  throw new _types.UninitializedPurchasesError("Purchases core is not configured. Call Purchases.configure(), " + "Purchases.configureCore(), or Analytics.init() first.");
87
93
  }
88
94
 
95
+ /**
96
+ * The `CustomerInfo` RC's `logOut()` resolves with, for a device that just
97
+ * became anonymous.
98
+ *
99
+ * The store engine is the preferred source, so an app that owns the store
100
+ * keeps getting real post-logout state. Whether it can answer is decided by
101
+ * `isConfigured()` — native truth on both platforms — rather than by trying
102
+ * the read and interpreting the failure, because an *unconfigured* store does
103
+ * not fail the same way on the two platforms: iOS rejects `getCustomerInfo`
104
+ * with `notConfigured`, Android's unconfigured gateway resolves an empty
105
+ * record of its own construction. Discovering the state from the error would
106
+ * hand back two different objects for one situation, in the very module that
107
+ * exists to stop that happening.
108
+ *
109
+ * With no store engine — or with one that cannot answer right now (cold cache
110
+ * plus offline) — the caller gets the entitlement-free record below, built in
111
+ * JS so it is identical on both platforms. Logging out is not a store
112
+ * operation and must not fail because the store is unreachable.
113
+ */
114
+ async function customerInfoAfterLogOut() {
115
+ if (await nativeBoolean(native => native.isConfigured())) {
116
+ try {
117
+ return await (0, _module.getNativeModule)().getCustomerInfo();
118
+ } catch {
119
+ // Fall through to the empty record.
120
+ }
121
+ }
122
+ const snapshot = await _identity.Identity.current();
123
+ return emptyCustomerInfo(snapshot.userId ?? snapshot.anonymousId);
124
+ }
125
+
126
+ /** An entitlement-free `CustomerInfo` for `subjectId`. Mirrors the native
127
+ * `CustomerInfo.empty(originalAppUserId:)` constructors. */
128
+ function emptyCustomerInfo(subjectId) {
129
+ const now = new Date();
130
+ return {
131
+ entitlements: {
132
+ all: {},
133
+ active: {},
134
+ verification: _types.VERIFICATION_RESULT.NOT_REQUESTED
135
+ },
136
+ activeSubscriptions: [],
137
+ allPurchasedProductIdentifiers: [],
138
+ allPurchaseDates: {},
139
+ subscriptionsByProductIdentifier: {},
140
+ nonSubscriptionTransactions: [],
141
+ firstSeen: now.toISOString(),
142
+ firstSeenMillis: now.getTime(),
143
+ originalAppUserId: subjectId,
144
+ requestDate: now.toISOString(),
145
+ requestDateMillis: now.getTime(),
146
+ latestExpirationDate: null,
147
+ latestExpirationDateMillis: null,
148
+ originalPurchaseDate: null,
149
+ originalPurchaseDateMillis: null,
150
+ originalApplicationVersion: null,
151
+ managementURL: null
152
+ };
153
+ }
154
+
89
155
  /**
90
156
  * RC-compatible subscriptions SDK entry point. Process-wide singleton; call
91
157
  * `Purchases.configure(...)` once at app start, then use the static methods.
@@ -224,51 +290,140 @@ class Purchases {
224
290
  return (0, _module.getNativeModule)().restorePurchases();
225
291
  }
226
292
 
227
- // The four RC-parity identity aliases below stay on the PURCHASE guard on
228
- // purpose, even though identity is a core concern natively. The two platforms
229
- // disagree about what this specific surface does: the iOS bridge's `logIn`
230
- // reaches `SwissKnife.logIn` → `Identity.logIn`, which is core-gated and POSTs
231
- // `/api/sdk/users/identify`; the Android bridge's `logIn` reaches
232
- // `SwissKnife.logIn` → the purchases `gateway`, which only rebinds the local
233
- // user id and refreshes entitlements. Loosening the guard here would let a
234
- // core-only app call a method that means different things per platform and
235
- // silently skips the identify POST on Android. `Identity.logIn` / `logOut` /
236
- // `current` are the core-safe surface — they route to the unified native
237
- // Identity on both platforms and carry no configure guard in JS at all.
293
+ // MARK: - RC-parity identity aliases
294
+ //
295
+ // ## The guarantee
296
+ //
297
+ // Each of the four aliases below is *exactly* its {@link Identity}
298
+ // counterpart with the RevenueCat name and the RevenueCat return type, on
299
+ // BOTH platforms. There is no per-platform behaviour left in them: they are
300
+ // one-line delegations to `Identity`, which reaches the `identityLogIn` /
301
+ // `identityLogOut` / `identityCurrent` native bridge methods — and those go
302
+ // to the unified native `Identity` (`SwissKnife.Identity` on iOS,
303
+ // `com.appswissknife.identity.Identity` on Android) on both. Concretely, a
304
+ // `Purchases.logIn(...)` POSTs `/api/sdk/users/identify` on iOS AND on
305
+ // Android. Pinned by `identity-parity.test.ts`.
306
+ //
307
+ // ## Why they are written as delegations rather than bridge calls
308
+ //
309
+ // They used to call the legacy `logIn` / `logOut` / `getAppUserID` /
310
+ // `isAnonymous` bridge methods, which bottom out in the *deprecated native
311
+ // facades* — and those facades do NOT agree across platforms:
312
+ //
313
+ // - `logOut`: iOS `SwissKnife.logOut` routes to `Identity.logOut`;
314
+ // Android's routes straight to the purchases `gateway` and only
315
+ // back-syncs Identity's snapshot afterwards.
316
+ // - `getAppUserID`: iOS returns the Identity-synced subject (a stable
317
+ // `$SKAnonymousID:`+DeviceID value when anonymous); Android returns
318
+ // `gateway.getAppUserID()`, whose anonymous form is a fresh random UUID
319
+ // minted per process and unrelated to `Identity.current().anonymousId`.
320
+ // - `isAnonymous`: iOS reads Identity-synced state; Android reads the
321
+ // gateway's, which `Identity.reset()` / `Identity.wipe()` never touch.
322
+ //
323
+ // Delegating in JS makes the RN surface immune to all of that, and it is the
324
+ // only version of the fix that is verifiable from this repo's test suites.
325
+ // The legacy bridge methods stay on the native-module spec (removing them
326
+ // would break the native contract) but nothing in this package calls them
327
+ // any more.
328
+ //
329
+ // ## Second bug this closes
330
+ //
331
+ // `Identity` keeps JS-side caches (`lastSnapshot`, `lastLogIn`) that let a
332
+ // repeat `Identity.logIn(sameId)` skip the bridge. An alias that mutated
333
+ // native identity behind `Identity`'s back left those caches describing a
334
+ // world that no longer existed — after `Identity.logIn("u")` +
335
+ // `Purchases.logOut()`, a following `Identity.logIn("u")` short-circuited on
336
+ // the stale cache and resolved "logged in" without the device ever being
337
+ // re-identified. Routing through `Identity` means one owner for that state.
338
+ //
339
+ // ## The guard
340
+ //
341
+ // These sit on {@link throwIfCoreNotConfigured}, not on the purchase guard.
342
+ // Identity is a core capability — natively both platforms gate it on
343
+ // `isCoreConfigured` — and the single most likely caller of
344
+ // `Purchases.logIn` is an app migrating off RevenueCat that still lets
345
+ // RevenueCat own the store, i.e. one that called `configureCore`. Gating the
346
+ // RC-named alias on the purchase engine would reject exactly that app while
347
+ // the identical `Identity.logIn` call succeeded. The guard is not dropped
348
+ // entirely, because `Identity.current()` before any configure returns a
349
+ // real snapshot on iOS and a `{anonymousId: ""}` placeholder on Android —
350
+ // requiring core is what makes even that case agree.
238
351
 
239
352
  /**
240
- * Identify the user. Aliases/merges anonymous purchases server-side.
353
+ * Identify the user, merging the anonymous subject into `appUserID`
354
+ * server-side.
355
+ *
356
+ * Exactly `Identity.logIn(appUserID)` with the RevenueCat name. On both
357
+ * platforms this POSTs `(anonymous_id, user_id)` to
358
+ * `/api/sdk/users/identify` and resolves once the backend ack and the
359
+ * post-identify entitlements refresh complete; a rejection means the device
360
+ * is NOT merged server-side and the call must be retried. Repeat calls with
361
+ * the id already in effect are free (no bridge hop, no request).
362
+ *
363
+ * Works after `Purchases.configure`, `Purchases.configureCore`, or
364
+ * `Analytics.init` — the store does not have to be ours.
241
365
  *
242
- * @deprecated Wave 1 — prefer `Identity.logIn(userId)`. Routes through
243
- * the unified Identity surface natively, so the bug fix (Android now
244
- * POSTs `/api/sdk/users/identify`) applies whether you call this or
245
- * `Identity.logIn(...)`.
366
+ * @deprecated Wave 1 — prefer `Identity.logIn(userId)`. This alias exists so
367
+ * RevenueCat migrations compile unchanged; it is a pure delegation, so there
368
+ * is nothing to gain by keeping it and one less name to learn by dropping it.
246
369
  */
247
370
  static async logIn(appUserID) {
248
- throwIfNotConfigured();
249
- return (0, _module.getNativeModule)().logIn(appUserID);
371
+ await throwIfCoreNotConfigured();
372
+ return _identity.Identity.logIn(appUserID);
250
373
  }
251
374
 
252
375
  /**
253
- * Log out the current user and revert to anonymous.
376
+ * Log out the current user and revert to anonymous. The device id survives,
377
+ * so analytics continuity for the same physical install is preserved.
254
378
  *
255
- * @deprecated Wave 1 — prefer `Identity.logOut()`.
379
+ * Exactly `Identity.logOut()` with the RevenueCat name, plus RC's
380
+ * `CustomerInfo` return: after the logout lands, the post-logout customer
381
+ * info is read back from the store engine. **When no store engine is
382
+ * configured** (`configureCore`, `Analytics.init`) there is nothing to read,
383
+ * and you get an entitlement-free `CustomerInfo` for the anonymous subject —
384
+ * the same record, built in JS, on both platforms. Do not read that as a
385
+ * store error; if you want real entitlements, call `getCustomerInfo()`.
386
+ *
387
+ * @deprecated Wave 1 — prefer `Identity.logOut()`, which does not pretend to
388
+ * return store state.
256
389
  */
257
390
  static async logOut() {
258
- throwIfNotConfigured();
259
- return (0, _module.getNativeModule)().logOut();
391
+ await throwIfCoreNotConfigured();
392
+ await _identity.Identity.logOut();
393
+ return customerInfoAfterLogOut();
260
394
  }
261
395
 
262
- /** The current app user id (anonymous or identified). */
396
+ /**
397
+ * The current subject id — the identified user id if there is one, else the
398
+ * SDK's anonymous id (`$SKAnonymousID:`-prefixed, stable across launches).
399
+ *
400
+ * Exactly `(await Identity.current()).userId ?? .anonymousId`. Note this is
401
+ * the *Identity* subject on both platforms; on Android the purchase
402
+ * gateway's own anonymous id is a different, per-process value, and this
403
+ * alias deliberately does not report it.
404
+ *
405
+ * @deprecated Wave 1 — prefer `Identity.current()`, which hands back the
406
+ * anonymous id, the user id and `isAnonymous` in one read instead of forcing
407
+ * two calls that can interleave.
408
+ */
263
409
  static async getAppUserID() {
264
- throwIfNotConfigured();
265
- return (0, _module.getNativeModule)().getAppUserID();
410
+ await throwIfCoreNotConfigured();
411
+ const snapshot = await _identity.Identity.current();
412
+ return snapshot.userId ?? snapshot.anonymousId;
266
413
  }
267
414
 
268
- /** Whether the current user id is an SDK-generated anonymous id. */
415
+ /**
416
+ * Whether the current subject is the SDK-generated anonymous id.
417
+ *
418
+ * Exactly `(await Identity.current()).isAnonymous`, so it tracks
419
+ * `Identity.reset()` and `Identity.wipe()` on both platforms.
420
+ *
421
+ * @deprecated Wave 1 — prefer `Identity.current()`; see
422
+ * {@link getAppUserID}.
423
+ */
269
424
  static async isAnonymous() {
270
- throwIfNotConfigured();
271
- return (0, _module.getNativeModule)().isAnonymous();
425
+ await throwIfCoreNotConfigured();
426
+ return (await _identity.Identity.current()).isAnonymous;
272
427
  }
273
428
 
274
429
  // Subscriber attributes. CORE, not store — see {@link throwIfCoreNotConfigured}.
@@ -325,12 +480,20 @@ class Purchases {
325
480
  }
326
481
  }
327
482
 
328
- /** @internal Test seam: reset singleton state between tests. */
483
+ /**
484
+ * @internal Test seam: reset singleton state between tests.
485
+ *
486
+ * Also resets `Identity`'s caches, because the RC-parity aliases delegate
487
+ * there: without it, a `Purchases.logIn("u")` in one test would leave
488
+ * `Identity`'s `lastLogIn` primed and the next test's identical call would
489
+ * short-circuit before reaching the (freshly mocked) bridge.
490
+ */
329
491
  static __resetForTests() {
330
492
  configured = false;
331
493
  coreConfigured = false;
332
494
  configuredApiKey = null;
333
495
  customerInfoSubscriptions.clear();
496
+ _identity.Identity.__resetForTests();
334
497
  }
335
498
  }
336
499
 
@@ -1 +1 @@
1
- {"version":3,"names":["_module","require","_spec","_types","configured","configuredApiKey","coreConfigured","nativeBoolean","read","Promise","resolve","getNativeModule","catch","customerInfoSubscriptions","Map","throwIfNotConfigured","UninitializedPurchasesError","throwIfCoreNotConfigured","native","isCoreConfigured","Purchases","configure","options","apiKey","nativeOptions","appUserID","proxyURL","diagnosticsEnabled","storeKitVersion","useAmazon","autoPromptATT","sendInstallOnFirstLaunch","logLevel","configureCore","isConfigured","getCustomerInfo","getOfferings","purchasePackage","pkg","offeringId","presentedOfferingContext","offeringIdentifier","identifier","purchaseStoreProduct","product","restorePurchases","logIn","logOut","getAppUserID","isAnonymous","setAttributes","attributes","setEmail","email","setDisplayName","displayName","setPhoneNumber","phoneNumber","setPushToken","pushToken","setLogLevel","level","addCustomerInfoUpdateListener","listener","sub","getEventEmitter","addListener","CUSTOMER_INFO_UPDATED_EVENT","event","set","removeCustomerInfoUpdateListener","get","remove","delete","__resetForTests","clear","exports","_default","default"],"sourceRoot":"../../src","sources":["purchases.ts"],"mappings":";;;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAHA;;AAqBA,IAAIG,UAAU,GAAG,KAAK;AACtB,IAAIC,gBAA+B,GAAG,IAAI;AAC1C,IAAIC,cAAc,GAAG,KAAK;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,aAAaA,CACpBC,IAAmE,EACjD;EAClB,IAAI;IACF,OAAOC,OAAO,CAACC,OAAO,CAACF,IAAI,CAAC,IAAAG,uBAAe,EAAC,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC,MAAM,KAAK,CAAC;EACpE,CAAC,CAAC,MAAM;IACN,OAAOH,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC;EAC/B;AACF;;AAEA;AACA,MAAMG,yBAAyB,GAAG,IAAIC,GAAG,CAGvC,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA,SAASC,oBAAoBA,CAAA,EAAS;EACpC,IAAI,CAACX,UAAU,EAAE;IACf,MAAM,IAAIY,kCAA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,QAAQ,CAACK,KAAkD,CACxE,CAAC;IACDvD,yBAAyB,CAACwD,GAAG,CAACN,QAAQ,EAAEC,GAAG,CAAC;EAC9C;;EAEA;EACA,OAAOM,gCAAgCA,CACrCP,QAAoC,EAC9B;IACN,MAAMC,GAAG,GAAGnD,yBAAyB,CAAC0D,GAAG,CAACR,QAAQ,CAAC;IACnD,IAAIC,GAAG,EAAE;MACPA,GAAG,CAACQ,MAAM,CAAC,CAAC;MACZ3D,yBAAyB,CAAC4D,MAAM,CAACV,QAAQ,CAAC;IAC5C;EACF;;EAEA;EACA,OAAOW,eAAeA,CAAA,EAAS;IAC7BtE,UAAU,GAAG,KAAK;IAClBE,cAAc,GAAG,KAAK;IACtBD,gBAAgB,GAAG,IAAI;IACvBQ,yBAAyB,CAAC8D,KAAK,CAAC,CAAC;EACnC;AACF;;AAEA;AAAAC,OAAA,CAAAxD,SAAA,GAAAA,SAAA;AAAA,IAAAyD,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAMe1D,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["_identity","require","_module","_spec","_types","configured","configuredApiKey","coreConfigured","nativeBoolean","read","Promise","resolve","getNativeModule","catch","customerInfoSubscriptions","Map","throwIfNotConfigured","UninitializedPurchasesError","throwIfCoreNotConfigured","native","isCoreConfigured","customerInfoAfterLogOut","isConfigured","getCustomerInfo","snapshot","Identity","current","emptyCustomerInfo","userId","anonymousId","subjectId","now","Date","entitlements","all","active","verification","VERIFICATION_RESULT","NOT_REQUESTED","activeSubscriptions","allPurchasedProductIdentifiers","allPurchaseDates","subscriptionsByProductIdentifier","nonSubscriptionTransactions","firstSeen","toISOString","firstSeenMillis","getTime","originalAppUserId","requestDate","requestDateMillis","latestExpirationDate","latestExpirationDateMillis","originalPurchaseDate","originalPurchaseDateMillis","originalApplicationVersion","managementURL","Purchases","configure","options","apiKey","nativeOptions","appUserID","proxyURL","diagnosticsEnabled","storeKitVersion","useAmazon","autoPromptATT","sendInstallOnFirstLaunch","logLevel","configureCore","getOfferings","purchasePackage","pkg","offeringId","presentedOfferingContext","offeringIdentifier","identifier","purchaseStoreProduct","product","restorePurchases","logIn","logOut","getAppUserID","isAnonymous","setAttributes","attributes","setEmail","email","setDisplayName","displayName","setPhoneNumber","phoneNumber","setPushToken","pushToken","setLogLevel","level","addCustomerInfoUpdateListener","listener","sub","getEventEmitter","addListener","CUSTOMER_INFO_UPDATED_EVENT","event","set","removeCustomerInfoUpdateListener","get","remove","delete","__resetForTests","clear","exports","_default","default"],"sourceRoot":"../../src","sources":["purchases.ts"],"mappings":";;;;;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAJA;;AAsBA,IAAII,UAAU,GAAG,KAAK;AACtB,IAAIC,gBAA+B,GAAG,IAAI;AAC1C,IAAIC,cAAc,GAAG,KAAK;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,aAAaA,CACpBC,IAAmE,EACjD;EAClB,IAAI;IACF,OAAOC,OAAO,CAACC,OAAO,CAACF,IAAI,CAAC,IAAAG,uBAAe,EAAC,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC,MAAM,KAAK,CAAC;EACpE,CAAC,CAAC,MAAM;IACN,OAAOH,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC;EAC/B;AACF;;AAEA;AACA,MAAMG,yBAAyB,GAAG,IAAIC,GAAG,CAGvC,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,oBAAoBA,CAAA,EAAS;EACpC,IAAI,CAACX,UAAU,EAAE;IACf,MAAM,IAAIY,kCAA2B,CAAC,CAAC;EACzC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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ACvDvD,oBAAoB,CAAC,CAAC;IACtB,OAAO,IAAAJ,uBAAe,EAAC,CAAC,CAAC2D,YAAY,CAAC,CAAC;EACzC;;EAEA;EACA,aAAaC,eAAeA,CAACC,GAAqB,EAA+B;IAC/EzD,oBAAoB,CAAC,CAAC;IACtB,MAAM0D,UAAU,GAAGD,GAAG,CAACE,wBAAwB,EAAEC,kBAAkB,IAAI,EAAE;IACzE,OAAO,IAAAhE,uBAAe,EAAC,CAAC,CAAC4D,eAAe,CAACC,GAAG,CAACI,UAAU,EAAEH,UAAU,CAAC;EACtE;;EAEA;EACA,aAAaI,oBAAoBA,CAC/BC,OAA8B,EACD;IAC7B/D,oBAAoB,CAAC,CAAC;IACtB,OAAO,IAAAJ,uBAAe,EAAC,CAAC,CAACkE,oBAAoB,CAACC,OAAO,CAACF,UAAU,CAAC;EACnE;;EAEA;EACA,aAAaG,gBAAgBA,CAAA,EAA0B;IACrDhE,oBAAoB,CAAC,CAAC;IACtB,OAAO,IAAAJ,uBAAe,EAAC,CAAC,CAACoE,gBAAgB,CAAC,CAAC;EAC7C;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,aAAaC,KAAKA,CAACnB,SAAiB,EAAwB;IAC1D,MAAM5C,wBAAwB,CAAC,CAAC;IAChC,OAAOO,kBAAQ,CAACwD,KAAK,CAACnB,SAAS,CAAC;EAClC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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