{"version":3,"names":["createSignal","untrack","ACTIVE_COMPOSITE_ITEM","ALL_KEYS","ARROW_DOWN","ARROW_KEYS","ARROW_LEFT","ARROW_RIGHT","ARROW_UP","END","HOME","HORIZONTAL_KEYS","HORIZONTAL_KEYS_WITH_EXTRA_KEYS","MODIFIER_KEYS","VERTICAL_KEYS","VERTICAL_KEYS_WITH_EXTRA_KEYS","findNonDisabledListIndex","getMaxListIndex","getMinListIndex","isElementDisabled","isIndexOutOfListBounds","isNativeInput","scrollIntoViewIfNeeded","EMPTY_MODIFIERS","useCompositeRoot","params","internalHighlightedIndex","setInternalHighlightedIndex","ownedWrite","name","highlightedIndex","setHighlightedIndex","next","undefined","onHighlightedIndexChange","committedIndex","lastSeenControlled","rootEl","setRootEl","rootRef","el","elementsRef","hasSetDefaultIndex","index","shouldScrollIntoView","direction","orientation","onMapChange","map","size","sortedElements","Array","from","keys","active","find","hasAttribute","activeIndex","indexOf","disabledIndicesAccessor","disabledIndices","getDisabledIndicesInput","list","handleKeyDown","event","enableHomeEnd","enableHomeAndEndKeys","loopFocus","stopEventPropagation","modifierKeys","RELEVANT_KEYS","has","key","isModifierKeySet","root","isRtl","resolveDirectionalKeys","target","shouldDeferToNativeInput","forwardKey","backwardKey","disabledInput","controlledValue","currentIndex","minIndex","maxIndex","nextIndex","computeNextIndex","stopPropagation","preventedKeys","preventDefault","queueMicrotask","focus","handleFocus","input","setSelectionRange","value","length","orientationAttr","o","props","aria-orientation","onFocus","onKeyDown","relayKeyboardEvent","ignoredModifierKeys","values","includes","getModifierState","relevantKeys","horizontalForwardKey","horizontalBackwardKey","horizontal","vertical","both","forwardKeys","backwardKeys","selectionStart","selectionEnd","textContent","shiftKey","isForward","isBackward","startingIndex","decrement"],"sources":["composite-root.ts"],"sourcesContent":["/**\n * `useCompositeRoot` — keyboard navigation primitive for 1D lists.\n *\n * Translates the keyboard half of Base UI React's `useCompositeRoot`\n * (`packages/react/src/internals/composite/root/useCompositeRoot.ts`) to Solid\n * 2. This is intentionally a 1D-only engine — grid / dense / itemSizes /\n * onLoop / cols are deliberately not implemented here. Every non-floating\n * consumer (toolbar, tabs, radio-group, toggle-group) is 1D. Grid navigation\n * lives in the floating path (`floating-ui/hooks/use-list-navigation.ts` +\n * `floating-ui/utils/composite.ts`, `getGridNavigatedIndex`), where any grid\n * consumer (menu / select / combobox) already gets it. Build a non-floating\n * grid path only if a non-floating grid consumer surfaces — none is planned.\n *\n * Shape:\n *\n * - Returns `{ props, highlightedIndex, onHighlightedIndexChange,\n *   elementsRef, onMapChange, relayKeyboardEvent }`.\n * - `props` is a plain object containing the keyboard handler + focus\n *   handler, ready to be dropped into `renderElement`'s `params.props`\n *   array. Handlers read reactive values at call time inside the body; no\n *   top-level reactive reads.\n * - `highlightedIndex` is an accessor; `onHighlightedIndexChange(index,\n *   shouldScrollIntoView)` mirrors React Base UI's signature exactly.\n * - `elementsRef` is a plain array (NOT a signal) — downstream `<CompositeList>`\n *   owns its contents and the keyboard handler reads it at call time.\n */\n\nimport { createSignal, untrack } from \"solid-js\";\nimport {\n\tACTIVE_COMPOSITE_ITEM,\n\tALL_KEYS,\n\tARROW_DOWN,\n\tARROW_KEYS,\n\tARROW_LEFT,\n\tARROW_RIGHT,\n\tARROW_UP,\n\ttype CompositeOrientation,\n\tEND,\n\tHOME,\n\tHORIZONTAL_KEYS,\n\tHORIZONTAL_KEYS_WITH_EXTRA_KEYS,\n\tMODIFIER_KEYS,\n\ttype ModifierKey,\n\ttype TextDirection,\n\tVERTICAL_KEYS,\n\tVERTICAL_KEYS_WITH_EXTRA_KEYS,\n} from \"./composite-constants\";\nimport type { CompositeMetadata } from \"./composite-context\";\nimport {\n\ttype DisabledIndices,\n\ttype ElementList,\n\tfindNonDisabledListIndex,\n\tgetMaxListIndex,\n\tgetMinListIndex,\n\tisElementDisabled,\n\tisIndexOutOfListBounds,\n\tisNativeInput,\n\tscrollIntoViewIfNeeded,\n} from \"./composite-utils\";\n\nexport interface UseCompositeRootParameters {\n\torientation?: CompositeOrientation | undefined;\n\tloopFocus?: boolean | undefined;\n\t/** Controlled highlighted index. */\n\thighlightedIndex?: (() => number | undefined) | undefined;\n\t/** Fired when the highlighted index changes. */\n\tonHighlightedIndexChange?: ((index: number) => void) | undefined;\n\t/** Text direction (for rtl-aware horizontal navigation). */\n\tdirection: () => TextDirection;\n\t/** Opts into Home/End key handling. */\n\tenableHomeAndEndKeys?: boolean | undefined;\n\t/** When `true`, `event.stopPropagation()` fires on handled keys. */\n\tstopEventPropagation?: boolean | undefined;\n\t/** Indices that should be treated as disabled for navigation. */\n\tdisabledIndices?: (() => number[] | undefined) | undefined;\n\t/** Modifier keys that allow native behavior (default: none). */\n\tmodifierKeys?: ModifierKey[] | undefined;\n}\n\n/**\n * A `MouseEvent`/`KeyboardEvent` with Base UI's handler-chain bailout.\n */\ninterface BaseUIEventLike {\n\tbaseUIHandlerPrevented?: boolean;\n\tpreventBaseUIHandler?: () => void;\n}\n\nconst EMPTY_MODIFIERS: readonly ModifierKey[] = [];\n\nexport interface UseCompositeRootReturn {\n\t/** Props to merge onto the composite's root element. */\n\tprops: {\n\t\t\"aria-orientation\"?: \"horizontal\" | \"vertical\" | undefined;\n\t\tonFocus: (event: FocusEvent) => void;\n\t\tonKeyDown: (event: KeyboardEvent & BaseUIEventLike) => void;\n\t};\n\thighlightedIndex: () => number;\n\tonHighlightedIndexChange: (\n\t\tindex: number,\n\t\tshouldScrollIntoView?: boolean,\n\t) => void;\n\t/** Plain array of registered elements (owned by `<CompositeList>`). */\n\telementsRef: Array<HTMLElement | null>;\n\t/** Root DOM element ref callback (captured internally for scroll/focus). */\n\trootRef: (el: HTMLElement | null) => void;\n\t/** Handler for `<CompositeList onMapChange>`. Picks up the initial\n\t * active item from the `ACTIVE_COMPOSITE_ITEM` attribute once. */\n\tonMapChange: (map: Map<Element, CompositeMetadata<unknown> | null>) => void;\n\t/** Alias for `props.onKeyDown`, suitable for relaying events from\n\t * detached trigger elements. */\n\trelayKeyboardEvent: (event: KeyboardEvent & BaseUIEventLike) => void;\n}\n\nexport function useCompositeRoot(\n\tparams: UseCompositeRootParameters,\n): UseCompositeRootReturn {\n\t// Internal highlighted-index state. Composite is internal infrastructure\n\t// (no public consumer ever passes `highlightedIndex` directly — only\n\t// outer compounds like Tabs.List / ToggleGroup forward an accessor for\n\t// composite-to-composite coordination). The optional consumer-controlled\n\t// override stays via the `params.highlightedIndex` accessor; if absent,\n\t// the internal signal is the source of truth.\n\t//\n\t// Why this internal signal stays as part of §4.1: composite is a 100%\n\t// internal helper, not a public-API surface. Forcing every wrapper to\n\t// bring its own signal would push controlled/uncontrolled friction onto\n\t// internals where the consumer is never exposed. The pattern we removed\n\t// from public wrappers (drop defaultX, force consumer to bring signal)\n\t// doesn't apply here.\n\tconst [internalHighlightedIndex, setInternalHighlightedIndex] = createSignal(\n\t\t0,\n\t\t{ ownedWrite: true, name: \"composite.internalHighlightedIndex\" },\n\t);\n\tconst highlightedIndex = (): number =>\n\t\tparams.highlightedIndex?.() ?? internalHighlightedIndex();\n\tconst setHighlightedIndex = (next: number | undefined): void => {\n\t\tif (next === undefined) return;\n\t\t// Always notify the external onChange — consumers may use this to\n\t\t// observe even when they don't pass a controlled `highlightedIndex`.\n\t\tparams.onHighlightedIndexChange?.(next);\n\t\t// Only write the internal signal when the consumer isn't driving\n\t\t// `highlightedIndex` themselves; mirrors consumer-owned signal mechanics\n\t\t// (\"once-controlled-always-controlled\" pattern, see solidify.md §6).\n\t\tif (params.highlightedIndex === undefined) {\n\t\t\tsetInternalHighlightedIndex(next);\n\t\t}\n\t};\n\n\t// Synchronous mirror for keyboard-handler reads. In Solid 2 signal writes\n\t// settle on the next microtask (MIGRATION.md), so two arrow presses inside\n\t// the same tick would both see the pre-write value — making the second\n\t// press read a stale `highlightedIndex()`. We mirror the latest written\n\t// value into a plain variable so the handler can advance monotonically.\n\t// The accessor remains the source of truth for external readers.\n\t//\n\t// Strategy (see B3 in the wave-0 review):\n\t//\n\t// - On every handler entry we read the external controlled value (when\n\t//   the consumer passes one) and compare it against `lastSeenControlled`.\n\t// - If the consumer drove it elsewhere (external change across ticks),\n\t//   the value differs from our last observation; we resync\n\t//   `committedIndex` to the external value.\n\t// - Otherwise, we assume the caller is still mid-tick and prefer\n\t//   `committedIndex` — which reflects all writes we've issued so far in\n\t//   this tick, even if the controlled accessor hasn't flushed yet.\n\t//\n\t// The controlled accessor remains the single source of truth across\n\t// ticks; `committedIndex` is an intra-tick overlay only.\n\tlet committedIndex = 0;\n\tlet lastSeenControlled: number | undefined;\n\n\t// Root DOM element, captured via ref callback. `ownedWrite` because the\n\t// callback fires from unowned scope.\n\tconst [rootEl, setRootEl] = createSignal<HTMLElement | null>(null, {\n\t\townedWrite: true,\n\t});\n\tconst rootRef = (el: HTMLElement | null): void => {\n\t\tsetRootEl(el);\n\t};\n\n\t// The elements array lives here; `<CompositeList>` mutates it on our\n\t// behalf. Keeping it as a plain array (not a signal) matches the\n\t// `ref.current`-shaped contract floating-ui uses and keeps keyboard\n\t// handler reads synchronous.\n\tconst elementsRef: Array<HTMLElement | null> = [];\n\n\t// Once-only latch for the \"initial active item\" scan.\n\tlet hasSetDefaultIndex = false;\n\n\tconst onHighlightedIndexChange = (\n\t\tindex: number,\n\t\tshouldScrollIntoView = false,\n\t): void => {\n\t\tcommittedIndex = index;\n\t\tsetHighlightedIndex(index);\n\t\tif (shouldScrollIntoView) {\n\t\t\tconst el = elementsRef[index] ?? null;\n\t\t\tscrollIntoViewIfNeeded(\n\t\t\t\trootEl(),\n\t\t\t\tel,\n\t\t\t\tparams.direction(),\n\t\t\t\tparams.orientation ?? \"both\",\n\t\t\t);\n\t\t}\n\t};\n\n\tconst onMapChange = (\n\t\tmap: Map<Element, CompositeMetadata<unknown> | null>,\n\t): void => {\n\t\t// Invoked from `<CompositeList>` inside an effect apply when items\n\t\t// register/unregister; reads of `rootEl()` / `params.direction()`\n\t\t// are snapshots driving a one-shot scroll, not subscriptions.\n\t\t// `untrack` keeps the strict-read context from flagging them.\n\t\tuntrack(() => {\n\t\t\tif (map.size === 0 || hasSetDefaultIndex) return;\n\t\t\thasSetDefaultIndex = true;\n\t\t\tconst sortedElements = Array.from(map.keys());\n\t\t\tconst active = sortedElements.find((el) =>\n\t\t\t\tel.hasAttribute(ACTIVE_COMPOSITE_ITEM),\n\t\t\t) as HTMLElement | undefined;\n\t\t\tconst activeIndex = active ? sortedElements.indexOf(active) : -1;\n\t\t\tif (activeIndex !== -1) {\n\t\t\t\tonHighlightedIndexChange(activeIndex);\n\t\t\t}\n\t\t\tscrollIntoViewIfNeeded(\n\t\t\t\trootEl(),\n\t\t\t\tactive ?? null,\n\t\t\t\tparams.direction(),\n\t\t\t\tparams.orientation ?? \"both\",\n\t\t\t);\n\t\t});\n\t};\n\n\tconst disabledIndicesAccessor = (): number[] | undefined =>\n\t\tparams.disabledIndices?.();\n\n\tconst getDisabledIndicesInput = (): DisabledIndices | undefined => {\n\t\tconst list = disabledIndicesAccessor();\n\t\treturn list;\n\t};\n\n\tconst handleKeyDown = (event: KeyboardEvent & BaseUIEventLike): void => {\n\t\tconst enableHomeEnd = params.enableHomeAndEndKeys ?? false;\n\t\tconst orientation = params.orientation ?? \"both\";\n\t\tconst loopFocus = params.loopFocus ?? true;\n\t\tconst stopEventPropagation = params.stopEventPropagation ?? false;\n\t\tconst modifierKeys = params.modifierKeys ?? EMPTY_MODIFIERS;\n\n\t\tconst RELEVANT_KEYS = enableHomeEnd ? ALL_KEYS : ARROW_KEYS;\n\t\tif (!RELEVANT_KEYS.has(event.key)) return;\n\t\tif (isModifierKeySet(event, modifierKeys)) return;\n\n\t\tconst root = rootEl();\n\t\tif (!root) return;\n\n\t\tconst isRtl = params.direction() === \"rtl\";\n\t\tconst keys = resolveDirectionalKeys(\n\t\t\torientation,\n\t\t\tisRtl,\n\t\t\tenableHomeEnd,\n\t\t\tRELEVANT_KEYS,\n\t\t);\n\n\t\t// Textbox bailout — defer arrow keys to the input when the cursor\n\t\t// isn't at the extent in the travel direction.\n\t\tconst target = event.target as EventTarget | null;\n\t\tif (\n\t\t\tshouldDeferToNativeInput(event, target, keys.forwardKey, keys.backwardKey)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst list: ElementList = elementsRef;\n\t\tconst disabledInput = getDisabledIndicesInput();\n\t\t// See `committedIndex` declaration: prefer the mirror for\n\t\t// intra-tick reads, only resync to the controlled accessor when the\n\t\t// external value changed between handler calls (across ticks).\n\t\tconst controlledValue = params.highlightedIndex?.();\n\t\tif (\n\t\t\tcontrolledValue !== undefined &&\n\t\t\tcontrolledValue !== lastSeenControlled\n\t\t) {\n\t\t\tcommittedIndex = controlledValue;\n\t\t}\n\t\tlastSeenControlled = controlledValue;\n\t\tconst currentIndex = committedIndex;\n\t\tconst minIndex = getMinListIndex(list, disabledInput);\n\t\tconst maxIndex = getMaxListIndex(list, disabledInput);\n\n\t\tconst nextIndex = computeNextIndex(\n\t\t\tevent,\n\t\t\tcurrentIndex,\n\t\t\tlist,\n\t\t\tdisabledInput,\n\t\t\tminIndex,\n\t\t\tmaxIndex,\n\t\t\tenableHomeEnd,\n\t\t\tloopFocus,\n\t\t\tkeys,\n\t\t);\n\n\t\tif (\n\t\t\tnextIndex !== currentIndex &&\n\t\t\t!isIndexOutOfListBounds(list, nextIndex)\n\t\t) {\n\t\t\tif (stopEventPropagation) event.stopPropagation();\n\t\t\tif (keys.preventedKeys.has(event.key)) event.preventDefault();\n\t\t\tonHighlightedIndexChange(nextIndex, true);\n\n\t\t\t// Defer focus until after the flush completes — matches React's\n\t\t\t// `queueMicrotask` placement so any concurrent focus-manager work\n\t\t\t// (e.g. `returnFocus`) has already settled.\n\t\t\tqueueMicrotask(() => {\n\t\t\t\telementsRef[nextIndex]?.focus();\n\t\t\t});\n\t\t}\n\t};\n\n\tconst handleFocus = (event: FocusEvent): void => {\n\t\tconst root = rootEl();\n\t\tconst target = event.target;\n\t\tif (!root || target == null || !isNativeInput(target)) return;\n\t\tconst input = target as HTMLInputElement | HTMLTextAreaElement;\n\t\tinput.setSelectionRange(0, input.value?.length ?? 0);\n\t};\n\n\tconst orientationAttr = (): \"horizontal\" | \"vertical\" | undefined => {\n\t\tconst o = params.orientation ?? \"both\";\n\t\treturn o === \"both\" ? undefined : o;\n\t};\n\n\tconst props = {\n\t\tget \"aria-orientation\"(): \"horizontal\" | \"vertical\" | undefined {\n\t\t\treturn orientationAttr();\n\t\t},\n\t\tonFocus: handleFocus,\n\t\tonKeyDown: handleKeyDown,\n\t};\n\n\treturn {\n\t\tprops,\n\t\thighlightedIndex,\n\t\tonHighlightedIndexChange,\n\t\telementsRef,\n\t\trootRef,\n\t\tonMapChange,\n\t\trelayKeyboardEvent: handleKeyDown,\n\t};\n}\n\nfunction isModifierKeySet(\n\tevent: KeyboardEvent,\n\tignoredModifierKeys: readonly ModifierKey[],\n): boolean {\n\tfor (const key of MODIFIER_KEYS.values()) {\n\t\tif (ignoredModifierKeys.includes(key)) continue;\n\t\tif (event.getModifierState(key)) return true;\n\t}\n\treturn false;\n}\n\ninterface DirectionalKeys {\n\t/** Single key (per orientation) that moves the highlight forward. */\n\tforwardKey: string;\n\t/** Single key (per orientation) that moves the highlight backward. */\n\tbackwardKey: string;\n\t/** All keys that move forward (`both` orientation has two). */\n\tforwardKeys: readonly string[];\n\t/** All keys that move backward (`both` orientation has two). */\n\tbackwardKeys: readonly string[];\n\t/** Keys whose default action should be prevented when handled. */\n\tpreventedKeys: ReadonlySet<string>;\n}\n\n// Resolve the orientation/rtl-aware key sets used to drive navigation. Pulled\n// out of the handler so the (otherwise dense) lookup tables read as data.\nfunction resolveDirectionalKeys(\n\torientation: CompositeOrientation,\n\tisRtl: boolean,\n\tenableHomeEnd: boolean,\n\trelevantKeys: ReadonlySet<string>,\n): DirectionalKeys {\n\tconst horizontalForwardKey = isRtl ? ARROW_LEFT : ARROW_RIGHT;\n\tconst horizontalBackwardKey = isRtl ? ARROW_RIGHT : ARROW_LEFT;\n\treturn {\n\t\tforwardKey: {\n\t\t\thorizontal: horizontalForwardKey,\n\t\t\tvertical: ARROW_DOWN,\n\t\t\tboth: horizontalForwardKey,\n\t\t}[orientation],\n\t\tbackwardKey: {\n\t\t\thorizontal: horizontalBackwardKey,\n\t\t\tvertical: ARROW_UP,\n\t\t\tboth: horizontalBackwardKey,\n\t\t}[orientation],\n\t\tforwardKeys: {\n\t\t\thorizontal: [horizontalForwardKey],\n\t\t\tvertical: [ARROW_DOWN],\n\t\t\tboth: [horizontalForwardKey, ARROW_DOWN],\n\t\t}[orientation],\n\t\tbackwardKeys: {\n\t\t\thorizontal: [horizontalBackwardKey],\n\t\t\tvertical: [ARROW_UP],\n\t\t\tboth: [horizontalBackwardKey, ARROW_UP],\n\t\t}[orientation],\n\t\tpreventedKeys: {\n\t\t\thorizontal: enableHomeEnd\n\t\t\t\t? HORIZONTAL_KEYS_WITH_EXTRA_KEYS\n\t\t\t\t: HORIZONTAL_KEYS,\n\t\t\tvertical: enableHomeEnd ? VERTICAL_KEYS_WITH_EXTRA_KEYS : VERTICAL_KEYS,\n\t\t\tboth: relevantKeys,\n\t\t}[orientation],\n\t};\n}\n\n// Textbox bailout: when the event originated in a native input, arrow keys\n// should defer to the input unless the caret sits at the extent in the travel\n// direction. Returns `true` when the composite handler should stand down.\nfunction shouldDeferToNativeInput(\n\tevent: KeyboardEvent,\n\ttarget: EventTarget | null,\n\tforwardKey: string,\n\tbackwardKey: string,\n): boolean {\n\tif (!isNativeInput(target) || isElementDisabled(target)) return false;\n\tconst input = target as HTMLInputElement | HTMLTextAreaElement;\n\tconst selectionStart = input.selectionStart;\n\tconst selectionEnd = input.selectionEnd;\n\tconst textContent = input.value ?? \"\";\n\tif (\n\t\tselectionStart == null ||\n\t\tevent.shiftKey ||\n\t\tselectionStart !== selectionEnd\n\t) {\n\t\treturn true;\n\t}\n\tif (event.key !== backwardKey && selectionStart < textContent.length) {\n\t\treturn true;\n\t}\n\tif (event.key !== forwardKey && selectionStart > 0) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n// The next-index math: Home/End jumps, edge looping, and the find-next-enabled\n// scan. Returns the index the highlight should move to (possibly unchanged).\nfunction computeNextIndex(\n\tevent: KeyboardEvent,\n\tcurrentIndex: number,\n\tlist: ElementList,\n\tdisabledInput: DisabledIndices | undefined,\n\tminIndex: number,\n\tmaxIndex: number,\n\tenableHomeEnd: boolean,\n\tloopFocus: boolean,\n\tkeys: DirectionalKeys,\n): number {\n\tlet nextIndex = currentIndex;\n\n\tif (enableHomeEnd) {\n\t\tif (event.key === HOME) nextIndex = minIndex;\n\t\telse if (event.key === END) nextIndex = maxIndex;\n\t}\n\n\tconst isForward = keys.forwardKeys.includes(event.key);\n\tconst isBackward = keys.backwardKeys.includes(event.key);\n\tif (nextIndex === currentIndex && (isForward || isBackward)) {\n\t\tif (loopFocus && nextIndex === maxIndex && isForward) {\n\t\t\tnextIndex = minIndex;\n\t\t} else if (loopFocus && nextIndex === minIndex && isBackward) {\n\t\t\tnextIndex = maxIndex;\n\t\t} else {\n\t\t\tnextIndex = findNonDisabledListIndex(list, {\n\t\t\t\tstartingIndex: nextIndex,\n\t\t\t\tdecrement: isBackward,\n\t\t\t\tdisabledIndices: disabledInput,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn nextIndex;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,EAAEC,OAAO,QAAQ,UAAU;AAChD,SACCC,qBAAqB,EACrBC,QAAQ,EACRC,UAAU,EACVC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,QAAQ,EAERC,GAAG,EACHC,IAAI,EACJC,eAAe,EACfC,+BAA+B,EAC/BC,aAAa,EAGbC,aAAa,EACbC,6BAA6B,QACvB,uBAAuB;AAE9B,SAGCC,wBAAwB,EACxBC,eAAe,EACfC,eAAe,EACfC,iBAAiB,EACjBC,sBAAsB,E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