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AAS,oHAGnBwJ,EAAc3K,KAAI8J,GAAS,6CACCO,EAAa5H,UAAUiF,KAAKoC,0BACvD3J,KAAK,mCAET,iBAEDyK,EAAWzJ,OAAS,sGAGhByJ,EAAW5K,KAAI8J,GAAS,6CACIO,EAAa5H,UAAUiF,KAAKoC,0BACvD3J,KAAK,mCAET,aArBL4G,EAAUiE,UAAY,0CAyB1B,E,wDCnXK,MAAMpC,GAAmBqC,E,SAAAA,IAAkB,SAASC,GACzD,MAAM,kBAAEC,EAAiB,QAAEC,EAAO,YAAEC,EAAW,WAAEC,EAAU,OAAEtC,EAAM,UAAEuC,EAAS,aAAElB,GAC9Ea,EAEInE,EAAYsD,EAAatD,UAG/BA,EAAUyE,UAAUC,OAAO,kBAA+B,IAAZL,GAE9C,MAAMM,EAAcP,EAAoB,EAClCQ,EAAyB,IAAZP,EAAgB,EAAIA,EAGvCrE,EAAUiE,UAAY,8DACmCU,QAAkBC,sBACnED,OAAiBC,iEAGnBP,GAAW,EAAI,uCAAyC,gGAIpDC,EAAc,sCAAwC,wBAEhDE,EAAUJ,EAAoB,8BACxBA,EAAoB,+SAShCG,EAAa,sCAAwC,wBAE/CC,EAAUJ,EAAoB,8BACxBA,EAAoB,uOAW1C,IAAIpE,EAAU6E,iBAAiB,MAAMrC,SAAQsC,IAC3CA,EAAQhC,iBAAiB,SAASC,IAChCA,EAAMgC,iBACN9C,EAAOc,EAAMiC,cAAcxH,QAAQmF,MAAM,GACzC,GAEN,G","sources":["webpack://pratt-main/../pratt/static/js/components/algolia/hit-helpers.js","webpack://pratt-main/../pratt/static/js/components/algolia/panel.js","webpack://pratt-main/../pratt/static/js/components/algolia/templates/refinement-list.js","webpack://pratt-main/../pratt/static/js/components/algolia/search-client.js","webpack://pratt-main/./static/js/components/algolia/event-search.js","webpack://pratt-main/../pratt/static/js/components/algolia/pagination.js"],"sourcesContent":["export const MONTHS = [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n];\n\nexport const TIME_ZONE = 'America/New_York';\n\nexport class HitHelpers {\n static getTypeDisplay(type) {\n switch (type) {\n case 'post':\n return 'News';\n case 'prattfolio-story':\n return 'Prattfolio Story';\n default:\n return type[0].toLocaleUpperCase() + type.slice(1);\n }\n }\n\n static Courses = {\n /* eslint-disable */\n sectionsAsHtml(hit) {\n // prettier-ignore\n return `\n \n `;\n },\n /* eslint-enable */\n };\n\n static Events = {\n /* eslint-disable */\n dateAsHTML(hit) {\n const start = new Date(\n new Date(hit.occurrences[0].start).toLocaleString('en-US', { timeZone: TIME_ZONE }),\n );\n // prettier-ignore\n return `\n \n `;\n },\n /* eslint-enable */\n\n time(hit, opts = {}) {\n if (!hit.occurrences.length) {\n return '';\n }\n\n const start = new Date(\n new Date(hit.occurrences[0].start).toLocaleString('en-US', { timeZone: TIME_ZONE }),\n );\n const end = new Date(\n new Date(hit.occurrences[0].end).toLocaleString('en-US', { timeZone: TIME_ZONE }),\n );\n\n const timeFormat = new Intl.DateTimeFormat('en-US', { timeStyle: 'short' });\n const dateFormat = new Intl.DateTimeFormat('en-US', {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n const dateFormatNoYear = new Intl.DateTimeFormat('en-US', { month: 'long', day: 'numeric' });\n\n const isSameDay =\n start.getFullYear() === end.getFullYear() &&\n start.getMonth() === end.getMonth() &&\n start.getDate() === end.getDate();\n\n const isSameYear = start.getFullYear() === end.getFullYear();\n\n let time;\n if (hit.is_all_day) {\n if (isSameDay) {\n time = 'All Day';\n if (opts.includeDay) {\n time = dateFormat.format(start);\n }\n } else {\n if (isSameYear) {\n time = `${dateFormatNoYear.format(start)} – ${dateFormat.format(\n end,\n )} All Day`;\n } else {\n time = `${dateFormat.format(start)} – ${dateFormat.format(\n end,\n )} All Day`;\n }\n }\n } else {\n if (isSameDay) {\n time = `${timeFormat.format(start)} – ${timeFormat.format(end)}`;\n if (opts.includeDay) {\n time = `${dateFormat.format(start)} ${time}`;\n }\n } else {\n let startDateDay = `${dateFormat.format(start)}`;\n if (isSameYear) {\n startDateDay = `${dateFormatNoYear.format(start)}`;\n }\n const endDateDay = `${dateFormat.format(end)}`;\n const startDateTime = `${timeFormat.format(start)}`;\n const endDateTime = `${timeFormat.format(end)}`;\n time = `${startDateDay} – ${endDateDay} ${startDateTime} – ${endDateTime}`;\n }\n }\n\n return time;\n },\n\n location(hit) {\n if (hit.event_type === 'hybrid') {\n return `Online and ${hit.location}`;\n } else if (hit.event_type === 'physical') {\n return hit.location;\n } else {\n return 'Online Event';\n }\n },\n };\n}\n","import { refinementList, panel } from 'instantsearch.js/es/widgets';\n\nexport const refinementListWithPanel = header =>\n panel({\n templates: {\n header: `

