"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
// GHS CRM — Beste voorstel bij het inplannen + de dagroute van een technieker.
// GhsBesteVoorstel: in de planner van een plaatsing en in de planmodus van een interventie.
// Toont per voorstel: datum, tijdslot, technieker, extra rijtijd, bezetting en waarschuwingen.
// Klik = het tijdvak en de technieker worden overgenomen; de dagroute van dat voorstel staat
// eronder. Adressen zonder coördinaten worden op de achtergrond opgezocht.
(function () {
  var W = window;
  var NL = function NL(iso) {
    var d = new Date(iso + 'T12:00:00');
    return "".concat(['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'][d.getDay()], " ").concat(d.getDate(), " ").concat(['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'][d.getMonth()]);
  };
  var vandaag = function vandaag() {
    return W.GHS_TODAY || new Date().toISOString().slice(0, 10);
  };
  var plus = function plus(iso, n) {
    var d = new Date(iso + 'T12:00:00');
    d.setDate(d.getDate() + n);
    return d.toISOString().slice(0, 10);
  };
  var LBL = {
    fontFamily: T.fontBody,
    fontSize: 10,
    fontWeight: 700,
    letterSpacing: '0.12em',
    textTransform: 'uppercase',
    color: T.fg3
  };

  /* De route van één dag: vertrek → jobs → terug, met de rijtijd tussen elk stuk. */
  var GhsDagRoute = function GhsDagRoute(_ref) {
    var techId = _ref.techId,
      jobs = _ref.jobs,
      route = _ref.route,
      nieuwId = _ref.nieuwId;
    var r = route || W.rdRoute(techId, jobs);
    var stop = function stop(label, sub, nieuw) {
      return /*#__PURE__*/React.createElement("span", {
        style: {
          display: 'inline-flex',
          alignItems: 'center',
          gap: 7,
          padding: '5px 9px',
          background: nieuw ? 'rgba(0,217,0,0.12)' : T.bg2,
          border: "1px solid ".concat(nieuw ? T.strokeAccent : T.stroke1),
          clipPath: cutPath(5),
          fontFamily: T.fontBody,
          fontSize: 11.5,
          color: T.fg1,
          whiteSpace: 'nowrap'
        }
      }, /*#__PURE__*/React.createElement("b", {
        style: {
          fontWeight: nieuw ? 800 : 600
        }
      }, label), sub && /*#__PURE__*/React.createElement("span", {
        style: {
          color: T.fg3
        }
      }, sub));
    };
    var rit = function rit(s) {
      return /*#__PURE__*/React.createElement("span", {
        title: "Rijtijd: ".concat((W.RD_BRON_LABEL || {})[s.bron] || s.bron),
        style: {
          display: 'inline-flex',
          alignItems: 'center',
          gap: 4,
          fontFamily: T.fontBody,
          fontSize: 11,
          fontWeight: 700,
          color: s.min == null ? T.fg4 : s.min > W.rdDrm('plan_max_rijtijd') ? '#ff5a4d' : T.fg3,
          whiteSpace: 'nowrap'
        }
      }, /*#__PURE__*/React.createElement(Icon, {
        name: "arrowright",
        size: 11,
        color: "currentColor"
      }), s.min == null ? '?' : "".concat(s.min, " min").concat(s.bron === 'schatting' || s.bron === 'postcode' ? '*' : ''));
    };
    return /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        flexDirection: 'column',
        gap: 8
      }
    }, /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 8,
        flexWrap: 'wrap'
      }
    }, stop(r.vertrek.thuis ? 'Thuis' : 'Bedrijf', null), jobs.map(function (j, i) {
      return /*#__PURE__*/React.createElement(React.Fragment, {
        key: j.id
      }, rit(r.stukken[i]), stop("".concat(j.start, "\u2013").concat(j.end), j.stad || j.label, j.id === nieuwId || j.nieuw));
    }), rit(r.stukken[r.stukken.length - 1]), stop(r.vertrek.thuis ? 'Thuis' : 'Bedrijf', null)), /*#__PURE__*/React.createElement("span", {
      style: {
        fontFamily: T.fontBody,
        fontSize: 11.5,
        color: T.fg3
      }
    }, "".concat(r.rijMin, " min rijden \xB7 ").concat(r.km, " km").concat(r.geschat ? ' · * = schatting, echte rijtijd wordt opgehaald' : '').concat(r.onbekend ? " \xB7 ".concat(r.onbekend, " ").concat(r.onbekend === 1 ? 'adres' : 'adressen', " nog niet gelokaliseerd") : '')));
  };

  /* ── Beste voorstel ──
     props: contacts, cid (klant), duurMin of dagen [minuten per dag], opeenvolgend, techIds
     (kandidaten), zonder (slotId bij verplaatsen), van/tot (venster), gekozen {date,start,crew},
     onKies({date,start,end,crew,slot,momenten}). ingebed = zonder eigen kader en kop (de
     planbalk heeft er al een) · tech/onTech = de techniekerfilter van buitenaf · zonderRoute =
     geen dagroute onder de lijst (de planbalk toont de kaart ernaast). */
  var GhsBesteVoorstel = function GhsBesteVoorstel(_ref2) {
    var contacts = _ref2.contacts,
      cid = _ref2.cid,
      duurMin = _ref2.duurMin,
      dagen = _ref2.dagen,
      _ref2$opeenvolgend = _ref2.opeenvolgend,
      opeenvolgend = _ref2$opeenvolgend === void 0 ? true : _ref2$opeenvolgend,
      ploegPerDag = _ref2.ploegPerDag,
      techIds = _ref2.techIds,
      zonder = _ref2.zonder,
      van = _ref2.van,
      tot = _ref2.tot,
      gekozen = _ref2.gekozen,
      onKies = _ref2.onKies,
      compact = _ref2.compact,
      aantal = _ref2.aantal,
      ingebed = _ref2.ingebed,
      techC = _ref2.tech,
      onTech = _ref2.onTech,
      zonderRoute = _ref2.zonderRoute;
    var tik = W.useRdInst();
    var c = (contacts || []).find(function (x) {
      return x.id === cid;
    }) || null;
    var adres = W.rdAdres(c),
      punt = W.rdPuntVan ? W.rdPuntVan(c) : W.rdGeo(adres),
      grof = !!(punt && punt.grof);
    var _React$useState = React.useState(true),
      _React$useState2 = _slicedToArray(_React$useState, 2),
      open = _React$useState2[0],
      setOpen = _React$useState2[1];
    var _React$useState3 = React.useState(aantal || 5),
      _React$useState4 = _slicedToArray(_React$useState3, 2),
      toon = _React$useState4[0],
      setToon = _React$useState4[1];
    var _React$useState5 = React.useState(false),
      _React$useState6 = _slicedToArray(_React$useState5, 2),
      bezigAdres = _React$useState6[0],
      setBezigAdres = _React$useState6[1];
    var _React$useState7 = React.useState(false),
      _React$useState8 = _slicedToArray(_React$useState7, 2),
      bezigRij = _React$useState8[0],
      setBezigRij = _React$useState8[1];
    var _React$useState9 = React.useState(null),
      _React$useState0 = _slicedToArray(_React$useState9, 2),
      techL = _React$useState0[0],
      setTechL = _React$useState0[1];
    var tech0 = onTech ? techC || null : techL,
      setTech = onTech || setTechL;
    var tech = tech0 && (!techIds || !techIds.length || techIds.includes(tech0)) ? tech0 : null;
    var P = {
      van: van || plus(vandaag(), 1),
      tot: tot || plus(vandaag(), W.rdDrm('plan_horizon_dagen'))
    };
    var reeks = (dagen || []).length > 1,
      duur0 = dagen && dagen.length ? dagen[0] : duurMin;
    var kandidaten = (techIds && techIds.length ? techIds : (W.PLANNING_CREW || []).map(function (w) {
      return w.id;
    })).filter(function (id) {
      return !tech || tech === id;
    });
    var lijst = React.useMemo(function () {
      if (!duur0) return [];
      if (reeks && W.rdVoorstelReeks) return W.rdVoorstelReeks(contacts, {
        punt: punt,
        dagen: dagen,
        opeenvolgend: opeenvolgend,
        ploegPerDag: ploegPerDag,
        van: P.van,
        tot: P.tot,
        techIds: kandidaten,
        zonder: zonder
      });
      return W.rdVoorstel(contacts, {
        punt: punt,
        duurMin: duur0,
        van: P.van,
        tot: P.tot,
        techIds: kandidaten,
        zonder: zonder
      });
    }, [contacts, punt, duur0, (dagen || []).join(','), (ploegPerDag || []).join(','), opeenvolgend, P.van, P.tot, kandidaten.join(','), zonder, W.rdInst().bron, tik]);
    /* Adres van de klant (en de vertrekpunten) opzoeken als dat nog niet gebeurde; daarna de echte rijtijden. */
    React.useEffect(function () {
      if (!c) return;
      var todo = [adres].concat(_toConsumableArray(kandidaten.map(function (id) {
        return W.rdVertrek(id).adres;
      }))).filter(function (a) {
        return a && !W.rdGeo(a);
      });
      if (!todo.length) return;
      setBezigAdres(true);
      Promise.all(todo.map(function (a) {
        return W.rdZoekAdres(a);
      })).then(function () {
        return setBezigAdres(false);
      });
    }, [adres, kandidaten.join(',')]);
    React.useEffect(function () {
      if (!punt || punt.grof || !lijst.length) return;
      var punten = [punt].concat(_toConsumableArray(lijst.slice(0, 12).flatMap(function (v) {
        return [v.route.vertrek.punt].concat(_toConsumableArray(W.rdJobsVan(contacts, v.techId, v.datum, zonder).map(function (j) {
          return j.punt;
        })));
      }))).filter(Boolean);
      setBezigRij(true);
      W.rdHaalRij(punten).then(function () {
        return setBezigRij(false);
      });
    }, [punt, lijst.length && lijst[0].datum, lijst.length && lijst[0].techId, tik]);
    var kies = function kies(v) {
      return onKies && onKies({
        date: v.datum,
        start: v.start,
        end: v.end,
        crew: [v.techId],
        slot: v.slot,
        momenten: (v.dagenLijst || [v]).map(function (x) {
          return {
            date: x.datum,
            start: x.start,
            end: x.end,
            slot: x.slot,
            techId: x.techId
          };
        })
      });
    };
    var isGekozen = function isGekozen(v) {
      return !!gekozen && gekozen.date === v.datum && gekozen.start === v.start && (gekozen.crew || []).includes(v.techId);
    };
    var sel = lijst.find(isGekozen) || null;
    var bron = W.rdInst().bron;
    if (!c) return null;
    var status = !adres ? 'Geen adres bij de klant — geen rijtijden.' : bezigAdres ? 'Adres opzoeken…' : !punt ? 'Adres niet gevonden op de kaart — voorstellen zonder rijtijd.' : "".concat(lijst.length, " mogelijkheden tot ").concat(NL(P.tot), " \xB7 ").concat(grof ? 'adres nog niet op de kaart: nabijheid op postcode' : "rijtijden via ".concat(bron === 'tomtom' ? 'TomTom' : bron === 'osrm' ? 'OpenStreetMap' : 'schatting')).concat(bezigRij ? ' · bijwerken…' : '');
    var kort = function kort(iso) {
      return NL(iso).split(' ').slice(0, 2).join(' ');
    };
    var maxRij = W.rdDrm('plan_max_rijtijd');
    var inhoud = /*#__PURE__*/React.createElement(React.Fragment, null, (techIds || []).length !== 1 && (W.PLANNING_CREW || []).length > 1 && /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 6,
        flexWrap: 'wrap'
      }
    }, /*#__PURE__*/React.createElement("span", {
      style: LBL
    }, "Technieker"), [null].concat(_toConsumableArray(techIds && techIds.length ? techIds : (W.PLANNING_CREW || []).map(function (w) {
      return w.id;
    }))).map(function (id) {
      var on = tech === id,
        w = id ? W.ghsCrewLid && W.ghsCrewLid(id) : null;
      return /*#__PURE__*/React.createElement("button", {
        key: id || 'alle',
        type: "button",
        "aria-pressed": on,
        onClick: function onClick() {
          return setTech(id);
        },
        style: {
          minHeight: 32,
          padding: '0 11px',
          background: on ? 'rgba(0,217,0,0.12)' : T.bg2,
          border: "1px solid ".concat(on ? T.strokeAccent : T.stroke1),
          clipPath: cutPath(4),
          cursor: 'pointer',
          fontFamily: T.fontBody,
          fontSize: 12,
          fontWeight: 700,
          color: on ? T.accent : T.fg2
        }
      }, id ? w ? w.name.split(' ')[0] : id : 'Iedereen');
    })), !lijst.length && /*#__PURE__*/React.createElement("div", {
      style: {
        fontFamily: T.fontBody,
        fontSize: 12.5,
        color: T.fg3,
        lineHeight: 1.5
      }
    }, reeks ? 'Geen reeks van werkdagen binnen het venster. Vergroot het venster, kort de werkdagen in of kies handmatig in de agenda.' : 'Geen vrij tijdslot binnen het venster. Vergroot het venster of kies handmatig in de agenda.'), lijst.slice(0, toon).map(function (v, i) {
      var on = isGekozen(v),
        warn = v.waarschuwingen.length > 0,
        d = v.dagenLijst || null,
        nD = d ? d.length : 1;
      var extraOk = v.extraRij != null && v.extraRij <= maxRij * nD;
      return /*#__PURE__*/React.createElement("button", {
        key: "".concat(v.datum, "|").concat(v.tot || '', "|").concat(v.techId, "|").concat(v.slot),
        type: "button",
        "aria-pressed": on,
        onClick: function onClick() {
          return kies(v);
        },
        title: v.waarschuwingen.join('\n'),
        style: {
          display: 'grid',
          gridTemplateColumns: compact ? 'auto minmax(0,1fr) auto' : 'auto minmax(0,1fr) auto auto',
          alignItems: 'center',
          gap: 12,
          width: '100%',
          padding: '11px 12px',
          textAlign: 'left',
          background: on ? 'rgba(0,217,0,0.10)' : T.bg2,
          border: "1px solid ".concat(on ? T.strokeAccent : warn ? 'rgba(255,176,32,0.45)' : T.stroke1),
          boxShadow: on ? "inset 3px 0 0 ".concat(T.accent) : 'none',
          clipPath: cutPath(6),
          cursor: 'pointer'
        }
      }, /*#__PURE__*/React.createElement("span", {
        style: {
          width: 26,
          height: 26,
          display: 'inline-flex',
          alignItems: 'center',
          justifyContent: 'center',
          background: on ? T.accent : i === 0 ? 'rgba(0,217,0,0.18)' : T.bg0,
          border: "1px solid ".concat(on ? T.accent : T.stroke1),
          borderRadius: '50%',
          fontFamily: T.fontDisplay,
          fontSize: 12,
          fontWeight: 600,
          color: i === 0 ? T.accent : T.fg2
        }
      }, on ? /*#__PURE__*/React.createElement(Icon, {
        name: "check",
        size: 13,
        color: "#012010"
      }) : i + 1), /*#__PURE__*/React.createElement("span", {
        style: {
          minWidth: 0
        }
      }, /*#__PURE__*/React.createElement("span", {
        style: {
          display: 'flex',
          alignItems: 'baseline',
          gap: '2px 8px',
          flexWrap: 'wrap'
        }
      }, /*#__PURE__*/React.createElement("span", {
        style: {
          fontFamily: T.fontDisplay,
          fontSize: 14.5,
          fontWeight: 600,
          color: T.fg1
        }
      }, d ? "".concat(kort(v.datum), " \u2013 ").concat(NL(v.tot)) : NL(v.datum)), /*#__PURE__*/React.createElement("span", {
        style: {
          fontFamily: T.fontBody,
          fontSize: 12.5,
          fontWeight: 700,
          color: T.fg2
        }
      }, d ? "".concat(nD, " werkdagen") : v.slotLabel), !d && /*#__PURE__*/React.createElement("span", {
        style: {
          fontFamily: T.fontBody,
          fontSize: 12,
          color: T.fg3
        }
      }, "".concat(v.start, "\u2013").concat(v.end)), /*#__PURE__*/React.createElement("span", {
        style: {
          fontFamily: T.fontBody,
          fontSize: 12.5,
          color: T.fg2
        }
      }, "\xB7 ".concat(d ? _toConsumableArray(new Set(d.map(function (x) {
        return x.tech.name.split(' ')[0];
      }))).join(' / ') : v.tech.name.split(' ')[0])), d && !v.aansluitend && /*#__PURE__*/React.createElement("span", {
        style: {
          fontFamily: T.fontBody,
          fontSize: 11.5,
          fontWeight: 800,
          color: '#ffb020'
        }
      }, "niet aaneen"), warn && /*#__PURE__*/React.createElement("span", {
        style: {
          display: 'inline-flex',
          alignItems: 'center',
          gap: 4,
          fontFamily: T.fontBody,
          fontSize: 11.5,
          fontWeight: 800,
          color: '#ffb020'
        }
      }, /*#__PURE__*/React.createElement(Icon, {
        name: "alert",
        size: 12,
        color: "currentColor"
      }), v.waarschuwingen.length === 1 ? v.waarschuwingen[0] : "".concat(v.waarschuwingen.length, " waarschuwingen"))), /*#__PURE__*/React.createElement("span", {
        style: {
          display: 'block',
          fontFamily: T.fontBody,
          fontSize: 12,
          color: T.fg3,
          marginTop: 3,
          lineHeight: 1.45
        }
      }, d ? d.map(function (x) {
        return "".concat(kort(x.datum), " ").concat(x.start, "\u2013").concat(x.end);
      }).join(' · ') : "".concat(v.jobs ? "".concat(v.jobs, " ").concat(v.jobs === 1 ? 'andere job' : 'andere jobs') : 'geen andere jobs', " \xB7 dagroute ").concat(v.dagRij, " min \xB7 dag ").concat(v.bezetting, "% vol").concat(v.zelfOk ? '' : ' · niet voor zelfplanning'))), /*#__PURE__*/React.createElement("span", {
        style: {
          textAlign: 'right'
        }
      }, /*#__PURE__*/React.createElement("span", {
        style: {
          display: 'block',
          fontFamily: T.fontDisplay,
          fontSize: 16,
          fontWeight: 600,
          color: v.extraRij == null ? T.fg4 : extraOk ? T.accent : '#ffb020',
          whiteSpace: 'nowrap'
        }
      }, v.extraRij == null ? '—' : "+".concat(v.extraRij, " min")), /*#__PURE__*/React.createElement("span", {
        style: {
          display: 'block',
          fontFamily: T.fontBody,
          fontSize: 10.5,
          color: T.fg3
        }
      }, d ? 'extra rijtijd, samen' : 'extra rijtijd')), !compact && /*#__PURE__*/React.createElement("span", {
        style: {
          fontFamily: T.fontBody,
          fontSize: 12,
          fontWeight: 700,
          color: on ? T.accent : T.fg3,
          whiteSpace: 'nowrap'
        }
      }, on ? 'Gekozen' : 'Kies'));
    }), lijst.length > toon && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
      variant: "ghost",
      size: "sm",
      icon: "chevrondown",
      onClick: function onClick() {
        return setToon(function (t) {
          return t + (aantal || 5);
        });
      }
    }, "Meer voorstellen (".concat(lijst.length - toon, ")"))), sel && !zonderRoute && /*#__PURE__*/React.createElement("div", {
      style: {
        paddingTop: 10,
        borderTop: "1px solid ".concat(T.stroke1)
      }
    }, /*#__PURE__*/React.createElement("span", {
      style: _objectSpread(_objectSpread({}, LBL), {}, {
        display: 'block',
        marginBottom: 8
      })
    }, "Dagroute ".concat(sel.tech.name.split(' ')[0], " \xB7 ").concat(NL(sel.datum))), /*#__PURE__*/React.createElement(GhsDagRoute, {
      techId: sel.techId,
      jobs: [].concat(_toConsumableArray(W.rdJobsVan(contacts, sel.techId, sel.datum, zonder)), [{
        id: 'nieuw',
        start: sel.start,
        end: sel.end,
        punt: punt,
        stad: c.city || '',
        nieuw: true
      }]).sort(function (a, b) {
        return W.rdMin(a.start) - W.rdMin(b.start);
      }),
      route: sel.route,
      nieuwId: "nieuw"
    })));
    if (ingebed) return /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        flexDirection: 'column',
        gap: 9,
        minWidth: 0
      }
    }, /*#__PURE__*/React.createElement("span", {
      style: {
        fontFamily: T.fontBody,
        fontSize: 12,
        color: T.fg3
      }
    }, status), inhoud);
    return /*#__PURE__*/React.createElement("div", {
      style: {
        background: T.bg1,
        border: "1px solid ".concat(T.stroke1),
        clipPath: cutPath(8)
      }
    }, /*#__PURE__*/React.createElement("button", {
      type: "button",
      "aria-expanded": open,
      onClick: function onClick() {
        return setOpen(function (o) {
          return !o;
        });
      },
      style: {
        width: '100%',
        display: 'flex',
        alignItems: 'center',
        gap: 10,
        padding: '11px 14px',
        background: 'none',
        border: 'none',
        cursor: 'pointer',
        textAlign: 'left'
      }
    }, /*#__PURE__*/React.createElement("span", {
      style: {
        width: 28,
        height: 28,
        flexShrink: 0,
        display: 'inline-flex',
        alignItems: 'center',
        justifyContent: 'center',
        background: 'rgba(0,217,0,0.12)',
        clipPath: cutPath(5)
      }
    }, /*#__PURE__*/React.createElement(Icon, {
      name: "zap",
      size: 14,
      color: T.accent
    })), /*#__PURE__*/React.createElement("span", {
      style: {
        flex: 1,
        minWidth: 0
      }
    }, /*#__PURE__*/React.createElement("span", {
      style: {
        display: 'block',
        fontFamily: T.fontBody,
        fontSize: 13.5,
        fontWeight: 700,
        color: T.fg1
      }
    }, "Beste voorstel \u2014 minste rijtijd"), /*#__PURE__*/React.createElement("span", {
      style: {
        display: 'block',
        fontFamily: T.fontBody,
        fontSize: 11.5,
        color: T.fg3,
        marginTop: 2
      }
    }, status)), /*#__PURE__*/React.createElement(Icon, {
      name: open ? 'chevronup' : 'chevrondown',
      size: 14,
      color: T.fg3
    })), open && /*#__PURE__*/React.createElement("div", {
      style: {
        padding: '0 14px 14px',
        display: 'flex',
        flexDirection: 'column',
        gap: 10
      }
    }, inhoud));
  };
  Object.assign(W, {
    GhsBesteVoorstel: GhsBesteVoorstel,
    GhsDagRoute: GhsDagRoute
  });
})();