/*
 * GDevelop JS Platform
 * Copyright 2013-2025 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
 * This project is released under the MIT License.
 */
namespace gdjs {
  declare var nmd: any;
  const logger = new gdjs.Logger('InAppTutorialMessage');
  const padding = '20px';
  const redHeroImage =
    'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAABrrFhUAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAACxMAAAsTAQCanBgAAALuUExURUdwTBgQPBkQOxkQPRgQPRkRPRgQPBkRPRQQQBgQPBgQOhoRPhkRPRgQPBkQPBgQPRkQPRkQPRkQPBkQPRkSPRkSPBgRPRkQPhYQPRkQPhgQOv///////////+7t8BkRPQAAAP///+1ZTupWSfJgWPFfVvhoZPpqZ+xYTO9cUvpraPtsau1aT+tXS/xta/lpZfdnYvBeVfVkXu5bUfBdVPFfV/1ubfdmYflqZu5bUOtXSv1vbu9dU/VjXPtsaexZTfZlX/NhWvVkXfNhWfRiW/hoY/lpZvZlYPNiW+lURvJhWepVSPtrafxtbP9wb+tWSfxubPFeVf9wcPRjXfJgV/NiWvdmYPBeVOtYS//+9exYTfZmYPBdU+lVR+1ZTftraO1aTvhnY/VlX+5aT+hTRf5wb/9xcfdnY/FeVu5aUO9cU/1ubNtCKv5vbu9cUfxtau5cUfhpZdxDLPtta/JfV/Hw89g+JePh5+9bUfprZ//+995FLzQbQP//+///+fVkX////plFV+ROPOdRQTUcQvBeVuBING9qhm80T29qhcRXYfpqaGwwSiYVPtpAJ6JET+JkaVAmRicWQB8fH8DAwHs3T4U3SV8sSjIZPdtcXODg3qZJV0MhRPBqa/FgV9dWVL5PVok+UlEnSH06UoI0RE4jQmktRfh4cgcDCRAQEbZFRkBAP/JfVotAVvDv7fvJwPi2q+JLN+FbRxYPNt9gY9JdZO1mZtBNRoc6TV0lPP7r4qCfnKhNXpqXqFIpSZw8RXYxRIyInGJeXfiqoQoHGpCQkGcrQcRJRykjRd5S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As5A6+jivwmuiQgLeQRTCI6Oasy0N5Ark7966ZmDN88KdCHg4aOzKyP9fQpBEL8Z/ZRJnW/Ym1Lv2f3qPAKfu/jE0TfffPPoExf9+v0nMmxpYlXgafAcce9Qs/L40SCfk+O1/6qwJYsg0mD2B3u8/t6z5/RFk+BbVq8PW8oIojeYPX/0tCT52R88YZb6S1D9Q3jC3Az5N4QtfaxdOfjXhi1LrBQTbNoQtlwRsQIoWMriP48JPrDc+Jes71+Qgs3/Rd2/EvJgU3jYyojloWBdRNjKiaWnYEXBX3oKVhx8oWDTf7ncv+xagiXpFDevVPjSKa4KcSasWRsZtsJjS+hssGZTeNi1EOtDUw02rYoMu2Zi/SqTOdi09hpCb7YP1lxT2s85fbrlA0HfeXLj9eHXKHrDCFuuD5iE1ddHXNvgPU4IX7XZTxZu3Loq/P0B3ucwacvazauvekJ9zeqt10dseL9h93XDhvCItddv3bTpxhtv9Mh9442bNm29fm3ElqVH/v8BxGruVrjGoqUAAAAASUVORK5CYII=';

  /** A minimal utility to define DOM elements. */
  function h<K extends keyof HTMLElementTagNameMap>(
    tag: K,
    attrs: {
      style?: Partial<CSSStyleDeclaration>;
      onClick?: () => void;
    },
    ...nodes: (HTMLElement | string)[]
  ): HTMLElement {
    const node = document.createElement(tag);
    Object.keys(attrs).forEach((key) => {
      if (key === 'style') {
        for (const [styleName, value] of Object.entries(attrs.style!)) {
          node.style[styleName] = value;
        }
      } else if (key === 'onClick') {
        node.addEventListener('click', attrs[key]!);
      } else {
        node.setAttribute(key, '' + attrs[key]);
      }
    });

    node.append(...nodes);
    return node;
  }

  const styles = {
    container: {
      position: 'absolute',
      zIndex: '1',
      display: 'flex',
    },
    avatarContainer: {
      display: 'flex',
      boxShadow:
        'rgba(43, 19, 19, 0.2) 0px 2px 4px -1px, rgba(0, 0, 0, 0.14) 0px 4px 5px 0px, rgba(0, 0, 0, 0.12) 0px 1px 10px 0px',
      borderRadius: '30px',
      cursor: 'pointer',
    },
    messageContainer: {
      position: 'absolute',
      padding: '10px 12px',
      minWidth: '180px',
      borderRadius: '8px',
      backgroundColor: 'rgb(250, 250, 250)',
      boxShadow:
        'rgba(43, 19, 19, 0.2) 0px 2px 4px -1px, rgba(0, 0, 0, 0.14) 0px 4px 5px 0px, rgba(0, 0, 0, 0.12) 0px 1px 10px 0px',
      fontFamily:
        "'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, 'Helvetica Neue', Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",
      fontSize: '14px',
      lineHeight: '20px',
      letterSpacing: '0.01em',
      color: 'rgb(73, 73, 82)',
    },
  };