${header}

`,\n },\n hidden(options) {\n return options.items.length === 0;\n },\n })(refinementList);\n","export const refinementListTemplate = `\n \n`;\n","import algoliasearch from 'algoliasearch/lite';\n\nconst { ALGOLIA_APPLICATION_ID, ALGOLIA_SEARCH_API_KEY } = window.pratt.env || {};\n\nlet searchClient = null;\n\ntry {\n searchClient = algoliasearch(ALGOLIA_APPLICATION_ID, ALGOLIA_SEARCH_API_KEY);\n} catch (e) {\n console.error(e);\n}\n\nexport default searchClient;\n","import instantsearch from 'instantsearch.js';\nimport {\n configure,\n searchBox,\n toggleRefinement,\n clearRefinements,\n} from 'instantsearch.js/es/widgets';\nimport { connectRange, connectHits } from 'instantsearch.js/es/connectors';\nimport searchClient from '@pratt/js/components/algolia/search-client';\nimport { HitHelpers, MONTHS, TIME_ZONE } from '@pratt/js/components/algolia/hit-helpers';\nimport { customPagination } from '@pratt/js/components/algolia/pagination';\nimport { refinementListWithPanel } from '@pratt/js/components/algolia/panel';\nimport { refinementListTemplate } from '@pratt/js/components/algolia/templates/refinement-list';\n\nfunction getDateET(year, month, day) {\n const date = new Date(Date.UTC(year, month, day));\n\n const utcDate = new Date(date.toLocaleString('en-US', { timeZone: 'UTC' }));\n const tzDate = new Date(date.toLocaleString('en-US', { timeZone: TIME_ZONE }));\n const offset = utcDate.getTime() - tzDate.getTime();\n\n date.setTime(date.getTime() + offset);\n return date;\n}\n\nclass EventSearch {\n constructor(rootEl) {\n this.rootEl = rootEl;\n if (!this.rootEl) {\n throw new Error('Root event search element not found.');\n }\n\n this.hitsPerPage = 24;\n\n this.indexName = this.rootEl.dataset['algoliaIndex'];\n this.minYear = Number.parseInt(this.rootEl.dataset['minYear'], 10);\n this.maxYear = Number.parseInt(this.rootEl.dataset['maxYear'], 10);\n\n this.search = instantsearch({\n indexName: this.indexName,\n searchClient: searchClient,\n routing: true,\n insights: true,\n });\n\n // If URL has query params, use those as starting range. Otherwise get today's month & year.\n let startDate = new Date();\n if (window.location.search) {\n const urlParams = new URLSearchParams(window.location.search);\n const params = Object.fromEntries(urlParams.entries());\n const startParam = params[`${this.indexName}[range][occurrences.start]`];\n if (startParam) {\n startDate = new Date(Number(startParam.replace(':', '')));\n }\n }\n this.month = startDate.getMonth();\n this.year = startDate.getFullYear();\n\n this.customHits = connectHits(this.renderHits.bind(this));\n\n this.init();\n this.search.start();\n }\n\n init() {\n this.search.addWidgets([\n // https://www.algolia.com/doc/api-reference/widgets/configure/js/\n // Parameter options: https://www.algolia.com/doc/api-reference/search-api-parameters/\n configure({\n hitsPerPage: this.hitsPerPage,\n distinct: true,\n // Force faceting to be applied after de-duplication (via the Distinct setting)\n facetingAfterDistinct: true,\n // Filter results by 'type' facet\n // https://www.algolia.com/doc/api-reference/api-parameters/filters/#facet-filters\n filters: `type:\"event\"`,\n }),\n\n this.dateInput({\n onRefine: () => {\n // Earliest date is first day of month at 12:00:00AM\n const currentDate = new Date(\n new Date().getUTCFullYear(),\n new Date().getUTCMonth(),\n new Date().getUTCDate(),\n );\n const currentMonthYear = new Date(\n new Date(currentDate).getUTCFullYear(),\n new Date(currentDate).getUTCMonth(),\n 1,\n );\n const setMonthYear = new Date(new Date(this.year), new Date(this.month), 1);\n\n let earliestDate = getDateET(this.year, this.month, 1);\n\n if (currentMonthYear.getTime() === setMonthYear.getTime()) {\n earliestDate = getDateET(\n new Date(currentDate).getUTCFullYear(),\n new Date(currentDate).getUTCMonth(),\n new Date().getUTCDate(),\n );\n }\n\n return [earliestDate.getTime(), undefined];\n },\n })({\n attribute: 'occurrences.end',\n }),\n\n this.dateInput({\n onRefine: () => {\n // Latest date is last day of month at 11:59:59PM\n const latestDate = getDateET(this.year, this.month + 1, 1);\n latestDate.setTime(latestDate.getTime() - 1000);\n return [undefined, latestDate.getTime()];\n },\n })({\n attribute: 'occurrences.start',\n }),\n\n searchBox({\n container: '.js-event-search-input',\n placeholder: 'Search',\n showSubmit: false,\n }),\n\n clearRefinements({\n container: '.js-event-search-clear',\n templates: {\n resetLabel: 'Reset',\n },\n excludedAttributes: ['occurrences.start', 'occurrences.end'],\n }),\n\n refinementListWithPanel('School')({\n container: '.js-event-search-schools-input',\n attribute: 'schools',\n operator: 'and',\n limit: 10,\n showMore: true,\n showMoreLimit: 100,\n sortBy: ['name:asc'],\n templates: {\n item: refinementListTemplate,\n },\n }),\n\n refinementListWithPanel('Department')({\n container: '.js-event-search-departments-input',\n attribute: 'departments',\n operator: 'and',\n limit: 10,\n showMore: true,\n showMoreLimit: 100,\n sortBy: ['name:asc'],\n templates: {\n item: refinementListTemplate,\n },\n }),\n\n refinementListWithPanel('Office')({\n container: '.js-event-search-offices-input',\n attribute: 'offices',\n operator: 'and',\n limit: 10,\n showMore: true,\n showMoreLimit: 100,\n sortBy: ['name:asc'],\n templates: {\n item: refinementListTemplate,\n },\n }),\n\n refinementListWithPanel('Special Categories')({\n container: '.js-event-search-special-events-input',\n attribute: 'events_cats',\n operator: 'and',\n limit: 10,\n showMore: true,\n showMoreLimit: 100,\n sortBy: ['name:asc'],\n templates: {\n item: refinementListTemplate,\n },\n }),\n\n toggleRefinement({\n container: '.js-event-search-toggle-input',\n attribute: 'is_internal',\n templates: {\n labelText: 'Internal Only',\n },\n }),\n\n // https://www.algolia.com/doc/api-reference/widgets/hits/js/\n this.customHits({\n container: '.js-event-search-hits',\n templates: {\n /* eslint-disable */\n item: hit => {\n // prettier-ignore\n return `\n
\n
\n\n ${HitHelpers.Events.dateAsHTML(hit)}\n\n
\n\n
\n ${hit.is_internal ? '

Internal

' : ''}\n

\n \n ${hit.title}\n \n

\n
\n\n
\n

\n ${HitHelpers.Events.time(hit)}\n

\n ${hit.location ? `\n

\n ${HitHelpers.Events.location(hit)}\n

\n ` : ''}\n
\n\n
\n\n ${hit.thumbnail ? `\n
\n \"${hit.title}\"\n
\n ` : ''}\n
\n
\n `;\n },\n /* eslint-enable */\n },\n }),\n\n customPagination({\n container: document.querySelector('.js-event-search-pagination'),\n }),\n ]);\n }\n\n dateInput({ onRefine }) {\n return connectRange(({ refine }, isFirstRender) => {\n const container = document.querySelector('.js-event-search-date-input');\n let monthSelect = container.querySelector('select#month-input');\n let yearSelect = container.querySelector('select#year-input');\n\n if (isFirstRender) {\n if (!monthSelect) {\n const monthContainer = container.querySelector('.js-event-search-date-month-input');\n monthSelect = document.createElement('select');\n monthSelect.id = 'month-input';\n MONTHS.forEach((month, index) => {\n const option = document.createElement('option');\n option.value = index;\n option.innerText = month;\n monthSelect.appendChild(option);\n });\n monthSelect.value = this.month;\n monthContainer.appendChild(monthSelect);\n }\n\n monthSelect.addEventListener('change', event => {\n this.month = Number.parseInt(event.target.value, 10);\n refine(onRefine());\n });\n\n if (!yearSelect) {\n const yearContainer = container.querySelector('.js-event-search-date-year-input');\n yearSelect = document.createElement('select');\n yearSelect.id = 'year-input';\n const years = [];\n // Add the year options. Have it start one year before the current year.\n for (let y = this.minYear - 1; y <= this.maxYear; y++) {\n years.push(y);\n }\n years.forEach(year => {\n const option = document.createElement('option');\n option.value = year;\n option.innerText = year;\n yearSelect.appendChild(option);\n });\n yearSelect.value = this.year;\n yearContainer.appendChild(yearSelect);\n }\n\n yearSelect.addEventListener('change', event => {\n this.year = Number.parseInt(event.target.value, 10);\n refine(onRefine());\n });\n\n refine(onRefine());\n }\n });\n }\n\n renderHits(renderOpts) {\n const { widgetParams } = renderOpts;\n\n const container = document.querySelector(widgetParams.container);\n\n // Earliest date is first day of month at 12:00:00AM\n const earliestDate = getDateET(this.year, this.month, 1);\n // Latest date is last day of month at 11:59:59PM\n const latestDate = getDateET(this.year, this.month + 1, 1);\n latestDate.setTime(latestDate.getTime() - 1000);\n\n const allIndividualEvents = renderOpts.hits.flatMap(event => {\n const individualEvents = [];\n event.occurrences.forEach(occurrence => {\n // Only get the occurrences that match the current filter\n if (occurrence.end >= earliestDate.getTime() && occurrence.start <= latestDate.getTime()) {\n individualEvents.push({\n ...event,\n occurrences: [occurrence],\n });\n }\n });\n return individualEvents;\n });\n\n const currentDate = new Date(\n new Date().getUTCFullYear(),\n new Date().getUTCMonth(),\n new Date().getUTCDate(),\n );\n const currentEvents = [];\n const pastEvents = [];\n\n allIndividualEvents\n .sort((a, b) => a.occurrences[0].start - b.occurrences[0].start)\n .forEach(event => {\n event.is_past = event.occurrences[0].end < currentDate;\n if (event.is_past) {\n pastEvents.push(event);\n } else {\n currentEvents.push(event);\n }\n });\n\n if (!allIndividualEvents.length) {\n container.innerHTML = `

No events

`;\n } else {\n /* eslint-disable */\n // prettier-ignore\n container.innerHTML = `\n ${currentEvents.length ? `\n

Ongoing and Future Events

\n
    \n ${currentEvents.map(event => `\n
  1. ${widgetParams.templates.item(event)}
  2. \n `).join('\\n')}\n
\n `: ''}\n\n ${pastEvents.length ? `\n

Past Events

\n
    \n ${pastEvents.map(event => `\n
  1. ${widgetParams.templates.item(event)}
  2. \n `).join('\\n')}\n
\n `: ''}\n `;\n /* eslint-enable */\n }\n }\n}\n\nexport default EventSearch;\n","import { connectPagination } from 'instantsearch.js/es/connectors';\n\n// Render custom pagination widget\n// https://www.algolia.com/doc/api-reference/widgets/pagination/js/#connector\nexport const customPagination = connectPagination(function(renderOptions) {\n const { currentRefinement, nbPages, isFirstPage, isLastPage, refine, createURL, widgetParams } =\n renderOptions;\n\n const container = widgetParams.container;\n\n // Hide pagination if no results\n container.classList.toggle('visually-hidden', nbPages === 0);\n\n const currentPage = currentRefinement + 1;\n const totalPages = nbPages === 0 ? 1 : nbPages;\n\n /* eslint-disable */\n container.innerHTML = `\n
\n ${currentPage} / ${totalPages}\n
\n
\n \n Previous page\n \n \n \n \n \n Next page\n \n \n \n \n
\n `;\n /* eslint-enable */\n\n [...container.querySelectorAll('a')].forEach(element => {\n element.addEventListener('click', event => {\n event.preventDefault();\n refine(event.currentTarget.dataset.value);\n });\n });\n});\n"],"names":["MONTHS","TIME_ZONE","HitHelpers","getTypeDisplay","type","toLocaleUpperCase","slice","static","sectionsAsHtml","hit","sections","map","section","days","join","start_time","end_time","location","loc","name","dateAsHTML","start","Date","occurrences","toLocaleString","timeZone","getMonth","getDate","time","opts","length","end","timeFormat","Intl","DateTimeFormat","timeStyle","dateFormat","year","month","day","dateFormatNoYear","isSameDay","getFullYear","isSameYear","is_all_day","includeDay","format","startDateDay","event_type","refinementListWithPanel","header","panel","templates","hidden","options","items","refinementList","refinementListTemplate","ALGOLIA_APPLICATION_ID","ALGOLIA_SEARCH_API_KEY","window","pratt","env","searchClient","algoliasearch","e","console","error","getDateET","date","UTC","utcDate","tzDate","offset","getTime","setTime","constructor","rootEl","this","Error","hitsPerPage","indexName","dataset","minYear","Number","parseInt","maxYear","search","instantsearch","routing","insights","startDate","urlParams","URLSearchParams","startParam","Object","fromEntries","entries","replace","customHits","connectHits","renderHits","bind","init","addWidgets","configure","distinct","facetingAfterDistinct","filters","dateInput","onRefine","currentDate","getUTCFullYear","getUTCMonth","getUTCDate","currentMonthYear","setMonthYear","earliestDate","undefined","attribute","latestDate","searchBox","container","placeholder","showSubmit","clearRefinements","resetLabel","excludedAttributes","operator","limit","showMore","showMoreLimit","sortBy","item","toggleRefinement","labelText","thumbnail","is_featured","feature_level","is_past","palette","colorway_special","colorway_tertiary","colorway_secondary","Events","is_internal","url","objectID","__queryID","__position","title","customPagination","document","querySelector","connectRange","refine","isFirstRender","monthSelect","yearSelect","monthContainer","createElement","id","forEach","index","option","value","innerText","appendChild","addEventListener","event","target","yearContainer","years","y","push","renderOpts","widgetParams","allIndividualEvents","hits","flatMap","individualEvents","occurrence","currentEvents","pastEvents","sort","a","b","innerHTML","connectPagination","renderOptions","currentRefinement","nbPages","isFirstPage","isLastPage","createURL","classList","toggle","currentPage","totalPages","querySelectorAll","element","preventDefault","currentTarget"],"sourceRoot":""}