{"version":3,"file":"lithent.cjs","sources":["../src/utils/universalRef.ts","../src/utils/index.ts","../src/utils/predicator.ts","../src/hook/internal/unmount.ts","../src/hook/mountCallback.ts","../src/hook/mountReadyCallback.ts","../src/hook/internal/useUpdate.ts","../src/render.ts","../src/diff.ts","../src/utils/redraw.ts","../src/utils/createWDom.ts","../src/hook/updateCallback.ts","../src/wDom.ts","../src/hook/ref.ts","../src/hook/useRenew.ts"],"sourcesContent":["import {\n  ComponentMap,\n  ComponentSubKey,\n  CompKey,\n  ComponentInfo,\n  TagFunction,\n} from '@/types';\n\nexport const wdomSymbol = Symbol.for('lithentWDomSymbol');\nexport const xmlnsRef: { value: string } = { value: '' };\nexport const compKeyRef: { value: CompKey | null } = { value: null };\nexport const needDiffRef: { value: boolean } = { value: false };\nexport const componentMap: ComponentMap = new WeakMap();\nexport const lmountComponentSet: WeakSet<Function> = new WeakSet();\nlet componentMapManualMode = false;\n\nconst setComponetRef = (compKey: CompKey, ctor?: TagFunction): void => {\n  componentMap.set(compKey, {\n    ctor,\n    vd: { value: null },\n    up: () => {},\n    upR: [],\n    upS: { value: 0 },\n    upD: [],\n    upCB: [],\n    mts: [],\n    umts: [],\n    wdCB: [], // WDom creation callback queue\n  });\n};\n\nexport const getComponentKey = (): CompKey | null => compKeyRef.value;\n\n/** The component whose setup or render is running (a WeakMap misses null). */\nexport const getCurrentComponent = () =>\n  componentMap.get(compKeyRef.value as CompKey);\n\nexport const getComponentSubInfo = <K extends ComponentSubKey>(\n  compKey: CompKey,\n  subKey: K\n): ComponentInfo[K] | null => {\n  const component = componentMap.get(compKey);\n  if (component) {\n    return component[subKey];\n  }\n  return null;\n};\n\nexport const initUpdateHookState = (compKey: CompKey): void => {\n  compKeyRef.value = compKey;\n};\n\nexport const initMountHookState = (\n  compKey: CompKey,\n  ctor?: TagFunction\n): void => {\n  compKeyRef.value = compKey;\n  setComponetRef(compKey, ctor);\n};\n\nexport const setComponentMapManualMode = (enabled: boolean): void => {\n  componentMapManualMode = enabled;\n};\n\nexport const isComponentMapManualMode = (): boolean => componentMapManualMode;\n\nexport const runUnmountEffects = (compKey: CompKey): void => {\n  const subInfo = componentMap.get(compKey);\n  if (subInfo) {\n    subInfo.umts.forEach(effect => effect());\n    subInfo.umts = [];\n  }\n};\n\nexport const disposeComponentEntry = (compKey: CompKey): void => {\n  runUnmountEffects(compKey);\n  componentMap.delete(compKey);\n};\n","import { WDom, Props } from '@/types';\n\nimport { wdomSymbol } from '@/utils/universalRef';\n\nexport const getParent = (vDom: WDom) =>\n  (vDom.getParent && vDom.getParent()) as WDom;\n\n// A separate scope keeps parent links from retaining a diff's old children.\nexport const makeParentGetter = (parent: WDom) => () => parent;\n\nexport const entries = Object.entries;\nexport const keys = Object.keys;\n\nexport const isEnumerableProp = (props: Props, key: string) =>\n  Object.prototype.propertyIsEnumerable.call(props, key);\n\n// DOM props use for...in, including inherited enumerable keys. A hidden own\n// key shadows the same name on the prototype and must not keep an old prop.\nexport const hasEnumerableProp = (props: Props, key: string): boolean => {\n  if (isEnumerableProp(props, key)) return true;\n  const prototype = Object.getPrototypeOf(props);\n  return (\n    !Object.prototype.hasOwnProperty.call(props, key) &&\n    !!prototype &&\n    hasEnumerableProp(prototype, key)\n  );\n};\n\nexport const isObject = (target: unknown): target is Record<string, unknown> =>\n  typeof target === 'object' && target !== null;\n\nexport const assign = Object.assign;\nexport const isPropType = (obj: unknown): obj is Props => {\n  return (\n    isObject(obj) &&\n    !Array.isArray(obj) &&\n    !Object.getOwnPropertySymbols(obj).includes(wdomSymbol)\n  );\n};\n","import { Fragment } from '@/wDom';\nimport {\n  WDom,\n  TagFunction,\n  TagFunctionResolver,\n  FragmentFunction,\n  WDomType,\n} from '@/types';\nimport { isObject } from '@/utils';\n\ntype WDomParam =\n  | string\n  | WDom\n  | TagFunction\n  | TagFunctionResolver\n  | FragmentFunction;\n\n/**\n * Predicator\n */\n\nconst checkSameCustomComponent = (\n  newWDom: WDom | TagFunction | TagFunctionResolver,\n  originalWDom?: WDom\n): boolean =>\n  'ctor' in newWDom\n    ? newWDom.ctor === (originalWDom && originalWDom.ctor)\n    : newWDom === (originalWDom && originalWDom.ctor);\n\n// The checks below are reached through checkSameWDomWithOriginal only: with\n// a plain node of that type (getWDomType) and an original.\nconst checkSameFragment = (newWDom: WDom, originalWDom: WDom): boolean =>\n  originalWDom.type === 'f' &&\n  // A component's node is a one-child fragment too: never update it in\n  // place as a plain fragment, or the component is never unmounted, nor\n  // update a plain fragment with one (a hoisted <Comp /> first drawn by a\n  // redraw), or it is never mounted.\n  !originalWDom.ctor &&\n  !newWDom.ctor &&\n  !!originalWDom.children &&\n  originalWDom.children.length ===\n    (newWDom.children && newWDom.children.length);\n\nconst checkSameTagElement = (newWDom: WDom, originalWDom: WDom): boolean =>\n  originalWDom.type === 'e' &&\n  originalWDom.tag === newWDom.tag &&\n  !!originalWDom.children &&\n  originalWDom.children.length ===\n    (newWDom.children && newWDom.children.length);\n\nconst checkNormalTypeElement = (newWDom: WDom, originalWDom: WDom): boolean =>\n  originalWDom.type === newWDom.type;\n\nconst checkLoopTypeElement = (newWDom: WDom, originalWDom: WDom): boolean =>\n  originalWDom.type === newWDom.type &&\n  ((checkKeyedChildren(newWDom) && checkKeyedChildren(originalWDom)) ||\n    (!!originalWDom.children &&\n      originalWDom.children.length ===\n        (newWDom.children && newWDom.children.length)));\n\nexport const getKey = (target: WDom) =>\n  (target && target.compProps && target.compProps.key) ??\n  (target && target.props && target.props.key);\n\n/**\n * Check if the type is virtual (fragment or loop)\n * Virtual types don't create real DOM elements themselves\n */\nexport const checkVirtualType = (\n  type?: string | null // 'f': fragment, 'l': loop\n) => type === 'f' || type === 'l';\n\nexport const checkCustemComponentFunction = (\n  target: WDomParam\n): target is TagFunction | TagFunctionResolver =>\n  (typeof target === 'function' && !checkFragmentFunction(target)) ||\n  (isObject(target) && 'resolve' in target);\n\nexport const checkFragmentFunction = (\n  target: unknown\n): target is FragmentFunction => target === Fragment;\n\n// A diffed node (resolved already): empty when it has no type.\nexport const checkEmptyElement = (wDom: WDom) => !wDom.type;\n\n// Whether the node's element is a portal target, which lies outside the\n// parent the portal sits in: a portal's own element, or the one a node\n// replacing or deleting a portal still holds, with that portal's props (op),\n// until it is drawn.\nexport const checkPortalElement = ({ el, op, props }: WDom) =>\n  !!el && (el === (op && op.portal) || el === (props && props.portal));\n\nexport const checkEventKey = (key: string) => key[0] === 'o' && key[1] === 'n';\n\nexport const checkExistyKey = (target: WDom) => checkExisty(getKey(target));\n\n// A list is keyed when any child has a key: a leading null or false (a hidden\n// row) must not turn key matching off for the rest.\nexport const checkKeyedChildren = (target?: WDom) =>\n  !!target && !!target.children && target.children.some(checkExistyKey);\n\nexport const checkExisty = (value: unknown) =>\n  value !== null && value !== undefined;\n\nexport const checkStyleData = (\n  dataKey: string,\n  dataValue: unknown\n): dataValue is Record<string, string> =>\n  dataKey === 'style' && isObject(dataValue);\n\nexport const checkRefData = (\n  dataKey: string,\n  dataValue: unknown\n): dataValue is {\n  value: HTMLElement | Element | DocumentFragment | Text | undefined;\n} => dataKey === 'ref' && isObject(dataValue);\n\n// Descriptor lookups are cached per prototype+key. Keying by prototype\n// rather than nodeName matters for custom elements: one rendered before its\n// definition is upgraded later and gets a new prototype, which must be looked\n// up again instead of reusing the \"no accessor\" answer for its tag name.\nconst accessorCache = new WeakMap<object, Map<string, boolean>>();\n\nexport const hasAccessorMethods = (target: unknown, dataKey: string) => {\n  const proto = target!.constructor.prototype;\n  let byKey = accessorCache.get(proto);\n  if (!byKey) accessorCache.set(proto, (byKey = new Map()));\n  let result = byKey.get(dataKey);\n\n  if (result === undefined) {\n    const descriptor = Object.getOwnPropertyDescriptor(proto, dataKey);\n    result = !!(descriptor && descriptor.get && descriptor.set);\n    byKey.set(dataKey, result);\n  }\n\n  return result;\n};\n\n// A custom element tag whose definition has not arrived, or whose instance\n// has not been upgraded yet: still a plain HTMLElement, with no accessors.\nexport const isPendingCustomElement = (target: unknown) =>\n  (target as Element).localName.includes('-') &&\n  (target as Element).constructor === HTMLElement;\n\n/**\n * Get WDom type as a single character code\n * 'c': component, 'f': fragment, 'e': element, 'l': loop, 't': text, 'et': empty/null\n */\nexport const getWDomType = (\n  wDom: WDom | TagFunction | TagFunctionResolver\n): WDomType =>\n  checkCustemComponentFunction(wDom)\n    ? 'c'\n    : ((wDom as WDom).type as WDomType) || 'et';\n\nexport const checkSameWDomWithOriginal = {\n  c: checkSameCustomComponent,\n  l: checkLoopTypeElement,\n  t: checkNormalTypeElement,\n  e: checkSameTagElement,\n  f: checkSameFragment,\n  et: checkNormalTypeElement,\n};\n","import { WDom, CompKey } from '@/types';\nimport { checkEventKey } from '@/utils/predicator';\nimport {\n  componentMap,\n  getCurrentComponent,\n  isComponentMapManualMode,\n  runUnmountEffects,\n} from '@/utils/universalRef';\n\nexport const unmount = (effectAction: () => void) => {\n  const comp = getCurrentComponent();\n  comp && comp.umts.push(effectAction);\n};\n\nexport const runUnmountQueueFromWDom = (newWDom: WDom) => {\n  const { compKey } = newWDom;\n\n  if (compKey) {\n    // A redraw queued before this removal still holds the node. Marking it\n    // retired makes that stale redraw a no-op instead of drawing it back in.\n    newWDom.il = true;\n    removeItem(compKey);\n  }\n  recursiveRunUnmount(newWDom);\n};\n\nconst recursiveRunUnmount = (wDom: WDom) => {\n  // A portal host belongs to the caller and survives removal. Release its\n  // handlers while leaving listeners on discarded ordinary DOM untouched.\n  if (wDom.tag === 'portal' && wDom.el) {\n    for (const key in wDom.props) {\n      if (checkEventKey(key)) {\n        wDom.el.removeEventListener(\n          key.slice(2).toLowerCase(),\n          wDom.props[key] as EventListener\n        );\n      }\n    }\n  }\n  (wDom.children || []).forEach(item => {\n    const childComKey = item.compKey;\n    if (childComKey) {\n      runUnmountQueueFromWDom(item);\n    } else {\n      recursiveRunUnmount(item);\n    }\n  });\n};\n\nconst removeItem = (compKey: CompKey) => {\n  runUnmountEffects(compKey);\n\n  if (!isComponentMapManualMode()) {\n    componentMap.delete(compKey);\n  }\n};\n","import { WDom } from '@/types';\nimport {\n  compKeyRef,\n  componentMap,\n  getCurrentComponent,\n} from '@/utils/universalRef';\nimport { unmount } from '@/hook/internal/unmount';\n\nlet mountedQueue: WDom[] = [];\n\n/**\n * WDom을 mountedQueue에 추가\n */\nexport const addMountedQueue = (wDom: WDom) => {\n  if (wDom.compKey) {\n    mountedQueue.push(wDom);\n  }\n};\n\n/**\n * DOM 렌더링 후 mountCallback 실행\n */\nexport const execMountedQueue = () => {\n  mountedQueue.forEach(runMountedQueueFromWDom);\n  mountedQueue = [];\n};\n\n/**\n * mountCallback 등록\n */\nexport const mountCallback = (effectAction: () => void) => {\n  const comp = getCurrentComponent();\n  comp && comp.mts.push(effectAction);\n};\n\n/**\n * mountCallback만 실행\n */\nconst runMountedQueueFromWDom = (newWDom: WDom) => {\n  const { compKey } = newWDom;\n  // Every entry has all its queues (setComponetRef).\n  const component = compKey && componentMap.get(compKey);\n\n  if (component) {\n    const mountQueue = component.mts;\n\n    compKeyRef.value = compKey;\n    component.upS.value = 0;\n    component.mts = [];\n\n    mountQueue.forEach((effect: Function) => {\n      const callback = effect();\n      if (callback) {\n        unmount(callback);\n      }\n    });\n  }\n};\n","import { WDom } from '@/types';\nimport {\n  compKeyRef,\n  componentMap,\n  getCurrentComponent,\n} from '@/utils/universalRef';\nimport { unmount } from '@/hook/internal/unmount';\n\n/**\n * WDom이 생성된 직후(DOM 마운트 전)에 실행될 콜백 등록\n */\nexport const mountReadyCallback = (effectAction: () => void | (() => void)) => {\n  const comp = getCurrentComponent();\n  comp && comp.wdCB.push(effectAction);\n};\n\n/**\n * 특정 WDom의 wdomCallback 즉시 실행\n * wDomToDom() 내부에서 각 WDom 생성 시점에 호출됨\n */\nexport const runWDomCallbacksFromWDom = (newWDom: WDom) => {\n  const { compKey } = newWDom;\n\n  if (compKey) {\n    const component = componentMap.get(compKey);\n    const wdCBQueue = component && component.wdCB;\n\n    compKeyRef.value = compKey;\n\n    if (wdCBQueue && wdCBQueue.length > 0) {\n      component.wdCB = [];\n\n      wdCBQueue.forEach((effect: Function) => {\n        const cleanup = effect();\n        if (typeof cleanup === 'function') {\n          unmount(cleanup);\n        }\n      });\n    }\n  }\n};\n","import { WDom } from '@/types';\nimport {\n  compKeyRef,\n  componentMap,\n  getCurrentComponent,\n} from '@/utils/universalRef';\n\ntype DependencyFactory = () => unknown[];\n\nexport const useUpdated = (\n  effectAction: () => (() => void) | void,\n  dependencies: DependencyFactory = () => []\n) => {\n  const component = getCurrentComponent();\n  if (!component) return;\n\n  const { upD, upS } = component;\n  const def = upD[upS.value];\n\n  const nextDependencies = dependencies();\n\n  if (def && checkNeedPushQueue(def, nextDependencies)) {\n    const callback = effectAction();\n    if (callback) {\n      component.upCB.push(callback);\n    }\n  }\n\n  upD[upS.value] = nextDependencies;\n  upS.value += 1;\n};\n\nexport const runUpdatedQueueFromWDom = (newWDom: WDom) => {\n  const { compKey } = newWDom;\n  // Every entry has all its queues (setComponetRef).\n  const component = compKey && componentMap.get(compKey);\n\n  if (component) {\n    const queue = component.upCB;\n\n    compKeyRef.value = compKey;\n    component.upS.value = 0;\n\n    if (newWDom.ctor) {\n      component.upCB = [];\n      queue.forEach((effect: Function) => effect());\n    }\n  }\n};\n\nconst checkNeedPushQueue = (originalDefs: unknown[], newDefs: unknown[]) =>\n  !originalDefs.length\n    ? true\n    : originalDefs.some((def, index) => def !== newDefs[index]);\n","import { WDom, Props } from '@/types';\nimport {\n  checkStyleData,\n  checkRefData,\n  checkExisty,\n  checkVirtualType,\n  hasAccessorMethods,\n  isPendingCustomElement,\n  checkEventKey,\n  checkPortalElement,\n} from '@/utils/predicator';\n\nimport { componentMap, xmlnsRef } from '@/utils/universalRef';\nimport { runUnmountQueueFromWDom } from '@/hook/internal/unmount';\nimport { execMountedQueue, addMountedQueue } from '@/hook/mountCallback';\nimport { runWDomCallbacksFromWDom } from '@/hook/mountReadyCallback';\nimport { runUpdatedQueueFromWDom } from '@/hook/internal/useUpdate';\nimport {\n  getParent,\n  isObject,\n  hasEnumerableProp,\n  makeParentGetter,\n} from '@/utils';\nimport { cloneWDom } from '@/wDom';\n\nconst DF = () => new DocumentFragment();\n\n// Into the root's wrapper: before its after element, in place of <html>, or\n// at the end.\nconst insertRoot = (\n  wrapElement: HTMLElement,\n  element: Node,\n  afterElement?: HTMLElement | null\n) =>\n  afterElement\n    ? wrapElement.insertBefore(element, afterElement)\n    : wrapElement.tagName === 'HTML'\n      ? wrapElement.replaceWith(element)\n      : wrapElement.appendChild(element);\nconst CE = (t: string) => document.createElement(t);\n\nexport const render = (\n  wDom: WDom,\n  wrapElement: HTMLElement | null,\n  afterElement?: HTMLElement | null,\n  isHydration?: boolean\n) => {\n  wDom.isRoot = true;\n  wrapElement = wrapElement || document.body;\n  wDom.we = wrapElement;\n\n  const Dom = wDomToDom(wDom, isHydration);\n\n  wDom.ae = afterElement as HTMLElement;\n  if (afterElement || !isHydration) {\n    insertRoot(wrapElement, Dom, afterElement);\n  }\n\n  execMountedQueue();\n\n  return () => {\n    const compData = componentMap.get(wDom.compProps as Props);\n    const comp = (compData && compData.vd.value) || wDom;\n    runUnmountQueueFromWDom(comp);\n    rootDelete(comp);\n  };\n};\n\nconst rootDelete = (newWDom: WDom) =>\n  deleteRealDom(newWDom, newWDom.we as HTMLElement);\n\nexport const typeDelete = (newWDom: WDom) => {\n  const parentWDom = getParent(newWDom);\n  deleteRealDom(\n    newWDom,\n    (newWDom.isRoot\n      ? newWDom.we\n      : parentWDom && findRealParentElement(parentWDom)) as HTMLElement\n  );\n};\n\nconst deleteRealDom = (newWDom: WDom, parent: HTMLElement) => {\n  if (parent && newWDom.el) {\n    const nt = newWDom.el.nodeType;\n    // A portal's children are in its target, which itself stays.\n    const isPortal = checkPortalElement(newWDom);\n    if (nt === 11 || isPortal) {\n      findChildWithRemoveElement(\n        newWDom,\n        isPortal ? (newWDom.el as HTMLElement) : parent\n      );\n    } else if (nt === 1 || nt === 3) {\n      parent.removeChild(newWDom.el);\n    }\n\n    newWDom.el = undefined;\n  }\n};\n\nconst findChildWithRemoveElement = (newWDom: WDom, parent: HTMLElement) => {\n  const items = newWDom.oc || newWDom.children || [];\n\n  // Clear only when these roots, through any Fragment/component wrappers,\n  // are exactly the parent's children. Stop at the first mismatch so removing\n  // one part of a larger list never walks its remaining siblings.\n  if (items.length > 1) {\n    let next = parent.firstChild;\n    const matches = (item: WDom): boolean => {\n      const el = item.el;\n      if (!el || checkPortalElement(item)) return !el;\n      if (el.nodeType === 11) {\n        return (item.oc || item.children || []).every(matches);\n      }\n      const same = el === next && (el as HTMLElement).tagName !== 'HTML';\n      next = el.nextSibling;\n      return same;\n    };\n\n    if (items.every(matches) && !next) {\n      parent.textContent = '';\n      items.forEach(item => (item.el = undefined));\n      return;\n    }\n  }\n\n  items.forEach(item => {\n    const nt = item.el && item.el.nodeType;\n    if (checkPortalElement(item)) {\n      findChildWithRemoveElement(item, item.el as HTMLElement);\n    } else if (nt === 1 || nt === 3) {\n      const el = item.el as HTMLElement;\n      el.tagName === 'HTML' ? (el.innerHTML = '') : el.remove();\n    } else if (nt === 11) {\n      findChildWithRemoveElement(item, parent);\n    }\n  });\n};\n\n/**\n * Unmount and remove unused keyed children. Listeners are left on the\n * discarded DOM and go away with it. The parent element is found from the\n * list they were in: a child's own parent link may have been moved on by\n * the same node being drawn in another place since.\n */\nexport const typeDeleteUnused = (items: WDom[], list: WDom) => {\n  const parentElement = findRealParentElement(list) as HTMLElement;\n  items.forEach(item => {\n    runUnmountQueueFromWDom(item);\n    deleteRealDom(item, parentElement);\n  });\n};\n\nconst typeSortedReplace = (newWDom: WDom) => {\n  typeDelete(newWDom);\n  typeAdd(newWDom);\n};\n\nconst typeAdd = (\n  newWDom: WDom,\n  newElement?: HTMLElement | DocumentFragment | Text\n) => {\n  newElement = newElement || wDomToDom(newWDom);\n\n  const parentWDom = getParent(newWDom);\n  if (!parentWDom || !parentWDom.type) {\n    if (newWDom.isRoot && newWDom.we && newWDom.tag !== 'portal') {\n      insertRoot(newWDom.we, newElement, newWDom.ae);\n      execMountedQueue();\n    }\n    return;\n  }\n\n  const parentEl = findRealParentElement(parentWDom);\n  // Children added or moved inside a loop are placed by updateChildren, so\n  // anything that reaches here (e.g. a replaced fragment or component in an\n  // unkeyed loop) goes right before its own next sibling.\n  const nextEl = startFindNextBrotherElement(newWDom, parentWDom);\n\n  if (parentEl) {\n    if (newWDom.tag !== 'portal') {\n      parentEl.insertBefore(newElement, nextEl || null);\n    }\n    execMountedQueue();\n  }\n};\n\nconst getElementFromFragment = (newWDom: WDom) => {\n  if (checkVirtualType(newWDom.type)) {\n    return (newWDom.children || []).reduce((acc, item) => {\n      const element = getElementFromFragment(item);\n\n      // A portal's target does not move with its siblings.\n      if (element && !checkPortalElement(item)) {\n        acc.appendChild(element);\n      }\n      return acc;\n    }, DF());\n  }\n\n  return newWDom.el;\n};\n\nconst startFindNextBrotherElement = (\n  wDom: WDom,\n  parentWDom: WDom\n): HTMLElement | DocumentFragment | Text | undefined => {\n  const brothers = parentWDom.children || [];\n\n  // After the brothers, a fragment or loop parent goes on with its own next\n  // brother, up to the root's after element.\n  return (\n    findChildFragmentNextElement(brothers.slice(brothers.indexOf(wDom) + 1)) ||\n    (checkVirtualType(parentWDom.type)\n      ? parentWDom.isRoot\n        ? parentWDom.ae\n        : startFindNextBrotherElement(parentWDom, getParent(parentWDom))\n      : undefined)\n  );\n};\n\n// Children of a list being updated that move or are added: until its\n// placement pass they are not where they will be, so they are no anchor for\n// content inserted meanwhile. Kept here rather than as a flag on the node,\n// which would give the nodes that get it another shape.\nconst moving = new Set<WDom>();\n\nconst findChildFragmentNextElement = (\n  candidiateBrothers: WDom[]\n): HTMLElement | DocumentFragment | Text | undefined =>\n  candidiateBrothers.reduce<HTMLElement | DocumentFragment | Text | undefined>(\n    (targetEl, bItem) => {\n      // A portal's target is not in the parent: no anchor there.\n      if (\n        targetEl ||\n        checkPortalElement(bItem) ||\n        (moving.size && moving.has(bItem))\n      )\n        return targetEl;\n      const { type, el } = bItem;\n      if (type && checkVirtualType(type)) {\n        const found = findChildFragmentNextElement(bItem.children || []);\n        if (found) return found;\n      }\n      if (el && el.nodeType !== 11) return el;\n      return targetEl;\n    },\n    undefined\n  );\n\nconst typeReplace = (newWDom: WDom) => {\n  const parentWDom = getParent(newWDom);\n  const orignalElement = newWDom.el;\n\n  if (orignalElement && (parentWDom ? parentWDom.type : newWDom.isRoot)) {\n    // A portal being replaced, or replacing: one side is drawn in the\n    // portal's target, not in the parent, so delete and add instead.\n    if (\n      !parentWDom ||\n      orignalElement.nodeType === 11 ||\n      checkPortalElement(newWDom) ||\n      newWDom.tag === 'portal'\n    ) {\n      typeSortedReplace(newWDom);\n    } else {\n      const parentElement = findRealParentElement(parentWDom);\n      const newElement = wDomToDom(newWDom);\n\n      if (parentElement) {\n        parentElement.replaceChild(newElement, orignalElement);\n      }\n      execMountedQueue();\n    }\n  }\n};\n\nconst typeUpdate = (newWDom: WDom) => {\n  if (newWDom.type === 't') {\n    updateText(newWDom);\n    return;\n  }\n\n  if (newWDom.el) {\n    const { op: oldProps, props } = newWDom;\n    updateProps(props, newWDom.el, oldProps);\n\n    if (newWDom.tag === 'input') {\n      (newWDom.el as HTMLInputElement).value = String(\n        (props && props.value) || ''\n      );\n    }\n  }\n\n  updateChildren(newWDom);\n  runUpdatedQueueFromWDom(newWDom);\n};\n\n/**\n * Process child updates. Loop parents with added/moved children are handled\n * in O(n): a left-to-right content pass (keeps lifecycle order), an LIS over\n * the matched original indices (oi, recorded by the diff phase) to pick the\n * children that can stay in place, and a right-to-left placement pass that\n * inserts only added children and non-LIS moves before a running anchor.\n */\nconst updateChildren = (newWDom: WDom) => {\n  const children = newWDom.children || [];\n\n  if (\n    newWDom.type !== 'l' ||\n    !children.some(\n      item => 'ATS'.includes(item.nr as string) || item.oi !== undefined\n    )\n  ) {\n    children.forEach(wDomUpdate);\n    return;\n  }\n\n  // The matched children that keep their place: an LIS over their original\n  // indexes (oi). Worked out before the content pass, because until the\n  // placement pass a child that moves is still where it was, and so is the\n  // old element of one replaced (S): neither may be the anchor for content\n  // inserted meanwhile (moving), such as a kept row whose fragment changed.\n  // An added child needs no such care: it has no element before the content\n  // pass reaches it, and anchors are looked for after the child at hand.\n  // Read up front: wDomUpdate clears oi on an unkeyed child matched by\n  // position.\n  const matchedIndexes: number[] = [];\n  const oiSeq: number[] = [];\n\n  // Replaced children, then the matched ones that move.\n  const movers: WDom[] = [];\n  let ordered = true;\n\n  children.forEach((item, index) => {\n    const oi = item.oi;\n    const nr = item.nr;\n    if (nr === 'S') {\n      movers.push(item);\n    } else if (nr !== 'A' && oi !== undefined) {\n      if (oi < oiSeq[oiSeq.length - 1]) {\n        ordered = false;\n      }\n      matchedIndexes.push(index);\n      oiSeq.push(oi);\n    }\n  });\n\n  // keep[i]: whether matched child i stays (unset when not matched).\n  // Matched children still in their original order all stay, as in a redraw\n  // that moves nothing: no LIS then. Only the children that move or are\n  // added are flagged, so a long list's children are usually untouched.\n  let keep: boolean[] | undefined;\n  if (!ordered) {\n    const lis: boolean[] = (keep = []);\n    getLisPositions(oiSeq).forEach(pos => (lis[matchedIndexes[pos]] = true));\n    matchedIndexes.forEach(\n      i => lis[i] || ((lis[i] = false), movers.push(children[i]))\n    );\n  }\n\n  // Content pass (left-to-right, keeps lifecycle order).\n  // Added children are created here but inserted in the placement pass.\n  const created: (HTMLElement | DocumentFragment | Text | undefined)[] = [];\n  let createdCount = 0;\n\n  movers.forEach(item => moving.add(item));\n  try {\n    children.forEach((item, index) => {\n      const nr = item.nr;\n\n      if (nr === 'A' || nr === 'S') {\n        if (nr === 'S') {\n          typeDelete(item);\n        }\n        created[index] = wDomToDom(item);\n        createdCount++;\n      } else {\n        wDomUpdate(item);\n      }\n    });\n  } finally {\n    movers.forEach(item => moving.delete(item));\n  }\n\n  const parentEl = findRealParentElement(newWDom);\n  const baseAnchor = newWDom.isRoot\n    ? newWDom.ae\n    : startFindNextBrotherElement(newWDom, getParent(newWDom));\n\n  // Fast-append the trailing run of added children in order\n  // (a null anchor makes insertBefore behave as appendChild).\n  let tail = children.length;\n  while (tail > 0 && created[tail - 1] !== undefined) {\n    tail--;\n  }\n\n  for (let i = tail; i < children.length; i++) {\n    const el = created[i];\n\n    if (el && parentEl && children[i].tag !== 'portal') {\n      parentEl.insertBefore(el, baseAnchor || null);\n    }\n  }\n\n  if (keep || createdCount > children.length - tail) {\n    // Placement pass (right-to-left): insert added children and non-LIS\n    // moves before a running anchor.\n    let anchor =\n      findChildFragmentNextElement(children.slice(tail)) || baseAnchor;\n\n    for (let i = tail - 1; i >= 0; i--) {\n      const item = children[i];\n      const isNew = created[i] !== undefined;\n      const needMove = !!keep && keep[i] === false;\n\n      if ((isNew || needMove) && parentEl && item.tag !== 'portal') {\n        const el = isNew ? created[i] : getElementFromFragment(item);\n\n        if (el) {\n          parentEl.insertBefore(el, anchor || null);\n        }\n      }\n\n      const first = findChildFragmentNextElement([item]);\n      if (first) {\n        anchor = first;\n      }\n    }\n  }\n\n  children.forEach(clearDiffMeta);\n  execMountedQueue();\n};\n\n// Assigned, not deleted: `delete` changes the object's shape, which makes\n// every later access to the node slower. nr goes back to 'N' (nothing to\n// do), not undefined: a node that has it is drawn (see makeNewWDomTree).\nconst clearDiffMeta = (item: WDom) => {\n  item.oi = item.oc = item.op = undefined;\n  item.nr = 'N';\n};\n\n/**\n * Longest increasing subsequence positions (binary search, O(n log n)).\n * Returns the positions in seq that form the LIS.\n */\nconst getLisPositions = (seq: number[]) => {\n  // tails[k]: the position ending the smallest-tailed increasing run of\n  // length k + 1. A value larger than the last tail just extends it.\n  const tails: number[] = [];\n  const prev: number[] = [];\n\n  seq.forEach((value, i) => {\n    let lo = 0;\n    let hi = tails.length;\n\n    if (hi && seq[tails[hi - 1]] < value) {\n      lo = hi;\n    } else {\n      while (lo < hi) {\n        const mid = (lo + hi) >> 1;\n        if (seq[tails[mid]] < value) {\n          lo = mid + 1;\n        } else {\n          hi = mid;\n        }\n      }\n    }\n\n    prev[i] = lo ? tails[lo - 1] : -1;\n    tails[lo] = i;\n  });\n\n  let i = tails.length;\n  let last = tails[i - 1];\n  while (i-- > 0) {\n    tails[i] = last;\n    last = prev[last];\n  }\n\n  return tails;\n};\n\nexport const wDomUpdate = (newWDomTree: WDom) => {\n  const { nr: needRerender } = newWDomTree;\n\n  if (needRerender && needRerender !== 'N') {\n    renderHandlers[needRerender](newWDomTree);\n    clearDiffMeta(newWDomTree);\n  }\n};\n\nconst renderHandlers = {\n  A: typeAdd,\n  D: typeDelete,\n  R: typeReplace,\n  U: typeUpdate,\n  S: typeSortedReplace,\n  // A keyed item reaches here only as a component redrawing itself: it has\n  // not moved, so it is updated in place. Re-inserting its nodes would blur a\n  // focused input inside it or reload an iframe. Moves within a list are\n  // placed by updateChildren.\n  T: typeUpdate,\n} as const;\n\nconst updateText = (newWDom: WDom) => {\n  if (newWDom.el) {\n    newWDom.el.nodeValue = String(newWDom.text);\n  }\n};\n\nconst updateProps = (\n  props?: Props,\n  element?: HTMLElement | Element | DocumentFragment | Text,\n  oldProps?: Props | null\n) => {\n  const originalProps = oldProps || {};\n\n  for (const dataKey in props) {\n    const dataValue: unknown = props[dataKey];\n\n    if (dataValue === originalProps[dataKey]) {\n      continue;\n    }\n\n    // An event key starts with \"on\", so it is none of the keys below.\n    if (checkEventKey(dataKey)) {\n      updateEvent(\n        element as HTMLElement,\n        dataKey,\n        dataValue as (e: Event) => void,\n        originalProps[dataKey] as (e: Event) => void\n      );\n    } else {\n      if (dataKey === 'key') {\n        // Do nothing\n      } else if (dataKey === 'portal' && isObject(dataValue)) {\n        // Do nothing\n      } else if (dataKey === 'innerHTML' && typeof dataValue === 'string') {\n        (element as HTMLElement).innerHTML = dataValue;\n      } else if (checkStyleData(dataKey, dataValue)) {\n        updateStyle(\n          dataValue,\n          checkStyleData(dataKey, originalProps.style)\n            ? originalProps.style\n            : {},\n          element\n        );\n      } else if (checkRefData(dataKey, dataValue)) {\n        dataValue.value = element;\n      } else if (dataKey) {\n        if (dataKey !== 'type' && hasAccessorMethods(element, dataKey)) {\n          (element as HTMLElement & Record<string, unknown>)[dataKey] =\n            dataValue;\n        } else {\n          setAttr(\n            dataKey === 'className' ? 'class' : dataKey,\n            element as HTMLElement,\n            dataValue as string\n          );\n          // Keep the real value too: once defined, the element absorbs own\n          // properties through its accessors, so an object or `false` is not\n          // left as the attribute string (B-3).\n          // Only keys HTMLElement lacks: `textContent` or `offsetWidth` would\n          // run a DOM setter or throw.\n          if (\n            isPendingCustomElement(element) &&\n            !(dataKey in HTMLElement.prototype)\n          ) {\n            (element as HTMLElement & Record<string, unknown>)[dataKey] =\n              dataValue;\n          }\n        }\n      }\n    }\n  }\n\n  // Props that are gone. The previous props object is left as it was: it may\n  // be the caller's own object.\n  for (const dataKey in originalProps) {\n    if (props && hasEnumerableProp(props, dataKey)) {\n      continue;\n    }\n\n    if (checkEventKey(dataKey)) {\n      updateEvent(\n        element as HTMLElement,\n        dataKey,\n        undefined,\n        originalProps[dataKey] as (e: Event) => void\n      );\n      continue;\n    }\n\n    (element as HTMLElement).removeAttribute(dataKey);\n    // A prop that went in as a custom element property is unset there too\n    // (B-4). Not upgraded yet: drop the value kept for it (B-3); `delete`\n    // never touches an inherited DOM property such as `title`. Upgraded:\n    // only through the element's own accessors, never built-in ones such as\n    // input.value, where `undefined` would read as \"undefined\".\n    if (isPendingCustomElement(element)) {\n      delete (element as HTMLElement & Record<string, unknown>)[dataKey];\n    } else if (\n      (element as Element).localName.includes('-') &&\n      hasAccessorMethods(element, dataKey)\n    ) {\n      (element as HTMLElement & Record<string, unknown>)[dataKey] = undefined;\n    }\n  }\n};\n\nconst setAttr = (k: string, el: HTMLElement, v: string) =>\n  xmlnsRef.value && k !== 'xmlns'\n    ? el.setAttributeNS(null, k, v)\n    : el.setAttribute(k, v);\n\nconst wDomToDom = (wDom: WDom, isHydration?: boolean): HTMLElement => {\n  let element;\n  const { type, tag, text, props, children = [] } = wDom;\n  const isVirtualType = checkVirtualType(type);\n\n  runWDomCallbacksFromWDom(wDom);\n\n  if (tag === 'svg') {\n    xmlnsRef.value = String(props && props.xmlns);\n  }\n\n  if (!isHydration) {\n    if (!type || isVirtualType) {\n      element = DF();\n    } else if (type === 'e' && tag) {\n      // element\n      if (tag === 'portal' && props && props.portal) {\n        element = props.portal as HTMLElement;\n      } else {\n        element = xmlnsRef.value\n          ? document.createElementNS(xmlnsRef.value, tag)\n          : CE(tag);\n      }\n    } else if (type === 't' && checkExisty(text)) {\n      // text node\n      element = document.createTextNode(String(text));\n    } else {\n      throw Error('Invalid wDom');\n    }\n\n    wDom.el = element as HTMLElement;\n  } else {\n    element = wDom.el;\n  }\n\n  wDomChildrenToDom(wDom, children, element, isHydration);\n\n  updateProps(props, element, null);\n\n  addMountedQueue(wDom);\n\n  if (tag === 'svg') {\n    xmlnsRef.value = '';\n  }\n\n  return element as HTMLElement;\n};\n\nconst wDomChildrenToDom = (\n  wDom: WDom,\n  children: WDom[],\n  parentElement?: HTMLElement | Element | DocumentFragment | Text,\n  isHydration?: boolean\n) => {\n  // The parent is not attached to the document yet, so children can be\n  // appended directly (no intermediate fragment allocation).\n  const getParent = makeParentGetter(wDom);\n  children.forEach((childItem: WDom, index: number) => {\n    // A child already drawn elsewhere (nr 'N': the same node twice, a\n    // hoisted constant in several components) is drawn here as its own copy.\n    // The children of an added subtree come from a diff, which copied those\n    // already (nr 'A'). Drawn, the child gets nr 'N' (see makeNewWDomTree).\n    if (childItem.nr === 'N' && !isHydration) {\n      const copy = cloneWDom(childItem);\n      childItem = children[index] = 'resolve' in copy ? copy.resolve() : copy;\n    }\n    // h() may have assigned a shared node to a later parent already. The\n    // first occurrence needs its actual owner too, not only the copies.\n    childItem.getParent = getParent;\n    childItem.nr = 'N';\n    if (childItem.type) {\n      const childElement = wDomToDom(childItem, isHydration);\n      if (childItem.tag !== 'portal' && !isHydration && parentElement) {\n        parentElement.appendChild(childElement);\n      }\n    }\n  });\n};\n\nconst updateEvent = (\n  element: HTMLElement,\n  eventKey: string,\n  newEventHandler: ((e: Event) => void) | undefined,\n  oldEventHandler: (e: Event) => void\n) => {\n  const eventName = eventKey.slice(2).toLowerCase();\n\n  if (oldEventHandler !== newEventHandler) {\n    if (oldEventHandler) {\n      element.removeEventListener(eventName, oldEventHandler);\n    }\n\n    if (newEventHandler) {\n      element.addEventListener(eventName, newEventHandler);\n    }\n  }\n};\n\nconst updateStyle = (\n  style: Record<string, string>,\n  oldStyle: Record<string, string>,\n  element?: HTMLElement | Element | DocumentFragment | Text\n) => {\n  const orig = { ...oldStyle };\n  if (!(element instanceof HTMLElement)) return;\n\n  const styleProxy = element.style as unknown as Record<string, string>;\n\n  for (const k in style) {\n    styleProxy[k] = style[k];\n    delete orig[k];\n  }\n\n  for (const k in orig) {\n    styleProxy[k] = '';\n  }\n};\n\nconst findRealParentElement = (\n  vDom: WDom\n): HTMLElement | DocumentFragment | Text | undefined =>\n  checkVirtualType(vDom.type)\n    ? vDom.isRoot\n      ? vDom.we\n      : findRealParentElement(getParent(vDom) as WDom)\n    : (vDom.el as HTMLElement);\n","import { WDom, TagFunctionResolver, RenderType, Props } from '@/types';\nimport { checkCustemComponentFunction, getKey } from '@/utils/predicator';\nimport { getParent, makeParentGetter } from '@/utils';\nimport { typeDeleteUnused } from '@/render';\nimport { cloneWDom, copyResolver } from '@/wDom';\nimport {\n  checkEmptyElement,\n  checkSameWDomWithOriginal,\n  getWDomType,\n  checkExistyKey,\n  checkExisty,\n  checkKeyedChildren,\n} from '@/utils/predicator';\n\nimport { runUnmountQueueFromWDom } from '@/hook/internal/unmount';\nimport { keys, isEnumerableProp } from '@/utils';\n\n/**\n * The starting point of the diffing process between the original virtual DOM and the new virtual DOM for re-rendering.\n */\nexport const makeNewWDomTree = (\n  newWDom: WDom | TagFunctionResolver,\n  originalWDom?: WDom\n) => {\n  // Already drawn or taken by a diff (it has nr, 'N' once drawn): the node\n  // belongs to another place, so this place draws a copy. The same node in the same place is still left\n  // alone as unchanged. A component made without a diff and not drawn yet\n  // (in a new component's output, or a hoisted <Comp />) is drawn as it is:\n  // a copy would be a second instance, leaving the one already set up behind.\n  if (newWDom !== originalWDom && (newWDom as WDom).nr) {\n    newWDom = cloneWDom(newWDom as WDom);\n  }\n\n  return remakeNewWDom(\n    newWDom,\n    !!originalWDom &&\n      checkSameWDomWithOriginal[getWDomType(newWDom)](newWDom, originalWDom),\n    originalWDom\n  );\n};\n\n/**\n * Create a new virtual DOM after comparing with the previous virtual DOM\n */\nconst remakeNewWDom = (\n  newWDom: WDom | TagFunctionResolver,\n  isSameType: boolean,\n  originalWDom?: WDom\n) => {\n  const remakeWDom = generalize(newWDom, isSameType, originalWDom);\n  const needRerender = addReRenderTypeProperty(\n    remakeWDom,\n    isSameType,\n    originalWDom\n  );\n  const isNoting = needRerender === 'N';\n\n  if (!isNoting) {\n    remakeWDom.children = remakeChildrenForDiff(\n      remakeWDom,\n      isSameType,\n      originalWDom\n    );\n  }\n\n  // NOTE: short-key metadata (nr = needRerender) keeps bundle size down\n  remakeWDom.nr = needRerender;\n  inheritPropForRender(remakeWDom, originalWDom, needRerender);\n\n  // A retired node keeps its children: it may be a hoisted constant the\n  // caller draws again later, which is then copied from them. A component's\n  // node is copied from its description instead (cloneWDom), so it lets go\n  // of its previous output: otherwise every row a list redraws keeps its old\n  // subtree reachable, for the GC to copy, until the whole redraw is done.\n  if (!isNoting && originalWDom) {\n    originalWDom.il = true;\n    if (originalWDom.ctor) {\n      originalWDom.children = undefined;\n    }\n  }\n  return remakeWDom;\n};\n\n/**\n * Handle what the new virtual DOM should inherit or reconcile from the original virtual DOM.\n */\nconst inheritPropForRender = (\n  remakeWDom: WDom,\n  originalWDom?: WDom,\n  needRerender?: RenderType\n) => {\n  if (needRerender !== 'A' && originalWDom) {\n    remakeWDom.el = originalWDom.el;\n  }\n\n  if (needRerender === 'D' || needRerender === 'R' || needRerender === 'S') {\n    if (originalWDom) {\n      runUnmountQueueFromWDom(originalWDom);\n    }\n    remakeWDom.oc = originalWDom && originalWDom.children;\n  }\n\n  remakeWDom.op = originalWDom && originalWDom.props;\n};\n\n/**\n * Determine the render operation type (Add/Delete/Replace/Update/etc)\n * based on comparison between new and original WDom\n */\nconst addReRenderTypeProperty = (\n  newWDom: WDom,\n  isSameType: boolean,\n  originalWDom?: WDom\n): RenderType | undefined => {\n  if (checkEmptyElement(newWDom)) return 'D';\n\n  if (\n    newWDom === originalWDom ||\n    (isSameType &&\n      newWDom.type === 't' &&\n      newWDom.text === (originalWDom as WDom).text)\n  ) {\n    return 'N';\n  }\n  if (!(originalWDom && originalWDom.type)) return 'A';\n\n  const parent = getParent(originalWDom);\n  const isKeyChecked =\n    !newWDom.isRoot && parent && parent.type === 'l' && checkExistyKey(newWDom);\n\n  return isSameType ? (isKeyChecked ? 'T' : 'U') : isKeyChecked ? 'S' : 'R';\n};\n\n/**\n * Handling virtual DOM attribute updates.\n */\nconst syncResolverProps = (props: Props, infoProps: Props) => {\n  if (props && infoProps !== props) {\n    // Only the keys that are gone: deleting and re-adding every key on every\n    // render changes the object's shape each time.\n    infoProps = infoProps || {};\n    keys(props).forEach(\n      key => isEnumerableProp(infoProps, key) || delete props[key]\n    );\n    keys(infoProps).forEach(key => (props[key] = infoProps[key]));\n  }\n};\n\n/**\n * Keep the existing component node while injecting the props/children from the freshly computed TagFunctionResolver.\n * originalWDom is the fully evaluated node from the previous render, whereas infoVdom is the intermediate resolver,\n * so updating compProps/compChild in place lets reRender() evaluate with the latest slots and props.\n * It is crucial that props and children references remain stable as nodes update—many ancestors/closures share these arrays,\n * so mutate the existing arrays instead of replacing their references.\n */\nconst runUpdate = (vDom: WDom, infoVdom: TagFunctionResolver) => {\n  const { compProps: props, compChild: children } = vDom;\n  const { props: infoProps, children: infoChidren } = infoVdom;\n\n  if (props) {\n    syncResolverProps(props, infoProps);\n  }\n\n  /**\n   * In runUpdate, the original DOM (vDom) is already fully evaluated and completed, whereas infoVdom represents an intermediate state. Therefore, vdom.compChild and infoVdom.children are indeed the correct counterparts to compare.\n\n   * Keep shared child array references intact (<= same slot array instance)\n   * When the reference changes, sync the stored compChild contents so reRender sees fresh nodes\n   * Only update children if they're different references\n   * If it's the same Fragment reference, the diff process will handle updating its children\n   */\n  if (children && infoChidren && children !== infoChidren) {\n    children.splice(0, children.length, ...infoChidren);\n  }\n\n  return (vDom.reRender && vDom.reRender()) as WDom;\n};\n\n/**\n * Replace the compared virtual DOM with the new virtual DOM or simply update it.\n */\nconst generalize = (\n  newWDom: WDom | TagFunctionResolver,\n  isSameType: boolean,\n  originalWDom?: WDom\n): WDom => {\n  return checkCustemComponentFunction(newWDom)\n    ? isSameType && originalWDom\n      ? runUpdate(originalWDom, newWDom)\n      : // Resolved before (children a component draws again somewhere else):\n        // the first instance owns its props, which are also its key, so the\n        // new instance is made from a copy.\n        (newWDom.rd\n          ? copyResolver(newWDom)\n          : ((newWDom.rd = true), newWDom)\n        ).resolve()\n    : newWDom;\n};\n\n/**\n * 자식 가상돔들도 전부 재귀처리하며 똑같은 처리를 해준다.\n */\nconst remakeChildrenForDiff = (\n  newWDom: WDom,\n  isSameType: boolean,\n  originalWDom?: WDom\n) =>\n  isSameType && originalWDom\n    ? remakeChildrenForUpdate(newWDom, originalWDom)\n    : remakeChildrenForAdd(newWDom);\n\n/**\n * Recursive handling for the creation of a new virtual DOM. Kept apart from\n * the update below: one function for both made creating 1,000 rows 6% slower.\n */\nconst remakeChildrenForAdd = (newWDom: WDom) => {\n  const getParent = makeParentGetter(newWDom);\n\n  return (newWDom.children || []).map((item: WDom) => {\n    const child = makeNewWDomTree(item);\n    child.getParent = getParent;\n    return child;\n  });\n};\n\n/**\n * Recursive handling for updates, not additions.\n * Uses key-based diffing for loops, index-based for others\n */\nconst remakeChildrenForUpdate = (newWDom: WDom, originalWDom: WDom) => {\n  if (newWDom.type === 'l' && checkKeyedChildren(newWDom)) {\n    return diffLoopChildren(newWDom, originalWDom);\n  }\n\n  const origChildren = originalWDom.children || [];\n  const getParent = makeParentGetter(newWDom);\n\n  return (newWDom.children || []).map((item: WDom, index: number) => {\n    const child = makeNewWDomTree(item, origChildren[index]);\n    child.getParent = getParent;\n    return child;\n  });\n};\n\n/**\n * Recursive handling of loop-type virtual DOM elements.\n * Matches children against the originals by key via a Map in O(n) and\n * records each match's original index (oi) for the render phase to\n * minimize moves via LIS. The originals left unmatched are deleted.\n */\nconst diffLoopChildren = (newWDom: WDom, originalWDom: WDom) => {\n  const origChildren = originalWDom.children || [];\n  const keyMap = new Map<unknown, number>();\n  origChildren.forEach((item, index) => {\n    const key = getKey(item);\n    if (checkExisty(key) && !keyMap.has(key)) {\n      keyMap.set(key, index);\n    }\n  });\n\n  const used: boolean[] = [];\n  const getParent = makeParentGetter(newWDom);\n  const remaked = (newWDom.children || []).map((item, index) => {\n    const key = getKey(item);\n    // Unkeyed items among keyed ones (a hidden row's null, a nested array)\n    // pair with the unkeyed original at the same index, as in React.\n    const origIndex = checkExisty(key)\n      ? keyMap.get(key)\n      : index < origChildren.length && !checkExistyKey(origChildren[index])\n        ? index\n        : undefined;\n    let original: WDom | undefined;\n\n    if (origIndex !== undefined) {\n      keyMap.delete(key);\n      used[origIndex] = true;\n      original = origChildren[origIndex];\n    }\n\n    const child = makeNewWDomTree(item, original);\n    if (original) {\n      child.oi = origIndex;\n    }\n    child.getParent = getParent;\n\n    return child;\n  });\n\n  // Originals left unmatched, including ones whose key was already taken\n  // (no key, or a duplicate) and so never made it into keyMap.\n  typeDeleteUnused(\n    origChildren.filter((_item, index) => !used[index]),\n    originalWDom\n  );\n\n  return remaked;\n};\n","import { Props, WDom } from '@/types';\nimport { componentMap } from '@/utils/universalRef';\n\nconst redrawQueue = new Map<Props, () => void>();\nlet redrawQueueTimeout: boolean = false;\n\nconst schedule = (compKey: Props, exec: () => void) => {\n  redrawQueue.set(compKey, exec);\n\n  if (!redrawQueueTimeout) {\n    redrawQueueTimeout = true;\n    queueMicrotask(execRedrawQueue);\n  }\n};\n\nexport const setRedrawAction = (compKey: Props, exec: () => void) => {\n  const comp = componentMap.get(compKey);\n  if (comp) {\n    comp.up = () => schedule(compKey, exec);\n  }\n};\n\n/**\n * Like setRedrawAction, but bound once per component instead of on every\n * render: the node to redraw is the component's current one when renew() is\n * called.\n */\nexport const bindRedraw = (compKey: Props, exec: (wDom: WDom) => void) => {\n  const comp = componentMap.get(compKey);\n  if (comp) {\n    comp.up = () => {\n      const wDom = comp.vd.value as WDom;\n      schedule(compKey, () => exec(wDom));\n    };\n  }\n};\n\nexport const componentUpdate = (compKey: Props) => () => {\n  const comp = componentMap.get(compKey);\n  const up = comp && comp.up;\n  if (up) {\n    up();\n    return true;\n  }\n  return false;\n};\n\n// Each entry is taken out before it runs, so a renew raised during the flush\n// (a new child's mountCallback renewing its parent) queues it again and this\n// same pass runs it. If a render throws, another microtask drains the rest\n// without requiring a new renew; the original error still propagates.\nconst execRedrawQueue = () => {\n  try {\n    redrawQueue.forEach((item: () => void, compKey: Props) => {\n      redrawQueue.delete(compKey);\n      item();\n    });\n  } finally {\n    redrawQueueTimeout = !!redrawQueue.size;\n    if (redrawQueueTimeout) queueMicrotask(execRedrawQueue);\n  }\n};\n","import type { WDom } from '@/types';\nimport { wdomSymbol } from '@/utils/universalRef';\n\n// Common hot fields share one layout; root/component metadata stays sparse.\nexport const createWDom = (\n  type: WDom['type'],\n  tag?: WDom['tag'],\n  props?: WDom['props'],\n  text?: WDom['text'],\n  children?: WDom['children'],\n  getParent?: WDom['getParent']\n): WDom => ({\n  type,\n  nr: undefined,\n  tag,\n  props,\n  text,\n  children,\n  getParent,\n  el: undefined,\n  oi: undefined,\n  oc: undefined,\n  op: undefined,\n  il: undefined,\n  [wdomSymbol]: true,\n});\n","import { getCurrentComponent } from '@/utils/universalRef';\n\nimport { useUpdated } from '@/hook/internal/useUpdate';\n\ntype DependencyFactory = () => unknown[];\n\nexport const updateCallback = (\n  effectAction: () => (() => void) | void,\n  dependencies: DependencyFactory = () => []\n) => {\n  const component = getCurrentComponent();\n  if (!component) return;\n\n  component.upR.push(() => useUpdated(effectAction, dependencies));\n  useUpdated(effectAction, dependencies);\n};\n\nexport const runUpdateCallback = () => {\n  const comp = getCurrentComponent();\n  const updateReqs = comp && comp.upR;\n\n  if (updateReqs && updateReqs.length) {\n    updateReqs.forEach(callback => callback());\n  }\n};\n","import {\n  WDom,\n  TagFunction,\n  TagFunctionResolver,\n  FragmentFunction,\n  Props,\n  MiddleStateWDomChildren,\n  MiddleStateWDom,\n  NodePointer,\n  Component,\n  LComponent,\n} from '@/types';\n\nimport { makeNewWDomTree } from '@/diff';\nimport { wDomUpdate } from '@/render';\nimport {\n  initUpdateHookState,\n  compKeyRef,\n  initMountHookState,\n  needDiffRef,\n  componentMap,\n  lmountComponentSet,\n} from '@/utils/universalRef';\nimport { bindRedraw, componentUpdate } from '@/utils/redraw';\nimport { createWDom } from '@/utils/createWDom';\nimport { runUpdateCallback } from '@/hook/updateCallback';\nimport {\n  checkFragmentFunction,\n  checkCustemComponentFunction,\n} from '@/utils/predicator';\n\n// ============================================================================\n// Public API - Highest Level (User-facing API)\n// ============================================================================\n\n/**\n * It allows grouping multiple elements together.\n */\nexport const Fragment = (_props: Props, ...children: WDom[]) =>\n  createWDom('f', undefined, undefined, undefined, children);\n\n/**\n * Element creation\n */\nexport const h = (\n  tag: TagFunction | FragmentFunction | string,\n  props: Props,\n  ...children: MiddleStateWDomChildren\n) => {\n  const nodeParentPointer: NodePointer = { value: undefined };\n  const newChildren = remakeChildren(nodeParentPointer, children);\n  const node = makeNode(tag, props || {}, newChildren);\n\n  if (!checkCustemComponentFunction(node)) {\n    nodeParentPointer.value = node;\n  }\n\n  return node;\n};\n\n/**\n * Enables portals\n */\nexport const portal = (wDom: WDom, portal: HTMLElement) =>\n  h('portal', { portal }, wDom);\n\n/**\n * It helps with component creation.\n */\nexport const mount =\n  <T>(component: Component<T>) =>\n  (_props: T, _children?: MiddleStateWDomChildren) =>\n    component;\n\n/**\n * It helps with component creation without renew parameter.\n * Use useRenew() hook to get renew function if needed.\n */\nexport const lmount =\n  <T>(component: LComponent<T>) =>\n  (_props: T, _children?: MiddleStateWDomChildren) => {\n    lmountComponentSet.add(component);\n    return component;\n  };\n\n/**\n * Maintain compChild references for upward updates (render props, slots, etc.).\n * JSX always returns a fresh children array, so when a subtree re-renders\n * bottom-up we must manually swap the old child instance out of each ancestor's\n * compChild.\n *\n * Fragment-wrapping solved this by keeping a stable wrapper node,\n * but that hides the actual child tree. We prefer this explicit sync for DX.\n *\n * In practice slot consumers rarely thread children more than a layer or two—\n * usually shallow composed pieces like dropdowns or drag-and-drop shells—so the\n * directed walk keeps DX high without introducing observable overhead.\n */\nconst syncAncestorComponentChildren = (\n  parent: WDom | undefined,\n  prevChild: WDom,\n  nextChild: WDom\n) => {\n  const walk = (node: WDom | undefined, visited: Set<WDom>): void => {\n    if (!node || visited.has(node)) {\n      return;\n    }\n\n    visited.add(node);\n\n    if (node.compChild) {\n      const childIndex = node.compChild.indexOf(prevChild);\n\n      if (childIndex !== -1) {\n        node.compChild.splice(childIndex, 1, nextChild);\n      }\n    }\n\n    walk(node.getParent ? node.getParent() : undefined, visited);\n  };\n\n  walk(parent, new Set<WDom>());\n};\n\n/**\n * It re-renders starting from a specific component.\n */\nexport const replaceWDom = (\n  tag: TagFunction,\n  props: Props,\n  children: WDom[],\n  originalWDom: WDom\n) => {\n  if (originalWDom.il) {\n    return;\n  }\n  needDiffRef.value = true;\n\n  let newWDomTree: WDom;\n  try {\n    const newWDom = makeWDomResolver(tag, props, children);\n    newWDomTree = makeNewWDomTree(newWDom, originalWDom);\n    // NOTE: we/ae are short for wrapElement/afterElement\n    const { isRoot, getParent, we, ae } = originalWDom;\n\n    newWDomTree.getParent = getParent;\n\n    if (!isRoot && getParent) {\n      const parent = getParent();\n      const brothers = (parent && parent.children) || [];\n      const index = brothers.indexOf(originalWDom);\n\n      if (index !== -1) {\n        brothers.splice(index, 1, newWDomTree);\n      }\n\n      syncAncestorComponentChildren(parent, originalWDom, newWDomTree);\n    } else {\n      newWDomTree.isRoot = true;\n      newWDomTree.we = we;\n      newWDomTree.ae = ae;\n    }\n  } finally {\n    needDiffRef.value = false;\n  }\n\n  wDomUpdate(newWDomTree);\n};\n\n// ============================================================================\n// Mid-Level - Virtual DOM Node Creation (Intermediate abstraction level)\n// ============================================================================\n\n/**\n * The starting point where the virtual DOM is created from the h function.\n */\nconst makeNode = (\n  tag: TagFunction | FragmentFunction | string,\n  props: Props,\n  children: WDom[]\n) => {\n  if (checkFragmentFunction(tag)) {\n    return Fragment(props, ...children);\n  } else if (checkCustemComponentFunction(tag)) {\n    const componetMakeResolver = makeWDomResolver(tag, props, children);\n\n    if (needDiffRef.value) {\n      return componetMakeResolver;\n    }\n\n    // Drawn right away, without a diff. Later updates sync the instance's\n    // props and children in place, so it gets copies; the node keeps the\n    // untouched description to be drawn again elsewhere (cloneWDom).\n    const node = copyResolver(componetMakeResolver).resolve();\n    node.rs = componetMakeResolver;\n    return node;\n  }\n\n  return createWDom('e', tag, props, undefined, children);\n};\n\n/**\n * The starting point for recursively processing the child virtual DOM elements.\n */\nconst remakeChildren = (\n  nodeParentPointer: NodePointer,\n  children: MiddleStateWDomChildren\n): WDom[] => {\n  // Siblings share a single getParent closure (one allocation per parent)\n  const getParent = () => nodeParentPointer.value;\n\n  return children.map((item: MiddleStateWDom) => {\n    const childItem = makeChildrenItem(item);\n    childItem.getParent = getParent;\n    return childItem;\n  });\n};\n\n/**\n * Recursively process the child virtual DOM elements.\n */\nconst makeChildrenItem = (item: MiddleStateWDom): WDom => {\n  if (item === null || item === undefined || typeof item === 'boolean') {\n    return createWDom(null);\n  } else if (Array.isArray(item)) {\n    const nodeParentPointer: NodePointer = { value: undefined };\n    const children = remakeChildren(nodeParentPointer, item);\n    const node = createWDom('l', undefined, undefined, undefined, children);\n    nodeParentPointer.value = node;\n\n    return node;\n  } else if (typeof item === 'string' || typeof item === 'number') {\n    return createWDom('t', undefined, undefined, item);\n  }\n\n  return item;\n};\n\n// ============================================================================\n// Component Lifecycle - Component Creation & Re-rendering\n// ============================================================================\n\n/**\n * Create component resolver function\n */\nconst createComponentResolver = (\n  tag: TagFunction,\n  props: Props,\n  wrappedChildren: WDom[]\n) => {\n  return (compKey = props) => {\n    // Diff mode sets needDiffRef to true so h()/makeNode return a resolver\n    // placeholder. During actual resolution we must force a real WDom tree,\n    // otherwise nested components leave only resolvers (no getParent/children)\n    // and CSR renders a blank area. Temporarily drop needDiffRef, then restore.\n    // Regression tests: src/tests/core-composedRenew.test.tsx,\n    // src/tests/core-component-remount.test.tsx\n    const prevNeedDiff = needDiffRef.value;\n    const previousKey = compKeyRef.value;\n    needDiffRef.value = false;\n    try {\n      initMountHookState(compKey, tag);\n\n      const initialComponent = tag(props, wrappedChildren);\n\n      let componentMaker: (nextProps: Props) => MiddleStateWDom;\n\n      if (typeof initialComponent === 'function') {\n        const component = initialComponent;\n        // Check if component is created with lmount (no renew parameter)\n        // TypeScript cannot infer that component is LComponent when has() returns true,\n        // because WeakSet.has() is a runtime check that doesn't narrow types.\n        // We use 'as any' since the runtime check guarantees type safety.\n        componentMaker = lmountComponentSet.has(component)\n          ? (component as any)(props, wrappedChildren)\n          : component(componentUpdate(compKey), props, wrappedChildren);\n      } else {\n        // For components that directly return a VDom, recreate it each render.\n        // The first call already rendered this stateless component. Repeating it\n        // creates orphan child instances and can register hooks under a child's key.\n        let firstRender = true;\n        componentMaker = (nextProps: Props) => {\n          if (firstRender) {\n            firstRender = false;\n            return initialComponent as MiddleStateWDom;\n          }\n          return tag(nextProps, wrappedChildren) as MiddleStateWDom;\n        };\n      }\n\n      return makeCustomNode(\n        componentMaker,\n        compKey,\n        tag,\n        props,\n        wrappedChildren\n      );\n    } finally {\n      compKeyRef.value = previousKey;\n      needDiffRef.value = prevNeedDiff;\n    }\n  };\n};\n\n/**\n * A fresh copy of a node that is already drawn somewhere: a hoisted constant,\n * children a component renders again in another place, the same node twice.\n * A node holds the state of the place it is drawn in (el, children, parent,\n * component instance), so a second place gets its own copy. A component\n * becomes a resolver for a new instance with its own props and children.\n */\nexport const cloneWDom = (wDom: WDom): WDom | TagFunctionResolver =>\n  wDom.ctor\n    ? copyResolver(\n        wDom.rs || {\n          ctor: wDom.ctor,\n          props: wDom.compProps as Props,\n          children: wDom.compChild as WDom[],\n        }\n      )\n    : createWDom(\n        wDom.type,\n        wDom.tag,\n        wDom.props,\n        wDom.text,\n        wDom.children && [...wDom.children],\n        wDom.getParent\n      );\n\nexport const copyResolver = ({\n  ctor,\n  props,\n  children,\n}: Omit<TagFunctionResolver, 'resolve'>) =>\n  makeWDomResolver(ctor as TagFunction, { ...props }, [...(children || [])]);\n\n/**\n * Create an intermediate step for diffing between the existing virtual DOM and the new one during re-rendering\n */\nconst makeWDomResolver = (\n  tag: TagFunction,\n  props: Props,\n  children: WDom[]\n) => ({\n  ctor: tag,\n  props,\n  children,\n  resolve: createComponentResolver(tag, props, children),\n});\n\n/**\n * Create the actual virtual DOM node from the component.\n */\nconst makeCustomNode = (\n  componentMaker: (props: Props) => MiddleStateWDom,\n  compKey: Props,\n  tag: TagFunction,\n  props: Props,\n  children: WDom[]\n) => {\n  const wrappedComponentMaker = wrapComponentMaker(componentMaker);\n  const customNode = wrappedComponentMaker(props);\n  const reRender = makeReRender(\n    wrappedComponentMaker,\n    compKey,\n    tag,\n    props,\n    children\n  );\n\n  addComponentProps(customNode, compKey, tag, props, children, reRender);\n  bindRedraw(compKey, wDom =>\n    replaceWDom(\n      tag,\n      (wDom.compProps as Props) || props,\n      (wDom.compChild as WDom[]) || children,\n      wDom\n    )\n  );\n  return customNode;\n};\n\n/**\n * When the virtual DOM is actually created from the component, generate a re-render method for future redraws.\n */\nconst makeReRender = (\n  componentMaker: (props: Props) => WDom,\n  compKey: Props,\n  tag: TagFunction,\n  props: Props,\n  children: WDom[]\n) => {\n  const reRender = (): WDom => {\n    const previousKey = compKeyRef.value;\n    try {\n      initUpdateHookState(compKey);\n      runUpdateCallback();\n\n      const customNode = componentMaker(props);\n      addComponentProps(customNode, compKey, tag, props, children, reRender);\n\n      return customNode;\n    } finally {\n      compKeyRef.value = previousKey;\n    }\n  };\n  return reRender;\n};\n\n// ============================================================================\n// Low-Level Utilities - Component Node Manipulation\n// ============================================================================\n\n/**\n * Wrap component output in a stable Fragment so component metadata lives on a\n * dedicated node. This prevents parent/child sharing when a component returns\n * another component and keeps updates stable even when output becomes empty.\n */\nconst wrapComponentMaker =\n  (componentMaker: (props: Props) => MiddleStateWDom) =>\n  (newProps: Props): WDom => {\n    const next = makeChildrenItem(componentMaker(newProps));\n    const wrapper = Fragment({}, next);\n    next.getParent = () => wrapper;\n    return wrapper;\n  };\n\n/**\n * When creating a custom component node, attach additional information attributes to the virtual DOM object.\n */\nconst addComponentProps = (\n  wDom: WDom,\n  compKey: Props,\n  tag: TagFunction,\n  props: Props,\n  children: WDom[],\n  reRender: () => WDom\n) => {\n  // Runs on every render of every component: plain assignments, and the\n  // redraw action is bound once in makeCustomNode.\n  wDom.compProps = props;\n  wDom.compChild = children;\n  wDom.ctor = tag;\n  wDom.compKey = compKey;\n  wDom.reRender = reRender;\n\n  const comp = componentMap.get(compKey);\n  if (comp) {\n    comp.vd.value = wDom;\n  }\n};\n","export const ref = <T>(initValue: T) => ({ value: initValue });\nexport const nextTick = () => Promise.resolve();\n","import { Renew } from '@/types';\nimport { getComponentKey } from '@/utils/universalRef';\nimport { componentUpdate } from '@/utils/redraw';\n\n/**\n * Hook to get the renew (component update) function.\n * Useful for lmount components that need to trigger updates.\n */\nexport const useRenew = (): Renew => {\n  const compKey = getComponentKey();\n\n  if (!compKey) {\n    return () => false;\n  }\n\n  return componentUpdate(compKey);\n};\n"],"names":["wdomSymbol","xmlnsRef","compKeyRef","needDiffRef","componentMap","lmountComponentSet","componentMapManualMode","setComponetRef","compKey","ctor","getComponentKey","getCurrentComponent","getComponentSubInfo","subKey","component","initUpdateHookState","initMountHookState","setComponentMapManualMode","enabled","isComponentMapManualMode","runUnmountEffects","subInfo","effect","disposeComponentEntry","getParent","vDom","makeParentGetter","parent","keys","isEnumerableProp","props","key","hasEnumerableProp","prototype","isObject","target","isPropType","obj","checkSameCustomComponent","newWDom","originalWDom","checkSameFragment","checkSameTagElement","checkNormalTypeElement","checkLoopTypeElement","checkKeyedChildren","getKey","checkVirtualType","type","checkCustemComponentFunction","checkFragmentFunction","Fragment","checkEmptyElement","wDom","checkPortalElement","el","op","checkEventKey","checkExistyKey","checkExisty","value","checkStyleData","dataKey","dataValue","checkRefData","accessorCache","hasAccessorMethods","proto","byKey","result","descriptor","isPendingCustomElement","getWDomType","checkSameWDomWithOriginal","unmount","effectAction","comp","runUnmountQueueFromWDom","removeItem","recursiveRunUnmount","item","mountedQueue","addMountedQueue","execMountedQueue","runMountedQueueFromWDom","mountCallback","mountQueue","callback","mountReadyCallback","runWDomCallbacksFromWDom","wdCBQueue","cleanup","useUpdated","dependencies","upD","upS","def","nextDependencies","checkNeedPushQueue","runUpdatedQueueFromWDom","queue","originalDefs","newDefs","index","DF","insertRoot","wrapElement","element","afterElement","CE","t","render","isHydration","Dom","wDomToDom","compData","rootDelete","deleteRealDom","typeDelete","parentWDom","findRealParentElement","nt","isPortal","findChildWithRemoveElement","items","next","matches","same","typeDeleteUnused","list","parentElement","typeSortedReplace","typeAdd","newElement","parentEl","nextEl","startFindNextBrotherElement","getElementFromFragment","acc","brothers","findChildFragmentNextElement","moving","candidiateBrothers","targetEl","bItem","found","typeReplace","orignalElement","typeUpdate","updateText","oldProps","updateProps","updateChildren","children","wDomUpdate","matchedIndexes","oiSeq","movers","ordered","oi","nr","keep","lis","getLisPositions","pos","i","created","createdCount","baseAnchor","tail","anchor","isNew","needMove","first","clearDiffMeta","seq","tails","prev","lo","hi","mid","last","newWDomTree","needRerender","renderHandlers","originalProps","updateEvent","updateStyle","setAttr","k","v","tag","text","isVirtualType","wDomChildrenToDom","childItem","copy","cloneWDom","childElement","eventKey","newEventHandler","oldEventHandler","eventName","style","oldStyle","orig","styleProxy","makeNewWDomTree","remakeNewWDom","isSameType","remakeWDom","generalize","addReRenderTypeProperty","isNoting","remakeChildrenForDiff","inheritPropForRender","isKeyChecked","syncResolverProps","infoProps","runUpdate","infoVdom","infoChidren","copyResolver","remakeChildrenForUpdate","remakeChildrenForAdd","child","diffLoopChildren","origChildren","keyMap","used","remaked","origIndex","original","_item","redrawQueue","redrawQueueTimeout","schedule","exec","execRedrawQueue","bindRedraw","componentUpdate","up","createWDom","updateCallback","runUpdateCallback","updateReqs","_props","h","nodeParentPointer","newChildren","remakeChildren","node","makeNode","portal","mount","_children","lmount","syncAncestorComponentChildren","prevChild","nextChild","walk","visited","childIndex","replaceWDom","makeWDomResolver","isRoot","we","ae","componetMakeResolver","makeChildrenItem","createComponentResolver","wrappedChildren","prevNeedDiff","previousKey","initialComponent","componentMaker","firstRender","nextProps","makeCustomNode","wrappedComponentMaker","wrapComponentMaker","customNode","reRender","makeReRender","addComponentProps","newProps","wrapper","ref","initValue","nextTick","useRenew"],"mappings":"aAQa,MAAAA,GAAa,OAAO,IAAI,mBAAmB,EAC3CC,EAA8B,CAAE,MAAO,IACvCC,EAAwC,CAAE,MAAO,MACjDC,EAAkC,CAAE,MAAO,IAC3CC,MAAiC,QACjCC,MAA4C,QACzD,IAAIC,GAAyB,GAE7B,MAAMC,GAAiB,CAACC,EAAkBC,IAA6B,CACrEL,EAAa,IAAII,EAAS,CACxB,KAAAC,EACA,GAAI,CAAE,MAAO,IAAK,EAClB,GAAI,IAAM,CAAC,EACX,IAAK,CAAC,EACN,IAAK,CAAE,MAAO,CAAE,EAChB,IAAK,CAAC,EACN,KAAM,CAAC,EACP,IAAK,CAAC,EACN,KAAM,CAAC,EACP,KAAM,CAAC,CAAA,CACR,CACH,EAEaC,GAAkB,IAAsBR,EAAW,MAGnDS,EAAsB,IACjCP,EAAa,IAAIF,EAAW,KAAgB,EAEjCU,GAAsB,CACjCJ,EACAK,IAC4B,CACtB,MAAAC,EAAYV,EAAa,IAAII,CAAO,EAC1C,OAAIM,EACKA,EAAUD,CAAM,EAElB,IACT,EAEaE,GAAuBP,GAA2B,CAC7DN,EAAW,MAAQM,CACrB,EAEaQ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