{"version":3,"sources":["../../../src/client/components/client-segment.tsx"],"sourcesContent":["'use client'\n\nimport type { Params } from '../../server/request/params'\nimport { LayoutRouterContext } from '../../shared/lib/app-router-context.shared-runtime'\nimport { use } from 'react'\nimport { createClientParams } from './client-boundary-params'\n\n/**\n * When the Page is a client component we send the params to this client wrapper\n * where they are turned into dynamically tracked values before being passed to the actual Segment component.\n *\n * additionally we may send a promise representing params. We don't ever use this passed\n * value but it can be necessary for the sender to send a Promise that doesn't resolve in certain situations\n * such as when cacheComponents is enabled. It is up to the caller to decide if the promises are needed.\n */\nexport function ClientSegmentRoot({\n  Component,\n  slots,\n  serverProvidedParams,\n}: {\n  Component: React.ComponentType<any>\n  slots: { [key: string]: React.ReactNode }\n  serverProvidedParams: null | {\n    params: Params\n    promises: Array<Promise<any>> | null\n  }\n}) {\n  let params: Params\n  if (serverProvidedParams !== null) {\n    params = serverProvidedParams.params\n  } else {\n    // When Cache Components is enabled, the server does not pass the params\n    // as props; they are parsed on the client and passed via context.\n    const layoutRouterContext = use(LayoutRouterContext)\n    params =\n      layoutRouterContext !== null ? layoutRouterContext.parentParams : {}\n  }\n\n  const clientParams = createClientParams(params)\n\n  return <Component {...slots} params={clientParams} />\n}\n"],"names":["ClientSegmentRoot","Component","slots","serverProvidedParams","params","layoutRouterContext","use","LayoutRouterContext","parentParams","clientParams","createClientParams"],"mappings":"AAAA;;;;;+BAegBA;;;eAAAA;;;;+CAZoB;uBAChB;sCACe;AAU5B,SAASA,kBAAkB,EAChCC,SAAS,EACTC,KAAK,EACLC,oBAAoB,EAQrB;IACC,IAAIC;IACJ,IAAID,yBAAyB,MAAM;QACjCC,SAASD,qBAAqBC,MAAM;IACtC,OAAO;QACL,wEAAwE;QACxE,kEAAkE;QAClE,MAAMC,sBAAsBC,IAAAA,UAAG,EAACC,kDAAmB;QACnDH,SACEC,wBAAwB,OAAOA,oBAAoBG,YAAY,GAAG,CAAC;IACvE;IAEA,MAAMC,eAAeC,IAAAA,wCAAkB,EAACN;IAExC,qBAAO,qBAACH;QAAW,GAAGC,KAAK;QAAEE,QAAQK;;AACvC","ignoreList":[0]}