{"version":3,"file":"expand-DU5Jyf-3.js","sources":["../../../app/javascript/src/utils/htmlUtils.js","../../../app/javascript/src/components/Containers/HorizontalScrollWithIndicator.vue","../../../app/javascript/src/components/ListTrips.vue","../../../app/assets/images/mba/icons/fold.svg?component","../../../app/assets/images/mba/icons/expand.svg?component"],"sourcesContent":["export function getHorizontalVisibilityPercentage(el, container) {\n  const elementRect = el.getBoundingClientRect();\n  const containerRect = container.getBoundingClientRect();\n  const visibleWidth = Math.min(elementRect.right, containerRect.right) - Math.max(elementRect.left, containerRect.left);\n  return visibleWidth >= 0 ? (visibleWidth / elementRect.width) * 100 : 0;\n}","<template>\n  <slot :scroll=\"scroll\"/>\n\n  <div v-show=\"show\" class=\"scroll-indicator\">\n    <div v-for=\"(_, n) in count\"\n         class=\"dot\"\n         :class=\"{ active: n === visibleIndex }\"\n    ></div>\n  </div>\n</template>\n\n<script setup>\nimport { ref } from \"vue\";\nimport { useDebounceFn } from \"@vueuse/core\";\nimport { getHorizontalVisibilityPercentage } from \"@/utils/htmlUtils.js\";\nimport { findIndexOfMax } from \"@/utils/numberUtils.js\";\n\nconst props = defineProps({\n  show: Boolean,\n  count: Number,\n  parent: String,\n  child: String,\n});\nconst visibleIndex = ref(0);\n\nconst scroll = useDebounceFn(() => {\n  const parentEl = document.querySelector(props.parent);\n  const childList = [...parentEl.querySelectorAll(props.child)];\n  const visibilityList = childList.map(el => getHorizontalVisibilityPercentage(el, parentEl));\n  visibleIndex.value = findIndexOfMax(visibilityList);\n}, 100);\n</script>\n\n<style lang=\"scss\" scoped>\n.scroll-indicator {\n  display: flex;\n  gap: 8px;\n\n  .dot {\n    width: 6px;\n    aspect-ratio: 1/1;\n    background-color: $grey-50;\n    border-radius: 50%;\n\n    &.active {\n      background-color: $brand-primary;\n    }\n  }\n}\n</style>","<template>\n  <FloatingContainer v-if=\"continents\">\n    <div ref=\"continentEl\" class=\"continents\">\n      <button v-for=\"(value, label) in continentList\"\n              @click=\"selectedContinent = value\"\n              :class=\"{ selected: selectedContinent === value }\"\n      >{{ label }}\n      </button>\n    </div>\n  </FloatingContainer>\n\n  <FloatingContainerWithIndicator\n    :show=\"mobile\"\n    :count=\"products.length\"\n    parent=\".products\"\n    child=\".itinerary\"\n    v-slot=\"{ scroll }\"\n  >\n    <div ref=\"productListEl\" class=\"products\" @scroll=\"scroll()\">\n      <ProductCard\n        class=\"itinerary\"\n        v-for=\"product in products\"\n        :key=\"product.id\"\n        :product=\"product\"\n      />\n    </div>\n  </FloatingContainerWithIndicator>\n</template>\n\n<script setup>\nimport api from '@/utils/api.js';\nimport { useShared } from \"@/helpers/vueHelpers.js\";\nimport { ref, onMounted, watch, nextTick } from \"vue\";\nimport { deserializeJsonApi } from '@/utils/jsonApiDeserializer.js';\nimport ProductCard from \"@/modules/Explore/ProductCard2.vue\";\nimport FloatingContainer from \"@/components/Containers/FloatingContainer.vue\";\nimport FloatingContainerWithIndicator from \"@/components/Containers/FloatingContainerWithIndicator.vue\";\n\nconst props = defineProps({\n  apiPath: String,\n  continents: {\n    type: Boolean,\n    default: true\n  }\n});\nconst { mobile } = useShared();\nconst continentEl = ref(null);\nconst productListEl = ref(null);\n\nconst products = ref([]);\nconst continentList = ref({\n  'North America': \"North America\",\n  'South America': \"South America\",\n  'Europe': \"Europe\",\n  'Africa': \"Africa\",\n  'Asia': \"Asia\",\n  'Oceania': \"Australia\",\n  // \"Antarctica\"\n});\nconst selectedContinent = ref('North America');\n\nonMounted(() => {\n  loadContinent(selectedContinent.value);\n});\n\nwatch(selectedContinent, loadContinent);\n\nasync function loadContinent(continent) {\n  try {\n    const url = props.continents ? `${props.apiPath}?continents[]=${continent}` : `${props.apiPath}`;\n    const { data } = await api.get(url);\n    const allEvents = await deserializeJsonApi(data);\n    products.value = allEvents.map(event => {\n      const product = { ...event.product };\n      product.event = event;\n      return product;\n    });\n    nextTick(() => productListEl.value.scrollLeft = 0);\n  } catch (error) {\n    console.log(error);\n    alert('Failed to load mba itineraries');\n  }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.continents {\n  @include hide-scrollbar;\n\n  display: flex;\n  justify-content: center;\n  overflow: auto;\n  gap: 12px;\n\n  @include mobile {\n    padding: 0 24px;\n    justify-content: flex-start;\n  }\n\n  button {\n    color: $grey-300;\n    padding: 14px 28px;\n    border-radius: 56px;\n    border: 1px solid $grey-50;\n    background: rgba(255, 255, 255, 0.60);\n    white-space: nowrap;\n\n    &.selected {\n      color: white;\n      background-color: $brand-primary;\n    }\n  }\n}\n\n.products {\n  width: 100%;\n  display: grid;\n  grid-template-columns: repeat(4, 1fr);\n  gap: 20px;\n\n  @include mobile {\n    padding: 0 24px;\n    display: flex;\n    overflow-x: auto;\n    gap: 12px;\n    scroll-snap-type: x mandatory;\n\n    .itinerary {\n      min-width: 88vw;\n      flex-shrink: 0;\n      scroll-snap-align: center;\n    }\n  }\n}\n</style>","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createStaticVNode as _createStaticVNode } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 24 24\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createStaticVNode(\"<g filter=\\\"url(#filter0_b_9401_2119)\\\"><rect width=\\\"24\\\" height=\\\"24\\\" rx=\\\"12\\\" fill=\\\"currentColor\\\"></rect><path d=\\\"M18.4956 12.2499C18.4956 12.4487 18.4386 12.6393 18.3371 12.7798C18.2356 12.9204 18.0979 12.9993 17.9544 12.9993H6.0471C5.90355 12.9993 5.76589 12.9204 5.66439 12.7798C5.56288 12.6393 5.50586 12.4487 5.50586 12.2499C5.50586 12.0511 5.56288 11.8605 5.66439 11.72C5.76589 11.5794 5.90355 11.5005 6.0471 11.5005H17.9544C18.0979 11.5005 18.2356 11.5794 18.3371 11.72C18.4386 11.8605 18.4956 12.0511 18.4956 12.2499Z\\\" fill=\\\"white\\\"></path></g><defs><filter id=\\\"filter0_b_9401_2119\\\" x=\\\"-3.28528\\\" y=\\\"-3.28528\\\" width=\\\"30.5706\\\" height=\\\"30.5706\\\" filterUnits=\\\"userSpaceOnUse\\\" color-interpolation-filters=\\\"sRGB\\\"><feFlood flood-opacity=\\\"0\\\" result=\\\"BackgroundImageFix\\\"></feFlood><feGaussianBlur in=\\\"BackgroundImageFix\\\" stdDeviation=\\\"1.64264\\\"></feGaussianBlur><feComposite in2=\\\"SourceAlpha\\\" operator=\\\"in\\\" result=\\\"effect1_backgroundBlur_9401_2119\\\"></feComposite><feBlend mode=\\\"normal\\\" in=\\\"SourceGraphic\\\" in2=\\\"effect1_backgroundBlur_9401_2119\\\" result=\\\"shape\\\"></feBlend></filter></defs>\", 2)\n  ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = {\n  viewBox: \"0 0 24 24\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}\n\nexport function render(_ctx, _cache) {\n  return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n    _createElementVNode(\"rect\", {\n      width: \"24\",\n      height: \"24\",\n      rx: \"12\",\n      fill: \"currentColor\"\n    }, null, -1),\n    _createElementVNode(\"path\", {\n      d: \"M16.8716 12.0003C16.8716 12.1079 16.8289 12.2112 16.7527 12.2873C16.6766 12.3634 16.5733 12.4062 16.4657 12.4062H12.4062V16.4657C12.4062 16.5733 12.3634 16.6766 12.2873 16.7527C12.2112 16.8289 12.1079 16.8716 12.0003 16.8716C11.8926 16.8716 11.7894 16.8289 11.7132 16.7527C11.6371 16.6766 11.5943 16.5733 11.5943 16.4657V12.4062H7.53485C7.42719 12.4062 7.32394 12.3634 7.24781 12.2873C7.17168 12.2112 7.12891 12.1079 7.12891 12.0003C7.12891 11.8926 7.17168 11.7894 7.24781 11.7132C7.32394 11.6371 7.42719 11.5943 7.53485 11.5943H11.5943V7.53485C11.5943 7.42719 11.6371 7.32394 11.7132 7.24781C11.7894 7.17168 11.8926 7.12891 12.0003 7.12891C12.1079 7.12891 12.2112 7.17168 12.2873 7.24781C12.3634 7.32394 12.4062 7.42719 12.4062 7.53485V11.5943H16.4657C16.5733 11.5943 16.6766 11.6371 16.7527 11.7132C16.8289 11.7894 16.8716 11.8926 16.8716 12.0003Z\",\n      fill: \"white\"\n    }, null, -1)\n  ])))\n}\nexport default { render: render }"],"names":["getHorizontalVisibilityPercentage","el","container","elementRect","containerRect","visibleWidth","props","__props","visibleIndex","ref","scroll","useDebounceFn","parentEl","visibilityList","findIndexOfMax","mobile","useShared","continentEl","productListEl","products","continentList","selectedContinent","onMounted","loadContinent","watch","continent","url","data","api","allEvents","deserializeJsonApi","event","product","nextTick","error","_hoisted_1","render","_ctx","_cache","_openBlock","_createElementBlock","_createStaticVNode","FoldIcon","_createElementVNode","ExpandIcon"],"mappings":"whBAAO,SAASA,EAAkCC,EAAIC,EAAW,CAC/D,MAAMC,EAAcF,EAAG,sBAAuB,EACxCG,EAAgBF,EAAU,sBAAuB,EACjDG,EAAe,KAAK,IAAIF,EAAY,MAAOC,EAAc,KAAK,EAAI,KAAK,IAAID,EAAY,KAAMC,EAAc,IAAI,EACrH,OAAOC,GAAgB,EAAKA,EAAeF,EAAY,MAAS,IAAM,CACxE,oJCYA,MAAMG,EAAQC,EAMRC,EAAeC,EAAI,CAAC,EAEpBC,EAASC,EAAc,IAAM,CACjC,MAAMC,EAAW,SAAS,cAAcN,EAAM,MAAM,EAE9CO,EADY,CAAC,GAAGD,EAAS,iBAAiBN,EAAM,KAAK,CAAC,EAC3B,IAAIL,GAAMD,EAAkCC,EAAIW,CAAQ,CAAC,EAC1FJ,EAAa,MAAQM,EAAeD,CAAc,CACpD,EAAG,GAAG,ujBCQN,MAAMP,EAAQC,EAOR,CAAE,OAAAQ,CAAQ,EAAGC,EAAW,EACxBC,EAAcR,EA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