((e,t,o,r)=>{let a=document.currentScript;if(!a)return;let i=a.dataset.icon??t,n=o??"#fff",je=e=>{try{return localStorage.getItem(e)}catch{return null}},Ze=e=>{try{localStorage.removeItem(e)}catch{}},s=a.dataset.thread??je(`${e}:thread`)??(()=>{try{return crypto.randomUUID()}catch{let _t=e=>Array(e).fill(0).map(()=>Math.floor(16*Math.random()).toString(16)).join("");return`${_t(8)}-${_t(4)}-${_t(4)}-${_t(4)}-${_t(12)}`}})();((e,t)=>{try{localStorage.setItem(e,t)}catch{}})(`${e}:thread`,s);let d=a.dataset.user??je(`${e}:user`),c=new URL(e);s&&c.searchParams.set("thread",s),d&&c.searchParams.set("user",d);let l=parseInt(a.dataset.offsetX??"0"),p=parseInt(a.dataset.offsetY??"0"),g=document.querySelector("#wordgpt-chat-button");g||(g=document.createElement("div")).setAttribute("id","wordgpt-chat-button");let u=` #wordgpt-chat-button { position: fixed; bottom: ${20+p}px; right: ${20+l}px; width: 50px; height: 50px; border-radius: 25px; background-color: ${n}; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); cursor: pointer; z-index: 999999998; padding: 5px; } #wordgpt-chat-engage { position: fixed; bottom: ${100+p}px; right: ${20+l}px; width: 250px; height: 50px; // border-radius: 25px; // background-color: ${n}; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); cursor: pointer; // z-index: 999999998; padding: 5px; opacity: 0; pointer-events: none; z-index: -1; // flex-direction: column; justify-content: center; align-items: right; display: flex; font-size: 16px; font-weight: bold; border-radius: 10px; // background: linear-gradient(135deg, rgb(42, 39, 218) 0%, rgb(0, 204, 255) 60%, ${n} 100%); background: linear-gradient(135deg, rgb(42, 39, 218) 0%, rgb(128, 0, 128) 60%, ${n} 100%); } #wordgpt-chat-engage-text { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; color: #fff; font-size: 20px; font-weight: bold; // text-shadow: 0 0 2px #000; flex: 1; } #wordgpt-chat-close { // width: 100 %; text-align: right; color: #000; font-size: 16px; font-weight: bold; // border: 1px solid #000; padding: 1px; // border-radius: 5px; // cursor: pointer; } #wordgpt-chat-window { position: fixed; display: flex; flex-direction: column; justify-content: space-between; bottom: ${80+p}px; right: ${20+l}px; background-color: #fff; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); opacity: 0; pointer-events: none; border-radius: 12px; overflow: hidden; height: min(860px, 100vh - 120px); width: 600px; z-index: -1; } #wordgpt-chat-window-icon { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; background-image: url(${i}); background-size: cover; background-position: center; background-repeat: no-repeat; z-index: 999999999; } #wordgpt-chat-window-close { display: flex; position: absolute; justify-content: right; top: 5px; right: 35px; width: 50px; height: 50px; border-radius: 25px; background: white; color: #000; cursor: pointer; z-index: 999999999; align-items: center; width: 30px; height: 30px; } #wordgpt-chat-iframe { width: 100%; height: 100%; border: none; } @media only screen and (max-width: 600px) { #wordgpt-chat-window { bottom: 0; right: 0; left: 0; top: 0; height: 100%; width: 100%; display: flex; align-items: flex-end; border-radius: 0; } #wordgpt-chat-iframe { height: 100%; } } `,h=document.querySelector("#wordgpt-chat-style");h||((h=document.createElement("style")).setAttribute("id","wordgpt-chat-style"),h.innerHTML=u,document.head.appendChild(h));let m=document.querySelector("#wordgpt-chat-window");m||((m=document.createElement("div")).setAttribute("id","wordgpt-chat-window"),document.body.appendChild(m));let b=document.querySelector("#wordgpt-chat-window-icon");b||((b=document.createElement("div")).setAttribute("id","wordgpt-chat-window-icon"),g.appendChild(b),document.body.appendChild(g)),m.innerHTML=`