arcy.js 0.1.0 → 0.1.2

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.
@@ -0,0 +1,568 @@
1
+ (function(){'use strict';/* arcy.js — https://arcyai.com */
2
+ var qr=Object.defineProperty,Jr=Object.defineProperties;var Qr=Object.getOwnPropertyDescriptors;var dn=Object.getOwnPropertySymbols;var Zr=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable;var fn=(e,t,n)=>t in e?qr(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Zr.call(t,n)&&fn(e,n,t[n]);if(dn)for(var n of dn(t))eo.call(t,n)&&fn(e,n,t[n]);return e},ae=(e,t)=>Jr(e,Qr(t));var H=(e,t,n)=>new Promise((r,s)=>{var l=o=>{try{f(n.next(o));}catch(i){s(i);}},a=o=>{try{f(n.throw(o));}catch(i){s(i);}},f=o=>o.done?r(o.value):Promise.resolve(o.value).then(l,a);f((n=n.apply(e,t)).next());});function w(e){typeof console!="undefined"&&console.warn&&console.warn(`[arcy] ${e}`);}function pn(){let e=new Map;function t(r,s){if(typeof s!="function")return w(`on("${r}") needs a function. Ignoring.`),()=>{};let l=e.get(r);return l||(l=new Set,e.set(r,l)),l.add(s),()=>{l.delete(s);}}function n(r){let s=e.get(r);if(s)for(let l of [...s])try{l();}catch(a){w(`A "${r}" handler threw. ${String(a)}`);}}return {on:t,emit:n}}function kt(e){if(e.parentElement!==null)return e.parentElement;let t=e.parentNode;return t!==null&&"host"in t?t.host:null}var mn=[/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b\d(?:[ -]?\d){12,18}\b/g],to="[masked]";function Xe(e){return mn.some(t=>(t.lastIndex=0,t.test(e)))}var At=4096,no=100,ro=64;function ot(e){if(!e)return;let t=e.slice(0,At);if(e.length>At){let r=t.search(/\s\S*$/);t=r===-1?t.slice(0,At-no):t.slice(0,r);}let n=t.replace(/\s+/g," ").trim();if(n){for(let r of mn)n=n.replace(r,to);return n.slice(0,80)}}function gn(e){return !(e.length===0||e.length>64||e.includes(":")||e.startsWith("radix-")||/^\d+$/.test(e)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))}var oo=["data-testid","data-test","data-cy","id","name","aria-label"],io=["data-testid","data-test","data-cy"],so=64;function ao(e){for(let t of io){let n=e.getAttribute(t);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>so)&&!Xe(r))return r}}var lo=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function co(e){let t=kt(e);for(;t!==null;){let n=t.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let s of oo){let l=t.getAttribute(s);if(l===null||s==="id"&&!gn(l))continue;let a=ot(l);if(a!==void 0)return {tag:n,attr:s,value:a}}let r=t.getAttribute("role");if(r!==null&&lo.has(r))return {tag:n,attr:"role",value:r};t=kt(t);}}function uo(e){let t=0,n=e.previousElementSibling;for(;n!==null;)n.tagName===e.tagName&&(t+=1),n=n.previousElementSibling;return t}function hn(e){let t={tag:e.tagName.toLowerCase(),siblingIndex:uo(e)},n=ot(e.textContent);n!==void 0&&(t.text=n);let r=ot(e.getAttribute("aria-label"));r!==void 0&&(t.ariaLabel=r);let s=ot(e.getAttribute("placeholder"));s!==void 0&&(t.placeholder=s);let l=e.getAttribute("id");l!==null&&gn(l)&&!Xe(l)&&(t.id=l);let a=e.getAttribute("role");if(a!==null){let i=a.trim();i!==""&&i.length<=ro&&!Xe(i)&&(t.role=i);}let f=ao(e);f!==void 0&&(t.testId=f);let o=co(e);return o!==void 0&&(t.ancestorTag=o.tag,t.ancestorAttr=o.attr,t.ancestorValue=o.value),t}var yn="arcy.picker.73f47221b73c.js",bn="arcy.chat.39921845e233.js",wn="arcy.flow.fef131718e42.js";var fo=/^(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{12,})$/i,po=/^[^@\s/]+@[^@\s/]+\.[^@\s/]+$/;function mo(e){if(e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch(t){return e}}function vn(e){return e.length===0?false:fo.test(e)?true:po.test(mo(e))}function Be(e){let n=e.split("/").map(r=>vn(r)?":id":r).join("/");for(;n.length>1&&n.charAt(n.length-1)==="/";)n=n.slice(0,-1);return n.length===0?"/":n}function go(e){if(e.length===0)return "";let t=[];for(let n of e.split("&")){if(n.length===0)continue;let r=n.indexOf("="),s=r===-1?n:n.slice(0,r);if(s.length===0)continue;let l=vn(s)?":id":s;t.indexOf(l)===-1&&t.push(l);}return t.length===0?"":(t.sort(),`?${t.join("&")}`)}function ho(e,t){var n;try{let r=new URL(e,t!=null?t:void 0);return {path:r.pathname,query:r.search.slice(1)}}catch(r){let s=(n=e.split("#")[0])!=null?n:"";if(!s.startsWith("/"))return null;let l=s.indexOf("?");return l===-1?{path:s,query:""}:{path:s.slice(0,l),query:s.slice(l+1)}}}function je(e,t){if(typeof e!="string"||e.length===0)return null;let n=ho(e,t);if(n===null)return null;let r=Be(n.path);if(!r)return null;if(r.length>=2048)return r.slice(0,2048);let s=go(n.query);return s.length===0||r.length+s.length>2048?r:r+s}function yo(e){try{let t=e.currentScript,n=t==null?void 0:t.nonce;if(typeof n=="string"&&n.length>0)return n;let r=e.getElementsByTagName("script");for(let s=0;s<r.length;s++){let l=r[s].nonce;if(typeof l=="string"&&l.length>0)return l}return null}catch(t){return null}}var bo=typeof document!="undefined"?yo(document):null;function wo(){return bo}function Le(e){let t=wo();if(t)try{e.nonce=t,e.setAttribute("nonce",t);}catch(n){}}var vo="https://docs.arcyai.com/troubleshooting#content-security-policy";function _t(e){try{let{origin:t}=new URL(e);return t&&t!=="null"?t:null}catch(t){return null}}function So(e){var s;let t=_t(e.apiBase),n=e.cdnBase?_t(e.cdnBase):null,r=["This page's Content-Security-Policy is blocking part of the ARCY widget.","Add these to the policy your app sends:",""];return n&&r.push(` script-src ${n}`),t&&(r.push(` connect-src ${t}`),r.push(` font-src ${t}`),r.push(` img-src ${t} blob:`)),r.push(" style-src 'unsafe-inline', or a nonce on the script that loads ARCY"),r.push(""),r.push("To allow none of them, proxy a path on your own domain to the API and pass it as arcy.init(token, { apiBase })."),r.push((s=e.docsUrl)!=null?s:vo),r.join(`
3
+ `)}function Sn(e,t){let n=[t.apiBase,t.cdnBase].filter(s=>typeof s=="string"&&s.length>0).map(_t).filter(s=>s!==null),r=()=>{};try{let s=l=>{let a=l.blockedURI;(a==="inline"||n.some(o=>a==null?void 0:a.startsWith(o)))&&(r(),w(So(t)));};e.document.addEventListener("securitypolicyviolation",s),r=()=>{try{e.document.removeEventListener("securitypolicyviolation",s);}catch(l){}};}catch(s){}return ()=>r()}var It="__arcyPicker";var qe=2,En="arcy:design-mode:ready",Tn="arcy:design-mode:pick",xn="arcy:design-mode:exit",kn="arcy:design-mode:screenshot";var _n="arcy-widget",An="data-arcy",Rt="2147483000",Eo=[["position","fixed"],["inset","0"],["z-index",Rt],["pointer-events","none"],["background","transparent"],["border","0"],["box-shadow","none"],["outline","0"]],To=[["margin","0"],["padding","0"]],Cn="data-arcy-style",Je=new Map;function xo(e=_n){let t=Je.get(e);return t!==void 0&&t.host.isConnected}function it(e={}){var s,l,a;if(typeof document=="undefined")return null;let t=(s=e.id)!=null?s:_n,n=e.container;if(xo(t))return w("This ARCY surface is already on this page. Ignoring the second mount."),null;Je.delete(t);let r=(l=n!=null?n:document.body)!=null?l:document.documentElement;if(!r)return w("The page has no <body> to mount into yet. The widget will not render."),null;if(!n){let f=document.querySelectorAll(`[${An}]`);for(let o=0;o<f.length;o+=1)if(((a=f[o])==null?void 0:a.id)===t)return w("Another copy of ARCY is already on this page. Ignoring this one."),null}try{let f=document.createElement("div");f.id=t,f.setAttribute(An,"");for(let[h,v]of Eo)f.style.setProperty(h,v,"important");for(let[h,v]of To)f.style.setProperty(h,v);let o=f,i=!1;try{f.attachShadow&&(o=f.attachShadow({mode:"closed"}),i=!0);}catch(h){}r.appendChild(f),Ao(f);let u={host:f,root:o,isolated:i,destroy(){try{f.parentNode&&f.parentNode.removeChild(f);}catch(h){}Je.get(t)===u&&Je.delete(t);}};return Je.set(t,u),u}catch(f){return w(`The widget could not mount. ${String(f)}`),null}}var ko=["pointerdown","pointerup","pointercancel","mousedown","mouseup","click","dblclick","auxclick","contextmenu","touchstart","touchend","touchcancel","focusin","focusout","keydown","keyup","keypress","beforeinput","input","change","compositionstart","compositionupdate","compositionend","cut","copy","paste"];function Ao(e){let t=n=>{try{n.stopPropagation();}catch(r){}};for(let n of ko)try{e.addEventListener(n,t);}catch(r){}try{e.addEventListener("mousedown",n=>{n.defaultPrevented||Pt(e.ownerDocument,e);});}catch(n){}}function Pt(e,t){try{let n=e.activeElement;if(!n||n===t||t.contains(n)||n===e.body||n===e.documentElement)return;let r=n.blur;typeof r=="function"&&r.call(n);}catch(n){}}function In(e,t){var n;if(!e.isolated)return false;try{let r=e.root.querySelector(`[${Cn}]`);if(r)return r.textContent=`${(n=r.textContent)!=null?n:""}
4
+ ${t}`,!0;let s=e.host.ownerDocument.createElement("style");return Le(s),s.setAttribute(Cn,""),s.textContent=t,e.root.appendChild(s),!0}catch(r){return w(`The widget could not apply its styles. ${String(r)}`),false}}var Co="arcy-picker-notice",_o=[["left","50%"],["bottom","24px"]],Io=[["transform","translateX(-50%)"],["box-sizing","border-box"],["max-width","min(520px, calc(100vw - 32px))"],["padding","14px 16px"],["border-radius","12px"],["background","#101828"],["color","#ffffff"],["font",'13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'],["box-shadow","0 8px 24px rgba(16, 24, 40, 0.28)"]],Ro=[["font-weight","600"],["margin-bottom","4px"]],Po=[["color","#d0d5dd"]],Lo=[["appearance","none"],["margin-top","10px"],["border","1px solid rgba(255, 255, 255, 0.25)"],["border-radius","999px"],["background","transparent"],["color","#ffffff"],["font","inherit"],["padding","4px 12px"],["cursor","pointer"]];function st(e,t){for(let[n,r]of t)e.style.setProperty(n,r);}var Rn=false;function at(e){if(Rn)return;let t=null;try{if(t=it({id:Co}),!t)return;Rn=!0;let n=t.host.ownerDocument,r=n.createElement("div");r.style.setProperty("position","absolute","important"),r.style.setProperty("pointer-events","auto","important");for(let[o,i]of _o)r.style.setProperty(o,i,"important");st(r,Io);let s=n.createElement("div");st(s,Ro),s.textContent="ARCY element picker did not start";let l=n.createElement("div");st(l,Po),l.textContent=e;let a=n.createElement("button");a.type="button",st(a,Lo),a.textContent="Dismiss";let f=t;a.addEventListener("click",()=>{try{f.destroy();}catch(o){}}),r.append(s,l,a),t.root.appendChild(r);}catch(n){try{t==null||t.destroy();}catch(r){}}}function Se(e){w(e),at(e);}var Lt="arcy_picker",Oo="/api/v1/sdk/tagging/verify",Ln="https://cdn.arcyai.com";var Mo=15e3,Fo=1e4;function No(e,t){var n;return (n=Ot(e))!=null?n:Ot(t)}function Ot(e){if(!e)return null;try{let t=new URLSearchParams(e.charAt(0)==="#"?e.slice(1):e).get(Lt);return t&&t.length>0?t:null}catch(t){return null}}function Do(e){try{let t=new URL(e.location.href),n=t.searchParams.has(Lt),r=Ot(t.hash)!==null;if(!n&&!r)return;n&&t.searchParams.delete(Lt),r&&(t.hash=""),e.history.replaceState(e.history.state,"",t.toString());}catch(t){}}function Bo(e){return H(this,null,function*(){let{apiBase:t,token:n,nonce:r,fetchImpl:s,timeoutMs:l=Fo,setTimeoutImpl:a=(i,u)=>setTimeout(i,u)}=e;if(!s)return null;let f=()=>H(null,null,function*(){try{let i=yield s(`${t}${Oo}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({token:r}),credentials:"omit"});if(!i.ok)return null;let u=yield i.json();if((u==null?void 0:u.ok)!==!0)return null;let h=Ho(u.returnOrigin);return h?{returnOrigin:h,screenshotsEnabled:u.elementScreenshotsEnabled!==!1}:(Se("This ARCY server has not been told where its dashboard lives, so a pick would have nowhere to go. Set FRONTEND_DASHBOARD_URL and try again."),null)}catch(i){return null}}),o=new Promise(i=>{try{a(()=>i(null),l);}catch(u){}});return Promise.race([f(),o])})}function Ho(e){if(typeof e!="string"||e.length===0)return null;try{let{origin:t}=new URL(e);return t&&t!=="null"?t:null}catch(t){return null}}function On(e,t,n,r){return new Promise(s=>{let l=false,a=null,f=p=>{l||(l=true,a&&(a.onload=null,a.onerror=null),s(p));},o=false,i=p=>{o||(o=true,Se(p));},u=()=>{let p;try{p=e[It];}catch(k){return i("The element picker registration could not be read. Design mode is off."),null}if(!p)return null;if(typeof p.mount!="function")return i("The element picker registered something unusable. Design mode is off."),null;let b;try{b=p.contract;}catch(k){b=void 0;}return b!==2?(i(`The element picker on the CDN speaks contract ${typeof b=="number"?b:"unknown"}, this arcy.js speaks ${2}. Update arcy.js to use design mode.`),null):p},h=p=>{try{let b=u();!b&&!o&&p(),f(b);}catch(b){f(null);}},v=false;try{v=e[It]!==void 0;}catch(p){v=true;}if(v){h(()=>{});return}try{let p=e.document;a=p.createElement("script"),Le(a),a.async=!0,a.src=`${t}/${yn}`;let b=a.src;a.onload=()=>h(()=>Se("The element picker loaded but did not register. Design mode is off.")),a.onerror=()=>{try{Se(`Failed to load ${b}. Design mode is off. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch(k){}f(null);},(p.head||p.documentElement).appendChild(a);}catch(p){Se(`The element picker could not load. ${String(p)}`),f(null);return}try{r(()=>{l||Se("The element picker did not load in time. Design mode is off."),f(null);},n);}catch(p){}})}function Uo(e){try{let t=e.location.pathname;return typeof t!="string"||!t.startsWith("/")?"/":Be(t)}catch(t){return "/"}}function Vo(e){try{let t=e.opener;return !!t&&!t.closed}catch(t){return false}}function lt(e,t,n){try{let r=e.opener;if(!r||r.closed){w("The ARCY dashboard window is gone, so that pick could not be sent.");return}r.postMessage(n,t);}catch(r){w(`That pick could not be sent to the ARCY dashboard. ${String(r)}`);}}function Mn(e){return H(this,null,function*(){try{let{win:t,token:n,apiBase:r,fetchImpl:s,onVerified:l,loadChunk:a,loadTimeoutMs:f=Mo,setTimeoutImpl:o=(k,D)=>setTimeout(k,D)}=e,i=No(t.location.search,t.location.hash);if(!i)return "no_nonce";if(Do(t),!Vo(t))return Se("This page was not opened by the ARCY dashboard, so a picked element would have nowhere to go. If you did start it from the flow builder, this site is severing the link back: a Cross-Origin-Opener-Policy header on this page (helmet sets one by default) does exactly that. Serve this page with Cross-Origin-Opener-Policy: unsafe-none while you author."),"no_opener";let u=yield Bo({apiBase:r,token:n,nonce:i,fetchImpl:s,setTimeoutImpl:o});if(!u)return Se("The design-mode link is invalid, expired, or could not be verified. It is single-use and short-lived, so a reload spends it. Check that this page carries the same environment Token as the flow you are editing, then open the picker again from the dashboard."),"rejected";try{l();}catch(k){}let h=yield a(t,f,o);if(!h)return "load_failed";let{returnOrigin:v,screenshotsEnabled:p}=u;return h.mount({screenshotsEnabled:p,onPick:(k,D)=>{lt(t,v,{type:Tn,protocol:qe,target:k,route:Uo(t),matchCount:D});},onScreenshot:k=>{lt(t,v,{type:kn,protocol:qe,screenshot:k});},onExit:()=>{lt(t,v,{type:xn,protocol:qe});}})?(lt(t,v,{type:En,protocol:qe}),"active"):(Se("The element picker could not start. Design mode is off."),"mount_failed")}catch(t){return Se(`Design mode could not start. ${String(t)}`),"load_failed"}})}var Mt={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function oe(e){return e?{getItem(t){try{return e.getItem(t)}catch(n){return null}},setItem(t,n){try{e.setItem(t,n);}catch(r){}},removeItem(t){try{e.removeItem(t);}catch(n){}}}:Mt}function Ee(){try{let e=globalThis.localStorage;return oe(e)}catch(e){return Mt}}function Ve(){try{let e=globalThis.sessionStorage;return oe(e)}catch(e){return Mt}}function ie(e,t){let n=e.getItem(t);if(!n)return null;try{let r=JSON.parse(n);return !r||typeof r!="object"||Array.isArray(r)?null:r}catch(r){return null}}function ne(e,t,n){try{e.setItem(t,JSON.stringify(n));}catch(r){}}var Wo="arcy.preview.";function ct(e,t=Ve()){try{return oe(t).getItem(Wo+e)!==null}catch(n){return false}}var Ft="arcy_preview",$o=1,Ko="/api/v1/sdk/flows/preview/verify",Go=1e4;function Yo(e,t){var n;return (n=Nt(e))!=null?n:Nt(t)}function Nt(e){if(!e)return null;try{let t=new URLSearchParams(e.charAt(0)==="#"?e.slice(1):e).get(Ft);return t&&t.length>0?t:null}catch(t){return null}}function zo(e){try{let t=new URL(e.location.href),n=t.searchParams.has(Ft),r=Nt(t.hash)!==null;if(!n&&!r)return;n&&t.searchParams.delete(Ft),r&&(t.hash=""),e.history.replaceState(e.history.state,"",t.toString());}catch(t){}}function Fn(e,t){try{let n=Yo(e.location.search,e.location.hash);return n?(zo(e),{kind:"nonce",nonce:n}):ct(t)?{kind:"pending"}:null}catch(n){return null}}function Nn(e){return H(this,null,function*(){let{apiBase:t,token:n,nonce:r,sessionToken:s,userTraits:l,fetchImpl:a,timeoutMs:f=Go,setTimeoutImpl:o=(k,D)=>setTimeout(k,D)}=e;if(!a)return null;let i=k=>{w(k);try{at(k);}catch(D){}return null},u=()=>H(null,null,function*(){try{let k=yield a(`${t}${Ko}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify($($({token:r},s?{sessionToken:s}:{}),l&&Object.keys(l).length>0?{userTraits:l}:{})),credentials:"omit"});if(!k.ok)return i("ARCY could not verify this preview link. Close this tab and press Preview in the dashboard again.");let D=yield k.json();return (D==null?void 0:D.ok)!==!0||D.flow===void 0||D.flow===null?i("ARCY could not verify this preview link. Close this tab and press Preview in the dashboard again."):D.protocol!==$o?i("This page runs an older version of arcy.js than the dashboard expects. The preview cannot run until the script updates."):D.flow}catch(k){return i("ARCY could not reach its server to start this preview. Check the connection and press Preview again.")}}),h=false,v,p=new Promise(k=>{try{v=o(()=>{h||(h=!0,k(i("ARCY took too long to verify this preview link. Close this tab and press Preview in the dashboard again.")));},f);}catch(D){}}),b=yield Promise.race([u().then(k=>(h=true,k)),p]);try{v!==void 0&&clearTimeout(v);}catch(k){}return b})}var Dt="https://api.arcyai.com",Xo="/api/v1/sdk/session/init";var jo=["ON","REQUIRE_CONSENT","OFF"];function qo(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,n=t.behavioralTelemetry,r=t.effectiveCustomization,s=t.widget,l=t.identity,a=l&&typeof l=="object"&&!Array.isArray(l)?l.accepted:void 0;return {sessionToken:typeof t.sessionToken=="string"?t.sessionToken:null,behavioralTelemetry:typeof n=="string"&&jo.indexOf(n)!==-1?n:null,customization:r&&typeof r=="object"&&!Array.isArray(r)?r:null,widget:s&&typeof s=="object"&&!Array.isArray(s)?s:null,identityAccepted:typeof a=="boolean"?a:null}}function Dn(e){let{token:t,apiBase:n=Dt,setTimeoutImpl:r=(S,E)=>setTimeout(S,E),now:s=()=>Date.now(),retryDelayMs:l=2e3,attemptTimeoutMs:a=5e3,failureCooldownMs:f=3e4}=e,o=e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,i=`${n}${Xo}`,u=null,h=null,v=null,p=null,b=0;function k(S){let E={publicKey:t,sessionId:S.sessionId};return S.visitorId!==void 0&&(E.visitorId=S.visitorId),S.userId!==void 0&&(E.userId=S.userId),S.userHash!==void 0&&(E.userHash=S.userHash),S.userTraits!==void 0&&(E.userTraits=S.userTraits),S.uiLanguage!==void 0&&(E.uiLanguage=S.uiLanguage),S.contentLocale!==void 0&&(E.contentLocale=S.contentLocale),S.viewerLocale!==void 0&&(E.viewerLocale=S.viewerLocale),S.route!==void 0&&(E.route=S.route),S.sessionContext!==void 0&&(E.sessionContext=S.sessionContext),JSON.stringify(E)}function D(S){return H(this,null,function*(){if(!o)return {ok:false,reason:"unusable"};let E;try{E=yield o(i,{method:"POST",headers:{"Content-Type":"application/json"},body:S,credentials:"omit"});}catch(M){return null}if(E.status>=500)return null;if(!E.ok)return {ok:false,reason:"rejected"};let F;try{F=yield E.json();}catch(M){return {ok:false,reason:"unusable"}}let A=qo(F);return A?{ok:true,config:A}:{ok:false,reason:"unusable"}})}function I(S){return new Promise(E=>{try{r(()=>E(),S);}catch(F){E();}})}function V(S){return Promise.race([D(S),I(a).then(()=>null)])}function P(S){return H(this,null,function*(){let E=yield V(S);if(E)return E;yield I(l);let F=yield V(S);return F!=null?F:{ok:false,reason:"network"}})}return {sync(S){return H(this,null,function*(){let E=k(S);if(p&&E===h)return p;if(!p&&E===h&&u)return {ok:true,config:u};if(v&&v.json===E&&s()-v.at<f)return {ok:false,reason:"network"};h=E;let F=++b,A=P(E).then(M=>(F===b&&(M.ok?(u=M.config,v=null):(v={json:E,at:s()},h===E&&(h=null))),p===A&&(p=null),M));return p=A,A})},config:()=>u}}var Bt="__arcyChat";var Bn=["image/png","image/jpeg","image/webp"],Ht="--_arcy-font-key",Hn="arcy-chat-policy",Un="arcy-bar-tray",ut={historyTitle:"Recent chats",historyEmpty:"No conversations yet.",newChat:"New chat",flowsTitle:"What I can do",flowsEmpty:"Nothing to run yet.",collapse:"Collapse",back:"Back",closeSheet:"Close",settingsTitle:"Settings",dockChat:"Dock to the corner",dockChatHint:"Shrink ARCY to a button in the bottom-right corner.",language:"Language",openChat:"Open chat",moveBar:"Move the chat bar",send:"Send",flowRunning:"Running",flowStep:"Step {step} of {total}",flowStop:"Stop",flowFailed:"Sorry, I could not finish that for you this time. You can ask me here and I will help you do it.",attachMenu:"Add",attachImage:"Attach an image",removeImage:"Remove image",imageTooLarge:"That image is too large. Each image must be under 5 MB.",imageWrongType:"That file type is not supported. Use PNG, JPEG or WEBP.",imageTooMany:"You can attach up to 3 images.",imageFailed:"That image could not be uploaded. Please try again.",likeAnswer:"Good answer",dislikeAnswer:"Bad answer",answering:"Answering",aiDisclaimer:"{app} is AI and can make mistakes",consentNotice:"Your messages are processed to answer your question.",consentWithPolicy:"{policy}",disclaimerJoin:" \xB7 ",privacyPolicy:"Privacy Policy",poweredBy:"Powered by ARCY",genericError:"Something went wrong. Please try again.",userCapReached:"You've reached today's limit for questions. Please try again tomorrow.",imageConversation:"Image",searchedSourcesLabel:"Searched {count} sources",sourcesLabel:"Sources:",flowOfferHint:"You can do this in one click with the Quick Flow below.",fillConfirm:"Confirm",fillYes:"Yes",fillNo:"No",fillRequired:"This field needs an answer.",fillInvalidNumber:"Please enter a number.",fillNumberTooSmall:"Please enter {min} or more.",fillNumberTooLarge:"Please enter {max} or less.",fillInvalidEmail:"Please enter a valid email address.",fillInvalidUrl:"Please enter a valid link.",fillInvalidDate:"Please enter a valid date.",fillInvalidTime:"Please enter a valid time.",fillDateTooEarly:"Please pick {min} or later.",fillDateTooLate:"Please pick {max} or earlier.",fillTooLong:"Please keep it under {max} characters.",fillInvalidOption:"Please pick one of the options.",fillInvalid:"That does not look right. Please try again."};var Ut="https://cdn.arcyai.com";var Jo=15e3;function Wn(e,t,n,r){return new Promise(s=>{let l=false,a=null,f=p=>{l||(l=true,a&&(a.onload=null,a.onerror=null),s(p));},o=false,i=p=>{o||(o=true,w(p));},u=()=>{let p;try{p=e[Bt];}catch(k){return i("The chat panel registration could not be read. The panel will not open."),null}if(!p)return null;if(typeof p.mount!="function")return i("The chat panel registered something unusable. The panel will not open."),null;let b;try{b=p.contract;}catch(k){b=void 0;}return b!==4?(i(`The chat panel on the CDN speaks contract ${typeof b=="number"?b:"unknown"}, this arcy.js speaks ${4}. Update arcy.js to open the chat panel.`),null):p},h=p=>{try{let b=u();!b&&!o&&p(),f(b);}catch(b){f(null);}},v=false;try{v=e[Bt]!==void 0;}catch(p){v=true;}if(v){h(()=>{});return}try{let p=e.document;a=p.createElement("script"),Le(a),a.async=!0,a.src=`${t}/${bn}`;let b=a.src;a.onload=()=>h(()=>w("The chat panel loaded but did not register. The panel will not open.")),a.onerror=()=>{try{w(`Failed to load ${b}. The chat panel will not open. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch(k){}f(null);},(p.head||p.documentElement).appendChild(a);}catch(p){w(`The chat panel could not load. ${String(p)}`),f(null);return}try{r(()=>{l||w("The chat panel did not load in time."),f(null);},n);}catch(p){}})}function $n(e){let{root:t,host:n,win:r=typeof window!="undefined"?window:void 0,loadChunk:s,loadTimeoutMs:l=Jo,setTimeoutImpl:a=(L,j)=>setTimeout(L,j),onRequestClose:f,bar:o,apiBase:i,getSessionToken:u,getSessionId:h,getRoute:v,getMaxHeightPercent:p,onStartFlow:b,publicKey:k,getConversationId:D,setConversationId:I,touchConversation:V,getVisitorId:P,onOrgCapExceeded:X,onStopFlow:S,track:E,getWidget:F,onSelectLocale:A}=e,M=t!==n,C=null,G=null,U=false,K=false;function J(){return H(this,null,function*(){if(!(C||U))return G||(G=H(null,null,function*(){if(r)try{let L=yield s(r,l,a);if(!L||U)return;let j={root:t,host:n,isolated:M,onRequestClose:f,bar:o,apiBase:i,getSessionToken:u,getSessionId:h,getRoute:v,getMaxHeightPercent:p,onStartFlow:b,publicKey:k,getConversationId:D,setConversationId:I,touchConversation:V,getVisitorId:P,onOrgCapExceeded:X,onStopFlow:S,track:E,getWidget:F,onSelectLocale:A};C=L.mount(j),C||w("The chat panel could not start.");}catch(L){w(`The chat panel could not load. ${String(L)}`);}finally{G=null;}}),G)})}return {open(){return H(this,null,function*(){if(!U&&(K=true,yield J(),!(!K||U)))try{C==null||C.open();}catch(L){w(`The chat panel could not open. ${String(L)}`);}})},close(){K=false;try{C==null||C.close();}catch(L){w(`The chat panel could not close. ${String(L)}`);}},destroy(){U=true,K=false;let L=C;C=null;try{L==null||L.destroy();}catch(j){w(`The chat panel could not be removed. ${String(j)}`);}},reposition(){var L;try{(L=C==null?void 0:C.reposition)==null||L.call(C);}catch(j){w(`The chat panel could not move. ${String(j)}`);}},refreshChrome(){var L;try{(L=C==null?void 0:C.refreshChrome)==null||L.call(C);}catch(j){w(`The chat panel could not apply its texts. ${String(j)}`);}},promptFill(L){return H(this,null,function*(){if(U||(yield J(),U||!(C!=null&&C.promptFill)))return null;try{return yield C.promptFill(L)}catch(j){return w(`The flow's question could not be shown. ${String(j)}`),null}})},cancelFill(){var L;try{(L=C==null?void 0:C.cancelFill)==null||L.call(C);}catch(j){w(`The flow's question could not be withdrawn. ${String(j)}`);}},showFlowFailure(){return H(this,null,function*(){if(!U&&(K=true,yield J(),!(!K||U||!(C!=null&&C.showFlowFailure))))try{C.showFlowFailure();}catch(L){w(`The flow's failure notice could not be shown. ${String(L)}`);}})}}}var Vt="__arcyFlow";var Qo="arcy.flow.";function Zo(e){return typeof e.flowId=="string"&&e.flowId.length>0&&typeof e.currentStepCvid=="string"&&e.currentStepCvid.length>0&&typeof e.flowSessionId=="string"&&e.flowSessionId.length>0&&typeof e.startedAt=="number"}function Kn(e,{store:t=Ee()}={}){let n=oe(t),r=Qo+e;return {read(){let s=ie(n,r);return !s||!Zo(s)?null:{flowId:s.flowId,currentStepCvid:s.currentStepCvid,flowSessionId:s.flowSessionId,startedAt:s.startedAt}},save(s){ne(n,r,s);},clear(){n.removeItem(r);}}}var Yn="https://cdn.arcyai.com";var ei=15e3;function zn(e,t,n,r){return new Promise(s=>{let l=false,a=null,f=p=>{l||(l=true,a&&(a.onload=null,a.onerror=null),s(p));},o=false,i=p=>{o||(o=true,w(p));},u=()=>{let p;try{p=e[Vt];}catch(k){return i("The flow engine registration could not be read. The flow will not start."),null}if(!p)return null;if(typeof p.mount!="function")return i("The flow engine registered something unusable. The flow will not start."),null;let b;try{b=p.contract;}catch(k){b=void 0;}return b!==2?(i(`The flow engine on the CDN speaks contract ${typeof b=="number"?b:"unknown"}, this arcy.js speaks ${2}. Update arcy.js to run flows.`),null):p},h=p=>{try{let b=u();!b&&!o&&p(),f(b);}catch(b){f(null);}},v=false;try{v=e[Vt]!==void 0;}catch(p){v=true;}if(v){h(()=>{});return}try{let p=e.document;a=p.createElement("script"),Le(a),a.async=!0,a.src=`${t}/${wn}`;let b=a.src;a.onload=()=>h(()=>w("The flow engine loaded but did not register. The flow will not start.")),a.onerror=()=>{try{w(`Failed to load ${b}. The flow will not start. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch(k){}f(null);},(p.head||p.documentElement).appendChild(a);}catch(p){w(`The flow engine could not load. ${String(p)}`),f(null);return}try{r(()=>{l||w("The flow engine did not load in time."),f(null);},n);}catch(p){}})}function Xn(e){let{win:t=typeof window!="undefined"?window:void 0,loadChunk:n,loadTimeoutMs:r=ei,setTimeoutImpl:s=(h,v)=>setTimeout(h,v),context:l}=e,a=null,f=null,o=false;function i(){return H(this,null,function*(){if(!(a||o))return f||(f=H(null,null,function*(){if(t)try{let h=yield n(t,r,s);if(!h||o)return;a=h.mount(ae($({},l),{doc:t.document,win:t})),a||w("The flow engine could not start.");}catch(h){w(`The flow engine could not load. ${String(h)}`);}finally{f=null;}}),f)})}return {start(h){return H(this,null,function*(){if(!o&&(yield i(),!o))try{yield a==null?void 0:a.start(h);}catch(v){w(`The flow could not start. ${String(v)}`);}})},resume(){return H(this,null,function*(){if(o||!Kn(l.token).read()||(yield i(),o||!a))return false;try{return yield a.resume()}catch(v){return w(`The flow could not resume. ${String(v)}`),false}})},startPreview(h){return H(this,null,function*(){var v;if(!o&&(yield i(),!o))try{yield (v=a==null?void 0:a.startPreview)==null?void 0:v.call(a,h);}catch(p){w(`The preview could not start. ${String(p)}`);}})},resumePreview(){return H(this,null,function*(){if(o||!ct(l.token)||(yield i(),o||!(a!=null&&a.resumePreview)))return false;try{return yield a.resumePreview()}catch(h){return w(`The preview could not resume. ${String(h)}`),false}})},stop(){var h;if(!o)try{(h=a==null?void 0:a.stop)==null||h.call(a);}catch(v){w(`The flow could not be stopped. ${String(v)}`);}},destroy(){o=true;let h=a;a=null;try{h==null||h.destroy();}catch(v){w(`The flow engine could not be removed. ${String(v)}`);}}}}function Wt(e){let t=e.dataTransfer;if(!t)return false;let n=t.types;if(!n)return false;for(let r=0;r<n.length;r+=1)if(n[r]==="Files")return true;return false}function jn(e){var n;let t=e.dataTransfer;return Array.from((n=t==null?void 0:t.files)!=null?n:[])}var qn=`
5
+ [data-tip] {
6
+ position: relative;
7
+ }
8
+
9
+ [data-tip]::after {
10
+ content: attr(data-tip);
11
+ position: absolute;
12
+ left: 50%;
13
+ bottom: calc(100% + 6px);
14
+ transform: translateX(-50%);
15
+ z-index: 2;
16
+ padding: 4px 8px;
17
+ border-radius: 6px;
18
+ background: var(--_arcy-main-text, #101828);
19
+ color: var(--_arcy-main-bg, #ffffff);
20
+ font-size: 11px;
21
+ line-height: 1.3;
22
+ white-space: nowrap;
23
+ pointer-events: none;
24
+ opacity: 0;
25
+ visibility: hidden;
26
+ transition: opacity 120ms ease;
27
+ }
28
+
29
+ [data-tip][data-tip-placement="below"]::after {
30
+ bottom: auto;
31
+ top: calc(100% + 6px);
32
+ }
33
+
34
+ /* Alignment, for a control near an edge the panel clips (D895). Centring a
35
+ bubble on the leftmost header icon puts half of it outside the panel, and
36
+ the panel clips its overflow, so the half outside is simply gone. No
37
+ z-index can fix that: the bubble is not behind anything, it is cut off.
38
+ These pin the bubble to the control's own edge instead. */
39
+ [data-tip][data-tip-align="start"]::after {
40
+ left: 0;
41
+ transform: none;
42
+ }
43
+
44
+ [data-tip][data-tip-align="end"]::after {
45
+ left: auto;
46
+ right: 0;
47
+ transform: none;
48
+ }
49
+
50
+ [data-tip]:hover::after,
51
+ [data-tip]:focus-visible::after {
52
+ opacity: 1;
53
+ visibility: visible;
54
+ }
55
+
56
+ /* A coarse pointer has no hover: the tooltip would latch open on tap and
57
+ sit over the thing the visitor just pressed. */
58
+ @media (hover: none) {
59
+ [data-tip]::after {
60
+ display: none;
61
+ }
62
+ }
63
+
64
+ @media (prefers-reduced-motion: reduce) {
65
+ [data-tip]::after {
66
+ transition: none;
67
+ }
68
+ }
69
+ `;var Jn=qn+`
70
+ .arcy-bar-wrap {
71
+ gap: 6px;
72
+ font: 14px/1.4 var(--_arcy-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
73
+ /* Only ever animates from a concrete pixel value: bar.ts's render()
74
+ freezes the wrap's current width before writing the target so this has
75
+ two real numbers to interpolate between, never the "max-content"
76
+ keyword most engines cannot transition. */
77
+ transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1);
78
+ /* Above the panel, always (.arcy-chat-panel's own z-index in chat.ts):
79
+ both are position: absolute siblings inside the same shared root with
80
+ nothing else to order them, so without this the panel simply painted
81
+ over the bar whenever they overlapped, because the panel is always the
82
+ later of the two to mount (it loads lazily, on first open()) and DOM
83
+ order was the only tiebreaker. This is its own stacking context, so the
84
+ bar's own menu and tooltips (z-index 2 inside it, tooltip.ts) stay
85
+ above the panel too, not just the bar's own box. */
86
+ z-index: 2;
87
+ }
88
+
89
+ /* The corner launcher the widget becomes when a visitor docks it from the
90
+ panel's Settings sheet. Its size and placement are written inline from
91
+ bar.ts, for the reason at the top of this file: docked, this button is the
92
+ only way back into the widget, so losing this sheet has to leave it plain
93
+ rather than unfindable.
94
+
95
+ It is the WELCOME MARK: same size token, same brand colours, same
96
+ overflow-hidden circle an upload is inset into. The welcome screen's own
97
+ rule, in chat.ts, is its twin, and the two are meant to be
98
+ indistinguishable, because docked this button is that mark. */
99
+ .arcy-bar-dock {
100
+ overflow: hidden;
101
+ appearance: none;
102
+ border: 0;
103
+ /* box-sizing: border-box comes from bar.ts's SURVIVAL_STYLE. calc() against
104
+ the size token itself, NOT a percentage: a percentage padding resolves
105
+ against the containing block's width, not this button's own, and would
106
+ inflate a 34px button to match the page instead of insetting the icon. */
107
+ padding: calc(var(--_arcy-chat-welcome-icon-size, 34px) * 0.15);
108
+ cursor: pointer;
109
+ border-radius: 999px;
110
+ background: var(--_arcy-brand-bg, #101828);
111
+ color: var(--_arcy-brand-text, #ffffff);
112
+ -webkit-tap-highlight-color: transparent;
113
+ /* Its own stacking context, above the panel, same as the bar's wrap. */
114
+ z-index: 2;
115
+ transition: transform 160ms cubic-bezier(0.4, 0, 0.2, 1);
116
+ }
117
+
118
+ .arcy-bar-dock:hover {
119
+ transform: scale(1.06);
120
+ }
121
+
122
+ .arcy-bar-dock:focus-visible {
123
+ outline: 2px solid currentColor;
124
+ outline-offset: 3px;
125
+ }
126
+
127
+ .arcy-bar {
128
+ position: relative;
129
+ display: flex;
130
+ align-items: center;
131
+ box-sizing: border-box;
132
+ width: 100%;
133
+ min-height: 52px;
134
+ padding: 0 8px 0 8px;
135
+ border-radius: var(--arcy-bar-radius, 16px);
136
+ background: var(--_arcy-main-bg, #ffffff);
137
+ color: var(--_arcy-main-text, #101828);
138
+ /* The shared base.border (D832): one value, this edge and the panel's. */
139
+ border: var(--_arcy-border-width, 0px) solid
140
+ var(--_arcy-border-color, color-mix(in srgb, var(--_arcy-main-text, #101828) 15%, transparent));
141
+ /* The focus ring rides in front of the operator's own shadow rather than
142
+ replacing it (D908), so a focused bar keeps whatever depth they chose. */
143
+ box-shadow: var(--_arcy-bar-focus-ring, 0 0 #0000),
144
+ var(--arcy-bar-shadow, 0 8px 24px rgba(16, 24, 40, 0.28));
145
+ transition: box-shadow 160ms ease, background 160ms ease,
146
+ border-color 160ms ease;
147
+ }
148
+
149
+ /* Flow mode's status surface reads left to right (dot, name, step, stop),
150
+ so the left edge sits closer to the composer's usual text inset while the
151
+ right stays flush with the stop control (D930/D979). */
152
+ .arcy-bar[data-mode="flow"] {
153
+ padding: 0 8px 0 16px;
154
+ }
155
+
156
+ /* Glassiness (\xA75.4): a blur behind the bar plus an alpha on
157
+ main.background. Only where the browser can blur; elsewhere the bar stays
158
+ opaque, never transparent. With no glass set the alpha is 0% and this is
159
+ a no-op. */
160
+ @supports (backdrop-filter: blur(1px)) {
161
+ .arcy-bar {
162
+ background: color-mix(in srgb, var(--_arcy-main-bg, #ffffff) calc(100% - var(--_arcy-glass-alpha, 0%)), transparent);
163
+ backdrop-filter: blur(var(--_arcy-glass-blur, 0px));
164
+ -webkit-backdrop-filter: blur(var(--_arcy-glass-blur, 0px));
165
+ }
166
+ }
167
+
168
+ .arcy-bar-form {
169
+ display: flex;
170
+ align-items: center;
171
+ gap: 6px;
172
+ flex: 1 1 auto;
173
+ min-width: 0;
174
+ margin: 0;
175
+ }
176
+
177
+ .arcy-bar-input {
178
+ flex: 1 1 auto;
179
+ min-width: 0;
180
+ appearance: none;
181
+ border: 0;
182
+ background: transparent;
183
+ color: inherit;
184
+ font: inherit;
185
+ padding: 12px 0;
186
+ outline: none;
187
+ }
188
+
189
+ /* Collapsed, the whole pill is the target (ADR 0103): the input inside it is
190
+ a few pixels wide, and a visitor aiming for it is a visitor who misses. */
191
+ .arcy-bar[data-collapsed="true"] {
192
+ cursor: pointer;
193
+ }
194
+
195
+ .arcy-bar[data-collapsed="true"] .arcy-bar-input {
196
+ /* No cursor override here, unlike the pill above: this is a real,
197
+ focusable input, not a decoration, and hovering directly over it
198
+ should give the same text-caret cue any input gives. The surrounding
199
+ pill's own pointer cursor still covers the rest of the target. */
200
+ /* Takes the row's spare width, exactly as it does open (ADR 0149): the
201
+ pill is bar.collapsedWidth wide now rather than as wide as its own
202
+ text, and an input that kept sizing itself to the placeholder would
203
+ leave the operator's extra pixels stranded behind the send control. */
204
+ padding-right: 8px;
205
+ }
206
+
207
+ /* The left slot. As a mark it is not a control, so it takes no hover, no
208
+ pointer and no tab stop; as the menu's plus it is an icon button. */
209
+ .arcy-bar-grip {
210
+ /* Outside the composer's own controls: what it moves is the whole bar, so
211
+ it takes neither the left slot's hover treatment nor its padding
212
+ (ADR 0111). Rendered on BOTH widths of the bar, resting and expanded,
213
+ and only when the operator has allowed it: the data-grip rule below is
214
+ driven by that setting alone. The handle used to vanish the moment the panel
215
+ opened even though dragging the open bar already worked underneath,
216
+ which is a control that is functional but invisible. */
217
+ display: none;
218
+ align-items: center;
219
+ justify-content: center;
220
+ flex: 0 0 auto;
221
+ padding: 0 2px 0 4px;
222
+ margin-right: -2px;
223
+ border: 0;
224
+ background: transparent;
225
+ /* Matches the leading icon's own resting contrast (see .arcy-bar-leading
226
+ below). The previous, much lower value read as barely-there against
227
+ either theme, which made the handle hard to spot rather than subtle. */
228
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 65%, transparent);
229
+ cursor: grab;
230
+ touch-action: none;
231
+ -webkit-tap-highlight-color: transparent;
232
+ }
233
+
234
+ .arcy-bar[data-grip="true"] .arcy-bar-grip {
235
+ display: flex;
236
+ }
237
+
238
+ .arcy-bar-grip:active {
239
+ cursor: grabbing;
240
+ }
241
+
242
+ .arcy-bar-grip:hover {
243
+ color: var(--_arcy-main-text, #101828);
244
+ }
245
+
246
+ .arcy-bar-leading {
247
+ appearance: none;
248
+ border: 0;
249
+ padding: 8px;
250
+ border-radius: 999px;
251
+ background: transparent;
252
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 65%, transparent);
253
+ font: inherit;
254
+ display: flex;
255
+ align-items: center;
256
+ justify-content: center;
257
+ flex: 0 0 auto;
258
+ -webkit-tap-highlight-color: transparent;
259
+ }
260
+
261
+ .arcy-bar-leading[data-role="menu"] {
262
+ cursor: pointer;
263
+ }
264
+
265
+ .arcy-bar-leading[data-role="menu"]:hover {
266
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
267
+ }
268
+
269
+ .arcy-bar-leading[data-role="mark"] {
270
+ cursor: inherit;
271
+ color: var(--_arcy-brand-bg, #101828);
272
+ opacity: 1;
273
+ }
274
+
275
+ .arcy-bar-menu {
276
+ position: absolute;
277
+ left: 0;
278
+ bottom: calc(100% + 8px);
279
+ z-index: 1;
280
+ display: flex;
281
+ flex-direction: column;
282
+ gap: 2px;
283
+ min-width: 200px;
284
+ padding: 6px;
285
+ border-radius: 12px;
286
+ background: var(--_arcy-main-bg, #ffffff);
287
+ color: var(--_arcy-main-text, #101828);
288
+ border: 1px solid
289
+ color-mix(in srgb, var(--_arcy-main-text, #101828) 12%, transparent);
290
+ box-shadow: 0 12px 32px rgba(16, 24, 40, 0.18);
291
+ }
292
+
293
+ /* The menu is a surface the visitor sees, so it wears base.glassiness like
294
+ the bar and the panel do (D832's one-value rule, one layer out). It gets
295
+ its own @supports block rather than joining the bar's above, because this
296
+ sheet declares the menu's opaque background AFTER that block: sharing it
297
+ would put the two rules at equal specificity with the opaque one last,
298
+ and the menu stayed white on a glassy bar.
299
+
300
+ Note this sheet is a template literal. No backticks in these comments. */
301
+ @supports (backdrop-filter: blur(1px)) {
302
+ .arcy-bar-menu {
303
+ background: color-mix(in srgb, var(--_arcy-main-bg, #ffffff) calc(100% - var(--_arcy-glass-alpha, 0%)), transparent);
304
+ backdrop-filter: blur(var(--_arcy-glass-blur, 0px));
305
+ -webkit-backdrop-filter: blur(var(--_arcy-glass-blur, 0px));
306
+ }
307
+ }
308
+
309
+ .arcy-bar-menu-item {
310
+ appearance: none;
311
+ border: 0;
312
+ cursor: pointer;
313
+ font: inherit;
314
+ text-align: left;
315
+ display: flex;
316
+ align-items: center;
317
+ gap: 10px;
318
+ padding: 8px 10px;
319
+ border-radius: 8px;
320
+ background: transparent;
321
+ color: inherit;
322
+ -webkit-tap-highlight-color: transparent;
323
+ }
324
+
325
+ .arcy-bar-menu-item:hover {
326
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
327
+ }
328
+
329
+ .arcy-bar-input::placeholder {
330
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 55%, transparent);
331
+ /* Opera and older Firefox dim placeholders by default, which on a light
332
+ bar reads as a disabled input. */
333
+ opacity: 1;
334
+ }
335
+
336
+ .arcy-bar-input:disabled {
337
+ opacity: 0.6;
338
+ }
339
+
340
+ .arcy-bar-icon,
341
+ .arcy-bar-send,
342
+ .arcy-bar-stop {
343
+ appearance: none;
344
+ border: 0;
345
+ cursor: pointer;
346
+ font: inherit;
347
+ -webkit-tap-highlight-color: transparent;
348
+ display: flex;
349
+ align-items: center;
350
+ justify-content: center;
351
+ flex: 0 0 auto;
352
+ }
353
+
354
+ .arcy-bar-icon {
355
+ padding: 8px;
356
+ border-radius: 999px;
357
+ background: transparent;
358
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 65%, transparent);
359
+ }
360
+
361
+ .arcy-bar-icon:hover {
362
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
363
+ }
364
+
365
+ .arcy-bar-send {
366
+ padding: 10px;
367
+ border-radius: 999px;
368
+ background: var(--_arcy-brand-bg, #101828);
369
+ color: var(--_arcy-brand-text, #ffffff);
370
+ }
371
+
372
+ /* The send control answers the pointer whatever colour the operator chose
373
+ (D888). The hover token defaults to the base colour, so a background swap
374
+ alone is invisible on every theme that did not set one; a lift and a
375
+ contact shadow read on any colour, including white on white. */
376
+ .arcy-bar-send {
377
+ transition: background 120ms ease, transform 120ms ease, box-shadow 120ms ease;
378
+ }
379
+
380
+ .arcy-bar-send:hover {
381
+ background: var(--_arcy-brand-bg-hover, var(--_arcy-brand-bg, #101828));
382
+ transform: translateY(-1px);
383
+ box-shadow: 0 2px 8px rgba(16, 24, 40, 0.18);
384
+ }
385
+
386
+ .arcy-bar-send:active {
387
+ background: var(--_arcy-brand-bg-active, var(--_arcy-brand-bg, #101828));
388
+ transform: translateY(0);
389
+ box-shadow: none;
390
+ }
391
+
392
+ @media (prefers-reduced-motion: reduce) {
393
+ .arcy-bar-send {
394
+ transition: background 120ms ease;
395
+ }
396
+ .arcy-bar-send:hover,
397
+ .arcy-bar-send:active {
398
+ transform: none;
399
+ }
400
+ }
401
+
402
+ .arcy-bar-send:disabled,
403
+ .arcy-bar-icon:disabled {
404
+ cursor: default;
405
+ opacity: 0.6;
406
+ }
407
+
408
+ /* The input takes NO ring of its own (D887). It fills a bar that already
409
+ looks like an input, so a rectangle drawn around the text reads as a
410
+ browser artefact rather than as focus, and it was the first thing a
411
+ visitor saw on clicking. The bar carries the state instead.
412
+
413
+ The border goes brand (D908). base.border.width defaults to 0, so a
414
+ colour change alone would be invisible on most themes; the 1px ring is
415
+ what actually paints the edge there, and on a theme that HAS a border the
416
+ two land on the same line. */
417
+ .arcy-bar:focus-within {
418
+ outline: none;
419
+ border-color: var(--_arcy-brand-bg, #101828);
420
+ --_arcy-bar-focus-ring: 0 0 0 1px var(--_arcy-brand-bg, #101828);
421
+ }
422
+
423
+ /* A control inside the bar still says which control it is: the bar's ring
424
+ says "the widget has focus", this one says "and it is this button". */
425
+ .arcy-bar-icon:focus-visible,
426
+ .arcy-bar-send:focus-visible,
427
+ .arcy-bar-stop:focus-visible,
428
+ .arcy-bar-leading:focus-visible,
429
+ .arcy-bar-menu-item:focus-visible {
430
+ outline: 2px solid var(--_arcy-main-text, #101828);
431
+ outline-offset: 1px;
432
+ }
433
+
434
+ /* The attachment tray. See bar.ts's renderTray(). */
435
+ .arcy-bar-tray {
436
+ display: none;
437
+ flex-wrap: wrap;
438
+ align-items: center;
439
+ gap: 6px;
440
+ padding: 10px 4px 2px 4px;
441
+ min-width: 0;
442
+ }
443
+
444
+ /* A composer holding pictures is two rows, not one. */
445
+ .arcy-bar[data-attachments="true"] {
446
+ flex-direction: column;
447
+ align-items: stretch;
448
+ }
449
+
450
+ /* \u2500\u2500 Flow-running mode \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
451
+
452
+ .arcy-bar-status {
453
+ display: flex;
454
+ align-items: center;
455
+ gap: 10px;
456
+ flex: 1 1 auto;
457
+ min-width: 0;
458
+ }
459
+
460
+ .arcy-bar-dot {
461
+ flex: 0 0 auto;
462
+ width: 8px;
463
+ height: 8px;
464
+ border-radius: 999px;
465
+ background: var(--_arcy-brand-bg, #101828);
466
+ animation: arcy-bar-pulse 1.4s ease-in-out infinite;
467
+ }
468
+
469
+ @keyframes arcy-bar-pulse {
470
+ 0%, 100% { opacity: 1; }
471
+ 50% { opacity: 0.35; }
472
+ }
473
+
474
+ .arcy-bar-flow-name {
475
+ flex: 1 1 auto;
476
+ min-width: 0;
477
+ overflow: hidden;
478
+ text-overflow: ellipsis;
479
+ white-space: nowrap;
480
+ font-size: 13px;
481
+ }
482
+
483
+ .arcy-bar-flow-step {
484
+ flex: 0 0 auto;
485
+ font-size: 12px;
486
+ font-variant-numeric: tabular-nums;
487
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 60%, transparent);
488
+ }
489
+
490
+ .arcy-bar-stop {
491
+ gap: 6px;
492
+ padding: 6px 12px;
493
+ border-radius: 999px;
494
+ font-size: 12px;
495
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
496
+ color: inherit;
497
+ }
498
+
499
+ .arcy-bar-stop:hover {
500
+ background: color-mix(in srgb, var(--_arcy-main-text, #101828) 14%, transparent);
501
+ }
502
+
503
+ /* ADR 0169: the combined input rendering. The status row sits on a slim top
504
+ row and the composer stays live beneath it, so a fill question can be
505
+ answered without losing sight of the run. */
506
+ .arcy-bar[data-mode="input"] {
507
+ flex-direction: column;
508
+ align-items: stretch;
509
+ padding: 6px 8px 0 8px;
510
+ }
511
+
512
+ .arcy-bar[data-mode="input"] .arcy-bar-status {
513
+ flex: 0 0 auto;
514
+ padding: 2px 8px 4px 8px;
515
+ border-bottom: 1px solid
516
+ color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
517
+ }
518
+
519
+ .arcy-bar[data-mode="input"] .arcy-bar-form {
520
+ padding-left: 8px;
521
+ }
522
+
523
+ /* D1296: the done state. The run is over, so the dot stops pulsing and the
524
+ check mark takes the counter's place. */
525
+ .arcy-bar[data-phase="done"] .arcy-bar-dot {
526
+ animation: none;
527
+ opacity: 1;
528
+ }
529
+
530
+ .arcy-bar[data-phase="done"] .arcy-bar-flow-step {
531
+ color: var(--_arcy-main-text, #101828);
532
+ font-size: 14px;
533
+ }
534
+
535
+ /* The AI disclosure. Under the bar, and only while the panel is open: a
536
+ quiet page stays quiet. */
537
+ .arcy-bar-disclaimer {
538
+ font-size: 10.5px;
539
+ text-align: center;
540
+ color: color-mix(in srgb, var(--_arcy-main-text, #101828) 55%, transparent);
541
+ /* The wrap is centred on the bar, so this must not be able to widen it. */
542
+ max-width: 100%;
543
+ }
544
+
545
+ /* The privacy-policy link inline in the bar disclosure (D979/D981-followup).
546
+ Underlined so it reads as clickable against text that otherwise is not. */
547
+ .arcy-chat-policy {
548
+ color: inherit;
549
+ text-decoration: underline;
550
+ text-underline-offset: 2px;
551
+ cursor: pointer;
552
+ }
553
+
554
+ .arcy-chat-policy:hover {
555
+ color: var(--_arcy-main-text, #101828);
556
+ }
557
+
558
+ @media (prefers-reduced-motion: reduce) {
559
+ .arcy-bar,
560
+ .arcy-bar-wrap,
561
+ .arcy-bar-dock,
562
+ .arcy-bar-dot {
563
+ transition: none;
564
+ animation: none;
565
+ }
566
+ }
567
+ `;var Oe=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:0;function Qn(e){var n;let t=(n=e==null?void 0:e.document)==null?void 0:n.documentElement;return {width:Oe(t==null?void 0:t.clientWidth)||Oe(e==null?void 0:e.innerWidth),height:Oe(t==null?void 0:t.clientHeight)||Oe(e==null?void 0:e.innerHeight)}}function ti(e){let t=e==null?void 0:e.visualViewport;if(!t)return 0;let n=Qn(e).height,r=Oe(t.height);if(!n||!r)return 0;let s=typeof t.offsetTop=="number"&&Number.isFinite(t.offsetTop)?t.offsetTop:0,l=n-(r+s);return !Number.isFinite(l)||l<24?0:Math.min(l,n)}function dt(e){let t=Qn(e);return ae($({},t),{isMobile:t.width>0&&t.width<640,keyboardOffset:ti(e)})}var ni=560;function Zn(e,t){let n=Oe(t.width);if(!n)return ni;if(n<640)return Math.max(0,n-24);let r=Math.round(e/100*n);return Math.min(r,n-32)}function er(e){return e.x===0&&e.y===0?"none":`translate(${e.x}px, ${e.y}px)`}function $t(e,t,n){let r=Oe(n);if(!r)return e;let s=Math.max(0,(r-Oe(t))/2);return Math.min(s,Math.max(-s,e))}var oi=1e4,tr=52,ft=24,pt=18,mt=30,gt=280,nr="var(--_arcy-chat-welcome-icon-size, 34px)",rr="53%",ii=24,or="http://www.w3.org/2000/svg",ir=[["box-sizing","border-box"],["margin","0"],["display","flex"]],sr=[["position","absolute"],["pointer-events","auto"]],si=260,ai=300,li=150,ci=3e3;function Ae(e,t,n,r=2){let s=e.createElementNS(or,"svg");s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("aria-hidden","true"),s.setAttribute("width",String(n)),s.setAttribute("height",String(n));let l=e.createElementNS(or,"path");return l.setAttribute("d",t),l.setAttribute("fill","none"),l.setAttribute("stroke","currentColor"),l.setAttribute("stroke-width",String(r)),l.setAttribute("stroke-linecap","round"),l.setAttribute("stroke-linejoin","round"),s.appendChild(l),s}function ar(e,t,n){let r=e.createElement("img");return r.src=t,r.alt="",r.setAttribute("aria-hidden","true"),r.width=n,r.height=n,r.style.setProperty("width",`${n}px`),r.style.setProperty("height",`${n}px`),r.style.setProperty("object-fit","contain"),r}var ui="M5 3H19A2 2 0 0 1 21 5V19A2 2 0 0 1 19 21H5A2 2 0 0 1 3 19V5A2 2 0 0 1 5 3ZM7 9a2 2 0 1 0 4 0a2 2 0 1 0-4 0M21 15l-3.086-3.086a2 2 0 0 0-2.828 0L6 21",Qe={x:0,y:0},di="M12 5v14M5 12h14",fi="M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",lr="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594zM20 2v4M22 4h-4M4 20m-2 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0",cr="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z",pi="M12 19V5M5 12l7-7 7 7",mi="M6 6h12v12H6z";function q(e,t){return (...n)=>{try{t(...n);}catch(r){w(`${e} failed. ${String(r)}`);}}}var gi={send:"Send",attachMenu:"Add",attachImage:"Attach an image",flowStop:"Stop",openChat:"Open chat",moveBar:"Move the chat bar",flowStep:"Step {step} of {total}"};function ur(e={}){var Zt,en,tn,nn,rn,on,sn,an,ln,cn;let t=$($({},gi),(Zt=e.labels)!=null?Zt:{}),n={widthPercent:(tn=(en=e.geometry)==null?void 0:en.widthPercent)!=null?tn:mt,bottomOffset:(rn=(nn=e.geometry)==null?void 0:nn.bottomOffset)!=null?rn:ft,collapsedWidth:(sn=(on=e.geometry)==null?void 0:on.collapsedWidth)!=null?sn:gt},r=null,s=false,l=null,a=null,f=null,o=null,i=null,u=null,h=(an=e.iconUrl)!=null?an:null,v=(ln=e.iconSize)!=null?ln:pt,p=(cn=e.welcomeIconUrl)!=null?cn:null,b=null,k=null,D=false,I=null,V=null,P=false,X={x:0,y:0},S=null,E=null,F=null,A=null,M=null,C=null,G=null,U=null,K=null,J=null,ee="idle",L=null,j=false,le=false,Ce=0,ce=false,Te=false,Y={width:0,height:0,isMobile:false,keyboardOffset:0};function ge(){return !L&&ee!=="open"}function he(c){var W,Pe;let m=(W=l==null?void 0:l.offsetWidth)!=null?W:0,O=(Pe=l==null?void 0:l.offsetHeight)!=null?Pe:0;if(!Y.width||!Y.height)return c;let _=n.bottomOffset+Y.keyboardOffset,te=Math.max(0,Y.height-O-_);return {x:$t(c.x,m,Y.width),y:Math.min(_,Math.max(-te,c.y))}}function ue(c){var ve,un;if(!D||Y.isMobile)return;c.preventDefault(),c.stopPropagation();let m=c.clientX,O=c.clientY,_=X,te=k,W=(un=(ve=k==null?void 0:k.ownerDocument)==null?void 0:ve.defaultView)!=null?un:typeof window!="undefined"?window:null,Pe=De=>{var ze;De.pointerId===c.pointerId&&(X=he({x:_.x+(De.clientX-m),y:_.y+(De.clientY-O)}),se(),(ze=e.onGeometryChange)==null||ze.call(e));},re=De=>{var ze;if(De.pointerId===c.pointerId){W==null||W.removeEventListener("pointermove",Pe,true),W==null||W.removeEventListener("pointerup",re,true),W==null||W.removeEventListener("pointercancel",re,true);try{te==null||te.releasePointerCapture(De.pointerId);}catch(Is){}(ze=e.onPositionChange)==null||ze.call(e,X);}};try{te==null||te.setPointerCapture(c.pointerId);}catch(De){}W==null||W.addEventListener("pointermove",Pe,true),W==null||W.addEventListener("pointerup",re,true),W==null||W.addEventListener("pointercancel",re,true);}function He(){l==null||l.style.setProperty("display",P?"none":"flex","important"),I&&(I.style.setProperty("display",P?"flex":"none","important"),P&&(I.style.setProperty("bottom",`${n.bottomOffset+Y.keyboardOffset}px`,"important"),I.style.setProperty("right",`${ii}px`,"important")));}function se(){if(He(),!l)return;let c=ge(),m=Zn(n.widthPercent,Y),O=n.bottomOffset+Y.keyboardOffset;l.style.setProperty("bottom",`${O}px`,"important"),l.style.setProperty("left","50%","important"),l.style.setProperty("translate","-50%","important");let _=D&&!Y.isMobile?he(X):Qe;X=_;let te=L?Qe:{x:$t(_.x,c?n.collapsedWidth:m,Y.width),y:_.y};l.style.setProperty("transform",er(te)),a==null||a.setAttribute("data-grip",D&&!Y.isMobile&&!L?"true":"false"),l.style.setProperty("width",c?`${n.collapsedWidth}px`:`${m}px`);let W=`calc(100% - ${24}px)`;l.style.setProperty("max-width",Y.isMobile?W:"none"),l.setAttribute("data-mobile",Y.isMobile?"":"false");}function xe(){if(!i||!u)return;let c=i.ownerDocument,m=!ge()&&le,O=m?Ae(c,di,18):h?ar(c,h,v):Ae(c,lr,v);i.replaceChild(O,u),u=O,i.setAttribute("aria-label",t.attachMenu),m?i.setAttribute("data-tip",t.attachMenu):i.removeAttribute("data-tip"),i.setAttribute("aria-haspopup",m?"menu":"false"),i.setAttribute("data-role",m?"menu":"mark"),i.disabled=!m,i.setAttribute("aria-hidden",m?"false":"true"),i.tabIndex=m?0:-1,m||x();}function _e(){if(!J||!a)return;let c=le&&Ce>0&&!ge(),m=a.getAttribute("data-attachments")==="true";J.style.setProperty("display",c?"flex":"none"),a.setAttribute("data-attachments",c?"true":"false"),m!==c&&q("onGeometryChange",()=>{var O;return (O=e.onGeometryChange)==null?void 0:O.call(e)})();}function R(c){ce=c,S&&S.style.setProperty("display",c?"flex":"none"),i==null||i.setAttribute("aria-expanded",c?"true":"false"),c&&(E==null||E.focus());}function x(){if(!ce)return;let c=S==null?void 0:S.getRootNode(),m=!!(c&&"activeElement"in c&&c.activeElement&&(S!=null&&S.contains(c.activeElement)));R(false),m&&(i==null||i.focus());}function N(){if(!I||!V)return;let c=I.ownerDocument,m=p&&p!==b?p:null,O;if(m){let _=c.createElement("img");_.src=m,_.alt="",_.setAttribute("aria-hidden","true"),_.style.setProperty("width","100%"),_.style.setProperty("height","100%"),_.style.setProperty("object-fit","contain"),_.style.setProperty("display","block"),_.addEventListener("error",()=>{b=m,N();},{once:true}),O=_;}else {let _=Ae(c,cr,18);_.setAttribute("width",rr),_.setAttribute("height",rr),O=_;}I.replaceChild(O,V),V=O;}function z(){if(!a||!f||!M)return;let c=L?j?"input":"flow":ee,m=(L==null?void 0:L.phase)==="done";a.setAttribute("data-mode",c),a.setAttribute("data-phase",L?m?"done":"running":"none"),a.setAttribute("data-collapsed",ge()?"true":"false"),xe(),_e(),se(),f.style.setProperty("display",c==="flow"?"none":"flex"),M.style.setProperty("display",c==="flow"||c==="input"?"flex":"none"),A==null||A.style.setProperty("display","flex"),a.setAttribute("aria-expanded",c==="open"?"true":"false"),L&&C&&G&&(C.textContent=L.name,G.textContent=m?"\u2713":t.flowStep.replace("{step}",String(L.step)).replace("{total}",String(L.total)),U==null||U.style.setProperty("display",m?"none":"flex")),K&&K.style.setProperty("display",c==="open"&&K.textContent?"block":"none");}function ye(){Y=dt(typeof window!="undefined"?window:null),se(),q("onGeometryChange",()=>{var c;return (c=e.onGeometryChange)==null?void 0:c.call(e)})();}function de(c){var O;c.preventDefault();let m=(O=o==null?void 0:o.value.trim())!=null?O:"";if(!m&&Ce===0){be();return}o&&(o.value=""),q("onSubmit",()=>{var _;return (_=e.onSubmit)==null?void 0:_.call(e,m)})();}function Fe(){be();}function be(){L||ee==="open"||Te||(Te=true,q("onActivate",()=>{var c;return (c=e.onActivate)==null?void 0:c.call(e)})());}function Ie(c){if(!(L||ee==="open")&&!(S&&c.target instanceof Node&&S.contains(c.target))){be();try{o==null||o.focus();}catch(m){}}}function Ue(){Te=false;}function tt(c){c.preventDefault(),c.stopPropagation(),!(ge()||!le)&&R(!ce);}function wt(){try{F==null||F.click();}catch(c){}}function Ke(c){var m;c.preventDefault(),c.stopPropagation(),x(),wt(),(m=e.onAttach)==null||m.call(e);}function Ne(){var O;let c=F==null?void 0:F.files,m=c?Array.from(c):[];F&&(F.value=""),!(!le||m.length===0)&&((O=e.onFiles)==null||O.call(e,m));}function vt(c){c.key==="Escape"&&ce&&x();}function St(c){if(!ce)return;let m=c.target;m instanceof Node&&((i==null?void 0:i.contains(m))===true||(S==null?void 0:S.contains(m))===true)||x();}function Et(c){let m=typeof c.composedPath=="function"?c.composedPath():[],O=c.target,_=r==null?void 0:r.host,te=!!(_&&(m.some(W=>W===_)||m.length===0&&O instanceof Node&&_.contains(O)));ce&&!te&&x(),!(L||ee!=="open")&&(!_||te||q("onDismiss",()=>{var W;return (W=e.onDismiss)==null?void 0:W.call(e)})());}function Tt(c){Wt(c)&&c.preventDefault();}function xt(c){var O;if(!Wt(c)||(c.preventDefault(),!le))return;let m=jn(c);m.length!==0&&((O=e.onFiles)==null||O.call(e,m));}let we=q("resize",ye),nt=q("submit",de),fe=q("focus",Fe),ke=q("barClick",Ie),rt=q("pointerdown",Ue),Ge=q("attachMenu",tt),d=q("attach",Ke),y=q("picked",Ne),T=q("stop",()=>{var c;return (c=e.onStop)==null?void 0:c.call(e)}),g=q("menuKey",vt),B=q("menuDismiss",Et),Q=q("menuDismissInside",St),pe=q("dragover",Tt),Re=q("drop",xt),Z=q("undock",()=>{var c;return (c=e.onUndock)==null?void 0:c.call(e)});function Ye(c){if(!s){s=true;try{c.style.setProperty("opacity","1");}catch(m){}}}function zr(c,m){if(s)return;if(!m||typeof m.setTimeout!="function"){s=true;return}try{c.style.setProperty("opacity","0"),c.style.setProperty("transition",`opacity ${si}ms ease`);}catch(_){s=true;return}let O=_=>{try{m.setTimeout(()=>Ye(c),_);}catch(te){Ye(c);}};if(c.ownerDocument.readyState==="complete"){O(li);return}try{m.addEventListener("load",()=>O(ai),{once:!0});}catch(_){}O(ci);}function Xr(){var te,W,Pe;if(r!=null&&r.host.isConnected){w("The chat bar is already mounted. Ignoring the second mount.");return}r=null;let c=it({container:e.container});if(!c)return;r=c,zr(c.host,c.host.ownerDocument.defaultView),In(r,Jn);let m=r.host.ownerDocument;l=m.createElement("div"),l.className="arcy-bar-wrap";for(let[re,ve]of ir)l.style.setProperty(re,ve);for(let[re,ve]of sr)l.style.setProperty(re,ve,"important");l.style.setProperty("flex-direction","column"),l.style.setProperty("align-items","center"),a=m.createElement("div"),a.className="arcy-bar",a.setAttribute("role","group"),a.setAttribute("aria-label",t.openChat),f=m.createElement("form"),f.className="arcy-bar-form",o=m.createElement("input"),o.type="text",o.className="arcy-bar-input",o.maxLength=oi,o.setAttribute("aria-label",t.openChat),o.autocomplete="off",J=m.createElement("div"),J.className=Un,J.style.setProperty("display","none"),k=m.createElement("button"),k.type="button",k.className="arcy-bar-grip",k.setAttribute("aria-label",t.moveBar),k.setAttribute("data-tip",t.moveBar),k.appendChild(Ae(m,fi,16)),k.addEventListener("pointerdown",ue),k.addEventListener("click",re=>re.stopPropagation()),i=m.createElement("button"),i.type="button",i.className="arcy-bar-leading",u=h?ar(m,h,v):Ae(m,lr,v),i.appendChild(u),S=m.createElement("div"),S.className="arcy-bar-menu",S.setAttribute("role","menu"),S.style.setProperty("display","none"),E=m.createElement("button"),E.type="button",E.className="arcy-bar-menu-item",E.setAttribute("role","menuitem"),E.appendChild(Ae(m,ui,16)),E.appendChild(m.createTextNode(t.attachImage)),S.appendChild(E),F=m.createElement("input"),F.type="file",F.accept=Bn.join(","),F.multiple=true,F.tabIndex=-1,F.setAttribute("aria-hidden","true"),F.style.setProperty("display","none"),a.appendChild(F),A=m.createElement("button"),A.type="submit",A.className="arcy-bar-send",A.setAttribute("aria-label",t.send),A.appendChild(Ae(m,pi,18)),f.appendChild(k),f.appendChild(i),f.appendChild(o),f.appendChild(A),M=m.createElement("div"),M.className="arcy-bar-status",M.style.setProperty("display","none");let O=m.createElement("span");O.className="arcy-bar-dot",O.setAttribute("aria-hidden","true"),C=m.createElement("span"),C.className="arcy-bar-flow-name",G=m.createElement("span"),G.className="arcy-bar-flow-step",U=m.createElement("button"),U.type="button",U.className="arcy-bar-stop",U.appendChild(Ae(m,mi,15,2)),U.appendChild(m.createTextNode(t.flowStop)),M.appendChild(O),M.appendChild(C),M.appendChild(G),M.appendChild(U),a.appendChild(J),a.appendChild(f),a.appendChild(M),a.appendChild(S),K=m.createElement("div"),K.className="arcy-bar-disclaimer",K.style.setProperty("display","none"),l.appendChild(a),l.appendChild(K),I=m.createElement("button"),I.type="button",I.className="arcy-bar-dock",I.setAttribute("aria-label",t.openChat),I.setAttribute("data-tip",t.openChat),I.setAttribute("data-tip-placement","above"),I.setAttribute("data-tip-align","end");for(let[re,ve]of ir)I.style.setProperty(re,ve);for(let[re,ve]of sr)I.style.setProperty(re,ve,"important");I.style.setProperty("align-items","center"),I.style.setProperty("justify-content","center"),I.style.setProperty("width",nr),I.style.setProperty("height",nr),V=Ae(m,cr,18),I.appendChild(V),N(),I.addEventListener("click",Z),f.addEventListener("submit",nt),o.addEventListener("focus",fe),a.addEventListener("click",ke),a.addEventListener("pointerdown",rt,true),i.addEventListener("click",Ge),E.addEventListener("click",d),F.addEventListener("change",y),U.addEventListener("click",T),a.addEventListener("dragover",pe),a.addEventListener("drop",Re),m.addEventListener("pointerdown",B,true),r.root.addEventListener("pointerdown",Q,true),m.addEventListener("keydown",g,true);let _=m.defaultView;_==null||_.addEventListener("resize",we),_==null||_.addEventListener("orientationchange",we),(te=_==null?void 0:_.visualViewport)==null||te.addEventListener("resize",we),(W=_==null?void 0:_.visualViewport)==null||W.addEventListener("scroll",we),r.root.appendChild(l),r.root.appendChild(I),Y=dt(_!=null?_:null),P=((Pe=e.readDocked)==null?void 0:Pe.call(e))===true,se(),z();}function jr(){var O,_;if(!r)return;let c=r.host.ownerDocument.defaultView;c==null||c.removeEventListener("resize",we),c==null||c.removeEventListener("orientationchange",we),(O=c==null?void 0:c.visualViewport)==null||O.removeEventListener("resize",we),(_=c==null?void 0:c.visualViewport)==null||_.removeEventListener("scroll",we),f==null||f.removeEventListener("submit",nt),o==null||o.removeEventListener("focus",fe),a==null||a.removeEventListener("click",ke),a==null||a.removeEventListener("pointerdown",rt,true),i==null||i.removeEventListener("click",Ge),E==null||E.removeEventListener("click",d),F==null||F.removeEventListener("change",y),U==null||U.removeEventListener("click",T),a==null||a.removeEventListener("dragover",pe),a==null||a.removeEventListener("drop",Re),I==null||I.removeEventListener("click",Z);let m=r.host.ownerDocument;m.removeEventListener("pointerdown",B,true),r.root.removeEventListener("pointerdown",Q,true),m.removeEventListener("keydown",g,true),r.destroy(),r=null,l=a=f=M=C=G=K=null,o=null,E=A=U=null,F=null,i=null,u=null,I=null,V=null,S=null,J=null,ce=false,L=null,ee="idle";}return {mount:Xr,unmount:jr,isMounted:()=>r!==null&&r.host.isConnected,getElement:()=>a,getRoot:()=>{var c;return (c=r==null?void 0:r.root)!=null?c:null},getHost:()=>{var c;return (c=r==null?void 0:r.host)!=null?c:null},setMode(c){ee!==c&&(ee=c,Te=false,z());},getMode:()=>L?"flow":ee,setGeometry(c){var m,O,_;n={widthPercent:(m=c.widthPercent)!=null?m:n.widthPercent,bottomOffset:(O=c.bottomOffset)!=null?O:n.bottomOffset,collapsedWidth:(_=c.collapsedWidth)!=null?_:n.collapsedWidth},se();},getMetrics:()=>ae($({},n),{offset:L||!D||Y.isMobile?Qe:X,height:(l==null?void 0:l.offsetHeight)||(a==null?void 0:a.offsetHeight)||tr,keyboardOffset:Y.keyboardOffset,isMobile:Y.isMobile,viewportHeight:Y.height,viewportWidth:Y.width}),getHeight:()=>(l==null?void 0:l.offsetHeight)||(a==null?void 0:a.offsetHeight)||tr,setLabels(c){t=$($({},t),c);try{if(A==null||A.setAttribute("aria-label",t.send),E){let m=E.lastChild;m&&(m.textContent=t.attachImage);}if(a==null||a.setAttribute("aria-label",t.openChat),o==null||o.setAttribute("aria-label",t.openChat),I&&(I.setAttribute("aria-label",t.openChat),I.setAttribute("data-tip",t.openChat)),k&&(k.setAttribute("aria-label",t.moveBar),k.setAttribute("data-tip",t.moveBar)),U){let m=U.lastChild;m&&(m.textContent=t.flowStop);}}catch(m){}z();},setPlaceholder(c){try{o&&(o.placeholder=c!=null?c:"");}catch(m){}},setDisabled(c){try{o&&(o.disabled=c),A&&(A.disabled=c),E&&(E.disabled=c),c&&x();}catch(m){}},setAttachEnabled(c){le!==c&&(le=c,z());},setDraggable(c){var m,O,_;D!==c&&(D=c,X=c&&(O=(m=e.readPosition)==null?void 0:m.call(e))!=null?O:Qe,se(),(_=e.onGeometryChange)==null||_.call(e));},setIcon(c){h!==c&&(h=c,xe());},setIconSize(c){v!==c&&(v=c,xe());},setWelcomeIcon(c){p!==c&&(p=c,b=null,N());},setDocked(c){P!==c&&(P=c,q("onDockedChange",()=>{var m;return (m=e.onDockedChange)==null?void 0:m.call(e,c)})(),c&&x(),se(),q("onGeometryChange",()=>{var m;return (m=e.onGeometryChange)==null?void 0:m.call(e)})());},isDocked:()=>P,setFlow(c){L=c,c||(j=false),z();},setAwaitingInput(c){j!==c&&(j=c,z(),q("onGeometryChange",()=>{var m;return (m=e.onGeometryChange)==null?void 0:m.call(e)})());},setDisclaimer(c){try{if(K&&(K.textContent="",c!=null))if(typeof c=="string")K.textContent=c;else {let m=K.ownerDocument;K.appendChild(m.createTextNode(c.before));let O=m.createElement("a");O.className=Hn,O.href=c.linkHref,O.target="_blank",O.rel="noopener noreferrer",O.textContent=c.linkLabel,K.appendChild(O),c.after&&K.appendChild(m.createTextNode(c.after));}}catch(m){}z();},setAttachmentCount(c){Ce=c;try{_e();}catch(m){}},attachmentSlot:()=>J,focusInput(){try{r&&Pt(r.host.ownerDocument,r.host),o==null||o.focus();}catch(c){}},reposition:()=>{Y=dt(typeof window!="undefined"?window:null),se();},readValue:()=>{var c;return (c=o==null?void 0:o.value)!=null?c:""},clearValue(){try{o&&(o.value="");}catch(c){}}}}var hi="https://api.arcyai.com";function Kt(e){return typeof e!="string"||e.length===0||e.length>2048?false:/^https:\/\//i.test(e)?true:e.startsWith("/")&&!e.startsWith("//")}function ht(e,t){return Kt(e)?/^https:\/\//i.test(e)?e:`${(t!=null?t:hi).replace(/\/+$/,"")}${e}`:null}var yi=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,bi=/^[a-z0-9-]{1,32}$/,dr={none:"none",soft:"0 0 2px rgba(16, 24, 40, 0.04), 0 0 8px rgba(16, 24, 40, 0.06)",medium:"0 0 4px rgba(16, 24, 40, 0.05), 0 0 20px rgba(16, 24, 40, 0.10)",strong:"0 0 8px rgba(16, 24, 40, 0.07), 0 0 36px rgba(16, 24, 40, 0.16)",bold:"0 0 12px rgba(16, 24, 40, 0.10), 0 0 48px rgba(16, 24, 40, 0.22)"},wi=20,vi=50,Si=30,Ei=80,Ti=0,xi=120,ki=14,Ai=28,Ci=180,_i=480,Ii=2147483647,yt={vars:{},widthPercent:null,bottomOffset:null,collapsedWidth:null,barIconSize:null,maxHeightPercent:null,zIndex:null};function me(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Me(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.min(n,Math.max(t,e))}function Ze(e,t,n){if(t)for(let[r,s]of n){let l=t[r];typeof l=="string"&&yi.test(l)&&(e[s]=l);}}function We(e,t,n,r,s){let l=Me(n,r,s);l!==null&&(e[t]=`${l}px`);}function fr(e,t,n){typeof n=="string"&&n in dr&&(e[t]=dr[n]);}function Gt(e){let t=me(e);if(!t)return yt;let n={},r=me(t.base);Ze(n,me(r==null?void 0:r.brand),[["text","--_arcy-brand-text"],["background","--_arcy-brand-bg"],["hover","--_arcy-brand-bg-hover"],["active","--_arcy-brand-bg-active"]]),Ze(n,me(r==null?void 0:r.main),[["text","--_arcy-main-text"],["background","--_arcy-main-bg"]]);let s=me(r==null?void 0:r.border);We(n,"--_arcy-border-width",s==null?void 0:s.width,0,8),Ze(n,s,[["color","--_arcy-border-color"]]);let l=Me(r==null?void 0:r.glassiness,0,100);l!==null&&l>0&&(n["--_arcy-glass-blur"]=`${Math.round(l/5)}px`,n["--_arcy-glass-alpha"]=`${Math.round(l/2)}%`);let a=r==null?void 0:r.fontFamily;typeof a=="string"&&bi.test(a)&&a!=="system"&&(n[Ht]=a);let f=Me(r==null?void 0:r.zIndex,0,Ii);We(n,"--arcy-bar-radius",r==null?void 0:r.borderRadius,0,32),We(n,"--_arcy-chat-radius",r==null?void 0:r.borderRadius,0,32),fr(n,"--arcy-bar-shadow",r==null?void 0:r.shadow),fr(n,"--_arcy-chat-shadow",r==null?void 0:r.shadow);let o=me(t.bar),i=me(t.chat);We(n,"--_arcy-chat-logo-size",i==null?void 0:i.logoSize,16,48),We(n,"--_arcy-chat-welcome-icon-size",i==null?void 0:i.welcomeIconSize,16,72),Ze(n,me(i==null?void 0:i.assistantBubble),[["background","--_arcy-assistant-bg"],["text","--_arcy-assistant-text"]]);let u=me(i==null?void 0:i.scrollbar);return We(n,"--_arcy-scroll-width",u==null?void 0:u.width,2,16),Ze(n,u,[["track","--_arcy-scroll-track"],["thumb","--_arcy-scroll-thumb"],["thumbHover","--_arcy-scroll-thumb-hover"]]),{vars:n,widthPercent:Me(i==null?void 0:i.width,wi,vi),bottomOffset:Me(o==null?void 0:o.bottomOffset,Ti,xi),collapsedWidth:Me(o==null?void 0:o.collapsedWidth,Ci,_i),barIconSize:Me(o==null?void 0:o.iconSize,ki,Ai),maxHeightPercent:Me(i==null?void 0:i.maxHeight,Si,Ei),zIndex:f!==null?Math.round(f):null}}var Ri=["--_arcy-brand-text","--_arcy-brand-bg","--_arcy-brand-bg-hover","--_arcy-brand-bg-active","--_arcy-main-text","--_arcy-main-bg","--_arcy-border-width","--_arcy-border-color","--_arcy-glass-blur","--_arcy-glass-alpha",Ht,"--arcy-bar-radius","--arcy-bar-shadow","--_arcy-chat-radius","--_arcy-chat-logo-size","--_arcy-chat-welcome-icon-size","--_arcy-chat-shadow","--_arcy-assistant-bg","--_arcy-assistant-text","--_arcy-scroll-width","--_arcy-scroll-track","--_arcy-scroll-thumb","--_arcy-scroll-thumb-hover"];function pr(e,t){try{for(let n of Ri){let r=t.vars[n];r===void 0?e.style.removeProperty(n):e.style.setProperty(n,r);}e.style.setProperty("z-index",t.zIndex===null?Rt:String(t.zIndex),"important");}catch(n){w(`The widget could not apply its theme. ${String(n)}`);}}var Pi="arcy.tokens.",Li=4096,Oi=100;function et(e){let t=me(e);if(!t)return null;let n=typeof t.name=="string"?t.name.slice(0,Oi):"",r=t.logoUrl,s=Kt(r)?r:null;return {name:n,logoUrl:s}}function mr(e,t=Ee()){let n=oe(t),r=Pi+e;return {read(){let s=me(ie(n,r));return {tokens:Gt(s==null?void 0:s.t),identity:et(s==null?void 0:s.w)}},remember(s,l){let a=me(s),f=et(l);if(!a&&!f){n.removeItem(r);return}try{let o={t:a!=null?a:void 0,w:f!=null?f:void 0};if(JSON.stringify(o).length>Li)return;ne(n,r,o);}catch(o){}}}}var Mi="arcy.shell.",gr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,Fi=/^[a-z]{2}-[A-Z]{2}$/;function Ni(e){if(!e||typeof e!="object")return null;let{x:t,y:n}=e;return typeof t!="number"||typeof n!="number"||!Number.isFinite(t)||!Number.isFinite(n)?null:{x:t,y:n}}function Di(e){var s,l,a;let t=typeof globalThis!="undefined"?globalThis.crypto:void 0;if(!e&&t&&typeof t.randomUUID=="function")try{let f=t.randomUUID();if(gr.test(f))return f}catch(f){}let n=new Uint8Array(16);if(e)e(n);else if(t&&typeof t.getRandomValues=="function")t.getRandomValues(n);else for(let f=0;f<n.length;f++)n[f]=Math.floor(Math.random()*256);n[6]=((s=n[6])!=null?s:0)&15|64,n[8]=((l=n[8])!=null?l:0)&63|128;let r="";for(let f=0;f<n.length;f++)r+=((a=n[f])!=null?a:0).toString(16).padStart(2,"0");return `${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function hr(e,{store:t=Ee(),fill:n}={}){let r=oe(t),s=Mi+e;function l(){var o;return (o=ie(r,s))!=null?o:{}}function a(o){ne(r,s,$($({},l()),o));}function f(){let o=l(),i=o.anonymousId;return {anonymousId:typeof i=="string"&&gr.test(i)?i:null,position:Ni(o.position),docked:o.docked===true,locale:typeof o.locale=="string"&&Fi.test(o.locale)?o.locale:null}}return {read:f,anonymousId(){let o=f().anonymousId;return o||(a({anonymousId:Di(n)}),f().anonymousId)},rememberPosition(o){a({position:o});},rememberDocked(o){a({docked:o});},rememberLocale(o){a({locale:o});},forgetAnonymousId(){let o=l();o.anonymousId!==void 0&&(delete o.anonymousId,Object.keys(o).length===0?r.removeItem(s):ne(r,s,o));}}}var Bi="arcy.visit.",yr="first";function br(e,t=Ve()){let n=oe(t),r=Bi+e;return {markFirstVisit(){n.setItem(r,yr);},isFirstVisit(){return n.getItem(r)===yr}}}var wr="0123456789ABCDEFGHJKMNPQRSTVWXYZ";var Yt=e=>{let t=typeof globalThis!="undefined"?globalThis.crypto:void 0;if(t&&typeof t.getRandomValues=="function"){t.getRandomValues(e);return}for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);};function $e(e,t=Yt){var a,f;let n="",r=Math.floor(e);for(let o=0;o<10;o++)n=((a=wr[r%32])!=null?a:"0")+n,r=Math.floor(r/32);let s=new Uint8Array(16);t(s);let l="";for(let o=0;o<16;o++)l+=wr[((f=s[o])!=null?f:0)%32];return n+l}var Hi="arcy.chat.",Ui=1440*60*1e3;function vr(e,{store:t=Ee(),fill:n=Yt,now:r=Date.now}={}){let s=oe(t),l=Hi+e;function a(){var o;return (o=ie(s,l))!=null?o:{}}function f(){let o=$e(r(),n);return ne(s,l,{id:o,lastActiveAt:r()}),o}return {id(){let o=a(),i=typeof o.id=="string"?o.id:null,u=typeof o.lastActiveAt=="number"?o.lastActiveAt:null;return i&&u!==null&&r()-u<Ui?i:f()},touch(){let o=a();typeof o.id=="string"&&ne(s,l,ae($({},o),{lastActiveAt:r()}));},reset(){f();},adopt(o){return typeof o!="string"||o.length===0?this.id():(ne(s,l,{id:o,lastActiveAt:r()}),o)},startNew(){return f()}}}var Vi=[["utm_source","utmSource"],["utm_medium","utmMedium"],["utm_campaign","utmCampaign"],["utm_content","utmContent"],["utm_term","utmTerm"]],Wi=255,$i=512,Ki=/[\u0000-\u001f\u007f]/g;function Sr(e,t){let n=e.replace(Ki,"").trim();if(n.length!==0)return n.slice(0,t)}function Gi(e){if(!(typeof e!="string"||e.length===0))try{let t=new URL(e),n=t.host;if(!n)return;let r=Be(t.pathname);return Sr(r==="/"?n:n+r,$i)}catch(t){return}}function Yi(e){let t={};if(typeof e!="string"||e.length===0)return t;let n=e.charAt(0)==="?"?e.slice(1):e;for(let r of n.split("&")){let s=r.indexOf("=");if(s<=0)continue;let l=r.slice(0,s).toLowerCase(),a=Vi.find(i=>i[0]===l);if(!a)continue;let f=r.slice(s+1).replace(/\+/g," ");try{f=decodeURIComponent(f);}catch(i){}let o=Sr(f,Wi);o&&(t[a[1]]=o);}return t}function zi(e){let t=typeof e=="string"?e:"";if(t.length!==0){if(/Edg[A-Z]?\//.test(t))return "Edge";if(/OPR\/|Opera/.test(t))return "Opera";if(/SamsungBrowser\//.test(t))return "Samsung Internet";if(/Firefox\/|FxiOS\//.test(t))return "Firefox";if(/Chrome\/|CriOS\//.test(t))return "Chrome";if(/Safari\//.test(t))return "Safari"}}function Xi(e){let t=typeof e=="string"?e:"";if(t.length!==0){if(/iPhone|iPad|iPod/.test(t))return "iOS";if(/Android/.test(t))return "Android";if(/CrOS/.test(t))return "ChromeOS";if(/Windows/.test(t))return "Windows";if(/Mac OS X|Macintosh/.test(t))return "macOS";if(/Linux/.test(t))return "Linux"}}function ji(e){if(!(typeof e!="number"||!(e>0)))return e<480?"xs":e<768?"sm":e<1024?"md":e<1280?"lg":"xl"}function Er(e){let t=$({},Yi(e.search)),n=Gi(e.referrer);n&&(t.referrer=n);let r=zi(e.userAgent);r&&(t.browser=r);let s=Xi(e.userAgent);s&&(t.os=s);let l=ji(e.viewportWidth);return l&&(t.viewport=l),Object.keys(t).length>0?t:void 0}var qi=["ON","REQUIRE_CONSENT","OFF"];function Tr(e,t){function n(){let s=ie(e,t);if(!s)return {};let l=typeof s.state=="string"&&qi.indexOf(s.state)!==-1?s.state:void 0,a=typeof s.consent=="boolean"?s.consent:void 0;return {state:l,consent:a}}function r(s){if(s.state===void 0&&s.consent===void 0){e.removeItem(t);return}ne(e,t,s);}return {state:()=>{var s;return (s=n().state)!=null?s:null},consent:()=>{var s;return (s=n().consent)!=null?s:null},setState(s){r(ae($({},n()),{state:s}));},setConsent(s){let l=n();r({state:l.state,consent:s?true:void 0});},clearState(){r({state:void 0,consent:n().consent});},shouldCapture(){let{state:s,consent:l}=n();return s===void 0||s==="OFF"?false:s==="REQUIRE_CONSENT"?l===true:true}}}var Ji=/iPhone|iPod|Android.*Mobile|Windows Phone|BlackBerry|Opera Mini|IEMobile/i,Qi=/iPad|Tablet|PlayBook|Silk|Kindle/i;function xr(e){var n;let t=(n=e==null?void 0:e.userAgent)!=null?n:"";return Qi.test(t)||(e==null?void 0:e.platform)==="MacIntel"&&typeof e.maxTouchPoints=="number"&&e.maxTouchPoints>1?"tablet":Ji.test(t)?"mobile":/Android/i.test(t)?"tablet":"desktop"}var Ar=100,Zi=4096,es=["INPUT","TEXTAREA","SELECT"];function kr(e){if(e.length!==0&&!Xe(e.slice(0,Zi)))return e.slice(0,Ar)}function zt(e,t){var a,f,o;let n=((a=e.tagName)!=null?a:"").toUpperCase(),r={tag:n.toLowerCase()},s=e.getAttribute("role");s&&(r.role=s.slice(0,64));let l=e.getAttribute("type");if(l&&(r.type=l.slice(0,32)),es.indexOf(n)===-1){let i=((f=e.textContent)!=null?f:"").replace(/\s+/g," ").trim(),u=kr(i);u&&(r.text=u);}else {let i=(o=e.getAttribute("aria-label"))!=null?o:e.getAttribute("name"),u=kr(i!=null?i:"");u&&(r.label=u);}if(t){let i=t(e);i&&Object.keys(i).length>0&&(r.fingerprint=i);}return r}function Cr(e,t){return zt(e,t)}function _r(e,t){var s;let n=zt(e,t),r=(s=e.validity)==null?void 0:s.valid;return typeof r=="boolean"&&(n.valid=r),n}function Ir(e,t){var l,a;let n=zt(e,t),r=(l=e.getAttribute("name"))!=null?l:e.getAttribute("id");r&&(n.form=r.slice(0,Ar));let s=(a=e.elements)==null?void 0:a.length;return typeof s=="number"&&(n.fieldCount=s),n}var ts=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],ns="OTHER",rs=400,Rr=200,os=/[\u0000-\u001f\u007f]+/g;function jt(e){let t=null;if(typeof e=="string")t=e;else if(e&&typeof e=="object"){let r=e.message;typeof r=="string"&&(t=r);}if(t===null)return null;let n=t.replace(os," ").trim();return n.length===0?null:n.length>Rr?n.slice(0,Rr):n}function Xt(e){if(typeof e!="string")return "GET";let t=e.toUpperCase();return ts.indexOf(t)===-1?ns:t}function is(e){return typeof e=="number"&&e>=rs}function Pr(e){let{target:t,report:n,ignore:r}=e,s=[];function l(o,i,u){var h;try{if(!is(i)||u!==null&&(r!=null&&r(u)))return;n({method:o,status:i,url:u===null?null:je(u,(h=t.location)==null?void 0:h.href)});}catch(v){}}function a(){let o=t.fetch;if(typeof o!="function")return;let i=function(...u){let h=o.apply(this,u);try{let v=h;if(typeof(v==null?void 0:v.then)!="function")return h;v.then(p=>{let b=p==null?void 0:p.status;l(ss(u),b,as(u));},()=>{});}catch(v){}return h};t.fetch=i,s.push(()=>{t.fetch===i&&(t.fetch=o);});}function f(){var b;let o=(b=t.XMLHttpRequest)==null?void 0:b.prototype,i=o==null?void 0:o.open,u=o==null?void 0:o.send;if(!o||typeof i!="function"||typeof u!="function"||typeof WeakMap!="function")return;let h=new WeakMap,v=function(...k){var I,V;let D=i.apply(this,k);try{h.set(this,{method:Xt(k[0]),url:typeof k[1]=="string"?k[1]:null,listening:(V=(I=h.get(this))==null?void 0:I.listening)!=null?V:!1});}catch(P){}return D},p=function(...k){try{let D=this,I=h.get(this);typeof D.addEventListener=="function"&&(I==null?void 0:I.listening)!==!0&&(I&&(I.listening=!0),D.addEventListener("loadend",()=>{var P,X;let V=h.get(this);l((P=V==null?void 0:V.method)!=null?P:"GET",D.status,(X=V==null?void 0:V.url)!=null?X:null);}));}catch(D){}return u.apply(this,k)};o.open=v,s.push(()=>{o.open===v&&(o.open=i);}),o.send=p,s.push(()=>{o.send===p&&(o.send=u);});}try{a(),f();}catch(o){for(let i of s)try{i();}catch(u){}return null}return s.length===0?null:()=>{for(let o of s)try{o();}catch(i){}s.length=0;}}function ss(e){let t=e[1];if(t&&typeof t=="object"&&typeof t.method=="string")return Xt(t.method);let n=e[0];return n&&typeof n=="object"&&typeof n.method=="string"?Xt(n.method):"GET"}function as(e){let t=e[0];if(typeof t=="string")return t;if(!t||typeof t!="object")return null;let n=t.url;if(typeof n=="string")return n;let r=t.href;return typeof r=="string"?r:null}function Lr(e,t,n,r,s){let l={id:e,name:t,occurredAt:n,sessionId:r.sessionId};return r.userId&&(l.userId=r.userId),r.visitorId&&(l.visitorId=r.visitorId),r.route&&(l.route=r.route),r.localeCode&&(l.localeCode=r.localeCode),r.deviceClass&&(l.deviceClass=r.deviceClass),r.flowSessionId&&(l.flowSessionId=r.flowSessionId),s&&Object.keys(s).length>0&&(l.payload=s),l}var ls=["button","submit","reset","image","hidden","checkbox","radio"],cs=["INPUT","TEXTAREA","SELECT"];function us(e){var r,s;if(!e||typeof e.getAttribute!="function")return false;let t=((r=e.tagName)!=null?r:"").toUpperCase();if(cs.indexOf(t)===-1)return false;if(t!=="INPUT")return true;let n=((s=e.getAttribute("type"))!=null?s:"text").toLowerCase();return ls.indexOf(n)===-1}function Or(e){let t=e.value;return typeof t=="string"?t.length===0:t==null}function Mr(e){let t=null;return {focus(n){us(n)&&(t={element:n,empty:Or(n),filled:false,cleared:false},e.emit("field_focused",n));},change(n){if(!t||t.element!==n)return;let r=Or(n);if(r!==t.empty){if(t.empty=r,!r){if(t.filled)return;t.filled=true,e.emit("input_filled",n);return}t.cleared||(t.cleared=true,e.emit("input_cleared",n));}},blur(n){t&&t.element===n&&(t=null);}}}var ds=["A","BUTTON","INPUT","SELECT","TEXTAREA","SUMMARY","OPTION","LABEL"],fs=["button","link","checkbox","radio","switch","tab","menuitem","menuitemcheckbox","menuitemradio","option","combobox","textbox","searchbox","slider","spinbutton","treeitem"];function ps(e,t){var l;let n=((l=e.tagName)!=null?l:"").toUpperCase();if(ds.indexOf(n)!==-1)return true;let r=e.getAttribute("role");if(r&&fs.indexOf(r.toLowerCase())!==-1||e.getAttribute("onclick")!==null)return true;let s=e.getAttribute("tabindex");return s!==null&&Number(s)>=0||e.getAttribute("contenteditable")==="true"?true:t?t(e)==="pointer":false}function Fr(e,t){let n=e;for(let r=0;n&&r<6;r++){if(ps(n,t))return n;n=n.parentElement;}return null}var ms=[25,50,75,100],gs=250,hs=100;function Nr(e){let{readDepth:t,emit:n,setTimeoutImpl:r=(i,u)=>setTimeout(i,u),clearTimeoutImpl:s=i=>clearTimeout(i),throttleMs:l=gs}=e,a=0,f=null;function o(){f=null;let i=null;try{i=t();}catch(h){return}if(i===null)return;let u=0;for(let h of ms)i>=h&&(u=h);u<=a||(a=u,n(u));}return {scrolled(){if(f===null&&!(a>=hs))try{f=r(o,l);}catch(i){f=null;}},reset(){if(a=0,f!==null){try{s(f);}catch(i){}f=null;}},dispose(){if(f!==null){try{s(f);}catch(i){}f=null;}}}}function Dr(e){var a,f,o;let t=(a=e.innerHeight)!=null?a:0,n=(f=e.documentHeight)!=null?f:0;if(!(n-t>0)||!(t>0))return null;let l=(((o=e.scrollY)!=null?o:0)+t)/n*100;return l>0?l>100?100:l:0}var ys=1800*1e3,bs=60*1e3;function Br({store:e,key:t,now:n,fill:r,windowMs:s=ys}){function l(i){let u=ie(e,t);return u&&typeof u.id=="string"&&u.id.length>0&&typeof u.seen=="number"&&i-u.seen<s?u:null}function a(i){let u=$e(i,r);return ne(e,t,{id:u,seen:i}),u}function f(){let i=n(),u=l(i);return u?(i-u.seen>=bs&&ne(e,t,{id:u.id,seen:i}),u.id):a(i)}function o(){var u,h;let i=n();return (h=(u=l(i))==null?void 0:u.id)!=null?h:a(i)}return {touch:f,current:o,peek:()=>ie(e,t),clear(){e.removeItem(t);}}}var qt="https://api.arcyai.com",ws="/api/v1/sdk/telemetry";function vs(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=56319?(t+=4,n++):t+=3;}return t}function Ss(e){let t=[],n=[],r=13;for(let s of e){let l=vs(JSON.stringify(s))+1;(n.length>=100||n.length>0&&r+l>65536)&&(t.push(n),n=[],r=13),n.push(s),r+=l;}return n.length>0&&t.push(n),t}function Hr(e){let{token:t,apiBase:n=qt,fetchImpl:r,sendBeacon:s,setTimeoutImpl:l=(A,M)=>setTimeout(A,M),clearTimeoutImpl:a=A=>clearTimeout(A),sessionStore:f,stopKey:o,onTelemetryOff:i}=e,u=`${n}${ws}`,h=[],v=null,p=k(),b=Promise.resolve();function k(){return !f||!o?null:f.getItem(o)==="tracked_events_cap"?"tracked_events_cap":null}function D(A){p=A,h=[],I(),A==="tracked_events_cap"?f&&o&&f.setItem(o,A):i&&i();}function I(){v!==null&&(a(v),v=null);}function V(){v===null&&(v=l(()=>{v=null,F(false);},5e3));}function P(A){if(p===null){if(h.push(A),h.length>1e3&&h.splice(0,h.length-1e3),h.length>=20){F(false);return}V();}}function X(A){return H(this,null,function*(){try{let M=yield A.json();if(M&&typeof M=="object"){let C=M.code;if(typeof C=="string")return C}}catch(M){}return null})}function S(A){return H(this,null,function*(){if(!r)return A;let M;try{M=yield r(u,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({events:A}),credentials:"omit"});}catch(C){return A}return M.status===403?(yield X(M))==="telemetry_off"?(D("telemetry_off"),[]):[]:M.status===429?(yield X(M))==="tracked_events_cap"?(D("tracked_events_cap"),[]):A:M.status>=500?A:[]})}function E(A){let M=JSON.stringify({events:A}),C=`${u}?token=${encodeURIComponent(t)}`;if(s&&typeof Blob!="undefined")try{if(s(C,new Blob([M],{type:"application/json"})))return !0}catch(G){}if(r)try{return r(u,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:M,keepalive:!0,credentials:"omit"}).catch(()=>{}),!0}catch(G){return false}return false}function F(A=false){return H(this,null,function*(){if(I(),p!==null||h.length===0){yield b;return}let M=h;h=[];let C=Ss(M);if(A){for(let G of C)E(G);return}b=b.then(()=>H(null,null,function*(){let G=[];for(let U of C){if(p!==null)return;G.push(...yield S(U));}G.length>0&&p===null&&(h=G.concat(h),h.length>1e3&&h.splice(0,h.length-1e3),V());})),yield b;})}return {enqueue:P,flush:F,stopped:()=>p,discard(){h=[],I();},dispose(){I();}}}var Ur="arcy:routechange",Es="arcy.session.",Ts="arcy.telemetry.",xs="arcy.telemetry.stop.";function bt(e){return e.isTrusted===false}function Jt(e){var ue,He,se,xe,_e;let{token:t,apiBase:n,describeElement:r,getUserId:s,getVisitorId:l,getFlowSessionId:a,now:f=()=>Date.now(),fill:o}=e,i=e.win!==void 0?e.win:typeof window!="undefined"?window:null,u=e.doc!==void 0?e.doc:typeof document!="undefined"?document:null,h=(ue=e.localStore)!=null?ue:Ee(),v=Tr(h,Ts+t),p=Br({store:h,key:Es+t,now:f,fill:o}),b=Hr({token:t,apiBase:n,fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,sendBeacon:(He=i==null?void 0:i.navigator)!=null&&He.sendBeacon&&typeof i.navigator.sendBeacon=="function"?i.navigator.sendBeacon.bind(i.navigator):null,setTimeoutImpl:e.setTimeoutImpl,clearTimeoutImpl:e.clearTimeoutImpl,sessionStore:(se=e.sessionStore)!=null?se:Ve(),stopKey:xs+t,onTelemetryOff:()=>v.clearState()}),k=xr(i==null?void 0:i.navigator),D=(_e=(xe=i==null?void 0:i.navigator)==null?void 0:xe.language)!=null?_e:void 0,I=false,V=false,P=null,X=false;function S(){var R,x;return (x=je((R=i==null?void 0:i.location)==null?void 0:R.href))!=null?x:void 0}function E(R,x,N){var Fe,be,Ie,Ue;if(V||!v.shouldCapture()||b.stopped()!==null)return false;let z=f(),ye=p.touch(),de=Lr($e(z,o),R,z,{sessionId:ye,userId:(Fe=s==null?void 0:s())!=null?Fe:void 0,visitorId:(be=l==null?void 0:l())!=null?be:void 0,route:S(),localeCode:D,deviceClass:k,flowSessionId:(Ue=(Ie=N==null?void 0:N.flowSessionId)!=null?Ie:a==null?void 0:a())!=null?Ue:void 0},x);return N!=null&&N.flowId&&(de.flowId=N.flowId),N!=null&&N.flowVersion&&(de.flowVersion=N.flowVersion),N!=null&&N.stepCvid&&(de.stepCvid=N.stepCvid),b.enqueue(de),true}let F=R=>{try{let x=R;if(bt(x))return;let N=i!=null&&i.getComputedStyle?ye=>{var de;try{return (de=i.getComputedStyle(ye).cursor)!=null?de:null}catch(Fe){return null}}:void 0,z=Fr(x.target,N);if(!z)return;E("interaction_click",Cr(z,r));}catch(x){}},A=R=>{try{let x=R;if(bt(x)||!x.target||typeof x.target.getAttribute!="function")return;E("form_submit",Ir(x.target,r));}catch(x){}},M=()=>{var R;try{let x=(R=S())!=null?R:null;if(x===P)return;let N=P;P=x,G.reset(),E("navigation",N?{from:N}:void 0);}catch(x){}},C=Mr({emit:(R,x)=>{E(R,_r(x,r));}}),G=Nr({readDepth:()=>{var R;return Dr({scrollY:i==null?void 0:i.scrollY,innerHeight:i==null?void 0:i.innerHeight,documentHeight:(R=u==null?void 0:u.documentElement)==null?void 0:R.scrollHeight})},emit:R=>{E("scroll_depth",{percent:R});},setTimeoutImpl:e.setTimeoutImpl,clearTimeoutImpl:e.clearTimeoutImpl}),U=false,K=R=>{try{let x=R;if(bt(x)||!x.target)return;C.focus(x.target);}catch(x){}},J=R=>{try{let x=R;if(bt(x)||!x.target)return;C.change(x.target);}catch(x){}},ee=R=>{try{let x=R;if(!x.target)return;C.blur(x.target);}catch(x){}},L=()=>{try{G.scrolled();}catch(R){}},j=()=>{try{if((u==null?void 0:u.visibilityState)==="visible"){E("page_visible");return}E("page_hidden"),b.flush(!0);}catch(R){}},le=()=>{try{U||(U=!0,E("session_end")),b.flush(!0);}catch(R){}},Ce=R=>{var x;try{let N=R;Te({message:(x=jt(N.message))!=null?x:"Uncaught error",kind:"error",source:Y(N.filename)});}catch(N){}},ce=R=>{var x;try{Te({message:(x=jt(R.reason))!=null?x:"Unhandled promise rejection",kind:"unhandledrejection"});}catch(N){}};function Te(R){let x={message:R.message,kind:R.kind};R.source&&(x.source=R.source),E("js_error",x);}function Y(R){var x,N;if(typeof R=="string")return (N=je(R,(x=i==null?void 0:i.location)==null?void 0:x.href))!=null?N:void 0}let ge=(n!=null?n:qt).replace(/\/+$/,""),he=null;return {start(){var R;I||V||(I=true,P=(R=S())!=null?R:null,u==null||u.addEventListener("click",F,true),u==null||u.addEventListener("submit",A,true),u==null||u.addEventListener("focusin",K,true),u==null||u.addEventListener("focusout",ee,true),u==null||u.addEventListener("input",J,true),u==null||u.addEventListener("change",J,true),i==null||i.addEventListener(Ur,M),i==null||i.addEventListener("popstate",M),i==null||i.addEventListener("scroll",L,{passive:true}),i==null||i.addEventListener("pagehide",le),u==null||u.addEventListener("visibilitychange",j),i==null||i.addEventListener("error",Ce),i==null||i.addEventListener("unhandledrejection",ce),i&&he===null&&(he=Pr({target:i,report:x=>{let N={method:x.method,status:x.status};x.url&&(N.url=x.url),E("request_failed",N);},ignore:x=>x.indexOf(ge)===0})),X=!E("navigation")&&v.state()===null);},stop(R){V=true,I&&(I=false,u==null||u.removeEventListener("click",F,true),u==null||u.removeEventListener("submit",A,true),u==null||u.removeEventListener("focusin",K,true),u==null||u.removeEventListener("focusout",ee,true),u==null||u.removeEventListener("input",J,true),u==null||u.removeEventListener("change",J,true),i==null||i.removeEventListener(Ur,M),i==null||i.removeEventListener("popstate",M),i==null||i.removeEventListener("scroll",L),i==null||i.removeEventListener("pagehide",le),u==null||u.removeEventListener("visibilitychange",j),i==null||i.removeEventListener("error",Ce),i==null||i.removeEventListener("unhandledrejection",ce),he&&(he(),he=null),G.dispose(),R!=null&&R.discard?b.discard():b.flush(false),b.dispose());},setTelemetryState(R){v.setState(R),X&&(X=false,E("navigation"));},setTelemetryConsent(R){v.setConsent(R),R||b.discard();},track(R,x,N){E(R,x,N);},flush:()=>b.flush(false),sessionId:()=>p.current(),resetSession:()=>p.clear(),stopped:()=>b.stopped(),state:()=>v.state()}}var Vr="0.1.1";var ks=["telemetry","locale","defaultOpen","contentLocale","apiBase"];function Wr(){return {userId:null,isAnonymous:false,attributes:{}}}function As(e,t){return e==null?{ok:true,hash:void 0}:typeof e!="string"||e.length===0?(w(`${t}() was given a userHash that is not a string. Ignoring it.`),{ok:false}):{ok:true,hash:e}}function Qt(e,t){if(e===void 0)return {};if(typeof e!="object"||e===null||Array.isArray(e))return w(`${t}() attributes must be an object. Ignoring the call.`),null;let n={};for(let[r,s]of Object.entries(e)){if(s===void 0)continue;if(s===null){n[r]=null;continue}let l=typeof s;if(l==="string"||l==="number"||l==="boolean"){n[r]=s;continue}if(Array.isArray(s)&&s.every(a=>typeof a=="string")){n[r]=s;continue}w(`${t}() dropped "${r}": an attribute must be a string, number, boolean, null, or an array of strings.`);}return n}var Cs={cdnBase:null,loadChat:()=>Promise.resolve(null),loadFlow:()=>Promise.resolve(null),loadPicker:()=>Promise.resolve(null)};function $r(e){return _s({chunks:e}).api}function _s(e={}){var Ge;let t=(Ge=e.chunks)!=null?Ge:Cs,n=pn();function r(){var y;let d=l.apiBase;return typeof d=="string"&&d.length>0?d.replace(/\/+$/,""):(y=e.apiBase)!=null?y:Dt}let s=null,l={},a=Wr(),f=false,o=null,i=null,u=null,h=false,v=null,p=null,b=null,k=0,D,I,V=false,P=null,X=null,S=null,E=null,F=null,A=yt,M=null,C=null,G=null,U=null,K=null,J=false,ee=false;function L(d){return s===null?(w(`${d}() was called before init(). Ignoring.`),false):true}function j(d,y){return H(this,null,function*(){if(typeof d!="string"||d.length===0){w("init() needs an environment token. Ignoring the call.");return}if(s!==null){w("init() has already been called. Ignoring the second call.");return}if(s=d,l={},y!==void 0)if(typeof y!="object"||y===null)w("init() options must be an object. Continuing without them.");else for(let[T,g]of Object.entries(y)){if(!ks.includes(T)){w(`init() ignored unknown option "${T}". Only telemetry, locale, defaultOpen, contentLocale, and apiBase can be set in code; everything else is configured in the dashboard.`);continue}l[T]=g;}typeof window!="undefined"&&Sn(window,{apiBase:r(),cdnBase:t.cdnBase}),le(d),Ce(d),ce(d),yield Ne(),n.emit("ready"),l.defaultOpen&&fe();})}function le(d){try{P=hr(d);let y=P.read().anonymousId!==null;E=P.anonymousId(),X=br(d),y||X.markFirstVisit();}catch(y){P=null,E=null,w(`The ARCY session could not be started. ${String(y)}`);}try{S=vr(d);}catch(y){S=null,w(`The ARCY session could not be started. ${String(y)}`);}try{F=mr(d);let y=F.read();A=y.tokens,M=y.identity;}catch(y){F=null,A=yt,w(`The ARCY session could not be started. ${String(y)}`);}try{p=Jt({token:d,apiBase:r(),fetchImpl:e.fetchImpl,describeElement:y=>hn(y),getUserId:()=>a.isAnonymous?null:a.userId,getVisitorId:()=>E}),l.telemetry!==void 0&&p.setTelemetryConsent(l.telemetry===!0),p.start();}catch(y){w(`Telemetry could not start. ${String(y)}`);}try{b=Dn({token:d,apiBase:r(),fetchImpl:e.fetchImpl,setTimeoutImpl:e.setTimeoutImpl});}catch(y){w(`The ARCY session could not be started. ${String(y)}`);}ge();}function Ce(d){if(typeof window!="undefined")try{Mn({win:window,token:d,loadChunk:t.loadPicker,apiBase:r(),fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,setTimeoutImpl:e.setTimeoutImpl,onVerified:()=>p==null?void 0:p.stop({discard:!0})});}catch(y){w(`Design mode could not start. ${String(y)}`);}}function ce(d){if(typeof window!="undefined")try{let y=Fn(window,d);if(!y)return;p==null||p.stop({discard:!0}),h=!0,v=y;}catch(y){w(`The preview could not start. ${String(y)}`);}}function Te(d){var y,T;return Nn({apiBase:r(),token:s!=null?s:"",nonce:d,sessionToken:(T=(y=b==null?void 0:b.config())==null?void 0:y.sessionToken)!=null?T:null,userTraits:a.attributes,fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,setTimeoutImpl:e.setTimeoutImpl})}function Y(){ee=false,o==null||o.unmount(),o=null,i==null||i.destroy(),i=null,u==null||u.destroy(),u=null,C=null,G=null,U=null,ke();}function ge(){try{o||se(),he(),xe(),i==null||i.refreshChrome(),ee&&(ee=!1,fe());}catch(d){w(`The chat bar could not render. ${String(d)}`);}}function he(){var d,y,T,g;try{let B=o==null?void 0:o.getHost();if(!o||!B)return;pr(B,A),o.setGeometry({widthPercent:(d=A.widthPercent)!=null?d:mt,bottomOffset:(y=A.bottomOffset)!=null?y:ft,collapsedWidth:(T=A.collapsedWidth)!=null?T:gt}),o.setIconSize((g=A.barIconSize)!=null?g:pt);}catch(B){w(`The widget could not apply its theme. ${String(B)}`);}}function ue(){var Re,Z;let d=(Re=b==null?void 0:b.config())==null?void 0:Re.widget,y=(Z=et(d))!=null?Z:M;if(!y)return null;let T=Ye=>typeof Ye=="string"?Ye:"",g=d!=null&&d.chrome&&typeof d.chrome=="object"&&!Array.isArray(d.chrome)?$($({},ut),d.chrome):ut,B=d==null?void 0:d.welcomeIconUrl,Q=d==null?void 0:d.chatBarIconUrl,pe=r();return {name:y.name,logoUrl:ht(y.logoUrl,pe),welcomeIconUrl:ht(B,pe),chatBarIconUrl:ht(Q,pe),welcomeMessage:T(d==null?void 0:d.welcomeMessage),inputPlaceholder:T(d==null?void 0:d.inputPlaceholder),welcomeHeadline:T(d==null?void 0:d.welcomeHeadline),allowImageUpload:(d==null?void 0:d.allowImageUpload)===true,barDraggable:(d==null?void 0:d.barDraggable)===true,privacyPolicyUrl:typeof(d==null?void 0:d.privacyPolicyUrl)=="string"&&/^https:\/\//i.test(d.privacyPolicyUrl)?d.privacyPolicyUrl:null,chrome:g,locales:He(d==null?void 0:d.locales),activeLocale:typeof(d==null?void 0:d.activeLocale)=="string"?d.activeLocale:""}}function He(d){if(!Array.isArray(d))return [];let y=[];for(let T of d){if(!T||typeof T!="object")continue;let{code:g,label:B}=T;typeof g!="string"||g.length===0||typeof B!="string"||B.length===0||y.push({code:g,label:B});}return y}function se(){var d,y,T,g,B,Q,pe,Re;try{o=ur({geometry:{widthPercent:(d=A.widthPercent)!=null?d:mt,bottomOffset:(y=A.bottomOffset)!=null?y:ft,collapsedWidth:(T=A.collapsedWidth)!=null?T:gt},labels:_e(),iconUrl:(B=(g=ue())==null?void 0:g.chatBarIconUrl)!=null?B:null,welcomeIconUrl:(pe=(Q=ue())==null?void 0:Q.welcomeIconUrl)!=null?pe:null,iconSize:(Re=A.barIconSize)!=null?Re:pt,onActivate:()=>fe(),onSubmit:Z=>{if(J||fe(),C){C(Z);return}K=Z;},onAttach:()=>{fe();},onFiles:Z=>{if(fe(),G){G(Z);return}U=Z;},onDismiss:()=>{ke();},onStop:()=>{u==null||u.stop(),be();},onGeometryChange:()=>i==null?void 0:i.reposition(),readPosition:()=>{var Z;return (Z=P==null?void 0:P.read().position)!=null?Z:null},onPositionChange:Z=>P==null?void 0:P.rememberPosition(Z),readDocked:()=>(P==null?void 0:P.read().docked)===!0,onDockedChange:Z=>P==null?void 0:P.rememberDocked(Z),onUndock:()=>fe()}),o.mount(),Ue();}catch(Z){w(`The chat bar could not render. ${String(Z)}`);}}function xe(){var d,y,T;try{if(!o)return;let g=ue();o.setLabels(_e()),o.getMode()!=="flow"&&o.setPlaceholder((d=g==null?void 0:g.inputPlaceholder)!=null?d:null),o.setAttachEnabled((g==null?void 0:g.allowImageUpload)===!0),o.setDraggable((g==null?void 0:g.barDraggable)===!0),o.setIcon((y=g==null?void 0:g.chatBarIconUrl)!=null?y:null),o.setWelcomeIcon((T=g==null?void 0:g.welcomeIconUrl)!=null?T:null);}catch(g){w(`The widget could not apply its texts. ${String(g)}`);}}function _e(){var y,T;let d=(T=(y=ue())==null?void 0:y.chrome)!=null?T:ut;return {send:d.send,attachMenu:d.attachMenu,attachImage:d.attachImage,flowStop:d.flowStop,openChat:d.openChat,moveBar:d.moveBar,flowStep:d.flowStep}}let R=600,x=4e3,N=null,z=[],ye=null;function de(d){let y=d.phase==="done"?x:R;try{N=setTimeout(()=>{for(N=null;z.length>0;){let T=z.shift();if(Ie(T),T!==null){de(T);return}}},y);}catch(T){}}function Fe(d){if(d===null){let y=(ye==null?void 0:ye.phase)==="done"||z.some(T=>(T==null?void 0:T.phase)==="done");if(N!==null&&y){z[z.length-1]!==null&&z.push(null);return}be();return}if(N!==null){let y=z[z.length-1];if(d.phase!=="done"&&y!==void 0&&y!==null&&y.phase!=="done"){z[z.length-1]=d;return}z.push(d);return}Ie(d),de(d);}function be(){if(N!==null){try{clearTimeout(N);}catch(d){}N=null;}z=[],Ie(null);}function Ie(d){var y,T;ye=d;try{if(d&&(o==null||o.setDocked(!1)),o==null||o.setFlow(d),d){ke();return}o==null||o.setPlaceholder((T=(y=ue())==null?void 0:y.inputPlaceholder)!=null?T:null);}catch(g){w(`The flow status could not be shown. ${String(g)}`);}}function Ue(){try{let d=o==null?void 0:o.getRoot(),y=o==null?void 0:o.getHost(),T=o;if(!d||!y||!T)return;i=$n({root:d,host:y,loadChunk:t.loadChat,onRequestClose:()=>ke(),bar:{onSubmit:g=>{if(C=g,K!==null){let B=K;K=null,g(B);}},onFiles:g=>{if(G=g,U!==null){let B=U;U=null,g(B);}},setPlaceholder:g=>T.setPlaceholder(g),setDisabled:g=>T.setDisabled(g),setMode:g=>T.setMode(g),setFlow:g=>T.setFlow(g),setAwaitingInput:g=>T.setAwaitingInput(g),setDisclaimer:g=>T.setDisclaimer(g),setAttachEnabled:g=>T.setAttachEnabled(g),setAttachmentCount:g=>T.setAttachmentCount(g),attachmentSlot:()=>T.attachmentSlot(),focusInput:()=>T.focusInput(),getMetrics:()=>T.getMetrics(),dock:()=>T.setDocked(!0)},apiBase:r(),getSessionToken:()=>{var g,B;return (B=(g=b==null?void 0:b.config())==null?void 0:g.sessionToken)!=null?B:null},getSessionId:()=>p==null?void 0:p.sessionId(),getRoute:()=>typeof window!="undefined"?window.location.pathname:"",getMaxHeightPercent:()=>{var g;return (g=A.maxHeightPercent)!=null?g:void 0},onStartFlow:g=>{Ke(),u==null||u.start(g);},onStopFlow:()=>{u==null||u.stop(),be();},publicKey:s!=null?s:void 0,getConversationId:()=>{var g;return (g=S==null?void 0:S.id())!=null?g:null},setConversationId:g=>{var B,Q;return g===null?(B=S==null?void 0:S.startNew())!=null?B:null:(Q=S==null?void 0:S.adopt(g))!=null?Q:null},touchConversation:()=>S==null?void 0:S.touch(),getVisitorId:()=>E,onOrgCapExceeded:()=>Y(),track:(g,B,Q)=>{p==null||p.track(g,Q,B);},getWidget:()=>ue(),onSelectLocale:g=>{tt(g);}});}catch(d){w(`The chat panel could not be prepared. ${String(d)}`);}}function tt(d){return H(this,null,function*(){try{if(typeof d!="string"||d.length===0||(P==null?void 0:P.read().locale)===d)return;P==null||P.rememberLocale(d),yield Ne(),xe(),i==null||i.refreshChrome();}catch(y){w(`The widget could not change its language. ${String(y)}`);}})}function wt(){var T;if(!s)return null;let d=(T=b==null?void 0:b.config())==null?void 0:T.sessionToken;if(!d)return null;let y=X;return ae($({apiBase:r(),token:s,sessionToken:d,sessionId:p==null?void 0:p.sessionId(),getTrait:g=>{let B=a.attributes[g];if(!(B==null||Array.isArray(B)))return B}},y?{isFirstVisit:()=>y.isFirstVisit()}:{}),{promptFill:g=>{var Q;return o==null||o.setDocked(false),J=true,((Q=i==null?void 0:i.promptFill(g))!=null?Q:Promise.resolve(null)).finally(()=>{J=false;})},cancelFill:()=>{J=false,i==null||i.cancelFill();},onFailure:()=>{f||fe(),i==null||i.showFlowFailure();},track:(g,B,Q)=>{p==null||p.track(g,Q,B);},onStatus:g=>Fe(g),getBottomOcclusion:()=>{let g=o==null?void 0:o.getMetrics();return g?g.bottomOffset+g.keyboardOffset+g.height:0}})}function Ke(){if(!u)try{let d=wt();if(!d)return;u=Xn({context:d,loadChunk:t.loadFlow});}catch(d){w(`The flow engine could not be prepared. ${String(d)}`);}}function Ne(){return H(this,null,function*(){var d,y;try{yield Et();}catch(T){w(`The ARCY session could not be started. ${String(T)}`);}try{let T=b==null?void 0:b.config();if(T){let g=((d=T.customization)!=null?d:{}).tokens;F==null||F.remember(g,T.widget),A=Gt(g),M=(y=et(T.widget))!=null?y:M;}}catch(T){w(`The widget could not read its theme. ${String(T)}`);}if(h||(Ke(),u&&(h=true,u.resume())),v){let T=v;v=null,H(null,null,function*(){if(Ke(),!u)return;if(T.kind==="pending"){yield u.resumePreview();return}let g=yield Te(T.nonce);g&&(yield u.startPreview(g));}).catch(g=>w(`The preview could not run. ${String(g)}`));}ge();})}function vt(){if(D!==void 0)return D;try{let d=typeof window!="undefined"?window.location.pathname:null;return typeof d!="string"||!d.startsWith("/")?void 0:(D=Be(d),D)}catch(d){return}}function St(){var d,y;if(V)return I;V=true;try{return typeof window=="undefined"?void 0:(I=Er({referrer:typeof document!="undefined"?document.referrer:null,search:(y=(d=window.location)==null?void 0:d.search)!=null?y:null,userAgent:typeof navigator!="undefined"?navigator.userAgent:null,viewportWidth:window.innerWidth}),I)}catch(T){return}}function Et(){return H(this,null,function*(){var T,g;if(!b||!p)return;let d=++k,y=yield b.sync({sessionId:p.sessionId(),route:vt(),sessionContext:St(),visitorId:E!=null?E:void 0,userId:a.isAnonymous?void 0:(T=a.userId)!=null?T:void 0,userHash:a.isAnonymous?void 0:a.userHash,userTraits:Object.keys(a.attributes).length?a.attributes:void 0,uiLanguage:l.locale==="en"||l.locale==="tr"?l.locale:void 0,contentLocale:typeof l.contentLocale=="string"?l.contentLocale:void 0,viewerLocale:(g=P==null?void 0:P.read().locale)!=null?g:void 0});if(!y.ok){w("The ARCY session could not be started. The widget will keep working, and telemetry stays off until configuration arrives.");return}d===k&&(y.config.identityAccepted===false&&w("This environment enforces identity verification and no valid userHash was supplied, so this user was not identified and none of their attributes were stored. Pass a signed userHash: arcy.identify(userId, attributes, { userHash }). See Settings > Identity verification in the ARCY dashboard."),y.config.behavioralTelemetry&&p.setTelemetryState(y.config.behavioralTelemetry));})}function Tt(d,y,T){return H(this,null,function*(){var pe;if(!L("identify"))return;if(typeof d!="string"||d.length===0){w("identify() needs a user id. Ignoring the call.");return}let g=Qt(y,"identify");if(g===null)return;let B=As((T!=null?T:{}).userHash,"identify");if(!B.ok)return;let Q=a.userId===d&&!a.isAnonymous;a={userId:d,isAnonymous:false,attributes:Q?$($({},a.attributes),g):g,userHash:Q?(pe=B.hash)!=null?pe:a.userHash:B.hash},yield Ne();})}function xt(d){return H(this,null,function*(){if(!L("identifyAnonymous"))return;let y=Qt(d,"identifyAnonymous");y!==null&&(a={userId:null,isAnonymous:true,attributes:y},yield Ne());})}function we(d){return H(this,null,function*(){if(!L("updateUser"))return;if(!a.userId&&!a.isAnonymous){w("updateUser() was called before identify() or identifyAnonymous(). Ignoring the call.");return}let y=Qt(d,"updateUser");y!==null&&(a=ae($({},a),{attributes:$($({},a.attributes),y)}),yield Ne());})}function nt(){var d;a=Wr(),P==null||P.forgetAnonymousId(),E=(d=P==null?void 0:P.anonymousId())!=null?d:null,p==null||p.resetSession(),S==null||S.reset(),ke();}function fe(){if(L("open")){if(!o){ee=true;return}f||(o==null||o.setDocked(false),f=true,o==null||o.setMode("open"),i==null||i.open(),n.emit("open"));}}function ke(){f&&(f=false,o==null||o.setMode("idle"),i==null||i.close(),n.emit("close"));}function rt(d,y){return n.on(d,y)}return {api:{init:j,identify:Tt,identifyAnonymous:xt,updateUser:we,reset:nt,open:fe,close:ke,on:rt,VERSION:Vr},getToken:()=>s,getOptions:()=>l,getIdentity:()=>a,isOpen:()=>f,getBar:()=>o,getChatController:()=>i,getFlowController:()=>u,getTelemetry:()=>p,getConfig:()=>{var d;return (d=b==null?void 0:b.config())!=null?d:null},selectLocale:tt,getShellState:()=>P,getTokens:()=>A,getWidgetChrome:()=>ue()}}var Kr={cdnBase:Ut,loadChat:(e,t,n)=>Wn(e,Ut,t,n),loadFlow:(e,t,n)=>zn(e,Yn,t,n),loadPicker:(e,t,n)=>On(e,Ln,t,n)};function Gr(e,t){let n=e.q;for(;n.length>0;){let r=n.shift();if(!r)break;let s=t[r.method];if(typeof s!="function"){r.resolve();continue}try{let l=s(...r.args);l&&typeof l.then=="function"?l.then(()=>r.resolve(),()=>r.resolve()):r.resolve();}catch(l){r.resolve();}}}var Yr=$r(Kr);if(typeof window!="undefined"){let e=window.arcy;window.arcy=Yr,e&&Array.isArray(e.q)&&Gr(e,Yr);}
568
+ })();