@kudoai/chatgpt.js 2.6.5 → 2.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.4/dist/chatgpt-2.6.4.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
84
84
  // Your code here...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest();
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.4/dist/chatgpt-2.6.4.min.js');
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
93
93
  xhr.onload = function () {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script');
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.4/dist/chatgpt-2.6.4.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // Your code here...
package/chatgpt.js CHANGED
@@ -898,16 +898,16 @@ const chatgpt = {
898
898
  getChatInput: function() { return chatgpt.getChatBox().value; },
899
899
 
900
900
  getContinueGeneratingButton: function() {
901
- for (const formButton of document.querySelectorAll('form button')) {
902
- if (formButton.textContent.toLowerCase().includes('continue')) {
903
- return formButton;
904
- }}},
901
+ document.querySelectorAll('button svg').forEach(svg => {
902
+ if (svg.querySelector('polygon[points*="11 19 2 12 11 5 11 19"]')) {
903
+ return svg.parentNode.parentNode;
904
+ }});},
905
905
 
906
906
  getLastPrompt: function() { return chatgpt.getChatData('active', 'msg', 'user', 'latest'); },
907
907
  getLastResponse: function() { return chatgpt.getChatData('active', 'msg', 'chatgpt', 'latest'); },
908
908
 
909
909
  getNewChatLink: function() {
910
- for (const navLink of document.querySelectorAll('nav[aria-label="Chat history"] a')) {
910
+ for (const navLink of document.querySelectorAll('nav a')) {
911
911
  if (/(new|clear) chat/i.test(navLink.text)) {
912
912
  return navLink;
913
913
  }}},
@@ -934,11 +934,10 @@ const chatgpt = {
934
934
  getSendButton: function() { return document.querySelector('form button[class*="bottom"]'); },
935
935
 
936
936
  getStopGeneratingButton: function() {
937
- for (const formButton of document.querySelectorAll('form button')) {
938
- const ariaLabel = formButton.getAttribute('aria-label');
939
- if (ariaLabel && ariaLabel.toLowerCase().includes('stop'))
940
- return formButton;
941
- }},
937
+ document.querySelectorAll('form button svg').forEach(svg => {
938
+ if (svg.querySelector('path[d*="2 0 0 1 2"]'))
939
+ return svg.parentNode;
940
+ });},
942
941
 
943
942
  getUserLanguage: function() {
944
943
  return navigator.languages[0] || navigator.language || navigator.browserLanguage ||
@@ -949,7 +948,7 @@ const chatgpt = {
949
948
  deactivate: function() { this.isOn() ? this.toggle() : console.info('Chat history is already disabled!'); },
950
949
 
951
950
  isOn: function() {
952
- const navDivs = document.querySelectorAll('nav[aria-label="Chat history"] div'),
951
+ const navDivs = document.querySelectorAll('nav div'),
953
952
  offDiv = [...navDivs].find(div => div.textContent.includes('Chat History is off')) || {};
954
953
  return offDiv.classList.toString().includes('invisible');
955
954
  },
@@ -959,14 +958,14 @@ const chatgpt = {
959
958
  isLoaded: function() {
960
959
  return new Promise(resolve => {
961
960
  const checkChatHistory = () => {
962
- if (document.querySelector('nav[aria-label="Chat history"]')) resolve(true);
961
+ if (document.querySelector('nav')) resolve(true);
963
962
  else setTimeout(checkChatHistory, 100);
964
963
  };
965
964
  checkChatHistory();
966
965
  });},
967
966
 
968
967
  toggle: function() {
969
- for (const navBtn of document.querySelectorAll('nav[aria-label="Chat history"] button')) {
968
+ for (const navBtn of document.querySelectorAll('nav button')) {
970
969
  if (/chat history/i.test(navBtn.textContent)) {
971
970
  navBtn.click(); return;
972
971
  }}}
@@ -1555,11 +1554,10 @@ const chatgpt = {
1555
1554
  }}},
1556
1555
 
1557
1556
  stopGenerating: function() {
1558
- for (const formButton of document.querySelectorAll('form button')) {
1559
- const ariaLabel = formButton.getAttribute('aria-label');
1560
- if (ariaLabel && ariaLabel.toLowerCase().includes('stop')) {
1561
- formButton.click(); return;
1562
- }}}
1557
+ document.querySelectorAll('form button svg').forEach(svg => {
1558
+ if (svg.querySelector('path[d*="2 0 0 1 2"]')) {
1559
+ svg.parentNode.click(); return;
1560
+ }});}
1563
1561
  },
1564
1562
 
1565
1563
  reviewCode: function() { chatgpt.code.review(); },
@@ -1587,7 +1585,7 @@ const chatgpt = {
1587
1585
 
1588
1586
  sendInNewChat: function(msg) {
1589
1587
  if (typeof msg !== 'string') return console.error('Message must be a string!');
1590
- for (const navLink of document.querySelectorAll('nav[aria-label="Chat history"] a')) {
1588
+ for (const navLink of document.querySelectorAll('nav a')) {
1591
1589
  if (/(new|clear) chat/i.test(navLink.text)) {
1592
1590
  navLink.click(); break;
1593
1591
  }} setTimeout(() => { chatgpt.send(msg); }, 500);
@@ -1718,7 +1716,7 @@ const chatgpt = {
1718
1716
  elements: [], observer: {},
1719
1717
 
1720
1718
  activateObserver: function() {
1721
- const chatHistoryNav = document.querySelector('nav[aria-label="Chat history"]'),
1719
+ const chatHistoryNav = document.querySelector('nav'),
1722
1720
  firstButton = chatHistoryNav.querySelector('a');
1723
1721
  if (chatgpt.history.isOff()) // Hide enable history spam div
1724
1722
  try { firstButton.parentNode.nextElementSibling.style.display = 'none'; } catch (err) {}
@@ -1731,7 +1729,7 @@ const chatgpt = {
1731
1729
 
1732
1730
  let cssClasses;
1733
1731
  // Grab CSS from original website elements
1734
- for (let navLink of document.querySelectorAll('nav[aria-label="Chat history"] a')) {
1732
+ for (let navLink of document.querySelectorAll('nav a')) {
1735
1733
  if (/.*chat/.exec(navLink.text)[0]) {
1736
1734
  cssClasses = navLink.classList;
1737
1735
  navLink.parentNode.style.margin = '2px 0'; // add v-margins to ensure consistency across all inserted buttons
@@ -1746,7 +1744,7 @@ const chatgpt = {
1746
1744
  element.style.margin = '2px 0';
1747
1745
  });
1748
1746
 
1749
- const navBar = document.querySelector('nav[aria-label="Chat history"]');
1747
+ const navBar = document.querySelector('nav');
1750
1748
  // Create MutationObserver instance
1751
1749
  this.observer = new MutationObserver(mutations => {
1752
1750
  mutations.forEach(mutation => {
@@ -1849,7 +1847,7 @@ const chatgpt = {
1849
1847
  },
1850
1848
 
1851
1849
  startNewChat: function() {
1852
- for (const navLink of document.querySelectorAll('nav[aria-label="Chat history"] a')) {
1850
+ for (const navLink of document.querySelectorAll('nav a')) {
1853
1851
  if (/(new|clear) chat/i.test(navLink.text)) {
1854
1852
  navLink.click(); return;
1855
1853
  }}},
@@ -1,7 +1,7 @@
1
- const endpoints={assets:"https://raw.githubusercontent.com/KudoAI/chatgpt.js/main",openAI:{session:"https://chat.openai.com/api/auth/session",chats:"https://chat.openai.com/backend-api/conversations",chat:"https://chat.openai.com/backend-api/conversation",share_create:"https://chat.openai.com/backend-api/share/create",share:"https://chat.openai.com/backend-api/share",instructions:"https://chat.openai.com/backend-api/user_system_messages"}},isChromeUserScript=(localStorage.alertQueue=JSON.stringify([]),localStorage.notifyProps=JSON.stringify({queue:{topRight:[],bottomRight:[],bottomLeft:[],topLeft:[]},lastNthAudio:0}),navigator.userAgent.includes("Chrome")&&"undefined"!=typeof unsafeWindow),isFFuserScript=navigator.userAgent.includes("Firefox")&&"undefined"!=typeof unsafeWindow,isFFtmScript=isFFuserScript&&"Tampermonkey"==GM_info.scriptHandler;let cjsMessages;isChromeUserScript||isFFuserScript&&!isFFtmScript||(async()=>{var e=new Promise(o=>{const r=navigator.languages[0]||navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage||"",a=endpoints.assets+"/data/_locales/",e=(r?r.replace("-","_"):"en")+"/";let s=a+e+"messages.json",i=0;!function t(){const n=new XMLHttpRequest;n.open("GET",s),n.send(),n.onload=()=>{try{var e=new Proxy(JSON.parse(n.responseText),{get(e,t){if("object"==typeof e[t]&&null!==e[t]&&"message"in e[t])return e[t].message}});o(e)}catch(e){3===++i&&o({}),s=r.includes("-")&&1===i?s.replace(/(.*)_.*(\/.*)/,"$1$2"):a+"en/messages.json",t()}},n.onerror=()=>{o({})}}()});cjsMessages=await e})();const chatgpt={openAIaccessToken:{},actAs:function(s){return new Promise((o,r)=>{const a=new XMLHttpRequest;a.open("GET","https://raw.githubusercontent.com/KudoAI/chat-prompts/main/dist/personas.min.json",!0),a.send(),a.onload=()=>{if(200!==a.status)return r("🤖 chatgpt.js >> Request failed. Cannot retrieve prompts data.");var e=JSON.parse(a.responseText).personas;if(s){var t=e.find(e=>e.title.toLowerCase()==s.toLowerCase());if(!t)return r(`🤖 chatgpt.js >> Persona '${s}' was not found!`);chatgpt.send(t.prompt,"click"),console.info(`Loading ${s} persona...`),chatgpt.isIdle().then(()=>{console.info("Persona activated!")})}else{console.log("\n%c🤖 chatgpt.js personas\n","font-family: sans-serif ; font-size: xxx-large ; font-weight: bold");for(const n of e)console.log("%c"+n.title,"font-family: monospace ; font-size: larger ;")}return o()}})},activateDarkMode:function(){document.documentElement.classList.replace("light","dark"),document.documentElement.style.colorScheme="dark",localStorage.setItem("theme","dark")},activateLightMode:function(){document.documentElement.classList.replace("dark","light"),document.documentElement.style.colorScheme="light",localStorage.setItem("theme","light")},alert:function(e,t,n,o,r){const a=chatgpt.isDarkMode()?"dark":"light",s=chatgpt.browser.isMobile(),i=document.createElement("div"),c=(i.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),i.classList.add("chatgpt-modal"),document.createElement("div")),l=document.createElement("h2"),u=document.createElement("p");var d=20231203;let g=document.querySelector("#chatgpt-modal-style");(!g||parseInt(g.getAttribute("last-updated"),10)<d)&&(g||((g=document.createElement("style")).id="chatgpt-modal-style",g.setAttribute("last-updated",d.toString()),document.head.append(g)),g.innerText=".chatgpt-modal {position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ;background-color: rgba(67, 70, 72, 0) ;transition: background-color 0.05s ease ;display: flex ; justify-content: center ; align-items: center ; z-index: 9999 }.chatgpt-modal > div {opacity: 0 ; transform: translateX(-2px) translateY(5px) ; max-width: 75vw ; word-wrap: break-word ;transition: opacity 0.1s cubic-bezier(.165,.84,.44,1), transform 0.2s cubic-bezier(.165,.84,.44,1) ;"+`background-color: ${"dark"==a?"black":"white"} ;`+("dark"!=a?"border: 1px solid rgba(0, 0, 0, 0.3) ;":"")+"padding: 20px ; margin: 12px 23px ; border-radius: 15px ; box-shadow: 0 30px 60px rgba(0, 0, 0, .12) ; -webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none ; user-select: none ; }.chatgpt-modal h2 { margin-bottom: 9px }"+`.chatgpt-modal a { color: ${"dark"==a?"#00cfff":"#1e9ebb"}}`+".chatgpt-modal.animated > div { opacity: 1 ; transform: translateX(0) translateY(0) }@keyframes alert-zoom-fade-out { 0% { opacity: 1 ; transform: scale(1) }50% { opacity: 0.25 ; transform: scale(1.05) }100% { opacity: 0 ; transform: scale(1.35) }}.modal-buttons { display: flex ; justify-content: flex-end ; margin: 20px -5px -3px 0 ;"+(s?"flex-direction: column-reverse":"")+"}.chatgpt-modal button {"+`margin-left: ${s?0:10}px ; padding: ${s?15:4}px 18px ; border-radius: 15px ;`+(s?"margin-top: 5px ; margin-bottom: 3px ;":"")+`border: 1px solid ${"dark"==a?"white":"black"}}`+".primary-modal-btn {"+`border: 1px solid ${"dark"==a?"white":"black"} ;`+`background: ${"dark"==a?"white":"black"} ;`+`color: ${"dark"==a?"black":"white"}}`+".chatgpt-modal button:hover { color: #3d5d71 ; border-color: #6d9cb9 ;background-color: "+("dark"==a?"#00cfff":"#9cdaff")+";box-shadow: 2px 1px "+("dark"==a?"54px #00cfff":"30px #9cdaff")+"}.modal-close-btn {cursor: pointer ; width: 20px ; height: 20px ; float: right ; position: relative ; right: -2px }.modal-close-btn svg { margin: 5px 5px }"+`.modal-close-btn:hover { background-color: #f2f2f2${"dark"==a?"00":""}}`+".chatgpt-modal .checkbox-group { display: flex ; margin-top: -18px }.chatgpt-modal .checkbox-group label {font-size: .7rem ; margin: -.04rem 0 0px .3rem ;"+`color: ${"dark"==a?"#e1e1e1":"#1e1e1e"}}`+'.chatgpt-modal input[type="checkbox"] { transform: scale(0.7) ;'+`border: 1px solid ${"dark"==a?"white":"black"}}`+'.chatgpt-modal input[type="checkbox"]:checked {'+`border: 1px solid ${"dark"==a?"white":"black"} ;`+'background-color: black ; position: inherit }.chatgpt-modal input[type="checkbox"]:focus { outline: none ; box-shadow: none }'),l.innerText=e||"",u.innerText=t||"",this.renderHTML(u);const p=document.createElement("div");p.classList.add("modal-buttons"),n&&(n=Array.isArray(n)?n:[n]).forEach(e=>{var t=document.createElement("button");t.textContent=e.name.replace(/[_-]\w/g,e=>e.slice(1).toUpperCase()).replace(/([A-Z])/g," $1").replace(/^\w/,e=>e.toUpperCase()),t.addEventListener("click",()=>{b(),e()}),p.insertBefore(t,p.firstChild)});d=document.createElement("button"),d.textContent=n?"Dismiss":"OK",p.insertBefore(d,p.firstChild),p.lastChild.classList.add("primary-modal-btn"),e=document.createElement("div");if(o){e.classList.add("checkbox-group");const w=o,v=document.createElement("input");v.type="checkbox",v.addEventListener("change",w);t=document.createElement("label");t.addEventListener("click",()=>{v.checked=!v.checked,w()}),t.textContent=w.name.charAt(0).toUpperCase()+w.name.slice(1).replace(/([A-Z])/g,(e,t)=>" "+t.toLowerCase()).replace(/\b(\w+)nt\b/gi,"$1n't").trim(),e.append(v),e.append(t)}n=document.createElement("div"),n.title=cjsMessages?.tooltip_close||"Close",n.classList.add("modal-close-btn"),o=document.createElementNS("http://www.w3.org/2000/svg","svg"),o.setAttribute("height","10px"),o.setAttribute("viewBox","0 0 14 14"),o.setAttribute("fill","none"),t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("fill-rule","evenodd"),t.setAttribute("clip-rule","evenodd"),t.setAttribute("fill",chatgpt.isDarkMode()?"white":"black"),t.setAttribute("d","M13.7071 1.70711C14.0976 1.31658 14.0976 0.683417 13.7071 0.292893C13.3166 -0.0976312 12.6834 -0.0976312 12.2929 0.292893L7 5.58579L1.70711 0.292893C1.31658 -0.0976312 0.683417 -0.0976312 0.292893 0.292893C-0.0976312 0.683417 -0.0976312 1.31658 0.292893 1.70711L5.58579 7L0.292893 12.2929C-0.0976312 12.6834 -0.0976312 13.3166 0.292893 13.7071C0.683417 14.0976 1.31658 14.0976 1.70711 13.7071L7 8.41421L12.2929 13.7071C12.6834 14.0976 13.3166 14.0976 13.7071 13.7071C14.0976 13.3166 14.0976 12.6834 13.7071 12.2929L8.41421 7L13.7071 1.70711Z"),o.append(t),n.append(o),[n,l,u,p,e].forEach(e=>{c.append(e)}),c.style.width=`${r||458}px`,i.append(c),document.body.append(i);let h=JSON.parse(localStorage.alertQueue);h.push(i.id),localStorage.alertQueue=JSON.stringify(h),i.style.display="none",1===h.length&&(i.style.display="",setTimeout(()=>{i.style.backgroundColor=`rgba(67, 70, 72, ${"dark"==a?.62:0})`,i.classList.add("animated")},100));const f=e=>{(e.target==e.currentTarget||e.target instanceof SVGPathElement)&&b()},m=e=>{if([13,27].includes(e.keyCode))for(const n of h){var t=document.getElementById(n);if(t&&"none"!==t.style.display)return void(27===e.keyCode?b():13===e.keyCode&&(t=t.querySelector(".modal-buttons").lastChild)&&(t.click(),e.preventDefault()))}},y=[i,n,o,d],b=(y.forEach(e=>{e.addEventListener("click",f)}),document.addEventListener("keydown",m),()=>{i.style.backgroundColor="transparent",c.style.animation="alert-zoom-fade-out 0.075s ease-out",setTimeout(()=>{if(i.remove(),(h=JSON.parse(localStorage.alertQueue)).shift(),localStorage.alertQueue=JSON.stringify(h),y.forEach(e=>{e.removeEventListener("click",f)}),document.removeEventListener("keydown",m),0<h.length){const e=document.getElementById(h[0]);setTimeout(()=>{e.style.display="",setTimeout(()=>{e.classList.add("animated")},100)},500)}},50)});return i.id},askAndGetReply:async function(e){return chatgpt.send(e),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")},autoRefresh:{activate:function(e){if(this.isActive)console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh already active!");else{const n=this,o=(this.toggle.refreshFrame(),t=>{var e=Math.max(2,Math.floor(21*chatgpt.randomFloat()-10));n.isActive=setTimeout(()=>{var e=document.querySelector('script[src*="_ssgManifest.js"]');document.querySelector("#refresh-frame").src=e.src+"?"+Date.now(),console.log("↻ ChatGPT >> ["+n.nowTimeStamp()+"] ChatGPT session refreshed"),o(t)},1e3*(t+e))});o(e?parseInt(e,10):30),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh activated"),navigator.userAgent.includes("Chrome")&&void 0!==document.hidden&&document.addEventListener("visibilitychange",this.toggle.beacons)}},deactivate:function(){this.isActive?(this.toggle.refreshFrame(),document.removeEventListener("visibilitychange",this.toggle.beacons),clearTimeout(this.isActive),this.isActive=null,console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh de-activated")):console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh already inactive!")},nowTimeStamp:function(){var e=new Date,t=e.getHours()%12||12;let n=e.getMinutes(),o=e.getSeconds();n<10&&(n="0"+n),o<10&&(o="0"+o);e=e.getHours()<12?"AM":"PM";return t+":"+n+":"+o+" "+e},toggle:{beacons:function(){chatgpt.autoRefresh.beaconID?(clearInterval(chatgpt.autoRefresh.beaconID),chatgpt.autoRefresh.beaconID=null,console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacons de-activated")):(chatgpt.autoRefresh.beaconID=setInterval(()=>{navigator.sendBeacon("https://httpbin.org/post",new Uint8Array),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacon sent")},9e4),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacons activated"))},refreshFrame:function(){let e=document.querySelector("#refresh-frame");e?e.remove():(e=Object.assign(document.createElement("iframe"),{id:"refresh-frame",style:"display: none"}),document.head.prepend(e))}}},browser:{isLightMode:function(){return window.matchMedia?.("(prefers-color-scheme: light)")?.matches},isDarkMode:function(){return window.matchMedia?.("(prefers-color-scheme: dark)")?.matches},isChromium:function(){return navigator.userAgent.includes("Chrome")},isFirefox:function(){return navigator.userAgent.includes("Firefox")},isFullScreen:function(){var e=navigator.userAgent;return e.includes("Chrome")?window.matchMedia("(display-mode: fullscreen)").matches:e.includes("Firefox")?window.fullScreen:/MSIE|rv:/.test(e)?document.msFullscreenElement:document.webkitIsFullScreen},isMobile:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}},clearChats:async function(e){var t=["api","dom"];if((e=(e||"dom").trim().toLowerCase())&&!t.includes(e))return console.log(`Method argument must be one of: [${t}]`);if("dom"!=e)return new Promise((n,o)=>{chatgpt.getAccessToken().then(e=>{const t=new XMLHttpRequest;t.open("PATCH",endpoints.openAI.chats,!0),t.setRequestHeader("Content-Type","application/json"),t.setRequestHeader("Authorization","Bearer "+e),t.onload=()=>{if(200!==t.status)return o("🤖 chatgpt.js >> Request failed. Cannot clear chats.");console.info("Chats successfully cleared"),n()},t.send(JSON.stringify({is_visible:!1}))}).catch(o)});{try{await chatgpt.getChatData()}catch{return}chatgpt.menu.open(),setTimeout(()=>{for(const e of document.querySelectorAll('a[role="menuitem"]')||[])if(/settings/i.test(e.text)){e.click();break}setTimeout(()=>{for(const e of document.querySelectorAll("[id*=radix] button"))if(/^clear/i.test(e.textContent)){e.click();break}setTimeout(()=>{document.querySelector("[id*=radix] button").click(),setTimeout(()=>{n();try{document.querySelector("#prompt-textarea").focus()}catch(e){}},10)},10)},333)},10);const n=()=>{document.querySelector("div[id*=radix] button").click()}}},code:{execute:async function(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Display the output as if you were terminal:\n\n"+e),console.info("Executing code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},extract:function(e){var t=e.match(/(?<=```.*\n)[\s\S]*?(?=```)/g);return t?t[t.length-1]:e},minify:async function(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Minify the following code:\n\n"+e),console.info("Minifying code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},obfuscate:async function(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Obfuscate the following code:\n\n"+e),console.info("Obfuscating code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},refactor:async function(e,t){if(!e)return console.error("Code (1st) argument not supplied. Pass some code!");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send("Refactor the following code for "+(t||"brevity")+":\n\n"+e),console.info("Refactoring code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))},review:async function(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Review the following code for me:\n\n"+e),console.info("Reviewing code..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")):console.error("Code argument not supplied. Pass some code!")},unminify:async function(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Unminify the following code.:\n\n"+e),console.info("Unminifying code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},write:async function(e,t){if(!e)return console.error("Prompt (1st) argument not supplied. Pass a prompt!");if(!t)return console.error("outputLang (2nd) argument not supplied. Pass a language!");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send(e+"\n\nWrite this as code in "+t),console.info("Writing code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))}},detectLanguage:async function(e){return e?"string"!=typeof e?console.error("Text argument must be a string!"):(chatgpt.send("Detect the language of the following text:\n\n"+e+"\n\nOnly respond with the name of the language"),console.info("Reviewing text..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")):console.error("Text argument not supplied. Pass some text!")},executeCode:function(){chatgpt.code.execute()},exportChat:async function(e,t){e=e?Number.isInteger(e)||/^\d+$/.test(e)?parseInt(e,10):e:"active",t=t.toLowerCase()||"html",console.info("Generating transcript...");let o="",n;if(/te?xt/.test(t)){var r=new Date,a=r.getDate().toString().padStart(2,"0"),s=(r.getMonth()+1).toString().padStart(2,"0"),i=r.getFullYear(),c=r.getHours().toString().padStart(2,"0"),r=r.getMinutes().toString().padStart(2,"0");if(n=`ChatGPT_${a}-${s}-${i}_${c}-${r}.txt`,"active"==e&&/\/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/.test(window.location.href)){a=document.querySelectorAll("main > div > div > div > div > div > div[class*=group]");if(0===a.length)return console.error("Chat is empty!");const l=[];let n=!0;a.forEach(e=>{var t=n?"USER":"CHATGPT",e=(n=!n,Array.from(e.childNodes).map(e=>e.innerText).join("\n\n").replace("Copy code",""));l.push(t+": "+e)}),o=l.join("\n\n")}else for(const u of await chatgpt.getChatData(e,"msg","both","all"))o=(o+=`USER: ${u.user}
1
+ const endpoints={assets:"https://raw.githubusercontent.com/KudoAI/chatgpt.js/main",openAI:{session:"https://chat.openai.com/api/auth/session",chats:"https://chat.openai.com/backend-api/conversations",chat:"https://chat.openai.com/backend-api/conversation",share_create:"https://chat.openai.com/backend-api/share/create",share:"https://chat.openai.com/backend-api/share",instructions:"https://chat.openai.com/backend-api/user_system_messages"}},isChromeUserScript=(localStorage.alertQueue=JSON.stringify([]),localStorage.notifyProps=JSON.stringify({queue:{topRight:[],bottomRight:[],bottomLeft:[],topLeft:[]},lastNthAudio:0}),navigator.userAgent.includes("Chrome")&&"undefined"!=typeof unsafeWindow),isFFuserScript=navigator.userAgent.includes("Firefox")&&"undefined"!=typeof unsafeWindow,isFFtmScript=isFFuserScript&&"Tampermonkey"==GM_info.scriptHandler;let cjsMessages;isChromeUserScript||isFFuserScript&&!isFFtmScript||(async()=>{var e=new Promise(o=>{const r=navigator.languages[0]||navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage||"",a=endpoints.assets+"/data/_locales/",e=(r?r.replace("-","_"):"en")+"/";let s=a+e+"messages.json",i=0;!function t(){const n=new XMLHttpRequest;n.open("GET",s),n.send(),n.onload=()=>{try{var e=new Proxy(JSON.parse(n.responseText),{get(e,t){if("object"==typeof e[t]&&null!==e[t]&&"message"in e[t])return e[t].message}});o(e)}catch(e){3===++i&&o({}),s=r.includes("-")&&1===i?s.replace(/(.*)_.*(\/.*)/,"$1$2"):a+"en/messages.json",t()}},n.onerror=()=>{o({})}}()});cjsMessages=await e})();const chatgpt={openAIaccessToken:{},actAs:function(s){return new Promise((o,r)=>{const a=new XMLHttpRequest;a.open("GET","https://raw.githubusercontent.com/KudoAI/chat-prompts/main/dist/personas.min.json",!0),a.send(),a.onload=()=>{if(200!==a.status)return r("🤖 chatgpt.js >> Request failed. Cannot retrieve prompts data.");var e=JSON.parse(a.responseText).personas;if(s){var t=e.find(e=>e.title.toLowerCase()==s.toLowerCase());if(!t)return r(`🤖 chatgpt.js >> Persona '${s}' was not found!`);chatgpt.send(t.prompt,"click"),console.info(`Loading ${s} persona...`),chatgpt.isIdle().then(()=>{console.info("Persona activated!")})}else{console.log("\n%c🤖 chatgpt.js personas\n","font-family: sans-serif ; font-size: xxx-large ; font-weight: bold");for(const n of e)console.log("%c"+n.title,"font-family: monospace ; font-size: larger ;")}return o()}})},activateDarkMode:function(){document.documentElement.classList.replace("light","dark"),document.documentElement.style.colorScheme="dark",localStorage.setItem("theme","dark")},activateLightMode:function(){document.documentElement.classList.replace("dark","light"),document.documentElement.style.colorScheme="light",localStorage.setItem("theme","light")},alert:function(e,t,n,o,r){const a=chatgpt.isDarkMode()?"dark":"light",s=chatgpt.browser.isMobile(),i=document.createElement("div"),c=(i.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),i.classList.add("chatgpt-modal"),document.createElement("div")),l=document.createElement("h2"),u=document.createElement("p");var d=20231203;let p=document.querySelector("#chatgpt-modal-style");(!p||parseInt(p.getAttribute("last-updated"),10)<d)&&(p||((p=document.createElement("style")).id="chatgpt-modal-style",p.setAttribute("last-updated",d.toString()),document.head.append(p)),p.innerText=".chatgpt-modal {position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ;background-color: rgba(67, 70, 72, 0) ;transition: background-color 0.05s ease ;display: flex ; justify-content: center ; align-items: center ; z-index: 9999 }.chatgpt-modal > div {opacity: 0 ; transform: translateX(-2px) translateY(5px) ; max-width: 75vw ; word-wrap: break-word ;transition: opacity 0.1s cubic-bezier(.165,.84,.44,1), transform 0.2s cubic-bezier(.165,.84,.44,1) ;"+`background-color: ${"dark"==a?"black":"white"} ;`+("dark"!=a?"border: 1px solid rgba(0, 0, 0, 0.3) ;":"")+"padding: 20px ; margin: 12px 23px ; border-radius: 15px ; box-shadow: 0 30px 60px rgba(0, 0, 0, .12) ; -webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none ; user-select: none ; }.chatgpt-modal h2 { margin-bottom: 9px }"+`.chatgpt-modal a { color: ${"dark"==a?"#00cfff":"#1e9ebb"}}`+".chatgpt-modal.animated > div { opacity: 1 ; transform: translateX(0) translateY(0) }@keyframes alert-zoom-fade-out { 0% { opacity: 1 ; transform: scale(1) }50% { opacity: 0.25 ; transform: scale(1.05) }100% { opacity: 0 ; transform: scale(1.35) }}.modal-buttons { display: flex ; justify-content: flex-end ; margin: 20px -5px -3px 0 ;"+(s?"flex-direction: column-reverse":"")+"}.chatgpt-modal button {"+`margin-left: ${s?0:10}px ; padding: ${s?15:4}px 18px ; border-radius: 15px ;`+(s?"margin-top: 5px ; margin-bottom: 3px ;":"")+`border: 1px solid ${"dark"==a?"white":"black"}}`+".primary-modal-btn {"+`border: 1px solid ${"dark"==a?"white":"black"} ;`+`background: ${"dark"==a?"white":"black"} ;`+`color: ${"dark"==a?"black":"white"}}`+".chatgpt-modal button:hover { color: #3d5d71 ; border-color: #6d9cb9 ;background-color: "+("dark"==a?"#00cfff":"#9cdaff")+";box-shadow: 2px 1px "+("dark"==a?"54px #00cfff":"30px #9cdaff")+"}.modal-close-btn {cursor: pointer ; width: 20px ; height: 20px ; float: right ; position: relative ; right: -2px }.modal-close-btn svg { margin: 5px 5px }"+`.modal-close-btn:hover { background-color: #f2f2f2${"dark"==a?"00":""}}`+".chatgpt-modal .checkbox-group { display: flex ; margin-top: -18px }.chatgpt-modal .checkbox-group label {font-size: .7rem ; margin: -.04rem 0 0px .3rem ;"+`color: ${"dark"==a?"#e1e1e1":"#1e1e1e"}}`+'.chatgpt-modal input[type="checkbox"] { transform: scale(0.7) ;'+`border: 1px solid ${"dark"==a?"white":"black"}}`+'.chatgpt-modal input[type="checkbox"]:checked {'+`border: 1px solid ${"dark"==a?"white":"black"} ;`+'background-color: black ; position: inherit }.chatgpt-modal input[type="checkbox"]:focus { outline: none ; box-shadow: none }'),l.innerText=e||"",u.innerText=t||"",this.renderHTML(u);const g=document.createElement("div");g.classList.add("modal-buttons"),n&&(n=Array.isArray(n)?n:[n]).forEach(e=>{var t=document.createElement("button");t.textContent=e.name.replace(/[_-]\w/g,e=>e.slice(1).toUpperCase()).replace(/([A-Z])/g," $1").replace(/^\w/,e=>e.toUpperCase()),t.addEventListener("click",()=>{b(),e()}),g.insertBefore(t,g.firstChild)});d=document.createElement("button"),d.textContent=n?"Dismiss":"OK",g.insertBefore(d,g.firstChild),g.lastChild.classList.add("primary-modal-btn"),e=document.createElement("div");if(o){e.classList.add("checkbox-group");const w=o,v=document.createElement("input");v.type="checkbox",v.addEventListener("change",w);t=document.createElement("label");t.addEventListener("click",()=>{v.checked=!v.checked,w()}),t.textContent=w.name.charAt(0).toUpperCase()+w.name.slice(1).replace(/([A-Z])/g,(e,t)=>" "+t.toLowerCase()).replace(/\b(\w+)nt\b/gi,"$1n't").trim(),e.append(v),e.append(t)}n=document.createElement("div"),n.title=cjsMessages?.tooltip_close||"Close",n.classList.add("modal-close-btn"),o=document.createElementNS("http://www.w3.org/2000/svg","svg"),o.setAttribute("height","10px"),o.setAttribute("viewBox","0 0 14 14"),o.setAttribute("fill","none"),t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("fill-rule","evenodd"),t.setAttribute("clip-rule","evenodd"),t.setAttribute("fill",chatgpt.isDarkMode()?"white":"black"),t.setAttribute("d","M13.7071 1.70711C14.0976 1.31658 14.0976 0.683417 13.7071 0.292893C13.3166 -0.0976312 12.6834 -0.0976312 12.2929 0.292893L7 5.58579L1.70711 0.292893C1.31658 -0.0976312 0.683417 -0.0976312 0.292893 0.292893C-0.0976312 0.683417 -0.0976312 1.31658 0.292893 1.70711L5.58579 7L0.292893 12.2929C-0.0976312 12.6834 -0.0976312 13.3166 0.292893 13.7071C0.683417 14.0976 1.31658 14.0976 1.70711 13.7071L7 8.41421L12.2929 13.7071C12.6834 14.0976 13.3166 14.0976 13.7071 13.7071C14.0976 13.3166 14.0976 12.6834 13.7071 12.2929L8.41421 7L13.7071 1.70711Z"),o.append(t),n.append(o),[n,l,u,g,e].forEach(e=>{c.append(e)}),c.style.width=`${r||458}px`,i.append(c),document.body.append(i);let h=JSON.parse(localStorage.alertQueue);h.push(i.id),localStorage.alertQueue=JSON.stringify(h),i.style.display="none",1===h.length&&(i.style.display="",setTimeout(()=>{i.style.backgroundColor=`rgba(67, 70, 72, ${"dark"==a?.62:0})`,i.classList.add("animated")},100));const f=e=>{(e.target==e.currentTarget||e.target instanceof SVGPathElement)&&b()},m=e=>{if([13,27].includes(e.keyCode))for(const n of h){var t=document.getElementById(n);if(t&&"none"!==t.style.display)return void(27===e.keyCode?b():13===e.keyCode&&(t=t.querySelector(".modal-buttons").lastChild)&&(t.click(),e.preventDefault()))}},y=[i,n,o,d],b=(y.forEach(e=>{e.addEventListener("click",f)}),document.addEventListener("keydown",m),()=>{i.style.backgroundColor="transparent",c.style.animation="alert-zoom-fade-out 0.075s ease-out",setTimeout(()=>{if(i.remove(),(h=JSON.parse(localStorage.alertQueue)).shift(),localStorage.alertQueue=JSON.stringify(h),y.forEach(e=>{e.removeEventListener("click",f)}),document.removeEventListener("keydown",m),0<h.length){const e=document.getElementById(h[0]);setTimeout(()=>{e.style.display="",setTimeout(()=>{e.classList.add("animated")},100)},500)}},50)});return i.id},askAndGetReply:async function(e){return chatgpt.send(e),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")},autoRefresh:{activate:function(e){if(this.isActive)console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh already active!");else{const n=this,o=(this.toggle.refreshFrame(),t=>{var e=Math.max(2,Math.floor(21*chatgpt.randomFloat()-10));n.isActive=setTimeout(()=>{var e=document.querySelector('script[src*="_ssgManifest.js"]');document.querySelector("#refresh-frame").src=e.src+"?"+Date.now(),console.log("↻ ChatGPT >> ["+n.nowTimeStamp()+"] ChatGPT session refreshed"),o(t)},1e3*(t+e))});o(e?parseInt(e,10):30),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh activated"),navigator.userAgent.includes("Chrome")&&void 0!==document.hidden&&document.addEventListener("visibilitychange",this.toggle.beacons)}},deactivate:function(){this.isActive?(this.toggle.refreshFrame(),document.removeEventListener("visibilitychange",this.toggle.beacons),clearTimeout(this.isActive),this.isActive=null,console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh de-activated")):console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh already inactive!")},nowTimeStamp:function(){var e=new Date,t=e.getHours()%12||12;let n=e.getMinutes(),o=e.getSeconds();n<10&&(n="0"+n),o<10&&(o="0"+o);e=e.getHours()<12?"AM":"PM";return t+":"+n+":"+o+" "+e},toggle:{beacons:function(){chatgpt.autoRefresh.beaconID?(clearInterval(chatgpt.autoRefresh.beaconID),chatgpt.autoRefresh.beaconID=null,console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacons de-activated")):(chatgpt.autoRefresh.beaconID=setInterval(()=>{navigator.sendBeacon("https://httpbin.org/post",new Uint8Array),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacon sent")},9e4),console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacons activated"))},refreshFrame:function(){let e=document.querySelector("#refresh-frame");e?e.remove():(e=Object.assign(document.createElement("iframe"),{id:"refresh-frame",style:"display: none"}),document.head.prepend(e))}}},browser:{isLightMode:function(){return window.matchMedia?.("(prefers-color-scheme: light)")?.matches},isDarkMode:function(){return window.matchMedia?.("(prefers-color-scheme: dark)")?.matches},isChromium:function(){return navigator.userAgent.includes("Chrome")},isFirefox:function(){return navigator.userAgent.includes("Firefox")},isFullScreen:function(){var e=navigator.userAgent;return e.includes("Chrome")?window.matchMedia("(display-mode: fullscreen)").matches:e.includes("Firefox")?window.fullScreen:/MSIE|rv:/.test(e)?document.msFullscreenElement:document.webkitIsFullScreen},isMobile:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}},clearChats:async function(e){var t=["api","dom"];if((e=(e||"dom").trim().toLowerCase())&&!t.includes(e))return console.log(`Method argument must be one of: [${t}]`);if("dom"!=e)return new Promise((n,o)=>{chatgpt.getAccessToken().then(e=>{const t=new XMLHttpRequest;t.open("PATCH",endpoints.openAI.chats,!0),t.setRequestHeader("Content-Type","application/json"),t.setRequestHeader("Authorization","Bearer "+e),t.onload=()=>{if(200!==t.status)return o("🤖 chatgpt.js >> Request failed. Cannot clear chats.");console.info("Chats successfully cleared"),n()},t.send(JSON.stringify({is_visible:!1}))}).catch(o)});{try{await chatgpt.getChatData()}catch{return}chatgpt.menu.open(),setTimeout(()=>{for(const e of document.querySelectorAll('a[role="menuitem"]')||[])if(/settings/i.test(e.text)){e.click();break}setTimeout(()=>{for(const e of document.querySelectorAll("[id*=radix] button"))if(/^clear/i.test(e.textContent)){e.click();break}setTimeout(()=>{document.querySelector("[id*=radix] button").click(),setTimeout(()=>{n();try{document.querySelector("#prompt-textarea").focus()}catch(e){}},10)},10)},333)},10);const n=()=>{document.querySelector("div[id*=radix] button").click()}}},code:{execute:async function(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Display the output as if you were terminal:\n\n"+e),console.info("Executing code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},extract:function(e){var t=e.match(/(?<=```.*\n)[\s\S]*?(?=```)/g);return t?t[t.length-1]:e},minify:async function(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Minify the following code:\n\n"+e),console.info("Minifying code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},obfuscate:async function(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Obfuscate the following code:\n\n"+e),console.info("Obfuscating code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},refactor:async function(e,t){if(!e)return console.error("Code (1st) argument not supplied. Pass some code!");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send("Refactor the following code for "+(t||"brevity")+":\n\n"+e),console.info("Refactoring code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))},review:async function(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Review the following code for me:\n\n"+e),console.info("Reviewing code..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")):console.error("Code argument not supplied. Pass some code!")},unminify:async function(e){return e?"string"!=typeof e?console.error("Code argument must be a string!"):(chatgpt.send("Unminify the following code.:\n\n"+e),console.info("Unminifying code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))):console.error("Code argument not supplied. Pass some code!")},write:async function(e,t){if(!e)return console.error("Prompt (1st) argument not supplied. Pass a prompt!");if(!t)return console.error("outputLang (2nd) argument not supplied. Pass a language!");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send(e+"\n\nWrite this as code in "+t),console.info("Writing code..."),await chatgpt.isIdle(),chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))}},detectLanguage:async function(e){return e?"string"!=typeof e?console.error("Text argument must be a string!"):(chatgpt.send("Detect the language of the following text:\n\n"+e+"\n\nOnly respond with the name of the language"),console.info("Reviewing text..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")):console.error("Text argument not supplied. Pass some text!")},executeCode:function(){chatgpt.code.execute()},exportChat:async function(e,t){e=e?Number.isInteger(e)||/^\d+$/.test(e)?parseInt(e,10):e:"active",t=t.toLowerCase()||"html",console.info("Generating transcript...");let o="",n;if(/te?xt/.test(t)){var r=new Date,a=r.getDate().toString().padStart(2,"0"),s=(r.getMonth()+1).toString().padStart(2,"0"),i=r.getFullYear(),c=r.getHours().toString().padStart(2,"0"),r=r.getMinutes().toString().padStart(2,"0");if(n=`ChatGPT_${a}-${s}-${i}_${c}-${r}.txt`,"active"==e&&/\/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/.test(window.location.href)){a=document.querySelectorAll("main > div > div > div > div > div > div[class*=group]");if(0===a.length)return console.error("Chat is empty!");const l=[];let n=!0;a.forEach(e=>{var t=n?"USER":"CHATGPT",e=(n=!n,Array.from(e.childNodes).map(e=>e.innerText).join("\n\n").replace("Copy code",""));l.push(t+": "+e)}),o=l.join("\n\n")}else for(const u of await chatgpt.getChatData(e,"msg","both","all"))o=(o+=`USER: ${u.user}
2
2
 
3
3
  `)+`CHATGPT: ${u.chatgpt}
4
4
 
5
- `}else{s=await(await fetch(await chatgpt.shareChat(e))).text(),i=(new DOMParser).parseFromString(s,"text/html");n=i.querySelector("title").textContent+".html",i.querySelectorAll('link[rel="stylesheet"]').forEach(e=>{var t=e.getAttribute("href");t?.startsWith("/")&&e.setAttribute("href","https://chat.openai.com"+t)}),o=(new XMLSerializer).serializeToString(i)}if(console.info(`Exporting transcript as ${t.toUpperCase()}...`),"pdf"==t){o=o.replace(/<svg.*?<\/svg>/g,e=>{return`<img src="${"data:image/svg+xml,"+encodeURIComponent(e)}">`});const d=window.open("","","toolbar=0, location=0, menubar=0, height=600, width=800");d.document.write(o),setTimeout(()=>{d.print({toPDF:!0})},100)}else{"md"==t&&(c=/<!?.*(<h1(.|\n)*?href=".*?continue.*?".*?\/a>.*?)<[^/]/.exec(o)[1],o=c||o,n=n.replace(".html",".md"));r=new Blob([o],{type:"text/"+("html"==t?"html":"md"==t?"markdown":"plain")}),a=document.createElement("a"),e=URL.createObjectURL(r);a.href=e,a.download=n,document.body.append(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(e)}},extractCode:function(){chatgpt.code.extract()},generateRandomIP:function(){var e=Array.from({length:4},()=>Math.floor(256*chatgpt.randomFloat())).join(".");return console.info("IP generated: "+e),e},get:function(e,t=""){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid arguments. Both arguments must be strings.");if(!targetTypes.includes(e.toLowerCase()))throw new Error("Invalid targetType: "+e+". Valid values are: "+JSON.stringify(targetTypes));var n=[],o=new RegExp("^get(.*)"+e+"$","i");for(const a in chatgpt)"function"==typeof chatgpt[a]&&o.test(a)&&n.push(a.replace(o,"$1").toLowerCase());if(!n.includes(t.toLowerCase()))throw new Error("Invalid targetName: "+t+". "+(0<n.length?"Valid values are: "+JSON.stringify(n):"targetType "+e.toLowerCase()+" does not require additional options."));const r=("get"+t+e).toLowerCase();return this[Object.keys(this).find(e=>e.toLowerCase()==r)]()},getAccessToken:function(){return new Promise((e,t)=>{if(0<Object.keys(chatgpt.openAIaccessToken).length&&0<=Date.parse(chatgpt.openAIaccessToken.expireDate)-Date.parse(new Date))return e(chatgpt.openAIaccessToken.token);const n=new XMLHttpRequest;n.open("GET",endpoints.openAI.session,!0),n.setRequestHeader("Content-Type","application/json"),n.onload=()=>200!==n.status?t("🤖 chatgpt.js >> Request failed. Cannot retrieve access token."):(console.info("Token expiration: "+new Date(JSON.parse(n.responseText).expires).toLocaleString().replace(","," at")),chatgpt.openAIaccessToken={token:JSON.parse(n.responseText).accessToken,expireDate:JSON.parse(n.responseText).expires},e(chatgpt.openAIaccessToken.token)),n.send()})},getAccountDetails:function(...s){var e=["email","id","image","name","picture"];for(const t of s=arguments[0]?Array.isArray(arguments[0])?arguments[0]:Array.from(arguments):e)if(!e.includes(t))return console.error("Invalid detail arg '"+t+"' supplied. Valid details are:\n ["+e+"]");return new Promise((o,r)=>{const a=new XMLHttpRequest;a.open("GET",endpoints.openAI.session,!0),a.setRequestHeader("Content-Type","application/json"),a.onload=()=>{if(200!==a.status)return r("🤖 chatgpt.js >> Request failed. Cannot retrieve account details.");var e=JSON.parse(a.responseText).user,t={};for(const n of s)t[n]=e[n];return o(t)},a.send()})},getChatBox:function(){return document.getElementById("prompt-textarea")},getChatData:function(u=1,o="all",p="all",h="all"){var e=["all","id","title","create_time","update_time","msg"],t=["all","both","user","chatgpt"];u=u?Number.isInteger(u)||/^\d+$/.test(u)?0===parseInt(u,10)?0:parseInt(u,10)-1:u:"active",o=["all",""].includes(o)?e.filter(e=>/^(?!all$|msg$).*/.test(e)):Array.isArray(o)?o:[o],p=p?t.includes(p)?p:"invalid":"all",h=Number.isInteger(h)||/^\d+$/.test(h)?0===parseInt(h,10)?0:parseInt(h,10)-1:["all","latest"].includes(h.toLowerCase())?h.toLowerCase():h?"invalid":"all";for(const n of o)if(!e.includes(n))return console.error("Invalid detail arg '"+n+"' passed. Valid details are:\n ["+e+"]");if("invalid"==p)return console.error("Invalid sender arg passed. Valid senders are:\n ["+t+"]");if("invalid"==h)return console.error("Invalid msgToGet arg passed. Valid msg's to get are:\n [ 'all' | 'latest' | index of msg to get ]");const r=(e,c)=>{const l=/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/;return new Promise((t,s)=>{const i=new XMLHttpRequest;i.open("GET",endpoints.openAI.chats,!0),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Authorization","Bearer "+e),i.onload=()=>{if(200!==i.status)return s("🤖 chatgpt.js >> Request failed. Cannot retrieve chat details.");var n=JSON.parse(i.responseText).items;if(n.length<=0)return s("🤖 chatgpt.js >> Chat list is empty.");var o={};if(Number.isInteger(u)||"latest"==u||"active"==u&&!new RegExp("/"+l.source+"$").test(window.location.href)){if((u=Number.isInteger(u)?u:0)>n.length)return s("🤖 chatgpt.js >> Chat with index "+(u+1)+" is out of bounds. Only "+n.length+" chats exist!");for(const e of c)o[e]=n[u][e]}else{var r="active"==u||new RegExp("^"+l.source+"$").test(u)?"id":"title";"active"==u&&(u=l.exec(window.location.href)[0]);let e,t;for(e=0;e<n.length;e++)if(n[e][r]==u){t=!0;break}if(!t)return s("🤖 chatgpt.js >> No chat with "+r+" = "+u+" found.");for(const a of c)o[a]=n[e][a]}return t(o)},i.send()})};return new Promise(n=>{chatgpt.getAccessToken().then(e=>{var t;o.includes("msg")?(t=e,new Promise((u,d)=>{const g=new XMLHttpRequest;r(t,["id"]).then(e=>{g.open("GET",endpoints.openAI.chat+"/"+e.id,!0),g.setRequestHeader("Content-Type","application/json"),g.setRequestHeader("Authorization","Bearer "+t),g.onload=()=>{if(200!==g.status)return d("🤖 chatgpt.js >> Request failed. Cannot retrieve chat messages.");var t=JSON.parse(g.responseText).mapping,n=[],o=[],r=[];for(const e in t)"message"in t[e]&&"user"==t[e].message.author.role&&n.push({id:t[e].id,msg:t[e].message});if(n.sort((e,t)=>e.msg.create_time-t.msg.create_time),parseInt(h,10)+1>n.length)return d("🤖 chatgpt.js >> Message/response with index "+(h+1)+" is out of bounds. Only "+n.length+" messages/responses exist!");for(const a of n){let e=[];for(const s in t)"message"in t[s]&&"assistant"==t[s].message.author.role&&t[s].parent==a.id&&e.push(t[s].message);e.sort((e,t)=>e.create_time-t.create_time),e=1===(e=e.map(e=>{switch(e.content.content_type){case"code":return e.content.text;case"text":return e.content.parts[0];default:return}})).length?e[0]:e,o.push(e)}if("user"==p)for(const i in n)r.push(n[i].msg.content.parts[0]);else if("chatgpt"==p)for(const c of o)r.push("latest"==h?o[o.length-1]:c);else{let e=0;for(const l in n)r.push({user:n[l].msg.content.parts[0],chatgpt:"latest"==h?o[e][o[e].length-1]:o[e]}),e++}return u("all"==h?r:"latest"==h?r[r.length-1]:r[h])},g.send()})}).then(e=>n(e))):r(e,o).then(e=>n(e))})})},getChatInput:function(){return chatgpt.getChatBox().value},getContinueGeneratingButton:function(){for(const e of document.querySelectorAll("form button"))if(e.textContent.toLowerCase().includes("continue"))return e},getLastPrompt:function(){return chatgpt.getChatData("active","msg","user","latest")},getLastResponse:function(){return chatgpt.getChatData("active","msg","chatgpt","latest")},getNewChatLink:function(){for(const e of document.querySelectorAll('nav[aria-label="Chat history"] a'))if(/(new|clear) chat/i.test(e.text))return e},getRegenerateButton:function(){for(const e of document.querySelectorAll("main svg"))if(e.querySelector('path[d*="M4.5 2.5C5.05228"]'))return e.parentNode.parentNode},getResponse:function(){return(window.location.href.startsWith("https://chat.openai.com/c/")?chatgpt.getResponseFromDOM:chatgpt.getResponseFromAPI).apply(null,arguments)},getResponseFromAPI:function(e,t){return chatgpt.response.getFromAPI(e,t)},getResponseFromDOM:function(e){return chatgpt.response.getFromDOM(e)},getSendButton:function(){return document.querySelector('form button[class*="bottom"]')},getStopGeneratingButton:function(){for(const t of document.querySelectorAll("form button")){var e=t.getAttribute("aria-label");if(e&&e.toLowerCase().includes("stop"))return t}},getUserLanguage:function(){return navigator.languages[0]||navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage||""},history:{activate:function(){this.isOff()?this.toggle():console.info("Chat history is already enabled!")},deactivate:function(){this.isOn()?this.toggle():console.info("Chat history is already disabled!")},isOn:function(){return([...document.querySelectorAll('nav[aria-label="Chat history"] div')].find(e=>e.textContent.includes("Chat History is off"))||{}).classList.toString().includes("invisible")},isOff:function(){return!this.isOn()},isLoaded:function(){return new Promise(e=>{const t=()=>{document.querySelector('nav[aria-label="Chat history"]')?e(!0):setTimeout(t,100)};t()})},toggle:function(){for(const e of document.querySelectorAll('nav[aria-label="Chat history"] button'))if(/chat history/i.test(e.textContent))return void e.click()}},instructions:{add:function(o,r){var e;return o?"string"!=typeof o?console.error("Instruction must be a string"):(e=["user","chatgpt"],r?"string"!=typeof r?console.error("Target must be a string"):(r=r.toLowerCase(),e.includes(r)?(o=`
5
+ `}else{s=await(await fetch(await chatgpt.shareChat(e))).text(),i=(new DOMParser).parseFromString(s,"text/html");n=i.querySelector("title").textContent+".html",i.querySelectorAll('link[rel="stylesheet"]').forEach(e=>{var t=e.getAttribute("href");t?.startsWith("/")&&e.setAttribute("href","https://chat.openai.com"+t)}),o=(new XMLSerializer).serializeToString(i)}if(console.info(`Exporting transcript as ${t.toUpperCase()}...`),"pdf"==t){o=o.replace(/<svg.*?<\/svg>/g,e=>{return`<img src="${"data:image/svg+xml,"+encodeURIComponent(e)}">`});const d=window.open("","","toolbar=0, location=0, menubar=0, height=600, width=800");d.document.write(o),setTimeout(()=>{d.print({toPDF:!0})},100)}else{"md"==t&&(c=/<!?.*(<h1(.|\n)*?href=".*?continue.*?".*?\/a>.*?)<[^/]/.exec(o)[1],o=c||o,n=n.replace(".html",".md"));r=new Blob([o],{type:"text/"+("html"==t?"html":"md"==t?"markdown":"plain")}),a=document.createElement("a"),e=URL.createObjectURL(r);a.href=e,a.download=n,document.body.append(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(e)}},extractCode:function(){chatgpt.code.extract()},generateRandomIP:function(){var e=Array.from({length:4},()=>Math.floor(256*chatgpt.randomFloat())).join(".");return console.info("IP generated: "+e),e},get:function(e,t=""){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid arguments. Both arguments must be strings.");if(!targetTypes.includes(e.toLowerCase()))throw new Error("Invalid targetType: "+e+". Valid values are: "+JSON.stringify(targetTypes));var n=[],o=new RegExp("^get(.*)"+e+"$","i");for(const a in chatgpt)"function"==typeof chatgpt[a]&&o.test(a)&&n.push(a.replace(o,"$1").toLowerCase());if(!n.includes(t.toLowerCase()))throw new Error("Invalid targetName: "+t+". "+(0<n.length?"Valid values are: "+JSON.stringify(n):"targetType "+e.toLowerCase()+" does not require additional options."));const r=("get"+t+e).toLowerCase();return this[Object.keys(this).find(e=>e.toLowerCase()==r)]()},getAccessToken:function(){return new Promise((e,t)=>{if(0<Object.keys(chatgpt.openAIaccessToken).length&&0<=Date.parse(chatgpt.openAIaccessToken.expireDate)-Date.parse(new Date))return e(chatgpt.openAIaccessToken.token);const n=new XMLHttpRequest;n.open("GET",endpoints.openAI.session,!0),n.setRequestHeader("Content-Type","application/json"),n.onload=()=>200!==n.status?t("🤖 chatgpt.js >> Request failed. Cannot retrieve access token."):(console.info("Token expiration: "+new Date(JSON.parse(n.responseText).expires).toLocaleString().replace(","," at")),chatgpt.openAIaccessToken={token:JSON.parse(n.responseText).accessToken,expireDate:JSON.parse(n.responseText).expires},e(chatgpt.openAIaccessToken.token)),n.send()})},getAccountDetails:function(...s){var e=["email","id","image","name","picture"];for(const t of s=arguments[0]?Array.isArray(arguments[0])?arguments[0]:Array.from(arguments):e)if(!e.includes(t))return console.error("Invalid detail arg '"+t+"' supplied. Valid details are:\n ["+e+"]");return new Promise((o,r)=>{const a=new XMLHttpRequest;a.open("GET",endpoints.openAI.session,!0),a.setRequestHeader("Content-Type","application/json"),a.onload=()=>{if(200!==a.status)return r("🤖 chatgpt.js >> Request failed. Cannot retrieve account details.");var e=JSON.parse(a.responseText).user,t={};for(const n of s)t[n]=e[n];return o(t)},a.send()})},getChatBox:function(){return document.getElementById("prompt-textarea")},getChatData:function(u=1,o="all",g="all",h="all"){var e=["all","id","title","create_time","update_time","msg"],t=["all","both","user","chatgpt"];u=u?Number.isInteger(u)||/^\d+$/.test(u)?0===parseInt(u,10)?0:parseInt(u,10)-1:u:"active",o=["all",""].includes(o)?e.filter(e=>/^(?!all$|msg$).*/.test(e)):Array.isArray(o)?o:[o],g=g?t.includes(g)?g:"invalid":"all",h=Number.isInteger(h)||/^\d+$/.test(h)?0===parseInt(h,10)?0:parseInt(h,10)-1:["all","latest"].includes(h.toLowerCase())?h.toLowerCase():h?"invalid":"all";for(const n of o)if(!e.includes(n))return console.error("Invalid detail arg '"+n+"' passed. Valid details are:\n ["+e+"]");if("invalid"==g)return console.error("Invalid sender arg passed. Valid senders are:\n ["+t+"]");if("invalid"==h)return console.error("Invalid msgToGet arg passed. Valid msg's to get are:\n [ 'all' | 'latest' | index of msg to get ]");const r=(e,c)=>{const l=/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/;return new Promise((t,s)=>{const i=new XMLHttpRequest;i.open("GET",endpoints.openAI.chats,!0),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Authorization","Bearer "+e),i.onload=()=>{if(200!==i.status)return s("🤖 chatgpt.js >> Request failed. Cannot retrieve chat details.");var n=JSON.parse(i.responseText).items;if(n.length<=0)return s("🤖 chatgpt.js >> Chat list is empty.");var o={};if(Number.isInteger(u)||"latest"==u||"active"==u&&!new RegExp("/"+l.source+"$").test(window.location.href)){if((u=Number.isInteger(u)?u:0)>n.length)return s("🤖 chatgpt.js >> Chat with index "+(u+1)+" is out of bounds. Only "+n.length+" chats exist!");for(const e of c)o[e]=n[u][e]}else{var r="active"==u||new RegExp("^"+l.source+"$").test(u)?"id":"title";"active"==u&&(u=l.exec(window.location.href)[0]);let e,t;for(e=0;e<n.length;e++)if(n[e][r]==u){t=!0;break}if(!t)return s("🤖 chatgpt.js >> No chat with "+r+" = "+u+" found.");for(const a of c)o[a]=n[e][a]}return t(o)},i.send()})};return new Promise(n=>{chatgpt.getAccessToken().then(e=>{var t;o.includes("msg")?(t=e,new Promise((u,d)=>{const p=new XMLHttpRequest;r(t,["id"]).then(e=>{p.open("GET",endpoints.openAI.chat+"/"+e.id,!0),p.setRequestHeader("Content-Type","application/json"),p.setRequestHeader("Authorization","Bearer "+t),p.onload=()=>{if(200!==p.status)return d("🤖 chatgpt.js >> Request failed. Cannot retrieve chat messages.");var t=JSON.parse(p.responseText).mapping,n=[],o=[],r=[];for(const e in t)"message"in t[e]&&"user"==t[e].message.author.role&&n.push({id:t[e].id,msg:t[e].message});if(n.sort((e,t)=>e.msg.create_time-t.msg.create_time),parseInt(h,10)+1>n.length)return d("🤖 chatgpt.js >> Message/response with index "+(h+1)+" is out of bounds. Only "+n.length+" messages/responses exist!");for(const a of n){let e=[];for(const s in t)"message"in t[s]&&"assistant"==t[s].message.author.role&&t[s].parent==a.id&&e.push(t[s].message);e.sort((e,t)=>e.create_time-t.create_time),e=1===(e=e.map(e=>{switch(e.content.content_type){case"code":return e.content.text;case"text":return e.content.parts[0];default:return}})).length?e[0]:e,o.push(e)}if("user"==g)for(const i in n)r.push(n[i].msg.content.parts[0]);else if("chatgpt"==g)for(const c of o)r.push("latest"==h?o[o.length-1]:c);else{let e=0;for(const l in n)r.push({user:n[l].msg.content.parts[0],chatgpt:"latest"==h?o[e][o[e].length-1]:o[e]}),e++}return u("all"==h?r:"latest"==h?r[r.length-1]:r[h])},p.send()})}).then(e=>n(e))):r(e,o).then(e=>n(e))})})},getChatInput:function(){return chatgpt.getChatBox().value},getContinueGeneratingButton:function(){document.querySelectorAll("button svg").forEach(e=>{if(e.querySelector('polygon[points*="11 19 2 12 11 5 11 19"]'))return e.parentNode.parentNode})},getLastPrompt:function(){return chatgpt.getChatData("active","msg","user","latest")},getLastResponse:function(){return chatgpt.getChatData("active","msg","chatgpt","latest")},getNewChatLink:function(){for(const e of document.querySelectorAll("nav a"))if(/(new|clear) chat/i.test(e.text))return e},getRegenerateButton:function(){for(const e of document.querySelectorAll("main svg"))if(e.querySelector('path[d*="M4.5 2.5C5.05228"]'))return e.parentNode.parentNode},getResponse:function(){return(window.location.href.startsWith("https://chat.openai.com/c/")?chatgpt.getResponseFromDOM:chatgpt.getResponseFromAPI).apply(null,arguments)},getResponseFromAPI:function(e,t){return chatgpt.response.getFromAPI(e,t)},getResponseFromDOM:function(e){return chatgpt.response.getFromDOM(e)},getSendButton:function(){return document.querySelector('form button[class*="bottom"]')},getStopGeneratingButton:function(){document.querySelectorAll("form button svg").forEach(e=>{if(e.querySelector('path[d*="2 0 0 1 2"]'))return e.parentNode})},getUserLanguage:function(){return navigator.languages[0]||navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage||""},history:{activate:function(){this.isOff()?this.toggle():console.info("Chat history is already enabled!")},deactivate:function(){this.isOn()?this.toggle():console.info("Chat history is already disabled!")},isOn:function(){return([...document.querySelectorAll("nav div")].find(e=>e.textContent.includes("Chat History is off"))||{}).classList.toString().includes("invisible")},isOff:function(){return!this.isOn()},isLoaded:function(){return new Promise(e=>{const t=()=>{document.querySelector("nav")?e(!0):setTimeout(t,100)};t()})},toggle:function(){for(const e of document.querySelectorAll("nav button"))if(/chat history/i.test(e.textContent))return void e.click()}},instructions:{add:function(o,r){var e;return o?"string"!=typeof o?console.error("Instruction must be a string"):(e=["user","chatgpt"],r?"string"!=typeof r?console.error("Target must be a string"):(r=r.toLowerCase(),e.includes(r)?(o=`
6
6
 
7
- `+o,new Promise(n=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return"user"==r?t.about_user_message+=o:"chatgpt"==r&&(t.about_model_message+=o),await this.sendRequest("POST",e,t),n()})})):console.error(`Invalid target ${r}. Valid targets are [${e}]`)):console.error("Please provide a valid target!")):console.error("Please provide an instruction")},clear:function(o){var e=["user","chatgpt"];return o?"string"!=typeof o?console.error("Target must be a string"):(o=o.toLowerCase(),e.includes(o)?new Promise(n=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return"user"==o?t.about_user_message="":"chatgpt"==o&&(t.about_model_message=""),await this.sendRequest("POST",e,t),n()})}):console.error(`Invalid target ${o}. Valid targets are [${e}]`)):console.error("Please provide a valid target!")},fetchData:function(){return new Promise(t=>{chatgpt.getAccessToken().then(async e=>t(await this.sendRequest("GET",e)))})},sendRequest:function(r,e,a){for(let e=0;e<arguments.length-1;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string`);var t=["POST","GET"];return(r=(r||"").trim().toUpperCase())&&t.includes(r)?e?a&&"object"!=typeof a?console.error(`Invalid body data type. Got ${typeof a}, expected object`):new Promise((t,n)=>{const o=new XMLHttpRequest;o.open(r,endpoints.openAI.instructions,!0),o.setRequestHeader("Accept-Language","en-US"),o.setRequestHeader("Authorization","Bearer "+e),"POST"==r&&o.setRequestHeader("Content-Type","application/json"),o.onload=()=>{var e=JSON.parse(o.responseText);return 422===o.status?n("🤖 chatgpt.js >> Character limit exceeded. Custom instructions can have a maximum length of 1500 characters."):403===o.status&&"content_policy"==e.detail.reason?n("🤖 chatgpt.js >> "+e.detail.description):200!==o.status?n("🤖 chatgpt.js >> Request failed. Cannot contact custom instructions endpoint."):(console.info("Custom instructions successfully contacted with method "+r),t(e||{}))},o.send(JSON.stringify(a)||"")}):console.error("Please provide a valid access token!"):console.error("Valid methods are "+t)},turnOff:function(){return new Promise(n=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return t.enabled=!1,await this.sendRequest("POST",e,t),n()})})},turnOn:function(){return new Promise(n=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return t.enabled=!0,await this.sendRequest("POST",e,t),n()})})},toggle:function(){return new Promise(t=>{this.fetchData().then(async e=>(await(e.enabled?this.turnOff():this.turnOn()),t()))})}},isChromium:function(){return chatgpt.browser.isChromium()},isDarkMode:function(){return document.documentElement.classList.toString().includes("dark")},isFirefox:function(){return chatgpt.browser.isFirefox()},isFullScreen:function(){return chatgpt.browser.isFullScreen()},isIdle:function(){return new Promise(e=>{const t=setInterval(()=>{chatgpt.getRegenerateButton()&&(clearInterval(t),e(!0))},100)})},isLoaded:function(){return new Promise(e=>{const t=setInterval(()=>{document.querySelector('nav button[id*="menu"]')&&(clearInterval(t),setTimeout(()=>{e(!0)},500))},100)})},isLightMode:function(){return document.documentElement.classList.toString().includes("light")},isMobileDevice:function(){return chatgpt.browser.isMobile()},logout:function(){window.location.href="https://chat.openai.com/auth/logout"},menu:{elements:[],addedEvent:!1,append:function(e,t={}){var n=["button","dropdown"];if(!e||"string"!=typeof e)return console.error("🤖 chatgpt.js >> Please supply a valid string element name!");if(e=e.toLowerCase(),!n.includes(e))return console.error(`🤖 chatgpt.js >> Invalid element! Valid elements are [${n}]`);const o=document.createElement("dropdown"==e?"select":"button"==e?"a":e);if(o.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),"button"==e){o.textContent=t?.label&&"string"==typeof t.label?t.label:"chatgpt.js button";n=document.createElement("img");n.src=t?.icon&&"string"==typeof t.icon?t.icon:endpoints.assets+"/starters/chrome/extension/icons/icon128.png",n.width=18,o.insertBefore(n,o.firstChild),o.onclick=t?.onclick&&"function"==typeof t.onclick?t.onclick:function(){}}else if("dropdown"==e){if(t?.items&&Array.isArray(t.items)&&t.items.length||(t.items=[{text:"🤖 chatgpt.js option",value:"chatgpt.js option value"}]),!t.items.every(e=>"object"==typeof e))return console.error("'items' must be an array of objects!");o.style="background-color: #000; width: 100%; border: none;",t.items.forEach(e=>{var t=document.createElement("option");t.textContent=e?.text,t.value=e?.value,o.add(t)})}const r=()=>{var e,t=document.querySelectorAll('a[role="menuitem"]');let n;for(e of t)if("Settings"==e.textContent){n=e.classList;break}const o=t[0].parentNode;chatgpt.menu.elements.forEach(e=>{if(e.setAttribute("class",n),!o.contains(e))try{o.insertBefore(e,o.firstChild)}catch(e){console.error(e)}})};this.elements.push(o);n=document.querySelector('nav button[id*="headless"]');return this.addedEvent||(n.addEventListener("click",()=>{setTimeout(r,25)}),this.addedEvent=!0),o.id},close:function(){var e=document.querySelector('nav [id*="menu-button"][aria-expanded="true"]');if(!e)throw console.error("Menu already hidden!"),new Error;try{e.click()}catch(e){throw console.error("Error while closing the menu"),new Error(e)}},open:function(){var e=document.querySelector('nav [id*="menu-button"][aria-expanded="false"]');if(!e)throw console.error("Menu already hidden!"),new Error;try{e.click()}catch(e){throw console.error("Error while closing the menu"),new Error(e)}}},minify:function(){chatgpt.code.minify()},notify:async function(t,e,n,o){n=n?+n:1.75;const r=document.createElement("div");r.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),r.classList.add("chatgpt-notif"),r.innerText=t,document.body.append(r);var t=document.createElement("div"),a=(t.title=cjsMessages?.tooltip_dismiss||"Dismiss",t.classList.add("notif-close-btn"),document.createElementNS("http://www.w3.org/2000/svg","svg")),s=(a.setAttribute("height","8px"),a.setAttribute("viewBox","0 0 14 14"),a.setAttribute("fill","none"),a.style.height=a.style.width="8px",document.createElementNS("http://www.w3.org/2000/svg","path"));s.setAttribute("fill-rule","evenodd"),s.setAttribute("clip-rule","evenodd"),s.setAttribute("fill","white"),s.setAttribute("d","M13.7071 1.70711C14.0976 1.31658 14.0976 0.683417 13.7071 0.292893C13.3166 -0.0976312 12.6834 -0.0976312 12.2929 0.292893L7 5.58579L1.70711 0.292893C1.31658 -0.0976312 0.683417 -0.0976312 0.292893 0.292893C-0.0976312 0.683417 -0.0976312 1.31658 0.292893 1.70711L5.58579 7L0.292893 12.2929C-0.0976312 12.6834 -0.0976312 13.3166 0.292893 13.7071C0.683417 14.0976 1.31658 14.0976 1.70711 13.7071L7 8.41421L12.2929 13.7071C12.6834 14.0976 13.3166 14.0976 13.7071 13.7071C14.0976 13.3166 14.0976 12.6834 13.7071 12.2929L8.41421 7L13.7071 1.70711Z"),a.append(s),t.append(a),r.append(t),r.isTop=!e||!/low|bottom/i.test(e),r.isRight=!e||!/left/i.test(e),r.quadrant=(r.isTop?"top":"bottom")+(r.isRight?"Right":"Left");let i=document.querySelector("#chatgpt-notif-style"),c=((!i||parseInt(i.getAttribute("last-updated"),10)<20231110)&&(i||((i=document.createElement("style")).id="chatgpt-notif-style",i.setAttribute("last-updated",20231110..toString()),document.head.append(i)),i.innerText=".chatgpt-notif {background-color: black ; padding: 10px 13px 10px 18px ; border-radius: 11px ; border: 1px solid #f5f5f7 ;opacity: 0 ; position: fixed ; z-index: 9999 ; font-size: 1.8rem ; color: white ;-webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none ; user-select: none ;"+`transform: translateX(${r.isRight?"":"-"}35px) ;`+(o?"box-shadow: -8px 13px 25px 0 "+(/\b(shadow|on)\b/gi.test(o)?"gray":o):"")+"}.notif-close-btn { cursor: pointer ; float: right ; position: relative ; right: -4px ; margin-left: -3px ;display: grid }@keyframes notif-zoom-fade-out { 0% { opacity: 1 ; transform: scale(1) }15% { opacity: 0.35 ; transform: rotateX(-27deg) scale(1.05) }45% { opacity: 0.05 ; transform: rotateX(-81deg) }100% { opacity: 0 ; transform: rotateX(-180deg) scale(1.15) }}"),JSON.parse(localStorage.notifyProps));c.queue[r.quadrant].push(r.id),localStorage.notifyProps=JSON.stringify(c),r.style.top=r.isTop?23..toString()+"px":"",r.style.bottom=r.isTop?"":23..toString()+"px",r.style.right=r.isRight?27..toString()+"px":"",r.style.left=r.isRight?"":27..toString()+"px";s=c.queue[r.quadrant];if(1<s.length)try{for(const f of s.slice(0,-1)){var l=document.getElementById(f),u=l.style.top?"top":"bottom",d=+/\d+/.exec(l.style[u])[0]+5+l.getBoundingClientRect().height;l.style[u]=d+"px"}}catch(e){}setTimeout(()=>{r.style.opacity=chatgpt.isDarkMode()?.8:.67,r.style.transform="translateX(0)",r.style.transition="transform 0.15s ease, opacity 0.15s ease"},10);t=n<.3?0:n-.3;let g,p;if(isFFtmScript){let e;for(;(e=Math.floor(3*Math.random())+1)===c.lastNthAudio;);c.lastNthAudio=e,localStorage.notifyProps=JSON.stringify(c),(g=new Audio).src=endpoints.assets+"/media/audio/notifications/bubble-pop/"+`${e}-${r.isRight?"right":"left"}.mp3`,p=setTimeout(()=>g.play().catch(()=>{}),1e3*t)}e=()=>{r.style.animation="notif-zoom-fade-out 0.3s ease-out",isFFtmScript&&g?.play().catch(()=>{}),clearTimeout(h),clearTimeout(p)};const h=setTimeout(e,1e3*t);a.addEventListener("click",e,{once:!0}),r.addEventListener("animationend",()=>{r.remove(),(c=JSON.parse(localStorage.notifyProps)).queue[r.quadrant].shift(),localStorage.notifyProps=JSON.stringify(c)},{once:!0})},obfuscate:function(){chatgpt.code.obfuscate()},printAllFunctions:function(){const t={cmdPrompt:["#ff00ff","#00ff00"],objName:["#0611e9","#f9ee16"],methodName:["#005aff","#ffa500"],entryType:["#467e06","#b981f9"],srcMethod:["#ff0000","#00ffff"]};Object.keys(t).forEach(e=>{t[e][1]=t[e][1]||"#"+(16777215^Number("0x1"+t[e][0].replace(/^#/,""))).toString(16).substring(1).toUpperCase()});var e=[];for(const c in this)if("function"==typeof this[c]){var n=!Object.keys(this).find(e=>Object.keys(this[e]).includes(this[c].name));e.push([n?"chatgpt":"other",c])}else if("object"==typeof this[c])for(const l in this[c])"function"==typeof this[c][l]&&e.push([c,l]);e.sort((e,t)=>e[0].localeCompare(t[0])||e[1].localeCompare(t[1]));var o=window.matchMedia("(prefers-color-scheme: dark)").matches,r="font-family: monospace ; font-size: larger ; ";console.log("\n%c🤖 chatgpt.js methods\n","font-family: sans-serif ; font-size: xxx-large ; font-weight: bold");for(const u of e){var a=/chatgpt|other/.test(u[0]),s="chatgpt"==u[0]?this[u[1]].name:"other"!==u[0]?u[0]+"."+u[1]:Object.keys(this).find(e=>Object.keys(this[e]).includes(this[u[1]].name))+"."+this[u[1]].name,i="AsyncFunction"==this[u[1]]?.constructor.name;console.log("%c>> %c"+(a?"":u[0]+".%c")+u[1]+" - https://chatgptjs.org/userguide/"+/(?:.*\.)?(.*)/.exec(s)[1].toLowerCase()+(i?"-async":"")+"\n%c[%c"+("chatgpt"==u[0]&&u[1]==this[u[1]].name||!a?"Function":"Alias of")+"%c: %c"+s+"%c]",r+"font-weight: bold ; color:"+t.cmdPrompt[+o],r+"font-weight: bold ;color:"+t[a?"methodName":"objName"][+o],r+"font-weight: "+(a?"initial":"bold")+";color:"+(a?"initial":t.methodName[+o]),r+"font-weight: "+(a?"bold":"initial")+";color:"+(a?t.entryType[+o]:"initial"),r+"font-weight: "+(a?"initial":"bold")+";color:"+(a?"initial":t.entryType[+o]),r+(a?"font-style: italic":"font-weight: initial")+";color:"+(a?t.srcMethod[+o]:"initial"),r+(a?"font-weight: initial":"font-style: italic")+";color:"+(a?"initial":t.srcMethod[+o]),a?"":r+"color: initial ; font-weight: initial")}},randomFloat:function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/4294967295},refactor:function(){chatgpt.code.refactor()},regenerate:function(){for(const e of document.querySelectorAll("form button"))if(e.textContent.toLowerCase().includes("regenerate"))return void e.click()},renderHTML:function(e){var t=/<([a-z\d]+)\b([^>]*)>([\s\S]*?)<\/\1>/g,n=/(\S+)=['"]?((?:.(?!['"]?\s+(?:\S+)=|[>']))+.)['"]?/g,o=e.childNodes;this.renderHTML.preWrapSet||(e.style.whiteSpace="pre-wrap",this.renderHTML.preWrapSet=!0,setTimeout(()=>{this.renderHTML.preWrapSet=!1},100));for(const i of o)if(i.nodeType==Node.TEXT_NODE){var r=i.nodeValue,a=Array.from(r.matchAll(t));if(0<a.length){const c=a[0],[l,u,d,g]=c.slice(0,4),p=document.createElement(u);p.textContent=g;Array.from(d.matchAll(n)).forEach(e=>{var t=e[1],e=e[2].replace(/['"]/g,"");p.setAttribute(t,e)});var a=this.renderHTML(p),s=document.createTextNode(r.substring(0,c.index)),r=document.createTextNode(r.substring(c.index+l.length));e.replaceChild(s,i),e.insertBefore(a,s.nextSibling),e.insertBefore(r,a.nextSibling)}}else i.nodeType==Node.ELEMENT_NODE&&this.renderHTML(i);return e},resend:async function(){chatgpt.send(await chatgpt.getChatData("latest","msg","user","latest"))},response:{get:function(){return(window.location.href.startsWith("https://chat.openai.com/c/")?this.getFromDOM:this.getFromAPI).apply(null,arguments)},getFromAPI:function(e,t){return e=e||"latest",t=t||"latest",chatgpt.getChatData(e,"msg","chatgpt",t)},getFromDOM:function(e){var t=document.querySelectorAll('div[data-testid*="conversation-turn"]:nth-child(odd)'),n=e.toString().toLowerCase();let o="";return o=t.length?(o=(/last|final/.test(n)?t[t.length-1]:t[(Number.isInteger(e)?e:/^\d+/.test(n)?/^\d+/.exec(n)[0]:(/^(?:1|one|fir)(?:st)?$/.test(n)?1:/^(?:2|tw(?:o|en|el(?:ve|f))|seco)(?:nd|t[yi])?(?:e?th)?$/.test(n)?2:/^(?:3|th(?:ree|ir?))(?:rd|teen|t[yi])?(?:e?th)?$/.test(n)?3:/^(?:4|fou?r)(?:teen|t[yi])?(?:e?th)?$/.test(n)?4:/^(?:5|fi(?:ve|f))(?:teen|t[yi])?(?:e?th)?$/.test(n)?5:/^(?:6|six)(?:teen|t[yi])?(?:e?th)?$/.test(n)?6:/^(?:7|seven)(?:teen|t[yi])?(?:e?th)?$/.test(n)?7:/^(?:8|eight?)(?:teen|t[yi])?(?:e?th)?$/.test(n)?8:/^(?:9|nine?)(?:teen|t[yi])?(?:e?th)?$/.test(n)?9:/^(?:10|ten)(?:th)?$/.test(n)?10:1)*(/(ty|ieth)$/.test(n)?10:1)+(/teen(th)?$/.test(n)?10:0))-1]).textContent).replace(/^ChatGPTChatGPT/,""):o},getLast:function(){return chatgpt.getChatData("active","msg","chatgpt","latest")},regenerate:function(){for(const e of document.querySelectorAll("form button"))if(e.textContent.toLowerCase().includes("regenerate"))return void e.click()},stopGenerating:function(){for(const t of document.querySelectorAll("form button")){var e=t.getAttribute("aria-label");if(e&&e.toLowerCase().includes("stop"))return void t.click()}}},reviewCode:function(){chatgpt.code.review()},scrollToBottom:function(){try{document.querySelector('button[class*="cursor"][class*="bottom"]').click()}catch(e){console.error("",e)}},send:function(e,t=""){for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string!`);const n=document.querySelector("form textarea"),o=document.querySelector('form button[class*="bottom"]'),r=(n.value=e,n.dispatchEvent(new Event("input",{bubbles:!0})),setInterval(()=>{o?.hasAttribute("disabled")||("click"==t.toLowerCase()||chatgpt.browser.isMobile()?o.click():n.dispatchEvent(new KeyboardEvent("keydown",{keyCode:13,bubbles:!0})),clearInterval(r))},25))},sendInNewChat:function(e){if("string"!=typeof e)return console.error("Message must be a string!");for(const t of document.querySelectorAll('nav[aria-label="Chat history"] a'))if(/(new|clear) chat/i.test(t.text)){t.click();break}setTimeout(()=>{chatgpt.send(e)},500)},settings:{scheme:{isDark:function(){return document.documentElement.classList.contains("dark")},isLight:function(){return document.documentElement.classList.contains("light")},set:function(e){var t=["dark","light","system"];if(!e)return console.error("Please specify a scheme value!");if(!t.includes(e))return console.error(`Invalid scheme value. Valid values are [${t}]`);let n=e;"system"==e&&(n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),localStorage.setItem("theme",e),console.info(`Scheme set to ${e.toUpperCase()}.`),document.documentElement.classList.contains(n)||this.toggle()},toggle:function(){var[e,t]=this.isDark()?["dark","light"]:["light","dark"];document.documentElement.classList.replace(e,t),document.documentElement.style.colorScheme=t,localStorage.setItem("theme",t)}}},sentiment:async function(e,t){for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send("What is the sentiment of the following text"+(t?` towards the entity ${t},`:"")+" from strongly negative to strongly positive?\n\n"+e),console.info("Analyzing sentiment..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")},setScheme:function(e){chatgpt.settings.scheme.set(e)},shareChat:function(s,i="clipboard"){var e=["alert","notify","notification","clipboard","copy"];if(!e.includes(i))return console.error("Invalid method '"+i+"' passed. Valid methods are ["+e+"].");return new Promise(n=>{chatgpt.getAccessToken().then(t=>{var r;r=t,new Promise((t,n)=>{const o=new XMLHttpRequest;chatgpt.getChatData(s).then(e=>{o.open("GET",endpoints.openAI.chat+"/"+e.id,!0),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Authorization","Bearer "+r),o.onload=()=>200!==o.status?n("🤖 chatgpt.js >> Request failed. Cannot retrieve chat node."):t(JSON.parse(o.responseText).current_node),o.send()})}).then(e=>{var r,a;r=t,a=e,new Promise((t,n)=>{const o=new XMLHttpRequest;chatgpt.getChatData(s).then(e=>{o.open("POST",endpoints.openAI.share_create,!0),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Authorization","Bearer "+r),o.onload=()=>200!==o.status?n("🤖 chatgpt.js >> Request failed. Cannot initialize share chat."):t(JSON.parse(o.responseText)),o.send(JSON.stringify({current_node_id:a,conversation_id:e.id,is_anonymous:!0}))})}).then(e=>{var o,r;o=t,r=e,new Promise((e,t)=>{const n=new XMLHttpRequest;n.open("PATCH",endpoints.openAI.share+"/"+r.share_id,!0),n.setRequestHeader("Content-Type","application/json"),n.setRequestHeader("Authorization","Bearer "+o),n.onload=()=>200!==n.status?t("🤖 chatgpt.js >> Request failed. Cannot share chat."):(console.info(`Chat shared at '${r.share_url}'`),e()),n.send(JSON.stringify({share_id:r.share_id,highlighted_message_id:r.highlighted_message_id,title:r.title,is_public:!0,is_visible:r.is_visible,is_anonymous:r.is_anonymous}))}).then(()=>{["copy","clipboard"].includes(i)?navigator.clipboard.writeText(e.share_url):chatgpt.alert("🚀 Share link created!",'"'+e.title+'" is available at: <a target="blank" rel="noopener" href="'+e.share_url+'" >'+e.share_url+"</a>",[function(){window.open(e.share_url,"_blank","noopener")},function(){navigator.clipboard.writeText(e.share_url)}]),n(e.share_url)})})})})})},sidebar:{elements:[],observer:{},activateObserver:function(){var e,t=document.querySelector('nav[aria-label="Chat history"]').querySelector("a");if(chatgpt.history.isOff())try{t.parentNode.nextElementSibling.style.display="none"}catch(e){}if(this.observer instanceof MutationObserver)try{this.observer.disconnect()}catch(e){}if(!this.elements.length)return console.error("🤖 chatgpt.js >> No elements to append!");let n;for(e of document.querySelectorAll('nav[aria-label="Chat history"] a'))if(/.*chat/.exec(e.text)[0]){n=e.classList,e.parentNode.style.margin="2px 0";break}this.elements.forEach(e=>{e.setAttribute("class",n),e.style.maxHeight=e.style.minHeight="44px",e.style.margin="2px 0"});const o=document.querySelector('nav[aria-label="Chat history"]');this.observer=new MutationObserver(e=>{e.forEach(e=>{("childList"==e.type&&e.addedNodes.length||"attributes"==e.type&&"data-chatgptjs"==e.attributeName)&&this.elements.forEach(e=>{if(!o.contains(e))try{o.insertBefore(e,o.querySelector("a").parentNode)}catch(e){console.error(e)}})})}),this.observer.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0})},append:function(e,t={}){var n=["button","dropdown"];if(!e||"string"!=typeof e)return console.error("🤖 chatgpt.js >> Please supply a valid string element name!");if(e=e.toLowerCase(),!n.includes(e))return console.error(`🤖 chatgpt.js >> Invalid element! Valid elements are [${n}]`);const o=document.createElement("dropdown"==e?"select":e);if(o.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),"button"==e){o.textContent=t?.label&&"string"==typeof t.label?t.label:"chatgpt.js button";n=document.createElement("img");n.src=t?.icon&&"string"==typeof t.icon?t.icon:endpoints.assets+"/starters/chrome/extension/icons/icon128.png",n.width=18,o.insertBefore(n,o.firstChild),o.onclick=t?.onclick&&"function"==typeof t.onclick?t.onclick:function(){}}else if("dropdown"==e){if(t?.items&&Array.isArray(t.items)&&t.items.length||(t.items=[{text:"🤖 chatgpt.js option",value:"chatgpt.js option value"}]),!t.items.every(e=>"object"==typeof e))return console.error("'items' must be an array of objects!");t.items.forEach(e=>{var t=document.createElement("option");t.textContent=e?.text,t.value=e?.value,o.add(t)})}return"dropdown"==e&&(o.style.backgroundColor="var(--gray-900, rgb(32, 33, 35))"),this.elements.push(o),this.activateObserver(),document.body.setAttribute("data-chatgptjs","observer-trigger"),o.id},hide:function(){this.isOn()?this.toggle():console.info("Sidebar already hidden!")},show:function(){this.isOff()?this.toggle():console.info("Sidebar already shown!")},isOff:function(){return!this.isOn()},isOn:function(){return chatgpt.browser.isMobile()?"hidden"==document.documentElement.style.overflow:"hidden"!=document.querySelector("#__next > div > div").style.visibility},toggle:function(){var e=chatgpt.browser.isMobile(),t=e?()=>!0:e=>Array.from(e.querySelectorAll("*")).some(e=>e.style.transform.includes("translateY"));for(const n of document.querySelectorAll(e?"#__next button":"main button"))if(t(n))return void n.click()}},startNewChat:function(){for(const e of document.querySelectorAll('nav[aria-label="Chat history"] a'))if(/(new|clear) chat/i.test(e.text))return void e.click()},stop:function(){for(const e of document.querySelectorAll("form button"))if(e.textContent.toLowerCase().includes("stop"))return void e.click()},suggest:async function(e,t){if(!e)return console.error("ideaType (1st argument) not supplied(e.g. 'gifts', 'names', 'recipes', etc.)");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send("Suggest some names. "+(t||"")),console.info(`Creating ${e}...`),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")},speak:function(e,t={}){var n,{voice:o=2,pitch:r=2,speed:a=1.1}=t;if("string"!=typeof e)return console.error("Message must be a string!");for(n in t){var s=t[n];if("number"!=typeof s&&!/^\d+$/.test(s))return console.error(`Invalid ${n} index '${s}'. Must be a number!`)}try{var i=speechSynthesis.getVoices(),c=new SpeechSynthesisUtterance;c.text=e,c.voice=i[o],c.pitch=r,c.rate=a,speechSynthesis.speak(c)}catch(e){console.error(e)}},summarize:async function(e){return e?"string"!=typeof e?console.error("Text argument must be a string!"):(chatgpt.send("Summarize the following text:\n\n"+e),console.info("Summarizing text..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")):console.error("Text (1st) argument not supplied. Pass some text!")},toggleScheme:function(){chatgpt.settings.scheme.toggle()},translate:async function(e,t){if(!e)return console.error("Text (1st) argument not supplied. Pass some text!");if(!t)return console.error("outputLang (2nd) argument not supplied. Pass a language!");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string!`);return chatgpt.send("Translate the following text to "+t+". Only reply with the translation.\n\n"+e),console.info("Translating text..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")},unminify:function(){chatgpt.code.unminify()},uuidv4:function(){let n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{var t=(n+window.crypto.getRandomValues(new Uint32Array(1))[0]/(Math.pow(2,32)-1)*16)%16|0;return n=Math.floor(n/16),("x"==e?t:3&t|8).toString(16)})},writeCode:function(){chatgpt.code.write()}},buttonActions=(chatgpt.scheme={...chatgpt.settings.scheme},["click","get"]),targetTypes=["button","link","div","response"];for(const o3 of buttonActions)chatgpt[o3+"Button"]=function(n){var e=/^[.#]/.test(n)?document.querySelector(n):/send/i.test(n)?document.querySelector('form button[class*="bottom"]'):/scroll/i.test(n)?document.querySelector('button[class*="cursor"]'):function(){for(const e of document.querySelectorAll("button"))if(e.textContent.toLowerCase().includes(n.toLowerCase()))return e;for(const t of document.querySelectorAll("nav a"))if(t.textContent.toLowerCase().includes(n.toLowerCase()))return t}();if("click"!=o3)return e;e.click()};const functionAliases=[["actAs","actas","act","become","persona","premadePrompt","preMadePrompt","prePrompt","preprompt","roleplay","rolePlay","rp"],["activateAutoRefresh","activateAutoRefresher","activateRefresher","activateSessionRefresher","autoRefresh","autoRefresher","autoRefreshSession","refresher","sessionRefresher"],["deactivateAutoRefresh","deactivateAutoRefresher","deactivateRefresher","deactivateSessionRefresher"],["detectLanguage","getLanguage"],["executeCode","codeExecute"],["exportChat","chatExport","export"],["getLastPrompt","getLastQuery","getMyLastMsg","getMyLastQuery"],["getTextarea","getTextArea","getChatbox","getChatBox"],["isFullScreen","isFullscreen"],["logOut","logout","logOff","logoff","signOut","signout","signOff","signoff"],["minify","codeMinify","minifyCode"],["new","newChat","startNewChat"],["obfuscate","codeObfuscate","obfuscateCode"],["printAllFunctions","showAllFunctions"],["refactor","codeRefactor","refactorCode"],["refreshReply","regenerate","regenerateReply"],["refreshSession","sessionRefresh"],["renderHTML","renderHtml","renderLinks","renderTags"],["reviewCode","codeReview"],["send","sendChat","sendMsg"],["sendInNewChat","sendNewChat"],["sentiment","analyzeSentiment","sentimentAnalysis"],["stop","stopGenerating"],["suggest","suggestion","recommend"],["toggleAutoRefresh","toggleAutoRefresher","toggleRefresher","toggleSessionRefresher"],["toggleScheme","toggleMode"],["translate","translation","translator"],["unminify","unminifyCode","codeUnminify"],["writeCode","codeWrite"]],synonyms=[["account","acct"],["activate","turnOn"],["analyze","check","evaluate","review"],["ask","send","submit"],["chat","conversation","convo"],["data","details"],["deactivate","deActivate","turnOff"],["execute","interpret","interpreter","run"],["generating","generation"],["minify","uglify"],["refactor","rewrite"],["regenerate","regen"],["render","parse"],["reply","response"],["sentiment","attitude","emotion","feeling","opinion","perception"],["speak","say","speech","talk","tts"],["summarize","tldr"],["unminify","beautify","prettify","prettyPrint"]],camelCaser=e=>e.map((e,t)=>0===t||"s"==e?e:e.charAt(0).toUpperCase()+e.slice(1)).join("");for(const x3 in chatgpt){for(const y3 of functionAliases)if(y3.includes(x3))if(y3.some(e=>e.includes("."))){const A3=y3.find(e=>e.includes(".")).split(".")[1];for(const C3 of y3)/^(\w+)/.exec(C3)[1]!==x3&&(chatgpt[C3]=chatgpt[x3][A3])}else for(const D3 of y3)D3!==x3&&(chatgpt[D3]=chatgpt[x3]);do{var newFunctionsCreated=!1;for(const E3 in chatgpt)if("function"==typeof chatgpt[E3]){const F3=E3.split(/(?=[A-Zs])/);for(const G3 of F3){const H3=[].concat(...synonyms.filter(e=>e.includes(G3.toLowerCase())).map(e=>e.filter(e=>e!==G3.toLowerCase())));for(const L3 of H3){const M3=camelCaser(F3.map(e=>e==G3?L3:e));chatgpt[M3]||(chatgpt[M3]=chatgpt[E3],newFunctionsCreated=!0)}}}}while(newFunctionsCreated)}const consolePrefix="🤖 chatgpt.js >> ",ogError=console.error,ogInfo=console.info;console.error=(...e)=>{e[0].startsWith(consolePrefix)?ogError(...e):ogError(consolePrefix+e[0],...e.slice(1))},console.info=e=>{e.startsWith(consolePrefix)?ogInfo(e):ogInfo(consolePrefix+e)};try{window.chatgpt=chatgpt}catch(e){}try{module.exports=chatgpt}catch(e){}
7
+ `+o,new Promise(n=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return"user"==r?t.about_user_message+=o:"chatgpt"==r&&(t.about_model_message+=o),await this.sendRequest("POST",e,t),n()})})):console.error(`Invalid target ${r}. Valid targets are [${e}]`)):console.error("Please provide a valid target!")):console.error("Please provide an instruction")},clear:function(o){var e=["user","chatgpt"];return o?"string"!=typeof o?console.error("Target must be a string"):(o=o.toLowerCase(),e.includes(o)?new Promise(n=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return"user"==o?t.about_user_message="":"chatgpt"==o&&(t.about_model_message=""),await this.sendRequest("POST",e,t),n()})}):console.error(`Invalid target ${o}. Valid targets are [${e}]`)):console.error("Please provide a valid target!")},fetchData:function(){return new Promise(t=>{chatgpt.getAccessToken().then(async e=>t(await this.sendRequest("GET",e)))})},sendRequest:function(r,e,a){for(let e=0;e<arguments.length-1;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string`);var t=["POST","GET"];return(r=(r||"").trim().toUpperCase())&&t.includes(r)?e?a&&"object"!=typeof a?console.error(`Invalid body data type. Got ${typeof a}, expected object`):new Promise((t,n)=>{const o=new XMLHttpRequest;o.open(r,endpoints.openAI.instructions,!0),o.setRequestHeader("Accept-Language","en-US"),o.setRequestHeader("Authorization","Bearer "+e),"POST"==r&&o.setRequestHeader("Content-Type","application/json"),o.onload=()=>{var e=JSON.parse(o.responseText);return 422===o.status?n("🤖 chatgpt.js >> Character limit exceeded. Custom instructions can have a maximum length of 1500 characters."):403===o.status&&"content_policy"==e.detail.reason?n("🤖 chatgpt.js >> "+e.detail.description):200!==o.status?n("🤖 chatgpt.js >> Request failed. Cannot contact custom instructions endpoint."):(console.info("Custom instructions successfully contacted with method "+r),t(e||{}))},o.send(JSON.stringify(a)||"")}):console.error("Please provide a valid access token!"):console.error("Valid methods are "+t)},turnOff:function(){return new Promise(n=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return t.enabled=!1,await this.sendRequest("POST",e,t),n()})})},turnOn:function(){return new Promise(n=>{chatgpt.getAccessToken().then(async e=>{var t=await this.fetchData();return t.enabled=!0,await this.sendRequest("POST",e,t),n()})})},toggle:function(){return new Promise(t=>{this.fetchData().then(async e=>(await(e.enabled?this.turnOff():this.turnOn()),t()))})}},isChromium:function(){return chatgpt.browser.isChromium()},isDarkMode:function(){return document.documentElement.classList.toString().includes("dark")},isFirefox:function(){return chatgpt.browser.isFirefox()},isFullScreen:function(){return chatgpt.browser.isFullScreen()},isIdle:function(){return new Promise(e=>{const t=setInterval(()=>{chatgpt.getRegenerateButton()&&(clearInterval(t),e(!0))},100)})},isLoaded:function(){return new Promise(e=>{const t=setInterval(()=>{document.querySelector('nav button[id*="menu"]')&&(clearInterval(t),setTimeout(()=>{e(!0)},500))},100)})},isLightMode:function(){return document.documentElement.classList.toString().includes("light")},isMobileDevice:function(){return chatgpt.browser.isMobile()},logout:function(){window.location.href="https://chat.openai.com/auth/logout"},menu:{elements:[],addedEvent:!1,append:function(e,t={}){var n=["button","dropdown"];if(!e||"string"!=typeof e)return console.error("🤖 chatgpt.js >> Please supply a valid string element name!");if(e=e.toLowerCase(),!n.includes(e))return console.error(`🤖 chatgpt.js >> Invalid element! Valid elements are [${n}]`);const o=document.createElement("dropdown"==e?"select":"button"==e?"a":e);if(o.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),"button"==e){o.textContent=t?.label&&"string"==typeof t.label?t.label:"chatgpt.js button";n=document.createElement("img");n.src=t?.icon&&"string"==typeof t.icon?t.icon:endpoints.assets+"/starters/chrome/extension/icons/icon128.png",n.width=18,o.insertBefore(n,o.firstChild),o.onclick=t?.onclick&&"function"==typeof t.onclick?t.onclick:function(){}}else if("dropdown"==e){if(t?.items&&Array.isArray(t.items)&&t.items.length||(t.items=[{text:"🤖 chatgpt.js option",value:"chatgpt.js option value"}]),!t.items.every(e=>"object"==typeof e))return console.error("'items' must be an array of objects!");o.style="background-color: #000; width: 100%; border: none;",t.items.forEach(e=>{var t=document.createElement("option");t.textContent=e?.text,t.value=e?.value,o.add(t)})}const r=()=>{var e,t=document.querySelectorAll('a[role="menuitem"]');let n;for(e of t)if("Settings"==e.textContent){n=e.classList;break}const o=t[0].parentNode;chatgpt.menu.elements.forEach(e=>{if(e.setAttribute("class",n),!o.contains(e))try{o.insertBefore(e,o.firstChild)}catch(e){console.error(e)}})};this.elements.push(o);n=document.querySelector('nav button[id*="headless"]');return this.addedEvent||(n.addEventListener("click",()=>{setTimeout(r,25)}),this.addedEvent=!0),o.id},close:function(){var e=document.querySelector('nav [id*="menu-button"][aria-expanded="true"]');if(!e)throw console.error("Menu already hidden!"),new Error;try{e.click()}catch(e){throw console.error("Error while closing the menu"),new Error(e)}},open:function(){var e=document.querySelector('nav [id*="menu-button"][aria-expanded="false"]');if(!e)throw console.error("Menu already hidden!"),new Error;try{e.click()}catch(e){throw console.error("Error while closing the menu"),new Error(e)}}},minify:function(){chatgpt.code.minify()},notify:async function(t,e,n,o){n=n?+n:1.75;const r=document.createElement("div");r.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),r.classList.add("chatgpt-notif"),r.innerText=t,document.body.append(r);var t=document.createElement("div"),a=(t.title=cjsMessages?.tooltip_dismiss||"Dismiss",t.classList.add("notif-close-btn"),document.createElementNS("http://www.w3.org/2000/svg","svg")),s=(a.setAttribute("height","8px"),a.setAttribute("viewBox","0 0 14 14"),a.setAttribute("fill","none"),a.style.height=a.style.width="8px",document.createElementNS("http://www.w3.org/2000/svg","path"));s.setAttribute("fill-rule","evenodd"),s.setAttribute("clip-rule","evenodd"),s.setAttribute("fill","white"),s.setAttribute("d","M13.7071 1.70711C14.0976 1.31658 14.0976 0.683417 13.7071 0.292893C13.3166 -0.0976312 12.6834 -0.0976312 12.2929 0.292893L7 5.58579L1.70711 0.292893C1.31658 -0.0976312 0.683417 -0.0976312 0.292893 0.292893C-0.0976312 0.683417 -0.0976312 1.31658 0.292893 1.70711L5.58579 7L0.292893 12.2929C-0.0976312 12.6834 -0.0976312 13.3166 0.292893 13.7071C0.683417 14.0976 1.31658 14.0976 1.70711 13.7071L7 8.41421L12.2929 13.7071C12.6834 14.0976 13.3166 14.0976 13.7071 13.7071C14.0976 13.3166 14.0976 12.6834 13.7071 12.2929L8.41421 7L13.7071 1.70711Z"),a.append(s),t.append(a),r.append(t),r.isTop=!e||!/low|bottom/i.test(e),r.isRight=!e||!/left/i.test(e),r.quadrant=(r.isTop?"top":"bottom")+(r.isRight?"Right":"Left");let i=document.querySelector("#chatgpt-notif-style"),c=((!i||parseInt(i.getAttribute("last-updated"),10)<20231110)&&(i||((i=document.createElement("style")).id="chatgpt-notif-style",i.setAttribute("last-updated",20231110..toString()),document.head.append(i)),i.innerText=".chatgpt-notif {background-color: black ; padding: 10px 13px 10px 18px ; border-radius: 11px ; border: 1px solid #f5f5f7 ;opacity: 0 ; position: fixed ; z-index: 9999 ; font-size: 1.8rem ; color: white ;-webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none ; user-select: none ;"+`transform: translateX(${r.isRight?"":"-"}35px) ;`+(o?"box-shadow: -8px 13px 25px 0 "+(/\b(shadow|on)\b/gi.test(o)?"gray":o):"")+"}.notif-close-btn { cursor: pointer ; float: right ; position: relative ; right: -4px ; margin-left: -3px ;display: grid }@keyframes notif-zoom-fade-out { 0% { opacity: 1 ; transform: scale(1) }15% { opacity: 0.35 ; transform: rotateX(-27deg) scale(1.05) }45% { opacity: 0.05 ; transform: rotateX(-81deg) }100% { opacity: 0 ; transform: rotateX(-180deg) scale(1.15) }}"),JSON.parse(localStorage.notifyProps));c.queue[r.quadrant].push(r.id),localStorage.notifyProps=JSON.stringify(c),r.style.top=r.isTop?23..toString()+"px":"",r.style.bottom=r.isTop?"":23..toString()+"px",r.style.right=r.isRight?27..toString()+"px":"",r.style.left=r.isRight?"":27..toString()+"px";s=c.queue[r.quadrant];if(1<s.length)try{for(const f of s.slice(0,-1)){var l=document.getElementById(f),u=l.style.top?"top":"bottom",d=+/\d+/.exec(l.style[u])[0]+5+l.getBoundingClientRect().height;l.style[u]=d+"px"}}catch(e){}setTimeout(()=>{r.style.opacity=chatgpt.isDarkMode()?.8:.67,r.style.transform="translateX(0)",r.style.transition="transform 0.15s ease, opacity 0.15s ease"},10);t=n<.3?0:n-.3;let p,g;if(isFFtmScript){let e;for(;(e=Math.floor(3*Math.random())+1)===c.lastNthAudio;);c.lastNthAudio=e,localStorage.notifyProps=JSON.stringify(c),(p=new Audio).src=endpoints.assets+"/media/audio/notifications/bubble-pop/"+`${e}-${r.isRight?"right":"left"}.mp3`,g=setTimeout(()=>p.play().catch(()=>{}),1e3*t)}e=()=>{r.style.animation="notif-zoom-fade-out 0.3s ease-out",isFFtmScript&&p?.play().catch(()=>{}),clearTimeout(h),clearTimeout(g)};const h=setTimeout(e,1e3*t);a.addEventListener("click",e,{once:!0}),r.addEventListener("animationend",()=>{r.remove(),(c=JSON.parse(localStorage.notifyProps)).queue[r.quadrant].shift(),localStorage.notifyProps=JSON.stringify(c)},{once:!0})},obfuscate:function(){chatgpt.code.obfuscate()},printAllFunctions:function(){const t={cmdPrompt:["#ff00ff","#00ff00"],objName:["#0611e9","#f9ee16"],methodName:["#005aff","#ffa500"],entryType:["#467e06","#b981f9"],srcMethod:["#ff0000","#00ffff"]};Object.keys(t).forEach(e=>{t[e][1]=t[e][1]||"#"+(16777215^Number("0x1"+t[e][0].replace(/^#/,""))).toString(16).substring(1).toUpperCase()});var e=[];for(const c in this)if("function"==typeof this[c]){var n=!Object.keys(this).find(e=>Object.keys(this[e]).includes(this[c].name));e.push([n?"chatgpt":"other",c])}else if("object"==typeof this[c])for(const l in this[c])"function"==typeof this[c][l]&&e.push([c,l]);e.sort((e,t)=>e[0].localeCompare(t[0])||e[1].localeCompare(t[1]));var o=window.matchMedia("(prefers-color-scheme: dark)").matches,r="font-family: monospace ; font-size: larger ; ";console.log("\n%c🤖 chatgpt.js methods\n","font-family: sans-serif ; font-size: xxx-large ; font-weight: bold");for(const u of e){var a=/chatgpt|other/.test(u[0]),s="chatgpt"==u[0]?this[u[1]].name:"other"!==u[0]?u[0]+"."+u[1]:Object.keys(this).find(e=>Object.keys(this[e]).includes(this[u[1]].name))+"."+this[u[1]].name,i="AsyncFunction"==this[u[1]]?.constructor.name;console.log("%c>> %c"+(a?"":u[0]+".%c")+u[1]+" - https://chatgptjs.org/userguide/"+/(?:.*\.)?(.*)/.exec(s)[1].toLowerCase()+(i?"-async":"")+"\n%c[%c"+("chatgpt"==u[0]&&u[1]==this[u[1]].name||!a?"Function":"Alias of")+"%c: %c"+s+"%c]",r+"font-weight: bold ; color:"+t.cmdPrompt[+o],r+"font-weight: bold ;color:"+t[a?"methodName":"objName"][+o],r+"font-weight: "+(a?"initial":"bold")+";color:"+(a?"initial":t.methodName[+o]),r+"font-weight: "+(a?"bold":"initial")+";color:"+(a?t.entryType[+o]:"initial"),r+"font-weight: "+(a?"initial":"bold")+";color:"+(a?"initial":t.entryType[+o]),r+(a?"font-style: italic":"font-weight: initial")+";color:"+(a?t.srcMethod[+o]:"initial"),r+(a?"font-weight: initial":"font-style: italic")+";color:"+(a?"initial":t.srcMethod[+o]),a?"":r+"color: initial ; font-weight: initial")}},randomFloat:function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/4294967295},refactor:function(){chatgpt.code.refactor()},regenerate:function(){for(const e of document.querySelectorAll("form button"))if(e.textContent.toLowerCase().includes("regenerate"))return void e.click()},renderHTML:function(e){var t=/<([a-z\d]+)\b([^>]*)>([\s\S]*?)<\/\1>/g,n=/(\S+)=['"]?((?:.(?!['"]?\s+(?:\S+)=|[>']))+.)['"]?/g,o=e.childNodes;this.renderHTML.preWrapSet||(e.style.whiteSpace="pre-wrap",this.renderHTML.preWrapSet=!0,setTimeout(()=>{this.renderHTML.preWrapSet=!1},100));for(const i of o)if(i.nodeType==Node.TEXT_NODE){var r=i.nodeValue,a=Array.from(r.matchAll(t));if(0<a.length){const c=a[0],[l,u,d,p]=c.slice(0,4),g=document.createElement(u);g.textContent=p;Array.from(d.matchAll(n)).forEach(e=>{var t=e[1],e=e[2].replace(/['"]/g,"");g.setAttribute(t,e)});var a=this.renderHTML(g),s=document.createTextNode(r.substring(0,c.index)),r=document.createTextNode(r.substring(c.index+l.length));e.replaceChild(s,i),e.insertBefore(a,s.nextSibling),e.insertBefore(r,a.nextSibling)}}else i.nodeType==Node.ELEMENT_NODE&&this.renderHTML(i);return e},resend:async function(){chatgpt.send(await chatgpt.getChatData("latest","msg","user","latest"))},response:{get:function(){return(window.location.href.startsWith("https://chat.openai.com/c/")?this.getFromDOM:this.getFromAPI).apply(null,arguments)},getFromAPI:function(e,t){return e=e||"latest",t=t||"latest",chatgpt.getChatData(e,"msg","chatgpt",t)},getFromDOM:function(e){var t=document.querySelectorAll('div[data-testid*="conversation-turn"]:nth-child(odd)'),n=e.toString().toLowerCase();let o="";return o=t.length?(o=(/last|final/.test(n)?t[t.length-1]:t[(Number.isInteger(e)?e:/^\d+/.test(n)?/^\d+/.exec(n)[0]:(/^(?:1|one|fir)(?:st)?$/.test(n)?1:/^(?:2|tw(?:o|en|el(?:ve|f))|seco)(?:nd|t[yi])?(?:e?th)?$/.test(n)?2:/^(?:3|th(?:ree|ir?))(?:rd|teen|t[yi])?(?:e?th)?$/.test(n)?3:/^(?:4|fou?r)(?:teen|t[yi])?(?:e?th)?$/.test(n)?4:/^(?:5|fi(?:ve|f))(?:teen|t[yi])?(?:e?th)?$/.test(n)?5:/^(?:6|six)(?:teen|t[yi])?(?:e?th)?$/.test(n)?6:/^(?:7|seven)(?:teen|t[yi])?(?:e?th)?$/.test(n)?7:/^(?:8|eight?)(?:teen|t[yi])?(?:e?th)?$/.test(n)?8:/^(?:9|nine?)(?:teen|t[yi])?(?:e?th)?$/.test(n)?9:/^(?:10|ten)(?:th)?$/.test(n)?10:1)*(/(ty|ieth)$/.test(n)?10:1)+(/teen(th)?$/.test(n)?10:0))-1]).textContent).replace(/^ChatGPTChatGPT/,""):o},getLast:function(){return chatgpt.getChatData("active","msg","chatgpt","latest")},regenerate:function(){for(const e of document.querySelectorAll("form button"))if(e.textContent.toLowerCase().includes("regenerate"))return void e.click()},stopGenerating:function(){document.querySelectorAll("form button svg").forEach(e=>{e.querySelector('path[d*="2 0 0 1 2"]')&&e.parentNode.click()})}},reviewCode:function(){chatgpt.code.review()},scrollToBottom:function(){try{document.querySelector('button[class*="cursor"][class*="bottom"]').click()}catch(e){console.error("",e)}},send:function(e,t=""){for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string!`);const n=document.querySelector("form textarea"),o=document.querySelector('form button[class*="bottom"]'),r=(n.value=e,n.dispatchEvent(new Event("input",{bubbles:!0})),setInterval(()=>{o?.hasAttribute("disabled")||("click"==t.toLowerCase()||chatgpt.browser.isMobile()?o.click():n.dispatchEvent(new KeyboardEvent("keydown",{keyCode:13,bubbles:!0})),clearInterval(r))},25))},sendInNewChat:function(e){if("string"!=typeof e)return console.error("Message must be a string!");for(const t of document.querySelectorAll("nav a"))if(/(new|clear) chat/i.test(t.text)){t.click();break}setTimeout(()=>{chatgpt.send(e)},500)},settings:{scheme:{isDark:function(){return document.documentElement.classList.contains("dark")},isLight:function(){return document.documentElement.classList.contains("light")},set:function(e){var t=["dark","light","system"];if(!e)return console.error("Please specify a scheme value!");if(!t.includes(e))return console.error(`Invalid scheme value. Valid values are [${t}]`);let n=e;"system"==e&&(n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),localStorage.setItem("theme",e),console.info(`Scheme set to ${e.toUpperCase()}.`),document.documentElement.classList.contains(n)||this.toggle()},toggle:function(){var[e,t]=this.isDark()?["dark","light"]:["light","dark"];document.documentElement.classList.replace(e,t),document.documentElement.style.colorScheme=t,localStorage.setItem("theme",t)}}},sentiment:async function(e,t){for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send("What is the sentiment of the following text"+(t?` towards the entity ${t},`:"")+" from strongly negative to strongly positive?\n\n"+e),console.info("Analyzing sentiment..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")},setScheme:function(e){chatgpt.settings.scheme.set(e)},shareChat:function(s,i="clipboard"){var e=["alert","notify","notification","clipboard","copy"];if(!e.includes(i))return console.error("Invalid method '"+i+"' passed. Valid methods are ["+e+"].");return new Promise(n=>{chatgpt.getAccessToken().then(t=>{var r;r=t,new Promise((t,n)=>{const o=new XMLHttpRequest;chatgpt.getChatData(s).then(e=>{o.open("GET",endpoints.openAI.chat+"/"+e.id,!0),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Authorization","Bearer "+r),o.onload=()=>200!==o.status?n("🤖 chatgpt.js >> Request failed. Cannot retrieve chat node."):t(JSON.parse(o.responseText).current_node),o.send()})}).then(e=>{var r,a;r=t,a=e,new Promise((t,n)=>{const o=new XMLHttpRequest;chatgpt.getChatData(s).then(e=>{o.open("POST",endpoints.openAI.share_create,!0),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Authorization","Bearer "+r),o.onload=()=>200!==o.status?n("🤖 chatgpt.js >> Request failed. Cannot initialize share chat."):t(JSON.parse(o.responseText)),o.send(JSON.stringify({current_node_id:a,conversation_id:e.id,is_anonymous:!0}))})}).then(e=>{var o,r;o=t,r=e,new Promise((e,t)=>{const n=new XMLHttpRequest;n.open("PATCH",endpoints.openAI.share+"/"+r.share_id,!0),n.setRequestHeader("Content-Type","application/json"),n.setRequestHeader("Authorization","Bearer "+o),n.onload=()=>200!==n.status?t("🤖 chatgpt.js >> Request failed. Cannot share chat."):(console.info(`Chat shared at '${r.share_url}'`),e()),n.send(JSON.stringify({share_id:r.share_id,highlighted_message_id:r.highlighted_message_id,title:r.title,is_public:!0,is_visible:r.is_visible,is_anonymous:r.is_anonymous}))}).then(()=>{["copy","clipboard"].includes(i)?navigator.clipboard.writeText(e.share_url):chatgpt.alert("🚀 Share link created!",'"'+e.title+'" is available at: <a target="blank" rel="noopener" href="'+e.share_url+'" >'+e.share_url+"</a>",[function(){window.open(e.share_url,"_blank","noopener")},function(){navigator.clipboard.writeText(e.share_url)}]),n(e.share_url)})})})})})},sidebar:{elements:[],observer:{},activateObserver:function(){var e,t=document.querySelector("nav").querySelector("a");if(chatgpt.history.isOff())try{t.parentNode.nextElementSibling.style.display="none"}catch(e){}if(this.observer instanceof MutationObserver)try{this.observer.disconnect()}catch(e){}if(!this.elements.length)return console.error("🤖 chatgpt.js >> No elements to append!");let n;for(e of document.querySelectorAll("nav a"))if(/.*chat/.exec(e.text)[0]){n=e.classList,e.parentNode.style.margin="2px 0";break}this.elements.forEach(e=>{e.setAttribute("class",n),e.style.maxHeight=e.style.minHeight="44px",e.style.margin="2px 0"});const o=document.querySelector("nav");this.observer=new MutationObserver(e=>{e.forEach(e=>{("childList"==e.type&&e.addedNodes.length||"attributes"==e.type&&"data-chatgptjs"==e.attributeName)&&this.elements.forEach(e=>{if(!o.contains(e))try{o.insertBefore(e,o.querySelector("a").parentNode)}catch(e){console.error(e)}})})}),this.observer.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0})},append:function(e,t={}){var n=["button","dropdown"];if(!e||"string"!=typeof e)return console.error("🤖 chatgpt.js >> Please supply a valid string element name!");if(e=e.toLowerCase(),!n.includes(e))return console.error(`🤖 chatgpt.js >> Invalid element! Valid elements are [${n}]`);const o=document.createElement("dropdown"==e?"select":e);if(o.id=Math.floor(1e6*chatgpt.randomFloat())+Date.now(),"button"==e){o.textContent=t?.label&&"string"==typeof t.label?t.label:"chatgpt.js button";n=document.createElement("img");n.src=t?.icon&&"string"==typeof t.icon?t.icon:endpoints.assets+"/starters/chrome/extension/icons/icon128.png",n.width=18,o.insertBefore(n,o.firstChild),o.onclick=t?.onclick&&"function"==typeof t.onclick?t.onclick:function(){}}else if("dropdown"==e){if(t?.items&&Array.isArray(t.items)&&t.items.length||(t.items=[{text:"🤖 chatgpt.js option",value:"chatgpt.js option value"}]),!t.items.every(e=>"object"==typeof e))return console.error("'items' must be an array of objects!");t.items.forEach(e=>{var t=document.createElement("option");t.textContent=e?.text,t.value=e?.value,o.add(t)})}return"dropdown"==e&&(o.style.backgroundColor="var(--gray-900, rgb(32, 33, 35))"),this.elements.push(o),this.activateObserver(),document.body.setAttribute("data-chatgptjs","observer-trigger"),o.id},hide:function(){this.isOn()?this.toggle():console.info("Sidebar already hidden!")},show:function(){this.isOff()?this.toggle():console.info("Sidebar already shown!")},isOff:function(){return!this.isOn()},isOn:function(){return chatgpt.browser.isMobile()?"hidden"==document.documentElement.style.overflow:"hidden"!=document.querySelector("#__next > div > div").style.visibility},toggle:function(){var e=chatgpt.browser.isMobile(),t=e?()=>!0:e=>Array.from(e.querySelectorAll("*")).some(e=>e.style.transform.includes("translateY"));for(const n of document.querySelectorAll(e?"#__next button":"main button"))if(t(n))return void n.click()}},startNewChat:function(){for(const e of document.querySelectorAll("nav a"))if(/(new|clear) chat/i.test(e.text))return void e.click()},stop:function(){for(const e of document.querySelectorAll("form button"))if(e.textContent.toLowerCase().includes("stop"))return void e.click()},suggest:async function(e,t){if(!e)return console.error("ideaType (1st argument) not supplied(e.g. 'gifts', 'names', 'recipes', etc.)");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string.`);return chatgpt.send("Suggest some names. "+(t||"")),console.info(`Creating ${e}...`),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")},speak:function(e,t={}){var n,{voice:o=2,pitch:r=2,speed:a=1.1}=t;if("string"!=typeof e)return console.error("Message must be a string!");for(n in t){var s=t[n];if("number"!=typeof s&&!/^\d+$/.test(s))return console.error(`Invalid ${n} index '${s}'. Must be a number!`)}try{var i=speechSynthesis.getVoices(),c=new SpeechSynthesisUtterance;c.text=e,c.voice=i[o],c.pitch=r,c.rate=a,speechSynthesis.speak(c)}catch(e){console.error(e)}},summarize:async function(e){return e?"string"!=typeof e?console.error("Text argument must be a string!"):(chatgpt.send("Summarize the following text:\n\n"+e),console.info("Summarizing text..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")):console.error("Text (1st) argument not supplied. Pass some text!")},toggleScheme:function(){chatgpt.settings.scheme.toggle()},translate:async function(e,t){if(!e)return console.error("Text (1st) argument not supplied. Pass some text!");if(!t)return console.error("outputLang (2nd) argument not supplied. Pass a language!");for(let e=0;e<arguments.length;e++)if("string"!=typeof arguments[e])return console.error(`Argument ${e+1} must be a string!`);return chatgpt.send("Translate the following text to "+t+". Only reply with the translation.\n\n"+e),console.info("Translating text..."),await chatgpt.isIdle(),chatgpt.getChatData("active","msg","chatgpt","latest")},unminify:function(){chatgpt.code.unminify()},uuidv4:function(){let n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{var t=(n+window.crypto.getRandomValues(new Uint32Array(1))[0]/(Math.pow(2,32)-1)*16)%16|0;return n=Math.floor(n/16),("x"==e?t:3&t|8).toString(16)})},writeCode:function(){chatgpt.code.write()}},buttonActions=(chatgpt.scheme={...chatgpt.settings.scheme},["click","get"]),targetTypes=["button","link","div","response"];for(const m3 of buttonActions)chatgpt[m3+"Button"]=function(n){var e=/^[.#]/.test(n)?document.querySelector(n):/send/i.test(n)?document.querySelector('form button[class*="bottom"]'):/scroll/i.test(n)?document.querySelector('button[class*="cursor"]'):function(){for(const e of document.querySelectorAll("button"))if(e.textContent.toLowerCase().includes(n.toLowerCase()))return e;for(const t of document.querySelectorAll("nav a"))if(t.textContent.toLowerCase().includes(n.toLowerCase()))return t}();if("click"!=m3)return e;e.click()};const functionAliases=[["actAs","actas","act","become","persona","premadePrompt","preMadePrompt","prePrompt","preprompt","roleplay","rolePlay","rp"],["activateAutoRefresh","activateAutoRefresher","activateRefresher","activateSessionRefresher","autoRefresh","autoRefresher","autoRefreshSession","refresher","sessionRefresher"],["deactivateAutoRefresh","deactivateAutoRefresher","deactivateRefresher","deactivateSessionRefresher"],["detectLanguage","getLanguage"],["executeCode","codeExecute"],["exportChat","chatExport","export"],["getLastPrompt","getLastQuery","getMyLastMsg","getMyLastQuery"],["getTextarea","getTextArea","getChatbox","getChatBox"],["isFullScreen","isFullscreen"],["logOut","logout","logOff","logoff","signOut","signout","signOff","signoff"],["minify","codeMinify","minifyCode"],["new","newChat","startNewChat"],["obfuscate","codeObfuscate","obfuscateCode"],["printAllFunctions","showAllFunctions"],["refactor","codeRefactor","refactorCode"],["refreshReply","regenerate","regenerateReply"],["refreshSession","sessionRefresh"],["renderHTML","renderHtml","renderLinks","renderTags"],["reviewCode","codeReview"],["send","sendChat","sendMsg"],["sendInNewChat","sendNewChat"],["sentiment","analyzeSentiment","sentimentAnalysis"],["stop","stopGenerating"],["suggest","suggestion","recommend"],["toggleAutoRefresh","toggleAutoRefresher","toggleRefresher","toggleSessionRefresher"],["toggleScheme","toggleMode"],["translate","translation","translator"],["unminify","unminifyCode","codeUnminify"],["writeCode","codeWrite"]],synonyms=[["account","acct"],["activate","turnOn"],["analyze","check","evaluate","review"],["ask","send","submit"],["chat","conversation","convo"],["data","details"],["deactivate","deActivate","turnOff"],["execute","interpret","interpreter","run"],["generating","generation"],["minify","uglify"],["refactor","rewrite"],["regenerate","regen"],["render","parse"],["reply","response"],["sentiment","attitude","emotion","feeling","opinion","perception"],["speak","say","speech","talk","tts"],["summarize","tldr"],["unminify","beautify","prettify","prettyPrint"]],camelCaser=e=>e.map((e,t)=>0===t||"s"==e?e:e.charAt(0).toUpperCase()+e.slice(1)).join("");for(const v3 in chatgpt){for(const w3 of functionAliases)if(w3.includes(v3))if(w3.some(e=>e.includes("."))){const y3=w3.find(e=>e.includes(".")).split(".")[1];for(const A3 of w3)/^(\w+)/.exec(A3)[1]!==v3&&(chatgpt[A3]=chatgpt[v3][y3])}else for(const B3 of w3)B3!==v3&&(chatgpt[B3]=chatgpt[v3]);do{var newFunctionsCreated=!1;for(const C3 in chatgpt)if("function"==typeof chatgpt[C3]){const D3=C3.split(/(?=[A-Zs])/);for(const E3 of D3){const F3=[].concat(...synonyms.filter(e=>e.includes(E3.toLowerCase())).map(e=>e.filter(e=>e!==E3.toLowerCase())));for(const J3 of F3){const K3=camelCaser(D3.map(e=>e==E3?J3:e));chatgpt[K3]||(chatgpt[K3]=chatgpt[C3],newFunctionsCreated=!0)}}}}while(newFunctionsCreated)}const consolePrefix="🤖 chatgpt.js >> ",ogError=console.error,ogInfo=console.info;console.error=(...e)=>{e[0].startsWith(consolePrefix)?ogError(...e):ogError(consolePrefix+e[0],...e.slice(1))},console.info=e=>{e.startsWith(consolePrefix)?ogInfo(e):ogInfo(consolePrefix+e)};try{window.chatgpt=chatgpt}catch(e){}try{module.exports=chatgpt}catch(e){}
package/docs/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Stars&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/License-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/blob/main/LICENSE)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=Commits&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=Code+Quality&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/Mentioned_in-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/Featured_on-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // Your code here...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest();
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
93
93
  xhr.onload = function () {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script');
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // Your code here...
package/docs/USERGUIDE.md CHANGED
@@ -143,7 +143,7 @@
143
143
 
144
144
  ```js
145
145
  (async () => {
146
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
146
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
147
147
  // Your code here...
148
148
  })();
149
149
  ```
@@ -152,7 +152,7 @@
152
152
 
153
153
  ```js
154
154
  var xhr = new XMLHttpRequest();
155
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
155
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
156
156
  xhr.onload = function () {
157
157
  if (xhr.status === 200) {
158
158
  var chatgptJS = document.createElement('script');
@@ -174,7 +174,7 @@ function yourCode() {
174
174
 
175
175
  ```js
176
176
  ...
177
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
177
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
178
178
  // ==/UserScript==
179
179
 
180
180
  // Your code here...
package/docs/de/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Sterne&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/Lizenz-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=Commits&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=Codequalität&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/Erwähnt_in-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/Vorgestellt_auf-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // Ihr Code hier...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest();
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
93
93
  xhr.onload = function () {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script');
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // Ihr Code hier...
package/docs/es/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Estrellas&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/Licencia-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=Confirmaciones&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=Calidad+del+Código&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/Mencionado_en-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/Presentado_en-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // Tu código aquí...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest();
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
93
93
  xhr.onload = function () {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script');
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // Tu código aquí...
package/docs/fr/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Étoiles&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/Licence-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=Commits&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=Qualité+du+Code&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/Mentionné_dans-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/Présenté_sur-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // Votre code ici...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest();
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
93
93
  xhr.onload = function () {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script');
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // Votre code ici...
package/docs/hi/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Stars&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/License-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=Commits&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=Code+Quality&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/Mentioned_in-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/Featured_on-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // आपका कोड यहां लिखें...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest()
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js')
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js')
93
93
  xhr.onload = function() {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script')
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // आपका कोड यहां लिखें...
package/docs/it/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Stelle&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/Licenza-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=Commette&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=Qualità+del+Codice&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/Menzionato_in-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/In_Evidenza-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // Il tuo codice qui...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest();
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
93
93
  xhr.onload = function () {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script');
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // Il tuo codice qui...
package/docs/ja/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=出演者&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/ライセンス-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=コミット&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=コードの品質&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/で言及-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/で特集されました-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // コードはここにあります...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest()
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js')
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js')
93
93
  xhr.onload = function() {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script')
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // コードはここにあります...
package/docs/ko/README.md CHANGED
@@ -44,7 +44,7 @@
44
44
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=별&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
45
45
  [![](https://img.shields.io/badge/라이센스-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
46
46
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=커밋&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
47
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
48
48
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=코드+품질&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
49
49
  [![](https://img.shields.io/badge/언급됨-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
50
50
  [![](https://img.shields.io/badge/특집_소개-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -81,7 +81,7 @@
81
81
 
82
82
  ```js
83
83
  (async () => {
84
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
84
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
85
85
  // 코드를 여기에 작성해 주세요...
86
86
 
87
87
  })();
@@ -91,7 +91,7 @@
91
91
 
92
92
  ```js
93
93
  var xhr = new XMLHttpRequest();
94
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
94
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
95
95
  xhr.onload = function () {
96
96
  if (xhr.status === 200) {
97
97
  var chatgptJS = document.createElement('script');
@@ -115,7 +115,7 @@ function yourCode() {
115
115
 
116
116
  ```js
117
117
  ...
118
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
118
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
119
119
  // ==/UserScript==
120
120
 
121
121
  // 코드를 여기에 작성해 주세요...
package/docs/ne/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Stars&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/License-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=Commits&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=Code+Quality&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/Mentioned_in-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/Featured_on-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // आफ्नो कोड यहाँ लेख्नुहोस्...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest()
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js')
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js')
93
93
  xhr.onload = function() {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script')
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // आफ्नो कोड यहाँ लेख्नुहोस्...
package/docs/nl/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Sterren&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/Licentie-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=Begaat&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=Codekwaliteit&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/Vermeld_in-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/Uitgelicht_op-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // Uw code hier...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest();
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
93
93
  xhr.onload = function () {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script');
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // Uw code hier...
package/docs/pt/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Estrelas&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/Licença-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=Confirma&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=Qualidade+do+Código&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/Mencionado_em-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/Destaque_em-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // Seu código aqui...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest();
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
93
93
  xhr.onload = function () {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script');
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // Seu código aqui...
package/docs/vi/README.md CHANGED
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Ngôi+sao&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/Giấy_Phép-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=Cam+Kết&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=Chất+Lượng+Mã&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/Đề_Cập_Trong-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/Đặc_Trưng_Trên-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // Mã của bạn ở đây ...
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest();
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
93
93
  xhr.onload = function () {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script');
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // Mã của bạn ở đây ...
@@ -43,7 +43,7 @@
43
43
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=星星&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
44
44
  [![](https://img.shields.io/badge/许可证-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
45
45
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=提交&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
46
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
47
47
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=代码质量&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
48
48
  [![](https://img.shields.io/badge/中提到-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
49
49
  [![](https://img.shields.io/badge/精选于-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -80,7 +80,7 @@
80
80
 
81
81
  ```js
82
82
  (async () => {
83
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
83
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
84
84
  // 这里是您的代码
85
85
  })();
86
86
  ```
@@ -89,7 +89,7 @@
89
89
 
90
90
  ```js
91
91
  var xhr = new XMLHttpRequest()
92
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js')
92
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js')
93
93
  xhr.onload = function() {
94
94
  if (xhr.status === 200) {
95
95
  var chatgptJS = document.createElement('script')
@@ -111,7 +111,7 @@ function yourCode() {
111
111
 
112
112
  ```js
113
113
  ...
114
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
114
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
115
115
  // ==/UserScript==
116
116
 
117
117
  // 这里是您的代码
@@ -42,7 +42,7 @@
42
42
  [![](https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=星星&color=gold&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/KudoAI/chatgpt.js/stargazers)
43
43
  [![](https://img.shields.io/badge/许可证-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge)](LICENSE.md)
44
44
  [![](https://img.shields.io/github/commit-activity/m/kudoai/chatgpt.js?label=提交&logo=github&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/kudoai/chatgpt.js/commits/main)
45
- ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.4.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
45
+ ![](https://img.shields.io/github/size/kudoai/chatgpt.js/dist/chatgpt-2.6.6.min.js?label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge)
46
46
  [![](https://img.shields.io/codacy/grade/696917c8e5a949c49edb89ed2f43d5ba?label=代碼質量&logo=codacy&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge)](https://app.codacy.com/gh/KudoAI/chatgpt.js/commits?utm_source=chatgpt%2Ejs&utm_content=github_shield)
47
47
  [![](https://img.shields.io/badge/中提到-Awesome-cca8c4?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge)](https://github.com/sindresorhus/awesome-chatgpt#javascript)
48
48
  [![](https://img.shields.io/badge/精選於-Product_Hunt-ff6154?logo=producthunt&logoColor=white&labelColor=464646&style=for-the-badge)](https://www.producthunt.com/posts/chatgpt-js)
@@ -79,7 +79,7 @@
79
79
 
80
80
  ```js
81
81
  (async () => {
82
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
82
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
83
83
  // 你的代碼在這裡...
84
84
  })();
85
85
  ```
@@ -88,7 +88,7 @@
88
88
 
89
89
  ```js
90
90
  var xhr = new XMLHttpRequest();
91
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js');
91
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js');
92
92
  xhr.onload = function () {
93
93
  if (xhr.status === 200) {
94
94
  var chatgptJS = document.createElement('script');
@@ -110,7 +110,7 @@ function yourCode() {
110
110
 
111
111
  ```js
112
112
  ...
113
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
113
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
114
114
  // ==/UserScript==
115
115
 
116
116
  // 你的代碼在這裡...
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kudoai/chatgpt.js",
3
- "version": "2.6.5",
3
+ "version": "2.6.6",
4
4
  "description": "Client-side JavaScript library for ChatGPT",
5
5
  "author": {
6
6
  "name": "KudoAI & contributors",
@@ -63,9 +63,9 @@
63
63
  },
64
64
  "devDependencies": {
65
65
  "@adamlui/minify.js": "^1.1.2",
66
- "@adamlui/scss-to-css": "^1.3.1",
66
+ "@adamlui/scss-to-css": "^1.3.2",
67
67
  "docsify-cli": "^4.4.4",
68
- "eslint": "^8.56.0",
68
+ "eslint": "^8.57.0",
69
69
  "eslint-plugin-json-schema-validator": "^4.8.3",
70
70
  "eslint-plugin-yml": "^1.12.2",
71
71
  "husky": "^9.0.11"
@@ -936,7 +936,7 @@ const chatgpt = {
936
936
  getStopGeneratingButton: function() {
937
937
  for (const formButton of document.querySelectorAll('form button')) {
938
938
  const ariaLabel = formButton.getAttribute('aria-label');
939
- if (ariaLabel && ariaLabel.toLowerCase().includes('stop'))
939
+ if (ariaLabel?.toLowerCase().includes('stop'))
940
940
  return formButton;
941
941
  }},
942
942
 
@@ -1557,7 +1557,7 @@ const chatgpt = {
1557
1557
  stopGenerating: function() {
1558
1558
  for (const formButton of document.querySelectorAll('form button')) {
1559
1559
  const ariaLabel = formButton.getAttribute('aria-label');
1560
- if (ariaLabel && ariaLabel.toLowerCase().includes('stop')) {
1560
+ if (ariaLabel?.toLowerCase().includes('stop')) {
1561
1561
  formButton.click(); return;
1562
1562
  }}}
1563
1563
  },
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 3,
3
3
  "name": "ChatGPT Extension",
4
4
  "description": "A Chrome template to start using chatgpt.js like a boss!",
5
- "version": "2024.2.23",
5
+ "version": "2024.3.1",
6
6
  "author": "chatgpt.js",
7
7
  "icons": {
8
8
  "16": "icons/icon16.png",
@@ -3,12 +3,12 @@
3
3
  // @description A Greasemonkey template to start using chatgpt.js like a boss
4
4
  // @author chatgpt.js
5
5
  // @namespace https://chatgpt.js.org
6
- // @version 2024.2.23.1
6
+ // @version 2024.3.1
7
7
  // @license MIT
8
8
  // @match https://chat.openai.com/*
9
9
  // @icon https://raw.githubusercontent.com/kudoai/chatgpt.js-greasemonkey-starter/main/media/images/icons/robot/icon48.png
10
10
  // @icon64 https://raw.githubusercontent.com/kudoai/chatgpt.js-greasemonkey-starter/main/media/images/icons/robot/icon64.png
11
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.5/dist/chatgpt.min.js
11
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.6/dist/chatgpt.min.js
12
12
  // @grant GM_getValue
13
13
  // @grant GM_setValue
14
14
  // @noframes