@tamagui/web 3.0.10 → 3.0.12

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 (36) hide show
  1. package/dist/cjs/_withNativeStyle.cjs +18 -4
  2. package/dist/cjs/_withNativeStyle.native.cjs +18 -4
  3. package/dist/cjs/_withNativeStyle.native.js +18 -4
  4. package/dist/cjs/_withNativeStyle.native.js.map +1 -1
  5. package/dist/cjs/createComponent.cjs +1 -1
  6. package/dist/cjs/createComponent.native.cjs +1 -1
  7. package/dist/cjs/createComponent.native.js +1 -1
  8. package/dist/cjs/createComponent.native.js.map +1 -1
  9. package/dist/cjs/helpers/nativeStyleEngine.cjs +77 -5
  10. package/dist/cjs/helpers/nativeStyleEngine.native.cjs +80 -5
  11. package/dist/cjs/helpers/nativeStyleEngine.native.js +80 -5
  12. package/dist/cjs/helpers/nativeStyleEngine.native.js.map +1 -1
  13. package/dist/esm/_withNativeStyle.mjs +19 -5
  14. package/dist/esm/_withNativeStyle.mjs.map +1 -1
  15. package/dist/esm/_withNativeStyle.native.js +19 -5
  16. package/dist/esm/_withNativeStyle.native.js.map +1 -1
  17. package/dist/esm/createComponent.mjs +1 -1
  18. package/dist/esm/createComponent.mjs.map +1 -1
  19. package/dist/esm/createComponent.native.js +1 -1
  20. package/dist/esm/createComponent.native.js.map +1 -1
  21. package/dist/esm/helpers/nativeStyleEngine.mjs +75 -6
  22. package/dist/esm/helpers/nativeStyleEngine.mjs.map +1 -1
  23. package/dist/esm/helpers/nativeStyleEngine.native.js +78 -6
  24. package/dist/esm/helpers/nativeStyleEngine.native.js.map +1 -1
  25. package/package.json +17 -17
  26. package/src/_withNativeStyle.tsx +34 -13
  27. package/src/createComponent.tsx +5 -4
  28. package/src/helpers/nativeStyleEngine.ts +116 -6
  29. package/src/hooks/useComponentState.ts +34 -1
  30. package/types/_withNativeStyle.d.ts +5 -4
  31. package/types/_withNativeStyle.d.ts.map +1 -1
  32. package/types/createComponent.d.ts.map +1 -1
  33. package/types/helpers/nativeStyleEngine.d.ts +5 -0
  34. package/types/helpers/nativeStyleEngine.d.ts.map +1 -1
  35. package/types/hooks/useComponentState.d.ts +14 -11
  36. package/types/hooks/useComponentState.d.ts.map +1 -1
@@ -227,6 +227,7 @@ export function setNativeStyleEngine(next: NativeStyleEngine | null): void {
227
227
  scopeMappings.clear()
228
228
  pendingHosts = []
229
229
  pendingStates = []
230
+ resetNativeStyleDiscovery()
230
231
  }
231
232
  engine = next
