import { defineComponent, computed, ref, watch, mergeProps, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrRenderComponent, ssrRenderAttr, ssrInterpolate, ssrRenderList, ssrRenderClass } from 'vue/server-renderer'; import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs'; const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "SmartLocationInput", __ssrInlineRender: true, props: { modelValue: { default: null }, label: { default: "" }, placeholder: { default: "Kezdj el g\xE9pelni (ir\xE1ny\xEDt\xF3sz\xE1m vagy v\xE1ros)..." }, minChars: { default: 2 }, countryCode: { default: "HU" }, debounceMs: { default: 300 } }, emits: ["update:modelValue", "select"], setup(__props, { emit: __emit }) { const props = __props; ref(null); const query = ref(""); const selectedItem = ref(props.modelValue); const items = ref([]); const searching = ref(false); const showDropdown = ref(false); const highlightedIndex = ref(0); const displayText = computed(() => { if (selectedItem.value) { return `${selectedItem.value.zip_code} ${selectedItem.value.city}`; } return query.value; }); const filteredItems = computed(() => { if (!query.value || query.value.length < props.minChars) return []; const q = query.value.toLowerCase(); return items.value.filter( (item) => item.zip_code.toLowerCase().includes(q) || item.city.toLowerCase().includes(q) ); }); watch( () => props.modelValue, (val) => { selectedItem.value = val; } ); return (_ctx, _push, _parent, _attrs) => { _push(``); if (__props.label) { _push(``); } else { _push(``); } _push(`
`); if (searching.value) { _push(``); } else { _push(``); } if (selectedItem.value && !searching.value) { _push(``); } else { _push(``); } _push(`
`); if (showDropdown.value && filteredItems.value.length > 0) { _push(`
`); ssrRenderList(filteredItems.value, (item, index) => { _push(``); }); _push(`
`); } else { _push(``); } if (showDropdown.value && query.value.length >= __props.minChars && filteredItems.value.length === 0 && !searching.value) { _push(`
Nincs tal\xE1lat
`); } else { _push(``); } _push(``); }; } }); const _sfc_setup$1 = _sfc_main$1.setup; _sfc_main$1.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/SmartLocationInput.vue"); return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0; }; const __nuxt_component_0 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-b43e13ca"]]); const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "SharedAddressForm", __ssrInlineRender: true, props: { modelValue: { default: () => ({ zip: null, city: null, street_name: null, street_type: null, house_number: null, stairwell: null, floor: null, door: null, parcel_id: null, full_address_text: null, latitude: null, longitude: null }) } }, emits: ["update:modelValue"], setup(__props, { emit: __emit }) { const props = __props; const emit = __emit; const selectedLocation = computed(() => { var _a, _b; if (((_a = props.modelValue) == null ? void 0 : _a.zip) && ((_b = props.modelValue) == null ? void 0 : _b.city)) { return { id: 0, // We don't have the DB id here, but SmartLocationInput handles this zip_code: props.modelValue.zip, city: props.modelValue.city, country_code: "HU" }; } return null; }); function onLocationSelected(location) { if (location) { const updated = { ...props.modelValue }; updated.zip = location.zip_code; updated.city = location.city; emit("update:modelValue", updated); } } return (_ctx, _push, _parent, _attrs) => { const _component_SmartLocationInput = __nuxt_component_0; _push(`

C\xEDm adatok

`); _push(ssrRenderComponent(_component_SmartLocationInput, { "model-value": selectedLocation.value, "onUpdate:modelValue": onLocationSelected, label: "Ir\xE1ny\xEDt\xF3sz\xE1m / V\xE1ros", placeholder: "Kezdj el g\xE9pelni (pl. 1011 vagy Budapest)..." }, null, _parent)); _push(`
`); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/SharedAddressForm.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as _ }; //# sourceMappingURL=SharedAddressForm-rsg7wrlQ.mjs.map