{"version":3,"file":"index-DpI3Yiwy.js","sources":["../../../app/hooks/useReturnUrl.ts","../../../app/components/Form/index.tsx"],"sourcesContent":["import { useSearchParams } from \"react-router\";\nimport { useGlobals } from \"./useGlobals\";\n\nexport const useReturnUrl = () => {\n const { fields } = useGlobals() || {};\n const [searchParams] = useSearchParams();\n\n const returnUrl = fields?.find((field) => field.field === \"returnUrl\")?.value;\n\n if (returnUrl) {\n return encodeURIComponent(returnUrl);\n }\n\n const queryReturnUrl = searchParams.get(\"returnUrl\");\n\n if (!queryReturnUrl) {\n return null;\n }\n\n return encodeURIComponent(queryReturnUrl);\n};\n","import type { ComponentProps } from \"react\";\nimport { useGlobals } from \"~/hooks/useGlobals\";\nimport { useReturnUrl } from \"~/hooks/useReturnUrl\";\n\nexport function Form({ children, ...props }: ComponentProps<\"form\">) {\n const { antiForgery } = useGlobals() || {};\n const returnUrl = useReturnUrl();\n\n return (\n
\n {antiForgery && (\n \n )}\n\n {returnUrl && }\n\n {children}\n \n );\n}\n"],"names":["useReturnUrl","fields","useGlobals","searchParams","useSearchParams","returnUrl","find","field","value","encodeURIComponent","queryReturnUrl","get","Form","children","props","antiForgery","jsxs","jsx","fieldName","token"],"mappings":"2DAGO,MAAMA,EAAeA,IAAM,OAC1B,KAAA,CAAEC,OAAAA,CAAAA,EAAWC,EAAW,GAAK,CAAC,EAC9B,CAACC,CAAY,EAAIC,EAAgB,EAEjCC,GAAYJ,EAAAA,GAAAA,YAAAA,EAAQK,QAAgBC,EAAMA,QAAU,eAAxCN,YAAAA,EAAsDO,MAExE,GAAIH,EACF,OAAOI,mBAAmBJ,CAAS,EAG/BK,MAAAA,EAAiBP,EAAaQ,IAAI,WAAW,EAEnD,OAAKD,EAIED,mBAAmBC,CAAc,EAH/B,IAIX,EChBO,SAASE,EAAK,CAAEC,SAAAA,EAAU,GAAGC,CAA8B,EAAG,CAC7D,KAAA,CAAEC,YAAAA,CAAAA,EAAgBb,EAAW,GAAK,CAAC,EACnCG,EAAYL,EAAa,EAG7B,OAAAgB,EAAA,KAAC,OAAK,CAAA,GAAIF,EACPC,SAAAA,CACCA,GAAAE,EAAA,IAAC,SACC,KAAMF,GAAAA,YAAAA,EAAaG,UACnB,MAAOH,GAAAA,YAAAA,EAAaI,MACpB,KAAK,QAER,CAAA,EAEAd,SAAc,QAAM,CAAA,KAAK,YAAY,MAAOA,EAAW,KAAK,SAAW,EAEvEQ,CAAAA,EACH,CAEJ"}