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EAAM,UAAY,SACb,gBAAgB0C,EAAK,CAAC,EAAE,IAAI,GAG9BA,EAAK,CAAC,EAAE","names":["limit","GuggenPagination","defineAsyncComponent","__vitePreload","props","__props","getFilters","useArtworkFilters","handleError","useHandleError","setMetaDescription","setMetaTitle","useMetaData","filters","ref","currentTag","computed","isArtist","results","isCategory","tag","searchTerm","getSubType","sub","hasBio","metaDescription","node","pageCount","part","termByCategoryQuery","gql","artworkNavQuery","paginationQuery","termQuery","artworkTermQuery","queryVariables","isFetching","useQuery","data","title","prepareTerm","nextTick","dataLoaded","paged","onMounted","getTermInfo","term","capitalize","category","currentBio","bio","prepareBio","word","bioBreak","bioParagraph","bioDouble","bioEstablished","artwork","cat"],"ignoreList":[],"sources":["../../src/components/artwork/ArtworkTerm.vue"],"sourcesContent":["<template>\n  <article>\n    <ArtworkNavHeader :active-filter=\"search\" :filters=\"filters\"></ArtworkNavHeader>\n    <section :class=\"[$style.terms, 'container']\">\n      <header v-if=\"results && results.artworks.nodes.length\">\n        <h1 v-html=\"getTermInfo('name', true)\"></h1>\n      </header>\n      <div v-if=\"results && results.artworks.nodes.length\" :class=\"[$style.cards]\">\n        <p\n          v-if=\"isArtist && results.artworks.nodes[0].artists.nodes[0].dates\"\n          :class=\"[$style.label, 'label']\"\n        >\n          {{ results.artworks.nodes[0].artists.nodes[0].dates[0].display }}\n        </p>\n        <ProcessContent\n          v-if=\"hasBio\"\n          :content=\"getTermInfo('bio')\"\n          wrapper=\"section\"\n          :class=\"[$style.bio, { [$style.artistBio]: isArtist }]\"\n        ></ProcessContent>\n        <section\n          v-if=\"\n            results.artworks.nodes.length &&\n            results.artworks.nodes[0].artists.nodes[0].moduleHeader &&\n            results.artworks.nodes[0].artists.nodes[0].exhibitionModule\n          \"\n          :class=\"[$style.module, 'space-24-32-above']\"\n        >\n          <h2\n            v-if=\"\n              results.artworks.nodes.length &&\n              results.artworks.nodes[0].artists.nodes[0].moduleHeader\n            \"\n          >\n            {{ results.artworks.nodes[0].artists.nodes[0].moduleHeader }}\n          </h2>\n          <ProcessContent\n            v-if=\"\n              results.artworks.nodes.length &&\n              results.artworks.nodes[0].artists.nodes[0].exhibitionModule\n            \"\n            :content=\"results.artworks.nodes[0].artists.nodes[0].exhibitionModule\"\n          ></ProcessContent>\n        </section>\n        <section class=\"space-24-32-above\">\n          <h2 v-if=\"results.artworks.nodes.length && isArtist\">\n            Artwork by {{ getTermInfo('name') }}\n          </h2>\n          <ArtworkGrid\n            :data=\"results.artworks.nodes\"\n            :show-artist=\"subtype !== 'artist'\"\n            class=\"space-24-32-above\"\n          ></ArtworkGrid>\n        </section>\n      </div>\n      <GuggenPagination\n        v-if=\"results\"\n        :current-page=\"page\"\n        :per-page=\"limit\"\n        :sub-type=\"subtype\"\n        :sub-type-value=\"search\"\n        :total-page-count=\"pageCount\"\n        post-type=\"artwork\"\n      ></GuggenPagination>\n    </section>\n  </article>\n</template>\n\n<script setup lang=\"ts\">\nimport ArtworkGrid from '@/components/artwork/ArtworkGrid.vue';\nimport ArtworkNavHeader from '@/components/artwork/ArtworkNavHeader.vue';\nimport { artworkNavQuery } from '@/queries/ArtworkNavQuery';\nimport { computed, defineAsyncComponent, nextTick, onMounted, ref } from 'vue';\nimport { dataLoaded, useHandleError, useMetaData } from '@/composables/Common.js';\nimport gql from 'graphql-tag';\nimport { paginationQuery } from '@/queries/PaginationQuery';\nimport ProcessContent from '@/components/common/ProcessContent.vue';\nimport { useArtworkFilters } from '@/composables/ArtworkFilters.js';\nimport { useQuery } from 'villus';\n\nconst GuggenPagination = defineAsyncComponent(() => import('@/components/GuggenPagination.vue'));\n\nconst props = withDefaults(\n  defineProps<{\n    page?: number;\n    search?: string;\n    subtype: string;\n  }>(),\n  { page: 1 },\n);\n\nconst { getFilters } = useArtworkFilters();\nconst { handleError } = useHandleError();\nconst { setMetaDescription, setMetaTitle } = useMetaData();\n\nconst filters = ref({});\nconst limit = 27;\n\nconst currentTag = computed(() => {\n  if (isArtist.value) {\n    return results.value.artworks.nodes[0].artists.nodes;\n  }\n\n  if (isCategory.value) {\n    return results.value.artworks.nodes[0].categories.nodes.filter(\n      (tag) => tag.slug === searchTerm.value,\n    );\n  }\n\n  return results.value.artworks.nodes[0][`${getSubType.value}s`].nodes.filter(\n    (tag) => tag.slug === searchTerm.value,\n  );\n});\nconst getSubType = computed(() => {\n  const sub = props.subtype.split('_');\n\n  return sub.length > 1 ? `${sub[0]}${sub[1].charAt(0).toUpperCase()}${sub[1].slice(1)}` : sub[0];\n});\nconst hasBio = computed(\n  () =>\n    (isArtist.value && results.value.artworks.nodes[0].artists.nodes[0].bio) ||\n    props.subtype === 'movement' ||\n    props.subtype === 'special_collection' ||\n    (props.subtype === 'site' && results.value.artworks.nodes[0][`${props.subtype}s`].nodes[0].bio),\n);\nconst isArtist = computed(() => props.subtype === 'artist');\nconst isCategory = computed(() => props.subtype === 'category');\nconst metaDescription = computed(() => {\n  if (isArtist.value) {\n    return results.value.artworks.nodes[0].artists.nodes;\n  }\n\n  if (isCategory.value) {\n    return results.value.metaHub;\n  }\n\n  return results.value[`${getSubType.value}s`].nodes.filter((node) => node.description);\n});\nconst pageCount = computed(() => Math.ceil(results.value.totalCount / limit));\nconst searchTerm = computed(() => {\n  // re: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes\n  return (\n    props.search &&\n    props.search\n      .split('-')\n      .map((part) =>\n        part\n          .toLowerCase()\n          .normalize('NFD')\n          .replace(/\\p{Diacritic}/gu, ''),\n      )\n      .join('-')\n  );\n});\n\nconst termByCategoryQuery = gql`\n  query getArtworksTermByCategory(\n    $filter: String,\n    $limit: Int!,\n    $paged: Int,\n    $path: String,\n    $subType: String,\n    $subTypeValue: String,\n    $type: String\n  ) {\n    artworks(first: $limit, where: {\n      paged: $paged,\n      sortOrder: true,\n      categoryName: \"${searchTerm.value}\"\n    } ) {\n      nodes {\n        artists {\n          nodes {\n            name\n          }\n        }\n        categories {\n          nodes {\n            description\n            name\n            slug\n          }\n        }\n        featuredImage {\n          node {\n            altText\n            sourceUrl\n          }\n        }\n        imageSrcset\n        slug\n        title\n      }\n    }\n    metaHub(targetPath: $path) {\n      description\n      image_alt\n      image_src\n      title\n    }\n    ${artworkNavQuery}\n    ${paginationQuery}\n  }\n`;\nconst termQuery = gql`\n  query getArtworksTerm(\n    $filter: String,\n    $limit: Int!,\n    $paged: Int,\n    $subType: String,\n    $subTypeValue: String,\n    $type: String\n  ) {\n    artworks(first: $limit, where: {\n      paged: $paged,\n      sortOrder: true,\n      ${getSubType.value}: \"${searchTerm.value}\"\n    } ) {\n      nodes {\n        artists {\n          nodes {\n            dates {\n              display\n            }\n            name\n          }\n        }\n        featuredImage {\n          node {\n            altText\n            sourceUrl\n          }\n        }\n        imageSrcset\n        slug\n        title\n        ${getSubType.value}s {\n          nodes {\n            bio\n            description\n            ${isArtist.value ? 'exhibitionModule' : ''}\n            ${isArtist.value ? 'moduleHeader' : ''}\n            name\n            slug\n          }\n        }\n      }\n    }\n    ${artworkNavQuery}\n    ${paginationQuery}\n  }\n`;\nconst artworkTermQuery = isCategory.value ? termByCategoryQuery : termQuery;\nconst queryVariables = {\n  limit: limit,\n  paged: +props.page,\n  path: `/artwork/category/${props.search}`,\n  subType: props.subtype,\n  subTypeValue: props.search,\n  type: 'artwork',\n};\n\nconst { data: results, isFetching } = useQuery({\n  onData: (data) => {\n    if (data && Object.keys(data).length && data.artworks.nodes.length) {\n      const title = prepareTerm(data.artworks.nodes[0]);\n\n      filters.value = getFilters(data);\n      setMetaTitle(title);\n      nextTick(() => {\n        currentTag.value[0].description = metaDescription.value[0].description;\n        currentTag.value[0].title = title;\n        setMetaDescription(metaDescription.value[0].description);\n      });\n      dataLoaded();\n    }\n\n    if (!data || data.artworks.nodes.length === 0) {\n      handleError('ArtworkTerm', `Page ${props.page}, limit ${limit}`);\n    }\n  },\n  query: artworkTermQuery,\n  skip: ({ paged }) => isNaN(paged),\n  variables: queryVariables,\n});\n\nif (isNaN(props.page)) {\n  handleError('ArtworkTerm', `Page ${props.page}, limit ${limit}`);\n}\n\nif (isNaN(props.page)) {\n  handleError('ArtworkTerm', `Page ${props.page}, limit ${limit}`);\n}\n\nonMounted(() => dataLoaded(!isFetching.value));\n\nfunction getTermInfo(term: string, capitalize: boolean = false): string {\n  if (props.subtype === 'category') {\n    const category = results.value.artworks.nodes[0].categories.nodes.filter(\n      (category) => category.slug === searchTerm.value,\n    );\n\n    return category[0].name;\n  }\n\n  if (props.subtype === 'decade') {\n    return `Art from the ${searchTerm.value}`;\n  }\n\n  if (term === 'bio') {\n    const currentBio = results.value.artworks.nodes[0][`${getSubType.value}s`].nodes.filter(\n      (bio) => bio.slug === searchTerm.value,\n    );\n\n    return prepareBio(currentBio[0].bio);\n  }\n\n  if (capitalize) {\n    const title = currentTag.value[0].name.split(' ');\n\n    return title\n      .map((word) => {\n        return word === 'on' || word === 'of' ? word : word[0].toUpperCase() + word.substring(1);\n      })\n      .join(' ');\n  }\n\n  return currentTag.value[0].name;\n}\n\nfunction prepareBio(bio: string): string {\n  // remove extra TMS collection bio information from view\n  if (bio) {\n    const bioBreak = /<p>.*?<br\\s*\\/*><br\\s*\\/*>/; // <p>b. ... <br><br>\n    const bioParagraph = /<p>b\\..*?<\\/p>/; // <p>b. ... </p>\n    const bioDouble = /<p>.*?<\\/*br>b\\..*?<\\/p>/; // multiple\n    const bioEstablished = /<p>est.*?<\\/p>/; // \"established\"\n\n    if (bioBreak.test(bio)) {\n      return bio.replace(bioBreak, '<p>');\n    }\n\n    if (bioParagraph.test(bio)) {\n      return bio.replace(bioParagraph, '');\n    }\n\n    if (bioDouble.test(bio)) {\n      return bio.replace(bioDouble, '').replace(bioDouble, '');\n    }\n\n    if (bioEstablished.test(bio)) {\n      return bio.replace(bioEstablished, '');\n    }\n\n    return bio;\n  }\n\n  return '';\n}\n\nfunction prepareTerm(artwork): string {\n  if (isArtist.value) {\n    return artwork.artists.nodes[0].name;\n  }\n\n  if (isCategory.value) {\n    const category = artwork.categories.nodes.filter((cat) => cat.slug === searchTerm.value);\n\n    return category[0].name;\n  }\n\n  const term = artwork[`${getSubType.value}s`].nodes.filter(\n    (term) => term.slug === searchTerm.value,\n  );\n\n  if (props.subtype === 'decade') {\n    return `Art from the ${term[0].name}`;\n  }\n\n  return term[0].name;\n}\n</script>\n\n<style lang=\"scss\" module>\n.module {\n  :global(.module) {\n    margin-top: 1rem;\n  }\n}\n\n.terms {\n  margin-top: 0;\n\n  h2 {\n    margin-top: 0;\n  }\n}\n\n@media (min-width: $break-point) {\n  .terms {\n    @include grid;\n    @include space-24-32-above;\n\n    > header {\n      grid-column: 1 / span 8;\n    }\n\n    .back,\n    .cards {\n      grid-column: span 12;\n    }\n\n    .cards {\n      @include grid;\n\n      > * {\n        grid-column: span 12;\n      }\n\n      > nav,\n      .bio,\n      .label {\n        grid-column: 1 / span 8;\n      }\n\n      .bio {\n        > p {\n          margin-top: 0;\n        }\n\n        &.artist-bio {\n          p {\n            margin-top: 1rem;\n          }\n        }\n      }\n\n      .label {\n        margin-top: 0;\n      }\n\n      .module {\n        grid-column: 1 / span 8;\n      }\n    }\n\n    .discover-more {\n      grid-column: 1 / span 8;\n    }\n\n    h1 {\n      margin-top: 0;\n    }\n  }\n}\n</style>\n"],"file":"assets/ArtworkTerm-CciVsn0p.js"}