"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 _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
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); }
/* __IIFE_WRAPPED__ */
(function () {
  /* GHS — vensteronderdelen in de stijl van de contactfiche, de werkbon en de opmeting.
     Elk venster dat een dossier toont, krijgt dezelfde opbouw:
       GhsVensterKop  — donker vlak met een gloed in de kleur van de stand, links een kleurbalk,
                        avatar of icoon, titel met statuschips, één regel met de kerngegevens,
                        rechts eigen cijfers of knoppen en daarna minimaliseren en sluiten.
       GhsVensterTabs — de onderdelen van het venster, zoals de tabs van de contactfiche.
       GhsStapKop     — de kop boven de inhoud van een tab: icoon in een tegel, titel en stand.
     GHS_VENSTER is de maat van zo'n venster (dezelfde als de werkbon en de opmeting). */

  var GHS_VENSTER = {
    width: '96%',
    maxWidth: 1420,
    height: '94%'
  };

  /* De laag achter een venster of dialoog. Onderaan blijft de ruimte van de dock vrij
     (--ghs-dock), zodat een venster nooit achter de geminimaliseerde vensters verdwijnt. */
  var ghsVensterLaag = function ghsVensterLaag(zIndex, extra) {
    return _objectSpread({
      position: 'fixed',
      inset: 0,
      zIndex: zIndex || 2800,
      background: 'rgba(1,12,8,0.74)',
      backdropFilter: 'blur(5px)',
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      padding: '20px 20px calc(20px + var(--ghs-dock, 0px))',
      boxSizing: 'border-box'
    }, extra || {});
  };

  /* Het kader van een groot venster: zelfde hoek, rand en schaduw als de contactfiche en de werkbon. */
  var ghsVensterKader = function ghsVensterKader(extra) {
    return _objectSpread(_objectSpread({}, GHS_VENSTER), {}, {
      background: T.bg1,
      clipPath: cutPath(18),
      border: "1px solid ".concat(T.stroke1),
      position: 'relative',
      overflow: 'hidden',
      boxShadow: '0 50px 110px -30px rgba(0,0,0,0.8)',
      display: 'flex',
      flexDirection: 'column'
    }, extra || {});
  };

  /* Het kader van een dialoog of keuzevenster (kleiner, zelfde stijl). */
  var ghsDialoogKader = function ghsDialoogKader(breedte, extra) {
    return _objectSpread({
      width: breedte || 580,
      maxWidth: '100%',
      maxHeight: '100%',
      background: T.bg1,
      border: "1px solid ".concat(T.stroke2),
      clipPath: cutPath(14),
      position: 'relative',
      overflow: 'hidden',
      boxShadow: '0 44px 96px -28px rgba(0,0,0,0.85)',
      display: 'flex',
      flexDirection: 'column',
      boxSizing: 'border-box'
    }, extra || {});
  };

  /* Inhoud en voet van een dialoog: de inhoud scrolt, de voet blijft staan; overal 22 px rand. */
  var GHS_DIALOOG_INHOUD = {
    flex: '0 1 auto',
    minHeight: 0,
    overflowY: 'auto',
    padding: '18px 22px'
  };
  var GHS_DIALOOG_VOET = {
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'flex-end',
    gap: 10,
    padding: '14px 22px',
    borderTop: "1px solid ".concat(T.stroke1),
    flexShrink: 0,
    flexWrap: 'wrap'
  };

  /* De voet van een venster: links de stille knoppen, rechts de hoofdactie. */
  var GHS_VENSTER_VOET = {
    flexShrink: 0,
    padding: '12px 26px',
    background: T.bg1,
    borderTop: "1px solid ".concat(T.stroke1),
    display: 'flex',
    gap: 10,
    justifyContent: 'space-between',
    alignItems: 'center',
    flexWrap: 'wrap'
  };
  var GhsVensterChip = function GhsVensterChip(_ref) {
    var label = _ref.label,
      kleur = _ref.kleur,
      icon = _ref.icon,
      title = _ref.title,
      attrs = _ref.attrs;
    var k = kleur || T.accent;
    return /*#__PURE__*/React.createElement("span", _extends({
      title: title
    }, attrs || {}, {
      style: {
        display: 'inline-flex',
        alignItems: 'center',
        gap: 6,
        padding: '3px 9px 3px 8px',
        background: "".concat(k, "1f"),
        border: "1px solid ".concat(k, "66"),
        clipPath: cutPath(5),
        fontFamily: T.fontBody,
        fontSize: 11,
        fontWeight: 700,
        color: k,
        whiteSpace: 'nowrap'
      }
    }), icon ? /*#__PURE__*/React.createElement(Icon, {
      name: icon,
      size: 11,
      color: k
    }) : /*#__PURE__*/React.createElement("span", {
      style: {
        width: 7,
        height: 7,
        background: k,
        boxShadow: "0 0 8px ".concat(k)
      }
    }), label);
  };
  var VK_SLUIT = {
    width: 36,
    height: 36,
    flexShrink: 0,
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
    background: 'rgba(255,90,77,0.10)',
    border: '1px solid rgba(255,90,77,0.38)',
    clipPath: cutPath(7),
    cursor: 'pointer',
    color: '#ff5a4d',
    padding: 0
  };

  /* Eén sluitknop voor elk venster, elke dialoog en elk zijpaneel. */
  var GhsSluitKnop = function GhsSluitKnop(_ref2) {
    var onClick = _ref2.onClick,
      title = _ref2.title,
      attrs = _ref2.attrs;
    return /*#__PURE__*/React.createElement("button", _extends({
      type: "button",
      onClick: onClick,
      title: title || 'Sluiten',
      "aria-label": title || 'Sluiten'
    }, attrs || {}, {
      style: VK_SLUIT
    }), /*#__PURE__*/React.createElement(Icon, {
      name: "x",
      size: 17,
      color: "currentColor"
    }));
  };

  /* Kop van een dialoog of zijpaneel: icoon in een tegel, een klein label, de titel en één regel uitleg;
     rechts eigen knoppen, dan minimaliseren en sluiten. Boven en onder dezelfde ruimte. */
  var GhsDialoogKop = function GhsDialoogKop(_ref3) {
    var icoon = _ref3.icoon,
      kleur = _ref3.kleur,
      label = _ref3.label,
      titel = _ref3.titel,
      sub = _ref3.sub,
      rechts = _ref3.rechts,
      onMinimize = _ref3.onMinimize,
      onClose = _ref3.onClose,
      sluitTitel = _ref3.sluitTitel,
      boven = _ref3.boven,
      attrs = _ref3.attrs;
    var k = kleur || T.accent;
    return /*#__PURE__*/React.createElement("div", _extends({
      "data-ghs-dialoogkop": ""
    }, attrs || {}, {
      style: {
        display: 'flex',
        alignItems: boven ? 'flex-start' : 'center',
        gap: 14,
        padding: '18px 22px',
        borderBottom: "1px solid ".concat(T.stroke1),
        flexShrink: 0
      }
    }), icoon && /*#__PURE__*/React.createElement("span", {
      style: {
        width: 40,
        height: 40,
        flexShrink: 0,
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center',
        background: "".concat(k, "1a"),
        border: "1px solid ".concat(k, "66"),
        clipPath: cutPath(8)
      }
    }, /*#__PURE__*/React.createElement(Icon, {
      name: icoon,
      size: 19,
      color: k
    })), /*#__PURE__*/React.createElement("div", {
      style: {
        flex: 1,
        minWidth: 0
      }
    }, label && /*#__PURE__*/React.createElement("div", {
      style: {
        fontFamily: T.fontBody,
        fontSize: 10,
        fontWeight: 700,
        letterSpacing: '0.14em',
        textTransform: 'uppercase',
        color: icoon ? T.fg3 : k,
        marginBottom: 4,
        lineHeight: 1.2
      }
    }, label), /*#__PURE__*/React.createElement("h3", {
      style: {
        margin: 0,
        fontFamily: T.fontDisplay,
        fontSize: 19,
        fontWeight: 600,
        color: T.fg1,
        lineHeight: 1.2,
        overflowWrap: 'anywhere'
      }
    }, titel), sub && /*#__PURE__*/React.createElement("div", {
      style: {
        fontFamily: T.fontBody,
        fontSize: 12.5,
        color: T.fg3,
        marginTop: 4,
        lineHeight: 1.5,
        textWrap: 'pretty'
      }
    }, sub)), rechts, (onMinimize || onClose) && /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 10,
        flexShrink: 0
      }
    }, onMinimize && window.MinimizeButton && /*#__PURE__*/React.createElement(window.MinimizeButton, {
      onClick: onMinimize
    }), onClose && /*#__PURE__*/React.createElement(GhsSluitKnop, {
      onClick: onClose,
      title: sluitTitel
    })));
  };
  var GhsVensterKop = function GhsVensterKop(_ref4) {
    var kleur = _ref4.kleur,
      avatar = _ref4.avatar,
      icoon = _ref4.icoon,
      titel = _ref4.titel,
      chips = _ref4.chips,
      meta = _ref4.meta,
      rechts = _ref4.rechts,
      onder = _ref4.onder,
      onMinimize = _ref4.onMinimize,
      onClose = _ref4.onClose,
      sluitTitel = _ref4.sluitTitel,
      attrs = _ref4.attrs;
    var k = kleur || T.accent;
    var merk = (window.__resources || {}).iconWhite;
    var regel = (meta || []).filter(function (x) {
      return x != null && x !== false && x !== '';
    });
    var punt = function punt(i) {
      return /*#__PURE__*/React.createElement("span", {
        key: 'p' + i,
        style: {
          color: T.fg4
        }
      }, "\xB7");
    };
    return /*#__PURE__*/React.createElement("div", _extends({
      "data-ghs-vensterkop": ""
    }, attrs || {}, {
      style: {
        position: 'relative',
        flexShrink: 0,
        overflow: 'hidden',
        isolation: 'isolate',
        padding: '18px 26px 18px 30px',
        background: "radial-gradient(90% 160% at 0% 0%, ".concat(k, "33 0%, ").concat(k, "0d 38%, transparent 62%), linear-gradient(100deg, rgba(0,0,0,0.12) 0%, rgba(0,0,0,0.38) 60%, rgba(0,0,0,0.50) 100%), ").concat(T.bg0),
        borderBottom: "1px solid ".concat(k, "3d")
      }
    }), /*#__PURE__*/React.createElement("span", {
      style: {
        position: 'absolute',
        left: 0,
        top: 0,
        bottom: 0,
        width: 4,
        background: k,
        boxShadow: "0 0 18px ".concat(k),
        pointerEvents: 'none'
      }
    }), /*#__PURE__*/React.createElement("span", {
      style: {
        position: 'absolute',
        left: 0,
        right: 0,
        bottom: -1,
        height: 1,
        background: "linear-gradient(90deg, ".concat(k, " 0%, ").concat(k, "66 22%, transparent 60%)"),
        pointerEvents: 'none',
        zIndex: -1
      }
    }), merk && /*#__PURE__*/React.createElement("img", {
      src: merk,
      alt: "",
      "aria-hidden": "true",
      style: {
        position: 'absolute',
        right: 150,
        top: '50%',
        height: 190,
        transform: 'translateY(-50%) rotate(-8deg)',
        opacity: 0.045,
        pointerEvents: 'none',
        userSelect: 'none',
        zIndex: -1
      }
    }), /*#__PURE__*/React.createElement("span", {
      style: {
        position: 'absolute',
        right: 0,
        top: 0,
        bottom: 0,
        width: 260,
        background: "repeating-linear-gradient(115deg, transparent 0 22px, ".concat(k, "0a 22px 23px)"),
        maskImage: 'linear-gradient(90deg, transparent, #000 70%)',
        WebkitMaskImage: 'linear-gradient(90deg, transparent, #000 70%)',
        pointerEvents: 'none',
        zIndex: -1
      }
    }), /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 16,
        flexWrap: 'wrap',
        rowGap: 12
      }
    }, avatar ? /*#__PURE__*/React.createElement("span", {
      "data-ghs-kop-beeld": "",
      style: {
        position: 'relative',
        display: 'flex',
        borderRadius: '50%',
        boxShadow: "0 0 0 2px ".concat(k, "55, 0 0 22px ").concat(k, "33"),
        flexShrink: 0
      }
    }, /*#__PURE__*/React.createElement(Avatar, {
      name: avatar,
      size: 52
    })) : icoon ? /*#__PURE__*/React.createElement("span", {
      "data-ghs-kop-beeld": "",
      style: {
        width: 52,
        height: 52,
        flexShrink: 0,
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center',
        background: "".concat(k, "1a"),
        border: "1px solid ".concat(k, "66"),
        clipPath: cutPath(10),
        boxShadow: "0 0 22px ".concat(k, "22")
      }
    }, /*#__PURE__*/React.createElement(Icon, {
      name: icoon,
      size: 22,
      color: k
    })) : null, /*#__PURE__*/React.createElement("div", {
      "data-ghs-kop-titel": "",
      style: {
        flex: '1 1 380px',
        minWidth: 0
      }
    }, /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 10,
        flexWrap: 'wrap'
      }
    }, /*#__PURE__*/React.createElement("h2", {
      style: {
        margin: 0,
        fontFamily: T.fontDisplay,
        fontSize: 23,
        fontWeight: 600,
        color: T.fg1,
        lineHeight: 1.15,
        minWidth: 0,
        overflowWrap: 'anywhere'
      }
    }, titel), (chips || []).filter(Boolean).map(function (c, i) {
      return React.isValidElement(c) ? /*#__PURE__*/React.createElement(React.Fragment, {
        key: i
      }, c) : /*#__PURE__*/React.createElement(GhsVensterChip, {
        key: i,
        label: c.label,
        kleur: c.kleur,
        icon: c.icon,
        title: c.title,
        attrs: c.attrs
      });
    })), regel.length > 0 && /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 8,
        marginTop: 5,
        fontFamily: T.fontBody,
        fontSize: 12.5,
        color: T.fg3,
        flexWrap: 'wrap',
        rowGap: 3
      }
    }, regel.reduce(function (acc, x, i) {
      return i ? acc.concat([punt(i), /*#__PURE__*/React.createElement(React.Fragment, {
        key: 'm' + i
      }, x)]) : [/*#__PURE__*/React.createElement(React.Fragment, {
        key: "m0"
      }, x)];
    }, []))), (rechts || onMinimize || onClose) && /*#__PURE__*/React.createElement("div", {
      "data-ghs-kop-rechts": "",
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 18,
        flexShrink: 0,
        marginLeft: 'auto'
      }
    }, rechts, (onMinimize || onClose) && /*#__PURE__*/React.createElement("div", {
      "data-ghs-kop-knoppen": "",
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 12,
        paddingLeft: rechts ? 16 : 0,
        borderLeft: rechts ? "1px solid ".concat(T.stroke1) : 'none'
      }
    }, onMinimize && window.MinimizeButton && /*#__PURE__*/React.createElement(window.MinimizeButton, {
      onClick: onMinimize
    }), onClose && /*#__PURE__*/React.createElement(GhsSluitKnop, {
      onClick: onClose,
      title: sluitTitel
    })))), onder && /*#__PURE__*/React.createElement("div", {
      "data-ghs-vensterkop-onder": "",
      style: {
        marginTop: 14,
        paddingLeft: avatar || icoon ? 68 : 0
      }
    }, onder));
  };

  /* tabs: [{ id, label, icon, telling, stip:{ kleur, tip }, badge:{ n, kleur, title }, sub, title, attrs }] */
  var GhsVensterTabs = function GhsVensterTabs(_ref5) {
    var tabs = _ref5.tabs,
      actief = _ref5.actief,
      onKies = _ref5.onKies,
      label = _ref5.label,
      attrs = _ref5.attrs;
    return /*#__PURE__*/React.createElement("div", _extends({
      "data-ghs-venstertabs": "",
      role: "tablist",
      "aria-label": label
    }, attrs || {}, {
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 0,
        padding: '0 12px',
        borderBottom: "1px solid ".concat(T.stroke1),
        flexShrink: 0,
        overflowX: 'auto',
        overflowY: 'hidden'
      }
    }), (tabs || []).map(function (t) {
      var on = actief === t.id;
      return /*#__PURE__*/React.createElement("button", _extends({
        key: t.id,
        type: "button",
        role: "tab",
        "aria-selected": on,
        title: t.title || t.stip && t.stip.tip || undefined
      }, t.attrs || {}, {
        onClick: function onClick() {
          return onKies(t.id);
        },
        style: {
          position: 'relative',
          display: 'flex',
          alignItems: 'center',
          gap: 7,
          padding: t.sub ? '10px 14px' : '13px 14px',
          background: 'none',
          border: 'none',
          cursor: 'pointer',
          flexShrink: 0,
          textAlign: 'left',
          color: on ? T.fg1 : T.fg3,
          fontFamily: T.fontBody,
          fontSize: 13,
          fontWeight: on ? 600 : 500,
          whiteSpace: 'nowrap'
        }
      }), t.icon && /*#__PURE__*/React.createElement(Icon, {
        name: t.icon,
        size: 15,
        color: on ? T.accent : 'currentColor'
      }), t.sub ? /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", {
        style: {
          display: 'block'
        }
      }, t.label), /*#__PURE__*/React.createElement("span", {
        style: {
          display: 'block',
          fontSize: 10.5,
          fontWeight: 500,
          color: T.fg4,
          marginTop: 1
        }
      }, t.sub)) : t.label, t.telling != null && /*#__PURE__*/React.createElement("span", {
        style: {
          color: T.fg4,
          fontWeight: 500
        }
      }, t.telling), t.stip && /*#__PURE__*/React.createElement("span", {
        style: {
          width: 6,
          height: 6,
          borderRadius: '50%',
          background: t.stip.kleur,
          boxShadow: "0 0 6px ".concat(t.stip.kleur)
        }
      }), t.badge && t.badge.n > 0 && /*#__PURE__*/React.createElement("span", {
        title: t.badge.title,
        style: {
          minWidth: 18,
          padding: '1px 6px',
          borderRadius: 9,
          background: t.badge.kleur || '#ffb020',
          color: '#0b0d0b',
          fontSize: 10,
          fontWeight: 800,
          textAlign: 'center',
          boxSizing: 'border-box'
        }
      }, t.badge.n), on && /*#__PURE__*/React.createElement("span", {
        style: {
          position: 'absolute',
          left: 10,
          right: 10,
          bottom: -1,
          height: 2,
          background: T.accent,
          borderRadius: 2,
          boxShadow: '0 0 8px rgba(0,217,0,0.5)'
        }
      }));
    }));
  };
  var GhsStapKop = function GhsStapKop(_ref6) {
    var icon = _ref6.icon,
      titel = _ref6.titel,
      sub = _ref6.sub,
      kleur = _ref6.kleur,
      rechts = _ref6.rechts;
    var k = kleur || T.accent;
    return /*#__PURE__*/React.createElement("div", {
      "data-ghs-stapkop": "",
      style: {
        paddingLeft: 12,
        position: 'relative'
      }
    }, /*#__PURE__*/React.createElement("span", {
      style: {
        position: 'absolute',
        left: 0,
        top: 2,
        bottom: 2,
        width: 3,
        background: k,
        boxShadow: "0 0 12px ".concat(k, "66")
      }
    }), /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 12
      }
    }, /*#__PURE__*/React.createElement("div", {
      style: {
        width: 38,
        height: 38,
        clipPath: cutPath(8),
        background: "".concat(k, "1a"),
        border: "1px solid ".concat(k, "8c"),
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center',
        flexShrink: 0
      }
    }, /*#__PURE__*/React.createElement(Icon, {
      name: icon,
      size: 18,
      color: k
    })), /*#__PURE__*/React.createElement("div", {
      style: {
        flex: 1,
        minWidth: 0
      }
    }, /*#__PURE__*/React.createElement("h3", {
      style: {
        margin: 0,
        fontFamily: T.fontDisplay,
        fontSize: 18,
        fontWeight: 600,
        color: T.fg1
      }
    }, titel), sub && /*#__PURE__*/React.createElement("div", {
      style: {
        fontFamily: T.fontBody,
        fontSize: 12,
        color: T.fg3,
        marginTop: 2,
        lineHeight: 1.45
      }
    }, sub)), rechts));
  };
  Object.assign(window, {
    GHS_VENSTER: GHS_VENSTER,
    GHS_VENSTER_VOET: GHS_VENSTER_VOET,
    GHS_DIALOOG_INHOUD: GHS_DIALOOG_INHOUD,
    GHS_DIALOOG_VOET: GHS_DIALOOG_VOET,
    ghsVensterLaag: ghsVensterLaag,
    ghsVensterKader: ghsVensterKader,
    ghsDialoogKader: ghsDialoogKader,
    GhsSluitKnop: GhsSluitKnop,
    GhsDialoogKop: GhsDialoogKop,
    GhsVensterKop: GhsVensterKop,
    GhsVensterChip: GhsVensterChip,
    GhsVensterTabs: GhsVensterTabs,
    GhsStapKop: GhsStapKop
  });
})();