/* SHKit: shared helpers loaded before all screens.
   Exposes window.useIsMobile (responsive hook) and window.Deco (brand decoration). */

/* Responsive hook: true when viewport is at or below `bp` px. */
window.useIsMobile = function useIsMobile(bp) {
  bp = bp || 768;
  const query = '(max-width: ' + bp + 'px)';
  const read = function () {
    return typeof window.matchMedia === 'function' ? window.matchMedia(query).matches : false;
  };
  const state = React.useState(read);
  const value = state[0];
  const set = state[1];
  React.useEffect(function () {
    const mq = window.matchMedia(query);
    const onChange = function () { set(mq.matches); };
    onChange();
    if (mq.addEventListener) { mq.addEventListener('change', onChange); }
    else { mq.addListener(onChange); }
    return function () {
      if (mq.removeEventListener) { mq.removeEventListener('change', onChange); }
      else { mq.removeListener(onChange); }
    };
  }, [query]);
  return value;
};

/* Decorative brand motif: absolutely positioned, non-interactive, hidden on mobile via CSS.
   props: src (path under assets/brand/), w (width px), anim (animation class), style (positioning). */
window.Deco = function Deco(props) {
  const cls = 'sh-deco ' + (props.anim || '');
  const style = Object.assign({ width: props.w || 40 }, props.style || {});
  return React.createElement('img', {
    src: 'assets/brand/' + props.src,
    className: cls,
    style: style,
    alt: '',
    'aria-hidden': 'true',
    draggable: 'false',
   });
};

/* LocalIcon: renders a local brand SVG (from assets/brand/icons/) via CSS mask,
   same API as the Lucide-based Icon component: name, size, color. */
window.LocalIcon = function LocalIcon(_ref) {
  var name = _ref.name,
    size = _ref.size || 24,
    color = _ref.color || 'currentColor',
    style = _ref.style;
  var url = 'assets/brand/icons/' + name + '.svg';
  return React.createElement('span', {
    role: 'img',
    'aria-label': name,
    style: Object.assign({
      display: 'inline-block',
      width: size,
      height: size,
      backgroundColor: color,
      WebkitMaskImage: 'url("' + url + '")',
      maskImage: 'url("' + url + '")',
      WebkitMaskRepeat: 'no-repeat',
      maskRepeat: 'no-repeat',
      WebkitMaskSize: 'contain',
      maskSize: 'contain',
      WebkitMaskPosition: 'center',
      maskPosition: 'center',
      flex: '0 0 auto'
    }, style || {})
  });
};
