{"version":3,"file":"mobxreactlite.cjs.development.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/utils.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useLocalObservable.ts","../src/useAsObservableSource.ts","../src/useLocalStore.ts","../src/index.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n    throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n    throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n    callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n    if (!reactionScheduler) {\n        reactionScheduler = defaultNoopBatch\n        if (\"production\" !== process.env.NODE_ENV) {\n            console.warn(\n                \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n            )\n        }\n    }\n    configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n    if (\"production\" !== process.env.NODE_ENV) {\n        console.warn(\"[MobX] Deprecated\")\n    }\n\n    return true\n}\n","const deprecatedMessages: string[] = []\n\nexport function useDeprecated(msg: string) {\n    if (!deprecatedMessages.includes(msg)) {\n        deprecatedMessages.push(msg)\n        console.warn(msg)\n    }\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n    return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n    globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n    return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n    constructor(finalize: (value: T) => void)\n    register(target: object, value: T, token?: object): void\n    unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n    private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n    private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n    constructor(private readonly finalize: (value: T) => void) {}\n\n    // Token is actually required with this impl\n    register(target: object, value: T, token?: object) {\n        this.registrations.set(token, {\n            value,\n            registeredAt: Date.now()\n        })\n        this.scheduleSweep()\n    }\n\n    unregister(token: unknown) {\n        this.registrations.delete(token)\n    }\n\n    // Bound so it can be used directly as setTimeout callback.\n    sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n        // cancel timeout so we can force sweep anytime\n        clearTimeout(this.sweepTimeout)\n        this.sweepTimeout = undefined\n\n        const now = Date.now()\n        this.registrations.forEach((registration, token) => {\n            if (now - registration.registeredAt >= maxAge) {\n                this.finalize(registration.value)\n                this.registrations.delete(token)\n            }\n        })\n\n        if (this.registrations.size > 0) {\n            this.scheduleSweep()\n        }\n    }\n\n    // Bound so it can be exported directly as clearTimers test utility.\n    finalizeAllImmediately = () => {\n        this.sweep(0)\n    }\n\n    private scheduleSweep() {\n        if (this.sweepTimeout === undefined) {\n            this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n        }\n    }\n}\n\nexport const UniversalFinalizationRegistry =\n    typeof FinalizationRegistry !== \"undefined\"\n        ? FinalizationRegistry\n        : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n    (adm: { reaction: Reaction | null }) => {\n        adm.reaction?.dispose()\n        adm.reaction = null\n    }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n    reaction: Reaction | null // also serves as disposed flag\n    onStoreChange: Function | null // also serves as mounted flag\n    // stateVersion that 'ticks' for every time the reaction fires\n    // tearing is still present,\n    // because there is no cross component synchronization,\n    // but we can use `useSyncExternalStore` API.\n    // TODO: optimize to use number?\n    stateVersion: any\n    name: string\n    // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n    subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n    getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n    adm.reaction = new Reaction(`observer${adm.name}`, () => {\n        adm.stateVersion = Symbol()\n        // onStoreChange won't be available until the component \"mounts\".\n        // If state changes in between initial render and mount,\n        // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n        adm.onStoreChange?.()\n    })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n    if (isUsingStaticRendering()) {\n        return render()\n    }\n\n    const admRef = React.useRef<ObserverAdministration | null>(null)\n\n    if (!admRef.current) {\n        // First render\n        const adm: ObserverAdministration = {\n            reaction: null,\n            onStoreChange: null,\n            stateVersion: Symbol(),\n            name: baseComponentName,\n            subscribe(onStoreChange: () => void) {\n                // Do NOT access admRef here!\n                observerFinalizationRegistry.unregister(adm)\n                adm.onStoreChange = onStoreChange\n                if (!adm.reaction) {\n                    // We've lost our reaction and therefore all subscriptions, occurs when:\n                    // 1. Timer based finalization registry disposed reaction before component mounted.\n                    // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n                    // We have to recreate reaction and schedule re-render to recreate subscriptions,\n                    // even if state did not change.\n                    createReaction(adm)\n                    // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n                    // So we make sure that is not the case\n                    adm.stateVersion = Symbol()\n                }\n\n                return () => {\n                    // Do NOT access admRef here!\n                    adm.onStoreChange = null\n                    adm.reaction?.dispose()\n                    adm.reaction = null\n                }\n            },\n            getSnapshot() {\n                // Do NOT access admRef here!\n                return adm.stateVersion\n            }\n        }\n\n        admRef.current = adm\n    }\n\n    const adm = admRef.current!\n\n    if (!adm.reaction) {\n        // First render or reaction was disposed by registry before subscribe\n        createReaction(adm)\n        // StrictMode/ConcurrentMode/Suspense may mean that our component is\n        // rendered and abandoned multiple times, so we need to track leaked\n        // Reactions.\n        observerFinalizationRegistry.register(admRef, adm, adm)\n    }\n\n    React.useDebugValue(adm.reaction!, printDebugValue)\n\n    useSyncExternalStore(\n        // Both of these must be stable, otherwise it would keep resubscribing every render.\n        adm.subscribe,\n        adm.getSnapshot,\n        adm.getSnapshot\n    )\n\n    // render the original component, but have the\n    // reaction track the observables, so that rendering\n    // can be invalidated (see above) once a dependency changes\n    let renderResult!: T\n    let exception\n    adm.reaction!.track(() => {\n        try {\n            renderResult = render()\n        } catch (e) {\n            exception = e\n        }\n    })\n\n    if (exception) {\n        throw exception // re-throw any exceptions caught during rendering\n    }\n\n    return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n    Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n    ? Symbol.for(\"react.forward_ref\")\n    : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n    ? Symbol.for(\"react.memo\")\n    : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n    readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n    baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n    options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n    React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n    baseComponent: React.ForwardRefExoticComponent<\n        React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n    >\n): React.MemoExoticComponent<\n    React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n    baseComponent: React.FunctionComponent<P>,\n    options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n    C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n    Options extends IObserverOptions\n>(\n    baseComponent: C,\n    options?: Options\n): Options extends { forwardRef: true }\n    ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n        ? C &\n              React.MemoExoticComponent<\n                  React.ForwardRefExoticComponent<\n                      React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n                  >\n              >\n        : never /* forwardRef set for a non forwarding component */\n    : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n    baseComponent:\n        | React.ForwardRefRenderFunction<TRef, P>\n        | React.FunctionComponent<P>\n        | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n    // TODO remove in next major\n    options?: IObserverOptions\n) {\n    if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n        warnObserverOptionsDeprecated = false\n        console.warn(\n            `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n        )\n    }\n\n    if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n        throw new Error(\n            `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n        )\n    }\n\n    // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n    if (isUsingStaticRendering()) {\n        return baseComponent\n    }\n\n    let useForwardRef = options?.forwardRef ?? false\n    let render = baseComponent\n\n    const baseComponentName = baseComponent.displayName || baseComponent.name\n\n    // If already wrapped with forwardRef, unwrap,\n    // so we can patch render and apply memo\n    if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n        useForwardRef = true\n        render = baseComponent[\"render\"]\n        if (typeof render !== \"function\") {\n            throw new Error(\n                `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n            )\n        }\n    }\n\n    let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n        return useObserver(() => render(props, ref), baseComponentName)\n    }\n\n    // Inherit original name and displayName, see #3438\n    ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n    if (isFunctionNameConfigurable) {\n        Object.defineProperty(observerComponent, \"name\", {\n            value: baseComponent.name,\n            writable: true,\n            configurable: true\n        })\n    }\n\n    // Support legacy context: `contextTypes` must be applied before `memo`\n    if ((baseComponent as any).contextTypes) {\n        ;(observerComponent as React.FunctionComponent).contextTypes = (\n            baseComponent as any\n        ).contextTypes\n    }\n\n    if (useForwardRef) {\n        // `forwardRef` must be applied prior `memo`\n        // `forwardRef(observer(cmp))` throws:\n        // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n        observerComponent = forwardRef(observerComponent)\n    }\n\n    // memo; we are not interested in deep updates\n    // in props; we assume that if deep objects are changed,\n    // this is in observables, which would have been tracked anyway\n    observerComponent = memo(observerComponent)\n\n    copyStaticProperties(baseComponent, observerComponent)\n\n    if (\"production\" !== process.env.NODE_ENV) {\n        Object.defineProperty(observerComponent, \"contextTypes\", {\n            set() {\n                throw new Error(\n                    `[mobx-react-lite] \\`${\n                        this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n                    }.contextTypes\\` must be set before applying \\`observer\\`.`\n                )\n            }\n        })\n    }\n\n    return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n    $$typeof: true,\n    render: true,\n    compare: true,\n    type: true,\n    // Don't redefine `displayName`,\n    // it's defined as getter-setter pair on `memo` (see #3192).\n    displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n    Object.keys(base).forEach(key => {\n        if (!hoistBlackList[key]) {\n            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n        }\n    })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n    children?(): React.ReactElement | null\n    render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n    const component = children || render\n    if (typeof component !== \"function\") {\n        return null\n    }\n    return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n    ObserverComponent.propTypes = {\n        children: ObserverPropsCheck,\n        render: ObserverPropsCheck\n    }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n    props: { [k: string]: any },\n    key: string,\n    componentName: string,\n    location: any,\n    propFullName: string\n) {\n    const extraKey = key === \"children\" ? \"render\" : \"children\"\n    const hasProp = typeof props[key] === \"function\"\n    const hasExtraProp = typeof props[extraKey] === \"function\"\n    if (hasProp && hasExtraProp) {\n        return new Error(\n            \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n        )\n    }\n\n    if (hasProp || hasExtraProp) {\n        return null\n    }\n    return new Error(\n        \"Invalid prop `\" +\n            propFullName +\n            \"` of type `\" +\n            typeof props[key] +\n            \"` supplied to\" +\n            \" `\" +\n            componentName +\n            \"`, expected `function`.\"\n    )\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n    initializer: () => TStore,\n    annotations?: AnnotationsMap<TStore, never>\n): TStore {\n    return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n    if (\"production\" !== process.env.NODE_ENV)\n        useDeprecated(\n            \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n        )\n    // We're deliberately not using idiomatic destructuring for the hook here.\n    // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n    // For further details, please refer to mobxjs/mobx#3842.\n    const res = useState(() => observable(current, {}, { deep: false }))[0]\n    runInAction(() => {\n        Object.assign(res, current)\n    })\n    return res\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n    initializer: (source: TSource) => TStore,\n    current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n    initializer: (source?: TSource) => TStore,\n    current?: TSource\n): TStore {\n    if (\"production\" !== process.env.NODE_ENV) {\n        useDeprecated(\n            \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n        )\n    }\n    const source = current && useAsObservableSource(current)\n    return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n    if (\"production\" !== process.env.NODE_ENV) {\n        useDeprecated(\n            \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n        )\n    }\n    return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n    if (\"production\" !== process.env.NODE_ENV) {\n        console.warn(\n            \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n        )\n    }\n    enableStaticRendering(enable)\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","console","warn","configure","isObserverBatched","deprecatedMessages","useDeprecated","msg","includes","push","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","REGISTRY_FINALIZE_AFTER","REGISTRY_SWEEP_INTERVAL","TimerBasedFinalizationRegistry","finalize","registrations","Map","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","UniversalFinalizationRegistry","FinalizationRegistry","observerFinalizationRegistry","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","useDebugValue","useSyncExternalStore","renderResult","exception","track","e","warnObserverOptionsDeprecated","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","observer","baseComponent","options","process","useForwardRef","_options$forwardRef","displayName","observerComponent","ref","defineProperty","writable","contextTypes","copyStaticProperties","_this$type","type","_this$type2","hoistBlackList","$$typeof","compare","base","keys","key","ObserverComponent","_ref","children","component","propTypes","ObserverPropsCheck","componentName","location","propFullName","extraKey","hasProp","hasExtraProp","useLocalObservable","initializer","annotations","observable","autoBind","useAsObservableSource","res","deep","runInAction","assign","useLocalStore","source","batch","clearTimers","_observerFinalization","fn","useObserverOriginal","useStaticRendering"],"mappings":";;;;;;;;;;;;AAGA,IAAI,CAACA,cAAQ,EAAE;EACX,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;;AAExE,IAAI,CAACC,mBAAc,EAAE;EACjB,MAAM,IAAID,KAAK,CAAC,oEAAoE,CAAC;;;SCLzEE,gBAAgBA,CAACC,QAAoB;EACjDA,QAAQ,EAAE;AACd;AAEA,SAAgBC,gBAAgBA,CAACC,iBAAsB;EACnD,IAAI,CAACA,iBAAiB,EAAE;IACpBA,iBAAiB,GAAGH,gBAAgB;IACpC,AAA2C;MACvCI,OAAO,CAACC,IAAI,CACR,6EAA6E,CAChF;;;EAGTC,cAAS,CAAC;IAAEH,iBAAiB,EAAjBA;GAAmB,CAAC;AACpC;AAEA,IAAaI,iBAAiB,GAAG,SAApBA,iBAAiBA;EAC1B,AAA2C;IACvCH,OAAO,CAACC,IAAI,CAAC,mBAAmB,CAAC;;EAGrC,OAAO,IAAI;AACf,CAAC;;ACxBD,IAAMG,kBAAkB,GAAa,EAAE;AAEvC,SAAgBC,aAAaA,CAACC,GAAW;EACrC,IAAI,CAACF,kBAAkB,CAACG,QAAQ,CAAC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