{"version":3,"file":"PodcastFilterList-DA0W2DxY.mjs","names":[],"sources":["../src/components/display/podcasts/PodcastFilterList.vue","../src/components/display/podcasts/PodcastFilterList.vue"],"sourcesContent":["<template>\n  <section class=\"py-3\">\n    <h3 class=\"mb-2\">\n      {{ titleFilter }}\n    </h3>\n    <div class=\"d-flex align-items-stretch flex-wrap mb-2\">\n      <div id=\"podcast-filter-list-category-chooser\" class=\"w-50-responsive pe-3\">\n        <CategoryChooser\n          height=\"100%\"\n          :defaultanswer=\"t('No category filter')\"\n          @selected=\"onCategorySelected\"\n        />\n      </div>\n      <ClassicSearch\n        v-model:text-init=\"searchPattern\"\n        class=\"w-50-responsive\"\n        id-search=\"podcast-filter-search\"\n        :label=\"t('Search')\"\n      />\n    </div>\n\n    <PodcastList\n      v-if=\"!showSeasons\"\n      :first=\"dfirst\"\n      :size=\"dsize\"\n      :iab-id=\"iabId\"\n      :query=\"query\"\n      :participant-id=\"participantId\"\n      :emission-id=\"emissionId\"\n      :organisation-id=\"productorId\"\n      :sort-criteria=\"sort\"\n      :reload=\"reloadList\"\n      :include-hidden=\"editRight\"\n      :show-count=\"showCount\"\n      :display-sort-text=\"false\"\n      :force-update-parameters=\"forceUpdateParameters\"\n      @fetch=\"fetch\"\n    />\n    <ClassicNav\n      v-else\n      v-model:active-tab=\"activeSeasonTab\"\n      :tab-number=\"emission.seasons.length\"\n    >\n      <template v-for=\"(season, i) in seasons\" #[tabNameSlot(i)]>\n        {{ $t('Podcast - Season N', { season }) }}\n      </template>\n\n      <template\n        v-for=\"(season, i) in seasons\"\n        #[tabContentSlot(i)]\n        :key=\"season\"\n      >\n        <PodcastList\n          class=\"flex-grow-1\"\n          :first=\"dfirst\"\n          :size=\"dsize\"\n          :iab-id=\"iabId\"\n          :query=\"query\"\n          :participant-id=\"participantId\"\n          :emission-id=\"emissionId\"\n          :organisation-id=\"productorId\"\n          :sort-criteria=\"sort\"\n          :reload=\"reloadList\"\n          :include-hidden=\"editRight\"\n          :show-count=\"showCount\"\n          :display-sort-text=\"false\"\n          :force-update-parameters=\"forceUpdateParameters\"\n          :seasons=\"[season]\"\n          @fetch=\"fetch($event, season)\"\n        />\n      </template>\n    </ClassicNav>\n  </section>\n</template>\n\n<script setup lang=\"ts\">\nimport ClassicSearch from \"../../form/ClassicSearch.vue\";\nimport PodcastList from \"./PodcastList.vue\";\nimport { Category } from \"@/stores/class/general/category\";\nimport { defineAsyncComponent, ref, Ref, computed, watch } from \"vue\";\nimport { Podcast } from \"@/stores/class/general/podcast\";\nimport { useI18n } from \"vue-i18n\";\nimport ClassicNav from \"../../misc/ClassicNav.vue\";\nimport { Emission } from \"@/stores/class/general/emission\";\nimport { useSeasonsManagement } from \"../../composable/useSeasonsManagement\";\nimport { PodcastSort } from \"../../../api/podcastApi\";\nconst CategoryChooser = defineAsyncComponent(\n  () => import(\"../categories/CategoryChooser.vue\"),\n);\n\n//Props \nconst props = withDefaults(defineProps<{\n  first?: number;\n  size?: number;\n  query?: string;\n  participantId?: number;\n  name?: string;\n  emissionId?: number;\n  categoryFilter?: boolean;\n  reload?: boolean;\n  editRight?: boolean;\n  productorId?: Array<string>;\n  showCount?: boolean;\n  forceUpdateParameters?: boolean;\n  /**\n   * Emission for which to display podcasts\n   * If set, will check for seasons\n   */\n  emission?: Emission;\n}>(), {\n  first: 0,\n  size: 30\n});\n\n//Emits\nconst emit = defineEmits<{\n  (e: \"fetch\", podcasts: Array<Podcast>, season: number|undefined): void;\n  (e: \"update:query\", query: string): void;\n}>();\n\n//Data \nconst dfirst = ref(props.first);\nconst dsize = ref(props.size);\nconst searchPattern = ref(props.query ?? \"\");\nconst reloadList = ref(false);\nconst iabId : Ref<number | undefined>= ref(undefined);\n\n//Composables\nconst { t } = useI18n();\nconst { areSeasonsEnabled, getMaxSeason } = useSeasonsManagement();\n\n//Computed\nconst titleFilter = computed(() => {\n  return props.name\n    ? t(\"All podcast button\", { name: props.name })\n    : t(\"All podcast emission button\");\n});\nconst query = computed(() => searchPattern.value.length > 3 ? searchPattern.value : \"\");\n\nconst showSeasons = computed(() => {\n  return props.emission !== undefined && areSeasonsEnabled(props.emission) && (props.emission.seasons?.length ?? 0) > 0;\n});\n\nconst seasons = computed((): Array<number> => [...props.emission.seasons].sort());\n\nconst activeSeasonTab = ref(showSeasons.value ? props.emission.seasons?.indexOf(getMaxSeason(props.emission)) ?? 0 : 0);\n\nconst sort = computed((): PodcastSort => {\n  if(showSeasons.value === true) {\n    return PodcastSort.SEASONAL;\n  } else if(!query.value.length) {\n    return PodcastSort.DATE;\n  } else {\n    return PodcastSort.SCORE;\n  }\n});\n\n//Watch\nwatch(()=>props.reload, () => {\n  reloadList.value = !reloadList.value;\n});\nwatch(searchPattern, () => {\n  emit('update:query', searchPattern.value);\n});\n\n//Methods\nfunction onCategorySelected(category: Category | undefined): void {\n  iabId.value = category?.id ? category.id : undefined;\n}\nfunction fetch(podcasts: Array<Podcast>, season?: number): void {\n  emit(\"fetch\", podcasts, season);\n}\n\n/** Name of the slot for the tab's title */\nfunction tabNameSlot(index: number): string {\n  return `${index}`;\n}\n/** Name of the slot for the tab's content */\nfunction tabContentSlot(index: number): string {\n  return `tab${index}`;\n}\n</script>\n","<template>\n  <section class=\"py-3\">\n    <h3 class=\"mb-2\">\n      {{ titleFilter }}\n    </h3>\n    <div class=\"d-flex align-items-stretch flex-wrap mb-2\">\n      <div id=\"podcast-filter-list-category-chooser\" class=\"w-50-responsive pe-3\">\n        <CategoryChooser\n          height=\"100%\"\n          :defaultanswer=\"t('No category filter')\"\n          @selected=\"onCategorySelected\"\n        />\n      </div>\n      <ClassicSearch\n        v-model:text-init=\"searchPattern\"\n        class=\"w-50-responsive\"\n        id-search=\"podcast-filter-search\"\n        :label=\"t('Search')\"\n      />\n    </div>\n\n    <PodcastList\n      v-if=\"!showSeasons\"\n      :first=\"dfirst\"\n      :size=\"dsize\"\n      :iab-id=\"iabId\"\n      :query=\"query\"\n      :participant-id=\"participantId\"\n      :emission-id=\"emissionId\"\n      :organisation-id=\"productorId\"\n      :sort-criteria=\"sort\"\n      :reload=\"reloadList\"\n      :include-hidden=\"editRight\"\n      :show-count=\"showCount\"\n      :display-sort-text=\"false\"\n      :force-update-parameters=\"forceUpdateParameters\"\n      @fetch=\"fetch\"\n    />\n    <ClassicNav\n      v-else\n      v-model:active-tab=\"activeSeasonTab\"\n      :tab-number=\"emission.seasons.length\"\n    >\n      <template v-for=\"(season, i) in seasons\" #[tabNameSlot(i)]>\n        {{ $t('Podcast - Season N', { season }) }}\n      </template>\n\n      <template\n        v-for=\"(season, i) in seasons\"\n        #[tabContentSlot(i)]\n        :key=\"season\"\n      >\n        <PodcastList\n          class=\"flex-grow-1\"\n          :first=\"dfirst\"\n          :size=\"dsize\"\n          :iab-id=\"iabId\"\n          :query=\"query\"\n          :participant-id=\"participantId\"\n          :emission-id=\"emissionId\"\n          :organisation-id=\"productorId\"\n          :sort-criteria=\"sort\"\n          :reload=\"reloadList\"\n          :include-hidden=\"editRight\"\n          :show-count=\"showCount\"\n          :display-sort-text=\"false\"\n          :force-update-parameters=\"forceUpdateParameters\"\n          :seasons=\"[season]\"\n          @fetch=\"fetch($event, season)\"\n        />\n      </template>\n    </ClassicNav>\n  </section>\n</template>\n\n<script setup lang=\"ts\">\nimport ClassicSearch from \"../../form/ClassicSearch.vue\";\nimport PodcastList from \"./PodcastList.vue\";\nimport { Category } from \"@/stores/class/general/category\";\nimport { defineAsyncComponent, ref, Ref, computed, watch } from \"vue\";\nimport { Podcast } from \"@/stores/class/general/podcast\";\nimport { useI18n } from \"vue-i18n\";\nimport ClassicNav from \"../../misc/ClassicNav.vue\";\nimport { Emission } from \"@/stores/class/general/emission\";\nimport { useSeasonsManagement } from \"../../composable/useSeasonsManagement\";\nimport { PodcastSort } from \"../../../api/podcastApi\";\nconst CategoryChooser = defineAsyncComponent(\n  () => import(\"../categories/CategoryChooser.vue\"),\n);\n\n//Props \nconst props = withDefaults(defineProps<{\n  first?: number;\n  size?: number;\n  query?: string;\n  participantId?: number;\n  name?: string;\n  emissionId?: number;\n  categoryFilter?: boolean;\n  reload?: boolean;\n  editRight?: boolean;\n  productorId?: Array<string>;\n  showCount?: boolean;\n  forceUpdateParameters?: boolean;\n  /**\n   * Emission for which to display podcasts\n   * If set, will check for seasons\n   */\n  emission?: Emission;\n}>(), {\n  first: 0,\n  size: 30\n});\n\n//Emits\nconst emit = defineEmits<{\n  (e: \"fetch\", podcasts: Array<Podcast>, season: number|undefined): void;\n  (e: \"update:query\", query: string): void;\n}>();\n\n//Data \nconst dfirst = ref(props.first);\nconst dsize = ref(props.size);\nconst searchPattern = ref(props.query ?? \"\");\nconst reloadList = ref(false);\nconst iabId : Ref<number | undefined>= ref(undefined);\n\n//Composables\nconst { t } = useI18n();\nconst { areSeasonsEnabled, getMaxSeason } = useSeasonsManagement();\n\n//Computed\nconst titleFilter = computed(() => {\n  return props.name\n    ? t(\"All podcast button\", { name: props.name })\n    : t(\"All podcast emission button\");\n});\nconst query = computed(() => searchPattern.value.length > 3 ? searchPattern.value : \"\");\n\nconst showSeasons = computed(() => {\n  return props.emission !== undefined && areSeasonsEnabled(props.emission) && (props.emission.seasons?.length ?? 0) > 0;\n});\n\nconst seasons = computed((): Array<number> => [...props.emission.seasons].sort());\n\nconst activeSeasonTab = ref(showSeasons.value ? props.emission.seasons?.indexOf(getMaxSeason(props.emission)) ?? 0 : 0);\n\nconst sort = computed((): PodcastSort => {\n  if(showSeasons.value === true) {\n    return PodcastSort.SEASONAL;\n  } else if(!query.value.length) {\n    return PodcastSort.DATE;\n  } else {\n    return PodcastSort.SCORE;\n  }\n});\n\n//Watch\nwatch(()=>props.reload, () => {\n  reloadList.value = !reloadList.value;\n});\nwatch(searchPattern, () => {\n  emit('update:query', searchPattern.value);\n});\n\n//Methods\nfunction onCategorySelected(category: Category | undefined): void {\n  iabId.value = category?.id ? category.id : undefined;\n}\nfunction fetch(podcasts: Array<Podcast>, season?: number): void {\n  emit(\"fetch\", podcasts, season);\n}\n\n/** Name of the slot for the tab's title */\nfunction tabNameSlot(index: number): string {\n  return `${index}`;\n}\n/** Name of the slot for the tab's content */\nfunction tabContentSlot(index: number): string {\n  return `tab${index}`;\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsFA,MAAM,kBAAkB,2BAChB,OAAO,kCAAA,MAAA,MAAA,EAAA,CAAA,CACf;EAGA,MAAM,QAAQ;EAwBd,MAAM,OAAO;EAMb,MAAM,SAAS,IAAI,MAAM,KAAK;EAC9B,MAAM,QAAQ,IAAI,MAAM,IAAI;EAC5B,MAAM,gBAAgB,IAAI,MAAM,SAAS,EAAE;EAC3C,MAAM,aAAa,IAAI,KAAK;EAC5B,MAAM,QAAiC,IAAI,KAAA,CAAS;EAGpD,MAAM,EAAE,MAAM,QAAQ;EACtB,MAAM,EAAE,mBAAmB,iBAAiB,qBAAqB;EAGjE,MAAM,cAAc,eAAe;GACjC,OAAO,MAAM,OACT,EAAE,sBAAsB,EAAE,MAAM,MAAM,KAAK,CAAC,IAC5C,EAAE,6BAA6B;EACrC,CAAC;EACD,MAAM,QAAQ,eAAe,cAAc,MAAM,SAAS,IAAI,cAAc,QAAQ,EAAE;EAEtF,MAAM,cAAc,eAAe;GACjC,OAAO,MAAM,aAAa,KAAA,KAAa,kBAAkB,MAAM,QAAQ,MAAM,MAAM,SAAS,SAAS,UAAU,KAAK;EACtH,CAAC;EAED,MAAM,UAAU,eAA8B,CAAC,GAAG,MAAM,SAAS,OAAO,EAAE,KAAK,CAAC;EAEhF,MAAM,kBAAkB,IAAI,YAAY,QAAQ,MAAM,SAAS,SAAS,QAAQ,aAAa,MAAM,QAAQ,CAAC,KAAK,IAAI,CAAC;EAEtH,MAAM,OAAO,eAA4B;GACvC,IAAG,YAAY,UAAU,MACvB,OAAO,YAAY;QACd,IAAG,CAAC,MAAM,MAAM,QACrB,OAAO,YAAY;QAEnB,OAAO,YAAY;EAEvB,CAAC;EAG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