Загрузка данных


(() => {
  const ROOT_ID = 'IwtHTJtwO';
  const hits = window.__sdkForeignDom = [];
  const inSdk = n => { for (let x = n; x; x = x.parentNode || x.host) if (x.id === ROOT_ID) return true; return false; };
  const foreign = () => {
    const st = (new Error().stack || '').split('\n').slice(3).join('\n');
    return /sdk\.examus\.net/.test(st) ? null : st;
  };
  const report = (op, target, arg) => {
    if (!(inSdk(target) || (arg && arg.nodeType && inSdk(arg)))) return;
    const st = foreign();
    if (!st) return;
    const rec = op + ' on <' + (target.nodeName || '?') + (target.id ? '#' + target.id : '') + '>\n' + st;
    hits.push(rec);
    console.warn('[SDK DOM touched by foreign code] ' + rec);
  };
  const wrap = (proto, name) => {
    const orig = proto[name];
    if (typeof orig !== 'function') return;
    proto[name] = function (...a) { try { report(name, this, a[0]); } catch (e) {} return orig.apply(this, a); };
  };
  [[Node.prototype, ['appendChild', 'insertBefore', 'removeChild', 'replaceChild', 'normalize']],
   [Element.prototype, ['remove', 'replaceWith', 'before', 'after', 'append', 'prepend', 'setAttribute', 'removeAttribute', 'insertAdjacentHTML', 'insertAdjacentElement']],
   [CharacterData.prototype, ['remove', 'replaceWith', 'before', 'after', 'appendData', 'replaceData', 'deleteData']]]
    .forEach(([p, names]) => names.forEach(n => wrap(p, n)));
  const wrapSetter = (proto, prop) => {
    const d = Object.getOwnPropertyDescriptor(proto, prop);
    if (!d || !d.set) return;
    Object.defineProperty(proto, prop, { ...d, set(v) { try { report('set ' + prop, this); } catch (e) {} d.set.call(this, v); } });
  };
  wrapSetter(Element.prototype, 'innerHTML');
  wrapSetter(Element.prototype, 'outerHTML');
  wrapSetter(Node.prototype, 'textContent');
  wrapSetter(Node.prototype, 'nodeValue');
  wrapSetter(CharacterData.prototype, 'data');
  wrapSetter(HTMLElement.prototype, 'innerText');
  console.warn('[diag] installed');
})();