1!(function (e) { 2 "function" == typeof define && define.amd ? define("searchForm", e) : e(); 3})(function () { 4 "use strict"; 5 var s = { 6 template: "#search-form-post-types-filter", 7 data() { 8 return { selected: null, search: "" }; 9 }, 10 created() { 11 this.selected = this.$root.post_type.key; 12 }, 13 methods: { 14 select(e) { 15 (this.selected = e), this.$root.setPostType(e), (this.search = ""); 16 }, 17 onSave() { 18 this.$root.setPostType(this.selected), (this.search = ""), this.$refs.formGroup.blur(); 19 }, 20 onBlur() { 21 this.search = ""; 22 }, 23 }, 24 computed: { 25 postTypes() { 26 return this.search.trim().length ? Object.values(this.$root.post_types).filter((e) => -1 !== e.label.toLowerCase().indexOf(this.search.trim().toLowerCase())) : Object.values(this.$root.post_types); 27 }, 28 }, 29 }, 30 i = { 31 template: "#search-form-keywords-filter", 32 props: { filter: Object, repeaterId: String }, 33 data() { 34 return { value: this.filter.value || "" }; 35 }, 36 methods: { 37 isFilled() { 38 return this.value.trim().length; 39 }, 40 saveValue() { 41 this.filter.value = this.isFilled() ? this.value.trim() : null; 42 }, 43 onPopupSave() { 44 this.saveValue(), this.$refs.formGroup?.blur(); 45 }, 46 onPopupClear() { 47 (this.value = ""), this.$refs.input.focus(); 48 }, 49 onReset() { 50 (this.value = this.filter.resets_to || ""), this.saveValue(); 51 }, 52 onEnter() { 53 this.$root.submitsToPage() && this.$root.submit(); 54 }, 55 }, 56 }, 57 a = { 58 template: "#search-form-stepper-filter", 59 props: { filter: Object, repeaterId: String }, 60 data() { 61 return { value: this.filter.props.value }; 62 }, 63 created() { 64 this.debouncedSave = Voxel.helpers.debounce(() => this.saveValue(), 300); 65 }, 66 methods: { 67 increment() { 68 "number" != typeof this.value ? this.setValue(this.filter.props.range_start) : this.setValue(this.value + this.filter.props.step_size); 69 }, 70 decrement() { 71 "number" != typeof this.value ? this.setValue(this.filter.props.range_start) : this.setValue(this.value - this.filter.props.step_size); 72 }, 73 setValue(e) { 74 "" === e || "number" != typeof e 75 ? (this.value = "") 76 : e < this.filter.props.range_start 77 ? (this.value = this.filter.props.range_start) 78 : e > this.filter.props.range_end 79 ? (this.value = this.filter.props.range_end) 80 : (this.value = Number(e.toFixed(this.filter.props.precision))); 81 }, 82 saveValue() { 83 this.setValue(this.value), (this.filter.value = this.isFilled() ? this.value : null); 84 }, 85 onSave() { 86 this.saveValue(), this.$refs.formGroup.blur(); 87 }, 88 onClear() { 89 (this.value = ""), this.$refs.input.focus(); 90 }, 91 isFilled() { 92 return "number" == typeof this.value; 93 }, 94 onReset() { 95 (this.value = this.filter.resets_to || ""), this.saveValue(); 96 }, 97 }, 98 }, 99 r = { 100 template: "#search-form-range-filter", 101 props: { filter: Object, repeaterId: String }, 102 data() { 103 return { value: this.filter.props.value, displayValue: this.formatForDisplay(this.filter.props.value), default: [], slider: null }; 104 }, 105 created() { 106 "inline" === this.filter.props.display_as && this.setupInlineSlider(); 107 }, 108 unmounted() { 109 this.slider?.destroy(); 110 }, 111 methods: { 112 setupSlider() { 113 var e, t, s, i, a; 114 this.slider || 115 ((s = 116 "single" === (e = this.filter.props).handles 117 ? ((t = "in_range" === e.compare ? [1, 0] : [0, 1]), (this.default = "in_range" === e.compare ? e.range_end : e.range_start))
118 : ((t = "in_range" === e.compare ? [0, 1, 0] : [1, 0, 1]), (this.default = "in_range" === e.compare ? [e.range_start, e.range_end] : [e.range_start, e.range_start]))), 119 this.value.length && (s = this.value), 120 (i = "ltr"), 121 "rtl" === document.documentElement.getAttribute("dir") && (i = "rtl"), 122 (a = document.createElement("div")).classList.add("range-slider"), 123 (this.slider = noUiSlider.create(a, { start: s, connect: t, step: e.step_size, range: { min: this.filter.props.range_start, max: this.filter.props.range_end }, direction: i })), 124 this.slider.on("update", (e) => { 125 this.value = e.map((e) => Number(e)); 126 })); 127 }, 128 onEntry() { 129 this.setupSlider(), this.$nextTick(() => this.$refs.sliderWrapper.append(this.slider.target)); 130 }, 131 setupInlineSlider() { 132 this.setupSlider(), 133 this.$nextTick(() => this.$refs.sliderWrapper.append(this.slider.target)), 134 this.slider.on( 135 "update", 136 Voxel.helpers.debounce(() => this.saveValue(), 200) 137 ); 138 }, 139 saveValue() { 140 (this.filter.value = this.isFilled() ? this.value.join("..") : null), (this.displayValue = this.value.map((e) => e.toLocaleString()).join(" â ")); 141 }, 142 onSave() { 143 this.saveValue(), this.$refs.formGroup.blur(); 144 }, 145 onClear() { 146 this.slider.set(this.default); 147 }, 148 isFilled() { 149 var e = Array.isArray(this.default) ? this.default : [this.default]; 150 return this.value.length && this.value.join("..") !== e.join(".."); 151 }, 152 formatForDisplay(e) { 153 let t = this.filter.props.format; 154 return e.map((e) => (t.numeric && (e = e.toLocaleString()), t.prefix + e + t.suffix)).join(" â "); 155 }, 156 onReset() { 157 this.slider?.set(this.filter.resets_to || this.default), this.saveValue(); 158 }, 159 }, 160 computed: { 161 popupDisplayValue() { 162 return this.formatForDisplay(this.value); 163 }, 164 }, 165 }, 166 l = { 167 template: "#search-form-location-filter", 168 props: { filter: Object, repeaterId: String }, 169 data() { 170 return { 171 addressInput: null, 172 value: this.filter.props.value, 173 displayValue: this.filter.props.value.address, 174 displayDistance: null, 175 loading: !1, 176 visibleAreaLabel: this.filter.props.l10n.visibleArea, 177 slider: null, 178 units: this.filter.props.radius.units, 179 }; 180 }, 181 created() { 182 jQuery(this.$root.$options.el).on("map:bounds_updated", (e, t) => this.useBounds(t)), 183 this.filter.props.value.radius && (this.displayDistance = this.filter.props.value.radius + ("mi" === this.units ? "mi" : "km")), 184 this.value.radius || (this.value.radius = this.filter.props.radius.default), 185 null !== this.value.address && 186 null !== this.$root.getMapWidget() && 187 Voxel.Maps.await(() => { 188 this.updateMap(), jQuery(this.$root.$options.el).off("toggled-view:map", this.updateMap), jQuery(this.$root.$options.el).one("toggled-view:map", this.updateMap); 189 }), 190 "inline" === this.filter.props.display_as && this.setupInlineAddress(), 191 "inline" === this.filter.props.display_proximity_as && this.setupInlineProximity(); 192 }, 193 unmounted() { 194 this.slider?.destroy(); 195 }, 196 methods: { 197 onOpen() { 198 this.addressInput || 199 ((this.addressInput = document.createElement("input")), this.addressInput.setAttribute("type", "text"), this.addressInput.setAttribute("placeholder", this.filter.props.placeholder), this.autocomplete) || 200 this.addressInput.addEventListener( 201 "focus", 202 () => { 203 Voxel.Maps.await(() => { 204 this.autocomplete = new Voxel.Maps.Autocomplete( 205 this.addressInput, 206 (e) => { 207 e 208 ? this.usePlaceData(e) 209 : ((this.value.address = null), (this.value.swlat = null), (this.value.swlng = null), (this.value.nelat = null), (this.value.nelng = null), (this.value.lat = null), (this.value.lng = null)); 210 }, 211 this.$root.config.autocomplete 212 ); 213 }); 214 }, 215 { once: !0 } 216 ), 217 (this.addressInput.value = this.value.address), 218 this.$nextTick(() => { 219 this.$refs.addressWrapper.appendChild(this.addressInput), 220 (this.addressInput.value && this.addressInput.value !== this.visibleAreaLabel) || ((this.addressInput.value = ""), requestAnimationFrame(() => this.addressInput.focus())); 221 }); 222 }, 223 setupInlineAddress() { 224 this.addressInput || 225 ((this.addressInput = document.createElement("input")), 226 this.addressInput.setAttribute("type", "text"), 227 this.addressInput.setAttribute("placeholder", this.filter.props.placeholder), 228 this.addressInput.classList.add("inline-input"), 229 this.autocomplete) || 230 this.addressInput.addEventListener( 231 "focus", 232 () => { 233 Voxel.Maps.await(() => { 234 this.autocomplete = new Voxel.Maps.Autocomplete( 235 this.addressInput, 236 (e) => { 237 if ( e ) { 238 this.usePlaceData(e); 239 this.saveValue(); 240 if ( jQuery( '.header-search-actions .ts-search-btn' ).length ) { 241 jQuery( '.header-search-actions .ts-search-btn' )[0].click(); 242 } else if ( jQuery( '.ts-search-portal .ts-btn-2' ).length ) { 243 jQuery( '.ts-search-portal .ts-btn-2' )[0].click(); 244 } 245 } else { 246 ((this.value.address = null),
247 (this.value.swlat = null), 248 (this.value.swlng = null), 249 (this.value.nelat = null), 250 (this.value.nelng = null), 251 (this.value.lat = null), 252 (this.value.lng = null), 253 this.addressInput.value || this.saveValue()); 254 } 255 }, 256 this.$root.config.autocomplete 257 ); 258 }); 259 }, 260 { once: !0 } 261 ), 262 (this.addressInput.value = this.value.address), 263 this.$nextTick(() => { 264 this.$refs.addressWrapper.appendChild(this.addressInput), (this.addressInput.value && this.addressInput.value !== this.visibleAreaLabel) || (this.addressInput.value = ""); 265 }); 266 }, 267 onOpenProximity() { 268 (this.value.method = "radius"), this.setupSlider(), this.$nextTick(() => this.$refs.sliderWrapper.append(this.slider.target)); 269 }, 270 setupInlineProximity() { 271 this.setupSlider(), 272 this.$nextTick(() => this.$refs.sliderWrapper.append(this.slider.target)), 273 this.slider.on( 274 "update", 275 Voxel.helpers.debounce(() => this.saveValue(), 200) 276 ); 277 }, 278 onClearProximity() { 279 this.value.method = "area"; 280 }, 281 setupSlider() { 282 if (!this.slider) { 283 this.filter.props; 284 let e = this.filter.props.radius.default; 285 this.value.radius && (e = this.value.radius); 286 var t = document.createElement("div"); 287 t.classList.add("range-slider"), 288 (this.slider = noUiSlider.create(t, { start: e, connect: [1, 0], step: this.filter.props.radius.step, range: { min: this.filter.props.radius.min, max: this.filter.props.radius.max } })), 289 this.slider.on("update", (e) => (this.value.radius = Number(e[0]))); 290 } 291 }, 292 usePlaceData(e) {
293 var t = e.viewport.getSouthWest(), 294 s = e.viewport.getNorthEast(); 295 (this.value.address = e.address), 296 (this.value.swlat = this.$root._shortenPoint(t.getLatitude())), 297 (this.value.swlng = this.$root._shortenPoint(t.getLongitude())), 298 (this.value.nelat = this.$root._shortenPoint(s.getLatitude())), 299 (this.value.nelng = this.$root._shortenPoint(s.getLongitude())), 300 (this.value.lat = this.$root._shortenPoint(e.latlng.getLatitude())), 301 (this.value.lng = this.$root._shortenPoint(e.latlng.getLongitude())), 302 this.addressInput && (this.addressInput.value = e.address); 303 }, 304 useBounds(e) { 305 var t = e.getSouthWest(), 306 e = e.getNorthEast(), 307 s = this.visibleAreaLabel, 308 i = this.$root._shortenPoint(t.getLatitude()), 309 t = this.$root._shortenPoint(t.getLongitude()), 310 a = this.$root._shortenPoint(e.getLatitude()), 311 e = this.$root._shortenPoint(e.getLongitude()); 312 (this.value.method = "area"), 313 (this.value.address = s), 314 (this.value.swlat = i), 315 (this.value.swlng = t), 316 (this.value.nelat = a), 317 (this.value.nelng = e), 318 (this.filter.value = s + `;${i},${t}..${a},` + e), 319 (this.displayValue = s), 320 (this.displayDistance = null), 321 this.addressInput && (this.addressInput.value = s); 322 }, 323 updateMap() { 324 this.$root.map && 325 ("radius" === this.value.method 326 ? this.isFilled() 327 ? (this.$root.mapCircle.setCenter(new Voxel.Maps.LatLng(this.value.lat, this.value.lng)), 328 this.$root.mapCircle.setRadius(this.value.radius * ("mi" === this.units ? 1.609344 : 1) * 1e3), 329 this.$root.silentMapUpdate(() => { 330 this.$root.map.fitBounds(this.$root.mapCircle.getBounds()), (this.showOnIdleHandler = this.$root.map.addListenerOnce("idle", () => this.$root.mapCircle.show())), this.$root.mapCircle.show(); 331 })) 332 : this.$root.mapCircle.hide() 333 : (this.$root.mapCircle.hide(), 334 this.showOnIdleHandler && this.$root.map.removeListener(this.showOnIdleHandler), 335 this.isFilled() && 336 this.$root.silentMapUpdate(() => { 337 this.$root.map.fitBounds(new Voxel.Maps.Bounds(new Voxel.Maps.LatLng(this.value.swlat, this.value.swlng), new Voxel.Maps.LatLng(this.value.nelat, this.value.nelng))); 338 }))); 339 }, 340 saveValue() { 341 var e, t, s, i, a, r, l, n, o; 342 this.isFilled() 343 ? (({ method: e, address: t, swlat: s, swlng: i, nelat: a, nelng: r, lat: l, lng: n, radius: o } = this.value), 344 "radius" === e ? ((this.filter.value = t + `;${l},${n},` + o), (this.displayDistance = o + ("mi" === this.units ? "mi" : "km"))) : ((this.filter.value = t + `;${s},${i}..${a},` + r), (this.displayDistance = null))) 345 : ((this.filter.value = null), (this.displayDistance = null)), 346 this.updateMap(), 347 jQuery(this.$root.$options.el).off("toggled-view:map", this.updateMap), 348 jQuery(this.$root.$options.el).one("toggled-view:map", this.updateMap), 349 (this.displayValue = this.value.address); 350 }, 351 onSave() { 352 this.saveValue(), this.$refs.formGroup?.$refs.popup?.$emit("blur"), this.$refs.proximity?.$refs.popup?.$emit("blur"); 353 }, 354 onClear() { 355 (this.addressInput.value = ""), this.addressInput.dispatchEvent(new Event("input")), this.addressInput.focus(); 356 }, 357 geolocate(t, e) { 358 (this.loading = !0), 359 Voxel.Maps.await(() => { 360 Voxel.Maps.getGeocoder().getUserLocation({ 361 fetchAddress: !0, 362 receivedAddress: (e) => { 363 this.usePlaceData(e), (this.value.method = "radius"), (this.loading = !1), "function" == typeof t && t(e); 364 }, 365 addressFail: () => { 366 Voxel.alert(Voxel_Config.l10n.addressFail, "error"), this.addressInput?.focus(), (this.loading = !1), "function" == typeof e && e(); 367 }, 368 positionFail: () => { 369 Voxel.alert(Voxel_Config.l10n.positionFail, "error"), this.addressInput?.focus(), (this.loading = !1), "function" == typeof e && e(); 370 }, 371 }); 372 }); 373 }, 374 useMyLocation() { 375 this.geolocate(() => this.onSave()); 376 }, 377 isFilled() { 378 return !( 379 "string" != typeof this.value.address || 380 !this.value.address.trim() || 381 ("radius" === this.value.method ? [this.value.lat, this.value.lng, this.value.radius] : [this.value.swlat, this.value.swlng, this.value.nelat, this.value.nelng]).includes(null) 382 ); 383 }, 384 ensureLocation() { 385 this.value.address && this.value.address !== this.visibleAreaLabel 386 ? ((this.loading = !0), 387 Voxel.Maps.getGeocoder().geocode(this.value.address, (e) => { 388 e ? this.usePlaceData(e) : this.addressInput?.focus(), (this.loading = !1), "inline" === this.filter.props.display_proximity_as && this.saveValue(); 389 })) 390 : ((this.value.address = ""), 391 this.addressInput && (this.addressInput.value = ""), 392 "inline" !== this.filter.props.display_proximity_as && this.addressInput?.focus(), 393 "inline" === this.filter.props.display_proximity_as && this.saveValue()); 394 }, 395 onReset() { 396 (this.value.address = this.filter.resets_to?.address || null), 397 (this.value.swlat = this.filter.resets_to?.swlat || null), 398 (this.value.swlng = this.filter.resets_to?.swlng || null), 399 (this.value.nelat = this.filter.resets_to?.nelat || null), 400 (this.value.nelng = this.filter.resets_to?.nelng || null), 401 (this.value.lat = this.filter.resets_to?.lat || null), 402 (this.value.lng = this.filter.resets_to?.lng || null), 403 (this.value.radius = this.filter.resets_to?.radius || this.filter.props.radius.default), 404 (this.value.method = this.filter.resets_to?.method || "area"), 405 this.addressInput && (this.addressInput.value = this.filter.resets_to?.address || ""), 406 this.slider && this.slider.set(this.value.radius), 407 this.saveValue(); 408 }, 409 }, 410 watch: { 411 "value.method"() { 412 "radius" === this.value.method 413 ? this.value.lat && this.value.lng && this.value.address !== this.visibleAreaLabel 414 ? "inline" === this.filter.props.display_proximity_as && this.saveValue() 415 : this.ensureLocation() 416 : this.value.swlat && this.value.swlng && this.value.nelat && this.value.nelng 417 ? "inline" === this.filter.props.display_proximity_as && this.saveValue() 418 : this.ensureLocation(); 419 }, 420 }, 421 }, 422 n = { 423 template: "#search-form-availability-filter", 424 components: { 425 datePicker: { 426 template: "#availability-date-picker", 427 props: { filter: Object, parent: Object }, 428 data() { 429 return { picker: null, value: this.filter.props.value, today: new Date() }; 430 }, 431 mounted() { 432 this.picker = new Pikaday({ 433 field: this.$refs.input, 434 container: this.$refs.calendar, 435 bound: !1, 436 firstDay: 1,
437 keyboardInput: !1, 438 defaultDate: this.value.start, 439 minDate: this.today, 440 onSelect: (e) => { 441 (this.value.start = e), this.parent.onSave(); 442 }, 443 selectDayFn: (e) => this.value.start && this.value.start.toDateString() === e.toDateString(), 444 }); 445 }, 446 unmounted() { 447 setTimeout(() => this.picker.destroy(), 200); 448 }, 449 methods: { 450 refresh() { 451 this.picker.draw(); 452 }, 453 reset() { 454 (this.value.start = null), this.refresh(); 455 }, 456 }, 457 computed: { 458 startLabel() { 459 return this.value.start ? Voxel.helpers.dateFormat(this.value.start) : this.filter.props.l10n.checkIn; 460 }, 461 }, 462 }, 463 rangePicker: { 464 template: "#availability-date-range-picker", 465 props: { filter: Object, parent: Object }, 466 data() { 467 return { picker: null, activePicker: "start", value: this.filter.props.value, today: new Date() }; 468 }, 469 mounted() { 470 (this.picker = new Pikaday({ 471 field: this.$refs.input, 472 container: this.$refs.calendar, 473 bound: !1, 474 firstDay: 1, 475 keyboardInput: !1, 476 numberOfMonths: 2, 477 defaultDate: this.value.start, 478 minDate: this.today, 479 theme: "pika-range", 480 onSelect: (e) => { 481 "start" === this.activePicker ? (this.setStartDate(e), (this.activePicker = "end")) : (this.setEndDate(e), (this.activePicker = "start"), this.parent.onSave()), this.refresh(); 482 }, 483 selectDayFn: (e) => !(!this.value.start || e.toDateString() !== this.value.start.toDateString()) || !(!this.value.end || e.toDateString() !== this.value.end.toDateString()) || void 0, 484 disableDayFn: (e) => { 485 if ("end" === this.activePicker && this.value.start && e < this.value.start) return !0; 486 }, 487 })), 488 this.setStartDate(this.value.start), 489 this.setEndDate(this.value.end), 490 this.refresh(); 491 }, 492 unmounted() { 493 setTimeout(() => this.picker.destroy(), 200); 494 }, 495 methods: { 496 setStartDate(e) { 497 (this.value.start = e), this.picker.setStartRange(e), this.value.end && this.value.start > this.value.end && this.setEndDate(null); 498 }, 499 setEndDate(e) { 500 (this.value.end = e), this.picker.setEndRange(e); 501 }, 502 refresh() { 503 this.picker.draw(); 504 }, 505 reset() { 506 this.setStartDate(null), this.setEndDate(null), this.refresh(), (this.activePicker = "start"); 507 }, 508 }, 509 computed: { 510 startLabel() { 511 return this.value.start ? Voxel.helpers.dateFormat(this.value.start) : this.filter.props.l10n.checkIn; 512 }, 513 endLabel() { 514 return this.value.end ? Voxel.helpers.dateFormat(this.value.end) : this.filter.props.l10n.checkOut; 515 }, 516 }, 517 watch: { 518 activePicker() { 519 this.refresh(); 520 }, 521 }, 522 }, 523 }, 524 props: { filter: Object, repeaterId: String }, 525 data() { 526 return { value: this.filter.props.value, displayValue: this.filter.props.displayValue }; 527 }, 528 created() { 529 "string" == typeof this.value.start && (this.value.start = new Date(this.value.start + "T00:00:00")), "string" == typeof this.value.end && (this.value.end = new Date(this.value.end + "T00:00:00")); 530 }, 531 methods: { 532 selectPreset(e) { 533 this.filter.value = e; 534 }, 535 isUsingCustomRange() { 536 return null !== this.filter.value && this.filter.value.includes(".."); 537 }, 538 saveValue() { 539 var e, t; 540 this.value.end || (this.value.end = this.value.start), 541 this.isFilled() 542 ? ((e = Voxel.helpers.dateFormatYmd(this.value.start)), (t = Voxel.helpers.dateFormatYmd(this.value.end)), (this.filter.value = "single-date" === this.filter.props.inputMode ? e : e + ".." + t)) 543 : (this.filter.value = null),
544 (this.displayValue.start = this.startLabel), 545 (this.displayValue.end = this.endLabel); 546 }, 547 onSave() { 548 this.saveValue(), this.$refs.formGroup.blur(); 549 }, 550 onClear() { 551 this.$refs.picker.reset(); 552 }, 553 isFilled() { 554 return this.value.start && this.value.end; 555 }, 556 openRangePicker(e) { 557 "end" !== e || this.value.end || (e = "start"), (this.$root.activePopup = this.filter.id), this.$nextTick(() => (this.$refs.picker.activePicker = e)); 558 }, 559 onReset() { 560 this.filter.resets_to && "string" == typeof this.filter.resets_to 561 ? this.selectPreset(this.filter.resets_to) 562 : (this.filter.resets_to?.start && this.filter.resets_to?.end 563 ? ((this.value.start = new Date(this.filter.resets_to.start + "T00:00:00")), (this.value.end = new Date(this.filter.resets_to.end + "T00:00:00"))) 564 : ((this.value.start = null), (this.value.end = null)), 565 this.saveValue()); 566 }, 567 }, 568 computed: { 569 startLabel() { 570 return this.value.start ? Voxel.helpers.dateFormat(this.value.start) : this.filter.props.l10n.checkIn; 571 }, 572 endLabel() { 573 return this.value.end ? Voxel.helpers.dateFormat(this.value.end) : this.filter.props.l10n.checkOut; 574 }, 575 }, 576 }, 577 o = { 578 template: "#search-form-open-now-filter", 579 props: { filter: Object, repeaterId: String }, 580 data() { 581 return { value: this.filter.value || !1 }; 582 }, 583 methods: { 584 toggle() { 585 this.filter.value = null === this.filter.value ? 1 : null; 586 }, 587 saveValue() { 588 this.filter.value = this.value ? 1 : null; 589 }, 590 onSave() { 591 this.saveValue(), this.$refs.formGroup.blur(); 592 }, 593 onReset() { 594 (this.value = this.filter.resets_to), this.saveValue(); 595 }, 596 }, 597 }; 598 const h = { 599 template: "#search-form-terms-filter-list", 600 props: ["terms", "parent-term", "previous-list", "list-key"], 601 data() { 602 return { termsFilter: Voxel.helpers.getParent(this, "terms-filter"), perPage: 50, page: 1 }; 603 }, 604 methods: { 605 selectTerm(e) { 606 e.children && e.children.length ? ((this.termsFilter.slide_from = "right"), (this.termsFilter.active_list = "terms_" + e.id)) : this.termsFilter.selectTerm(e); 607 }, 608 goBack() { 609 (this.termsFilter.slide_from = "left"), (this.termsFilter.active_list = this.previousList); 610 }, 611 beforeEnter(e, t) { 612 setTimeout(() => (e.closest(".min-scroll").scrollTop = this.termsFilter.scrollPosition[t] || 0), 100); 613 }, 614 beforeLeave(e, t) { 615 this.termsFilter.scrollPosition[t] = e.closest(".min-scroll").scrollTop; 616 }, 617 }, 618 computed: { 619 termsWithChildren() { 620 return this.terms.filter((e) => e.children && e.children.length); 621 }, 622 }, 623 }; 624 var d = { 625 template: "#search-form-terms-filter", 626 name: "terms-filter", 627 props: { filter: Object, repeaterId: String }, 628 data() { 629 return { value: this.filter.props.selected || {}, terms: this.filter.props.terms, active_list: "toplevel", slide_from: "right", search: "", firstLabel: "", remainingCount: 0, scrollPosition: {} }; 630 }, 631 created() { 632 (this.firstLabel = this._getFirstLabel()), (this.remainingCount = this._getRemainingCount()); 633 let s = (t, e) => { 634 (t.parentRef = e), t.children && t.children.forEac
634h((e) => s(e, t)), this.value[t.slug] && (this.value[t.slug] = t); 635 }; 636 this.terms.forEach((e) => s(e, null)), 637 Object.keys(this.value).forEach((e) => { 638 let t = this.value[e].parentRef; 639 for (; t; ) (t.hasSelection = !0), (t = t.parentRef); 640 }); 641 }, 642 methods: { 643 saveValue() { 644 (this.filter.value = this.isFilled() ? Object.keys(this.value).join(",") : null), (this.firstLabel = this._getFirstLabel()), (this.remainingCount = this._getRemainingCount()); 645 }, 646 onSave() { 647 this.saveValue(), this.$refs.formGroup?.blur(); 648 }, 649 onClear() { 650 Object.keys(this.value).forEach((e) => { 651 let t = this.value[e].parentRef; 652 for (; t; ) (t.hasSelection = !1), (t = t.parentRef); 653 }), 654 (this.value = {}), 655 (this.search = ""), 656 this.$refs.searchInput?.focus(); 657 }, 658 isFilled() { 659 return Object.keys(this.value).length; 660 }, 661 _getFirstLabel() { 662 return Object.values(this.value)[0]?.label; 663 }, 664 _getRemainingCount() { 665 return Object.values(this.value).length - 1; 666 }, 667 selectTerm(a) { 668 if (this.value[a.slug]) { 669 delete this.value[a.slug]; 670 let e = a.parentRef; 671 for (; e; ) e.children.some((e) => e.hasSelection || this.value[e.slug]) || (e.hasSelection = !1), (e = e.parentRef); 672 } else { 673 this.filter.props.multiple || Object.keys(this.value).forEach((e) => delete this.value[e]); 674 let e = (this.value[a.slug] = a).parentRef; 675 for (; e; ) delete this.value[e.slug], (e.hasSelection = !0), (e = e.parentRef); 676 Object.values(this.value).forEach((e) => { 677 let t = e.parentRef; 678 var s = []; 679 let i = !1; 680 for (; t; ) { 681 if (t.slug === a.slug) { 682 i = !0; 683 break; 684 } 685 s.push(t), (t = t.parentRef); 686 } 687 i && (delete this.value[e.slug], s.forEach((e) => (e.hasSelection = !1))); 688 }), 689 this.filter.props.multiple || "inline" === this.filter.props.display_as || this.onSave(); 690 } 691 "inline" === this.filter.props.display_as && this.saveValue(); 692 }, 693 onReset() { 694 if ( 695 ((this.search = ""), 696 Object.keys(this.value).forEach((e) => { 697 let t = this.value[e].parentRef; 698 for (; t; ) (t.hasSelection = !1), (t = t.parentRef); 699 delete this.value[e]; 700 }), 701 this.filter.resets_to && this.filter.resets_to.length) 702 ) { 703 let t = this.filter.resets_to.reduce((e, t) => ((e[t] = !0), e), {}), 704 s = (e) => { 705 e.children && e.children.forEach((e) => s(e)), t[e.slug] && (this.value[e.slug] = e); 706 }; 707 this.terms.forEach((e) => s(e)); 708 } 709 this.saveValue(); 710 }, 711 }, 712 computed: { 713 searchResults() { 714 var t, s; 715 return ( 716 !!this.search.trim().length && 717 ((t = []), 718 (s = (e) => { 719 -1 !== e.label.toLowerCase().indexOf(this.search.trim().toLowerCase()) && t.push(e), e.children && e.children.forEac
719h(s); 720 }), 721 this.terms.forEach(s), 722 t) 723 ); 724 }, 725 }, 726 }, 727 u = { 728 template: "#search-form-order-by-filter", 729 inheritAttrs: !1, 730 props: { filter: Object, repeaterId: String }, 731 data() { 732 return { value: this.filter.value || "", loading: !1 }; 733 }, 734 mounted() { 735 this.$nextTick(() => { 736 this.selected?.requires_location && !this.selected.has_location && ("buttons" === this.filter.props.display_as ? this.selectDropdownChoice(this.selected) : this.selectChoice(this.selected)); 737 let e = this.$root.getLocationFilter(); 738 e && 739 this.$root.$watch( 740 () => e.value.lat, 741 () => { 742 "radius" === e.value.method && e.value.lat && e.value.lng && this.selected?.requires_location && (this.filter.value = `${this.selected.key}(${e.value.lat},${e.value.lng})`); 743 }, 744 { deep: !0 } 745 ); 746 }); 747 }, 748 methods: { 749 saveValue() { 750 this.filter.value = this.isFilled() ? this.value.trim() : null; 751 }, 752 onSave() { 753 this.saveValue(), this.$refs.formGroup.blur(); 754 }, 755 onClear() { 756 this.value = ""; 757 }, 758 isFilled() { 759 return this.value.trim().length; 760 }, 761 selectDropdownChoice(s) { 762 s.requires_location 763 ? ((this.loading = s.key), 764 this.getNearbyLocation((e, t) => { 765 (this.value = s.key + `(${e},${t})`), (this.filter.value = this.value), this.$refs.formGroup?.blur(); 766 })) 767 : ((this.value = s.key), this.$refs.formGroup?.blur()); 768 }, 769 selectChoice(s) { 770 s.requires_location 771 ? ((this.loading = s.key), 772 this.getNearbyLocation((e, t) => { 773 this.filter.value = s.key + `(${e},${t})`; 774 })) 775 : (this.filter.value = s.key); 776 }, 777 sortKey(e) { 778 return "string" != typeof e ? null : e.split("(")[0]; 779 }, 780 getNearbyLocation(s) { 781 let i = this.$root.getLocationFilter(); 782 if (i) { 783 let t = () => { 784 i.geolocate( 785 (e) => { 786 s(e.latlng.getLatitude(), e.latlng.getLongitude()), i.onSave(), (this.loading = !1); 787 }, 788 () => (this.loading = !1) 789 ); 790 }; 791 i.isFilled() && i.value.address !== i.visibleAreaLabel 792 ? "radius" === i.value.method 793 ? (s(i.value.lat, i.value.lng), i.onSave(), (this.loading = !1)) 794 : null !== i.value.lat && null !== i.value.lng && null !== i.value.radius 795 ? ((i.value.method = "radius"), s(i.value.lat, i.value.lng), i.onSave(), (this.loading = !1)) 796 : ((i.value.method = "radius"), 797 Voxel.Maps.getGeocoder().geocode(i.value.address, (e) => { 798 e ? (i.usePlaceData(e), s(i.value.lat, i.value.lng), i.onSave(), (this.loading = !1)) : t(); 799 })) 800 : t(); 801 } else 802 navigator.geolocation.getCurrentPosition( 803 (e) => { 804 var t = this.$root._shortenPoint(e.coords.latitude), 805 e = this.$root._shortenPoint(e.coords.longitude); 806 s(t, e), (this.loading = !1); 807 }, 808 () => { 809 Voxel.alert(Voxel_Config.l10n.positionFail, "error"), (this.loading = !1); 810 } 811 ); 812 }, 813 onReset() { 814 var e = this.filter.props.choices[this.filter.resets_to?.key || ""]; 815 e ? (this.selectChoice(e), "popup" === this.filter.props.display_as && (this.value = this.filter.value)) : ((this.value = ""), this.saveValue()); 816 }, 817 }, 818 computed: { 819 displayValue() { 820 return this.selected?.label; 821 }, 822 selected() { 823 return this.filter.props.choices[this.sortKey(this.filter.value)]; 824 }, 825 }, 826 }, 827 p = { 828 template: "#search-form-recurring-date-filter", 829 components: { 830 datePicker: { 831 template: "#recurring-date-picker", 832 props: { filter: Object, parent: Object }, 833 data() { 834 return { picker: null, value: this.filter.props.value }; 835 }, 836 mounted() { 837 this.picker = new Pikaday({ 838 field: this.$refs.input, 839 container: this.$refs.calendar, 840 bound: !1, 841 firstDay: 1,
842 keyboardInput: !1, 843 defaultDate: this.value.start, 844 onSelect: (e) => { 845 (this.value.start = e), this.parent.onSave(); 846 }, 847 selectDayFn: (e) => this.value.start && this.value.start.toDateString() === e.toDateString(), 848 }); 849 }, 850 unmounted() { 851 setTimeout(() => this.picker.destroy(), 200); 852 }, 853 methods: { 854 refresh() { 855 this.picker.draw(); 856 }, 857 reset() { 858 (this.value.start = null), this.refresh(); 859 }, 860 }, 861 computed: { 862 startLabel() { 863 return this.value.start ? Voxel.helpers.dateFormat(this.value.start) : this.filter.props.l10n.pickDate; 864 }, 865 }, 866 }, 867 rangePicker: { 868 template: "#recurring-date-range-picker", 869 props: { filter: Object, parent: Object }, 870 data() { 871 return { picker: null, activePicker: "start", value: this.filter.props.value }; 872 }, 873 mounted() { 874 (this.picker = new Pikaday({ 875 field: this.$refs.input, 876 container: this.$refs.calendar, 877 bound: !1, 878 firstDay: 1, 879 keyboardInput: !1, 880 numberOfMonths: 2, 881 defaultDate: this.value.start, 882 theme: "pika-range", 883 onSelect: (e) => { 884 "start" === this.activePicker ? (this.setStartDate(e), (this.activePicker = "end")) : (this.setEndDate(e), (this.activePicker = "start"), this.parent.onSave()), this.refresh(); 885 }, 886 selectDayFn: (e) => !(!this.value.start || e.toDateString() !== this.value.start.toDateString()) || !(!this.value.end || e.toDateString() !== this.value.end.toDateString()) || void 0, 887 disableDayFn: (e) => { 888 if ("end" === this.activePicker && this.value.start && e < this.value.start) return !0; 889 }, 890 })), 891 this.setStartDate(this.value.start), 892 this.setEndDate(this.value.end), 893 this.refresh(); 894 }, 895 unmounted() { 896 setTimeout(() => this.picker.destroy(), 200); 897 }, 898 methods: { 899 setStartDate(e) { 900 (this.value.start = e), this.picker.setStartRange(e), this.value.end && this.value.start > this.value.end && this.setEndDate(null); 901 }, 902 setEndDate(e) { 903 (this.value.end = e), this.picker.setEndRange(e); 904 }, 905 refresh() { 906 this.picker.draw(); 907 }, 908 reset() { 909 this.setStartDate(null), this.setEndDate(null), this.refresh(), (this.activePicker = "start"); 910 }, 911 }, 912 computed: { 913 startLabel() { 914 return this.value.start ? Voxel.helpers.dateFormat(this.value.start) : this.filter.props.l10n.from; 915 }, 916 endLabel() { 917 return this.value.end ? Voxel.helpers.dateFormat(this.value.end) : this.filter.props.l10n.to; 918 }, 919 }, 920 watch: { 921 activePicker() { 922 this.refresh(); 923 }, 924 }, 925 }, 926 }, 927 props: { filter: Object, repeaterId: String }, 928 data() { 929 return { value: this.filter.props.value, displayValue: this.filter.props.displayValue }; 930 }, 931 created() { 932 "string" == typeof this.value.start && (this.value.start = new Date(this.value.start + "T00:00:00")), "string" == typeof this.value.end && (this.value.end = new Date(this.value.end + "T00:00:00")); 933 }, 934 methods: { 935 selectPreset(e) { 936 this.filter.value = e; 937 }, 938 isUsingCustomRange() { 939 return null !== this.filter.value && this.filter.value.includes(".."); 940 }, 941 saveValue() { 942 var e, t; 943 this.value.end || (this.value.end = this.value.start), 944 this.isFilled() 945 ? ((e = Voxel.helpers.dateFormatYmd(this.value.start)), (t = Voxel.helpers.dateFormatYmd(this.value.end)), (this.filter.value = "single-date" === this.filter.props.inputMode ? e : e + ".." + t)) 946 : (this.filter.value = null),
947 (this.displayValue.start = this.startLabel), 948 (this.displayValue.end = this.endLabel); 949 }, 950 onSave() { 951 this.saveValue(), this.$refs.formGroup.blur(); 952 }, 953 onClear() { 954 this.$refs.picker.reset(); 955 }, 956 isFilled() { 957 return this.value.start && this.value.end; 958 }, 959 openRangePicker(e) { 960 "end" !== e || this.value.end || (e = "start"), (this.$root.activePopup = this.filter.id), this.$nextTick(() => (this.$refs.picker.activePicker = e)); 961 }, 962 onReset() { 963 this.filter.resets_to && "string" == typeof this.filter.resets_to 964 ? this.selectPreset(this.filter.resets_to) 965 : (this.filter.resets_to?.start && this.filter.resets_to?.end 966 ? ((this.value.start = new Date(this.filter.resets_to.start)), (this.value.end = new Date(this.filter.resets_to.end))) 967 : ((this.value.start = null), (this.value.end = null)), 968 this.saveValue()); 969 }, 970 }, 971 computed: { 972 startLabel() { 973 return this.value.start ? Voxel.helpers.dateFormat(this.value.start) : this.filter.props.l10n.from; 974 }, 975 endLabel() { 976 return this.value.end ? Voxel.helpers.dateFormat(this.value.end) : this.filter.props.l10n.to; 977 }, 978 }, 979 }, 980 c = { 981 template: "#search-form-switcher-filter", 982 props: { filter: Object, repeaterId: String }, 983 data() { 984 return { value: this.filter.value || !1 }; 985 }, 986 methods: { 987 toggle() { 988 this.filter.value = null === this.filter.value ? 1 : null; 989 }, 990 saveValue() { 991 this.filter.value = this.value ? 1 : null; 992 }, 993 onSave() { 994 this.saveValue(), this.$refs.formGroup.blur(); 995 }, 996 onReset() { 997 (this.value = this.filter.resets_to), this.saveValue(); 998 }, 999 }, 1000 }, 1001 v = { 1002 template: "#search-form-user-filter", 1003 props: { filter: Object, repeaterId: String }, 1004 methods: { 1005 saveValue() { 1006 this.filter.value = this.isFilled() ? this.value : null; 1007 }, 1008 isFilled() { 1009 return !!this.value; 1010 }, 1011 onReset() { 1012 (this.value = this.filter.resets_to), this.saveValue(); 1013 }, 1014 }, 1015 }, 1016 f = { 1017 template: "#search-form-relations-filter", 1018 props: { filter: Object, repeaterId: String }, 1019 methods: { 1020 saveValue() { 1021 this.filter.value = this.isFilled() ? this.value : null; 1022 }, 1023 isFilled() { 1024 return !!this.value; 1025 }, 1026 onReset() { 1027 (this.value = this.filter.resets_to), this.saveValue(); 1028 }, 1029 }, 1030 }, 1031 m = { 1032 template: "#search-form-post-status-filter", 1033 inheritAttrs: !1, 1034 props: { filter: Object, repeaterId: String }, 1035 data() { 1036 return { value: this.filter.value || "" }; 1037 }, 1038 methods: { 1039 saveValue() { 1040 this.filter.value = this.isFilled() ? this.value.trim() : null; 1041 }, 1042 onSave() { 1043 this.saveValue(), this.$refs.formGroup.blur(); 1044 }, 1045 onClear() { 1046 this.value = ""; 1047 }, 1048 isFilled() { 1049 return this.value.trim().length; 1050 }, 1051 onReset() { 1052 (this.value = this.filter.resets_to || ""), this.saveValue(); 1053 }, 1054 }, 1055 computed: { 1056 displayValue() { 1057 return this.selected?.label; 1058 }, 1059 selected() { 1060 return this.filter.props.choices[this.filter.value]; 1061 }, 1062 }, 1063 }, 1064 g = { template: "#search-form-ui-heading-filter", props: { filter: Object, repeaterId: String } }; 1065 (window.render_search_form = () => { 1066 Array.from(document.querySelectorAll(".ts-search-widget")).forEac
1066h((e) => { 1067 var t; 1068 e.__vue_app__ || 1069 e.classList.contains("no-render") || 1070 ((t = ((e) => { 1071 let t = JSON.parse(e.closest(".elementor-widget-container").querySelector(".vxconfig").innerHTML); 1072 return Vue.createApp({ 1073 el: e, 1074 mixins: [Voxel.mixins.base], 1075 data() { 1076 return { 1077 config: { showLabels: !0, defaultType: null, onSubmit: {}, searchOn: null }, 1078 loading: !1, 1079 resetting: !1, 1080 page: parseInt(Voxel.getSearchParam("pg") || 1, 10), 1081 post_types: {}, 1082 post_type: null, 1083 activePopup: null, 1084 map: null, 1085 markers: [], 1086 _postFeedWidget: null, 1087 _mapWidget: null, 1088 popup: null, 1089 suspendDragSearch: !1, 1090 mapConfig: {}, 1091 portal: { enabled: { desktop: t.general.portal.desktop, tablet: t.general.portal.tablet, mobile: t.general.portal.mobile }, active: !1 }, 1092 breakpoint: null, 1093 }; 1094 }, 1095 created() { 1096 this.setActiveBreakpoint(), (this.config = jQuery.extend(!0, this.config, t.general)), (this.post_types = t.postTypes); 1097 var e = Object.keys(this.post_types); 1098 this.config.defaultType ? this.setPostType(this.config.defaultType) : e.length ? this.setPostType(e[0]) : (this.post_type = { key: "", label: "", icon: "" }), 1099 this.updateMap(), 1100 this.handlePagination(), 1101 this.$nextTick(this.handleNavbars), 1102 "filter_update" === this.config.searchOn && 1103 this.$watch("currentValues", () => { 1104 (this.portal.enabled[this.breakpoint] && this.portal.active) || ((this.page = 1), this.getPosts()); 1105 }), 1106 (this.previousQueryString = this.currentQueryString), 1107 this.config.is_edit_mode && 1108 this.config.widget_id && 1109 (jQuery(".ts-search-portal-" + this.config.widget_id).remove(), 1110 window.ts_search_portal === this.config.widget_id && (this.portal.active = !0), 1111 this.$watch("portal.active", (e) => (window.ts_search_portal = e ? this.config.widget_id : null))); 1112 }, 1113 mounted() { 1114 requestAnimationFrame(() => { 1115 document.addEventListener("mousedown", this._blur_portal); 1116 }); 1117 }, 1118 unmounted() { 1119 document.removeEventListener("mousedown", this._blur_portal); 1120 }, 1121 methods: { 1122 setPostType(e) { 1123 this.post_types[e] && (this.post_type = this.post_types[e]); 1124 }, 1125 submit() { 1126 if ("submit-to-archive" === this.config.onSubmit.action) { 1127 var t = jQuery.param(this.currentValues).replace(/%2C/g, ",").replace(/%3B/g, ";").replace(/%20/g, "+"); 1128 let e = this.post_type.archive; 1129 t.length && (e += "?" + t), (window.location.href = e); 1130 } else { 1131 var e; 1132 "submit-to-page" === this.config.onSubmit.action ? ((t = this.currentQueryString), (e = this.config.onSubmit.pageLink || ""), (window.location.href = e + "?" + t)) : ((this.page = 1), this.getPosts()); 1133 } 1134 }, 1135 submitsToPage() { 1136 return "submit-to-archive" === this.config.onSubmit.action || "submit-to-page" === this.config.onSubmit.action; 1137 }, 1138 getPosts() { 1139 var a, t, e, s; 1140 this.previousQueryString === this.currentQueryString 1141 ? ((this.loading = !1), (this.resetting = !1)) 1142 : ((this.loading = !0), 1143 (a = this.getPostFeedWidget()), 1144 (t = this.getMapWidget()), 1145 (e = this.currentQueryString), 1146 (s = Voxel_Config.ajax_url + "&action=search_posts&" + e), 1147 a?.addClass("vx-loading"), 1148 t?.addClass("vx-loading"), 1149 a && 1150 ((s += "&limit=" + (parseInt(a.data("per-page"), 10) || 10)), 1151 this.post_type.template_id && (s += "&__template_id=" + this.post_type.template_id), 1152 this.config.show_total_count && (s += "&__get_total_count=1"), 1153 a.find('link[rel="stylesheet"]').each((e, t) => { 1154 t.id && !document.querySelector("#vx-assets-cache #" + CSS.escape(t.id)) && jQuery(t).clone().appendTo("#vx-assets-cache"); 1155 })), 1156 jQuery 1157 .get(s, (e) => { 1158 if (((this.loading = !1), (this.resetting = !1), (this.previousQueryString = this.currentQueryString), t?.removeClass("vx-loading"), a)) { 1159 let s = [], 1160 i = jQuery('<div class="response-wrapper">' + e + "</div>"); 1161 i.find('link[rel="stylesheet"]').each((e, t) => { 1162 t.id && 1163 !document.querySelector("#vx-assets-cache #" + CSS.escape(t.id)) && 1164 (jQuery(t).appendTo("#vx-assets-cache"), 1165 s.push( 1166 new Promise((e) => { 1167 t.onload = e; 1168 }) 1169 )); 1170 }), 1171 (i = i.children()), 1172 Promise.all(s).then(() => { 1173 requestAnimationFrame(() => { 1174 var e, t; 1175 "prev_next" === a.data("paginate") 1176 ? (a.find(".post-feed-grid:first").html(i), 1177 (e = a.find("script.info")).data("has-prev") 1178 ? a.find(".feed-pagination .ts-load-prev").removeClass("disabled") 1179 : a.find(".feed-pagination .ts-load-prev").addClass("disabled"), 1180 e.data("has-next") ? a.find(".feed-pagination .ts-load-next").removeClass("disabled") : a.find(".feed-pagination .ts-load-next").addClass("disabled"), 1181 e.remove(), 1182 e.data("has-prev") || e.data("has-next") ? a.find(".feed-pagination").removeClass("hidden") : a.find(".feed-pagination").addClass("hidden"), 1183 a.find(".ts-no-posts")[e.data("has-results") ? "addClass" : "removeClass"]("hidden"), 1184 this.config.show_total_count && 1185 ((t = e.data("total-count")), 1186 a.find(".post-feed-header")[1 <= t ? "removeClass" : "addClass"]("hidden"), 1187 a.find(".post-feed-header .result-count").text(e.data("display-count"))), 1188 (t = a.get(0).closest(".elementor-element")).getBoundingClientRect().top < 0 && t.scrollIntoView()) 1189 : ("load_more" === a.data("paginate") 1190 ? (a.find(".post-feed-grid:first")[1 < this.page ? "append" : "html"](i), 1191 (e = a.find("script.info")).data("has-next") 1192 ? a.find(".feed-pagination .ts-load-more").removeClass("hidden") 1193 : a.find(".feed-pagination .ts-load-more").addClass("hidden"), 1194 a.find(".ts-no-posts")[e.data("has-results") ? "addClass" : "removeClass"]("hidden"), 1195 this.config.show_total_count && 1196 ((t = e.data("total-count")), 1197 a.find(".post-feed-header")[1 <= t ? "removeClass" : "addClass"]("hidden"), 1198 a.find(".post-feed-header .result-count").text(e.data("display-count-alt")))) 1199 : (a.find(".post-feed-grid:first").html(i), 1200 (e = a.find("script.info")), 1201 a.find(".ts-no-posts")[e.data("has-results") ? "addClass" : "removeClass"]("hidden"), 1202 this.config.show_total_count && 1203 ((t = e.data("total-count")), 1204 a.find(".post-feed-header")[1 <= t ? "removeClass" : "addClass"]("hidden"), 1205 a.find(".post-feed-header .result-count").text(e.data("display-count")))), 1206 e.remove()), 1207 a.removeClass("vx-loading"), 1208 a.find('script[type="text/javascript"]').each((e, t) => { 1209 t.id && (2 <= jQuery(`script[id="${CSS.escape(t.id)}"]`).length ? t.remove() : jQuery(t).appendTo("#vx-assets-cache")); 1210 }), 1211 jQuery(document).trigger("voxel:markup-update"), 1212 this.updateMap(); 1213 }); 1214 }); 1215 } 1216 }) 1217 .fail(() => { 1218 (this.loading = !1), (this.resetting = !1), t?.removeClass("vx-loading"), a?.removeClass("vx-loading"), Voxel.alert(Voxel_Config.l10n.ajaxError, "error"); 1219 }), 1220 this.config.onSubmit.updateUrl && (((s = new URL(window.location)).search = e), "load_more" === a?.data("paginate") && s.searchParams.delete("pg"), window.history.replaceState(null, null, s))); 1221 }, 1222 handlePagination() { 1223 var e = this.getPostFeedWidget(); 1224 null !== e && 1225 (e.find(".feed-pagination .ts-load-prev").on("click", (e) => { 1226 e.preventDefault(), e.target.classList.contains("disabled") || ((this.page = 1 < this.page ? this.page - 1 : 1), this.getPosts()); 1227 }), 1228 e.find(".feed-pagination .ts-load-next").on("click", (e) => { 1229 e.preventDefault(), e.target.classList.contains("disabled") || ((this.page += 1), this.getPosts()); 1230 }), 1231 e.find(".feed-pagination .ts-load-more").on("click", (e) => { 1232 e.preventDefault(), (this.page += 1), this.getPosts(); 1233 }), 1234 e.find(".ts-no-posts .ts-feed-reset").on("click", (e) => { 1235 e.preventDefault(), this.clearAll(), e.currentTarget.classList.remove("resetting"), requestAnimationFrame(() => e.currentTarget.classList.add("resetting")); 1236 })); 1237 }, 1238 handleNavbars() { 1239 jQuery(`.ts-nav-sf-${this.widget_id} .ts-item-link`).on("click", (e) => { 1240 e.preventDefault(); 1241 e = e.currentTarget.parentElement.dataset.postType; 1242 this.setPostType(e); 1243 }), 1244 this.$watch("post_type", () => { 1245 jQuery(`.ts-nav-sf-${this.widget_id} .menu-item[data-post-type="${this.post_type.key}"]`).addClass("current-menu-item").siblings().removeClass("current-menu-item"); 1246 }); 1247 }, 1248 updateMap() { 1249 var s = this.getMapWidget(); 1250 null !== s && 1251 (this.map 1252 ? this._updateMarkers() 1253 : Voxel.Maps.await(() => { 1254 var e = s.find(".ts-map"), 1255 t = e.get(0); 1256 t && 1257 ((e = e.data("config")), 1258 (t = { el: t, zoom: 3 }), 1259 (this.mapConfig = e) && 1260 (e.zoom && (t.zoom = e.zoom), e.minZoom && (t.minZoom = e.minZoom), e.maxZoom && (t.maxZoom = e.maxZoom), e.center) &&
1260 1261 (t.center = new Voxel.Maps.LatLng(e.center.lat, e.center.lng)), 1262 (this.map = new Voxel.Maps.Map(t)), 1263 (this.popup = new Voxel.Maps.Popup({ map: this.map })), 1264 (this.mapCircle = new Voxel.Maps.Circle({ map: this.map, center: new Voxel.Maps.LatLng(42, 20), radius: 1 })), 1265 this.map.addListener("click", () => this.popup.hide()), 1266 this.map.addListenerOnce("idle", () => { 1267 this.map.addListener("idle", this._handleDragSearch), this.searchAreaHandler(); 1268 }), 1269 this._updateMarkers(), 1270 this.config.is_edit_mode) && 1271 !this._edit_mode_interval && 1272 (this._edit_mode_interval = setInterval(() => { 1273 var e = this.config.onSubmit.mapId; 1274 jQuery(`.elementor-element-${e} .ts-map.ts-map-loaded`).length || ((this._mapWidget = null), (this.map = null), this.updateMap()); 1275 }, 500)); 1276 })); 1277 }, 1278 _handleDragSearch() { 1279 this.getMapWidget().find(".ts-map-drag .ts-drag-toggle.active").length && !this.suspendDragSearch && (this.mapCircle.hide(), jQuery(this.$options.el).trigger("map:bounds_updated", this.map.getBounds())); 1280 }, 1281 _updateMarkers() { 1282 var e = this.getPostFeedWidget(), 1283 n = this.getMapWidget(); 1284 if (e && n) { 1285 this.markers.map((e) => e.remove()), (this.markers = []), this.popup.hide(), n.find(".ts-popup-anchor").html(""); 1286 let l = e.find(".post-feed-grid:first").find("> .ts-preview"); 1287 (this.bounds = new Voxel.Maps.Bounds()), 1288 (this.previewCardCache = {}), 1289 l.length 1290 ? (e.find(".post-feed-grid:first").removeClass("post-feed-no-results"), 1291 l.each((e, a) => { 1292 if ("string" == typeof a.dataset.position) { 1293 let t = a.dataset.postId; 1294 var s = a.dataset.position.split(","), 1295 i = parseFloat(s[0]), 1296 s = parseFloat(s[1]); 1297 "number" == typeof i && 1298 "number" == typeof s && 1299 ((i = new Voxel.Maps.LatLng(i, s)), 1300 this.markers.push( 1301 new Voxel.Maps.Marker({ 1302 map: this.map, 1303 position: i, 1304 template: a.querySelector(":scope > .ts-marker-wrapper").innerHTML, 1305 onClick: (e, s) => { 1306 e.stopPropagation(), n.find(".marker-active").removeClass("marker-active"), s.addClass("marker-active"); 1307 let i = jQuery(this.$refs.mapNavTemplate.innerHTML), 1308 r = 1309 (i.find(".ts-map-prev").on("click", (e) => { 1310 e.preventDefault(); 1311 e = this._prevPost(a.dataset.postId); 1312 n.find(`.map-marker[data-
1312post-id="${e}"]`).click(); 1313 }), 1314 i.find(".ts-map-next").on("click", (e) => { 1315 e.preventDefault(); 1316 e = this._nextPost(a.dataset.postId); 1317 n.find(`.map-marker[data-post-id="${e}"]`).click(); 1318 }), 1319 (e) => { 1320 var t; 1321 1 < l.length && e.append(i.get(0)), 1322 "fixed" === this.config.popupAnchor[this.breakpoint] 1323 ? (this.map.addListenerOnce("click", () => { 1324 s.removeClass("marker-active"), n.find(".ts-popup-anchor").html(""); 1325 }), 1326 this.silentMapUpdate(() => { 1327 this.popup.setPosition(s.getPosition()), this.popup.setContent(jQuery('<div class="empty-popup"></div>').get(0)), this.popup.show(); 1328 }), 1329 (t = jQuery( 1330 '<div class="gm-style-iw-a ts-marker"><div class="gm-style-iw-t"><div class="gm-style-iw gm-style-iw-c"><div class="gm-style-iw-d"></div></div></div></div>' 1331 )) 1332 .find(".gm-style-iw-d") 1333 .append(e), 1334 n.find(".ts-popup-anchor").html(t)) 1335 : (this.map.addListenerOnce("click", () => s.removeClass("marker-active")), 1336 this.silentMapUpdate(() => { 1337 this.popup.setPosition(s.getPosition()), this.popup.setContent(e), this.popup.show(); 1338 })); 1339 }); 1340 if (this.post_type.map_template_id && this.post_type.template_id !== this.post_type.map_template_id) { 1341 let a = t + ":" + this.post_type.map_template_id; 1342 this.previewCardCache[a] 1343 ? ((e = jQuery(this.previewCardCache[a]).get(0)), r(e)) 1344 : ("fixed" === this.config.popupAnchor[this.breakpoint] && n.find(".ts-popup-anchor").html(""), 1345 this.silentMapUpdate(() => { 1346 this.popup.setPosition(s.getPosition()), 1347 this.popup.setContent(jQuery('<div class="ts-preview-popup ts-loading-popup"><span class="ts-loader"></span></div>').get(0)), 1348 this.popup.show(); 1349 }), 1350 jQuery.get(`${Voxel_Config.ajax_url}&action=get_preview_card&post_id=${t}&template_id=` + this.post_type.map_template_id).always((t) => { 1351 let i = jQuery('<div class="ts-preview-popup"></div>'); 1352 if (!1 !== t.success) { 1353 let e = jQuery('<div class="response-wrapper">' + t + "</div>"), 1354 s = []; 1355 e.find('link[rel="stylesheet"]').each((e, t) => { 1356 t.id && document.querySelector("#" + CSS.escape(t.id)) 1357 ? t.remove() 1358 : s.push( 1359 new Promise((e) => { 1360 t.onload = e; 1361 }) 1362 ); 1363 }), 1364 e.find('script[type="text/javascript"]').each((e, t) => { 1365 t.id && document.querySelector("#" + CSS.escape(t.id)) && t.remove(); 1366 }), 1367 (e = e.children()).appendTo("#vx-markup-cache"), 1368 Promise.all(s).then(() => { 1369 requestAnimationFrame(() => { 1370 i.html(e), (i = i.get(0)), (this.previewCardCache[a] = i.outerHTML), r(i); 1371 }); 1372 }); 1373 } else (i = i.get(0)), (this.previewCardCache[a] = i.outerHTML), r(i); 1374 })); 1375 } else { 1376 e = a.cloneNode(!0); 1377 e.classList.remove("ts-preview"), e.classList.add("ts-preview-popup"), r(e); 1378 } 1379 }, 1380 }) 1381 ), 1382 this.bounds.extend(i)); 1383 } 1384 })) 1385 : e.find(".post-feed-grid:first").addClass("post-feed-no-results"), 1386 this._mapBoundsHandler(), 1387 jQuery(this.$root.$options.el).off("toggled-view:map", this._mapBoundsHandler), 1388 jQuery(this.$root.$options.el).one("toggled-view:map", this._mapBoundsHandler); 1389 } 1390 }, 1391 _nextPost(e) { 1392 var t, 1393 s = this.getPostFeedWidget(); 1394 if (s) 1395 return ( 1396 (t = s.find(".post-feed-grid:first").find("> .ts-preview").first()), 1397 ((e = (s = s.find(".post-feed-grid:first").find(`> .ts-preview[data-post-id="${e}"]`)).length ? s.nextAll(".ts-preview:first") : null) && e.length ? e : t).data("post-id") 1398 ); 1399 }, 1400 _prevPost(e) { 1401 var t, 1402 s = this.getPostFeedWidget(); 1403 if (s) 1404 return ( 1405 (t = s.find(".post-feed-grid:first").find("> .ts-preview").last()), 1406 ((e = (s = s.find(".post-feed-grid:first").find(`> .ts-preview[data-post-id="${e}"]`)).length ? s.prevAll(".ts-preview:first") : null) && e.length ? e : t).data("post-id") 1407 ); 1408 }, 1409 _mapBoundsHandler() { 1410 var e = Object.values(this.post_type.filters).find((e) => "location" === e.type); 1411 (e && null !== e.value) || 1412 this.silentMapUpdate(() => { 1413 this.bounds.empty() 1414 ? (this.map.setCenter(new Voxel.Maps.LatLng(this.mapConfig.center.lat, this.mapConfig.center.lng)), this.map.setZoom(this.mapConfig.zoom)) 1415 : (this.map.fitBounds(this.bounds), 1416 setTimeout(() => { 1417 this.map.getZoom() > this.mapConfig.maxZoom && this.map.setZoom(this.mapConfig.maxZoom), this.map.getZoom() < this.mapConfig.minZoom && this.map.setZoom(this.mapConfig.minZoom); 1418 })); 1419 }); 1420 }, 1421 silentMapUpdate(e) { 1422 (this.suspendDragSearch = !0), e(), this.map.addListenerOnce("idle", () => (this.suspendDragSearch = !1)); 1423 }, 1424 clearAll() { 1425 (this.resetting = !0), 1426 Object.values(this.post_type.filters).forEac
1426h((e) => { 1427 e = this.$refs[this.post_type.key + ":" + e.key]; 1428 e && "function" == typeof e.onReset && e.onReset(); 1429 }), 1430 this.mapCircle?.hide(), 1431 "filter_update" !== this.config.searchOn && this.getPosts(); 1432 let e = this.$refs.resetBtn; 1433 e && (e.classList.remove("resetting"), requestAnimationFrame(() => e.classList.add("resetting"))); 1434 }, 1435 _shortenPoint(e) { 1436 return e.toString().substr(0, e < 0 ? 9 : 8); 1437 }, 1438 getPostFeedWidget() { 1439 var e; 1440 return "post-to-feed" !== this.config.onSubmit.action 1441 ? null 1442 : (this._postFeedWidget || ((e = this.config.onSubmit.postFeedId), (e = jQuery(".elementor-element-" + e)).length && (this._postFeedWidget = e)), this._postFeedWidget); 1443 }, 1444 getMapWidget() { 1445 var e; 1446 return "post-to-feed" !== this.config.onSubmit.action 1447 ? null 1448 : (this._mapWidget || 1449 ((e = this.config.onSubmit.mapId), 1450 (e = jQuery(".elementor-element-" + e)).length && 1451 ((this._mapWidget = e).find(".ts-map-drag .ts-drag-toggle").on("click", (e) => { 1452 e.preventDefault(), e.currentTarget.classList.toggle("active"); 1453 }), 1454 e.find(".ts-map-drag .ts-search-area").on("click", (e) => { 1455 e.preventDefault(), e.currentTarget.classList.add("hidden"), this.mapCircle?.hide(), jQuery(this.$options.el).trigger("map:bounds_updated", this.map.getBounds()), this.searchAreaHandler(); 1456 }))), 1457 this._mapWidget); 1458 }, 1459 searchAreaHandler() { 1460 let e = this.getMapWidget()?.find(".ts-map-drag .ts-search-area"); 1461 e && 1462 e.length && 1463 this.map && 1464 (e.data("next-handler") || 1465 (e.data("next-handler", !0), 1466 this.map.addListenerOnce("idle", () => { 1467 e.removeClass("hidden"), e.data("next-handler", !1); 1468 }))); 1469 }, 1470 getLocationFilter() { 1471 var e = Object.values(this.post_type.filters).find((e) => "location" === e.type); 1472 return e ? this.$refs[this.post_type.key + ":" + e.key] : null; 1473 },
1474 setActiveBreakpoint() { 1475 var e = elementorFrontendConfig.responsive.breakpoints; 1476 let t = matchMedia(`screen and (max-width: ${e.mobile.value}px)`), 1477 s = matchMedia(`screen and (min-width: ${e.tablet.value + 1}px)`); 1478 (this.breakpoint = t.matches ? "mobile" : s.matches ? "desktop" : "tablet"), 1479 t.addListener(() => (this.breakpoint = t.matches ? "mobile" : s.matches ? "desktop" : "tablet")), 1480 s.addListener(() => (this.breakpoint = t.matches ? "mobile" : s.matches ? "desktop" : "tablet")); 1481 }, 1482 toggleListView(e) { 1483 var t = this.breakpoint; 1484 this.$refs.listViewToggle.classList.add("vx-hidden-" + t), 1485 this.getMapWidget()?.addClass("vx-hidden-" + t), 1486 this.$refs.mapViewToggle.classList.remove("vx-hidden-" + t), 1487 this.getPostFeedWidget()?.removeClass("vx-hidden-" + t), 1488 jQuery(this.$options.el).trigger("toggled-view:list", this.map.getBounds()); 1489 }, 1490 toggleMapView(e) { 1491 var t = this.breakpoint; 1492 this.$refs.listViewToggle.classList.remove("vx-hidden-" + t), 1493 this.getMapWidget()?.removeClass("vx-hidden-" + t), 1494 this.$refs.mapViewToggle.classList.add("vx-hidden-" + t), 1495 this.getPostFeedWidget()?.addClass("vx-hidden-" + t); 1496 let s = this.getMapWidget()?.find(".ts-map-drag .ts-search-area"); 1497 s.data("first-handler") || 1498 (s.data("first-handler", !0), 1499 this.map.addListenerOnce("idle", () => { 1500 s?.addClass("hidden"), this.searchAreaHandler(); 1501 })), 1502 jQuery(this.$options.el).trigger("toggled-view:map", this.map.getBounds()), 1503 "mapbox" === Voxel_Config.maps.provider && this.map.getSourceObject().resize(); 1504 }, 1505 _blur_portal(e) { 1506 this.portal.active && this.portal.enabled[this.breakpoint] && (e.target.closest(".triggers-blur, .vx-popup:not(.ts-search-portal)") || (this.portal.active = !1)); 1507 }, 1508 }, 1509 computed: { 1510 currentValues() { 1511 var s; 1512 return this.post_type 1513 ? ((s = {}), 1514 Object.keys(this.post_type.filters).forEach((e) => { 1515 var t = this.post_type.filters[e].value; 1516 null !== t && (s[e] = t); 1517 }), 1518 s) 1519 : null; 1520 }, 1521 currentQueryString() { 1522 this.getPostFeedWidget(); 1523 var s = { type: this.post_type.key }; 1524 return ( 1525 Object.keys(this.post_type.filters).forEach((e) => { 1526 var t = this.post_type.filters[e].value; 1527 null !== t && (s[e] = t); 1528 }), 1529 1 < this.page && (s.pg = this.page), 1530 jQuery.param(s).replace(/%2C/g, ",").replace(/%3B/g, ";").replace(/%20/g, "+") 1531 ); 1532 }, 1533 activeFilterCount() { 1534 return Object.values(this.currentValues).filter((e) => null !== e).length; 1535 }, 1536 }, 1537 }); 1538 })(e)).component("form-group", Voxel.components.formGroup), 1539 t.component("term-list", h), 1540 t.component("filter-post-types", s), 1541 t.component("filter-keywords", i), 1542 t.component("filter-stepper", a), 1543 t.component("filter-range", r), 1544 t.component("filter-location", l), 1545 t.component("filter-availability", n), 1546 t.component("filter-open-now", o), 1547 t.component("filter-terms", d), 1548 t.component("filter-order-by", u), 1549 t.component("filter-recurring-date", p), 1550 t.component("filter-date", p), 1551 t.component("filter-switcher", c), 1552 t.component("filter-user", v), 1553 t.component("filter-relations", f), 1554 t.component("filter-post-status", m), 1555 t.component("filter-ui-heading", g), 1556 t.mount(e)); 1557 }); 1558 }), 1559 window.render_search_form(), 1560 jQuery(document).on("voxel:markup-update", window.render_search_form); 1561});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.