{"version":3,"file":"RadioCurrently-CF_kFXTY.mjs","names":[],"sources":["../src/components/display/live/RadioCurrently.vue","../src/components/display/live/RadioCurrently.vue"],"sourcesContent":["<template>\n  <div class=\"d-flex align-items-center\">\n    <div\n      v-if=\"currentlyPlayingString.length || podcastRadio\"\n      class=\"fw-bold me-1\"\n    >\n      {{ t(\"Currently\") }}&nbsp;:\n    </div>\n    <router-link\n      v-if=\"podcastRadio\"\n      class=\"d-flex align-items-center\"\n      :to=\"{\n        name: 'podcast',\n        params: { podcastId: podcastRadio.podcastId },\n      }\"\n      :title=\"t('Episode name page', { name: podcastRadio.title })\"\n    >\n      <img\n        v-lazy=\"useProxyImageUrl(podcastRadio.imageUrl, '80')\"\n        width=\"80\"\n        height=\"80\"\n        class=\"small-img-box\"\n        aria-hidden=\"true\"\n        alt=\"\"\n        :title=\"t('Episode name image', { name: podcastRadio.title })\"\n      />\n      <div>{{ podcastRadio.title }}</div>\n    </router-link>\n    <div v-else-if=\"currentlyPlayingString.length\">\n      {{ currentlyPlayingString }}\n    </div>\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {useFetchRadio} from \"../../composable/radio/usefetchRadioData\";\nimport { usePlayerStore } from \"../../../stores/PlayerStore\";\nimport {useImageProxy} from \"../../composable/useImageProxy\";\nimport { computed, onMounted, onUnmounted, ref, Ref } from \"vue\";\nimport { Canal } from \"@/stores/class/radio/canal\";\nimport { MediaRadio } from \"@/stores/class/general/player\";\nimport { Podcast } from \"@/stores/class/general/podcast\";\nimport { useI18n } from \"vue-i18n\";\n\n//Props \nconst props = defineProps({\n  radio: { default: undefined, type: Object as () => Canal },\n})\n\n//Data \nconst currentMetadata: Ref<MediaRadio | undefined> = ref(undefined);\nconst currentPodcast: Ref<Podcast | undefined> = ref(undefined);\nconst radioInterval: Ref<ReturnType<typeof setTimeout> | undefined> = ref(undefined);\n\n  \n//Composables\nconst { t } = useI18n();\nconst { fetchRadioMetadata, displayTitle } = useFetchRadio();\nconst { useProxyImageUrl } = useImageProxy();\nconst playerStore = usePlayerStore();\n\n//Computed\nconst playingRadio = computed(() => playerStore.playerRadio && playerStore.playerRadio.canalId === props.radio?.id);\nconst podcastRadio = computed(() => {\n  if (playingRadio.value) {\n    return playerStore.playerRadio?.podcast;\n  }\n  return currentPodcast.value;\n});\nconst currentlyPlayingString = computed(() => {\n  if (playingRadio.value && playerStore.playerRadio) {\n    return displayTitle(playerStore.playerRadio.metadata);\n  }\n  return displayTitle(currentMetadata.value);\n});\n\nonMounted(()=>{\n  fetchCurrentlyPlaying();\n  radioInterval.value = setInterval(() => {\n    fetchCurrentlyPlaying();\n  }, 10000);\n})\n\nonUnmounted(()=>{\n  clearInterval(radioInterval.value);\n  radioInterval.value= undefined;\n})\n\n\n//Methods\nasync function fetchCurrentlyPlaying(): Promise<void> {\n  if (!props.radio || playingRadio.value) {\n    return;\n  }\n  fetchRadioMetadata(\n    props.radio.id,\n    currentMetadata.value?.title ?? \"\",\n    updateMetadata,\n  );\n}\nfunction updateMetadata(metadata: MediaRadio|undefined, podcast?: Podcast): void {\n  currentMetadata.value = metadata;\n  currentPodcast.value = podcast;\n}\n</script>\n\n<style lang=\"scss\">\n.octopus-app .small-img-box {\n  height: 80px;\n  width: 80px;\n  border-radius: var(--octopus-border-radius);\n  overflow: hidden;\n  flex-shrink: 0;\n  margin: 0.5rem;\n}\n</style>\n","<template>\n  <div class=\"d-flex align-items-center\">\n    <div\n      v-if=\"currentlyPlayingString.length || podcastRadio\"\n      class=\"fw-bold me-1\"\n    >\n      {{ t(\"Currently\") }}&nbsp;:\n    </div>\n    <router-link\n      v-if=\"podcastRadio\"\n      class=\"d-flex align-items-center\"\n      :to=\"{\n        name: 'podcast',\n        params: { podcastId: podcastRadio.podcastId },\n      }\"\n      :title=\"t('Episode name page', { name: podcastRadio.title })\"\n    >\n      <img\n        v-lazy=\"useProxyImageUrl(podcastRadio.imageUrl, '80')\"\n        width=\"80\"\n        height=\"80\"\n        class=\"small-img-box\"\n        aria-hidden=\"true\"\n        alt=\"\"\n        :title=\"t('Episode name image', { name: podcastRadio.title })\"\n      />\n      <div>{{ podcastRadio.title }}</div>\n    </router-link>\n    <div v-else-if=\"currentlyPlayingString.length\">\n      {{ currentlyPlayingString }}\n    </div>\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport {useFetchRadio} from \"../../composable/radio/usefetchRadioData\";\nimport { usePlayerStore } from \"../../../stores/PlayerStore\";\nimport {useImageProxy} from \"../../composable/useImageProxy\";\nimport { computed, onMounted, onUnmounted, ref, Ref } from \"vue\";\nimport { Canal } from \"@/stores/class/radio/canal\";\nimport { MediaRadio } from \"@/stores/class/general/player\";\nimport { Podcast } from \"@/stores/class/general/podcast\";\nimport { useI18n } from \"vue-i18n\";\n\n//Props \nconst props = defineProps({\n  radio: { default: undefined, type: Object as () => Canal },\n})\n\n//Data \nconst currentMetadata: Ref<MediaRadio | undefined> = ref(undefined);\nconst currentPodcast: Ref<Podcast | undefined> = ref(undefined);\nconst radioInterval: Ref<ReturnType<typeof setTimeout> | undefined> = ref(undefined);\n\n  \n//Composables\nconst { t } = useI18n();\nconst { fetchRadioMetadata, displayTitle } = useFetchRadio();\nconst { useProxyImageUrl } = useImageProxy();\nconst playerStore = usePlayerStore();\n\n//Computed\nconst playingRadio = computed(() => playerStore.playerRadio && playerStore.playerRadio.canalId === props.radio?.id);\nconst podcastRadio = computed(() => {\n  if (playingRadio.value) {\n    return playerStore.playerRadio?.podcast;\n  }\n  return currentPodcast.value;\n});\nconst currentlyPlayingString = computed(() => {\n  if (playingRadio.value && playerStore.playerRadio) {\n    return displayTitle(playerStore.playerRadio.metadata);\n  }\n  return displayTitle(currentMetadata.value);\n});\n\nonMounted(()=>{\n  fetchCurrentlyPlaying();\n  radioInterval.value = setInterval(() => {\n    fetchCurrentlyPlaying();\n  }, 10000);\n})\n\nonUnmounted(()=>{\n  clearInterval(radioInterval.value);\n  radioInterval.value= undefined;\n})\n\n\n//Methods\nasync function fetchCurrentlyPlaying(): Promise<void> {\n  if (!props.radio || playingRadio.value) {\n    return;\n  }\n  fetchRadioMetadata(\n    props.radio.id,\n    currentMetadata.value?.title ?? \"\",\n    updateMetadata,\n  );\n}\nfunction updateMetadata(metadata: MediaRadio|undefined, podcast?: Podcast): void {\n  currentMetadata.value = metadata;\n  currentPodcast.value = podcast;\n}\n</script>\n\n<style lang=\"scss\">\n.octopus-app .small-img-box {\n  height: 80px;\n  width: 80px;\n  border-radius: var(--octopus-border-radius);\n  overflow: hidden;\n  flex-shrink: 0;\n  margin: 0.5rem;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;EA6CA,MAAM,QAAQ;EAKd,MAAM,kBAA+C,IAAI,KAAA,CAAS;EAClE,MAAM,iBAA2C,IAAI,KAAA,CAAS;EAC9D,MAAM,gBAAgE,IAAI,KAAA,CAAS;EAInF,MAAM,EAAE,MAAM,QAAQ;EACtB,MAAM,EAAE,oBAAoB,iBAAiB,cAAc;EAC3D,MAAM,EAAE,qBAAqB,cAAc;EAC3C,MAAM,cAAc,eAAe;EAGnC,MAAM,eAAe,eAAe,YAAY,eAAe,YAAY,YAAY,YAAY,MAAM,OAAO,EAAE;EAClH,MAAM,eAAe,eAAe;GAClC,IAAI,aAAa,OACf,OAAO,YAAY,aAAa;GAElC,OAAO,eAAe;EACxB,CAAC;EACD,MAAM,yBAAyB,eAAe;GAC5C,IAAI,aAAa,SAAS,YAAY,aACpC,OAAO,aAAa,YAAY,YAAY,QAAQ;GAEtD,OAAO,aAAa,gBAAgB,KAAK;EAC3C,CAAC;EAED,gBAAc;GACZ,sBAAsB;GACtB,cAAc,QAAQ,kBAAkB;IACtC,sBAAsB;GACxB,GAAG,GAAK;EACV,CAAC;EAED,kBAAgB;GACd,cAAc,cAAc,KAAK;GACjC,cAAc,QAAO,KAAA;EACvB,CAAC;EAID,eAAe,wBAAuC;GACpD,IAAI,CAAC,MAAM,SAAS,aAAa,OAC/B;GAEF,mBACE,MAAM,MAAM,IACZ,gBAAgB,OAAO,SAAS,I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