@ujet/websdk-headless 3.42.2 → 3.43.4

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/index.d.ts CHANGED
@@ -104,7 +104,7 @@ interface CheckInVisibilityStateRequest {
104
104
  tab_inactive?: boolean;
105
105
  }
106
106
  interface CheckInModalStateRequest {
107
- modal_type: 'check_in' | 'timeout';
107
+ modal_type: 'check_in';
108
108
  }
109
109
 
110
110
  declare enum PostSessionStatus {
@@ -537,7 +537,8 @@ declare class Chat {
537
537
  get optInRequired(): boolean;
538
538
  get postSessionRequired(): boolean;
539
539
  get postSessionInProgress(): boolean;
540
- get checkInStatus(): CheckInStatus;
540
+ get checkInStatus(): CheckInStatus | null;
541
+ set checkInStatus(newStatus: CheckInStatus | null);
541
542
  update(state: ChatResponse): void;
542
543
  on(eventName: string, handler: EventHandler): void;
543
544
  off(eventName: string, handler: EventHandler): void;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";var iI=Object.defineProperty;var aI=(e,t,r)=>t in e?iI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var vt=(e,t,r)=>aI(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class sI{constructor(){vt(this,"_hostPath","")}setPath(t){this._hostPath=t}getPath(){return this._hostPath}}const kT=new sI;class oI{async playPing(){kT.getPath();const t="https://websdk.ujet.co/v3/ping.mp3";try{await this.playSound(t)}catch(r){console.warn("Chat audio play failed",{error:r})}}async playSound(t,r=1){const n=new window.Audio(t);n.volume=r;try{await n.play()}catch(i){console.warn("Audio play failed",{error:i})}}}/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:RT,setPrototypeOf:oy,isFrozen:uI,getPrototypeOf:cI,getOwnPropertyDescriptor:lI}=Object;let{freeze:nn,seal:Un,create:bh}=Object,{apply:_h,construct:wh}=typeof Reflect<"u"&&Reflect;nn||(nn=function(t){return t});Un||(Un=function(t){return t});_h||(_h=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];return t.apply(r,i)});wh||(wh=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return new t(...n)});const oc=an(Array.prototype.forEach),fI=an(Array.prototype.lastIndexOf),uy=an(Array.prototype.pop),$o=an(Array.prototype.push),dI=an(Array.prototype.splice),bl=an(String.prototype.toLowerCase),od=an(String.prototype.toString),ud=an(String.prototype.match),Oo=an(String.prototype.replace),pI=an(String.prototype.indexOf),hI=an(String.prototype.trim),ei=an(Object.prototype.hasOwnProperty),Zr=an(RegExp.prototype.test),Io=vI(TypeError);function an(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return _h(e,t,n)}}function vI(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return wh(e,r)}}function Mt(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:bl;oy&&oy(e,null);let n=t.length;for(;n--;){let i=t[n];if(typeof i=="string"){const a=r(i);a!==i&&(uI(t)||(t[n]=a),i=a)}e[i]=!0}return e}function mI(e){for(let t=0;t<e.length;t++)ei(e,t)||(e[t]=null);return e}function Fi(e){const t=bh(null);for(const[r,n]of RT(e))ei(e,r)&&(Array.isArray(n)?t[r]=mI(n):n&&typeof n=="object"&&n.constructor===Object?t[r]=Fi(n):t[r]=n);return t}function Po(e,t){for(;e!==null;){const n=lI(e,t);if(n){if(n.get)return an(n.get);if(typeof n.value=="function")return an(n.value)}e=cI(e)}function r(){return null}return r}const cy=nn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),cd=nn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ld=nn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),gI=nn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fd=nn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),yI=nn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ly=nn(["#text"]),fy=nn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),dd=nn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),dy=nn(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),uc=nn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),bI=Un(/\{\{[\w\W]*|[\w\W]*\}\}/gm),_I=Un(/<%[\w\W]*|[\w\W]*%>/gm),wI=Un(/\$\{[\w\W]*/gm),SI=Un(/^data-[\-\w.\u00B7-\uFFFF]+$/),TI=Un(/^aria-[\-\w]+$/),$T=Un(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),CI=Un(/^(?:\w+script|data):/i),EI=Un(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),OT=Un(/^html$/i),kI=Un(/^[a-z][.\w]*(-[.\w]+)+$/i);var py=Object.freeze({__proto__:null,ARIA_ATTR:TI,ATTR_WHITESPACE:EI,CUSTOM_ELEMENT:kI,DATA_ATTR:SI,DOCTYPE_NAME:OT,ERB_EXPR:_I,IS_ALLOWED_URI:$T,IS_SCRIPT_OR_DATA:CI,MUSTACHE_EXPR:bI,TMPLIT_EXPR:wI});const Ao={element:1,text:3,progressingInstruction:7,comment:8,document:9},RI=function(){return typeof window>"u"?null:window},$I=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";r&&r.hasAttribute(i)&&(n=r.getAttribute(i));const a="dompurify"+(n?"#"+n:"");try{return t.createPolicy(a,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},hy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function IT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:RI();const t=rt=>IT(rt);if(t.version="3.3.0",t.removed=[],!e||!e.document||e.document.nodeType!==Ao.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const n=r,i=n.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:c,Element:o,NodeFilter:u,NamedNodeMap:l=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:v,trustedTypes:m}=e,y=o.prototype,C=Po(y,"cloneNode"),R=Po(y,"remove"),E=Po(y,"nextSibling"),M=Po(y,"childNodes"),D=Po(y,"parentNode");if(typeof s=="function"){const rt=r.createElement("template");rt.content&&rt.content.ownerDocument&&(r=rt.content.ownerDocument)}let L,Z="";const{implementation:ee,createNodeIterator:V,createDocumentFragment:N,getElementsByTagName:ne}=r,{importNode:Q}=n;let ie=hy();t.isSupported=typeof RT=="function"&&typeof D=="function"&&ee&&ee.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:me,ERB_EXPR:j,TMPLIT_EXPR:le,DATA_ATTR:Ce,ARIA_ATTR:Ze,IS_SCRIPT_OR_DATA:We,ATTR_WHITESPACE:_e,CUSTOM_ELEMENT:ce}=py;let{IS_ALLOWED_URI:de}=py,A=null;const Re=Mt({},[...cy,...cd,...ld,...fd,...ly]);let qe=null;const Ie=Mt({},[...fy,...dd,...dy,...uc]);let be=Object.seal(bh(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),J=null,Rt=null;const Te=Object.seal(bh(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let oe=!0,Tt=!0,Le=!1,Vt=!0,ht=!1,Oe=!0,ot=!1,Ct=!1,xe=!1,Ut=!1,mt=!1,Bt=!1,cr=!0,ze=!1;const Nr="user-content-";let Sr=!0,$t=!1,It={},gt=null;const ct=Mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let qt=null;const xt=Mt({},["audio","video","img","source","image","track"]);let lr=null;const Dr=Mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Lr="http://www.w3.org/1998/Math/MathML",jr="http://www.w3.org/2000/svg",Lt="http://www.w3.org/1999/xhtml";let sr=Lt,ye=!1,Se=null;const ue=Mt({},[Lr,jr,Lt],od);let ge=Mt({},["mi","mo","mn","ms","mtext"]),fe=Mt({},["annotation-xml"]);const we=Mt({},["title","style","font","a","script"]);let Ee=null;const te=["application/xhtml+xml","text/html"],he="text/html";let H=null,ae=null;const Y=r.createElement("form"),je=function(X){return X instanceof RegExp||X instanceof Function},$e=function(){let X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ae&&ae===X)){if((!X||typeof X!="object")&&(X={}),X=Fi(X),Ee=te.indexOf(X.PARSER_MEDIA_TYPE)===-1?he:X.PARSER_MEDIA_TYPE,H=Ee==="application/xhtml+xml"?od:bl,A=ei(X,"ALLOWED_TAGS")?Mt({},X.ALLOWED_TAGS,H):Re,qe=ei(X,"ALLOWED_ATTR")?Mt({},X.ALLOWED_ATTR,H):Ie,Se=ei(X,"ALLOWED_NAMESPACES")?Mt({},X.ALLOWED_NAMESPACES,od):ue,lr=ei(X,"ADD_URI_SAFE_ATTR")?Mt(Fi(Dr),X.ADD_URI_SAFE_ATTR,H):Dr,qt=ei(X,"ADD_DATA_URI_TAGS")?Mt(Fi(xt),X.ADD_DATA_URI_TAGS,H):xt,gt=ei(X,"FORBID_CONTENTS")?Mt({},X.FORBID_CONTENTS,H):ct,J=ei(X,"FORBID_TAGS")?Mt({},X.FORBID_TAGS,H):Fi({}),Rt=ei(X,"FORBID_ATTR")?Mt({},X.FORBID_ATTR,H):Fi({}),It=ei(X,"USE_PROFILES")?X.USE_PROFILES:!1,oe=X.ALLOW_ARIA_ATTR!==!1,Tt=X.ALLOW_DATA_ATTR!==!1,Le=X.ALLOW_UNKNOWN_PROTOCOLS||!1,Vt=X.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ht=X.SAFE_FOR_TEMPLATES||!1,Oe=X.SAFE_FOR_XML!==!1,ot=X.WHOLE_DOCUMENT||!1,Ut=X.RETURN_DOM||!1,mt=X.RETURN_DOM_FRAGMENT||!1,Bt=X.RETURN_TRUSTED_TYPE||!1,xe=X.FORCE_BODY||!1,cr=X.SANITIZE_DOM!==!1,ze=X.SANITIZE_NAMED_PROPS||!1,Sr=X.KEEP_CONTENT!==!1,$t=X.IN_PLACE||!1,de=X.ALLOWED_URI_REGEXP||$T,sr=X.NAMESPACE||Lt,ge=X.MATHML_TEXT_INTEGRATION_POINTS||ge,fe=X.HTML_INTEGRATION_POINTS||fe,be=X.CUSTOM_ELEMENT_HANDLING||{},X.CUSTOM_ELEMENT_HANDLING&&je(X.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(be.tagNameCheck=X.CUSTOM_ELEMENT_HANDLING.tagNameCheck),X.CUSTOM_ELEMENT_HANDLING&&je(X.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(be.attributeNameCheck=X.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),X.CUSTOM_ELEMENT_HANDLING&&typeof X.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(be.allowCustomizedBuiltInElements=X.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ht&&(Tt=!1),mt&&(Ut=!0),It&&(A=Mt({},ly),qe=[],It.html===!0&&(Mt(A,cy),Mt(qe,fy)),It.svg===!0&&(Mt(A,cd),Mt(qe,dd),Mt(qe,uc)),It.svgFilters===!0&&(Mt(A,ld),Mt(qe,dd),Mt(qe,uc)),It.mathMl===!0&&(Mt(A,fd),Mt(qe,dy),Mt(qe,uc))),X.ADD_TAGS&&(typeof X.ADD_TAGS=="function"?Te.tagCheck=X.ADD_TAGS:(A===Re&&(A=Fi(A)),Mt(A,X.ADD_TAGS,H))),X.ADD_ATTR&&(typeof X.ADD_ATTR=="function"?Te.attributeCheck=X.ADD_ATTR:(qe===Ie&&(qe=Fi(qe)),Mt(qe,X.ADD_ATTR,H))),X.ADD_URI_SAFE_ATTR&&Mt(lr,X.ADD_URI_SAFE_ATTR,H),X.FORBID_CONTENTS&&(gt===ct&&(gt=Fi(gt)),Mt(gt,X.FORBID_CONTENTS,H)),Sr&&(A["#text"]=!0),ot&&Mt(A,["html","head","body"]),A.table&&(Mt(A,["tbody"]),delete J.tbody),X.TRUSTED_TYPES_POLICY){if(typeof X.TRUSTED_TYPES_POLICY.createHTML!="function")throw Io('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof X.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Io('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');L=X.TRUSTED_TYPES_POLICY,Z=L.createHTML("")}else L===void 0&&(L=$I(m,i)),L!==null&&typeof Z=="string"&&(Z=L.createHTML(""));nn&&nn(X),ae=X}},Ke=Mt({},[...cd,...ld,...gI]),He=Mt({},[...fd,...yI]),Je=function(X){let Me=D(X);(!Me||!Me.tagName)&&(Me={namespaceURI:sr,tagName:"template"});const Xe=bl(X.tagName),jt=bl(Me.tagName);return Se[X.namespaceURI]?X.namespaceURI===jr?Me.namespaceURI===Lt?Xe==="svg":Me.namespaceURI===Lr?Xe==="svg"&&(jt==="annotation-xml"||ge[jt]):!!Ke[Xe]:X.namespaceURI===Lr?Me.namespaceURI===Lt?Xe==="math":Me.namespaceURI===jr?Xe==="math"&&fe[jt]:!!He[Xe]:X.namespaceURI===Lt?Me.namespaceURI===jr&&!fe[jt]||Me.namespaceURI===Lr&&!ge[jt]?!1:!He[Xe]&&(we[Xe]||!Ke[Xe]):!!(Ee==="application/xhtml+xml"&&Se[X.namespaceURI]):!1},Ye=function(X){$o(t.removed,{element:X});try{D(X).removeChild(X)}catch{R(X)}},et=function(X,Me){try{$o(t.removed,{attribute:Me.getAttributeNode(X),from:Me})}catch{$o(t.removed,{attribute:null,from:Me})}if(Me.removeAttribute(X),X==="is")if(Ut||mt)try{Ye(Me)}catch{}else try{Me.setAttribute(X,"")}catch{}},tt=function(X){let Me=null,Xe=null;if(xe)X="<remove></remove>"+X;else{const Gt=ud(X,/^[\r\n\t ]+/);Xe=Gt&&Gt[0]}Ee==="application/xhtml+xml"&&sr===Lt&&(X='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+X+"</body></html>");const jt=L?L.createHTML(X):X;if(sr===Lt)try{Me=new v().parseFromString(jt,Ee)}catch{}if(!Me||!Me.documentElement){Me=ee.createDocument(sr,"template",null);try{Me.documentElement.innerHTML=ye?Z:jt}catch{}}const At=Me.body||Me.documentElement;return X&&Xe&&At.insertBefore(r.createTextNode(Xe),At.childNodes[0]||null),sr===Lt?ne.call(Me,ot?"html":"body")[0]:ot?Me.documentElement:At},it=function(X){return V.call(X.ownerDocument||X,X,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},at=function(X){return X instanceof f&&(typeof X.nodeName!="string"||typeof X.textContent!="string"||typeof X.removeChild!="function"||!(X.attributes instanceof l)||typeof X.removeAttribute!="function"||typeof X.setAttribute!="function"||typeof X.namespaceURI!="string"||typeof X.insertBefore!="function"||typeof X.hasChildNodes!="function")},lt=function(X){return typeof c=="function"&&X instanceof c};function Xt(rt,X,Me){oc(rt,Xe=>{Xe.call(t,X,Me,ae)})}const pr=function(X){let Me=null;if(Xt(ie.beforeSanitizeElements,X,null),at(X))return Ye(X),!0;const Xe=H(X.nodeName);if(Xt(ie.uponSanitizeElement,X,{tagName:Xe,allowedTags:A}),Oe&&X.hasChildNodes()&&!lt(X.firstElementChild)&&Zr(/<[/\w!]/g,X.innerHTML)&&Zr(/<[/\w!]/g,X.textContent)||X.nodeType===Ao.progressingInstruction||Oe&&X.nodeType===Ao.comment&&Zr(/<[/\w]/g,X.data))return Ye(X),!0;if(!(Te.tagCheck instanceof Function&&Te.tagCheck(Xe))&&(!A[Xe]||J[Xe])){if(!J[Xe]&&Wr(Xe)&&(be.tagNameCheck instanceof RegExp&&Zr(be.tagNameCheck,Xe)||be.tagNameCheck instanceof Function&&be.tagNameCheck(Xe)))return!1;if(Sr&&!gt[Xe]){const jt=D(X)||X.parentNode,At=M(X)||X.childNodes;if(At&&jt){const Gt=At.length;for(let gr=Gt-1;gr>=0;--gr){const yr=C(At[gr],!0);yr.__removalCount=(X.__removalCount||0)+1,jt.insertBefore(yr,E(X))}}}return Ye(X),!0}return X instanceof o&&!Je(X)||(Xe==="noscript"||Xe==="noembed"||Xe==="noframes")&&Zr(/<\/no(script|embed|frames)/i,X.innerHTML)?(Ye(X),!0):(ht&&X.nodeType===Ao.text&&(Me=X.textContent,oc([me,j,le],jt=>{Me=Oo(Me,jt," ")}),X.textContent!==Me&&($o(t.removed,{element:X.cloneNode()}),X.textContent=Me)),Xt(ie.afterSanitizeElements,X,null),!1)},dt=function(X,Me,Xe){if(cr&&(Me==="id"||Me==="name")&&(Xe in r||Xe in Y))return!1;if(!(Tt&&!Rt[Me]&&Zr(Ce,Me))){if(!(oe&&Zr(Ze,Me))){if(!(Te.attributeCheck instanceof Function&&Te.attributeCheck(Me,X))){if(!qe[Me]||Rt[Me]){if(!(Wr(X)&&(be.tagNameCheck instanceof RegExp&&Zr(be.tagNameCheck,X)||be.tagNameCheck instanceof Function&&be.tagNameCheck(X))&&(be.attributeNameCheck instanceof RegExp&&Zr(be.attributeNameCheck,Me)||be.attributeNameCheck instanceof Function&&be.attributeNameCheck(Me,X))||Me==="is"&&be.allowCustomizedBuiltInElements&&(be.tagNameCheck instanceof RegExp&&Zr(be.tagNameCheck,Xe)||be.tagNameCheck instanceof Function&&be.tagNameCheck(Xe))))return!1}else if(!lr[Me]){if(!Zr(de,Oo(Xe,_e,""))){if(!((Me==="src"||Me==="xlink:href"||Me==="href")&&X!=="script"&&pI(Xe,"data:")===0&&qt[X])){if(!(Le&&!Zr(We,Oo(Xe,_e,"")))){if(Xe)return!1}}}}}}}return!0},Wr=function(X){return X!=="annotation-xml"&&ud(X,ce)},Xr=function(X){Xt(ie.beforeSanitizeAttributes,X,null);const{attributes:Me}=X;if(!Me||at(X))return;const Xe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:qe,forceKeepAttr:void 0};let jt=Me.length;for(;jt--;){const At=Me[jt],{name:Gt,namespaceURI:gr,value:yr}=At,Qr=H(Gt),yn=yr;let Wt=Gt==="value"?yn:hI(yn);if(Xe.attrName=Qr,Xe.attrValue=Wt,Xe.keepAttr=!0,Xe.forceKeepAttr=void 0,Xt(ie.uponSanitizeAttribute,X,Xe),Wt=Xe.attrValue,ze&&(Qr==="id"||Qr==="name")&&(et(Gt,X),Wt=Nr+Wt),Oe&&Zr(/((--!?|])>)|<\/(style|title|textarea)/i,Wt)){et(Gt,X);continue}if(Qr==="attributename"&&ud(Wt,"href")){et(Gt,X);continue}if(Xe.forceKeepAttr)continue;if(!Xe.keepAttr){et(Gt,X);continue}if(!Vt&&Zr(/\/>/i,Wt)){et(Gt,X);continue}ht&&oc([me,j,le],di=>{Wt=Oo(Wt,di," ")});const Kn=H(X.nodeName);if(!dt(Kn,Qr,Wt)){et(Gt,X);continue}if(L&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!gr)switch(m.getAttributeType(Kn,Qr)){case"TrustedHTML":{Wt=L.createHTML(Wt);break}case"TrustedScriptURL":{Wt=L.createScriptURL(Wt);break}}if(Wt!==yn)try{gr?X.setAttributeNS(gr,Gt,Wt):X.setAttribute(Gt,Wt),at(X)?Ye(X):uy(t.removed)}catch{et(Gt,X)}}Xt(ie.afterSanitizeAttributes,X,null)},Vn=function rt(X){let Me=null;const Xe=it(X);for(Xt(ie.beforeSanitizeShadowDOM,X,null);Me=Xe.nextNode();)Xt(ie.uponSanitizeShadowNode,Me,null),pr(Me),Xr(Me),Me.content instanceof a&&rt(Me.content);Xt(ie.afterSanitizeShadowDOM,X,null)};return t.sanitize=function(rt){let X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Me=null,Xe=null,jt=null,At=null;if(ye=!rt,ye&&(rt="<!-->"),typeof rt!="string"&&!lt(rt))if(typeof rt.toString=="function"){if(rt=rt.toString(),typeof rt!="string")throw Io("dirty is not a string, aborting")}else throw Io("toString is not a function");if(!t.isSupported)return rt;if(Ct||$e(X),t.removed=[],typeof rt=="string"&&($t=!1),$t){if(rt.nodeName){const yr=H(rt.nodeName);if(!A[yr]||J[yr])throw Io("root node is forbidden and cannot be sanitized in-place")}}else if(rt instanceof c)Me=tt("<!---->"),Xe=Me.ownerDocument.importNode(rt,!0),Xe.nodeType===Ao.element&&Xe.nodeName==="BODY"||Xe.nodeName==="HTML"?Me=Xe:Me.appendChild(Xe);else{if(!Ut&&!ht&&!ot&&rt.indexOf("<")===-1)return L&&Bt?L.createHTML(rt):rt;if(Me=tt(rt),!Me)return Ut?null:Bt?Z:""}Me&&xe&&Ye(Me.firstChild);const Gt=it($t?rt:Me);for(;jt=Gt.nextNode();)pr(jt),Xr(jt),jt.content instanceof a&&Vn(jt.content);if($t)return rt;if(Ut){if(mt)for(At=N.call(Me.ownerDocument);Me.firstChild;)At.appendChild(Me.firstChild);else At=Me;return(qe.shadowroot||qe.shadowrootmode)&&(At=Q.call(n,At,!0)),At}let gr=ot?Me.outerHTML:Me.innerHTML;return ot&&A["!doctype"]&&Me.ownerDocument&&Me.ownerDocument.doctype&&Me.ownerDocument.doctype.name&&Zr(OT,Me.ownerDocument.doctype.name)&&(gr="<!DOCTYPE "+Me.ownerDocument.doctype.name+`>
2
- `+gr),ht&&oc([me,j,le],yr=>{gr=Oo(gr,yr," ")}),L&&Bt?L.createHTML(gr):gr},t.setConfig=function(){let rt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$e(rt),Ct=!0},t.clearConfig=function(){ae=null,Ct=!1},t.isValidAttribute=function(rt,X,Me){ae||$e({});const Xe=H(rt),jt=H(X);return dt(Xe,jt,Me)},t.addHook=function(rt,X){typeof X=="function"&&$o(ie[rt],X)},t.removeHook=function(rt,X){if(X!==void 0){const Me=fI(ie[rt],X);return Me===-1?void 0:dI(ie[rt],Me,1)[0]}return uy(ie[rt])},t.removeHooks=function(rt){ie[rt]=[]},t.removeAllHooks=function(){ie=hy()},t}var OI=IT();const II={ALLOWED_TAGS:["b","i","em","strong","p","br","ul","ol","li","a"],ALLOWED_ATTR:["href","src","alt","title","target","class","id","style"],ALLOW_DATA_ATTR:!1,FORBID_TAGS:["img","iframe","object","input","style","script","embed","svg","video","audio","body","input","form","link"],FORBID_ATTR:["onerror","onclick","onload","onmouseover","onfocus","onblur","onchange","onsubmit","scr","href","style","action","value"],IN_PLACE:!0},PI="javascript:";function AI(e){return(e==null?void 0:e.constructor)===Object}async function vy(e,t=3){let r=0,n;for(;r<=t;){r+=1;try{return await e()}catch(i){n=i,console.error(i),await PT(1e3*Math.pow(2,r))}}throw n}function PT(e){return new Promise(t=>{setTimeout(()=>{t(0)},e)})}function MI(){return Math.random().toString(36).slice(2)}const xI=new TextDecoder,NI=e=>{const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return xI.decode(r)},DI=e=>e.length===0,LI=(...e)=>e.every(DI),AT=e=>{const t=OI.sanitize(e,II);return t.includes(PI)?(console.warn("Suspicious content detected and removed."),""):t},jI="prod",im="3.42.2",my="https://main.api.ujet.co",qr={companyId:"",tenant:"",trackerId:"",deviceId:"",application:"websdk",version:im},gy=[];class Aa{constructor(t){vt(this,"channel");this.channel=t}static addHandler(t){gy.push(t)}debug(...t){this._log("debug",...t)}info(...t){this._log("info",...t)}warn(...t){this._log("warn",...t)}error(...t){this._log("error",...t)}_log(t,...r){gy.forEach(n=>{n(this.channel,t,...r)})}}const FI=(e,t,...r)=>{console[t](`[${t}][${e}]`,...r)},UI=e=>{let t=[],r;return(i,a,...s)=>{a==="debug"||i==="communicator"||(t.push(BI(i,a,...s)),clearTimeout(r),r=window.setTimeout(()=>{if(t.length){const c={num_of_logs:t.length,logs:t};e(c)}t=[]},2e3))}};function BI(e,t,...r){let n=r.pop();typeof n=="string"&&(r.push(n),n={});const i=r.join(" "),a={loglevel:t,channel:e,timestamp:new Date().toISOString(),application:qr.application,version:qr.version,device:qr.deviceId,tenant:qr.tenant,company_id:qr.companyId,location_url:location.href,data:GI(n),message:am(i)};return qr.trackerId&&(a.tracker_id=qr.trackerId),a}const qI=["user","phone","phone_number","phoneNumber","email"],zI=[/(?:3[47]\d|(?:4\d|5[1-5]|65)\d{2}|6011)\d{12}/g,/(?!(000|666|9))\d{3}-(?!00)\d{2}-(?!0000)\d{4}/g,/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+$/g];function am(e){return typeof e=="string"?zI.forEach(t=>{e=e.replace(t,"__MASKED__")}):e&&AI(e)&&(e={...e},Object.keys(e).forEach(t=>{qI.indexOf(t)!==-1?e[t]="__MASKED__":am(e[t])})),e}function GI(e){if(e.error){const t=e.error;return{error:{name:t.name,message:t.message,stack:t.stack}}}return am(e.data)}const WI=new Aa("chat-provider");class sm{constructor(t,r,n){vt(this,"audio");vt(this,"issueChatToken");vt(this,"identity");vt(this,"channelId");vt(this,"region");vt(this,"inTask",!1);vt(this,"muted",!1);vt(this,"events");this.events=t,this.region=r.region,this.audio=new oI,this.issueChatToken=n}ping(){if(!this.muted)try{this.audio.playPing()}catch(t){WI.warn("Chat audio play failed",{error:t})}}on(t,r){this.events.addEventListener(t,r)}off(t,r){this.events.removeEventListener(t,r)}trackInTask(t){t.type==="noti"&&t.event==="taskVaStarted"?this.inTask=!0:t.type==="noti"&&(t.event==="taskVaFinished"||t.event==="taskVaFailed")&&(this.inTask=!1)}}vt(sm,"type","base");const MT={};function om(e){MT[e.type]=e}function HI(e){return MT[e]}const yy=new Aa("MediaStore"),VI=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB,KI="chat-media",by=1,Ml="file";class xT{constructor(){vt(this,"db")}store(){return new Promise((t,r)=>{if(this.db)return t(_y(this.db));const n=VI.open(KI,by);n.onerror=()=>{r(new Error("indexedDB open failed"))},n.onsuccess=()=>{const i=n.result;this.db=i,t(_y(i))},n.onupgradeneeded=i=>{const a=n.result;i.oldVersion>0&&i.oldVersion<by&&(yy.info("deprecating media store"),a.deleteObjectStore(Ml)),yy.info("creating media store"),a.createObjectStore(Ml)}})}async save(t,r){(await this.store()).put({index:t,file:r},t)}async getAll(){const t=await this.store();return await new Promise((r,n)=>{const i=t.getAll();i.onerror=()=>{n(new Error("indexedDB getAll failed"))},i.onsuccess=()=>{r(i.result)}})}async getAllFiles(){const t={};return(await this.getAll()).forEach(n=>{t[n.index]=n.file}),t}async clear(){(await this.store()).clear()}}function _y(e){return e.transaction(Ml,"readwrite").objectStore(Ml)}const pd=new Aa("communicator");let wy=!1;const Sy=1e4;class JI{constructor(t,r){vt(this,"events");vt(this,"options");vt(this,"channel");vt(this,"authenticate");vt(this,"channelReady",!1);vt(this,"__authed",!1);vt(this,"pending",[]);vt(this,"promises",{});vt(this,"user");vt(this,"iframe");this.authenticate=t.authenticate,this.events=r,this.options=this.createConnectOption(t),this.channel=new MessageChannel,this.useConnect(this.options)}useConnect(t){const r=document.createElement("iframe");r.src=t.bridge,r.setAttribute("style","display:none");let n="*";/^https:/.test(t.bridge)&&(n=new URL(t.bridge).origin),r.addEventListener("load",()=>{if(pd.debug("iframe bridge ready for",n),!this.channelReady){const i={type:"_init",data:t};r.contentWindow.postMessage(i,n,[this.channel.port2])}}),this.channel.port1.onmessage=i=>{this.receiveMessage(i)},document.body.appendChild(r),this.iframe=r}receiveMessage(t){const r=t.data;if(r){if(pd.debug("receiveMessage",r),r.type==="ready")this.channelReady=!0,qr.deviceId=r.result.deviceId,qr.deviceId||console.error("Device Id has not been provided. SDK will not work properly."),this.runPending(),this.events.triggerEvent("ready");else if(r.type==="callback"&&r.callbackId){const[n,i]=this.promises[r.callbackId];r.error?i(r.error):n(r.result),delete this.promises[r.callbackId]}else if(r.type==="refreshToken")this.refreshToken();else if(r.request==="_auth"){if(r.result.error)return;if(this.events.triggerEvent("authenticated"),r.result&&r.result.log_proxy_url&&!wy){wy=!0;const n=UI(i=>{this.postMessage({type:"_log",data:i})});Aa.addHandler(n)}}}}postMessage(t){this.channel&&this.channelReady?(pd.debug("postMessage",t),this.channel.port1.postMessage(t)):this.pending.push(t)}runPending(){for(;this.pending.length;){const t=this.pending.shift();this.postMessage(t)}}postPromise(t,r){return new Promise((n,i)=>{const a=MI()+"_"+Date.now();this.promises[a]=[n,i];const s={type:t,callbackId:a,data:r};this.postMessage(s)})}createConnectOption(t){var s;let r=t.host;r||(t.tenant?r=my.replace("main.api",t.tenant):r=my);const n=t.lang||"en",i=!!((s=t.cobrowse)!=null&&s.enabled),a=t.bridge||"https://websdk.ujet.co/v3/bridge.html";return{host:r,lang:n,cobrowse:i,companyId:t.companyId,location:location.href,version:t.version||"3.42.2",bridge:a}}async refreshToken(){this.__authed=!0;const t=await this.authenticate(),r=["twilio_chat","nexmo_chat"];this.options.cobrowse&&r.push("cobrowse");const n={modules:r,user:{token:t.token,company_id:this.options.companyId}};await this.postPromise("_auth",n).then(i=>{if(i.error)return;const a=JSON.parse(NI(t.token.split(".")[1]));if(this.user={identifier:a.identifier,name:a.name,email:a.email},this.events.triggerEvent("authenticate"),a.exp){let s;if(a.exp.toString().length===13?s=a.exp:a.exp.toString().length===10&&(s=a.exp*1e3),s){const c=Math.max(s-Date.now()-Sy,Sy);setTimeout(()=>{this.refreshToken()},c)}}})}request(t,r){!this.__authed&&t!=="proactive_chat_triggers"&&this.refreshToken();const n={url:t,options:r};return this.postPromise("request",n)}destroy(){delete this.channel,this.iframe&&(document.body.removeChild(this.iframe),this.iframe=void 0)}}var to=(e=>(e.WAITING="waiting",e.READY="ready",e.IN_PROGRESS="in_progress",e.FINISHED="finished",e))(to||{}),NT=(e=>(e.CONFIRMED="confirmed",e.EXITED="exited",e.PENDING="pending",e.REQUESTED="requested",e.SKIPPED="skipped",e.TIMED_OUT="timed_out",e))(NT||{});class um{constructor(){vt(this,"handlers",{})}addEventListener(t,r){this.handlers[t]||(this.handlers[t]=[]),this.handlers[t].push(r)}triggerEvent(t,r){const n=this.handlers[t];n&&n.forEach(i=>{i(r)})}removeEventListener(t,r){if(this.handlers[t]){const n=this.handlers[t].indexOf(r);n!==-1&&this.handlers[t].splice(n,1)}}destroy(){this.handlers={}}}function YI(e,t){const r={};return t.forEach(n=>{r[n.id]=n}),e.map(n=>{if(n.type==="server_message"){const i=n.message_id,a=r[i];DT(n,a.content)}return n})}function XI(e,t){return DT(e,t.content)}function DT(e,t){return Object.keys(t).forEach(r=>{e[r]=t[r]}),e}const Ty={photo:2,video:2,audio:1,document:1};function QI(e){const t=e.toSorted((r,n)=>!r.groupMessageId||!n.groupMessageId||r.groupMessageId!==n.groupMessageId?0:(Ty[n.type]||0)-(Ty[r.type]||0));return t.forEach((r,n,i)=>{const a=!r.groupMessageId,s=i[n+1];s&&(a&&s.$userId===r.$userId&&r.$time||!a&&s.groupMessageId===r.groupMessageId&&r.$time)&&(s.$time=r.$time,r.$time=null)}),t}const ZI={confirmSessionTitle:"Screen Share Session Request",confirmSessionContent:"Do you want to share your current screen with the agent?",endSessionText:"End Screen Share Session",confirmRemoteControlTitle:"Remote Access Request",confirmRemoteControlContent:"The agent would like to have access to your currently shared screen to further assist you. Do you want to allow this?",confirmFullDeviceTitle:"Screen Share Request",confirmFullDeviceContent:"Do you want to share your full screen with the agent? The agent will not be able to control anything on the screen.",allowText:"Allow",denyText:"Deny"},eP={confirmSessionTitle:"Solicitud de sesión de conavegación",confirmSessionContent:"¿Desea compartir su pantalla actual con el agente?",endSessionText:"Fin de la sesión de conavegación",confirmRemoteControlTitle:"Solicitud de acceso remoto",confirmRemoteControlContent:"El agente desea tener acceso a su pantalla actual compartida para seguir asistiéndole. ¿Desea permitirlo?",confirmFullDeviceTitle:"Solicitud de compartir pantalla",confirmFullDeviceContent:"¿Desea compartir su pantalla completa con el agente? El agente no podrá controlar nada de la pantalla.",allowText:"Permitir",denyText:"Denegar"},tP={confirmSessionTitle:"Demande de session de co-navigation",confirmSessionContent:"Voulez-vous partager votre écran actuel avec l'agent ?",endSessionText:"Terminer la session de co-navigation",confirmRemoteControlTitle:"Demande d'accès à distance",confirmRemoteControlContent:"L'agent souhaite avoir accès à l'écran que vous partagez actuellement pour mieux vous aider. Voulez-vous l'y autoriser ?",confirmFullDeviceTitle:"Demande de partage d'écran",confirmFullDeviceContent:"Voulez-vous partager votre écran complet avec l'agent ? L'agent ne sera pas en mesure de contrôler quoi que ce soit sur l'écran.",allowText:"Autoriser",denyText:"Refuser"},rP={confirmSessionTitle:"Screen Share-Sitzungsanfrage",confirmSessionContent:"Möchten Sie Ihren aktuellen Bildschirm für den Agenten freigeben?",endSessionText:"Screen Share-Sitzung beenden",confirmRemoteControlTitle:"Fernzugriff-Anfrage",confirmRemoteControlContent:"Der Agent möchte Zugriff auf Ihren aktuell freigegebenen Bildschirm erhalten, um Ihnen weiterhelfen zu können. Möchten Sie dies erlauben?",confirmFullDeviceTitle:"Bildschirmfreigabe",confirmFullDeviceContent:"Möchten Sie Ihren gesamten Bildschirm für den Agenten freigeben? Der Agent ist dadurch nicht in der Lage, Elemente auf Ihrem Bildschirm zu steuern.",allowText:"Erlauben",denyText:"Verweigern"},nP={confirmSessionTitle:"共同ブラウジングセッションリクエスト",confirmSessionContent:"現在の画面を担当者と共有したいですか。",endSessionText:"共同ブラウジングセッションを終了",confirmRemoteControlTitle:"リモートアクセスリクエスト",confirmRemoteControlContent:"担当者は、お客様をさらにお手伝いするために、現在共有中の画面へのアクセスを希望しています。許可しますか。",confirmFullDeviceTitle:"画面共有リクエスト",confirmFullDeviceContent:"画面全体を担当者と共有したいですか。担当者は画面上で一切の操作ができません。",allowText:"許可",denyText:"拒否"},iP={confirmSessionTitle:"코브라우징 세션 요청",confirmSessionContent:"현재 화면을 상담원과 공유하시겠습니까?",endSessionText:"코브라우징 세션 종료",confirmRemoteControlTitle:"원격 액세스 요청",confirmRemoteControlContent:"상담원이 추가 지원을 위해 현재 공유된 화면에 액세스할 수 있기를 원합니다. 허용하시겠습니까?",confirmFullDeviceTitle:"화면 공유 요청",confirmFullDeviceContent:"상담원과 전체 화면을 공유하시겠습니까? 상담원은 화면의 어떤 부분도 제어할 수 없습니다.",allowText:"허용",denyText:"거절"},aP={confirmSessionTitle:"Richiesta di sessione di Screen Share",confirmSessionContent:"Vuoi condividere la tua schermata attuale con l'operatore?",endSessionText:"Termina sessione di Screen Share",confirmRemoteControlTitle:"Richiesta di accesso remoto",confirmRemoteControlContent:"L'operatore vorrebbe accedere alla tua schermata attualmente condivisa per assisterti al meglio. Acconsenti?",confirmFullDeviceTitle:"Richiesta di condivisione schermo",confirmFullDeviceContent:"Vuoi condividere il tuo intero schermo con l'operatore? L'operatore non potrà controllare nessun elemento sullo schermo.",allowText:"Consenti",denyText:"Rifiuta"},sP={confirmSessionTitle:"同步浏览会话请求",confirmSessionContent:"您是否要向该客服代表共享当前的屏幕?",endSessionText:"结束同步浏览会话",confirmRemoteControlTitle:"远程访问请求",confirmRemoteControlContent:"为了进一步协助您,客服代表想访问您当前的共享屏幕。您是否允许这样做?",confirmFullDeviceTitle:"屏幕共享请求",confirmFullDeviceContent:"您是否要向该客服代表共享全屏?客服代表将不能控制屏幕上的任何东西。",allowText:"允许",denyText:"拒绝"},oP={confirmSessionTitle:"Samwebbläsningssession har begärts",confirmSessionContent:"Vill du dela din aktuella skärm med vår medarbetare?",endSessionText:"Avsluta samwebbläsningssession",confirmRemoteControlTitle:"Begäran om fjärråtkomst",confirmRemoteControlContent:"Vår medarbetare skulle vilja få åtkomst till skärmen som du delar just nu för att kunna hjälpa dig vidare. Vill du tillåta detta?",confirmFullDeviceTitle:"Begäran om skärmdelning",confirmFullDeviceContent:"Vill du dela hela skärmen med medarbetaren? Medarbetaren kommer inte kunna kontrollera något på skärmen.",allowText:"Tillåt",denyText:"Neka"},uP={confirmSessionTitle:"Solicitação de Sessão de Co-navegação",confirmSessionContent:"Deseja partilhar o seu ecrã atual com o agente?",endSessionText:"Terminar Sessão de Co-navegação",confirmRemoteControlTitle:"Solicitação de Acesso Remoto",confirmRemoteControlContent:"O agente gostaria de ter acesso ao seu ecrã partilhado atualmente para ajudá-lo ainda mais. Quer permitir isto?",confirmFullDeviceTitle:"Solicitação de Partilha de Ecrã",confirmFullDeviceContent:"Deseja partilhar o seu ecrã inteiro com o agente? O agente não poderá controlar nada no ecrã.",allowText:"Permitir",denyText:"Negar"},cP={confirmSessionTitle:"Pyyntö yhteisselausistunnosta",confirmSessionContent:"Haluatko jakaa nykyisen näyttösi edustajan kanssa?",endSessionText:"Lopeta yhteisselausistunto",confirmRemoteControlTitle:"Etäkäyttöpyyntö",confirmRemoteControlContent:"Edustaja haluaisi saada käyttää tällä hetkellä jakamaasi näyttöä voidakseen auttaa sinua enemmän. Haluatko antaa siihen luvan?",confirmFullDeviceTitle:"Näytön jakamispyyntö",confirmFullDeviceContent:"Haluatko jakaa koko näyttösi edustajan kanssa? Edustaja ei pysty käyttämään mitään näytöllä olevaa.",allowText:"Salli",denyText:"Estä"},lP={confirmSessionTitle:"Samlesingsøkten er startet",confirmSessionContent:"Vil du dele skjermen din med agenten?",endSessionText:"Avslutt samlesingsøkt",confirmRemoteControlTitle:"Forespørsel om fjerntilgang",confirmRemoteControlContent:"Agenten vil ha tilgang til skjermen din for å kunne hjelpe deg videre. Vil du tillate dette?",confirmFullDeviceTitle:"Forespørsel om skjermdeling",confirmFullDeviceContent:"Vil du dele hele skjermen din med agenten? Agenten kan ikke kontrollere noe på skjermen.",allowText:"Tillat",denyText:"Avvis"},fP={confirmSessionTitle:"Forespørgsel om sambrowsingsession",confirmSessionContent:"Vil du dele din nuværende skærm med agenten",endSessionText:"Afslut sambrowsingsession",confirmRemoteControlTitle:"Anmodning om fjernadgang",confirmRemoteControlContent:"Agenten vil gerne have adgang til din nuværende delte skærm for at kunne hjælpe dig yderligere. Ønsker du at tillade dette?",confirmFullDeviceTitle:"Forespørgsel om skærmdeling",confirmFullDeviceContent:"Vil du dele din fulde skærm med agenten? Agenten vil ikke kunne styre noget på skærmen",allowText:"Tillad",denyText:"Afvis"},dP={confirmSessionTitle:"Verzoek om cobrowse-sessie",confirmSessionContent:"Wilt u uw huidige scherm delen met de agent?",endSessionText:"Cobrowse-sessie beëindigen",confirmRemoteControlTitle:"Verzoek om toegang op afstand",confirmRemoteControlContent:"De agent wil graag toegang hebben tot uw momenteel gedeelde scherm om u verder te helpen. Wilt u dit toestaan?",confirmFullDeviceTitle:"Verzoek om scherm te delen",confirmFullDeviceContent:"Wilt u uw volledige scherm delen met de agent? De agent kan niets op het scherm bedienen.",allowText:"Toestaan",denyText:"Weigeren"},pP={confirmSessionTitle:"Oturum İsteğini Eş Zamanlı Tara",confirmSessionContent:"Mevcut ekranınızı temsilciyle paylaşmak ister misiniz?",endSessionText:"Eş zamanlı Oturum Taramayı Sonlandır",confirmRemoteControlTitle:"Uzaktan Erişim İsteği",confirmRemoteControlContent:"Temsilci şu anda paylaşılan ekranınıza size daha fazla yardımcı olabilmek için erişim sağlamak istiyor. Buna izin vermek istiyor musunuz?",confirmFullDeviceTitle:"Ekran Paylaşım İsteği",confirmFullDeviceContent:"Temsilciyle tam ekranınızı paylaşmak istiyor musunuz? Temsilci ekrandaki hiçbir şeyi kontrol edemez.",allowText:"İzin Ver",denyText:"Reddet"},hP={confirmSessionTitle:"Yêu cầu phiên cùng duyệt",confirmSessionContent:"Bạn có muốn chia sẻ màn hình hiện tại của mình với chuyên viên không?",endSessionText:"Kết thúc phiên cùng duyệt",confirmRemoteControlTitle:"Yêu cầu truy cập từ xa",confirmRemoteControlContent:"Chuyên viên muốn được cấp quyền truy cập vào màn hình bạn đang chia sẻ để hỗ trợ bạn nhiều hơn. Bạn có muốn cho phép không?",confirmFullDeviceTitle:"Yêu cầu chia sẻ màn hình",confirmFullDeviceContent:"Bạn có muốn chia sẻ toàn bộ màn hình của mình với chuyên viên không? Chuyên viên sẽ không thể điều khiển bất cứ phần nào trên màn hình.",allowText:"Cho phép",denyText:"Từ chối"},vP={confirmSessionTitle:"ขอเซสชันเรียกดูร่วม",confirmSessionContent:"คุณต้องการแชร์หน้าจอปัจจุบันกับตัวแทนหรือไม่",endSessionText:"สิ้นสุดเซสชันเรียกดูร่วม",confirmRemoteControlTitle:"ขอการเข้าถึงระยะไกล",confirmRemoteControlContent:"ตัวแทนต้องการเข้าถึงหน้าจอของคุณที่แชร์อยู่ในปัจจุบันเพื่อให้ความช่วยเหลือคุณต่อไป คุณจะอนุญาตหรือไม่",confirmFullDeviceTitle:"ขอแชร์หน้าจอ",confirmFullDeviceContent:"คุณต้องการแชร์ทั้งหน้าของคุณกับตัวแทนหรือไม่ ตัวแทนจะไม่สามารถควบคุมอะไรบนหน้าจอ",allowText:"ยินยอม",denyText:"ปฏิเสธ"},mP={confirmSessionTitle:"طلب جلسة تصفح مشترك",confirmSessionContent:"هل تريد مشاركة شاشتك الحالية مع الموظف؟",endSessionText:"إنهاء جلسة التصفح المشترك",confirmRemoteControlTitle:"طلب التحكم عن بعد",confirmRemoteControlContent:"يرغب مسئول الدعم في رؤية شاشتك المشاركة حالياً لمساعدتك بشكلٍ أكبر. هل تسمح بذلك؟",confirmFullDeviceTitle:"طلب مشاركة الشاشة",confirmFullDeviceContent:"هل تريد مشاركة شاشتك الكاملة مع مسئول الدعم؟ لن يتمكن المسئول من التحكم في أي شيء على الشاشة.",allowText:"السماح",denyText:"الرفض"},gP={confirmSessionTitle:"Žádost o relaci Screen Share",confirmSessionContent:"Chcete svou současnou obrazovku sdílet s agentem?",endSessionText:"Ukončit relaci Screen Share",confirmRemoteControlTitle:"Žádost o vzdálený přístup",confirmRemoteControlContent:"Agent by rád získal přístup k vaší stávající sdílené obrazovce, aby vám mohl dál pomoci. Chcete mu přístup povolit?",confirmFullDeviceTitle:"Žádost o sdílení obrazovky",confirmFullDeviceContent:"Chcete svou celou obrazovku sdílet s agentem? Agent nebude moci ovládat nic, co na obrazovce je.",allowText:"Povolit",denyText:"Zamítnout"},yP={confirmSessionTitle:"Prośba o sesję Screen Share",confirmSessionContent:"Czy chcesz udostępnić konsultantowi swój bieżący ekran?",endSessionText:"Zakończ sesję Screen Share",confirmRemoteControlTitle:"Prośba o zdalny dostęp",confirmRemoteControlContent:"Konsultant prosi o dostęp do Twojego aktualnie udostępnionego ekranu, aby udzielić Ci dalszej pomocy. Czy chcesz na to zezwolić?",confirmFullDeviceTitle:"Prośba o udostępnienie ekranu",confirmFullDeviceContent:"Czy chcesz udostępnić konsultantowi swój cały ekran? Konsultant nie będzie mógł kontrolować niczego na ekranie.",allowText:"Zezwól",denyText:"Odmów"},bP={confirmSessionTitle:"Screen Share munkameneti kérés",confirmSessionContent:"Megosztja az aktuális képernyőjét a képviselővel?",endSessionText:"Screen Share munkamenet befejezése",confirmRemoteControlTitle:"Távoli hozzáférési kérés",confirmRemoteControlContent:"A képviselő szeretne hozzáférni a jelenleg megosztott képernyőjéhez, hogy további segítséget nyújthasson. Engedélyezi ezt?",confirmFullDeviceTitle:"Képernyőmegosztási kérelem",confirmFullDeviceContent:"Megosztja a teljes képernyőjét az ügynökkel? Az ügynök semmit sem tud majd irányítani a képernyőn.",allowText:"Engedélyezés",denyText:"Elutasítás"},_P={confirmSessionTitle:"Запрос сеанса совместного просмотра веб-страниц",confirmSessionContent:"Хотите поделиться вашим текущим экраном с представителем?",endSessionText:"Завершить сеанс совместного просмотра веб-страниц",confirmRemoteControlTitle:"Запрос на удаленный доступ",confirmRemoteControlContent:"Представитель хочет получить доступ к вашему текущему экрану, которым вы делитесь, чтобы помочь вам. Хотите разрешить это?",confirmFullDeviceTitle:"Запрос на совместный просмотр экрана",confirmFullDeviceContent:"Хотите поделиться вашим полный экраном с представителем? Агент не сможет выполнять никаких действий на экране.",allowText:"Разрешить",denyText:"Отказать"},wP={confirmSessionTitle:"सह-ब्राउज़ सत्र अनुरोध किया गया",confirmSessionContent:"क्या आप अपनी वर्तमान स्क्रीन को एजेंट के साथ साझा करना चाहते हैं?",endSessionText:"सह-ब्राउज़ सत्र समाप्त करें",confirmRemoteControlTitle:"रिमोट पहुँच का अनुरोध किया गया",confirmRemoteControlContent:"एजेंट आपकी वर्तमान साझा स्क्रीन तक पहुँच प्राप्त करना चाहेगा ताकि वह आपकी और सहायता कर सके। क्या आप इसकी अनुमति देना चाहते हैं?",confirmFullDeviceTitle:"स्क्रीन साझाकरण अनुरोध",confirmFullDeviceContent:"क्या आप अपनी पूरी स्क्रीन एजेंट के साथ साझा करना चाहते हैं? एजेंट स्क्रीन पर कुछ भी नियंत्रित नहीं कर पाएगा।",allowText:"अनुमति दें",denyText:"अस्वीकार करें"},SP={confirmSessionTitle:"Solicitare sesiune de co-navigare",confirmSessionContent:"Doriți să partajați ecranul dumneavoastră curent cu agentul?",endSessionText:"Încheiați sesiunea de co-navigare",confirmRemoteControlTitle:"Cerere de acces la distanță",confirmRemoteControlContent:"Agentul ar dori să aibă acces la ecranul dumneavoastră partajat pentru a vă ajuta în continuare. Doriți să permiteți acest lucru?",confirmFullDeviceTitle:"Cerere de partajare a ecranului",confirmFullDeviceContent:"Doriți să partajați ecranul dumneavoastră complet cu agentul? Agentul nu va putea controla nimic de pe ecran.",allowText:"Permiteți",denyText:"Refuzați"},TP={confirmSessionTitle:"Zahtjev za sesiju zajedničkog pregledavanja",confirmSessionContent:"Želite li podijeliti svoj trenutni zaslon s agentom?",endSessionText:"Završi sesiju zajedničkog pregledavanja",confirmRemoteControlTitle:"Zahtjev za daljinski pristup",confirmRemoteControlContent:"Agent želi imati pristup vašem trenutno dijeljenom zaslonu kako bi Vam dodatno pomogao. Želite li to dopustiti?",confirmFullDeviceTitle:"Zahtjev za dijeljenje zaslona",confirmFullDeviceContent:"Želite li s agentom podijeliti svoj cijeli zaslon? Agent neće moći ništa kontrolirati na ekranu.",allowText:"Dopustiti",denyText:"Odbiti"},CP={confirmSessionTitle:"Запит на сесію спільного перегляду",confirmSessionContent:"Чи Ви хочете поділитись з агентом своїм поточним екраном?",endSessionText:"Завершити сесію спільного перегляду",confirmRemoteControlTitle:"Запит на віддалений доступ",confirmRemoteControlContent:"Агент хоче отримати доступ до Вашого поточного екрану, який переглядається спільно, щоб допомогти Вам. Ви дозволяєте?",confirmFullDeviceTitle:"Запит на спільний перегляд екрану",confirmFullDeviceContent:"Чи Ви хочете поділитись з агентом своїм екраном повністю? Агент не зможе нічого на ньому контролювати.",allowText:"Дозволити",denyText:"Відмовити"},EP={confirmSessionTitle:"Kahilingan sa Screen Share na Sesyon",confirmSessionContent:"Gusto mo bang ibahagi ang iyong kasalukuyang screen sa agent?",endSessionText:"Tapusin ang Screen Share na Sesyon",confirmRemoteControlTitle:"Kahilingan sa Remote Access",confirmRemoteControlContent:"Gusto ng agent na magkaroon ng access sa iyong nakabahaging screen sa kasalukuyan upang mas matulungan ka. Gusto mo bang payagan ito?",confirmFullDeviceTitle:"Kahilingan sa Pagbahagi ng Screen",confirmFullDeviceContent:"Gusto mo bang ibahagi ang buong screen sa agent? Hindi makokontrol ng agent ang kahit ano sa screen.",allowText:"Payagan",denyText:"Tanggihan"},Mo={en:ZI,es:eP,"es-MX":{confirmSessionTitle:"Solicitud de Sesión de Co-navegación",confirmSessionContent:"¿Quiere compartir su pantalla actual con el agente?",endSessionText:"Fin de la sesión de co-navegación",confirmRemoteControlContent:"El agente desea tener acceso a su pantalla actualmente compartida para poder ayudarlo. ¿Quiere permitirlo?",confirmFullDeviceTitle:"Petición de pantalla compartida",confirmFullDeviceContent:"¿Quiere compartir su pantalla completa con el agente? El agente no podrá controlar nada en la pantalla."},fr:tP,"fr-CA":{confirmSessionTitle:"Demande de session co-navigation",confirmSessionContent:"Voulez-vous partager votre écran actuel avec l'agent?",endSessionText:"Fin de la session de co-navigation",confirmRemoteControlContent:"L'agent souhaiterait avoir accès à votre écran actuellement partagé pour mieux vous aider. Voulez-vous l'autoriser?",confirmFullDeviceContent:"Voulez-vous partager votre écran complet avec l'agent? L'agent ne sera pas en mesure de contrôler quoi que ce soit sur l'écran."},de:rP,ja:nP,ko:iP,it:aP,zh:sP,"zh-Hant":{confirmSessionTitle:"共同瀏覽工作階段要求",confirmSessionContent:"要與專員分享您目前的畫面嗎?",endSessionText:"結束共同瀏覽工作階段",confirmRemoteControlTitle:"遠端存取要求",confirmRemoteControlContent:"專員想要存取您目前分享的螢幕畫面以進一步協助您。要允許嗎?",confirmFullDeviceTitle:"螢幕畫面分享要求",confirmFullDeviceContent:"要與專員分享全螢幕嗎?專員將無法控制畫面上的任何項目。",allowText:"允許",denyText:"拒絕"},sv:oP,pt:uP,"pt-BR":{confirmSessionContent:"Você deseja compartilhar sua tela atual com o agente?",endSessionText:"Encerrar Sessão de Co-navegação",confirmRemoteControlContent:"O agente gostaria de acessar sua tela atualmente compartilhada para melhor ajudá-lo. Você deseja permitir isso?",confirmFullDeviceTitle:"Solicitação de Compartilhamento de Tela",confirmFullDeviceContent:"Você deseja compartilhar sua tela inteira com o agente? O agente não poderá controlar nada na tela."},fi:cP,nb:lP,da:fP,nl:dP,tr:pP,vi:hP,th:vP,ar:mP,cs:gP,pl:yP,hu:bP,ru:_P,hi:wP,ro:SP,hr:TP,uk:CP,tl:EP};function kP(e){const t=e.split("-")[0];return Mo[e]?e===t?Mo[e]:{...Mo[t],...Mo[e]}:Mo[t]}const LT=["assigned","va_assigned"],jT=["dismissed","va_dismissed"],RP=["va_assigned","va_dismissed"],$P=["queued",...LT,...jT],OP=["timeout","canceled","failed","finished"],cc=new Aa("Chat");class IP{constructor(t,r){vt(this,"provider");vt(this,"store");vt(this,"globalEvents");vt(this,"state");vt(this,"connected",!1);vt(this,"allowSkipVirtualAgent",!1);vt(this,"inEscalation",!1);vt(this,"events");vt(this,"cachedFiles");this.state=t,this.store=new xT,this.cachedFiles={},this.events=new um;const n=HI(this.state.provider_type);this.provider=new n(this.events,t,r)}_setGlobalEvents(t,r){this.globalEvents=t,this.on("message",n=>{if(n.content=AT(n.content),n.type==="server_message"){const i=n.message_id;r(this.id,i).then(a=>{n=XI(n,a),t.triggerEvent("chat.message",n)})}else n.type==="photo"||n.type==="video"?setTimeout(()=>{const i=n.$index.toString();n.file=this.cachedFiles[i],t.triggerEvent("chat.message",n)},100):(t.triggerEvent("chat.message",n),this.registerMessageEvents(n))}),this.on("memberJoined",n=>{t.triggerEvent("chat.memberJoined",n)}),this.on("memberLeft",n=>{t.triggerEvent("chat.memberLeft",n)}),this.on("typingStarted",n=>{t.triggerEvent("chat.typingStarted",n)}),this.on("typingEnded",n=>{t.triggerEvent("chat.typingEnded",n)})}get id(){var t;return((t=this.state)==null?void 0:t.id)||-1}get menuId(){return this.state?this.state.menus[this.state.menus.length-1].id:-1}get channelId(){var t;return((t=this.state)==null?void 0:t.provider_channel_id)||""}get lang(){var t;return((t=this.state)==null?void 0:t.lang)||""}get virtual(){return RP.indexOf(this.status)!==-1}get muted(){var t;return((t=this.provider)==null?void 0:t.muted)||!1}set muted(t){this.provider&&(this.provider.muted=t)}get agent(){return this.state?this.virtual?this.state.external_agent||this.state.virtual_agent:this.state.agent||this.state.virtual_agent:null}get allAgents(){var t,r;return{virtual:((t=this.state)==null?void 0:t.all_virtual_agents)||[],human:((r=this.state)==null?void 0:r.all_agents)||[]}}get userIdentity(){var t;return((t=this.provider)==null?void 0:t.identity)||""}get status(){var t;return((t=this.state)==null?void 0:t.status)||""}get postSessionStatus(){var t;return((t=this.state)==null?void 0:t.post_session_transfer_status)||""}get statusText(){var t;return((t=this.state)==null?void 0:t.status_text)||""}get cobrowsable(){return this.state?this.state.features.indexOf("cobrowse")!==-1:!1}get ongoing(){return $P.indexOf(this.status)!=-1}get assigned(){return LT.indexOf(this.status)!=-1}get dismissed(){return jT.indexOf(this.status)!=-1}get ended(){return OP.indexOf(this.status)!=-1}get transcriptCount(){var t;return((t=this.state)==null?void 0:t.transcript_requested_count)||0}get createdAt(){var t;return((t=this.state)==null?void 0:t.created_at)||""}get inTask(){var t;return((t=this.provider)==null?void 0:t.inTask)||!1}get feedbackType(){var t;return this.state?this.state.survey_enabled?"survey":(t=this.state.csat_settings)!=null&&t.enabled?"rate":"none":"none"}get optInRequired(){var t;return((t=this.state)==null?void 0:t.post_session_opt_in_required)||!1}get postSessionRequired(){var t;return((t=this.state)==null?void 0:t.post_session_required)||!1}get postSessionInProgress(){return this.state?this.state.post_session_transfer_status===to.IN_PROGRESS:!1}get checkInStatus(){var t;return((t=this.state)==null?void 0:t.check_in_status)||null}update(t){if(!this.state||this.state.id!==t.id)return;const r=t.menus[t.menus.length-1].id,n=this.state.menus[this.state.menus.length-1].id;this.state=t,r!==n&&this.triggerEvent("_menuChanged",this),t.status==="canceled"?this.triggerEvent("ended",this):this.triggerEvent("updated",this)}on(t,r){this.events.addEventListener(t,r)}off(t,r){this.events.removeEventListener(t,r)}async connect(){if(!this.provider)return cc.info("connecting interrupted"),!1;try{await vy(()=>this.provider.create(),3),await vy(()=>this.provider.join(this.state.provider_channel_id),3),this.connected=!0;const t=await this.fetchMessages(),r={chat:this,messages:t};return this.triggerEvent("connectedMessages",r),this.triggerEvent("connected",this),this.registerProviderEvents(),cc.info("connected with provider",this.state.provider_type),!0}catch(t){return cc.error("Failed to connect with provider",t),!1}}async disconnect(){this.connected=!1,this.triggerEvent("disconnected",this),this.events.destroy(),this.provider&&(await this.provider.destroy(),cc.info("disconnect with provider",this.state.provider_type))}async sendMessage(t,r){const n=await this.provider.sendMessage(t);return r&&this.saveMedia(n,r),n}preview(t){if(!this.inTask)return this.provider.preview(t)}async fetchMessages(){if(this.connected){const t=await this.store.getAllFiles();return this.provider.fetchMessages(t)}else throw new Error("Please fetchMessages after chat connected.")}startTyping(){return this.provider.startTyping()}stopTyping(){return this.provider.stopTyping()}saveMedia(t,r){this.cachedFiles[t.toString()]=r,this.store.save(t,r)}async destroy(){await this.clearMediaStore(),this.connected&&await this.disconnect(),this.provider&&(this.triggerEvent("destroyed"),this.provider=null),this.events.destroy(),this.state=null}async clearMediaStore(){await this.store.clear()}_handleChatEndedEvent(t){this.state&&(this.disconnect(),t.timeout?(this.state.status="timeout",this.triggerEvent("timeout",this)):(this.state.status="finished",this.triggerEvent("ended",this)))}triggerEvent(t,r){this.events.triggerEvent(t,r),this.globalEvents&&this.globalEvents.triggerEvent("chat."+t,r)}registerProviderEvents(){this.provider&&this.provider.registerConversationEvents()}registerMessageEvents(t){switch(t.event){case"cobrowseRequestedFromAgent":this.events.triggerEvent("_requestCobrowse","agent");break;case"cobrowseRequestedFromEndUser":this.events.triggerEvent("_requestCobrowse","end_user");break;case"chatDismissed":this.state&&(this.state.status="dismissed",this.triggerEvent("dismissed",this));break;case"chatEnded":this.events.triggerEvent("_chatEnded",t);break;case"escalationStarted":this.inEscalation=!0;break;case"escalationFailed":case"escalationAccepted":this.inEscalation=!1;break;case"checkInRequired":this.triggerEvent("checkInRequested");break;case"checkInTimedOut":this.triggerEvent("checkInTimedOut");break}}}function Cy(e){return e.chats=e.chats.map(t=>{const r=t.entries.map((n,i)=>PP(n,`${t.comm_id}-${i}`));return t.entries=QI(r),t}),e}function PP(e,t){var r;return{$index:e.timestamp,$sid:t,$timestamp:new Date(e.timestamp),$userType:e.role,$userId:((r=e.user_data)==null?void 0:r.id)||0,user:e.user_data,type:e.type,...e.body}}const AP={en:"English (US)","en-CA":"English (Canada)","en-GB":"English (UK)",es:"Español (España)","es-MX":"Español (México)",fr:"Français (France)","fr-CA":"Français (Canada)",de:"Deutsch",ja:"日本語",ko:"한국어",it:"Italiano",zh:"中文 (简体)","zh-Hant":"中文 (繁體)",sv:"Svenska",pt:"Português (Portugal)","pt-BR":"Português (Brasil)",fi:"Suomi",nb:"Norsk",da:"Dansk",nl:"Nederlands",tr:"Türk",vi:"Tiếng Việt",th:"คนไทย",ar:"اَلْعَرَبِيَّةُ",cs:"Czech",pl:"Polish",hu:"Hungarian"};function MP(e){var r,n;return{languages:e.languages.filter(i=>i.enabled).map(i=>({lang:i.lang,name:i.name,localeName:AP[i.lang]})),name:e.display_name,subdomain:e.subdomain,support_email:e.support_email,action_tracking:e.action_tracking_enabled,email_transcripts:e.chat_settings.email_transcripts,message_preview:e.chat_settings.message_preview,email_enhancement:e.email_enhancement_enabled,display_history:((r=e.chat_settings.display_history)==null?void 0:r.enabled)&&((n=e.chat_settings.display_history)==null?void 0:n.to_end_user),use_recording:e.use_recording,use_web:e.use_web,cobrowse_domain:e.cobrowse_domain}}function FT(e){return e.map(xP).filter(t=>t.enabled)}function xP(e){const t={id:e.id,enabled:!0,channels:[],hidden:!!e.hidden};if(!e.name||!e.name.trim())return t.enabled=!1,t;t.name=e.name.trim();const r=NP(e);if(r&&(t.redirection=e.redirection),e.children&&e.children.length){const n=FT(e.children);return t.enabled=n.length>0||r,t.children=n,t}if(!e.channels)t.enabled=r;else{const{channels:n,deflection:i}=DP(e.channels);t.deflection=i,r||(t.channels=n),t.enabled=n.length>0||r}return t}function NP(e){let t=!1;const r=e.redirection;return r&&(r.option==="message"||r.option==="url")&&(t=!!r.data),t}function DP(e){let t=null;const r=[],n=e.chat,i=a=>{!a.deflection_type&&a.deflected_reason&&(a.deflection_type=a.deflected_reason),a.deflected===void 0&&a.deflection_type&&(a.deflected=!0),r.push(a)};return n&&n.deflected&&(t={enabled:!0,type:n.deflected_reason}),n&&(n.enabled||n.virtual_agent_available)&&i({...e.chat,type:"chat"}),e.voice_call&&e.voice_call.instant_enabled&&i({...e.voice_call,type:"instant_call"}),e.voice_call&&e.voice_call.schedule_enabled&&i({...e.voice_call,type:"scheduled_call",deflection_type:e.voice_call.schedule_deflection_type}),e.email&&e.email.enabled&&i({...e.email,type:"email"}),n&&n.deflected&&n.deflected_reason==="over_capacity"&&n.keep_waiting&&i({...n,enabled:!0,type:"keep_waiting",deflection_type:n.deflected_reason}),e.external_deflection_link&&e.external_deflection_link.enabled&&e.external_deflection_link.links.forEach(s=>{s.enabled&&i({...s,type:"external_link"})}),{channels:r,deflection:t}}const Ey=/Chrome/.test(navigator.userAgent);class LP{constructor(t){vt(this,"request");this.request=t}get(t,r){if(r){const n=[];Object.keys(r).forEach(i=>{const a=r[i];a!==void 0&&n.push(`${encodeURIComponent(i)}=${encodeURIComponent(a)}`)}),t+="?"+n.join("&")}return this.request(t,{method:"GET"})}post(t,r){const n={method:"POST"};return n.body=JSON.stringify(r),this.request(t,n)}patch(t,r){const n={method:"PATCH"};return n.body=JSON.stringify(r),this.request(t,n)}put(t,r){const n={method:"PUT"};return n.body=JSON.stringify(r),this.request(t,n)}async getTriggers(t){const r={"UJET-Company-Id":t};return(await this.request("proactive_chat_triggers",{method:"GET",headers:r})).data}async trackClientEvents(t){return await this.post("/client_events",{events:t})}async getCompany(){const t=await this.get("company");return MP(t.data)}async getMenus(t,r){const n={type:"web_menu",lang:t,direct_access_key:r},i=await this.get("menus",n),a={key:!!r,user:!1},s=i.headers["ujet-direct-access"];return s&&s!="false"&&(a.user=!0),{menus:FT(i.data),direct:a}}async getAfterHourMessage(t){return(await this.get(`audible_messages/${t}`)).data["after_hours.message"].text}async getTimeSlots(t,r="en"){return(await this.get(`menus/${t}/time_slots`,{type:"web_menu",lang:r})).data}async getWaitTimes(t,r="en"){return(await this.get(`menus/${t}/wait_times`,{type:"web_menu",lang:r})).data}async verifyForm(t){try{return await this.post("forms/verify",t),!0}catch{return!1}}async finishChat(t){return(await this.patch(`chats/${t}`,{status:"finished"})).data}async updatePostSession(t,r){const n={post_session_transfer_status:r};try{return(await this.patch(`chats/${t}`,n)).data}catch(i){if(r===to.IN_PROGRESS&&i.status===400)return(await this.patch(`chats/${t}`,n)).data;throw i}}async getChatDeflection(t){const{data:r}=await this.get(`chats/${t}/deflections`);return r&&r.enabled?r:null}sendChatCustomData(t,r){let n;return typeof r=="string"?n={signed:!0,signed_data:r}:n={signed:!1,data:r},this.post(`chats/${t}/custom_data`,n)}async downloadChatTranscript(t){return(await this.post(`chats/${t}/generate_transcript_pdf`,{})).data}async getPdfStatus(t){return await this.get(`chat_transcript_pdfs/${t}/download_transcript`)}async sendChatTranscripts(t,r){return await this.post(`chats/${t}/transcripts`,{emails:r.join(",")})}async listChatTaskMessages(t){return(await this.get(`chats/${t}/task_va_messages`)).data}async getChatTaskMessage(t,r){return(await this.get(`chats/${t}/task_va_messages/${r}`)).data}async sendChatTaskMessage(t,r){const n={content:{content:r,type:"text"}};return(await this.post(`chats/${t}/task_va_messages`,n)).data}async sendChatTextMessage(t,r){const n={message:{content:r,timestamp:new Date().toISOString()}};await this.post(`chats/${t}/messages`,n)}async sendPreviewMessage(t,r,n){const i={message:{content:r,timestamp:n}},{data:a}=await this.post(`chats/${t}/redact_messages`,i);return a}escalateChat(t,r){return this.post(`chats/${t}/escalations`,r)}trackEscalation(t,r,n){return this.put(`chats/${t}/escalations/${r}`,{escalation_id:r,deflection_channel:n})}requestChatCobrowse(t,r){return this.post(`chats/${t}/cobrowse`,r)}rateChat(t,r){return this.patch(`chats/${t}/rating`,r)}async getChatSurvey(t){return(await this.get(`chats/${t}/survey`)).data}sendChatSurvey(t,r){const n={chat_id:t,answers:r};return this.put(`chats/${t}/survey`,n)}trackChatEndUserEvent(t,r){return this.post(`chats/${t}/end_user_event`,r)}async createChat(t,r,n,i){const a={chat:{menu_id:t,lang:r,email:n.email,greeting:n.greeting,trigger_id:n.trigger_id,ticket_id:n==null?void 0:n.ticket_id,custom_data:n==null?void 0:n.custom_data},cobrowsable:n.cobrowsable},c=(await this.post("chats",a)).data;return this.wrapChat(c,i)}async loadChat(t,r){const n=await this.getChat(t);return this.wrapChat(n,r)}async resumeChat(t,r){const n=await this.patch(`chats/${t}`,{status:"queued"});return this.wrapChat(n.data,r)}async getChatHistory(t=1){if(t===1){const{data:r}=await this.get("/chats/histories?page=1&per_page=2");return Cy(r)}else{const{data:r}=await this.get(`/chats/histories?page=${t}&per_page=1`);return Cy(r)}}async uploadChatFile(t,r){let n="file";/^image/.test(r.type)?n="photo":/^video/.test(r.type)?n="video":n="file";const i=r.name.replace(/\.[^.]+$/i,""),a=await this.post(`chats/${t}/${n}s/upload`,{filename:i}),s={file:r,fields:a.data.fields};Ey&&(s.file=await UT(r));const o=(await this.request(a.data.url,s)).data.key,l=(await this.post(`chats/${t}/${n}s`,{chat_id:t,[n]:{s3_path:o,photo_type:n}})).data;return l.type=n,l}async getChat(t){return(await this.get(`chats/${t}`)).data}async wrapChat(t,r){const n=async()=>(await this.post(`chats/${t.id}/tokens`,{provider_type:t.provider_type,device_id:r})).data,i=new IP(t,n),a=async s=>{if(i.status==="va_assigned"){const c=await this.getSkipVirtualAgentSettings(i.menuId,i.lang);i.allowSkipVirtualAgent=c,i.update(s)}};if(i.channelId)i.connect(),a(t);else{let s;for(;!s;)await this.getChat(i.id).then(c=>{c.provider_channel_id&&i.state?(s=!0,i.update(c),i.connect(),a(c)):(c.status==="canceled"||c.status==="finished")&&(s=!0)}),s||await PT(1500)}return i.on("initialized",async()=>{if(i.status==="queued"){const s=await this.getChat(i.id);i.update(s)}}),i.on("memberJoined",async()=>{const s=await this.getChat(i.id);i.update(s)}),i.on("memberLeft",async()=>{const s=await this.getChat(i.id);i.update(s)}),i.on("_chatEnded",async s=>{const c=await this.getChat(i.id);i.update(c),(!i.state||i.ended)&&i._handleChatEndedEvent(s)}),i.on("_menuChanged",async s=>{const c=await this.getChat(s.id);a(c)}),i}async createCall(t,r,n){const i={type:n.scheduled_at?"web_scheduled_call":"web_instant_call",menu_id:t,lang:r,email:n.email,ticket_id:n.ticket_id,recording_permission:n.recording_permission||"recording_permission_not_asked",scheduled_at:n.scheduled_at,custom_data:n.custom_data,end_user:{phone_number:n.phone_number}},s=(await this.post("calls",{call:i,cobrowsable:!1})).data;return s.menu_id=s.selected_menu.id,s}async fetchCall(t){const n=(await this.get(`calls/${t}`)).data;return n.menu_id=n.selected_menu.id,n}async cancelCall(t){const n=(await this.patch(`calls/${t}`,{status:"failed",fail_reason:"canceled"})).data;return n.menu_id=n.selected_menu.id,n}async listFileTypes(){return(await this.get("email_prohibited_file_types")).data}async createEmail(t,r,n){const i={end_user_email:n.email,email_body:n.content,menu_id:t.toString(),lang:r};return n.name&&(i.end_user_name=n.name),n.recaptcha&&(i.recaptcha_response=n.recaptcha),n.files&&Ey?i["email_attachments[]"]=await jP(n.files):n.files&&(i["email_attachments[]"]=[...n.files]),(await this.request("emails",{form:i})).data}async getMedia(t,r){const n=await this.get(`media/${t}?type=${r}`);if(!n.data)return null;const i=n.headers["x-file-name"];return new File([n.data],i,{type:n.data.type})}async getSkipVirtualAgentSettings(t,r){return(await this.get(`menus/${t}/virtual_agent_settings`,{lang:r})).data.allow_skip_virtual_agent}async confirmCheckIn(t){return(await this.post(`chats/${t}/check_in/confirm`,null)).data}async rejoinQueue(t){return(await this.post(`chats/${t}/check_in/rejoin`,null)).data}async exitCheckIn(t){return(await this.post(`chats/${t}/check_in/exit`,null)).data}async trackCheckIn(t,r){await this.post(`chats/${t}/check_in/modal_shown`,r)}async notifyCheckInState(t,r){await this.post(`chats/${t}/check_in/end_user_status`,r)}}function jP(e){return Promise.all(e.map(UT))}function UT(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{const i=[n.result],a={type:e.type,lastModified:e.lastModified};t({name:e.name,fileBits:i,options:a})},n.onerror=r,n.readAsArrayBuffer(e)})}/*!
2
+ `+gr),ht&&oc([me,j,le],yr=>{gr=Oo(gr,yr," ")}),L&&Bt?L.createHTML(gr):gr},t.setConfig=function(){let rt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$e(rt),Ct=!0},t.clearConfig=function(){ae=null,Ct=!1},t.isValidAttribute=function(rt,X,Me){ae||$e({});const Xe=H(rt),jt=H(X);return dt(Xe,jt,Me)},t.addHook=function(rt,X){typeof X=="function"&&$o(ie[rt],X)},t.removeHook=function(rt,X){if(X!==void 0){const Me=fI(ie[rt],X);return Me===-1?void 0:dI(ie[rt],Me,1)[0]}return uy(ie[rt])},t.removeHooks=function(rt){ie[rt]=[]},t.removeAllHooks=function(){ie=hy()},t}var OI=IT();const II={ALLOWED_TAGS:["b","i","em","strong","p","br","ul","ol","li","a"],ALLOWED_ATTR:["href","src","alt","title","target","class","id","style"],ALLOW_DATA_ATTR:!1,FORBID_TAGS:["img","iframe","object","input","style","script","embed","svg","video","audio","body","input","form","link"],FORBID_ATTR:["onerror","onclick","onload","onmouseover","onfocus","onblur","onchange","onsubmit","scr","href","style","action","value"],IN_PLACE:!0},PI="javascript:";function AI(e){return(e==null?void 0:e.constructor)===Object}async function vy(e,t=3){let r=0,n;for(;r<=t;){r+=1;try{return await e()}catch(i){n=i,console.error(i),await PT(1e3*Math.pow(2,r))}}throw n}function PT(e){return new Promise(t=>{setTimeout(()=>{t(0)},e)})}function MI(){return Math.random().toString(36).slice(2)}const xI=new TextDecoder,NI=e=>{const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return xI.decode(r)},DI=e=>e.length===0,LI=(...e)=>e.every(DI),AT=e=>{const t=OI.sanitize(e,II);return t.includes(PI)?(console.warn("Suspicious content detected and removed."),""):t},jI="prod",im="3.43.4",my="https://main.api.ujet.co",qr={companyId:"",tenant:"",trackerId:"",deviceId:"",application:"websdk",version:im},gy=[];class Aa{constructor(t){vt(this,"channel");this.channel=t}static addHandler(t){gy.push(t)}debug(...t){this._log("debug",...t)}info(...t){this._log("info",...t)}warn(...t){this._log("warn",...t)}error(...t){this._log("error",...t)}_log(t,...r){gy.forEach(n=>{n(this.channel,t,...r)})}}const FI=(e,t,...r)=>{console[t](`[${t}][${e}]`,...r)},UI=e=>{let t=[],r;return(i,a,...s)=>{a==="debug"||i==="communicator"||(t.push(BI(i,a,...s)),clearTimeout(r),r=window.setTimeout(()=>{if(t.length){const c={num_of_logs:t.length,logs:t};e(c)}t=[]},2e3))}};function BI(e,t,...r){let n=r.pop();typeof n=="string"&&(r.push(n),n={});const i=r.join(" "),a={loglevel:t,channel:e,timestamp:new Date().toISOString(),application:qr.application,version:qr.version,device:qr.deviceId,tenant:qr.tenant,company_id:qr.companyId,location_url:location.href,data:GI(n),message:am(i)};return qr.trackerId&&(a.tracker_id=qr.trackerId),a}const qI=["user","phone","phone_number","phoneNumber","email"],zI=[/(?:3[47]\d|(?:4\d|5[1-5]|65)\d{2}|6011)\d{12}/g,/(?!(000|666|9))\d{3}-(?!00)\d{2}-(?!0000)\d{4}/g,/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+$/g];function am(e){return typeof e=="string"?zI.forEach(t=>{e=e.replace(t,"__MASKED__")}):e&&AI(e)&&(e={...e},Object.keys(e).forEach(t=>{qI.indexOf(t)!==-1?e[t]="__MASKED__":am(e[t])})),e}function GI(e){if(e.error){const t=e.error;return{error:{name:t.name,message:t.message,stack:t.stack}}}return am(e.data)}const WI=new Aa("chat-provider");class sm{constructor(t,r,n){vt(this,"audio");vt(this,"issueChatToken");vt(this,"identity");vt(this,"channelId");vt(this,"region");vt(this,"inTask",!1);vt(this,"muted",!1);vt(this,"events");this.events=t,this.region=r.region,this.audio=new oI,this.issueChatToken=n}ping(){if(!this.muted)try{this.audio.playPing()}catch(t){WI.warn("Chat audio play failed",{error:t})}}on(t,r){this.events.addEventListener(t,r)}off(t,r){this.events.removeEventListener(t,r)}trackInTask(t){t.type==="noti"&&t.event==="taskVaStarted"?this.inTask=!0:t.type==="noti"&&(t.event==="taskVaFinished"||t.event==="taskVaFailed")&&(this.inTask=!1)}}vt(sm,"type","base");const MT={};function om(e){MT[e.type]=e}function HI(e){return MT[e]}const yy=new Aa("MediaStore"),VI=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB,KI="chat-media",by=1,Ml="file";class xT{constructor(){vt(this,"db")}store(){return new Promise((t,r)=>{if(this.db)return t(_y(this.db));const n=VI.open(KI,by);n.onerror=()=>{r(new Error("indexedDB open failed"))},n.onsuccess=()=>{const i=n.result;this.db=i,t(_y(i))},n.onupgradeneeded=i=>{const a=n.result;i.oldVersion>0&&i.oldVersion<by&&(yy.info("deprecating media store"),a.deleteObjectStore(Ml)),yy.info("creating media store"),a.createObjectStore(Ml)}})}async save(t,r){(await this.store()).put({index:t,file:r},t)}async getAll(){const t=await this.store();return await new Promise((r,n)=>{const i=t.getAll();i.onerror=()=>{n(new Error("indexedDB getAll failed"))},i.onsuccess=()=>{r(i.result)}})}async getAllFiles(){const t={};return(await this.getAll()).forEach(n=>{t[n.index]=n.file}),t}async clear(){(await this.store()).clear()}}function _y(e){return e.transaction(Ml,"readwrite").objectStore(Ml)}const pd=new Aa("communicator");let wy=!1;const Sy=1e4;class JI{constructor(t,r){vt(this,"events");vt(this,"options");vt(this,"channel");vt(this,"authenticate");vt(this,"channelReady",!1);vt(this,"__authed",!1);vt(this,"pending",[]);vt(this,"promises",{});vt(this,"user");vt(this,"iframe");this.authenticate=t.authenticate,this.events=r,this.options=this.createConnectOption(t),this.channel=new MessageChannel,this.useConnect(this.options)}useConnect(t){const r=document.createElement("iframe");r.src=t.bridge,r.setAttribute("style","display:none");let n="*";/^https:/.test(t.bridge)&&(n=new URL(t.bridge).origin),r.addEventListener("load",()=>{if(pd.debug("iframe bridge ready for",n),!this.channelReady){const i={type:"_init",data:t};r.contentWindow.postMessage(i,n,[this.channel.port2])}}),this.channel.port1.onmessage=i=>{this.receiveMessage(i)},document.body.appendChild(r),this.iframe=r}receiveMessage(t){const r=t.data;if(r){if(pd.debug("receiveMessage",r),r.type==="ready")this.channelReady=!0,qr.deviceId=r.result.deviceId,qr.deviceId||console.error("Device Id has not been provided. SDK will not work properly."),this.runPending(),this.events.triggerEvent("ready");else if(r.type==="callback"&&r.callbackId){const[n,i]=this.promises[r.callbackId];r.error?i(r.error):n(r.result),delete this.promises[r.callbackId]}else if(r.type==="refreshToken")this.refreshToken();else if(r.request==="_auth"){if(r.result.error)return;if(this.events.triggerEvent("authenticated"),r.result&&r.result.log_proxy_url&&!wy){wy=!0;const n=UI(i=>{this.postMessage({type:"_log",data:i})});Aa.addHandler(n)}}}}postMessage(t){this.channel&&this.channelReady?(pd.debug("postMessage",t),this.channel.port1.postMessage(t)):this.pending.push(t)}runPending(){for(;this.pending.length;){const t=this.pending.shift();this.postMessage(t)}}postPromise(t,r){return new Promise((n,i)=>{const a=MI()+"_"+Date.now();this.promises[a]=[n,i];const s={type:t,callbackId:a,data:r};this.postMessage(s)})}createConnectOption(t){var s;let r=t.host;r||(t.tenant?r=my.replace("main.api",t.tenant):r=my);const n=t.lang||"en",i=!!((s=t.cobrowse)!=null&&s.enabled),a=t.bridge||"https://websdk.ujet.co/v3/bridge.html";return{host:r,lang:n,cobrowse:i,companyId:t.companyId,location:location.href,version:t.version||"3.43.4",bridge:a}}async refreshToken(){this.__authed=!0;const t=await this.authenticate(),r=["twilio_chat","nexmo_chat"];this.options.cobrowse&&r.push("cobrowse");const n={modules:r,user:{token:t.token,company_id:this.options.companyId}};await this.postPromise("_auth",n).then(i=>{if(i.error)return;const a=JSON.parse(NI(t.token.split(".")[1]));if(this.user={identifier:a.identifier,name:a.name,email:a.email},this.events.triggerEvent("authenticate"),a.exp){let s;if(a.exp.toString().length===13?s=a.exp:a.exp.toString().length===10&&(s=a.exp*1e3),s){const c=Math.max(s-Date.now()-Sy,Sy);setTimeout(()=>{this.refreshToken()},c)}}})}request(t,r){!this.__authed&&t!=="proactive_chat_triggers"&&this.refreshToken();const n={url:t,options:r};return this.postPromise("request",n)}destroy(){delete this.channel,this.iframe&&(document.body.removeChild(this.iframe),this.iframe=void 0)}}var to=(e=>(e.WAITING="waiting",e.READY="ready",e.IN_PROGRESS="in_progress",e.FINISHED="finished",e))(to||{}),NT=(e=>(e.CONFIRMED="confirmed",e.EXITED="exited",e.PENDING="pending",e.REQUESTED="requested",e.SKIPPED="skipped",e.TIMED_OUT="timed_out",e))(NT||{});class um{constructor(){vt(this,"handlers",{})}addEventListener(t,r){this.handlers[t]||(this.handlers[t]=[]),this.handlers[t].push(r)}triggerEvent(t,r){const n=this.handlers[t];n&&n.forEach(i=>{i(r)})}removeEventListener(t,r){if(this.handlers[t]){const n=this.handlers[t].indexOf(r);n!==-1&&this.handlers[t].splice(n,1)}}destroy(){this.handlers={}}}function YI(e,t){const r={};return t.forEach(n=>{r[n.id]=n}),e.map(n=>{if(n.type==="server_message"){const i=n.message_id,a=r[i];DT(n,a.content)}return n})}function XI(e,t){return DT(e,t.content)}function DT(e,t){return Object.keys(t).forEach(r=>{e[r]=t[r]}),e}const Ty={photo:2,video:2,audio:1,document:1};function QI(e){const t=e.toSorted((r,n)=>!r.groupMessageId||!n.groupMessageId||r.groupMessageId!==n.groupMessageId?0:(Ty[n.type]||0)-(Ty[r.type]||0));return t.forEach((r,n,i)=>{const a=!r.groupMessageId,s=i[n+1];s&&(a&&s.$userId===r.$userId&&r.$time||!a&&s.groupMessageId===r.groupMessageId&&r.$time)&&(s.$time=r.$time,r.$time=null)}),t}const ZI={confirmSessionTitle:"Screen Share Session Request",confirmSessionContent:"Do you want to share your current screen with the agent?",endSessionText:"End Screen Share Session",confirmRemoteControlTitle:"Remote Access Request",confirmRemoteControlContent:"The agent would like to have access to your currently shared screen to further assist you. Do you want to allow this?",confirmFullDeviceTitle:"Screen Share Request",confirmFullDeviceContent:"Do you want to share your full screen with the agent? The agent will not be able to control anything on the screen.",allowText:"Allow",denyText:"Deny"},eP={confirmSessionTitle:"Solicitud de sesión de conavegación",confirmSessionContent:"¿Desea compartir su pantalla actual con el agente?",endSessionText:"Fin de la sesión de conavegación",confirmRemoteControlTitle:"Solicitud de acceso remoto",confirmRemoteControlContent:"El agente desea tener acceso a su pantalla actual compartida para seguir asistiéndole. ¿Desea permitirlo?",confirmFullDeviceTitle:"Solicitud de compartir pantalla",confirmFullDeviceContent:"¿Desea compartir su pantalla completa con el agente? El agente no podrá controlar nada de la pantalla.",allowText:"Permitir",denyText:"Denegar"},tP={confirmSessionTitle:"Demande de session de co-navigation",confirmSessionContent:"Voulez-vous partager votre écran actuel avec l'agent ?",endSessionText:"Terminer la session de co-navigation",confirmRemoteControlTitle:"Demande d'accès à distance",confirmRemoteControlContent:"L'agent souhaite avoir accès à l'écran que vous partagez actuellement pour mieux vous aider. Voulez-vous l'y autoriser ?",confirmFullDeviceTitle:"Demande de partage d'écran",confirmFullDeviceContent:"Voulez-vous partager votre écran complet avec l'agent ? L'agent ne sera pas en mesure de contrôler quoi que ce soit sur l'écran.",allowText:"Autoriser",denyText:"Refuser"},rP={confirmSessionTitle:"Screen Share-Sitzungsanfrage",confirmSessionContent:"Möchten Sie Ihren aktuellen Bildschirm für den Agenten freigeben?",endSessionText:"Screen Share-Sitzung beenden",confirmRemoteControlTitle:"Fernzugriff-Anfrage",confirmRemoteControlContent:"Der Agent möchte Zugriff auf Ihren aktuell freigegebenen Bildschirm erhalten, um Ihnen weiterhelfen zu können. Möchten Sie dies erlauben?",confirmFullDeviceTitle:"Bildschirmfreigabe",confirmFullDeviceContent:"Möchten Sie Ihren gesamten Bildschirm für den Agenten freigeben? Der Agent ist dadurch nicht in der Lage, Elemente auf Ihrem Bildschirm zu steuern.",allowText:"Erlauben",denyText:"Verweigern"},nP={confirmSessionTitle:"共同ブラウジングセッションリクエスト",confirmSessionContent:"現在の画面を担当者と共有したいですか。",endSessionText:"共同ブラウジングセッションを終了",confirmRemoteControlTitle:"リモートアクセスリクエスト",confirmRemoteControlContent:"担当者は、お客様をさらにお手伝いするために、現在共有中の画面へのアクセスを希望しています。許可しますか。",confirmFullDeviceTitle:"画面共有リクエスト",confirmFullDeviceContent:"画面全体を担当者と共有したいですか。担当者は画面上で一切の操作ができません。",allowText:"許可",denyText:"拒否"},iP={confirmSessionTitle:"코브라우징 세션 요청",confirmSessionContent:"현재 화면을 상담원과 공유하시겠습니까?",endSessionText:"코브라우징 세션 종료",confirmRemoteControlTitle:"원격 액세스 요청",confirmRemoteControlContent:"상담원이 추가 지원을 위해 현재 공유된 화면에 액세스할 수 있기를 원합니다. 허용하시겠습니까?",confirmFullDeviceTitle:"화면 공유 요청",confirmFullDeviceContent:"상담원과 전체 화면을 공유하시겠습니까? 상담원은 화면의 어떤 부분도 제어할 수 없습니다.",allowText:"허용",denyText:"거절"},aP={confirmSessionTitle:"Richiesta di sessione di Screen Share",confirmSessionContent:"Vuoi condividere la tua schermata attuale con l'operatore?",endSessionText:"Termina sessione di Screen Share",confirmRemoteControlTitle:"Richiesta di accesso remoto",confirmRemoteControlContent:"L'operatore vorrebbe accedere alla tua schermata attualmente condivisa per assisterti al meglio. Acconsenti?",confirmFullDeviceTitle:"Richiesta di condivisione schermo",confirmFullDeviceContent:"Vuoi condividere il tuo intero schermo con l'operatore? L'operatore non potrà controllare nessun elemento sullo schermo.",allowText:"Consenti",denyText:"Rifiuta"},sP={confirmSessionTitle:"同步浏览会话请求",confirmSessionContent:"您是否要向该客服代表共享当前的屏幕?",endSessionText:"结束同步浏览会话",confirmRemoteControlTitle:"远程访问请求",confirmRemoteControlContent:"为了进一步协助您,客服代表想访问您当前的共享屏幕。您是否允许这样做?",confirmFullDeviceTitle:"屏幕共享请求",confirmFullDeviceContent:"您是否要向该客服代表共享全屏?客服代表将不能控制屏幕上的任何东西。",allowText:"允许",denyText:"拒绝"},oP={confirmSessionTitle:"Samwebbläsningssession har begärts",confirmSessionContent:"Vill du dela din aktuella skärm med vår medarbetare?",endSessionText:"Avsluta samwebbläsningssession",confirmRemoteControlTitle:"Begäran om fjärråtkomst",confirmRemoteControlContent:"Vår medarbetare skulle vilja få åtkomst till skärmen som du delar just nu för att kunna hjälpa dig vidare. Vill du tillåta detta?",confirmFullDeviceTitle:"Begäran om skärmdelning",confirmFullDeviceContent:"Vill du dela hela skärmen med medarbetaren? Medarbetaren kommer inte kunna kontrollera något på skärmen.",allowText:"Tillåt",denyText:"Neka"},uP={confirmSessionTitle:"Solicitação de Sessão de Co-navegação",confirmSessionContent:"Deseja partilhar o seu ecrã atual com o agente?",endSessionText:"Terminar Sessão de Co-navegação",confirmRemoteControlTitle:"Solicitação de Acesso Remoto",confirmRemoteControlContent:"O agente gostaria de ter acesso ao seu ecrã partilhado atualmente para ajudá-lo ainda mais. Quer permitir isto?",confirmFullDeviceTitle:"Solicitação de Partilha de Ecrã",confirmFullDeviceContent:"Deseja partilhar o seu ecrã inteiro com o agente? O agente não poderá controlar nada no ecrã.",allowText:"Permitir",denyText:"Negar"},cP={confirmSessionTitle:"Pyyntö yhteisselausistunnosta",confirmSessionContent:"Haluatko jakaa nykyisen näyttösi edustajan kanssa?",endSessionText:"Lopeta yhteisselausistunto",confirmRemoteControlTitle:"Etäkäyttöpyyntö",confirmRemoteControlContent:"Edustaja haluaisi saada käyttää tällä hetkellä jakamaasi näyttöä voidakseen auttaa sinua enemmän. Haluatko antaa siihen luvan?",confirmFullDeviceTitle:"Näytön jakamispyyntö",confirmFullDeviceContent:"Haluatko jakaa koko näyttösi edustajan kanssa? Edustaja ei pysty käyttämään mitään näytöllä olevaa.",allowText:"Salli",denyText:"Estä"},lP={confirmSessionTitle:"Samlesingsøkten er startet",confirmSessionContent:"Vil du dele skjermen din med agenten?",endSessionText:"Avslutt samlesingsøkt",confirmRemoteControlTitle:"Forespørsel om fjerntilgang",confirmRemoteControlContent:"Agenten vil ha tilgang til skjermen din for å kunne hjelpe deg videre. Vil du tillate dette?",confirmFullDeviceTitle:"Forespørsel om skjermdeling",confirmFullDeviceContent:"Vil du dele hele skjermen din med agenten? Agenten kan ikke kontrollere noe på skjermen.",allowText:"Tillat",denyText:"Avvis"},fP={confirmSessionTitle:"Forespørgsel om sambrowsingsession",confirmSessionContent:"Vil du dele din nuværende skærm med agenten",endSessionText:"Afslut sambrowsingsession",confirmRemoteControlTitle:"Anmodning om fjernadgang",confirmRemoteControlContent:"Agenten vil gerne have adgang til din nuværende delte skærm for at kunne hjælpe dig yderligere. Ønsker du at tillade dette?",confirmFullDeviceTitle:"Forespørgsel om skærmdeling",confirmFullDeviceContent:"Vil du dele din fulde skærm med agenten? Agenten vil ikke kunne styre noget på skærmen",allowText:"Tillad",denyText:"Afvis"},dP={confirmSessionTitle:"Verzoek om cobrowse-sessie",confirmSessionContent:"Wilt u uw huidige scherm delen met de agent?",endSessionText:"Cobrowse-sessie beëindigen",confirmRemoteControlTitle:"Verzoek om toegang op afstand",confirmRemoteControlContent:"De agent wil graag toegang hebben tot uw momenteel gedeelde scherm om u verder te helpen. Wilt u dit toestaan?",confirmFullDeviceTitle:"Verzoek om scherm te delen",confirmFullDeviceContent:"Wilt u uw volledige scherm delen met de agent? De agent kan niets op het scherm bedienen.",allowText:"Toestaan",denyText:"Weigeren"},pP={confirmSessionTitle:"Oturum İsteğini Eş Zamanlı Tara",confirmSessionContent:"Mevcut ekranınızı temsilciyle paylaşmak ister misiniz?",endSessionText:"Eş zamanlı Oturum Taramayı Sonlandır",confirmRemoteControlTitle:"Uzaktan Erişim İsteği",confirmRemoteControlContent:"Temsilci şu anda paylaşılan ekranınıza size daha fazla yardımcı olabilmek için erişim sağlamak istiyor. Buna izin vermek istiyor musunuz?",confirmFullDeviceTitle:"Ekran Paylaşım İsteği",confirmFullDeviceContent:"Temsilciyle tam ekranınızı paylaşmak istiyor musunuz? Temsilci ekrandaki hiçbir şeyi kontrol edemez.",allowText:"İzin Ver",denyText:"Reddet"},hP={confirmSessionTitle:"Yêu cầu phiên cùng duyệt",confirmSessionContent:"Bạn có muốn chia sẻ màn hình hiện tại của mình với chuyên viên không?",endSessionText:"Kết thúc phiên cùng duyệt",confirmRemoteControlTitle:"Yêu cầu truy cập từ xa",confirmRemoteControlContent:"Chuyên viên muốn được cấp quyền truy cập vào màn hình bạn đang chia sẻ để hỗ trợ bạn nhiều hơn. Bạn có muốn cho phép không?",confirmFullDeviceTitle:"Yêu cầu chia sẻ màn hình",confirmFullDeviceContent:"Bạn có muốn chia sẻ toàn bộ màn hình của mình với chuyên viên không? Chuyên viên sẽ không thể điều khiển bất cứ phần nào trên màn hình.",allowText:"Cho phép",denyText:"Từ chối"},vP={confirmSessionTitle:"ขอเซสชันเรียกดูร่วม",confirmSessionContent:"คุณต้องการแชร์หน้าจอปัจจุบันกับตัวแทนหรือไม่",endSessionText:"สิ้นสุดเซสชันเรียกดูร่วม",confirmRemoteControlTitle:"ขอการเข้าถึงระยะไกล",confirmRemoteControlContent:"ตัวแทนต้องการเข้าถึงหน้าจอของคุณที่แชร์อยู่ในปัจจุบันเพื่อให้ความช่วยเหลือคุณต่อไป คุณจะอนุญาตหรือไม่",confirmFullDeviceTitle:"ขอแชร์หน้าจอ",confirmFullDeviceContent:"คุณต้องการแชร์ทั้งหน้าของคุณกับตัวแทนหรือไม่ ตัวแทนจะไม่สามารถควบคุมอะไรบนหน้าจอ",allowText:"ยินยอม",denyText:"ปฏิเสธ"},mP={confirmSessionTitle:"طلب جلسة تصفح مشترك",confirmSessionContent:"هل تريد مشاركة شاشتك الحالية مع الموظف؟",endSessionText:"إنهاء جلسة التصفح المشترك",confirmRemoteControlTitle:"طلب التحكم عن بعد",confirmRemoteControlContent:"يرغب مسئول الدعم في رؤية شاشتك المشاركة حالياً لمساعدتك بشكلٍ أكبر. هل تسمح بذلك؟",confirmFullDeviceTitle:"طلب مشاركة الشاشة",confirmFullDeviceContent:"هل تريد مشاركة شاشتك الكاملة مع مسئول الدعم؟ لن يتمكن المسئول من التحكم في أي شيء على الشاشة.",allowText:"السماح",denyText:"الرفض"},gP={confirmSessionTitle:"Žádost o relaci Screen Share",confirmSessionContent:"Chcete svou současnou obrazovku sdílet s agentem?",endSessionText:"Ukončit relaci Screen Share",confirmRemoteControlTitle:"Žádost o vzdálený přístup",confirmRemoteControlContent:"Agent by rád získal přístup k vaší stávající sdílené obrazovce, aby vám mohl dál pomoci. Chcete mu přístup povolit?",confirmFullDeviceTitle:"Žádost o sdílení obrazovky",confirmFullDeviceContent:"Chcete svou celou obrazovku sdílet s agentem? Agent nebude moci ovládat nic, co na obrazovce je.",allowText:"Povolit",denyText:"Zamítnout"},yP={confirmSessionTitle:"Prośba o sesję Screen Share",confirmSessionContent:"Czy chcesz udostępnić konsultantowi swój bieżący ekran?",endSessionText:"Zakończ sesję Screen Share",confirmRemoteControlTitle:"Prośba o zdalny dostęp",confirmRemoteControlContent:"Konsultant prosi o dostęp do Twojego aktualnie udostępnionego ekranu, aby udzielić Ci dalszej pomocy. Czy chcesz na to zezwolić?",confirmFullDeviceTitle:"Prośba o udostępnienie ekranu",confirmFullDeviceContent:"Czy chcesz udostępnić konsultantowi swój cały ekran? Konsultant nie będzie mógł kontrolować niczego na ekranie.",allowText:"Zezwól",denyText:"Odmów"},bP={confirmSessionTitle:"Screen Share munkameneti kérés",confirmSessionContent:"Megosztja az aktuális képernyőjét a képviselővel?",endSessionText:"Screen Share munkamenet befejezése",confirmRemoteControlTitle:"Távoli hozzáférési kérés",confirmRemoteControlContent:"A képviselő szeretne hozzáférni a jelenleg megosztott képernyőjéhez, hogy további segítséget nyújthasson. Engedélyezi ezt?",confirmFullDeviceTitle:"Képernyőmegosztási kérelem",confirmFullDeviceContent:"Megosztja a teljes képernyőjét az ügynökkel? Az ügynök semmit sem tud majd irányítani a képernyőn.",allowText:"Engedélyezés",denyText:"Elutasítás"},_P={confirmSessionTitle:"Запрос сеанса совместного просмотра веб-страниц",confirmSessionContent:"Хотите поделиться вашим текущим экраном с представителем?",endSessionText:"Завершить сеанс совместного просмотра веб-страниц",confirmRemoteControlTitle:"Запрос на удаленный доступ",confirmRemoteControlContent:"Представитель хочет получить доступ к вашему текущему экрану, которым вы делитесь, чтобы помочь вам. Хотите разрешить это?",confirmFullDeviceTitle:"Запрос на совместный просмотр экрана",confirmFullDeviceContent:"Хотите поделиться вашим полный экраном с представителем? Агент не сможет выполнять никаких действий на экране.",allowText:"Разрешить",denyText:"Отказать"},wP={confirmSessionTitle:"सह-ब्राउज़ सत्र अनुरोध किया गया",confirmSessionContent:"क्या आप अपनी वर्तमान स्क्रीन को एजेंट के साथ साझा करना चाहते हैं?",endSessionText:"सह-ब्राउज़ सत्र समाप्त करें",confirmRemoteControlTitle:"रिमोट पहुँच का अनुरोध किया गया",confirmRemoteControlContent:"एजेंट आपकी वर्तमान साझा स्क्रीन तक पहुँच प्राप्त करना चाहेगा ताकि वह आपकी और सहायता कर सके। क्या आप इसकी अनुमति देना चाहते हैं?",confirmFullDeviceTitle:"स्क्रीन साझाकरण अनुरोध",confirmFullDeviceContent:"क्या आप अपनी पूरी स्क्रीन एजेंट के साथ साझा करना चाहते हैं? एजेंट स्क्रीन पर कुछ भी नियंत्रित नहीं कर पाएगा।",allowText:"अनुमति दें",denyText:"अस्वीकार करें"},SP={confirmSessionTitle:"Solicitare sesiune de co-navigare",confirmSessionContent:"Doriți să partajați ecranul dumneavoastră curent cu agentul?",endSessionText:"Încheiați sesiunea de co-navigare",confirmRemoteControlTitle:"Cerere de acces la distanță",confirmRemoteControlContent:"Agentul ar dori să aibă acces la ecranul dumneavoastră partajat pentru a vă ajuta în continuare. Doriți să permiteți acest lucru?",confirmFullDeviceTitle:"Cerere de partajare a ecranului",confirmFullDeviceContent:"Doriți să partajați ecranul dumneavoastră complet cu agentul? Agentul nu va putea controla nimic de pe ecran.",allowText:"Permiteți",denyText:"Refuzați"},TP={confirmSessionTitle:"Zahtjev za sesiju zajedničkog pregledavanja",confirmSessionContent:"Želite li podijeliti svoj trenutni zaslon s agentom?",endSessionText:"Završi sesiju zajedničkog pregledavanja",confirmRemoteControlTitle:"Zahtjev za daljinski pristup",confirmRemoteControlContent:"Agent želi imati pristup vašem trenutno dijeljenom zaslonu kako bi Vam dodatno pomogao. Želite li to dopustiti?",confirmFullDeviceTitle:"Zahtjev za dijeljenje zaslona",confirmFullDeviceContent:"Želite li s agentom podijeliti svoj cijeli zaslon? Agent neće moći ništa kontrolirati na ekranu.",allowText:"Dopustiti",denyText:"Odbiti"},CP={confirmSessionTitle:"Запит на сесію спільного перегляду",confirmSessionContent:"Чи Ви хочете поділитись з агентом своїм поточним екраном?",endSessionText:"Завершити сесію спільного перегляду",confirmRemoteControlTitle:"Запит на віддалений доступ",confirmRemoteControlContent:"Агент хоче отримати доступ до Вашого поточного екрану, який переглядається спільно, щоб допомогти Вам. Ви дозволяєте?",confirmFullDeviceTitle:"Запит на спільний перегляд екрану",confirmFullDeviceContent:"Чи Ви хочете поділитись з агентом своїм екраном повністю? Агент не зможе нічого на ньому контролювати.",allowText:"Дозволити",denyText:"Відмовити"},EP={confirmSessionTitle:"Kahilingan sa Screen Share na Sesyon",confirmSessionContent:"Gusto mo bang ibahagi ang iyong kasalukuyang screen sa agent?",endSessionText:"Tapusin ang Screen Share na Sesyon",confirmRemoteControlTitle:"Kahilingan sa Remote Access",confirmRemoteControlContent:"Gusto ng agent na magkaroon ng access sa iyong nakabahaging screen sa kasalukuyan upang mas matulungan ka. Gusto mo bang payagan ito?",confirmFullDeviceTitle:"Kahilingan sa Pagbahagi ng Screen",confirmFullDeviceContent:"Gusto mo bang ibahagi ang buong screen sa agent? Hindi makokontrol ng agent ang kahit ano sa screen.",allowText:"Payagan",denyText:"Tanggihan"},Mo={en:ZI,es:eP,"es-MX":{confirmSessionTitle:"Solicitud de Sesión de Co-navegación",confirmSessionContent:"¿Quiere compartir su pantalla actual con el agente?",endSessionText:"Fin de la sesión de co-navegación",confirmRemoteControlContent:"El agente desea tener acceso a su pantalla actualmente compartida para poder ayudarlo. ¿Quiere permitirlo?",confirmFullDeviceTitle:"Petición de pantalla compartida",confirmFullDeviceContent:"¿Quiere compartir su pantalla completa con el agente? El agente no podrá controlar nada en la pantalla."},fr:tP,"fr-CA":{confirmSessionTitle:"Demande de session co-navigation",confirmSessionContent:"Voulez-vous partager votre écran actuel avec l'agent?",endSessionText:"Fin de la session de co-navigation",confirmRemoteControlContent:"L'agent souhaiterait avoir accès à votre écran actuellement partagé pour mieux vous aider. Voulez-vous l'autoriser?",confirmFullDeviceContent:"Voulez-vous partager votre écran complet avec l'agent? L'agent ne sera pas en mesure de contrôler quoi que ce soit sur l'écran."},de:rP,ja:nP,ko:iP,it:aP,zh:sP,"zh-Hant":{confirmSessionTitle:"共同瀏覽工作階段要求",confirmSessionContent:"要與專員分享您目前的畫面嗎?",endSessionText:"結束共同瀏覽工作階段",confirmRemoteControlTitle:"遠端存取要求",confirmRemoteControlContent:"專員想要存取您目前分享的螢幕畫面以進一步協助您。要允許嗎?",confirmFullDeviceTitle:"螢幕畫面分享要求",confirmFullDeviceContent:"要與專員分享全螢幕嗎?專員將無法控制畫面上的任何項目。",allowText:"允許",denyText:"拒絕"},sv:oP,pt:uP,"pt-BR":{confirmSessionContent:"Você deseja compartilhar sua tela atual com o agente?",endSessionText:"Encerrar Sessão de Co-navegação",confirmRemoteControlContent:"O agente gostaria de acessar sua tela atualmente compartilhada para melhor ajudá-lo. Você deseja permitir isso?",confirmFullDeviceTitle:"Solicitação de Compartilhamento de Tela",confirmFullDeviceContent:"Você deseja compartilhar sua tela inteira com o agente? O agente não poderá controlar nada na tela."},fi:cP,nb:lP,da:fP,nl:dP,tr:pP,vi:hP,th:vP,ar:mP,cs:gP,pl:yP,hu:bP,ru:_P,hi:wP,ro:SP,hr:TP,uk:CP,tl:EP};function kP(e){const t=e.split("-")[0];return Mo[e]?e===t?Mo[e]:{...Mo[t],...Mo[e]}:Mo[t]}const LT=["assigned","va_assigned"],jT=["dismissed","va_dismissed"],RP=["va_assigned","va_dismissed"],$P=["queued","check_in_timeout",...LT,...jT],OP=["timeout","canceled","failed","finished"],cc=new Aa("Chat");class IP{constructor(t,r){vt(this,"provider");vt(this,"store");vt(this,"globalEvents");vt(this,"state");vt(this,"connected",!1);vt(this,"allowSkipVirtualAgent",!1);vt(this,"inEscalation",!1);vt(this,"events");vt(this,"cachedFiles");this.state=t,this.store=new xT,this.cachedFiles={},this.events=new um;const n=HI(this.state.provider_type);this.provider=new n(this.events,t,r)}_setGlobalEvents(t,r){this.globalEvents=t,this.on("message",n=>{if(n.content=AT(n.content),n.type==="server_message"){const i=n.message_id;r(this.id,i).then(a=>{n=XI(n,a),t.triggerEvent("chat.message",n)})}else n.type==="photo"||n.type==="video"?setTimeout(()=>{const i=n.$index.toString();n.file=this.cachedFiles[i],t.triggerEvent("chat.message",n)},100):(t.triggerEvent("chat.message",n),this.registerMessageEvents(n))}),this.on("memberJoined",n=>{t.triggerEvent("chat.memberJoined",n)}),this.on("memberLeft",n=>{t.triggerEvent("chat.memberLeft",n)}),this.on("typingStarted",n=>{t.triggerEvent("chat.typingStarted",n)}),this.on("typingEnded",n=>{t.triggerEvent("chat.typingEnded",n)}),this.on("checkInRequired",()=>{t.triggerEvent("chat.checkInRequested")}),this.on("checkInTimedOut",()=>{t.triggerEvent("chat.checkInTimedOut")})}get id(){var t;return((t=this.state)==null?void 0:t.id)||-1}get menuId(){return this.state?this.state.menus[this.state.menus.length-1].id:-1}get channelId(){var t;return((t=this.state)==null?void 0:t.provider_channel_id)||""}get lang(){var t;return((t=this.state)==null?void 0:t.lang)||""}get virtual(){return RP.indexOf(this.status)!==-1}get muted(){var t;return((t=this.provider)==null?void 0:t.muted)||!1}set muted(t){this.provider&&(this.provider.muted=t)}get agent(){return this.state?this.virtual?this.state.external_agent||this.state.virtual_agent:this.state.agent||this.state.virtual_agent:null}get allAgents(){var t,r;return{virtual:((t=this.state)==null?void 0:t.all_virtual_agents)||[],human:((r=this.state)==null?void 0:r.all_agents)||[]}}get userIdentity(){var t;return((t=this.provider)==null?void 0:t.identity)||""}get status(){var t;return((t=this.state)==null?void 0:t.status)||""}get postSessionStatus(){var t;return((t=this.state)==null?void 0:t.post_session_transfer_status)||""}get statusText(){var t;return((t=this.state)==null?void 0:t.status_text)||""}get cobrowsable(){return this.state?this.state.features.indexOf("cobrowse")!==-1:!1}get ongoing(){return $P.indexOf(this.status)!=-1}get assigned(){return LT.indexOf(this.status)!=-1}get dismissed(){return jT.indexOf(this.status)!=-1}get ended(){return OP.indexOf(this.status)!=-1}get transcriptCount(){var t;return((t=this.state)==null?void 0:t.transcript_requested_count)||0}get createdAt(){var t;return((t=this.state)==null?void 0:t.created_at)||""}get inTask(){var t;return((t=this.provider)==null?void 0:t.inTask)||!1}get feedbackType(){var t;return this.state?this.state.survey_enabled?"survey":(t=this.state.csat_settings)!=null&&t.enabled?"rate":"none":"none"}get optInRequired(){var t;return((t=this.state)==null?void 0:t.post_session_opt_in_required)||!1}get postSessionRequired(){var t;return((t=this.state)==null?void 0:t.post_session_required)||!1}get postSessionInProgress(){return this.state?this.state.post_session_transfer_status===to.IN_PROGRESS:!1}get checkInStatus(){var t;return((t=this.state)==null?void 0:t.check_in_status)??null}set checkInStatus(t){this.state&&(this.state.check_in_status=t)}update(t){if(!this.state||this.state.id!==t.id)return;const r=t.menus[t.menus.length-1].id,n=this.state.menus[this.state.menus.length-1].id;this.state=t,r!==n&&this.triggerEvent("_menuChanged",this),t.status==="canceled"?this.triggerEvent("ended",this):this.triggerEvent("updated",this)}on(t,r){this.events.addEventListener(t,r)}off(t,r){this.events.removeEventListener(t,r)}async connect(){if(!this.provider)return cc.info("connecting interrupted"),!1;try{await vy(()=>this.provider.create(),3),await vy(()=>this.provider.join(this.state.provider_channel_id),3),this.connected=!0;const t=await this.fetchMessages(),r={chat:this,messages:t};return this.triggerEvent("connectedMessages",r),this.triggerEvent("connected",this),this.registerProviderEvents(),cc.info("connected with provider",this.state.provider_type),!0}catch(t){return cc.error("Failed to connect with provider",t),!1}}async disconnect(){this.connected=!1,this.triggerEvent("disconnected",this),this.events.destroy(),this.provider&&(await this.provider.destroy(),cc.info("disconnect with provider",this.state.provider_type))}async sendMessage(t,r){const n=await this.provider.sendMessage(t);return r&&this.saveMedia(n,r),n}preview(t){if(!this.inTask)return this.provider.preview(t)}async fetchMessages(){if(this.connected){const t=await this.store.getAllFiles();return this.provider.fetchMessages(t)}else throw new Error("Please fetchMessages after chat connected.")}startTyping(){return this.provider.startTyping()}stopTyping(){return this.provider.stopTyping()}saveMedia(t,r){this.cachedFiles[t.toString()]=r,this.store.save(t,r)}async destroy(){await this.clearMediaStore(),this.connected&&await this.disconnect(),this.provider&&(this.triggerEvent("destroyed"),this.provider=null),this.events.destroy(),this.state=null}async clearMediaStore(){await this.store.clear()}_handleChatEndedEvent(t){this.state&&(this.disconnect(),t.timeout?(this.state.status="timeout",this.triggerEvent("timeout",this)):(this.state.status="finished",this.triggerEvent("ended",this)))}triggerEvent(t,r){this.events.triggerEvent(t,r),this.globalEvents&&this.globalEvents.triggerEvent("chat."+t,r)}registerProviderEvents(){this.provider&&this.provider.registerConversationEvents()}registerMessageEvents(t){switch(t.event){case"cobrowseRequestedFromAgent":this.events.triggerEvent("_requestCobrowse","agent");break;case"cobrowseRequestedFromEndUser":this.events.triggerEvent("_requestCobrowse","end_user");break;case"chatDismissed":this.state&&(this.state.status="dismissed",this.triggerEvent("dismissed",this));break;case"chatEnded":this.events.triggerEvent("_chatEnded",t);break;case"escalationStarted":this.inEscalation=!0;break;case"escalationFailed":case"escalationAccepted":this.inEscalation=!1;break;case"checkInRequired":this.events.triggerEvent("checkInRequired");break;case"checkInTimedOut":this.events.triggerEvent("checkInTimedOut");break}}}function Cy(e){return e.chats=e.chats.map(t=>{const r=t.entries.map((n,i)=>PP(n,`${t.comm_id}-${i}`));return t.entries=QI(r),t}),e}function PP(e,t){var r;return{$index:e.timestamp,$sid:t,$timestamp:new Date(e.timestamp),$userType:e.role,$userId:((r=e.user_data)==null?void 0:r.id)||0,user:e.user_data,type:e.type,...e.body}}const AP={en:"English (US)","en-CA":"English (Canada)","en-GB":"English (UK)",es:"Español (España)","es-MX":"Español (México)",fr:"Français (France)","fr-CA":"Français (Canada)",de:"Deutsch",ja:"日本語",ko:"한국어",it:"Italiano",zh:"中文 (简体)","zh-Hant":"中文 (繁體)",sv:"Svenska",pt:"Português (Portugal)","pt-BR":"Português (Brasil)",fi:"Suomi",nb:"Norsk",da:"Dansk",nl:"Nederlands",tr:"Türk",vi:"Tiếng Việt",th:"คนไทย",ar:"اَلْعَرَبِيَّةُ",cs:"Czech",pl:"Polish",hu:"Hungarian"};function MP(e){var r,n;return{languages:e.languages.filter(i=>i.enabled).map(i=>({lang:i.lang,name:i.name,localeName:AP[i.lang]})),name:e.display_name,subdomain:e.subdomain,support_email:e.support_email,action_tracking:e.action_tracking_enabled,email_transcripts:e.chat_settings.email_transcripts,message_preview:e.chat_settings.message_preview,email_enhancement:e.email_enhancement_enabled,display_history:((r=e.chat_settings.display_history)==null?void 0:r.enabled)&&((n=e.chat_settings.display_history)==null?void 0:n.to_end_user),use_recording:e.use_recording,use_web:e.use_web,cobrowse_domain:e.cobrowse_domain}}function FT(e){return e.map(xP).filter(t=>t.enabled)}function xP(e){const t={id:e.id,enabled:!0,channels:[],hidden:!!e.hidden};if(!e.name||!e.name.trim())return t.enabled=!1,t;t.name=e.name.trim();const r=NP(e);if(r&&(t.redirection=e.redirection),e.children&&e.children.length){const n=FT(e.children);return t.enabled=n.length>0||r,t.children=n,t}if(!e.channels)t.enabled=r;else{const{channels:n,deflection:i}=DP(e.channels);t.deflection=i,r||(t.channels=n),t.enabled=n.length>0||r}return t}function NP(e){let t=!1;const r=e.redirection;return r&&(r.option==="message"||r.option==="url")&&(t=!!r.data),t}function DP(e){let t=null;const r=[],n=e.chat,i=a=>{!a.deflection_type&&a.deflected_reason&&(a.deflection_type=a.deflected_reason),a.deflected===void 0&&a.deflection_type&&(a.deflected=!0),r.push(a)};return n&&n.deflected&&(t={enabled:!0,type:n.deflected_reason}),n&&(n.enabled||n.virtual_agent_available)&&i({...e.chat,type:"chat"}),e.voice_call&&e.voice_call.instant_enabled&&i({...e.voice_call,type:"instant_call"}),e.voice_call&&e.voice_call.schedule_enabled&&i({...e.voice_call,type:"scheduled_call",deflection_type:e.voice_call.schedule_deflection_type}),e.email&&e.email.enabled&&i({...e.email,type:"email"}),n&&n.deflected&&n.deflected_reason==="over_capacity"&&n.keep_waiting&&i({...n,enabled:!0,type:"keep_waiting",deflection_type:n.deflected_reason}),e.external_deflection_link&&e.external_deflection_link.enabled&&e.external_deflection_link.links.forEach(s=>{s.enabled&&i({...s,type:"external_link"})}),{channels:r,deflection:t}}const Ey=/Chrome/.test(navigator.userAgent);class LP{constructor(t){vt(this,"request");this.request=t}get(t,r){if(r){const n=[];Object.keys(r).forEach(i=>{const a=r[i];a!==void 0&&n.push(`${encodeURIComponent(i)}=${encodeURIComponent(a)}`)}),t+="?"+n.join("&")}return this.request(t,{method:"GET"})}post(t,r){const n={method:"POST"};return n.body=JSON.stringify(r),this.request(t,n)}patch(t,r){const n={method:"PATCH"};return n.body=JSON.stringify(r),this.request(t,n)}put(t,r){const n={method:"PUT"};return n.body=JSON.stringify(r),this.request(t,n)}async getTriggers(t){const r={"UJET-Company-Id":t};return(await this.request("proactive_chat_triggers",{method:"GET",headers:r})).data}async trackClientEvents(t){return await this.post("/client_events",{events:t})}async getCompany(){const t=await this.get("company");return MP(t.data)}async getMenus(t,r){const n={type:"web_menu",lang:t,direct_access_key:r},i=await this.get("menus",n),a={key:!!r,user:!1},s=i.headers["ujet-direct-access"];return s&&s!="false"&&(a.user=!0),{menus:FT(i.data),direct:a}}async getAfterHourMessage(t){return(await this.get(`audible_messages/${t}`)).data["after_hours.message"].text}async getTimeSlots(t,r="en"){return(await this.get(`menus/${t}/time_slots`,{type:"web_menu",lang:r})).data}async getWaitTimes(t,r="en"){return(await this.get(`menus/${t}/wait_times`,{type:"web_menu",lang:r})).data}async verifyForm(t){try{return await this.post("forms/verify",t),!0}catch{return!1}}async finishChat(t){return(await this.patch(`chats/${t}`,{status:"finished"})).data}async updatePostSession(t,r){const n={post_session_transfer_status:r};try{return(await this.patch(`chats/${t}`,n)).data}catch(i){if(r===to.IN_PROGRESS&&i.status===400)return(await this.patch(`chats/${t}`,n)).data;throw i}}async getChatDeflection(t){const{data:r}=await this.get(`chats/${t}/deflections`);return r&&r.enabled?r:null}sendChatCustomData(t,r){let n;return typeof r=="string"?n={signed:!0,signed_data:r}:n={signed:!1,data:r},this.post(`chats/${t}/custom_data`,n)}async downloadChatTranscript(t){return(await this.post(`chats/${t}/generate_transcript_pdf`,{})).data}async getPdfStatus(t){return await this.get(`chat_transcript_pdfs/${t}/download_transcript`)}async sendChatTranscripts(t,r){return await this.post(`chats/${t}/transcripts`,{emails:r.join(",")})}async listChatTaskMessages(t){return(await this.get(`chats/${t}/task_va_messages`)).data}async getChatTaskMessage(t,r){return(await this.get(`chats/${t}/task_va_messages/${r}`)).data}async sendChatTaskMessage(t,r){const n={content:{content:r,type:"text"}};return(await this.post(`chats/${t}/task_va_messages`,n)).data}async sendChatTextMessage(t,r){const n={message:{content:r,timestamp:new Date().toISOString()}};await this.post(`chats/${t}/messages`,n)}async sendPreviewMessage(t,r,n){const i={message:{content:r,timestamp:n}},{data:a}=await this.post(`chats/${t}/redact_messages`,i);return a}escalateChat(t,r){return this.post(`chats/${t}/escalations`,r)}trackEscalation(t,r,n){return this.put(`chats/${t}/escalations/${r}`,{escalation_id:r,deflection_channel:n})}requestChatCobrowse(t,r){return this.post(`chats/${t}/cobrowse`,r)}rateChat(t,r){return this.patch(`chats/${t}/rating`,r)}async getChatSurvey(t){return(await this.get(`chats/${t}/survey`)).data}sendChatSurvey(t,r){const n={chat_id:t,answers:r};return this.put(`chats/${t}/survey`,n)}trackChatEndUserEvent(t,r){return this.post(`chats/${t}/end_user_event`,r)}async createChat(t,r,n,i){const a={chat:{menu_id:t,lang:r,email:n.email,greeting:n.greeting,trigger_id:n.trigger_id,ticket_id:n==null?void 0:n.ticket_id,custom_data:n==null?void 0:n.custom_data},cobrowsable:n.cobrowsable},c=(await this.post("chats",a)).data;return this.wrapChat(c,i)}async loadChat(t,r){const n=await this.getChat(t);return this.wrapChat(n,r)}async resumeChat(t,r){const n=await this.patch(`chats/${t}`,{status:"queued"});return this.wrapChat(n.data,r)}async getChatHistory(t=1){if(t===1){const{data:r}=await this.get("/chats/histories?page=1&per_page=2");return Cy(r)}else{const{data:r}=await this.get(`/chats/histories?page=${t}&per_page=1`);return Cy(r)}}async uploadChatFile(t,r){let n="file";/^image/.test(r.type)?n="photo":/^video/.test(r.type)?n="video":n="file";const i=r.name.replace(/\.[^.]+$/i,""),a=await this.post(`chats/${t}/${n}s/upload`,{filename:i}),s={file:r,fields:a.data.fields};Ey&&(s.file=await UT(r));const o=(await this.request(a.data.url,s)).data.key,l=(await this.post(`chats/${t}/${n}s`,{chat_id:t,[n]:{s3_path:o,photo_type:n}})).data;return l.type=n,l}async getChat(t){return(await this.get(`chats/${t}`)).data}async wrapChat(t,r){const n=async()=>(await this.post(`chats/${t.id}/tokens`,{provider_type:t.provider_type,device_id:r})).data,i=new IP(t,n),a=async s=>{if(i.status==="va_assigned"){const c=await this.getSkipVirtualAgentSettings(i.menuId,i.lang);i.allowSkipVirtualAgent=c,i.update(s)}};if(i.on("initialized",async()=>{if(i.status==="queued"){const s=await this.getChat(i.id);i.update(s)}}),i.on("memberJoined",async()=>{const s=await this.getChat(i.id);i.update(s)}),i.on("memberLeft",async()=>{const s=await this.getChat(i.id);i.update(s)}),i.on("_chatEnded",async s=>{const c=await this.getChat(i.id);i.update(c),(!i.state||i.ended)&&i._handleChatEndedEvent(s)}),i.on("_menuChanged",async s=>{const c=await this.getChat(s.id);a(c)}),i.on("checkInRequired",async()=>{const s=await this.getChat(i.id);i.update(s)}),i.on("checkInTimedOut",async()=>{const s=await this.getChat(i.id);i.update(s)}),i.channelId)i.connect(),a(t);else{let s;for(;!s;)await this.getChat(i.id).then(c=>{c.provider_channel_id&&i.state?(s=!0,i.update(c),i.connect(),a(c)):(c.status==="canceled"||c.status==="finished")&&(s=!0)}),s||await PT(1500)}return i}async createCall(t,r,n){const i={type:n.scheduled_at?"web_scheduled_call":"web_instant_call",menu_id:t,lang:r,email:n.email,ticket_id:n.ticket_id,recording_permission:n.recording_permission||"recording_permission_not_asked",scheduled_at:n.scheduled_at,custom_data:n.custom_data,end_user:{phone_number:n.phone_number}},s=(await this.post("calls",{call:i,cobrowsable:!1})).data;return s.menu_id=s.selected_menu.id,s}async fetchCall(t){const n=(await this.get(`calls/${t}`)).data;return n.menu_id=n.selected_menu.id,n}async cancelCall(t){const n=(await this.patch(`calls/${t}`,{status:"failed",fail_reason:"canceled"})).data;return n.menu_id=n.selected_menu.id,n}async listFileTypes(){return(await this.get("email_prohibited_file_types")).data}async createEmail(t,r,n){const i={end_user_email:n.email,email_body:n.content,menu_id:t.toString(),lang:r};return n.name&&(i.end_user_name=n.name),n.recaptcha&&(i.recaptcha_response=n.recaptcha),n.files&&Ey?i["email_attachments[]"]=await jP(n.files):n.files&&(i["email_attachments[]"]=[...n.files]),(await this.request("emails",{form:i})).data}async getMedia(t,r){const n=await this.get(`media/${t}?type=${r}`);if(!n.data)return null;const i=n.headers["x-file-name"];return new File([n.data],i,{type:n.data.type})}async getSkipVirtualAgentSettings(t,r){return(await this.get(`menus/${t}/virtual_agent_settings`,{lang:r})).data.allow_skip_virtual_agent}async confirmCheckIn(t){return(await this.post(`chats/${t}/check_in/confirm`,null)).data}async rejoinQueue(t){return(await this.post(`chats/${t}/check_in/rejoin`,null)).data}async exitCheckIn(t){return(await this.post(`chats/${t}/check_in/exit`,null)).data}async trackCheckIn(t,r){await this.post(`chats/${t}/check_in/modal_shown`,r)}async notifyCheckInState(t,r){await this.post(`chats/${t}/check_in/end_user_status`,r)}}function jP(e){return Promise.all(e.map(UT))}function UT(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{const i=[n.result],a={type:e.type,lastModified:e.lastModified};t({name:e.name,fileBits:i,options:a})},n.onerror=r,n.readAsArrayBuffer(e)})}/*!
3
3
  * tabbable 6.2.0
4
4
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5
5
  */var BT=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],xl=BT.join(","),qT=typeof Element>"u",os=qT?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Nl=!qT&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Dl=function e(t,r){var n;r===void 0&&(r=!0);var i=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"inert"),a=i===""||i==="true",s=a||r&&t&&e(t.parentNode);return s},FP=function(t){var r,n=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"contenteditable");return n===""||n==="true"},zT=function(t,r,n){if(Dl(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(xl));return r&&os.call(t,xl)&&i.unshift(t),i=i.filter(n),i},GT=function e(t,r,n){for(var i=[],a=Array.from(t);a.length;){var s=a.shift();if(!Dl(s,!1))if(s.tagName==="SLOT"){var c=s.assignedElements(),o=c.length?c:s.children,u=e(o,!0,n);n.flatten?i.push.apply(i,u):i.push({scopeParent:s,candidates:u})}else{var l=os.call(s,xl);l&&n.filter(s)&&(r||!t.includes(s))&&i.push(s);var f=s.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(s),v=!Dl(f,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(s));if(f&&v){var m=e(f===!0?s.children:f.children,!0,n);n.flatten?i.push.apply(i,m):i.push({scopeParent:s,candidates:m})}else a.unshift.apply(a,s.children)}}return i},WT=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},ts=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||FP(t))&&!WT(t)?0:t.tabIndex},UP=function(t,r){var n=ts(t);return n<0&&r&&!WT(t)?0:n},BP=function(t,r){return t.tabIndex===r.tabIndex?t.documentOrder-r.documentOrder:t.tabIndex-r.tabIndex},HT=function(t){return t.tagName==="INPUT"},qP=function(t){return HT(t)&&t.type==="hidden"},zP=function(t){var r=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(n){return n.tagName==="SUMMARY"});return r},GP=function(t,r){for(var n=0;n<t.length;n++)if(t[n].checked&&t[n].form===r)return t[n]},WP=function(t){if(!t.name)return!0;var r=t.form||Nl(t),n=function(c){return r.querySelectorAll('input[type="radio"][name="'+c+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(t.name));else try{i=n(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var a=GP(i,t.form);return!a||a===t},HP=function(t){return HT(t)&&t.type==="radio"},VP=function(t){return HP(t)&&!WP(t)},KP=function(t){var r,n=t&&Nl(t),i=(r=n)===null||r===void 0?void 0:r.host,a=!1;if(n&&n!==t){var s,c,o;for(a=!!((s=i)!==null&&s!==void 0&&(c=s.ownerDocument)!==null&&c!==void 0&&c.contains(i)||t!=null&&(o=t.ownerDocument)!==null&&o!==void 0&&o.contains(t));!a&&i;){var u,l,f;n=Nl(i),i=(u=n)===null||u===void 0?void 0:u.host,a=!!((l=i)!==null&&l!==void 0&&(f=l.ownerDocument)!==null&&f!==void 0&&f.contains(i))}}return a},ky=function(t){var r=t.getBoundingClientRect(),n=r.width,i=r.height;return n===0&&i===0},JP=function(t,r){var n=r.displayCheck,i=r.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var a=os.call(t,"details>summary:first-of-type"),s=a?t.parentElement:t;if(os.call(s,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="legacy-full"){if(typeof i=="function"){for(var c=t;t;){var o=t.parentElement,u=Nl(t);if(o&&!o.shadowRoot&&i(o)===!0)return ky(t);t.assignedSlot?t=t.assignedSlot:!o&&u!==t.ownerDocument?t=u.host:t=o}t=c}if(KP(t))return!t.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return ky(t);return!1},YP=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var r=t.parentElement;r;){if(r.tagName==="FIELDSET"&&r.disabled){for(var n=0;n<r.children.length;n++){var i=r.children.item(n);if(i.tagName==="LEGEND")return os.call(r,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}r=r.parentElement}return!1},Ll=function(t,r){return!(r.disabled||Dl(r)||qP(r)||JP(r,t)||zP(r)||YP(r))},Sh=function(t,r){return!(VP(r)||ts(r)<0||!Ll(t,r))},XP=function(t){var r=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(r)||r>=0)},QP=function e(t){var r=[],n=[];return t.forEach(function(i,a){var s=!!i.scopeParent,c=s?i.scopeParent:i,o=UP(c,s),u=s?e(i.candidates):c;o===0?s?r.push.apply(r,u):r.push(c):n.push({documentOrder:a,tabIndex:o,item:i,isScope:s,content:u})}),n.sort(BP).reduce(function(i,a){return a.isScope?i.push.apply(i,a.content):i.push(a.content),i},[]).concat(r)},ZP=function(t,r){r=r||{};var n;return r.getShadowRoot?n=GT([t],r.includeContainer,{filter:Sh.bind(null,r),flatten:!1,getShadowRoot:r.getShadowRoot,shadowRootFilter:XP}):n=zT(t,r.includeContainer,Sh.bind(null,r)),QP(n)},eA=function(t,r){r=r||{};var n;return r.getShadowRoot?n=GT([t],r.includeContainer,{filter:Ll.bind(null,r),flatten:!0,getShadowRoot:r.getShadowRoot}):n=zT(t,r.includeContainer,Ll.bind(null,r)),n},ks=function(t,r){if(r=r||{},!t)throw new Error("No node provided");return os.call(t,xl)===!1?!1:Sh(r,t)},tA=BT.concat("iframe").join(","),hd=function(t,r){if(r=r||{},!t)throw new Error("No node provided");return os.call(t,tA)===!1?!1:Ll(r,t)};/*!
package/dist/index.mjs CHANGED
@@ -689,7 +689,7 @@ const AI = new TextDecoder(), MI = (e) => {
689
689
  }, xI = (e) => e.length === 0, NI = (...e) => e.every(xI), OT = (e) => {
690
690
  const t = RI.sanitize(e, $I);
691
691
  return t.includes(OI) ? (console.warn("Suspicious content detected and removed."), "") : t;
692
- }, Wte = "prod", IT = "3.42.2", py = "https://main.api.ujet.co", Vr = {
692
+ }, Wte = "prod", IT = "3.43.4", py = "https://main.api.ujet.co", Vr = {
693
693
  companyId: "",
694
694
  tenant: "",
695
695
  trackerId: "",
@@ -952,7 +952,7 @@ class HI {
952
952
  cobrowse: i,
953
953
  companyId: t.companyId,
954
954
  location: location.href,
955
- version: t.version || "3.42.2",
955
+ version: t.version || "3.43.4",
956
956
  bridge: a
957
957
  };
958
958
  }
@@ -1399,6 +1399,7 @@ const NT = [
1399
1399
  "va_dismissed"
1400
1400
  ], kP = [
1401
1401
  "queued",
1402
+ "check_in_timeout",
1402
1403
  ...NT,
1403
1404
  ...DT
1404
1405
  ], RP = [
@@ -1441,6 +1442,10 @@ class $P {
1441
1442
  t.triggerEvent("chat.typingStarted", n);
1442
1443
  }), this.on("typingEnded", (n) => {
1443
1444
  t.triggerEvent("chat.typingEnded", n);
1445
+ }), this.on("checkInRequired", () => {
1446
+ t.triggerEvent("chat.checkInRequested");
1447
+ }), this.on("checkInTimedOut", () => {
1448
+ t.triggerEvent("chat.checkInTimedOut");
1444
1449
  });
1445
1450
  }
1446
1451
  get id() {
@@ -1538,7 +1543,10 @@ class $P {
1538
1543
  }
1539
1544
  get checkInStatus() {
1540
1545
  var t;
1541
- return ((t = this.state) == null ? void 0 : t.check_in_status) || null;
1546
+ return ((t = this.state) == null ? void 0 : t.check_in_status) ?? null;
1547
+ }
1548
+ set checkInStatus(t) {
1549
+ this.state && (this.state.check_in_status = t);
1542
1550
  }
1543
1551
  update(t) {
1544
1552
  if (!this.state || this.state.id !== t.id)
@@ -1630,10 +1638,10 @@ class $P {
1630
1638
  this.inEscalation = !1;
1631
1639
  break;
1632
1640
  case "checkInRequired":
1633
- this.triggerEvent("checkInRequested");
1641
+ this.events.triggerEvent("checkInRequired");
1634
1642
  break;
1635
1643
  case "checkInTimedOut":
1636
- this.triggerEvent("checkInTimedOut");
1644
+ this.events.triggerEvent("checkInTimedOut");
1637
1645
  break;
1638
1646
  }
1639
1647
  }
@@ -1979,16 +1987,7 @@ class NP {
1979
1987
  i.allowSkipVirtualAgent = c, i.update(s);
1980
1988
  }
1981
1989
  };
1982
- if (i.channelId)
1983
- i.connect(), a(t);
1984
- else {
1985
- let s;
1986
- for (; !s; )
1987
- await this.getChat(i.id).then((c) => {
1988
- c.provider_channel_id && i.state ? (s = !0, i.update(c), i.connect(), a(c)) : (c.status === "canceled" || c.status === "finished") && (s = !0);
1989
- }), s || await $T(1500);
1990
- }
1991
- return i.on("initialized", async () => {
1990
+ if (i.on("initialized", async () => {
1992
1991
  if (i.status === "queued") {
1993
1992
  const s = await this.getChat(i.id);
1994
1993
  i.update(s);
@@ -2005,7 +2004,22 @@ class NP {
2005
2004
  }), i.on("_menuChanged", async (s) => {
2006
2005
  const c = await this.getChat(s.id);
2007
2006
  a(c);
2008
- }), i;
2007
+ }), i.on("checkInRequired", async () => {
2008
+ const s = await this.getChat(i.id);
2009
+ i.update(s);
2010
+ }), i.on("checkInTimedOut", async () => {
2011
+ const s = await this.getChat(i.id);
2012
+ i.update(s);
2013
+ }), i.channelId)
2014
+ i.connect(), a(t);
2015
+ else {
2016
+ let s;
2017
+ for (; !s; )
2018
+ await this.getChat(i.id).then((c) => {
2019
+ c.provider_channel_id && i.state ? (s = !0, i.update(c), i.connect(), a(c)) : (c.status === "canceled" || c.status === "finished") && (s = !0);
2020
+ }), s || await $T(1500);
2021
+ }
2022
+ return i;
2009
2023
  }
2010
2024
  async createCall(t, r, n) {
2011
2025
  const i = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ujet/websdk-headless",
3
- "version": "3.42.2",
3
+ "version": "3.43.4",
4
4
  "types": "dist/index.d.ts",
5
5
  "files": [
6
6
  "dist/index.mjs",