{"version":3,"file":"LiveHorizontalList-CE9LoLWi.mjs","names":[],"sources":["../src/components/display/live/LiveHorizontalList.vue","../src/components/display/live/LiveHorizontalList.vue"],"sourcesContent":["<template>\n  <div v-if=\"notEmpty\">\n    <h3 class=\"mb-0 mt-3\">\n      {{ t(\"All live emission button\") }}\n    </h3>\n    <ListPaginate\n      id=\"liveListPaginate\"\n      v-model:first=\"dfirst\"\n      v-model:rows-per-page=\"dsize\"\n      v-model:is-mobile=\"isMobile\"\n      :total-count=\"totalCount\"\n      :loading=\"false\"\n      :player-responsive=\"true\"\n    >\n      <template #list>\n        <div class=\"octopus-element-list\">\n          <template v-for=\"p in displayArray\" :key=\"p.podcastId\">\n            <PodcastItem v-if=\"0 !== p.podcastId\" :podcast=\"p\" />\n          </template>\n        </div>\n      </template>\n    </ListPaginate>\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport ListPaginate from \"../list/ListPaginate.vue\";\nimport classicApi from \"../../../api/classicApi\";\nimport PodcastItem from \"../podcasts/PodcastItem.vue\";\nimport { Podcast, emptyPodcastData } from \"@/stores/class/general/podcast\";\nimport { computed, onBeforeMount, Ref, ref, watch } from \"vue\";\nimport { ListClassicReturn } from \"@/stores/class/general/listReturn\";\nimport { useI18n } from \"vue-i18n\";\n\n\n//Props \nconst props = defineProps({\n  first: { default: 0, type: Number },\n  size: { default: 30, type: Number },\n  emissionId: { default: undefined, type: Number },\n})\n\n//Data \nconst dfirst = ref(props.first);\nconst dsize = ref(props.size);\nconst totalCount = ref(0);\nconst lives: Ref<Array<Podcast>> = ref([]);\nconst notEmpty = ref(false);\nconst inFetching = ref(false);\nconst isMobile = ref(false);\n\n//Composables\nconst { t } = useI18n();\n\n//Computed\nconst displayArray = computed(() => {\n  if (isMobile.value) {\n    return lives.value;\n  }\n  return lives.value.slice(\n    dfirst.value,\n    Math.min(dfirst.value + dsize.value, totalCount.value),\n  );\n});\n\n\n//Watch\nwatch(dsize, () => reloadList());\nwatch(dfirst, () => {\n  if (!lives.value[dfirst.value] || 0 === lives.value[dfirst.value].podcastId) {\n    fetchContent(false);\n  }\n});\n\nonBeforeMount(()=>fetchContent(true))\n\n\n//Methods\nfunction reloadList() {\n  dfirst.value = 0;\n  fetchContent(true);\n}\nasync function fetchContent(reset: boolean): Promise<void> {\n  inFetching.value = true;\n  if (reset) {\n    notEmpty.value = false;\n  }\n  const data = await classicApi.fetchData<ListClassicReturn<Podcast>>({\n    api: 0,\n    path: \"podcast/search\",\n    parameters: {\n      first: dfirst.value,\n      size: dsize.value,\n      emissionId: props.emissionId,\n      sort: \"DATE\",\n      includeStatus: \"READY_TO_RECORD\",\n    },\n    specialTreatement: true,\n  });\n  afterFetching(reset, data);\n}\nfunction afterFetching(\n  reset: boolean,\n  data: { count: number; result: Array<Podcast>; sort: string },\n): void {\n  if (reset) {\n    lives.value.length = 0;\n  }\n  if (dfirst.value > lives.value.length) {\n    for (\n      let i = lives.value.length - 1, len = dfirst.value + dsize.value;\n      i < len;\n      i++\n    ) {\n      lives.value.push(emptyPodcastData());\n    }\n  }\n  const responseLives = data.result.filter((l: Podcast | null) => {\n    return null !== l;\n  });\n  lives.value = lives.value\n    .slice(0, dfirst.value)\n    .concat(responseLives)\n    .concat(lives.value.slice(dfirst.value + dsize.value, lives.value.length));\n  totalCount.value = data.count;\n  if (0 !== lives.value.length) {\n    notEmpty.value = true;\n  }\n  inFetching.value = false;\n}\n</script>\n","<template>\n  <div v-if=\"notEmpty\">\n    <h3 class=\"mb-0 mt-3\">\n      {{ t(\"All live emission button\") }}\n    </h3>\n    <ListPaginate\n      id=\"liveListPaginate\"\n      v-model:first=\"dfirst\"\n      v-model:rows-per-page=\"dsize\"\n      v-model:is-mobile=\"isMobile\"\n      :total-count=\"totalCount\"\n      :loading=\"false\"\n      :player-responsive=\"true\"\n    >\n      <template #list>\n        <div class=\"octopus-element-list\">\n          <template v-for=\"p in displayArray\" :key=\"p.podcastId\">\n            <PodcastItem v-if=\"0 !== p.podcastId\" :podcast=\"p\" />\n          </template>\n        </div>\n      </template>\n    </ListPaginate>\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport ListPaginate from \"../list/ListPaginate.vue\";\nimport classicApi from \"../../../api/classicApi\";\nimport PodcastItem from \"../podcasts/PodcastItem.vue\";\nimport { Podcast, emptyPodcastData } from \"@/stores/class/general/podcast\";\nimport { computed, onBeforeMount, Ref, ref, watch } from \"vue\";\nimport { ListClassicReturn } from \"@/stores/class/general/listReturn\";\nimport { useI18n } from \"vue-i18n\";\n\n\n//Props \nconst props = defineProps({\n  first: { default: 0, type: Number },\n  size: { default: 30, type: Number },\n  emissionId: { default: undefined, type: Number },\n})\n\n//Data \nconst dfirst = ref(props.first);\nconst dsize = ref(props.size);\nconst totalCount = ref(0);\nconst lives: Ref<Array<Podcast>> = ref([]);\nconst notEmpty = ref(false);\nconst inFetching = ref(false);\nconst isMobile = ref(false);\n\n//Composables\nconst { t } = useI18n();\n\n//Computed\nconst displayArray = computed(() => {\n  if (isMobile.value) {\n    return lives.value;\n  }\n  return lives.value.slice(\n    dfirst.value,\n    Math.min(dfirst.value + dsize.value, totalCount.value),\n  );\n});\n\n\n//Watch\nwatch(dsize, () => reloadList());\nwatch(dfirst, () => {\n  if (!lives.value[dfirst.value] || 0 === lives.value[dfirst.value].podcastId) {\n    fetchContent(false);\n  }\n});\n\nonBeforeMount(()=>fetchContent(true))\n\n\n//Methods\nfunction reloadList() {\n  dfirst.value = 0;\n  fetchContent(true);\n}\nasync function fetchContent(reset: boolean): Promise<void> {\n  inFetching.value = true;\n  if (reset) {\n    notEmpty.value = false;\n  }\n  const data = await classicApi.fetchData<ListClassicReturn<Podcast>>({\n    api: 0,\n    path: \"podcast/search\",\n    parameters: {\n      first: dfirst.value,\n      size: dsize.value,\n      emissionId: props.emissionId,\n      sort: \"DATE\",\n      includeStatus: \"READY_TO_RECORD\",\n    },\n    specialTreatement: true,\n  });\n  afterFetching(reset, data);\n}\nfunction afterFetching(\n  reset: boolean,\n  data: { count: number; result: Array<Podcast>; sort: string },\n): void {\n  if (reset) {\n    lives.value.length = 0;\n  }\n  if (dfirst.value > lives.value.length) {\n    for (\n      let i = lives.value.length - 1, len = dfirst.value + dsize.value;\n      i < len;\n      i++\n    ) {\n      lives.value.push(emptyPodcastData());\n    }\n  }\n  const responseLives = data.result.filter((l: Podcast | null) => {\n    return null !== l;\n  });\n  lives.value = lives.value\n    .slice(0, dfirst.value)\n    .concat(responseLives)\n    .concat(lives.value.slice(dfirst.value + dsize.value, lives.value.length));\n  totalCount.value = data.count;\n  if (0 !== lives.value.length) {\n    notEmpty.value = true;\n  }\n  inFetching.value = false;\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAoCA,MAAM,QAAQ;EAOd,MAAM,SAAS,IAAI,MAAM,KAAK;EAC9B,MAAM,QAAQ,IAAI,MAAM,IAAI;EAC5B,MAAM,aAAa,IAAI,CAAC;EACxB,MAAM,QAA6B,IAAI,CAAC,CAAC;EACzC,MAAM,WAAW,IAAI,KAAK;EAC1B,MAAM,aAAa,IAAI,KAAK;EAC5B,MAAM,WAAW,IAAI,KAAK;EAG1B,MAAM,EAAE,MAAM,QAAQ;EAGtB,MAAM,eAAe,eAAe;GAClC,IAAI,SAAS,OACX,OAAO,MAAM;GAEf,OAAO,MAAM,MAAM,MACjB,OAAO,OACP,KAAK,IAAI,OAAO,QAAQ,MAAM,OAAO,WAAW,KAAK,CACvD;EACF,CAAC;EAID,MAAM,aAAa,WAAW,CAAC;EAC/B,MAAM,cAAc;GAClB,IAAI,CAAC,MAAM,MAAM,OAAO,UAAU,MAAM,MAAM,MAAM,OAAO,OAAO,WAChE,aAAa,KAAK;EAEtB,CAAC;EAED,oBAAkB,aAAa,IAAI,CAAC;EAIpC,SAAS,aAAa;GACpB,OAAO,QAAQ;GACf,aAAa,IAAI;EACnB;EACA,eAAe,aAAa,OAA+B;GACzD,WAAW,QAAQ;GACnB,IAAI,OACF,SAAS,QAAQ;GAcnB,cAAc,OAAO,MAZF,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