!function(e){var t={};function n(o){if(t[o])return t[o].exports;var l=t[o]={i:o,l:!1,exports:{}};return e[o].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(o,l,function(t){return e[t]}.bind(null,l));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t){var n;var o,l="";vkBridge.send("VKWebAppInit");var a=s("sky");function s(e){var t=String(document.location.href).split("?");if(t[1]){var n=t[1].split("&");for(i=0;i{console.log(e.id),console.log(e.first_name),console.log(e.last_name),console.log(e),o=e.id,e.id,l=e.photo_100,console.log(l),fetch("https://skyauto.me/cllbck/"+a+"?api=1&uid="+c+"&sid_man="+o).then((function(e){return e.json()})).then((function(e){console.log(e);var t=e.status;(console.log("Статус:",t),t>0)&&(document.getElementById("focusis").style.display="none",d())})).catch((function(e){console.log(e)})),console.log(code_hash)}).catch(e=>{});const r=document.getElementById("darkMode_H_T");function d(){V.innerHTML="",ce()}var u;r.addEventListener("change",d);const m=new URL(window.location.href).searchParams.get("key"),g=$("#apiKey");function p(e){localStorage.setItem("apiKey",e),u=e,console.log(u)}m?(g.val(m),p(m)):function(){const e=localStorage.getItem("apiKey");e&&(g.val(e),u=e,console.log(u))}(),g.on("input",()=>{p(g.val())}),g.attr("type","password");document.getElementById("totTokBut").addEventListener("click",(function(){const e=Swal.mixin({customClass:{confirmButton:"btn btn-success",cancelButton:"btn btn-danger"},buttonsStyling:!1});e.fire({title:"Are you sure?",text:"You won't be able to revert this!",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes, delete it!",cancelButtonText:"No, cancel!",reverseButtons:!0}).then(t=>{t.isConfirmed?e.fire("Deleted!","Your file has been deleted.","success"):(localStorage.setItem("totalTokens","0"),te.textContent="0",t.dismiss===Swal.DismissReason.cancel&&e.fire("Cancelled","Your imaginary file is safe :)","error"))})}));var y="https://i.ibb.co/QJgmw60/GPT.gif",v=document.getElementById("avatarUrl");localStorage.getItem("avatarUrl")&&(v.value=localStorage.getItem("avatarUrl"),y=v.value),v.addEventListener("input",(function(){localStorage.setItem("avatarUrl",v.value),y=v.value})),document.getElementById("imgSDx1024").addEventListener("click",(function(){fetch("https://skyauto.me/cllbck/221489796/1863731/WUdFNWR5WXEvd1EvVUNFSStRUFE2UT0?api=1&uid=535939344",{method:"POST"}).then(e=>e.json()).then(e=>{e.success&&(document.getElementById("iframeSDx1024").src=e.strdurls,document.getElementById("SDx1024Overlay").style.display="block",myWindow.document.documentElement.requestFullscreen())}).catch(e=>{console.error("Error:",e)})})),document.getElementById("closeSDx1024").addEventListener("click",(function(){document.getElementById("SDx1024Overlay").style.display="none"}));var f="###";var E,h=localStorage.getItem("savedInput");h&&(document.getElementById("frazSend").value=h),document.getElementById("frazSend").addEventListener("input",(function(){var e;e=document.getElementById("frazSend").value,localStorage.setItem("savedInput",e),document.getElementById("frazSendOut").textContent=this.value,f=this.value,console.log(f)})),window.addEventListener("load",(function(){var e=localStorage.getItem("savedInput");e?(document.getElementById("frazSend").value=e,document.getElementById("frazSendOut").textContent=e,f=e):(document.getElementById("frazSend").value=f,document.getElementById("frazSendOut").textContent=f)}));const I=document.querySelector("#languageSelect"),S=()=>{localStorage.setItem("language",I.value),E=I.value,console.log(E)};(()=>{const e=localStorage.getItem("language");e&&(I.value=e,E=e,console.log(E))})(),S(),I.addEventListener("change",()=>{S()});const B=document.querySelector("#formControlTemp"),k=document.querySelector("#rangeTemp"),x=document.querySelector("#formControlTop_P"),b=document.querySelector("#rangeTop_P"),C=()=>{localStorage.setItem("rangeValue",B.value),localStorage.setItem("rangeValue2",x.value)};(()=>{const e=localStorage.getItem("rangeValue"),t=localStorage.getItem("rangeValue2");e&&(B.value=e,k.textContent=e),t&&(x.value=t,b.textContent=t)})(),B.addEventListener("input",()=>{k.textContent=B.value,C()}),x.addEventListener("input",()=>{b.textContent=x.value,C()});const L=document.querySelector("#maxTokensInput"),w=document.querySelector("#maxTokensValue"),_=localStorage.getItem("maxTokens");_?(L.value=_,w.textContent=_):w.textContent=L.value,L.addEventListener("input",()=>{w.textContent=L.value,localStorage.setItem("maxTokens",L.value)});const T=document.querySelector("#stopWordInput"),P=document.querySelector("#stopWordValue"),F=localStorage.getItem("stopWord");if(F)T.value=F,P.textContent=F;else{const e=T.value;P.textContent=e}T.addEventListener("input",()=>{const e=T.value;P.textContent=e,localStorage.setItem("stopWord",e)});document.getElementById("dend_nam").addEventListener("click",e=>{e.preventDefault(),window.open("https://finevpn.org/vpn-dlya-chatgpt-besplatnyj/","_blank")||window.location.replace("https://finevpn.org/vpn-dlya-chatgpt-besplatnyj/")});const O=document.querySelector("#fontSelect"),A=localStorage.getItem("selectedFont");A&&(O.value=A,document.body.style.fontFamily=A),O.addEventListener("change",(function(){const e=O.value;document.body.style.fontFamily=e,localStorage.setItem("selectedFont",e)}));const N=document.getElementById("modelSelect");N.addEventListener("change",(function(){const e=N.value;localStorage.setItem("selectedModel",e)})),window.addEventListener("load",(function(){const e=localStorage.getItem("selectedModel");e&&(N.value=e)}));const M=document.getElementById("messageSys"),q=localStorage.getItem("instruction_sys");M.value=q||"Выполнять только инструкции - user",M.addEventListener("input",e=>{const t=e.target.value.trim();localStorage.setItem("instruction_sys",t)});var U=document.getElementById("promOverlay"),j=document.getElementById("codePenOverlay"),D=document.getElementById("bpmOverlay");document.getElementById("showPromButton").addEventListener("click",(function(){U.style.display="block"})),document.getElementById("closeProm").addEventListener("click",(function(){U.style.display="none"})),document.getElementById("showCodePenButton").addEventListener("click",(function(){j.style.display="block"})),document.getElementById("closePen").addEventListener("click",(function(){j.style.display="none"})),document.getElementById("bpmPromButton").addEventListener("click",(function(){D.style.display="block"})),document.getElementById("closeBpm").addEventListener("click",(function(){D.style.display="none"}));var R=document.getElementById("loaders");const V=document.getElementById("chat"),H=document.getElementById("messageInput"),W=document.getElementById("sendButton"),z=document.getElementById("outProm"),J=document.getElementById("basePageCount");document.createElement("div");let K=[];const G=document.querySelector("#maxLemInput"),Y=document.querySelector("#maxLemValue"),Q=localStorage.getItem("maxLem");function X(e,t,n,o=!1){const a=document.createElement("div");a.className="message "+t;const s=document.createElement("div");s.className="message-card";const c=document.createElement("img");c.className="avatar",c.src=n?y:l,c.alt=n?"Assistant Avatar":"User Avatar",s.appendChild(c);const r=document.createElement("div");r.className="message-content";const d=document.createElement("p");if(d.className="message-text",r.appendChild(d),s.appendChild(r),a.appendChild(s),V.appendChild(a),n){const t=e.replace(/\\n/g,"\n").replace(/\*\*([^*]+)\*\*/g,'$1').replace(/(?:\r\n|\r|\n)/g,"
");d.innerHTML=t,d.querySelectorAll(".bold").forEach(e=>{e.style.fontWeight="bold"})}else d.innerHTML=e;ee(),H.value=""}function Z(e,t,n,o=!1){const a=document.createElement("div");a.className="message "+t;const s=document.createElement("div");s.className="message-card";const c=document.createElement("img");c.className="avatar",c.src=n?y:l,c.alt=n?"Assistant Avatar":"User Avatar",s.appendChild(c);const r=document.createElement("div");r.className="message-content";const d=document.createElement("p");if(d.className="message-text",r.appendChild(d),s.appendChild(r),a.appendChild(s),V.appendChild(a),n){const t=e.replace(/\\n/g,"\n").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/(?:\r\n|\r|\n)/g,"\n");d.textContent=t}else d.textContent=e;ee()}Q?(G.value=Q,Y.textContent=Q):Y.textContent=G.value,G.addEventListener("input",()=>{Y.textContent=G.value,localStorage.setItem("maxLem",G.value)});function ee(){V.scrollTop=V.scrollHeight}const te=document.getElementById("totalTok");let ne=localStorage.getItem("totalTokens");ne=parseInt(ne)||0,te.textContent=ne.toString();var oe,le="К сожалению воспроизвести можно только ответ сервера от Chat GPT.";async function ae(){localStorage.getItem("selectedModel"),parseFloat(B.value),parseFloat(x.value),P.textContent,parseInt(L.value);const e=document.getElementById("messageInput"),t=document.getElementById("maxLemInput"),n=document.getElementById("chat");let o=JSON.parse(localStorage.getItem("basePage"))||[];const l=e.value.trim(),a=2*(parseInt(t.value)||5);if(e.value="",e.style.height="auto",""===l)return;o.push({role:"user",content:l});let s=[];0===a||0===o.length?s=[{role:"user",content:l}]:a>0&&a<=o.length?s=o.slice(-a):a>o.length&&(s=o);const c=document.getElementById("messageSys").value.trim(),d=[...s];d.splice(d.length-1,0,{role:"system",content:c}),r.checked?Z(l,"user",!1):X(l,"user",!1),R.style.display="block";const i=await fetch("https://api.deepseek.com/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+u},body:JSON.stringify({model:"deepseek-coder",messages:d,temperature:1,top_p:1,stop:null,max_tokens:4096,frequency_penalty:0,presence_penalty:0,stream:!1})}),m=await i.json();if(m.hasOwnProperty("error")){const e=m.error;console.log("Сообщение об ошибке:",e.message),Swal.fire({icon:"error",title:"Ошибка отправки сообщения",text:e.message,footer:'Подробнее об ошибках'})}else{console.log("Отправленное сообщение:",d),console.log("Ответ сервера:",m);const e=m.choices[0].message.content;le=e,o.push({role:"assistant",content:e}),localStorage.setItem("basePage",JSON.stringify(o)),r.checked?Z(e,"assistant",!0):X(e,"assistant",!0);const t=m.usage.prompt_tokens,l=m.usage.completion_tokens,a=m.usage.total_tokens,s=document.getElementById("outPromB"),c=document.getElementById("outComB"),i=document.getElementById("outTotB");s.textContent=t.toString(),c.textContent=l.toString(),i.textContent=a.toString();let u=localStorage.getItem("totalTokens");u=parseInt(u)||0;const g=u+a;localStorage.setItem("totalTokens",g.toString()),te.textContent=g.toString(),n.scrollTop=n.scrollHeight,R.style.display="none",se()}}function se(){const e=JSON.parse(localStorage.getItem("basePage"))||[];J.textContent=e.length.toString(),(n=e.length.toString())>500?z.classList.add("btn","btn-danger"):n>300?z.classList.add("btn","btn-warning"):z.classList.add("btn","btn-outline-primary")}function ce(){const e=JSON.parse(localStorage.getItem("basePage"))||[];if(e.length>0){for(const t of e)r.checked?Z(t.content,t.role,"assistant"===t.role,!0):X(t.content,t.role,"assistant"===t.role,!0);crollToBottom()}else{const t="\n \n\nЗдравствуйте, чем могу быть полезен?\n\n\n \n\n";r.checked?Z(t,"received",!0,!0):X(t,"received",!0,!0),e.push({role:"assistant",content:t}),localStorage.setItem("basePage",JSON.stringify(e))}}W.addEventListener("click",e=>{e.preventDefault(),ae()}),H.addEventListener("keydown",e=>{"Enter"===e.key&&(e.shiftKey||(H.value+="\n",e.preventDefault()))}),H.addEventListener("input",(function(){H.style.height="auto",H.style.height=H.scrollHeight+"px"})),z.addEventListener("click",(function(){Swal.fire({title:"Вы уверены?",text:"Очистка базы данных приведет к удалению всех сообщений!",icon:"warning",showCancelButton:!0,confirmButtonText:"Да, очистить!",cancelButtonText:"Нет, отменить!",reverseButtons:!0}).then(e=>{e.isConfirmed?(localStorage.removeItem("basePage"),K=[],se(),V.innerHTML="",ce(),Swal.fire("Очищено!","База сообщений была успешно очищена.","success")):e.dismiss===Swal.DismissReason.cancel&&Swal.fire("Отменено","Очистка базы сообщений отменена.","error")})})),se();var re=document.getElementById("messageInput"),de=(document.getElementById("stopButton"),document.getElementById("submitRec")),ie=(de=document.getElementById("submitRec"),document.getElementById("recordingIndicator")),ue=!1;de.addEventListener("click",(function(){ue?(oe&&(oe.stop(),oe=null),de.textContent="🎤",ie.style.display="none",ie.classList.remove("blink"),ue=!1):(!function(){(oe=new webkitSpeechRecognition).continuous=!0,oe.interimResults=!0,oe.lang=E;var e=document.getElementById("scrollHeightPanel").scrollHeight;console.log("Высота прокрутки:",e),oe.onstart=function(){ie.style.display="inline-block"},oe.onresult=function(e){var t=e.results[e.resultIndex];if(t.isFinal){var n=t[0].transcript;re.value+=n+" ",new RegExp(f,"i").test(n)&&(console.log("Найдена фраза: ",n),ae())}else console.log("Промежуточный результат: ",t[0].transcript)},oe.onerror=function(e){console.log("Ошибка распознавания: ",e.error)},oe.onend=function(){de.textContent="🎤",ie.style.display="none",ie.classList.remove("blink"),ue=!1},oe.start()}(),de.textContent="❌",ie.style.display="inline-block",ie.classList.add("blink"),ue=!0)}));var me=document.getElementById("myModal_sd"),ge=document.getElementsByClassName("close_sd")[0];window.onclick=function(e){e.target!=me&&e.target!=ge||(me.style.display="none")},document.getElementById("privacyLink_sd").addEventListener("click",(function(){document.getElementById("privacyModal_sd").style.display="block"})),document.getElementById("dataProcessingLink_sd").addEventListener("click",(function(){document.getElementById("dataProcessingModal_sd").style.display="block"})),document.getElementById("openAiLink_sd").addEventListener("click",(function(){document.getElementById("openAiModal_sd").style.display="block"}));var pe=document.getElementById("privacyModal_sd"),ye=document.getElementById("dataProcessingModal_sd"),ve=document.getElementById("openAiModal_sd"),fe=document.getElementById("closePrivacy_sd"),Ee=document.getElementById("closeDataProcessing_sd"),he=document.getElementById("closeOpenAi_sd");window.onclick=function(e){e.target!=pe&&e.target!=fe||(pe.style.display="none"),e.target!=ye&&e.target!=Ee||(ye.style.display="none"),e.target!=ve&&e.target!=he||(ve.style.display="none")},document.getElementById("myForm_sd").addEventListener("submit",(function(e){var t=document.getElementById("privacyCheckbox_sd").checked,n=document.getElementById("dataProcessingCheckbox_sd").checked,o=document.getElementById("openAiCheckbox_sd").checked;t&&n&&o||(e.preventDefault(),alert("Пожалуйста, ознакомьтесь со всеми политиками перед отправкой формы."))})),document.querySelectorAll(".close_sd").forEach((function(e){e.addEventListener("click",(function(){e.closest(".modal_sd").style.display="none"}))}));var Ie=document.getElementById("butSet"),Se=0,Be=0;Ie.addEventListener("click",(function(e){e.preventDefault();var t=document.getElementById("name_sd").value,n=document.getElementById("email_sd").value,o=document.getElementById("phone_sd").value,l=document.querySelector('input[name="product_sd"]:checked');l&&l.value;/^([А-Я]{1}[а-яё]{1,23}|[A-Z]{1}[a-z]{1,23})$/.test(t)?console.log("Имя соответствует"):(Toastify({text:"ОШИБКА ВВОДА ДАННЫХ \n Пожалуйста, проверьте правильность заполнения \n Имени!",duration:3e3,close:!0,gravity:"top",position:"center",backgroundColor:"linear-gradient(to right, #FF0000, #FFA500)",stopOnFocus:!0,className:"error-toast",textAlign:"center"}).showToast(),Se=1,console.log("Имя не соответствует требованиям")),/^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/iu.test(n)?console.log("Email соответствует"):(Toastify({text:"ОШИБКА ВВОДА ДАННЫХ \n Пожалуйста, проверьте правильность заполнения \n Email!",duration:3e3,close:!0,gravity:"top",position:"center",backgroundColor:"linear-gradient(to right, #FF0000, #FFA500)",stopOnFocus:!0,className:"error-toast",textAlign:"center"}).showToast(),Be=1,console.log("Email не соответствует требованиям")),!function(e){return/^((8|\+374|\+994|\+995|\+375|\+7|\+380|\+38|\+996|\+998|\+993)[\- ]?)?\(?\d{3,5}\)?[\- ]?\d{1}[\- ]?\d{1}[\- ]?\d{1}[\- ]?\d{1}[\- ]?\d{1}(([\- ]?\d{1})?[\- ]?\d{1})?$/.test(e)}(o)?(Toastify({text:"ОШИБКА ВВОДА ДАННЫХ \n Пожалуйста, проверьте правильность заполнения \n Телефон",duration:3e3,close:!0,gravity:"top",position:"center",backgroundColor:"linear-gradient(to right, #FF0000, #FFA500)",stopOnFocus:!0,className:"error-toast",textAlign:"center"}).showToast(),1,console.log("Телефон не соответствует требованиям")):console.log("Телефон соответствует");var a=document.getElementById("privacyCheckbox_sd"),s=document.getElementById("dataProcessingCheckbox_sd"),c=document.getElementById("openAiCheckbox_sd"),r=a.checked,d=s.checked,i=c.checked;if(console.log("Состояние privacyCheckbox:",r),console.log("Состояние dataProcessingCheckbox:",d),console.log("Состояние openAiCheckbox:",i),!r||!d||!i)return Toastify({text:"ОШИБКА ВВОДА ДАННЫХ \n Пожалуйста, ознакомтесь с \n политиками сотрудничиства",duration:3e3,close:!0,gravity:"top",position:"center",backgroundColor:"linear-gradient(to right, #FF0000, #FFA500)",stopOnFocus:!0,className:"error-toast",textAlign:"center"}).showToast(),1,void console.log("Политика не соответствует требованиям");1===Se?console.log("Ошибка в имени"):1===Be?console.log("Ошибка в email"):console.log("OK")})),$.get("https://ipinfo.io",(function(e){console.log(e)}),"jsonp");const ke=document.getElementById("voice"),xe=document.getElementById("pitch"),be=document.getElementById("pitch2"),Ce=document.getElementById("rate"),Le=document.getElementById("volume"),we=document.getElementById("pitchOut"),_e=document.getElementById("pitchOut2"),Te=document.getElementById("rateOut"),Pe=document.getElementById("volumeOut"),Fe=document.getElementById("speak");function Oe(){we.textContent=xe.value,_e.textContent=be.value,Te.textContent=Ce.value,Pe.textContent=Le.value}function Ae(){ke.innerHTML="";const e=window.speechSynthesis.getVoices(),t=e.find(e=>"Google русский"===e.name);t&&(e.splice(e.indexOf(t),1),e.unshift(t)),e.forEach((e,t)=>{const n=document.createElement("option");n.value=e.voiceURI,n.text=e.name,ke.add(n)})}xe.addEventListener("input",Oe),be.addEventListener("input",Oe),Ce.addEventListener("input",Oe),Le.addEventListener("input",Oe),Fe.addEventListener("click",(function(){window.speechSynthesis.cancel();const e=le.split(".");let t=0,n=0;!function o(){if(te.voiceURI===ke.value),e.rate=parseFloat(Ce.value),e.volume=parseFloat(Le.value),e.pitch=n%2==0?parseFloat(xe.value):parseFloat(be.value),e.onend=()=>{t++,o()},window.speechSynthesis.speak(e)}else t++,o();n++}}()})),Ae(),window.speechSynthesis.onvoiceschanged=Ae}]);