{"version":3,"file":"community-B5Vu0mbP.js","sources":["../../src/scripts/modules/community.ts"],"sourcesContent":["import { Component } from '@verndale/core';\nimport { ConditionalDisplay } from '../helpers/global';\n\nclass Community extends Component {\n setupDefaults() {\n this.dom = {\n community: this.el.querySelectorAll('.v-section-community__li'),\n iframe: this.el.querySelector('iframe')\n };\n\n if (ConditionalDisplay(this.el.id)) {\n this.el.style.display = 'none';\n }\n this.replaceIframe();\n this.removeEmptyCommunity();\n\n const options = {\n root: document.querySelector('#scrollArea'),\n rootMargin: '0px',\n threshold: 1.0\n };\n\n const observer = new IntersectionObserver(this.scrolledIntoView.bind(this), options);\n observer.observe(this.el);\n }\n\n scrolledIntoView(entries: IntersectionObserverEntry[], observer: IntersectionObserver) {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n this.replaceIframe();\n observer.unobserve(entry.target);\n }\n });\n }\n\n replaceIframe() {\n const name = document.body.dataset.name || '';\n const state = document.body.dataset.state || '';\n\n if (this.dom.iframe) {\n const map = this.dom.iframe as HTMLIFrameElement;\n map.src = '';\n window.requestAnimationFrame(() => {\n const src =\n 'https://www.google.com/maps/embed/v1/search?key=AIzaSyCE5I18JBlnz2x5x8FSnGX1Tt0rov72ZV0&q=community+centers+and+religious+centers+in+{city}+{state}&zoom=12';\n map.src = src.replace('{city}', name).replace('{state}', state);\n });\n }\n }\n\n removeEmptyCommunity() {\n (this.dom.community as NodeListOf).forEach(community => {\n if (!community.querySelector('.v-section-community__grade')?.getAttribute('alt')) {\n community.style.display = 'none';\n }\n });\n }\n}\n\nexport default Community;\n"],"names":["Community","Component","ConditionalDisplay","options","entries","observer","entry","name","state","map","src","community","_a"],"mappings":"8EAGA,MAAMA,UAAkBC,CAAU,CAChC,eAAgB,CACd,KAAK,IAAM,CACT,UAAW,KAAK,GAAG,iBAAiB,0BAA0B,EAC9D,OAAQ,KAAK,GAAG,cAAc,QAAQ,CAAA,EAGpCC,EAAmB,KAAK,GAAG,EAAE,IAC1B,KAAA,GAAG,MAAM,QAAU,QAE1B,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAE1B,MAAMC,EAAU,CACd,KAAM,SAAS,cAAc,aAAa,EAC1C,WAAY,MACZ,UAAW,CAAA,EAGI,IAAI,qBAAqB,KAAK,iBAAiB,KAAK,IAAI,EAAGA,CAAO,EAC1E,QAAQ,KAAK,EAAE,CAC1B,CAEA,iBAAiBC,EAAsCC,EAAgC,CACrFD,EAAQ,QAAiBE,GAAA,CACnBA,EAAM,iBACR,KAAK,cAAc,EACVD,EAAA,UAAUC,EAAM,MAAM,EACjC,CACD,CACH,CAEA,eAAgB,CACd,MAAMC,EAAO,SAAS,KAAK,QAAQ,MAAQ,GACrCC,EAAQ,SAAS,KAAK,QAAQ,OAAS,GAEzC,GAAA,KAAK,IAAI,OAAQ,CACb,MAAAC,EAAM,KAAK,IAAI,OACrBA,EAAI,IAAM,GACV,OAAO,sBAAsB,IAAM,CACjC,MAAMC,EACJ,8JACED,EAAA,IAAMC,EAAI,QAAQ,SAAUH,CAAI,EAAE,QAAQ,UAAWC,CAAK,CAAA,CAC/D,CACH,CACF,CAEA,sBAAuB,CACpB,KAAK,IAAI,UAAsC,QAAqBG,GAAA,QAC9DC,EAAAD,EAAU,cAAc,6BAA6B,IAArD,MAAAC,EAAwD,aAAa,SACxED,EAAU,MAAM,QAAU,OAC5B,CACD,CACH,CACF"}