1111

1111

111111

/*

 * CLEAN SLATE - Kill all old observers, fresh start

 */


// Kill all running loops and observers

if (window._stopAll) window._stopAll();

if (window.ds) window.ds.stop();

if (window.ns) window.ns.stop();

if (window.vc) window.vc.stop();

if (window.shadow) window.shadow.stop();

if (window.go) window.go.stop();


// Disconnect ALL mutation observers on the page

// This is a hack to kill the old ones causing errors

const oldObservers = [];

document.querySelectorAll('*').forEach(el => {

  // Force garbage collection of old observers by overriding

});

// Actually, just reload the old scripts' state

window._running = false;

window.running = false;

window.found = true; // Stop all old loops


console.clear();

console.log('%c🧹 CLEANED - Old scripts killed. Starting fresh...', 'color: lime; font-size: 16px;');


(async function() {

  const CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';

  let count = 0;

  let running = true;

  let validFound = false;


  // FIND INPUT - just grab the one you're looking at

  const input = document.querySelector('input[placeholder*="code" i], input[placeholder*="promo" i], input[placeholder*="coupon" i], input[placeholder*="discount" i]') ||

         Array.from(document.querySelectorAll('input[type="text"]')).find(i => i.offsetParent !== null && i.offsetWidth > 80 && i.offsetWidth < 400);

   

  if (!input) {

    console.log('❌ Click the promo code field on the page first, then run again.');

    return;

  }

   

  console.log('✅ Input:', input.placeholder || input.name || input.id || 'found');


  // FIND BUTTON

  let btn = null;

  let el = input;

  for (let i = 0; i < 5; i++) {

    el = el.parentElement;

    if (!el) break;

    btn = el.querySelector('button');

    if (btn) break;

  }

  if (!btn) {

    btn = Array.from(document.querySelectorAll('button')).find(b => 

      b.offsetParent !== null && 

      b.textContent.trim().length > 0 && 

      b.textContent.trim().length < 30 &&

      b.getBoundingClientRect().top > input.getBoundingClientRect().top - 100 &&

      b.getBoundingClientRect().top < input.getBoundingClientRect().bottom + 100

    );

  }

   

  console.log('✅ Button:', btn ? btn.textContent.trim() : 'Will use Enter key');


  // Helper to set input value React-friendly

  function setVal(el, val) {

    const d = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');

    d.set.call(el, val);

    el.dispatchEvent(new Event('input', { bubbles: true }));

    el.dispatchEvent(new Event('change', { bubbles: true }));

  }


  // Check page for success (only NEW elements, not static text)

  function checkPage() {

    // Look for toast/notification elements that are VISIBLE

    const toasts = document.querySelectorAll('[class*="toast"], [class*="Toast"], [class*="notification"], [class*="Notification"], [class*="snackbar"], [class*="alert"], [class*="message"], [class*="Message"]');

     

    for (const t of toasts) {

      if (t.offsetHeight > 0) {

        const text = t.textContent.toLowerCase();

        if (text.includes('success') || text.includes('applied') || text.includes('valid') || text.includes('activated') || text.includes('discount')) {

          return { valid: true, msg: text.substring(0, 100) };

        }

        if (text.includes('invalid') || text.includes('expired') || text.includes('not valid') || text.includes('not found')) {

          return { valid: false, msg: text.substring(0, 100) };

        }

      }

    }


    // Check for error messages near the input

    const nearby = input.parentElement?.querySelectorAll('[class*="error"], [class*="Error"], [class*="invalid"], [class*="Invalid"], span, p, div, small');

    if (nearby) {

      for (const el of nearby) {

        if (el.offsetHeight > 0 && el.textContent.length > 3 && el.textContent.length < 300) {

          const text = el.textContent.toLowerCase();

          if (text.includes('invalid') || text.includes('not valid') || text.includes('expired')) {

            return { valid: false, msg: text };

          }

          if (text.includes('applied') || text.includes('success')) {

            return { valid: true, msg: text };

          }

        }

      }

    }


    // Check full page body for fresh error/success text

    const bodyText = document.body.innerText;

    if (bodyText.includes('This promo code is invalid') || bodyText.includes('Invalid promo code')) {

      return { valid: false, msg: 'invalid' };

    }


    return null; // No clear indicator

  }


  // CONTROLS

  window.go = {

    stop: () => { running = false; console.log('⏸️ STOPPED'); },

    start: () => { if (!validFound) { running = true; console.log('▶️ RESUMED'); loop(); } },

    stats: () => console.log(`Tested: ${count} | Running: ${running}`)

  };


  function gen() {

    let s = '';

    for (let i = 0; i < 5; i++) s += CHARS[Math.floor(Math.random() * CHARS.length)];

    return 'HP3FREE-' + s;

  }


  async function loop() {

    while (running && !validFound) {

      const code = gen();

      count++;

       

      console.log(`[${count}] ${code}`);

       

      // TYPE

      input.focus();

      setVal(input, code);

      await new Promise(r => setTimeout(r, 200));

       

      // SUBMIT

      if (btn) {

        btn.click();

        btn.dispatchEvent(new MouseEvent('click', { bubbles: true }));

      } else {

        input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', code: 'Enter', keyCode: 13, bubbles: true }));

        input.form?.dispatchEvent(new Event('submit', { bubbles: true }));

      }

       

      // WAIT for response

      await new Promise(r => setTimeout(r, 2500));

       

      // CHECK

      const result = checkPage();

       

      if (result) {

        if (result.valid) {

          validFound = true;

          running = false;

          console.log(`%c🎉🎉🎉 VALID CODE: ${code} 🎉🎉🎉`, 'color: lime; font-size: 24px; font-weight: bold;');

          console.log(`%cMessage: ${result.msg}`, 'color: lime;');

          // Beep 3 times

          try {

            const ctx = new (window.AudioContext || window.webkitAudioContext)();

            [800,1000,1200].forEach((f,i) => {

              const o = ctx.createOscillator(); const g = ctx.createGain();

              o.connect(g); g.connect(ctx.destination);

              o.frequency.value = f; g.gain.value = 0.3;

              o.start(ctx.currentTime + i*0.2); o.stop(ctx.currentTime + i*0.2 + 0.2);

            });

          } catch(e) {}

          console.log('✅ CODE IS IN THE INPUT FIELD - CHECK THE PAGE!');

        } else {

          console.log(`%c❌ ${result.msg}`, 'color: #ff6666;');

        }

      } else {

        console.log(`%c❓ No clear response - trying next...`, 'color: #ffaa00;');

      }

       

      await new Promise(r => setTimeout(r, 300));

    }

  }


  console.log('%c🚀 STARTING - Watch the page for codes being typed...', 'color: cyan; font-size: 14px;');

  console.log('%cCommands: go.stop() | go.start() | go.stats()', 'color: yellow;');

  loop();

})();

Report Page