232
233
  if (next) {
@@ -307,7 +308,14 @@ export function createNativeStyleLinkState(
307
308
  // and the engine links every pending view in one call before a scope next
308
309
  // changes. linking exists for theme switches, so a mount pays nothing native.
309
310
  // nothing unlinks: the engine drops views that left the tree when it links, so
310
- // an unmount costs nothing either
311
+ // an unmount costs nothing either.
312
+ //
313
+ // a callback ref per themed host is most of the render cost (react calls it
314
+ // on every mount). the first mounts still attach one, and that ref records
315
+ // the react root. once the root is known, compiled hosts omit the ref and a
316
+ // later flush walks the root for hosts whose style array was registered here.
317
+ // that walk runs once the JS thread idles after the render that needs it, so a
318
+ // theme switch only walks when it lands before that idle.
311
319
  let pendingHosts: unknown[] = []
312
320
  let pendingStates: NativeStyleLinkState[] = []
313
321
  // past this many pending hosts, link them once the JS thread idles, so hosts
@@ -315,11 +323,103 @@ let pendingStates: NativeStyleLinkState[] = []
315
323
  const maxPendingHosts = 4096
316
324
  let idleFlushQueued = false
317
325
 
326
+ type StyleFiber = {
327
+ child: StyleFiber | null
328
+ sibling: StyleFiber | null
329
+ return: StyleFiber | null
330
+ memoizedProps: { style?: object } | null
331
+ stateNode: { node?: unknown; canonical?: object; current?: StyleFiber } | null
332
+ }
333
+
334
+ // style array identity -> the state those hosts rendered. the array is stable
335
+ // until the scope state changes, and it is the style prop on the host fiber
336
+ const stylesToState = new WeakMap<object, NativeStyleLinkState>()
337
+ // host -> the state it linked with. a host stays linked to its mapping's table
338
+ // under its scope, so a re-render with a newer state of that scope links nothing.
339
+ // fabric clones a host instance on every update and keeps its canonical
340
+ // record, so that record is the key for both a ref and a walked fiber
341
+ let linkedHostState = new WeakMap<object, NativeStyleLinkState>()
342
+
343
+ function hostKey(host: object): object {
344
+ const record = host as {
345
+ __internalInstanceHandle?: StyleFiber
346
+ stateNode?: StyleFiber['stateNode']
347
+ }
348
+ const instance = record.__internalInstanceHandle?.stateNode ?? record.stateNode
349
+ return instance?.canonical ?? host
350
+ }
351
+ // FiberRoot of the tree a host ref captured. current is the committed HostRoot.
352
+ // current is optional because a host fiber's stateNode is this same shape and
353
+ // has no current, and that object is what capture stores
354
+ let fiberRoot: { current?: StyleFiber | null } | null = null
355
+ let needsDiscover = false
356
+
357
+ function resetNativeStyleDiscovery(): void {
358
+ fiberRoot = null
359
+ needsDiscover = false
360
+ linkedHostState = new WeakMap()
361
+ }
362
+
363
+ export function registerNativeStyle(style: object, state: NativeStyleLinkState): void {
364
+ stylesToState.set(style, state)
365
+ }
366
+
367
+ /** true once a host ref has captured a react root that is still mounted */
368
+ export function nativeStyleMountMode(): 'discover' | 'ref' {
369
+ const current = fiberRoot?.current
370
+ if (current && current.stateNode === fiberRoot) {
371
+ if (!needsDiscover) {
372
+ needsDiscover = true
373
+ queueIdleFlush()
374
+ }
375
+ return 'discover'
376
+ }
377
+ return 'ref'
378
+ }
379
+
380
+ /** records the react root from a host ref, when the instance carries a fiber */
381
+ export function captureNativeStyleRoot(node: unknown): void {
382
+ const fiber = (node as { __internalInstanceHandle?: StyleFiber } | null)
383
+ ?.__internalInstanceHandle
384
+ if (!fiber) return
385
+ let top = fiber
386
+ for (let guard = 0; top.return && guard < 100000; guard++) top = top.return
387
+ const root = top.stateNode
388
+ if (root && root.current === top) fiberRoot = root
389
+ }
390
+
391
+ function discoverMountedHosts(): number {
392
+ const root = fiberRoot?.current
393
+ if (!root || root.stateNode !== fiberRoot) return 0
394
+ const stack: StyleFiber[] = [root]
395
+ let found = 0
396
+ for (let guard = 0; stack.length && guard < 100000; guard++) {
397
+ const fiber = stack.pop()!
398
+ if (fiber.sibling) stack.push(fiber.sibling)
399
+ if (fiber.child) stack.push(fiber.child)
400
+ const style = fiber.memoizedProps?.style
401
+ if (!style) continue
402
+ const state = stylesToState.get(style)
403
+ // only a fabric host carries the shadow node; composite fibers share the
404
+ // style prop and must not link
405
+ if (!state || !fiber.stateNode?.node) continue
406
+ found++
407
+ linkNativeStyleHost(fiber, state)
408
+ }
409
+ return found
410
+ }
411
+
318
412
  function idleFlush() {
319
413
  idleFlushQueued = false
320
414
  flushNativeStyleLinks()
321
415
  }
322
416
 
417
+ function queueIdleFlush() {
418
+ if (idleFlushQueued) return
419
+ idleFlushQueued = true
420
+ requestIdleCallback(idleFlush)
421
+ }
422
+
323
423
  function addScopeMapping(scopeId: string, compiled: CompiledMapping) {
324
424
  let linked = scopeMappings.get(scopeId)
325
425
  if (!linked) scopeMappings.set(scopeId, (linked = new Set()))
@@ -328,6 +428,13 @@ function addScopeMapping(scopeId: string, compiled: CompiledMapping) {
328
428
 
329
429
  /** links every pending view in one engine call */
330
430
  export function flushNativeStyleLinks(): void {
431
+ if (needsDiscover) {
432
+ needsDiscover = false
433
+ const current = fiberRoot?.current
434
+ // a replaced react root no longer points at the fiber we captured
435
+ if (!current || current.stateNode !== fiberRoot) fiberRoot = null
436
+ else discoverMountedHosts()
437
+ }
331
438
  if (!pendingHosts.length) return
332
439
  const hosts = pendingHosts
333
440
  const states = pendingStates
@@ -360,7 +467,13 @@ export function flushNativeStyleLinks(): void {
360
467
 
361
468
  /** records a mounted host for linking. a host attaching twice links once */
362
469
  export function linkNativeStyleHost(host: unknown, state: NativeStyleLinkState): void {
363
- if (!engine) return
470
+ if (!engine || host == null) return
471
+ const key = hostKey(host as object)
472
+ const linked = linkedHostState.get(key)
473
+ if (linked && linked.mapping === state.mapping && linked.scopeId === state.scopeId) {
474
+ return
475
+ }
476
+ linkedHostState.set(key, state)
364
477
  // a scope can advance (layout effect) after a concurrent render captured its
365
478
  // theme but before that render's host attaches. link that host now against
366
479
  // the live scope state and have the engine commit it once to correct the
@@ -375,10 +488,7 @@ export function linkNativeStyleHost(host: unknown, state: NativeStyleLinkState):
375
488
  }
376
489
  pendingHosts.push(host)
377
490
  pendingStates.push(state)
378
- if (pendingHosts.length >= maxPendingHosts && !idleFlushQueued) {
379
- idleFlushQueued = true
380
- requestIdleCallback(idleFlush)
381
- }
491
+ if (pendingHosts.length >= maxPendingHosts) queueIdleFlush()
382
492
  }
383
493
 
384
494
  /** memo-generation and live-owner sizes for development diagnostics and probes */
@@ -6,23 +6,56 @@ import { getSetting } from '../config'
6
6
  import { isOptimizedForFirstRender } from './isOptimizedForFirstRender'
7
7
  import { defaultComponentStateMounted } from '../defaultComponentState'
8
8
  import { isObj } from '../helpers/isObj'
9
+ import type { RefObject } from 'react'
9
10
  import type {
10
11
  ComponentContextI,
12
+ ComponentSetState,
13
+ ComponentSetStateShallow,
14
+ PresenceContextProps,
11
15
  StaticConfig,
12
16
  TamaguiComponentState,
13
17
  TamaguiComponentStateRef,
14
18
  TamaguiInternalConfig,
15
19
  TextProps,
16
20
  UseAnimationHook,
21
+ UsePresenceResult,
17
22
  } from '../types'
18
23
  import type { ViewProps } from '../views/View'
19
24
 
25
+ // declaration emit cannot write the inferred return: finalizeStyleFlags returns
26
+ // the same object. the method's published type is already elided to any
27
+ type UseComponentStateResult = {
28
+ props: ViewProps | TextProps | Record<string, any>
29
+ startedUnhydrated: boolean
30
+ curStateRef: TamaguiComponentStateRef
31
+ disabled: any
32
+ groupName: string | undefined
33
+ hasAnimationProp: boolean
34
+ hasEnterStyle: boolean
35
+ isAnimated: boolean
36
+ isExiting: boolean
37
+ isHydrated: boolean
38
+ presence: UsePresenceResult | null
39
+ presenceState: PresenceContextProps | null | undefined
40
+ setState: ComponentSetState
41
+ setStateShallow: ComponentSetStateShallow
42
+ noClass: boolean
43
+ state: TamaguiComponentState
44
+ stateRef: RefObject<TamaguiComponentStateRef>
45
+ inputStyle: 'css' | 'value'
46
+ outputStyle: 'css' | 'inline'
47
+ willBeAnimated: boolean
48
+ willBeAnimatedClient: boolean
49
+ platformPseudo: boolean
50
+ finalizeStyleFlags(hasEnterStyle: boolean, hasPlatformPseudo: boolean): any
51
+ }
52
+
20
53
  export const useComponentState = (
21
54
  props: ViewProps | TextProps | Record<string, any>,
22
55
  animationDriver: ComponentContextI['animationDriver'],
23
56
  staticConfig: StaticConfig,
24
57
  config: TamaguiInternalConfig
25
- ) => {
58
+ ): UseComponentStateResult => {
26
59
  'use no memo'
27
60
 
28
61
  const isHydrated = useDidFinishSSR()
@@ -3,10 +3,11 @@ import { type NativeStyleThemeMapping } from './helpers/nativeStyleEngine';
3
3
  /**
4
4
  * internal: emitted by the native compiler when experimental.nativeFastPath is on.
5
5
  *
6
- * One component over the host: the theme scope is the only context read and
7
- * the host ref queues the host for the engine's next batched link. Links never
8
- * detach (the engine prunes unmounted views), so a themed view costs one
9
- * component and one array push to mount.
6
+ * One component over the host: the theme scope is the only context read.
7
+ * Until a host ref has seen the react root, the host ref queues the view for
8
+ * the engine's next batched link. After that, themed hosts render with no ref
9
+ * and a flush walks the root. Links never detach (the engine prunes unmounted
10
+ * views).
10
11
  *
11
12
  * `host: 'view'`: `Component` is RN's host view (`unstable_NativeView`).
12
13
  * <View> resets TextAncestorContext for its children when it sits inside a
@@ -1 +1 @@
1
- {"version":3,"file":"_withNativeStyle.d.ts","sourceRoot":"","sources":["../src/_withNativeStyle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAc,MAAM,OAAO,CAAA;AAElC,OAAO,EAML,KAAK,uBAAuB,EAC7B,MAAM,6BAA6B,CAAA;AAYpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,cAChB,GAAG,aACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kBAClB,uBAAuB,SAChC,MAAM,GAAG,MAAM;YAwIU,GAAG;sBAIA,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;CAG3D,CAAA"}
1
+ {"version":3,"file":"_withNativeStyle.d.ts","sourceRoot":"","sources":["../src/_withNativeStyle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAc,MAAM,OAAO,CAAA;AAElC,OAAO,EASL,KAAK,uBAAuB,EAC7B,MAAM,6BAA6B,CAAA;AAYpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,gBAAgB,cAChB,GAAG,aACH,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kBAClB,uBAAuB,SAChC,MAAM,GAAG,MAAM;YAmJU,GAAG;sBAIA,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;CAG3D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAwC/D,OAAO,KAAK,EASV,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EAOf,MAAM,SAAS,CAAA;AAahB,KAAK,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAA;AAEpF,eAAO,MAAM,kBAAkB,wBAA+B,CAAA;AAuK9D,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,EACnD,GAAG,SAAS,cAAc,GAAG,cAAc,EAC3C,SAAS,GAAG,KAAK,EACjB,UAAU,SAAS,MAAM,GAAG,KAAK,EACjC,YAAY,EAAE,YAAY,wEAykE3B"}
1
+ {"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../src/createComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAwC/D,OAAO,KAAK,EASV,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EAOf,MAAM,SAAS,CAAA;AAahB,KAAK,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAA;AAEpF,eAAO,MAAM,kBAAkB,wBAA+B,CAAA;AAuK9D,wBAAgB,eAAe,CAC7B,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,EACnD,GAAG,SAAS,cAAc,GAAG,cAAc,EAC3C,SAAS,GAAG,KAAK,EACjB,UAAU,SAAS,MAAM,GAAG,KAAK,EACjC,YAAY,EAAE,YAAY,wEA0kE3B"}
@@ -76,6 +76,11 @@ export interface NativeStyleLinkState {
76
76
  theme: Record<string, unknown>;
77
77
  }
78
78
  export declare function createNativeStyleLinkState(mapping: NativeStyleThemeMapping, scopeId: string, stateName: string, theme: Record<string, unknown>): NativeStyleLinkState;
79
+ export declare function registerNativeStyle(style: object, state: NativeStyleLinkState): void;
80
+ /** true once a host ref has captured a react root that is still mounted */
81
+ export declare function nativeStyleMountMode(): 'discover' | 'ref';
82
+ /** records the react root from a host ref, when the instance carries a fiber */
83
+ export declare function captureNativeStyleRoot(node: unknown): void;
79
84
  /** links every pending view in one engine call */
80
85
  export declare function flushNativeStyleLinks(): void;
81
86
  /** records a mounted host for linking. a host attaching twice links once */
@@ -1 +1 @@
1
- {"version":3,"file":"nativeStyleEngine.d.ts","sourceRoot":"","sources":["../../src/helpers/nativeStyleEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKtE,CAAA;AAkBD,yFAAyF;AACzF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,UAAQ,GACZ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA2BzB;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,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AI,CAAC,GAAG,IAAI,GACtD,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE;IACH,UAAU,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAA;IAC/C,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC/B,EACD,IAAI,EAAE,OAAO,GACZ,IAAI,CAWN;AAKD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAoBvE;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAG1D"}
@@ -1,7 +1,8 @@
1
- import type { ComponentContextI, StaticConfig, TamaguiComponentState, TamaguiComponentStateRef, TamaguiInternalConfig, TextProps } from '../types';
1
+ import type { RefObject } from 'react';
2
+ import type { ComponentContextI, ComponentSetState, ComponentSetStateShallow, PresenceContextProps, StaticConfig, TamaguiComponentState, TamaguiComponentStateRef, TamaguiInternalConfig, TextProps, UsePresenceResult } from '../types';
2
3
  import type { ViewProps } from '../views/View';
3
- export declare const useComponentState: (props: ViewProps | TextProps | Record<string, any>, animationDriver: ComponentContextI['animationDriver'], staticConfig: StaticConfig, config: TamaguiInternalConfig) => {
4
- props: Record<string, any> | TextProps | ViewProps;
4
+ type UseComponentStateResult = {
5
+ props: ViewProps | TextProps | Record<string, any>;
5
6
  startedUnhydrated: boolean;
6
7
  curStateRef: TamaguiComponentStateRef;
7
8
  disabled: any;
@@ -11,18 +12,20 @@ export declare const useComponentState: (props: ViewProps | TextProps | Record<s
11
12
  isAnimated: boolean;
12
13
  isExiting: boolean;
13
14
  isHydrated: boolean;
14
- presence: import("..").UsePresenceResult | null;
15
- presenceState: import("..").PresenceContextProps | null | undefined;
16
- setState: import("../types").ComponentSetState;
17
- setStateShallow: import("../types").ComponentSetStateShallow;
15
+ presence: UsePresenceResult | null;
16
+ presenceState: PresenceContextProps | null | undefined;
17
+ setState: ComponentSetState;
18
+ setStateShallow: ComponentSetStateShallow;
18
19
  noClass: boolean;
19
20
  state: TamaguiComponentState;
20
- stateRef: import("react").RefObject<TamaguiComponentStateRef>;
21
- inputStyle: "css" | "value";
22
- outputStyle: "css" | "inline";
21
+ stateRef: RefObject<TamaguiComponentStateRef>;
22
+ inputStyle: 'css' | 'value';
23
+ outputStyle: 'css' | 'inline';
23
24
  willBeAnimated: boolean;
24
25
  willBeAnimatedClient: boolean;
25
26
  platformPseudo: boolean;
26
- finalizeStyleFlags(hasEnterStyle: boolean, hasPlatformPseudo: boolean): /*elided*/ any;
27
+ finalizeStyleFlags(hasEnterStyle: boolean, hasPlatformPseudo: boolean): any;
27
28
  };
29
+ export declare const useComponentState: (props: ViewProps | TextProps | Record<string, any>, animationDriver: ComponentContextI['animationDriver'], staticConfig: StaticConfig, config: TamaguiInternalConfig) => UseComponentStateResult;
30
+ export {};
28
31
  //# sourceMappingURL=useComponentState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useComponentState.d.ts","sourceRoot":"","sources":["../../src/hooks/useComponentState.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,SAAS,EAEV,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,eAAO,MAAM,iBAAiB,UACrB,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,mBACjC,iBAAiB,CAAC,iBAAiB,CAAC,gBACvC,YAAY,UAClB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;sCA6LO,OAAO,qBAAqB,OAAO;CAyCxE,CAAA"}
1
+ {"version":3,"file":"useComponentState.d.ts","sourceRoot":"","sources":["../../src/hooks/useComponentState.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SA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