{"version":3,"names":["generateAnchorAttributes","component","attributes","href","target","rel","download","Object","keys","length","async","openURL","url","event","router","document","querySelector","preventDefault","push"],"sources":["src/utils/elements-interface.ts"],"sourcesContent":["/**\n * The interfaces in this file are used to make sure our components\n * have the correct properties defined that are needed to pass to\n * the native HTML elements they render\n *\n * Add this @Props\n */\n// /**\n//    HTML <a> download attribute\n//    */\n//  @Prop() download: string | undefined;\n\n//  /**\n//   * HTML <a> href attribute\n//   */\n//  @Prop() href: string | undefined;\n\n//  /**\n//   * HTML <a> ref attribute\n//   */\n//  @Prop() rel: string | undefined;\n\n// /**\n//   * HTML <a> target attribute\n//   */\n//  @Prop() target: '_blank' | '_self' | '_parent' | '_top';\nexport interface AnchorInterface {\n  href: string | undefined;\n  target: string | undefined;\n  rel: string | undefined;\n  download: string | undefined;\n}\n\nexport function generateAnchorAttributes(component: AnchorInterface): { [k: string]: any } | null {\n  let attributes = {};\n\n  attributes = component.href ? { ...attributes, href: component.href } : attributes;\n  attributes = component.target ? { ...attributes, target: component.target } : attributes;\n  attributes = component.rel ? { ...attributes, rel: component.rel } : attributes;\n  attributes = component.download ? { ...attributes, download: component.download } : attributes;\n\n  return Object.keys(attributes).length > 0 ? attributes : null;\n}\n\nexport async function openURL(url: string | undefined | null, event: Event | undefined | null): Promise<boolean> {\n  if (url != null && url[0] !== '#') {\n    const router = document.querySelector('sy-router');\n    if (router) {\n      if (event != null) {\n        event.preventDefault();\n      }\n      return router.push(url, event);\n    }\n  }\n\n  return false;\n}\n"],"mappings":"SAiCgBA,EAAyBC,GACvC,IAAIC,EAAa,GAEjBA,EAAaD,EAAUE,KAAO,IAAKD,EAAYC,KAAMF,EAAUE,MAASD,EACxEA,EAAaD,EAAUG,OAAS,IAAKF,EAAYE,OAAQH,EAAUG,QAAWF,EAC9EA,EAAaD,EAAUI,IAAM,IAAKH,EAAYG,IAAKJ,EAAUI,KAAQH,EACrEA,EAAaD,EAAUK,SAAW,IAAKJ,EAAYI,SAAUL,EAAUK,UAAaJ,EAEpF,OAAOK,OAAOC,KAAKN,GAAYO,OAAS,EAAIP,EAAa,IAC3D,CAEOQ,eAAeC,EAAQC,EAAgCC,GAC5D,GAAID,GAAO,MAAQA,EAAI,KAAO,IAAK,CACjC,MAAME,EAASC,SAASC,cAAc,aACtC,GAAIF,EAAQ,CACV,GAAID,GAAS,KAAM,CACjBA,EAAMI,gB,CAER,OAAOH,EAAOI,KAAKN,EAAKC,E,EAI5B,OAAO,KACT,Q","ignoreList":[]}