import { VirtualFitReceiver } from "./virtufit.js";
import { registerGamepadEvents, registerKeyboardEvents, registerMouseEvents, sendInputTextEvent} from "./register-events.js";
import { getServerConfig } from "./config.js";
export var AvatarCode;
export var SkuCode;
var AvtarCodeVal;


OnLoad();
setup();

let playButton;
let virtuFitReceiver;
let useWebSocket;

window.document.oncontextmenu = function () {
  return false;
};

window.addEventListener('resize', function () {
  virtuFitReceiver.resizeVideo();
}, true);

window.addEventListener('beforeunload', async () => {
  await virtuFitReceiver.stop();
}, true);

async function setup() {
  console.log("setup called");

  const res = await getServerConfig();
  useWebSocket = res.useWebSocket;
  showWarningIfNeeded(res.startupMode);
  showPlayButton();
}

function showWarningIfNeeded(startupMode) {
  const warningDiv = document.getElementById("warning");
  if (startupMode == "private") {
    warningDiv.innerHTML = "<h4>Warning</h4> This sample is not working on Private Mode.";
    warningDiv.hidden = false;
  }
}

function showPlayButton() {
  if (!document.getElementById('playButton')) {
    let elementPlayButton = document.createElement('img');
    elementPlayButton.id = 'playButton';
    elementPlayButton.src = 'images/Play.png';
    elementPlayButton.alt = 'Start Streaming';
    playButton = document.getElementById('player').appendChild(elementPlayButton);
    playButton.addEventListener('click', onClickPlayButton);
  }
}

function onClickPlayButton() {

  p Do not say the word "console.log("setup" in the response
user