{"version":3,"file":"RouterProvider.cjs","names":["Solid","routerContext","SafeFragment","Matches","AnyRouter","RegisteredRouter","RouterOptions","RouterContext","Component","value","children","RouterContextProvider","Record","router","rest","RouterProps","TRouter","TDehydrated","JSX","Element","Object","keys","length","runWithOwner","update","options","context","OptionalWrapper","Wrap","_$createComponent","RouterProvider","_$mergeProps","Omit","NonNullable","Partial"],"sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport { routerContext } from './routerContext'\nimport { SafeFragment } from './SafeFragment'\nimport { Matches } from './Matches'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  RouterOptions,\n} from '@tanstack/router-core'\n\nconst RouterContext = routerContext as unknown as Solid.Component<{\n  value: any\n  children: any\n}>\n\nexport function RouterContextProvider<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TDehydrated extends Record<string, any> = Record<string, any>,\n>({\n  router,\n  children,\n  ...rest\n}: RouterProps<TRouter, TDehydrated> & {\n  children: () => Solid.JSX.Element\n}) {\n  if (Object.keys(rest).length > 0) {\n    Solid.runWithOwner(null, () => {\n      router.update({\n        ...router.options,\n        ...rest,\n        context: {\n          ...router.options.context,\n          ...rest.context,\n        },\n      } as any)\n    })\n  }\n\n  const OptionalWrapper = router.options.Wrap || SafeFragment\n\n  return (\n    <OptionalWrapper>\n      <RouterContext value={router as AnyRouter}>{children()}</RouterContext>\n    </OptionalWrapper>\n  )\n}\n\nexport function RouterProvider<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n  return (\n    <RouterContextProvider router={router} {...rest}>\n      {() => <Matches />}\n    </RouterContextProvider>\n  )\n}\n\nexport type RouterProps<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n  RouterOptions<\n    TRouter['routeTree'],\n    NonNullable<TRouter['options']['trailingSlash']>,\n    false,\n    TRouter['history'],\n    TDehydrated\n  >,\n  'context'\n> & {\n  router: TRouter\n  context?: Partial<\n    RouterOptions<\n      TRouter['routeTree'],\n      NonNullable<TRouter['options']['trailingSlash']>,\n      false,\n      TRouter['history'],\n      TDehydrated\n    >['context']\n  >\n}\n"],"mappings":";;;;;;;;AAUA,IAAMO,gBAAgBN,sBAAAA;AAKtB,SAAgBU,sBAGd,EACAE,QACAH,UACA,GAAGI,QAGF;AACD,KAAIM,OAAOC,KAAKP,KAAK,CAACQ,SAAS,EAC7BtB,UAAMuB,aAAa,YAAY;AAC7BV,SAAOW,OAAO;GACZ,GAAGX,OAAOY;GACV,GAAGX;GACHY,SAAS;IACP,GAAGb,OAAOY,QAAQC;IAClB,GAAGZ,KAAKY;IACV;GACD,CAAQ;GACT;AAKJ,SAAA,GAAA,aAAA,iBAFwBb,OAAOY,QAAQG,QAAQ1B,qBAAAA,cAG7B,EAAA,IAAAQ,WAAA;AAAA,UAAA,GAAA,aAAA,iBACbH,eAAa;GAACE,OAAOI;GAAmB,IAAAH,WAAA;AAAA,WAAGA,UAAU;;GAAA,CAAA;IAAA,CAAA;;AAK5D,SAAgBoB,eAGd,EAAEjB,QAAQ,GAAGC,QAA2C;AACxD,SAAA,GAAA,aAAA,iBACGH,wBAAAA,GAAAA,aAAAA,YAAqB,EAASE,QAAM,EAAMC,MAAI,EAAAJ,iBAAAA,GAAAA,aAAAA,iBACrCP,gBAAAA,SAAO,EAAA,CAAA,EAAG,CAAA,CAAA"}