{"version":3,"file":"js/1218.main.min.js","mappings":";;;;;;;;;;;AAAO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAA,EAAkB;EAAA,IAAdC,IAAI,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IAE/BG,UAAU,GAAKJ,IAAI,CAAnBI,UAAU;EAElB,IAAI;IACA,IAAMC,GAAG,GAAG,IAAIC,GAAG,CAACF,UAAU,CAAC;IAE/B,IAAIC,GAAG,CAACE,QAAQ,KAAK,iBAAiB,IAAIF,GAAG,CAACG,YAAY,CAACC,GAAG,CAAC,GAAG,CAAC,EAAE;MACjE;MACA,IAAMC,OAAO,GAAGL,GAAG,CAACG,YAAY,CAACG,GAAG,CAAC,GAAG,CAAC;MACzC;MACA,wCAAAC,MAAA,CAAwCF,OAAO;IACnD,CAAC,MAAM,IAAIL,GAAG,CAACE,QAAQ,KAAK,UAAU,EAAE;MACpC;MACA,IAAMG,QAAO,GAAGL,GAAG,CAACQ,QAAQ,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;MACvC,wCAAAF,MAAA,CAAwCF,QAAO;IACnD,CAAC,MAAM;MACH,MAAM,IAAIK,KAAK,CAAC,yBAAyB,CAAC;IAC9C;EACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;IACZC,OAAO,CAACD,KAAK,CAAC,uBAAuB,EAAEA,KAAK,CAACE,OAAO,CAAC;IACrD,OAAO,IAAI;EACf;AACJ,CAAC","sources":["webpack://smetio/./developement/js/functions/convert/convertToEmbedUrl.js"],"sourcesContent":["export const convertToEmbedUrl = (data = {}) => {\r\n\r\n const { regularUrl } = data;\r\n\r\n try {\r\n const url = new URL(regularUrl);\r\n\r\n if (url.hostname === 'www.youtube.com' && url.searchParams.has('v')) {\r\n // Extract the video ID\r\n const videoId = url.searchParams.get('v');\r\n // Return the embed URL\r\n return `https://www.youtube.com/embed/${videoId}`;\r\n } else if (url.hostname === 'youtu.be') {\r\n // For shortened URLs, use the pathname as the video ID\r\n const videoId = url.pathname.slice(1); // Remove leading slash\r\n return `https://www.youtube.com/embed/${videoId}`;\r\n } else {\r\n throw new Error('Not a valid YouTube URL');\r\n }\r\n } catch (error) {\r\n console.error('Error converting URL:', error.message);\r\n return null;\r\n }\r\n};\r\n"],"names":["convertToEmbedUrl","data","arguments","length","undefined","regularUrl","url","URL","hostname","searchParams","has","videoId","get","concat","pathname","slice","Error","error","console","message"],"sourceRoot":""}