const XK = 'kVz7q';

/**
 * @param {string} s
 * @returns {string}
 */
const dx = (s) => {
  const raw = globalThis.atob(s);
  let out = '';

  for (let i = 0; i < raw.length; i += 1) {
    out += String.fromCharCode((raw.charCodeAt(i) - XK.charCodeAt(i % XK.length) + 256) % 256);
  }

  return out;
};

export const SHOPEE_VIDEO_CREATOR_HOST = dx('08rup+Slhama49C37qbjmcnipuHQu6it3w==');
export const SHOPEE_VIDEO_MMS_HOST = dx('08rup+SlhamY4dSE56TkmcnipuHQu6it3w==');

export const SHOPEE_VIDEO_REGION = 'VN';

export const SHOPEE_VIDEO_BIZ_VOD = 201;
export const SHOPEE_VIDEO_BIZ_IMAGE = 4117;
export const SHOPEE_VIDEO_MEDIATYPE_VOD = 1;

export const SHOPEE_VIDEO_MMS_VERSION = dx('2MPtZKSZjKhn');
export const SHOPEE_VIDEO_MMS_OS_TYPE = 2;

export const SHOPEE_VIDEO_VOD_KEY_PREFIX = dx('3r7pp9bQtfCm1co=');
export const SHOPEE_VIDEO_VOD_KEY_IV = dx('nIita6ahjbJvqKGLrmqjnA==');

export const SHOPEE_VIDEO_S3_REGION = 'VN';
export const SHOPEE_VIDEO_S3_SERVICE = 's3';

export const SHOPEE_VIDEO_TASK_STATUS = Object.freeze({
  READY: 100,
  POSTED: 300,
});

export const SHOPEE_VIDEO_STATE = Object.freeze({
  PROCESSING: 0,
  LIVE: 1,
});
