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ACf,KAAMS,CAAA,CACP,EAAE,MAAMD,CAAW,CACrB,GACA,KAAK,EACP,EAGU,CACb,EAGeE,EAAA,CACbpB,MACF,ECpFMqB,EAAkB,yCAClBC,EAA8B,GAAG,OAAAD,EAAe,6BAEhDE,EAA8B,qDAC9BC,EAA0C,GAAG,OAAAD,EAA2B,6BAExEE,EAA2B,kDAC3BC,EAAuC,GAAG,OAAAD,EAAwB,6BAElEzB,EAAO,IAAM,CACjBd,EAAE,IAAI,OAAAmC,EAAiB,EAAE,KAAMM,GAAO,CAE9B,MAAAC,EADMzB,EAAEwB,CAAE,EACM,KAAK,WAAW,EAElCA,EAAG,UAAU,SAASL,CAA2B,IAClDK,EAAA,UAAU,IAAIL,CAA2B,EAI5CM,EAAU,SAAS,OAAO,EAEPC,EAAA,OAAOF,EAAI,EAAE,GACjC,EAEDzC,EAAE,IAAI,OAAAqC,EAA6B,EAAE,KAAMI,GAAO,CAC5CA,EAAG,UAAU,SAASH,CAAuC,IAC9DG,EAAA,UAAU,IAAIH,CAAuC,EAGxD,WAAW,IAAMM,EAAe,OAAOH,EAAI,EAAE,EAAG,CAAC,GAClD,EAEDzC,EAAE,IAAI,OAAAuC,EAA0B,EAAE,KAAME,GAAO,CACzCA,EAAG,UAAU,SAASD,CAAoC,IAC3DC,EAAA,UAAU,IAAID,CAAoC,EAErDN,EAAU,KAAK,CACb,KAAMO,CAAA,CACP,GACF,CACH,EAEeI,EAAA,CACb,KAAA/B,CACF","names":["INIT_COMPLETE_CLASS","default_selector","ListingCarousel","container_element","selector","_extend","u","slide_data_objects","img_element","$img_element","image_width","image_height","image_src","image_msrc","e","n","PhotoSwipeUI_Default","__vitePreload","PhotoSwipe","Factory","init","sele","$map_container","$","_once","map_el","dom_id","DomIdGenerator","lat","lng","center","L","map_canvas_dom_id","Promise","LeafletMapTileLayer","AssetsInfoStore","map_tile_layer","icon_image_data","leaflet_map","marker_icon","StaticMap","CELL_CLASS_NAME","CELL_INITIALIZED_CLASS_NAME","CELL_CLASS_NAME_WITH_SWIPER","CELL_WITH_SWIPER_INITIALIZED_CLASS_NAME","CELL_CLASS_NAME_MAP_VIEW","CELL_MAP_VIEW_INITIALIZED_CLASS_NAME","el","$carousel","Photoswipe_Factory","Swiper_Factory","Carousel"],"ignoreList":[],"sources":["../../../app/assets/javascripts/concepts/new_development_buildings/carousel/photoswipe/factory.ts","../../../app/assets/javascripts/concepts/new_development_buildings/carousel/map_view/index.ts","../../../app/assets/javascripts/concepts/new_development_buildings/carousel/index.ts"],"sourcesContent":["\nimport u from \"umbrellajs\"\nimport _extend from \"lodash/assign\"\n\n\nconst INIT_COMPLETE_CLASS = \"js-photoswipe-init-done\"\n\ninterface Selector {\n carousel: string\n image: string\n}\ninterface InputSelector {\n carousel?: string\n image?: string\n}\nconst default_selector = {\n carousel: \".carousel\",\n image: \"img\",\n}\n\nclass ListingCarousel {\n private selector: Selector\n private $container_el: UmbrellaInstance\n private $carousel: UmbrellaInstance\n private $image: UmbrellaInstance\n\n constructor({container_element, selector = {}}: {container_element: string | HTMLElement, selector: InputSelector}) {\n if (container_element == null) {\n throw new Error(\"container_element is absent\")\n }\n\n this.selector = _extend({}, default_selector, selector)\n this.$container_el = u(container_element)\n\n this.$carousel = this.$container_el.find(this.selector.carousel)\n this.$image = this.$container_el.find(this.selector.image)\n\n this.bind_action()\n }\n\n protected bind_action(){\n if (this.$carousel.hasClass(INIT_COMPLETE_CLASS)) { return this }\n this.$carousel.addClass(INIT_COMPLETE_CLASS)\n\n const slide_data_objects = [] as PhotoSwipe.Item[]\n this.$image.each((img_element) => {\n const $img_element = u(img_element)\n const image_width = $img_element.data(\"photoswipe-width\")\n const image_height = $img_element.data(\"photoswipe-height\")\n const image_src = $img_element.data(\"photoswipe-src\")\n // Optional\n const image_msrc = $img_element.data(\"photoswipe-msrc\")\n\n if ([image_width, image_height, image_src].some((e) => e == null)) {\n return\n }\n\n slide_data_objects.push({\n src: image_src,\n w: image_width,\n h: image_height,\n\n // Optional\n msrc: image_msrc,\n })\n })\n\n if (document.querySelectorAll(\".pswp\")[0] == null) {\n // Minified from source code provided by photoswipe\n // https://photoswipe.com/documentation/getting-started.html\n u(\"body\").append(\"
\")\n }\n\n\n if (slide_data_objects.length > 0) {\n import(\n \"photoswipe/dist/photoswipe-ui-default\"\n )\n .then(({default: PhotoSwipeUI_Default}) => {\n import(\n \"photoswipe\"\n )\n .then(({default: PhotoSwipe}) => {\n this.$image.on(\"click\", () => {\n const gallery = new PhotoSwipe(\n document.querySelectorAll(\".pswp\")[0] as HTMLElement,\n PhotoSwipeUI_Default,\n slide_data_objects,\n {\n // Don't change history when browsing gallery\n history: false,\n\n bgOpacity: 0.8,\n\n shareEl: false,\n fullscreenEl: false,\n captionEl: false,\n\n clickToCloseNonZoomable: false,\n tapToClose: true,\n },\n )\n gallery.init()\n })\n })\n })\n }\n\n return this\n }\n}\n\nconst Factory = {\n create(container_element: string | HTMLElement, selector?: InputSelector){\n return new ListingCarousel({container_element: container_element, selector: (selector || {})})\n },\n}\n\nexport { Factory as default }\n","\nimport $ from \"jquery\"\nimport _once from \"lodash/once\"\nimport L from \"plugins/leaflet\"\nimport Promise from \"plugins/bluebird\"\n\nimport AssetsInfoStore from \"app/assets_info_store\"\n\nimport DomIdGenerator from \"app/utils/dom_id_generator\"\n\nimport LeafletMapTileLayer from \"app/map/leaflet/map_tile_layer\"\n\n\ninterface InputSelector {\n main?: string | JQuery | HTMLElement,\n map_container?: string,\n}\n\ninterface Selector {\n main: string | JQuery,\n map_container: string,\n}\n\nconst default_selector: Selector = {\n main: \".cell-new-development-building-carousel-map-view\",\n map_container: \".cell-new-development-building-carousel-map-view__static-map-box\",\n}\n\n\nconst init = (selector?: InputSelector) => {\n const sele: Selector = Object.assign({}, default_selector, selector)\n\n const $el = $(sele.main)\n const $map_container = $el.find(sele.map_container)\n\n const render_map = _once(() => {\n const map_el = $map_container[0]\n\n const dom_id = DomIdGenerator.generateNewId()\n // Set new ID if applicable\n if (dom_id !== map_el.id) { map_el.setAttribute(\"id\", dom_id) }\n\n const lat = parseFloat($map_container.data(\"lat\"))\n const lng = parseFloat($map_container.data(\"lng\"))\n const center = L.latLng(lat, lng)\n\n // Generate ID for Leaflet map, if absent\n const map_canvas_dom_id = dom_id\n\n // If we add map tile layer AFTER creating map object\n // The location of tile layer is drifted on load\n // To workaround this we create tile layer first and\n // pass it on map object creation\n Promise.all([\n LeafletMapTileLayer.getNewTileLayerPromise(),\n AssetsInfoStore.fetch(\"map/markers/s-spacious.png\"),\n ])\n .spread((map_tile_layer, icon_image_data) => {\n const leaflet_map =\n L.map(map_canvas_dom_id, {\n center: center,\n\n zoom: 17,\n minZoom: 17,\n maxZoom: 17,\n\n // Interaction Options\n dragging: false,\n touchZoom: false,\n scrollWheelZoom: false,\n doubleClickZoom: false,\n boxZoom: false,\n tap: false,\n\n // Control options\n zoomControl: false,\n attributionControl: false,\n\n layers: [\n map_tile_layer,\n ],\n })\n\n const marker_icon = L.icon({\n iconUrl: icon_image_data.url,\n iconSize: [25, 29],\n })\n L.marker(center, {\n icon: marker_icon,\n }).addTo(leaflet_map)\n })\n .done()\n })\n\n\n render_map()\n}\n\n\nexport default {\n init: init,\n}\n","\n// region JS Imports\n\n// region External Modules\nimport $ from \"jquery\"\nimport u from \"umbrellajs\"\nimport \"plugins/jquery_plugins/bootstrap-carousel\"\n// endregion External Modules\n\n// region Private Components\nimport Photoswipe_Factory from \"./photoswipe/factory\"\nimport Swiper_Factory from \"components/swiper\"\nimport StaticMap from \"./map_view/index\"\n// endregion Private Components\n\n// endregion JS Imports\n\nconst CELL_CLASS_NAME = \"cell-new-development-building-carousel\"\nconst CELL_INITIALIZED_CLASS_NAME = `${CELL_CLASS_NAME}--js-spacious-initialized`\n\nconst CELL_CLASS_NAME_WITH_SWIPER = \"cell-new-development-building-carousel-with-swiper\"\nconst CELL_WITH_SWIPER_INITIALIZED_CLASS_NAME = `${CELL_CLASS_NAME_WITH_SWIPER}--js-spacious-initialized`\n\nconst CELL_CLASS_NAME_MAP_VIEW = \"cell-new-development-building-carousel-map-view\"\nconst CELL_MAP_VIEW_INITIALIZED_CLASS_NAME = `${CELL_CLASS_NAME_MAP_VIEW}--js-spacious-initialized`\n\nconst init = () => {\n u(`.${CELL_CLASS_NAME}`).each((el) => {\n const $el = $(el)\n const $carousel = $el.find(\".carousel\")\n\n if (el.classList.contains(CELL_INITIALIZED_CLASS_NAME)) { return }\n el.classList.add(CELL_INITIALIZED_CLASS_NAME)\n\n // carousel autoplay recommended to be disabled for web vitals\n // https://web.dev/carousel-best-practices/\n $carousel.carousel(\"pause\")\n\n Photoswipe_Factory.create(el, {})\n })\n\n u(`.${CELL_CLASS_NAME_WITH_SWIPER}`).each((el) => {\n if (el.classList.contains(CELL_WITH_SWIPER_INITIALIZED_CLASS_NAME)) { return }\n el.classList.add(CELL_WITH_SWIPER_INITIALIZED_CLASS_NAME)\n\n // This one is slow, one task for each element to avoid INP\n setTimeout(() => Swiper_Factory.create(el, {}), 0)\n })\n\n u(`.${CELL_CLASS_NAME_MAP_VIEW}`).each((el) => {\n if (el.classList.contains(CELL_MAP_VIEW_INITIALIZED_CLASS_NAME)) { return }\n el.classList.add(CELL_MAP_VIEW_INITIALIZED_CLASS_NAME)\n\n StaticMap.init({\n main: el,\n })\n })\n}\n\nexport default {\n init,\n}\n"],"file":"assets/index-g_YT50fq.js"}