{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-FCUTPPX5.cjs","../src/embed-shims/next-link.tsx"],"names":[],"mappings":"AAAA,ylBAAY;AACZ;AACA;ACoBA,8BAAoG;AAqCzF,+CAAA;AApBX,IAAI,KAAA,EAA8B,IAAA;AAM3B,SAAS,YAAA,CAAgB,SAAA,EAAmC;AAKjE,EAAA,KAAA,EAAO,SAAA;AACT;AAEA,IAAM,KAAA,EAAO,+BAAA,SAAkD,YAAA,CAAa,KAAA,EAAO,GAAA,EAAK;AAItF,EAAA,GAAA,CAAI,IAAA,EAAM;AACR,IAAA,MAAM,KAAA,EAAO,IAAA;AACb,IAAA,uBAAO,6BAAA,IAAC,EAAA,EAAK,GAAA,EAAW,GAAG,MAAA,CAAO,CAAA;AAAA,EACpC;AAIA,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA,EAAU,SAAA;AAAA,IACV,OAAA,EAAS,QAAA;AAAA,IACT,MAAA,EAAQ,OAAA;AAAA,IACR,OAAA,EAAS,QAAA;AAAA,IACT,QAAA,EAAU,SAAA;AAAA,IACV,cAAA,EAAgB,eAAA;AAAA,IAChB,MAAA,EAAQ,OAAA;AAAA,IACR,GAAG;AAAA,EACL,EAAA,EAAI,KAAA;AACJ,EAAA,MAAM,QAAA,EAAU,OAAO,KAAA,IAAS,SAAA,EAAW,KAAA,kBAAO,IAAA,2BAAM,WAAA,EAAW,IAAA,CAAK,SAAA,EAAW,KAAA,CAAA;AACnF,EAAA,uBACE,6BAAA,GAAC,EAAA,EAAE,GAAA,EAAU,IAAA,EAAM,OAAA,EAAU,GAAG,IAAA,EAC7B,SAAA,CACH,CAAA;AAEJ,CAAC,CAAA;AAED,IAAO,kBAAA,EAAQ,IAAA;ADtDf;AACA;AACE;AACA;AACF,mFAAC","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-FCUTPPX5.cjs","sourcesContent":[null,"/**\n * `next/link` shim — environment-aware Link component.\n *\n * Defaults to a plain `<a>` so non-Next hosts (Vite, CRA, esbuild)\n * work out of the box. Next.js hosts can opt into the REAL `next/link`\n * (with client-router prefetching) by calling {@link registerLink}\n * ONCE at app init:\n *\n *   // hub: lib/embed-shim-registration.ts\n *   import NextLink from 'next/link'\n *   import { registerLink } from '@flamingo-stack/openframe-frontend-core/embed-shims'\n *   registerLink(NextLink)\n *\n * After registration, every lib component that renders this shim\n * delegates to `NextLink` — prefetch, replace, scroll, locale, etc.\n * all work as expected. Without registration, the shim falls through\n * to the plain `<a>` path that drops Next-specific props.\n *\n * Lib internals import this shim directly (relative path); hub-side\n * code goes through the barrel (`@flamingo-stack/.../embed-shims`).\n */\n'use client';\nimport { forwardRef, type AnchorHTMLAttributes, type ComponentType, type ReactNode, type Ref } from 'react';\n\ntype LinkProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {\n  href?: string | { pathname?: string; query?: Record<string, string> };\n  prefetch?: boolean | null;\n  replace?: boolean;\n  scroll?: boolean;\n  shallow?: boolean;\n  passHref?: boolean;\n  legacyBehavior?: boolean;\n  locale?: string | false;\n  children?: ReactNode;\n};\n\n/** What the shim renders once a host has registered `next/link`. */\ntype RegisteredLink = ComponentType<LinkProps & { ref?: Ref<HTMLAnchorElement> }>;\n\nlet impl: RegisteredLink | null = null;\n\n/**\n * Register the real `next/link` so this shim delegates to it instead\n * of rendering a plain `<a>`. Call ONCE at app init in a Next.js host.\n */\nexport function registerLink<P>(component: ComponentType<P>): void {\n  // The registration contract IS the assertion: the host states that its\n  // component handles the props this shim forwards (`next/link` does). One\n  // narrow assertion here, instead of `any` on the slot and on this\n  // signature, which erased the type for every caller.\n  impl = component as RegisteredLink;\n}\n\nconst Link = forwardRef<HTMLAnchorElement, LinkProps>(function NextLinkShim(props, ref) {\n  // Real impl path — registered by the host. Hand off untouched so\n  // every Next-specific prop (prefetch, replace, scroll, locale…)\n  // reaches the real component intact.\n  if (impl) {\n    const Real = impl;\n    return <Real ref={ref} {...props} />;\n  }\n\n  // Fallback path — plain <a>. Drops Next-only props and reduces\n  // `UrlObject` href to its pathname.\n  const {\n    href,\n    children,\n    prefetch: _prefetch,\n    replace: _replace,\n    scroll: _scroll,\n    shallow: _shallow,\n    passHref: _passHref,\n    legacyBehavior: _legacyBehavior,\n    locale: _locale,\n    ...rest\n  } = props;\n  const hrefStr = typeof href === 'string' ? href : href?.pathname ? href.pathname : undefined;\n  return (\n    <a ref={ref} href={hrefStr} {...rest}>\n      {children}\n    </a>\n  );\n});\n\nexport default Link;\n"]}