Перепиши код JS:
(async()=>{Date.prototype.addDays=function(e){var t=new Date(this.valueOf());return t.setDate(t.getDate()+Number(e)),t};const e=document.getElementById("root_form"),t=document.getElementById("block_info"),a=document.getElementById("log_title"),n=document.getElementById("startBtn"),r=document.getElementById("dateFrom"),o=document.getElementById("dateTo"),s=document.getElementById("delay"),i=document.getElementById("coef"),l=document.getElementById("wb_id"),c=document.getElementById("count_supplies"),d=document.getElementById("log_text"),u=document.getElementById("dateFrom2"),p=document.getElementById("dateTo2"),m=document.getElementById("by_slots"),w=document.getElementById("success_img");s.addEventListener("change",(e=>{Number(s.value)<5&&(s.value=5)})),r.addEventListener("input",(e=>{var t=(new Date).addDays(Number(e.target.value)).toLocaleDateString();u.textContent=t})),o.addEventListener("input",(e=>{var t=(new Date).addDays(Number(e.target.value)).toLocaleDateString();p.textContent=t}));var y=(new Date).addDays(Number(r.value)).toLocaleDateString();u.textContent=y;var h=(new Date).addDays(Number(o.value)).toLocaleDateString();p.textContent=h;setInterval((async()=>await async function(){let[r]=await chrome.tabs.query({active:!0,currentWindow:!0});await chrome.scripting.executeScript({target:{tabId:r.id},func:async()=>JSON.stringify({alert:window.alert,is_running:window.is_running,oldID:window.oldID,email:window.email}),world:"MAIN"},(async r=>{var o=JSON.parse(r[0].result),s=o.alert,i=o.is_running,l=o.oldID,c=o.email;if(i){n.innerHTML='<i class="fa fa-stop" style="margin-right:8px; color: #EE23FF;"></i> Остановить поиск',e.style.display="none",t.style.display="block",n.classList.add("button_stop"),n.classList.remove("button_start"),w.style.display="none";try{s.includes("успешно")?(w.style.display="block",a.textContent=s.split(".")[0].trim(),d.textContent=s.replace(a.textContent,"").substring(1).trim(),n.classList.add("button_start"),n.classList.remove("button_stop"),n.innerHTML="Задать новый поиск"):(a.textContent=s.split("\n")[0].trim(),d.textContent=s.replace(a.textContent,"").trim())}catch(e){}}else n.classList.add("button_start"),n.classList.remove("button_stop"),n.innerHTML='<i class="fa fa-play" style="margin-right:8px;"></i> Начать поиск',e.style.display="block",t.style.display="none";m.setAttribute("href",m.getAttribute("href").replace("nw=test","nw="+l).replace("email=test@yandex.ru","email="+c)),s&&s.includes("был успешно найден")&&null!=l&&chrome.storage.sync.get("lastSuccessAlert",(async e=>{e.lastSuccessAlert!=s&&chrome.storage.sync.set({lastSuccessAlert:s},(function(){}))}))}))}()),500);var g=void 0;let[f]=await chrome.tabs.query({active:!0,currentWindow:!0});async function v(e,t,a,n){var r=await fetch("http://45.136.180.100/api/ru",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({nw:e,email:t,phone:a,first_name:n})}),o=await r.json();return c.textContent=o.cs,o}await chrome.scripting.executeScript({target:{tabId:f.id},func:async()=>{var e=void 0;return await async function(){try{if(!window.location.toString().includes("seller.wildberries.ru"))return void alert("Включите вкладку с wb кабинетом или авторизуйтесь, потом попробуйте запустить расширение заново.");var t=await fetch("https://seller.wildberries.ru/passport/api/v2/user/personal_data",{headers:{accept:"*/*","accept-language":"ru,en-US;q=0.9,en;q=0.8,ru-RU;q=0.7","content-type":"application/json","sec-ch-ua":'"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',origin:"https://seller.wildberries.ru"},referrer:"https://seller.wildberries.ru/supplies-management/all-supplies/supply-detail/uploaded-goods?preorderId&supplyId=23376109",referrerPolicy:"strict-origin-when-cross-origin",body:null,method:"GET",mode:"cors",credentials:"include"}),a=await t.json();window.email=a.user.email,window.first_name=a.user.first_name,window.phone=a.user.phone,e=function(e){const t=("; ${"+document.cookie+"}").split(`; ${e}=`);if(2===t.length)return t.pop().split(";").shift()}("x-supplier-id-external"),window.oldID=e}catch(e){setCookie("alert","Включите вкладку с wb кабинетом или авторизуйтесь, потом попробуйте запустить расширение заново."),alert("Включите вкладку с wb кабинетом или авторизуйтесь, потом попробуйте запустить расширение заново.")}}(),JSON.stringify({oldID:window.oldID,email:window.email,first_name:window.first_name,phone:window.phone})},world:"MAIN"},(async e=>{var t=JSON.parse(e[0].result);g=t.oldID;var a=t.email,n=t.first_name,r=t.phone;l.textContent=g,g&&await v(g,a,r,n)}));async function b(...e){function t(e,t){window.alert=t;var a="",n=new Date;n.setTime(n.getTime()+31536e6),a="; expires="+n.toUTCString(),document.cookie=e+"="+(t||"")+a+"; path=/"}if(null!=window.is_running&&1==window.is_running)return window.is_running=!1,clearInterval(window.timerId),void t("alert","Бот остановлен.");Date.prototype.addDays=function(e){var t=new Date(this.valueOf());return t.setDate(t.getDate()+Number(e)),t};try{var a="null",n="null";function r(e){const t=("; ${"+document.cookie+"}").split(`; ${e}=`);if(2===t.length)return t.pop().split(";").shift()}function o(){var e=new URL(window.location.toString()),t=e.searchParams.get("supplyId"),r=e.searchParams.get("preorderId");null!=t&&(a=Number(t),n="null"),0==a&&(a="null"),null!=r&&(n=Number(r)),0==n&&(n="null")}o();var s=(new Date).addDays(e[0]).toLocaleDateString("en-CA"),i=(new Date).addDays(e[1]).toLocaleDateString("en-CA"),l=1e3*Number(e[2]),c=Number(e[3]),d=void 0,u={accept:"*/*","accept-language":"ru,en-US;q=0.9,en;q=0.8,ru-RU;q=0.7","content-type":"application/json","sec-ch-ua":'"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',origin:"https://seller.wildberries.ru"};async function p(e,t,a,n){if(window.canFounded){window.canFounded=!1;var r=await fetch("https://upmob.ru/api/mhdev_proxie",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({method:"api/sf",nw:e,supply_id:t,koef:a,warehouseName:n})});return await r.json()}return{}}window.canFounded=!0;var m=!1;async function w(){if(!m){var e=await async function(e){var t=await fetch("https://upmob.ru/api/mhdev_proxie",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({method:"api/ru",nw:e})});return await t.json()}(f);if(e.cs<1)clearInterval(window.timerId);else{var w,y;console.log("checkCosts 1"),await v((w=1,y=1100,w=Math.ceil(w),y=Math.floor(y),Math.floor(Math.random()*(y-w+1))+w));var b=await async function(){try{null==document.getElementById("amountPallet")&&document.getElementsByClassName("onlyIcon__IUCeD-rFzH")[0].click()}catch(e){}var e=await fetch("https://seller-supply.wildberries.ru/ns/sm-supply/supply-manager/api/v1/supply/getAcceptanceCosts",{headers:u,referrer:"https://seller.wildberries.ru/",referrerPolicy:"strict-origin-when-cross-origin",body:'{"params":{"dateFrom":"'+s+'T00:00:00.000Z","dateTo":"'+i+'T20:00:00.000Z","preorderID":'+n+',"supplyId":'+a+'},"jsonrpc":"2.0","id":"json-rpc_31"}',method:"POST",mode:"cors",credentials:"include"});return await e.json()}();for(var _ of(console.log("checkCosts 2"),b.result.costs))if(_.coefficient<=c&&_.coefficient>=0){m=!0;try{if(await h(_.date),await v(8e3),o(),await g(),null!=d.paidAcceptanceCoefficient&&d.paidAcceptanceCoefficient<=c)clearInterval(window.timerId),t("alert",null!=a&&"null"!=a?"Коэффициент "+d.paidAcceptanceCoefficient+" у поставки "+a+" был успешно найден. Поставка запланирована. Бот остановлен.":"Коэффициент "+d.paidAcceptanceCoefficient+" у поставки был успешно найден. Поставка запланирована. Бот остановлен."),await p(r("x-supplier-id-external"),a,d.paidAcceptanceCoefficient,d.warehouseName);else{m=!1;try{document.getElementsByClassName("onlyIcon__IUCeD-rFzH")[0].click()}catch(e){}}return}catch(e){m=!1}}console.log("checkCosts 3"),t("alert","null"!=a?"Бот работает над поставкой: "+a+"\n\n"+d.warehouseName+"\n Коэффициент не более : "+c+"\n От "+s+"\n До "+i+"\nЗадержка: "+Math.round(l/1e3)+"\n\nПоследняя попытка: "+(new Date).toLocaleString():"Бот работает над поставкой: "+n+"\n\n"+d.warehouseName+"\n Коэффициент не более : "+c+"\n От "+s+"\n До "+i+"\nЗадержка: "+Math.round(l/1e3)+"\n\nПоследняя попытка: "+(new Date).toLocaleString())}}}function y(e,t){let a=e.querySelectorAll("[class^='"+t+"'], [class*=' "+t+"]");return Array.from(a).map((e=>Array.from(e.classList))).reduce(((e,t)=>t=t.concat(e)),[]).filter((e=>e.startsWith(t)))[0]}const v=e=>new Promise(((t,a)=>{setTimeout((e=>t()),e)}));async function h(e){var t=Number(e.split("T")[0].split("-")[2]);document.getElementsByClassName("caption__kqFcIewCT5")[1].click(),await v(500);for(var a=y(document,"Calendar-cell__date-container__"),n=document.getElementsByClassName(a).length,r=void 0,o=0;o<n;o++){var s=document.getElementsByClassName(a)[o];if(t==Number(s.innerText.split(" ")[0])){r=o;break}}console.log("selected_cell_number: "+r);var i=new MouseEvent("mouseover",{view:window,bubbles:!0,cancelable:!0}),l=y(document,"Calendar-cell__cell-content__"),c=document.getElementsByClassName(l)[r];c.dispatchEvent(i),await v(500),console.log("html: "+c.getElementsByClassName("Custom-popup")[0].outerHTML);var d=y(c.getElementsByClassName("Custom-popup")[0],"caption__");c.getElementsByClassName("Custom-popup")[0].getElementsByClassName(d)[0].click(),await v(300);var u=y(document,"Calendar-plan-buttons--transfer__"),p=y(document.getElementsByClassName(u)[0],"caption__");document.getElementsByClassName(p)[0].click()}async function g(){var e=await fetch("https://seller-supply.wildberries.ru/ns/sm-supply/supply-manager/api/v1/supply/supplyDetails",{headers:u,referrer:"https://seller.wildberries.ru/",referrerPolicy:"strict-origin-when-cross-origin",body:'{"params":{"pageNumber":1,"pageSize":20,"preorderID":'+n+',"search":"","supplyID":'+a+'},"jsonrpc":"2.0","id":"json-rpc_63"}',method:"POST",mode:"cors",credentials:"include"}),t=await e.json();console.log("responseJSON: "+JSON.stringify(t)),d=t.result.supply}var f=r("x-supplier-id-external");function r(e){const t=`; ${document.cookie}`.split(`; ${e}=`);if(2===t.length)return t.pop().split(";").shift()}await async function(){console.log("getUserSuppliers");try{var e=await fetch("https://seller.wildberries.ru/ns/suppliers/suppliers-portal-core/suppliers",{headers:{accept:"*/*","accept-language":"ru,en-US;q=0.9,en;q=0.8,ru-RU;q=0.7","content-type":"application/json","sec-ch-ua":'"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"macOS"',origin:"https://seller.wildberries.ru"},referrer:"https://seller.wildberries.ru/",referrerPolicy:"strict-origin-when-cross-origin",body:'[{"method":"getUserSuppliers","params":{},"id":"json-rpc_5","jsonrpc":"2.0"},{"method":"listCountries","params":{},"id":"json-rpc_6","jsonrpc":"2.0"}]',method:"POST",mode:"cors",credentials:"include"});await e.json()}catch(e){t("alert","Включите вкладку с wb кабинетом или авторизуйтесь, потом попробуйте запустить расширение заново. err: "+e.stack)}}(),window.timerId=void 0,async function(){(async()=>{await g(),await async function(){var e=await fetch("https://seller.wildberries.ru/passport/api/v2/user/personal_data",{headers:u,referrer:"https://seller.wildberries.ru/supplies-management/all-supplies/supply-detail/uploaded-goods?preorderId&supplyId=23376109",referrerPolicy:"strict-origin-when-cross-origin",body:null,method:"GET",mode:"cors",credentials:"include"}),t=await e.json();t.user}();var e=Math.round(l/1e3),a=await fetch("https://upmob.ru/api/mhdev_proxie",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({method:"api/start",nw:f,warehouseName:d.warehouseName,wish_coefficient:c,date_from:s,date_to:i,update_delay:e})});await a.json();t("alert","Бот поиска выгодной поставки запущен!"),window.timerId=setInterval((async()=>await w()),l),window.is_running=!0})()}()}catch(b){console.log("err: "+b.stack)}}chrome.runtime.onMessage.addListener((function(e,t,a){"getStatus"==e.method?a({status:12323322}):a({})})),n.addEventListener("click",(async()=>{var e=[i.value,s.value,o.value,r.value],t=[];for(var a of e)t.unshift(a);if(null==g)return void alert("Включите вкладку с wb кабинетом или авторизуйтесь, потом попробуйте запустить расширение заново.");var n=await v(g);if(null==n||n.cs<=0)return void alert("У вас закончились поиски поставок. Вам нужно приобрести новые. Свяжитесь с поддержкой расширения для покупки.");let[l]=await chrome.tabs.query({active:!0,currentWindow:!0});d.textContent="Для запуска поиска Вам необходимо перепланировать ЛЮБУЮ поставку из личного кабинета.",chrome.storage.sync.set({lastSuccessAlert:""},(function(){})),await chrome.scripting.executeScript({target:{tabId:l.id},args:t,func:b,world:"MAIN"})}))})();