{"version":3,"sources":["../../../src/client/router/with-router.ts"],"names":["createElement","hoistNonReactStatics","usePilot","withRouter","WrappedComponent","area","props","router"],"mappings":"AAGA,OAAS,iBAAAA,MAAqB,QAC9B,OAAOC,MAA0B,0BACjC,OAAS,YAAAC,MAAgB,oBAQlB,SAASC,EACfC,EACAC,EACmB,CAMnB,OAAOJ,EALsBK,GAAa,CACzC,MAAMC,EAASL,EAASG,CAAI,EAC5B,OAAOL,EAAcI,EAAkB,CAAE,GAAIE,EAAa,OAAAC,CAAO,CAAC,CACnE,EAEiDH,CAAgB,CAClE","sourcesContent":["/**\n * © 2023 WavePlay <dev@waveplay.com>\n */\nimport { createElement } from 'react'\nimport hoistNonReactStatics from 'hoist-non-react-statics'\nimport { usePilot } from '../core/use-pilot'\nimport type { ComponentType } from 'react'\nimport type { Pilot } from '../core/pilot'\n\ninterface InjectedProps {\n\trouter: Pilot\n}\n\nexport function withRouter<P extends InjectedProps>(\n\tWrappedComponent: ComponentType<P>,\n\tarea?: string\n): ComponentType<P> {\n\tconst ComponentWithRouter = (props: P) => {\n\t\tconst router = usePilot(area)\n\t\treturn createElement(WrappedComponent, { ...(props as P), router })\n\t}\n\n\treturn hoistNonReactStatics(ComponentWithRouter, WrappedComponent)\n}\n"]}