"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 _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 _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; }
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 _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 _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 _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; }
// GHS CRM — Statistieken

var MONTHS_NL = ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'];
var REV_DATA = [42800, 51200, 38600, 67300, 72100, 58900, 81200, 76500, 69800, 88400, 94200, 102600];
var DEALS_DATA = [4, 6, 3, 8, 9, 7, 11, 10, 8, 12, 13, 14];
var KWP_DATA = [28, 36, 22, 52, 67, 55, 82, 79, 68, 98, 112, 124];
var SVGChart = function SVGChart(_ref) {
  var data = _ref.data,
    labels = _ref.labels,
    _ref$color = _ref.color,
    color = _ref$color === void 0 ? '#00D900' : _ref$color,
    _ref$height = _ref.height,
    height = _ref$height === void 0 ? 140 : _ref$height,
    _ref$fill = _ref.fill,
    fill = _ref$fill === void 0 ? true : _ref$fill,
    _ref$formatY = _ref.formatY,
    formatY = _ref$formatY === void 0 ? function (v) {
      return v;
    } : _ref$formatY;
  var max = Math.max.apply(Math, _toConsumableArray(data)) * 1.1;
  var min = 0;
  var range = max - min;
  var W = 560,
    H = height;
  var pad = {
    l: 50,
    r: 10,
    t: 10,
    b: 28
  };
  var cw = W - pad.l - pad.r;
  var ch = H - pad.t - pad.b;
  var pts = data.map(function (v, i) {
    return [pad.l + i / (data.length - 1) * cw, pad.t + ch - (v - min) / range * ch];
  });
  var linePath = pts.map(function (p, i) {
    return i === 0 ? "M".concat(p[0].toFixed(1), ",").concat(p[1].toFixed(1)) : "L".concat(p[0].toFixed(1), ",").concat(p[1].toFixed(1));
  }).join(' ');
  var areaPath = "".concat(linePath, " L").concat(pts[pts.length - 1][0].toFixed(1), ",").concat((pad.t + ch).toFixed(1), " L").concat(pts[0][0].toFixed(1), ",").concat((pad.t + ch).toFixed(1), " Z");
  return /*#__PURE__*/React.createElement("svg", {
    width: "100%",
    viewBox: "0 0 ".concat(W, " ").concat(H),
    style: {
      overflow: 'visible'
    }
  }, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
    id: "cg".concat(color.replace('#', '')),
    x1: "0",
    y1: "0",
    x2: "0",
    y2: "1"
  }, /*#__PURE__*/React.createElement("stop", {
    offset: "0%",
    stopColor: color,
    stopOpacity: "0.25"
  }), /*#__PURE__*/React.createElement("stop", {
    offset: "100%",
    stopColor: color,
    stopOpacity: "0"
  }))), [0, 0.25, 0.5, 0.75, 1].map(function (pct) {
    var y = pad.t + ch * (1 - pct);
    var val = min + range / 1.1 * pct;
    return /*#__PURE__*/React.createElement("g", {
      key: pct
    }, /*#__PURE__*/React.createElement("line", {
      x1: pad.l,
      y1: y.toFixed(1),
      x2: W - pad.r,
      y2: y.toFixed(1),
      stroke: "rgba(246,247,235,0.06)",
      strokeWidth: "1"
    }), /*#__PURE__*/React.createElement("text", {
      x: pad.l - 6,
      y: y + 4,
      textAnchor: "end",
      fontSize: "9",
      fill: "rgba(246,247,235,0.35)",
      fontFamily: "Manrope,sans-serif"
    }, formatY(Math.round(val))));
  }), pts.map(function (p, i) {
    return /*#__PURE__*/React.createElement("text", {
      key: i,
      x: p[0].toFixed(1),
      y: H - 4,
      textAnchor: "middle",
      fontSize: "9",
      fill: "rgba(246,247,235,0.35)",
      fontFamily: "Manrope,sans-serif",
      fontWeight: "600",
      style: {
        textTransform: 'uppercase'
      }
    }, labels[i]);
  }), fill && /*#__PURE__*/React.createElement("path", {
    d: areaPath,
    fill: "url(#cg".concat(color.replace('#', ''), ")")
  }), /*#__PURE__*/React.createElement("path", {
    d: linePath,
    fill: "none",
    stroke: color,
    strokeWidth: "2",
    strokeLinecap: "round",
    strokeLinejoin: "round"
  }), /*#__PURE__*/React.createElement("circle", {
    cx: pts[4][0],
    cy: pts[4][1],
    r: "5",
    fill: color,
    stroke: T.bg0,
    strokeWidth: "2",
    style: {
      filter: "drop-shadow(0 0 6px ".concat(color, ")")
    }
  }));
};
var StatCard = function StatCard(_ref2) {
  var title = _ref2.title,
    children = _ref2.children,
    style = _ref2.style;
  return /*#__PURE__*/React.createElement("div", {
    style: _objectSpread({
      background: T.bg1,
      clipPath: cutPath(12),
      padding: '18px 20px',
      position: 'relative'
    }, style)
  }, /*#__PURE__*/React.createElement("div", {
    style: accentEdge(12)
  }), /*#__PURE__*/React.createElement("div", {
    style: {
      fontSize: 10,
      fontFamily: T.fontBody,
      fontWeight: 700,
      letterSpacing: '0.16em',
      textTransform: 'uppercase',
      color: T.fg3,
      marginBottom: 14
    }
  }, title), children);
};
var BarGroup = function BarGroup(_ref3) {
  var label = _ref3.label,
    value = _ref3.value,
    max = _ref3.max,
    _ref3$color = _ref3.color,
    color = _ref3$color === void 0 ? T.accent : _ref3$color,
    _ref3$suffix = _ref3.suffix,
    suffix = _ref3$suffix === void 0 ? '' : _ref3$suffix;
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      justifyContent: 'space-between',
      marginBottom: 4
    }
  }, /*#__PURE__*/React.createElement("span", {
    style: {
      fontSize: 12,
      color: T.fg2,
      fontFamily: T.fontBody
    }
  }, label), /*#__PURE__*/React.createElement("span", {
    style: {
      fontSize: 12,
      color: T.fg1,
      fontFamily: T.fontBody,
      fontWeight: 600,
      fontVariantNumeric: 'tabular-nums'
    }
  }, value, suffix)), /*#__PURE__*/React.createElement("div", {
    style: {
      height: 5,
      background: T.bg0,
      borderRadius: 3,
      overflow: 'hidden'
    }
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      height: '100%',
      width: "".concat(value / max * 100, "%"),
      background: color,
      borderRadius: 3,
      boxShadow: color === T.accent ? '0 0 5px rgba(0,217,0,0.35)' : 'none',
      transition: 'width 600ms cubic-bezier(0.22,1,0.36,1)'
    }
  })));
};
var StatisticsPage = function StatisticsPage() {
  var _React$useState = React.useState('2026'),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    period = _React$useState2[0],
    setPeriod = _React$useState2[1];
  var totals = {
    rev: REV_DATA.reduce(function (s, v) {
      return s + v;
    }, 0),
    kwp: KWP_DATA.reduce(function (s, v) {
      return s + v;
    }, 0),
    deals: DEALS_DATA.reduce(function (s, v) {
      return s + v;
    }, 0)
  };
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Topbar, {
    title: "Statistieken",
    user: {
      name: 'Nick De Roeck'
    }
  }), /*#__PURE__*/React.createElement("div", {
    className: "ghs-stapel",
    style: {
      padding: 24
    }
  }, /*#__PURE__*/React.createElement(GhsKpiRij, null, /*#__PURE__*/React.createElement(KPICard, {
    label: "Totale omzet 2026",
    value: "\u20AC ".concat((totals.rev / 1000).toFixed(0), "K"),
    delta: 14.2,
    icon: "trending",
    accent: true
  }), /*#__PURE__*/React.createElement(KPICard, {
    label: "Ge\xEFnstalleerde kWp",
    value: "".concat(totals.kwp),
    unit: "kWp",
    delta: 18.6,
    icon: "sun",
    color: "#ffb020"
  }), /*#__PURE__*/React.createElement(KPICard, {
    label: "Deals gesloten",
    value: totals.deals.toString(),
    delta: 9.1,
    icon: "handshake",
    color: "#00aaff"
  }), /*#__PURE__*/React.createElement(KPICard, {
    label: "Gem. deal waarde",
    value: "\u20AC ".concat(Math.round(totals.rev / totals.deals / 1000), "K"),
    icon: "barchart",
    color: "#bf63ff"
  })), /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'grid',
      gridTemplateColumns: '1fr 1fr',
      gap: GHS_RITME
    }
  }, /*#__PURE__*/React.createElement(StatCard, {
    title: "OMZET PER MAAND \u2014 2026"
  }, /*#__PURE__*/React.createElement(SVGChart, {
    data: REV_DATA,
    labels: MONTHS_NL,
    color: T.accent,
    height: 140,
    formatY: function formatY(v) {
      return "\u20AC".concat(Math.round(v / 1000), "K");
    }
  })), /*#__PURE__*/React.createElement(StatCard, {
    title: "GE\xCFNSTALLEERDE kWp PER MAAND"
  }, /*#__PURE__*/React.createElement(SVGChart, {
    data: KWP_DATA,
    labels: MONTHS_NL,
    color: "#bf63ff",
    height: 140,
    formatY: function formatY(v) {
      return "".concat(v);
    }
  }))), /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'grid',
      gridTemplateColumns: '1fr 1fr 1fr',
      gap: GHS_RITME
    }
  }, /*#__PURE__*/React.createElement(StatCard, {
    title: "TOP VERKOPERS \u2014 2026"
  }, [{
    name: 'Ive Bogaerts',
    deals: 42,
    rev: 186000
  }, {
    name: 'Sébastien Flamant',
    deals: 31,
    rev: 142000
  }, {
    name: 'Geert De Maeyer',
    deals: 24,
    rev: 108000
  }].map(function (s, i) {
    return /*#__PURE__*/React.createElement("div", {
      key: s.name,
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 10,
        padding: '9px 0',
        borderBottom: i < 2 ? "1px solid ".concat(T.stroke1) : 'none'
      }
    }, /*#__PURE__*/React.createElement("span", {
      style: {
        fontFamily: T.fontDisplay,
        fontSize: 14,
        fontWeight: 600,
        color: i === 0 ? T.accent : T.fg3,
        width: 18,
        flexShrink: 0
      }
    }, i + 1), /*#__PURE__*/React.createElement(Avatar, {
      name: s.name,
      size: 28
    }), /*#__PURE__*/React.createElement("div", {
      style: {
        flex: 1
      }
    }, /*#__PURE__*/React.createElement("div", {
      style: {
        fontSize: 12,
        fontFamily: T.fontBody,
        fontWeight: 600,
        color: T.fg1
      }
    }, s.name), /*#__PURE__*/React.createElement("div", {
      style: {
        fontSize: 10,
        color: T.fg3,
        fontFamily: T.fontBody
      }
    }, s.deals, " deals")), /*#__PURE__*/React.createElement("span", {
      style: {
        fontSize: 12,
        fontFamily: T.fontDisplay,
        fontWeight: 600,
        color: T.fg1,
        fontVariantNumeric: 'tabular-nums'
      }
    }, "\u20AC", (s.rev / 1000).toFixed(0), "K"));
  })), /*#__PURE__*/React.createElement(StatCard, {
    title: "PRODUCTMIX 2026"
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      flexDirection: 'column',
      gap: 10
    }
  }, /*#__PURE__*/React.createElement(BarGroup, {
    label: "Zonnepanelen",
    value: 178,
    max: 178,
    suffix: " inst."
  }), /*#__PURE__*/React.createElement(BarGroup, {
    label: "Batterijen",
    value: 94,
    max: 178,
    color: "#bf63ff",
    suffix: " inst."
  }), /*#__PURE__*/React.createElement(BarGroup, {
    label: "Warmtepompen",
    value: 32,
    max: 178,
    color: "#ffb020",
    suffix: " inst."
  }), /*#__PURE__*/React.createElement(BarGroup, {
    label: "Airco",
    value: 28,
    max: 178,
    color: "#00aaff",
    suffix: " inst."
  })), /*#__PURE__*/React.createElement("div", {
    style: {
      height: 1,
      background: T.stroke1,
      margin: '14px 0'
    }
  }), /*#__PURE__*/React.createElement("div", {
    style: {
      fontSize: 12,
      color: T.fg3,
      fontFamily: T.fontBody
    }
  }, "Totaal kWp ge\xEFnstalleerd"), /*#__PURE__*/React.createElement("div", {
    style: {
      fontFamily: T.fontDisplay,
      fontSize: 22,
      fontWeight: 600,
      color: T.fg1,
      marginTop: 2
    }
  }, totals.kwp, " ", /*#__PURE__*/React.createElement("span", {
    style: {
      fontSize: 12,
      color: T.fg3,
      fontWeight: 400
    }
  }, "kWp"))), /*#__PURE__*/React.createElement(StatCard, {
    title: "PIPELINE STATUS"
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      flexDirection: 'column',
      gap: 10
    }
  }, [{
    label: 'Lead',
    n: 12,
    color: T.fg3
  }, {
    label: 'Offerte',
    n: 8,
    color: '#bf63ff'
  }, {
    label: 'Aanvaard',
    n: 5,
    color: '#ffb020'
  }, {
    label: 'Gepland',
    n: 6,
    color: '#00aaff'
  }, {
    label: 'Geïnstalleerd',
    n: 4,
    color: T.accent
  }, {
    label: 'Afgerond',
    n: 3,
    color: 'rgba(246,247,235,0.4)'
  }].map(function (s) {
    return /*#__PURE__*/React.createElement(BarGroup, {
      key: s.label,
      label: s.label,
      value: s.n,
      max: 12,
      color: s.color,
      suffix: " deals"
    });
  })))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(StatCard, {
    title: "NIEUWE DEALS PER MAAND"
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      alignItems: 'flex-end',
      gap: 6,
      height: 80
    }
  }, DEALS_DATA.map(function (v, i) {
    var max = Math.max.apply(Math, DEALS_DATA);
    var isCurrent = i === 4;
    return /*#__PURE__*/React.createElement("div", {
      key: i,
      style: {
        flex: 1,
        display: 'flex',
        flexDirection: 'column',
        alignItems: 'center',
        gap: 4
      }
    }, /*#__PURE__*/React.createElement("div", {
      style: {
        fontFamily: T.fontDisplay,
        fontSize: 11,
        fontWeight: 600,
        color: isCurrent ? T.accent : T.fg3
      }
    }, v), /*#__PURE__*/React.createElement("div", {
      style: {
        width: '100%',
        height: "".concat(v / max * 56, "px"),
        background: isCurrent ? T.accent : 'rgba(0,217,0,0.22)',
        borderRadius: '2px 2px 0 0',
        boxShadow: isCurrent ? '0 0 10px rgba(0,217,0,0.35)' : 'none',
        minHeight: 4
      }
    }), /*#__PURE__*/React.createElement("span", {
      style: {
        fontSize: 9,
        color: isCurrent ? T.accent : T.fg4,
        fontFamily: T.fontBody,
        fontWeight: 600,
        letterSpacing: '0.08em'
      }
    }, MONTHS_NL[i]));
  }))))));
};
Object.assign(window, {
  StatisticsPage: StatisticsPage
});