@robylon/web-react-sdk 1.1.55-alpha.4 → 2.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).RobylonChatbot={})}(this,(function(t){"use strict";var i,n,e,o,r,a,l,s,d=function(){return d=Object.assign||function(t){for(var i,n=1,e=arguments.length;e>n;n++)for(var o in i=arguments[n])({}).hasOwnProperty.call(i,o)&&(t[o]=i[o]);return t},d.apply(this,arguments)};function u(t,i,n,e){return new(n||(n=Promise))((function(o,r){function a(t){try{s(e.next(t))}catch(t){r(t)}}function l(t){try{s(e.throw(t))}catch(t){r(t)}}function s(t){var i;t.done?o(t.value):(i=t.value,i instanceof n?i:new n((function(t){t(i)}))).then(a,l)}s((e=e.apply(t,i||[])).next())}))}function c(t,i){var n,e,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,e&&(o=2&l[0]?e.return:l[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,l[1])).done)return o;switch(e=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,e=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){r=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(6===l[0]&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=i.call(t,r)}catch(t){l=[6,t],e=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}}function f(t,i,n){if(n||2===arguments.length)for(var e,o=0,r=i.length;r>o;o++)!e&&o in i||(e||(e=[].slice.call(i,0,o)),e[o]=i[o]);return t.concat(e||[].slice.call(i))}"function"==typeof SuppressedError&&SuppressedError,function(t){t.WIDGET="WIDGET",t.POPOVER="POPOVER",t.EMBED="EMBED"}(i||(i={})),function(t){t.RIGHT="Right",t.LEFT="Left"}(n||(n={})),function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.TEXTUAL_IMAGE="TEXTUAL_IMAGE"}(e||(e={})),function(t){t.WORKING_HOURS="WORKING_HOURS",t.ALWAYS="ALWAYS"}(o||(o={})),function(t){t.URL="URL"}(r||(r={})),function(t){t.AND="AND",t.OR="OR"}(a||(a={})),function(t){t.IS="IS",t.IS_NOT="IS_NOT",t.CONTAINS="CONTAINS",t.DOES_NOT_CONTAIN="DOES_NOT_CONTAIN",t.STARTS_WITH="STARTS_WITH",t.ENDS_WITH="ENDS_WITH"}(l||(l={})),function(t){t.BUTTON="BUTTON",t.TEXT="TEXT"}(s||(s={}));var v=function(t,i){void 0===i&&(i=.5);var n,e,o,r,a=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,i,n,e){return i+i+n+n+e+e}));var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:{r:0,g:0,b:0}}(t);return(n=a.r,e=a.g,o=a.b,.2126*(r=[n,e,o].map((function(t){return(t/=255)>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92})))[0]+.7152*r[1]+.0722*r[2])>i?"#0E0E0F":"#FFFFFF"},h={log:function(){for(var t=[],i=0;arguments.length>i;i++)t[i]=arguments[i];console.log.apply(console,t)},error:function(){for(var t=[],i=0;arguments.length>i;i++)t[i]=arguments[i];console.error.apply(console,t)},warn:function(){for(var t=[],i=0;arguments.length>i;i++)t[i]=arguments[i];console.warn.apply(console,t)},info:function(){}};h.log("Raw API_URL:","https://api.robylon.ai");var p={copilotUrl:"https://dev.chatbot.robylon.ai",environment:"production",apiUrl:"https://api.robylon.ai"};h.log("CONFIG",p);var m,g,b=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},w=function(){return{copilotUrl:p.copilotUrl||"https://app.robylon.ai",environment:p.environment||"production",apiUrl:p.apiUrl||"https://app.robylon.ai"}};!function(t){t.CHATBOT_BUTTON_LOADED="CHATBOT_BUTTON_LOADED",t.CHATBOT_BUTTON_CLICKED="CHATBOT_BUTTON_CLICKED",t.CHATBOT_OPENED="CHATBOT_OPENED",t.CHATBOT_CLOSED="CHATBOT_CLOSED",t.CHATBOT_APP_READY="CHATBOT_APP_READY",t.CHATBOT_LOADED="CHATBOT_LOADED",t.CHAT_INITIALIZED="CHAT_INITIALIZED",t.SESSION_REFRESHED="SESSION_REFRESHED",t.CHAT_INITIALIZATION_FAILED="CHAT_INITIALIZATION_FAILED",t.CHATBOT_READY="CHATBOT_READY"}(m||(m={})),function(t){t.CHAT_MOVED="CHAT_MOVED",t.CHATBOT_TOKEN_EXHAUSTED="CHATBOT_TOKEN_EXHAUSTED"}(g||(g={}));var y,x="system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",_="21px",I="",T=[],E=!1,S=function(){return"undefined"==typeof window?"":window.location.href},A=function(){return S()},k=function(){var t=S();t!==I&&(I=t,T.forEach((function(i){return i(t)})))},R=function(t,i,n,e){var o=i||"",r=S(),a=e||r,s=function(t,i){return-1!==i.indexOf(t)}(o,a);switch(n){case l.IS:return a===o;case l.IS_NOT:return a!==o;case l.CONTAINS:return s;case l.DOES_NOT_CONTAIN:return!s;case l.STARTS_WITH:return a.startsWith(o);case l.ENDS_WITH:return a.endsWith(o);default:return!1}},O=null,D=null,C=function(){return O===A()},z=function(){var t=D;return D=null,t},M=function(){return!0},F=((y={})[o.WORKING_HOURS]=function(t,i){var n=i.getHours(),e=i.getMinutes();return(n>10||10===n&&e>=0)&&(19>n||19===n&&0===e)},y[o.ALWAYS]=M,y);const{entries:N,setPrototypeOf:j,isFrozen:L,getPrototypeOf:U,getOwnPropertyDescriptor:P}=Object;let{freeze:W,seal:B,create:H}=Object,{apply:Y,construct:X}="undefined"!=typeof Reflect&&Reflect;W||(W=function(t){return t}),B||(B=function(t){return t}),Y||(Y=function(t,i){for(var n=arguments.length,e=Array(n>2?n-2:0),o=2;n>o;o++)e[o-2]=arguments[o];return t.apply(i,e)}),X||(X=function(t){for(var i=arguments.length,n=Array(i>1?i-1:0),e=1;i>e;e++)n[e-1]=arguments[e];return new t(...n)});const G=lt([].forEach),J=lt([].lastIndexOf),V=lt([].pop),K=lt([].push),Z=lt([].splice),q=lt("".toLowerCase),Q=lt("".toString),$=lt("".match),tt=lt("".replace),it=lt("".indexOf),nt=lt("".trim),et=lt({}.hasOwnProperty),ot=lt(/t/.test),rt=(at=TypeError,function(){for(var t=arguments.length,i=Array(t),n=0;t>n;n++)i[n]=arguments[n];return X(at,i)});var at;function lt(t){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var n=arguments.length,e=Array(n>1?n-1:0),o=1;n>o;o++)e[o-1]=arguments[o];return Y(t,i,e)}}function st(t,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:q;j&&j(t,null);let e=i.length;for(;e--;){let o=i[e];if("string"==typeof o){const t=n(o);t!==o&&(L(i)||(i[e]=t),o=t)}t[o]=!0}return t}function dt(t){for(let i=0;i<t.length;i++)et(t,i)||(t[i]=null);return t}function ut(t){const i=H(null);for(const[n,e]of N(t))et(t,n)&&(Array.isArray(e)?i[n]=dt(e):e&&"object"==typeof e&&e.constructor===Object?i[n]=ut(e):i[n]=e);return i}function ct(t,i){for(;null!==t;){const n=P(t,i);if(n){if(n.get)return lt(n.get);if("function"==typeof n.value)return lt(n.value)}t=U(t)}return function(){return null}}const ft=W(["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"]),vt=W(["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"]),ht=W(["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"]),pt=W(["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"]),mt=W(["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"]),gt=W(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bt=W(["#text"]),wt=W(["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"]),yt=W(["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"]),xt=W(["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"]),_t=W(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),It=B(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Tt=B(/<%[\w\W]*|[\w\W]*%>/gm),Et=B(/\$\{[\w\W]*/gm),St=B(/^data-[\-\w.\u00B7-\uFFFF]+$/),At=B(/^aria-[\-\w]+$/),kt=B(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Rt=B(/^(?:\w+script|data):/i),Ot=B(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Dt=B(/^html$/i),Ct=B(/^[a-z][.\w]*(-[.\w]+)+$/i);var zt=Object.freeze({__proto__:null,ARIA_ATTR:At,ATTR_WHITESPACE:Ot,CUSTOM_ELEMENT:Ct,DATA_ATTR:St,DOCTYPE_NAME:Dt,ERB_EXPR:Tt,IS_ALLOWED_URI:kt,IS_SCRIPT_OR_DATA:Rt,MUSTACHE_EXPR:It,TMPLIT_EXPR:Et});const Mt=function(){return"undefined"==typeof window?null:window};var Ft,Nt=function t(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Mt();const n=i=>t(i);if(n.version="3.3.0",n.removed=[],!i||!i.document||9!==i.document.nodeType||!i.Element)return n.isSupported=!1,n;let{document:e}=i;const o=e,r=o.currentScript,{DocumentFragment:a,HTMLTemplateElement:l,Node:s,Element:d,NodeFilter:u,NamedNodeMap:c=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:f,DOMParser:v,trustedTypes:h}=i,p=d.prototype,m=ct(p,"cloneNode"),g=ct(p,"remove"),b=ct(p,"nextSibling"),w=ct(p,"childNodes"),y=ct(p,"parentNode");if("function"==typeof l){const t=e.createElement("template");t.content&&t.content.ownerDocument&&(e=t.content.ownerDocument)}let x,_="";const{implementation:I,createNodeIterator:T,createDocumentFragment:E,getElementsByTagName:S}=e,{importNode:A}=o;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof N&&"function"==typeof y&&I&&void 0!==I.createHTMLDocument;const{MUSTACHE_EXPR:R,ERB_EXPR:O,TMPLIT_EXPR:D,DATA_ATTR:C,ARIA_ATTR:z,IS_SCRIPT_OR_DATA:M,ATTR_WHITESPACE:F,CUSTOM_ELEMENT:j}=zt;let{IS_ALLOWED_URI:L}=zt,U=null;const P=st({},[...ft,...vt,...ht,...mt,...bt]);let B=null;const Y=st({},[...wt,...yt,...xt,..._t]);let X=Object.seal(H(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}})),at=null,lt=null;const dt=Object.seal(H(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let It=!0,Tt=!0,Et=!1,St=!0,At=!1,Rt=!0,Ot=!1,Ct=!1,Ft=!1,Nt=!1,jt=!1,Lt=!1,Ut=!0,Pt=!1,Wt=!0,Bt=!1,Ht={},Yt=null;const Xt=st({},["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 Gt=null;const Jt=st({},["audio","video","img","source","image","track"]);let Vt=null;const Kt=st({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Zt="http://www.w3.org/1998/Math/MathML",qt="http://www.w3.org/2000/svg",Qt="http://www.w3.org/1999/xhtml";let $t=Qt,ti=!1,ii=null;const ni=st({},[Zt,qt,Qt],Q);let ei=st({},["mi","mo","mn","ms","mtext"]),oi=st({},["annotation-xml"]);const ri=st({},["title","style","font","a","script"]);let ai=null;const li=["application/xhtml+xml","text/html"];let si=null,di=null;const ui=e.createElement("form"),ci=function(t){return t instanceof RegExp||t instanceof Function},fi=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!di||di!==t){if(t&&"object"==typeof t||(t={}),t=ut(t),ai=-1===li.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,si="application/xhtml+xml"===ai?Q:q,U=et(t,"ALLOWED_TAGS")?st({},t.ALLOWED_TAGS,si):P,B=et(t,"ALLOWED_ATTR")?st({},t.ALLOWED_ATTR,si):Y,ii=et(t,"ALLOWED_NAMESPACES")?st({},t.ALLOWED_NAMESPACES,Q):ni,Vt=et(t,"ADD_URI_SAFE_ATTR")?st(ut(Kt),t.ADD_URI_SAFE_ATTR,si):Kt,Gt=et(t,"ADD_DATA_URI_TAGS")?st(ut(Jt),t.ADD_DATA_URI_TAGS,si):Jt,Yt=et(t,"FORBID_CONTENTS")?st({},t.FORBID_CONTENTS,si):Xt,at=et(t,"FORBID_TAGS")?st({},t.FORBID_TAGS,si):ut({}),lt=et(t,"FORBID_ATTR")?st({},t.FORBID_ATTR,si):ut({}),Ht=!!et(t,"USE_PROFILES")&&t.USE_PROFILES,It=!1!==t.ALLOW_ARIA_ATTR,Tt=!1!==t.ALLOW_DATA_ATTR,Et=t.ALLOW_UNKNOWN_PROTOCOLS||!1,St=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,At=t.SAFE_FOR_TEMPLATES||!1,Rt=!1!==t.SAFE_FOR_XML,Ot=t.WHOLE_DOCUMENT||!1,Nt=t.RETURN_DOM||!1,jt=t.RETURN_DOM_FRAGMENT||!1,Lt=t.RETURN_TRUSTED_TYPE||!1,Ft=t.FORCE_BODY||!1,Ut=!1!==t.SANITIZE_DOM,Pt=t.SANITIZE_NAMED_PROPS||!1,Wt=!1!==t.KEEP_CONTENT,Bt=t.IN_PLACE||!1,L=t.ALLOWED_URI_REGEXP||kt,$t=t.NAMESPACE||Qt,ei=t.MATHML_TEXT_INTEGRATION_POINTS||ei,oi=t.HTML_INTEGRATION_POINTS||oi,X=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&ci(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(X.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&ci(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(X.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(X.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),At&&(Tt=!1),jt&&(Nt=!0),Ht&&(U=st({},bt),B=[],!0===Ht.html&&(st(U,ft),st(B,wt)),!0===Ht.svg&&(st(U,vt),st(B,yt),st(B,_t)),!0===Ht.svgFilters&&(st(U,ht),st(B,yt),st(B,_t)),!0===Ht.mathMl&&(st(U,mt),st(B,xt),st(B,_t))),t.ADD_TAGS&&("function"==typeof t.ADD_TAGS?dt.tagCheck=t.ADD_TAGS:(U===P&&(U=ut(U)),st(U,t.ADD_TAGS,si))),t.ADD_ATTR&&("function"==typeof t.ADD_ATTR?dt.attributeCheck=t.ADD_ATTR:(B===Y&&(B=ut(B)),st(B,t.ADD_ATTR,si))),t.ADD_URI_SAFE_ATTR&&st(Vt,t.ADD_URI_SAFE_ATTR,si),t.FORBID_CONTENTS&&(Yt===Xt&&(Yt=ut(Yt)),st(Yt,t.FORBID_CONTENTS,si)),Wt&&(U["#text"]=!0),Ot&&st(U,["html","head","body"]),U.table&&(st(U,["tbody"]),delete at.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw rt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw rt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=t.TRUSTED_TYPES_POLICY,_=x.createHTML("")}else void 0===x&&(x=function(t,i){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let n=null;const e="data-tt-policy-suffix";i&&i.hasAttribute(e)&&(n=i.getAttribute(e));const o="dompurify"+(n?"#"+n:"");try{return t.createPolicy(o,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(h,r)),null!==x&&"string"==typeof _&&(_=x.createHTML(""));W&&W(t),di=t}},vi=st({},[...vt,...ht,...pt]),hi=st({},[...mt,...gt]),pi=function(t){K(n.removed,{element:t});try{y(t).removeChild(t)}catch(i){g(t)}},mi=function(t,i){try{K(n.removed,{attribute:i.getAttributeNode(t),from:i})}catch(t){K(n.removed,{attribute:null,from:i})}if(i.removeAttribute(t),"is"===t)if(Nt||jt)try{pi(i)}catch(t){}else try{i.setAttribute(t,"")}catch(t){}},gi=function(t){let i=null,n=null;if(Ft)t="<remove></remove>"+t;else{const i=$(t,/^[\r\n\t ]+/);n=i&&i[0]}"application/xhtml+xml"===ai&&$t===Qt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const o=x?x.createHTML(t):t;if($t===Qt)try{i=(new v).parseFromString(o,ai)}catch(t){}if(!i||!i.documentElement){i=I.createDocument($t,"template",null);try{i.documentElement.innerHTML=ti?_:o}catch(t){}}const r=i.body||i.documentElement;return t&&n&&r.insertBefore(e.createTextNode(n),r.childNodes[0]||null),$t===Qt?S.call(i,Ot?"html":"body")[0]:Ot?i.documentElement:r},bi=function(t){return T.call(t.ownerDocument||t,t,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},wi=function(t){return t instanceof f&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof c)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes)},yi=function(t){return"function"==typeof s&&t instanceof s};function xi(t,i,e){G(t,(t=>{t.call(n,i,e,di)}))}const _i=function(t){let i=null;if(xi(k.beforeSanitizeElements,t,null),wi(t))return pi(t),!0;const e=si(t.nodeName);if(xi(k.uponSanitizeElement,t,{tagName:e,allowedTags:U}),Rt&&t.hasChildNodes()&&!yi(t.firstElementChild)&&ot(/<[/\w!]/g,t.innerHTML)&&ot(/<[/\w!]/g,t.textContent))return pi(t),!0;if(7===t.nodeType)return pi(t),!0;if(Rt&&8===t.nodeType&&ot(/<[/\w]/g,t.data))return pi(t),!0;if(!(dt.tagCheck instanceof Function&&dt.tagCheck(e))&&(!U[e]||at[e])){if(!at[e]&&Ti(e)){if(X.tagNameCheck instanceof RegExp&&ot(X.tagNameCheck,e))return!1;if(X.tagNameCheck instanceof Function&&X.tagNameCheck(e))return!1}if(Wt&&!Yt[e]){const i=y(t)||t.parentNode,n=w(t)||t.childNodes;if(n&&i)for(let e=n.length-1;e>=0;--e){const o=m(n[e],!0);o.t=(t.t||0)+1,i.insertBefore(o,b(t))}}return pi(t),!0}return t instanceof d&&!function(t){let i=y(t);i&&i.tagName||(i={namespaceURI:$t,tagName:"template"});const n=q(t.tagName),e=q(i.tagName);return!!ii[t.namespaceURI]&&(t.namespaceURI===qt?i.namespaceURI===Qt?"svg"===n:i.namespaceURI===Zt?"svg"===n&&("annotation-xml"===e||ei[e]):!!vi[n]:t.namespaceURI===Zt?i.namespaceURI===Qt?"math"===n:i.namespaceURI===qt?"math"===n&&oi[e]:!!hi[n]:t.namespaceURI===Qt?!(i.namespaceURI===qt&&!oi[e])&&!(i.namespaceURI===Zt&&!ei[e])&&!hi[n]&&(ri[n]||!vi[n]):!("application/xhtml+xml"!==ai||!ii[t.namespaceURI]))}(t)?(pi(t),!0):"noscript"!==e&&"noembed"!==e&&"noframes"!==e||!ot(/<\/no(script|embed|frames)/i,t.innerHTML)?(At&&3===t.nodeType&&(i=t.textContent,G([R,O,D],(t=>{i=tt(i,t," ")})),t.textContent!==i&&(K(n.removed,{element:t.cloneNode()}),t.textContent=i)),xi(k.afterSanitizeElements,t,null),!1):(pi(t),!0)},Ii=function(t,i,n){if(Ut&&("id"===i||"name"===i)&&(n in e||n in ui))return!1;if(Tt&&!lt[i]&&ot(C,i));else if(It&&ot(z,i));else if(dt.attributeCheck instanceof Function&&dt.attributeCheck(i,t));else if(!B[i]||lt[i]){if(!(Ti(t)&&(X.tagNameCheck instanceof RegExp&&ot(X.tagNameCheck,t)||X.tagNameCheck instanceof Function&&X.tagNameCheck(t))&&(X.attributeNameCheck instanceof RegExp&&ot(X.attributeNameCheck,i)||X.attributeNameCheck instanceof Function&&X.attributeNameCheck(i,t))||"is"===i&&X.allowCustomizedBuiltInElements&&(X.tagNameCheck instanceof RegExp&&ot(X.tagNameCheck,n)||X.tagNameCheck instanceof Function&&X.tagNameCheck(n))))return!1}else if(Vt[i]);else if(ot(L,tt(n,F,"")));else if("src"!==i&&"xlink:href"!==i&&"href"!==i||"script"===t||0!==it(n,"data:")||!Gt[t])if(Et&&!ot(M,tt(n,F,"")));else if(n)return!1;return!0},Ti=function(t){return"annotation-xml"!==t&&$(t,j)},Ei=function(t){xi(k.beforeSanitizeAttributes,t,null);const{attributes:i}=t;if(!i||wi(t))return;const e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0};let o=i.length;for(;o--;){const r=i[o],{name:a,namespaceURI:l,value:s}=r,d=si(a),u=s;let c="value"===a?u:nt(u);if(e.attrName=d,e.attrValue=c,e.keepAttr=!0,e.forceKeepAttr=void 0,xi(k.uponSanitizeAttribute,t,e),c=e.attrValue,!Pt||"id"!==d&&"name"!==d||(mi(a,t),c="user-content-"+c),Rt&&ot(/((--!?|])>)|<\/(style|title|textarea)/i,c)){mi(a,t);continue}if("attributename"===d&&$(c,"href")){mi(a,t);continue}if(e.forceKeepAttr)continue;if(!e.keepAttr){mi(a,t);continue}if(!St&&ot(/\/>/i,c)){mi(a,t);continue}At&&G([R,O,D],(t=>{c=tt(c,t," ")}));const f=si(t.nodeName);if(Ii(f,d,c)){if(x&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(l);else switch(h.getAttributeType(f,d)){case"TrustedHTML":c=x.createHTML(c);break;case"TrustedScriptURL":c=x.createScriptURL(c)}if(c!==u)try{l?t.setAttributeNS(l,a,c):t.setAttribute(a,c),wi(t)?pi(t):V(n.removed)}catch(i){mi(a,t)}}else mi(a,t)}xi(k.afterSanitizeAttributes,t,null)},Si=function t(i){let n=null;const e=bi(i);for(xi(k.beforeSanitizeShadowDOM,i,null);n=e.nextNode();)xi(k.uponSanitizeShadowNode,n,null),_i(n),Ei(n),n.content instanceof a&&t(n.content);xi(k.afterSanitizeShadowDOM,i,null)};return n.sanitize=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=null,r=null,l=null,d=null;if(ti=!t,ti&&(t="\x3c!--\x3e"),"string"!=typeof t&&!yi(t)){if("function"!=typeof t.toString)throw rt("toString is not a function");if("string"!=typeof(t=t.toString()))throw rt("dirty is not a string, aborting")}if(!n.isSupported)return t;if(Ct||fi(i),n.removed=[],"string"==typeof t&&(Bt=!1),Bt){if(t.nodeName){const i=si(t.nodeName);if(!U[i]||at[i])throw rt("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof s)e=gi("\x3c!----\x3e"),r=e.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?e=r:e.appendChild(r);else{if(!Nt&&!At&&!Ot&&-1===t.indexOf("<"))return x&&Lt?x.createHTML(t):t;if(e=gi(t),!e)return Nt?null:Lt?_:""}e&&Ft&&pi(e.firstChild);const u=bi(Bt?t:e);for(;l=u.nextNode();)_i(l),Ei(l),l.content instanceof a&&Si(l.content);if(Bt)return t;if(Nt){if(jt)for(d=E.call(e.ownerDocument);e.firstChild;)d.appendChild(e.firstChild);else d=e;return(B.shadowroot||B.shadowrootmode)&&(d=A.call(o,d,!0)),d}let c=Ot?e.outerHTML:e.innerHTML;return Ot&&U["!doctype"]&&e.ownerDocument&&e.ownerDocument.doctype&&e.ownerDocument.doctype.name&&ot(Dt,e.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+e.ownerDocument.doctype.name+">\n"+c),At&&G([R,O,D],(t=>{c=tt(c,t," ")})),x&&Lt?x.createHTML(c):c},n.setConfig=function(){fi(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ct=!0},n.clearConfig=function(){di=null,Ct=!1},n.isValidAttribute=function(t,i,n){di||fi({});const e=si(t),o=si(i);return Ii(e,o,n)},n.addHook=function(t,i){"function"==typeof i&&K(k[t],i)},n.removeHook=function(t,i){if(void 0!==i){const n=J(k[t],i);return-1===n?void 0:Z(k[t],n,1)[0]}return V(k[t])},n.removeHooks=function(t){k[t]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),jt=function(){function t(t){var i,n=this;this.resizeObserver=null,this.proactiveElement=null,this.urlUnsubscribe=null,this.delayTimers=[],this.config=t,this.buttonElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.render(),this.mount();try{this.buttonElement.style.opacity="0",this.buttonElement.style.transition="transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",requestAnimationFrame((function(){n.buttonElement.style.opacity="1"}))}catch(t){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=(i=function(){n.clearProactiveDelays(),n.renderProactiveIfNeeded(!0)},E||function(){if(!E&&"undefined"!=typeof window){E=!0,I=S();var t=function(t){var i=history[t];return function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];var e=i.apply(this,t);return setTimeout(k,0),e}};try{history.pushState=t("pushState"),history.replaceState=t("replaceState")}catch(t){}window.addEventListener("popstate",k),window.addEventListener("hashchange",k);var i=setInterval((function(){k()}),1e3);setInterval((function(){0===T.length&&(clearInterval(i),window.removeEventListener("popstate",k),window.removeEventListener("hashchange",k),E=!1)}),5e3)}}(),T.push(i),i(S()),function(){var t=T.indexOf(i);t>-1&&T.splice(t,1)})}return t.prototype.render=function(){var t,i,n=this;w().copilotUrl;var o=this.config,r=o.config,a=o.isIframeVisible,l=null!==(t=null==r?void 0:r.launcher_size_multiplier)&&void 0!==t?t:1,s=null!==(i=this.config.launcher_size)&&void 0!==i?i:48*l,d={zIndex:"1000",display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97)",transform:a?"scale(0.85)":"scale(1)",fontFamily:x};r.launcher_type===e.IMAGE&&Object.assign(d,{width:"".concat(s,"px"),height:"".concat(s,"px"),borderRadius:"50%",backgroundColor:r.brand_colour}),this.applyResponsiveStyles(d),this.buttonElement.className="message-bubble-container",this.buttonElement.innerHTML="",this.buttonElement.appendChild(this.createLauncherElement()),this.buttonElement.onclick=function(){n.config.toggleIframe(),n.hideProactiveMessages()},this.renderProactiveIfNeeded()},t.prototype.createLauncherElement=function(){var t,i,n,o,r=this.config,a=r.config,l=r.isIframeVisible,s=w().copilotUrl,d=null!==(t=null==a?void 0:a.launcher_size_multiplier)&&void 0!==t?t:1,u=null!==(i=this.config.launcher_size)&&void 0!==i?i:48*d;switch(console.log("config in floating button",a),a.launcher_type){case e.TEXT:return this.createTextLauncher();case e.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case e.IMAGE:default:if(l){var c=Math.round(.5*u),f=document.createElement("div");Object.assign(f.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});var v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.setAttribute("width",c+""),v.setAttribute("height",c+""),v.setAttribute("viewBox","0 0 24 24"),v.setAttribute("fill","none"),v.setAttribute("xmlns","http://www.w3.org/2000/svg"),v.style.display="block";var h=document.createElementNS("http://www.w3.org/2000/svg","path");return h.setAttribute("d","M19 9L12 16L5 9"),h.setAttribute("stroke","currentColor"),h.setAttribute("stroke-width","1.5"),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round"),v.appendChild(h),f.appendChild(v),f}var p=document.createElement("img");return p.src=a.launcher_type?(null===(o=null===(n=a.images)||void 0===n?void 0:n.launcher_image_url)||void 0===o?void 0:o.url)||"".concat(s,"/chatbubble.png"):a.image_url||"".concat(s,"/chatbubble.png"),p.alt="Chat",Object.assign(p.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box"}),p}},t.prototype.createTextLauncher=function(){var t=this.config.config,i=t.brand_colour,n=t.launcher_properties,e=t.launcher_size_multiplier,o=null!=e?e:1,r=void 0!==this.config.launcher_size?void 0:160*o,a=void 0!==this.config.launcher_size?void 0:40*o,l=void 0!==this.config.launcher_size?void 0:14*o,s=void 0!==this.config.launcher_size?void 0:21*o,d=document.createElement("div");Object.assign(d.style,{width:void 0!==r?"".concat(r,"px"):"fit-content",maxWidth:void 0!==r?"".concat(r,"px"):"160px",height:void 0!==a?"".concat(a,"px"):"40px",borderRadius:"9999px",backgroundColor:i,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box"});var u=document.createElement("div");Object.assign(u.style,{flex:"1",minWidth:"0"});var c=document.createElement("p");return Object.assign(c.style,{margin:"0",color:v(i),fontSize:void 0!==l?"".concat(l,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==s?"".concat(s,"px"):_,fontFamily:x,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),c.textContent=(null==n?void 0:n.text)||"",u.appendChild(c),d.appendChild(u),d},t.prototype.createTextualImageLauncher=function(){var t,i,n,e,o,r,a=w().copilotUrl,l=this.config.config,s=l.brand_colour,d=l.launcher_properties,u=l.image_url,c=l.launcher_size_multiplier,f=null!=c?c:1,h=void 0!==this.config.launcher_size?void 0:174*f,p=void 0!==this.config.launcher_size?void 0:40*f,m=void 0!==this.config.launcher_size?void 0:40*f,g=void 0!==this.config.launcher_size?void 0:14*f,b=void 0!==this.config.launcher_size?void 0:21*f,y=document.createElement("div");Object.assign(y.style,{maxWidth:void 0!==h?"".concat(h,"px"):"13rem",width:"fit-content",height:void 0!==p?"".concat(p,"px"):"40px",borderRadius:"9999px",backgroundColor:s,display:"flex",alignItems:"center",paddingLeft:"20px",paddingRight:"0",paddingTop:"9px",paddingBottom:"9px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",gap:"8px",boxSizing:"border-box"});var I=document.createElement("div");Object.assign(I.style,{flex:"1",minWidth:"0"});var T=document.createElement("p");Object.assign(T.style,{margin:"0",color:v(s),fontSize:void 0!==g?"".concat(g,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==b?"".concat(b,"px"):_,fontFamily:x,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),T.textContent=(null==d?void 0:d.text)||"";var E=document.createElement("div");Object.assign(E.style,{width:void 0!==m?"".concat(m,"px"):"40px",height:void 0!==m?"".concat(m,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var S=document.createElement("img");return S.src=(null===(i=null===(t=null==this?void 0:this.config)||void 0===t?void 0:t.config)||void 0===i?void 0:i.launcher_type)?(null===(r=null===(o=null===(e=null===(n=null==this?void 0:this.config)||void 0===n?void 0:n.config)||void 0===e?void 0:e.images)||void 0===o?void 0:o.launcher_image_url)||void 0===r?void 0:r.url)||"".concat(a,"/chatbubble.png"):u||"".concat(a,"/chatbubble.png"),S.alt="Chat",Object.assign(S.style,{width:"100%",height:"100%",objectFit:"cover"}),I.appendChild(T),E.appendChild(S),y.appendChild(I),y.appendChild(E),y},t.prototype.applyResponsiveStyles=function(t){var i,n,e,o,r,a,l,s,u,c=560>(null===window||void 0===window?void 0:window.innerWidth),f=this.config.config,v=this.config.position||(null===(e=f.interface_properties)||void 0===e?void 0:e.position)||"Right",h=null!==(a=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(r=f.interface_properties)||void 0===r?void 0:r.side_spacing)&&void 0!==a?a:20,p=null!==(u=null!==(l=this.config.bottomSpacing)&&void 0!==l?l:null===(s=f.interface_properties)||void 0===s?void 0:s.bottom_spacing)&&void 0!==u?u:20;this.buttonElement.style.position="",this.buttonElement.style.bottom="",this.buttonElement.style.right="",this.buttonElement.style.left="";var m=d(d({},t),c?((i={position:"fixed",bottom:"".concat(p,"px")})[v.toLowerCase()]="".concat(h,"px"),i):((n={bottom:"".concat(p,"px")})[v.toLowerCase()]="".concat(h,"px"),n));Object.assign(this.buttonElement.style,m)},t.prototype.handleResize=function(){var t,i,n,o=null!==(i=null===(t=this.config.config)||void 0===t?void 0:t.launcher_size_multiplier)&&void 0!==i?i:1,r=null!==(n=this.config.launcher_size)&&void 0!==n?n:48*o,a={zIndex:"1000",display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",borderRadius:this.config.config.launcher_type&&this.config.config.launcher_type!==e.IMAGE?"9999px":"50%",boxSizing:"border-box"};this.config.config.launcher_type===e.IMAGE&&Object.assign(a,{width:"".concat(r,"px"),height:"".concat(r,"px"),borderRadius:"50%",backgroundColor:this.config.config.brand_colour}),this.applyResponsiveStyles(a)},t.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},t.prototype.getElement=function(){return this.buttonElement},t.prototype.mount=function(){var t=this;requestAnimationFrame((function(){var i,n;null===(n=(i=t.config).onEvent)||void 0===n||n.call(i,{type:m.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),t.config.onInternalEvent(m.CHATBOT_BUTTON_LOADED)}))},t.prototype.update=function(t){this.config.isIframeVisible,this.config=d(d({},this.config),t),this.buttonElement.style.transform=this.config.isIframeVisible?"scale(0.85)":"scale(1)",this.render(),this.renderProactiveIfNeeded()},t.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.buttonElement&&this.buttonElement.parentNode&&this.buttonElement.parentNode.removeChild(this.buttonElement),this.proactiveElement&&this.proactiveElement.parentElement&&(this.proactiveElement.parentElement.removeChild(this.proactiveElement),this.proactiveElement=null),this.clearProactiveDelays(),this.urlUnsubscribe&&(this.urlUnsubscribe(),this.urlUnsubscribe=null)},t.prototype.clearProactiveDelays=function(){this.delayTimers.forEach((function(t){return clearTimeout(t)})),this.delayTimers=[]},t.prototype.hideProactiveMessages=function(){var t,i,n=this;O=A();var e=null===(t=this.proactiveElement)||void 0===t?void 0:t.children[0];if(e){var o="Right"===(this.config.position||(null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.position)||"Right");Array.from(e.children).forEach((function(t){t.className=o?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){n.proactiveElement&&n.proactiveElement.parentElement&&n.proactiveElement.parentElement.removeChild(n.proactiveElement),n.proactiveElement=null,n.clearProactiveDelays()}),400)}else this.clearProactiveDelays()},t.prototype.injectAnimationStyles=function(){if(!document.getElementById("rblyn-proactive-animations")){var t=document.createElement("style");t.id="rblyn-proactive-animations",t.textContent="\n @keyframes slideInFromRight {\n 0% {\n transform: translateX(120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(-1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideInFromLeft {\n 0% {\n transform: translateX(-120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideOutRight {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(120%) scale(0.9);\n opacity: 0;\n }\n }\n @keyframes slideOutLeft {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(-120%) scale(0.9);\n opacity: 0;\n }\n }\n .rblyn-proactive-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-exit-right {\n animation: slideOutRight 0.4s ease-in forwards;\n }\n .rblyn-proactive-exit-left {\n animation: slideOutLeft 0.4s ease-in forwards;\n }\n .rblyn-proactive-close-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-close-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n /* Reset styles for proactive message content to prevent website CSS interference */\n /* Only target children of the content wrapper, not the bubble container itself */\n .rblyn-proactive-message-content * {\n box-sizing: border-box !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n background: transparent;\n font-family: ".concat(x,' !important;\n font-size: inherit !important;\n font-weight: inherit !important;\n line-height: inherit !important;\n color: inherit;\n text-align: inherit;\n list-style: none;\n }\n .rblyn-proactive-message-content p,\n .rblyn-proactive-message-content div,\n .rblyn-proactive-message-content span {\n display: inline !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n .rblyn-proactive-message-content p:first-child,\n .rblyn-proactive-message-content div:first-child,\n .rblyn-proactive-message-content span:first-child {\n margin-top: 0 !important;\n }\n .rblyn-proactive-message-content p:last-child,\n .rblyn-proactive-message-content div:last-child,\n .rblyn-proactive-message-content span:last-child {\n margin-bottom: 0 !important;\n }\n .rblyn-proactive-message-content a {\n color: inherit !important;\n text-decoration: underline !important;\n cursor: pointer !important;\n }\n .rblyn-proactive-message-content a:hover {\n opacity: 0.8 !important;\n }\n .rblyn-proactive-message-content b,\n .rblyn-proactive-message-content strong {\n font-weight: 600 !important;\n }\n .rblyn-proactive-message-content i,\n .rblyn-proactive-message-content em {\n font-style: italic !important;\n }\n .rblyn-proactive-message-content u {\n text-decoration: underline !important;\n }\n .rblyn-proactive-message-content br {\n display: block !important;\n content: "" !important;\n margin-top: 0.5em !important;\n }\n '),document.head.appendChild(t)}},t.prototype.renderProactiveIfNeeded=function(t){var i,n,o,r,l,u,c,h,p,m,g,b,w,y,I,T=this,E=null===(n=null===(i=this.config)||void 0===i?void 0:i.config)||void 0===n?void 0:n.proactive_message_obj;if(!Array.isArray(E)||this.config.isIframeVisible||C())if(this.proactiveElement&&this.proactiveElement.parentElement){var A=this.proactiveElement.children[0],k="Right"===(this.config.position||(null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.position)||"Right");Array.from(A.children).forEach((function(t){t.className=k?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){T.proactiveElement&&T.proactiveElement.parentElement&&T.proactiveElement.parentElement.removeChild(T.proactiveElement),T.proactiveElement=null,T.clearProactiveDelays()}),400)}else this.proactiveElement=null,this.clearProactiveDelays();else{if(this.injectAnimationStyles(),!this.proactiveElement){var O=document.createElement("div");O.style.position="fixed";var z=null!==(u=null!==(r=this.config.bottomSpacing)&&void 0!==r?r:null===(l=this.config.config.interface_properties)||void 0===l?void 0:l.bottom_spacing)&&void 0!==u?u:20,N=null!==(p=null!==(c=this.config.sideSpacing)&&void 0!==c?c:null===(h=this.config.config.interface_properties)||void 0===h?void 0:h.side_spacing)&&void 0!==p?p:20,j=this.config.position||(null===(m=this.config.config.interface_properties)||void 0===m?void 0:m.position)||"Right",L=null!==(b=null===(g=this.config.config)||void 0===g?void 0:g.launcher_size_multiplier)&&void 0!==b?b:1,U=null!==(w=this.config.launcher_size)&&void 0!==w?w:48*L,P=this.config.config.launcher_type===e.IMAGE?U:void 0!==this.config.launcher_size?40:40*L;O.style.bottom="".concat(z+P+8,"px"),"Right"===j?O.style.right="".concat(N,"px"):O.style.left="".concat(N,"px"),O.style.maxWidth="22.875rem",O.style.zIndex="2147483646";var W=document.createElement("div");W.style.display="flex",W.style.flexDirection="column",W.style.alignItems="Right"===j?"flex-end":"flex-start";var B=document.createElement("div");B.style.position="absolute",B.style.top="-32px",B.style.width="24px",B.style.height="24px",B.style.borderRadius="50%",B.style.background="#fff",B.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="center",B.style.cursor="pointer",B.style.opacity="0",B.style.visibility="hidden","Right"===(this.config.position||(null===(y=this.config.config.interface_properties)||void 0===y?void 0:y.position)||"Right")?(B.style.right="0px",B.style.left="auto",B.style.transform="translateX(120%) scale(0.95)"):(B.style.left="0px",B.style.right="auto",B.style.transform="translateX(-120%) scale(0.95)"),B.onclick=function(t){t.stopPropagation(),T.hideProactiveMessages()},B.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">\n <path d="M10.3334 10.3334L7.00009 7.00009M7.00009 7.00009L3.66675 3.66675M7.00009 7.00009L10.3334 3.66675M7.00009 7.00009L3.66675 10.3334" stroke="#444547" stroke-width="0.816326" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n ',O.appendChild(W),O.appendChild(B),document.body.appendChild(O),this.proactiveElement=O}var H=this.proactiveElement.children[0];H.innerHTML="";var Y="Right"===(this.config.position||(null===(I=this.config.config.interface_properties)||void 0===I?void 0:I.position)||"Right");H.style.display="flex",H.style.flexDirection="column",H.style.alignItems=Y?"flex-end":"flex-start",this.clearProactiveDelays();var X=function(t){if(!t||C())return[];var i=S(),n=new Date,e=[];return t.forEach((function(t){e.push.apply(e,function(t,i,n){var e=(null==t?void 0:t.send_time_type)||"",o=e?F[e]:M;if(!o||!o(t,n))return[];for(var r=(null==t?void 0:t.content_multiple)||[],l=Math.max(0,1e3*+((null==t?void 0:t.delay)||0)),d=[],u=0;u<r.length;u++){for(var c=r[u],f=(null==c?void 0:c.message_display_attributes)||[],v=null,h=a.OR,p=0,m=f;p<m.length;p++){var g=m[p];if(null==g?void 0:g.logical_condition)h=g.logical_condition;else{var b=g,w=R(null==b||b.type,(null==b?void 0:b.value)||"",null==b?void 0:b.condition,i);v=null===v?w:h===a.AND?v&&w:v||w}}(null===v||v)&&(null==c?void 0:c.message)&&d.push({messageId:(null==t?void 0:t.message_id)||u+"",contentIndex:u,html:c.message+"",delayMs:l,contentId:c.content_id||null,messageDisplayType:(null==c?void 0:c.message_display_type)||s.TEXT,messageBubbleBg:null==c?void 0:c.message_bubble_bg,urlToGo:null==c?void 0:c.url_to_go})}return d}(t,i,n))})),e}(E);f([],X,!0).sort((function(t,i){return t.delayMs!==i.delayMs?t.delayMs-i.delayMs:t.contentIndex-i.contentIndex}));var G=new Map;X.forEach((function(t){var i=G.get(t.delayMs);i||(i={messageIds:[],groups:new Map},G.set(t.delayMs,i)),i.groups.has(t.messageId)||(i.messageIds.push(t.messageId),i.groups.set(t.messageId,[])),i.groups.get(t.messageId).push(t)}));var J=void 0!==G.get(0),V=this.proactiveElement.children[1];if(V&&X.length>0){V.style.opacity="0",V.style.visibility="hidden",V.style.transform=Y?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var K=function(){if(V){V.style.visibility="visible";var t=H.children.length,i=t>0?10*(t-1):0;V.style.animationDelay="".concat(i,"ms"),V.className=Y?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}};if(J){var Z=window.setTimeout(K,0);this.delayTimers.push(Z)}else{var q=Math.min.apply(Math,Array.from(G.keys()));Z=window.setTimeout(K,q),this.delayTimers.push(Z)}}else V&&(V.style.opacity="0",V.style.visibility="hidden");var Q=0;G.forEach((function(t,i){var n=t.messageIds,e=t.groups,o=window.setTimeout((function(){var t=H.children.length,o=0,r=[];n.forEach((function(t){var i=e.get(t)||[];f([],i,!0).sort((function(t,i){return t.contentIndex-i.contentIndex})).forEach((function(i){r.push({messageId:t,item:i})})),o+=i.length}));var a=i>0?f([],r,!0).reverse():r;a.forEach((function(n,e){var r,l=n.item,u=document.createElement("div"),c=l.messageDisplayType===s.BUTTON;u.style.background=(null==l?void 0:l.messageBubbleBg)||"#ffffff",u.style.color="#111",u.style.borderRadius=c?"100px":"12px",u.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.08)",u.style.padding="16px",u.style.border="1px solid #F1F2F4",u.style.cursor="pointer",u.style.fontFamily=x,u.style.fontSize="14px",u.style.lineHeight=_+"",u.style.width="fit-content",u.style.maxWidth="100%";var f=0===e,h=e===a.length-1,p=t>0,m=G.has(0),g=!1;0===i?g=!h||f&&p:f&&(p||m)?g=!0:f||(g=!0),g&&(u.style.marginBottom="16px");var b=10*(t+o-1-(0===i?t+Q:Q));u.className=Y?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",u.style.animationDelay="".concat(b,"ms"),u.style.opacity="0",u.style.transform=Y?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var w=document.createElement("div");Object.assign(w.style,{display:"flex",alignItems:"center",gap:"8px"});var y=document.createElement("div");if(y.className="rblyn-proactive-message-content",y.setAttribute("dir",function(t){if(!t||"string"!=typeof t||0===t.trim().length)return"ltr";var i=t.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===i.length)return"ltr";for(var n=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,e=0,o=0,r=0,a=i;r<a.length;r++){var l=a[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(l)||(o++,n.test(l)&&e++)}return 0===o?"ltr":e/o>.3?"rtl":"ltr"}(l.html)),y.innerHTML=function(t){return t?Nt.sanitize(t,{ALLOWED_TAGS:["b","strong","i","em","u","br","span","a","p","s"],ALLOWED_ATTR:["href","target","rel","style"],ALLOW_ARIA_ATTR:!1,ALLOW_DATA_ATTR:!1,RETURN_TRUSTED_TYPE:!1}):""}(l.html),w.appendChild(y),(null==l?void 0:l.urlToGo)&&"string"==typeof l.urlToGo&&""!==l.urlToGo.trim()){var I=document.createElementNS("http://www.w3.org/2000/svg","svg");I.setAttribute("width","16"),I.setAttribute("height","17"),I.setAttribute("viewBox","0 0 16 17"),I.setAttribute("fill","none"),I.setAttribute("xmlns","http://www.w3.org/2000/svg"),Object.assign(I.style,{flexShrink:"0",color:v((null==l?void 0:l.messageBubbleBg)||"#ffffff")});var E=document.createElementNS("http://www.w3.org/2000/svg","g");E.setAttribute("id","External_Link");var S=document.createElementNS("http://www.w3.org/2000/svg","path");S.setAttribute("id","Vector"),S.setAttribute("d","M6.6668 3.83268H5.4668C4.72006 3.83268 4.34642 3.83268 4.0612 3.97801C3.81032 4.10584 3.60649 4.30966 3.47866 4.56055C3.33334 4.84576 3.33334 5.21941 3.33334 5.96615V11.0328C3.33334 11.7795 3.33334 12.1527 3.47866 12.4379C3.60649 12.6888 3.81032 12.893 4.0612 13.0208C4.34614 13.166 4.71933 13.166 5.46461 13.166H10.5354C11.2807 13.166 11.6533 13.166 11.9383 13.0208C12.1891 12.893 12.3937 12.6886 12.5215 12.4377C12.6667 12.1528 12.6667 11.78 12.6667 11.0347V9.83268M13.3333 6.49935V3.16602M13.3333 3.16602H10M13.3333 3.16602L8.66667 7.83268"),S.setAttribute("stroke","currentColor"),S.setAttribute("stroke-width","1.5"),S.setAttribute("stroke-linecap","round"),S.setAttribute("stroke-linejoin","round"),E.appendChild(S),I.appendChild(E),w.appendChild(I)}if(u.appendChild(w),u.onclick=function(){if((null==l?void 0:l.urlToGo)&&"string"==typeof l.urlToGo&&""!==l.urlToGo.trim())window.open(l.urlToGo,"_blank","noopener,noreferrer");else{var t;t={message_id:l.messageId,content_string:l.html||null,content_id:l.contentId||null},D=d({input_id:null},t),T.config.toggleIframe(),T.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:l.messageId,content_string:l.html||null,content_id:l.contentId||null}}))}catch(t){}}},0===i)H.appendChild(u);else{H.insertBefore(u,H.firstChild);var A=null===(r=T.proactiveElement)||void 0===r?void 0:r.children[1];if(A&&"visible"===A.style.visibility){var k=H.children.length,R=k>0?10*(k-1):0;A.style.animationDelay="".concat(R,"ms")}}Q++}))}),i);T.delayTimers.push(o)}))}},t}(),Lt=function(){var t;return(null===(t=navigator.userAgentData)||void 0===t?void 0:t.platform)||(/Windows|Mac|Linux|Android|iOS/.exec(navigator.userAgent)||["Unknown"])[0]},Ut=function(){var t;if(null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands)for(var i=["Chrome","Firefox","Safari","Edge","Opera"],n=0,e=navigator.userAgentData.brands;n<e.length;n++){var o=e[n];if(i.includes(o.brand))return o.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},Pt=function(){var t,i,n,e;return{width:(null===window||void 0===window?void 0:window.innerWidth)||(null===(t=null===document||void 0===document?void 0:document.documentElement)||void 0===t?void 0:t.clientWidth)||(null===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.clientWidth),height:(null===window||void 0===window?void 0:window.innerHeight)||(null===(n=null===document||void 0===document?void 0:document.documentElement)||void 0===n?void 0:n.clientHeight)||(null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.clientHeight)}},Wt=function(){return{platform:"web",os:Lt(),browser:Ut(),sdk_version:"1.1.55-alpha.4",device:(t=navigator.userAgent.toLowerCase(),/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(t)?"tablet":/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(t)?"mobile":"desktop"),screen_size:Pt()};var t};!function(t){t.ERROR="ERROR",t.INFO="INFO"}(Ft||(Ft={}));var Bt,Ht,Yt=["@robylon/web-react-sdk","node_modules/@robylon/web-react-sdk/"],Xt=function(t){var i=t.filename,n=t.stack,e=t.message;return!!(i||n||e)&&Yt.some((function(t){return(null==i?void 0:i.includes(t))||(null==n?void 0:n.includes(t))||(null==e?void 0:e.includes(t))}))},Gt=function(){function t(){var t=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(i){var n,e={filename:i.filename,stack:null===(n=i.error)||void 0===n?void 0:n.stack,message:i.message};Xt(e)&&t.trackError(i.error||i.message,"GlobalErrorHandler",{filename:i.filename,lineNo:i.lineno,colNo:i.colno})},this.handleUnhandledRejection=function(i){var n,e,o={stack:null===(n=i.reason)||void 0===n?void 0:n.stack,message:(null===(e=i.reason)||void 0===e?void 0:e.message)||i.reason+""};Xt(o)&&t.trackError(i.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:i.reason})},this.setupGlobalHandlers()}return t.prototype.setupGlobalHandlers=function(){b()&&(null===window||void 0===window||window.addEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.addEventListener("unhandledrejection",this.handleUnhandledRejection))},t.prototype.cleanup=function(){b()&&(null===window||void 0===window||window.removeEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.removeEventListener("unhandledrejection",this.handleUnhandledRejection))},t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.prototype.initialize=function(t,i){void 0===i&&(i=null);try{if(this.preInitQueue.length>0){var n={org_id:"UNINITALIZED",event_data:{message:"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===t?"undefined":null===t?"null":""===t?"empty string":"invalid: ".concat(t)),componentName:"ErrorTrackingService",additionalInfo:{preInitError:!0,apiKey:t,userId:i,timestamp:Date.now()},timestamp:Date.now()},metadata:Wt(),event_type:Ft.ERROR,user_id:i};this.sendLog(n).catch(console.error)}this.apiKey=t,this.userId=i,this.isInitialized=!0,this.processPreInitQueue()}catch(n){h.error("Error during ErrorTrackingService initialization:",n),this.preInitQueue.push({error:n instanceof Error?n:Error(n+""),componentName:"ErrorTrackingService",additionalInfo:{apiKey:t,userId:i}})}},t.prototype.processPreInitQueue=function(){return u(this,void 0,void 0,(function(){var t,i,n;return c(this,(function(e){switch(e.label){case 0:if(!this.preInitQueue.length)return[2];h.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),t=0,i=this.preInitQueue,e.label=1;case 1:return t<i.length?(n=i[t],[4,this.trackError(n.error,n.componentName,d(d({},n.additionalInfo),{preInitError:!0}))]):[3,4];case 2:e.sent(),e.label=3;case 3:return t++,[3,1];case 4:return this.preInitQueue=[],[2]}}))}))},t.prototype.sendLog=function(t){return u(this,void 0,void 0,(function(){var i,n,e,o,r,a;return c(this,(function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),i=w().apiUrl,[4,fetch("".concat(i,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:return(n=l.sent()).ok?[3,3]:(o=(e=h).error,r=["Failed to send error log:"],[4,n.text()]);case 2:o.apply(e,r.concat([l.sent()])),l.label=3;case 3:return[3,5];case 4:return a=l.sent(),h.error("Error sending log:",a),[3,5];case 5:return[2]}}))}))},t.prototype.trackError=function(t,i,n){return u(this,void 0,void 0,(function(){var e,o,r;return c(this,(function(a){switch(a.label){case 0:if(this.isInitialized)return[3,5];e={org_id:"UNINITALIZED",event_data:{message:t instanceof Error?t.message:t,stack:t instanceof Error?t.stack:void 0,componentName:i,additionalInfo:d(d({},n),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:Wt(),event_type:Ft.ERROR,user_id:this.userId},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.sendLog(e)];case 2:return a.sent(),[3,4];case 3:return a.sent(),this.preInitQueue.push({error:t,componentName:i,additionalInfo:n}),h.warn("Error tracked before initialization, queuing:",t),[3,4];case 4:return[2];case 5:return o={message:t instanceof Error?t.message:t,stack:t instanceof Error?t.stack:void 0,componentName:i,additionalInfo:d(d({},n),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:o,metadata:Wt(),event_type:Ft.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return a.sent(),[2]}}))}))},t.prototype.trackInfo=function(t,i,n){return u(this,void 0,void 0,(function(){var e,o;return c(this,(function(r){switch(r.label){case 0:return this.apiKey?(e={message:t,componentName:i,additionalInfo:n,timestamp:Date.now()},o={org_id:this.apiKey,event_data:e,metadata:Wt(),event_type:Ft.INFO,user_id:this.userId},[4,this.sendLog(o)]):(h.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}}))}))},t}(),Jt=Gt.getInstance(),Vt="MISSING_API_KEY",Kt="SDK_INIT_FAILED",Zt="ERROR_TRACKING_INIT_FAILED",qt="API_REQUEST_FAILED",Qt="NETWORK_ERROR",$t="INVALID_RESPONSE",ti="IFRAME_LOAD_FAILED",ii="INITIALIZATION_ERROR",ni=((Bt={})[Vt]=function(t){return"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===t?"undefined":null===t?"null":""===t?"empty string":"invalid: ".concat(t),". A valid API key string is required to initialize the SDK.")},Bt.INVALID_API_KEY=function(t){return"SDK Initialization Failed: Provided API key '".concat(t,"' is invalid. API key must be a non-empty string in UUID format.")},Bt.CONFIG_FETCH_FAILED=function(t){return"Failed to fetch chatbot configuration: ".concat(t.statusCode?"Server responded with status ".concat(t.statusCode):"Could not reach server").concat(t.error?". Error: ".concat(t.error):"")},Bt[qt]=function(t,i,n){return"API Request Failed: Server responded with status ".concat(t," for ").concat(n?"endpoint ".concat(n):"request"," - ").concat(i)},Bt[Qt]=function(t){return"Network Error: Failed to communicate with server".concat(t.url?" at ".concat(t.url):"").concat(t.error?" - ".concat(t.error):"")},Bt[ti]=function(t){return"Failed to load chatbot interface".concat(t.src?" from ".concat(t.src):"").concat(t.error?". Error: ".concat(t.error):"")},Bt[$t]=function(t){return"Invalid API Response: Missing required fields in response data: ".concat(t.join(", "))},Bt[Zt]=function(t){return"Error Tracking Service initialization failed".concat(t.apiKey?" for API key ".concat(t.apiKey):"").concat(t.error?". Error: ".concat(t.error):"")},Bt[Kt]=function(t){return"SDK Initialization Failed: ".concat(t.reason||"Could not initialize the chatbot SDK").concat(t.config?". Attempted initialization with config: ".concat(JSON.stringify(t.config,null,2)):"")},Bt.COOKIE_ACCESS_ERROR=function(t,i){return"Cookie Access Error: Failed to ".concat(t).concat(i?" cookie '".concat(i,"'"):" cookies",". This may affect user session persistence.")},Bt.COMPONENT_RENDER_ERROR=function(t){return"React Component Error: ".concat(t.component||"Unknown component"," failed to render. Error: ").concat(t.error).concat(t.stack?"\nComponent Stack: ".concat(t.stack):"")},Bt),ei=function(){var t,i=navigator.userAgent;if(null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands){var n=navigator.userAgentData.brands.find((function(t){return"Google Chrome"===t.brand}));if(null==n?void 0:n.version)return n.version}var e=i.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return e?e[2]:"Unknown"},oi=function(){var t,i,n=Wt();return{current_page_url:(null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.href)||"",browser_language:(null===navigator||void 0===navigator?void 0:navigator.language)||(null===(i=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===i?void 0:i[0])||"en",browser_version:ei(),os:null==n?void 0:n.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:n}};!function(t){t.UPDATE_OVERRIDES="updateOverrides",t.I_CAN_AUTHENTICATE="i_can_authenticate",t.I_LOADED_LAUNCHER="i_loaded_launcher",t.I_OPENED_IFRAME="i_opened_iframe",t.I_CLICKED_PROACTIVE_BUBBLE="i_clicked_proactive_bubble",t.CAPTURED_SESSION_DATA="capturedSessionData",t.UPDATE_USER_PROFILE="updateUserProfile",t.OPENED_IFRAME_EVENT="openedIframe"}(Ht||(Ht={}));var ri=function(){function t(t){var i=this;this.isInitialized=!1,this.hasRegistered=!1,this.isAppReady=!1,this.shouldWaitForAppReady=!1,this.hasPendingOpenRequest=!1,this.overridesPayloadCache=null,this.proactiveDataSentInRegistration=!1,this.openedDueToProactive=!1,this.handleMessage=function(t){var n,e,o,r,a,l,s,d,u,c,f=w().copilotUrl;if(t.origin===f){var v=JSON.parse(t.data);if("APP_READY"===(null==v?void 0:v.type))return i.isAppReady=!0,void i.sendOpenAndRegisterIfReady();if("CHATBOT_CLOSED"===(null==v?void 0:v.type))return void(null===(n=null==i?void 0:i.config)||void 0===n||n.onClose());if("CHATBOT_TOKEN_EXHAUSTED"===(null==v?void 0:v.type))return void i.config.onInternalEvent(g.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null==v?void 0:v.type)&&(null===(o=(e=i.config).onEvent)||void 0===o||o.call(e,{type:m.CHATBOT_LOADED,timestamp:Date.now()}),i.config.onInternalEvent(m.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null==v?void 0:v.type)&&(null===(a=(r=i.config).onEvent)||void 0===a||a.call(r,{type:m.CHAT_INITIALIZED,timestamp:Date.now()}),i.config.onInternalEvent(m.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null==v?void 0:v.type)&&(null===(s=(l=i.config).onEvent)||void 0===s||s.call(l,{type:m.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),i.config.onInternalEvent(m.CHAT_INITIALIZATION_FAILED,{error:null===(d=t.data)||void 0===d?void 0:d.error})),"SESSION_REFRESHED"===(null==v?void 0:v.type)&&(null===(c=(u=i.config).onEvent)||void 0===c||c.call(u,{type:m.SESSION_REFRESHED,timestamp:Date.now()}),i.config.onInternalEvent(m.SESSION_REFRESHED)),"CHAT_MOVED"===(null==v?void 0:v.type)&&i.config.onInternalEvent(g.CHAT_MOVED,{from:t.data.from,to:t.data.to,trigger:t.data.trigger})}},this.config=t,this.iframeElement=document.createElement("iframe"),this.iframeElement.id="chat-iframe-rbyln",this.resizeHandler=this.applyResponsiveStyles.bind(this),this.render(),this.initialize(),this.setupEventListeners()}return t.prototype.getElement=function(){return this.iframeElement},t.prototype.render=function(){var t,i=this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right";Object.assign(this.iframeElement.style,{zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom ".concat(i.toLowerCase()),transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out",transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"none"}),this.applyResponsiveStyles()},t.prototype.applyResponsiveStyles=function(){var t,i,n,e,o,r;if(this.iframeElement){var a=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",l=null!==(r=null!==(e=this.config.bottomSpacing)&&void 0!==e?e:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.bottom_spacing)&&void 0!==r?r:20;560>window.innerWidth?Object.assign(this.iframeElement.style,((t={width:"100vw",minWidth:"300px"})[a.toLowerCase()]="0",t.bottom="0",t.height="100vh",t.flexDirection="column",t.flexGrow="1",t.borderRadius="0",t.top="0",t.maxHeight="100%",t.position="fixed",t)):Object.assign(this.iframeElement.style,((i={width:"26%",minWidth:"400px",height:"calc(100vh - 2rem - 10vh - ".concat(l,"px)"),borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"50rem",position:""})[a.toLowerCase()]=void 0,i))}},t.prototype.initialize=function(){var t=this;if(!this.isInitialized){var i=w().copilotUrl;this.iframeElement.src="".concat(i,"/chatbot-plugin?id=").concat(this.config.config.chatbotId),this.isInitialized=!0,this.iframeElement.addEventListener("load",(function(){var n,e,o,r,a,l,s,u,c,f,v,h,p,g,b,w,y,x,_,I,T,E,S,A,k,R,O,D,C,M,F,N,j,L=new URL(t.iframeElement.src).origin||i;if(null===(n=t.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,name:"checkDomain"},L),t.config.overrides){var U={header_avatar:null!==(r=null===(o=t.config.overrides)||void 0===o?void 0:o.header_avatar)&&void 0!==r?r:null,agent_avatar:null!==(l=null===(a=t.config.overrides)||void 0===a?void 0:a.agent_avatar)&&void 0!==l?l:null,header_title:null!==(u=null===(s=t.config.overrides)||void 0===s?void 0:s.header_title)&&void 0!==u?u:null,header_subtitle:null!==(f=null===(c=t.config.overrides)||void 0===c?void 0:c.header_subtitle)&&void 0!==f?f:null,header_title_text_color:null!==(h=null===(v=t.config.overrides)||void 0===v?void 0:v.header_title_text_color)&&void 0!==h?h:null,header_subtitle_text_color:null!==(g=null===(p=t.config.overrides)||void 0===p?void 0:p.header_subtitle_text_color)&&void 0!==g?g:null,header_bg:null!==(w=null===(b=t.config.overrides)||void 0===b?void 0:b.header_bg)&&void 0!==w?w:null};null===(y=t.iframeElement.contentWindow)||void 0===y||y.postMessage({domain:null===(x=null===window||void 0===window?void 0:window.location)||void 0===x?void 0:x.hostname,action:Ht.UPDATE_OVERRIDES,data:U},i)}if(!t.hasRegistered&&t.iframeElement.contentWindow){t.iframeElement.contentWindow.postMessage({domain:null===(_=null===window||void 0===window?void 0:window.location)||void 0===_?void 0:_.hostname,action:Ht.I_CAN_AUTHENTICATE,data:{show_history:null===(I=t.config.config)||void 0===I?void 0:I.show_history}},i);var P=z();t.proactiveDataSentInRegistration=!!P,t.iframeElement.contentWindow.postMessage({domain:null===(T=null===window||void 0===window?void 0:window.location)||void 0===T?void 0:T.hostname,action:Ht.I_LOADED_LAUNCHER,data:d(d({ws_url:null===(E=t.config.config)||void 0===E?void 0:E.ws_url,userId:null===(S=t.config.config)||void 0===S?void 0:S.userId,token:null===(A=t.config.config)||void 0===A?void 0:A.token,userProfile:d(d({},null===(k=t.config.config)||void 0===k?void 0:k.userProfile),{__INT_SYS_INFO__:d(d({},(null===(O=null===(R=t.config.config)||void 0===R?void 0:R.userProfile)||void 0===O?void 0:O.__INT_SYS_INFO__)||{}),oi())}),isAnonymous:null===(D=t.config.config)||void 0===D?void 0:D.isAnonymous},P?{proactiveData:P}:{}),{show_history:null===(C=t.config.config)||void 0===C?void 0:C.show_history})},i),t.hasRegistered=!0}null===(F=(M=t.config).onIframeLoaded)||void 0===F||F.call(M),null===(j=(N=t.config).onEvent)||void 0===j||j.call(N,{type:m.CHATBOT_READY,timestamp:Date.now()}),t.config.onInternalEvent(m.CHATBOT_LOADED)}))}},t.prototype.setupEventListeners=function(){var t=this;window.addEventListener("resize",this.resizeHandler),this.iframeElement.addEventListener("error",(function(){Jt.trackError(Error(ni[ti]({src:t.iframeElement.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:ti,errorType:"RUNTIME_ERROR",context:{config:t.config.config,iframeUrl:t.iframeElement.src,timestamp:Date.now()}})})),window.addEventListener("message",this.handleMessage),window.addEventListener("rblyn:proactiveClick",(function(i){var n,e,o,r,a,l,s,u,c,f;if(t.hasRegistered)if(t.proactiveDataSentInRegistration)t.proactiveDataSentInRegistration=!1;else{t.openedDueToProactive=!0;var v=(null==i?void 0:i.detail)||{},h=w().copilotUrl,p=new URL(t.iframeElement.src).origin||h;null===(n=t.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,action:Ht.I_CLICKED_PROACTIVE_BUBBLE,data:{userId:null===(o=t.config.config)||void 0===o?void 0:o.userId,token:null===(r=t.config.config)||void 0===r?void 0:r.token,userProfile:d(d({},null===(a=t.config.config)||void 0===a?void 0:a.userProfile),{__INT_SYS_INFO__:d(d({},(null===(s=null===(l=t.config.config)||void 0===l?void 0:l.userProfile)||void 0===s?void 0:s.__INT_SYS_INFO__)||{}),oi())}),isAnonymous:null===(u=t.config.config)||void 0===u?void 0:u.isAnonymous,ws_url:null===(c=t.config.config)||void 0===c?void 0:c.ws_url,proactiveData:{input_id:null,message_id:(null==v?void 0:v.message_id)||null,content_string:(null==v?void 0:v.content_string)||null,content_id:(null==v?void 0:v.content_id)||null},show_history:null===(f=t.config.config)||void 0===f?void 0:f.show_history}},p)}}))},t.prototype.updateVisibility=function(t,i){var n;this.shouldWaitForAppReady=!!i,this.config.isVisible=t;var e=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right";if(t?this.showIframe(e):this.hideIframe(e),!t)return this.openedDueToProactive=!1,void(this.hasPendingOpenRequest=!1);this.hasPendingOpenRequest=!0,this.shouldWaitForAppReady,this.sendOpenAndRegisterIfReady()},t.prototype.showIframe=function(t){this.iframeElement.style.display="block",this.iframeElement.getBoundingClientRect(),this.iframeElement.style.opacity="1",this.iframeElement.style.transform="scale(1) translate3d(0,0,0)"},t.prototype.hideIframe=function(t){var i=this;this.iframeElement.style.opacity="0",this.iframeElement.style.transform="scale(0.3) translate3d(".concat((t.toLowerCase(),"0"),",40px,0)"),setTimeout((function(){i.config.isVisible||(i.iframeElement.style.display="none")}),200)},t.prototype.sendOpenAndRegisterIfReady=function(){var t,i,n,e,o,r,a,l,s,u,c,f;if(this.iframeElement.contentWindow&&this.config.isVisible&&(!this.shouldWaitForAppReady||this.isAppReady)&&this.hasPendingOpenRequest){var v=w().copilotUrl,h=new URL(this.iframeElement.src).origin||v;if(this.iframeElement.contentWindow.postMessage({domain:null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.hostname,name:"openFrame"},h),this.openedDueToProactive)this.openedDueToProactive=!1;else{var p=z();this.iframeElement.contentWindow.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,action:Ht.I_OPENED_IFRAME,data:d(d({ws_url:null===(n=this.config.config)||void 0===n?void 0:n.ws_url,userId:null===(e=this.config.config)||void 0===e?void 0:e.userId,token:null===(o=this.config.config)||void 0===o?void 0:o.token,userProfile:d(d({},null===(r=this.config.config)||void 0===r?void 0:r.userProfile),{__INT_SYS_INFO__:d(d({},(null===(l=null===(a=this.config.config)||void 0===a?void 0:a.userProfile)||void 0===l?void 0:l.__INT_SYS_INFO__)||{}),oi())}),isAnonymous:null===(s=this.config.config)||void 0===s?void 0:s.isAnonymous},p?{proactiveData:p}:{}),{show_history:null===(u=this.config.config)||void 0===u?void 0:u.show_history})},v)}null===(f=(c=this.config).onEvent)||void 0===f||f.call(c,{type:m.CHATBOT_OPENED,timestamp:Date.now()}),this.config.onInternalEvent(m.CHATBOT_OPENED),this.hasPendingOpenRequest=!1}},t.prototype.update=function(t,i){var n,e,o=this.config.isVisible;if(this.config=d(d({},this.config),t),o!==this.config.isVisible&&this.updateVisibility(this.config.isVisible,i),this.iframeElement.contentWindow&&this.config.isVisible){var r=w().copilotUrl;this.iframeElement.contentWindow.postMessage({action:Ht.UPDATE_USER_PROFILE,user_profile:this.config.config.userProfile,show_history:null===(n=this.config.config)||void 0===n?void 0:n.show_history},r),this.iframeElement.contentWindow.postMessage({action:Ht.OPENED_IFRAME_EVENT,user_profile:this.config.config.userProfile,show_history:null===(e=this.config.config)||void 0===e?void 0:e.show_history},r)}},t.prototype.destroy=function(){window.removeEventListener("resize",this.resizeHandler),window.removeEventListener("message",this.handleMessage),this.iframeElement&&this.iframeElement.parentNode&&this.iframeElement.parentNode.removeChild(this.iframeElement)},t}(),ai=function(){function t(t,i,n,e){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:t,position:i,sideSpacing:n,bottomSpacing:e},this.render(),this.mount(),this.setupResizeListener()}return t.prototype.render=function(){this.applyStyles(),this.containerElement.className="robylon-chatbot-container"},t.prototype.applyStyles=function(){var t,i,n,e,o,r,a,l,s,u=560>(null===window||void 0===window?void 0:window.innerWidth),c=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",f=null!==(r=null!==(e=this.config.sideSpacing)&&void 0!==e?e:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.side_spacing)&&void 0!==r?r:20,v=null!==(s=null!==(a=this.config.bottomSpacing)&&void 0!==a?a:null===(l=this.config.config.interface_properties)||void 0===l?void 0:l.bottom_spacing)&&void 0!==s?s:20;this.containerElement.style.position="",this.containerElement.style.top="",this.containerElement.style.bottom="",this.containerElement.style.right="",this.containerElement.style.left="",this.containerElement.style.alignItems="";var h={position:"fixed",zIndex:"1000",display:"flex",flexDirection:"column"},p=d(d({},h),((t={bottom:"".concat(v,"px")})[c.toLowerCase()]="".concat(f,"px"),t.alignItems="Right"===c?"flex-end":"flex-start",t)),m=d(d({},h),((i={top:"0"})[c.toLowerCase()]="".concat(f,"px"),i.alignItems="center",i));Object.assign(this.containerElement.style,u?m:p)},t.prototype.handleResize=function(){this.applyStyles()},t.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},t.prototype.mount=function(){document.body.appendChild(this.containerElement)},t.prototype.getElement=function(){return this.containerElement},t.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.containerElement&&this.containerElement.parentNode&&this.containerElement.parentNode.removeChild(this.containerElement)},t}(),li=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var i=16*Math.random()|0;return("x"===t?i:3&i|8).toString(16)}))},si=function(t){var i,n="; ".concat(document.cookie).split("; ".concat(t,"="));if(2===n.length)return null===(i=n.pop())||void 0===i?void 0:i.split(";").shift()},di=function(t){var i=t?"USER_DATA=%7B%22attributes%22%3A%5B%7B%22key%22%3A%22USER_ATTRIBUTE_USER_EMAIL%22%2C%22value%22%3A%22dinesh.goel%40robylon.ai%22%7D%2C%7B%22key%22%3A%22USER_ATTRIBUTE_UNIQUE_ID%22%2C%22value%22%3A%2266011f2c28d1787d13c6c796%22%7D%5D%2C%22subscribedToOldSdk%22%3Afalse%2C%22deviceUuid%22%3A%2226c02feb-2664-451d-8469-9cf1378547c6%22%2C%22deviceAdded%22%3Atrue%7D; _ga_3YS9P6ZDWX=GS1.1.1715252584.3.1.1715258696.39.0.0; _ga_V4J24F7YF9=GS1.1.1715273274.2.0.1715273274.0.0.0; city_name=Bengaluru; lang_code=en-in; cookieConcent=A; _gcl_au=1.1.343275043.1717154298; _clck=43guwd%7C2%7Cfmi%7C0%7C1561; _gid=GA1.2.1423066649.1718210058; moe_uuid=26c02feb-2664-451d-8469-9cf1378547c6; _ga_6RM65PWEZY=GS1.1.1718210058.18.1.1718211647.60.0.0; _ga=GA1.1.689213983.1712737672; AMP_MKTG_fe4beb374f=JTdCJTIycmVmZXJyZXIlMjIlM0ElMjJodHRwcyUzQSUyRiUyRmFjY291bnRzLnRlYWNobWludC5jb20lMkYlMjIlMkMlMjJyZWZlcnJpbmdfZG9tYWluJTIyJTNBJTIyYWNjb3VudHMudGVhY2htaW50LmNvbSUyMiU3RA==; AMP_fe4beb374f=JTdCJTIyZGV2aWNlSWQlMjIlM0ElMjI0MWMxMTljZC03YzVjLTRiYTctYTUzZS1mYTgzMjRlYjc0OWUlMjIlMkMlMjJ1c2VySWQlMjIlM0ElMjIxZjI2ODAwOC01OGYxLTQwYTItYjQ0Ni1mYmQ5N2E0NDQyYTAlMjIlMkMlMjJzZXNzaW9uSWQlMjIlM0ExNzE4MjEzMzEwOTc3JTJDJTIyb3B0T3V0JTIyJTNBZmFsc2UlMkMlMjJsYXN0RXZlbnRUaW1lJTIyJTNBMTcxODIxMzMxMDk4MSUyQyUyMmxhc3RFdmVudElkJTIyJTNBMTQlN0Q=; _ga_3YS9P6ZDWX=GS1.1.1718211637.26.1.1718213441.60.0.0; SESSION=%7B%22sessionKey%22%3A%22e4d76f52-9053-4277-99a4-f1ba667fd5f2%22%2C%22sessionStartTime%22%3A%222024-06-12T16%3A34%3A19.047Z%22%2C%22sessionMaxTime%22%3A1800%2C%22customIdentifiersToTrack%22%3A%5B%5D%2C%22sessionExpiryTime%22%3A1718215247464%2C%22numberOfSessions%22%3A17%7D":document.cookie;return i=i.split(";").map((function(t){var i=t.split("="),n=i[0],e=i.slice(1).join("=").trim();return{name:n=n.trim(),value:e?decodeURIComponent(e):""}})),i},ui=function(t,i,n,e){return u(void 0,void 0,void 0,(function(){var o,r,a,l,s,d,u,f;return c(this,(function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),o=w().apiUrl,h.log("endpointUrl",r="".concat(o,"/chat/chatbot/get/")),a={client_user_id:i||null,org_id:t,token:n||void 0,internal_user_id:e||void 0,extra_info:{},launcher_info:oi()},[4,fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];case 1:return(l=c.sent()).ok?[3,3]:[4,l.text()];case 2:throw s=c.sent(),Error(ni[qt](l.status,s));case 3:return[4,l.json()];case 4:if(d=c.sent(),!(null===(f=null==d?void 0:d.user)||void 0===f?void 0:f.org_info))throw Error(ni[$t](["user","org_info"]));return[2,d];case 5:throw u=c.sent(),Jt.trackError(u instanceof Error?u:Error(ni[Qt]({error:u+""})),"fetchChatbotConfig",{errorCode:u instanceof Error&&u.message.includes("API Request Failed")?qt:Qt,errorType:"API_ERROR",context:{apiKey:t,userId:i,timestamp:Date.now()}}),u;case 6:return[2]}}))}))},ci=function(t){return u(void 0,void 0,void 0,(function(){var o,r,a,l,s,u,f,v,p,m,g,b,w,y,x,_,I,T,E,S,A,k,R,O,D,C,z,M,F,N,j,L,U,P,W,B,H,Y,X;return c(this,(function(c){switch(c.label){case 0:return o=function(t){return{api_key:(t.api_key||"")+"",user_id:t.user_id?t.user_id+"":null,user_token:t.user_token?t.user_token+"":void 0,user_profile:t.user_profile||{}}}(t),r=o.user_id||void 0,a=!1,r?l=si("rblyn_anon")||li():(J=r=si("rblyn_anon")||li(),(V=new Date).setTime(V.getTime()+31536e6),document.cookie="".concat("rblyn_anon","=").concat(J,";expires=").concat(V.toUTCString(),";path=/"),a=!0,l=r),[4,ui(o.api_key,r,o.user_token,l)];case 1:s=c.sent();try{o.api_key}catch(t){h.warn("Failed to inject mock proactive messages",t)}return u=Wt(),f=oi(),G=o.user_profile,v=G?Object.fromEntries(Object.entries(G).map((function(t){var i=t[0],n=t[1];return"boolean"==typeof n||"number"==typeof n?[i,n]:[i,n+""]}))):{},p=d(d(d({},u),{__INT_SYS_INFO__:d(d({},u),f)}),v),[2,{chatbotId:o.api_key,userId:r,token:o.user_token,isAnonymous:a,domain:"",show_launcher:null===(g=null===(m=s.user.org_info)||void 0===m?void 0:m.show_launcher)||void 0===g||g,brand_colour:(null===(w=null===(b=s.user.org_info.brand_config)||void 0===b?void 0:b.colors)||void 0===w?void 0:w.brand_color)||"",image_url:(null===(x=null===(y=s.user.org_info)||void 0===y?void 0:y.brand_config)||void 0===x?void 0:x.launcher_logo_url)||"",userProfile:p,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(_=s.user.org_info.brand_config)||void 0===_?void 0:_.display_name)||"",welcome_message:(null===(I=s.user.org_info.brand_config)||void 0===I?void 0:I.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(T=s.user.org_info.brand_config)||void 0===T?void 0:T.redirect_url)||""},launcher_type:(null===(E=s.user.org_info.brand_config)||void 0===E?void 0:E.launcher_type)||e.IMAGE,launcher_properties:{text:(null===(A=null===(S=s.user.org_info.brand_config)||void 0===S?void 0:S.launcher_properties)||void 0===A?void 0:A.text)||""},images:{launcher_image_url:{url:(null===(O=null===(R=null===(k=s.user.org_info.brand_config)||void 0===k?void 0:k.images)||void 0===R?void 0:R.launcher_image_url)||void 0===O?void 0:O.url)||""}},proactive_message_obj:fi(null===(z=null===(C=null===(D=null==s?void 0:s.user)||void 0===D?void 0:D.org_info)||void 0===C?void 0:C.brand_config)||void 0===z?void 0:z.proactive_message_obj),interface_properties:{position:(null===(F=null===(M=s.user.org_info.brand_config)||void 0===M?void 0:M.interface_properties)||void 0===F?void 0:F.position)||n.RIGHT,side_spacing:(null===(j=null===(N=s.user.org_info.brand_config)||void 0===N?void 0:N.interface_properties)||void 0===j?void 0:j.side_spacing)||20,bottom_spacing:(null===(U=null===(L=s.user.org_info.brand_config)||void 0===L?void 0:L.interface_properties)||void 0===U?void 0:U.bottom_spacing)||20},interface_type:(null===(P=s.user.org_info.brand_config)||void 0===P?void 0:P.interface_type)||i.WIDGET,launcher_delay:(null===(W=s.user.org_info.brand_config)||void 0===W?void 0:W.launcher_delay)||{enabled:!1,delay:0},launcher_size_multiplier:null!==(H=null===(B=s.user.org_info.brand_config)||void 0===B?void 0:B.launcher_size_multiplier)&&void 0!==H?H:1,ws_url:null===(X=null===(Y=s.user)||void 0===Y?void 0:Y.router_connection_info)||void 0===X?void 0:X.url}]}var G,J,V}))}))},fi=function(t){if(t){var i=(Array.isArray(t)?t:[t]).filter(Boolean).map((function(t){var i,n,e={message_id:(null!==(i=null==t?void 0:t.message_id)&&void 0!==i?i:"")+"",org_id:(null!==(n=null==t?void 0:t.org_id)&&void 0!==n?n:"")+"",name:null==t?void 0:t.name,content:null==t?void 0:t.content,send_time_type:null==t?void 0:t.send_time_type,created_by_name:null==t?void 0:t.created_by_name,updated_by_name:null==t?void 0:t.updated_by_name,updated_at:null==t?void 0:t.updated_at,created_at:null==t?void 0:t.created_at,delay:"number"==typeof(null==t?void 0:t.delay)?t.delay:void 0,content_multiple:Array.isArray(null==t?void 0:t.content_multiple)?t.content_multiple:(null==t?void 0:t.content)?[{message:t.content+"",message_display_attributes:[]}]:[]};return(null==t?void 0:t.content)&&!(null==t?void 0:t.content_multiple)&&h.warn("[Robylon SDK] proactive_message.content is deprecated; use content_multiple[].message instead."),e}));return i.length?i:void 0}},vi=function(){function t(t){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.isIframeLoaded=!1,this.config=t,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return t.prototype.sendMessageToIframe=function(t,i){var n;(null===(n=this.iframe)||void 0===n?void 0:n.contentWindow)&&this.iframe.contentWindow.postMessage(t,i)},t.prototype.onCloseListener=function(t){t.origin===this.config.domain&&"closeChatbot"===t.data&&this.closeIframe()},t.prototype.validateDomain=function(){var t,i=this.config.domain,n=null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.origin;return h.log("expectedDomain, to current domain",i,n,i===n),i===n},t.prototype.createChatBubblContainer=function(){var t,i=this,n=document.createElement("div");n.id="chatbase-message-bubbles",Object.assign(n.style,{position:"fixed",bottom:"80px",borderRadius:"10px",fontFamily:"sans-serif",fontSize:"16px",zIndex:"2147483644",cursor:"pointer",flexDirection:"column",gap:"50px",maxWidth:"70vw",display:"block",right:"1rem",left:"unset"});var e=document.createElement("div");e.classList.add("close-btn"),e.textContent="✕",Object.assign(e.style,{position:"absolute",top:"-7px",right:"-7px",fontWeight:"bold",display:"none",justifyContent:"center",alignItems:"center",zIndex:"2147483643",width:"22px",height:"22px",borderRadius:"50%",textAlign:"center",fontSize:"12px",cursor:"pointer",backgroundColor:"rgb(224, 224, 224)",color:"black",boxShadow:"rgba(150, 150, 150, 0.15) 0px 6px 24px 0px, rgba(150, 150, 150, 0.15) 0px 0px 0px 1px"}),((null===(t=this.config.chat_interface_config)||void 0===t?void 0:t.chat_bubble_prompts)||[]).forEach((function(t){var e=i.createMessageBubble(t);n.appendChild(e)})),n.appendChild(e),document.body.appendChild(n)},t.prototype.createMessageBubble=function(t){var i=document.createElement("div");this.bubblePromptContainer=i,Object.assign(i.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var n=document.createElement("div");n.classList.add("message"),n.textContent=t,Object.assign(n.style,{backgroundColor:"white",color:"black",boxShadow:"rgba(150, 150, 150, 0.2) 0px 10px 30px 0px, rgba(150, 150, 150, 0.2) 0px 0px 0px 1px",borderRadius:"10px",padding:"8px 5px",margin:"8px",fontSize:"14px",opacity:"1",transform:"scale(1)",transition:"opacity 0.5s ease 0s, transform 0.5s ease 0s"});var e=document.createElement("button");return e.innerHTML="&times;",Object.assign(e.style,{position:"absolute",top:"1px",left:"-3px",width:"20px",height:"20px",borderRadius:"50%",backgroundColor:"#fff",color:"#000",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",fontSize:"14px",lineHeight:"1",padding:"0",zIndex:"100"}),e.addEventListener("click",(function(){i.remove()})),i.appendChild(e),i.appendChild(n),i},t.prototype.createFloatingButton=function(){var t=document.createElement("div");t.classList.add("message-bubble-container"),Object.assign(t.style,{position:"fixed",bottom:"1.5rem",right:"1.5rem",zIndex:"1000",width:"48px",height:"48px",display:"flex",flexDirection:"column-reverse",backgroundColor:this.config.brand_colour,color:v(this.config.brand_colour),borderRadius:"50%",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden"}),document.body.appendChild(t),this.logoContainer=t,this.loadImage(this.logoContainer),this.createChatBubblContainer(),this.logoContainer.addEventListener("click",this.toggleIframe.bind(this))},t.prototype.loadImage=function(t){var i,n,e=document.createElement("img");e.src=this.config.launcher_type?(null===(n=null===(i=this.config.images)||void 0===i?void 0:i.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(this.config.domain,"/chatbubble.png"):this.config.image_url||"".concat(this.config.domain,"/chatbubble.png"),e.alt="Chat",Object.assign(e.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover"}),this.chatBtnImage=e,t.innerHTML="",t.appendChild(e)},t.prototype.createIframe=function(){var t=this;h.log("RobylonConfig?.domain====>",this.config.domain);var i=document.createElement("iframe");Object.assign(i.style,{position:"fixed",right:"32px",bottom:"86px",minWidth:"400px",width:"26%",maxWidth:"800px",top:"calc(10vh - 32px)",maxHeight:"45rem",height:"calc(100vh - 3rem - 10vh)",zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom right",transition:"transform 0.3s ease-out",borderRadius:"1rem",display:"none"}),i.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),h.log("iframe.src====>",i.src),document.body.appendChild(i),this.iframe=i;var n=function(){560>(null===window||void 0===window?void 0:window.innerWidth)?Object.assign(i.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(i.style,{width:"26%",minWidth:"400px",right:"32px",bottom:"86px",height:"calc(100vh - 3rem - 10vh)",borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"45rem"})};n(),null===window||void 0===window||window.addEventListener("resize",n),i.addEventListener("load",(function(){var n,e,o,r,a;if(t.iframe){var l=new URL(t.iframe.src).origin||t.config.domain;null===(n=i.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,name:"checkDomain"},l),null===(o=i.contentWindow)||void 0===o||o.postMessage({domain:null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.hostname,action:"registerUserId",data:{userId:t.config.userId,token:t.config.token,userProfile:d(d({},t.config.userProfile||{}),{__INT_SYS_INFO__:d(d({},(null===(a=t.config.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),oi())})}},l),t.isIframeLoaded=!0,t.createFloatingButton()}})),null===window||void 0===window||window.addEventListener("message",(function(n){var e,o;if(n.origin===t.config.domain){if("captureSessionData"===n.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===t.config.chatbotId,a={cookies:di(r),localStorage:JSON.stringify(localStorage),sessionStorage:JSON.stringify(sessionStorage),action:"capturedSessionData",domain_name:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname};null===(o=i.contentWindow)||void 0===o||o.postMessage(a,t.config.domain||"*")}"expand"===n.data&&(t.adjustIframeWidth(),i.style.height="calc(100vh - 120px)",i.style.bottom="86px"),"collapse"===n.data&&Object.assign(i.style,{width:"26%",height:"calc(100vh - 32px - 10vh)",bottom:"86px",top:"calc(32px + 10vh)"})}}))},t.prototype.adjustIframeWidth=function(){if(this.iframe){var t=null===window||void 0===window?void 0:window.innerWidth;h.log("screenWidth",t),this.iframe.style.width=832>t?"".concat(t-64,"px"):"800px"}},t.prototype.loadSvgInline=function(t){var i=document.createElement("div");i.innerHTML='\n<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g id="Chevron_Down">\n <path id="Vector" d="M19 9L12 16L5 9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n </g>\n</svg>\n';var n=i.querySelector("svg");t.innerHTML="",n&&t.appendChild(n)},t.prototype.toggleIcon=function(t,i){"block"===i.style.display?this.loadSvgInline(t):this.loadImage(t)},t.prototype.toggleIframe=function(){var t;if(h.log("toggleIframe",this.iframe,this.logoContainer,this.chatBtnImage),this.iframe&&this.logoContainer&&this.chatBtnImage){var i=new URL(this.iframe.src).origin||this.config.domain;h.log("toggleIframe"),null===(t=this.iframe.contentWindow)||void 0===t||t.postMessage({domain:null===window||void 0===window?void 0:window.location.hostname,name:"none"===this.iframe.style.display?"openFrame":"closeFrame"},i),this.iframe.style.display="none"===this.iframe.style.display?"block":"none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit="block"===this.iframe.style.display?"none":"cover",this.bubblePromptContainer&&(this.bubblePromptContainer.style.display="none"),h.log("this.bubblePromptContainer",this.bubblePromptContainer)}},t.prototype.closeIframe=function(){this.iframe&&this.logoContainer&&this.chatBtnImage&&(this.iframe.style.display="none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit="cover")},t.prototype.init=function(){this.createIframe()},t}(),hi=function(t){var i={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},n=[],e=function(t){i=d(d({},i),t),n.forEach((function(t){return t(i)}))};return{getState:function(){return i},initialize:function(){return u(void 0,void 0,void 0,(function(){var i,n,o;return c(this,(function(r){switch(r.label){case 0:if(!t.api_key)return Jt.trackError(Error(ni[Vt](t.api_key)),"ChatbotStateManager",{errorCode:Vt,errorType:ii,context:{timestamp:Date.now()}}),[2];e({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,ci(t)];case 2:return i=r.sent(),[4,new Promise((function(t,n){!function(n,o,r){if(n.chatbotId&&n.userId)try{new vi(n),e({isInitialized:!0,chatbotConfig:i}),t(),h.log("Robylon SDK initialized successfully.")}catch(t){r(t instanceof Error?t.message:"Failed to initialize SDK")}else r("Incomplete configuration for SDK initialization.")}(i,0,(function(t){n(t)}))}))];case 3:return r.sent(),[3,6];case 4:return n=r.sent(),o=n instanceof Error?n.message:"Failed to initialize chatbot",e({error:o}),Jt.trackError(n instanceof Error?n:Error(o),"ChatbotStateManager",{errorCode:Kt,errorType:ii,context:{timestamp:Date.now()}}),[3,6];case 5:return e({isInitializing:!1}),[7];case 6:return[2]}}))}))},toggleIframeVisibility:function(){e({isIframeVisible:!i.isIframeVisible})},closeIframe:function(){e({isIframeVisible:!1})},updateState:e,subscribe:function(t){return n.push(t),function(){var i=n.indexOf(t);i>-1&&n.splice(i,1)}},unsubscribe:function(t){var i=n.indexOf(t);i>-1&&n.splice(i,1)}}},pi=function(t){t.api_key,t.user_profile;var i=t.onEvent;return t.chatbotConfig,{emit:function(t,n){var e={type:t,timestamp:Date.now(),data:n};null==i||i(e)},onInternalEvent:function(t,i){}}},mi=function(){function t(t){var i=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.iframe=null,this.isDestroyed=!1,this.isIframeLoaded=!1,this.handleStateChange=function(t){var n,e,o,r,a,l;if(!i.isDestroyed){var s=t.isInitialized,d=t.error,u=t.chatbotConfig,c=t.isIframeVisible;if(!d&&u&&s){if(i.eventEmitter=pi({api_key:i.config.api_key,user_profile:i.config.user_profile,onEvent:i.config.onEvent,chatbotConfig:{isAnonymous:u.isAnonymous,userId:u.userId}}),i.container||(i.container=new ai(u,i.config.position,i.config.sideSpacing,i.config.bottomSpacing)),i.iframe)i.iframe.update({config:u,isVisible:c,position:i.config.position,bottomSpacing:i.config.bottomSpacing,overrides:i.config.overrides},!0);else if(i.iframe=new ri({config:u,isVisible:c,onClose:i.handleClose,onEvent:i.config.onEvent,onIframeLoaded:function(){i.isIframeLoaded=!0;var t=i.stateManager.getState();i.handleStateChange({isInitialized:t.isInitialized,error:t.error,chatbotConfig:t.chatbotConfig,isIframeVisible:t.isIframeVisible})},onInternalEvent:i.eventEmitter.onInternalEvent,position:i.config.position,bottomSpacing:i.config.bottomSpacing,overrides:i.config.overrides}),i.iframe.getElement&&"function"==typeof i.iframe.getElement){var f=i.iframe.getElement();f&&i.container&&i.container.getElement().prepend(f)}var v=void 0!==i.config.show_launcher?!!i.config.show_launcher:null===(n=null==u?void 0:u.show_launcher)||void 0===n||n,h=!0===(null===(e=null==u?void 0:u.launcher_delay)||void 0===e?void 0:e.enabled),p=null!==(l=null!==(r=null===(o=null==u?void 0:u.launcher_delay)||void 0===o?void 0:o.seconds)&&void 0!==r?r:null===(a=null==u?void 0:u.launcher_delay)||void 0===a?void 0:a.delay)&&void 0!==l?l:0,m=function(){if(i.isIframeLoaded)if(i.floatingButton)i.floatingButton.update({config:u,isIframeVisible:c,position:i.config.position,sideSpacing:i.config.sideSpacing,bottomSpacing:i.config.bottomSpacing,launcher_size:i.config.launcher_size});else if(i.floatingButton=new jt({config:u,toggleIframe:i.toggleIframe,isIframeVisible:c,onEvent:i.config.onEvent,onInternalEvent:i.eventEmitter.onInternalEvent,position:i.config.position,sideSpacing:i.config.sideSpacing,bottomSpacing:i.config.bottomSpacing,launcher_size:i.config.launcher_size}),i.floatingButton.getElement&&"function"==typeof i.floatingButton.getElement){var t=i.floatingButton.getElement();t&&i.container&&i.container.getElement().appendChild(t)}};i.launcherDelayTimeout&&(clearTimeout(i.launcherDelayTimeout),i.launcherDelayTimeout=null),v?h&&+p>0&&!i.floatingButton?i.launcherDelayTimeout=window.setTimeout((function(){i.isIframeLoaded&&m(),i.launcherDelayTimeout=null}),1e3*+p):i.isIframeLoaded&&m():i.floatingButton&&(i.floatingButton.destroy(),i.floatingButton=null)}}},this.toggleIframe=function(){var t=i.stateManager.getState();i.stateManager.toggleIframeVisibility(),i.eventEmitter.emit(t.isIframeVisible?m.CHATBOT_CLOSED:m.CHATBOT_BUTTON_CLICKED)},this.handleClose=function(){i.stateManager.closeIframe(),i.eventEmitter.emit(m.CHATBOT_CLOSED)};var n=d(d({},t),{position:"string"==typeof t.position?"left"===t.position.toLowerCase()?"Left":"right"===t.position.toLowerCase()?"Right":void 0:void 0,sideSpacing:"string"==typeof t.sideSpacing?""===t.sideSpacing||isNaN(+t.sideSpacing)?void 0:+t.sideSpacing:t.sideSpacing,bottomSpacing:"string"==typeof t.bottomSpacing?""===t.bottomSpacing||isNaN(+t.bottomSpacing)?void 0:+t.bottomSpacing:t.bottomSpacing,show_launcher:t.show_launcher,overrides:t.overrides,launcher_size:t.launcher_size});if(this.config=n,!t.api_key)throw Jt.trackError(Error(ni[Vt](t.api_key)),"RobylonChatbot",{errorCode:Vt,errorType:ii,context:{timestamp:Date.now()}}),Error("API key is required");try{Jt.initialize(t.api_key,t.user_id)}catch(t){Jt.trackError(t instanceof Error?t:Error(t+""),"RobylonChatbot",{errorCode:Zt,errorType:ii,context:{timestamp:Date.now()}})}this.stateManager=hi({api_key:t.api_key,user_id:t.user_id,user_token:t.user_token,user_profile:t.user_profile}),this.eventEmitter=pi({api_key:t.api_key,user_profile:t.user_profile,onEvent:t.onEvent,chatbotConfig:null}),this.initialize()}return t.prototype.initialize=function(){return u(this,void 0,void 0,(function(){var t;return c(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return i.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return t=i.sent(),Jt.trackError(t instanceof Error?t:Error(t+""),"RobylonChatbot.initialize",{errorCode:Kt,errorType:ii,context:{timestamp:Date.now()}}),[3,3];case 3:return[2]}}))}))},t.prototype.show=function(){this.stateManager.getState().isIframeVisible||(this.stateManager.toggleIframeVisibility(),this.eventEmitter.emit(m.CHATBOT_BUTTON_CLICKED))},t.prototype.hide=function(){this.stateManager.getState().isIframeVisible&&(this.stateManager.closeIframe(),this.eventEmitter.emit(m.CHATBOT_CLOSED))},t.prototype.toggle=function(){this.toggleIframe()},t.prototype.destroy=function(){this.isDestroyed=!0,this.floatingButton&&(this.floatingButton.destroy(),this.floatingButton=null),this.launcherDelayTimeout&&(clearTimeout(this.launcherDelayTimeout),this.launcherDelayTimeout=null),this.iframe&&(this.iframe.destroy(),this.iframe=null),this.container&&(this.container.destroy(),this.container=null),this.stateManager.unsubscribe(this.handleStateChange)},t.prototype.getState=function(){return this.stateManager.getState().isInitialized?"initialized":"uninitialized"},t}();function gi(t){return new mi(t)}if("undefined"!=typeof window){!function(){if("undefined"!=typeof window){var t=window,i=(null==t?void 0:t.RobylonChatbot)||(null==t?void 0:t.R);if(i&&Array.isArray(i.q)){var n=null;i.q.forEach((function(t){var i=t[0];if("init"===i){var e=t[1]||{};n=gi(e)}else n&&"function"==typeof n[i]&&n[i]()})),t.RobylonChatbot=function(t){var i=[].slice.call(arguments,1);return"init"===t?n=gi(i[0]||{}):n&&"function"==typeof n[t]?n[t].apply(n,i):void 0},(null==t?void 0:t.R)||(t.R=t.RobylonChatbot),t.RobylonChatbot.getState=function(){return"initialized"},(null==t?void 0:t.R)&&(t.R.getState=t.RobylonChatbot.getState)}}}();var bi=window,wi=null==bi?void 0:bi.RobylonChatbot;wi&&!(null==bi?void 0:bi.R)&&(bi.R=wi)}var yi={create:gi,getState:function(){return"initialized"}};t.create=gi,t.default=yi,Object.defineProperty(t,"i",{value:!0})}));
1
+ !function(i,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((i="undefined"!=typeof globalThis?globalThis:i||self).RobylonChatbot={})}(this,(function(i){"use strict";var t,n,e,o,r,l,a,s,d=function(){return d=Object.assign||function(i){for(var t,n=1,e=arguments.length;e>n;n++)for(var o in t=arguments[n])({}).hasOwnProperty.call(t,o)&&(i[o]=t[o]);return i},d.apply(this,arguments)};function u(i,t,n,e){return new(n||(n=Promise))((function(o,r){function l(i){try{s(e.next(i))}catch(i){r(i)}}function a(i){try{s(e.throw(i))}catch(i){r(i)}}function s(i){var t;i.done?o(i.value):(t=i.value,t instanceof n?t:new n((function(i){i(t)}))).then(l,a)}s((e=e.apply(i,t||[])).next())}))}function c(i,t){var n,e,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(r=0)),r;)try{if(n=1,e&&(o=2&a[0]?e.return:a[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,a[1])).done)return o;switch(e=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,e=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!((o=(o=r.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(i,r)}catch(i){a=[6,i],e=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function v(i,t,n){if(n||2===arguments.length)for(var e,o=0,r=t.length;r>o;o++)!e&&o in t||(e||(e=[].slice.call(t,0,o)),e[o]=t[o]);return i.concat(e||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(i){i.WIDGET="WIDGET",i.POPOVER="POPOVER",i.EMBED="EMBED"}(t||(t={})),function(i){i.RIGHT="Right",i.LEFT="Left"}(n||(n={})),function(i){i.TEXT="TEXT",i.IMAGE="IMAGE",i.TEXTUAL_IMAGE="TEXTUAL_IMAGE"}(e||(e={})),function(i){i.WORKING_HOURS="WORKING_HOURS",i.ALWAYS="ALWAYS"}(o||(o={})),function(i){i.URL="URL"}(r||(r={})),function(i){i.AND="AND",i.OR="OR"}(l||(l={})),function(i){i.IS="IS",i.IS_NOT="IS_NOT",i.CONTAINS="CONTAINS",i.DOES_NOT_CONTAIN="DOES_NOT_CONTAIN",i.STARTS_WITH="STARTS_WITH",i.ENDS_WITH="ENDS_WITH"}(a||(a={})),function(i){i.BUTTON="BUTTON",i.TEXT="TEXT"}(s||(s={}));var f=function(i,t){void 0===t&&(t=.5);var n,e,o,r,l=function(i){i=i.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(i,t,n,e){return t+t+n+n+e+e}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:{r:0,g:0,b:0}}(i);return(n=l.r,e=l.g,o=l.b,.2126*(r=[n,e,o].map((function(i){return(i/=255)>.03928?Math.pow((i+.055)/1.055,2.4):i/12.92})))[0]+.7152*r[1]+.0722*r[2])>t?"#0E0E0F":"#FFFFFF"},h={log:function(){for(var i=[],t=0;arguments.length>t;t++)i[t]=arguments[t];console.log.apply(console,i)},error:function(){for(var i=[],t=0;arguments.length>t;t++)i[t]=arguments[t];console.error.apply(console,i)},warn:function(){for(var i=[],t=0;arguments.length>t;t++)i[t]=arguments[t];console.warn.apply(console,i)},info:function(){}};h.log("Raw API_URL:","https://api.robylon.ai");var p={copilotUrl:"https://chatbot.robylon.ai",environment:"production",apiUrl:"https://api.robylon.ai"};h.log("CONFIG",p);var m,g,w=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},b=function(){return{copilotUrl:p.copilotUrl||"https://app.robylon.ai",environment:p.environment||"production",apiUrl:p.apiUrl||"https://app.robylon.ai"}};!function(i){i.CHATBOT_BUTTON_LOADED="CHATBOT_BUTTON_LOADED",i.CHATBOT_BUTTON_CLICKED="CHATBOT_BUTTON_CLICKED",i.CHATBOT_OPENED="CHATBOT_OPENED",i.CHATBOT_CLOSED="CHATBOT_CLOSED",i.CHATBOT_APP_READY="CHATBOT_APP_READY",i.CHATBOT_LOADED="CHATBOT_LOADED",i.CHAT_INITIALIZED="CHAT_INITIALIZED",i.SESSION_REFRESHED="SESSION_REFRESHED",i.CHAT_INITIALIZATION_FAILED="CHAT_INITIALIZATION_FAILED",i.CHATBOT_READY="CHATBOT_READY"}(m||(m={})),function(i){i.CHAT_MOVED="CHAT_MOVED",i.CHATBOT_TOKEN_EXHAUSTED="CHATBOT_TOKEN_EXHAUSTED"}(g||(g={}));var y,x="system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",_="21px",I="",S=[],T=!1,E=function(){return"undefined"==typeof window?"":window.location.href},A=function(){return E()},k=function(){var i=E();i!==I&&(I=i,S.forEach((function(t){return t(i)})))},R=function(i,t,n,e){var o=t||"",r=E(),l=e||r,s=function(i,t){return-1!==t.indexOf(i)}(o,l);switch(n){case a.IS:return l===o;case a.IS_NOT:return l!==o;case a.CONTAINS:return s;case a.DOES_NOT_CONTAIN:return!s;case a.STARTS_WITH:return l.startsWith(o);case a.ENDS_WITH:return l.endsWith(o);default:return!1}},O=null,D=null,C=function(){return O===A()},z=function(){var i=D;return D=null,i},M=function(){return!0},N=((y={})[o.WORKING_HOURS]=function(i,t){var n=t.getHours(),e=t.getMinutes();return(n>10||10===n&&e>=0)&&(19>n||19===n&&0===e)},y[o.ALWAYS]=M,y);const{entries:F,setPrototypeOf:j,isFrozen:L,getPrototypeOf:U,getOwnPropertyDescriptor:P}=Object;let{freeze:W,seal:B,create:H}=Object,{apply:V,construct:Y}="undefined"!=typeof Reflect&&Reflect;W||(W=function(i){return i}),B||(B=function(i){return i}),V||(V=function(i,t){for(var n=arguments.length,e=Array(n>2?n-2:0),o=2;n>o;o++)e[o-2]=arguments[o];return i.apply(t,e)}),Y||(Y=function(i){for(var t=arguments.length,n=Array(t>1?t-1:0),e=1;t>e;e++)n[e-1]=arguments[e];return new i(...n)});const K=ai([].forEach),X=ai([].lastIndexOf),G=ai([].pop),J=ai([].push),Z=ai([].splice),q=ai("".toLowerCase),Q=ai("".toString),$=ai("".match),ii=ai("".replace),ti=ai("".indexOf),ni=ai("".trim),ei=ai({}.hasOwnProperty),oi=ai(/t/.test),ri=(li=TypeError,function(){for(var i=arguments.length,t=Array(i),n=0;i>n;n++)t[n]=arguments[n];return Y(li,t)});var li;function ai(i){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,e=Array(n>1?n-1:0),o=1;n>o;o++)e[o-1]=arguments[o];return V(i,t,e)}}function si(i,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:q;j&&j(i,null);let e=t.length;for(;e--;){let o=t[e];if("string"==typeof o){const i=n(o);i!==o&&(L(t)||(t[e]=i),o=i)}i[o]=!0}return i}function di(i){for(let t=0;t<i.length;t++)ei(i,t)||(i[t]=null);return i}function ui(i){const t=H(null);for(const[n,e]of F(i))ei(i,n)&&(Array.isArray(e)?t[n]=di(e):e&&"object"==typeof e&&e.constructor===Object?t[n]=ui(e):t[n]=e);return t}function ci(i,t){for(;null!==i;){const n=P(i,t);if(n){if(n.get)return ai(n.get);if("function"==typeof n.value)return ai(n.value)}i=U(i)}return function(){return null}}const vi=W(["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"]),fi=W(["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"]),hi=W(["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"]),pi=W(["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"]),mi=W(["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"]),gi=W(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),wi=W(["#text"]),bi=W(["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"]),yi=W(["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"]),xi=W(["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"]),_i=W(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ii=B(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Si=B(/<%[\w\W]*|[\w\W]*%>/gm),Ti=B(/\$\{[\w\W]*/gm),Ei=B(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ai=B(/^aria-[\-\w]+$/),ki=B(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ri=B(/^(?:\w+script|data):/i),Oi=B(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Di=B(/^html$/i),Ci=B(/^[a-z][.\w]*(-[.\w]+)+$/i);var zi=Object.freeze({__proto__:null,ARIA_ATTR:Ai,ATTR_WHITESPACE:Oi,CUSTOM_ELEMENT:Ci,DATA_ATTR:Ei,DOCTYPE_NAME:Di,ERB_EXPR:Si,IS_ALLOWED_URI:ki,IS_SCRIPT_OR_DATA:Ri,MUSTACHE_EXPR:Ii,TMPLIT_EXPR:Ti});const Mi=function(){return"undefined"==typeof window?null:window};var Ni,Fi=function i(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Mi();const n=t=>i(t);if(n.version="3.3.0",n.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return n.isSupported=!1,n;let{document:e}=t;const o=e,r=o.currentScript,{DocumentFragment:l,HTMLTemplateElement:a,Node:s,Element:d,NodeFilter:u,NamedNodeMap:c=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:v,DOMParser:f,trustedTypes:h}=t,p=d.prototype,m=ci(p,"cloneNode"),g=ci(p,"remove"),w=ci(p,"nextSibling"),b=ci(p,"childNodes"),y=ci(p,"parentNode");if("function"==typeof a){const i=e.createElement("template");i.content&&i.content.ownerDocument&&(e=i.content.ownerDocument)}let x,_="";const{implementation:I,createNodeIterator:S,createDocumentFragment:T,getElementsByTagName:E}=e,{importNode:A}=o;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof F&&"function"==typeof y&&I&&void 0!==I.createHTMLDocument;const{MUSTACHE_EXPR:R,ERB_EXPR:O,TMPLIT_EXPR:D,DATA_ATTR:C,ARIA_ATTR:z,IS_SCRIPT_OR_DATA:M,ATTR_WHITESPACE:N,CUSTOM_ELEMENT:j}=zi;let{IS_ALLOWED_URI:L}=zi,U=null;const P=si({},[...vi,...fi,...hi,...mi,...wi]);let B=null;const V=si({},[...bi,...yi,...xi,..._i]);let Y=Object.seal(H(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}})),li=null,ai=null;const di=Object.seal(H(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ii=!0,Si=!0,Ti=!1,Ei=!0,Ai=!1,Ri=!0,Oi=!1,Ci=!1,Ni=!1,Fi=!1,ji=!1,Li=!1,Ui=!0,Pi=!1,Wi=!0,Bi=!1,Hi={},Vi=null;const Yi=si({},["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 Ki=null;const Xi=si({},["audio","video","img","source","image","track"]);let Gi=null;const Ji=si({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Zi="http://www.w3.org/1998/Math/MathML",qi="http://www.w3.org/2000/svg",Qi="http://www.w3.org/1999/xhtml";let $i=Qi,it=!1,tt=null;const nt=si({},[Zi,qi,Qi],Q);let et=si({},["mi","mo","mn","ms","mtext"]),ot=si({},["annotation-xml"]);const rt=si({},["title","style","font","a","script"]);let lt=null;const at=["application/xhtml+xml","text/html"];let st=null,dt=null;const ut=e.createElement("form"),ct=function(i){return i instanceof RegExp||i instanceof Function},vt=function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!dt||dt!==i){if(i&&"object"==typeof i||(i={}),i=ui(i),lt=-1===at.indexOf(i.PARSER_MEDIA_TYPE)?"text/html":i.PARSER_MEDIA_TYPE,st="application/xhtml+xml"===lt?Q:q,U=ei(i,"ALLOWED_TAGS")?si({},i.ALLOWED_TAGS,st):P,B=ei(i,"ALLOWED_ATTR")?si({},i.ALLOWED_ATTR,st):V,tt=ei(i,"ALLOWED_NAMESPACES")?si({},i.ALLOWED_NAMESPACES,Q):nt,Gi=ei(i,"ADD_URI_SAFE_ATTR")?si(ui(Ji),i.ADD_URI_SAFE_ATTR,st):Ji,Ki=ei(i,"ADD_DATA_URI_TAGS")?si(ui(Xi),i.ADD_DATA_URI_TAGS,st):Xi,Vi=ei(i,"FORBID_CONTENTS")?si({},i.FORBID_CONTENTS,st):Yi,li=ei(i,"FORBID_TAGS")?si({},i.FORBID_TAGS,st):ui({}),ai=ei(i,"FORBID_ATTR")?si({},i.FORBID_ATTR,st):ui({}),Hi=!!ei(i,"USE_PROFILES")&&i.USE_PROFILES,Ii=!1!==i.ALLOW_ARIA_ATTR,Si=!1!==i.ALLOW_DATA_ATTR,Ti=i.ALLOW_UNKNOWN_PROTOCOLS||!1,Ei=!1!==i.ALLOW_SELF_CLOSE_IN_ATTR,Ai=i.SAFE_FOR_TEMPLATES||!1,Ri=!1!==i.SAFE_FOR_XML,Oi=i.WHOLE_DOCUMENT||!1,Fi=i.RETURN_DOM||!1,ji=i.RETURN_DOM_FRAGMENT||!1,Li=i.RETURN_TRUSTED_TYPE||!1,Ni=i.FORCE_BODY||!1,Ui=!1!==i.SANITIZE_DOM,Pi=i.SANITIZE_NAMED_PROPS||!1,Wi=!1!==i.KEEP_CONTENT,Bi=i.IN_PLACE||!1,L=i.ALLOWED_URI_REGEXP||ki,$i=i.NAMESPACE||Qi,et=i.MATHML_TEXT_INTEGRATION_POINTS||et,ot=i.HTML_INTEGRATION_POINTS||ot,Y=i.CUSTOM_ELEMENT_HANDLING||{},i.CUSTOM_ELEMENT_HANDLING&&ct(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=i.CUSTOM_ELEMENT_HANDLING.tagNameCheck),i.CUSTOM_ELEMENT_HANDLING&&ct(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),i.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Y.allowCustomizedBuiltInElements=i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ai&&(Si=!1),ji&&(Fi=!0),Hi&&(U=si({},wi),B=[],!0===Hi.html&&(si(U,vi),si(B,bi)),!0===Hi.svg&&(si(U,fi),si(B,yi),si(B,_i)),!0===Hi.svgFilters&&(si(U,hi),si(B,yi),si(B,_i)),!0===Hi.mathMl&&(si(U,mi),si(B,xi),si(B,_i))),i.ADD_TAGS&&("function"==typeof i.ADD_TAGS?di.tagCheck=i.ADD_TAGS:(U===P&&(U=ui(U)),si(U,i.ADD_TAGS,st))),i.ADD_ATTR&&("function"==typeof i.ADD_ATTR?di.attributeCheck=i.ADD_ATTR:(B===V&&(B=ui(B)),si(B,i.ADD_ATTR,st))),i.ADD_URI_SAFE_ATTR&&si(Gi,i.ADD_URI_SAFE_ATTR,st),i.FORBID_CONTENTS&&(Vi===Yi&&(Vi=ui(Vi)),si(Vi,i.FORBID_CONTENTS,st)),Wi&&(U["#text"]=!0),Oi&&si(U,["html","head","body"]),U.table&&(si(U,["tbody"]),delete li.tbody),i.TRUSTED_TYPES_POLICY){if("function"!=typeof i.TRUSTED_TYPES_POLICY.createHTML)throw ri('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof i.TRUSTED_TYPES_POLICY.createScriptURL)throw ri('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=i.TRUSTED_TYPES_POLICY,_=x.createHTML("")}else void 0===x&&(x=function(i,t){if("object"!=typeof i||"function"!=typeof i.createPolicy)return null;let n=null;const e="data-tt-policy-suffix";t&&t.hasAttribute(e)&&(n=t.getAttribute(e));const o="dompurify"+(n?"#"+n:"");try{return i.createPolicy(o,{createHTML:i=>i,createScriptURL:i=>i})}catch(i){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(h,r)),null!==x&&"string"==typeof _&&(_=x.createHTML(""));W&&W(i),dt=i}},ft=si({},[...fi,...hi,...pi]),ht=si({},[...mi,...gi]),pt=function(i){J(n.removed,{element:i});try{y(i).removeChild(i)}catch(t){g(i)}},mt=function(i,t){try{J(n.removed,{attribute:t.getAttributeNode(i),from:t})}catch(i){J(n.removed,{attribute:null,from:t})}if(t.removeAttribute(i),"is"===i)if(Fi||ji)try{pt(t)}catch(i){}else try{t.setAttribute(i,"")}catch(i){}},gt=function(i){let t=null,n=null;if(Ni)i="<remove></remove>"+i;else{const t=$(i,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===lt&&$i===Qi&&(i='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+i+"</body></html>");const o=x?x.createHTML(i):i;if($i===Qi)try{t=(new f).parseFromString(o,lt)}catch(i){}if(!t||!t.documentElement){t=I.createDocument($i,"template",null);try{t.documentElement.innerHTML=it?_:o}catch(i){}}const r=t.body||t.documentElement;return i&&n&&r.insertBefore(e.createTextNode(n),r.childNodes[0]||null),$i===Qi?E.call(t,Oi?"html":"body")[0]:Oi?t.documentElement:r},wt=function(i){return S.call(i.ownerDocument||i,i,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},bt=function(i){return i instanceof v&&("string"!=typeof i.nodeName||"string"!=typeof i.textContent||"function"!=typeof i.removeChild||!(i.attributes instanceof c)||"function"!=typeof i.removeAttribute||"function"!=typeof i.setAttribute||"string"!=typeof i.namespaceURI||"function"!=typeof i.insertBefore||"function"!=typeof i.hasChildNodes)},yt=function(i){return"function"==typeof s&&i instanceof s};function xt(i,t,e){K(i,(i=>{i.call(n,t,e,dt)}))}const _t=function(i){let t=null;if(xt(k.beforeSanitizeElements,i,null),bt(i))return pt(i),!0;const e=st(i.nodeName);if(xt(k.uponSanitizeElement,i,{tagName:e,allowedTags:U}),Ri&&i.hasChildNodes()&&!yt(i.firstElementChild)&&oi(/<[/\w!]/g,i.innerHTML)&&oi(/<[/\w!]/g,i.textContent))return pt(i),!0;if(7===i.nodeType)return pt(i),!0;if(Ri&&8===i.nodeType&&oi(/<[/\w]/g,i.data))return pt(i),!0;if(!(di.tagCheck instanceof Function&&di.tagCheck(e))&&(!U[e]||li[e])){if(!li[e]&&St(e)){if(Y.tagNameCheck instanceof RegExp&&oi(Y.tagNameCheck,e))return!1;if(Y.tagNameCheck instanceof Function&&Y.tagNameCheck(e))return!1}if(Wi&&!Vi[e]){const t=y(i)||i.parentNode,n=b(i)||i.childNodes;if(n&&t)for(let e=n.length-1;e>=0;--e){const o=m(n[e],!0);o.i=(i.i||0)+1,t.insertBefore(o,w(i))}}return pt(i),!0}return i instanceof d&&!function(i){let t=y(i);t&&t.tagName||(t={namespaceURI:$i,tagName:"template"});const n=q(i.tagName),e=q(t.tagName);return!!tt[i.namespaceURI]&&(i.namespaceURI===qi?t.namespaceURI===Qi?"svg"===n:t.namespaceURI===Zi?"svg"===n&&("annotation-xml"===e||et[e]):!!ft[n]:i.namespaceURI===Zi?t.namespaceURI===Qi?"math"===n:t.namespaceURI===qi?"math"===n&&ot[e]:!!ht[n]:i.namespaceURI===Qi?!(t.namespaceURI===qi&&!ot[e])&&!(t.namespaceURI===Zi&&!et[e])&&!ht[n]&&(rt[n]||!ft[n]):!("application/xhtml+xml"!==lt||!tt[i.namespaceURI]))}(i)?(pt(i),!0):"noscript"!==e&&"noembed"!==e&&"noframes"!==e||!oi(/<\/no(script|embed|frames)/i,i.innerHTML)?(Ai&&3===i.nodeType&&(t=i.textContent,K([R,O,D],(i=>{t=ii(t,i," ")})),i.textContent!==t&&(J(n.removed,{element:i.cloneNode()}),i.textContent=t)),xt(k.afterSanitizeElements,i,null),!1):(pt(i),!0)},It=function(i,t,n){if(Ui&&("id"===t||"name"===t)&&(n in e||n in ut))return!1;if(Si&&!ai[t]&&oi(C,t));else if(Ii&&oi(z,t));else if(di.attributeCheck instanceof Function&&di.attributeCheck(t,i));else if(!B[t]||ai[t]){if(!(St(i)&&(Y.tagNameCheck instanceof RegExp&&oi(Y.tagNameCheck,i)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(i))&&(Y.attributeNameCheck instanceof RegExp&&oi(Y.attributeNameCheck,t)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(t,i))||"is"===t&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&oi(Y.tagNameCheck,n)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(n))))return!1}else if(Gi[t]);else if(oi(L,ii(n,N,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===i||0!==ti(n,"data:")||!Ki[i])if(Ti&&!oi(M,ii(n,N,"")));else if(n)return!1;return!0},St=function(i){return"annotation-xml"!==i&&$(i,j)},Tt=function(i){xt(k.beforeSanitizeAttributes,i,null);const{attributes:t}=i;if(!t||bt(i))return;const e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0};let o=t.length;for(;o--;){const r=t[o],{name:l,namespaceURI:a,value:s}=r,d=st(l),u=s;let c="value"===l?u:ni(u);if(e.attrName=d,e.attrValue=c,e.keepAttr=!0,e.forceKeepAttr=void 0,xt(k.uponSanitizeAttribute,i,e),c=e.attrValue,!Pi||"id"!==d&&"name"!==d||(mt(l,i),c="user-content-"+c),Ri&&oi(/((--!?|])>)|<\/(style|title|textarea)/i,c)){mt(l,i);continue}if("attributename"===d&&$(c,"href")){mt(l,i);continue}if(e.forceKeepAttr)continue;if(!e.keepAttr){mt(l,i);continue}if(!Ei&&oi(/\/>/i,c)){mt(l,i);continue}Ai&&K([R,O,D],(i=>{c=ii(c,i," ")}));const v=st(i.nodeName);if(It(v,d,c)){if(x&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(a);else switch(h.getAttributeType(v,d)){case"TrustedHTML":c=x.createHTML(c);break;case"TrustedScriptURL":c=x.createScriptURL(c)}if(c!==u)try{a?i.setAttributeNS(a,l,c):i.setAttribute(l,c),bt(i)?pt(i):G(n.removed)}catch(t){mt(l,i)}}else mt(l,i)}xt(k.afterSanitizeAttributes,i,null)},Et=function i(t){let n=null;const e=wt(t);for(xt(k.beforeSanitizeShadowDOM,t,null);n=e.nextNode();)xt(k.uponSanitizeShadowNode,n,null),_t(n),Tt(n),n.content instanceof l&&i(n.content);xt(k.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(i){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=null,r=null,a=null,d=null;if(it=!i,it&&(i="\x3c!--\x3e"),"string"!=typeof i&&!yt(i)){if("function"!=typeof i.toString)throw ri("toString is not a function");if("string"!=typeof(i=i.toString()))throw ri("dirty is not a string, aborting")}if(!n.isSupported)return i;if(Ci||vt(t),n.removed=[],"string"==typeof i&&(Bi=!1),Bi){if(i.nodeName){const t=st(i.nodeName);if(!U[t]||li[t])throw ri("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof s)e=gt("\x3c!----\x3e"),r=e.ownerDocument.importNode(i,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?e=r:e.appendChild(r);else{if(!Fi&&!Ai&&!Oi&&-1===i.indexOf("<"))return x&&Li?x.createHTML(i):i;if(e=gt(i),!e)return Fi?null:Li?_:""}e&&Ni&&pt(e.firstChild);const u=wt(Bi?i:e);for(;a=u.nextNode();)_t(a),Tt(a),a.content instanceof l&&Et(a.content);if(Bi)return i;if(Fi){if(ji)for(d=T.call(e.ownerDocument);e.firstChild;)d.appendChild(e.firstChild);else d=e;return(B.shadowroot||B.shadowrootmode)&&(d=A.call(o,d,!0)),d}let c=Oi?e.outerHTML:e.innerHTML;return Oi&&U["!doctype"]&&e.ownerDocument&&e.ownerDocument.doctype&&e.ownerDocument.doctype.name&&oi(Di,e.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+e.ownerDocument.doctype.name+">\n"+c),Ai&&K([R,O,D],(i=>{c=ii(c,i," ")})),x&&Li?x.createHTML(c):c},n.setConfig=function(){vt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ci=!0},n.clearConfig=function(){dt=null,Ci=!1},n.isValidAttribute=function(i,t,n){dt||vt({});const e=st(i),o=st(t);return It(e,o,n)},n.addHook=function(i,t){"function"==typeof t&&J(k[i],t)},n.removeHook=function(i,t){if(void 0!==t){const n=X(k[i],t);return-1===n?void 0:Z(k[i],n,1)[0]}return G(k[i])},n.removeHooks=function(i){k[i]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),ji=function(){function i(i){var t,n=this;this.resizeObserver=null,this.proactiveElement=null,this.urlUnsubscribe=null,this.delayTimers=[],this.scrollHandlers=new Map,this.shownScrollMessages=new Set,this.config=i,this.buttonElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.render(),this.mount();try{this.buttonElement.style.opacity="0",this.buttonElement.style.transition="transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 280ms ease",requestAnimationFrame((function(){n.buttonElement.style.opacity="1"}))}catch(i){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=(t=function(){n.clearProactiveDelays(),n.renderProactiveIfNeeded(!0)},T||function(){if(!T&&"undefined"!=typeof window){T=!0,I=E();var i=function(i){var t=history[i];return function(){for(var i=[],n=0;arguments.length>n;n++)i[n]=arguments[n];var e=t.apply(this,i);return setTimeout(k,0),e}};try{history.pushState=i("pushState"),history.replaceState=i("replaceState")}catch(i){}window.addEventListener("popstate",k),window.addEventListener("hashchange",k);var t=setInterval((function(){k()}),1e3);setInterval((function(){0===S.length&&(clearInterval(t),window.removeEventListener("popstate",k),window.removeEventListener("hashchange",k),T=!1)}),5e3)}}(),S.push(t),t(E()),function(){var i=S.indexOf(t);i>-1&&S.splice(i,1)})}return i.prototype.render=function(){var i,t,n=this;b().copilotUrl;var o=this.config,r=o.config,l=o.isIframeVisible,a=null!==(i=null==r?void 0:r.launcher_size_multiplier)&&void 0!==i?i:1,s=null!==(t=this.config.launcher_size)&&void 0!==t?t:48*a,d={zIndex:"1000",display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97)",transform:l?"scale(0.85)":"scale(1)",fontFamily:x};r.launcher_type===e.IMAGE&&Object.assign(d,{width:"".concat(s,"px"),height:"".concat(s,"px"),borderRadius:"50%",backgroundColor:r.brand_colour}),this.applyResponsiveStyles(d),this.buttonElement.className="message-bubble-container",this.buttonElement.innerHTML="",this.buttonElement.appendChild(this.createLauncherElement()),this.buttonElement.onclick=function(){n.config.toggleIframe(),n.hideProactiveMessages()},this.renderProactiveIfNeeded()},i.prototype.createLauncherElement=function(){var i,t,n,o,r=this.config,l=r.config,a=r.isIframeVisible,s=b().copilotUrl,d=null!==(i=null==l?void 0:l.launcher_size_multiplier)&&void 0!==i?i:1,u=null!==(t=this.config.launcher_size)&&void 0!==t?t:48*d;switch(console.log("config in floating button",l),l.launcher_type){case e.TEXT:return this.createTextLauncher();case e.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case e.IMAGE:default:if(a){var c=Math.round(.5*u),v=document.createElement("div");Object.assign(v.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});var f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",c+""),f.setAttribute("height",c+""),f.setAttribute("viewBox","0 0 24 24"),f.setAttribute("fill","none"),f.setAttribute("xmlns","http://www.w3.org/2000/svg"),f.style.display="block";var h=document.createElementNS("http://www.w3.org/2000/svg","path");return h.setAttribute("d","M19 9L12 16L5 9"),h.setAttribute("stroke","currentColor"),h.setAttribute("stroke-width","1.5"),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round"),f.appendChild(h),v.appendChild(f),v}var p=document.createElement("img");return p.src=l.launcher_type?(null===(o=null===(n=l.images)||void 0===n?void 0:n.launcher_image_url)||void 0===o?void 0:o.url)||"".concat(s,"/chatbubble.png"):l.image_url||"".concat(s,"/chatbubble.png"),p.alt="Chat",Object.assign(p.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover",width:"100%",height:"100%",boxSizing:"border-box"}),p}},i.prototype.createTextLauncher=function(){var i=this.config.config,t=i.brand_colour,n=i.launcher_properties,e=i.launcher_size_multiplier,o=null!=e?e:1,r=void 0!==this.config.launcher_size?void 0:160*o,l=void 0!==this.config.launcher_size?void 0:40*o,a=void 0!==this.config.launcher_size?void 0:14*o,s=void 0!==this.config.launcher_size?void 0:21*o,d=document.createElement("div");Object.assign(d.style,{width:void 0!==r?"".concat(r,"px"):"fit-content",maxWidth:void 0!==r?"".concat(r,"px"):"160px",height:void 0!==l?"".concat(l,"px"):"40px",borderRadius:"9999px",backgroundColor:t,display:"flex",alignItems:"center",padding:"9px 20px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",boxSizing:"border-box"});var u=document.createElement("div");Object.assign(u.style,{flex:"1",minWidth:"0"});var c=document.createElement("p");return Object.assign(c.style,{margin:"0",color:f(t),fontSize:void 0!==a?"".concat(a,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==s?"".concat(s,"px"):_,fontFamily:x,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),c.textContent=(null==n?void 0:n.text)||"",u.appendChild(c),d.appendChild(u),d},i.prototype.createTextualImageLauncher=function(){var i,t,n,e,o,r,l=b().copilotUrl,a=this.config.config,s=a.brand_colour,d=a.launcher_properties,u=a.image_url,c=a.launcher_size_multiplier,v=null!=c?c:1,h=void 0!==this.config.launcher_size?void 0:174*v,p=void 0!==this.config.launcher_size?void 0:40*v,m=void 0!==this.config.launcher_size?void 0:40*v,g=void 0!==this.config.launcher_size?void 0:14*v,w=void 0!==this.config.launcher_size?void 0:21*v,y=document.createElement("div");Object.assign(y.style,{maxWidth:void 0!==h?"".concat(h,"px"):"13rem",width:"fit-content",height:void 0!==p?"".concat(p,"px"):"40px",borderRadius:"9999px",backgroundColor:s,display:"flex",alignItems:"center",paddingLeft:"20px",paddingRight:"0",paddingTop:"9px",paddingBottom:"9px",boxShadow:"0px 0px 16px 0px rgba(0, 0, 0, 0.24)",gap:"8px",boxSizing:"border-box"});var I=document.createElement("div");Object.assign(I.style,{flex:"1",minWidth:"0"});var S=document.createElement("p");Object.assign(S.style,{margin:"0",color:f(s),fontSize:void 0!==g?"".concat(g,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==w?"".concat(w,"px"):_,fontFamily:x,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),S.textContent=(null==d?void 0:d.text)||"";var T=document.createElement("div");Object.assign(T.style,{width:void 0!==m?"".concat(m,"px"):"40px",height:void 0!==m?"".concat(m,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var E=document.createElement("img");return E.src=(null===(t=null===(i=null==this?void 0:this.config)||void 0===i?void 0:i.config)||void 0===t?void 0:t.launcher_type)?(null===(r=null===(o=null===(e=null===(n=null==this?void 0:this.config)||void 0===n?void 0:n.config)||void 0===e?void 0:e.images)||void 0===o?void 0:o.launcher_image_url)||void 0===r?void 0:r.url)||"".concat(l,"/chatbubble.png"):u||"".concat(l,"/chatbubble.png"),E.alt="Chat",Object.assign(E.style,{width:"100%",height:"100%",objectFit:"cover"}),I.appendChild(S),T.appendChild(E),y.appendChild(I),y.appendChild(T),y},i.prototype.applyResponsiveStyles=function(i){var t,n,e,o,r,l,a,s,u,c=560>(null===window||void 0===window?void 0:window.innerWidth),v=this.config.config,f=this.config.position||(null===(e=v.interface_properties)||void 0===e?void 0:e.position)||"Right",h=null!==(l=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(r=v.interface_properties)||void 0===r?void 0:r.side_spacing)&&void 0!==l?l:20,p=null!==(u=null!==(a=this.config.bottomSpacing)&&void 0!==a?a:null===(s=v.interface_properties)||void 0===s?void 0:s.bottom_spacing)&&void 0!==u?u:20;this.buttonElement.style.position="",this.buttonElement.style.bottom="",this.buttonElement.style.right="",this.buttonElement.style.left="";var m=d(d({},i),c?((t={position:"fixed",bottom:"".concat(p,"px")})[f.toLowerCase()]="".concat(h,"px"),t):((n={bottom:"".concat(p,"px")})[f.toLowerCase()]="".concat(h,"px"),n));Object.assign(this.buttonElement.style,m)},i.prototype.handleResize=function(){var i,t,n,o=null!==(t=null===(i=this.config.config)||void 0===i?void 0:i.launcher_size_multiplier)&&void 0!==t?t:1,r=null!==(n=this.config.launcher_size)&&void 0!==n?n:48*o,l={zIndex:"1000",display:"flex",flexDirection:"column-reverse",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden",marginTop:"16px",borderRadius:this.config.config.launcher_type&&this.config.config.launcher_type!==e.IMAGE?"9999px":"50%",boxSizing:"border-box"};this.config.config.launcher_type===e.IMAGE&&Object.assign(l,{width:"".concat(r,"px"),height:"".concat(r,"px"),borderRadius:"50%",backgroundColor:this.config.config.brand_colour}),this.applyResponsiveStyles(l)},i.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},i.prototype.getElement=function(){return this.buttonElement},i.prototype.mount=function(){var i=this;requestAnimationFrame((function(){var t,n;null===(n=(t=i.config).onEvent)||void 0===n||n.call(t,{type:m.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),i.config.onInternalEvent(m.CHATBOT_BUTTON_LOADED)}))},i.prototype.update=function(i){this.config.isIframeVisible,this.config=d(d({},this.config),i),this.buttonElement.style.transform=this.config.isIframeVisible?"scale(0.85)":"scale(1)",this.render(),this.renderProactiveIfNeeded()},i.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.buttonElement&&this.buttonElement.parentNode&&this.buttonElement.parentNode.removeChild(this.buttonElement),this.proactiveElement&&this.proactiveElement.parentElement&&(this.proactiveElement.parentElement.removeChild(this.proactiveElement),this.proactiveElement=null),this.clearProactiveDelays(),this.urlUnsubscribe&&(this.urlUnsubscribe(),this.urlUnsubscribe=null)},i.prototype.clearProactiveDelays=function(){this.delayTimers.forEach((function(i){return clearTimeout(i)})),this.delayTimers=[],this.scrollHandlers.forEach((function(i){window.removeEventListener("scroll",i)})),this.scrollHandlers.clear(),this.shownScrollMessages.clear()},i.prototype.hideProactiveMessages=function(){var i,t,n=this;O=A();var e=null===(i=this.proactiveElement)||void 0===i?void 0:i.children[0];if(e){var o="Right"===(this.config.position||(null===(t=this.config.config.interface_properties)||void 0===t?void 0:t.position)||"Right");Array.from(e.children).forEach((function(i){i.className=o?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){n.proactiveElement&&n.proactiveElement.parentElement&&n.proactiveElement.parentElement.removeChild(n.proactiveElement),n.proactiveElement=null,n.clearProactiveDelays()}),400)}else this.clearProactiveDelays()},i.prototype.injectAnimationStyles=function(){if(!document.getElementById("rblyn-proactive-animations")){var i=document.createElement("style");i.id="rblyn-proactive-animations",i.textContent="\n @keyframes slideInFromRight {\n 0% {\n transform: translateX(120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(-1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideInFromLeft {\n 0% {\n transform: translateX(-120%) scale(0.95);\n opacity: 0;\n }\n 85% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 92% {\n transform: translateX(1px) scale(1.002);\n }\n 100% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n }\n @keyframes slideOutRight {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(120%) scale(0.9);\n opacity: 0;\n }\n }\n @keyframes slideOutLeft {\n 0% {\n transform: translateX(0) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(-120%) scale(0.9);\n opacity: 0;\n }\n }\n .rblyn-proactive-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-exit-right {\n animation: slideOutRight 0.4s ease-in forwards;\n }\n .rblyn-proactive-exit-left {\n animation: slideOutLeft 0.4s ease-in forwards;\n }\n .rblyn-proactive-close-enter-right {\n animation: slideInFromRight 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n .rblyn-proactive-close-enter-left {\n animation: slideInFromLeft 1.2s cubic-bezier(0.5, 0.8, 0.3, 1.1) forwards;\n }\n /* Reset styles for proactive message content to prevent website CSS interference */\n /* Only target children of the content wrapper, not the bubble container itself */\n .rblyn-proactive-message-content * {\n box-sizing: border-box !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n background: transparent;\n font-family: ".concat(x,' !important;\n font-size: inherit !important;\n font-weight: inherit !important;\n line-height: inherit !important;\n color: inherit;\n text-align: inherit;\n list-style: none;\n }\n .rblyn-proactive-message-content p,\n .rblyn-proactive-message-content div,\n .rblyn-proactive-message-content span {\n display: inline !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n .rblyn-proactive-message-content p:first-child,\n .rblyn-proactive-message-content div:first-child,\n .rblyn-proactive-message-content span:first-child {\n margin-top: 0 !important;\n }\n .rblyn-proactive-message-content p:last-child,\n .rblyn-proactive-message-content div:last-child,\n .rblyn-proactive-message-content span:last-child {\n margin-bottom: 0 !important;\n }\n .rblyn-proactive-message-content a {\n color: inherit !important;\n text-decoration: underline !important;\n cursor: pointer !important;\n }\n .rblyn-proactive-message-content a:hover {\n opacity: 0.8 !important;\n }\n .rblyn-proactive-message-content b,\n .rblyn-proactive-message-content strong {\n font-weight: 600 !important;\n }\n .rblyn-proactive-message-content i,\n .rblyn-proactive-message-content em {\n font-style: italic !important;\n }\n .rblyn-proactive-message-content u {\n text-decoration: underline !important;\n }\n .rblyn-proactive-message-content br {\n display: block !important;\n content: "" !important;\n margin-top: 0.5em !important;\n }\n '),document.head.appendChild(i)}},i.prototype.renderProactiveIfNeeded=function(i){var t,n,o,r,a,u,c,h,p,m,g,w,b,y,I,S=this,T=null===(n=null===(t=this.config)||void 0===t?void 0:t.config)||void 0===n?void 0:n.proactive_message_obj;if(!Array.isArray(T)||this.config.isIframeVisible||C())if(this.proactiveElement&&this.proactiveElement.parentElement){var A=this.proactiveElement.children[0],k="Right"===(this.config.position||(null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.position)||"Right");Array.from(A.children).forEach((function(i){i.className=k?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"})),setTimeout((function(){S.proactiveElement&&S.proactiveElement.parentElement&&S.proactiveElement.parentElement.removeChild(S.proactiveElement),S.proactiveElement=null,S.clearProactiveDelays()}),400)}else this.proactiveElement=null,this.clearProactiveDelays();else{if(this.injectAnimationStyles(),!this.proactiveElement){var O=document.createElement("div");O.style.position="fixed";var z=null!==(u=null!==(r=this.config.bottomSpacing)&&void 0!==r?r:null===(a=this.config.config.interface_properties)||void 0===a?void 0:a.bottom_spacing)&&void 0!==u?u:20,F=null!==(p=null!==(c=this.config.sideSpacing)&&void 0!==c?c:null===(h=this.config.config.interface_properties)||void 0===h?void 0:h.side_spacing)&&void 0!==p?p:20,j=this.config.position||(null===(m=this.config.config.interface_properties)||void 0===m?void 0:m.position)||"Right",L=null!==(w=null===(g=this.config.config)||void 0===g?void 0:g.launcher_size_multiplier)&&void 0!==w?w:1,U=null!==(b=this.config.launcher_size)&&void 0!==b?b:48*L,P=this.config.config.launcher_type===e.IMAGE?U:void 0!==this.config.launcher_size?40:40*L;O.style.bottom="".concat(z+P+8,"px"),"Right"===j?O.style.right="".concat(F,"px"):O.style.left="".concat(F,"px"),O.style.maxWidth="22.875rem",O.style.zIndex="2147483646";var W=document.createElement("div");W.style.display="flex",W.style.flexDirection="column",W.style.alignItems="Right"===j?"flex-end":"flex-start";var B=document.createElement("div");B.style.position="absolute",B.style.top="-32px",B.style.width="24px",B.style.height="24px",B.style.borderRadius="50%",B.style.background="#fff",B.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="center",B.style.cursor="pointer",B.style.opacity="0",B.style.visibility="hidden","Right"===(this.config.position||(null===(y=this.config.config.interface_properties)||void 0===y?void 0:y.position)||"Right")?(B.style.right="0px",B.style.left="auto",B.style.transform="translateX(120%) scale(0.95)"):(B.style.left="0px",B.style.right="auto",B.style.transform="translateX(-120%) scale(0.95)"),B.onclick=function(i){i.stopPropagation(),S.hideProactiveMessages()},B.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">\n <path d="M10.3334 10.3334L7.00009 7.00009M7.00009 7.00009L3.66675 3.66675M7.00009 7.00009L10.3334 3.66675M7.00009 7.00009L3.66675 10.3334" stroke="#444547" stroke-width="0.816326" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n ',O.appendChild(W),O.appendChild(B),document.body.appendChild(O),this.proactiveElement=O}var H=this.proactiveElement.children[0];H.innerHTML="";var V="Right"===(this.config.position||(null===(I=this.config.config.interface_properties)||void 0===I?void 0:I.position)||"Right");H.style.display="flex",H.style.flexDirection="column",H.style.alignItems=V?"flex-end":"flex-start",this.clearProactiveDelays();var Y=function(i){if(!i||C())return[];var t=E(),n=new Date,e=[];return i.forEach((function(i){e.push.apply(e,function(i,t,n){var e=(null==i?void 0:i.send_time_type)||"",o=e?N[e]:M;if(!o||!o(i,n))return[];for(var r=(null==i?void 0:i.content_multiple)||[],a=(null==i?void 0:i.delay_type)||"time",d="time"===a?Math.max(0,1e3*+((null==i?void 0:i.delay)||0)):0,u="scroll"===a?+((null==i?void 0:i.scroll_threshold)||0):void 0,c=[],v=0;v<r.length;v++){for(var f=r[v],h=(null==f?void 0:f.message_display_attributes)||[],p=null,m=l.OR,g=0,w=h;g<w.length;g++){var b=w[g];if(null==b?void 0:b.logical_condition)m=b.logical_condition;else{var y=b,x=R(null==y||y.type,(null==y?void 0:y.value)||"",null==y?void 0:y.condition,t);p=null===p?x:m===l.AND?p&&x:p||x}}(null===p||p)&&(null==f?void 0:f.message)&&c.push({messageId:(null==i?void 0:i.message_id)||v+"",contentIndex:v,html:f.message+"",delayMs:d,delayType:a,scrollThreshold:u,contentId:f.content_id||null,messageDisplayType:(null==f?void 0:f.message_display_type)||s.TEXT,messageBubbleBg:null==f?void 0:f.message_bubble_bg,urlToGo:null==f?void 0:f.url_to_go})}return c}(i,t,n))})),e}(T),K=[],X=[];Y.forEach((function(i){"scroll"===i.delayType&&void 0!==i.scrollThreshold&&+i.scrollThreshold>0?X.push(i):K.push(i)}));var G=new Map;K.forEach((function(i){var t=G.get(i.delayMs);t||(t={messageIds:[],groups:new Map},G.set(i.delayMs,t)),t.groups.has(i.messageId)||(t.messageIds.push(i.messageId),t.groups.set(i.messageId,[])),t.groups.get(i.messageId).push(i)}));var J=new Map;X.forEach((function(i){var t=i.scrollThreshold||0,n=J.get(t);n||(n={messageIds:[],groups:new Map},J.set(t,n)),n.groups.has(i.messageId)||(n.messageIds.push(i.messageId),n.groups.set(i.messageId,[])),n.groups.get(i.messageId).push(i)}));var Z=void 0!==G.get(0),q=this.proactiveElement.children[1];if(q&&Y.length>0){q.style.opacity="0",q.style.visibility="hidden",q.style.transform=V?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var Q=function(){if(q){q.style.visibility="visible";var i=H.children.length,t=i>0?10*(i-1):0;q.style.animationDelay="".concat(t,"ms"),q.className=V?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}};if(Z){var $=window.setTimeout(Q,0);this.delayTimers.push($)}else{var ii=Math.min.apply(Math,Array.from(G.keys()));$=window.setTimeout(Q,ii),this.delayTimers.push($)}}else q&&(q.style.opacity="0",q.style.visibility="hidden");var ti=function(i,t,n){var e=H.children.length,o=0,r=[];i.forEach((function(i){var n=t.get(i)||[];v([],n,!0).sort((function(i,t){return i.contentIndex-t.contentIndex})).forEach((function(t){r.push({messageId:i,item:t})})),o+=n.length}));var l=n>0?v([],r,!0).reverse():r;l.forEach((function(i,t){var r,a=i.item,u=document.createElement("div"),c=a.messageDisplayType===s.BUTTON;u.style.background=(null==a?void 0:a.messageBubbleBg)||"#ffffff",u.style.color="#111",u.style.borderRadius=c?"100px":"12px",u.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.08)",u.style.padding="16px",u.style.border="1px solid #F1F2F4",u.style.cursor="pointer",u.style.fontFamily=x,u.style.fontSize="14px",u.style.lineHeight=_+"",u.style.width="fit-content",u.style.maxWidth="100%";var v=0===t,h=t===l.length-1,p=e>0,m=G.has(0),g=!1;0===n?g=!h||v&&p:v&&(p||m)?g=!0:v||(g=!0),g&&(u.style.marginBottom="16px");var w=10*(e+o-1-(0===n?e+0:0));u.className=V?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",u.style.animationDelay="".concat(w,"ms"),u.style.opacity="0",u.style.transform=V?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var b=document.createElement("div");Object.assign(b.style,{display:"flex",alignItems:"center",gap:"8px"});var y=document.createElement("div");if(y.className="rblyn-proactive-message-content",y.setAttribute("dir",function(i){if(!i||"string"!=typeof i||0===i.trim().length)return"ltr";var t=i.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===t.length)return"ltr";for(var n=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,e=0,o=0,r=0,l=t;r<l.length;r++){var a=l[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(a)||(o++,n.test(a)&&e++)}return 0===o?"ltr":e/o>.3?"rtl":"ltr"}(a.html)),y.innerHTML=function(i){return i?Fi.sanitize(i,{ALLOWED_TAGS:["b","strong","i","em","u","br","span","a","p","s"],ALLOWED_ATTR:["href","target","rel","style"],ALLOW_ARIA_ATTR:!1,ALLOW_DATA_ATTR:!1,RETURN_TRUSTED_TYPE:!1}):""}(a.html),b.appendChild(y),(null==a?void 0:a.urlToGo)&&"string"==typeof a.urlToGo&&""!==a.urlToGo.trim()){var I=document.createElementNS("http://www.w3.org/2000/svg","svg");I.setAttribute("width","16"),I.setAttribute("height","17"),I.setAttribute("viewBox","0 0 16 17"),I.setAttribute("fill","none"),I.setAttribute("xmlns","http://www.w3.org/2000/svg"),Object.assign(I.style,{flexShrink:"0",color:f((null==a?void 0:a.messageBubbleBg)||"#ffffff")});var T=document.createElementNS("http://www.w3.org/2000/svg","g");T.setAttribute("id","External_Link");var E=document.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("id","Vector"),E.setAttribute("d","M6.6668 3.83268H5.4668C4.72006 3.83268 4.34642 3.83268 4.0612 3.97801C3.81032 4.10584 3.60649 4.30966 3.47866 4.56055C3.33334 4.84576 3.33334 5.21941 3.33334 5.96615V11.0328C3.33334 11.7795 3.33334 12.1527 3.47866 12.4379C3.60649 12.6888 3.81032 12.893 4.0612 13.0208C4.34614 13.166 4.71933 13.166 5.46461 13.166H10.5354C11.2807 13.166 11.6533 13.166 11.9383 13.0208C12.1891 12.893 12.3937 12.6886 12.5215 12.4377C12.6667 12.1528 12.6667 11.78 12.6667 11.0347V9.83268M13.3333 6.49935V3.16602M13.3333 3.16602H10M13.3333 3.16602L8.66667 7.83268"),E.setAttribute("stroke","currentColor"),E.setAttribute("stroke-width","1.5"),E.setAttribute("stroke-linecap","round"),E.setAttribute("stroke-linejoin","round"),T.appendChild(E),I.appendChild(T),b.appendChild(I)}if(u.appendChild(b),u.onclick=function(){if((null==a?void 0:a.urlToGo)&&"string"==typeof a.urlToGo&&""!==a.urlToGo.trim())window.open(a.urlToGo,"_blank","noopener,noreferrer");else{var i;i={message_id:a.messageId,content_string:a.html||null,content_id:a.contentId||null},D=d({input_id:null},i),S.config.toggleIframe(),S.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:a.messageId,content_string:a.html||null,content_id:a.contentId||null}}))}catch(i){}}},0===n)H.appendChild(u);else{H.insertBefore(u,H.firstChild);var A=null===(r=S.proactiveElement)||void 0===r?void 0:r.children[1];if(A&&"visible"===A.style.visibility){var k=H.children.length,R=k>0?10*(k-1):0;A.style.animationDelay="".concat(R,"ms")}}}))};G.forEach((function(i,t){var n=i.messageIds,e=i.groups;if(0===t)ti(n,e,t);else{var o=window.setTimeout((function(){ti(n,e,t)}),t);S.delayTimers.push(o)}})),J.forEach((function(i,t){var n=i.messageIds,e=i.groups,o="scroll-".concat(t),r=function(){if((window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=t&&!S.shownScrollMessages.has(o)){S.shownScrollMessages.add(o),ti(n,e,1);var i=S.scrollHandlers.get(o);i&&(window.removeEventListener("scroll",i),S.scrollHandlers.delete(o))}};r(),S.scrollHandlers.set(o,r),window.addEventListener("scroll",r,{passive:!0})}))}},i}(),Li=function(){var i;return(null===(i=navigator.userAgentData)||void 0===i?void 0:i.platform)||(/Windows|Mac|Linux|Android|iOS/.exec(navigator.userAgent)||["Unknown"])[0]},Ui=function(){var i;if(null===(i=navigator.userAgentData)||void 0===i?void 0:i.brands)for(var t=["Chrome","Firefox","Safari","Edge","Opera"],n=0,e=navigator.userAgentData.brands;n<e.length;n++){var o=e[n];if(t.includes(o.brand))return o.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},Pi=function(){var i,t,n,e;return{width:(null===window||void 0===window?void 0:window.innerWidth)||(null===(i=null===document||void 0===document?void 0:document.documentElement)||void 0===i?void 0:i.clientWidth)||(null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.clientWidth),height:(null===window||void 0===window?void 0:window.innerHeight)||(null===(n=null===document||void 0===document?void 0:document.documentElement)||void 0===n?void 0:n.clientHeight)||(null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.clientHeight)}},Wi=function(){return{platform:"web",os:Li(),browser:Ui(),sdk_version:"2.0.0-alpha.6",device:(i=navigator.userAgent.toLowerCase(),/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(i)?"tablet":/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(i)?"mobile":"desktop"),screen_size:Pi()};var i};!function(i){i.ERROR="ERROR",i.INFO="INFO"}(Ni||(Ni={}));var Bi,Hi,Vi=["@robylon/web-react-sdk","node_modules/@robylon/web-react-sdk/"],Yi=function(i){var t=i.filename,n=i.stack,e=i.message;return!!(t||n||e)&&Vi.some((function(i){return(null==t?void 0:t.includes(i))||(null==n?void 0:n.includes(i))||(null==e?void 0:e.includes(i))}))},Ki=function(){function i(){var i=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(t){var n,e={filename:t.filename,stack:null===(n=t.error)||void 0===n?void 0:n.stack,message:t.message};Yi(e)&&i.trackError(t.error||t.message,"GlobalErrorHandler",{filename:t.filename,lineNo:t.lineno,colNo:t.colno})},this.handleUnhandledRejection=function(t){var n,e,o={stack:null===(n=t.reason)||void 0===n?void 0:n.stack,message:(null===(e=t.reason)||void 0===e?void 0:e.message)||t.reason+""};Yi(o)&&i.trackError(t.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:t.reason})},this.setupGlobalHandlers()}return i.prototype.setupGlobalHandlers=function(){w()&&(null===window||void 0===window||window.addEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.addEventListener("unhandledrejection",this.handleUnhandledRejection))},i.prototype.cleanup=function(){w()&&(null===window||void 0===window||window.removeEventListener("error",null==this?void 0:this.handleWindowError),null===window||void 0===window||window.removeEventListener("unhandledrejection",this.handleUnhandledRejection))},i.getInstance=function(){return i.instance||(i.instance=new i),i.instance},i.prototype.initialize=function(i,t){void 0===t&&(t=null);try{if(this.preInitQueue.length>0){var n={org_id:"UNINITALIZED",event_data:{message:"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===i?"undefined":null===i?"null":""===i?"empty string":"invalid: ".concat(i)),componentName:"ErrorTrackingService",additionalInfo:{preInitError:!0,apiKey:i,userId:t,timestamp:Date.now()},timestamp:Date.now()},metadata:Wi(),event_type:Ni.ERROR,user_id:t};this.sendLog(n).catch(console.error)}this.apiKey=i,this.userId=t,this.isInitialized=!0,this.processPreInitQueue()}catch(n){h.error("Error during ErrorTrackingService initialization:",n),this.preInitQueue.push({error:n instanceof Error?n:Error(n+""),componentName:"ErrorTrackingService",additionalInfo:{apiKey:i,userId:t}})}},i.prototype.processPreInitQueue=function(){return u(this,void 0,void 0,(function(){var i,t,n;return c(this,(function(e){switch(e.label){case 0:if(!this.preInitQueue.length)return[2];h.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),i=0,t=this.preInitQueue,e.label=1;case 1:return i<t.length?(n=t[i],[4,this.trackError(n.error,n.componentName,d(d({},n.additionalInfo),{preInitError:!0}))]):[3,4];case 2:e.sent(),e.label=3;case 3:return i++,[3,1];case 4:return this.preInitQueue=[],[2]}}))}))},i.prototype.sendLog=function(i){return u(this,void 0,void 0,(function(){var t,n,e,o,r,l;return c(this,(function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),t=b().apiUrl,[4,fetch("".concat(t,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 1:return(n=a.sent()).ok?[3,3]:(o=(e=h).error,r=["Failed to send error log:"],[4,n.text()]);case 2:o.apply(e,r.concat([a.sent()])),a.label=3;case 3:return[3,5];case 4:return l=a.sent(),h.error("Error sending log:",l),[3,5];case 5:return[2]}}))}))},i.prototype.trackError=function(i,t,n){return u(this,void 0,void 0,(function(){var e,o,r;return c(this,(function(l){switch(l.label){case 0:if(this.isInitialized)return[3,5];e={org_id:"UNINITALIZED",event_data:{message:i instanceof Error?i.message:i,stack:i instanceof Error?i.stack:void 0,componentName:t,additionalInfo:d(d({},n),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:Wi(),event_type:Ni.ERROR,user_id:this.userId},l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.sendLog(e)];case 2:return l.sent(),[3,4];case 3:return l.sent(),this.preInitQueue.push({error:i,componentName:t,additionalInfo:n}),h.warn("Error tracked before initialization, queuing:",i),[3,4];case 4:return[2];case 5:return o={message:i instanceof Error?i.message:i,stack:i instanceof Error?i.stack:void 0,componentName:t,additionalInfo:d(d({},n),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:o,metadata:Wi(),event_type:Ni.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return l.sent(),[2]}}))}))},i.prototype.trackInfo=function(i,t,n){return u(this,void 0,void 0,(function(){var e,o;return c(this,(function(r){switch(r.label){case 0:return this.apiKey?(e={message:i,componentName:t,additionalInfo:n,timestamp:Date.now()},o={org_id:this.apiKey,event_data:e,metadata:Wi(),event_type:Ni.INFO,user_id:this.userId},[4,this.sendLog(o)]):(h.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}}))}))},i}(),Xi=Ki.getInstance(),Gi="MISSING_API_KEY",Ji="SDK_INIT_FAILED",Zi="ERROR_TRACKING_INIT_FAILED",qi="API_REQUEST_FAILED",Qi="NETWORK_ERROR",$i="INVALID_RESPONSE",it="IFRAME_LOAD_FAILED",tt="INITIALIZATION_ERROR",nt=((Bi={})[Gi]=function(i){return"SDK Initialization Failed: Required parameter 'api_key' is ".concat(void 0===i?"undefined":null===i?"null":""===i?"empty string":"invalid: ".concat(i),". A valid API key string is required to initialize the SDK.")},Bi.INVALID_API_KEY=function(i){return"SDK Initialization Failed: Provided API key '".concat(i,"' is invalid. API key must be a non-empty string in UUID format.")},Bi.CONFIG_FETCH_FAILED=function(i){return"Failed to fetch chatbot configuration: ".concat(i.statusCode?"Server responded with status ".concat(i.statusCode):"Could not reach server").concat(i.error?". Error: ".concat(i.error):"")},Bi[qi]=function(i,t,n){return"API Request Failed: Server responded with status ".concat(i," for ").concat(n?"endpoint ".concat(n):"request"," - ").concat(t)},Bi[Qi]=function(i){return"Network Error: Failed to communicate with server".concat(i.url?" at ".concat(i.url):"").concat(i.error?" - ".concat(i.error):"")},Bi[it]=function(i){return"Failed to load chatbot interface".concat(i.src?" from ".concat(i.src):"").concat(i.error?". Error: ".concat(i.error):"")},Bi[$i]=function(i){return"Invalid API Response: Missing required fields in response data: ".concat(i.join(", "))},Bi[Zi]=function(i){return"Error Tracking Service initialization failed".concat(i.apiKey?" for API key ".concat(i.apiKey):"").concat(i.error?". Error: ".concat(i.error):"")},Bi[Ji]=function(i){return"SDK Initialization Failed: ".concat(i.reason||"Could not initialize the chatbot SDK").concat(i.config?". Attempted initialization with config: ".concat(JSON.stringify(i.config,null,2)):"")},Bi.COOKIE_ACCESS_ERROR=function(i,t){return"Cookie Access Error: Failed to ".concat(i).concat(t?" cookie '".concat(t,"'"):" cookies",". This may affect user session persistence.")},Bi.COMPONENT_RENDER_ERROR=function(i){return"React Component Error: ".concat(i.component||"Unknown component"," failed to render. Error: ").concat(i.error).concat(i.stack?"\nComponent Stack: ".concat(i.stack):"")},Bi),et=function(){var i,t=navigator.userAgent;if(null===(i=navigator.userAgentData)||void 0===i?void 0:i.brands){var n=navigator.userAgentData.brands.find((function(i){return"Google Chrome"===i.brand}));if(null==n?void 0:n.version)return n.version}var e=t.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return e?e[2]:"Unknown"},ot=function(){var i,t,n=Wi();return{current_page_url:(null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.href)||"",browser_language:(null===navigator||void 0===navigator?void 0:navigator.language)||(null===(t=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===t?void 0:t[0])||"en",browser_version:et(),os:null==n?void 0:n.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:n}};!function(i){i.UPDATE_OVERRIDES="updateOverrides",i.I_CAN_AUTHENTICATE="i_can_authenticate",i.I_LOADED_LAUNCHER="i_loaded_launcher",i.I_OPENED_IFRAME="i_opened_iframe",i.I_CLICKED_PROACTIVE_BUBBLE="i_clicked_proactive_bubble",i.CAPTURED_SESSION_DATA="capturedSessionData",i.UPDATE_USER_PROFILE="updateUserProfile",i.OPENED_IFRAME_EVENT="openedIframe"}(Hi||(Hi={}));var rt=function(){function i(i){var t=this;this.isInitialized=!1,this.hasRegistered=!1,this.isAppReady=!1,this.shouldWaitForAppReady=!1,this.hasPendingOpenRequest=!1,this.overridesPayloadCache=null,this.proactiveDataSentInRegistration=!1,this.openedDueToProactive=!1,this.handleMessage=function(i){var n,e,o,r,l,a,s,d,u,c,v=b().copilotUrl;if(i.origin===v){var f=JSON.parse(i.data);if("APP_READY"===(null==f?void 0:f.type))return t.isAppReady=!0,void t.sendOpenAndRegisterIfReady();if("CHATBOT_CLOSED"===(null==f?void 0:f.type))return void(null===(n=null==t?void 0:t.config)||void 0===n||n.onClose());if("CHATBOT_TOKEN_EXHAUSTED"===(null==f?void 0:f.type))return void t.config.onInternalEvent(g.CHATBOT_TOKEN_EXHAUSTED);"CHATBOT_LOADED"===(null==f?void 0:f.type)&&(null===(o=(e=t.config).onEvent)||void 0===o||o.call(e,{type:m.CHATBOT_LOADED,timestamp:Date.now()}),t.config.onInternalEvent(m.CHATBOT_LOADED)),"CHAT_INITIALIZED"===(null==f?void 0:f.type)&&(null===(l=(r=t.config).onEvent)||void 0===l||l.call(r,{type:m.CHAT_INITIALIZED,timestamp:Date.now()}),t.config.onInternalEvent(m.CHAT_INITIALIZED)),"CHAT_INITIALIZATION_FAILED"===(null==f?void 0:f.type)&&(null===(s=(a=t.config).onEvent)||void 0===s||s.call(a,{type:m.CHAT_INITIALIZATION_FAILED,timestamp:Date.now()}),t.config.onInternalEvent(m.CHAT_INITIALIZATION_FAILED,{error:null===(d=i.data)||void 0===d?void 0:d.error})),"SESSION_REFRESHED"===(null==f?void 0:f.type)&&(null===(c=(u=t.config).onEvent)||void 0===c||c.call(u,{type:m.SESSION_REFRESHED,timestamp:Date.now()}),t.config.onInternalEvent(m.SESSION_REFRESHED)),"CHAT_MOVED"===(null==f?void 0:f.type)&&t.config.onInternalEvent(g.CHAT_MOVED,{from:i.data.from,to:i.data.to,trigger:i.data.trigger})}},this.config=i,this.iframeElement=document.createElement("iframe"),this.iframeElement.id="chat-iframe-rbyln",this.resizeHandler=this.applyResponsiveStyles.bind(this),this.render(),this.initialize(),this.setupEventListeners()}return i.prototype.buildOverridesPayload=function(){var i,t,n,e,o,r,l,a,s,d,u,c,v,f,h,p,m,g,w,b,y;return{header_avatar:null!==(n=null===(t=null===(i=this.config)||void 0===i?void 0:i.overrides)||void 0===t?void 0:t.header_avatar)&&void 0!==n?n:null,agent_avatar:null!==(r=null===(o=null===(e=this.config)||void 0===e?void 0:e.overrides)||void 0===o?void 0:o.agent_avatar)&&void 0!==r?r:null,header_title:null!==(s=null===(a=null===(l=this.config)||void 0===l?void 0:l.overrides)||void 0===a?void 0:a.header_title)&&void 0!==s?s:null,header_subtitle:null!==(c=null===(u=null===(d=this.config)||void 0===d?void 0:d.overrides)||void 0===u?void 0:u.header_subtitle)&&void 0!==c?c:null,header_title_text_color:null!==(h=null===(f=null===(v=this.config)||void 0===v?void 0:v.overrides)||void 0===f?void 0:f.header_title_text_color)&&void 0!==h?h:null,header_subtitle_text_color:null!==(g=null===(m=null===(p=this.config)||void 0===p?void 0:p.overrides)||void 0===m?void 0:m.header_subtitle_text_color)&&void 0!==g?g:null,header_bg:null!==(y=null===(b=null===(w=this.config)||void 0===w?void 0:w.overrides)||void 0===b?void 0:b.header_bg)&&void 0!==y?y:null}},i.prototype.hasUserProvidedOverrides=function(i){return Object.values(i).some((function(i){return"string"==typeof i?i.trim().length>0:null!=i}))},i.prototype.getElement=function(){return this.iframeElement},i.prototype.render=function(){var i,t=this.config.position||(null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.position)||"Right";Object.assign(this.iframeElement.style,{zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom ".concat(t.toLowerCase()),transition:"transform 0.2s cubic-bezier(0.2, 1.27, 0.29, 0.97), opacity 0.15s ease-out",transform:"scale(0.3) translate3d(0,40px,0)",opacity:"0",display:"none"}),this.applyResponsiveStyles()},i.prototype.applyResponsiveStyles=function(){var i,t,n,e,o,r;if(this.iframeElement){var l=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",a=null!==(r=null!==(e=this.config.bottomSpacing)&&void 0!==e?e:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.bottom_spacing)&&void 0!==r?r:20;560>window.innerWidth?Object.assign(this.iframeElement.style,((i={width:"100vw",minWidth:"300px"})[l.toLowerCase()]="0",i.bottom="0",i.height="100vh",i.flexDirection="column",i.flexGrow="1",i.borderRadius="0",i.top="0",i.maxHeight="100%",i.position="fixed",i)):Object.assign(this.iframeElement.style,((t={width:"26%",minWidth:"400px",height:"calc(100vh - 2rem - 10vh - ".concat(a,"px)"),borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"50rem",position:""})[l.toLowerCase()]=void 0,t))}},i.prototype.initialize=function(){var i=this;if(!this.isInitialized){var t=b().copilotUrl;this.iframeElement.src="".concat(t,"/chatbot-plugin?id=").concat(this.config.config.chatbotId),this.isInitialized=!0,this.iframeElement.addEventListener("load",(function(){var n,e,o,r,l,a,s,u,c,v,f,h,p,g,w,b,y,x,_,I=new URL(i.iframeElement.src).origin||t;null===(n=i.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,name:"checkDomain"},I);var S=i.buildOverridesPayload();if(i.hasUserProvidedOverrides(S)&&(null===(o=i.iframeElement.contentWindow)||void 0===o||o.postMessage({domain:null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.hostname,action:Hi.UPDATE_OVERRIDES,data:S},t)),!i.hasRegistered&&i.iframeElement.contentWindow){i.iframeElement.contentWindow.postMessage({domain:null===(l=null===window||void 0===window?void 0:window.location)||void 0===l?void 0:l.hostname,action:Hi.I_CAN_AUTHENTICATE,data:{show_history:null===(a=i.config.config)||void 0===a?void 0:a.show_history}},t);var T=z();i.proactiveDataSentInRegistration=!!T,i.iframeElement.contentWindow.postMessage({domain:null===(s=null===window||void 0===window?void 0:window.location)||void 0===s?void 0:s.hostname,action:Hi.I_LOADED_LAUNCHER,data:d(d({ws_url:null===(u=i.config.config)||void 0===u?void 0:u.ws_url,userId:null===(c=i.config.config)||void 0===c?void 0:c.userId,token:null===(v=i.config.config)||void 0===v?void 0:v.token,userProfile:d(d({},null===(f=i.config.config)||void 0===f?void 0:f.userProfile),{__INT_SYS_INFO__:d(d({},(null===(p=null===(h=i.config.config)||void 0===h?void 0:h.userProfile)||void 0===p?void 0:p.__INT_SYS_INFO__)||{}),ot())}),isAnonymous:null===(g=i.config.config)||void 0===g?void 0:g.isAnonymous},T?{proactiveData:T}:{}),{show_history:null===(w=i.config.config)||void 0===w?void 0:w.show_history})},t),i.hasRegistered=!0}null===(y=(b=i.config).onIframeLoaded)||void 0===y||y.call(b),null===(_=(x=i.config).onEvent)||void 0===_||_.call(x,{type:m.CHATBOT_READY,timestamp:Date.now()}),i.config.onInternalEvent(m.CHATBOT_LOADED)}))}},i.prototype.setupEventListeners=function(){var i=this;window.addEventListener("resize",this.resizeHandler),this.iframeElement.addEventListener("error",(function(){Xi.trackError(Error(nt[it]({src:i.iframeElement.src,error:"Failed to load iframe"})),"ChatbotIframe",{errorCode:it,errorType:"RUNTIME_ERROR",context:{config:i.config.config,iframeUrl:i.iframeElement.src,timestamp:Date.now()}})})),window.addEventListener("message",this.handleMessage),window.addEventListener("rblyn:proactiveClick",(function(t){var n,e,o,r,l,a,s,u,c,v;if(i.hasRegistered)if(i.proactiveDataSentInRegistration)i.proactiveDataSentInRegistration=!1;else{i.openedDueToProactive=!0;var f=(null==t?void 0:t.detail)||{},h=b().copilotUrl,p=new URL(i.iframeElement.src).origin||h;null===(n=i.iframeElement.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,action:Hi.I_CLICKED_PROACTIVE_BUBBLE,data:{userId:null===(o=i.config.config)||void 0===o?void 0:o.userId,token:null===(r=i.config.config)||void 0===r?void 0:r.token,userProfile:d(d({},null===(l=i.config.config)||void 0===l?void 0:l.userProfile),{__INT_SYS_INFO__:d(d({},(null===(s=null===(a=i.config.config)||void 0===a?void 0:a.userProfile)||void 0===s?void 0:s.__INT_SYS_INFO__)||{}),ot())}),isAnonymous:null===(u=i.config.config)||void 0===u?void 0:u.isAnonymous,ws_url:null===(c=i.config.config)||void 0===c?void 0:c.ws_url,proactiveData:{input_id:null,message_id:(null==f?void 0:f.message_id)||null,content_string:(null==f?void 0:f.content_string)||null,content_id:(null==f?void 0:f.content_id)||null},show_history:null===(v=i.config.config)||void 0===v?void 0:v.show_history}},p)}}))},i.prototype.updateVisibility=function(i,t){var n;this.shouldWaitForAppReady=!!t,this.config.isVisible=i;var e=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right";if(i?this.showIframe(e):this.hideIframe(e),!i)return this.openedDueToProactive=!1,void(this.hasPendingOpenRequest=!1);this.hasPendingOpenRequest=!0,this.shouldWaitForAppReady,this.sendOpenAndRegisterIfReady()},i.prototype.showIframe=function(i){this.iframeElement.style.display="block",this.iframeElement.getBoundingClientRect(),this.iframeElement.style.opacity="1",this.iframeElement.style.transform="scale(1) translate3d(0,0,0)"},i.prototype.hideIframe=function(i){var t=this;this.iframeElement.style.opacity="0",this.iframeElement.style.transform="scale(0.3) translate3d(".concat((i.toLowerCase(),"0"),",40px,0)"),setTimeout((function(){t.config.isVisible||(t.iframeElement.style.display="none")}),200)},i.prototype.sendOpenAndRegisterIfReady=function(){var i,t,n,e,o,r,l,a,s,u,c,v;if(this.iframeElement.contentWindow&&this.config.isVisible&&(!this.shouldWaitForAppReady||this.isAppReady)&&this.hasPendingOpenRequest){var f=b().copilotUrl,h=new URL(this.iframeElement.src).origin||f;if(this.iframeElement.contentWindow.postMessage({domain:null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.hostname,name:"openFrame"},h),this.openedDueToProactive)this.openedDueToProactive=!1;else{var p=z();this.iframeElement.contentWindow.postMessage({domain:null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.hostname,action:Hi.I_OPENED_IFRAME,data:d(d({ws_url:null===(n=this.config.config)||void 0===n?void 0:n.ws_url,userId:null===(e=this.config.config)||void 0===e?void 0:e.userId,token:null===(o=this.config.config)||void 0===o?void 0:o.token,userProfile:d(d({},null===(r=this.config.config)||void 0===r?void 0:r.userProfile),{__INT_SYS_INFO__:d(d({},(null===(a=null===(l=this.config.config)||void 0===l?void 0:l.userProfile)||void 0===a?void 0:a.__INT_SYS_INFO__)||{}),ot())}),isAnonymous:null===(s=this.config.config)||void 0===s?void 0:s.isAnonymous},p?{proactiveData:p}:{}),{show_history:null===(u=this.config.config)||void 0===u?void 0:u.show_history})},f)}null===(v=(c=this.config).onEvent)||void 0===v||v.call(c,{type:m.CHATBOT_OPENED,timestamp:Date.now()}),this.config.onInternalEvent(m.CHATBOT_OPENED),this.hasPendingOpenRequest=!1}},i.prototype.update=function(i,t){var n,e,o=this.config.isVisible;if(this.config=d(d({},this.config),i),o!==this.config.isVisible&&this.updateVisibility(this.config.isVisible,t),this.iframeElement.contentWindow&&this.config.isVisible){var r=b().copilotUrl;this.iframeElement.contentWindow.postMessage({action:Hi.UPDATE_USER_PROFILE,user_profile:this.config.config.userProfile,show_history:null===(n=this.config.config)||void 0===n?void 0:n.show_history},r),this.iframeElement.contentWindow.postMessage({action:Hi.OPENED_IFRAME_EVENT,user_profile:this.config.config.userProfile,show_history:null===(e=this.config.config)||void 0===e?void 0:e.show_history},r)}},i.prototype.destroy=function(){window.removeEventListener("resize",this.resizeHandler),window.removeEventListener("message",this.handleMessage),this.iframeElement&&this.iframeElement.parentNode&&this.iframeElement.parentNode.removeChild(this.iframeElement)},i}(),lt=function(){function i(i,t,n,e){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:i,position:t,sideSpacing:n,bottomSpacing:e},this.render(),this.mount(),this.setupResizeListener()}return i.prototype.render=function(){this.applyStyles(),this.containerElement.className="robylon-chatbot-container"},i.prototype.applyStyles=function(){var i,t,n,e,o,r,l,a,s,u=560>(null===window||void 0===window?void 0:window.innerWidth),c=this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right",v=null!==(r=null!==(e=this.config.sideSpacing)&&void 0!==e?e:null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.side_spacing)&&void 0!==r?r:20,f=null!==(s=null!==(l=this.config.bottomSpacing)&&void 0!==l?l:null===(a=this.config.config.interface_properties)||void 0===a?void 0:a.bottom_spacing)&&void 0!==s?s:20;this.containerElement.style.position="",this.containerElement.style.top="",this.containerElement.style.bottom="",this.containerElement.style.right="",this.containerElement.style.left="",this.containerElement.style.alignItems="";var h={position:"fixed",zIndex:"1000",display:"flex",flexDirection:"column"},p=d(d({},h),((i={bottom:"".concat(f,"px")})[c.toLowerCase()]="".concat(v,"px"),i.alignItems="Right"===c?"flex-end":"flex-start",i)),m=d(d({},h),((t={top:"0"})[c.toLowerCase()]="".concat(v,"px"),t.alignItems="center",t));Object.assign(this.containerElement.style,u?m:p)},i.prototype.handleResize=function(){this.applyStyles()},i.prototype.setupResizeListener=function(){"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.handleResizeFunction),this.resizeObserver.observe(document.body)):window.addEventListener("resize",this.handleResizeFunction)},i.prototype.mount=function(){document.body.appendChild(this.containerElement)},i.prototype.getElement=function(){return this.containerElement},i.prototype.destroy=function(){this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.handleResizeFunction),this.containerElement&&this.containerElement.parentNode&&this.containerElement.parentNode.removeChild(this.containerElement)},i}(),at=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(i){var t=16*Math.random()|0;return("x"===i?t:3&t|8).toString(16)}))},st=function(i){var t,n="; ".concat(document.cookie).split("; ".concat(i,"="));if(2===n.length)return null===(t=n.pop())||void 0===t?void 0:t.split(";").shift()},dt=function(i){var t=i?"USER_DATA=%7B%22attributes%22%3A%5B%7B%22key%22%3A%22USER_ATTRIBUTE_USER_EMAIL%22%2C%22value%22%3A%22dinesh.goel%40robylon.ai%22%7D%2C%7B%22key%22%3A%22USER_ATTRIBUTE_UNIQUE_ID%22%2C%22value%22%3A%2266011f2c28d1787d13c6c796%22%7D%5D%2C%22subscribedToOldSdk%22%3Afalse%2C%22deviceUuid%22%3A%2226c02feb-2664-451d-8469-9cf1378547c6%22%2C%22deviceAdded%22%3Atrue%7D; _ga_3YS9P6ZDWX=GS1.1.1715252584.3.1.1715258696.39.0.0; _ga_V4J24F7YF9=GS1.1.1715273274.2.0.1715273274.0.0.0; city_name=Bengaluru; lang_code=en-in; cookieConcent=A; _gcl_au=1.1.343275043.1717154298; _clck=43guwd%7C2%7Cfmi%7C0%7C1561; _gid=GA1.2.1423066649.1718210058; moe_uuid=26c02feb-2664-451d-8469-9cf1378547c6; _ga_6RM65PWEZY=GS1.1.1718210058.18.1.1718211647.60.0.0; _ga=GA1.1.689213983.1712737672; AMP_MKTG_fe4beb374f=JTdCJTIycmVmZXJyZXIlMjIlM0ElMjJodHRwcyUzQSUyRiUyRmFjY291bnRzLnRlYWNobWludC5jb20lMkYlMjIlMkMlMjJyZWZlcnJpbmdfZG9tYWluJTIyJTNBJTIyYWNjb3VudHMudGVhY2htaW50LmNvbSUyMiU3RA==; AMP_fe4beb374f=JTdCJTIyZGV2aWNlSWQlMjIlM0ElMjI0MWMxMTljZC03YzVjLTRiYTctYTUzZS1mYTgzMjRlYjc0OWUlMjIlMkMlMjJ1c2VySWQlMjIlM0ElMjIxZjI2ODAwOC01OGYxLTQwYTItYjQ0Ni1mYmQ5N2E0NDQyYTAlMjIlMkMlMjJzZXNzaW9uSWQlMjIlM0ExNzE4MjEzMzEwOTc3JTJDJTIyb3B0T3V0JTIyJTNBZmFsc2UlMkMlMjJsYXN0RXZlbnRUaW1lJTIyJTNBMTcxODIxMzMxMDk4MSUyQyUyMmxhc3RFdmVudElkJTIyJTNBMTQlN0Q=; _ga_3YS9P6ZDWX=GS1.1.1718211637.26.1.1718213441.60.0.0; SESSION=%7B%22sessionKey%22%3A%22e4d76f52-9053-4277-99a4-f1ba667fd5f2%22%2C%22sessionStartTime%22%3A%222024-06-12T16%3A34%3A19.047Z%22%2C%22sessionMaxTime%22%3A1800%2C%22customIdentifiersToTrack%22%3A%5B%5D%2C%22sessionExpiryTime%22%3A1718215247464%2C%22numberOfSessions%22%3A17%7D":document.cookie;return t=t.split(";").map((function(i){var t=i.split("="),n=t[0],e=t.slice(1).join("=").trim();return{name:n=n.trim(),value:e?decodeURIComponent(e):""}})),t},ut=function(i,t,n,e){return u(void 0,void 0,void 0,(function(){var o,r,l,a,s,d,u,v;return c(this,(function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),o=b().apiUrl,h.log("endpointUrl",r="".concat(o,"/chat/chatbot/get/")),l={client_user_id:t||null,org_id:i,token:n||void 0,internal_user_id:e||void 0,extra_info:{},launcher_info:ot()},[4,fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})];case 1:return(a=c.sent()).ok?[3,3]:[4,a.text()];case 2:throw s=c.sent(),Error(nt[qi](a.status,s));case 3:return[4,a.json()];case 4:if(d=c.sent(),!(null===(v=null==d?void 0:d.user)||void 0===v?void 0:v.org_info))throw Error(nt[$i](["user","org_info"]));return[2,d];case 5:throw u=c.sent(),Xi.trackError(u instanceof Error?u:Error(nt[Qi]({error:u+""})),"fetchChatbotConfig",{errorCode:u instanceof Error&&u.message.includes("API Request Failed")?qi:Qi,errorType:"API_ERROR",context:{apiKey:i,userId:t,timestamp:Date.now()}}),u;case 6:return[2]}}))}))},ct=function(i){return u(void 0,void 0,void 0,(function(){var o,r,l,a,s,u,v,f,p,m,g,w,b,y,x,_,I,S,T,E,A,k,R,O,D,C,z,M,N,F,j,L,U,P,W,B,H,V,Y,K,X,G,J;return c(this,(function(c){switch(c.label){case 0:return o=function(i){return{api_key:(i.api_key||"")+"",user_id:i.user_id?i.user_id+"":null,user_token:i.user_token?i.user_token+"":void 0,user_profile:i.user_profile||{}}}(i),r=o.user_id||void 0,l=!1,r?a=st("rblyn_anon")||at():(q=r=st("rblyn_anon")||at(),(Q=new Date).setTime(Q.getTime()+31536e6),document.cookie="".concat("rblyn_anon","=").concat(q,";expires=").concat(Q.toUTCString(),";path=/"),l=!0,a=r),[4,ut(o.api_key,r,o.user_token,a)];case 1:s=c.sent();try{o.api_key}catch(i){h.warn("Failed to inject mock proactive messages",i)}return u=Wi(),v=ot(),Z=o.user_profile,f=Z?Object.fromEntries(Object.entries(Z).map((function(i){var t=i[0],n=i[1];return"boolean"==typeof n||"number"==typeof n?[t,n]:[t,n+""]}))):{},p=d(d(d({},u),{__INT_SYS_INFO__:d(d({},u),v)}),f),[2,{chatbotId:o.api_key,userId:r,token:o.user_token,isAnonymous:l,domain:"",show_launcher:null===(g=null===(m=s.user.org_info)||void 0===m?void 0:m.show_launcher)||void 0===g||g,auto_launch:null!==(b=null===(w=s.user.org_info)||void 0===w?void 0:w.auto_launch)&&void 0!==b&&b,brand_colour:(null===(x=null===(y=s.user.org_info.brand_config)||void 0===y?void 0:y.colors)||void 0===x?void 0:x.brand_color)||"",image_url:(null===(I=null===(_=s.user.org_info)||void 0===_?void 0:_.brand_config)||void 0===I?void 0:I.launcher_logo_url)||"",userProfile:p,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(S=s.user.org_info.brand_config)||void 0===S?void 0:S.display_name)||"",welcome_message:(null===(T=s.user.org_info.brand_config)||void 0===T?void 0:T.welcome_message)||"Hey! What can we help you with today?",redirect_url:(null===(E=s.user.org_info.brand_config)||void 0===E?void 0:E.redirect_url)||""},launcher_type:(null===(A=s.user.org_info.brand_config)||void 0===A?void 0:A.launcher_type)||e.IMAGE,launcher_properties:{text:(null===(R=null===(k=s.user.org_info.brand_config)||void 0===k?void 0:k.launcher_properties)||void 0===R?void 0:R.text)||""},images:{launcher_image_url:{url:(null===(C=null===(D=null===(O=s.user.org_info.brand_config)||void 0===O?void 0:O.images)||void 0===D?void 0:D.launcher_image_url)||void 0===C?void 0:C.url)||""}},proactive_message_obj:vt(null===(N=null===(M=null===(z=null==s?void 0:s.user)||void 0===z?void 0:z.org_info)||void 0===M?void 0:M.brand_config)||void 0===N?void 0:N.proactive_message_obj),interface_properties:{position:(null===(j=null===(F=s.user.org_info.brand_config)||void 0===F?void 0:F.interface_properties)||void 0===j?void 0:j.position)||n.RIGHT,side_spacing:(null===(U=null===(L=s.user.org_info.brand_config)||void 0===L?void 0:L.interface_properties)||void 0===U?void 0:U.side_spacing)||20,bottom_spacing:(null===(W=null===(P=s.user.org_info.brand_config)||void 0===P?void 0:P.interface_properties)||void 0===W?void 0:W.bottom_spacing)||20},interface_type:(null===(B=s.user.org_info.brand_config)||void 0===B?void 0:B.interface_type)||t.WIDGET,launcher_delay:(null===(H=s.user.org_info.brand_config)||void 0===H?void 0:H.launcher_delay)||{enabled:!1,delay:0},launcher_scroll:function(){var i,t,n,e,o,r,l;console.log("[Config] Raw API response launcher_scroll",{raw:null===(i=s.user.org_info.brand_config)||void 0===i?void 0:i.launcher_scroll,type:typeof(null===(t=s.user.org_info.brand_config)||void 0===t?void 0:t.launcher_scroll),enabled:null===(e=null===(n=s.user.org_info.brand_config)||void 0===n?void 0:n.launcher_scroll)||void 0===e?void 0:e.enabled,depth:null===(r=null===(o=s.user.org_info.brand_config)||void 0===o?void 0:o.launcher_scroll)||void 0===r?void 0:r.depth});var a=(null===(l=s.user.org_info.brand_config)||void 0===l?void 0:l.launcher_scroll)||{enabled:!1,depth:0};return console.log("[Config] Parsed launcher_scroll",a),a}(),auto_launch_delay:(null===(V=s.user.org_info.brand_config)||void 0===V?void 0:V.auto_launch_delay)||{enabled:!1,seconds:0},auto_launch_scroll:(null===(Y=s.user.org_info.brand_config)||void 0===Y?void 0:Y.auto_launch_scroll)||{enabled:!1,depth:0},launcher_size_multiplier:null!==(X=null===(K=s.user.org_info.brand_config)||void 0===K?void 0:K.launcher_size_multiplier)&&void 0!==X?X:1,ws_url:null===(J=null===(G=s.user)||void 0===G?void 0:G.router_connection_info)||void 0===J?void 0:J.url}]}var Z,q,Q}))}))},vt=function(i){if(i){var t=(Array.isArray(i)?i:[i]).filter(Boolean).map((function(i){var t,n,e,o={message_id:(null!==(t=null==i?void 0:i.message_id)&&void 0!==t?t:"")+"",org_id:(null!==(n=null==i?void 0:i.org_id)&&void 0!==n?n:"")+"",name:null==i?void 0:i.name,content:null==i?void 0:i.content,send_time_type:null==i?void 0:i.send_time_type,created_by_name:null==i?void 0:i.created_by_name,updated_by_name:null==i?void 0:i.updated_by_name,updated_at:null==i?void 0:i.updated_at,created_at:null==i?void 0:i.created_at,delay:"number"==typeof(null==i?void 0:i.delay)?i.delay:void 0,delay_type:"scroll"===(null==i?void 0:i.delay_type)||"time"===(null==i?void 0:i.delay_type)?i.delay_type:void 0,scroll_threshold:(e=+(null==i?void 0:i.scroll_threshold),Number.isFinite(e)?e:void 0),content_multiple:Array.isArray(null==i?void 0:i.content_multiple)?i.content_multiple:(null==i?void 0:i.content)?[{message:i.content+"",message_display_attributes:[]}]:[]};return(null==i?void 0:i.content)&&!(null==i?void 0:i.content_multiple)&&h.warn("[Robylon SDK] proactive_message.content is deprecated; use content_multiple[].message instead."),o}));return t.length?t:void 0}},ft=function(){function i(i){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.isIframeLoaded=!1,this.config=i,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return i.prototype.sendMessageToIframe=function(i,t){var n;(null===(n=this.iframe)||void 0===n?void 0:n.contentWindow)&&this.iframe.contentWindow.postMessage(i,t)},i.prototype.onCloseListener=function(i){i.origin===this.config.domain&&"closeChatbot"===i.data&&this.closeIframe()},i.prototype.validateDomain=function(){var i,t=this.config.domain,n=null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.origin;return h.log("expectedDomain, to current domain",t,n,t===n),t===n},i.prototype.createChatBubblContainer=function(){var i,t=this,n=document.createElement("div");n.id="chatbase-message-bubbles",Object.assign(n.style,{position:"fixed",bottom:"80px",borderRadius:"10px",fontFamily:"sans-serif",fontSize:"16px",zIndex:"2147483644",cursor:"pointer",flexDirection:"column",gap:"50px",maxWidth:"70vw",display:"block",right:"1rem",left:"unset"});var e=document.createElement("div");e.classList.add("close-btn"),e.textContent="✕",Object.assign(e.style,{position:"absolute",top:"-7px",right:"-7px",fontWeight:"bold",display:"none",justifyContent:"center",alignItems:"center",zIndex:"2147483643",width:"22px",height:"22px",borderRadius:"50%",textAlign:"center",fontSize:"12px",cursor:"pointer",backgroundColor:"rgb(224, 224, 224)",color:"black",boxShadow:"rgba(150, 150, 150, 0.15) 0px 6px 24px 0px, rgba(150, 150, 150, 0.15) 0px 0px 0px 1px"}),((null===(i=this.config.chat_interface_config)||void 0===i?void 0:i.chat_bubble_prompts)||[]).forEach((function(i){var e=t.createMessageBubble(i);n.appendChild(e)})),n.appendChild(e),document.body.appendChild(n)},i.prototype.createMessageBubble=function(i){var t=document.createElement("div");this.bubblePromptContainer=t,Object.assign(t.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var n=document.createElement("div");n.classList.add("message"),n.textContent=i,Object.assign(n.style,{backgroundColor:"white",color:"black",boxShadow:"rgba(150, 150, 150, 0.2) 0px 10px 30px 0px, rgba(150, 150, 150, 0.2) 0px 0px 0px 1px",borderRadius:"10px",padding:"8px 5px",margin:"8px",fontSize:"14px",opacity:"1",transform:"scale(1)",transition:"opacity 0.5s ease 0s, transform 0.5s ease 0s"});var e=document.createElement("button");return e.innerHTML="&times;",Object.assign(e.style,{position:"absolute",top:"1px",left:"-3px",width:"20px",height:"20px",borderRadius:"50%",backgroundColor:"#fff",color:"#000",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 5px rgba(0,0,0,0.2)",fontSize:"14px",lineHeight:"1",padding:"0",zIndex:"100"}),e.addEventListener("click",(function(){t.remove()})),t.appendChild(e),t.appendChild(n),t},i.prototype.createFloatingButton=function(){var i=document.createElement("div");i.classList.add("message-bubble-container"),Object.assign(i.style,{position:"fixed",bottom:"1.5rem",right:"1.5rem",zIndex:"1000",width:"48px",height:"48px",display:"flex",flexDirection:"column-reverse",backgroundColor:this.config.brand_colour,color:f(this.config.brand_colour),borderRadius:"50%",alignItems:"center",justifyContent:"center",cursor:"pointer",overflow:"hidden"}),document.body.appendChild(i),this.logoContainer=i,this.loadImage(this.logoContainer),this.createChatBubblContainer(),this.logoContainer.addEventListener("click",this.toggleIframe.bind(this))},i.prototype.loadImage=function(i){var t,n,e=document.createElement("img");e.src=this.config.launcher_type?(null===(n=null===(t=this.config.images)||void 0===t?void 0:t.launcher_image_url)||void 0===n?void 0:n.url)||"".concat(this.config.domain,"/chatbubble.png"):this.config.image_url||"".concat(this.config.domain,"/chatbubble.png"),e.alt="Chat",Object.assign(e.style,{zIndex:"1000",cursor:"pointer",borderRadius:"50%",objectFit:"cover"}),this.chatBtnImage=e,i.innerHTML="",i.appendChild(e)},i.prototype.createIframe=function(){var i=this;h.log("RobylonConfig?.domain====>",this.config.domain);var t=document.createElement("iframe");Object.assign(t.style,{position:"fixed",right:"32px",bottom:"86px",minWidth:"400px",width:"26%",maxWidth:"800px",top:"calc(10vh - 32px)",maxHeight:"45rem",height:"calc(100vh - 3rem - 10vh)",zIndex:"20000000",border:"none",boxShadow:"0px 0px 40px 0px rgba(14, 14, 15, 0.24)",transformOrigin:"bottom right",transition:"transform 0.3s ease-out",borderRadius:"1rem",display:"none"}),t.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),h.log("iframe.src====>",t.src),document.body.appendChild(t),this.iframe=t;var n=function(){560>(null===window||void 0===window?void 0:window.innerWidth)?Object.assign(t.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(t.style,{width:"26%",minWidth:"400px",right:"32px",bottom:"86px",height:"calc(100vh - 3rem - 10vh)",borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"45rem"})};n(),null===window||void 0===window||window.addEventListener("resize",n),t.addEventListener("load",(function(){var n,e,o,r,l;if(i.iframe){var a=new URL(i.iframe.src).origin||i.config.domain;null===(n=t.contentWindow)||void 0===n||n.postMessage({domain:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname,name:"checkDomain"},a),null===(o=t.contentWindow)||void 0===o||o.postMessage({domain:null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.hostname,action:"registerUserId",data:{userId:i.config.userId,token:i.config.token,userProfile:d(d({},i.config.userProfile||{}),{__INT_SYS_INFO__:d(d({},(null===(l=i.config.userProfile)||void 0===l?void 0:l.__INT_SYS_INFO__)||{}),ot())})}},a),i.isIframeLoaded=!0,i.createFloatingButton()}})),null===window||void 0===window||window.addEventListener("message",(function(n){var e,o;if(n.origin===i.config.domain){if("captureSessionData"===n.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===i.config.chatbotId,l={cookies:dt(r),localStorage:JSON.stringify(localStorage),sessionStorage:JSON.stringify(sessionStorage),action:"capturedSessionData",domain_name:null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.hostname};null===(o=t.contentWindow)||void 0===o||o.postMessage(l,i.config.domain||"*")}"expand"===n.data&&(i.adjustIframeWidth(),t.style.height="calc(100vh - 120px)",t.style.bottom="86px"),"collapse"===n.data&&Object.assign(t.style,{width:"26%",height:"calc(100vh - 32px - 10vh)",bottom:"86px",top:"calc(32px + 10vh)"})}}))},i.prototype.adjustIframeWidth=function(){if(this.iframe){var i=null===window||void 0===window?void 0:window.innerWidth;h.log("screenWidth",i),this.iframe.style.width=832>i?"".concat(i-64,"px"):"800px"}},i.prototype.loadSvgInline=function(i){var t=document.createElement("div");t.innerHTML='\n<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g id="Chevron_Down">\n <path id="Vector" d="M19 9L12 16L5 9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n </g>\n</svg>\n';var n=t.querySelector("svg");i.innerHTML="",n&&i.appendChild(n)},i.prototype.toggleIcon=function(i,t){"block"===t.style.display?this.loadSvgInline(i):this.loadImage(i)},i.prototype.toggleIframe=function(){var i;if(h.log("toggleIframe",this.iframe,this.logoContainer,this.chatBtnImage),this.iframe&&this.logoContainer&&this.chatBtnImage){var t=new URL(this.iframe.src).origin||this.config.domain;h.log("toggleIframe"),null===(i=this.iframe.contentWindow)||void 0===i||i.postMessage({domain:null===window||void 0===window?void 0:window.location.hostname,name:"none"===this.iframe.style.display?"openFrame":"closeFrame"},t),this.iframe.style.display="none"===this.iframe.style.display?"block":"none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit="block"===this.iframe.style.display?"none":"cover",this.bubblePromptContainer&&(this.bubblePromptContainer.style.display="none"),h.log("this.bubblePromptContainer",this.bubblePromptContainer)}},i.prototype.closeIframe=function(){this.iframe&&this.logoContainer&&this.chatBtnImage&&(this.iframe.style.display="none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit="cover")},i.prototype.init=function(){this.createIframe()},i}(),ht=function(i){var t={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},n=[],e=function(i){t=d(d({},t),i),n.forEach((function(i){return i(t)}))};return{getState:function(){return t},initialize:function(){return u(void 0,void 0,void 0,(function(){var t,n,o;return c(this,(function(r){switch(r.label){case 0:if(!i.api_key)return Xi.trackError(Error(nt[Gi](i.api_key)),"ChatbotStateManager",{errorCode:Gi,errorType:tt,context:{timestamp:Date.now()}}),[2];e({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,ct(i)];case 2:return t=r.sent(),[4,new Promise((function(i,n){!function(n,o,r){if(n.chatbotId&&n.userId)try{new ft(n),e({isInitialized:!0,chatbotConfig:t}),i(),h.log("Robylon SDK initialized successfully.")}catch(i){r(i instanceof Error?i.message:"Failed to initialize SDK")}else r("Incomplete configuration for SDK initialization.")}(t,0,(function(i){n(i)}))}))];case 3:return r.sent(),[3,6];case 4:return n=r.sent(),o=n instanceof Error?n.message:"Failed to initialize chatbot",e({error:o}),Xi.trackError(n instanceof Error?n:Error(o),"ChatbotStateManager",{errorCode:Ji,errorType:tt,context:{timestamp:Date.now()}}),[3,6];case 5:return e({isInitializing:!1}),[7];case 6:return[2]}}))}))},toggleIframeVisibility:function(){e({isIframeVisible:!t.isIframeVisible})},closeIframe:function(){e({isIframeVisible:!1})},updateState:e,subscribe:function(i){return n.push(i),function(){var t=n.indexOf(i);t>-1&&n.splice(t,1)}},unsubscribe:function(i){var t=n.indexOf(i);t>-1&&n.splice(t,1)}}},pt=function(i){i.api_key,i.user_profile;var t=i.onEvent;return i.chatbotConfig,{emit:function(i,n){var e={type:i,timestamp:Date.now(),data:n};null==t||t(e)},onInternalEvent:function(i,t){}}},mt=function(){function i(i){var t=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.iframe=null,this.isDestroyed=!1,this.isIframeLoaded=!1,this.hasScrolledPastDepth=!1,this.scrollHandler=null,this.hasAutoLaunched=!1,this.hasScrolledPastAutoLaunchDepth=!1,this.autoLaunchScrollHandler=null,this.autoLaunchDelayTimeout=null,this.handleStateChange=function(i){var n,e,o,r,l,a,s,d,u;if(!t.isDestroyed){var c=i.isInitialized,v=i.error,f=i.chatbotConfig,h=i.isIframeVisible;if(!v&&f&&c){if(t.eventEmitter=pt({api_key:t.config.api_key,user_profile:t.config.user_profile,onEvent:t.config.onEvent,chatbotConfig:{isAnonymous:f.isAnonymous,userId:f.userId}}),t.container||(t.container=new lt(f,t.config.position,t.config.sideSpacing,t.config.bottomSpacing)),t.iframe)t.iframe.update({config:f,isVisible:h,position:t.config.position,bottomSpacing:t.config.bottomSpacing,overrides:t.config.overrides},!0);else if(t.iframe=new rt({config:f,isVisible:h,onClose:t.handleClose,onEvent:t.config.onEvent,onIframeLoaded:function(){t.isIframeLoaded=!0;var i=t.stateManager.getState();t.handleStateChange({isInitialized:i.isInitialized,error:i.error,chatbotConfig:i.chatbotConfig,isIframeVisible:i.isIframeVisible}),i.chatbotConfig&&t.handleAutoLaunch(i.chatbotConfig,i.isIframeVisible)},onInternalEvent:t.eventEmitter.onInternalEvent,position:t.config.position,bottomSpacing:t.config.bottomSpacing,overrides:t.config.overrides}),t.iframe.getElement&&"function"==typeof t.iframe.getElement){var p=t.iframe.getElement();p&&t.container&&t.container.getElement().prepend(p)}t.setupScrollTracking(f),t.setupAutoLaunchScrollTracking(f);var m=void 0!==t.config.show_launcher?!!t.config.show_launcher:null===(n=null==f?void 0:f.show_launcher)||void 0===n||n,g=!0===(null===(e=null==f?void 0:f.launcher_delay)||void 0===e?void 0:e.enabled),w=null!==(a=null!==(r=null===(o=null==f?void 0:f.launcher_delay)||void 0===o?void 0:o.seconds)&&void 0!==r?r:null===(l=null==f?void 0:f.launcher_delay)||void 0===l?void 0:l.delay)&&void 0!==a?a:0,b=!0===(null===(s=null==f?void 0:f.launcher_scroll)||void 0===s?void 0:s.enabled),y=null!==(u=null===(d=null==f?void 0:f.launcher_scroll)||void 0===d?void 0:d.depth)&&void 0!==u?u:0,x=b&&+y>0;console.log("[Vanilla SDK] Launcher visibility check",{finalShowLauncher:m,delayEnabled:g,seconds:w,scrollEnabled:b,scrollDepth:y,requiresScroll:x,hasScrolledPastDepth:t.hasScrolledPastDepth});var _=!0;if(x){var I=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;_=I>=+y||t.hasScrolledPastDepth,console.log("[Vanilla SDK] Scroll condition check",{currentScrollY:I,requiredDepth:+y,hasScrolledPastDepthState:t.hasScrolledPastDepth,scrollConditionMet:_})}var S=function(){if(t.isIframeLoaded)if(t.floatingButton)t.floatingButton.update({config:f,isIframeVisible:h,position:t.config.position,sideSpacing:t.config.sideSpacing,bottomSpacing:t.config.bottomSpacing,launcher_size:t.config.launcher_size}),t.handleAutoLaunch(f,h);else{if(t.floatingButton=new ji({config:f,toggleIframe:t.toggleIframe,isIframeVisible:h,onEvent:t.config.onEvent,onInternalEvent:t.eventEmitter.onInternalEvent,position:t.config.position,sideSpacing:t.config.sideSpacing,bottomSpacing:t.config.bottomSpacing,launcher_size:t.config.launcher_size}),t.floatingButton.getElement&&"function"==typeof t.floatingButton.getElement){var i=t.floatingButton.getElement();i&&t.container&&t.container.getElement().appendChild(i)}t.handleAutoLaunch(f,h)}},T=function(){t.floatingButton&&(t.floatingButton.destroy(),t.floatingButton=null)};t.launcherDelayTimeout&&(clearTimeout(t.launcherDelayTimeout),t.launcherDelayTimeout=null),m?x&&!_?(console.log("[Vanilla SDK] Scroll required but condition not met, unmounting button"),T()):g&&+w>0?t.floatingButton?t.isIframeLoaded&&S():t.launcherDelayTimeout=window.setTimeout((function(){var i,n,e,o=t.stateManager.getState().chatbotConfig,r=!0===(null===(i=null==o?void 0:o.launcher_scroll)||void 0===i?void 0:i.enabled),l=null!==(e=null===(n=null==o?void 0:o.launcher_scroll)||void 0===n?void 0:n.depth)&&void 0!==e?e:0,a=r&&+l>0,s=!0;a&&(s=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=+l||t.hasScrolledPastDepth),!t.isIframeLoaded||a&&!s||S(),t.launcherDelayTimeout=null}),1e3*+w):(console.log("[Vanilla SDK] No delay, checking iframe loaded",{isIframeLoaded:t.isIframeLoaded}),t.isIframeLoaded?(console.log("[Vanilla SDK] Mounting button immediately"),S()):console.log("[Vanilla SDK] Iframe not loaded yet, button will mount when loaded")):(console.log("[Vanilla SDK] show_launcher is false, unmounting button"),T())}}},this.setupAutoLaunchScrollTracking=function(i){var n,e,o;if(i&&!t.hasAutoLaunched){var r=!0===(null===(n=null==i?void 0:i.auto_launch_scroll)||void 0===n?void 0:n.enabled),l=null!==(o=null===(e=null==i?void 0:i.auto_launch_scroll)||void 0===e?void 0:e.depth)&&void 0!==o?o:0;if(t.autoLaunchScrollHandler&&(window.removeEventListener("scroll",t.autoLaunchScrollHandler),t.autoLaunchScrollHandler=null),r&&+l>0){var a=function(){if(!t.hasScrolledPastAutoLaunchDepth&&(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=+l){t.hasScrolledPastAutoLaunchDepth=!0;var i=t.stateManager.getState();i.chatbotConfig&&t.handleAutoLaunch(i.chatbotConfig,i.isIframeVisible)}};a(),t.autoLaunchScrollHandler=a,window.addEventListener("scroll",t.autoLaunchScrollHandler,{passive:!0})}else t.hasScrolledPastAutoLaunchDepth=!1}},this.handleAutoLaunch=function(i,n){var e,o,r,l,a,s,d;if(i&&!t.hasAutoLaunched&&t.isIframeLoaded&&!n){var u=void 0!==t.config.show_launcher?!!t.config.show_launcher:null===(e=null==i?void 0:i.show_launcher)||void 0===e||e,c=!0===(null==i?void 0:i.auto_launch),v=!!t.floatingButton;if(u&&c&&v){var f=!0===(null===(o=null==i?void 0:i.auto_launch_delay)||void 0===o?void 0:o.enabled),h=null!==(l=null===(r=null==i?void 0:i.auto_launch_delay)||void 0===r?void 0:r.seconds)&&void 0!==l?l:0,p=!0===(null===(a=null==i?void 0:i.auto_launch_scroll)||void 0===a?void 0:a.enabled),g=null!==(d=null===(s=null==i?void 0:i.auto_launch_scroll)||void 0===s?void 0:s.depth)&&void 0!==d?d:0,w=p&&+g>0,b=!0;if(w&&(b=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=+g||t.hasScrolledPastAutoLaunchDepth),!w||b){t.autoLaunchDelayTimeout&&(clearTimeout(t.autoLaunchDelayTimeout),t.autoLaunchDelayTimeout=null);var y=function(){t.hasAutoLaunched||n||(t.hasAutoLaunched=!0,t.toggleIframe(),t.eventEmitter.emit(m.CHATBOT_BUTTON_CLICKED))};f&&+h>0?t.autoLaunchDelayTimeout=window.setTimeout((function(){var i=!0;w&&(i=(window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0)>=+g||t.hasScrolledPastAutoLaunchDepth),w&&!i||y(),t.autoLaunchDelayTimeout=null}),1e3*+h):y()}}}},this.setupScrollTracking=function(i){var n,e,o,r,l;if(console.log("[Vanilla SDK] setupScrollTracking called",{hasConfig:!!i,scrollEnabled:null===(n=null==i?void 0:i.launcher_scroll)||void 0===n?void 0:n.enabled,scrollDepth:null===(e=null==i?void 0:i.launcher_scroll)||void 0===e?void 0:e.depth}),i){var a=!0===(null===(o=null==i?void 0:i.launcher_scroll)||void 0===o?void 0:o.enabled),s=null!==(l=null===(r=null==i?void 0:i.launcher_scroll)||void 0===r?void 0:r.depth)&&void 0!==l?l:0;if(t.scrollHandler&&(window.removeEventListener("scroll",t.scrollHandler),t.scrollHandler=null),!a||0>=+s)return console.log("[Vanilla SDK] Scroll disabled or depth <= 0, resetting state"),void(t.hasScrolledPastDepth=!1);var d=function(){if(!t.hasScrolledPastDepth){var i=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;if(console.log("[Vanilla SDK] Checking scroll depth",{currentScrollY:i,requiredDepth:+s,hasScrolledPast:i>=+s,currentState:t.hasScrolledPastDepth}),i>=+s){console.log("[Vanilla SDK] Scroll depth reached! Setting flag to true"),t.hasScrolledPastDepth=!0;var n=t.stateManager.getState();t.handleStateChange({isInitialized:n.isInitialized,error:n.error,chatbotConfig:n.chatbotConfig,isIframeVisible:n.isIframeVisible})}}};console.log("[Vanilla SDK] Checking initial scroll position"),d(),t.scrollHandler=d,window.addEventListener("scroll",t.scrollHandler,{passive:!0})}},this.toggleIframe=function(){var i=t.stateManager.getState();t.stateManager.toggleIframeVisibility(),t.eventEmitter.emit(i.isIframeVisible?m.CHATBOT_CLOSED:m.CHATBOT_BUTTON_CLICKED)},this.handleClose=function(){t.stateManager.closeIframe(),t.eventEmitter.emit(m.CHATBOT_CLOSED)};var n=d(d({},i),{position:"string"==typeof i.position?"left"===i.position.toLowerCase()?"Left":"right"===i.position.toLowerCase()?"Right":void 0:void 0,sideSpacing:"string"==typeof i.sideSpacing?""===i.sideSpacing||isNaN(+i.sideSpacing)?void 0:+i.sideSpacing:i.sideSpacing,bottomSpacing:"string"==typeof i.bottomSpacing?""===i.bottomSpacing||isNaN(+i.bottomSpacing)?void 0:+i.bottomSpacing:i.bottomSpacing,show_launcher:i.show_launcher,overrides:i.overrides,launcher_size:i.launcher_size});if(this.config=n,!i.api_key)throw Xi.trackError(Error(nt[Gi](i.api_key)),"RobylonChatbot",{errorCode:Gi,errorType:tt,context:{timestamp:Date.now()}}),Error("API key is required");try{Xi.initialize(i.api_key,i.user_id)}catch(i){Xi.trackError(i instanceof Error?i:Error(i+""),"RobylonChatbot",{errorCode:Zi,errorType:tt,context:{timestamp:Date.now()}})}this.stateManager=ht({api_key:i.api_key,user_id:i.user_id,user_token:i.user_token,user_profile:i.user_profile}),this.eventEmitter=pt({api_key:i.api_key,user_profile:i.user_profile,onEvent:i.onEvent,chatbotConfig:null}),this.initialize()}return i.prototype.initialize=function(){return u(this,void 0,void 0,(function(){var i;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return t.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return i=t.sent(),Xi.trackError(i instanceof Error?i:Error(i+""),"RobylonChatbot.initialize",{errorCode:Ji,errorType:tt,context:{timestamp:Date.now()}}),[3,3];case 3:return[2]}}))}))},i.prototype.show=function(){this.stateManager.getState().isIframeVisible||(this.stateManager.toggleIframeVisibility(),this.eventEmitter.emit(m.CHATBOT_BUTTON_CLICKED))},i.prototype.hide=function(){this.stateManager.getState().isIframeVisible&&(this.stateManager.closeIframe(),this.eventEmitter.emit(m.CHATBOT_CLOSED))},i.prototype.toggle=function(){this.toggleIframe()},i.prototype.destroy=function(){this.isDestroyed=!0,this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.autoLaunchScrollHandler&&(window.removeEventListener("scroll",this.autoLaunchScrollHandler),this.autoLaunchScrollHandler=null),this.autoLaunchDelayTimeout&&(clearTimeout(this.autoLaunchDelayTimeout),this.autoLaunchDelayTimeout=null),this.floatingButton&&(this.floatingButton.destroy(),this.floatingButton=null),this.launcherDelayTimeout&&(clearTimeout(this.launcherDelayTimeout),this.launcherDelayTimeout=null),this.iframe&&(this.iframe.destroy(),this.iframe=null),this.container&&(this.container.destroy(),this.container=null),this.stateManager.unsubscribe(this.handleStateChange)},i.prototype.getState=function(){return this.stateManager.getState().isInitialized?"initialized":"uninitialized"},i}();function gt(i){return new mt(i)}if("undefined"!=typeof window){!function(){if("undefined"!=typeof window){var i=window,t=(null==i?void 0:i.RobylonChatbot)||(null==i?void 0:i.R);if(t&&Array.isArray(t.q)){var n=null;t.q.forEach((function(i){var t=i[0];if("init"===t){var e=i[1]||{};n=gt(e)}else n&&"function"==typeof n[t]&&n[t]()})),i.RobylonChatbot=function(i){var t=[].slice.call(arguments,1);return"init"===i?n=gt(t[0]||{}):n&&"function"==typeof n[i]?n[i].apply(n,t):void 0},(null==i?void 0:i.R)||(i.R=i.RobylonChatbot),i.RobylonChatbot.getState=function(){return"initialized"},(null==i?void 0:i.R)&&(i.R.getState=i.RobylonChatbot.getState)}}}();var wt=window,bt=null==wt?void 0:wt.RobylonChatbot;bt&&!(null==wt?void 0:wt.R)&&(wt.R=bt)}var yt={create:gt,getState:function(){return"initialized"}};i.create=gt,i.default=yt,Object.defineProperty(i,"t",{value:!0})}));
2
2
  //# sourceMappingURL=robylon-chatbot.js.map