{
const p = Array.isArray($event.detail) ? $event.detail[0] : $event.detail;
if (!p || !p.country) return;
if (typeof window.locationLoad === 'function') {
window.locationLoad(p.country, p.location || '', p.lng, p.lat);
}
})()"
>
0 ; if ((search ?? '').length >= 2) open = true; "
@select-location-updated.window="$el.value = event.detail.newName; parent.style.width='350px';"
@input="
clearTimeout(window.__autosuggestTimers?.[$el.id]);
window.__autosuggestTimers = window.__autosuggestTimers || {};
window.__autosuggestTimers[$el.id] = setTimeout(() => {
/* Dropdown still showing? The user is mid-pick - every
Livewire roundtrip from commitSearch morphs the
autosuggest subtree and visibly closes the dropdown
(despite wire:ignore.self on the wrapper, the
results child re-renders and Alpine's $data.open
transition flashes). Defer to @blur / row click. */
if (open) return;
if ($wire.commitSearch) $wire.commitSearch();
}, 3000);
"
@blur="
clearTimeout(window.__autosuggestTimers?.[$el.id]);
setTimeout(() => { if ($wire.commitSearch) $wire.commitSearch(); }, 200);
"
x-on:keydown.arrow-down.stop.prevent="showHistory && history.length > 0 ? highlightHistoryNext() : highlightNext()"
x-on:keydown.arrow-up.stop.prevent="showHistory && history.length > 0 ? highlightHistoryPrevious() : highlightPrevious()"
x-on:keydown.escape.stop.prevent="showHistory = false; open = false; historyHighlightedIndex = -1;"
x-on:keydown.enter.stop.prevent="(() => {
if (showHistory && history.length > 0 && historyHighlightedIndex >= 0) {
pickHistory(history[historyHighlightedIndex]);
historyHighlightedIndex = -1;
return;
}
const row = $refs.results?.children?.[highlightedIndex];
if (!row || row.dataset.navSkip === '1') {
/* A field that takes names on comma takes them on Enter
too, when no row is chosen: Enter is the other key that
says the name is finished. It used to do nothing, and
the next name was typed onto the end of the last. */
if (false) {
const typed = ($el.value || '').replace(/,/g, '').trim();
$el.value = '';
if (! typed) return;
open = false;
suppressOpen = true;
$wire.set('search', typed, false);
if ($wire.commitSearch) $wire.commitSearch();
}
return;
}
$dispatch('value-selected', {
id: row.getAttribute('data-result-id'),
item: row.getAttribute('data-result-item'),
});
})()" class="peer w-full font-body color-base bg-base-100 outline-none ring-offset-transparent transition duration-500
focus:outline-none focus:border-theme
hover:border hover:border-theme
text-left items-baseline px-4 pl-9 focus:pl-[36px] py-1 rounded-lg text-sm location-autosuggest !border-0 focus:border-0 focus:outline-none !bg-white/60 focus:!bg-white backdrop-blur-sm h-[45px] capitalize h-[50px] lg:w-[500px] ">
0; $root.querySelector('input')?.focus();
">close