  type AbsolutePositionStyle = {
    top?: string;
    bottom?: string;
    left?: string;
    right?: string;
    transform?: string;
  };

  /** @internal */
  export namespace inAppTutorialMessage {
    const containerId = 'in-app-tutorial-container';

    let _container: HTMLElement | null = null;
    let _styleSheet: HTMLStyleElement | null = null;
    let _areFontsLoaded = false;

    const _loadFonts = async () => {
      if (_areFontsLoaded) return;

      const fontFaces = await Promise.all([
        new FontFace(
          'Fira Sans',
          "url(https://fonts.gstatic.com/s/firasans/v17/va9E4kDNxMZdWfMOD5Vvl4jLazX3dA.woff2) format('woff2')",
          {
            variant: 'normal',
            weight: 'normal',
            unicodeRange:
              'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',
            display: 'swap',
          }
        ).load(),
        new FontFace(
          'Fira Sans',
          "url(https://fonts.gstatic.com/s/firasans/v17/va9B4kDNxMZdWfMOD5VnLK3eRhf6Xl7Glw.woff2) format('woff2')",
          {
            variant: 'normal',
            weight: 'bold',
            unicodeRange:
              'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD',
            display: 'swap',
          }
        ).load(),
      ]);
      fontFaces.forEach((fontFace) => {
        document.fonts.add(fontFace);
      });
      _areFontsLoaded = true;
    };

    const _loadStyleSheet = () => {
      if (_styleSheet) return;

      _styleSheet = document.createElement('style');
      _styleSheet.textContent = `
        #${containerId} p {
          margin-block: 0; /* To remove any browser built-in style */
        }
      `;
      document.head.appendChild(_styleSheet);
    };

    const getDomElementContainer = (
      runtimeGame: gdjs.RuntimeGame
    ): HTMLDivElement | null => {
      // Find the DOM element container.
      const domElementContainer = runtimeGame
        .getRenderer()
        .getDomElementContainer();
      if (!domElementContainer) {
        logger.error('No DOM element container found.');
        return null;
      }
      return domElementContainer;
    };

    const _getPositioningStyle = (position: string) => {
      const leftOrRight = position.toLowerCase().includes('right')
        ? 'right'
        : 'left';
      const topOrMiddleOrBottom = position.toLowerCase().includes('top')
        ? 'top'
        : position.toLowerCase().includes('middle')
        ? 'middle'
        : 'bottom';

      const containerPositionStyle: AbsolutePositionStyle = {};
      const messageContainerPositionStyle: AbsolutePositionStyle = {};

      if (leftOrRight === 'left') {
        containerPositionStyle.left = padding;
        messageContainerPositionStyle.left =
          topOrMiddleOrBottom === 'top' ? 'calc(100% + 10px)' : '0px';
      } else {
        containerPositionStyle.right = padding;
        messageContainerPositionStyle.right =
          topOrMiddleOrBottom === 'top' ? 'calc(100% + 10px)' : '0px';
      }
      if (topOrMiddleOrBottom === 'top') {
        containerPositionStyle.top = padding;
        messageContainerPositionStyle.top = '0px';
      } else if (topOrMiddleOrBottom === 'middle') {
        containerPositionStyle.top = '50%';
        messageContainerPositionStyle.transform =
          'translateY(calc(-100% - 10px))';
      } else {
        containerPositionStyle.bottom = padding;
        messageContainerPositionStyle.transform =
          'translateY(calc(-100% - 10px))';
      }
      return { containerPositionStyle, messageContainerPositionStyle };
    };

    export const displayInAppTutorialMessage = (
      runtimeGame: gdjs.RuntimeGame,
      /**
       * When undefined, removes the current message.
       */
      message: string | undefined,
      position: string
    ) => {
      const domElementContainer = getDomElementContainer(runtimeGame);
      if (!domElementContainer) {
        return;
      }

      if (_container) {
        domElementContainer.removeChild(_container);
        _container = null;
        if (!message) return;
      }

      const messageContent = document.createElement('div');
      messageContent.innerHTML = nmd(message);

      const {
        containerPositionStyle,
        messageContainerPositionStyle,
      } = _getPositioningStyle(position);

      _loadFonts();
      _loadStyleSheet();
      _container = (
        <div
          id={containerId}
          style={{ ...styles.container, ...containerPositionStyle }}
        >
          <div style={styles.avatarContainer}>
            <div
              style={{
                ...styles.messageContainer,
                ...messageContainerPositionStyle,
              }}
            >
              {messageContent}
            </div>
            <img
              width={60}
              height={60}
              alt="GDevelop mascot red hero"
              src={redHeroImage}
            />
          </div>
        </div>
      );
      // @ts-ignore - TS doesn't acknowledge the assignation above that excludes
      // the possibility that _container can be null.
      domElementContainer.appendChild(_container);
    };
  }
}
