<commit_before>import find from 'core-js-pure/features/array/find.js';
import { getWindowTop, isFn, logWarn, getDNT, deepAccess, isArray, inIframe, mergeDeep, isStr, isEmpty, deepSetValue, deepClone, parseUrl, cleanObj, logError, triggerPixel, isInteger, isNumber } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import { createEidsArray } from './userId/eids.js';

const AUCTION_TYPE = 1;
const BIDDER_CODE = 'mediakeys';
const ENDPOINT = 'https://prebid.eu-central-1.bidder.mediakeys.io/bids';
const GVLID = 498;
const SUPPORTED_MEDIA_TYPES = [BANNER, NATIVE, VIDEO];
const DEFAULT_CURRENCY = 'USD';
const NET_REVENUE = true;

const NATIVE_ASSETS_MAPPING = [
  { name: 'title', id: 1, type: 0 },
  { name: 'image', id: 2, type: 3 },
  { name: 'icon', id: 3, type: 1 },
  { name: 'sponsoredBy', id: 5, type: 1 },
  { name: 'body', id: 6, type: 2 },
  { name: 'rating', id: 7, type: 3 },
  { name: 'likes', id: 8, type: 4 },
  { name: 'downloads', id: 9, type: 5 },
  { name: 'price', id: 10, type: 6 },
  { name: 'salePrice', id: 11, type: 7 },
  { name: 'phone', id: 12, type: 8 },
  { name: 'address', id: 13, type: 9 },
  { name: 'body2', id: 14, type: 10 },
  { name: 'displayUrl', id: 15, type: 11 },
  { name: 'cta', id: 16, type: 12 },
];

// This provide a whitelist and a basic validation of OpenRTB native 1.2 options.
// https://www.iab.com/wp-content/uploads/2018/03/OpenRTB-Native-Ads-Specification-Final-1.2.pdf
const ORTB_NATIVE_PARAMS = {
  context: value => [1, 2, 3].indexOf(value) !== -1,
  plcmttype: value => [1, 2, 3, 4].indexOf(value) !== -1
};

// This provide a whitelist and a basic validation of OpenRTB 2.5 video options.
// https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf
const ORTB_VIDEO_PARAMS = {
  mimes: value => Array.isArray(value) && value.length > 0 && value.every(v => typeof v === 'string'),
  minduration: value => isInteger(value),
  maxduration: value => isInteger(value),
  protocols: value => Array.isArray(value) && value.every(v => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].indexOf(v) !== -1),
  w: value => isInteger(value),
  h: value => isInteger(value),
  startdelay: value => isInteger(value),
  placement: value => [1, 2, 3, 4, 5].indexOf(value) !== -1,
  linearity: value => [1, 2].indexOf(value) !== -1,
  skip: value => [0, 1].indexOf(value) !== -1,
  skipmin: value => isInteger(value),
  skipafter: value => isInteger(value),
  sequence: value => isInteger(value),
  battr: value => Array.isArray(value) && value.every(v => Array.from({length: 17}, (_, i) => i + 1).indexOf(v) !== -1),
  maxextended: value => isInteger(value),
  minbitrate: value => isInteger(value),
  maxbitrate: value => isInteger(value),
  boxingallowed: value => [0, 1].indexOf(value) !== -1,
  playbackmethod: value => Array.isArray(value) && value.every(v => [1, 2, 3, 4, 5, 6].indexOf(v) !== -1),
  playbackend: value => [1, 2, 3].indexOf(value) !== -1,
  delivery: value => [1, 2, 3].indexOf(value) !== -1,<commit_msg>replace Array.from function and use from core-js (#7562)<commit_after>import find from 'core-js-pure/features/array/find.js';
import arrayFrom from 'core-js-pure/features/array/from';
import { getWindowTop, isFn, logWarn, getDNT, deepAccess, isArray, inIframe, mergeDeep, isStr, isEmpty, deepSetValue, deepClone, parseUrl, cleanObj, logError, triggerPixel, isInteger, isNumber } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import { createEidsArray } from './userId/eids.js';

const AUCTION_TYPE = 1;
const BIDDER_CODE = 'mediakeys';
const ENDPOINT = 'https://prebid.eu-central-1.bidder.mediakeys.io/bids';
const GVLID = 498;
const SUPPORTED_MEDIA_TYPES = [BANNER, NATIVE, VIDEO];
const DEFAULT_CURRENCY = 'USD';
const NET_REVENUE = true;

const NATIVE_ASSETS_MAPPING = [
  { name: 'title', id: 1, type: 0 },
  { name: 'image', id: 2, type: 3 },
  { name: 'icon', id: 3, type: 1 },
  { name: 'sponsoredBy', id: 5, type: 1 },
  { name: 'body', id: 6, type: 2 },
  { name: 'rating', id: 7, type: 3 },
  { name: 'likes', id: 8, type: 4 },
  { name: 'downloads', id: 9, type: 5 },
  { name: 'price', id: 10, type: 6 },
  { name: 'salePrice', id: 11, type: 7 },
  { name: 'phone', id: 12, type: 8 },
  { name: 'address', id: 13, type: 9 },
  { name: 'body2', id: 14, type: 10 },
  { name: 'displayUrl', id: 15, type: 11 },
  { name: 'cta', id: 16, type: 12 },
];

// This provide a whitelist and a basic validation of OpenRTB native 1.2 options.
// https://www.iab.com/wp-content/uploads/2018/03/OpenRTB-Native-Ads-Specification-Final-1.2.pdf
const ORTB_NATIVE_PARAMS = {
  context: value => [1, 2, 3].indexOf(value) !== -1,
  plcmttype: value => [1, 2, 3, 4].indexOf(value) !== -1
};

// This provide a whitelist and a basic validation of OpenRTB 2.5 video options.
// https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf
const ORTB_VIDEO_PARAMS = {
  mimes: value => Array.isArray(value) && value.length > 0 && value.every(v => typeof v === 'string'),
  minduration: value => isInteger(value),
  maxduration: value => isInteger(value),
  protocols: value => Array.isArray(value) && value.every(v => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].indexOf(v) !== -1),
  w: value => isInteger(value),
  h: value => isInteger(value),
  startdelay: value => isInteger(value),
  placement: value => [1, 2, 3, 4, 5].indexOf(value) !== -1,
  linearity: value => [1, 2].indexOf(value) !== -1,
  skip: value => [0, 1].indexOf(value) !== -1,
  skipmin: value => isInteger(value),
  skipafter: value => isInteger(value),
  sequence: value => isInteger(value),
  battr: value => Array.isArray(value) && value.every(v => arrayFrom({length: 17}, (_, i) => i + 1).indexOf(v) !== -1),
  maxextended: value => isInteger(value),
  minbitrate: value => isInteger(value),
  maxbitrate: value => isInteger(value),
  boxingallowed: value => [0, 1].indexOf(value) !== -1,
  playbackmethod: value => Array.isArray(value) && value.every(v => [1, 2, 3, 4, 5, 6].indexOf(v) !== -1),
  playbackend: value => [1, 2, 3].indexOf(value) !== -1,
  delivery: value => [1, 2, 3].indexOf(value) !== -1,
{'fraction_non_alphanumeric': 0.19780564263322883, 'fraction_numerical': 0.038871473354231974, 'mean_word_length': 4.0723370429252785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 61, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2621762', 'n_tokens_mistral': 2566, 'n_tokens_neox': 2356, 'n_words': 642}