var Jt = Object.defineProperty;
var Xt = (n, e, t) => e in n ? Jt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
var Ve = (n, e, t) => (Xt(n, typeof e != "symbol" ? e + "" : e, t), t);
import { forwardRef as Yt, useRef as st, useEffect as Ke, useImperativeHandle as xt, createElement as $t } from "react";
function S() {
}
function en(n, e) {
  for (const t in e)
    n[t] = e[t];
  return (
    /** @type {T & S} */
    n
  );
}
function kt(n) {
  return n();
}
function ot() {
  return /* @__PURE__ */ Object.create(null);
}
function re(n) {
  n.forEach(kt);
}
function pt(n) {
  return typeof n == "function";
}
function me(n, e) {
  return n != n ? e == e : n !== e || n && typeof n == "object" || typeof n == "function";
}
let ze;
function V(n, e) {
  return n === e ? !0 : (ze || (ze = document.createElement("a")), ze.href = e, n === ze.href);
}
function tn(n) {
  return Object.keys(n).length === 0;
}
function nn(n, e, t, r) {
  if (n) {
    const l = Tt(n, e, t, r);
    return n[0](l);
  }
}
function Tt(n, e, t, r) {
  return n[1] && r ? en(t.ctx.slice(), n[1](r(e))) : t.ctx;
}
function rn(n, e, t, r) {
  if (n[2] && r) {
    const l = n[2](r(t));
    if (e.dirty === void 0)
      return l;
    if (typeof l == "object") {
      const u = [], s = Math.max(e.dirty.length, l.length);
      for (let f = 0; f < s; f += 1)
        u[f] = e.dirty[f] | l[f];
      return u;
    }
    return e.dirty | l;
  }
  return e.dirty;
}
function ln(n, e, t, r, l, u) {
  if (l) {
    const s = Tt(e, t, r, u);
    n.p(s, l);
  }
}
function sn(n) {
  if (n.ctx.length > 32) {
    const e = [], t = n.ctx.length / 32;
    for (let r = 0; r < t; r++)
      e[r] = -1;
    return e;
  }
  return -1;
}
function ct(n) {
  return n ?? "";
}
function k(n, e) {
  n.appendChild(e);
}
function A(n, e, t) {
  n.insertBefore(e, t || null);
}
function z(n) {
  n.parentNode && n.parentNode.removeChild(n);
}
function E(n) {
  return document.createElement(n);
}
function oe(n) {
  return document.createElementNS("http://www.w3.org/2000/svg", n);
}
function ce(n) {
  return document.createTextNode(n);
}
function J() {
  return ce(" ");
}
function on() {
  return ce("");
}
function D(n, e, t, r) {
  return n.addEventListener(e, t, r), () => n.removeEventListener(e, t, r);
}
function cn(n) {
  return function(e) {
    return e.preventDefault(), n.call(this, e);
  };
}
function o(n, e, t) {
  t == null ? n.removeAttribute(e) : n.getAttribute(e) !== t && n.setAttribute(e, t);
}
function fn(n) {
  return Array.from(n.childNodes);
}
function Be(n, e) {
  e = "" + e, n.data !== e && (n.data = /** @type {string} */
  e);
}
function ft(n, e) {
  n.value = e ?? "";
}
function se(n, e, t) {
  n.classList.toggle(e, !!t);
}
function un(n, e, { bubbles: t = !1, cancelable: r = !1 } = {}) {
  return new CustomEvent(n, { detail: e, bubbles: t, cancelable: r });
}
let Re;
function Le(n) {
  Re = n;
}
function Mt() {
  if (!Re)
    throw new Error("Function called outside component initialization");
  return Re;
}
function an(n) {
  Mt().$$.on_destroy.push(n);
}
function dn() {
  const n = Mt();
  return (e, t, { cancelable: r = !1 } = {}) => {
    const l = n.$$.callbacks[e];
    if (l) {
      const u = un(
        /** @type {string} */
        e,
        t,
        { cancelable: r }
      );
      return l.slice().forEach((s) => {
        s.call(n, u);
      }), !u.defaultPrevented;
    }
    return !0;
  };
}
function ut(n, e) {
  const t = n.$$.callbacks[e.type];
  t && t.slice().forEach((r) => r.call(this, e));
}
const ke = [], Je = [];
let pe = [];
const at = [], hn = /* @__PURE__ */ Promise.resolve();
let Xe = !1;
function mn() {
  Xe || (Xe = !0, hn.then(Lt));
}
function Ye(n) {
  pe.push(n);
}
const He = /* @__PURE__ */ new Set();
let ve = 0;
function Lt() {
  if (ve !== 0)
    return;
  const n = Re;
  do {
    try {
      for (; ve < ke.length; ) {
        const e = ke[ve];
        ve++, Le(e), _n(e.$$);
      }
    } catch (e) {
      throw ke.length = 0, ve = 0, e;
    }
    for (Le(null), ke.length = 0, ve = 0; Je.length; )
      Je.pop()();
    for (let e = 0; e < pe.length; e += 1) {
      const t = pe[e];
      He.has(t) || (He.add(t), t());
    }
    pe.length = 0;
  } while (ke.length);
  for (; at.length; )
    at.pop()();
  Xe = !1, He.clear(), Le(n);
}
function _n(n) {
  if (n.fragment !== null) {
    n.update(), re(n.before_update);
    const e = n.dirty;
    n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, e), n.after_update.forEach(Ye);
  }
}
function gn(n) {
  const e = [], t = [];
  pe.forEach((r) => n.indexOf(r) === -1 ? e.push(r) : t.push(r)), t.forEach((r) => r()), pe = e;
}
const Pe = /* @__PURE__ */ new Set();
let he;
function Ae() {
  he = {
    r: 0,
    c: [],
    p: he
    // parent group
  };
}
function Ue() {
  he.r || re(he.c), he = he.p;
}
function Z(n, e) {
  n && n.i && (Pe.delete(n), n.i(e));
}
function O(n, e, t, r) {
  if (n && n.o) {
    if (Pe.has(n))
      return;
    Pe.add(n), he.c.push(() => {
      Pe.delete(n), r && (t && n.d(1), r());
    }), n.o(e);
  } else
    r && r();
}
function dt(n) {
  return (n == null ? void 0 : n.length) !== void 0 ? n : Array.from(n);
}
function yn(n, e) {
  O(n, 1, 1, () => {
    e.delete(n.key);
  });
}
function bn(n, e, t, r, l, u, s, f, h, c, m, v) {
  let g = n.length, L = u.length, I = g;
  const T = {};
  for (; I--; )
    T[n[I].key] = I;
  const M = [], U = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), N = [];
  for (I = L; I--; ) {
    const B = v(l, u, I), R = t(B);
    let _ = s.get(R);
    _ ? r && N.push(() => _.p(B, e)) : (_ = c(R, B), _.c()), U.set(R, M[I] = _), R in T && y.set(R, Math.abs(I - T[R]));
  }
  const F = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
  function b(B) {
    Z(B, 1), B.m(f, m), s.set(B.key, B), m = B.first, L--;
  }
  for (; g && L; ) {
    const B = M[L - 1], R = n[g - 1], _ = B.key, w = R.key;
    B === R ? (m = B.first, g--, L--) : U.has(w) ? !s.has(_) || F.has(_) ? b(B) : d.has(w) ? g-- : y.get(_) > y.get(w) ? (d.add(_), b(B)) : (F.add(w), g--) : (h(R, s), g--);
  }
  for (; g--; ) {
    const B = n[g];
    U.has(B.key) || h(B, s);
  }
  for (; L; )
    b(M[L - 1]);
  return re(N), M;
}
function fe(n) {
  n && n.c();
}
function te(n, e, t) {
  const { fragment: r, after_update: l } = n.$$;
  r && r.m(e, t), Ye(() => {
    const u = n.$$.on_mount.map(kt).filter(pt);
    n.$$.on_destroy ? n.$$.on_destroy.push(...u) : re(u), n.$$.on_mount = [];
  }), l.forEach(Ye);
}
function ne(n, e) {
  const t = n.$$;
  t.fragment !== null && (gn(t.after_update), re(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
}
function wn(n, e) {
  n.$$.dirty[0] === -1 && (ke.push(n), mn(), n.$$.dirty.fill(0)), n.$$.dirty[e / 31 | 0] |= 1 << e % 31;
}
function _e(n, e, t, r, l, u, s = null, f = [-1]) {
  const h = Re;
  Le(n);
  const c = n.$$ = {
    fragment: null,
    ctx: [],
    // state
    props: u,
    update: S,
    not_equal: l,
    bound: ot(),
    // lifecycle
    on_mount: [],
    on_destroy: [],
    on_disconnect: [],
    before_update: [],
    after_update: [],
    context: new Map(e.context || (h ? h.$$.context : [])),
    // everything else
    callbacks: ot(),
    dirty: f,
    skip_bound: !1,
    root: e.target || h.$$.root
  };
  s && s(c.root);
  let m = !1;
  if (c.ctx = t ? t(n, e.props || {}, (v, g, ...L) => {
    const I = L.length ? L[0] : g;
    return c.ctx && l(c.ctx[v], c.ctx[v] = I) && (!c.skip_bound && c.bound[v] && c.bound[v](I), m && wn(n, v)), g;
  }) : [], c.update(), m = !0, re(c.before_update), c.fragment = r ? r(c.ctx) : !1, e.target) {
    if (e.hydrate) {
      const v = fn(e.target);
      c.fragment && c.fragment.l(v), v.forEach(z);
    } else
      c.fragment && c.fragment.c();
    e.intro && Z(n.$$.fragment), te(n, e.target, e.anchor), Lt();
  }
  Le(h);
}
class ge {
  constructor() {
    /**
     * ### PRIVATE API
     *
     * Do not use, may change at any time
     *
     * @type {any}
     */
    Ve(this, "$$");
    /**
     * ### PRIVATE API
     *
     * Do not use, may change at any time
     *
     * @type {any}
     */
    Ve(this, "$$set");
  }
  /** @returns {void} */
  $destroy() {
    ne(this, 1), this.$destroy = S;
  }
  /**
   * @template {Extract<keyof Events, string>} K
   * @param {K} type
   * @param {((e: Events[K]) => void) | null | undefined} callback
   * @returns {() => void}
   */
  $on(e, t) {
    if (!pt(t))
      return S;
    const r = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
    return r.push(t), () => {
      const l = r.indexOf(t);
      l !== -1 && r.splice(l, 1);
    };
  }
  /**
   * @param {Partial<Props>} props
   * @returns {void}
   */
  $set(e) {
    this.$$set && !tn(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
  }
}
const vn = "4";
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(vn);
function kn(n) {
  let e, t;
  return {
    c() {
      e = oe("svg"), t = oe("path"), o(t, "d", "M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"), o(e, "viewBox", "0 0 14 14"), o(e, "width", "13"), o(e, "height", "13"), o(e, "class", "svelte-en2qvf");
    },
    m(r, l) {
      A(r, e, l), k(e, t);
    },
    p: S,
    i: S,
    o: S,
    d(r) {
      r && z(e);
    }
  };
}
class Bt extends ge {
  constructor(e) {
    super(), _e(this, e, null, kn, me, {});
  }
}
function pn(n) {
  let e, t;
  return {
    c() {
      e = oe("svg"), t = oe("path"), o(t, "d", "M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"), o(e, "viewBox", "0 0 30 30"), o(e, "fill", "none"), o(e, "xmlns", "http://www.w3.org/2000/svg"), o(e, "class", "svelte-d2loi5");
    },
    m(r, l) {
      A(r, e, l), k(e, t);
    },
    p: S,
    i: S,
    o: S,
    d(r) {
      r && z(e);
    }
  };
}
class Rt extends ge {
  constructor(e) {
    super(), _e(this, e, null, pn, me, {});
  }
}
function Tn(n) {
  let e, t;
  return {
    c() {
      e = E("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "area.svg") || o(e, "src", t), o(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), o(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "area.svg") && o(e, "src", t), l & /*placeType*/
      64 && o(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function Mn(n) {
  let e, t;
  return {
    c() {
      e = E("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "poi.svg") || o(e, "src", t), o(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), o(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "poi.svg") && o(e, "src", t), l & /*placeType*/
      64 && o(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function Ln(n) {
  let e, t;
  return {
    c() {
      e = E("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "postal_code.svg") || o(e, "src", t), o(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), o(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "postal_code.svg") && o(e, "src", t), l & /*placeType*/
      64 && o(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function Bn(n) {
  let e, t;
  return {
    c() {
      e = E("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "street.svg") || o(e, "src", t), o(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), o(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "street.svg") && o(e, "src", t), l & /*placeType*/
      64 && o(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function Rn(n) {
  let e, t;
  return {
    c() {
      e = E("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "road.svg") || o(e, "src", t), o(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), o(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "road.svg") && o(e, "src", t), l & /*placeType*/
      64 && o(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function Cn(n) {
  let e, t;
  return {
    c() {
      e = E("img"), V(e.src, t = /*iconsBaseUrl*/
      n[3] + "housenumber.svg") || o(e, "src", t), o(
        e,
        "alt",
        /*placeType*/
        n[6]
      ), o(e, "class", "svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l);
    },
    p(r, l) {
      l & /*iconsBaseUrl*/
      8 && !V(e.src, t = /*iconsBaseUrl*/
      r[3] + "housenumber.svg") && o(e, "src", t), l & /*placeType*/
      64 && o(
        e,
        "alt",
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function En(n) {
  let e, t, r, l;
  return {
    c() {
      e = E("img"), V(e.src, t = /*imageUrl*/
      n[5]) || o(e, "src", t), o(
        e,
        "alt",
        /*category*/
        n[4]
      ), o(e, "class", "svelte-ltkwvy");
    },
    m(u, s) {
      A(u, e, s), r || (l = D(
        e,
        "error",
        /*error_handler*/
        n[12]
      ), r = !0);
    },
    p(u, s) {
      s & /*imageUrl*/
      32 && !V(e.src, t = /*imageUrl*/
      u[5]) && o(e, "src", t), s & /*category*/
      16 && o(
        e,
        "alt",
        /*category*/
        u[4]
      );
    },
    d(u) {
      u && z(e), r = !1, l();
    }
  };
}
function ht(n) {
  let e, t;
  return {
    c() {
      e = E("span"), t = ce(
        /*placeType*/
        n[6]
      ), o(e, "class", "secondary svelte-ltkwvy");
    },
    m(r, l) {
      A(r, e, l), k(e, t);
    },
    p(r, l) {
      l & /*placeType*/
      64 && Be(
        t,
        /*placeType*/
        r[6]
      );
    },
    d(r) {
      r && z(e);
    }
  };
}
function In(n) {
  var B, R;
  let e, t, r, l, u, s, f, h, c = (
    /*feature*/
    n[0].place_name.replace(/,.*/, "") + ""
  ), m, v, g = (
    /*showPlaceType*/
    n[2] === "always" || /*showPlaceType*/
    n[2] && !/*feature*/
    n[0].address && /*feature*/
    ((B = n[0].properties) == null ? void 0 : B.kind) !== "road" && /*feature*/
    ((R = n[0].properties) == null ? void 0 : R.kind) !== "road_relation" && !/*feature*/
    n[0].id.startsWith("address.") && !/*feature*/
    n[0].id.startsWith("postal_code.") && (!/*feature*/
    n[0].id.startsWith("poi.") || !/*imageUrl*/
    n[5])
  ), L, I, T = (
    /*feature*/
    n[0].place_name.replace(/[^,]*,?\s*/, "") + ""
  ), M, U, y;
  function N(_, w) {
    var X, a;
    return w & /*feature*/
    1 && (t = null), w & /*feature*/
    1 && (r = null), w & /*feature*/
    1 && (l = null), /*imageUrl*/
    _[5] ? En : (
      /*feature*/
      _[0].address ? Cn : (
        /*feature*/
        ((X = _[0].properties) == null ? void 0 : X.kind) === "road" || /*feature*/
        ((a = _[0].properties) == null ? void 0 : a.kind) === "road_relation" ? Rn : (t == null && (t = !!/*feature*/
        _[0].id.startsWith("address.")), t ? Bn : (r == null && (r = !!/*feature*/
        _[0].id.startsWith("postal_code.")), r ? Ln : (l == null && (l = !!/*feature*/
        _[0].id.startsWith("poi.")), l ? Mn : Tn)))
      )
    );
  }
  let F = N(n, -1), d = F(n), b = g && ht(n);
  return {
    c() {
      e = E("li"), d.c(), u = J(), s = E("span"), f = E("span"), h = E("span"), m = ce(c), v = J(), b && b.c(), L = J(), I = E("span"), M = ce(T), o(h, "class", "primary svelte-ltkwvy"), o(f, "class", "svelte-ltkwvy"), o(I, "class", "line2 svelte-ltkwvy"), o(s, "class", "texts svelte-ltkwvy"), o(e, "tabindex", "0"), o(
        e,
        "data-selected",
        /*selected*/
        n[1]
      ), o(e, "class", "svelte-ltkwvy"), se(
        e,
        "selected",
        /*selected*/
        n[1]
      );
    },
    m(_, w) {
      A(_, e, w), d.m(e, null), k(e, u), k(e, s), k(s, f), k(f, h), k(h, m), k(f, v), b && b.m(f, null), k(s, L), k(s, I), k(I, M), U || (y = [
        D(
          e,
          "mouseenter",
          /*mouseenter_handler*/
          n[10]
        ),
        D(
          e,
          "focus",
          /*focus_handler*/
          n[11]
        )
      ], U = !0);
    },
    p(_, [w]) {
      var X, a;
      F === (F = N(_, w)) && d ? d.p(_, w) : (d.d(1), d = F(_), d && (d.c(), d.m(e, u))), w & /*feature*/
      1 && c !== (c = /*feature*/
      _[0].place_name.replace(/,.*/, "") + "") && Be(m, c), w & /*showPlaceType, feature, imageUrl*/
      37 && (g = /*showPlaceType*/
      _[2] === "always" || /*showPlaceType*/
      _[2] && !/*feature*/
      _[0].address && /*feature*/
      ((X = _[0].properties) == null ? void 0 : X.kind) !== "road" && /*feature*/
      ((a = _[0].properties) == null ? void 0 : a.kind) !== "road_relation" && !/*feature*/
      _[0].id.startsWith("address.") && !/*feature*/
      _[0].id.startsWith("postal_code.") && (!/*feature*/
      _[0].id.startsWith("poi.") || !/*imageUrl*/
      _[5])), g ? b ? b.p(_, w) : (b = ht(_), b.c(), b.m(f, null)) : b && (b.d(1), b = null), w & /*feature*/
      1 && T !== (T = /*feature*/
      _[0].place_name.replace(/[^,]*,?\s*/, "") + "") && Be(M, T), w & /*selected*/
      2 && o(
        e,
        "data-selected",
        /*selected*/
        _[1]
      ), w & /*selected*/
      2 && se(
        e,
        "selected",
        /*selected*/
        _[1]
      );
    },
    i: S,
    o: S,
    d(_) {
      _ && z(e), d.d(), b && b.d(), U = !1, re(y);
    }
  };
}
function Sn(n, e, t) {
  var U;
  let r, l, { feature: u } = e, { selected: s = !1 } = e, { showPlaceType: f } = e, { missingIconsCache: h } = e, { iconsBaseUrl: c } = e;
  const m = (U = u.properties) == null ? void 0 : U.categories;
  let v, g;
  function L(y) {
    g && h.add(g), t(9, r--, r);
  }
  function I(y) {
    ut.call(this, n, y);
  }
  function T(y) {
    ut.call(this, n, y);
  }
  const M = (y) => L(y.currentTarget);
  return n.$$set = (y) => {
    "feature" in y && t(0, u = y.feature), "selected" in y && t(1, s = y.selected), "showPlaceType" in y && t(2, f = y.showPlaceType), "missingIconsCache" in y && t(8, h = y.missingIconsCache), "iconsBaseUrl" in y && t(3, c = y.iconsBaseUrl);
  }, n.$$.update = () => {
    var y, N, F, d;
    if (n.$$.dirty & /*index, category, iconsBaseUrl, imageUrl, missingIconsCache*/
    824)
      do
        t(9, r--, r), t(4, v = m == null ? void 0 : m[r]), t(5, g = v ? c + v.replace(/ /g, "_") + ".svg" : void 0);
      while (r > -1 && (!g || h.has(g)));
    n.$$.dirty & /*feature*/
    1 && t(6, l = u.id.startsWith("poi.") ? (N = (y = u.properties) == null ? void 0 : y.categories) == null ? void 0 : N.join(", ") : ((d = (F = u.properties) == null ? void 0 : F.place_type_name) == null ? void 0 : d[0]) ?? u.place_type[0]);
  }, t(9, r = (m == null ? void 0 : m.length) ?? 0), [
    u,
    s,
    f,
    c,
    v,
    g,
    l,
    L,
    h,
    r,
    I,
    T,
    M
  ];
}
class zn extends ge {
  constructor(e) {
    super(), _e(this, e, Sn, In, me, {
      feature: 0,
      selected: 1,
      showPlaceType: 2,
      missingIconsCache: 8,
      iconsBaseUrl: 3
    });
  }
}
function Pn(n) {
  let e;
  return {
    c() {
      e = E("div"), e.innerHTML = '<svg viewBox="0 0 18 18" width="24" height="24" class="svelte-7cmwmc"><path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"></path><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"></path></svg>', o(e, "class", "svelte-7cmwmc");
    },
    m(t, r) {
      A(t, e, r);
    },
    p: S,
    i: S,
    o: S,
    d(t) {
      t && z(e);
    }
  };
}
class An extends ge {
  constructor(e) {
    super(), _e(this, e, null, Pn, me, {});
  }
}
function Un(n) {
  let e, t;
  return {
    c() {
      e = oe("svg"), t = oe("path"), o(t, "d", "M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"), o(e, "viewBox", "0 0 60.006 21.412"), o(e, "width", "14"), o(e, "height", "20"), o(e, "class", "svelte-en2qvf");
    },
    m(r, l) {
      A(r, e, l), k(e, t);
    },
    p: S,
    i: S,
    o: S,
    d(r) {
      r && z(e);
    }
  };
}
class jn extends ge {
  constructor(e) {
    super(), _e(this, e, null, Un, me, {});
  }
}
function Wn(n) {
  let e, t;
  return {
    c() {
      e = oe("svg"), t = oe("path"), o(t, "d", "M13.101 14.261 8.74 9.899a4.797 4.797 0 0 1-1.425.748 5.165 5.165 0 0 1-1.603.248c-1.446 0-2.677-.5-3.693-1.503S.495 7.164.495 5.717c0-1.446.508-2.678 1.524-3.693C3.035 1.008 4.266.5 5.712.5c1.448 0 2.672.508 3.675 1.524 1.002 1.015 1.503 2.247 1.503 3.693 0 .558-.08 1.092-.239 1.603-.159.512-.411.98-.757 1.405l4.382 4.4a.74.74 0 0 1 .229.568.81.81 0 0 1-.249.568.787.787 0 0 1-.577.239.787.787 0 0 1-.578-.239ZM5.712 9.223c.97 0 1.796-.342 2.48-1.026a3.378 3.378 0 0 0 1.026-2.48c0-.982-.34-1.818-1.016-2.509-.677-.69-1.507-1.035-2.49-1.035a3.42 3.42 0 0 0-2.509 1.035 3.42 3.42 0 0 0-1.035 2.51c0 .982.345 1.812 1.035 2.488.691.678 1.527 1.017 2.51 1.017Z"), o(e, "width", "14"), o(e, "height", "14"), o(e, "viewBox", "0 0 15 15"), o(e, "class", "svelte-en2qvf");
    },
    m(r, l) {
      A(r, e, l), k(e, t);
    },
    p: S,
    i: S,
    o: S,
    d(r) {
      r && z(e);
    }
  };
}
class Zn extends ge {
  constructor(e) {
    super(), _e(this, e, null, Wn, me, {});
  }
}
function mt(n, e, t) {
  const r = n.slice();
  return r[76] = e[t], r[78] = t, r;
}
function _t(n) {
  let e, t;
  return e = new An({}), {
    c() {
      fe(e.$$.fragment);
    },
    m(r, l) {
      te(e, r, l), t = !0;
    },
    i(r) {
      t || (Z(e.$$.fragment, r), t = !0);
    },
    o(r) {
      O(e.$$.fragment, r), t = !1;
    },
    d(r) {
      ne(e, r);
    }
  };
}
function gt(n) {
  let e, t, r, l, u;
  return t = new jn({}), {
    c() {
      e = E("button"), fe(t.$$.fragment), o(e, "type", "button"), o(
        e,
        "title",
        /*reverseButtonTitle*/
        n[9]
      ), o(e, "class", "svelte-1r7dvt7"), se(
        e,
        "active",
        /*reverseActive*/
        n[0]
      );
    },
    m(s, f) {
      A(s, e, f), te(t, e, null), r = !0, l || (u = D(
        e,
        "click",
        /*click_handler_2*/
        n[61]
      ), l = !0);
    },
    p(s, f) {
      (!r || f[0] & /*reverseButtonTitle*/
      512) && o(
        e,
        "title",
        /*reverseButtonTitle*/
        s[9]
      ), (!r || f[0] & /*reverseActive*/
      1) && se(
        e,
        "active",
        /*reverseActive*/
        s[0]
      );
    },
    i(s) {
      r || (Z(t.$$.fragment, s), r = !0);
    },
    o(s) {
      O(t.$$.fragment, s), r = !1;
    },
    d(s) {
      s && z(e), ne(t), l = !1, u();
    }
  };
}
function Nn(n) {
  let e, t = [], r = /* @__PURE__ */ new Map(), l, u, s, f = dt(
    /*listFeatures*/
    n[13]
  );
  const h = (c) => (
    /*feature*/
    c[76].id + /*feature*/
    (c[76].address ? "," + /*feature*/
    c[76].address : "")
  );
  for (let c = 0; c < f.length; c += 1) {
    let m = mt(n, f, c), v = h(m);
    r.set(v, t[c] = yt(v, m));
  }
  return {
    c() {
      e = E("ul");
      for (let c = 0; c < t.length; c += 1)
        t[c].c();
      o(e, "class", "svelte-1r7dvt7");
    },
    m(c, m) {
      A(c, e, m);
      for (let v = 0; v < t.length; v += 1)
        t[v] && t[v].m(e, null);
      l = !0, u || (s = [
        D(
          e,
          "mouseleave",
          /*mouseleave_handler*/
          n[65]
        ),
        D(
          e,
          "blur",
          /*blur_handler_1*/
          n[66]
        )
      ], u = !0);
    },
    p(c, m) {
      m[0] & /*listFeatures, showPlaceType, selectedItemIndex, missingIconsCache, iconsBaseUrl, pick*/
      8940544 && (f = dt(
        /*listFeatures*/
        c[13]
      ), Ae(), t = bn(t, m, h, 1, c, f, r, e, yn, yt, null, mt), Ue());
    },
    i(c) {
      if (!l) {
        for (let m = 0; m < f.length; m += 1)
          Z(t[m]);
        l = !0;
      }
    },
    o(c) {
      for (let m = 0; m < t.length; m += 1)
        O(t[m]);
      l = !1;
    },
    d(c) {
      c && z(e);
      for (let m = 0; m < t.length; m += 1)
        t[m].d();
      u = !1, re(s);
    }
  };
}
function Fn(n) {
  let e, t, r, l, u, s;
  return t = new Rt({}), {
    c() {
      e = E("div"), fe(t.$$.fragment), r = J(), l = E("div"), u = ce(
        /*noResultsMessage*/
        n[7]
      ), o(l, "class", "svelte-1r7dvt7"), o(e, "class", "no-results svelte-1r7dvt7");
    },
    m(f, h) {
      A(f, e, h), te(t, e, null), k(e, r), k(e, l), k(l, u), s = !0;
    },
    p(f, h) {
      (!s || h[0] & /*noResultsMessage*/
      128) && Be(
        u,
        /*noResultsMessage*/
        f[7]
      );
    },
    i(f) {
      s || (Z(t.$$.fragment, f), s = !0);
    },
    o(f) {
      O(t.$$.fragment, f), s = !1;
    },
    d(f) {
      f && z(e), ne(t);
    }
  };
}
function On(n) {
  let e = "", t;
  return {
    c() {
      t = ce(e);
    },
    m(r, l) {
      A(r, t, l);
    },
    p: S,
    i: S,
    o: S,
    d(r) {
      r && z(t);
    }
  };
}
function Gn(n) {
  let e, t, r, l, u, s, f, h, c, m, v;
  return t = new Rt({}), h = new Bt({}), {
    c() {
      e = E("div"), fe(t.$$.fragment), r = J(), l = E("div"), u = ce(
        /*errorMessage*/
        n[6]
      ), s = J(), f = E("button"), fe(h.$$.fragment), o(l, "class", "svelte-1r7dvt7"), o(f, "class", "svelte-1r7dvt7"), o(e, "class", "error svelte-1r7dvt7");
    },
    m(g, L) {
      A(g, e, L), te(t, e, null), k(e, r), k(e, l), k(l, u), k(e, s), k(e, f), te(h, f, null), c = !0, m || (v = D(
        f,
        "click",
        /*click_handler_3*/
        n[62]
      ), m = !0);
    },
    p(g, L) {
      (!c || L[0] & /*errorMessage*/
      64) && Be(
        u,
        /*errorMessage*/
        g[6]
      );
    },
    i(g) {
      c || (Z(t.$$.fragment, g), Z(h.$$.fragment, g), c = !0);
    },
    o(g) {
      O(t.$$.fragment, g), O(h.$$.fragment, g), c = !1;
    },
    d(g) {
      g && z(e), ne(t), ne(h), m = !1, v();
    }
  };
}
function yt(n, e) {
  let t, r, l;
  function u() {
    return (
      /*mouseenter_handler*/
      e[63](
        /*i*/
        e[78]
      )
    );
  }
  function s() {
    return (
      /*focus_handler_1*/
      e[64](
        /*feature*/
        e[76]
      )
    );
  }
  return r = new zn({
    props: {
      feature: (
        /*feature*/
        e[76]
      ),
      showPlaceType: (
        /*showPlaceType*/
        e[10]
      ),
      selected: (
        /*selectedItemIndex*/
        e[14] === /*i*/
        e[78]
      ),
      missingIconsCache: (
        /*missingIconsCache*/
        e[19]
      ),
      iconsBaseUrl: (
        /*iconsBaseUrl*/
        e[11]
      )
    }
  }), r.$on("mouseenter", u), r.$on("focus", s), {
    key: n,
    first: null,
    c() {
      t = on(), fe(r.$$.fragment), this.first = t;
    },
    m(f, h) {
      A(f, t, h), te(r, f, h), l = !0;
    },
    p(f, h) {
      e = f;
      const c = {};
      h[0] & /*listFeatures*/
      8192 && (c.feature = /*feature*/
      e[76]), h[0] & /*showPlaceType*/
      1024 && (c.showPlaceType = /*showPlaceType*/
      e[10]), h[0] & /*selectedItemIndex, listFeatures*/
      24576 && (c.selected = /*selectedItemIndex*/
      e[14] === /*i*/
      e[78]), h[0] & /*iconsBaseUrl*/
      2048 && (c.iconsBaseUrl = /*iconsBaseUrl*/
      e[11]), r.$set(c);
    },
    i(f) {
      l || (Z(r.$$.fragment, f), l = !0);
    },
    o(f) {
      O(r.$$.fragment, f), l = !1;
    },
    d(f) {
      f && z(t), ne(r, f);
    }
  };
}
function Qn(n) {
  let e, t, r, l, u, s, f, h, c, m, v, g, L, I, T, M, U, y, N, F;
  l = new Zn({}), m = new Bt({});
  let d = (
    /*abortController*/
    n[18] && _t()
  ), b = (
    /*enableReverse*/
    n[5] === !0 && gt(n)
  );
  const B = (
    /*#slots*/
    n[53].default
  ), R = nn(
    B,
    n,
    /*$$scope*/
    n[52],
    null
  ), _ = [Gn, On, Fn, Nn], w = [];
  function X(a, P) {
    var ee, ue;
    return (
      /*error*/
      a[17] ? 0 : (
        /*focusedDelayed*/
        a[15] ? (
          /*listFeatures*/
          ((ee = a[13]) == null ? void 0 : ee.length) === 0 ? 2 : (
            /*focusedDelayed*/
            a[15] && /*listFeatures*/
            ((ue = a[13]) != null && ue.length) ? 3 : -1
          )
        ) : 1
      )
    );
  }
  return ~(T = X(n)) && (M = w[T] = _[T](n)), {
    c() {
      e = E("form"), t = E("div"), r = E("button"), fe(l.$$.fragment), u = J(), s = E("input"), f = J(), h = E("div"), c = E("button"), fe(m.$$.fragment), v = J(), d && d.c(), g = J(), b && b.c(), L = J(), R && R.c(), I = J(), M && M.c(), o(r, "class", "search-button svelte-1r7dvt7"), o(r, "type", "button"), o(
        s,
        "placeholder",
        /*placeholder*/
        n[8]
      ), o(
        s,
        "aria-label",
        /*placeholder*/
        n[8]
      ), o(s, "class", "svelte-1r7dvt7"), o(c, "type", "button"), o(
        c,
        "title",
        /*clearButtonTitle*/
        n[3]
      ), o(c, "class", "svelte-1r7dvt7"), o(h, "class", "clear-button-container svelte-1r7dvt7"), se(
        h,
        "displayable",
        /*searchValue*/
        n[1] !== ""
      ), o(t, "class", "input-group svelte-1r7dvt7"), o(e, "tabindex", "0"), o(e, "class", U = ct(
        /*className*/
        n[2]
      ) + " svelte-1r7dvt7"), se(
        e,
        "can-collapse",
        /*collapsed*/
        n[4] && /*searchValue*/
        n[1] === ""
      );
    },
    m(a, P) {
      A(a, e, P), k(e, t), k(t, r), te(l, r, null), k(t, u), k(t, s), n[55](s), ft(
        s,
        /*searchValue*/
        n[1]
      ), k(t, f), k(t, h), k(h, c), te(m, c, null), k(h, v), d && d.m(h, null), k(t, g), b && b.m(t, null), k(t, L), R && R.m(t, null), k(e, I), ~T && w[T].m(e, null), y = !0, N || (F = [
        D(
          r,
          "click",
          /*click_handler*/
          n[54]
        ),
        D(
          s,
          "input",
          /*input_1_input_handler*/
          n[56]
        ),
        D(
          s,
          "focus",
          /*focus_handler*/
          n[57]
        ),
        D(
          s,
          "blur",
          /*blur_handler*/
          n[58]
        ),
        D(
          s,
          "keydown",
          /*handleKeyDown*/
          n[21]
        ),
        D(
          s,
          "input",
          /*input_handler*/
          n[59]
        ),
        D(
          c,
          "click",
          /*click_handler_1*/
          n[60]
        ),
        D(e, "submit", cn(
          /*handleOnSubmit*/
          n[20]
        ))
      ], N = !0);
    },
    p(a, P) {
      (!y || P[0] & /*placeholder*/
      256) && o(
        s,
        "placeholder",
        /*placeholder*/
        a[8]
      ), (!y || P[0] & /*placeholder*/
      256) && o(
        s,
        "aria-label",
        /*placeholder*/
        a[8]
      ), P[0] & /*searchValue*/
      2 && s.value !== /*searchValue*/
      a[1] && ft(
        s,
        /*searchValue*/
        a[1]
      ), (!y || P[0] & /*clearButtonTitle*/
      8) && o(
        c,
        "title",
        /*clearButtonTitle*/
        a[3]
      ), /*abortController*/
      a[18] ? d ? P[0] & /*abortController*/
      262144 && Z(d, 1) : (d = _t(), d.c(), Z(d, 1), d.m(h, null)) : d && (Ae(), O(d, 1, 1, () => {
        d = null;
      }), Ue()), (!y || P[0] & /*searchValue*/
      2) && se(
        h,
        "displayable",
        /*searchValue*/
        a[1] !== ""
      ), /*enableReverse*/
      a[5] === !0 ? b ? (b.p(a, P), P[0] & /*enableReverse*/
      32 && Z(b, 1)) : (b = gt(a), b.c(), Z(b, 1), b.m(t, L)) : b && (Ae(), O(b, 1, 1, () => {
        b = null;
      }), Ue()), R && R.p && (!y || P[1] & /*$$scope*/
      2097152) && ln(
        R,
        B,
        a,
        /*$$scope*/
        a[52],
        y ? rn(
          B,
          /*$$scope*/
          a[52],
          P,
          null
        ) : sn(
          /*$$scope*/
          a[52]
        ),
        null
      );
      let ee = T;
      T = X(a), T === ee ? ~T && w[T].p(a, P) : (M && (Ae(), O(w[ee], 1, 1, () => {
        w[ee] = null;
      }), Ue()), ~T ? (M = w[T], M ? M.p(a, P) : (M = w[T] = _[T](a), M.c()), Z(M, 1), M.m(e, null)) : M = null), (!y || P[0] & /*className*/
      4 && U !== (U = ct(
        /*className*/
        a[2]
      ) + " svelte-1r7dvt7")) && o(e, "class", U), (!y || P[0] & /*className, collapsed, searchValue*/
      22) && se(
        e,
        "can-collapse",
        /*collapsed*/
        a[4] && /*searchValue*/
        a[1] === ""
      );
    },
    i(a) {
      y || (Z(l.$$.fragment, a), Z(m.$$.fragment, a), Z(d), Z(b), Z(R, a), Z(M), y = !0);
    },
    o(a) {
      O(l.$$.fragment, a), O(m.$$.fragment, a), O(d), O(b), O(R, a), O(M), y = !1;
    },
    d(a) {
      a && z(e), ne(l), n[55](null), ne(m), d && d.d(), b && b.d(), R && R.d(a), ~T && w[T].d(), N = !1, re(F);
    }
  };
}
function Dn(n, e, t) {
  const r = e[1], l = e[0], u = r - l;
  return n === r && t ? n : ((n - l) % u + u) % u + l;
}
function bt(n) {
  let e = [...n];
  return e[2] < e[0] && (e[2] += 360), e;
}
function qn(n, e, t) {
  let r, { $$slots: l = {}, $$scope: u } = e, { class: s = void 0 } = e, { apiKey: f } = e, { bbox: h = void 0 } = e, { clearButtonTitle: c = "clear" } = e, { clearOnBlur: m = !1 } = e, { collapsed: v = !1 } = e, { country: g = void 0 } = e, { debounceSearch: L = 200 } = e, { enableReverse: I = !1 } = e, { errorMessage: T = "Something went wrong…" } = e, { filter: M = () => !0 } = e, { flyTo: U = !0 } = e, { fuzzyMatch: y = !0 } = e, { language: N = void 0 } = e, { limit: F = void 0 } = e, { mapController: d = void 0 } = e, { minLength: b = 2 } = e, { noResultsMessage: B = "Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!" } = e, { placeholder: R = "Search" } = e, { proximity: _ = [{ type: "server-geolocation" }] } = e, { reverseActive: w = I === "always" } = e, { reverseButtonTitle: X = "toggle reverse geocoding" } = e, { searchValue: a = "" } = e, { showFullGeometry: P = !0 } = e, { showPlaceType: ee = "ifNeeded" } = e, { showResultsWhileTyping: ue = !0 } = e, { types: ae = void 0 } = e, { zoom: Ce = 16 } = e, { maxZoom: Te = 18 } = e, { apiUrl: je = "https://api.maptiler.com/geocoding" } = e, { fetchParameters: We = {} } = e, { iconsBaseUrl: xe = "https://cdn.maptiler.com/maptiler-geocoding-control/v1.0.0-rc.4/icons/" } = e, { adjustQuery: Ze = (i) => {
  } } = e;
  function Ct() {
    Y.focus();
  }
  function Et() {
    Y.blur();
  }
  function $e(i, W = !0) {
    t(1, a = i), W ? (t(14, j = -1), tt()) : (Oe(), setTimeout(() => {
      Y.focus(), Y.select();
    }));
  }
  let ye = !1, C, Q, p, et = "", Y, j = -1, x, Ee = [], de, be, Ie, Ne, Me;
  const It = /* @__PURE__ */ new Set(), le = dn();
  an(() => {
    d && (d.setEventHandler(void 0), d.indicateReverse(!1), d.setSelectedMarker(-1), d.setMarkers(void 0, void 0));
  });
  function tt(i) {
    if (be && (clearTimeout(be), be = void 0), j > -1 && C)
      t(49, p = C[j]), t(1, a = p.place_name.replace(/,.*/, "")), t(17, x = void 0), t(48, Q = void 0), t(14, j = -1);
    else if (a) {
      const W = i || !nt();
      Fe(a, { exact: !0 }).then(() => {
        t(48, Q = C), t(49, p = void 0), W && St();
      }).catch(($) => t(17, x = $));
    }
  }
  function nt() {
    return /^-?\d+(\.\d+)?,-?\d+(\.\d+)?$/.test(a);
  }
  async function Fe(i, { byId: W = !1, exact: $ = !1 } = {}) {
    t(17, x = void 0), de == null || de.abort();
    const ie = new AbortController();
    t(18, de = ie);
    try {
      const H = nt(), q = new URLSearchParams();
      if (N !== void 0 && q.set("language", Array.isArray(N) ? N.join(",") : N ?? ""), ae && q.set("types", ae.join(",")), h && q.set("bbox", h.map((De) => De.toFixed(6)).join(",")), g && q.set("country", Array.isArray(g) ? g.join(",") : g), !W && !H) {
        async function De() {
          const we = d == null ? void 0 : d.getCenterAndZoom();
          for (const K of _ ?? [])
            if (!(we && (K.minZoom != null && K.minZoom > we[0] || K.maxZoom != null && K.maxZoom < we[0]))) {
              if (K.type === "fixed")
                return K.coordinates.join(",");
              e:
                if (K.type === "client-geolocation") {
                  if (Me && K.cachedLocationExpiry && Me.time + K.cachedLocationExpiry > Date.now()) {
                    if (!Me.coords)
                      break e;
                    return Me.coords;
                  }
                  let qe;
                  try {
                    return qe = await new Promise((Kt, it) => {
                      ie.signal.addEventListener("abort", () => {
                        it(Error("aborted"));
                      }), navigator.geolocation.getCurrentPosition(
                        (Se) => {
                          Kt([Se.coords.longitude, Se.coords.latitude].map((Ht) => Ht.toFixed(6)).join(","));
                        },
                        (Se) => {
                          it(Se);
                        },
                        K
                      );
                    }), qe;
                  } catch {
                  } finally {
                    K.cachedLocationExpiry && (Me = {
                      time: Date.now(),
                      // ignore
                      coords: qe
                    });
                  }
                  if (ie.signal.aborted)
                    return;
                }
              if (K.type === "server-geolocation")
                return "ip";
              if (we && K.type === "map-center")
                return we[1].toFixed(6) + "," + we[2].toFixed(6);
            }
        }
        const lt = await De();
        lt && q.set("proximity", lt), ($ || !ue) && q.set("autocomplete", "false"), q.set("fuzzyMatch", String(y));
      }
      F !== void 0 && (!H || (ae == null ? void 0 : ae.length) === 1) && q.set("limit", String(F)), q.set("key", f), Ze(q);
      const G = je + "/" + encodeURIComponent(i) + ".json?" + q.toString();
      if (G === et) {
        W ? (t(13, C = void 0), t(49, p = Ee[0])) : t(13, C = Ee);
        return;
      }
      et = G;
      const rt = await fetch(G, { signal: ie.signal, ...We });
      if (!rt.ok)
        throw new Error();
      const Qe = await rt.json();
      le("response", { url: G, featureCollection: Qe }), W ? (t(13, C = void 0), t(49, p = Qe.features[0]), Ee = [p]) : (t(13, C = Qe.features.filter(M)), Ee = C, H && Y.focus());
    } catch (H) {
      if (H && typeof H == "object" && "name" in H && H.name === "AbortError")
        return;
      throw H;
    } finally {
      ie === de && t(18, de = void 0);
    }
  }
  function St() {
    var $, ie, H, q;
    if (!(Q != null && Q.length) || !U)
      return;
    const i = [180, 90, -180, -90], W = !Q.some((G) => !G.matching_text);
    for (const G of Q)
      (W || !G.matching_text) && (i[0] = Math.min(i[0], (($ = G.bbox) == null ? void 0 : $[0]) ?? G.center[0]), i[1] = Math.min(i[1], ((ie = G.bbox) == null ? void 0 : ie[1]) ?? G.center[1]), i[2] = Math.max(i[2], ((H = G.bbox) == null ? void 0 : H[2]) ?? G.center[0]), i[3] = Math.max(i[3], ((q = G.bbox) == null ? void 0 : q[3]) ?? G.center[1]));
    d && Q.length > 0 && (p && i[0] === i[2] && i[1] === i[3] ? d.flyTo(p.center, Ce) : d.fitBounds(bt(i), 50, Te));
  }
  function zt(i) {
    t(0, w = I === "always"), $e(Dn(i[0], [-180, 180], !0).toFixed(6) + "," + i[1].toFixed(6));
  }
  function Pt(i) {
    if (!C)
      return;
    let W = i.key === "ArrowDown" ? 1 : i.key === "ArrowUp" ? -1 : 0;
    W ? (j === -1 && W === -1 && t(14, j = C.length), t(14, j += W), j >= C.length && t(14, j = -1), i.preventDefault()) : ["ArrowLeft", "ArrowRight", "Home", "End"].includes(i.key) && t(14, j = -1);
  }
  function Oe(i = !0) {
    if (t(17, x = void 0), ue) {
      if (be && clearTimeout(be), a.length < b)
        return;
      const W = a;
      be = window.setTimeout(
        () => {
          Fe(W).catch(($) => t(17, x = $));
        },
        i ? L : 0
      );
    } else
      t(13, C = void 0), t(17, x = void 0);
  }
  function Ge(i) {
    t(49, p = i), t(1, a = i.place_name), t(14, j = -1);
  }
  const At = () => Y.focus();
  function Ut(i) {
    Je[i ? "unshift" : "push"](() => {
      Y = i, t(16, Y);
    });
  }
  function jt() {
    a = this.value, t(1, a), t(12, ye), t(26, m);
  }
  const Wt = () => t(12, ye = !0), Zt = () => t(12, ye = !1), Nt = () => Oe(), Ft = () => {
    t(1, a = ""), Y.focus();
  }, Ot = () => t(0, w = !w), Gt = () => t(17, x = void 0), Qt = (i) => t(14, j = i), Dt = (i) => Ge(i), qt = () => t(14, j = -1), Vt = () => {
  };
  return n.$$set = (i) => {
    "class" in i && t(2, s = i.class), "apiKey" in i && t(24, f = i.apiKey), "bbox" in i && t(25, h = i.bbox), "clearButtonTitle" in i && t(3, c = i.clearButtonTitle), "clearOnBlur" in i && t(26, m = i.clearOnBlur), "collapsed" in i && t(4, v = i.collapsed), "country" in i && t(27, g = i.country), "debounceSearch" in i && t(28, L = i.debounceSearch), "enableReverse" in i && t(5, I = i.enableReverse), "errorMessage" in i && t(6, T = i.errorMessage), "filter" in i && t(29, M = i.filter), "flyTo" in i && t(30, U = i.flyTo), "fuzzyMatch" in i && t(31, y = i.fuzzyMatch), "language" in i && t(32, N = i.language), "limit" in i && t(33, F = i.limit), "mapController" in i && t(34, d = i.mapController), "minLength" in i && t(35, b = i.minLength), "noResultsMessage" in i && t(7, B = i.noResultsMessage), "placeholder" in i && t(8, R = i.placeholder), "proximity" in i && t(36, _ = i.proximity), "reverseActive" in i && t(0, w = i.reverseActive), "reverseButtonTitle" in i && t(9, X = i.reverseButtonTitle), "searchValue" in i && t(1, a = i.searchValue), "showFullGeometry" in i && t(37, P = i.showFullGeometry), "showPlaceType" in i && t(10, ee = i.showPlaceType), "showResultsWhileTyping" in i && t(38, ue = i.showResultsWhileTyping), "types" in i && t(39, ae = i.types), "zoom" in i && t(40, Ce = i.zoom), "maxZoom" in i && t(41, Te = i.maxZoom), "apiUrl" in i && t(42, je = i.apiUrl), "fetchParameters" in i && t(43, We = i.fetchParameters), "iconsBaseUrl" in i && t(11, xe = i.iconsBaseUrl), "adjustQuery" in i && t(44, Ze = i.adjustQuery), "$$scope" in i && t(52, u = i.$$scope);
  }, n.$$.update = () => {
    if (n.$$.dirty[0] & /*focused, clearOnBlur*/
    67112960 && setTimeout(() => {
      t(15, Ie = ye), m && !ye && t(1, a = "");
    }), n.$$.dirty[0] & /*searchValue, listFeatures*/
    8194 | n.$$.dirty[1] & /*minLength*/
    16 && a.length < b && (t(49, p = void 0), t(13, C = void 0), t(17, x = void 0), t(48, Q = C)), n.$$.dirty[1] & /*showFullGeometry, picked*/
    262208 && P && p && !p.address && p.geometry.type === "Point" && Fe(p.id, { byId: !0 }).catch((i) => t(17, x = i)), n.$$.dirty[0] & /*flyTo*/
    1073741824 | n.$$.dirty[1] & /*mapController, picked, prevIdToFly, maxZoom, zoom*/
    787976 && (d && p && p.id !== Ne && U && (!p.bbox || p.bbox[0] === p.bbox[2] && p.bbox[1] === p.bbox[3] ? d.flyTo(p.center, p.id.startsWith("poi.") || p.id.startsWith("address.") ? Te : Ce) : d.fitBounds(bt(p.bbox), 50, Te), t(13, C = void 0), t(48, Q = void 0), t(14, j = -1)), t(50, Ne = p == null ? void 0 : p.id)), n.$$.dirty[0] & /*listFeatures*/
    8192 | n.$$.dirty[1] & /*markedFeatures*/
    131072 && Q !== C && t(48, Q = void 0), n.$$.dirty[1] & /*mapController, markedFeatures, picked*/
    393224 && d && d.setMarkers(Q, p), n.$$.dirty[0] & /*searchValue*/
    2 && t(14, j = -1), n.$$.dirty[0] & /*reverseActive, listFeatures, focusedDelayed*/
    40961 | n.$$.dirty[1] & /*mapController*/
    8 && d && d.setEventHandler((i) => {
      switch (i.type) {
        case "mapClick":
          w && zt(i.coordinates);
          break;
        case "markerClick":
          {
            const W = C == null ? void 0 : C.find(($) => $.id === i.id);
            W && Ge(W);
          }
          break;
        case "markerMouseEnter":
          t(14, j = Ie ? (C == null ? void 0 : C.findIndex((W) => W.id === i.id)) ?? -1 : -1);
          break;
        case "markerMouseLeave":
          t(14, j = -1);
          break;
      }
    }), n.$$.dirty[0] & /*selectedItemIndex*/
    16384 | n.$$.dirty[1] & /*mapController*/
    8 && (d == null || d.setSelectedMarker(j)), n.$$.dirty[0] & /*listFeatures, selectedItemIndex*/
    24576 && t(51, r = C == null ? void 0 : C[j]), n.$$.dirty[0] & /*searchValue*/
    2 | n.$$.dirty[1] & /*mapController*/
    8) {
      const i = /^(-?\d+(?:\.\d*)?),(-?\d+(?:\.\d*)?)$/.exec(a);
      d == null || d.setReverseMarker(i ? [Number(i[1]), Number(i[2])] : void 0);
    }
    n.$$.dirty[1] & /*selected*/
    1048576 && le("select", r), n.$$.dirty[1] & /*picked*/
    262144 && le("pick", p), n.$$.dirty[0] & /*focusedDelayed, listFeatures*/
    40960 && le("optionsVisibilityChange", Ie && !!C), n.$$.dirty[0] & /*listFeatures*/
    8192 && le("featuresListed", C), n.$$.dirty[1] & /*markedFeatures*/
    131072 && le("featuresMarked", Q), n.$$.dirty[0] & /*reverseActive*/
    1 && le("reverseToggle", w), n.$$.dirty[0] & /*searchValue*/
    2 && le("queryChange", a), n.$$.dirty[0] & /*reverseActive*/
    1 | n.$$.dirty[1] & /*mapController*/
    8 && d && d.indicateReverse(w);
  }, [
    w,
    a,
    s,
    c,
    v,
    I,
    T,
    B,
    R,
    X,
    ee,
    xe,
    ye,
    C,
    j,
    Ie,
    Y,
    x,
    de,
    It,
    tt,
    Pt,
    Oe,
    Ge,
    f,
    h,
    m,
    g,
    L,
    M,
    U,
    y,
    N,
    F,
    d,
    b,
    _,
    P,
    ue,
    ae,
    Ce,
    Te,
    je,
    We,
    Ze,
    Ct,
    Et,
    $e,
    Q,
    p,
    Ne,
    r,
    u,
    l,
    At,
    Ut,
    jt,
    Wt,
    Zt,
    Nt,
    Ft,
    Ot,
    Gt,
    Qt,
    Dt,
    qt,
    Vt
  ];
}
class Vn extends ge {
  constructor(e) {
    super(), _e(
      this,
      e,
      qn,
      Qn,
      me,
      {
        class: 2,
        apiKey: 24,
        bbox: 25,
        clearButtonTitle: 3,
        clearOnBlur: 26,
        collapsed: 4,
        country: 27,
        debounceSearch: 28,
        enableReverse: 5,
        errorMessage: 6,
        filter: 29,
        flyTo: 30,
        fuzzyMatch: 31,
        language: 32,
        limit: 33,
        mapController: 34,
        minLength: 35,
        noResultsMessage: 7,
        placeholder: 8,
        proximity: 36,
        reverseActive: 0,
        reverseButtonTitle: 9,
        searchValue: 1,
        showFullGeometry: 37,
        showPlaceType: 10,
        showResultsWhileTyping: 38,
        types: 39,
        zoom: 40,
        maxZoom: 41,
        apiUrl: 42,
        fetchParameters: 43,
        iconsBaseUrl: 11,
        adjustQuery: 44,
        focus: 45,
        blur: 46,
        setQuery: 47
      },
      null,
      [-1, -1, -1]
    );
  }
  get focus() {
    return this.$$.ctx[45];
  }
  get blur() {
    return this.$$.ctx[46];
  }
  get setQuery() {
    return this.$$.ctx[47];
  }
}
const wt = [
  "featuresListed",
  "featuresMarked",
  "optionsVisibilityChange",
  "pick",
  "queryChange",
  "response",
  "reverseToggle",
  "select"
], Kn = [
  "apiKey",
  "bbox",
  "clearButtonTitle",
  "clearOnBlur",
  "collapsed",
  "country",
  "debounceSearch",
  "enableReverse",
  "reverseActive",
  "errorMessage",
  "filter",
  "fuzzyMatch",
  "language",
  "limit",
  "minLength",
  "noResultsMessage",
  "placeholder",
  "proximity",
  "reverseButtonTitle",
  "showFullGeometry",
  "showPlaceType",
  "showResultsWhileTyping",
  "adjustQuery",
  "types",
  "zoom",
  "mapController"
];
function vt(n) {
  return "on" + n[0].toUpperCase() + n.slice(1);
}
const Xn = Yt(function(e, t) {
  const r = st(), l = st(), u = { ...e };
  for (const s of wt)
    delete u[vt(s)];
  Ke(() => {
    if (!r.current)
      throw new Error();
    const s = new Vn({
      target: r.current,
      props: u
    });
    return l.current = s, () => s.$destroy();
  }, []);
  for (const s of Kn)
    Ke(() => {
      l.current && e[s] !== void 0 && l.current.$set({ [s]: e[s] });
    }, [e[s]]);
  for (const s of wt) {
    const f = e[vt(s)];
    Ke(
      () => {
        var h;
        return f && ((h = l.current) == null ? void 0 : h.$on(s, (c) => {
          f(c.detail);
        }));
      },
      [f]
    );
  }
  return xt(t, () => ({
    setQuery: (s, f = !0) => {
      var h;
      return (h = l.current) == null ? void 0 : h.setQuery(s, f);
    },
    focus: () => {
      var s;
      return (s = l.current) == null ? void 0 : s.focus();
    },
    blur: () => {
      var s;
      return (s = l.current) == null ? void 0 : s.blur();
    }
  })), $t("div", { ref: r });
});
export {
  Xn as GeocodingControl
};
//# sourceMappingURL=react.js.map
