arcy.js 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arcy.flow.46ba8a96f99e.js +3 -0
- package/dist/{arcy.legacy.ba7330cb1ce9.js → arcy.legacy.98a48482777b.js} +2 -2
- package/dist/arcy.loader.js +1 -1
- package/dist/{arcy.modern.9d6d23d21370.js → arcy.modern.2c3fe0b458df.js} +2 -2
- package/dist/arcy.picker.777b2d4d1127.js +95 -0
- package/dist/{chunk-GDGE3HLE.js → chunk-7S5DA67F.js} +2 -2
- package/dist/{chunk-NY3NXM2V.js → chunk-AW7DHYSA.js} +1 -1
- package/dist/{chunk-NIHUDSWK.js → chunk-QDCO2MRA.js} +1 -1
- package/dist/design-mode.cjs +1 -1
- package/dist/design-mode.d.ts +9 -1
- package/dist/design-mode.js +2 -2
- package/dist/{flow-GATJGDCR.js → flow-FGTIZOXU.js} +37 -12
- package/dist/index.cjs +465 -87
- package/dist/index.d.ts +21 -6
- package/dist/index.js +15 -11
- package/dist/{picker-GPZ2GHB4.js → picker-6REZLJW3.js} +417 -69
- package/package.json +1 -1
- package/dist/arcy.flow.bc28949c2a72.js +0 -3
- package/dist/arcy.picker.b7e531503cf2.js +0 -59
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(function(){'use strict';/* arcy.js — https://arcyai.com */
|
|
2
|
+
function I(t){if(t.parentElement!==null)return t.parentElement;let e=t.parentNode;return e!==null&&"host"in e?e.host:null}function nt(t,e){let n=e;for(;n!==null;){if(n===t)return true;n=I(n);}return false}var rt=100;function S(t,e=0){let n=[],r=t.querySelectorAll("*");for(let o=0;o<r.length;o+=1){let i=r[o];n.push(i),i.shadowRoot!==null&&e<rt&&n.push(...S(i.shadowRoot,e+1));}return n}function H(t,e,n=0){let r=Array.from(t.querySelectorAll(e)),o=t.querySelectorAll("*");for(let i=0;i<o.length;i+=1){let s=o[i];s.shadowRoot!==null&&n<rt&&r.push(...H(s.shadowRoot,e,n+1));}return r}var ot=[/[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],x="[masked]";function W(t){return ot.some(e=>(e.lastIndex=0,e.test(t)))}var V=4096,Lt=100,Nt=64;function k(t){if(!t)return;let e=t.slice(0,V);if(t.length>V){let r=e.search(/\s\S*$/);e=r===-1?e.slice(0,V-Lt):e.slice(0,r);}let n=e.replace(/\s+/g," ").trim();if(n){for(let r of ot)n=n.replace(r,x);return n.slice(0,80)}}function it(t){return !(t.length===0||t.length>64||t.includes(":")||t.startsWith("radix-")||/^\d+$/.test(t)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t))}var Mt=new Set(["button","input","select","textarea","label","summary"]),Pt=new Set(["button","link","menuitem","tab","option"]);function R(t){let e=t.tagName.toLowerCase();if(Mt.has(e)||e==="a"&&t.hasAttribute("href"))return true;let n=t.getAttribute("role");if(n!==null&&Pt.has(n))return true;let r=t.getAttribute("contenteditable");return r===""||r==="true"}var Ot=["data-testid","data-test","data-cy","id","name","aria-label"],Dt=["data-testid","data-test","data-cy"],Ht=64;function Vt(t){for(let e of Dt){let n=t.getAttribute(e);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>Ht)&&!W(r))return r}}var Wt=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function Kt(t){let e=I(t);for(;e!==null;){let n=e.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let o of Ot){let i=e.getAttribute(o);if(i===null||o==="id"&&!it(i))continue;let s=k(i);if(s!==void 0)return {tag:n,attr:o,value:s}}let r=e.getAttribute("role");if(r!==null&&Wt.has(r))return {tag:n,attr:"role",value:r};e=I(e);}}function $t(t){let e=0,n=t.previousElementSibling;for(;n!==null;)n.tagName===t.tagName&&(e+=1),n=n.previousElementSibling;return e}function C(t){let e={tag:t.tagName.toLowerCase(),siblingIndex:$t(t)},n=k(t.textContent);n!==void 0&&(e.text=n);let r=k(t.getAttribute("aria-label"));r!==void 0&&(e.ariaLabel=r);let o=k(t.getAttribute("placeholder"));o!==void 0&&(e.placeholder=o);let i=t.getAttribute("id");i!==null&&it(i)&&!W(i)&&(e.id=i);let s=t.getAttribute("role");if(s!==null){let u=s.trim();u!==""&&u.length<=Nt&&!W(u)&&(e.role=u);}let l=Vt(t);l!==void 0&&(e.testId=l);let a=Kt(t);return a!==void 0&&(e.ancestorTag=a.tag,e.ancestorAttr=a.attr,e.ancestorValue=a.value),e}function jt(t){return t.getClientRects().length>0}var Bt=50,Ut=40,Gt=10,Xt=15,Jt=15,Yt=10,zt=10,qt=10,Zt=5,Qt=5,te=.6,ee=.7,ne={1:.3,2:.45,3:.6,4:.75,5:.9};function A(t){return t.split(x).join(" ").replace(/\s+/g," ").trim()}function re(t,e){if(e===void 0)return 0;let n=A(t),r=A(e);return n===""||r===""?0:r===n?1:r.includes(n)||n.includes(r)?te:0}function T(t,e){return e===t?1:0}function K(t){return t.includes(x)&&A(t)===""}function oe(t,e,n){let r=0,o=0,i=(s,l)=>{r+=s,o+=s*l;};if(t.testId!==void 0&&i(Bt,T(t.testId,e.testId)),t.text!==void 0&&A(t.text)!==""&&i(n?Gt:Ut,re(t.text,e.text)),t.ariaLabel!==void 0&&!K(t.ariaLabel)&&i(Xt,T(t.ariaLabel,e.ariaLabel)),t.placeholder!==void 0&&!K(t.placeholder)&&i(zt,T(t.placeholder,e.placeholder)),t.id!==void 0&&i(Jt,T(t.id,e.id)),t.role!==void 0&&i(Zt,T(t.role,e.role)),i(Yt,e.tag===t.tag?1:0),i(Qt,e.siblingIndex===t.siblingIndex?1:0),t.ancestorAttr!==void 0&&t.ancestorValue!==void 0&&!K(t.ancestorValue)){let s=0;e.ancestorAttr===t.ancestorAttr&&e.ancestorValue===t.ancestorValue&&(s=e.ancestorTag===t.ancestorTag?1:ee),i(qt,s);}return r===0?0:o/r}function ie(t,e){if(t.selector===null)return null;try{return H(e,t.selector)}catch{return null}}function se(t,e){let n=t.core.tag,r=[];for(let o of S(e))(o.tagName.toLowerCase()===n||R(o))&&r.push(o);return r}function st(t,e){if(e.length===0)return {status:"not_found",reason:"no_candidates",matchCount:0};let n=ne[t.precision],r=false,o=[];for(let s of e){if(!jt(s))continue;r=true;let l=oe(t.core,C(s),t.dynamicText);l>=n&&o.push({element:s,score:l});}if(o=o.filter((s,l)=>{let a=o[l+1];return a===void 0?true:!(nt(s.element,a.element)&&s.score<=a.score)}),o.length===0)return {status:"not_found",reason:r?"below_threshold":"not_visible",matchCount:0};let i=t.ordinal>=1?o[t.ordinal-1]:void 0;return i===void 0?{status:"not_found",reason:"ordinal_out_of_range",matchCount:o.length}:{status:"matched",element:i.element,score:i.score,matchCount:o.length}}function g(t,e){try{let n=ie(t,e);if(n!==null&&n.length>0){let r=st(t,n);if(r.status==="matched"||r.reason==="ordinal_out_of_range")return r}return st(t,se(t,e))}catch{return {status:"not_found",reason:"error",matchCount:0}}}var le=40;function lt(t=document){try{let e=S(t),n=[];for(let r of e){if(n.length>=le)break;R(r)&&n.push(C(r));}return n}catch{return []}}var $={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function y(t){return t?{getItem(e){try{return t.getItem(e)}catch{return null}},setItem(e,n){try{t.setItem(e,n);}catch{}},removeItem(e){try{t.removeItem(e);}catch{}}}:$}function at(){try{let t=globalThis.localStorage;return y(t)}catch{return $}}function ut(){try{let t=globalThis.sessionStorage;return y(t)}catch{return $}}function L(t,e){let n=t.getItem(e);if(!n)return null;try{let r=JSON.parse(n);return !r||typeof r!="object"||Array.isArray(r)?null:r}catch{return null}}function N(t,e,n){try{t.setItem(e,JSON.stringify(n));}catch{}}var ae=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function j(t){let e=typeof globalThis<"u"?globalThis.crypto:void 0;if(e&&typeof e.randomUUID=="function")try{let o=e.randomUUID();if(ae.test(o))return o}catch{}let n=new Uint8Array(16);if(e&&typeof e.getRandomValues=="function")e.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)}`}var ue=3,ce=["attribute","current_page","element","text_input","user_fills_input","current_time","user_idle","visitor","always_true","group"];function v(t){if(!t||typeof t!="object")return false;let e=t;return e.v===1&&!!e.core&&typeof e.core=="object"&&typeof e.core.tag=="string"&&(e.selector===null||typeof e.selector=="string")&&typeof e.ordinal=="number"&&typeof e.precision=="number"}function ht(t,e){if(e>ue||!t||typeof t!="object")return null;let n=t,r=n.type;if(typeof r!="string"||!ce.includes(r))return null;switch(r){case "attribute":return typeof n.codeName!="string"||typeof n.operator!="string"?null:{type:"attribute",codeName:n.codeName,operator:n.operator,value:n.value};case "current_page":return !Array.isArray(n.matches)||!Array.isArray(n.doesNotMatch)?null:{type:"current_page",matches:n.matches.filter(o=>typeof o=="string"),doesNotMatch:n.doesNotMatch.filter(o=>typeof o=="string")};case "element":return !v(n.target)||typeof n.state!="string"?null:{type:"element",target:n.target,state:n.state};case "text_input":return !v(n.target)||typeof n.operator!="string"||typeof n.value!="string"?null:{type:"text_input",target:n.target,operator:n.operator,value:n.value};case "user_fills_input":return v(n.target)?{type:"user_fills_input",target:n.target}:null;case "current_time":{let o=n.from,i=n.to;return o!==null&&typeof o!="string"||i!==null&&typeof i!="string"?null:{type:"current_time",from:o??null,to:i??null}}case "user_idle":{let o=n.seconds;return typeof o!="number"||!Number.isFinite(o)||o<1||o>600?null:{type:"user_idle",seconds:o}}case "visitor":return n.state!=="first_visit"&&n.state!=="returning"?null:{type:"visitor",state:n.state};case "always_true":return {type:"always_true"};case "group":{if(!Array.isArray(n.children)||n.operator!=="and"&&n.operator!=="or")return null;let o=[];for(let i of n.children){let s=ht(i,e+1);s&&o.push(s);}return {type:"group",operator:n.operator,children:o}}default:return null}}function gt(t){if(!t||typeof t!="object")return null;let e=t;if(e.v!==1)return null;let n=ht(e.node,0);return n?{v:1,node:n}:null}function ct(t){let e=/^(\d{2}):(\d{2})$/.exec(t);if(!e)return null;let n=Number(e[1]),r=Number(e[2]);return n>23||r>59?null:n*60+r}function de(t,e){if(t.from===null&&t.to===null)return true;let n=e.getHours()*60+e.getMinutes(),r=t.from!==null?ct(t.from):null,o=t.to!==null?ct(t.to):null;return t.from!==null&&r===null||t.to!==null&&o===null?false:r!==null&&o===null?n>=r:r===null&&o!==null?n<=o:r!==null&&o!==null?r<=o?n>=r&&n<=o:n>=r||n<=o:true}function B(t,e){let n=t.split("*").map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");try{return new RegExp(`^${n}$`).test(e)}catch{return false}}function fe(t,e){return t.doesNotMatch.some(n=>B(n,e))?false:t.matches.length===0?true:t.matches.some(n=>B(n,e))}var pe=/^\d{4}-\d{2}-\d{2}/;function dt(t){if(!pe.test(t))return null;let e=new Date(t).getTime();return Number.isFinite(e)?e:null}function me(t,e){if(t.trim()===""||e.trim()==="")return null;let n=Number(t),r=Number(e);if(Number.isFinite(n)&&Number.isFinite(r))return n-r;let o=dt(t),i=dt(e);return o!==null&&i!==null?o-i:null}function wt(t,e,n){if(e===void 0)return false;switch(t){case "is":return e===n;case "is_not":return e!==n;case "contains":return e.includes(n);case "does_not_contain":return !e.includes(n);case "starts_with":return e.startsWith(n);case "ends_with":return e.endsWith(n);case "is_empty":return e==="";case "is_not_empty":return e!=="";case "greater_than":case "less_than":{let r=me(e,n);return r===null?false:t==="greater_than"?r>0:r<0}case "matches_pattern":return B(n,e);default:return false}}function ft(t,e){try{if(t.getClientRects().length===0)return !1}catch{return false}try{let n=e.defaultView?.getComputedStyle(t);if(n&&n.visibility==="hidden")return !1}catch{}return true}function pt(t,e){try{let n=e.activeElement;for(;n;){if(n===t||t.contains(n))return !0;n=n.shadowRoot?.activeElement??null;}}catch{}return false}function he(t,e){let n=g(t.target,e.doc);switch(t.state){case "is_present":return n.status==="matched";case "is_not_present":return n.status==="not_found";case "is_disabled":case "is_not_disabled":{if(n.status!=="matched")return false;let r="disabled"in n.element&&n.element.disabled===true;return t.state==="is_disabled"?r:!r}case "is_clicked":return e.wasClicked(t.target);case "is_not_clicked":return !e.wasClicked(t.target);case "is_visible":return n.status==="matched"&&ft(n.element,e.doc);case "is_not_visible":return n.status!=="matched"||!ft(n.element,e.doc);case "is_checked":case "is_not_checked":{if(n.status!=="matched")return false;let r="checked"in n.element&&n.element.checked===true;return t.state==="is_checked"?r:!r}case "is_focused":return n.status==="matched"&&pt(n.element,e.doc);case "is_not_focused":return n.status!=="matched"||!pt(n.element,e.doc);default:return false}}function mt(t){return t==null||t===""?true:Array.isArray(t)?t.length===0:typeof t=="object"?Object.keys(t).length===0:false}function ge(t,e){let n=e.getTrait?.(t.codeName);switch(t.operator){case "has_any_value":return !mt(n);case "is_empty":return mt(n);}if(n===void 0||typeof n=="object")return false;let r=String(n),o=t.value===void 0?"":String(t.value);return wt(t.operator,r,o)}function M(t,e){switch(t.type){case "always_true":return true;case "current_time":return de(t,e.now());case "current_page":return fe(t,e.href());case "element":return he(t,e);case "attribute":return ge(t,e);case "text_input":{let n=e.readInputValue(t.target);return wt(t.operator,n,t.value)}case "user_fills_input":{let n=e.readInputValue(t.target),r=e.initialInputValue(t.target);return n!==void 0&&n!==""&&n!==r}case "user_idle":{let n=e.idleSeconds?.();return n!==void 0&&n>=t.seconds}case "visitor":{let n=e.isFirstVisit?.();return n===void 0?false:t.state==="first_visit"?n:!n}case "group":return t.children.length===0?false:t.operator==="and"?t.children.every(n=>M(n,e)):t.children.some(n=>M(n,e));default:return false}}function U(t){return t.type==="current_time"||t.type==="user_idle"?true:t.type==="group"?t.children.some(U):false}function G(t){return t.type==="user_idle"?true:t.type==="group"?t.children.some(G):false}var we="https://api.arcyai.com";var ye="/api/v1/sdk/flows";function ve(t){return t!==void 0?t:typeof fetch<"u"?fetch.bind(globalThis):null}function be(t,e,n,r){return new Promise(o=>{let i=false,s=l=>{i||(i=true,o(l));};t.then(s,()=>s(r));try{n(()=>s(r),e);}catch{}})}function Se(t){return !t||typeof t!="object"||Array.isArray(t)?null:P(t.flow)}function P(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;return typeof e.cvid!="string"||!Array.isArray(e.steps)?null:t}function Te(t){return {"Content-Type":"application/json",Authorization:`Bearer ${t}`}}async function yt(t,e){let{apiBase:n=we,sessionToken:r,sessionId:o,setTimeoutImpl:i=(u,p)=>setTimeout(u,p),timeoutMs:s=8e3}=e,l=ve(e.fetchImpl);if(!l)return {ok:false,reason:"unusable"};let a=(async()=>{let u;try{u=await l(`${n}${ye}/${encodeURIComponent(t)}/run`,{method:"POST",headers:Te(r),body:JSON.stringify(o?{sessionId:o}:{}),credentials:"omit"});}catch{return {ok:false,reason:"network"}}if(u.status===404)return {ok:false,reason:"not_found"};if(!u.ok)return {ok:false,reason:"rejected"};let p;try{p=await u.json();}catch{return {ok:false,reason:"unusable"}}let f=Se(p);return f?{ok:true,flow:f}:{ok:false,reason:"unusable"}})();return be(a,s,i,{ok:false,reason:"network"})}var Ee="arcy.flow.";function _e(t){return typeof t.flowId=="string"&&t.flowId.length>0&&typeof t.currentStepCvid=="string"&&t.currentStepCvid.length>0&&typeof t.flowSessionId=="string"&&t.flowSessionId.length>0&&typeof t.startedAt=="number"}function vt(t,{store:e=at()}={}){let n=y(e),r=Ee+t;return {read(){let o=L(n,r);return !o||!_e(o)?null:{flowId:o.flowId,currentStepCvid:o.currentStepCvid,flowSessionId:o.flowSessionId,startedAt:o.startedAt}},save(o){N(n,r,o);},clear(){n.removeItem(r);}}}var Fe="arcy.preview.";function Ie(t){return typeof t.flowId=="string"&&t.flowId.length>0&&typeof t.currentStepCvid=="string"&&t.currentStepCvid.length>0&&typeof t.flowSessionId=="string"&&t.flowSessionId.length>0&&typeof t.startedAt=="number"&&t.flow!==void 0&&t.flow!==null}function X(t,{store:e=ut()}={}){let n=y(e),r=Fe+t;return {read(){let o=L(n,r);return !o||!Ie(o)?null:o},save(o){N(n,r,o);},clear(){n.removeItem(r);}}}var ke=250,xe=15e3,Re=1e3,Ce=["pointerdown","pointermove","keydown","wheel","scroll","touchstart"],J=250,Ae=3e3,Le=250,Y=()=>{},Ne=()=>Promise.resolve({status:"wait"});function z(t,e){return t.steps.findIndex(n=>n.cvid===e)}function St(t){return t?t.type==="element"?[t.target]:t.type==="group"?t.children.flatMap(e=>St(e)):[]:[]}var q=class{constructor(e,n,r,o,i,s,l,a,u,p,f,w,h,D,b,d){this.flow=e;this.stepIndex=n;this.startedAt=r;this.flowSessionId=o;this.doc=i;this.win=s;this.runState=l;this.executor=a;this.getTrait=u;this.isFirstVisit=p;this.track=f;this.now=w;this.setTimeoutImpl=h;this.clearTimeoutImpl=D;this.setIntervalImpl=b;this.clearIntervalImpl=d;this.stopped=false;this.dwellTimer=null;this.observer=null;this.intervalHandle=null;this.throttleHandle=null;this.lastCheck=0;this.trueSince=new Map;this.clicked=new Set;this.initialValues=new Map;this.clickListener=null;this.lastActivityAt=0;this.activityListeners=[];this.inputPending=false;this.actionPending=false;this.inputListeners=[];this.parsedTriggers=new Map;this.lastStopReason=null;this.onStatus=null;this.onFailure=null;this.onCancelFill=null;}resolveElement(e,n=0){return g(e,this.doc)}waitForElement(e){let n=()=>{let l=g(e,this.doc),a=l.status==="matched"&&l.element.isConnected;return {result:l,found:a}},r=n(),o=Math.max(0,this.flow.waitSeconds*1e3);if(r.found||o===0)return Promise.resolve(r.result);let i=this.stepIndex,s=this.now()+o;return new Promise(l=>{let a=()=>{let u=n();if(u.found||this.stopped||this.stepIndex!==i||this.now()>=s){l(u.result);return}this.setTimeoutImpl(a,J);};this.setTimeoutImpl(a,J);})}conditionContext(){return {doc:this.doc,now:()=>new Date(this.now()),href:()=>this.win.location?.href??"",getTrait:this.getTrait,idleSeconds:()=>Math.max(0,(this.now()-this.lastActivityAt)/1e3),isFirstVisit:this.isFirstVisit,wasClicked:e=>this.clicked.has(e),readInputValue:e=>{let n=g(e,this.doc);if(n.status!=="matched")return;let r=n.element;return typeof r.value=="string"?r.value:void 0},initialInputValue:e=>{if(!this.initialValues.has(e)){let n=g(e,this.doc),r=n.status==="matched"?n.element:null;this.initialValues.set(e,r&&typeof r.value=="string"?r.value:void 0);}return this.initialValues.get(e)}}}currentStep(){return this.flow.steps[this.stepIndex]}persist(){let e=this.currentStep();e&&this.runState.save({flowId:this.flow.cvid,currentStepCvid:e.cvid,flowSessionId:this.flowSessionId,startedAt:this.startedAt});}teardownWatch(){if(this.observer?.disconnect(),this.observer=null,this.intervalHandle!==null&&(this.clearIntervalImpl(this.intervalHandle),this.intervalHandle=null),this.throttleHandle!==null&&(this.clearTimeoutImpl(this.throttleHandle),this.throttleHandle=null),this.dwellTimer!==null&&(this.clearTimeoutImpl(this.dwellTimer),this.dwellTimer=null),this.clickListener){try{this.doc.removeEventListener("click",this.clickListener,!0);}catch{}this.clickListener=null;}for(let[e,n]of this.inputListeners)try{this.doc.removeEventListener(e,n,!0);}catch{}this.inputListeners=[];for(let[e,n]of this.activityListeners)try{this.doc.removeEventListener(e,n,!0);}catch{}this.activityListeners=[],this.inputPending=false,this.actionPending=false,this.trueSince.clear(),this.clicked.clear(),this.initialValues.clear();}jumpTo(e){let n=z(this.flow,e);if(n===-1){this.finish("error",{reason:"step_not_found"});return}this.stopStep(),this.stepIndex=n,this.persist(),this.enterStep();}emitStatus(e){try{this.onStatus?.(e);}catch{}}dismiss(){this.stopped||this.finish("dismissed");}emit(e,n){try{this.track(e,{flowId:this.flow.cvid,flowSessionId:this.flowSessionId,stepCvid:this.currentStep()?.cvid},n);}catch{}}finish(e,n){this.lastStopReason=e;let r=e==="completed"?"flow_completed":e==="dismissed"?"flow_abandoned":"flow_error";this.emit(r,n);try{this.onCancelFill?.();}catch{}if(this.stopStep(),this.stopped=true,this.runState.clear(),e==="completed"&&this.emitStatus({name:this.flow.publicName??this.flow.name,step:this.flow.steps.length,total:this.flow.steps.length,phase:"done"}),this.emitStatus(null),e==="error")try{this.onFailure?.();}catch{}}stopStep(){this.teardownWatch();}fireTrigger(e){if(e.actionType==="dismiss_flow"){this.finish("dismissed");return}e.actionType==="go_to_step"&&e.targetStepCvid&&this.jumpTo(e.targetStepCvid);}parsedTrigger(e){return this.parsedTriggers.has(e.cvid)||this.parsedTriggers.set(e.cvid,gt(e.condition)),this.parsedTriggers.get(e.cvid)??null}checkTriggers(e,n){if(this.stopped)return;let r=!this.inputPending&&!this.actionPending,o=this.now();for(let i of [...e.triggers].sort((s,l)=>s.position-l.position)){let s=this.parsedTrigger(i);if(!s)continue;let l=M(s.node,n),a=i.cvid;if(!l){this.trueSince.delete(a);continue}let u=this.trueSince.get(a)??o;this.trueSince.has(a)||this.trueSince.set(a,u);let p=(i.waitSeconds??0)*1e3;if(o-u>=p&&r){this.fireTrigger(i);return}}}scheduleCheck(e){if(this.stopped||this.throttleHandle!==null)return;let n=Math.max(0,ke-(this.now()-this.lastCheck));this.throttleHandle=this.setTimeoutImpl(()=>{this.throttleHandle=null,this.lastCheck=this.now(),this.checkTriggers(e,this.conditionContext());},n);}startWatch(e){let n=e.triggers.some(o=>{let i=this.parsedTrigger(o);return i?U(i.node):false}),r=e.triggers.some(o=>{let i=this.parsedTrigger(o);return i?G(i.node):false});if(this.lastActivityAt=this.now(),typeof MutationObserver=="function")try{this.observer=new MutationObserver(()=>this.scheduleCheck(e)),this.observer.observe(this.doc.documentElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0});}catch{}if(n)try{this.intervalHandle=this.setIntervalImpl(()=>this.scheduleCheck(e),r?Re:xe);}catch{}if(r)for(let o of Ce){let i=()=>{this.lastActivityAt=this.now();};try{this.doc.addEventListener(o,i,{capture:!0,passive:!0}),this.activityListeners.push([o,i]);}catch{}}this.clickListener=o=>{for(let i of e.triggers){let s=this.parsedTrigger(i),l=St(s?.node);for(let a of l){let u=g(a,this.doc);u.status==="matched"&&o.target instanceof Node&&(u.element===o.target||u.element.contains(o.target))&&this.clicked.add(a);}}this.scheduleCheck(e);};try{this.doc.addEventListener("click",this.clickListener,!0);}catch{this.clickListener=null;}for(let o of ["input","change","focusin","focusout"]){let i=()=>this.scheduleCheck(e);try{this.doc.addEventListener(o,i,!0),this.inputListeners.push([o,i]);}catch{}}this.checkTriggers(e,this.conditionContext());}async runExecutor(e,n){try{let r=await this.executor(e,{doc:this.doc,win:this.win,resolveElement:(o,i)=>this.resolveElement(o,i),waitForElement:o=>this.waitForElement(o),setInputPending:o=>{this.inputPending=o;}});if(this.stopped||this.stepIndex!==n)return;if(this.actionPending=!1,r.status==="advance"){if(this.emit("flow_step_completed"),e.isCompletion){this.finish("completed");return}let o=this.stepIndex+1;if(o>=this.flow.steps.length){this.finish("completed");return}this.stopStep(),this.stepIndex=o,this.persist(),this.enterStep();return}if(r.status==="navigated"){if(this.emit("flow_step_completed"),r.navigateTarget==="new_tab"){this.finish("completed");return}if(this.stopStep(),e.isCompletion){this.finish("completed");return}let o=this.stepIndex+1;if(o>=this.flow.steps.length){this.finish("completed");return}this.stepIndex=o,this.persist();return}if(r.status==="error"){this.finish("error",r.reason==="element_not_found"?{reason:r.reason,liveManifest:lt(this.doc)}:{reason:r.reason});return}this.scheduleCheck(e);}catch{this.actionPending=false;}}enterStep(){let e=this.currentStep(),n=this.stepIndex;if(!e||this.stopped){this.finish(e?"completed":"error",e?void 0:{reason:"missing_step"});return}this.persist(),this.emit("flow_step_entered"),this.emitStatus({name:this.flow.publicName??this.flow.name,step:this.stepIndex+1,total:this.flow.steps.length,phase:"running"});let r=()=>{this.stopped||(this.actionPending=true,this.startWatch(e),this.runExecutor(e,n));};this.waitForPageReady(r);}waitForPageReady(e){let n=this.now()+Ae,r=()=>{this.dwellTimer=this.setTimeoutImpl(()=>{this.dwellTimer=null,e();},Le);},o=()=>{if(!this.stopped){if(this.doc.readyState!=="loading"||this.now()>=n){r();return}this.dwellTimer=this.setTimeoutImpl(()=>{this.dwellTimer=null,o();},J);}};o();}begin(){this.enterStep();}stop(){if(!this.stopped){try{this.onCancelFill?.();}catch{}this.stopStep(),this.stopped=true;}}};function Tt(t){let{context:e,executor:n=Ne,track:r=e.track??Y,now:o=()=>Date.now(),setTimeoutImpl:i=(d,c)=>setTimeout(d,c),clearTimeoutImpl:s=d=>clearTimeout(d),setIntervalImpl:l=(d,c)=>setInterval(d,c),clearIntervalImpl:a=d=>clearInterval(d)}=t,u=e.doc??document,p=e.win??window,f=vt(e.token),w={apiBase:e.apiBase,sessionToken:e.sessionToken,sessionId:e.sessionId},h=null;async function D(d){let c=await yt(d,w);return c.ok?c.flow:null}function b(d,c,m,F,et={}){h?.stop(),h=new q(d,c,m,F,u,p,et.runState??f,n,e.getTrait,e.isFirstVisit,et.track??r,o,i,s,l,a),h.onStatus=At=>e.onStatus?.(At),h.onFailure=()=>e.onFailure?.(),h.onCancelFill=()=>e.cancelFill?.(),h.begin();}return {async start(d){let c=await D(d);if(!c||c.steps.length===0)return;let m=j();try{r("flow_started",{flowId:c.cvid,flowSessionId:m});}catch{}b(c,0,o(),m);},async resume(){let d=f.read();if(!d)return false;let c=await D(d.flowId);if(!c||c.steps.length===0)return f.clear(),false;let m=z(c,d.currentStepCvid);return m===-1?(f.clear(),false):(b(c,m,d.startedAt,d.flowSessionId),true)},stop(){h?.dismiss(),h=null;},async startPreview(d){let c=P(d);if(!c||c.steps.length===0)return;let m=X(e.token);b(c,0,o(),j(),{runState:bt(m,d),track:Y});},async resumePreview(){let d=X(e.token),c=d.read();if(!c)return false;let m=P(c.flow);if(!m||m.steps.length===0)return d.clear(),false;let F=z(m,c.currentStepCvid);return F===-1?(d.clear(),false):(b(m,F,c.startedAt,c.flowSessionId,{runState:bt(d,c.flow),track:Y}),true)},destroy(){h?.stop(),h=null;}}}function bt(t,e){return {read:()=>null,save:n=>t.save({...n,flow:e}),clear:()=>t.clear()}}var Me=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Pe=/^\d{4}-\d{2}-\d{2}$/,Oe=/^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/,De=/^\d{4}-\d{2}-\d{2}T([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/,He=/^\d{4}-\d{2}$/,Ve=/^\d{4}-W\d{2}$/,We=/^\+?[\d\s().-]{3,}$/;function Ke(t){let e=Date.parse(t);return Number.isFinite(e)}function $e(t,e){if(e.min!==null){let n=Number(e.min);if(Number.isFinite(n)&&t<n)return "number_too_small"}if(e.max!==null){let n=Number(e.max);if(Number.isFinite(n)&&t>n)return "number_too_large"}return null}function Z(t){return /^\d:/.test(t)?`0${t}`:t}function E(t,e){return e.min!==null&&e.min.length>0&&t<e.min?"date_too_early":e.max!==null&&e.max.length>0&&t>e.max?"date_too_late":null}function Et(t,e){let n=e.kind==="password"?t:t.trim();if(n.length===0)return e.required?"required":null;if(e.maxLength!==null&&n.length>e.maxLength)return "too_long";switch(e.kind){case "number":case "range":{let r=Number(n);return Number.isFinite(r)?$e(r,e):"invalid_number"}case "email":return Me.test(n)?null:"invalid_email";case "url":try{let r=new URL(n);return r.protocol==="http:"||r.protocol==="https:"?null:"invalid_url"}catch{return "invalid_url"}case "tel":return We.test(n)?null:"invalid";case "date":return !Pe.test(n)||!Ke(n)?"invalid_date":E(n,e);case "datetime":return De.test(n)?E(n,e):"invalid_date";case "month":return He.test(n)?E(n,e):"invalid_date";case "week":return Ve.test(n)?E(n,e):"invalid_date";case "time":return Oe.test(n)?E(Z(n),{...e,min:e.min!==null?Z(e.min):null,max:e.max!==null?Z(e.max):null}):"invalid_time";case "select":case "radio":return (e.options??[]).some(o=>o.value===n)?null:"invalid_option";case "checkbox":return n==="true"||n==="false"?null:"invalid_option";default:{if(e.pattern)try{if(!new RegExp(`^(?:${e.pattern})$`).test(n))return "invalid"}catch{}return null}}}function _t(t,e){if(!e||e.length===0)return t;let n=t.trim();if(e.some(i=>i.value===n))return n;let r=n.toLowerCase(),o=e.find(i=>i.label.trim().toLowerCase()===r);return o?o.value:t}var Q=24;function je(t,e,n){let r=e-Math.max(0,n);if(!(e>0)||r<=0)return 0;if(t.bottom>r){let o=t.bottom-r+Q,i=Math.max(0,t.top-Q);return Math.min(o,i)}return t.top<0?t.top-Q:0}function kt(t,e,n){try{let r=n.getBottomOcclusion?.()??0,o=t.getBoundingClientRect(),i=e.doc.documentElement?.clientHeight||e.win.innerHeight||0,s=je(o,i,r);if(s===0)return;e.win.scrollBy({top:s,behavior:"smooth"});}catch{}}function tt(t,e){let r=e.defaultView?.PointerEvent,o=(()=>{try{return t.getBoundingClientRect()}catch{return null}})(),i={bubbles:true,cancelable:true,clientX:o?o.left+o.width/2:0,clientY:o?o.top+o.height/2:0},s=a=>{try{typeof r=="function"&&t.dispatchEvent(new r(a,{...i,pointerType:"mouse"}));}catch{}},l=a=>{try{t.dispatchEvent(new MouseEvent(a,i));}catch{}};s("pointerover"),s("pointerenter"),s("pointerdown"),l("mousedown");try{typeof t.focus=="function"&&t.focus();}catch{}s("pointerup"),l("mouseup"),l("click");}function Be(t,e){let n=t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:t instanceof HTMLInputElement?HTMLInputElement.prototype:t instanceof HTMLSelectElement?HTMLSelectElement.prototype:null;if(!n)return false;let o=Object.getOwnPropertyDescriptor(n,"value")?.set;if(!o)return false;try{return o.call(t,e),!0}catch{return false}}function O(t,e){let n=e.defaultView;try{t.dispatchEvent(new(n?.Event??Event)("input",{bubbles:!0}));}catch{}try{t.dispatchEvent(new(n?.Event??Event)("change",{bubbles:!0}));}catch{}}async function Ue(t,e,n){if(!v(t.target))return {status:"error",reason:"invalid_target"};let r=await e.waitForElement(t.target);if(r.status!=="matched"||!r.element.isConnected)return {status:"error",reason:"element_not_found"};kt(r.element,e,n);try{tt(r.element,e.doc);}catch{return {status:"error",reason:"dispatch_failed"}}return {status:"advance"}}var Ge=["text","number","email","date","url","tel"];function Ft(t){return Ge.includes(t)?t:null}var Xe={text:"text",search:"text",number:"number",email:"email",url:"url",tel:"tel",password:"password",date:"date",time:"time","datetime-local":"datetime",month:"month",week:"week",checkbox:"checkbox",radio:"radio",range:"range"};function _(t,e){try{let n=t.getAttribute(e);return n===null||n===""?null:n}catch{return null}}function Je(t){let e=[];for(let n=0;n<t.options.length;n+=1){let r=t.options[n];if(!r||r.disabled)continue;let o=(r.label||r.textContent||"").trim();r.value!==""&&e.push({value:r.value,label:o||r.value});}return e}function Ye(t,e){let n=t.getAttribute("name"),r=t.form??e,o=[];if(n)try{let i=`input[type="radio"][name="${CSS.escape(n)}"]`;r.querySelectorAll(i).forEach(s=>{s instanceof HTMLInputElement&&o.push(s);});}catch{}return o.length===0&&o.push(t),o.map(i=>({value:i.value,label:ze(i)||i.value}))}function xt(t){try{let e=t.labels;if(e&&e.length>0)return (e[0]?.textContent??"").trim()}catch{}try{let e=t.closest("label");if(e)return (e.textContent??"").trim()}catch{}return ""}function ze(t){return xt(t)}function It(t,e,n){let r="custom",o=null,i=false,s=null,l=null,a=null,u=null,p=null;if(t instanceof HTMLSelectElement)r="select",o=Je(t),i=t.required||!t.querySelector('option[value=""]');else if(t instanceof HTMLTextAreaElement)r="textarea",i=t.required,t.maxLength>0&&(u=t.maxLength);else if(t instanceof HTMLInputElement){let f=(_(t,"type")??"text").toLowerCase();r=Xe[f]??"text",i=t.required,s=_(t,"min"),l=_(t,"max"),a=_(t,"step"),p=_(t,"pattern"),t.maxLength>0&&(u=t.maxLength),r==="radio"&&(o=Ye(t,n)),r==="checkbox"&&(o=[{value:"true",label:xt(t)}]);}return e&&e!=="text"&&(r==="text"||r==="custom"||r==="textarea")&&(r=e),{kind:r,required:i,options:o,min:s,max:l,step:a,maxLength:u,pattern:p}}function qe(t){if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable)return t;try{let e=t.querySelector('input:not([type="hidden"]), textarea, select, [contenteditable="true"], [contenteditable=""]');return e instanceof HTMLElement?e:null}catch{return null}}function Ze(t,e){let r=e.defaultView?.KeyboardEvent;if(typeof r=="function")for(let o of ["keydown","keyup"])try{t.dispatchEvent(new r(o,{bubbles:!0,cancelable:!0}));}catch{}}function Qe(t,e,n,r){if(n==="checkbox"&&t instanceof HTMLInputElement){let i=e==="true";return t.checked!==i&&tt(t,r),t.checked!==i&&(t.checked=i,O(t,r)),true}if(n==="radio"&&t instanceof HTMLInputElement){let i=t.form??r,s=t.getAttribute("name"),l=null;if(s)try{let p=`input[type="radio"][name="${CSS.escape(s)}"]`;i.querySelectorAll(p).forEach(f=>{f instanceof HTMLInputElement&&f.value===e&&(l=f);});}catch{}let a=l??(t.value===e?t:null);if(!a)return false;tt(a,r);let u=a;return u.checked||(u.checked=true,O(u,r)),true}let o=qe(t);if(!o)return false;if(o instanceof HTMLElement&&o.isContentEditable){try{o.focus();}catch{}try{o.textContent=e;}catch{return false}return O(o,r),true}try{o.focus();}catch{}return Be(o,e)?(Ze(o,r),O(o,r),true):false}async function tn(t,e,n){if(!v(t.target))return {status:"error",reason:"invalid_target"};if(!n.promptFill)return {status:"wait"};let r=await e.waitForElement(t.target);if(r.status!=="matched"||!r.element.isConnected)return {status:"error",reason:"element_not_found"};let o=It(r.element,Ft(t.fillInputType),e.doc),i=(t.fillDescription??"").trim()||t.label||"",s=null,l=null,a;for(;;){let f;e.setInputPending(true);try{f=await n.promptFill({...o,question:i,errorCode:s});}catch{return {status:"error",reason:"prompt_failed"}}finally{e.setInputPending(false);}if(f===null)return {status:"error",reason:"fill_cancelled"};let w=o.kind==="select"||o.kind==="radio"?_t(f,o.options):o.kind==="password"?f:f.trim();if(s=Et(w,{...o,question:i,errorCode:null}),s===null){a=w;break}if(l!==null&&l===w)return {status:"error",reason:"fill_invalid"};l=w;}let u=await e.waitForElement(t.target);if(u.status!=="matched"||!u.element.isConnected)return {status:"error",reason:"element_not_found"};let p=It(u.element,Ft(t.fillInputType),e.doc);return p.kind!==o.kind?{status:"error",reason:"unfillable_target"}:(kt(u.element,e,n),Qe(u.element,a,p.kind,e.doc)?{status:"advance"}:{status:"error",reason:"unfillable_target"})}function en(t){if(t.startsWith("/")&&!t.startsWith("//"))return true;try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return false}}async function nn(t,e){if(!t.navigateUrl||!t.navigateTarget)return {status:"error",reason:"invalid_navigate_step"};if(!en(t.navigateUrl))return {status:"error",reason:"invalid_navigate_step"};try{t.navigateTarget==="new_tab"?e.win.open(t.navigateUrl,"_blank","noopener,noreferrer"):e.win.location.assign(t.navigateUrl);}catch{return {status:"error",reason:"navigate_failed"}}return {status:"navigated",navigateTarget:t.navigateTarget}}function Rt(t={}){return async(e,n)=>{try{switch(e.type){case "click":return await Ue(e,n,t);case "fill":return await tn(e,n,t);case "navigate":return await nn(e,n);default:return {status:"error",reason:"unknown_step_type"}}}catch{return {status:"error",reason:"executor_threw"}}}}var Ct="__arcyFlow";function on(t){try{let e=Rt({promptFill:t.promptFill,getBottomOcclusion:t.getBottomOcclusion});return Tt({context:t,executor:e})}catch{return null}}var sn={contract:2,mount:on};if(typeof window<"u")try{window[Ct]=sn;}catch{}
|
|
3
|
+
})();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(){'use strict';/* arcy.js — https://arcyai.com */
|
|
2
|
-
var qr=Object.defineProperty,Jr=Object.defineProperties;var Qr=Object.getOwnPropertyDescriptors;var dn=Object.getOwnPropertySymbols;var Zr=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable;var fn=(e,t,n)=>t in e?qr(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Zr.call(t,n)&&fn(e,n,t[n]);if(dn)for(var n of dn(t))eo.call(t,n)&&fn(e,n,t[n]);return e},ae=(e,t)=>Jr(e,Qr(t));var H=(e,t,n)=>new Promise((r,s)=>{var l=o=>{try{f(n.next(o));}catch(i){s(i);}},a=o=>{try{f(n.throw(o));}catch(i){s(i);}},f=o=>o.done?r(o.value):Promise.resolve(o.value).then(l,a);f((n=n.apply(e,t)).next());});function w(e){typeof console!="undefined"&&console.warn&&console.warn(`[arcy] ${e}`);}function pn(){let e=new Map;function t(r,s){if(typeof s!="function")return w(`on("${r}") needs a function. Ignoring.`),()=>{};let l=e.get(r);return l||(l=new Set,e.set(r,l)),l.add(s),()=>{l.delete(s);}}function n(r){let s=e.get(r);if(s)for(let l of [...s])try{l();}catch(a){w(`A "${r}" handler threw. ${String(a)}`);}}return {on:t,emit:n}}function kt(e){if(e.parentElement!==null)return e.parentElement;let t=e.parentNode;return t!==null&&"host"in t?t.host:null}var mn=[/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b\d(?:[ -]?\d){12,18}\b/g],to="[masked]";function Xe(e){return mn.some(t=>(t.lastIndex=0,t.test(e)))}var At=4096,no=100,ro=64;function ot(e){if(!e)return;let t=e.slice(0,At);if(e.length>At){let r=t.search(/\s\S*$/);t=r===-1?t.slice(0,At-no):t.slice(0,r);}let n=t.replace(/\s+/g," ").trim();if(n){for(let r of mn)n=n.replace(r,to);return n.slice(0,80)}}function gn(e){return !(e.length===0||e.length>64||e.includes(":")||e.startsWith("radix-")||/^\d+$/.test(e)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))}var oo=["data-testid","data-test","data-cy","id","name","aria-label"],io=["data-testid","data-test","data-cy"],so=64;function ao(e){for(let t of io){let n=e.getAttribute(t);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>so)&&!Xe(r))return r}}var lo=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function co(e){let t=kt(e);for(;t!==null;){let n=t.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let s of oo){let l=t.getAttribute(s);if(l===null||s==="id"&&!gn(l))continue;let a=ot(l);if(a!==void 0)return {tag:n,attr:s,value:a}}let r=t.getAttribute("role");if(r!==null&&lo.has(r))return {tag:n,attr:"role",value:r};t=kt(t);}}function uo(e){let t=0,n=e.previousElementSibling;for(;n!==null;)n.tagName===e.tagName&&(t+=1),n=n.previousElementSibling;return t}function hn(e){let t={tag:e.tagName.toLowerCase(),siblingIndex:uo(e)},n=ot(e.textContent);n!==void 0&&(t.text=n);let r=ot(e.getAttribute("aria-label"));r!==void 0&&(t.ariaLabel=r);let s=ot(e.getAttribute("placeholder"));s!==void 0&&(t.placeholder=s);let l=e.getAttribute("id");l!==null&&gn(l)&&!Xe(l)&&(t.id=l);let a=e.getAttribute("role");if(a!==null){let i=a.trim();i!==""&&i.length<=ro&&!Xe(i)&&(t.role=i);}let f=ao(e);f!==void 0&&(t.testId=f);let o=co(e);return o!==void 0&&(t.ancestorTag=o.tag,t.ancestorAttr=o.attr,t.ancestorValue=o.value),t}var yn="arcy.picker.
|
|
2
|
+
var qr=Object.defineProperty,Jr=Object.defineProperties;var Qr=Object.getOwnPropertyDescriptors;var dn=Object.getOwnPropertySymbols;var Zr=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable;var fn=(e,t,n)=>t in e?qr(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Zr.call(t,n)&&fn(e,n,t[n]);if(dn)for(var n of dn(t))eo.call(t,n)&&fn(e,n,t[n]);return e},ae=(e,t)=>Jr(e,Qr(t));var H=(e,t,n)=>new Promise((r,s)=>{var l=o=>{try{f(n.next(o));}catch(i){s(i);}},a=o=>{try{f(n.throw(o));}catch(i){s(i);}},f=o=>o.done?r(o.value):Promise.resolve(o.value).then(l,a);f((n=n.apply(e,t)).next());});function w(e){typeof console!="undefined"&&console.warn&&console.warn(`[arcy] ${e}`);}function pn(){let e=new Map;function t(r,s){if(typeof s!="function")return w(`on("${r}") needs a function. Ignoring.`),()=>{};let l=e.get(r);return l||(l=new Set,e.set(r,l)),l.add(s),()=>{l.delete(s);}}function n(r){let s=e.get(r);if(s)for(let l of [...s])try{l();}catch(a){w(`A "${r}" handler threw. ${String(a)}`);}}return {on:t,emit:n}}function kt(e){if(e.parentElement!==null)return e.parentElement;let t=e.parentNode;return t!==null&&"host"in t?t.host:null}var mn=[/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b\d(?:[ -]?\d){12,18}\b/g],to="[masked]";function Xe(e){return mn.some(t=>(t.lastIndex=0,t.test(e)))}var At=4096,no=100,ro=64;function ot(e){if(!e)return;let t=e.slice(0,At);if(e.length>At){let r=t.search(/\s\S*$/);t=r===-1?t.slice(0,At-no):t.slice(0,r);}let n=t.replace(/\s+/g," ").trim();if(n){for(let r of mn)n=n.replace(r,to);return n.slice(0,80)}}function gn(e){return !(e.length===0||e.length>64||e.includes(":")||e.startsWith("radix-")||/^\d+$/.test(e)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))}var oo=["data-testid","data-test","data-cy","id","name","aria-label"],io=["data-testid","data-test","data-cy"],so=64;function ao(e){for(let t of io){let n=e.getAttribute(t);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>so)&&!Xe(r))return r}}var lo=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function co(e){let t=kt(e);for(;t!==null;){let n=t.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let s of oo){let l=t.getAttribute(s);if(l===null||s==="id"&&!gn(l))continue;let a=ot(l);if(a!==void 0)return {tag:n,attr:s,value:a}}let r=t.getAttribute("role");if(r!==null&&lo.has(r))return {tag:n,attr:"role",value:r};t=kt(t);}}function uo(e){let t=0,n=e.previousElementSibling;for(;n!==null;)n.tagName===e.tagName&&(t+=1),n=n.previousElementSibling;return t}function hn(e){let t={tag:e.tagName.toLowerCase(),siblingIndex:uo(e)},n=ot(e.textContent);n!==void 0&&(t.text=n);let r=ot(e.getAttribute("aria-label"));r!==void 0&&(t.ariaLabel=r);let s=ot(e.getAttribute("placeholder"));s!==void 0&&(t.placeholder=s);let l=e.getAttribute("id");l!==null&&gn(l)&&!Xe(l)&&(t.id=l);let a=e.getAttribute("role");if(a!==null){let i=a.trim();i!==""&&i.length<=ro&&!Xe(i)&&(t.role=i);}let f=ao(e);f!==void 0&&(t.testId=f);let o=co(e);return o!==void 0&&(t.ancestorTag=o.tag,t.ancestorAttr=o.attr,t.ancestorValue=o.value),t}var yn="arcy.picker.777b2d4d1127.js",bn="arcy.chat.27fabef680f1.js",wn="arcy.flow.46ba8a96f99e.js";var fo=/^(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{12,})$/i,po=/^[^@\s/]+@[^@\s/]+\.[^@\s/]+$/;function mo(e){if(e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch(t){return e}}function vn(e){return e.length===0?false:fo.test(e)?true:po.test(mo(e))}function Be(e){let n=e.split("/").map(r=>vn(r)?":id":r).join("/");for(;n.length>1&&n.charAt(n.length-1)==="/";)n=n.slice(0,-1);return n.length===0?"/":n}function go(e){if(e.length===0)return "";let t=[];for(let n of e.split("&")){if(n.length===0)continue;let r=n.indexOf("="),s=r===-1?n:n.slice(0,r);if(s.length===0)continue;let l=vn(s)?":id":s;t.indexOf(l)===-1&&t.push(l);}return t.length===0?"":(t.sort(),`?${t.join("&")}`)}function ho(e,t){var n;try{let r=new URL(e,t!=null?t:void 0);return {path:r.pathname,query:r.search.slice(1)}}catch(r){let s=(n=e.split("#")[0])!=null?n:"";if(!s.startsWith("/"))return null;let l=s.indexOf("?");return l===-1?{path:s,query:""}:{path:s.slice(0,l),query:s.slice(l+1)}}}function je(e,t){if(typeof e!="string"||e.length===0)return null;let n=ho(e,t);if(n===null)return null;let r=Be(n.path);if(!r)return null;if(r.length>=2048)return r.slice(0,2048);let s=go(n.query);return s.length===0||r.length+s.length>2048?r:r+s}function yo(e){try{let t=e.currentScript,n=t==null?void 0:t.nonce;if(typeof n=="string"&&n.length>0)return n;let r=e.getElementsByTagName("script");for(let s=0;s<r.length;s++){let l=r[s].nonce;if(typeof l=="string"&&l.length>0)return l}return null}catch(t){return null}}var bo=typeof document!="undefined"?yo(document):null;function wo(){return bo}function Le(e){let t=wo();if(t)try{e.nonce=t,e.setAttribute("nonce",t);}catch(n){}}var vo="https://docs.arcyai.com/troubleshooting#content-security-policy";function _t(e){try{let{origin:t}=new URL(e);return t&&t!=="null"?t:null}catch(t){return null}}function So(e){var s;let t=_t(e.apiBase),n=e.cdnBase?_t(e.cdnBase):null,r=["This page's Content-Security-Policy is blocking part of the ARCY widget.","Add these to the policy your app sends:",""];return n&&r.push(` script-src ${n}`),t&&(r.push(` connect-src ${t}`),r.push(` font-src ${t}`),r.push(` img-src ${t} blob:`)),r.push(" style-src 'unsafe-inline', or a nonce on the script that loads ARCY"),r.push(""),r.push("To allow none of them, proxy a path on your own domain to the API and pass it as arcy.init(token, { apiBase })."),r.push((s=e.docsUrl)!=null?s:vo),r.join(`
|
|
3
3
|
`)}function Sn(e,t){let n=[t.apiBase,t.cdnBase].filter(s=>typeof s=="string"&&s.length>0).map(_t).filter(s=>s!==null),r=()=>{};try{let s=l=>{let a=l.blockedURI;(a==="inline"||n.some(o=>a==null?void 0:a.startsWith(o)))&&(r(),w(So(t)));};e.document.addEventListener("securitypolicyviolation",s),r=()=>{try{e.document.removeEventListener("securitypolicyviolation",s);}catch(l){}};}catch(s){}return ()=>r()}var It="__arcyPicker";var qe=2,En="arcy:design-mode:ready",Tn="arcy:design-mode:pick",xn="arcy:design-mode:exit",kn="arcy:design-mode:screenshot";var _n="arcy-widget",An="data-arcy",Rt="2147483000",Eo=[["position","fixed"],["inset","0"],["z-index",Rt],["pointer-events","none"],["background","transparent"],["border","0"],["box-shadow","none"],["outline","0"]],To=[["margin","0"],["padding","0"]],Cn="data-arcy-style",Je=new Map;function xo(e=_n){let t=Je.get(e);return t!==void 0&&t.host.isConnected}function it(e={}){var s,l,a;if(typeof document=="undefined")return null;let t=(s=e.id)!=null?s:_n,n=e.container;if(xo(t))return w("This ARCY surface is already on this page. Ignoring the second mount."),null;Je.delete(t);let r=(l=n!=null?n:document.body)!=null?l:document.documentElement;if(!r)return w("The page has no <body> to mount into yet. The widget will not render."),null;if(!n){let f=document.querySelectorAll(`[${An}]`);for(let o=0;o<f.length;o+=1)if(((a=f[o])==null?void 0:a.id)===t)return w("Another copy of ARCY is already on this page. Ignoring this one."),null}try{let f=document.createElement("div");f.id=t,f.setAttribute(An,"");for(let[h,v]of Eo)f.style.setProperty(h,v,"important");for(let[h,v]of To)f.style.setProperty(h,v);let o=f,i=!1;try{f.attachShadow&&(o=f.attachShadow({mode:"closed"}),i=!0);}catch(h){}r.appendChild(f),Ao(f);let u={host:f,root:o,isolated:i,destroy(){try{f.parentNode&&f.parentNode.removeChild(f);}catch(h){}Je.get(t)===u&&Je.delete(t);}};return Je.set(t,u),u}catch(f){return w(`The widget could not mount. ${String(f)}`),null}}var ko=["pointerdown","pointerup","pointercancel","mousedown","mouseup","click","dblclick","auxclick","contextmenu","touchstart","touchend","touchcancel","focusin","focusout","keydown","keyup","keypress","beforeinput","input","change","compositionstart","compositionupdate","compositionend","cut","copy","paste"];function Ao(e){let t=n=>{try{n.stopPropagation();}catch(r){}};for(let n of ko)try{e.addEventListener(n,t);}catch(r){}try{e.addEventListener("mousedown",n=>{n.defaultPrevented||Pt(e.ownerDocument,e);});}catch(n){}}function Pt(e,t){try{let n=e.activeElement;if(!n||n===t||t.contains(n)||n===e.body||n===e.documentElement)return;let r=n.blur;typeof r=="function"&&r.call(n);}catch(n){}}function In(e,t){var n;if(!e.isolated)return false;try{let r=e.root.querySelector(`[${Cn}]`);if(r)return r.textContent=`${(n=r.textContent)!=null?n:""}
|
|
4
4
|
${t}`,!0;let s=e.host.ownerDocument.createElement("style");return Le(s),s.setAttribute(Cn,""),s.textContent=t,e.root.appendChild(s),!0}catch(r){return w(`The widget could not apply its styles. ${String(r)}`),false}}var Co="arcy-picker-notice",_o=[["left","50%"],["bottom","24px"]],Io=[["transform","translateX(-50%)"],["box-sizing","border-box"],["max-width","min(520px, calc(100vw - 32px))"],["padding","14px 16px"],["border-radius","12px"],["background","#101828"],["color","#ffffff"],["font",'13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'],["box-shadow","0 8px 24px rgba(16, 24, 40, 0.28)"]],Ro=[["font-weight","600"],["margin-bottom","4px"]],Po=[["color","#d0d5dd"]],Lo=[["appearance","none"],["margin-top","10px"],["border","1px solid rgba(255, 255, 255, 0.25)"],["border-radius","999px"],["background","transparent"],["color","#ffffff"],["font","inherit"],["padding","4px 12px"],["cursor","pointer"]];function st(e,t){for(let[n,r]of t)e.style.setProperty(n,r);}var Rn=false;function at(e){if(Rn)return;let t=null;try{if(t=it({id:Co}),!t)return;Rn=!0;let n=t.host.ownerDocument,r=n.createElement("div");r.style.setProperty("position","absolute","important"),r.style.setProperty("pointer-events","auto","important");for(let[o,i]of _o)r.style.setProperty(o,i,"important");st(r,Io);let s=n.createElement("div");st(s,Ro),s.textContent="ARCY element picker did not start";let l=n.createElement("div");st(l,Po),l.textContent=e;let a=n.createElement("button");a.type="button",st(a,Lo),a.textContent="Dismiss";let f=t;a.addEventListener("click",()=>{try{f.destroy();}catch(o){}}),r.append(s,l,a),t.root.appendChild(r);}catch(n){try{t==null||t.destroy();}catch(r){}}}function Se(e){w(e),at(e);}var Lt="arcy_picker",Oo="/api/v1/sdk/tagging/verify",Ln="https://cdn.arcyai.com";var Mo=15e3,Fo=1e4;function No(e,t){var n;return (n=Ot(e))!=null?n:Ot(t)}function Ot(e){if(!e)return null;try{let t=new URLSearchParams(e.charAt(0)==="#"?e.slice(1):e).get(Lt);return t&&t.length>0?t:null}catch(t){return null}}function Do(e){try{let t=new URL(e.location.href),n=t.searchParams.has(Lt),r=Ot(t.hash)!==null;if(!n&&!r)return;n&&t.searchParams.delete(Lt),r&&(t.hash=""),e.history.replaceState(e.history.state,"",t.toString());}catch(t){}}function Bo(e){return H(this,null,function*(){let{apiBase:t,token:n,nonce:r,fetchImpl:s,timeoutMs:l=Fo,setTimeoutImpl:a=(i,u)=>setTimeout(i,u)}=e;if(!s)return null;let f=()=>H(null,null,function*(){try{let i=yield s(`${t}${Oo}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({token:r}),credentials:"omit"});if(!i.ok)return null;let u=yield i.json();if((u==null?void 0:u.ok)!==!0)return null;let h=Ho(u.returnOrigin);return h?{returnOrigin:h,screenshotsEnabled:u.elementScreenshotsEnabled!==!1}:(Se("This ARCY server has not been told where its dashboard lives, so a pick would have nowhere to go. Set FRONTEND_DASHBOARD_URL and try again."),null)}catch(i){return null}}),o=new Promise(i=>{try{a(()=>i(null),l);}catch(u){}});return Promise.race([f(),o])})}function Ho(e){if(typeof e!="string"||e.length===0)return null;try{let{origin:t}=new URL(e);return t&&t!=="null"?t:null}catch(t){return null}}function On(e,t,n,r){return new Promise(s=>{let l=false,a=null,f=p=>{l||(l=true,a&&(a.onload=null,a.onerror=null),s(p));},o=false,i=p=>{o||(o=true,Se(p));},u=()=>{let p;try{p=e[It];}catch(k){return i("The element picker registration could not be read. Design mode is off."),null}if(!p)return null;if(typeof p.mount!="function")return i("The element picker registered something unusable. Design mode is off."),null;let b;try{b=p.contract;}catch(k){b=void 0;}return b!==2?(i(`The element picker on the CDN speaks contract ${typeof b=="number"?b:"unknown"}, this arcy.js speaks ${2}. Update arcy.js to use design mode.`),null):p},h=p=>{try{let b=u();!b&&!o&&p(),f(b);}catch(b){f(null);}},v=false;try{v=e[It]!==void 0;}catch(p){v=true;}if(v){h(()=>{});return}try{let p=e.document;a=p.createElement("script"),Le(a),a.async=!0,a.src=`${t}/${yn}`;let b=a.src;a.onload=()=>h(()=>Se("The element picker loaded but did not register. Design mode is off.")),a.onerror=()=>{try{Se(`Failed to load ${b}. Design mode is off. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch(k){}f(null);},(p.head||p.documentElement).appendChild(a);}catch(p){Se(`The element picker could not load. ${String(p)}`),f(null);return}try{r(()=>{l||Se("The element picker did not load in time. Design mode is off."),f(null);},n);}catch(p){}})}function Uo(e){try{let t=e.location.pathname;return typeof t!="string"||!t.startsWith("/")?"/":Be(t)}catch(t){return "/"}}function Vo(e){try{let t=e.opener;return !!t&&!t.closed}catch(t){return false}}function lt(e,t,n){try{let r=e.opener;if(!r||r.closed){w("The ARCY dashboard window is gone, so that pick could not be sent.");return}r.postMessage(n,t);}catch(r){w(`That pick could not be sent to the ARCY dashboard. ${String(r)}`);}}function Mn(e){return H(this,null,function*(){try{let{win:t,token:n,apiBase:r,fetchImpl:s,onVerified:l,loadChunk:a,loadTimeoutMs:f=Mo,setTimeoutImpl:o=(k,D)=>setTimeout(k,D)}=e,i=No(t.location.search,t.location.hash);if(!i)return "no_nonce";if(Do(t),!Vo(t))return Se("This page was not opened by the ARCY dashboard, so a picked element would have nowhere to go. If you did start it from the flow builder, this site is severing the link back: a Cross-Origin-Opener-Policy header on this page (helmet sets one by default) does exactly that. Serve this page with Cross-Origin-Opener-Policy: unsafe-none while you author."),"no_opener";let u=yield Bo({apiBase:r,token:n,nonce:i,fetchImpl:s,setTimeoutImpl:o});if(!u)return Se("The design-mode link is invalid, expired, or could not be verified. It is single-use and short-lived, so a reload spends it. Check that this page carries the same environment Token as the flow you are editing, then open the picker again from the dashboard."),"rejected";try{l();}catch(k){}let h=yield a(t,f,o);if(!h)return "load_failed";let{returnOrigin:v,screenshotsEnabled:p}=u;return h.mount({screenshotsEnabled:p,onPick:(k,D)=>{lt(t,v,{type:Tn,protocol:qe,target:k,route:Uo(t),matchCount:D});},onScreenshot:k=>{lt(t,v,{type:kn,protocol:qe,screenshot:k});},onExit:()=>{lt(t,v,{type:xn,protocol:qe});}})?(lt(t,v,{type:En,protocol:qe}),"active"):(Se("The element picker could not start. Design mode is off."),"mount_failed")}catch(t){return Se(`Design mode could not start. ${String(t)}`),"load_failed"}})}var Mt={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function oe(e){return e?{getItem(t){try{return e.getItem(t)}catch(n){return null}},setItem(t,n){try{e.setItem(t,n);}catch(r){}},removeItem(t){try{e.removeItem(t);}catch(n){}}}:Mt}function Ee(){try{let e=globalThis.localStorage;return oe(e)}catch(e){return Mt}}function Ve(){try{let e=globalThis.sessionStorage;return oe(e)}catch(e){return Mt}}function ie(e,t){let n=e.getItem(t);if(!n)return null;try{let r=JSON.parse(n);return !r||typeof r!="object"||Array.isArray(r)?null:r}catch(r){return null}}function ne(e,t,n){try{e.setItem(t,JSON.stringify(n));}catch(r){}}var Wo="arcy.preview.";function ct(e,t=Ve()){try{return oe(t).getItem(Wo+e)!==null}catch(n){return false}}var Ft="arcy_preview",$o=1,Ko="/api/v1/sdk/flows/preview/verify",Go=1e4;function Yo(e,t){var n;return (n=Nt(e))!=null?n:Nt(t)}function Nt(e){if(!e)return null;try{let t=new URLSearchParams(e.charAt(0)==="#"?e.slice(1):e).get(Ft);return t&&t.length>0?t:null}catch(t){return null}}function zo(e){try{let t=new URL(e.location.href),n=t.searchParams.has(Ft),r=Nt(t.hash)!==null;if(!n&&!r)return;n&&t.searchParams.delete(Ft),r&&(t.hash=""),e.history.replaceState(e.history.state,"",t.toString());}catch(t){}}function Fn(e,t){try{let n=Yo(e.location.search,e.location.hash);return n?(zo(e),{kind:"nonce",nonce:n}):ct(t)?{kind:"pending"}:null}catch(n){return null}}function Nn(e){return H(this,null,function*(){let{apiBase:t,token:n,nonce:r,sessionToken:s,userTraits:l,fetchImpl:a,timeoutMs:f=Go,setTimeoutImpl:o=(k,D)=>setTimeout(k,D)}=e;if(!a)return null;let i=k=>{w(k);try{at(k);}catch(D){}return null},u=()=>H(null,null,function*(){try{let k=yield a(`${t}${Ko}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify($($({token:r},s?{sessionToken:s}:{}),l&&Object.keys(l).length>0?{userTraits:l}:{})),credentials:"omit"});if(!k.ok)return i("ARCY could not verify this preview link. Close this tab and press Preview in the dashboard again.");let D=yield k.json();return (D==null?void 0:D.ok)!==!0||D.flow===void 0||D.flow===null?i("ARCY could not verify this preview link. Close this tab and press Preview in the dashboard again."):D.protocol!==$o?i("This page runs an older version of arcy.js than the dashboard expects. The preview cannot run until the script updates."):D.flow}catch(k){return i("ARCY could not reach its server to start this preview. Check the connection and press Preview again.")}}),h=false,v,p=new Promise(k=>{try{v=o(()=>{h||(h=!0,k(i("ARCY took too long to verify this preview link. Close this tab and press Preview in the dashboard again.")));},f);}catch(D){}}),b=yield Promise.race([u().then(k=>(h=true,k)),p]);try{v!==void 0&&clearTimeout(v);}catch(k){}return b})}var Dt="https://api.arcyai.com",Xo="/api/v1/sdk/session/init";var jo=["ON","REQUIRE_CONSENT","OFF"];function qo(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,n=t.behavioralTelemetry,r=t.effectiveCustomization,s=t.widget,l=t.identity,a=l&&typeof l=="object"&&!Array.isArray(l)?l.accepted:void 0;return {sessionToken:typeof t.sessionToken=="string"?t.sessionToken:null,behavioralTelemetry:typeof n=="string"&&jo.indexOf(n)!==-1?n:null,customization:r&&typeof r=="object"&&!Array.isArray(r)?r:null,widget:s&&typeof s=="object"&&!Array.isArray(s)?s:null,identityAccepted:typeof a=="boolean"?a:null}}function Dn(e){let{token:t,apiBase:n=Dt,setTimeoutImpl:r=(S,E)=>setTimeout(S,E),now:s=()=>Date.now(),retryDelayMs:l=2e3,attemptTimeoutMs:a=5e3,failureCooldownMs:f=3e4}=e,o=e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,i=`${n}${Xo}`,u=null,h=null,v=null,p=null,b=0;function k(S){let E={publicKey:t,sessionId:S.sessionId};return S.visitorId!==void 0&&(E.visitorId=S.visitorId),S.userId!==void 0&&(E.userId=S.userId),S.userHash!==void 0&&(E.userHash=S.userHash),S.userTraits!==void 0&&(E.userTraits=S.userTraits),S.uiLanguage!==void 0&&(E.uiLanguage=S.uiLanguage),S.contentLocale!==void 0&&(E.contentLocale=S.contentLocale),S.viewerLocale!==void 0&&(E.viewerLocale=S.viewerLocale),S.route!==void 0&&(E.route=S.route),S.sessionContext!==void 0&&(E.sessionContext=S.sessionContext),JSON.stringify(E)}function D(S){return H(this,null,function*(){if(!o)return {ok:false,reason:"unusable"};let E;try{E=yield o(i,{method:"POST",headers:{"Content-Type":"application/json"},body:S,credentials:"omit"});}catch(M){return null}if(E.status>=500)return null;if(!E.ok)return {ok:false,reason:"rejected"};let F;try{F=yield E.json();}catch(M){return {ok:false,reason:"unusable"}}let A=qo(F);return A?{ok:true,config:A}:{ok:false,reason:"unusable"}})}function I(S){return new Promise(E=>{try{r(()=>E(),S);}catch(F){E();}})}function V(S){return Promise.race([D(S),I(a).then(()=>null)])}function P(S){return H(this,null,function*(){let E=yield V(S);if(E)return E;yield I(l);let F=yield V(S);return F!=null?F:{ok:false,reason:"network"}})}return {sync(S){return H(this,null,function*(){let E=k(S);if(p&&E===h)return p;if(!p&&E===h&&u)return {ok:true,config:u};if(v&&v.json===E&&s()-v.at<f)return {ok:false,reason:"network"};h=E;let F=++b,A=P(E).then(M=>(F===b&&(M.ok?(u=M.config,v=null):(v={json:E,at:s()},h===E&&(h=null))),p===A&&(p=null),M));return p=A,A})},config:()=>u}}var Bt="__arcyChat";var Bn=["image/png","image/jpeg","image/webp"],Ht="--_arcy-font-key",Hn="arcy-chat-policy",Un="arcy-bar-tray",ut={historyTitle:"Recent chats",historyEmpty:"No conversations yet.",newChat:"New chat",flowsTitle:"What I can do",flowsEmpty:"Nothing to run yet.",collapse:"Collapse",back:"Back",closeSheet:"Close",settingsTitle:"Settings",dockChat:"Dock to the corner",dockChatHint:"Shrink ARCY to a button in the bottom-right corner.",language:"Language",openChat:"Open chat",moveBar:"Move the chat bar",send:"Send",flowRunning:"Running",flowStep:"Step {step} of {total}",flowStop:"Stop",flowFailed:"Sorry, I could not finish that for you this time. You can ask me here and I will help you do it.",attachMenu:"Add",attachImage:"Attach an image",removeImage:"Remove image",imageTooLarge:"That image is too large. Each image must be under 5 MB.",imageWrongType:"That file type is not supported. Use PNG, JPEG or WEBP.",imageTooMany:"You can attach up to 3 images.",imageFailed:"That image could not be uploaded. Please try again.",likeAnswer:"Good answer",dislikeAnswer:"Bad answer",answering:"Answering",aiDisclaimer:"{app} is AI and can make mistakes",consentNotice:"Your messages are processed to answer your question.",consentWithPolicy:"{policy}",disclaimerJoin:" \xB7 ",privacyPolicy:"Privacy Policy",poweredBy:"Powered by ARCY",genericError:"Something went wrong. Please try again.",userCapReached:"You've reached today's limit for questions. Please try again tomorrow.",imageConversation:"Image",searchedSourcesLabel:"Searched {count} sources",sourcesLabel:"Sources:",flowOfferHint:"You can do this in one click with the Quick Flow below.",fillConfirm:"Confirm",fillYes:"Yes",fillNo:"No",fillRequired:"This field needs an answer.",fillInvalidNumber:"Please enter a number.",fillNumberTooSmall:"Please enter {min} or more.",fillNumberTooLarge:"Please enter {max} or less.",fillInvalidEmail:"Please enter a valid email address.",fillInvalidUrl:"Please enter a valid link.",fillInvalidDate:"Please enter a valid date.",fillInvalidTime:"Please enter a valid time.",fillDateTooEarly:"Please pick {min} or later.",fillDateTooLate:"Please pick {max} or earlier.",fillTooLong:"Please keep it under {max} characters.",fillInvalidOption:"Please pick one of the options.",fillInvalid:"That does not look right. Please try again."};var Ut="https://cdn.arcyai.com";var Jo=15e3;function Wn(e,t,n,r){return new Promise(s=>{let l=false,a=null,f=p=>{l||(l=true,a&&(a.onload=null,a.onerror=null),s(p));},o=false,i=p=>{o||(o=true,w(p));},u=()=>{let p;try{p=e[Bt];}catch(k){return i("The chat panel registration could not be read. The panel will not open."),null}if(!p)return null;if(typeof p.mount!="function")return i("The chat panel registered something unusable. The panel will not open."),null;let b;try{b=p.contract;}catch(k){b=void 0;}return b!==4?(i(`The chat panel on the CDN speaks contract ${typeof b=="number"?b:"unknown"}, this arcy.js speaks ${4}. Update arcy.js to open the chat panel.`),null):p},h=p=>{try{let b=u();!b&&!o&&p(),f(b);}catch(b){f(null);}},v=false;try{v=e[Bt]!==void 0;}catch(p){v=true;}if(v){h(()=>{});return}try{let p=e.document;a=p.createElement("script"),Le(a),a.async=!0,a.src=`${t}/${bn}`;let b=a.src;a.onload=()=>h(()=>w("The chat panel loaded but did not register. The panel will not open.")),a.onerror=()=>{try{w(`Failed to load ${b}. The chat panel will not open. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch(k){}f(null);},(p.head||p.documentElement).appendChild(a);}catch(p){w(`The chat panel could not load. ${String(p)}`),f(null);return}try{r(()=>{l||w("The chat panel did not load in time."),f(null);},n);}catch(p){}})}function $n(e){let{root:t,host:n,win:r=typeof window!="undefined"?window:void 0,loadChunk:s,loadTimeoutMs:l=Jo,setTimeoutImpl:a=(L,j)=>setTimeout(L,j),onRequestClose:f,bar:o,apiBase:i,getSessionToken:u,getSessionId:h,getRoute:v,getMaxHeightPercent:p,onStartFlow:b,publicKey:k,getConversationId:D,setConversationId:I,touchConversation:V,getVisitorId:P,onOrgCapExceeded:X,onStopFlow:S,track:E,getWidget:F,onSelectLocale:A}=e,M=t!==n,C=null,G=null,U=false,K=false;function J(){return H(this,null,function*(){if(!(C||U))return G||(G=H(null,null,function*(){if(r)try{let L=yield s(r,l,a);if(!L||U)return;let j={root:t,host:n,isolated:M,onRequestClose:f,bar:o,apiBase:i,getSessionToken:u,getSessionId:h,getRoute:v,getMaxHeightPercent:p,onStartFlow:b,publicKey:k,getConversationId:D,setConversationId:I,touchConversation:V,getVisitorId:P,onOrgCapExceeded:X,onStopFlow:S,track:E,getWidget:F,onSelectLocale:A};C=L.mount(j),C||w("The chat panel could not start.");}catch(L){w(`The chat panel could not load. ${String(L)}`);}finally{G=null;}}),G)})}return {open(){return H(this,null,function*(){if(!U&&(K=true,yield J(),!(!K||U)))try{C==null||C.open();}catch(L){w(`The chat panel could not open. ${String(L)}`);}})},close(){K=false;try{C==null||C.close();}catch(L){w(`The chat panel could not close. ${String(L)}`);}},destroy(){U=true,K=false;let L=C;C=null;try{L==null||L.destroy();}catch(j){w(`The chat panel could not be removed. ${String(j)}`);}},reposition(){var L;try{(L=C==null?void 0:C.reposition)==null||L.call(C);}catch(j){w(`The chat panel could not move. ${String(j)}`);}},refreshChrome(){var L;try{(L=C==null?void 0:C.refreshChrome)==null||L.call(C);}catch(j){w(`The chat panel could not apply its texts. ${String(j)}`);}},promptFill(L){return H(this,null,function*(){if(U||(yield J(),U||!(C!=null&&C.promptFill)))return null;try{return yield C.promptFill(L)}catch(j){return w(`The flow's question could not be shown. ${String(j)}`),null}})},cancelFill(){var L;try{(L=C==null?void 0:C.cancelFill)==null||L.call(C);}catch(j){w(`The flow's question could not be withdrawn. ${String(j)}`);}},showFlowFailure(){return H(this,null,function*(){if(!U&&(K=true,yield J(),!(!K||U||!(C!=null&&C.showFlowFailure))))try{C.showFlowFailure();}catch(L){w(`The flow's failure notice could not be shown. ${String(L)}`);}})}}}var Vt="__arcyFlow";var Qo="arcy.flow.";function Zo(e){return typeof e.flowId=="string"&&e.flowId.length>0&&typeof e.currentStepCvid=="string"&&e.currentStepCvid.length>0&&typeof e.flowSessionId=="string"&&e.flowSessionId.length>0&&typeof e.startedAt=="number"}function Kn(e,{store:t=Ee()}={}){let n=oe(t),r=Qo+e;return {read(){let s=ie(n,r);return !s||!Zo(s)?null:{flowId:s.flowId,currentStepCvid:s.currentStepCvid,flowSessionId:s.flowSessionId,startedAt:s.startedAt}},save(s){ne(n,r,s);},clear(){n.removeItem(r);}}}var Yn="https://cdn.arcyai.com";var ei=15e3;function zn(e,t,n,r){return new Promise(s=>{let l=false,a=null,f=p=>{l||(l=true,a&&(a.onload=null,a.onerror=null),s(p));},o=false,i=p=>{o||(o=true,w(p));},u=()=>{let p;try{p=e[Vt];}catch(k){return i("The flow engine registration could not be read. The flow will not start."),null}if(!p)return null;if(typeof p.mount!="function")return i("The flow engine registered something unusable. The flow will not start."),null;let b;try{b=p.contract;}catch(k){b=void 0;}return b!==2?(i(`The flow engine on the CDN speaks contract ${typeof b=="number"?b:"unknown"}, this arcy.js speaks ${2}. Update arcy.js to run flows.`),null):p},h=p=>{try{let b=u();!b&&!o&&p(),f(b);}catch(b){f(null);}},v=false;try{v=e[Vt]!==void 0;}catch(p){v=true;}if(v){h(()=>{});return}try{let p=e.document;a=p.createElement("script"),Le(a),a.async=!0,a.src=`${t}/${wn}`;let b=a.src;a.onload=()=>h(()=>w("The flow engine loaded but did not register. The flow will not start.")),a.onerror=()=>{try{w(`Failed to load ${b}. The flow will not start. If this page sets a Content-Security-Policy, it must allow scripts from ${t}.`);}catch(k){}f(null);},(p.head||p.documentElement).appendChild(a);}catch(p){w(`The flow engine could not load. ${String(p)}`),f(null);return}try{r(()=>{l||w("The flow engine did not load in time."),f(null);},n);}catch(p){}})}function Xn(e){let{win:t=typeof window!="undefined"?window:void 0,loadChunk:n,loadTimeoutMs:r=ei,setTimeoutImpl:s=(h,v)=>setTimeout(h,v),context:l}=e,a=null,f=null,o=false;function i(){return H(this,null,function*(){if(!(a||o))return f||(f=H(null,null,function*(){if(t)try{let h=yield n(t,r,s);if(!h||o)return;a=h.mount(ae($({},l),{doc:t.document,win:t})),a||w("The flow engine could not start.");}catch(h){w(`The flow engine could not load. ${String(h)}`);}finally{f=null;}}),f)})}return {start(h){return H(this,null,function*(){if(!o&&(yield i(),!o))try{yield a==null?void 0:a.start(h);}catch(v){w(`The flow could not start. ${String(v)}`);}})},resume(){return H(this,null,function*(){if(o||!Kn(l.token).read()||(yield i(),o||!a))return false;try{return yield a.resume()}catch(v){return w(`The flow could not resume. ${String(v)}`),false}})},startPreview(h){return H(this,null,function*(){var v;if(!o&&(yield i(),!o))try{yield (v=a==null?void 0:a.startPreview)==null?void 0:v.call(a,h);}catch(p){w(`The preview could not start. ${String(p)}`);}})},resumePreview(){return H(this,null,function*(){if(o||!ct(l.token)||(yield i(),o||!(a!=null&&a.resumePreview)))return false;try{return yield a.resumePreview()}catch(h){return w(`The preview could not resume. ${String(h)}`),false}})},stop(){var h;if(!o)try{(h=a==null?void 0:a.stop)==null||h.call(a);}catch(v){w(`The flow could not be stopped. ${String(v)}`);}},destroy(){o=true;let h=a;a=null;try{h==null||h.destroy();}catch(v){w(`The flow engine could not be removed. ${String(v)}`);}}}}function Wt(e){let t=e.dataTransfer;if(!t)return false;let n=t.types;if(!n)return false;for(let r=0;r<n.length;r+=1)if(n[r]==="Files")return true;return false}function jn(e){var n;let t=e.dataTransfer;return Array.from((n=t==null?void 0:t.files)!=null?n:[])}var qn=`
|
|
5
5
|
[data-tip] {
|
|
@@ -564,5 +564,5 @@ ${t}`,!0;let s=e.host.ownerDocument.createElement("style");return Le(s),s.setAtt
|
|
|
564
564
|
animation: none;
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
`;var Oe=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:0;function Qn(e){var n;let t=(n=e==null?void 0:e.document)==null?void 0:n.documentElement;return {width:Oe(t==null?void 0:t.clientWidth)||Oe(e==null?void 0:e.innerWidth),height:Oe(t==null?void 0:t.clientHeight)||Oe(e==null?void 0:e.innerHeight)}}function ti(e){let t=e==null?void 0:e.visualViewport;if(!t)return 0;let n=Qn(e).height,r=Oe(t.height);if(!n||!r)return 0;let s=typeof t.offsetTop=="number"&&Number.isFinite(t.offsetTop)?t.offsetTop:0,l=n-(r+s);return !Number.isFinite(l)||l<24?0:Math.min(l,n)}function dt(e){let t=Qn(e);return ae($({},t),{isMobile:t.width>0&&t.width<640,keyboardOffset:ti(e)})}var ni=560;function Zn(e,t){let n=Oe(t.width);if(!n)return ni;if(n<640)return Math.max(0,n-24);let r=Math.round(e/100*n);return Math.min(r,n-32)}function er(e){return e.x===0&&e.y===0?"none":`translate(${e.x}px, ${e.y}px)`}function $t(e,t,n){let r=Oe(n);if(!r)return e;let s=Math.max(0,(r-Oe(t))/2);return Math.min(s,Math.max(-s,e))}var oi=1e4,tr=52,ft=24,pt=18,mt=30,gt=280,nr="var(--_arcy-chat-welcome-icon-size, 34px)",rr="53%",ii=24,or="http://www.w3.org/2000/svg",ir=[["box-sizing","border-box"],["margin","0"],["display","flex"]],sr=[["position","absolute"],["pointer-events","auto"]],si=260,ai=300,li=150,ci=3e3;function Ae(e,t,n,r=2){let s=e.createElementNS(or,"svg");s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("aria-hidden","true"),s.setAttribute("width",String(n)),s.setAttribute("height",String(n));let l=e.createElementNS(or,"path");return l.setAttribute("d",t),l.setAttribute("fill","none"),l.setAttribute("stroke","currentColor"),l.setAttribute("stroke-width",String(r)),l.setAttribute("stroke-linecap","round"),l.setAttribute("stroke-linejoin","round"),s.appendChild(l),s}function ar(e,t,n){let r=e.createElement("img");return r.src=t,r.alt="",r.setAttribute("aria-hidden","true"),r.width=n,r.height=n,r.style.setProperty("width",`${n}px`),r.style.setProperty("height",`${n}px`),r.style.setProperty("object-fit","contain"),r}var ui="M5 3H19A2 2 0 0 1 21 5V19A2 2 0 0 1 19 21H5A2 2 0 0 1 3 19V5A2 2 0 0 1 5 3ZM7 9a2 2 0 1 0 4 0a2 2 0 1 0-4 0M21 15l-3.086-3.086a2 2 0 0 0-2.828 0L6 21",Qe={x:0,y:0},di="M12 5v14M5 12h14",fi="M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",lr="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594zM20 2v4M22 4h-4M4 20m-2 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0",cr="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z",pi="M12 19V5M5 12l7-7 7 7",mi="M6 6h12v12H6z";function q(e,t){return (...n)=>{try{t(...n);}catch(r){w(`${e} failed. ${String(r)}`);}}}var gi={send:"Send",attachMenu:"Add",attachImage:"Attach an image",flowStop:"Stop",openChat:"Open chat",moveBar:"Move the chat bar",flowStep:"Step {step} of {total}"};function ur(e={}){var Zt,en,tn,nn,rn,on,sn,an,ln,cn;let t=$($({},gi),(Zt=e.labels)!=null?Zt:{}),n={widthPercent:(tn=(en=e.geometry)==null?void 0:en.widthPercent)!=null?tn:mt,bottomOffset:(rn=(nn=e.geometry)==null?void 0:nn.bottomOffset)!=null?rn:ft,collapsedWidth:(sn=(on=e.geometry)==null?void 0:on.collapsedWidth)!=null?sn:gt},r=null,s=false,l=null,a=null,f=null,o=null,i=null,u=null,h=(an=e.iconUrl)!=null?an:null,v=(ln=e.iconSize)!=null?ln:pt,p=(cn=e.welcomeIconUrl)!=null?cn:null,b=null,k=null,D=false,I=null,V=null,P=false,X={x:0,y:0},S=null,E=null,F=null,A=null,M=null,C=null,G=null,U=null,K=null,J=null,ee="idle",L=null,j=false,le=false,Ce=0,ce=false,Te=false,Y={width:0,height:0,isMobile:false,keyboardOffset:0};function ge(){return !L&&ee!=="open"}function he(c){var W,Pe;let m=(W=l==null?void 0:l.offsetWidth)!=null?W:0,O=(Pe=l==null?void 0:l.offsetHeight)!=null?Pe:0;if(!Y.width||!Y.height)return c;let _=n.bottomOffset+Y.keyboardOffset,te=Math.max(0,Y.height-O-_);return {x:$t(c.x,m,Y.width),y:Math.min(_,Math.max(-te,c.y))}}function ue(c){var ve,un;if(!D||Y.isMobile)return;c.preventDefault(),c.stopPropagation();let m=c.clientX,O=c.clientY,_=X,te=k,W=(un=(ve=k==null?void 0:k.ownerDocument)==null?void 0:ve.defaultView)!=null?un:typeof window!="undefined"?window:null,Pe=De=>{var ze;De.pointerId===c.pointerId&&(X=he({x:_.x+(De.clientX-m),y:_.y+(De.clientY-O)}),se(),(ze=e.onGeometryChange)==null||ze.call(e));},re=De=>{var ze;if(De.pointerId===c.pointerId){W==null||W.removeEventListener("pointermove",Pe,true),W==null||W.removeEventListener("pointerup",re,true),W==null||W.removeEventListener("pointercancel",re,true);try{te==null||te.releasePointerCapture(De.pointerId);}catch(Is){}(ze=e.onPositionChange)==null||ze.call(e,X);}};try{te==null||te.setPointerCapture(c.pointerId);}catch(De){}W==null||W.addEventListener("pointermove",Pe,true),W==null||W.addEventListener("pointerup",re,true),W==null||W.addEventListener("pointercancel",re,true);}function He(){l==null||l.style.setProperty("display",P?"none":"flex","important"),I&&(I.style.setProperty("display",P?"flex":"none","important"),P&&(I.style.setProperty("bottom",`${n.bottomOffset+Y.keyboardOffset}px`,"important"),I.style.setProperty("right",`${ii}px`,"important")));}function se(){if(He(),!l)return;let c=ge(),m=Zn(n.widthPercent,Y),O=n.bottomOffset+Y.keyboardOffset;l.style.setProperty("bottom",`${O}px`,"important"),l.style.setProperty("left","50%","important"),l.style.setProperty("translate","-50%","important");let _=D&&!Y.isMobile?he(X):Qe;X=_;let te=L?Qe:{x:$t(_.x,c?n.collapsedWidth:m,Y.width),y:_.y};l.style.setProperty("transform",er(te)),a==null||a.setAttribute("data-grip",D&&!Y.isMobile&&!L?"true":"false"),l.style.setProperty("width",c?`${n.collapsedWidth}px`:`${m}px`);let W=`calc(100% - ${24}px)`;l.style.setProperty("max-width",Y.isMobile?W:"none"),l.setAttribute("data-mobile",Y.isMobile?"":"false");}function xe(){if(!i||!u)return;let c=i.ownerDocument,m=!ge()&&le,O=m?Ae(c,di,18):h?ar(c,h,v):Ae(c,lr,v);i.replaceChild(O,u),u=O,i.setAttribute("aria-label",t.attachMenu),m?i.setAttribute("data-tip",t.attachMenu):i.removeAttribute("data-tip"),i.setAttribute("aria-haspopup",m?"menu":"false"),i.setAttribute("data-role",m?"menu":"mark"),i.disabled=!m,i.setAttribute("aria-hidden",m?"false":"true"),i.tabIndex=m?0:-1,m||x();}function _e(){if(!J||!a)return;let c=le&&Ce>0&&!ge(),m=a.getAttribute("data-attachments")==="true";J.style.setProperty("display",c?"flex":"none"),a.setAttribute("data-attachments",c?"true":"false"),m!==c&&q("onGeometryChange",()=>{var O;return (O=e.onGeometryChange)==null?void 0:O.call(e)})();}function R(c){ce=c,S&&S.style.setProperty("display",c?"flex":"none"),i==null||i.setAttribute("aria-expanded",c?"true":"false"),c&&(E==null||E.focus());}function x(){if(!ce)return;let c=S==null?void 0:S.getRootNode(),m=!!(c&&"activeElement"in c&&c.activeElement&&(S!=null&&S.contains(c.activeElement)));R(false),m&&(i==null||i.focus());}function N(){if(!I||!V)return;let c=I.ownerDocument,m=p&&p!==b?p:null,O;if(m){let _=c.createElement("img");_.src=m,_.alt="",_.setAttribute("aria-hidden","true"),_.style.setProperty("width","100%"),_.style.setProperty("height","100%"),_.style.setProperty("object-fit","contain"),_.style.setProperty("display","block"),_.addEventListener("error",()=>{b=m,N();},{once:true}),O=_;}else {let _=Ae(c,cr,18);_.setAttribute("width",rr),_.setAttribute("height",rr),O=_;}I.replaceChild(O,V),V=O;}function z(){if(!a||!f||!M)return;let c=L?j?"input":"flow":ee,m=(L==null?void 0:L.phase)==="done";a.setAttribute("data-mode",c),a.setAttribute("data-phase",L?m?"done":"running":"none"),a.setAttribute("data-collapsed",ge()?"true":"false"),xe(),_e(),se(),f.style.setProperty("display",c==="flow"?"none":"flex"),M.style.setProperty("display",c==="flow"||c==="input"?"flex":"none"),A==null||A.style.setProperty("display","flex"),a.setAttribute("aria-expanded",c==="open"?"true":"false"),L&&C&&G&&(C.textContent=L.name,G.textContent=m?"\u2713":t.flowStep.replace("{step}",String(L.step)).replace("{total}",String(L.total)),U==null||U.style.setProperty("display",m?"none":"flex")),K&&K.style.setProperty("display",c==="open"&&K.textContent?"block":"none");}function ye(){Y=dt(typeof window!="undefined"?window:null),se(),q("onGeometryChange",()=>{var c;return (c=e.onGeometryChange)==null?void 0:c.call(e)})();}function de(c){var O;c.preventDefault();let m=(O=o==null?void 0:o.value.trim())!=null?O:"";if(!m&&Ce===0){be();return}o&&(o.value=""),q("onSubmit",()=>{var _;return (_=e.onSubmit)==null?void 0:_.call(e,m)})();}function Fe(){be();}function be(){L||ee==="open"||Te||(Te=true,q("onActivate",()=>{var c;return (c=e.onActivate)==null?void 0:c.call(e)})());}function Ie(c){if(!(L||ee==="open")&&!(S&&c.target instanceof Node&&S.contains(c.target))){be();try{o==null||o.focus();}catch(m){}}}function Ue(){Te=false;}function tt(c){c.preventDefault(),c.stopPropagation(),!(ge()||!le)&&R(!ce);}function wt(){try{F==null||F.click();}catch(c){}}function Ke(c){var m;c.preventDefault(),c.stopPropagation(),x(),wt(),(m=e.onAttach)==null||m.call(e);}function Ne(){var O;let c=F==null?void 0:F.files,m=c?Array.from(c):[];F&&(F.value=""),!(!le||m.length===0)&&((O=e.onFiles)==null||O.call(e,m));}function vt(c){c.key==="Escape"&&ce&&x();}function St(c){if(!ce)return;let m=c.target;m instanceof Node&&((i==null?void 0:i.contains(m))===true||(S==null?void 0:S.contains(m))===true)||x();}function Et(c){let m=typeof c.composedPath=="function"?c.composedPath():[],O=c.target,_=r==null?void 0:r.host,te=!!(_&&(m.some(W=>W===_)||m.length===0&&O instanceof Node&&_.contains(O)));ce&&!te&&x(),!(L||ee!=="open")&&(!_||te||q("onDismiss",()=>{var W;return (W=e.onDismiss)==null?void 0:W.call(e)})());}function Tt(c){Wt(c)&&c.preventDefault();}function xt(c){var O;if(!Wt(c)||(c.preventDefault(),!le))return;let m=jn(c);m.length!==0&&((O=e.onFiles)==null||O.call(e,m));}let we=q("resize",ye),nt=q("submit",de),fe=q("focus",Fe),ke=q("barClick",Ie),rt=q("pointerdown",Ue),Ge=q("attachMenu",tt),d=q("attach",Ke),y=q("picked",Ne),T=q("stop",()=>{var c;return (c=e.onStop)==null?void 0:c.call(e)}),g=q("menuKey",vt),B=q("menuDismiss",Et),Q=q("menuDismissInside",St),pe=q("dragover",Tt),Re=q("drop",xt),Z=q("undock",()=>{var c;return (c=e.onUndock)==null?void 0:c.call(e)});function Ye(c){if(!s){s=true;try{c.style.setProperty("opacity","1");}catch(m){}}}function zr(c,m){if(s)return;if(!m||typeof m.setTimeout!="function"){s=true;return}try{c.style.setProperty("opacity","0"),c.style.setProperty("transition",`opacity ${si}ms ease`);}catch(_){s=true;return}let O=_=>{try{m.setTimeout(()=>Ye(c),_);}catch(te){Ye(c);}};if(c.ownerDocument.readyState==="complete"){O(li);return}try{m.addEventListener("load",()=>O(ai),{once:!0});}catch(_){}O(ci);}function Xr(){var te,W,Pe;if(r!=null&&r.host.isConnected){w("The chat bar is already mounted. Ignoring the second mount.");return}r=null;let c=it({container:e.container});if(!c)return;r=c,zr(c.host,c.host.ownerDocument.defaultView),In(r,Jn);let m=r.host.ownerDocument;l=m.createElement("div"),l.className="arcy-bar-wrap";for(let[re,ve]of ir)l.style.setProperty(re,ve);for(let[re,ve]of sr)l.style.setProperty(re,ve,"important");l.style.setProperty("flex-direction","column"),l.style.setProperty("align-items","center"),a=m.createElement("div"),a.className="arcy-bar",a.setAttribute("role","group"),a.setAttribute("aria-label",t.openChat),f=m.createElement("form"),f.className="arcy-bar-form",o=m.createElement("input"),o.type="text",o.className="arcy-bar-input",o.maxLength=oi,o.setAttribute("aria-label",t.openChat),o.autocomplete="off",J=m.createElement("div"),J.className=Un,J.style.setProperty("display","none"),k=m.createElement("button"),k.type="button",k.className="arcy-bar-grip",k.setAttribute("aria-label",t.moveBar),k.setAttribute("data-tip",t.moveBar),k.appendChild(Ae(m,fi,16)),k.addEventListener("pointerdown",ue),k.addEventListener("click",re=>re.stopPropagation()),i=m.createElement("button"),i.type="button",i.className="arcy-bar-leading",u=h?ar(m,h,v):Ae(m,lr,v),i.appendChild(u),S=m.createElement("div"),S.className="arcy-bar-menu",S.setAttribute("role","menu"),S.style.setProperty("display","none"),E=m.createElement("button"),E.type="button",E.className="arcy-bar-menu-item",E.setAttribute("role","menuitem"),E.appendChild(Ae(m,ui,16)),E.appendChild(m.createTextNode(t.attachImage)),S.appendChild(E),F=m.createElement("input"),F.type="file",F.accept=Bn.join(","),F.multiple=true,F.tabIndex=-1,F.setAttribute("aria-hidden","true"),F.style.setProperty("display","none"),a.appendChild(F),A=m.createElement("button"),A.type="submit",A.className="arcy-bar-send",A.setAttribute("aria-label",t.send),A.appendChild(Ae(m,pi,18)),f.appendChild(k),f.appendChild(i),f.appendChild(o),f.appendChild(A),M=m.createElement("div"),M.className="arcy-bar-status",M.style.setProperty("display","none");let O=m.createElement("span");O.className="arcy-bar-dot",O.setAttribute("aria-hidden","true"),C=m.createElement("span"),C.className="arcy-bar-flow-name",G=m.createElement("span"),G.className="arcy-bar-flow-step",U=m.createElement("button"),U.type="button",U.className="arcy-bar-stop",U.appendChild(Ae(m,mi,15,2)),U.appendChild(m.createTextNode(t.flowStop)),M.appendChild(O),M.appendChild(C),M.appendChild(G),M.appendChild(U),a.appendChild(J),a.appendChild(f),a.appendChild(M),a.appendChild(S),K=m.createElement("div"),K.className="arcy-bar-disclaimer",K.style.setProperty("display","none"),l.appendChild(a),l.appendChild(K),I=m.createElement("button"),I.type="button",I.className="arcy-bar-dock",I.setAttribute("aria-label",t.openChat),I.setAttribute("data-tip",t.openChat),I.setAttribute("data-tip-placement","above"),I.setAttribute("data-tip-align","end");for(let[re,ve]of ir)I.style.setProperty(re,ve);for(let[re,ve]of sr)I.style.setProperty(re,ve,"important");I.style.setProperty("align-items","center"),I.style.setProperty("justify-content","center"),I.style.setProperty("width",nr),I.style.setProperty("height",nr),V=Ae(m,cr,18),I.appendChild(V),N(),I.addEventListener("click",Z),f.addEventListener("submit",nt),o.addEventListener("focus",fe),a.addEventListener("click",ke),a.addEventListener("pointerdown",rt,true),i.addEventListener("click",Ge),E.addEventListener("click",d),F.addEventListener("change",y),U.addEventListener("click",T),a.addEventListener("dragover",pe),a.addEventListener("drop",Re),m.addEventListener("pointerdown",B,true),r.root.addEventListener("pointerdown",Q,true),m.addEventListener("keydown",g,true);let _=m.defaultView;_==null||_.addEventListener("resize",we),_==null||_.addEventListener("orientationchange",we),(te=_==null?void 0:_.visualViewport)==null||te.addEventListener("resize",we),(W=_==null?void 0:_.visualViewport)==null||W.addEventListener("scroll",we),r.root.appendChild(l),r.root.appendChild(I),Y=dt(_!=null?_:null),P=((Pe=e.readDocked)==null?void 0:Pe.call(e))===true,se(),z();}function jr(){var O,_;if(!r)return;let c=r.host.ownerDocument.defaultView;c==null||c.removeEventListener("resize",we),c==null||c.removeEventListener("orientationchange",we),(O=c==null?void 0:c.visualViewport)==null||O.removeEventListener("resize",we),(_=c==null?void 0:c.visualViewport)==null||_.removeEventListener("scroll",we),f==null||f.removeEventListener("submit",nt),o==null||o.removeEventListener("focus",fe),a==null||a.removeEventListener("click",ke),a==null||a.removeEventListener("pointerdown",rt,true),i==null||i.removeEventListener("click",Ge),E==null||E.removeEventListener("click",d),F==null||F.removeEventListener("change",y),U==null||U.removeEventListener("click",T),a==null||a.removeEventListener("dragover",pe),a==null||a.removeEventListener("drop",Re),I==null||I.removeEventListener("click",Z);let m=r.host.ownerDocument;m.removeEventListener("pointerdown",B,true),r.root.removeEventListener("pointerdown",Q,true),m.removeEventListener("keydown",g,true),r.destroy(),r=null,l=a=f=M=C=G=K=null,o=null,E=A=U=null,F=null,i=null,u=null,I=null,V=null,S=null,J=null,ce=false,L=null,ee="idle";}return {mount:Xr,unmount:jr,isMounted:()=>r!==null&&r.host.isConnected,getElement:()=>a,getRoot:()=>{var c;return (c=r==null?void 0:r.root)!=null?c:null},getHost:()=>{var c;return (c=r==null?void 0:r.host)!=null?c:null},setMode(c){ee!==c&&(ee=c,Te=false,z());},getMode:()=>L?"flow":ee,setGeometry(c){var m,O,_;n={widthPercent:(m=c.widthPercent)!=null?m:n.widthPercent,bottomOffset:(O=c.bottomOffset)!=null?O:n.bottomOffset,collapsedWidth:(_=c.collapsedWidth)!=null?_:n.collapsedWidth},se();},getMetrics:()=>ae($({},n),{offset:L||!D||Y.isMobile?Qe:X,height:(l==null?void 0:l.offsetHeight)||(a==null?void 0:a.offsetHeight)||tr,keyboardOffset:Y.keyboardOffset,isMobile:Y.isMobile,viewportHeight:Y.height,viewportWidth:Y.width}),getHeight:()=>(l==null?void 0:l.offsetHeight)||(a==null?void 0:a.offsetHeight)||tr,setLabels(c){t=$($({},t),c);try{if(A==null||A.setAttribute("aria-label",t.send),E){let m=E.lastChild;m&&(m.textContent=t.attachImage);}if(a==null||a.setAttribute("aria-label",t.openChat),o==null||o.setAttribute("aria-label",t.openChat),I&&(I.setAttribute("aria-label",t.openChat),I.setAttribute("data-tip",t.openChat)),k&&(k.setAttribute("aria-label",t.moveBar),k.setAttribute("data-tip",t.moveBar)),U){let m=U.lastChild;m&&(m.textContent=t.flowStop);}}catch(m){}z();},setPlaceholder(c){try{o&&(o.placeholder=c!=null?c:"");}catch(m){}},setDisabled(c){try{o&&(o.disabled=c),A&&(A.disabled=c),E&&(E.disabled=c),c&&x();}catch(m){}},setAttachEnabled(c){le!==c&&(le=c,z());},setDraggable(c){var m,O,_;D!==c&&(D=c,X=c&&(O=(m=e.readPosition)==null?void 0:m.call(e))!=null?O:Qe,se(),(_=e.onGeometryChange)==null||_.call(e));},setIcon(c){h!==c&&(h=c,xe());},setIconSize(c){v!==c&&(v=c,xe());},setWelcomeIcon(c){p!==c&&(p=c,b=null,N());},setDocked(c){P!==c&&(P=c,q("onDockedChange",()=>{var m;return (m=e.onDockedChange)==null?void 0:m.call(e,c)})(),c&&x(),se(),q("onGeometryChange",()=>{var m;return (m=e.onGeometryChange)==null?void 0:m.call(e)})());},isDocked:()=>P,setFlow(c){L=c,c||(j=false),z();},setAwaitingInput(c){j!==c&&(j=c,z(),q("onGeometryChange",()=>{var m;return (m=e.onGeometryChange)==null?void 0:m.call(e)})());},setDisclaimer(c){try{if(K&&(K.textContent="",c!=null))if(typeof c=="string")K.textContent=c;else {let m=K.ownerDocument;K.appendChild(m.createTextNode(c.before));let O=m.createElement("a");O.className=Hn,O.href=c.linkHref,O.target="_blank",O.rel="noopener noreferrer",O.textContent=c.linkLabel,K.appendChild(O),c.after&&K.appendChild(m.createTextNode(c.after));}}catch(m){}z();},setAttachmentCount(c){Ce=c;try{_e();}catch(m){}},attachmentSlot:()=>J,focusInput(){try{r&&Pt(r.host.ownerDocument,r.host),o==null||o.focus();}catch(c){}},reposition:()=>{Y=dt(typeof window!="undefined"?window:null),se();},readValue:()=>{var c;return (c=o==null?void 0:o.value)!=null?c:""},clearValue(){try{o&&(o.value="");}catch(c){}}}}var hi="https://api.arcyai.com";function Kt(e){return typeof e!="string"||e.length===0||e.length>2048?false:/^https:\/\//i.test(e)?true:e.startsWith("/")&&!e.startsWith("//")}function ht(e,t){return Kt(e)?/^https:\/\//i.test(e)?e:`${(t!=null?t:hi).replace(/\/+$/,"")}${e}`:null}var yi=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,bi=/^[a-z0-9-]{1,32}$/,dr={none:"none",soft:"0 0 2px rgba(16, 24, 40, 0.04), 0 0 8px rgba(16, 24, 40, 0.06)",medium:"0 0 4px rgba(16, 24, 40, 0.05), 0 0 20px rgba(16, 24, 40, 0.10)",strong:"0 0 8px rgba(16, 24, 40, 0.07), 0 0 36px rgba(16, 24, 40, 0.16)",bold:"0 0 12px rgba(16, 24, 40, 0.10), 0 0 48px rgba(16, 24, 40, 0.22)"},wi=20,vi=50,Si=30,Ei=80,Ti=0,xi=120,ki=14,Ai=28,Ci=180,_i=480,Ii=2147483647,yt={vars:{},widthPercent:null,bottomOffset:null,collapsedWidth:null,barIconSize:null,maxHeightPercent:null,zIndex:null};function me(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Me(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.min(n,Math.max(t,e))}function Ze(e,t,n){if(t)for(let[r,s]of n){let l=t[r];typeof l=="string"&&yi.test(l)&&(e[s]=l);}}function We(e,t,n,r,s){let l=Me(n,r,s);l!==null&&(e[t]=`${l}px`);}function fr(e,t,n){typeof n=="string"&&n in dr&&(e[t]=dr[n]);}function Gt(e){let t=me(e);if(!t)return yt;let n={},r=me(t.base);Ze(n,me(r==null?void 0:r.brand),[["text","--_arcy-brand-text"],["background","--_arcy-brand-bg"],["hover","--_arcy-brand-bg-hover"],["active","--_arcy-brand-bg-active"]]),Ze(n,me(r==null?void 0:r.main),[["text","--_arcy-main-text"],["background","--_arcy-main-bg"]]);let s=me(r==null?void 0:r.border);We(n,"--_arcy-border-width",s==null?void 0:s.width,0,8),Ze(n,s,[["color","--_arcy-border-color"]]);let l=Me(r==null?void 0:r.glassiness,0,100);l!==null&&l>0&&(n["--_arcy-glass-blur"]=`${Math.round(l/5)}px`,n["--_arcy-glass-alpha"]=`${Math.round(l/2)}%`);let a=r==null?void 0:r.fontFamily;typeof a=="string"&&bi.test(a)&&a!=="system"&&(n[Ht]=a);let f=Me(r==null?void 0:r.zIndex,0,Ii);We(n,"--arcy-bar-radius",r==null?void 0:r.borderRadius,0,32),We(n,"--_arcy-chat-radius",r==null?void 0:r.borderRadius,0,32),fr(n,"--arcy-bar-shadow",r==null?void 0:r.shadow),fr(n,"--_arcy-chat-shadow",r==null?void 0:r.shadow);let o=me(t.bar),i=me(t.chat);We(n,"--_arcy-chat-logo-size",i==null?void 0:i.logoSize,16,48),We(n,"--_arcy-chat-welcome-icon-size",i==null?void 0:i.welcomeIconSize,16,72),Ze(n,me(i==null?void 0:i.assistantBubble),[["background","--_arcy-assistant-bg"],["text","--_arcy-assistant-text"]]);let u=me(i==null?void 0:i.scrollbar);return We(n,"--_arcy-scroll-width",u==null?void 0:u.width,2,16),Ze(n,u,[["track","--_arcy-scroll-track"],["thumb","--_arcy-scroll-thumb"],["thumbHover","--_arcy-scroll-thumb-hover"]]),{vars:n,widthPercent:Me(i==null?void 0:i.width,wi,vi),bottomOffset:Me(o==null?void 0:o.bottomOffset,Ti,xi),collapsedWidth:Me(o==null?void 0:o.collapsedWidth,Ci,_i),barIconSize:Me(o==null?void 0:o.iconSize,ki,Ai),maxHeightPercent:Me(i==null?void 0:i.maxHeight,Si,Ei),zIndex:f!==null?Math.round(f):null}}var Ri=["--_arcy-brand-text","--_arcy-brand-bg","--_arcy-brand-bg-hover","--_arcy-brand-bg-active","--_arcy-main-text","--_arcy-main-bg","--_arcy-border-width","--_arcy-border-color","--_arcy-glass-blur","--_arcy-glass-alpha",Ht,"--arcy-bar-radius","--arcy-bar-shadow","--_arcy-chat-radius","--_arcy-chat-logo-size","--_arcy-chat-welcome-icon-size","--_arcy-chat-shadow","--_arcy-assistant-bg","--_arcy-assistant-text","--_arcy-scroll-width","--_arcy-scroll-track","--_arcy-scroll-thumb","--_arcy-scroll-thumb-hover"];function pr(e,t){try{for(let n of Ri){let r=t.vars[n];r===void 0?e.style.removeProperty(n):e.style.setProperty(n,r);}e.style.setProperty("z-index",t.zIndex===null?Rt:String(t.zIndex),"important");}catch(n){w(`The widget could not apply its theme. ${String(n)}`);}}var Pi="arcy.tokens.",Li=4096,Oi=100;function et(e){let t=me(e);if(!t)return null;let n=typeof t.name=="string"?t.name.slice(0,Oi):"",r=t.logoUrl,s=Kt(r)?r:null;return {name:n,logoUrl:s}}function mr(e,t=Ee()){let n=oe(t),r=Pi+e;return {read(){let s=me(ie(n,r));return {tokens:Gt(s==null?void 0:s.t),identity:et(s==null?void 0:s.w)}},remember(s,l){let a=me(s),f=et(l);if(!a&&!f){n.removeItem(r);return}try{let o={t:a!=null?a:void 0,w:f!=null?f:void 0};if(JSON.stringify(o).length>Li)return;ne(n,r,o);}catch(o){}}}}var Mi="arcy.shell.",gr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,Fi=/^[a-z]{2}-[A-Z]{2}$/;function Ni(e){if(!e||typeof e!="object")return null;let{x:t,y:n}=e;return typeof t!="number"||typeof n!="number"||!Number.isFinite(t)||!Number.isFinite(n)?null:{x:t,y:n}}function Di(e){var s,l,a;let t=typeof globalThis!="undefined"?globalThis.crypto:void 0;if(!e&&t&&typeof t.randomUUID=="function")try{let f=t.randomUUID();if(gr.test(f))return f}catch(f){}let n=new Uint8Array(16);if(e)e(n);else if(t&&typeof t.getRandomValues=="function")t.getRandomValues(n);else for(let f=0;f<n.length;f++)n[f]=Math.floor(Math.random()*256);n[6]=((s=n[6])!=null?s:0)&15|64,n[8]=((l=n[8])!=null?l:0)&63|128;let r="";for(let f=0;f<n.length;f++)r+=((a=n[f])!=null?a:0).toString(16).padStart(2,"0");return `${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function hr(e,{store:t=Ee(),fill:n}={}){let r=oe(t),s=Mi+e;function l(){var o;return (o=ie(r,s))!=null?o:{}}function a(o){ne(r,s,$($({},l()),o));}function f(){let o=l(),i=o.anonymousId;return {anonymousId:typeof i=="string"&&gr.test(i)?i:null,position:Ni(o.position),docked:o.docked===true,locale:typeof o.locale=="string"&&Fi.test(o.locale)?o.locale:null}}return {read:f,anonymousId(){let o=f().anonymousId;return o||(a({anonymousId:Di(n)}),f().anonymousId)},rememberPosition(o){a({position:o});},rememberDocked(o){a({docked:o});},rememberLocale(o){a({locale:o});},forgetAnonymousId(){let o=l();o.anonymousId!==void 0&&(delete o.anonymousId,Object.keys(o).length===0?r.removeItem(s):ne(r,s,o));}}}var Bi="arcy.visit.",yr="first";function br(e,t=Ve()){let n=oe(t),r=Bi+e;return {markFirstVisit(){n.setItem(r,yr);},isFirstVisit(){return n.getItem(r)===yr}}}var wr="0123456789ABCDEFGHJKMNPQRSTVWXYZ";var Yt=e=>{let t=typeof globalThis!="undefined"?globalThis.crypto:void 0;if(t&&typeof t.getRandomValues=="function"){t.getRandomValues(e);return}for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);};function $e(e,t=Yt){var a,f;let n="",r=Math.floor(e);for(let o=0;o<10;o++)n=((a=wr[r%32])!=null?a:"0")+n,r=Math.floor(r/32);let s=new Uint8Array(16);t(s);let l="";for(let o=0;o<16;o++)l+=wr[((f=s[o])!=null?f:0)%32];return n+l}var Hi="arcy.chat.",Ui=1440*60*1e3;function vr(e,{store:t=Ee(),fill:n=Yt,now:r=Date.now}={}){let s=oe(t),l=Hi+e;function a(){var o;return (o=ie(s,l))!=null?o:{}}function f(){let o=$e(r(),n);return ne(s,l,{id:o,lastActiveAt:r()}),o}return {id(){let o=a(),i=typeof o.id=="string"?o.id:null,u=typeof o.lastActiveAt=="number"?o.lastActiveAt:null;return i&&u!==null&&r()-u<Ui?i:f()},touch(){let o=a();typeof o.id=="string"&&ne(s,l,ae($({},o),{lastActiveAt:r()}));},reset(){f();},adopt(o){return typeof o!="string"||o.length===0?this.id():(ne(s,l,{id:o,lastActiveAt:r()}),o)},startNew(){return f()}}}var Vi=[["utm_source","utmSource"],["utm_medium","utmMedium"],["utm_campaign","utmCampaign"],["utm_content","utmContent"],["utm_term","utmTerm"]],Wi=255,$i=512,Ki=/[\u0000-\u001f\u007f]/g;function Sr(e,t){let n=e.replace(Ki,"").trim();if(n.length!==0)return n.slice(0,t)}function Gi(e){if(!(typeof e!="string"||e.length===0))try{let t=new URL(e),n=t.host;if(!n)return;let r=Be(t.pathname);return Sr(r==="/"?n:n+r,$i)}catch(t){return}}function Yi(e){let t={};if(typeof e!="string"||e.length===0)return t;let n=e.charAt(0)==="?"?e.slice(1):e;for(let r of n.split("&")){let s=r.indexOf("=");if(s<=0)continue;let l=r.slice(0,s).toLowerCase(),a=Vi.find(i=>i[0]===l);if(!a)continue;let f=r.slice(s+1).replace(/\+/g," ");try{f=decodeURIComponent(f);}catch(i){}let o=Sr(f,Wi);o&&(t[a[1]]=o);}return t}function zi(e){let t=typeof e=="string"?e:"";if(t.length!==0){if(/Edg[A-Z]?\//.test(t))return "Edge";if(/OPR\/|Opera/.test(t))return "Opera";if(/SamsungBrowser\//.test(t))return "Samsung Internet";if(/Firefox\/|FxiOS\//.test(t))return "Firefox";if(/Chrome\/|CriOS\//.test(t))return "Chrome";if(/Safari\//.test(t))return "Safari"}}function Xi(e){let t=typeof e=="string"?e:"";if(t.length!==0){if(/iPhone|iPad|iPod/.test(t))return "iOS";if(/Android/.test(t))return "Android";if(/CrOS/.test(t))return "ChromeOS";if(/Windows/.test(t))return "Windows";if(/Mac OS X|Macintosh/.test(t))return "macOS";if(/Linux/.test(t))return "Linux"}}function ji(e){if(!(typeof e!="number"||!(e>0)))return e<480?"xs":e<768?"sm":e<1024?"md":e<1280?"lg":"xl"}function Er(e){let t=$({},Yi(e.search)),n=Gi(e.referrer);n&&(t.referrer=n);let r=zi(e.userAgent);r&&(t.browser=r);let s=Xi(e.userAgent);s&&(t.os=s);let l=ji(e.viewportWidth);return l&&(t.viewport=l),Object.keys(t).length>0?t:void 0}var qi=["ON","REQUIRE_CONSENT","OFF"];function Tr(e,t){function n(){let s=ie(e,t);if(!s)return {};let l=typeof s.state=="string"&&qi.indexOf(s.state)!==-1?s.state:void 0,a=typeof s.consent=="boolean"?s.consent:void 0;return {state:l,consent:a}}function r(s){if(s.state===void 0&&s.consent===void 0){e.removeItem(t);return}ne(e,t,s);}return {state:()=>{var s;return (s=n().state)!=null?s:null},consent:()=>{var s;return (s=n().consent)!=null?s:null},setState(s){r(ae($({},n()),{state:s}));},setConsent(s){let l=n();r({state:l.state,consent:s?true:void 0});},clearState(){r({state:void 0,consent:n().consent});},shouldCapture(){let{state:s,consent:l}=n();return s===void 0||s==="OFF"?false:s==="REQUIRE_CONSENT"?l===true:true}}}var Ji=/iPhone|iPod|Android.*Mobile|Windows Phone|BlackBerry|Opera Mini|IEMobile/i,Qi=/iPad|Tablet|PlayBook|Silk|Kindle/i;function xr(e){var n;let t=(n=e==null?void 0:e.userAgent)!=null?n:"";return Qi.test(t)||(e==null?void 0:e.platform)==="MacIntel"&&typeof e.maxTouchPoints=="number"&&e.maxTouchPoints>1?"tablet":Ji.test(t)?"mobile":/Android/i.test(t)?"tablet":"desktop"}var Ar=100,Zi=4096,es=["INPUT","TEXTAREA","SELECT"];function kr(e){if(e.length!==0&&!Xe(e.slice(0,Zi)))return e.slice(0,Ar)}function zt(e,t){var a,f,o;let n=((a=e.tagName)!=null?a:"").toUpperCase(),r={tag:n.toLowerCase()},s=e.getAttribute("role");s&&(r.role=s.slice(0,64));let l=e.getAttribute("type");if(l&&(r.type=l.slice(0,32)),es.indexOf(n)===-1){let i=((f=e.textContent)!=null?f:"").replace(/\s+/g," ").trim(),u=kr(i);u&&(r.text=u);}else {let i=(o=e.getAttribute("aria-label"))!=null?o:e.getAttribute("name"),u=kr(i!=null?i:"");u&&(r.label=u);}if(t){let i=t(e);i&&Object.keys(i).length>0&&(r.fingerprint=i);}return r}function Cr(e,t){return zt(e,t)}function _r(e,t){var s;let n=zt(e,t),r=(s=e.validity)==null?void 0:s.valid;return typeof r=="boolean"&&(n.valid=r),n}function Ir(e,t){var l,a;let n=zt(e,t),r=(l=e.getAttribute("name"))!=null?l:e.getAttribute("id");r&&(n.form=r.slice(0,Ar));let s=(a=e.elements)==null?void 0:a.length;return typeof s=="number"&&(n.fieldCount=s),n}var ts=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],ns="OTHER",rs=400,Rr=200,os=/[\u0000-\u001f\u007f]+/g;function jt(e){let t=null;if(typeof e=="string")t=e;else if(e&&typeof e=="object"){let r=e.message;typeof r=="string"&&(t=r);}if(t===null)return null;let n=t.replace(os," ").trim();return n.length===0?null:n.length>Rr?n.slice(0,Rr):n}function Xt(e){if(typeof e!="string")return "GET";let t=e.toUpperCase();return ts.indexOf(t)===-1?ns:t}function is(e){return typeof e=="number"&&e>=rs}function Pr(e){let{target:t,report:n,ignore:r}=e,s=[];function l(o,i,u){var h;try{if(!is(i)||u!==null&&(r!=null&&r(u)))return;n({method:o,status:i,url:u===null?null:je(u,(h=t.location)==null?void 0:h.href)});}catch(v){}}function a(){let o=t.fetch;if(typeof o!="function")return;let i=function(...u){let h=o.apply(this,u);try{let v=h;if(typeof(v==null?void 0:v.then)!="function")return h;v.then(p=>{let b=p==null?void 0:p.status;l(ss(u),b,as(u));},()=>{});}catch(v){}return h};t.fetch=i,s.push(()=>{t.fetch===i&&(t.fetch=o);});}function f(){var b;let o=(b=t.XMLHttpRequest)==null?void 0:b.prototype,i=o==null?void 0:o.open,u=o==null?void 0:o.send;if(!o||typeof i!="function"||typeof u!="function"||typeof WeakMap!="function")return;let h=new WeakMap,v=function(...k){var I,V;let D=i.apply(this,k);try{h.set(this,{method:Xt(k[0]),url:typeof k[1]=="string"?k[1]:null,listening:(V=(I=h.get(this))==null?void 0:I.listening)!=null?V:!1});}catch(P){}return D},p=function(...k){try{let D=this,I=h.get(this);typeof D.addEventListener=="function"&&(I==null?void 0:I.listening)!==!0&&(I&&(I.listening=!0),D.addEventListener("loadend",()=>{var P,X;let V=h.get(this);l((P=V==null?void 0:V.method)!=null?P:"GET",D.status,(X=V==null?void 0:V.url)!=null?X:null);}));}catch(D){}return u.apply(this,k)};o.open=v,s.push(()=>{o.open===v&&(o.open=i);}),o.send=p,s.push(()=>{o.send===p&&(o.send=u);});}try{a(),f();}catch(o){for(let i of s)try{i();}catch(u){}return null}return s.length===0?null:()=>{for(let o of s)try{o();}catch(i){}s.length=0;}}function ss(e){let t=e[1];if(t&&typeof t=="object"&&typeof t.method=="string")return Xt(t.method);let n=e[0];return n&&typeof n=="object"&&typeof n.method=="string"?Xt(n.method):"GET"}function as(e){let t=e[0];if(typeof t=="string")return t;if(!t||typeof t!="object")return null;let n=t.url;if(typeof n=="string")return n;let r=t.href;return typeof r=="string"?r:null}function Lr(e,t,n,r,s){let l={id:e,name:t,occurredAt:n,sessionId:r.sessionId};return r.userId&&(l.userId=r.userId),r.visitorId&&(l.visitorId=r.visitorId),r.route&&(l.route=r.route),r.localeCode&&(l.localeCode=r.localeCode),r.deviceClass&&(l.deviceClass=r.deviceClass),r.flowSessionId&&(l.flowSessionId=r.flowSessionId),s&&Object.keys(s).length>0&&(l.payload=s),l}var ls=["button","submit","reset","image","hidden","checkbox","radio"],cs=["INPUT","TEXTAREA","SELECT"];function us(e){var r,s;if(!e||typeof e.getAttribute!="function")return false;let t=((r=e.tagName)!=null?r:"").toUpperCase();if(cs.indexOf(t)===-1)return false;if(t!=="INPUT")return true;let n=((s=e.getAttribute("type"))!=null?s:"text").toLowerCase();return ls.indexOf(n)===-1}function Or(e){let t=e.value;return typeof t=="string"?t.length===0:t==null}function Mr(e){let t=null;return {focus(n){us(n)&&(t={element:n,empty:Or(n),filled:false,cleared:false},e.emit("field_focused",n));},change(n){if(!t||t.element!==n)return;let r=Or(n);if(r!==t.empty){if(t.empty=r,!r){if(t.filled)return;t.filled=true,e.emit("input_filled",n);return}t.cleared||(t.cleared=true,e.emit("input_cleared",n));}},blur(n){t&&t.element===n&&(t=null);}}}var ds=["A","BUTTON","INPUT","SELECT","TEXTAREA","SUMMARY","OPTION","LABEL"],fs=["button","link","checkbox","radio","switch","tab","menuitem","menuitemcheckbox","menuitemradio","option","combobox","textbox","searchbox","slider","spinbutton","treeitem"];function ps(e,t){var l;let n=((l=e.tagName)!=null?l:"").toUpperCase();if(ds.indexOf(n)!==-1)return true;let r=e.getAttribute("role");if(r&&fs.indexOf(r.toLowerCase())!==-1||e.getAttribute("onclick")!==null)return true;let s=e.getAttribute("tabindex");return s!==null&&Number(s)>=0||e.getAttribute("contenteditable")==="true"?true:t?t(e)==="pointer":false}function Fr(e,t){let n=e;for(let r=0;n&&r<6;r++){if(ps(n,t))return n;n=n.parentElement;}return null}var ms=[25,50,75,100],gs=250,hs=100;function Nr(e){let{readDepth:t,emit:n,setTimeoutImpl:r=(i,u)=>setTimeout(i,u),clearTimeoutImpl:s=i=>clearTimeout(i),throttleMs:l=gs}=e,a=0,f=null;function o(){f=null;let i=null;try{i=t();}catch(h){return}if(i===null)return;let u=0;for(let h of ms)i>=h&&(u=h);u<=a||(a=u,n(u));}return {scrolled(){if(f===null&&!(a>=hs))try{f=r(o,l);}catch(i){f=null;}},reset(){if(a=0,f!==null){try{s(f);}catch(i){}f=null;}},dispose(){if(f!==null){try{s(f);}catch(i){}f=null;}}}}function Dr(e){var a,f,o;let t=(a=e.innerHeight)!=null?a:0,n=(f=e.documentHeight)!=null?f:0;if(!(n-t>0)||!(t>0))return null;let l=(((o=e.scrollY)!=null?o:0)+t)/n*100;return l>0?l>100?100:l:0}var ys=1800*1e3,bs=60*1e3;function Br({store:e,key:t,now:n,fill:r,windowMs:s=ys}){function l(i){let u=ie(e,t);return u&&typeof u.id=="string"&&u.id.length>0&&typeof u.seen=="number"&&i-u.seen<s?u:null}function a(i){let u=$e(i,r);return ne(e,t,{id:u,seen:i}),u}function f(){let i=n(),u=l(i);return u?(i-u.seen>=bs&&ne(e,t,{id:u.id,seen:i}),u.id):a(i)}function o(){var u,h;let i=n();return (h=(u=l(i))==null?void 0:u.id)!=null?h:a(i)}return {touch:f,current:o,peek:()=>ie(e,t),clear(){e.removeItem(t);}}}var qt="https://api.arcyai.com",ws="/api/v1/sdk/telemetry";function vs(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=56319?(t+=4,n++):t+=3;}return t}function Ss(e){let t=[],n=[],r=13;for(let s of e){let l=vs(JSON.stringify(s))+1;(n.length>=100||n.length>0&&r+l>65536)&&(t.push(n),n=[],r=13),n.push(s),r+=l;}return n.length>0&&t.push(n),t}function Hr(e){let{token:t,apiBase:n=qt,fetchImpl:r,sendBeacon:s,setTimeoutImpl:l=(A,M)=>setTimeout(A,M),clearTimeoutImpl:a=A=>clearTimeout(A),sessionStore:f,stopKey:o,onTelemetryOff:i}=e,u=`${n}${ws}`,h=[],v=null,p=k(),b=Promise.resolve();function k(){return !f||!o?null:f.getItem(o)==="tracked_events_cap"?"tracked_events_cap":null}function D(A){p=A,h=[],I(),A==="tracked_events_cap"?f&&o&&f.setItem(o,A):i&&i();}function I(){v!==null&&(a(v),v=null);}function V(){v===null&&(v=l(()=>{v=null,F(false);},5e3));}function P(A){if(p===null){if(h.push(A),h.length>1e3&&h.splice(0,h.length-1e3),h.length>=20){F(false);return}V();}}function X(A){return H(this,null,function*(){try{let M=yield A.json();if(M&&typeof M=="object"){let C=M.code;if(typeof C=="string")return C}}catch(M){}return null})}function S(A){return H(this,null,function*(){if(!r)return A;let M;try{M=yield r(u,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({events:A}),credentials:"omit"});}catch(C){return A}return M.status===403?(yield X(M))==="telemetry_off"?(D("telemetry_off"),[]):[]:M.status===429?(yield X(M))==="tracked_events_cap"?(D("tracked_events_cap"),[]):A:M.status>=500?A:[]})}function E(A){let M=JSON.stringify({events:A}),C=`${u}?token=${encodeURIComponent(t)}`;if(s&&typeof Blob!="undefined")try{if(s(C,new Blob([M],{type:"application/json"})))return !0}catch(G){}if(r)try{return r(u,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:M,keepalive:!0,credentials:"omit"}).catch(()=>{}),!0}catch(G){return false}return false}function F(A=false){return H(this,null,function*(){if(I(),p!==null||h.length===0){yield b;return}let M=h;h=[];let C=Ss(M);if(A){for(let G of C)E(G);return}b=b.then(()=>H(null,null,function*(){let G=[];for(let U of C){if(p!==null)return;G.push(...yield S(U));}G.length>0&&p===null&&(h=G.concat(h),h.length>1e3&&h.splice(0,h.length-1e3),V());})),yield b;})}return {enqueue:P,flush:F,stopped:()=>p,discard(){h=[],I();},dispose(){I();}}}var Ur="arcy:routechange",Es="arcy.session.",Ts="arcy.telemetry.",xs="arcy.telemetry.stop.";function bt(e){return e.isTrusted===false}function Jt(e){var ue,He,se,xe,_e;let{token:t,apiBase:n,describeElement:r,getUserId:s,getVisitorId:l,getFlowSessionId:a,now:f=()=>Date.now(),fill:o}=e,i=e.win!==void 0?e.win:typeof window!="undefined"?window:null,u=e.doc!==void 0?e.doc:typeof document!="undefined"?document:null,h=(ue=e.localStore)!=null?ue:Ee(),v=Tr(h,Ts+t),p=Br({store:h,key:Es+t,now:f,fill:o}),b=Hr({token:t,apiBase:n,fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,sendBeacon:(He=i==null?void 0:i.navigator)!=null&&He.sendBeacon&&typeof i.navigator.sendBeacon=="function"?i.navigator.sendBeacon.bind(i.navigator):null,setTimeoutImpl:e.setTimeoutImpl,clearTimeoutImpl:e.clearTimeoutImpl,sessionStore:(se=e.sessionStore)!=null?se:Ve(),stopKey:xs+t,onTelemetryOff:()=>v.clearState()}),k=xr(i==null?void 0:i.navigator),D=(_e=(xe=i==null?void 0:i.navigator)==null?void 0:xe.language)!=null?_e:void 0,I=false,V=false,P=null,X=false;function S(){var R,x;return (x=je((R=i==null?void 0:i.location)==null?void 0:R.href))!=null?x:void 0}function E(R,x,N){var Fe,be,Ie,Ue;if(V||!v.shouldCapture()||b.stopped()!==null)return false;let z=f(),ye=p.touch(),de=Lr($e(z,o),R,z,{sessionId:ye,userId:(Fe=s==null?void 0:s())!=null?Fe:void 0,visitorId:(be=l==null?void 0:l())!=null?be:void 0,route:S(),localeCode:D,deviceClass:k,flowSessionId:(Ue=(Ie=N==null?void 0:N.flowSessionId)!=null?Ie:a==null?void 0:a())!=null?Ue:void 0},x);return N!=null&&N.flowId&&(de.flowId=N.flowId),N!=null&&N.flowVersion&&(de.flowVersion=N.flowVersion),N!=null&&N.stepCvid&&(de.stepCvid=N.stepCvid),b.enqueue(de),true}let F=R=>{try{let x=R;if(bt(x))return;let N=i!=null&&i.getComputedStyle?ye=>{var de;try{return (de=i.getComputedStyle(ye).cursor)!=null?de:null}catch(Fe){return null}}:void 0,z=Fr(x.target,N);if(!z)return;E("interaction_click",Cr(z,r));}catch(x){}},A=R=>{try{let x=R;if(bt(x)||!x.target||typeof x.target.getAttribute!="function")return;E("form_submit",Ir(x.target,r));}catch(x){}},M=()=>{var R;try{let x=(R=S())!=null?R:null;if(x===P)return;let N=P;P=x,G.reset(),E("navigation",N?{from:N}:void 0);}catch(x){}},C=Mr({emit:(R,x)=>{E(R,_r(x,r));}}),G=Nr({readDepth:()=>{var R;return Dr({scrollY:i==null?void 0:i.scrollY,innerHeight:i==null?void 0:i.innerHeight,documentHeight:(R=u==null?void 0:u.documentElement)==null?void 0:R.scrollHeight})},emit:R=>{E("scroll_depth",{percent:R});},setTimeoutImpl:e.setTimeoutImpl,clearTimeoutImpl:e.clearTimeoutImpl}),U=false,K=R=>{try{let x=R;if(bt(x)||!x.target)return;C.focus(x.target);}catch(x){}},J=R=>{try{let x=R;if(bt(x)||!x.target)return;C.change(x.target);}catch(x){}},ee=R=>{try{let x=R;if(!x.target)return;C.blur(x.target);}catch(x){}},L=()=>{try{G.scrolled();}catch(R){}},j=()=>{try{if((u==null?void 0:u.visibilityState)==="visible"){E("page_visible");return}E("page_hidden"),b.flush(!0);}catch(R){}},le=()=>{try{U||(U=!0,E("session_end")),b.flush(!0);}catch(R){}},Ce=R=>{var x;try{let N=R;Te({message:(x=jt(N.message))!=null?x:"Uncaught error",kind:"error",source:Y(N.filename)});}catch(N){}},ce=R=>{var x;try{Te({message:(x=jt(R.reason))!=null?x:"Unhandled promise rejection",kind:"unhandledrejection"});}catch(N){}};function Te(R){let x={message:R.message,kind:R.kind};R.source&&(x.source=R.source),E("js_error",x);}function Y(R){var x,N;if(typeof R=="string")return (N=je(R,(x=i==null?void 0:i.location)==null?void 0:x.href))!=null?N:void 0}let ge=(n!=null?n:qt).replace(/\/+$/,""),he=null;return {start(){var R;I||V||(I=true,P=(R=S())!=null?R:null,u==null||u.addEventListener("click",F,true),u==null||u.addEventListener("submit",A,true),u==null||u.addEventListener("focusin",K,true),u==null||u.addEventListener("focusout",ee,true),u==null||u.addEventListener("input",J,true),u==null||u.addEventListener("change",J,true),i==null||i.addEventListener(Ur,M),i==null||i.addEventListener("popstate",M),i==null||i.addEventListener("scroll",L,{passive:true}),i==null||i.addEventListener("pagehide",le),u==null||u.addEventListener("visibilitychange",j),i==null||i.addEventListener("error",Ce),i==null||i.addEventListener("unhandledrejection",ce),i&&he===null&&(he=Pr({target:i,report:x=>{let N={method:x.method,status:x.status};x.url&&(N.url=x.url),E("request_failed",N);},ignore:x=>x.indexOf(ge)===0})),X=!E("navigation")&&v.state()===null);},stop(R){V=true,I&&(I=false,u==null||u.removeEventListener("click",F,true),u==null||u.removeEventListener("submit",A,true),u==null||u.removeEventListener("focusin",K,true),u==null||u.removeEventListener("focusout",ee,true),u==null||u.removeEventListener("input",J,true),u==null||u.removeEventListener("change",J,true),i==null||i.removeEventListener(Ur,M),i==null||i.removeEventListener("popstate",M),i==null||i.removeEventListener("scroll",L),i==null||i.removeEventListener("pagehide",le),u==null||u.removeEventListener("visibilitychange",j),i==null||i.removeEventListener("error",Ce),i==null||i.removeEventListener("unhandledrejection",ce),he&&(he(),he=null),G.dispose(),R!=null&&R.discard?b.discard():b.flush(false),b.dispose());},setTelemetryState(R){v.setState(R),X&&(X=false,E("navigation"));},setTelemetryConsent(R){v.setConsent(R),R||b.discard();},track(R,x,N){E(R,x,N);},flush:()=>b.flush(false),sessionId:()=>p.current(),resetSession:()=>p.clear(),stopped:()=>b.stopped(),state:()=>v.state()}}var Vr="0.1.1";var ks=["telemetry","locale","defaultOpen","contentLocale","apiBase"];function Wr(){return {userId:null,isAnonymous:false,attributes:{}}}function As(e,t){return e==null?{ok:true,hash:void 0}:typeof e!="string"||e.length===0?(w(`${t}() was given a userHash that is not a string. Ignoring it.`),{ok:false}):{ok:true,hash:e}}function Qt(e,t){if(e===void 0)return {};if(typeof e!="object"||e===null||Array.isArray(e))return w(`${t}() attributes must be an object. Ignoring the call.`),null;let n={};for(let[r,s]of Object.entries(e)){if(s===void 0)continue;if(s===null){n[r]=null;continue}let l=typeof s;if(l==="string"||l==="number"||l==="boolean"){n[r]=s;continue}if(Array.isArray(s)&&s.every(a=>typeof a=="string")){n[r]=s;continue}w(`${t}() dropped "${r}": an attribute must be a string, number, boolean, null, or an array of strings.`);}return n}var Cs={cdnBase:null,loadChat:()=>Promise.resolve(null),loadFlow:()=>Promise.resolve(null),loadPicker:()=>Promise.resolve(null)};function $r(e){return _s({chunks:e}).api}function _s(e={}){var Ge;let t=(Ge=e.chunks)!=null?Ge:Cs,n=pn();function r(){var y;let d=l.apiBase;return typeof d=="string"&&d.length>0?d.replace(/\/+$/,""):(y=e.apiBase)!=null?y:Dt}let s=null,l={},a=Wr(),f=false,o=null,i=null,u=null,h=false,v=null,p=null,b=null,k=0,D,I,V=false,P=null,X=null,S=null,E=null,F=null,A=yt,M=null,C=null,G=null,U=null,K=null,J=false,ee=false;function L(d){return s===null?(w(`${d}() was called before init(). Ignoring.`),false):true}function j(d,y){return H(this,null,function*(){if(typeof d!="string"||d.length===0){w("init() needs an environment token. Ignoring the call.");return}if(s!==null){w("init() has already been called. Ignoring the second call.");return}if(s=d,l={},y!==void 0)if(typeof y!="object"||y===null)w("init() options must be an object. Continuing without them.");else for(let[T,g]of Object.entries(y)){if(!ks.includes(T)){w(`init() ignored unknown option "${T}". Only telemetry, locale, defaultOpen, contentLocale, and apiBase can be set in code; everything else is configured in the dashboard.`);continue}l[T]=g;}typeof window!="undefined"&&Sn(window,{apiBase:r(),cdnBase:t.cdnBase}),le(d),Ce(d),ce(d),yield Ne(),n.emit("ready"),l.defaultOpen&&fe();})}function le(d){try{P=hr(d);let y=P.read().anonymousId!==null;E=P.anonymousId(),X=br(d),y||X.markFirstVisit();}catch(y){P=null,E=null,w(`The ARCY session could not be started. ${String(y)}`);}try{S=vr(d);}catch(y){S=null,w(`The ARCY session could not be started. ${String(y)}`);}try{F=mr(d);let y=F.read();A=y.tokens,M=y.identity;}catch(y){F=null,A=yt,w(`The ARCY session could not be started. ${String(y)}`);}try{p=Jt({token:d,apiBase:r(),fetchImpl:e.fetchImpl,describeElement:y=>hn(y),getUserId:()=>a.isAnonymous?null:a.userId,getVisitorId:()=>E}),l.telemetry!==void 0&&p.setTelemetryConsent(l.telemetry===!0),p.start();}catch(y){w(`Telemetry could not start. ${String(y)}`);}try{b=Dn({token:d,apiBase:r(),fetchImpl:e.fetchImpl,setTimeoutImpl:e.setTimeoutImpl});}catch(y){w(`The ARCY session could not be started. ${String(y)}`);}ge();}function Ce(d){if(typeof window!="undefined")try{Mn({win:window,token:d,loadChunk:t.loadPicker,apiBase:r(),fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,setTimeoutImpl:e.setTimeoutImpl,onVerified:()=>p==null?void 0:p.stop({discard:!0})});}catch(y){w(`Design mode could not start. ${String(y)}`);}}function ce(d){if(typeof window!="undefined")try{let y=Fn(window,d);if(!y)return;p==null||p.stop({discard:!0}),h=!0,v=y;}catch(y){w(`The preview could not start. ${String(y)}`);}}function Te(d){var y,T;return Nn({apiBase:r(),token:s!=null?s:"",nonce:d,sessionToken:(T=(y=b==null?void 0:b.config())==null?void 0:y.sessionToken)!=null?T:null,userTraits:a.attributes,fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,setTimeoutImpl:e.setTimeoutImpl})}function Y(){ee=false,o==null||o.unmount(),o=null,i==null||i.destroy(),i=null,u==null||u.destroy(),u=null,C=null,G=null,U=null,ke();}function ge(){try{o||se(),he(),xe(),i==null||i.refreshChrome(),ee&&(ee=!1,fe());}catch(d){w(`The chat bar could not render. ${String(d)}`);}}function he(){var d,y,T,g;try{let B=o==null?void 0:o.getHost();if(!o||!B)return;pr(B,A),o.setGeometry({widthPercent:(d=A.widthPercent)!=null?d:mt,bottomOffset:(y=A.bottomOffset)!=null?y:ft,collapsedWidth:(T=A.collapsedWidth)!=null?T:gt}),o.setIconSize((g=A.barIconSize)!=null?g:pt);}catch(B){w(`The widget could not apply its theme. ${String(B)}`);}}function ue(){var Re,Z;let d=(Re=b==null?void 0:b.config())==null?void 0:Re.widget,y=(Z=et(d))!=null?Z:M;if(!y)return null;let T=Ye=>typeof Ye=="string"?Ye:"",g=d!=null&&d.chrome&&typeof d.chrome=="object"&&!Array.isArray(d.chrome)?$($({},ut),d.chrome):ut,B=d==null?void 0:d.welcomeIconUrl,Q=d==null?void 0:d.chatBarIconUrl,pe=r();return {name:y.name,logoUrl:ht(y.logoUrl,pe),welcomeIconUrl:ht(B,pe),chatBarIconUrl:ht(Q,pe),welcomeMessage:T(d==null?void 0:d.welcomeMessage),inputPlaceholder:T(d==null?void 0:d.inputPlaceholder),welcomeHeadline:T(d==null?void 0:d.welcomeHeadline),audience:(d==null?void 0:d.audience)==="identified"||(d==null?void 0:d.audience)==="anonymous"?d.audience:"",allowImageUpload:(d==null?void 0:d.allowImageUpload)===true,barDraggable:(d==null?void 0:d.barDraggable)===true,privacyPolicyUrl:typeof(d==null?void 0:d.privacyPolicyUrl)=="string"&&/^https:\/\//i.test(d.privacyPolicyUrl)?d.privacyPolicyUrl:null,chrome:g,locales:He(d==null?void 0:d.locales),activeLocale:typeof(d==null?void 0:d.activeLocale)=="string"?d.activeLocale:""}}function He(d){if(!Array.isArray(d))return [];let y=[];for(let T of d){if(!T||typeof T!="object")continue;let{code:g,label:B}=T;typeof g!="string"||g.length===0||typeof B!="string"||B.length===0||y.push({code:g,label:B});}return y}function se(){var d,y,T,g,B,Q,pe,Re;try{o=ur({geometry:{widthPercent:(d=A.widthPercent)!=null?d:mt,bottomOffset:(y=A.bottomOffset)!=null?y:ft,collapsedWidth:(T=A.collapsedWidth)!=null?T:gt},labels:_e(),iconUrl:(B=(g=ue())==null?void 0:g.chatBarIconUrl)!=null?B:null,welcomeIconUrl:(pe=(Q=ue())==null?void 0:Q.welcomeIconUrl)!=null?pe:null,iconSize:(Re=A.barIconSize)!=null?Re:pt,onActivate:()=>fe(),onSubmit:Z=>{if(J||fe(),C){C(Z);return}K=Z;},onAttach:()=>{fe();},onFiles:Z=>{if(fe(),G){G(Z);return}U=Z;},onDismiss:()=>{ke();},onStop:()=>{u==null||u.stop(),be();},onGeometryChange:()=>i==null?void 0:i.reposition(),readPosition:()=>{var Z;return (Z=P==null?void 0:P.read().position)!=null?Z:null},onPositionChange:Z=>P==null?void 0:P.rememberPosition(Z),readDocked:()=>(P==null?void 0:P.read().docked)===!0,onDockedChange:Z=>P==null?void 0:P.rememberDocked(Z),onUndock:()=>fe()}),o.mount(),Ue();}catch(Z){w(`The chat bar could not render. ${String(Z)}`);}}function xe(){var d,y,T;try{if(!o)return;let g=ue();o.setLabels(_e()),o.getMode()!=="flow"&&o.setPlaceholder((d=g==null?void 0:g.inputPlaceholder)!=null?d:null),o.setAttachEnabled((g==null?void 0:g.allowImageUpload)===!0),o.setDraggable((g==null?void 0:g.barDraggable)===!0),o.setIcon((y=g==null?void 0:g.chatBarIconUrl)!=null?y:null),o.setWelcomeIcon((T=g==null?void 0:g.welcomeIconUrl)!=null?T:null);}catch(g){w(`The widget could not apply its texts. ${String(g)}`);}}function _e(){var y,T;let d=(T=(y=ue())==null?void 0:y.chrome)!=null?T:ut;return {send:d.send,attachMenu:d.attachMenu,attachImage:d.attachImage,flowStop:d.flowStop,openChat:d.openChat,moveBar:d.moveBar,flowStep:d.flowStep}}let R=600,x=4e3,N=null,z=[],ye=null;function de(d){let y=d.phase==="done"?x:R;try{N=setTimeout(()=>{for(N=null;z.length>0;){let T=z.shift();if(Ie(T),T!==null){de(T);return}}},y);}catch(T){}}function Fe(d){if(d===null){let y=(ye==null?void 0:ye.phase)==="done"||z.some(T=>(T==null?void 0:T.phase)==="done");if(N!==null&&y){z[z.length-1]!==null&&z.push(null);return}be();return}if(N!==null){let y=z[z.length-1];if(d.phase!=="done"&&y!==void 0&&y!==null&&y.phase!=="done"){z[z.length-1]=d;return}z.push(d);return}Ie(d),de(d);}function be(){if(N!==null){try{clearTimeout(N);}catch(d){}N=null;}z=[],Ie(null);}function Ie(d){var y,T;ye=d;try{if(d&&(o==null||o.setDocked(!1)),o==null||o.setFlow(d),d){ke();return}o==null||o.setPlaceholder((T=(y=ue())==null?void 0:y.inputPlaceholder)!=null?T:null);}catch(g){w(`The flow status could not be shown. ${String(g)}`);}}function Ue(){try{let d=o==null?void 0:o.getRoot(),y=o==null?void 0:o.getHost(),T=o;if(!d||!y||!T)return;i=$n({root:d,host:y,loadChunk:t.loadChat,onRequestClose:()=>ke(),bar:{onSubmit:g=>{if(C=g,K!==null){let B=K;K=null,g(B);}},onFiles:g=>{if(G=g,U!==null){let B=U;U=null,g(B);}},setPlaceholder:g=>T.setPlaceholder(g),setDisabled:g=>T.setDisabled(g),setMode:g=>T.setMode(g),setFlow:g=>T.setFlow(g),setAwaitingInput:g=>T.setAwaitingInput(g),setDisclaimer:g=>T.setDisclaimer(g),setAttachEnabled:g=>T.setAttachEnabled(g),setAttachmentCount:g=>T.setAttachmentCount(g),attachmentSlot:()=>T.attachmentSlot(),focusInput:()=>T.focusInput(),getMetrics:()=>T.getMetrics(),dock:()=>T.setDocked(!0)},apiBase:r(),getSessionToken:()=>{var g,B;return (B=(g=b==null?void 0:b.config())==null?void 0:g.sessionToken)!=null?B:null},getSessionId:()=>p==null?void 0:p.sessionId(),getRoute:()=>typeof window!="undefined"?window.location.pathname:"",getMaxHeightPercent:()=>{var g;return (g=A.maxHeightPercent)!=null?g:void 0},onStartFlow:g=>{Ke(),u==null||u.start(g);},onStopFlow:()=>{u==null||u.stop(),be();},publicKey:s!=null?s:void 0,getConversationId:()=>{var g;return (g=S==null?void 0:S.id())!=null?g:null},setConversationId:g=>{var B,Q;return g===null?(B=S==null?void 0:S.startNew())!=null?B:null:(Q=S==null?void 0:S.adopt(g))!=null?Q:null},touchConversation:()=>S==null?void 0:S.touch(),getVisitorId:()=>E,onOrgCapExceeded:()=>Y(),track:(g,B,Q)=>{p==null||p.track(g,Q,B);},getWidget:()=>ue(),onSelectLocale:g=>{tt(g);}});}catch(d){w(`The chat panel could not be prepared. ${String(d)}`);}}function tt(d){return H(this,null,function*(){try{if(typeof d!="string"||d.length===0||(P==null?void 0:P.read().locale)===d)return;P==null||P.rememberLocale(d),yield Ne(),xe(),i==null||i.refreshChrome();}catch(y){w(`The widget could not change its language. ${String(y)}`);}})}function wt(){var T;if(!s)return null;let d=(T=b==null?void 0:b.config())==null?void 0:T.sessionToken;if(!d)return null;let y=X;return ae($({apiBase:r(),token:s,sessionToken:d,sessionId:p==null?void 0:p.sessionId(),getTrait:g=>{let B=a.attributes[g];if(!(B==null||Array.isArray(B)))return B}},y?{isFirstVisit:()=>y.isFirstVisit()}:{}),{promptFill:g=>{var Q;return o==null||o.setDocked(false),J=true,((Q=i==null?void 0:i.promptFill(g))!=null?Q:Promise.resolve(null)).finally(()=>{J=false;})},cancelFill:()=>{J=false,i==null||i.cancelFill();},onFailure:()=>{f||fe(),i==null||i.showFlowFailure();},track:(g,B,Q)=>{p==null||p.track(g,Q,B);},onStatus:g=>Fe(g),getBottomOcclusion:()=>{let g=o==null?void 0:o.getMetrics();return g?g.bottomOffset+g.keyboardOffset+g.height:0}})}function Ke(){if(!u)try{let d=wt();if(!d)return;u=Xn({context:d,loadChunk:t.loadFlow});}catch(d){w(`The flow engine could not be prepared. ${String(d)}`);}}function Ne(){return H(this,null,function*(){var d,y;try{yield Et();}catch(T){w(`The ARCY session could not be started. ${String(T)}`);}try{let T=b==null?void 0:b.config();if(T){let g=((d=T.customization)!=null?d:{}).tokens;F==null||F.remember(g,T.widget),A=Gt(g),M=(y=et(T.widget))!=null?y:M;}}catch(T){w(`The widget could not read its theme. ${String(T)}`);}if(h||(Ke(),u&&(h=true,u.resume())),v){let T=v;v=null,H(null,null,function*(){if(Ke(),!u)return;if(T.kind==="pending"){yield u.resumePreview();return}let g=yield Te(T.nonce);g&&(yield u.startPreview(g));}).catch(g=>w(`The preview could not run. ${String(g)}`));}ge();})}function vt(){if(D!==void 0)return D;try{let d=typeof window!="undefined"?window.location.pathname:null;return typeof d!="string"||!d.startsWith("/")?void 0:(D=Be(d),D)}catch(d){return}}function St(){var d,y;if(V)return I;V=true;try{return typeof window=="undefined"?void 0:(I=Er({referrer:typeof document!="undefined"?document.referrer:null,search:(y=(d=window.location)==null?void 0:d.search)!=null?y:null,userAgent:typeof navigator!="undefined"?navigator.userAgent:null,viewportWidth:window.innerWidth}),I)}catch(T){return}}function Et(){return H(this,null,function*(){var T,g;if(!b||!p)return;let d=++k,y=yield b.sync({sessionId:p.sessionId(),route:vt(),sessionContext:St(),visitorId:E!=null?E:void 0,userId:a.isAnonymous?void 0:(T=a.userId)!=null?T:void 0,userHash:a.isAnonymous?void 0:a.userHash,userTraits:Object.keys(a.attributes).length?a.attributes:void 0,uiLanguage:l.locale==="en"||l.locale==="tr"?l.locale:void 0,contentLocale:typeof l.contentLocale=="string"?l.contentLocale:void 0,viewerLocale:(g=P==null?void 0:P.read().locale)!=null?g:void 0});if(!y.ok){w("The ARCY session could not be started. The widget will keep working, and telemetry stays off until configuration arrives.");return}d===k&&(y.config.identityAccepted===false&&w("This environment enforces identity verification and no valid userHash was supplied, so this user was not identified and none of their attributes were stored. Pass a signed userHash: arcy.identify(userId, attributes, { userHash }). See Settings > Identity verification in the ARCY dashboard."),y.config.behavioralTelemetry&&p.setTelemetryState(y.config.behavioralTelemetry));})}function Tt(d,y,T){return H(this,null,function*(){var pe;if(!L("identify"))return;if(typeof d!="string"||d.length===0){w("identify() needs a user id. Ignoring the call.");return}let g=Qt(y,"identify");if(g===null)return;let B=As((T!=null?T:{}).userHash,"identify");if(!B.ok)return;let Q=a.userId===d&&!a.isAnonymous;a={userId:d,isAnonymous:false,attributes:Q?$($({},a.attributes),g):g,userHash:Q?(pe=B.hash)!=null?pe:a.userHash:B.hash},yield Ne();})}function xt(d){return H(this,null,function*(){if(!L("identifyAnonymous"))return;let y=Qt(d,"identifyAnonymous");y!==null&&(a={userId:null,isAnonymous:true,attributes:y},yield Ne());})}function we(d){return H(this,null,function*(){if(!L("updateUser"))return;if(!a.userId&&!a.isAnonymous){w("updateUser() was called before identify() or identifyAnonymous(). Ignoring the call.");return}let y=Qt(d,"updateUser");y!==null&&(a=ae($({},a),{attributes:$($({},a.attributes),y)}),yield Ne());})}function nt(){var d;a=Wr(),P==null||P.forgetAnonymousId(),E=(d=P==null?void 0:P.anonymousId())!=null?d:null,p==null||p.resetSession(),S==null||S.reset(),ke();}function fe(){if(L("open")){if(!o){ee=true;return}f||(o==null||o.setDocked(false),f=true,o==null||o.setMode("open"),i==null||i.open(),n.emit("open"));}}function ke(){f&&(f=false,o==null||o.setMode("idle"),i==null||i.close(),n.emit("close"));}function rt(d,y){return n.on(d,y)}return {api:{init:j,identify:Tt,identifyAnonymous:xt,updateUser:we,reset:nt,open:fe,close:ke,on:rt,VERSION:Vr},getToken:()=>s,getOptions:()=>l,getIdentity:()=>a,isOpen:()=>f,getBar:()=>o,getChatController:()=>i,getFlowController:()=>u,getTelemetry:()=>p,getConfig:()=>{var d;return (d=b==null?void 0:b.config())!=null?d:null},selectLocale:tt,getShellState:()=>P,getTokens:()=>A,getWidgetChrome:()=>ue()}}var Kr={cdnBase:Ut,loadChat:(e,t,n)=>Wn(e,Ut,t,n),loadFlow:(e,t,n)=>zn(e,Yn,t,n),loadPicker:(e,t,n)=>On(e,Ln,t,n)};function Gr(e,t){let n=e.q;for(;n.length>0;){let r=n.shift();if(!r)break;let s=t[r.method];if(typeof s!="function"){r.resolve();continue}try{let l=s(...r.args);l&&typeof l.then=="function"?l.then(()=>r.resolve(),()=>r.resolve()):r.resolve();}catch(l){r.resolve();}}}var Yr=$r(Kr);if(typeof window!="undefined"){let e=window.arcy;window.arcy=Yr,e&&Array.isArray(e.q)&&Gr(e,Yr);}
|
|
567
|
+
`;var Oe=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?e:0;function Qn(e){var n;let t=(n=e==null?void 0:e.document)==null?void 0:n.documentElement;return {width:Oe(t==null?void 0:t.clientWidth)||Oe(e==null?void 0:e.innerWidth),height:Oe(t==null?void 0:t.clientHeight)||Oe(e==null?void 0:e.innerHeight)}}function ti(e){let t=e==null?void 0:e.visualViewport;if(!t)return 0;let n=Qn(e).height,r=Oe(t.height);if(!n||!r)return 0;let s=typeof t.offsetTop=="number"&&Number.isFinite(t.offsetTop)?t.offsetTop:0,l=n-(r+s);return !Number.isFinite(l)||l<24?0:Math.min(l,n)}function dt(e){let t=Qn(e);return ae($({},t),{isMobile:t.width>0&&t.width<640,keyboardOffset:ti(e)})}var ni=560;function Zn(e,t){let n=Oe(t.width);if(!n)return ni;if(n<640)return Math.max(0,n-24);let r=Math.round(e/100*n);return Math.min(r,n-32)}function er(e){return e.x===0&&e.y===0?"none":`translate(${e.x}px, ${e.y}px)`}function $t(e,t,n){let r=Oe(n);if(!r)return e;let s=Math.max(0,(r-Oe(t))/2);return Math.min(s,Math.max(-s,e))}var oi=1e4,tr=52,ft=24,pt=18,mt=30,gt=280,nr="var(--_arcy-chat-welcome-icon-size, 34px)",rr="53%",ii=24,or="http://www.w3.org/2000/svg",ir=[["box-sizing","border-box"],["margin","0"],["display","flex"]],sr=[["position","absolute"],["pointer-events","auto"]],si=260,ai=300,li=150,ci=3e3;function Ae(e,t,n,r=2){let s=e.createElementNS(or,"svg");s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("aria-hidden","true"),s.setAttribute("width",String(n)),s.setAttribute("height",String(n));let l=e.createElementNS(or,"path");return l.setAttribute("d",t),l.setAttribute("fill","none"),l.setAttribute("stroke","currentColor"),l.setAttribute("stroke-width",String(r)),l.setAttribute("stroke-linecap","round"),l.setAttribute("stroke-linejoin","round"),s.appendChild(l),s}function ar(e,t,n){let r=e.createElement("img");return r.src=t,r.alt="",r.setAttribute("aria-hidden","true"),r.width=n,r.height=n,r.style.setProperty("width",`${n}px`),r.style.setProperty("height",`${n}px`),r.style.setProperty("object-fit","contain"),r}var ui="M5 3H19A2 2 0 0 1 21 5V19A2 2 0 0 1 19 21H5A2 2 0 0 1 3 19V5A2 2 0 0 1 5 3ZM7 9a2 2 0 1 0 4 0a2 2 0 1 0-4 0M21 15l-3.086-3.086a2 2 0 0 0-2.828 0L6 21",Qe={x:0,y:0},di="M12 5v14M5 12h14",fi="M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",lr="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594zM20 2v4M22 4h-4M4 20m-2 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0",cr="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z",pi="M12 19V5M5 12l7-7 7 7",mi="M6 6h12v12H6z";function q(e,t){return (...n)=>{try{t(...n);}catch(r){w(`${e} failed. ${String(r)}`);}}}var gi={send:"Send",attachMenu:"Add",attachImage:"Attach an image",flowStop:"Stop",openChat:"Open chat",moveBar:"Move the chat bar",flowStep:"Step {step} of {total}"};function ur(e={}){var Zt,en,tn,nn,rn,on,sn,an,ln,cn;let t=$($({},gi),(Zt=e.labels)!=null?Zt:{}),n={widthPercent:(tn=(en=e.geometry)==null?void 0:en.widthPercent)!=null?tn:mt,bottomOffset:(rn=(nn=e.geometry)==null?void 0:nn.bottomOffset)!=null?rn:ft,collapsedWidth:(sn=(on=e.geometry)==null?void 0:on.collapsedWidth)!=null?sn:gt},r=null,s=false,l=null,a=null,f=null,o=null,i=null,u=null,h=(an=e.iconUrl)!=null?an:null,v=(ln=e.iconSize)!=null?ln:pt,p=(cn=e.welcomeIconUrl)!=null?cn:null,b=null,k=null,D=false,I=null,V=null,P=false,X={x:0,y:0},S=null,E=null,F=null,A=null,M=null,C=null,G=null,U=null,K=null,J=null,ee="idle",L=null,j=false,le=false,Ce=0,ce=false,Te=false,Y={width:0,height:0,isMobile:false,keyboardOffset:0};function ge(){return !L&&ee!=="open"}function he(c){var W,Pe;let m=(W=l==null?void 0:l.offsetWidth)!=null?W:0,O=(Pe=l==null?void 0:l.offsetHeight)!=null?Pe:0;if(!Y.width||!Y.height)return c;let _=n.bottomOffset+Y.keyboardOffset,te=Math.max(0,Y.height-O-_);return {x:$t(c.x,m,Y.width),y:Math.min(_,Math.max(-te,c.y))}}function ue(c){var ve,un;if(!D||Y.isMobile)return;c.preventDefault(),c.stopPropagation();let m=c.clientX,O=c.clientY,_=X,te=k,W=(un=(ve=k==null?void 0:k.ownerDocument)==null?void 0:ve.defaultView)!=null?un:typeof window!="undefined"?window:null,Pe=De=>{var ze;De.pointerId===c.pointerId&&(X=he({x:_.x+(De.clientX-m),y:_.y+(De.clientY-O)}),se(),(ze=e.onGeometryChange)==null||ze.call(e));},re=De=>{var ze;if(De.pointerId===c.pointerId){W==null||W.removeEventListener("pointermove",Pe,true),W==null||W.removeEventListener("pointerup",re,true),W==null||W.removeEventListener("pointercancel",re,true);try{te==null||te.releasePointerCapture(De.pointerId);}catch(Is){}(ze=e.onPositionChange)==null||ze.call(e,X);}};try{te==null||te.setPointerCapture(c.pointerId);}catch(De){}W==null||W.addEventListener("pointermove",Pe,true),W==null||W.addEventListener("pointerup",re,true),W==null||W.addEventListener("pointercancel",re,true);}function He(){l==null||l.style.setProperty("display",P?"none":"flex","important"),I&&(I.style.setProperty("display",P?"flex":"none","important"),P&&(I.style.setProperty("bottom",`${n.bottomOffset+Y.keyboardOffset}px`,"important"),I.style.setProperty("right",`${ii}px`,"important")));}function se(){if(He(),!l)return;let c=ge(),m=Zn(n.widthPercent,Y),O=n.bottomOffset+Y.keyboardOffset;l.style.setProperty("bottom",`${O}px`,"important"),l.style.setProperty("left","50%","important"),l.style.setProperty("translate","-50%","important");let _=D&&!Y.isMobile?he(X):Qe;X=_;let te=L?Qe:{x:$t(_.x,c?n.collapsedWidth:m,Y.width),y:_.y};l.style.setProperty("transform",er(te)),a==null||a.setAttribute("data-grip",D&&!Y.isMobile&&!L?"true":"false"),l.style.setProperty("width",c?`${n.collapsedWidth}px`:`${m}px`);let W=`calc(100% - ${24}px)`;l.style.setProperty("max-width",Y.isMobile?W:"none"),l.setAttribute("data-mobile",Y.isMobile?"":"false");}function xe(){if(!i||!u)return;let c=i.ownerDocument,m=!ge()&&le,O=m?Ae(c,di,18):h?ar(c,h,v):Ae(c,lr,v);i.replaceChild(O,u),u=O,i.setAttribute("aria-label",t.attachMenu),m?i.setAttribute("data-tip",t.attachMenu):i.removeAttribute("data-tip"),i.setAttribute("aria-haspopup",m?"menu":"false"),i.setAttribute("data-role",m?"menu":"mark"),i.disabled=!m,i.setAttribute("aria-hidden",m?"false":"true"),i.tabIndex=m?0:-1,m||x();}function _e(){if(!J||!a)return;let c=le&&Ce>0&&!ge(),m=a.getAttribute("data-attachments")==="true";J.style.setProperty("display",c?"flex":"none"),a.setAttribute("data-attachments",c?"true":"false"),m!==c&&q("onGeometryChange",()=>{var O;return (O=e.onGeometryChange)==null?void 0:O.call(e)})();}function R(c){ce=c,S&&S.style.setProperty("display",c?"flex":"none"),i==null||i.setAttribute("aria-expanded",c?"true":"false"),c&&(E==null||E.focus());}function x(){if(!ce)return;let c=S==null?void 0:S.getRootNode(),m=!!(c&&"activeElement"in c&&c.activeElement&&(S!=null&&S.contains(c.activeElement)));R(false),m&&(i==null||i.focus());}function N(){if(!I||!V)return;let c=I.ownerDocument,m=p&&p!==b?p:null,O;if(m){let _=c.createElement("img");_.src=m,_.alt="",_.setAttribute("aria-hidden","true"),_.style.setProperty("width","100%"),_.style.setProperty("height","100%"),_.style.setProperty("object-fit","contain"),_.style.setProperty("display","block"),_.addEventListener("error",()=>{b=m,N();},{once:true}),O=_;}else {let _=Ae(c,cr,18);_.setAttribute("width",rr),_.setAttribute("height",rr),O=_;}I.replaceChild(O,V),V=O;}function z(){if(!a||!f||!M)return;let c=L?j?"input":"flow":ee,m=(L==null?void 0:L.phase)==="done";a.setAttribute("data-mode",c),a.setAttribute("data-phase",L?m?"done":"running":"none"),a.setAttribute("data-collapsed",ge()?"true":"false"),xe(),_e(),se(),f.style.setProperty("display",c==="flow"?"none":"flex"),M.style.setProperty("display",c==="flow"||c==="input"?"flex":"none"),A==null||A.style.setProperty("display","flex"),a.setAttribute("aria-expanded",c==="open"?"true":"false"),L&&C&&G&&(C.textContent=L.name,G.textContent=m?"\u2713":t.flowStep.replace("{step}",String(L.step)).replace("{total}",String(L.total)),U==null||U.style.setProperty("display",m?"none":"flex")),K&&K.style.setProperty("display",c==="open"&&K.textContent?"block":"none");}function ye(){Y=dt(typeof window!="undefined"?window:null),se(),q("onGeometryChange",()=>{var c;return (c=e.onGeometryChange)==null?void 0:c.call(e)})();}function de(c){var O;c.preventDefault();let m=(O=o==null?void 0:o.value.trim())!=null?O:"";if(!m&&Ce===0){be();return}o&&(o.value=""),q("onSubmit",()=>{var _;return (_=e.onSubmit)==null?void 0:_.call(e,m)})();}function Fe(){be();}function be(){L||ee==="open"||Te||(Te=true,q("onActivate",()=>{var c;return (c=e.onActivate)==null?void 0:c.call(e)})());}function Ie(c){if(!(L||ee==="open")&&!(S&&c.target instanceof Node&&S.contains(c.target))){be();try{o==null||o.focus();}catch(m){}}}function Ue(){Te=false;}function tt(c){c.preventDefault(),c.stopPropagation(),!(ge()||!le)&&R(!ce);}function wt(){try{F==null||F.click();}catch(c){}}function Ke(c){var m;c.preventDefault(),c.stopPropagation(),x(),wt(),(m=e.onAttach)==null||m.call(e);}function Ne(){var O;let c=F==null?void 0:F.files,m=c?Array.from(c):[];F&&(F.value=""),!(!le||m.length===0)&&((O=e.onFiles)==null||O.call(e,m));}function vt(c){c.key==="Escape"&&ce&&x();}function St(c){if(!ce)return;let m=c.target;m instanceof Node&&((i==null?void 0:i.contains(m))===true||(S==null?void 0:S.contains(m))===true)||x();}function Et(c){let m=typeof c.composedPath=="function"?c.composedPath():[],O=c.target,_=r==null?void 0:r.host,te=!!(_&&(m.some(W=>W===_)||m.length===0&&O instanceof Node&&_.contains(O)));ce&&!te&&x(),!(L||ee!=="open")&&(!_||te||q("onDismiss",()=>{var W;return (W=e.onDismiss)==null?void 0:W.call(e)})());}function Tt(c){Wt(c)&&c.preventDefault();}function xt(c){var O;if(!Wt(c)||(c.preventDefault(),!le))return;let m=jn(c);m.length!==0&&((O=e.onFiles)==null||O.call(e,m));}let we=q("resize",ye),nt=q("submit",de),fe=q("focus",Fe),ke=q("barClick",Ie),rt=q("pointerdown",Ue),Ge=q("attachMenu",tt),d=q("attach",Ke),y=q("picked",Ne),T=q("stop",()=>{var c;return (c=e.onStop)==null?void 0:c.call(e)}),g=q("menuKey",vt),B=q("menuDismiss",Et),Q=q("menuDismissInside",St),pe=q("dragover",Tt),Re=q("drop",xt),Z=q("undock",()=>{var c;return (c=e.onUndock)==null?void 0:c.call(e)});function Ye(c){if(!s){s=true;try{c.style.setProperty("opacity","1");}catch(m){}}}function zr(c,m){if(s)return;if(!m||typeof m.setTimeout!="function"){s=true;return}try{c.style.setProperty("opacity","0"),c.style.setProperty("transition",`opacity ${si}ms ease`);}catch(_){s=true;return}let O=_=>{try{m.setTimeout(()=>Ye(c),_);}catch(te){Ye(c);}};if(c.ownerDocument.readyState==="complete"){O(li);return}try{m.addEventListener("load",()=>O(ai),{once:!0});}catch(_){}O(ci);}function Xr(){var te,W,Pe;if(r!=null&&r.host.isConnected){w("The chat bar is already mounted. Ignoring the second mount.");return}r=null;let c=it({container:e.container});if(!c)return;r=c,zr(c.host,c.host.ownerDocument.defaultView),In(r,Jn);let m=r.host.ownerDocument;l=m.createElement("div"),l.className="arcy-bar-wrap";for(let[re,ve]of ir)l.style.setProperty(re,ve);for(let[re,ve]of sr)l.style.setProperty(re,ve,"important");l.style.setProperty("flex-direction","column"),l.style.setProperty("align-items","center"),a=m.createElement("div"),a.className="arcy-bar",a.setAttribute("role","group"),a.setAttribute("aria-label",t.openChat),f=m.createElement("form"),f.className="arcy-bar-form",o=m.createElement("input"),o.type="text",o.className="arcy-bar-input",o.maxLength=oi,o.setAttribute("aria-label",t.openChat),o.autocomplete="off",J=m.createElement("div"),J.className=Un,J.style.setProperty("display","none"),k=m.createElement("button"),k.type="button",k.className="arcy-bar-grip",k.setAttribute("aria-label",t.moveBar),k.setAttribute("data-tip",t.moveBar),k.appendChild(Ae(m,fi,16)),k.addEventListener("pointerdown",ue),k.addEventListener("click",re=>re.stopPropagation()),i=m.createElement("button"),i.type="button",i.className="arcy-bar-leading",u=h?ar(m,h,v):Ae(m,lr,v),i.appendChild(u),S=m.createElement("div"),S.className="arcy-bar-menu",S.setAttribute("role","menu"),S.style.setProperty("display","none"),E=m.createElement("button"),E.type="button",E.className="arcy-bar-menu-item",E.setAttribute("role","menuitem"),E.appendChild(Ae(m,ui,16)),E.appendChild(m.createTextNode(t.attachImage)),S.appendChild(E),F=m.createElement("input"),F.type="file",F.accept=Bn.join(","),F.multiple=true,F.tabIndex=-1,F.setAttribute("aria-hidden","true"),F.style.setProperty("display","none"),a.appendChild(F),A=m.createElement("button"),A.type="submit",A.className="arcy-bar-send",A.setAttribute("aria-label",t.send),A.appendChild(Ae(m,pi,18)),f.appendChild(k),f.appendChild(i),f.appendChild(o),f.appendChild(A),M=m.createElement("div"),M.className="arcy-bar-status",M.style.setProperty("display","none");let O=m.createElement("span");O.className="arcy-bar-dot",O.setAttribute("aria-hidden","true"),C=m.createElement("span"),C.className="arcy-bar-flow-name",G=m.createElement("span"),G.className="arcy-bar-flow-step",U=m.createElement("button"),U.type="button",U.className="arcy-bar-stop",U.appendChild(Ae(m,mi,15,2)),U.appendChild(m.createTextNode(t.flowStop)),M.appendChild(O),M.appendChild(C),M.appendChild(G),M.appendChild(U),a.appendChild(J),a.appendChild(f),a.appendChild(M),a.appendChild(S),K=m.createElement("div"),K.className="arcy-bar-disclaimer",K.style.setProperty("display","none"),l.appendChild(a),l.appendChild(K),I=m.createElement("button"),I.type="button",I.className="arcy-bar-dock",I.setAttribute("aria-label",t.openChat),I.setAttribute("data-tip",t.openChat),I.setAttribute("data-tip-placement","above"),I.setAttribute("data-tip-align","end");for(let[re,ve]of ir)I.style.setProperty(re,ve);for(let[re,ve]of sr)I.style.setProperty(re,ve,"important");I.style.setProperty("align-items","center"),I.style.setProperty("justify-content","center"),I.style.setProperty("width",nr),I.style.setProperty("height",nr),V=Ae(m,cr,18),I.appendChild(V),N(),I.addEventListener("click",Z),f.addEventListener("submit",nt),o.addEventListener("focus",fe),a.addEventListener("click",ke),a.addEventListener("pointerdown",rt,true),i.addEventListener("click",Ge),E.addEventListener("click",d),F.addEventListener("change",y),U.addEventListener("click",T),a.addEventListener("dragover",pe),a.addEventListener("drop",Re),m.addEventListener("pointerdown",B,true),r.root.addEventListener("pointerdown",Q,true),m.addEventListener("keydown",g,true);let _=m.defaultView;_==null||_.addEventListener("resize",we),_==null||_.addEventListener("orientationchange",we),(te=_==null?void 0:_.visualViewport)==null||te.addEventListener("resize",we),(W=_==null?void 0:_.visualViewport)==null||W.addEventListener("scroll",we),r.root.appendChild(l),r.root.appendChild(I),Y=dt(_!=null?_:null),P=((Pe=e.readDocked)==null?void 0:Pe.call(e))===true,se(),z();}function jr(){var O,_;if(!r)return;let c=r.host.ownerDocument.defaultView;c==null||c.removeEventListener("resize",we),c==null||c.removeEventListener("orientationchange",we),(O=c==null?void 0:c.visualViewport)==null||O.removeEventListener("resize",we),(_=c==null?void 0:c.visualViewport)==null||_.removeEventListener("scroll",we),f==null||f.removeEventListener("submit",nt),o==null||o.removeEventListener("focus",fe),a==null||a.removeEventListener("click",ke),a==null||a.removeEventListener("pointerdown",rt,true),i==null||i.removeEventListener("click",Ge),E==null||E.removeEventListener("click",d),F==null||F.removeEventListener("change",y),U==null||U.removeEventListener("click",T),a==null||a.removeEventListener("dragover",pe),a==null||a.removeEventListener("drop",Re),I==null||I.removeEventListener("click",Z);let m=r.host.ownerDocument;m.removeEventListener("pointerdown",B,true),r.root.removeEventListener("pointerdown",Q,true),m.removeEventListener("keydown",g,true),r.destroy(),r=null,l=a=f=M=C=G=K=null,o=null,E=A=U=null,F=null,i=null,u=null,I=null,V=null,S=null,J=null,ce=false,L=null,ee="idle";}return {mount:Xr,unmount:jr,isMounted:()=>r!==null&&r.host.isConnected,getElement:()=>a,getRoot:()=>{var c;return (c=r==null?void 0:r.root)!=null?c:null},getHost:()=>{var c;return (c=r==null?void 0:r.host)!=null?c:null},setMode(c){ee!==c&&(ee=c,Te=false,z());},getMode:()=>L?"flow":ee,setGeometry(c){var m,O,_;n={widthPercent:(m=c.widthPercent)!=null?m:n.widthPercent,bottomOffset:(O=c.bottomOffset)!=null?O:n.bottomOffset,collapsedWidth:(_=c.collapsedWidth)!=null?_:n.collapsedWidth},se();},getMetrics:()=>ae($({},n),{offset:L||!D||Y.isMobile?Qe:X,height:(l==null?void 0:l.offsetHeight)||(a==null?void 0:a.offsetHeight)||tr,keyboardOffset:Y.keyboardOffset,isMobile:Y.isMobile,viewportHeight:Y.height,viewportWidth:Y.width}),getHeight:()=>(l==null?void 0:l.offsetHeight)||(a==null?void 0:a.offsetHeight)||tr,setLabels(c){t=$($({},t),c);try{if(A==null||A.setAttribute("aria-label",t.send),E){let m=E.lastChild;m&&(m.textContent=t.attachImage);}if(a==null||a.setAttribute("aria-label",t.openChat),o==null||o.setAttribute("aria-label",t.openChat),I&&(I.setAttribute("aria-label",t.openChat),I.setAttribute("data-tip",t.openChat)),k&&(k.setAttribute("aria-label",t.moveBar),k.setAttribute("data-tip",t.moveBar)),U){let m=U.lastChild;m&&(m.textContent=t.flowStop);}}catch(m){}z();},setPlaceholder(c){try{o&&(o.placeholder=c!=null?c:"");}catch(m){}},setDisabled(c){try{o&&(o.disabled=c),A&&(A.disabled=c),E&&(E.disabled=c),c&&x();}catch(m){}},setAttachEnabled(c){le!==c&&(le=c,z());},setDraggable(c){var m,O,_;D!==c&&(D=c,X=c&&(O=(m=e.readPosition)==null?void 0:m.call(e))!=null?O:Qe,se(),(_=e.onGeometryChange)==null||_.call(e));},setIcon(c){h!==c&&(h=c,xe());},setIconSize(c){v!==c&&(v=c,xe());},setWelcomeIcon(c){p!==c&&(p=c,b=null,N());},setDocked(c){P!==c&&(P=c,q("onDockedChange",()=>{var m;return (m=e.onDockedChange)==null?void 0:m.call(e,c)})(),c&&x(),se(),q("onGeometryChange",()=>{var m;return (m=e.onGeometryChange)==null?void 0:m.call(e)})());},isDocked:()=>P,setFlow(c){L=c,c||(j=false),z();},setAwaitingInput(c){j!==c&&(j=c,z(),q("onGeometryChange",()=>{var m;return (m=e.onGeometryChange)==null?void 0:m.call(e)})());},setDisclaimer(c){try{if(K&&(K.textContent="",c!=null))if(typeof c=="string")K.textContent=c;else {let m=K.ownerDocument;K.appendChild(m.createTextNode(c.before));let O=m.createElement("a");O.className=Hn,O.href=c.linkHref,O.target="_blank",O.rel="noopener noreferrer",O.textContent=c.linkLabel,K.appendChild(O),c.after&&K.appendChild(m.createTextNode(c.after));}}catch(m){}z();},setAttachmentCount(c){Ce=c;try{_e();}catch(m){}},attachmentSlot:()=>J,focusInput(){try{r&&Pt(r.host.ownerDocument,r.host),o==null||o.focus();}catch(c){}},reposition:()=>{Y=dt(typeof window!="undefined"?window:null),se();},readValue:()=>{var c;return (c=o==null?void 0:o.value)!=null?c:""},clearValue(){try{o&&(o.value="");}catch(c){}}}}var hi="https://api.arcyai.com";function Kt(e){return typeof e!="string"||e.length===0||e.length>2048?false:/^https:\/\//i.test(e)?true:e.startsWith("/")&&!e.startsWith("//")}function ht(e,t){return Kt(e)?/^https:\/\//i.test(e)?e:`${(t!=null?t:hi).replace(/\/+$/,"")}${e}`:null}var yi=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,bi=/^[a-z0-9-]{1,32}$/,dr={none:"none",soft:"0 0 2px rgba(16, 24, 40, 0.04), 0 0 8px rgba(16, 24, 40, 0.06)",medium:"0 0 4px rgba(16, 24, 40, 0.05), 0 0 20px rgba(16, 24, 40, 0.10)",strong:"0 0 8px rgba(16, 24, 40, 0.07), 0 0 36px rgba(16, 24, 40, 0.16)",bold:"0 0 12px rgba(16, 24, 40, 0.10), 0 0 48px rgba(16, 24, 40, 0.22)"},wi=20,vi=50,Si=30,Ei=80,Ti=0,xi=120,ki=14,Ai=28,Ci=180,_i=480,Ii=2147483647,yt={vars:{},widthPercent:null,bottomOffset:null,collapsedWidth:null,barIconSize:null,maxHeightPercent:null,zIndex:null};function me(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Me(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.min(n,Math.max(t,e))}function Ze(e,t,n){if(t)for(let[r,s]of n){let l=t[r];typeof l=="string"&&yi.test(l)&&(e[s]=l);}}function We(e,t,n,r,s){let l=Me(n,r,s);l!==null&&(e[t]=`${l}px`);}function fr(e,t,n){typeof n=="string"&&n in dr&&(e[t]=dr[n]);}function Gt(e){let t=me(e);if(!t)return yt;let n={},r=me(t.base);Ze(n,me(r==null?void 0:r.brand),[["text","--_arcy-brand-text"],["background","--_arcy-brand-bg"],["hover","--_arcy-brand-bg-hover"],["active","--_arcy-brand-bg-active"]]),Ze(n,me(r==null?void 0:r.main),[["text","--_arcy-main-text"],["background","--_arcy-main-bg"]]);let s=me(r==null?void 0:r.border);We(n,"--_arcy-border-width",s==null?void 0:s.width,0,8),Ze(n,s,[["color","--_arcy-border-color"]]);let l=Me(r==null?void 0:r.glassiness,0,100);l!==null&&l>0&&(n["--_arcy-glass-blur"]=`${Math.round(l/5)}px`,n["--_arcy-glass-alpha"]=`${Math.round(l/2)}%`);let a=r==null?void 0:r.fontFamily;typeof a=="string"&&bi.test(a)&&a!=="system"&&(n[Ht]=a);let f=Me(r==null?void 0:r.zIndex,0,Ii);We(n,"--arcy-bar-radius",r==null?void 0:r.borderRadius,0,32),We(n,"--_arcy-chat-radius",r==null?void 0:r.borderRadius,0,32),fr(n,"--arcy-bar-shadow",r==null?void 0:r.shadow),fr(n,"--_arcy-chat-shadow",r==null?void 0:r.shadow);let o=me(t.bar),i=me(t.chat);We(n,"--_arcy-chat-logo-size",i==null?void 0:i.logoSize,16,48),We(n,"--_arcy-chat-welcome-icon-size",i==null?void 0:i.welcomeIconSize,16,72),Ze(n,me(i==null?void 0:i.assistantBubble),[["background","--_arcy-assistant-bg"],["text","--_arcy-assistant-text"]]);let u=me(i==null?void 0:i.scrollbar);return We(n,"--_arcy-scroll-width",u==null?void 0:u.width,2,16),Ze(n,u,[["track","--_arcy-scroll-track"],["thumb","--_arcy-scroll-thumb"],["thumbHover","--_arcy-scroll-thumb-hover"]]),{vars:n,widthPercent:Me(i==null?void 0:i.width,wi,vi),bottomOffset:Me(o==null?void 0:o.bottomOffset,Ti,xi),collapsedWidth:Me(o==null?void 0:o.collapsedWidth,Ci,_i),barIconSize:Me(o==null?void 0:o.iconSize,ki,Ai),maxHeightPercent:Me(i==null?void 0:i.maxHeight,Si,Ei),zIndex:f!==null?Math.round(f):null}}var Ri=["--_arcy-brand-text","--_arcy-brand-bg","--_arcy-brand-bg-hover","--_arcy-brand-bg-active","--_arcy-main-text","--_arcy-main-bg","--_arcy-border-width","--_arcy-border-color","--_arcy-glass-blur","--_arcy-glass-alpha",Ht,"--arcy-bar-radius","--arcy-bar-shadow","--_arcy-chat-radius","--_arcy-chat-logo-size","--_arcy-chat-welcome-icon-size","--_arcy-chat-shadow","--_arcy-assistant-bg","--_arcy-assistant-text","--_arcy-scroll-width","--_arcy-scroll-track","--_arcy-scroll-thumb","--_arcy-scroll-thumb-hover"];function pr(e,t){try{for(let n of Ri){let r=t.vars[n];r===void 0?e.style.removeProperty(n):e.style.setProperty(n,r);}e.style.setProperty("z-index",t.zIndex===null?Rt:String(t.zIndex),"important");}catch(n){w(`The widget could not apply its theme. ${String(n)}`);}}var Pi="arcy.tokens.",Li=4096,Oi=100;function et(e){let t=me(e);if(!t)return null;let n=typeof t.name=="string"?t.name.slice(0,Oi):"",r=t.logoUrl,s=Kt(r)?r:null;return {name:n,logoUrl:s}}function mr(e,t=Ee()){let n=oe(t),r=Pi+e;return {read(){let s=me(ie(n,r));return {tokens:Gt(s==null?void 0:s.t),identity:et(s==null?void 0:s.w)}},remember(s,l){let a=me(s),f=et(l);if(!a&&!f){n.removeItem(r);return}try{let o={t:a!=null?a:void 0,w:f!=null?f:void 0};if(JSON.stringify(o).length>Li)return;ne(n,r,o);}catch(o){}}}}var Mi="arcy.shell.",gr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,Fi=/^[a-z]{2}-[A-Z]{2}$/;function Ni(e){if(!e||typeof e!="object")return null;let{x:t,y:n}=e;return typeof t!="number"||typeof n!="number"||!Number.isFinite(t)||!Number.isFinite(n)?null:{x:t,y:n}}function Di(e){var s,l,a;let t=typeof globalThis!="undefined"?globalThis.crypto:void 0;if(!e&&t&&typeof t.randomUUID=="function")try{let f=t.randomUUID();if(gr.test(f))return f}catch(f){}let n=new Uint8Array(16);if(e)e(n);else if(t&&typeof t.getRandomValues=="function")t.getRandomValues(n);else for(let f=0;f<n.length;f++)n[f]=Math.floor(Math.random()*256);n[6]=((s=n[6])!=null?s:0)&15|64,n[8]=((l=n[8])!=null?l:0)&63|128;let r="";for(let f=0;f<n.length;f++)r+=((a=n[f])!=null?a:0).toString(16).padStart(2,"0");return `${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function hr(e,{store:t=Ee(),fill:n}={}){let r=oe(t),s=Mi+e;function l(){var o;return (o=ie(r,s))!=null?o:{}}function a(o){ne(r,s,$($({},l()),o));}function f(){let o=l(),i=o.anonymousId;return {anonymousId:typeof i=="string"&&gr.test(i)?i:null,position:Ni(o.position),docked:o.docked===true,locale:typeof o.locale=="string"&&Fi.test(o.locale)?o.locale:null}}return {read:f,anonymousId(){let o=f().anonymousId;return o||(a({anonymousId:Di(n)}),f().anonymousId)},rememberPosition(o){a({position:o});},rememberDocked(o){a({docked:o});},rememberLocale(o){a({locale:o});},forgetAnonymousId(){let o=l();o.anonymousId!==void 0&&(delete o.anonymousId,Object.keys(o).length===0?r.removeItem(s):ne(r,s,o));}}}var Bi="arcy.visit.",yr="first";function br(e,t=Ve()){let n=oe(t),r=Bi+e;return {markFirstVisit(){n.setItem(r,yr);},isFirstVisit(){return n.getItem(r)===yr}}}var wr="0123456789ABCDEFGHJKMNPQRSTVWXYZ";var Yt=e=>{let t=typeof globalThis!="undefined"?globalThis.crypto:void 0;if(t&&typeof t.getRandomValues=="function"){t.getRandomValues(e);return}for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);};function $e(e,t=Yt){var a,f;let n="",r=Math.floor(e);for(let o=0;o<10;o++)n=((a=wr[r%32])!=null?a:"0")+n,r=Math.floor(r/32);let s=new Uint8Array(16);t(s);let l="";for(let o=0;o<16;o++)l+=wr[((f=s[o])!=null?f:0)%32];return n+l}var Hi="arcy.chat.",Ui=1440*60*1e3;function vr(e,{store:t=Ee(),fill:n=Yt,now:r=Date.now}={}){let s=oe(t),l=Hi+e;function a(){var o;return (o=ie(s,l))!=null?o:{}}function f(){let o=$e(r(),n);return ne(s,l,{id:o,lastActiveAt:r()}),o}return {id(){let o=a(),i=typeof o.id=="string"?o.id:null,u=typeof o.lastActiveAt=="number"?o.lastActiveAt:null;return i&&u!==null&&r()-u<Ui?i:f()},touch(){let o=a();typeof o.id=="string"&&ne(s,l,ae($({},o),{lastActiveAt:r()}));},reset(){f();},adopt(o){return typeof o!="string"||o.length===0?this.id():(ne(s,l,{id:o,lastActiveAt:r()}),o)},startNew(){return f()}}}var Vi=[["utm_source","utmSource"],["utm_medium","utmMedium"],["utm_campaign","utmCampaign"],["utm_content","utmContent"],["utm_term","utmTerm"]],Wi=255,$i=512,Ki=/[\u0000-\u001f\u007f]/g;function Sr(e,t){let n=e.replace(Ki,"").trim();if(n.length!==0)return n.slice(0,t)}function Gi(e){if(!(typeof e!="string"||e.length===0))try{let t=new URL(e),n=t.host;if(!n)return;let r=Be(t.pathname);return Sr(r==="/"?n:n+r,$i)}catch(t){return}}function Yi(e){let t={};if(typeof e!="string"||e.length===0)return t;let n=e.charAt(0)==="?"?e.slice(1):e;for(let r of n.split("&")){let s=r.indexOf("=");if(s<=0)continue;let l=r.slice(0,s).toLowerCase(),a=Vi.find(i=>i[0]===l);if(!a)continue;let f=r.slice(s+1).replace(/\+/g," ");try{f=decodeURIComponent(f);}catch(i){}let o=Sr(f,Wi);o&&(t[a[1]]=o);}return t}function zi(e){let t=typeof e=="string"?e:"";if(t.length!==0){if(/Edg[A-Z]?\//.test(t))return "Edge";if(/OPR\/|Opera/.test(t))return "Opera";if(/SamsungBrowser\//.test(t))return "Samsung Internet";if(/Firefox\/|FxiOS\//.test(t))return "Firefox";if(/Chrome\/|CriOS\//.test(t))return "Chrome";if(/Safari\//.test(t))return "Safari"}}function Xi(e){let t=typeof e=="string"?e:"";if(t.length!==0){if(/iPhone|iPad|iPod/.test(t))return "iOS";if(/Android/.test(t))return "Android";if(/CrOS/.test(t))return "ChromeOS";if(/Windows/.test(t))return "Windows";if(/Mac OS X|Macintosh/.test(t))return "macOS";if(/Linux/.test(t))return "Linux"}}function ji(e){if(!(typeof e!="number"||!(e>0)))return e<480?"xs":e<768?"sm":e<1024?"md":e<1280?"lg":"xl"}function Er(e){let t=$({},Yi(e.search)),n=Gi(e.referrer);n&&(t.referrer=n);let r=zi(e.userAgent);r&&(t.browser=r);let s=Xi(e.userAgent);s&&(t.os=s);let l=ji(e.viewportWidth);return l&&(t.viewport=l),Object.keys(t).length>0?t:void 0}var qi=["ON","REQUIRE_CONSENT","OFF"];function Tr(e,t){function n(){let s=ie(e,t);if(!s)return {};let l=typeof s.state=="string"&&qi.indexOf(s.state)!==-1?s.state:void 0,a=typeof s.consent=="boolean"?s.consent:void 0;return {state:l,consent:a}}function r(s){if(s.state===void 0&&s.consent===void 0){e.removeItem(t);return}ne(e,t,s);}return {state:()=>{var s;return (s=n().state)!=null?s:null},consent:()=>{var s;return (s=n().consent)!=null?s:null},setState(s){r(ae($({},n()),{state:s}));},setConsent(s){let l=n();r({state:l.state,consent:s?true:void 0});},clearState(){r({state:void 0,consent:n().consent});},shouldCapture(){let{state:s,consent:l}=n();return s===void 0||s==="OFF"?false:s==="REQUIRE_CONSENT"?l===true:true}}}var Ji=/iPhone|iPod|Android.*Mobile|Windows Phone|BlackBerry|Opera Mini|IEMobile/i,Qi=/iPad|Tablet|PlayBook|Silk|Kindle/i;function xr(e){var n;let t=(n=e==null?void 0:e.userAgent)!=null?n:"";return Qi.test(t)||(e==null?void 0:e.platform)==="MacIntel"&&typeof e.maxTouchPoints=="number"&&e.maxTouchPoints>1?"tablet":Ji.test(t)?"mobile":/Android/i.test(t)?"tablet":"desktop"}var Ar=100,Zi=4096,es=["INPUT","TEXTAREA","SELECT"];function kr(e){if(e.length!==0&&!Xe(e.slice(0,Zi)))return e.slice(0,Ar)}function zt(e,t){var a,f,o;let n=((a=e.tagName)!=null?a:"").toUpperCase(),r={tag:n.toLowerCase()},s=e.getAttribute("role");s&&(r.role=s.slice(0,64));let l=e.getAttribute("type");if(l&&(r.type=l.slice(0,32)),es.indexOf(n)===-1){let i=((f=e.textContent)!=null?f:"").replace(/\s+/g," ").trim(),u=kr(i);u&&(r.text=u);}else {let i=(o=e.getAttribute("aria-label"))!=null?o:e.getAttribute("name"),u=kr(i!=null?i:"");u&&(r.label=u);}if(t){let i=t(e);i&&Object.keys(i).length>0&&(r.fingerprint=i);}return r}function Cr(e,t){return zt(e,t)}function _r(e,t){var s;let n=zt(e,t),r=(s=e.validity)==null?void 0:s.valid;return typeof r=="boolean"&&(n.valid=r),n}function Ir(e,t){var l,a;let n=zt(e,t),r=(l=e.getAttribute("name"))!=null?l:e.getAttribute("id");r&&(n.form=r.slice(0,Ar));let s=(a=e.elements)==null?void 0:a.length;return typeof s=="number"&&(n.fieldCount=s),n}var ts=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],ns="OTHER",rs=400,Rr=200,os=/[\u0000-\u001f\u007f]+/g;function jt(e){let t=null;if(typeof e=="string")t=e;else if(e&&typeof e=="object"){let r=e.message;typeof r=="string"&&(t=r);}if(t===null)return null;let n=t.replace(os," ").trim();return n.length===0?null:n.length>Rr?n.slice(0,Rr):n}function Xt(e){if(typeof e!="string")return "GET";let t=e.toUpperCase();return ts.indexOf(t)===-1?ns:t}function is(e){return typeof e=="number"&&e>=rs}function Pr(e){let{target:t,report:n,ignore:r}=e,s=[];function l(o,i,u){var h;try{if(!is(i)||u!==null&&(r!=null&&r(u)))return;n({method:o,status:i,url:u===null?null:je(u,(h=t.location)==null?void 0:h.href)});}catch(v){}}function a(){let o=t.fetch;if(typeof o!="function")return;let i=function(...u){let h=o.apply(this,u);try{let v=h;if(typeof(v==null?void 0:v.then)!="function")return h;v.then(p=>{let b=p==null?void 0:p.status;l(ss(u),b,as(u));},()=>{});}catch(v){}return h};t.fetch=i,s.push(()=>{t.fetch===i&&(t.fetch=o);});}function f(){var b;let o=(b=t.XMLHttpRequest)==null?void 0:b.prototype,i=o==null?void 0:o.open,u=o==null?void 0:o.send;if(!o||typeof i!="function"||typeof u!="function"||typeof WeakMap!="function")return;let h=new WeakMap,v=function(...k){var I,V;let D=i.apply(this,k);try{h.set(this,{method:Xt(k[0]),url:typeof k[1]=="string"?k[1]:null,listening:(V=(I=h.get(this))==null?void 0:I.listening)!=null?V:!1});}catch(P){}return D},p=function(...k){try{let D=this,I=h.get(this);typeof D.addEventListener=="function"&&(I==null?void 0:I.listening)!==!0&&(I&&(I.listening=!0),D.addEventListener("loadend",()=>{var P,X;let V=h.get(this);l((P=V==null?void 0:V.method)!=null?P:"GET",D.status,(X=V==null?void 0:V.url)!=null?X:null);}));}catch(D){}return u.apply(this,k)};o.open=v,s.push(()=>{o.open===v&&(o.open=i);}),o.send=p,s.push(()=>{o.send===p&&(o.send=u);});}try{a(),f();}catch(o){for(let i of s)try{i();}catch(u){}return null}return s.length===0?null:()=>{for(let o of s)try{o();}catch(i){}s.length=0;}}function ss(e){let t=e[1];if(t&&typeof t=="object"&&typeof t.method=="string")return Xt(t.method);let n=e[0];return n&&typeof n=="object"&&typeof n.method=="string"?Xt(n.method):"GET"}function as(e){let t=e[0];if(typeof t=="string")return t;if(!t||typeof t!="object")return null;let n=t.url;if(typeof n=="string")return n;let r=t.href;return typeof r=="string"?r:null}function Lr(e,t,n,r,s){let l={id:e,name:t,occurredAt:n,sessionId:r.sessionId};return r.userId&&(l.userId=r.userId),r.visitorId&&(l.visitorId=r.visitorId),r.route&&(l.route=r.route),r.localeCode&&(l.localeCode=r.localeCode),r.deviceClass&&(l.deviceClass=r.deviceClass),r.flowSessionId&&(l.flowSessionId=r.flowSessionId),s&&Object.keys(s).length>0&&(l.payload=s),l}var ls=["button","submit","reset","image","hidden","checkbox","radio"],cs=["INPUT","TEXTAREA","SELECT"];function us(e){var r,s;if(!e||typeof e.getAttribute!="function")return false;let t=((r=e.tagName)!=null?r:"").toUpperCase();if(cs.indexOf(t)===-1)return false;if(t!=="INPUT")return true;let n=((s=e.getAttribute("type"))!=null?s:"text").toLowerCase();return ls.indexOf(n)===-1}function Or(e){let t=e.value;return typeof t=="string"?t.length===0:t==null}function Mr(e){let t=null;return {focus(n){us(n)&&(t={element:n,empty:Or(n),filled:false,cleared:false},e.emit("field_focused",n));},change(n){if(!t||t.element!==n)return;let r=Or(n);if(r!==t.empty){if(t.empty=r,!r){if(t.filled)return;t.filled=true,e.emit("input_filled",n);return}t.cleared||(t.cleared=true,e.emit("input_cleared",n));}},blur(n){t&&t.element===n&&(t=null);}}}var ds=["A","BUTTON","INPUT","SELECT","TEXTAREA","SUMMARY","OPTION","LABEL"],fs=["button","link","checkbox","radio","switch","tab","menuitem","menuitemcheckbox","menuitemradio","option","combobox","textbox","searchbox","slider","spinbutton","treeitem"];function ps(e,t){var l;let n=((l=e.tagName)!=null?l:"").toUpperCase();if(ds.indexOf(n)!==-1)return true;let r=e.getAttribute("role");if(r&&fs.indexOf(r.toLowerCase())!==-1||e.getAttribute("onclick")!==null)return true;let s=e.getAttribute("tabindex");return s!==null&&Number(s)>=0||e.getAttribute("contenteditable")==="true"?true:t?t(e)==="pointer":false}function Fr(e,t){let n=e;for(let r=0;n&&r<6;r++){if(ps(n,t))return n;n=n.parentElement;}return null}var ms=[25,50,75,100],gs=250,hs=100;function Nr(e){let{readDepth:t,emit:n,setTimeoutImpl:r=(i,u)=>setTimeout(i,u),clearTimeoutImpl:s=i=>clearTimeout(i),throttleMs:l=gs}=e,a=0,f=null;function o(){f=null;let i=null;try{i=t();}catch(h){return}if(i===null)return;let u=0;for(let h of ms)i>=h&&(u=h);u<=a||(a=u,n(u));}return {scrolled(){if(f===null&&!(a>=hs))try{f=r(o,l);}catch(i){f=null;}},reset(){if(a=0,f!==null){try{s(f);}catch(i){}f=null;}},dispose(){if(f!==null){try{s(f);}catch(i){}f=null;}}}}function Dr(e){var a,f,o;let t=(a=e.innerHeight)!=null?a:0,n=(f=e.documentHeight)!=null?f:0;if(!(n-t>0)||!(t>0))return null;let l=(((o=e.scrollY)!=null?o:0)+t)/n*100;return l>0?l>100?100:l:0}var ys=1800*1e3,bs=60*1e3;function Br({store:e,key:t,now:n,fill:r,windowMs:s=ys}){function l(i){let u=ie(e,t);return u&&typeof u.id=="string"&&u.id.length>0&&typeof u.seen=="number"&&i-u.seen<s?u:null}function a(i){let u=$e(i,r);return ne(e,t,{id:u,seen:i}),u}function f(){let i=n(),u=l(i);return u?(i-u.seen>=bs&&ne(e,t,{id:u.id,seen:i}),u.id):a(i)}function o(){var u,h;let i=n();return (h=(u=l(i))==null?void 0:u.id)!=null?h:a(i)}return {touch:f,current:o,peek:()=>ie(e,t),clear(){e.removeItem(t);}}}var qt="https://api.arcyai.com",ws="/api/v1/sdk/telemetry";function vs(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=56319?(t+=4,n++):t+=3;}return t}function Ss(e){let t=[],n=[],r=13;for(let s of e){let l=vs(JSON.stringify(s))+1;(n.length>=100||n.length>0&&r+l>65536)&&(t.push(n),n=[],r=13),n.push(s),r+=l;}return n.length>0&&t.push(n),t}function Hr(e){let{token:t,apiBase:n=qt,fetchImpl:r,sendBeacon:s,setTimeoutImpl:l=(A,M)=>setTimeout(A,M),clearTimeoutImpl:a=A=>clearTimeout(A),sessionStore:f,stopKey:o,onTelemetryOff:i}=e,u=`${n}${ws}`,h=[],v=null,p=k(),b=Promise.resolve();function k(){return !f||!o?null:f.getItem(o)==="tracked_events_cap"?"tracked_events_cap":null}function D(A){p=A,h=[],I(),A==="tracked_events_cap"?f&&o&&f.setItem(o,A):i&&i();}function I(){v!==null&&(a(v),v=null);}function V(){v===null&&(v=l(()=>{v=null,F(false);},5e3));}function P(A){if(p===null){if(h.push(A),h.length>1e3&&h.splice(0,h.length-1e3),h.length>=20){F(false);return}V();}}function X(A){return H(this,null,function*(){try{let M=yield A.json();if(M&&typeof M=="object"){let C=M.code;if(typeof C=="string")return C}}catch(M){}return null})}function S(A){return H(this,null,function*(){if(!r)return A;let M;try{M=yield r(u,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({events:A}),credentials:"omit"});}catch(C){return A}return M.status===403?(yield X(M))==="telemetry_off"?(D("telemetry_off"),[]):[]:M.status===429?(yield X(M))==="tracked_events_cap"?(D("tracked_events_cap"),[]):A:M.status>=500?A:[]})}function E(A){let M=JSON.stringify({events:A}),C=`${u}?token=${encodeURIComponent(t)}`;if(s&&typeof Blob!="undefined")try{if(s(C,new Blob([M],{type:"application/json"})))return !0}catch(G){}if(r)try{return r(u,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:M,keepalive:!0,credentials:"omit"}).catch(()=>{}),!0}catch(G){return false}return false}function F(A=false){return H(this,null,function*(){if(I(),p!==null||h.length===0){yield b;return}let M=h;h=[];let C=Ss(M);if(A){for(let G of C)E(G);return}b=b.then(()=>H(null,null,function*(){let G=[];for(let U of C){if(p!==null)return;G.push(...yield S(U));}G.length>0&&p===null&&(h=G.concat(h),h.length>1e3&&h.splice(0,h.length-1e3),V());})),yield b;})}return {enqueue:P,flush:F,stopped:()=>p,discard(){h=[],I();},dispose(){I();}}}var Ur="arcy:routechange",Es="arcy.session.",Ts="arcy.telemetry.",xs="arcy.telemetry.stop.";function bt(e){return e.isTrusted===false}function Jt(e){var ue,He,se,xe,_e;let{token:t,apiBase:n,describeElement:r,getUserId:s,getVisitorId:l,getFlowSessionId:a,now:f=()=>Date.now(),fill:o}=e,i=e.win!==void 0?e.win:typeof window!="undefined"?window:null,u=e.doc!==void 0?e.doc:typeof document!="undefined"?document:null,h=(ue=e.localStore)!=null?ue:Ee(),v=Tr(h,Ts+t),p=Br({store:h,key:Es+t,now:f,fill:o}),b=Hr({token:t,apiBase:n,fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,sendBeacon:(He=i==null?void 0:i.navigator)!=null&&He.sendBeacon&&typeof i.navigator.sendBeacon=="function"?i.navigator.sendBeacon.bind(i.navigator):null,setTimeoutImpl:e.setTimeoutImpl,clearTimeoutImpl:e.clearTimeoutImpl,sessionStore:(se=e.sessionStore)!=null?se:Ve(),stopKey:xs+t,onTelemetryOff:()=>v.clearState()}),k=xr(i==null?void 0:i.navigator),D=(_e=(xe=i==null?void 0:i.navigator)==null?void 0:xe.language)!=null?_e:void 0,I=false,V=false,P=null,X=false;function S(){var R,x;return (x=je((R=i==null?void 0:i.location)==null?void 0:R.href))!=null?x:void 0}function E(R,x,N){var Fe,be,Ie,Ue;if(V||!v.shouldCapture()||b.stopped()!==null)return false;let z=f(),ye=p.touch(),de=Lr($e(z,o),R,z,{sessionId:ye,userId:(Fe=s==null?void 0:s())!=null?Fe:void 0,visitorId:(be=l==null?void 0:l())!=null?be:void 0,route:S(),localeCode:D,deviceClass:k,flowSessionId:(Ue=(Ie=N==null?void 0:N.flowSessionId)!=null?Ie:a==null?void 0:a())!=null?Ue:void 0},x);return N!=null&&N.flowId&&(de.flowId=N.flowId),N!=null&&N.flowVersion&&(de.flowVersion=N.flowVersion),N!=null&&N.stepCvid&&(de.stepCvid=N.stepCvid),b.enqueue(de),true}let F=R=>{try{let x=R;if(bt(x))return;let N=i!=null&&i.getComputedStyle?ye=>{var de;try{return (de=i.getComputedStyle(ye).cursor)!=null?de:null}catch(Fe){return null}}:void 0,z=Fr(x.target,N);if(!z)return;E("interaction_click",Cr(z,r));}catch(x){}},A=R=>{try{let x=R;if(bt(x)||!x.target||typeof x.target.getAttribute!="function")return;E("form_submit",Ir(x.target,r));}catch(x){}},M=()=>{var R;try{let x=(R=S())!=null?R:null;if(x===P)return;let N=P;P=x,G.reset(),E("navigation",N?{from:N}:void 0);}catch(x){}},C=Mr({emit:(R,x)=>{E(R,_r(x,r));}}),G=Nr({readDepth:()=>{var R;return Dr({scrollY:i==null?void 0:i.scrollY,innerHeight:i==null?void 0:i.innerHeight,documentHeight:(R=u==null?void 0:u.documentElement)==null?void 0:R.scrollHeight})},emit:R=>{E("scroll_depth",{percent:R});},setTimeoutImpl:e.setTimeoutImpl,clearTimeoutImpl:e.clearTimeoutImpl}),U=false,K=R=>{try{let x=R;if(bt(x)||!x.target)return;C.focus(x.target);}catch(x){}},J=R=>{try{let x=R;if(bt(x)||!x.target)return;C.change(x.target);}catch(x){}},ee=R=>{try{let x=R;if(!x.target)return;C.blur(x.target);}catch(x){}},L=()=>{try{G.scrolled();}catch(R){}},j=()=>{try{if((u==null?void 0:u.visibilityState)==="visible"){E("page_visible");return}E("page_hidden"),b.flush(!0);}catch(R){}},le=()=>{try{U||(U=!0,E("session_end")),b.flush(!0);}catch(R){}},Ce=R=>{var x;try{let N=R;Te({message:(x=jt(N.message))!=null?x:"Uncaught error",kind:"error",source:Y(N.filename)});}catch(N){}},ce=R=>{var x;try{Te({message:(x=jt(R.reason))!=null?x:"Unhandled promise rejection",kind:"unhandledrejection"});}catch(N){}};function Te(R){let x={message:R.message,kind:R.kind};R.source&&(x.source=R.source),E("js_error",x);}function Y(R){var x,N;if(typeof R=="string")return (N=je(R,(x=i==null?void 0:i.location)==null?void 0:x.href))!=null?N:void 0}let ge=(n!=null?n:qt).replace(/\/+$/,""),he=null;return {start(){var R;I||V||(I=true,P=(R=S())!=null?R:null,u==null||u.addEventListener("click",F,true),u==null||u.addEventListener("submit",A,true),u==null||u.addEventListener("focusin",K,true),u==null||u.addEventListener("focusout",ee,true),u==null||u.addEventListener("input",J,true),u==null||u.addEventListener("change",J,true),i==null||i.addEventListener(Ur,M),i==null||i.addEventListener("popstate",M),i==null||i.addEventListener("scroll",L,{passive:true}),i==null||i.addEventListener("pagehide",le),u==null||u.addEventListener("visibilitychange",j),i==null||i.addEventListener("error",Ce),i==null||i.addEventListener("unhandledrejection",ce),i&&he===null&&(he=Pr({target:i,report:x=>{let N={method:x.method,status:x.status};x.url&&(N.url=x.url),E("request_failed",N);},ignore:x=>x.indexOf(ge)===0})),X=!E("navigation")&&v.state()===null);},stop(R){V=true,I&&(I=false,u==null||u.removeEventListener("click",F,true),u==null||u.removeEventListener("submit",A,true),u==null||u.removeEventListener("focusin",K,true),u==null||u.removeEventListener("focusout",ee,true),u==null||u.removeEventListener("input",J,true),u==null||u.removeEventListener("change",J,true),i==null||i.removeEventListener(Ur,M),i==null||i.removeEventListener("popstate",M),i==null||i.removeEventListener("scroll",L),i==null||i.removeEventListener("pagehide",le),u==null||u.removeEventListener("visibilitychange",j),i==null||i.removeEventListener("error",Ce),i==null||i.removeEventListener("unhandledrejection",ce),he&&(he(),he=null),G.dispose(),R!=null&&R.discard?b.discard():b.flush(false),b.dispose());},setTelemetryState(R){v.setState(R),X&&(X=false,E("navigation"));},setTelemetryConsent(R){v.setConsent(R),R||b.discard();},track(R,x,N){E(R,x,N);},flush:()=>b.flush(false),sessionId:()=>p.current(),resetSession:()=>p.clear(),stopped:()=>b.stopped(),state:()=>v.state()}}var Vr="0.1.1";var ks=["telemetry","locale","defaultOpen","contentLocale","apiBase"];function Wr(){return {userId:null,isAnonymous:false,attributes:{}}}function As(e,t){return e==null?{ok:true,hash:void 0}:typeof e!="string"||e.length===0?(w(`${t}() was given a userHash that is not a string. Ignoring it.`),{ok:false}):{ok:true,hash:e}}function Qt(e,t){if(e===void 0)return {};if(typeof e!="object"||e===null||Array.isArray(e))return w(`${t}() attributes must be an object. Ignoring the call.`),null;let n={};for(let[r,s]of Object.entries(e)){if(s===void 0)continue;if(s===null){n[r]=null;continue}let l=typeof s;if(l==="string"||l==="number"||l==="boolean"){n[r]=s;continue}if(Array.isArray(s)&&s.every(a=>typeof a=="string")){n[r]=s;continue}w(`${t}() dropped "${r}": an attribute must be a string, number, boolean, null, or an array of strings.`);}return n}var Cs={cdnBase:null,loadChat:()=>Promise.resolve(null),loadFlow:()=>Promise.resolve(null),loadPicker:()=>Promise.resolve(null)};function $r(e){return _s({chunks:e}).api}function _s(e={}){var Ge;let t=(Ge=e.chunks)!=null?Ge:Cs,n=pn();function r(){var y;let d=l.apiBase;return typeof d=="string"&&d.length>0?d.replace(/\/+$/,""):(y=e.apiBase)!=null?y:Dt}let s=null,l={},a=Wr(),f=false,o=null,i=null,u=null,h=false,v=null,p=null,b=null,k=0,D,I,V=false,P=null,X=null,S=null,E=null,F=null,A=yt,M=null,C=null,G=null,U=null,K=null,J=false,ee=false;function L(d){return s===null?(w(`${d}() was called before init(). Ignoring.`),false):true}function j(d,y){return H(this,null,function*(){if(typeof d!="string"||d.length===0){w("init() needs an environment token. Ignoring the call.");return}if(s!==null){w("init() has already been called. Ignoring the second call.");return}if(s=d,l={},y!==void 0)if(typeof y!="object"||y===null)w("init() options must be an object. Continuing without them.");else for(let[T,g]of Object.entries(y)){if(!ks.includes(T)){w(`init() ignored unknown option "${T}". Only telemetry, locale, defaultOpen, contentLocale, and apiBase can be set in code; everything else is configured in the dashboard.`);continue}l[T]=g;}typeof window!="undefined"&&Sn(window,{apiBase:r(),cdnBase:t.cdnBase}),le(d),Ce(d),ce(d),yield Ne(),n.emit("ready"),l.defaultOpen&&fe();})}function le(d){try{P=hr(d);let y=P.read().anonymousId!==null;E=P.anonymousId(),X=br(d),y||X.markFirstVisit();}catch(y){P=null,E=null,w(`The ARCY session could not be started. ${String(y)}`);}try{S=vr(d);}catch(y){S=null,w(`The ARCY session could not be started. ${String(y)}`);}try{F=mr(d);let y=F.read();A=y.tokens,M=y.identity;}catch(y){F=null,A=yt,w(`The ARCY session could not be started. ${String(y)}`);}try{p=Jt({token:d,apiBase:r(),fetchImpl:e.fetchImpl,describeElement:y=>hn(y),getUserId:()=>a.isAnonymous?null:a.userId,getVisitorId:()=>E}),l.telemetry!==void 0&&p.setTelemetryConsent(l.telemetry===!0),p.start();}catch(y){w(`Telemetry could not start. ${String(y)}`);}try{b=Dn({token:d,apiBase:r(),fetchImpl:e.fetchImpl,setTimeoutImpl:e.setTimeoutImpl});}catch(y){w(`The ARCY session could not be started. ${String(y)}`);}ge();}function Ce(d){if(typeof window!="undefined")try{Mn({win:window,token:d,loadChunk:t.loadPicker,apiBase:r(),fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,setTimeoutImpl:e.setTimeoutImpl,onVerified:()=>p==null?void 0:p.stop({discard:!0})});}catch(y){w(`Design mode could not start. ${String(y)}`);}}function ce(d){if(typeof window!="undefined")try{let y=Fn(window,d);if(!y)return;p==null||p.stop({discard:!0}),h=!0,v=y;}catch(y){w(`The preview could not start. ${String(y)}`);}}function Te(d){var y,T;return Nn({apiBase:r(),token:s!=null?s:"",nonce:d,sessionToken:(T=(y=b==null?void 0:b.config())==null?void 0:y.sessionToken)!=null?T:null,userTraits:a.attributes,fetchImpl:e.fetchImpl!==void 0?e.fetchImpl:typeof fetch!="undefined"?fetch.bind(globalThis):null,setTimeoutImpl:e.setTimeoutImpl})}function Y(){ee=false,o==null||o.unmount(),o=null,i==null||i.destroy(),i=null,u==null||u.destroy(),u=null,C=null,G=null,U=null,ke();}function ge(){try{o||se(),he(),xe(),i==null||i.refreshChrome(),ee&&(ee=!1,fe());}catch(d){w(`The chat bar could not render. ${String(d)}`);}}function he(){var d,y,T,g;try{let B=o==null?void 0:o.getHost();if(!o||!B)return;pr(B,A),o.setGeometry({widthPercent:(d=A.widthPercent)!=null?d:mt,bottomOffset:(y=A.bottomOffset)!=null?y:ft,collapsedWidth:(T=A.collapsedWidth)!=null?T:gt}),o.setIconSize((g=A.barIconSize)!=null?g:pt);}catch(B){w(`The widget could not apply its theme. ${String(B)}`);}}function ue(){var Re,Z;let d=(Re=b==null?void 0:b.config())==null?void 0:Re.widget,y=(Z=et(d))!=null?Z:M;if(!y)return null;let T=Ye=>typeof Ye=="string"?Ye:"",g=d!=null&&d.chrome&&typeof d.chrome=="object"&&!Array.isArray(d.chrome)?$($({},ut),d.chrome):ut,B=d==null?void 0:d.welcomeIconUrl,Q=d==null?void 0:d.chatBarIconUrl,pe=r();return {name:y.name,logoUrl:ht(y.logoUrl,pe),welcomeIconUrl:ht(B,pe),chatBarIconUrl:ht(Q,pe),welcomeMessage:T(d==null?void 0:d.welcomeMessage),inputPlaceholder:T(d==null?void 0:d.inputPlaceholder),welcomeHeadline:T(d==null?void 0:d.welcomeHeadline),audience:(d==null?void 0:d.audience)==="identified"||(d==null?void 0:d.audience)==="anonymous"?d.audience:"",allowImageUpload:(d==null?void 0:d.allowImageUpload)===true,barDraggable:(d==null?void 0:d.barDraggable)===true,privacyPolicyUrl:typeof(d==null?void 0:d.privacyPolicyUrl)=="string"&&/^https:\/\//i.test(d.privacyPolicyUrl)?d.privacyPolicyUrl:null,chrome:g,locales:He(d==null?void 0:d.locales),activeLocale:typeof(d==null?void 0:d.activeLocale)=="string"?d.activeLocale:""}}function He(d){if(!Array.isArray(d))return [];let y=[];for(let T of d){if(!T||typeof T!="object")continue;let{code:g,label:B}=T;typeof g!="string"||g.length===0||typeof B!="string"||B.length===0||y.push({code:g,label:B});}return y}function se(){var d,y,T,g,B,Q,pe,Re;try{o=ur({geometry:{widthPercent:(d=A.widthPercent)!=null?d:mt,bottomOffset:(y=A.bottomOffset)!=null?y:ft,collapsedWidth:(T=A.collapsedWidth)!=null?T:gt},labels:_e(),iconUrl:(B=(g=ue())==null?void 0:g.chatBarIconUrl)!=null?B:null,welcomeIconUrl:(pe=(Q=ue())==null?void 0:Q.welcomeIconUrl)!=null?pe:null,iconSize:(Re=A.barIconSize)!=null?Re:pt,onActivate:()=>fe(),onSubmit:Z=>{if(J||fe(),C){C(Z);return}K=Z;},onAttach:()=>{fe();},onFiles:Z=>{if(fe(),G){G(Z);return}U=Z;},onDismiss:()=>{ke();},onStop:()=>{u==null||u.stop(),be();},onGeometryChange:()=>i==null?void 0:i.reposition(),readPosition:()=>{var Z;return (Z=P==null?void 0:P.read().position)!=null?Z:null},onPositionChange:Z=>P==null?void 0:P.rememberPosition(Z),readDocked:()=>(P==null?void 0:P.read().docked)===!0,onDockedChange:Z=>P==null?void 0:P.rememberDocked(Z),onUndock:()=>fe()}),o.mount(),Ue();}catch(Z){w(`The chat bar could not render. ${String(Z)}`);}}function xe(){var d,y,T;try{if(!o)return;let g=ue();o.setLabels(_e()),o.getMode()!=="flow"&&o.setPlaceholder((d=g==null?void 0:g.inputPlaceholder)!=null?d:null),o.setAttachEnabled((g==null?void 0:g.allowImageUpload)===!0),o.setDraggable((g==null?void 0:g.barDraggable)===!0),o.setIcon((y=g==null?void 0:g.chatBarIconUrl)!=null?y:null),o.setWelcomeIcon((T=g==null?void 0:g.welcomeIconUrl)!=null?T:null);}catch(g){w(`The widget could not apply its texts. ${String(g)}`);}}function _e(){var y,T;let d=(T=(y=ue())==null?void 0:y.chrome)!=null?T:ut;return {send:d.send,attachMenu:d.attachMenu,attachImage:d.attachImage,flowStop:d.flowStop,openChat:d.openChat,moveBar:d.moveBar,flowStep:d.flowStep}}let R=600,x=4e3,N=null,z=[],ye=null;function de(d){let y=d.phase==="done"?x:R;try{N=setTimeout(()=>{for(N=null;z.length>0;){let T=z.shift();if(Ie(T),T!==null){de(T);return}}},y);}catch(T){}}function Fe(d){if(d===null){let y=(ye==null?void 0:ye.phase)==="done"||z.some(T=>(T==null?void 0:T.phase)==="done");if(N!==null&&y){z[z.length-1]!==null&&z.push(null);return}be();return}if(N!==null){let y=z[z.length-1];if(d.phase!=="done"&&y!==void 0&&y!==null&&y.phase!=="done"){z[z.length-1]=d;return}z.push(d);return}Ie(d),de(d);}function be(){if(N!==null){try{clearTimeout(N);}catch(d){}N=null;}z=[],Ie(null);}function Ie(d){var y,T;ye=d;try{if(d&&(o==null||o.setDocked(!1)),o==null||o.setFlow(d),d){ke();return}o==null||o.setPlaceholder((T=(y=ue())==null?void 0:y.inputPlaceholder)!=null?T:null);}catch(g){w(`The flow status could not be shown. ${String(g)}`);}}function Ue(){try{let d=o==null?void 0:o.getRoot(),y=o==null?void 0:o.getHost(),T=o;if(!d||!y||!T)return;i=$n({root:d,host:y,loadChunk:t.loadChat,onRequestClose:()=>ke(),bar:{onSubmit:g=>{if(C=g,K!==null){let B=K;K=null,g(B);}},onFiles:g=>{if(G=g,U!==null){let B=U;U=null,g(B);}},setPlaceholder:g=>T.setPlaceholder(g),setDisabled:g=>T.setDisabled(g),setMode:g=>T.setMode(g),setFlow:g=>T.setFlow(g),setAwaitingInput:g=>T.setAwaitingInput(g),setDisclaimer:g=>T.setDisclaimer(g),setAttachEnabled:g=>T.setAttachEnabled(g),setAttachmentCount:g=>T.setAttachmentCount(g),attachmentSlot:()=>T.attachmentSlot(),focusInput:()=>T.focusInput(),getMetrics:()=>T.getMetrics(),dock:()=>T.setDocked(!0)},apiBase:r(),getSessionToken:()=>{var g,B;return (B=(g=b==null?void 0:b.config())==null?void 0:g.sessionToken)!=null?B:null},getSessionId:()=>p==null?void 0:p.sessionId(),getRoute:()=>typeof window!="undefined"?window.location.pathname:"",getMaxHeightPercent:()=>{var g;return (g=A.maxHeightPercent)!=null?g:void 0},onStartFlow:g=>{Ke(),u==null||u.start(g);},onStopFlow:()=>{u==null||u.stop(),be();},publicKey:s!=null?s:void 0,getConversationId:()=>{var g;return (g=S==null?void 0:S.id())!=null?g:null},setConversationId:g=>{var B,Q;return g===null?(B=S==null?void 0:S.startNew())!=null?B:null:(Q=S==null?void 0:S.adopt(g))!=null?Q:null},touchConversation:()=>S==null?void 0:S.touch(),getVisitorId:()=>E,onOrgCapExceeded:()=>Y(),track:(g,B,Q)=>{p==null||p.track(g,Q,B);},getWidget:()=>ue(),onSelectLocale:g=>{tt(g);}});}catch(d){w(`The chat panel could not be prepared. ${String(d)}`);}}function tt(d){return H(this,null,function*(){try{if(typeof d!="string"||d.length===0||(P==null?void 0:P.read().locale)===d)return;P==null||P.rememberLocale(d),yield Ne(),xe(),i==null||i.refreshChrome();}catch(y){w(`The widget could not change its language. ${String(y)}`);}})}function wt(){var T;if(!s)return null;let d=(T=b==null?void 0:b.config())==null?void 0:T.sessionToken;if(!d)return null;let y=X;return ae($({apiBase:r(),token:s,sessionToken:d,sessionId:p==null?void 0:p.sessionId(),getTrait:g=>{let B=a.attributes[g];if(B!=null)return B}},y?{isFirstVisit:()=>y.isFirstVisit()}:{}),{promptFill:g=>{var Q;return o==null||o.setDocked(false),J=true,((Q=i==null?void 0:i.promptFill(g))!=null?Q:Promise.resolve(null)).finally(()=>{J=false;})},cancelFill:()=>{J=false,i==null||i.cancelFill();},onFailure:()=>{f||fe(),i==null||i.showFlowFailure();},track:(g,B,Q)=>{p==null||p.track(g,Q,B);},onStatus:g=>Fe(g),getBottomOcclusion:()=>{let g=o==null?void 0:o.getMetrics();return g?g.bottomOffset+g.keyboardOffset+g.height:0}})}function Ke(){if(!u)try{let d=wt();if(!d)return;u=Xn({context:d,loadChunk:t.loadFlow});}catch(d){w(`The flow engine could not be prepared. ${String(d)}`);}}function Ne(){return H(this,null,function*(){var d,y;try{yield Et();}catch(T){w(`The ARCY session could not be started. ${String(T)}`);}try{let T=b==null?void 0:b.config();if(T){let g=((d=T.customization)!=null?d:{}).tokens;F==null||F.remember(g,T.widget),A=Gt(g),M=(y=et(T.widget))!=null?y:M;}}catch(T){w(`The widget could not read its theme. ${String(T)}`);}if(h||(Ke(),u&&(h=true,u.resume())),v){let T=v;v=null,H(null,null,function*(){if(Ke(),!u)return;if(T.kind==="pending"){yield u.resumePreview();return}let g=yield Te(T.nonce);g&&(yield u.startPreview(g));}).catch(g=>w(`The preview could not run. ${String(g)}`));}ge();})}function vt(){if(D!==void 0)return D;try{let d=typeof window!="undefined"?window.location.pathname:null;return typeof d!="string"||!d.startsWith("/")?void 0:(D=Be(d),D)}catch(d){return}}function St(){var d,y;if(V)return I;V=true;try{return typeof window=="undefined"?void 0:(I=Er({referrer:typeof document!="undefined"?document.referrer:null,search:(y=(d=window.location)==null?void 0:d.search)!=null?y:null,userAgent:typeof navigator!="undefined"?navigator.userAgent:null,viewportWidth:window.innerWidth}),I)}catch(T){return}}function Et(){return H(this,null,function*(){var T,g;if(!b||!p)return;let d=++k,y=yield b.sync({sessionId:p.sessionId(),route:vt(),sessionContext:St(),visitorId:E!=null?E:void 0,userId:a.isAnonymous?void 0:(T=a.userId)!=null?T:void 0,userHash:a.isAnonymous?void 0:a.userHash,userTraits:Object.keys(a.attributes).length?a.attributes:void 0,uiLanguage:l.locale==="en"||l.locale==="tr"?l.locale:void 0,contentLocale:typeof l.contentLocale=="string"?l.contentLocale:void 0,viewerLocale:(g=P==null?void 0:P.read().locale)!=null?g:void 0});if(!y.ok){w("The ARCY session could not be started. The widget will keep working, and telemetry stays off until configuration arrives.");return}d===k&&(y.config.identityAccepted===false&&w("This environment enforces identity verification and no valid userHash was supplied, so this user was not identified and none of their attributes were stored. Pass a signed userHash: arcy.identify(userId, attributes, { userHash }). See Settings > Identity verification in the ARCY dashboard."),y.config.behavioralTelemetry&&p.setTelemetryState(y.config.behavioralTelemetry));})}function Tt(d,y,T){return H(this,null,function*(){var pe;if(!L("identify"))return;if(typeof d!="string"||d.length===0){w("identify() needs a user id. Ignoring the call.");return}let g=Qt(y,"identify");if(g===null)return;let B=As((T!=null?T:{}).userHash,"identify");if(!B.ok)return;let Q=a.userId===d&&!a.isAnonymous;a={userId:d,isAnonymous:false,attributes:Q?$($({},a.attributes),g):g,userHash:Q?(pe=B.hash)!=null?pe:a.userHash:B.hash},yield Ne();})}function xt(d){return H(this,null,function*(){if(!L("identifyAnonymous"))return;let y=Qt(d,"identifyAnonymous");y!==null&&(a={userId:null,isAnonymous:true,attributes:y},yield Ne());})}function we(d){return H(this,null,function*(){if(!L("updateUser"))return;if(!a.userId&&!a.isAnonymous){w("updateUser() was called before identify() or identifyAnonymous(). Ignoring the call.");return}let y=Qt(d,"updateUser");y!==null&&(a=ae($({},a),{attributes:$($({},a.attributes),y)}),yield Ne());})}function nt(){var d;a=Wr(),P==null||P.forgetAnonymousId(),E=(d=P==null?void 0:P.anonymousId())!=null?d:null,p==null||p.resetSession(),S==null||S.reset(),ke();}function fe(){if(L("open")){if(!o){ee=true;return}f||(o==null||o.setDocked(false),f=true,o==null||o.setMode("open"),i==null||i.open(),n.emit("open"));}}function ke(){f&&(f=false,o==null||o.setMode("idle"),i==null||i.close(),n.emit("close"));}function rt(d,y){return n.on(d,y)}return {api:{init:j,identify:Tt,identifyAnonymous:xt,updateUser:we,reset:nt,open:fe,close:ke,on:rt,VERSION:Vr},getToken:()=>s,getOptions:()=>l,getIdentity:()=>a,isOpen:()=>f,getBar:()=>o,getChatController:()=>i,getFlowController:()=>u,getTelemetry:()=>p,getConfig:()=>{var d;return (d=b==null?void 0:b.config())!=null?d:null},selectLocale:tt,getShellState:()=>P,getTokens:()=>A,getWidgetChrome:()=>ue()}}var Kr={cdnBase:Ut,loadChat:(e,t,n)=>Wn(e,Ut,t,n),loadFlow:(e,t,n)=>zn(e,Yn,t,n),loadPicker:(e,t,n)=>On(e,Ln,t,n)};function Gr(e,t){let n=e.q;for(;n.length>0;){let r=n.shift();if(!r)break;let s=t[r.method];if(typeof s!="function"){r.resolve();continue}try{let l=s(...r.args);l&&typeof l.then=="function"?l.then(()=>r.resolve(),()=>r.resolve()):r.resolve();}catch(l){r.resolve();}}}var Yr=$r(Kr);if(typeof window!="undefined"){let e=window.arcy;window.arcy=Yr,e&&Array.isArray(e.q)&&Gr(e,Yr);}
|
|
568
568
|
})();
|
package/dist/arcy.loader.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(exports){'use strict';/* arcy.js — https://arcyai.com */
|
|
2
|
-
var c="arcy.modern.
|
|
2
|
+
var c="arcy.modern.2c3fe0b458df.js",i="arcy.legacy.98a48482777b.js";function a(){return typeof HTMLScriptElement!="undefined"&&"noModule"in HTMLScriptElement.prototype}function p(r){let e=r.currentScript;return !e||!e.src?"":e.src.replace(/\/[^/]*$/,"")}function f(r,e){var s;let u=p(e),d=a()?c:i,t=e.createElement("script"),o=(s=e.currentScript)==null?void 0:s.nonce;o&&(t.nonce=o,t.setAttribute("nonce",o)),t.async=true,t.src=`${u}/${d}`,t.onerror=()=>{typeof console!="undefined"&&console.warn&&console.warn(`[arcy] Failed to load ${t.src}. ARCY is disabled.`);};let n=e.getElementsByTagName("script")[0];n&&n.parentNode?n.parentNode.insertBefore(t,n):(e.head||e.documentElement).appendChild(t);}typeof window!="undefined"&&typeof document!="undefined"&&f(window,document);exports.currentScriptBase=p;exports.loadCore=f;return exports;})({});
|