(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(":root{--voltade-chat-margin: 24px;--voltade-chat-width: 50%;--voltade-chat-z-index: 9999;--voltade-chat-border: 1px solid #ced4da;--voltade-chat-border-radius: 8px;--voltade-chat-button-margin: 24px;--voltade-chat-button-height: 44px;--voltade-chat-button-animation: voltade-bounce 1s ease 3}@media screen and (max-width: 1024px){:root{--voltade-chat-margin: 16px;--voltade-chat-width: 60%;--voltade-chat-button-margin: 16px}}@media screen and (max-width: 768px){:root{--voltade-chat-margin: 12px;--voltade-chat-width: 75%;--voltade-chat-button-margin: 12px}}@media screen and (max-width: 576px){:root{--voltade-chat-margin: 0px;--voltade-chat-width: 100%;--voltade-chat-button-height: 40px;--voltade-chat-border-radius: 0px;--voltade-chat-button-margin: 12px}}#voltade-chat-button{position:fixed;top:auto;right:var(--voltade-chat-button-margin);bottom:var(--voltade-chat-button-margin);height:var(--voltade-chat-button-height);margin:0;padding:0 16px;color:var(--voltade-chat-button-text-color);background-color:var(--voltade-chat-button-background-color);border:none;border-radius:32px;cursor:pointer;display:flex;gap:8px;align-items:center;justify-content:center;z-index:var(--voltade-chat-z-index);transition:transform .2s ease;animation:var(--voltade-chat-button-animation)}#voltade-chat-button:hover{transform:scale(1.05)}#voltade-chat-button:active{transform:none}#voltade-chat-button-text{font-size:16px;font-weight:400;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}#voltade-chat-button-icon{display:flex;font-size:19.2px}#voltade-chat-button-icon svg{width:1.2em;height:1.2em}@media screen and (max-width: 576px){#voltade-chat-button{padding:0 12.8px}#voltade-chat-button-text{font-size:14.4px}#voltade-chat-button-icon{font-size:16px}}@media screen and (max-width: 576px){#voltade-chat-button.voltade-chat-button-round{padding:0;min-width:48px;min-height:48px}#voltade-chat-button.voltade-chat-button-round #voltade-chat-button-text{display:none}#voltade-chat-button.voltade-chat-button-round #voltade-chat-button-icon{font-size:19.2px}}#voltade-chat-container{display:none;position:fixed;right:var(--voltade-chat-margin);bottom:calc(var(--voltade-chat-button-margin) * 2 + var(--voltade-chat-button-height));width:var(--voltade-chat-width);height:calc(100% - var(--voltade-chat-button-margin) * 2 - var(--voltade-chat-margin) - var(--voltade-chat-button-height));background-color:#fff;border:var(--voltade-chat-border);border-radius:var(--voltade-chat-border-radius);overflow:hidden;z-index:var(--voltade-chat-z-index)}#voltade-chat-container[data-open=true]{display:block}#voltade-chat-iframe{border:none;width:100%;height:100%}#voltade-chat-loading-container{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:80px;height:80px;display:flex;align-items:center;justify-content:center}#voltade-chat-loading-spinner{position:absolute;border:6px solid #f3f3f3;border-radius:50%;border-top:6px solid var(--voltade-chat-button-background-color);width:100%;height:100%;animation:voltade-spin 2s linear infinite}#voltade-chat-loading-logo{width:100%;height:100%;border-radius:50%;background-size:90%;background-position:center center;background-repeat:no-repeat}@keyframes voltade-bounce{0%,to{transform:translateY(0)}50%{transform:translateY(-20px)}}@keyframes voltade-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:root{--voltade-attentive-background-color: #000;--voltade-attentive-text-color: #fff;--voltade-attentive-border-radius: 16px}#voltade-attentive-message{position:fixed;display:flex;align-items:center;gap:12px;right:var(--voltade-chat-button-margin);bottom:calc(var(--voltade-chat-button-margin) * 2 + var(--voltade-chat-button-height));background-color:var(--voltade-attentive-background-color);border-radius:var(--voltade-attentive-border-radius);padding:12px;max-width:360px;font-size:14.4px;font-weight:400;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;line-height:1.5;color:var(--voltade-attentive-text-color);opacity:0;transition:opacity .5s;z-index:var(--voltade-chat-z-index);cursor:pointer}@media screen and (max-width: 576px){#voltade-attentive-message{max-width:280px;gap:9.6px;padding:9.6px;line-height:1.2}}#voltade-attentive-message-caret{margin-inline-start:8px;border-right:8px solid var(--voltade-attentive-text-color);animation:blink-caret 1s ease infinite}#voltade-attentive-message-close{display:flex;align-items:center;color:var(--voltade-attentive-text-color);background-color:#ffffff1a;cursor:pointer;padding:3.2px;border-radius:6px}#voltade-attentive-message-close:hover{background-color:#fff3}@keyframes blink-caret{0%,to{border-color:transparent}50%{border-color:var(--voltade-attentive-text-color)}}")),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
(function(){"use strict";let w=Object.getPrototypeOf,S,R,y,E,q={isConnected:1},ht=1e3,C,U={},ut=w(q),H=w(w),g,B=(e,o,t,n)=>(e??(setTimeout(t,n),new Set)).add(o),G=(e,o,t)=>{let n=y;y=o;try{return e(t)}catch(r){return console.error(r),t}finally{y=n}},T=e=>e.filter(o=>o._dom?.isConnected),W=e=>C=B(C,e,()=>{for(let o of C)o._bindings=T(o._bindings),o._listeners=T(o._listeners);C=g},ht),A={get val(){return y?._getters?.add(this),this.rawVal},get oldVal(){return y?._getters?.add(this),this._oldVal},set val(e){y?._setters?.add(this),e!==this.rawVal&&(this.rawVal=e,this._bindings.length+this._listeners.length?(R?.add(this),S=B(S,this,pt)):this._oldVal=e)}},z=e=>({__proto__:A,rawVal:e,_oldVal:e,_bindings:[],_listeners:[]}),b=(e,o)=>{let t={_getters:new Set,_setters:new Set},n={f:e},r=E;E=[];let a=G(e,t,o);a=(a??document).nodeType?a:new Text(a);for(let s of t._getters)t._setters.has(s)||(W(s),s._bindings.push(n));for(let s of E)s._dom=a;return E=r,n._dom=a},N=(e,o=z(),t)=>{let n={_getters:new Set,_setters:new Set},r={f:e,s:o};r._dom=t??E?.push(r)??q,o.val=G(e,n,o.rawVal);for(let a of n._getters)n._setters.has(a)||(W(a),a._listeners.push(r));return o},F=(e,...o)=>{for(let t of o.flat(1/0)){let n=w(t??0),r=n===A?b(()=>t.val):n===H?b(t):t;r!=g&&e.append(r)}return e},X=(e,o,...t)=>{let[n,...r]=w(t[0]??0)===ut?t:[{},...t],a=e?document.createElementNS(e,o):document.createElement(o);for(let[s,c]of Object.entries(n)){let i=k=>k?Object.getOwnPropertyDescriptor(k,s)??i(w(k)):g,l=o+","+s,d=U[l]??(U[l]=i(w(a))?.set??0),h=s.startsWith("on")?(k,Gt)=>{let dt=s.slice(2);a.removeEventListener(dt,Gt),a.addEventListener(dt,k)}:d?d.bind(a):a.setAttribute.bind(a,s),v=w(c??0);s.startsWith("on")||v===H&&(c=N(c),v=A),v===A?b(()=>(h(c.val,c._oldVal),a)):h(c)}return F(a,...r)},K=e=>({get:(o,t)=>X.bind(g,e,t)}),ft=new Proxy(e=>new Proxy(X,K(e)),K()),J=(e,o)=>o?o!==e&&e.replaceWith(o):e.remove(),pt=()=>{let e=0,o=[...S].filter(n=>n.rawVal!==n._oldVal);do{R=new Set;for(let n of new Set(o.flatMap(r=>r._listeners=T(r._listeners))))N(n.f,n.s,n._dom),n._dom=g}while(++e<100&&(o=[...R]).length);let t=[...S].filter(n=>n.rawVal!==n._oldVal);S=g;for(let n of new Set(t.flatMap(r=>r._bindings=T(r._bindings))))J(n._dom,b(n.f,n._dom)),n._dom=g;for(let n of t)n._oldVal=n.rawVal};const u={add:F,tags:ft,state:z,derive:N,hydrate:(e,o)=>J(e,b(o,e))};function Y(e,o,t=!1){let n;return function(...r){const a=()=>{n=null,t||e(...r)},s=t&&!n;clearTimeout(n),n=window.setTimeout(a,o),s&&e(...r)}}function vt(e,o){let t=null;return function(...n){t===null&&(e(...n),t=window.setTimeout(()=>{t=null},o))}}function m(...e){(window.location.hostname==="localhost"||window.voltadeDebug)&&console.log(...e)}var wt=(e,o,t={})=>{let n=`${e}=${o}`;return t&&typeof t.maxAge=="number"&&t.maxAge>=0&&(n+=`; Max-Age=${Math.floor(t.maxAge)}`),t.domain&&(n+=`; Domain=${t.domain}`),t.path&&(n+=`; Path=${t.path}`),t.expires&&(n+=`; Expires=${t.expires.toUTCString()}`),t.httpOnly&&(n+="; HttpOnly"),t.secure&&(n+="; Secure"),t.sameSite&&(n+=`; SameSite=${t.sameSite}`),t.partitioned&&(n+="; Partitioned"),n},mt=(e,o,t={})=>(o=encodeURIComponent(o),wt(e,o,t)),gt=(e,o)=>(e=e.replace(/\/+$/,""),e=e+"/",o=o.replace(/^\/+/,""),e+o),Q=(e,o)=>{for(const[t,n]of Object.entries(o)){const r=new RegExp("/:"+t+"({[^}]*})?");e=e.replace(r,`/${n}`)}return e},yt=e=>e.replace(/\/index$/,"/");function I(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Z(e,o){if(!I(e)&&!I(o))return o;const t={...e};for(const n in o){const r=o[n];I(t[n])&&I(r)?t[n]=Z(t[n],r):t[n]=r}return t}var tt=(e,o)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!="string"||r==="then"))return tt(e,[...o,r])},apply(n,r,a){return e({path:o,args:a})}}),St=class{constructor(e,o){this.queryParams=void 0,this.pathParams={},this.cType=void 0,this.fetch=(t,n)=>{if(t){if(t.query){for(const[l,d]of Object.entries(t.query))if(d!==void 0)if(this.queryParams||(this.queryParams=new URLSearchParams),Array.isArray(d))for(const h of d)this.queryParams.append(l,h);else this.queryParams.set(l,d)}if(t.queries)for(const[l,d]of Object.entries(t.queries))for(const h of d)this.queryParams||(this.queryParams=new URLSearchParams),this.queryParams.append(l,h);if(t.form){const l=new FormData;for(const[d,h]of Object.entries(t.form))l.append(d,h);this.rBody=l}t.json&&(this.rBody=JSON.stringify(t.json),this.cType="application/json"),t.param&&(this.pathParams=t.param)}let r=this.method.toUpperCase(),a=!(r==="GET"||r==="HEAD");const s={...t?.header??{},...n?.headers?n.headers:{}};if(t?.cookie){const l=[];for(const[d,h]of Object.entries(t.cookie))l.push(mt(d,h,{path:"/"}));s.Cookie=l.join(",")}this.cType&&(s["Content-Type"]=this.cType);const c=new Headers(s??void 0);let i=this.url;return i=yt(i),i=Q(i,this.pathParams),this.queryParams&&(i=i+"?"+this.queryParams.toString()),r=this.method.toUpperCase(),a=!(r==="GET"||r==="HEAD"),(n?.fetch||fetch)(i,{body:a?this.rBody:void 0,method:r,headers:c})},this.url=e,this.method=o}},Et=(e,o)=>tt(t=>{const n=[...t.path];let r="";if(/^\$/.test(n[n.length-1])){const i=n.pop();i&&(r=i.replace(/^\$/,""))}const a=n.join("/"),s=gt(e,a);if(r==="url")return t.args[0]&&t.args[0].param?new URL(Q(s,t.args[0].param)):new URL(s);const c=new St(s,r);if(r){o??(o={});const i=Z(o,{...t.args[1]??{}});return c.fetch(t.args[0],i)}return c},[]);const O=Et("https://widget.voltade.ai/").api,{button:bt,div:P,iframe:_t,span:et,style:$t}=u.tags,{svg:nt,path:_}=u.tags("http://www.w3.org/2000/svg"),kt="https://chat.voltade.com",Ct=()=>nt({width:"20",height:"20",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},_({stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_({d:"M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2zm0 -12a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2zm-7 12a6 6 0 0 1 6 -6a6 6 0 0 1 -6 -6a6 6 0 0 1 -6 6a6 6 0 0 1 6 6z"})),ot=()=>nt({width:"20",height:"20",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"},_({stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_({d:"M18 6l-12 12"}),_({d:"M6 6l12 12"})),f="voltade-chat",Tt=({"chat-project-id":e,"chat-logo-url":o,"chat-button-default-text":t,"chat-button-default-icon":n,"chat-button-close-text":r,"chat-button-hide-text-on-mobile":a,...s})=>{const c=u.state("initial");window.addEventListener("voltade:chat:open",()=>{c.val="open";try{O.usage.$post({json:{pathname:window.location.pathname,type:"chat-button-click"}})}catch(h){console.error(h)}}),window.addEventListener("voltade:chat:close",()=>{c.val="closed"});const i=u.state(!1),l=P({id:`${f}-container`,"data-open":()=>c.val==="open"},()=>i.val===!1?P({id:`${f}-loading-container`},P({id:`${f}-loading-spinner`}),P({id:`${f}-loading-logo`,style:`background-image: url('${o}')`})):null);u.derive(()=>{c.val==="open"&&c.oldVal==="initial"&&u.add(l,_t({id:`${f}-iframe`,src:`${kt}/p/${e}`,allow:"microphone; clipboard-write",onload:h=>{const v=h.target;window.dispatchEvent(new CustomEvent("voltade:chat:load",{detail:v})),setTimeout(()=>{i.val=!0},300)}}))});const d=Object.entries(s).filter(([h])=>h.startsWith("chat-"));return[d.length>0?$t({id:`${f}-style`},`:root { ${d.map(([h,v])=>`--voltade-${h}: ${v};`).join(" ")} }`):null,bt({id:`${f}-button`,class:a==="true"?"voltade-chat-button-round":"",onclick:()=>{c.val==="initial"||c.val==="closed"?window.dispatchEvent(new CustomEvent("voltade:chat:open")):window.dispatchEvent(new CustomEvent("voltade:chat:close"))}},()=>et({id:`${f}-button-text`},c.val!=="open"?t:r),()=>et({id:`${f}-button-icon`},c.val!=="open"?n??Ct():ot())),l]};window.addEventListener("voltade:init",e=>{document.querySelectorAll(`[id^="${f}-"]`).forEach(o=>o.remove()),e.detail["chat-project-id"]&&u.add(document.body,Tt(e.detail))});const{div:D,style:At,span:It}=u.tags,$="voltade-attentive",rt=3,Ot=3,Pt=1,xt=500,jt=3e3,Lt=3,Rt=2e4,Nt=15e3,p=[];let at=0,x=null;function it(e,o){let t=e.innerText?.replace(/\s+/g," ")?.trim()??"";t.length>250&&(t=t.substring(0,250)+"...");let n=t.length===0;const r={type:o,text:t};return["href","alt","title","src"].forEach(a=>{const s=e.getAttribute(a);s!==null&&(n=!1,r[a]=s)}),n?null:r}function st(e){const o=p.findIndex(t=>t.text!==void 0&&t.text===e.text||t.href!==void 0&&t.href===e.href||t.alt!==void 0&&t.alt===e.alt||t.title!==void 0&&t.title===e.title||t.src!==void 0&&t.src===e.src);o!==-1&&p.splice(o,1)}function Dt(e){const o=e.target;if(!o||o.id.startsWith("voltade-"))return;const t=it(o,"click");t&&(st(t),p.push(t),p.length>rt&&p.shift(),window.dispatchEvent(new CustomEvent("voltade:attentive:generate")))}function Vt(e){return e.height<100||e.width<100}function Mt(){const e=window.innerHeight/2;document.querySelectorAll("section, article, div, a, img, p, h1, h2, h3, h4, h5, h6, li, span").forEach(t=>{const n=t.getBoundingClientRect(),r=window.getComputedStyle(t);if(!(["fixed","sticky"].includes(r.position)||Vt(n))&&n.top<=e&&n.bottom>=e){const a=it(t,"pause");if(!a)return;st(a),p.push(a),p.length>rt&&p.shift()}}),window.dispatchEvent(new CustomEvent("voltade:attentive:generate"))}const qt=({"attentive-prompt":e,...o})=>{const t=u.state(!1),n=u.state("");window.addEventListener("voltade:chat:open",()=>{t.val=!0,n.val=""}),window.addEventListener("voltade:chat:close",()=>t.val=!1);const r=Y(Dt,xt);document.addEventListener("click",i=>{t.val!==!0&&r(i)});const a=Y(Mt,jt);window.addEventListener("scroll",()=>{t.val!==!0&&a()});const s=vt(async i=>{n.val=" ",m("Generating...",i);try{const l=await O.attentive.$post({json:{pathname:window.location.pathname,prompt:e,interactions:i}});if(!l.ok)throw new Error(await l.text());if(!l.body)throw new Error("No response body");const d=l.body.pipeThrough(new TextDecoderStream).getReader();for(;;){const{done:h,value:v}=await d.read();if(h)break;n.val===" "?n.val=v:n.val+=v}setTimeout(()=>n.val="",Nt),at+=1}catch(l){console.error(l),n.val=""}},Rt);window.addEventListener("voltade:attentive:generate",()=>{if(t.val===!0){m("Chat is open. Skipping");return}if(n.val.length>0){m("Still showing the current message. Skipping");return}let i=0,l=0;for(const d of p)switch(d.type){case"click":i+=1;break;case"pause":l+=1;break}if(i<Ot&&l<Pt){m("Not enough interactions. Skipping");return}if(at>Lt){m("Too many generations for the current page. Skipping");return}if(x){m(`User has already ${x} the attentive message. Skipping`);return}s(p)});const c=Object.entries(o).filter(([i])=>i.startsWith("attentive-"));return[c.length>0?At({id:`${$}-style`},`:root { ${c.map(([i,l])=>`--voltade-${i}: ${l};`).join(" ")} }`):null,D({id:`${$}-message`,style:()=>`opacity: ${t.val||n.val.length===0?"0":"100"};`,onclick:()=>{if(t.val===!1){window.dispatchEvent(new CustomEvent("voltade:chat:open")),x="clicked";try{O.usage.$post({json:{pathname:window.location.pathname,type:"attentive-click"}})}catch(i){console.error(i)}}}},D(()=>n.val,It({id:`${$}-message-caret`})),D({id:`${$}-message-close`,style:()=>`display: ${n.val.length>1?"flex":"none"};`,onclick:i=>{i.stopPropagation(),n.val="",x="closed"}},ot()))]};window.addEventListener("voltade:init",e=>{document.querySelectorAll(`[id^="${$}-"]`).forEach(o=>o.remove()),e.detail["attentive-prompt"]&&u.add(document.body,qt(e.detail))});const j="voltade-attribution",Ut="https://chat.voltade.com",lt=1,Ht=1*864e5,L=new Set,V=new Set;function ct(e){let o=e;const t=window.localStorage.getItem(j);if(t)try{if(o=JSON.parse(t),o.version!==lt)throw new Error("Invalid version");const{chats:n}=o;for(const r in n)n[r]&&n[r].createdAt+Ht<Date.now()&&delete n[r]}catch{m("Invalid attribution storage. Resetting"),window.localStorage.removeItem(j)}return o??null}function Bt(e){if(e.origin===Ut&&e.data?.chatId&&e.data?.createdAt){m("New chat crete message",e.data);const{chatId:o,createdAt:t}=e.data,n=ct({version:lt,chats:{}});n.chats[o]={createdAt:t.getTime()},window.localStorage.setItem(j,JSON.stringify(n))}}async function M({type:e,value:o}){const t=ct();if(!t)return;const{chats:n}=t;try{await O.attribution.$post({json:{type:e,value:o,chats:n}}),window.localStorage.removeItem(j)}catch(r){console.error(r)}}window.addEventListener("voltade:init",e=>{if(e.detail["attribution-pages"]||e.detail["attribution-buttons"]){if(window.addEventListener("message",Bt),e.detail["attribution-pages"]?.split(`
`).forEach(o=>L.add(o.trim())),e.detail["attribution-buttons"]?.split(`
`).forEach(o=>V.add(o.trim())),L.size>0){const o=window.location.pathname;L.has(o)?M({type:"page",value:o}):window.addEventListener("popstate",()=>{const t=window.location.pathname;L.has(t)&&M({type:"page",value:t})})}V.size>0&&window.addEventListener("click",o=>{if(o.target instanceof HTMLElement){const t=o.target.closest("button"),n=o.target.innerText.trim();t&&V.has(n)&&M({type:"button",value:n})}})}})})();
window.dispatchEvent(new CustomEvent('voltade:init', { detail: {"chat-project-id":"w3ofltkasz","chat-logo-url":"http://a,p","chat-button-default-text":"Chat","chat-button-close-text":"Close chat","chat-button-background-color":"#000000","chat-button-hide-text-on-mobile":"false","chat-button-text-color":"#ffffff","chat-button-animation":"voltade-bounce 1s ease 3"} }));