{"version":3,"sources":["../../../src/client/ui/link.tsx"],"names":["jsx","forwardRef","TouchableOpacity","usePilot","Link","props","ref","area","as","children","href","locale","scroll","shallow","style","Wrapper","pilot","link_default"],"mappings":"AAyCE,cAAAA,MAAA,oBArCF,OAAS,cAAAC,MAAkB,QAC3B,OAAS,oBAAAC,MAAwB,eACjC,OAAS,YAAAC,MAAgB,oBAsBlB,MAAMC,EAAOH,EAA2B,CAACI,EAAkBC,IAAQ,CACzE,KAAM,CAAE,KAAAC,EAAM,GAAAC,EAAI,SAAAC,EAAU,KAAAC,EAAM,OAAAC,EAAQ,OAAAC,EAAQ,QAAAC,EAAS,MAAAC,EAAO,QAASC,EAAUb,CAAiB,EAAIG,EACpGW,EAAQb,EAASI,CAAI,EAU3B,OACCP,EAACe,EAAA,CAAQ,QATM,IAAM,CACrBC,EAAM,IAAIN,EAAMF,EAAI,CACnB,OAAAG,EACA,OAAAC,EACA,QAAAC,CACD,CAAC,CACF,EAG4B,IAAKP,EAAK,MAAOQ,EAC1C,SAAAL,EACF,CAEF,CAAC,EACD,IAAOQ,EAAQb","sourcesContent":["/**\n * © 2022 WavePlay <dev@waveplay.com>\n */\n'use client'\nimport { forwardRef } from 'react'\nimport { TouchableOpacity } from 'react-native'\nimport { usePilot } from '../core/use-pilot'\nimport type { ComponentType, Ref } from 'react'\nimport type { GestureResponderEvent, StyleProp, ViewStyle } from 'react-native'\nimport type { Url } from '../../_internal/types'\n\ntype WrapperProps = {\n\tonPress?: (event: GestureResponderEvent) => void\n\tref?: Ref<any>\n\tstyle?: StyleProp<ViewStyle> | StyleProp<ViewStyle>[]\n}\n\ninterface LinkProps {\n\tarea?: string\n\tas?: string\n\tchildren?: any\n\thref?: Url\n\tlocale?: string\n\tscroll?: boolean\n\tshallow?: boolean\n\tstyle?: any | any[]\n\twrapper?: ComponentType<WrapperProps>\n}\nexport const Link = forwardRef<any, LinkProps>((props: LinkProps, ref) => {\n\tconst { area, as, children, href, locale, scroll, shallow, style, wrapper: Wrapper = TouchableOpacity } = props\n\tconst pilot = usePilot(area)\n\n\tconst onPress = () => {\n\t\tpilot.fly(href, as, {\n\t\t\tlocale,\n\t\t\tscroll,\n\t\t\tshallow\n\t\t})\n\t}\n\n\treturn (\n\t\t<Wrapper onPress={onPress} ref={ref} style={style}>\n\t\t\t{children}\n\t\t</Wrapper>\n\t)\n})\nexport default Link\n"]}