arcy.js 0.0.2 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -3
- package/dist/arcy.chat.3968644db103.js +1271 -0
- package/dist/arcy.flow.fef131718e42.js +3 -0
- package/dist/arcy.legacy.b4005932a6cc.js +568 -0
- package/dist/arcy.loader.js +2 -0
- package/dist/arcy.modern.a51b9a32dd28.js +568 -0
- package/dist/arcy.picker.73f47221b73c.js +59 -0
- package/dist/chat-BK57WIAA.js +3867 -0
- package/dist/chunk-6HBSGVRN.js +219 -0
- package/dist/chunk-7VVKR3AO.js +122 -0
- package/dist/chunk-CQ2DESAJ.js +263 -0
- package/dist/chunk-DKYMIAYF.js +7 -0
- package/dist/chunk-FR6SJSDU.js +220 -0
- package/dist/chunk-LGWYJSYX.js +271 -0
- package/dist/chunk-NIHUDSWK.js +155 -0
- package/dist/chunk-NY3NXM2V.js +213 -0
- package/dist/design-mode.cjs +135 -0
- package/dist/design-mode.d.ts +197 -0
- package/dist/design-mode.js +2 -0
- package/dist/flow-M7W3H3C5.js +1422 -0
- package/dist/fonts/dm-sans-latin-ext.woff2 +0 -0
- package/dist/fonts/dm-sans-latin.woff2 +0 -0
- package/dist/fonts/ibm-plex-sans-latin-ext.woff2 +0 -0
- package/dist/fonts/ibm-plex-sans-latin.woff2 +0 -0
- package/dist/fonts/inter-latin-ext.woff2 +0 -0
- package/dist/fonts/inter-latin.woff2 +0 -0
- package/dist/fonts/lato-latin-ext.woff2 +0 -0
- package/dist/fonts/lato-latin.woff2 +0 -0
- package/dist/fonts/manrope-latin-ext.woff2 +0 -0
- package/dist/fonts/manrope-latin.woff2 +0 -0
- package/dist/fonts/montserrat-latin-ext.woff2 +0 -0
- package/dist/fonts/montserrat-latin.woff2 +0 -0
- package/dist/fonts/nunito-latin-ext.woff2 +0 -0
- package/dist/fonts/nunito-latin.woff2 +0 -0
- package/dist/fonts/open-sans-latin-ext.woff2 +0 -0
- package/dist/fonts/open-sans-latin.woff2 +0 -0
- package/dist/fonts/playfair-display-latin-ext.woff2 +0 -0
- package/dist/fonts/playfair-display-latin.woff2 +0 -0
- package/dist/fonts/poppins-latin-ext.woff2 +0 -0
- package/dist/fonts/poppins-latin.woff2 +0 -0
- package/dist/fonts/roboto-latin-ext.woff2 +0 -0
- package/dist/fonts/roboto-latin.woff2 +0 -0
- package/dist/fonts/source-sans-3-latin-ext.woff2 +0 -0
- package/dist/fonts/source-sans-3-latin.woff2 +0 -0
- package/dist/fonts/work-sans-latin-ext.woff2 +0 -0
- package/dist/fonts/work-sans-latin.woff2 +0 -0
- package/dist/index.cjs +13848 -0
- package/dist/index.d.ts +169 -0
- package/dist/index.js +4743 -0
- package/dist/picker-JPESE6JJ.js +2134 -0
- package/dist/snippet.cjs +46 -0
- package/dist/snippet.d.ts +39 -0
- package/dist/snippet.js +43 -0
- package/package.json +69 -5
- package/index.js +0 -5
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
(function(){'use strict';/* arcy.js — https://arcyai.com */
|
|
2
|
+
function h(e){typeof console<"u"&&console.warn&&console.warn(`[arcy] ${e}`);}function Gt(){let e=new Map;function t(r,o){if(typeof o!="function")return h(`on("${r}") needs a function. Ignoring.`),()=>{};let s=e.get(r);return s||(s=new Set,e.set(r,s)),s.add(o),()=>{s.delete(o);}}function n(r){let o=e.get(r);if(o)for(let s of [...o])try{s();}catch(i){h(`A "${r}" handler threw. ${String(i)}`);}}return {on:t,emit:n}}function mt(e){if(e.parentElement!==null)return e.parentElement;let t=e.parentNode;return t!==null&&"host"in t?t.host:null}var Yt=[/[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],Ir="[masked]";function Oe(e){return Yt.some(t=>(t.lastIndex=0,t.test(e)))}var ht=4096,Rr=100,Pr=64;function Ye(e){if(!e)return;let t=e.slice(0,ht);if(e.length>ht){let r=t.search(/\s\S*$/);t=r===-1?t.slice(0,ht-Rr):t.slice(0,r);}let n=t.replace(/\s+/g," ").trim();if(n){for(let r of Yt)n=n.replace(r,Ir);return n.slice(0,80)}}function zt(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 Lr=["data-testid","data-test","data-cy","id","name","aria-label"],Or=["data-testid","data-test","data-cy"],Mr=64;function Fr(e){for(let t of Or){let n=e.getAttribute(t);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>Mr)&&!Oe(r))return r}}var Nr=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function Dr(e){let t=mt(e);for(;t!==null;){let n=t.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let o of Lr){let s=t.getAttribute(o);if(s===null||o==="id"&&!zt(s))continue;let i=Ye(s);if(i!==void 0)return {tag:n,attr:o,value:i}}let r=t.getAttribute("role");if(r!==null&&Nr.has(r))return {tag:n,attr:"role",value:r};t=mt(t);}}function Br(e){let t=0,n=e.previousElementSibling;for(;n!==null;)n.tagName===e.tagName&&(t+=1),n=n.previousElementSibling;return t}function Xt(e){let t={tag:e.tagName.toLowerCase(),siblingIndex:Br(e)},n=Ye(e.textContent);n!==void 0&&(t.text=n);let r=Ye(e.getAttribute("aria-label"));r!==void 0&&(t.ariaLabel=r);let o=Ye(e.getAttribute("placeholder"));o!==void 0&&(t.placeholder=o);let s=e.getAttribute("id");s!==null&&zt(s)&&!Oe(s)&&(t.id=s);let i=e.getAttribute("role");if(i!==null){let l=i.trim();l!==""&&l.length<=Pr&&!Oe(l)&&(t.role=l);}let d=Fr(e);d!==void 0&&(t.testId=d);let a=Dr(e);return a!==void 0&&(t.ancestorTag=a.tag,t.ancestorAttr=a.attr,t.ancestorValue=a.value),t}var jt="arcy.picker.73f47221b73c.js",qt="arcy.chat.3968644db103.js",Jt="arcy.flow.fef131718e42.js";var Hr=/^(?:\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,Ur=/^[^@\s/]+@[^@\s/]+\.[^@\s/]+$/;function Vr(e){if(e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function Qt(e){return e.length===0?false:Hr.test(e)?true:Ur.test(Vr(e))}function ke(e){let n=e.split("/").map(r=>Qt(r)?":id":r).join("/");for(;n.length>1&&n.charAt(n.length-1)==="/";)n=n.slice(0,-1);return n.length===0?"/":n}function Wr(e){if(e.length===0)return "";let t=[];for(let n of e.split("&")){if(n.length===0)continue;let r=n.indexOf("="),o=r===-1?n:n.slice(0,r);if(o.length===0)continue;let s=Qt(o)?":id":o;t.indexOf(s)===-1&&t.push(s);}return t.length===0?"":(t.sort(),`?${t.join("&")}`)}function $r(e,t){try{let n=new URL(e,t??void 0);return {path:n.pathname,query:n.search.slice(1)}}catch{let n=e.split("#")[0]??"";if(!n.startsWith("/"))return null;let r=n.indexOf("?");return r===-1?{path:n,query:""}:{path:n.slice(0,r),query:n.slice(r+1)}}}function Me(e,t){if(typeof e!="string"||e.length===0)return null;let n=$r(e,t);if(n===null)return null;let r=ke(n.path);if(!r)return null;if(r.length>=2048)return r.slice(0,2048);let o=Wr(n.query);return o.length===0||r.length+o.length>2048?r:r+o}function Kr(e){try{let n=e.currentScript?.nonce;if(typeof n=="string"&&n.length>0)return n;let r=e.getElementsByTagName("script");for(let o=0;o<r.length;o++){let s=r[o].nonce;if(typeof s=="string"&&s.length>0)return s}return null}catch{return null}}var Gr=typeof document<"u"?Kr(document):null;function zr(){return Gr}function ve(e){let t=zr();if(t)try{e.nonce=t,e.setAttribute("nonce",t);}catch{}}var Xr="https://docs.arcyai.com/troubleshooting#content-security-policy";function gt(e){try{let{origin:t}=new URL(e);return t&&t!=="null"?t:null}catch{return null}}function jr(e){let t=gt(e.apiBase),n=e.cdnBase?gt(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(e.docsUrl??Xr),r.join(`
|
|
3
|
+
`)}function Zt(e,t){let n=[t.apiBase,t.cdnBase].filter(o=>typeof o=="string"&&o.length>0).map(gt).filter(o=>o!==null),r=()=>{};try{let o=s=>{let i=s.blockedURI;(i==="inline"||n.some(a=>i?.startsWith(a)))&&(r(),h(jr(t)));};e.document.addEventListener("securitypolicyviolation",o),r=()=>{try{e.document.removeEventListener("securitypolicyviolation",o);}catch{}};}catch{}return ()=>r()}var yt="__arcyPicker";var Fe=2,en="arcy:design-mode:ready",tn="arcy:design-mode:pick",nn="arcy:design-mode:exit",rn="arcy:design-mode:screenshot";var an="arcy-widget",on="data-arcy",bt="2147483000",qr=[["position","fixed"],["inset","0"],["z-index",bt],["pointer-events","none"],["background","transparent"],["border","0"],["box-shadow","none"],["outline","0"]],Jr=[["margin","0"],["padding","0"]],sn="data-arcy-style",Ne=new Map;function Qr(e=an){let t=Ne.get(e);return t!==void 0&&t.host.isConnected}function ze(e={}){if(typeof document>"u")return null;let t=e.id??an,n=e.container;if(Qr(t))return h("This ARCY surface is already on this page. Ignoring the second mount."),null;Ne.delete(t);let r=n??document.body??document.documentElement;if(!r)return h("The page has no <body> to mount into yet. The widget will not render."),null;if(!n){let o=document.querySelectorAll(`[${on}]`);for(let s=0;s<o.length;s+=1)if(o[s]?.id===t)return h("Another copy of ARCY is already on this page. Ignoring this one."),null}try{let o=document.createElement("div");o.id=t,o.setAttribute(on,"");for(let[a,l]of qr)o.style.setProperty(a,l,"important");for(let[a,l]of Jr)o.style.setProperty(a,l);let s=o,i=!1;try{o.attachShadow&&(s=o.attachShadow({mode:"closed"}),i=!0);}catch{}r.appendChild(o),eo(o);let d={host:o,root:s,isolated:i,destroy(){try{o.parentNode&&o.parentNode.removeChild(o);}catch{}Ne.get(t)===d&&Ne.delete(t);}};return Ne.set(t,d),d}catch(o){return h(`The widget could not mount. ${String(o)}`),null}}var Zr=["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 eo(e){let t=n=>{try{n.stopPropagation();}catch{}};for(let n of Zr)try{e.addEventListener(n,t);}catch{}try{e.addEventListener("mousedown",n=>{n.defaultPrevented||wt(e.ownerDocument,e);});}catch{}}function wt(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{}}function ln(e,t){if(!e.isolated)return false;try{let n=e.root.querySelector(`[${sn}]`);if(n)return n.textContent=`${n.textContent??""}
|
|
4
|
+
${t}`,!0;let r=e.host.ownerDocument.createElement("style");return ve(r),r.setAttribute(sn,""),r.textContent=t,e.root.appendChild(r),!0}catch(n){return h(`The widget could not apply its styles. ${String(n)}`),false}}var to="arcy-picker-notice",no=[["left","50%"],["bottom","24px"]],ro=[["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)"]],oo=[["font-weight","600"],["margin-bottom","4px"]],io=[["color","#d0d5dd"]],so=[["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 Xe(e,t){for(let[n,r]of t)e.style.setProperty(n,r);}var cn=false;function je(e){if(cn)return;let t=null;try{if(t=ze({id:to}),!t)return;cn=!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[a,l]of no)r.style.setProperty(a,l,"important");Xe(r,ro);let o=n.createElement("div");Xe(o,oo),o.textContent="ARCY element picker did not start";let s=n.createElement("div");Xe(s,io),s.textContent=e;let i=n.createElement("button");i.type="button",Xe(i,so),i.textContent="Dismiss";let d=t;i.addEventListener("click",()=>{try{d.destroy();}catch{}}),r.append(o,s,i),t.root.appendChild(r);}catch{try{t?.destroy();}catch{}}}function ue(e){h(e),je(e);}var vt="arcy_picker",ao="/api/v1/sdk/tagging/verify",dn="https://cdn.arcyai.com";var lo=15e3,co=1e4;function uo(e,t){return St(e)??St(t)}function St(e){if(!e)return null;try{let t=new URLSearchParams(e.charAt(0)==="#"?e.slice(1):e).get(vt);return t&&t.length>0?t:null}catch{return null}}function fo(e){try{let t=new URL(e.location.href),n=t.searchParams.has(vt),r=St(t.hash)!==null;if(!n&&!r)return;n&&t.searchParams.delete(vt),r&&(t.hash=""),e.history.replaceState(e.history.state,"",t.toString());}catch{}}async function po(e){let{apiBase:t,token:n,nonce:r,fetchImpl:o,timeoutMs:s=co,setTimeoutImpl:i=(l,f)=>setTimeout(l,f)}=e;if(!o)return null;let d=async()=>{try{let l=await o(`${t}${ao}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({token:r}),credentials:"omit"});if(!l.ok)return null;let f=await l.json();if(f?.ok!==!0)return null;let b=mo(f.returnOrigin);return b?{returnOrigin:b,screenshotsEnabled:f.elementScreenshotsEnabled!==!1}:(ue("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{return null}},a=new Promise(l=>{try{i(()=>l(null),s);}catch{}});return Promise.race([d(),a])}function mo(e){if(typeof e!="string"||e.length===0)return null;try{let{origin:t}=new URL(e);return t&&t!=="null"?t:null}catch{return null}}function fn(e,t,n,r){return new Promise(o=>{let s=false,i=null,d=p=>{s||(s=true,i&&(i.onload=null,i.onerror=null),o(p));},a=false,l=p=>{a||(a=true,ue(p));},f=()=>{let p;try{p=e[yt];}catch{return l("The element picker registration could not be read. Design mode is off."),null}if(!p)return null;if(typeof p.mount!="function")return l("The element picker registered something unusable. Design mode is off."),null;let g;try{g=p.contract;}catch{g=void 0;}return g!==2?(l(`The element picker on the CDN speaks contract ${typeof g=="number"?g:"unknown"}, this arcy.js speaks ${2}. Update arcy.js to use design mode.`),null):p},b=p=>{try{let g=f();!g&&!a&&p(),d(g);}catch{d(null);}},v=false;try{v=e[yt]!==void 0;}catch{v=true;}if(v){b(()=>{});return}try{let p=e.document;i=p.createElement("script"),ve(i),i.async=!0,i.src=`${t}/${jt}`;let g=i.src;i.onload=()=>b(()=>ue("The element picker loaded but did not register. Design mode is off.")),i.onerror=()=>{try{ue(`Failed to load ${g}. Design mode is off. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch{}d(null);},(p.head||p.documentElement).appendChild(i);}catch(p){ue(`The element picker could not load. ${String(p)}`),d(null);return}try{r(()=>{s||ue("The element picker did not load in time. Design mode is off."),d(null);},n);}catch{}})}function ho(e){try{let t=e.location.pathname;return typeof t!="string"||!t.startsWith("/")?"/":ke(t)}catch{return "/"}}function go(e){try{let t=e.opener;return !!t&&!t.closed}catch{return false}}function qe(e,t,n){try{let r=e.opener;if(!r||r.closed){h("The ARCY dashboard window is gone, so that pick could not be sent.");return}r.postMessage(n,t);}catch(r){h(`That pick could not be sent to the ARCY dashboard. ${String(r)}`);}}async function pn(e){try{let{win:t,token:n,apiBase:r,fetchImpl:o,onVerified:s,loadChunk:i,loadTimeoutMs:d=lo,setTimeoutImpl:a=(C,O)=>setTimeout(C,O)}=e,l=uo(t.location.search,t.location.hash);if(!l)return "no_nonce";if(fo(t),!go(t))return ue("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 f=await po({apiBase:r,token:n,nonce:l,fetchImpl:o,setTimeoutImpl:a});if(!f)return ue("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{s();}catch{}let b=await i(t,d,a);if(!b)return "load_failed";let{returnOrigin:v,screenshotsEnabled:p}=f;return b.mount({screenshotsEnabled:p,onPick:(C,O)=>{qe(t,v,{type:tn,protocol:Fe,target:C,route:ho(t),matchCount:O});},onScreenshot:C=>{qe(t,v,{type:rn,protocol:Fe,screenshot:C});},onExit:()=>{qe(t,v,{type:nn,protocol:Fe});}})?(qe(t,v,{type:en,protocol:Fe}),"active"):(ue("The element picker could not start. Design mode is off."),"mount_failed")}catch(t){return ue(`Design mode could not start. ${String(t)}`),"load_failed"}}var Et={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function Q(e){return e?{getItem(t){try{return e.getItem(t)}catch{return null}},setItem(t,n){try{e.setItem(t,n);}catch{}},removeItem(t){try{e.removeItem(t);}catch{}}}:Et}function de(){try{let e=globalThis.localStorage;return Q(e)}catch{return Et}}function Ae(){try{let e=globalThis.sessionStorage;return Q(e)}catch{return Et}}function Z(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{return null}}function J(e,t,n){try{e.setItem(t,JSON.stringify(n));}catch{}}var yo="arcy.preview.";function Je(e,t=Ae()){try{return Q(t).getItem(yo+e)!==null}catch{return false}}var Tt="arcy_preview",bo=1,wo="/api/v1/sdk/flows/preview/verify",vo=1e4;function So(e,t){return xt(e)??xt(t)}function xt(e){if(!e)return null;try{let t=new URLSearchParams(e.charAt(0)==="#"?e.slice(1):e).get(Tt);return t&&t.length>0?t:null}catch{return null}}function Eo(e){try{let t=new URL(e.location.href),n=t.searchParams.has(Tt),r=xt(t.hash)!==null;if(!n&&!r)return;n&&t.searchParams.delete(Tt),r&&(t.hash=""),e.history.replaceState(e.history.state,"",t.toString());}catch{}}function mn(e,t){try{let n=So(e.location.search,e.location.hash);return n?(Eo(e),{kind:"nonce",nonce:n}):Je(t)?{kind:"pending"}:null}catch{return null}}async function hn(e){let{apiBase:t,token:n,nonce:r,sessionToken:o,userTraits:s,fetchImpl:i,timeoutMs:d=vo,setTimeoutImpl:a=(C,O)=>setTimeout(C,O)}=e;if(!i)return null;let l=C=>{h(C);try{je(C);}catch{}return null},f=async()=>{try{let C=await i(`${t}${wo}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({token:r,...o?{sessionToken:o}:{},...s&&Object.keys(s).length>0?{userTraits:s}:{}}),credentials:"omit"});if(!C.ok)return l("ARCY could not verify this preview link. Close this tab and press Preview in the dashboard again.");let O=await C.json();return O?.ok!==!0||O.flow===void 0||O.flow===null?l("ARCY could not verify this preview link. Close this tab and press Preview in the dashboard again."):O.protocol!==bo?l("This page runs an older version of arcy.js than the dashboard expects. The preview cannot run until the script updates."):O.flow}catch{return l("ARCY could not reach its server to start this preview. Check the connection and press Preview again.")}},b=false,v,p=new Promise(C=>{try{v=a(()=>{b||(b=!0,C(l("ARCY took too long to verify this preview link. Close this tab and press Preview in the dashboard again.")));},d);}catch{}}),g=await Promise.race([f().then(C=>(b=true,C)),p]);try{v!==void 0&&clearTimeout(v);}catch{}return g}var kt="https://api.arcyai.com",To="/api/v1/sdk/session/init";var xo=["ON","REQUIRE_CONSENT","OFF"];function ko(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,n=t.behavioralTelemetry,r=t.effectiveCustomization,o=t.widget,s=t.identity,i=s&&typeof s=="object"&&!Array.isArray(s)?s.accepted:void 0;return {sessionToken:typeof t.sessionToken=="string"?t.sessionToken:null,behavioralTelemetry:typeof n=="string"&&xo.indexOf(n)!==-1?n:null,customization:r&&typeof r=="object"&&!Array.isArray(r)?r:null,widget:o&&typeof o=="object"&&!Array.isArray(o)?o:null,identityAccepted:typeof i=="boolean"?i:null}}function gn(e){let{token:t,apiBase:n=kt,setTimeoutImpl:r=(T,w)=>setTimeout(T,w),now:o=()=>Date.now(),retryDelayMs:s=2e3,attemptTimeoutMs:i=5e3,failureCooldownMs:d=3e4}=e,a=e.fetchImpl!==void 0?e.fetchImpl:typeof fetch<"u"?fetch.bind(globalThis):null,l=`${n}${To}`,f=null,b=null,v=null,p=null,g=0;function C(T){let w={publicKey:t,sessionId:T.sessionId};return T.visitorId!==void 0&&(w.visitorId=T.visitorId),T.userId!==void 0&&(w.userId=T.userId),T.userHash!==void 0&&(w.userHash=T.userHash),T.userTraits!==void 0&&(w.userTraits=T.userTraits),T.uiLanguage!==void 0&&(w.uiLanguage=T.uiLanguage),T.contentLocale!==void 0&&(w.contentLocale=T.contentLocale),T.viewerLocale!==void 0&&(w.viewerLocale=T.viewerLocale),T.route!==void 0&&(w.route=T.route),T.sessionContext!==void 0&&(w.sessionContext=T.sessionContext),JSON.stringify(w)}async function O(T){if(!a)return {ok:false,reason:"unusable"};let w;try{w=await a(l,{method:"POST",headers:{"Content-Type":"application/json"},body:T,credentials:"omit"});}catch{return null}if(w.status>=500)return null;if(!w.ok)return {ok:false,reason:"rejected"};let _;try{_=await w.json();}catch{return {ok:false,reason:"unusable"}}let M=ko(_);return M?{ok:true,config:M}:{ok:false,reason:"unusable"}}function k(T){return new Promise(w=>{try{r(()=>w(),T);}catch{w();}})}function z(T){return Promise.race([O(T),k(i).then(()=>null)])}async function N(T){let w=await z(T);return w||(await k(s),await z(T)??{ok:false,reason:"network"})}return {async sync(T){let w=C(T);if(p&&w===b)return p;if(!p&&w===b&&f)return {ok:true,config:f};if(v&&v.json===w&&o()-v.at<d)return {ok:false,reason:"network"};b=w;let _=++g,M=N(w).then(S=>(_===g&&(S.ok?(f=S.config,v=null):(v={json:w,at:o()},b===w&&(b=null))),p===M&&(p=null),S));return p=M,M},config:()=>f}}var Ct="__arcyChat";var yn=["image/png","image/jpeg","image/webp"],At="--_arcy-font-key",bn="arcy-chat-policy",wn="arcy-bar-tray",Qe={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 _t="https://cdn.arcyai.com";var Co=15e3;function Sn(e,t,n,r){return new Promise(o=>{let s=false,i=null,d=p=>{s||(s=true,i&&(i.onload=null,i.onerror=null),o(p));},a=false,l=p=>{a||(a=true,h(p));},f=()=>{let p;try{p=e[Ct];}catch{return l("The chat panel registration could not be read. The panel will not open."),null}if(!p)return null;if(typeof p.mount!="function")return l("The chat panel registered something unusable. The panel will not open."),null;let g;try{g=p.contract;}catch{g=void 0;}return g!==4?(l(`The chat panel on the CDN speaks contract ${typeof g=="number"?g:"unknown"}, this arcy.js speaks ${4}. Update arcy.js to open the chat panel.`),null):p},b=p=>{try{let g=f();!g&&!a&&p(),d(g);}catch{d(null);}},v=false;try{v=e[Ct]!==void 0;}catch{v=true;}if(v){b(()=>{});return}try{let p=e.document;i=p.createElement("script"),ve(i),i.async=!0,i.src=`${t}/${qt}`;let g=i.src;i.onload=()=>b(()=>h("The chat panel loaded but did not register. The panel will not open.")),i.onerror=()=>{try{h(`Failed to load ${g}. The chat panel will not open. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch{}d(null);},(p.head||p.documentElement).appendChild(i);}catch(p){h(`The chat panel could not load. ${String(p)}`),d(null);return}try{r(()=>{s||h("The chat panel did not load in time."),d(null);},n);}catch{}})}function En(e){let{root:t,host:n,win:r=typeof window<"u"?window:void 0,loadChunk:o,loadTimeoutMs:s=Co,setTimeoutImpl:i=(L,B)=>setTimeout(L,B),onRequestClose:d,bar:a,apiBase:l,getSessionToken:f,getSessionId:b,getRoute:v,getMaxHeightPercent:p,onStartFlow:g,publicKey:C,getConversationId:O,setConversationId:k,touchConversation:z,getVisitorId:N,onOrgCapExceeded:T,onStopFlow:w,track:_,getWidget:M,onSelectLocale:S}=e,I=t!==n,P=null,V=null,D=false,U=false;async function K(){if(!(P||D))return V||(V=(async()=>{if(r)try{let L=await o(r,s,i);if(!L||D)return;let B={root:t,host:n,isolated:I,onRequestClose:d,bar:a,apiBase:l,getSessionToken:f,getSessionId:b,getRoute:v,getMaxHeightPercent:p,onStartFlow:g,publicKey:C,getConversationId:O,setConversationId:k,touchConversation:z,getVisitorId:N,onOrgCapExceeded:T,onStopFlow:w,track:_,getWidget:M,onSelectLocale:S};P=L.mount(B),P||h("The chat panel could not start.");}catch(L){h(`The chat panel could not load. ${String(L)}`);}finally{V=null;}})(),V)}return {async open(){if(!D&&(U=true,await K(),!(!U||D)))try{P?.open();}catch(L){h(`The chat panel could not open. ${String(L)}`);}},close(){U=false;try{P?.close();}catch(L){h(`The chat panel could not close. ${String(L)}`);}},destroy(){D=true,U=false;let L=P;P=null;try{L?.destroy();}catch(B){h(`The chat panel could not be removed. ${String(B)}`);}},reposition(){try{P?.reposition?.();}catch(L){h(`The chat panel could not move. ${String(L)}`);}},refreshChrome(){try{P?.refreshChrome?.();}catch(L){h(`The chat panel could not apply its texts. ${String(L)}`);}},async promptFill(L){if(D||(await K(),D||!P?.promptFill))return null;try{return await P.promptFill(L)}catch(B){return h(`The flow's question could not be shown. ${String(B)}`),null}},cancelFill(){try{P?.cancelFill?.();}catch(L){h(`The flow's question could not be withdrawn. ${String(L)}`);}},async showFlowFailure(){if(!D&&(U=true,await K(),!(!U||D||!P?.showFlowFailure)))try{P.showFlowFailure();}catch(L){h(`The flow's failure notice could not be shown. ${String(L)}`);}}}}var It="__arcyFlow";var Ao="arcy.flow.";function _o(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 Tn(e,{store:t=de()}={}){let n=Q(t),r=Ao+e;return {read(){let o=Z(n,r);return !o||!_o(o)?null:{flowId:o.flowId,currentStepCvid:o.currentStepCvid,flowSessionId:o.flowSessionId,startedAt:o.startedAt}},save(o){J(n,r,o);},clear(){n.removeItem(r);}}}var kn="https://cdn.arcyai.com";var Io=15e3;function Cn(e,t,n,r){return new Promise(o=>{let s=false,i=null,d=p=>{s||(s=true,i&&(i.onload=null,i.onerror=null),o(p));},a=false,l=p=>{a||(a=true,h(p));},f=()=>{let p;try{p=e[It];}catch{return l("The flow engine registration could not be read. The flow will not start."),null}if(!p)return null;if(typeof p.mount!="function")return l("The flow engine registered something unusable. The flow will not start."),null;let g;try{g=p.contract;}catch{g=void 0;}return g!==2?(l(`The flow engine on the CDN speaks contract ${typeof g=="number"?g:"unknown"}, this arcy.js speaks ${2}. Update arcy.js to run flows.`),null):p},b=p=>{try{let g=f();!g&&!a&&p(),d(g);}catch{d(null);}},v=false;try{v=e[It]!==void 0;}catch{v=true;}if(v){b(()=>{});return}try{let p=e.document;i=p.createElement("script"),ve(i),i.async=!0,i.src=`${t}/${Jt}`;let g=i.src;i.onload=()=>b(()=>h("The flow engine loaded but did not register. The flow will not start.")),i.onerror=()=>{try{h(`Failed to load ${g}. The flow will not start. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch{}d(null);},(p.head||p.documentElement).appendChild(i);}catch(p){h(`The flow engine could not load. ${String(p)}`),d(null);return}try{r(()=>{s||h("The flow engine did not load in time."),d(null);},n);}catch{}})}function An(e){let{win:t=typeof window<"u"?window:void 0,loadChunk:n,loadTimeoutMs:r=Io,setTimeoutImpl:o=(f,b)=>setTimeout(f,b),context:s}=e,i=null,d=null,a=false;async function l(){if(!(i||a))return d||(d=(async()=>{if(t)try{let f=await n(t,r,o);if(!f||a)return;i=f.mount({...s,doc:t.document,win:t}),i||h("The flow engine could not start.");}catch(f){h(`The flow engine could not load. ${String(f)}`);}finally{d=null;}})(),d)}return {async start(f){if(!a&&(await l(),!a))try{await i?.start(f);}catch(b){h(`The flow could not start. ${String(b)}`);}},async resume(){if(a||!Tn(s.token).read()||(await l(),a||!i))return false;try{return await i.resume()}catch(b){return h(`The flow could not resume. ${String(b)}`),false}},async startPreview(f){if(!a&&(await l(),!a))try{await i?.startPreview?.(f);}catch(b){h(`The preview could not start. ${String(b)}`);}},async resumePreview(){if(a||!Je(s.token)||(await l(),a||!i?.resumePreview))return false;try{return await i.resumePreview()}catch(f){return h(`The preview could not resume. ${String(f)}`),false}},stop(){if(!a)try{i?.stop?.();}catch(f){h(`The flow could not be stopped. ${String(f)}`);}},destroy(){a=true;let f=i;i=null;try{f?.destroy();}catch(b){h(`The flow engine could not be removed. ${String(b)}`);}}}}function Rt(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 _n(e){let t=e.dataTransfer;return Array.from(t?.files??[])}var In=`
|
|
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 Rn=In+`
|
|
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 Se=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:0;function Pn(e){let t=e?.document?.documentElement;return {width:Se(t?.clientWidth)||Se(e?.innerWidth),height:Se(t?.clientHeight)||Se(e?.innerHeight)}}function Ro(e){let t=e?.visualViewport;if(!t)return 0;let n=Pn(e).height,r=Se(t.height);if(!n||!r)return 0;let o=typeof t.offsetTop=="number"&&Number.isFinite(t.offsetTop)?t.offsetTop:0,s=n-(r+o);return !Number.isFinite(s)||s<24?0:Math.min(s,n)}function Ze(e){let t=Pn(e);return {...t,isMobile:t.width>0&&t.width<640,keyboardOffset:Ro(e)}}var Po=560;function Ln(e,t){let n=Se(t.width);if(!n)return Po;if(n<640)return Math.max(0,n-24);let r=Math.round(e/100*n);return Math.min(r,n-32)}function On(e){return e.x===0&&e.y===0?"none":`translate(${e.x}px, ${e.y}px)`}function Pt(e,t,n){let r=Se(n);if(!r)return e;let o=Math.max(0,(r-Se(t))/2);return Math.min(o,Math.max(-o,e))}var Oo=1e4,Mn=52,et=24,tt=18,nt=30,rt=280,Fn="var(--_arcy-chat-welcome-icon-size, 34px)",Nn="53%",Mo=24,Dn="http://www.w3.org/2000/svg",Bn=[["box-sizing","border-box"],["margin","0"],["display","flex"]],Hn=[["position","absolute"],["pointer-events","auto"]],Fo=260,No=300,Do=150,Bo=3e3;function be(e,t,n,r=2){let o=e.createElementNS(Dn,"svg");o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("aria-hidden","true"),o.setAttribute("width",String(n)),o.setAttribute("height",String(n));let s=e.createElementNS(Dn,"path");return s.setAttribute("d",t),s.setAttribute("fill","none"),s.setAttribute("stroke","currentColor"),s.setAttribute("stroke-width",String(r)),s.setAttribute("stroke-linecap","round"),s.setAttribute("stroke-linejoin","round"),o.appendChild(s),o}function Un(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 Ho="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",De={x:0,y:0},Uo="M12 5v14M5 12h14",Vo="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",Vn="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",Wn="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",Wo="M12 19V5M5 12l7-7 7 7",$o="M6 6h12v12H6z";function $(e,t){return (...n)=>{try{t(...n);}catch(r){h(`${e} failed. ${String(r)}`);}}}var Ko={send:"Send",attachMenu:"Add",attachImage:"Attach an image",flowStop:"Stop",openChat:"Open chat",moveBar:"Move the chat bar",flowStep:"Step {step} of {total}"};function $n(e={}){let t={...Ko,...e.labels??{}},n={widthPercent:e.geometry?.widthPercent??nt,bottomOffset:e.geometry?.bottomOffset??et,collapsedWidth:e.geometry?.collapsedWidth??rt},r=null,o=false,s=null,i=null,d=null,a=null,l=null,f=null,b=e.iconUrl??null,v=e.iconSize??tt,p=e.welcomeIconUrl??null,g=null,C=null,O=false,k=null,z=null,N=false,T={x:0,y:0},w=null,_=null,M=null,S=null,I=null,P=null,V=null,D=null,U=null,K=null,L="idle",B=null,fe=false,ee=false,we=0,te=false,pe=false,W={width:0,height:0,isMobile:false,keyboardOffset:0};function ae(){return !B&&L!=="open"}function le(u){let m=s?.offsetWidth??0,H=s?.offsetHeight??0;if(!W.width||!W.height)return u;let F=n.bottomOffset+W.keyboardOffset,j=Math.max(0,W.height-H-F);return {x:Pt(u.x,m,W.width),y:Math.min(F,Math.max(-j,u.y))}}function E(u){if(!O||W.isMobile)return;u.preventDefault(),u.stopPropagation();let m=u.clientX,H=u.clientY,F=T,j=C,q=C?.ownerDocument?.defaultView??(typeof window<"u"?window:null),Kt=Ce=>{Ce.pointerId===u.pointerId&&(T=le({x:F.x+(Ce.clientX-m),y:F.y+(Ce.clientY-H)}),G(),e.onGeometryChange?.());},Ge=Ce=>{if(Ce.pointerId===u.pointerId){q?.removeEventListener("pointermove",Kt,true),q?.removeEventListener("pointerup",Ge,true),q?.removeEventListener("pointercancel",Ge,true);try{j?.releasePointerCapture(Ce.pointerId);}catch{}e.onPositionChange?.(T);}};try{j?.setPointerCapture(u.pointerId);}catch{}q?.addEventListener("pointermove",Kt,true),q?.addEventListener("pointerup",Ge,true),q?.addEventListener("pointercancel",Ge,true);}function R(){s?.style.setProperty("display",N?"none":"flex","important"),k&&(k.style.setProperty("display",N?"flex":"none","important"),N&&(k.style.setProperty("bottom",`${n.bottomOffset+W.keyboardOffset}px`,"important"),k.style.setProperty("right",`${Mo}px`,"important")));}function G(){if(R(),!s)return;let u=ae(),m=Ln(n.widthPercent,W),H=n.bottomOffset+W.keyboardOffset;s.style.setProperty("bottom",`${H}px`,"important"),s.style.setProperty("left","50%","important"),s.style.setProperty("translate","-50%","important");let F=O&&!W.isMobile?le(T):De;T=F;let j=B?De:{x:Pt(F.x,u?n.collapsedWidth:m,W.width),y:F.y};s.style.setProperty("transform",On(j)),i?.setAttribute("data-grip",O&&!W.isMobile&&!B?"true":"false"),s.style.setProperty("width",u?`${n.collapsedWidth}px`:`${m}px`);let q=`calc(100% - ${24}px)`;s.style.setProperty("max-width",W.isMobile?q:"none"),s.setAttribute("data-mobile",W.isMobile?"":"false");}function ne(){if(!l||!f)return;let u=l.ownerDocument,m=!ae()&&ee,H=m?be(u,Uo,18):b?Un(u,b,v):be(u,Vn,v);l.replaceChild(H,f),f=H,l.setAttribute("aria-label",t.attachMenu),m?l.setAttribute("data-tip",t.attachMenu):l.removeAttribute("data-tip"),l.setAttribute("aria-haspopup",m?"menu":"false"),l.setAttribute("data-role",m?"menu":"mark"),l.disabled=!m,l.setAttribute("aria-hidden",m?"false":"true"),l.tabIndex=m?0:-1,m||ge();}function me(){if(!K||!i)return;let u=ee&&we>0&&!ae(),m=i.getAttribute("data-attachments")==="true";K.style.setProperty("display",u?"flex":"none"),i.setAttribute("data-attachments",u?"true":"false"),m!==u&&$("onGeometryChange",()=>e.onGeometryChange?.())();}function he(u){te=u,w&&w.style.setProperty("display",u?"flex":"none"),l?.setAttribute("aria-expanded",u?"true":"false"),u&&_?.focus();}function ge(){if(!te)return;let u=w?.getRootNode(),m=!!(u&&"activeElement"in u&&u.activeElement&&w?.contains(u.activeElement));he(false),m&&l?.focus();}function ie(){if(!k||!z)return;let u=k.ownerDocument,m=p&&p!==g?p:null,H;if(m){let F=u.createElement("img");F.src=m,F.alt="",F.setAttribute("aria-hidden","true"),F.style.setProperty("width","100%"),F.style.setProperty("height","100%"),F.style.setProperty("object-fit","contain"),F.style.setProperty("display","block"),F.addEventListener("error",()=>{g=m,ie();},{once:true}),H=F;}else {let F=be(u,Wn,18);F.setAttribute("width",Nn),F.setAttribute("height",Nn),H=F;}k.replaceChild(H,z),z=H;}function X(){if(!i||!d||!I)return;let u=B?fe?"input":"flow":L,m=B?.phase==="done";i.setAttribute("data-mode",u),i.setAttribute("data-phase",B?m?"done":"running":"none"),i.setAttribute("data-collapsed",ae()?"true":"false"),ne(),me(),G(),d.style.setProperty("display",u==="flow"?"none":"flex"),I.style.setProperty("display",u==="flow"||u==="input"?"flex":"none"),S?.style.setProperty("display","flex"),i.setAttribute("aria-expanded",u==="open"?"true":"false"),B&&P&&V&&(P.textContent=B.name,V.textContent=m?"\u2713":t.flowStep.replace("{step}",String(B.step)).replace("{total}",String(B.total)),D?.style.setProperty("display",m?"none":"flex")),U&&U.style.setProperty("display",u==="open"&&U.textContent?"block":"none");}function Ue(){W=Ze(typeof window<"u"?window:null),G(),$("onGeometryChange",()=>e.onGeometryChange?.())();}function Ve(u){u.preventDefault();let m=a?.value.trim()??"";if(!m&&we===0){Te();return}a&&(a.value=""),$("onSubmit",()=>e.onSubmit?.(m))();}function st(){Te();}function Te(){B||L==="open"||pe||(pe=true,$("onActivate",()=>e.onActivate?.())());}function Re(u){if(!(B||L==="open")&&!(w&&u.target instanceof Node&&w.contains(u.target))){Te();try{a?.focus();}catch{}}}function at(){pe=false;}function We(u){u.preventDefault(),u.stopPropagation(),!(ae()||!ee)&&he(!te);}function lt(){try{M?.click();}catch{}}function Pe(u){u.preventDefault(),u.stopPropagation(),ge(),lt(),e.onAttach?.();}function xe(){let u=M?.files,m=u?Array.from(u):[];M&&(M.value=""),!(!ee||m.length===0)&&e.onFiles?.(m);}function ct(u){u.key==="Escape"&&te&&ge();}function ut(u){if(!te)return;let m=u.target;m instanceof Node&&(l?.contains(m)===true||w?.contains(m)===true)||ge();}function dt(u){let m=typeof u.composedPath=="function"?u.composedPath():[],H=u.target,F=r?.host,j=!!(F&&(m.some(q=>q===F)||m.length===0&&H instanceof Node&&F.contains(H)));te&&!j&&ge(),!(B||L!=="open")&&(!F||j||$("onDismiss",()=>e.onDismiss?.())());}function ft(u){Rt(u)&&u.preventDefault();}function pt(u){if(!Rt(u)||(u.preventDefault(),!ee))return;let m=_n(u);m.length!==0&&e.onFiles?.(m);}let ce=$("resize",Ue),$e=$("submit",Ve),re=$("focus",st),ye=$("barClick",Re),Ke=$("pointerdown",at),c=$("attachMenu",We),y=$("attach",Pe),A=$("picked",xe),x=$("stop",()=>e.onStop?.()),Y=$("menuKey",ct),se=$("menuDismiss",dt),Le=$("menuDismissInside",ut),Ut=$("dragover",ft),Vt=$("drop",pt),Wt=$("undock",()=>e.onUndock?.());function $t(u){if(!o){o=true;try{u.style.setProperty("opacity","1");}catch{}}}function Cr(u,m){if(o)return;if(!m||typeof m.setTimeout!="function"){o=true;return}try{u.style.setProperty("opacity","0"),u.style.setProperty("transition",`opacity ${Fo}ms ease`);}catch{o=true;return}let H=F=>{try{m.setTimeout(()=>$t(u),F);}catch{$t(u);}};if(u.ownerDocument.readyState==="complete"){H(Do);return}try{m.addEventListener("load",()=>H(No),{once:!0});}catch{}H(Bo);}function Ar(){if(r?.host.isConnected){h("The chat bar is already mounted. Ignoring the second mount.");return}r=null;let u=ze({container:e.container});if(!u)return;r=u,Cr(u.host,u.host.ownerDocument.defaultView),ln(r,Rn);let m=r.host.ownerDocument;s=m.createElement("div"),s.className="arcy-bar-wrap";for(let[j,q]of Bn)s.style.setProperty(j,q);for(let[j,q]of Hn)s.style.setProperty(j,q,"important");s.style.setProperty("flex-direction","column"),s.style.setProperty("align-items","center"),i=m.createElement("div"),i.className="arcy-bar",i.setAttribute("role","group"),i.setAttribute("aria-label",t.openChat),d=m.createElement("form"),d.className="arcy-bar-form",a=m.createElement("input"),a.type="text",a.className="arcy-bar-input",a.maxLength=Oo,a.setAttribute("aria-label",t.openChat),a.autocomplete="off",K=m.createElement("div"),K.className=wn,K.style.setProperty("display","none"),C=m.createElement("button"),C.type="button",C.className="arcy-bar-grip",C.setAttribute("aria-label",t.moveBar),C.setAttribute("data-tip",t.moveBar),C.appendChild(be(m,Vo,16)),C.addEventListener("pointerdown",E),C.addEventListener("click",j=>j.stopPropagation()),l=m.createElement("button"),l.type="button",l.className="arcy-bar-leading",f=b?Un(m,b,v):be(m,Vn,v),l.appendChild(f),w=m.createElement("div"),w.className="arcy-bar-menu",w.setAttribute("role","menu"),w.style.setProperty("display","none"),_=m.createElement("button"),_.type="button",_.className="arcy-bar-menu-item",_.setAttribute("role","menuitem"),_.appendChild(be(m,Ho,16)),_.appendChild(m.createTextNode(t.attachImage)),w.appendChild(_),M=m.createElement("input"),M.type="file",M.accept=yn.join(","),M.multiple=true,M.tabIndex=-1,M.setAttribute("aria-hidden","true"),M.style.setProperty("display","none"),i.appendChild(M),S=m.createElement("button"),S.type="submit",S.className="arcy-bar-send",S.setAttribute("aria-label",t.send),S.appendChild(be(m,Wo,18)),d.appendChild(C),d.appendChild(l),d.appendChild(a),d.appendChild(S),I=m.createElement("div"),I.className="arcy-bar-status",I.style.setProperty("display","none");let H=m.createElement("span");H.className="arcy-bar-dot",H.setAttribute("aria-hidden","true"),P=m.createElement("span"),P.className="arcy-bar-flow-name",V=m.createElement("span"),V.className="arcy-bar-flow-step",D=m.createElement("button"),D.type="button",D.className="arcy-bar-stop",D.appendChild(be(m,$o,15,2)),D.appendChild(m.createTextNode(t.flowStop)),I.appendChild(H),I.appendChild(P),I.appendChild(V),I.appendChild(D),i.appendChild(K),i.appendChild(d),i.appendChild(I),i.appendChild(w),U=m.createElement("div"),U.className="arcy-bar-disclaimer",U.style.setProperty("display","none"),s.appendChild(i),s.appendChild(U),k=m.createElement("button"),k.type="button",k.className="arcy-bar-dock",k.setAttribute("aria-label",t.openChat),k.setAttribute("data-tip",t.openChat),k.setAttribute("data-tip-placement","above"),k.setAttribute("data-tip-align","end");for(let[j,q]of Bn)k.style.setProperty(j,q);for(let[j,q]of Hn)k.style.setProperty(j,q,"important");k.style.setProperty("align-items","center"),k.style.setProperty("justify-content","center"),k.style.setProperty("width",Fn),k.style.setProperty("height",Fn),z=be(m,Wn,18),k.appendChild(z),ie(),k.addEventListener("click",Wt),d.addEventListener("submit",$e),a.addEventListener("focus",re),i.addEventListener("click",ye),i.addEventListener("pointerdown",Ke,true),l.addEventListener("click",c),_.addEventListener("click",y),M.addEventListener("change",A),D.addEventListener("click",x),i.addEventListener("dragover",Ut),i.addEventListener("drop",Vt),m.addEventListener("pointerdown",se,true),r.root.addEventListener("pointerdown",Le,true),m.addEventListener("keydown",Y,true);let F=m.defaultView;F?.addEventListener("resize",ce),F?.addEventListener("orientationchange",ce),F?.visualViewport?.addEventListener("resize",ce),F?.visualViewport?.addEventListener("scroll",ce),r.root.appendChild(s),r.root.appendChild(k),W=Ze(F??null),N=e.readDocked?.()===true,G(),X();}function _r(){if(!r)return;let u=r.host.ownerDocument.defaultView;u?.removeEventListener("resize",ce),u?.removeEventListener("orientationchange",ce),u?.visualViewport?.removeEventListener("resize",ce),u?.visualViewport?.removeEventListener("scroll",ce),d?.removeEventListener("submit",$e),a?.removeEventListener("focus",re),i?.removeEventListener("click",ye),i?.removeEventListener("pointerdown",Ke,true),l?.removeEventListener("click",c),_?.removeEventListener("click",y),M?.removeEventListener("change",A),D?.removeEventListener("click",x),i?.removeEventListener("dragover",Ut),i?.removeEventListener("drop",Vt),k?.removeEventListener("click",Wt);let m=r.host.ownerDocument;m.removeEventListener("pointerdown",se,true),r.root.removeEventListener("pointerdown",Le,true),m.removeEventListener("keydown",Y,true),r.destroy(),r=null,s=i=d=I=P=V=U=null,a=null,_=S=D=null,M=null,l=null,f=null,k=null,z=null,w=null,K=null,te=false,B=null,L="idle";}return {mount:Ar,unmount:_r,isMounted:()=>r!==null&&r.host.isConnected,getElement:()=>i,getRoot:()=>r?.root??null,getHost:()=>r?.host??null,setMode(u){L!==u&&(L=u,pe=false,X());},getMode:()=>B?"flow":L,setGeometry(u){n={widthPercent:u.widthPercent??n.widthPercent,bottomOffset:u.bottomOffset??n.bottomOffset,collapsedWidth:u.collapsedWidth??n.collapsedWidth},G();},getMetrics:()=>({...n,offset:B||!O||W.isMobile?De:T,height:s?.offsetHeight||i?.offsetHeight||Mn,keyboardOffset:W.keyboardOffset,isMobile:W.isMobile,viewportHeight:W.height,viewportWidth:W.width}),getHeight:()=>s?.offsetHeight||i?.offsetHeight||Mn,setLabels(u){t={...t,...u};try{if(S?.setAttribute("aria-label",t.send),_){let m=_.lastChild;m&&(m.textContent=t.attachImage);}if(i?.setAttribute("aria-label",t.openChat),a?.setAttribute("aria-label",t.openChat),k&&(k.setAttribute("aria-label",t.openChat),k.setAttribute("data-tip",t.openChat)),C&&(C.setAttribute("aria-label",t.moveBar),C.setAttribute("data-tip",t.moveBar)),D){let m=D.lastChild;m&&(m.textContent=t.flowStop);}}catch{}X();},setPlaceholder(u){try{a&&(a.placeholder=u??"");}catch{}},setDisabled(u){try{a&&(a.disabled=u),S&&(S.disabled=u),_&&(_.disabled=u),u&&ge();}catch{}},setAttachEnabled(u){ee!==u&&(ee=u,X());},setDraggable(u){O!==u&&(O=u,T=u?e.readPosition?.()??De:De,G(),e.onGeometryChange?.());},setIcon(u){b!==u&&(b=u,ne());},setIconSize(u){v!==u&&(v=u,ne());},setWelcomeIcon(u){p!==u&&(p=u,g=null,ie());},setDocked(u){N!==u&&(N=u,$("onDockedChange",()=>e.onDockedChange?.(u))(),u&&ge(),G(),$("onGeometryChange",()=>e.onGeometryChange?.())());},isDocked:()=>N,setFlow(u){B=u,u||(fe=false),X();},setAwaitingInput(u){fe!==u&&(fe=u,X(),$("onGeometryChange",()=>e.onGeometryChange?.())());},setDisclaimer(u){try{if(U&&(U.textContent="",u!=null))if(typeof u=="string")U.textContent=u;else {let m=U.ownerDocument;U.appendChild(m.createTextNode(u.before));let H=m.createElement("a");H.className=bn,H.href=u.linkHref,H.target="_blank",H.rel="noopener noreferrer",H.textContent=u.linkLabel,U.appendChild(H),u.after&&U.appendChild(m.createTextNode(u.after));}}catch{}X();},setAttachmentCount(u){we=u;try{me();}catch{}},attachmentSlot:()=>K,focusInput(){try{r&&wt(r.host.ownerDocument,r.host),a?.focus();}catch{}},reposition:()=>{W=Ze(typeof window<"u"?window:null),G();},readValue:()=>a?.value??"",clearValue(){try{a&&(a.value="");}catch{}}}}var Go=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,Yo=/^[a-z0-9-]{1,32}$/,Kn={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)"},zo=20,Xo=50,jo=30,qo=80,Jo=0,Qo=120,Zo=14,ei=28,ti=180,ni=480,ri=2147483647,ot={vars:{},widthPercent:null,bottomOffset:null,collapsedWidth:null,barIconSize:null,maxHeightPercent:null,zIndex:null};function oe(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Ee(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.min(n,Math.max(t,e))}function Be(e,t,n){if(t)for(let[r,o]of n){let s=t[r];typeof s=="string"&&Go.test(s)&&(e[o]=s);}}function _e(e,t,n,r,o){let s=Ee(n,r,o);s!==null&&(e[t]=`${s}px`);}function Gn(e,t,n){typeof n=="string"&&n in Kn&&(e[t]=Kn[n]);}function Lt(e){let t=oe(e);if(!t)return ot;let n={},r=oe(t.base);Be(n,oe(r?.brand),[["text","--_arcy-brand-text"],["background","--_arcy-brand-bg"],["hover","--_arcy-brand-bg-hover"],["active","--_arcy-brand-bg-active"]]),Be(n,oe(r?.main),[["text","--_arcy-main-text"],["background","--_arcy-main-bg"]]);let o=oe(r?.border);_e(n,"--_arcy-border-width",o?.width,0,8),Be(n,o,[["color","--_arcy-border-color"]]);let s=Ee(r?.glassiness,0,100);s!==null&&s>0&&(n["--_arcy-glass-blur"]=`${Math.round(s/5)}px`,n["--_arcy-glass-alpha"]=`${Math.round(s/2)}%`);let i=r?.fontFamily;typeof i=="string"&&Yo.test(i)&&i!=="system"&&(n[At]=i);let d=Ee(r?.zIndex,0,ri);_e(n,"--arcy-bar-radius",r?.borderRadius,0,32),_e(n,"--_arcy-chat-radius",r?.borderRadius,0,32),Gn(n,"--arcy-bar-shadow",r?.shadow),Gn(n,"--_arcy-chat-shadow",r?.shadow);let a=oe(t.bar),l=oe(t.chat);_e(n,"--_arcy-chat-logo-size",l?.logoSize,16,48),_e(n,"--_arcy-chat-welcome-icon-size",l?.welcomeIconSize,16,72),Be(n,oe(l?.assistantBubble),[["background","--_arcy-assistant-bg"],["text","--_arcy-assistant-text"]]);let f=oe(l?.scrollbar);return _e(n,"--_arcy-scroll-width",f?.width,2,16),Be(n,f,[["track","--_arcy-scroll-track"],["thumb","--_arcy-scroll-thumb"],["thumbHover","--_arcy-scroll-thumb-hover"]]),{vars:n,widthPercent:Ee(l?.width,zo,Xo),bottomOffset:Ee(a?.bottomOffset,Jo,Qo),collapsedWidth:Ee(a?.collapsedWidth,ti,ni),barIconSize:Ee(a?.iconSize,Zo,ei),maxHeightPercent:Ee(l?.maxHeight,jo,qo),zIndex:d!==null?Math.round(d):null}}var oi=["--_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",At,"--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 Yn(e,t){try{for(let n of oi){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?bt:String(t.zIndex),"important");}catch(n){h(`The widget could not apply its theme. ${String(n)}`);}}var ii="arcy.tokens.",si=4096,ai=100,li=2048;function He(e){let t=oe(e);if(!t)return null;let n=typeof t.name=="string"?t.name.slice(0,ai):"",r=t.logoUrl,o=typeof r=="string"&&r.length<=li&&/^https:\/\//i.test(r)?r:null;return {name:n,logoUrl:o}}function zn(e,t=de()){let n=Q(t),r=ii+e;return {read(){let o=oe(Z(n,r));return {tokens:Lt(o?.t),identity:He(o?.w)}},remember(o,s){let i=oe(o),d=He(s);if(!i&&!d){n.removeItem(r);return}try{let a={t:i??void 0,w:d??void 0};if(JSON.stringify(a).length>si)return;J(n,r,a);}catch{}}}}var ci="arcy.shell.",Xn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,ui=/^[a-z]{2}-[A-Z]{2}$/;function di(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 fi(e){let t=typeof globalThis<"u"?globalThis.crypto:void 0;if(!e&&t&&typeof t.randomUUID=="function")try{let o=t.randomUUID();if(Xn.test(o))return o}catch{}let n=new Uint8Array(16);if(e)e(n);else if(t&&typeof t.getRandomValues=="function")t.getRandomValues(n);else for(let o=0;o<n.length;o++)n[o]=Math.floor(Math.random()*256);n[6]=(n[6]??0)&15|64,n[8]=(n[8]??0)&63|128;let r="";for(let o=0;o<n.length;o++)r+=(n[o]??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 jn(e,{store:t=de(),fill:n}={}){let r=Q(t),o=ci+e;function s(){return Z(r,o)??{}}function i(a){J(r,o,{...s(),...a});}function d(){let a=s(),l=a.anonymousId;return {anonymousId:typeof l=="string"&&Xn.test(l)?l:null,position:di(a.position),docked:a.docked===true,locale:typeof a.locale=="string"&&ui.test(a.locale)?a.locale:null}}return {read:d,anonymousId(){let a=d().anonymousId;return a||(i({anonymousId:fi(n)}),d().anonymousId)},rememberPosition(a){i({position:a});},rememberDocked(a){i({docked:a});},rememberLocale(a){i({locale:a});},forgetAnonymousId(){let a=s();a.anonymousId!==void 0&&(delete a.anonymousId,Object.keys(a).length===0?r.removeItem(o):J(r,o,a));}}}var pi="arcy.visit.",qn="first";function Jn(e,t=Ae()){let n=Q(t),r=pi+e;return {markFirstVisit(){n.setItem(r,qn);},isFirstVisit(){return n.getItem(r)===qn}}}var Qn="0123456789ABCDEFGHJKMNPQRSTVWXYZ";var Ot=e=>{let t=typeof globalThis<"u"?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 Ie(e,t=Ot){let n="",r=Math.floor(e);for(let i=0;i<10;i++)n=(Qn[r%32]??"0")+n,r=Math.floor(r/32);let o=new Uint8Array(16);t(o);let s="";for(let i=0;i<16;i++)s+=Qn[(o[i]??0)%32];return n+s}var mi="arcy.chat.",hi=1440*60*1e3;function Zn(e,{store:t=de(),fill:n=Ot,now:r=Date.now}={}){let o=Q(t),s=mi+e;function i(){return Z(o,s)??{}}function d(){let a=Ie(r(),n);return J(o,s,{id:a,lastActiveAt:r()}),a}return {id(){let a=i(),l=typeof a.id=="string"?a.id:null,f=typeof a.lastActiveAt=="number"?a.lastActiveAt:null;return l&&f!==null&&r()-f<hi?l:d()},touch(){let a=i();typeof a.id=="string"&&J(o,s,{...a,lastActiveAt:r()});},reset(){d();},adopt(a){return typeof a!="string"||a.length===0?this.id():(J(o,s,{id:a,lastActiveAt:r()}),a)},startNew(){return d()}}}var gi=[["utm_source","utmSource"],["utm_medium","utmMedium"],["utm_campaign","utmCampaign"],["utm_content","utmContent"],["utm_term","utmTerm"]],yi=255,bi=512,wi=/[\u0000-\u001f\u007f]/g;function er(e,t){let n=e.replace(wi,"").trim();if(n.length!==0)return n.slice(0,t)}function vi(e){if(!(typeof e!="string"||e.length===0))try{let t=new URL(e),n=t.host;if(!n)return;let r=ke(t.pathname);return er(r==="/"?n:n+r,bi)}catch{return}}function Si(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 o=r.indexOf("=");if(o<=0)continue;let s=r.slice(0,o).toLowerCase(),i=gi.find(l=>l[0]===s);if(!i)continue;let d=r.slice(o+1).replace(/\+/g," ");try{d=decodeURIComponent(d);}catch{}let a=er(d,yi);a&&(t[i[1]]=a);}return t}function Ei(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 Ti(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 xi(e){if(!(typeof e!="number"||!(e>0)))return e<480?"xs":e<768?"sm":e<1024?"md":e<1280?"lg":"xl"}function tr(e){let t={...Si(e.search)},n=vi(e.referrer);n&&(t.referrer=n);let r=Ei(e.userAgent);r&&(t.browser=r);let o=Ti(e.userAgent);o&&(t.os=o);let s=xi(e.viewportWidth);return s&&(t.viewport=s),Object.keys(t).length>0?t:void 0}var ki=["ON","REQUIRE_CONSENT","OFF"];function nr(e,t){function n(){let o=Z(e,t);if(!o)return {};let s=typeof o.state=="string"&&ki.indexOf(o.state)!==-1?o.state:void 0,i=typeof o.consent=="boolean"?o.consent:void 0;return {state:s,consent:i}}function r(o){if(o.state===void 0&&o.consent===void 0){e.removeItem(t);return}J(e,t,o);}return {state:()=>n().state??null,consent:()=>n().consent??null,setState(o){r({...n(),state:o});},setConsent(o){let s=n();r({state:s.state,consent:o?true:void 0});},clearState(){r({state:void 0,consent:n().consent});},shouldCapture(){let{state:o,consent:s}=n();return o===void 0||o==="OFF"?false:o==="REQUIRE_CONSENT"?s===true:true}}}var Ci=/iPhone|iPod|Android.*Mobile|Windows Phone|BlackBerry|Opera Mini|IEMobile/i,Ai=/iPad|Tablet|PlayBook|Silk|Kindle/i;function rr(e){let t=e?.userAgent??"";return Ai.test(t)||e?.platform==="MacIntel"&&typeof e.maxTouchPoints=="number"&&e.maxTouchPoints>1?"tablet":Ci.test(t)?"mobile":/Android/i.test(t)?"tablet":"desktop"}var ir=100,_i=4096,Ii=["INPUT","TEXTAREA","SELECT"];function or(e){if(e.length!==0&&!Oe(e.slice(0,_i)))return e.slice(0,ir)}function Mt(e,t){let n=(e.tagName??"").toUpperCase(),r={tag:n.toLowerCase()},o=e.getAttribute("role");o&&(r.role=o.slice(0,64));let s=e.getAttribute("type");if(s&&(r.type=s.slice(0,32)),Ii.indexOf(n)===-1){let i=(e.textContent??"").replace(/\s+/g," ").trim(),d=or(i);d&&(r.text=d);}else {let i=e.getAttribute("aria-label")??e.getAttribute("name"),d=or(i??"");d&&(r.label=d);}if(t){let i=t(e);i&&Object.keys(i).length>0&&(r.fingerprint=i);}return r}function sr(e,t){return Mt(e,t)}function ar(e,t){let n=Mt(e,t),r=e.validity?.valid;return typeof r=="boolean"&&(n.valid=r),n}function lr(e,t){let n=Mt(e,t),r=e.getAttribute("name")??e.getAttribute("id");r&&(n.form=r.slice(0,ir));let o=e.elements?.length;return typeof o=="number"&&(n.fieldCount=o),n}var Ri=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],Pi="OTHER",Li=400,cr=200,Oi=/[\u0000-\u001f\u007f]+/g;function Nt(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(Oi," ").trim();return n.length===0?null:n.length>cr?n.slice(0,cr):n}function Ft(e){if(typeof e!="string")return "GET";let t=e.toUpperCase();return Ri.indexOf(t)===-1?Pi:t}function Mi(e){return typeof e=="number"&&e>=Li}function ur(e){let{target:t,report:n,ignore:r}=e,o=[];function s(a,l,f){try{if(!Mi(l)||f!==null&&r?.(f))return;n({method:a,status:l,url:f===null?null:Me(f,t.location?.href)});}catch{}}function i(){let a=t.fetch;if(typeof a!="function")return;let l=function(...f){let b=a.apply(this,f);try{let v=b;if(typeof v?.then!="function")return b;v.then(p=>{let g=p?.status;s(Fi(f),g,Ni(f));},()=>{});}catch{}return b};t.fetch=l,o.push(()=>{t.fetch===l&&(t.fetch=a);});}function d(){let a=t.XMLHttpRequest?.prototype,l=a?.open,f=a?.send;if(!a||typeof l!="function"||typeof f!="function"||typeof WeakMap!="function")return;let b=new WeakMap,v=function(...g){let C=l.apply(this,g);try{b.set(this,{method:Ft(g[0]),url:typeof g[1]=="string"?g[1]:null,listening:b.get(this)?.listening??!1});}catch{}return C},p=function(...g){try{let C=this,O=b.get(this);typeof C.addEventListener=="function"&&O?.listening!==!0&&(O&&(O.listening=!0),C.addEventListener("loadend",()=>{let k=b.get(this);s(k?.method??"GET",C.status,k?.url??null);}));}catch{}return f.apply(this,g)};a.open=v,o.push(()=>{a.open===v&&(a.open=l);}),a.send=p,o.push(()=>{a.send===p&&(a.send=f);});}try{i(),d();}catch{for(let a of o)try{a();}catch{}return null}return o.length===0?null:()=>{for(let a of o)try{a();}catch{}o.length=0;}}function Fi(e){let t=e[1];if(t&&typeof t=="object"&&typeof t.method=="string")return Ft(t.method);let n=e[0];return n&&typeof n=="object"&&typeof n.method=="string"?Ft(n.method):"GET"}function Ni(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 dr(e,t,n,r,o){let s={id:e,name:t,occurredAt:n,sessionId:r.sessionId};return r.userId&&(s.userId=r.userId),r.visitorId&&(s.visitorId=r.visitorId),r.route&&(s.route=r.route),r.localeCode&&(s.localeCode=r.localeCode),r.deviceClass&&(s.deviceClass=r.deviceClass),r.flowSessionId&&(s.flowSessionId=r.flowSessionId),o&&Object.keys(o).length>0&&(s.payload=o),s}var Di=["button","submit","reset","image","hidden","checkbox","radio"],Bi=["INPUT","TEXTAREA","SELECT"];function Hi(e){if(!e||typeof e.getAttribute!="function")return false;let t=(e.tagName??"").toUpperCase();if(Bi.indexOf(t)===-1)return false;if(t!=="INPUT")return true;let n=(e.getAttribute("type")??"text").toLowerCase();return Di.indexOf(n)===-1}function fr(e){let t=e.value;return typeof t=="string"?t.length===0:t==null}function pr(e){let t=null;return {focus(n){Hi(n)&&(t={element:n,empty:fr(n),filled:false,cleared:false},e.emit("field_focused",n));},change(n){if(!t||t.element!==n)return;let r=fr(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 Ui=["A","BUTTON","INPUT","SELECT","TEXTAREA","SUMMARY","OPTION","LABEL"],Vi=["button","link","checkbox","radio","switch","tab","menuitem","menuitemcheckbox","menuitemradio","option","combobox","textbox","searchbox","slider","spinbutton","treeitem"];function Wi(e,t){let n=(e.tagName??"").toUpperCase();if(Ui.indexOf(n)!==-1)return true;let r=e.getAttribute("role");if(r&&Vi.indexOf(r.toLowerCase())!==-1||e.getAttribute("onclick")!==null)return true;let o=e.getAttribute("tabindex");return o!==null&&Number(o)>=0||e.getAttribute("contenteditable")==="true"?true:t?t(e)==="pointer":false}function mr(e,t){let n=e;for(let r=0;n&&r<6;r++){if(Wi(n,t))return n;n=n.parentElement;}return null}var $i=[25,50,75,100],Ki=250,Gi=100;function hr(e){let{readDepth:t,emit:n,setTimeoutImpl:r=(l,f)=>setTimeout(l,f),clearTimeoutImpl:o=l=>clearTimeout(l),throttleMs:s=Ki}=e,i=0,d=null;function a(){d=null;let l=null;try{l=t();}catch{return}if(l===null)return;let f=0;for(let b of $i)l>=b&&(f=b);f<=i||(i=f,n(f));}return {scrolled(){if(d===null&&!(i>=Gi))try{d=r(a,s);}catch{d=null;}},reset(){if(i=0,d!==null){try{o(d);}catch{}d=null;}},dispose(){if(d!==null){try{o(d);}catch{}d=null;}}}}function gr(e){let t=e.innerHeight??0,n=e.documentHeight??0;if(!(n-t>0)||!(t>0))return null;let s=((e.scrollY??0)+t)/n*100;return s>0?s>100?100:s:0}var Yi=1800*1e3,zi=60*1e3;function yr({store:e,key:t,now:n,fill:r,windowMs:o=Yi}){function s(){let i=n(),d=Z(e,t);if(d&&typeof d.id=="string"&&d.id.length>0&&typeof d.seen=="number"&&i-d.seen<o)return i-d.seen>=zi&&J(e,t,{id:d.id,seen:i}),d.id;let l=Ie(i,r);return J(e,t,{id:l,seen:i}),l}return {touch:s,peek:()=>Z(e,t),clear(){e.removeItem(t);}}}var Dt="https://api.arcyai.com",Xi="/api/v1/sdk/telemetry";function ji(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 qi(e){let t=[],n=[],r=13;for(let o of e){let s=ji(JSON.stringify(o))+1;(n.length>=100||n.length>0&&r+s>65536)&&(t.push(n),n=[],r=13),n.push(o),r+=s;}return n.length>0&&t.push(n),t}function br(e){let{token:t,apiBase:n=Dt,fetchImpl:r,sendBeacon:o,setTimeoutImpl:s=(S,I)=>setTimeout(S,I),clearTimeoutImpl:i=S=>clearTimeout(S),sessionStore:d,stopKey:a,onTelemetryOff:l}=e,f=`${n}${Xi}`,b=[],v=null,p=C(),g=Promise.resolve();function C(){return !d||!a?null:d.getItem(a)==="tracked_events_cap"?"tracked_events_cap":null}function O(S){p=S,b=[],k(),S==="tracked_events_cap"?d&&a&&d.setItem(a,S):l&&l();}function k(){v!==null&&(i(v),v=null);}function z(){v===null&&(v=s(()=>{v=null,M(false);},5e3));}function N(S){if(p===null){if(b.push(S),b.length>1e3&&b.splice(0,b.length-1e3),b.length>=20){M(false);return}z();}}async function T(S){try{let I=await S.json();if(I&&typeof I=="object"){let P=I.code;if(typeof P=="string")return P}}catch{}return null}async function w(S){if(!r)return S;let I;try{I=await r(f,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({events:S}),credentials:"omit"});}catch{return S}return I.status===403?await T(I)==="telemetry_off"?(O("telemetry_off"),[]):[]:I.status===429?await T(I)==="tracked_events_cap"?(O("tracked_events_cap"),[]):S:I.status>=500?S:[]}function _(S){let I=JSON.stringify({events:S}),P=`${f}?token=${encodeURIComponent(t)}`;if(o&&typeof Blob<"u")try{if(o(P,new Blob([I],{type:"application/json"})))return !0}catch{}if(r)try{return r(f,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:I,keepalive:!0,credentials:"omit"}).catch(()=>{}),!0}catch{return false}return false}async function M(S=false){if(k(),p!==null||b.length===0){await g;return}let I=b;b=[];let P=qi(I);if(S){for(let V of P)_(V);return}g=g.then(async()=>{let V=[];for(let D of P){if(p!==null)return;V.push(...await w(D));}V.length>0&&p===null&&(b=V.concat(b),b.length>1e3&&b.splice(0,b.length-1e3),z());}),await g;}return {enqueue:N,flush:M,stopped:()=>p,discard(){b=[],k();},dispose(){k();}}}var wr="arcy:routechange",Ji="arcy.session.",Qi="arcy.telemetry.",Zi="arcy.telemetry.stop.";function it(e){return e.isTrusted===false}function Bt(e){let{token:t,apiBase:n,describeElement:r,getUserId:o,getVisitorId:s,getFlowSessionId:i,now:d=()=>Date.now(),fill:a}=e,l=e.win!==void 0?e.win:typeof window<"u"?window:null,f=e.doc!==void 0?e.doc:typeof document<"u"?document:null,b=e.localStore??de(),v=nr(b,Qi+t),p=yr({store:b,key:Ji+t,now:d,fill:a}),g=br({token:t,apiBase:n,fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch<"u"?fetch.bind(globalThis):null,sendBeacon:l?.navigator?.sendBeacon&&typeof l.navigator.sendBeacon=="function"?l.navigator.sendBeacon.bind(l.navigator):null,setTimeoutImpl:e.setTimeoutImpl,clearTimeoutImpl:e.clearTimeoutImpl,sessionStore:e.sessionStore??Ae(),stopKey:Zi+t,onTelemetryOff:()=>v.clearState()}),C=rr(l?.navigator),O=l?.navigator?.language??void 0,k=false,z=false,N=null,T=false;function w(){return Me(l?.location?.href)??void 0}function _(E,R,G){if(z||!v.shouldCapture()||g.stopped()!==null)return false;let ne=d(),me=p.touch(),he=dr(Ie(ne,a),E,ne,{sessionId:me,userId:o?.()??void 0,visitorId:s?.()??void 0,route:w(),localeCode:O,deviceClass:C,flowSessionId:G?.flowSessionId??i?.()??void 0},R);return G?.flowId&&(he.flowId=G.flowId),G?.flowVersion&&(he.flowVersion=G.flowVersion),G?.stepCvid&&(he.stepCvid=G.stepCvid),g.enqueue(he),true}let M=E=>{try{let R=E;if(it(R))return;let G=l?.getComputedStyle?me=>{try{return l.getComputedStyle(me).cursor??null}catch{return null}}:void 0,ne=mr(R.target,G);if(!ne)return;_("interaction_click",sr(ne,r));}catch{}},S=E=>{try{let R=E;if(it(R)||!R.target||typeof R.target.getAttribute!="function")return;_("form_submit",lr(R.target,r));}catch{}},I=()=>{try{let E=w()??null;if(E===N)return;let R=N;N=E,V.reset(),_("navigation",R?{from:R}:void 0);}catch{}},P=pr({emit:(E,R)=>{_(E,ar(R,r));}}),V=hr({readDepth:()=>gr({scrollY:l?.scrollY,innerHeight:l?.innerHeight,documentHeight:f?.documentElement?.scrollHeight}),emit:E=>{_("scroll_depth",{percent:E});},setTimeoutImpl:e.setTimeoutImpl,clearTimeoutImpl:e.clearTimeoutImpl}),D=false,U=E=>{try{let R=E;if(it(R)||!R.target)return;P.focus(R.target);}catch{}},K=E=>{try{let R=E;if(it(R)||!R.target)return;P.change(R.target);}catch{}},L=E=>{try{let R=E;if(!R.target)return;P.blur(R.target);}catch{}},B=()=>{try{V.scrolled();}catch{}},fe=()=>{try{if(f?.visibilityState==="visible"){_("page_visible");return}_("page_hidden"),g.flush(!0);}catch{}},ee=()=>{try{D||(D=!0,_("session_end")),g.flush(!0);}catch{}},we=E=>{try{let R=E;pe({message:Nt(R.message)??"Uncaught error",kind:"error",source:W(R.filename)});}catch{}},te=E=>{try{pe({message:Nt(E.reason)??"Unhandled promise rejection",kind:"unhandledrejection"});}catch{}};function pe(E){let R={message:E.message,kind:E.kind};E.source&&(R.source=E.source),_("js_error",R);}function W(E){if(typeof E=="string")return Me(E,l?.location?.href)??void 0}let ae=(n??Dt).replace(/\/+$/,""),le=null;return {start(){k||z||(k=true,N=w()??null,f?.addEventListener("click",M,true),f?.addEventListener("submit",S,true),f?.addEventListener("focusin",U,true),f?.addEventListener("focusout",L,true),f?.addEventListener("input",K,true),f?.addEventListener("change",K,true),l?.addEventListener(wr,I),l?.addEventListener("popstate",I),l?.addEventListener("scroll",B,{passive:true}),l?.addEventListener("pagehide",ee),f?.addEventListener("visibilitychange",fe),l?.addEventListener("error",we),l?.addEventListener("unhandledrejection",te),l&&le===null&&(le=ur({target:l,report:E=>{let R={method:E.method,status:E.status};E.url&&(R.url=E.url),_("request_failed",R);},ignore:E=>E.indexOf(ae)===0})),T=!_("navigation")&&v.state()===null);},stop(E){z=true,k&&(k=false,f?.removeEventListener("click",M,true),f?.removeEventListener("submit",S,true),f?.removeEventListener("focusin",U,true),f?.removeEventListener("focusout",L,true),f?.removeEventListener("input",K,true),f?.removeEventListener("change",K,true),l?.removeEventListener(wr,I),l?.removeEventListener("popstate",I),l?.removeEventListener("scroll",B),l?.removeEventListener("pagehide",ee),f?.removeEventListener("visibilitychange",fe),l?.removeEventListener("error",we),l?.removeEventListener("unhandledrejection",te),le&&(le(),le=null),V.dispose(),E?.discard?g.discard():g.flush(false),g.dispose());},setTelemetryState(E){v.setState(E),T&&(T=false,_("navigation"));},setTelemetryConsent(E){v.setConsent(E),E||g.discard();},track(E,R,G){_(E,R,G);},flush:()=>g.flush(false),sessionId:()=>p.touch(),resetSession:()=>p.clear(),stopped:()=>g.stopped(),state:()=>v.state()}}var vr="0.1.1";var es=["telemetry","locale","defaultOpen","contentLocale","apiBase"];function Sr(){return {userId:null,isAnonymous:false,attributes:{}}}function ts(e,t){return e==null?{ok:true,hash:void 0}:typeof e!="string"||e.length===0?(h(`${t}() was given a userHash that is not a string. Ignoring it.`),{ok:false}):{ok:true,hash:e}}function Ht(e,t){if(e===void 0)return {};if(typeof e!="object"||e===null||Array.isArray(e))return h(`${t}() attributes must be an object. Ignoring the call.`),null;let n={};for(let[r,o]of Object.entries(e)){if(o===void 0)continue;if(o===null){n[r]=null;continue}let s=typeof o;if(s==="string"||s==="number"||s==="boolean"){n[r]=o;continue}if(Array.isArray(o)&&o.every(i=>typeof i=="string")){n[r]=o;continue}h(`${t}() dropped "${r}": an attribute must be a string, number, boolean, null, or an array of strings.`);}return n}var ns={cdnBase:null,loadChat:()=>Promise.resolve(null),loadFlow:()=>Promise.resolve(null),loadPicker:()=>Promise.resolve(null)};function Er(e){return rs({chunks:e}).api}function rs(e={}){let t=e.chunks??ns,n=Gt();function r(){let c=s.apiBase;return typeof c=="string"&&c.length>0?c.replace(/\/+$/,""):e.apiBase??kt}let o=null,s={},i=Sr(),d=false,a=null,l=null,f=null,b=false,v=null,p=null,g=null,C=0,O,k,z=false,N=null,T=null,w=null,_=null,M=null,S=ot,I=null,P=null,V=null,D=null,U=null,K=false,L=false;function B(c){return o===null?(h(`${c}() was called before init(). Ignoring.`),false):true}async function fe(c,y){if(typeof c!="string"||c.length===0){h("init() needs an environment token. Ignoring the call.");return}if(o!==null){h("init() has already been called. Ignoring the second call.");return}if(o=c,s={},y!==void 0)if(typeof y!="object"||y===null)h("init() options must be an object. Continuing without them.");else for(let[A,x]of Object.entries(y)){if(!es.includes(A)){h(`init() ignored unknown option "${A}". Only telemetry, locale, defaultOpen, contentLocale, and apiBase can be set in code; everything else is configured in the dashboard.`);continue}s[A]=x;}typeof window<"u"&&Zt(window,{apiBase:r(),cdnBase:t.cdnBase}),ee(c),we(c),te(c),await xe(),n.emit("ready"),s.defaultOpen&&re();}function ee(c){try{N=jn(c);let y=N.read().anonymousId!==null;_=N.anonymousId(),T=Jn(c),y||T.markFirstVisit();}catch(y){N=null,_=null,h(`The ARCY session could not be started. ${String(y)}`);}try{w=Zn(c);}catch(y){w=null,h(`The ARCY session could not be started. ${String(y)}`);}try{M=zn(c);let y=M.read();S=y.tokens,I=y.identity;}catch(y){M=null,S=ot,h(`The ARCY session could not be started. ${String(y)}`);}try{p=Bt({token:c,apiBase:r(),fetchImpl:e.fetchImpl,describeElement:y=>Xt(y),getUserId:()=>i.isAnonymous?null:i.userId,getVisitorId:()=>_}),s.telemetry!==void 0&&p.setTelemetryConsent(s.telemetry===!0),p.start();}catch(y){h(`Telemetry could not start. ${String(y)}`);}try{g=gn({token:c,apiBase:r(),fetchImpl:e.fetchImpl,setTimeoutImpl:e.setTimeoutImpl});}catch(y){h(`The ARCY session could not be started. ${String(y)}`);}ae();}function we(c){if(!(typeof window>"u"))try{pn({win:window,token:c,loadChunk:t.loadPicker,apiBase:r(),fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch<"u"?fetch.bind(globalThis):null,setTimeoutImpl:e.setTimeoutImpl,onVerified:()=>p?.stop({discard:!0})});}catch(y){h(`Design mode could not start. ${String(y)}`);}}function te(c){if(!(typeof window>"u"))try{let y=mn(window,c);if(!y)return;p?.stop({discard:!0}),b=!0,v=y;}catch(y){h(`The preview could not start. ${String(y)}`);}}function pe(c){return hn({apiBase:r(),token:o??"",nonce:c,sessionToken:g?.config()?.sessionToken??null,userTraits:i.attributes,fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch<"u"?fetch.bind(globalThis):null,setTimeoutImpl:e.setTimeoutImpl})}function W(){L=false,a?.unmount(),a=null,l?.destroy(),l=null,f?.destroy(),f=null,P=null,V=null,D=null,ye();}function ae(){try{a||G(),le(),ne(),l?.refreshChrome(),L&&(L=!1,re());}catch(c){h(`The chat bar could not render. ${String(c)}`);}}function le(){try{let c=a?.getHost();if(!a||!c)return;Yn(c,S),a.setGeometry({widthPercent:S.widthPercent??nt,bottomOffset:S.bottomOffset??et,collapsedWidth:S.collapsedWidth??rt}),a.setIconSize(S.barIconSize??tt);}catch(c){h(`The widget could not apply its theme. ${String(c)}`);}}function E(){let c=g?.config()?.widget,y=He(c)??I;if(!y)return null;let A=Le=>typeof Le=="string"?Le:"",x=c?.chrome&&typeof c.chrome=="object"&&!Array.isArray(c.chrome)?{...Qe,...c.chrome}:Qe,Y=c?.welcomeIconUrl,se=c?.chatBarIconUrl;return {name:y.name,logoUrl:y.logoUrl,welcomeIconUrl:typeof Y=="string"&&/^https:\/\//i.test(Y)?Y:null,chatBarIconUrl:typeof se=="string"&&/^https:\/\//i.test(se)?se:null,welcomeMessage:A(c?.welcomeMessage),inputPlaceholder:A(c?.inputPlaceholder),welcomeHeadline:A(c?.welcomeHeadline),allowImageUpload:c?.allowImageUpload===true,barDraggable:c?.barDraggable===true,privacyPolicyUrl:typeof c?.privacyPolicyUrl=="string"&&/^https:\/\//i.test(c.privacyPolicyUrl)?c.privacyPolicyUrl:null,chrome:x,locales:R(c?.locales),activeLocale:typeof c?.activeLocale=="string"?c.activeLocale:""}}function R(c){if(!Array.isArray(c))return [];let y=[];for(let A of c){if(!A||typeof A!="object")continue;let{code:x,label:Y}=A;typeof x!="string"||x.length===0||typeof Y!="string"||Y.length===0||y.push({code:x,label:Y});}return y}function G(){try{a=$n({geometry:{widthPercent:S.widthPercent??nt,bottomOffset:S.bottomOffset??et,collapsedWidth:S.collapsedWidth??rt},labels:me(),iconUrl:E()?.chatBarIconUrl??null,welcomeIconUrl:E()?.welcomeIconUrl??null,iconSize:S.barIconSize??tt,onActivate:()=>re(),onSubmit:c=>{if(K||re(),P){P(c);return}U=c;},onAttach:()=>{re();},onFiles:c=>{if(re(),V){V(c);return}D=c;},onDismiss:()=>{ye();},onStop:()=>{f?.stop(),Te();},onGeometryChange:()=>l?.reposition(),readPosition:()=>N?.read().position??null,onPositionChange:c=>N?.rememberPosition(c),readDocked:()=>N?.read().docked===!0,onDockedChange:c=>N?.rememberDocked(c),onUndock:()=>re()}),a.mount(),at();}catch(c){h(`The chat bar could not render. ${String(c)}`);}}function ne(){try{if(!a)return;let c=E();a.setLabels(me()),a.getMode()!=="flow"&&a.setPlaceholder(c?.inputPlaceholder??null),a.setAttachEnabled(c?.allowImageUpload===!0),a.setDraggable(c?.barDraggable===!0),a.setIcon(c?.chatBarIconUrl??null),a.setWelcomeIcon(c?.welcomeIconUrl??null);}catch(c){h(`The widget could not apply its texts. ${String(c)}`);}}function me(){let c=E()?.chrome??Qe;return {send:c.send,attachMenu:c.attachMenu,attachImage:c.attachImage,flowStop:c.flowStop,openChat:c.openChat,moveBar:c.moveBar,flowStep:c.flowStep}}let he=600,ge=4e3,ie=null,X=[],Ue=null;function Ve(c){let y=c.phase==="done"?ge:he;try{ie=setTimeout(()=>{for(ie=null;X.length>0;){let A=X.shift();if(Re(A),A!==null){Ve(A);return}}},y);}catch{}}function st(c){if(c===null){let y=Ue?.phase==="done"||X.some(A=>A?.phase==="done");if(ie!==null&&y){X[X.length-1]!==null&&X.push(null);return}Te();return}if(ie!==null){let y=X[X.length-1];if(c.phase!=="done"&&y!==void 0&&y!==null&&y.phase!=="done"){X[X.length-1]=c;return}X.push(c);return}Re(c),Ve(c);}function Te(){if(ie!==null){try{clearTimeout(ie);}catch{}ie=null;}X=[],Re(null);}function Re(c){Ue=c;try{if(c&&a?.setDocked(!1),a?.setFlow(c),c){ye();return}a?.setPlaceholder(E()?.inputPlaceholder??null);}catch(y){h(`The flow status could not be shown. ${String(y)}`);}}function at(){try{let c=a?.getRoot(),y=a?.getHost(),A=a;if(!c||!y||!A)return;l=En({root:c,host:y,loadChunk:t.loadChat,onRequestClose:()=>ye(),bar:{onSubmit:x=>{if(P=x,U!==null){let Y=U;U=null,x(Y);}},onFiles:x=>{if(V=x,D!==null){let Y=D;D=null,x(Y);}},setPlaceholder:x=>A.setPlaceholder(x),setDisabled:x=>A.setDisabled(x),setMode:x=>A.setMode(x),setFlow:x=>A.setFlow(x),setAwaitingInput:x=>A.setAwaitingInput(x),setDisclaimer:x=>A.setDisclaimer(x),setAttachEnabled:x=>A.setAttachEnabled(x),setAttachmentCount:x=>A.setAttachmentCount(x),attachmentSlot:()=>A.attachmentSlot(),focusInput:()=>A.focusInput(),getMetrics:()=>A.getMetrics(),dock:()=>A.setDocked(!0)},apiBase:r(),getSessionToken:()=>g?.config()?.sessionToken??null,getSessionId:()=>p?.sessionId(),getRoute:()=>typeof window<"u"?window.location.pathname:"",getMaxHeightPercent:()=>S.maxHeightPercent??void 0,onStartFlow:x=>{Pe(),f?.start(x);},onStopFlow:()=>{f?.stop(),Te();},publicKey:o??void 0,getConversationId:()=>w?.id()??null,setConversationId:x=>x===null?w?.startNew()??null:w?.adopt(x)??null,touchConversation:()=>w?.touch(),getVisitorId:()=>_,onOrgCapExceeded:()=>W(),track:(x,Y,se)=>{p?.track(x,se,Y);},getWidget:()=>E(),onSelectLocale:x=>{We(x);}});}catch(c){h(`The chat panel could not be prepared. ${String(c)}`);}}async function We(c){try{if(typeof c!="string"||c.length===0||N?.read().locale===c)return;N?.rememberLocale(c),await xe(),ne(),l?.refreshChrome();}catch(y){h(`The widget could not change its language. ${String(y)}`);}}function lt(){if(!o)return null;let c=g?.config()?.sessionToken;if(!c)return null;let y=T;return {apiBase:r(),token:o,sessionToken:c,sessionId:p?.sessionId(),getTrait:A=>{let x=i.attributes[A];if(!(x==null||Array.isArray(x)))return x},...y?{isFirstVisit:()=>y.isFirstVisit()}:{},promptFill:A=>(a?.setDocked(false),K=true,(l?.promptFill(A)??Promise.resolve(null)).finally(()=>{K=false;})),cancelFill:()=>{K=false,l?.cancelFill();},onFailure:()=>{d||re(),l?.showFlowFailure();},track:(A,x,Y)=>{p?.track(A,Y,x);},onStatus:A=>st(A),getBottomOcclusion:()=>{let A=a?.getMetrics();return A?A.bottomOffset+A.keyboardOffset+A.height:0}}}function Pe(){if(!f)try{let c=lt();if(!c)return;f=An({context:c,loadChunk:t.loadFlow});}catch(c){h(`The flow engine could not be prepared. ${String(c)}`);}}async function xe(){try{await dt();}catch(c){h(`The ARCY session could not be started. ${String(c)}`);}try{let c=g?.config();if(c){let y=(c.customization??{}).tokens;M?.remember(y,c.widget),S=Lt(y),I=He(c.widget)??I;}}catch(c){h(`The widget could not read its theme. ${String(c)}`);}if(b||(Pe(),f&&(b=true,f.resume())),v){let c=v;v=null,(async()=>{if(Pe(),!f)return;if(c.kind==="pending"){await f.resumePreview();return}let y=await pe(c.nonce);y&&await f.startPreview(y);})().catch(y=>h(`The preview could not run. ${String(y)}`));}ae();}function ct(){if(O!==void 0)return O;try{let c=typeof window<"u"?window.location.pathname:null;return typeof c!="string"||!c.startsWith("/")?void 0:(O=ke(c),O)}catch{return}}function ut(){if(z)return k;z=true;try{return typeof window>"u"?void 0:(k=tr({referrer:typeof document<"u"?document.referrer:null,search:window.location?.search??null,userAgent:typeof navigator<"u"?navigator.userAgent:null,viewportWidth:window.innerWidth}),k)}catch{return}}async function dt(){if(!g||!p)return;let c=++C,y=await g.sync({sessionId:p.sessionId(),route:ct(),sessionContext:ut(),visitorId:_??void 0,userId:i.isAnonymous?void 0:i.userId??void 0,userHash:i.isAnonymous?void 0:i.userHash,userTraits:Object.keys(i.attributes).length?i.attributes:void 0,uiLanguage:s.locale==="en"||s.locale==="tr"?s.locale:void 0,contentLocale:typeof s.contentLocale=="string"?s.contentLocale:void 0,viewerLocale:N?.read().locale??void 0});if(!y.ok){h("The ARCY session could not be started. The widget will keep working, and telemetry stays off until configuration arrives.");return}c===C&&(y.config.identityAccepted===false&&h("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));}async function ft(c,y,A){if(!B("identify"))return;if(typeof c!="string"||c.length===0){h("identify() needs a user id. Ignoring the call.");return}let x=Ht(y,"identify");if(x===null)return;let Y=ts((A??{}).userHash,"identify");if(!Y.ok)return;let se=i.userId===c&&!i.isAnonymous;i={userId:c,isAnonymous:false,attributes:se?{...i.attributes,...x}:x,userHash:se?Y.hash??i.userHash:Y.hash},await xe();}async function pt(c){if(!B("identifyAnonymous"))return;let y=Ht(c,"identifyAnonymous");y!==null&&(i={userId:null,isAnonymous:true,attributes:y},await xe());}async function ce(c){if(!B("updateUser"))return;if(!i.userId&&!i.isAnonymous){h("updateUser() was called before identify() or identifyAnonymous(). Ignoring the call.");return}let y=Ht(c,"updateUser");y!==null&&(i={...i,attributes:{...i.attributes,...y}},await xe());}function $e(){i=Sr(),N?.forgetAnonymousId(),_=N?.anonymousId()??null,p?.resetSession(),w?.reset(),ye();}function re(){if(B("open")){if(!a){L=true;return}d||(a?.setDocked(false),d=true,a?.setMode("open"),l?.open(),n.emit("open"));}}function ye(){d&&(d=false,a?.setMode("idle"),l?.close(),n.emit("close"));}function Ke(c,y){return n.on(c,y)}return {api:{init:fe,identify:ft,identifyAnonymous:pt,updateUser:ce,reset:$e,open:re,close:ye,on:Ke,VERSION:vr},getToken:()=>o,getOptions:()=>s,getIdentity:()=>i,isOpen:()=>d,getBar:()=>a,getChatController:()=>l,getFlowController:()=>f,getTelemetry:()=>p,getConfig:()=>g?.config()??null,selectLocale:We,getShellState:()=>N,getTokens:()=>S}}var Tr={cdnBase:_t,loadChat:(e,t,n)=>Sn(e,_t,t,n),loadFlow:(e,t,n)=>Cn(e,kn,t,n),loadPicker:(e,t,n)=>fn(e,dn,t,n)};function xr(e,t){let n=e.q;for(;n.length>0;){let r=n.shift();if(!r)break;let o=t[r.method];if(typeof o!="function"){r.resolve();continue}try{let s=o(...r.args);s&&typeof s.then=="function"?s.then(()=>r.resolve(),()=>r.resolve()):r.resolve();}catch{r.resolve();}}}var kr=Er(Tr);if(typeof window<"u"){let e=window.arcy;window.arcy=kr,e&&Array.isArray(e.q)&&xr(e,kr);}
|
|
568
|
+
})();
|