@robylon/whatsapp-react-sdk 1.0.1 → 1.0.3

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,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).RobylonChatbot={})}(this,function(t){"use strict";var n,i,e,o,r,l,a,s,d=function(){return d=Object.assign||function(t){for(var n,i=1,e=arguments.length;e>i;i++)for(var o in n=arguments[i])({}).hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},d.apply(this,arguments)};function u(t,n,i,e){return new(i||(i=Promise))(function(o,r){function l(t){try{s(e.next(t))}catch(t){r(t)}}function a(t){try{s(e.throw(t))}catch(t){r(t)}}function s(t){var n;t.done?o(t.value):(n=t.value,n instanceof i?n:new i(function(t){t(n)})).then(l,a)}s((e=e.apply(t,n||[])).next())})}function c(t,n){var i,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(i)throw new TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(r=0)),r;)try{if(i=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=n.call(t,r)}catch(t){a=[6,t],e=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function f(t,n,i){if(i||2===arguments.length)for(var e,o=0,r=n.length;r>o;o++)!e&&o in n||(e||(e=[].slice.call(n,0,o)),e[o]=n[o]);return t.concat(e||[].slice.call(n))}"function"==typeof SuppressedError&&SuppressedError,function(t){t.WIDGET="WIDGET",t.POPOVER="POPOVER",t.EMBED="EMBED"}(n||(n={})),function(t){t.RIGHT="Right",t.LEFT="Left"}(i||(i={})),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"}(l||(l={})),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"}(a||(a={})),function(t){t.BUTTON="BUTTON",t.TEXT="TEXT"}(s||(s={}));var v,h,p=function(t,n){void 0===n&&(n=.5);var i,e,o,r,l=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(t,n,i,e){return n+n+i+i+e+e});var n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:{r:0,g:0,b:0}}(t);return(i=l.r,e=l.g,o=l.b,.2126*(r=[i,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])>n?"#0E0E0F":"#FFFFFF"};!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"}(v||(v={})),function(t){t.CHAT_MOVED="CHAT_MOVED",t.CHATBOT_TOKEN_EXHAUSTED="CHATBOT_TOKEN_EXHAUSTED"}(h||(h={}));var m,g="system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",b="21px",w="",x=[],y=!1,_=function(){return"undefined"==typeof window?"":window.location.href},I=function(){return _()},T=function(){var t=_();t!==w&&(w=t,x.forEach(function(n){return n(t)}))},S=function(t,n,i,e){var o=n||"",r=_(),l=e||r,s=function(t,n){return-1!==n.indexOf(t)}(o,l);switch(i){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}},E=null,A=function(){return E===I()},k=function(){return!0},R=((m={})[o.WORKING_HOURS]=function(t,n){var i=n.getHours(),e=n.getMinutes();return(i>10||10===i&&e>=0)&&(19>i||19===i&&0===e)},m[o.ALWAYS]=k,m);const{entries:O,setPrototypeOf:C,isFrozen:z,getPrototypeOf:D,getOwnPropertyDescriptor:M}=Object;let{freeze:j,seal:F,create:N}=Object,{apply:L,construct:U}="undefined"!=typeof Reflect&&Reflect;j||(j=function(t){return t}),F||(F=function(t){return t}),L||(L=function(t,n){for(var i=arguments.length,e=Array(i>2?i-2:0),o=2;i>o;o++)e[o-2]=arguments[o];return t.apply(n,e)}),U||(U=function(t){for(var n=arguments.length,i=Array(n>1?n-1:0),e=1;n>e;e++)i[e-1]=arguments[e];return new t(...i)});const W=nt([].forEach),P=nt([].lastIndexOf),B=nt([].pop),H=nt([].push),X=nt([].splice),Y=nt("".toLowerCase),G=nt("".toString),J=nt("".match),V=nt("".replace),K=nt("".indexOf),Z=nt("".trim),q=nt({}.hasOwnProperty),Q=nt(/t/.test),$=(tt=TypeError,function(){for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return U(tt,n)});var tt;function nt(t){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var i=arguments.length,e=Array(i>1?i-1:0),o=1;i>o;o++)e[o-1]=arguments[o];return L(t,n,e)}}function it(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Y;C&&C(t,null);let e=n.length;for(;e--;){let o=n[e];if("string"==typeof o){const t=i(o);t!==o&&(z(n)||(n[e]=t),o=t)}t[o]=!0}return t}function et(t){for(let n=0;n<t.length;n++)q(t,n)||(t[n]=null);return t}function ot(t){const n=N(null);for(const[i,e]of O(t))q(t,i)&&(Array.isArray(e)?n[i]=et(e):e&&"object"==typeof e&&e.constructor===Object?n[i]=ot(e):n[i]=e);return n}function rt(t,n){for(;null!==t;){const i=M(t,n);if(i){if(i.get)return nt(i.get);if("function"==typeof i.value)return nt(i.value)}t=D(t)}return function(){return null}}const lt=j(["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"]),at=j(["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"]),st=j(["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"]),dt=j(["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"]),ut=j(["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"]),ct=j(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ft=j(["#text"]),vt=j(["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"]),ht=j(["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"]),pt=j(["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"]),mt=j(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),gt=F(/\{\{[\w\W]*|[\w\W]*\}\}/gm),bt=F(/<%[\w\W]*|[\w\W]*%>/gm),wt=F(/\$\{[\w\W]*/gm),xt=F(/^data-[\-\w.\u00B7-\uFFFF]+$/),yt=F(/^aria-[\-\w]+$/),_t=F(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),It=F(/^(?:\w+script|data):/i),Tt=F(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),St=F(/^html$/i),Et=F(/^[a-z][.\w]*(-[.\w]+)+$/i);var At=Object.freeze({__proto__:null,ARIA_ATTR:yt,ATTR_WHITESPACE:Tt,CUSTOM_ELEMENT:Et,DATA_ATTR:xt,DOCTYPE_NAME:St,ERB_EXPR:bt,IS_ALLOWED_URI:_t,IS_SCRIPT_OR_DATA:It,MUSTACHE_EXPR:gt,TMPLIT_EXPR:wt});const kt=function(){return"undefined"==typeof window?null:window};var Rt=function t(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:kt();const i=n=>t(n);if(i.version="3.3.3",i.removed=[],!n||!n.document||9!==n.document.nodeType||!n.Element)return i.isSupported=!1,i;let{document:e}=n;const o=e,r=o.currentScript,{DocumentFragment:l,HTMLTemplateElement:a,Node:s,Element:d,NodeFilter:u,NamedNodeMap:c=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:f,DOMParser:v,trustedTypes:h}=n,p=d.prototype,m=rt(p,"cloneNode"),g=rt(p,"remove"),b=rt(p,"nextSibling"),w=rt(p,"childNodes"),x=rt(p,"parentNode");if("function"==typeof a){const t=e.createElement("template");t.content&&t.content.ownerDocument&&(e=t.content.ownerDocument)}let y,_="";const{implementation:I,createNodeIterator:T,createDocumentFragment:S,getElementsByTagName:E}=e,{importNode:A}=o;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof O&&"function"==typeof x&&I&&void 0!==I.createHTMLDocument;const{MUSTACHE_EXPR:R,ERB_EXPR:C,TMPLIT_EXPR:z,DATA_ATTR:D,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:U}=At;let{IS_ALLOWED_URI:tt}=At,nt=null;const et=it({},[...lt,...at,...st,...ut,...ft]);let gt=null;const bt=it({},[...vt,...ht,...pt,...mt]);let wt=Object.seal(N(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}})),xt=null,yt=null;const It=Object.seal(N(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Tt=!0,Et=!0,Rt=!1,Ot=!0,Ct=!1,zt=!0,Dt=!1,Mt=!1,jt=!1,Ft=!1,Nt=!1,Lt=!1,Ut=!0,Wt=!1,Pt=!0,Bt=!1,Ht={},Xt=null;const Yt=it({},["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=it({},["audio","video","img","source","image","track"]);let Vt=null;const Kt=it({},["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,tn=!1,nn=null;const en=it({},[Zt,qt,Qt],G);let on=it({},["mi","mo","mn","ms","mtext"]),rn=it({},["annotation-xml"]);const ln=it({},["title","style","font","a","script"]);let an=null;const sn=["application/xhtml+xml","text/html"];let dn=null,un=null;const cn=e.createElement("form"),fn=function(t){return t instanceof RegExp||t instanceof Function},vn=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!un||un!==t){if(t&&"object"==typeof t||(t={}),t=ot(t),an=-1===sn.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,dn="application/xhtml+xml"===an?G:Y,nt=q(t,"ALLOWED_TAGS")?it({},t.ALLOWED_TAGS,dn):et,gt=q(t,"ALLOWED_ATTR")?it({},t.ALLOWED_ATTR,dn):bt,nn=q(t,"ALLOWED_NAMESPACES")?it({},t.ALLOWED_NAMESPACES,G):en,Vt=q(t,"ADD_URI_SAFE_ATTR")?it(ot(Kt),t.ADD_URI_SAFE_ATTR,dn):Kt,Gt=q(t,"ADD_DATA_URI_TAGS")?it(ot(Jt),t.ADD_DATA_URI_TAGS,dn):Jt,Xt=q(t,"FORBID_CONTENTS")?it({},t.FORBID_CONTENTS,dn):Yt,xt=q(t,"FORBID_TAGS")?it({},t.FORBID_TAGS,dn):ot({}),yt=q(t,"FORBID_ATTR")?it({},t.FORBID_ATTR,dn):ot({}),Ht=!!q(t,"USE_PROFILES")&&t.USE_PROFILES,Tt=!1!==t.ALLOW_ARIA_ATTR,Et=!1!==t.ALLOW_DATA_ATTR,Rt=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Ot=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Ct=t.SAFE_FOR_TEMPLATES||!1,zt=!1!==t.SAFE_FOR_XML,Dt=t.WHOLE_DOCUMENT||!1,Ft=t.RETURN_DOM||!1,Nt=t.RETURN_DOM_FRAGMENT||!1,Lt=t.RETURN_TRUSTED_TYPE||!1,jt=t.FORCE_BODY||!1,Ut=!1!==t.SANITIZE_DOM,Wt=t.SANITIZE_NAMED_PROPS||!1,Pt=!1!==t.KEEP_CONTENT,Bt=t.IN_PLACE||!1,tt=t.ALLOWED_URI_REGEXP||_t,$t=t.NAMESPACE||Qt,on=t.MATHML_TEXT_INTEGRATION_POINTS||on,rn=t.HTML_INTEGRATION_POINTS||rn,wt=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&fn(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(wt.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&fn(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(wt.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(wt.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ct&&(Et=!1),Nt&&(Ft=!0),Ht&&(nt=it({},ft),gt=N(null),!0===Ht.html&&(it(nt,lt),it(gt,vt)),!0===Ht.svg&&(it(nt,at),it(gt,ht),it(gt,mt)),!0===Ht.svgFilters&&(it(nt,st),it(gt,ht),it(gt,mt)),!0===Ht.mathMl&&(it(nt,ut),it(gt,pt),it(gt,mt))),q(t,"ADD_TAGS")||(It.tagCheck=null),q(t,"ADD_ATTR")||(It.attributeCheck=null),t.ADD_TAGS&&("function"==typeof t.ADD_TAGS?It.tagCheck=t.ADD_TAGS:(nt===et&&(nt=ot(nt)),it(nt,t.ADD_TAGS,dn))),t.ADD_ATTR&&("function"==typeof t.ADD_ATTR?It.attributeCheck=t.ADD_ATTR:(gt===bt&&(gt=ot(gt)),it(gt,t.ADD_ATTR,dn))),t.ADD_URI_SAFE_ATTR&&it(Vt,t.ADD_URI_SAFE_ATTR,dn),t.FORBID_CONTENTS&&(Xt===Yt&&(Xt=ot(Xt)),it(Xt,t.FORBID_CONTENTS,dn)),t.ADD_FORBID_CONTENTS&&(Xt===Yt&&(Xt=ot(Xt)),it(Xt,t.ADD_FORBID_CONTENTS,dn)),Pt&&(nt["#text"]=!0),Dt&&it(nt,["html","head","body"]),nt.table&&(it(nt,["tbody"]),delete xt.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw $('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw $('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=t.TRUSTED_TYPES_POLICY,_=y.createHTML("")}else void 0===y&&(y=function(t,n){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let i=null;const e="data-tt-policy-suffix";n&&n.hasAttribute(e)&&(i=n.getAttribute(e));const o="dompurify"+(i?"#"+i:"");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!==y&&"string"==typeof _&&(_=y.createHTML(""));j&&j(t),un=t}},hn=it({},[...at,...st,...dt]),pn=it({},[...ut,...ct]),mn=function(t){H(i.removed,{element:t});try{x(t).removeChild(t)}catch(n){g(t)}},gn=function(t,n){try{H(i.removed,{attribute:n.getAttributeNode(t),from:n})}catch(t){H(i.removed,{attribute:null,from:n})}if(n.removeAttribute(t),"is"===t)if(Ft||Nt)try{mn(n)}catch(t){}else try{n.setAttribute(t,"")}catch(t){}},bn=function(t){let n=null,i=null;if(jt)t="<remove></remove>"+t;else{const n=J(t,/^[\r\n\t ]+/);i=n&&n[0]}"application/xhtml+xml"===an&&$t===Qt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const o=y?y.createHTML(t):t;if($t===Qt)try{n=(new v).parseFromString(o,an)}catch(t){}if(!n||!n.documentElement){n=I.createDocument($t,"template",null);try{n.documentElement.innerHTML=tn?_:o}catch(t){}}const r=n.body||n.documentElement;return t&&i&&r.insertBefore(e.createTextNode(i),r.childNodes[0]||null),$t===Qt?E.call(n,Dt?"html":"body")[0]:Dt?n.documentElement:r},wn=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)},xn=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)},yn=function(t){return"function"==typeof s&&t instanceof s};function _n(t,n,e){W(t,t=>{t.call(i,n,e,un)})}const In=function(t){let n=null;if(_n(k.beforeSanitizeElements,t,null),xn(t))return mn(t),!0;const e=dn(t.nodeName);if(_n(k.uponSanitizeElement,t,{tagName:e,allowedTags:nt}),zt&&t.hasChildNodes()&&!yn(t.firstElementChild)&&Q(/<[/\w!]/g,t.innerHTML)&&Q(/<[/\w!]/g,t.textContent))return mn(t),!0;if(7===t.nodeType)return mn(t),!0;if(zt&&8===t.nodeType&&Q(/<[/\w]/g,t.data))return mn(t),!0;if(!(It.tagCheck instanceof Function&&It.tagCheck(e))&&(!nt[e]||xt[e])){if(!xt[e]&&Sn(e)){if(wt.tagNameCheck instanceof RegExp&&Q(wt.tagNameCheck,e))return!1;if(wt.tagNameCheck instanceof Function&&wt.tagNameCheck(e))return!1}if(Pt&&!Xt[e]){const n=x(t)||t.parentNode,i=w(t)||t.childNodes;if(i&&n)for(let e=i.length-1;e>=0;--e){const o=m(i[e],!0);o.t=(t.t||0)+1,n.insertBefore(o,b(t))}}return mn(t),!0}return t instanceof d&&!function(t){let n=x(t);n&&n.tagName||(n={namespaceURI:$t,tagName:"template"});const i=Y(t.tagName),e=Y(n.tagName);return!!nn[t.namespaceURI]&&(t.namespaceURI===qt?n.namespaceURI===Qt?"svg"===i:n.namespaceURI===Zt?"svg"===i&&("annotation-xml"===e||on[e]):!!hn[i]:t.namespaceURI===Zt?n.namespaceURI===Qt?"math"===i:n.namespaceURI===qt?"math"===i&&rn[e]:!!pn[i]:t.namespaceURI===Qt?!(n.namespaceURI===qt&&!rn[e])&&!(n.namespaceURI===Zt&&!on[e])&&!pn[i]&&(ln[i]||!hn[i]):!("application/xhtml+xml"!==an||!nn[t.namespaceURI]))}(t)?(mn(t),!0):"noscript"!==e&&"noembed"!==e&&"noframes"!==e||!Q(/<\/no(script|embed|frames)/i,t.innerHTML)?(Ct&&3===t.nodeType&&(n=t.textContent,W([R,C,z],t=>{n=V(n,t," ")}),t.textContent!==n&&(H(i.removed,{element:t.cloneNode()}),t.textContent=n)),_n(k.afterSanitizeElements,t,null),!1):(mn(t),!0)},Tn=function(t,n,i){if(yt[n])return!1;if(Ut&&("id"===n||"name"===n)&&(i in e||i in cn))return!1;if(Et&&!yt[n]&&Q(D,n));else if(Tt&&Q(M,n));else if(It.attributeCheck instanceof Function&&It.attributeCheck(n,t));else if(!gt[n]||yt[n]){if(!(Sn(t)&&(wt.tagNameCheck instanceof RegExp&&Q(wt.tagNameCheck,t)||wt.tagNameCheck instanceof Function&&wt.tagNameCheck(t))&&(wt.attributeNameCheck instanceof RegExp&&Q(wt.attributeNameCheck,n)||wt.attributeNameCheck instanceof Function&&wt.attributeNameCheck(n,t))||"is"===n&&wt.allowCustomizedBuiltInElements&&(wt.tagNameCheck instanceof RegExp&&Q(wt.tagNameCheck,i)||wt.tagNameCheck instanceof Function&&wt.tagNameCheck(i))))return!1}else if(Vt[n]);else if(Q(tt,V(i,L,"")));else if("src"!==n&&"xlink:href"!==n&&"href"!==n||"script"===t||0!==K(i,"data:")||!Gt[t])if(Rt&&!Q(F,V(i,L,"")));else if(i)return!1;return!0},Sn=function(t){return"annotation-xml"!==t&&J(t,U)},En=function(t){_n(k.beforeSanitizeAttributes,t,null);const{attributes:n}=t;if(!n||xn(t))return;const e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:gt,forceKeepAttr:void 0};let o=n.length;for(;o--;){const r=n[o],{name:l,namespaceURI:a,value:s}=r,d=dn(l),u=s;let c="value"===l?u:Z(u);if(e.attrName=d,e.attrValue=c,e.keepAttr=!0,e.forceKeepAttr=void 0,_n(k.uponSanitizeAttribute,t,e),c=e.attrValue,!Wt||"id"!==d&&"name"!==d||(gn(l,t),c="user-content-"+c),zt&&Q(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,c)){gn(l,t);continue}if("attributename"===d&&J(c,"href")){gn(l,t);continue}if(e.forceKeepAttr)continue;if(!e.keepAttr){gn(l,t);continue}if(!Ot&&Q(/\/>/i,c)){gn(l,t);continue}Ct&&W([R,C,z],t=>{c=V(c,t," ")});const f=dn(t.nodeName);if(Tn(f,d,c)){if(y&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(a);else switch(h.getAttributeType(f,d)){case"TrustedHTML":c=y.createHTML(c);break;case"TrustedScriptURL":c=y.createScriptURL(c)}if(c!==u)try{a?t.setAttributeNS(a,l,c):t.setAttribute(l,c),xn(t)?mn(t):B(i.removed)}catch(n){gn(l,t)}}else gn(l,t)}_n(k.afterSanitizeAttributes,t,null)},An=function t(n){let i=null;const e=wn(n);for(_n(k.beforeSanitizeShadowDOM,n,null);i=e.nextNode();)_n(k.uponSanitizeShadowNode,i,null),In(i),En(i),i.content instanceof l&&t(i.content);_n(k.afterSanitizeShadowDOM,n,null)};return i.sanitize=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=null,r=null,a=null,d=null;if(tn=!t,tn&&(t="\x3c!--\x3e"),"string"!=typeof t&&!yn(t)){if("function"!=typeof t.toString)throw $("toString is not a function");if("string"!=typeof(t=t.toString()))throw $("dirty is not a string, aborting")}if(!i.isSupported)return t;if(Mt||vn(n),i.removed=[],"string"==typeof t&&(Bt=!1),Bt){if(t.nodeName){const n=dn(t.nodeName);if(!nt[n]||xt[n])throw $("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof s)e=bn("\x3c!----\x3e"),r=e.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?e=r:e.appendChild(r);else{if(!Ft&&!Ct&&!Dt&&-1===t.indexOf("<"))return y&&Lt?y.createHTML(t):t;if(e=bn(t),!e)return Ft?null:Lt?_:""}e&&jt&&mn(e.firstChild);const u=wn(Bt?t:e);for(;a=u.nextNode();)In(a),En(a),a.content instanceof l&&An(a.content);if(Bt)return t;if(Ft){if(Nt)for(d=S.call(e.ownerDocument);e.firstChild;)d.appendChild(e.firstChild);else d=e;return(gt.shadowroot||gt.shadowrootmode)&&(d=A.call(o,d,!0)),d}let c=Dt?e.outerHTML:e.innerHTML;return Dt&&nt["!doctype"]&&e.ownerDocument&&e.ownerDocument.doctype&&e.ownerDocument.doctype.name&&Q(St,e.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+e.ownerDocument.doctype.name+">\n"+c),Ct&&W([R,C,z],t=>{c=V(c,t," ")}),y&&Lt?y.createHTML(c):c},i.setConfig=function(){vn(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Mt=!0},i.clearConfig=function(){un=null,Mt=!1},i.isValidAttribute=function(t,n,i){un||vn({});const e=dn(t),o=dn(n);return Tn(e,o,i)},i.addHook=function(t,n){"function"==typeof n&&H(k[t],n)},i.removeHook=function(t,n){if(void 0!==n){const i=P(k[t],n);return-1===i?void 0:X(k[t],i,1)[0]}return B(k[t])},i.removeHooks=function(t){k[t]=[]},i.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},i}(),Ot="https://cdn.robylon.ai/logos/WhatsApp.svg",Ct=function(){function t(t){var n,i=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(){i.buttonElement.style.opacity="1"})}catch(t){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=(n=function(){i.clearProactiveDelays(),i.renderProactiveIfNeeded(!0)},y||function(){if(!y&&"undefined"!=typeof window){y=!0,w=_();var t=function(t){var n=history[t];return function(){for(var t=[],i=0;arguments.length>i;i++)t[i]=arguments[i];var e=n.apply(this,t);return setTimeout(T,0),e}};try{history.pushState=t("pushState"),history.replaceState=t("replaceState")}catch(t){}window.addEventListener("popstate",T),window.addEventListener("hashchange",T);var n=setInterval(function(){T()},1e3);setInterval(function(){0===x.length&&(clearInterval(n),window.removeEventListener("popstate",T),window.removeEventListener("hashchange",T),y=!1)},5e3)}}(),x.push(n),n(_()),function(){var t=x.indexOf(n);t>-1&&x.splice(t,1)})}return t.prototype.render=function(){var t,n,i=this,o=this.config,r=o.config,l=o.isIframeVisible,a=null!==(t=null==r?void 0:r.launcher_size_multiplier)&&void 0!==t?t:1,s=null!==(n=this.config.launcher_size)&&void 0!==n?n: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:g};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(){i.config.toggleIframe(),i.hideProactiveMessages()},this.renderProactiveIfNeeded()},t.prototype.createLauncherElement=function(){var t,n,i,o,r,l,a=this.config,s=a.config,d=a.isIframeVisible,u=null!==(t=null==s?void 0:s.launcher_size_multiplier)&&void 0!==t?t:1,c=null!==(n=this.config.launcher_size)&&void 0!==n?n:48*u,f="".concat(Math.max(4,Math.round(4*u)),"px"),v=(null==s?void 0:s.launcher_type)?(null===(r=null===(o=null===(i=null==s?void 0:s.images)||void 0===i?void 0:i.launcher_image_url)||void 0===o?void 0:o.url)||void 0===r?void 0:r.trim())||Ot:(null===(l=null==s?void 0:s.image_url)||void 0===l?void 0:l.trim())||Ot,h=v===Ot;switch(console.log("config in floating button",s),s.launcher_type){case e.TEXT:return this.createTextLauncher();case e.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case e.IMAGE:default:if(d){var p=Math.round(.5*c),m=document.createElement("div");Object.assign(m.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});var g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("width",p+""),g.setAttribute("height",p+""),g.setAttribute("viewBox","0 0 24 24"),g.setAttribute("fill","none"),g.setAttribute("xmlns","http://www.w3.org/2000/svg"),g.style.display="block";var b=document.createElementNS("http://www.w3.org/2000/svg","path");return b.setAttribute("d","M19 9L12 16L5 9"),b.setAttribute("stroke","currentColor"),b.setAttribute("stroke-width","1.5"),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round"),g.appendChild(b),m.appendChild(g),m}var w=document.createElement("img");return w.src=v,w.alt="Chat",Object.assign(w.style,{zIndex:"1000",cursor:"pointer",borderRadius:h?"0":"50%",objectFit:h?"contain":"cover",padding:h?f:"0",width:h?"calc(100% - 3px)":"100%",height:h?"calc(100% - 3px)":"100%",margin:h?"4px":"0",boxSizing:"border-box"}),w}},t.prototype.createTextLauncher=function(){var t=this.config.config,n=t.brand_colour,i=t.launcher_properties,e=t.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:n,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:p(n),fontSize:void 0!==a?"".concat(a,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==s?"".concat(s,"px"):b,fontFamily:g,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),c.textContent=(null==i?void 0:i.text)||"",u.appendChild(c),d.appendChild(u),d},t.prototype.createTextualImageLauncher=function(){var t,n,i,e,o,r,l,a=this.config.config,s=a.brand_colour,d=a.launcher_properties,u=a.image_url,c=a.launcher_size_multiplier,f=(null===(n=null===(t=null==this?void 0:this.config)||void 0===t?void 0:t.config)||void 0===n?void 0:n.launcher_type)?(null===(l=null===(r=null===(o=null===(e=null===(i=null==this?void 0:this.config)||void 0===i?void 0:i.config)||void 0===e?void 0:e.images)||void 0===o?void 0:o.launcher_image_url)||void 0===r?void 0:r.url)||void 0===l?void 0:l.trim())||Ot:(null==u?void 0:u.trim())||Ot,v=f===Ot,h=null!=c?c:1,m="".concat(Math.max(4,Math.round(4*h)),"px"),w=void 0!==this.config.launcher_size?void 0:174*h,x=void 0!==this.config.launcher_size?void 0:40*h,y=void 0!==this.config.launcher_size?void 0:40*h,_=void 0!==this.config.launcher_size?void 0:14*h,I=void 0!==this.config.launcher_size?void 0:21*h,T=document.createElement("div");Object.assign(T.style,{maxWidth:void 0!==w?"".concat(w,"px"):"13rem",width:"fit-content",height:void 0!==x?"".concat(x,"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 S=document.createElement("div");Object.assign(S.style,{flex:"1",minWidth:"0"});var E=document.createElement("p");Object.assign(E.style,{margin:"0",color:p(s),fontSize:void 0!==_?"".concat(_,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==I?"".concat(I,"px"):b,fontFamily:g,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),E.textContent=(null==d?void 0:d.text)||"";var A=document.createElement("div");Object.assign(A.style,{width:void 0!==y?"".concat(y,"px"):"40px",height:void 0!==y?"".concat(y,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var k=document.createElement("img");return k.src=f,k.alt="Chat",Object.assign(k.style,{width:v?"calc(100% - 6px)":"100%",height:v?"calc(100% - 6px)":"100%",margin:v?"3px":"0",borderRadius:v?"0":"50%",objectFit:v?"contain":"cover",padding:v?m:"0",boxSizing:"border-box"}),S.appendChild(E),A.appendChild(k),T.appendChild(S),T.appendChild(A),T},t.prototype.applyResponsiveStyles=function(t){var n,i,e,o,r,l,a,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!==(l=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(r=f.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=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?((n={position:"fixed",bottom:"".concat(p,"px")})[v.toLowerCase()]="".concat(h,"px"),n):((i={bottom:"".concat(p,"px")})[v.toLowerCase()]="".concat(h,"px"),i));Object.assign(this.buttonElement.style,m)},t.prototype.handleResize=function(){var t,n,i,o=null!==(n=null===(t=this.config.config)||void 0===t?void 0:t.launcher_size_multiplier)&&void 0!==n?n:1,r=null!==(i=this.config.launcher_size)&&void 0!==i?i: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)},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 n,i;null===(i=(n=t.config).onEvent)||void 0===i||i.call(n,{type:v.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),t.config.onInternalEvent(v.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,n,i=this;E=I();var e=null===(t=this.proactiveElement)||void 0===t?void 0:t.children[0];if(e){var o="Right"===(this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right");Array.from(e.children).forEach(function(t){t.className=o?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"}),setTimeout(function(){i.proactiveElement&&i.proactiveElement.parentElement&&i.proactiveElement.parentElement.removeChild(i.proactiveElement),i.proactiveElement=null,i.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(g,' !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 n,i,o,r,a,u,c,v,h,m,w,x,y,I,T,E=this,O=null===(i=null===(n=this.config)||void 0===n?void 0:n.config)||void 0===i?void 0:i.proactive_message_obj;if(!Array.isArray(O)||this.config.isIframeVisible||A())if(this.proactiveElement&&this.proactiveElement.parentElement){var C=this.proactiveElement.children[0],z="Right"===(this.config.position||(null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.position)||"Right");Array.from(C.children).forEach(function(t){t.className=z?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"}),setTimeout(function(){E.proactiveElement&&E.proactiveElement.parentElement&&E.proactiveElement.parentElement.removeChild(E.proactiveElement),E.proactiveElement=null,E.clearProactiveDelays()},400)}else this.proactiveElement=null,this.clearProactiveDelays();else{if(this.injectAnimationStyles(),!this.proactiveElement){var D=document.createElement("div");D.style.position="fixed";var M=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,j=null!==(h=null!==(c=this.config.sideSpacing)&&void 0!==c?c:null===(v=this.config.config.interface_properties)||void 0===v?void 0:v.side_spacing)&&void 0!==h?h:20,F=this.config.position||(null===(m=this.config.config.interface_properties)||void 0===m?void 0:m.position)||"Right",N=null!==(x=null===(w=this.config.config)||void 0===w?void 0:w.launcher_size_multiplier)&&void 0!==x?x:1,L=null!==(y=this.config.launcher_size)&&void 0!==y?y:48*N,U=this.config.config.launcher_type===e.IMAGE?L:void 0!==this.config.launcher_size?40:40*N;D.style.bottom="".concat(M+U+8,"px"),"Right"===F?D.style.right="".concat(j,"px"):D.style.left="".concat(j,"px"),D.style.maxWidth="22.875rem",D.style.zIndex="2147483646";var W=document.createElement("div");W.style.display="flex",W.style.flexDirection="column",W.style.alignItems="Right"===F?"flex-end":"flex-start";var P=document.createElement("div");P.style.position="absolute",P.style.top="-32px",P.style.width="24px",P.style.height="24px",P.style.borderRadius="50%",P.style.background="#fff",P.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",P.style.display="flex",P.style.alignItems="center",P.style.justifyContent="center",P.style.cursor="pointer",P.style.opacity="0",P.style.visibility="hidden","Right"===(this.config.position||(null===(I=this.config.config.interface_properties)||void 0===I?void 0:I.position)||"Right")?(P.style.right="0px",P.style.left="auto",P.style.transform="translateX(120%) scale(0.95)"):(P.style.left="0px",P.style.right="auto",P.style.transform="translateX(-120%) scale(0.95)"),P.onclick=function(t){t.stopPropagation(),E.hideProactiveMessages()},P.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 ',D.appendChild(W),D.appendChild(P),document.body.appendChild(D),this.proactiveElement=D}var B=this.proactiveElement.children[0];B.innerHTML="";var H="Right"===(this.config.position||(null===(T=this.config.config.interface_properties)||void 0===T?void 0:T.position)||"Right");B.style.display="flex",B.style.flexDirection="column",B.style.alignItems=H?"flex-end":"flex-start",this.clearProactiveDelays();var X=function(t){if(!t||A())return[];var n=_(),i=new Date,e=[];return t.forEach(function(t){e.push.apply(e,function(t,n,i){var e=(null==t?void 0:t.send_time_type)||"",o=e?R[e]:k;if(!o||!o(t,i))return[];for(var r=(null==t?void 0:t.content_multiple)||[],a=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=l.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=S(null==b||b.type,(null==b?void 0:b.value)||"",null==b?void 0:b.condition,n);v=null===v?w:h===l.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:a,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,n,i))}),e}(O);f([],X,!0).sort(function(t,n){return t.delayMs!==n.delayMs?t.delayMs-n.delayMs:t.contentIndex-n.contentIndex});var Y=new Map;X.forEach(function(t){var n=Y.get(t.delayMs);n||(n={messageIds:[],groups:new Map},Y.set(t.delayMs,n)),n.groups.has(t.messageId)||(n.messageIds.push(t.messageId),n.groups.set(t.messageId,[])),n.groups.get(t.messageId).push(t)});var G=void 0!==Y.get(0),J=this.proactiveElement.children[1];if(J&&X.length>0){J.style.opacity="0",J.style.visibility="hidden",J.style.transform=H?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var V=function(){if(J){J.style.visibility="visible";var t=B.children.length,n=t>0?10*(t-1):0;J.style.animationDelay="".concat(n,"ms"),J.className=H?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}};if(G){var K=window.setTimeout(V,0);this.delayTimers.push(K)}else{var Z=Math.min.apply(Math,Array.from(Y.keys()));K=window.setTimeout(V,Z),this.delayTimers.push(K)}}else J&&(J.style.opacity="0",J.style.visibility="hidden");var q=0;Y.forEach(function(t,n){var i=t.messageIds,e=t.groups,o=window.setTimeout(function(){var t=B.children.length,o=0,r=[];i.forEach(function(t){var n=e.get(t)||[];f([],n,!0).sort(function(t,n){return t.contentIndex-n.contentIndex}).forEach(function(n){r.push({messageId:t,item:n})}),o+=n.length});var l=n>0?f([],r,!0).reverse():r;l.forEach(function(i,e){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=g,u.style.fontSize="14px",u.style.lineHeight=b+"",u.style.width="fit-content",u.style.maxWidth="100%";var f=0===e,v=e===l.length-1,h=t>0,m=Y.has(0),w=!1;0===n?w=!v||f&&h:f&&(h||m)?w=!0:f||(w=!0),w&&(u.style.marginBottom="16px");var x=10*(t+o-1-(0===n?t+q:q));u.className=H?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",u.style.animationDelay="".concat(x,"ms"),u.style.opacity="0",u.style.transform=H?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var y=document.createElement("div");Object.assign(y.style,{display:"flex",alignItems:"center",gap:"8px"});var _=document.createElement("div");if(_.className="rblyn-proactive-message-content",_.setAttribute("dir",function(t){if(!t||"string"!=typeof t||0===t.trim().length)return"ltr";var n=t.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===n.length)return"ltr";for(var i=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,e=0,o=0,r=0,l=n;r<l.length;r++){var a=l[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(a)||(o++,i.test(a)&&e++)}return 0===o?"ltr":e/o>.3?"rtl":"ltr"}(a.html)),_.innerHTML=function(t){return t?Rt.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}):""}(a.html),y.appendChild(_),(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:p((null==a?void 0:a.messageBubbleBg)||"#ffffff")});var T=document.createElementNS("http://www.w3.org/2000/svg","g");T.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"),T.appendChild(S),I.appendChild(T),y.appendChild(I)}if(u.appendChild(y),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 t;t={message_id:a.messageId,content_string:a.html||null,content_id:a.contentId||null},d({input_id:null},t),E.config.toggleIframe(),E.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:a.messageId,content_string:a.html||null,content_id:a.contentId||null}}))}catch(t){}}},0===n)B.appendChild(u);else{B.insertBefore(u,B.firstChild);var A=null===(r=E.proactiveElement)||void 0===r?void 0:r.children[1];if(A&&"visible"===A.style.visibility){var k=B.children.length,R=k>0?10*(k-1):0;A.style.animationDelay="".concat(R,"ms")}}q++})},n);E.delayTimers.push(o)})}},t}(),zt=function(){function t(t,n,i,e){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:t,position:n,sideSpacing:i,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,n,i,e,o,r,l,a,s,u=560>(null===window||void 0===window?void 0:window.innerWidth),c=this.config.position||(null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.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!==(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),((t={bottom:"".concat(v,"px")})[c.toLowerCase()]="".concat(f,"px"),t.alignItems="Right"===c?"flex-end":"flex-start",t)),m=d(d({},h),((n={top:"0"})[c.toLowerCase()]="".concat(f,"px"),n.alignItems="center",n));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}(),Dt=function(){function t(t){this.config=t,this.popupElement=document.createElement("div"),this.render()}return t.prototype.createTitleBar=function(){var t,n,i,e,o,r,l=(null===(n=null===(t=this.config)||void 0===t?void 0:t.config)||void 0===n?void 0:n.title_bar_color)||"#075E54",a=p(l),s=function(t){var n,i;if(null==t?void 0:t.startsWith("#")){var e=t.replace("#",""),o=3===(null==e?void 0:e.length)?null===(i=null===(n=null==e?void 0:e.split(""))||void 0===n?void 0:n.map(function(t){return"".concat(t).concat(t)}))||void 0===i?void 0:i.join(""):e;if(6===(null==o?void 0:o.length)){var r=parseInt(null==o?void 0:o.slice(0,2),16),l=parseInt(null==o?void 0:o.slice(2,4),16),a=parseInt(null==o?void 0:o.slice(4,6),16);return"rgba(".concat(r,", ").concat(l,", ").concat(a,", 0.8)")}}return"#FFFFFF"===t?"rgba(255, 255, 255, 0.8)":"rgba(14, 14, 15, 0.8)"}(a),d=document.createElement("div");Object.assign(d.style,{backgroundColor:l,padding:"16px 18px 14px"});var u=document.createElement("div");u.textContent=(null===(e=null===(i=this.config)||void 0===i?void 0:i.config)||void 0===e?void 0:e.widget_title)||"Hi there",Object.assign(u.style,{color:a,fontSize:"16px",fontWeight:"600",lineHeight:"1.2"});var c=document.createElement("div");return c.textContent=(null===(r=null===(o=this.config)||void 0===o?void 0:o.config)||void 0===r?void 0:r.widget_subtitle)||"We typically reply in minutes",Object.assign(c.style,{color:s,fontSize:"12px",marginTop:"4px"}),d.appendChild(u),d.appendChild(c),d},t.prototype.createContent=function(){var t,n,i,e,o,r,l,a,s=document.createElement("div");Object.assign(s.style,{padding:"20px 16px 16px"});var d=document.createElement("button");Object.assign(d.style,{width:"100%",border:"none",borderRadius:"14px",backgroundColor:(null===(n=null===(t=this.config)||void 0===t?void 0:t.config)||void 0===n?void 0:n.brand_colour)||"#25D366",color:p((null===(e=null===(i=this.config)||void 0===i?void 0:i.config)||void 0===e?void 0:e.brand_colour)||"#25D366"),fontSize:"14px",fontWeight:"600",padding:"10px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",letterSpacing:"0.01em"});var u=document.createElement("img");u.src="https://cdn.robylon.ai/logos/WhatsApp.svg",u.alt="WhatsApp",Object.assign(u.style,{width:"20px",height:"20px",objectFit:"contain"});var c=document.createElement("span");if(c.textContent=(null===(r=null===(o=this.config)||void 0===o?void 0:o.config)||void 0===r?void 0:r.button_content)||"Chat on WhatsApp",d.appendChild(u),d.appendChild(c),d.onclick=this.config.onCtaClick,s.appendChild(d),null===(a=null===(l=this.config)||void 0===l?void 0:l.config)||void 0===a?void 0:a.powered_by_robylon){var f=document.createElement("div");Object.assign(f.style,{textAlign:"center",color:"rgba(14, 14, 15, 0.4)",fontSize:"10px",marginTop:"10px"}),f.appendChild(document.createTextNode("Powered by "));var v=document.createElement("a");v.href="https://www.robylon.ai",v.target="_blank",v.rel="noopener noreferrer",v.textContent="Robylon",Object.assign(v.style,{color:"inherit",textDecoration:"none"}),v.addEventListener("mouseenter",function(){v.style.textDecoration="underline",v.style.color="rgba(14, 14, 15, 0.8)"}),v.addEventListener("mouseleave",function(){v.style.textDecoration="none",v.style.color="inherit"}),f.appendChild(v),s.appendChild(f)}return s},t.prototype.render=function(){this.popupElement.innerHTML="",this.popupElement.className="rblyn-chat-widget-popup",Object.assign(this.popupElement.style,{width:"19rem",maxWidth:"calc(100vw - 19rem)",borderRadius:"22px",overflow:"hidden",backgroundColor:"#fff",boxShadow:"0 16px 40px rgba(14, 14, 15, 0.2)",marginBottom:"14px"});var t=document.createElement("style");t.textContent='\n .rblyn-chat-widget-popup,\n .rblyn-chat-widget-popup * {\n font-family: system-ui, Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif !important;\n }\n ',this.popupElement.appendChild(t),this.popupElement.appendChild(this.createTitleBar()),this.popupElement.appendChild(this.createContent())},t.prototype.getElement=function(){return this.popupElement},t.prototype.update=function(t){this.config=t,this.render()},t.prototype.destroy=function(){var t;(null===(t=this.popupElement)||void 0===t?void 0:t.parentNode)&&this.popupElement.parentNode.removeChild(this.popupElement)},t}(),Mt=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]},jt=function(){var t;if(null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands)for(var n=["Chrome","Firefox","Safari","Edge","Opera"],i=0,e=navigator.userAgentData.brands;i<e.length;i++){var o=e[i];if(n.includes(o.brand))return o.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},Ft=function(){var t,n,i,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===(n=null===document||void 0===document?void 0:document.body)||void 0===n?void 0:n.clientWidth),height:(null===window||void 0===window?void 0:window.innerHeight)||(null===(i=null===document||void 0===document?void 0:document.documentElement)||void 0===i?void 0:i.clientHeight)||(null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.clientHeight)}},Nt=function(){return{platform:"web",os:Mt(),browser:jt(),sdk_version:"1.0.1",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:Ft()};var t},Lt=function(t){var n=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 n=n.split(";").map(function(t){var n=t.split("="),i=n[0],e=n.slice(1).join("=").trim();return{name:i=i.trim(),value:e?decodeURIComponent(e):""}}),n},Ut={log:function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];console.log.apply(console,t)},error:function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];console.error.apply(console,t)},warn:function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];console.warn.apply(console,t)},info:function(){}};Ut.log("Raw API_URL:","https://api.robylon.ai");var Wt={copilotUrl:"https://chatbot.robylon.ai",environment:"production",apiUrl:"https://api.robylon.ai"};Ut.log("CONFIG",Wt);var Pt,Bt=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},Ht=function(){return{copilotUrl:Wt.copilotUrl||"https://app.robylon.ai",environment:Wt.environment||"production",apiUrl:Wt.apiUrl||"https://app.robylon.ai"}};!function(t){t.ERROR="ERROR",t.INFO="INFO"}(Pt||(Pt={}));var Xt,Yt=["@robylon/whatsapp-react-sdk","node_modules/@robylon/whatsapp-react-sdk/"],Gt=function(t){var n=t.filename,i=t.stack,e=t.message;return!!(n||i||e)&&Yt.some(function(t){return(null==n?void 0:n.includes(t))||(null==i?void 0:i.includes(t))||(null==e?void 0:e.includes(t))})},Jt=function(){function t(){var t=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(n){var i,e={filename:n.filename,stack:null===(i=n.error)||void 0===i?void 0:i.stack,message:n.message};Gt(e)&&t.trackError(n.error||n.message,"GlobalErrorHandler",{filename:n.filename,lineNo:n.lineno,colNo:n.colno})},this.handleUnhandledRejection=function(n){var i,e,o={stack:null===(i=n.reason)||void 0===i?void 0:i.stack,message:(null===(e=n.reason)||void 0===e?void 0:e.message)||n.reason+""};Gt(o)&&t.trackError(n.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:n.reason})},this.setupGlobalHandlers()}return t.prototype.setupGlobalHandlers=function(){Bt()&&(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(){Bt()&&(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,n){void 0===n&&(n=null);try{if(this.preInitQueue.length>0){var i={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:n,timestamp:Date.now()},timestamp:Date.now()},metadata:Nt(),event_type:Pt.ERROR,user_id:n};this.sendLog(i).catch(console.error)}this.apiKey=t,this.userId=n,this.isInitialized=!0,this.processPreInitQueue()}catch(i){Ut.error("Error during ErrorTrackingService initialization:",i),this.preInitQueue.push({error:i instanceof Error?i:Error(i+""),componentName:"ErrorTrackingService",additionalInfo:{apiKey:t,userId:n}})}},t.prototype.processPreInitQueue=function(){return u(this,void 0,void 0,function(){var t,n,i;return c(this,function(e){switch(e.label){case 0:if(!this.preInitQueue.length)return[2];Ut.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),t=0,n=this.preInitQueue,e.label=1;case 1:return t<n.length?(i=n[t],[4,this.trackError(i.error,i.componentName,d(d({},i.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 n,i,e,o,r,l;return c(this,function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),n=Ht().apiUrl,[4,fetch("".concat(n,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:return(i=a.sent()).ok?[3,3]:(o=(e=Ut).error,r=["Failed to send error log:"],[4,i.text()]);case 2:o.apply(e,r.concat([a.sent()])),a.label=3;case 3:return[3,5];case 4:return l=a.sent(),Ut.error("Error sending log:",l),[3,5];case 5:return[2]}})})},t.prototype.trackError=function(t,n,i){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:t instanceof Error?t.message:t,stack:t instanceof Error?t.stack:void 0,componentName:n,additionalInfo:d(d({},i),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:Nt(),event_type:Pt.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:t,componentName:n,additionalInfo:i}),Ut.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:n,additionalInfo:d(d({},i),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:o,metadata:Nt(),event_type:Pt.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return l.sent(),[2]}})})},t.prototype.trackInfo=function(t,n,i){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:n,additionalInfo:i,timestamp:Date.now()},o={org_id:this.apiKey,event_data:e,metadata:Nt(),event_type:Pt.INFO,user_id:this.userId},[4,this.sendLog(o)]):(Ut.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}})})},t}(),Vt=Jt.getInstance(),Kt="MISSING_API_KEY",Zt="SDK_INIT_FAILED",qt="ERROR_TRACKING_INIT_FAILED",Qt="API_REQUEST_FAILED",$t="NETWORK_ERROR",tn="INVALID_RESPONSE",nn="INITIALIZATION_ERROR",en=((Xt={})[Kt]=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.")},Xt.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.")},Xt.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):"")},Xt[Qt]=function(t,n,i){return"API Request Failed: Server responded with status ".concat(t," for ").concat(i?"endpoint ".concat(i):"request"," - ").concat(n)},Xt[$t]=function(t){return"Network Error: Failed to communicate with server".concat(t.url?" at ".concat(t.url):"").concat(t.error?" - ".concat(t.error):"")},Xt.IFRAME_LOAD_FAILED=function(t){return"Failed to load chatbot interface".concat(t.src?" from ".concat(t.src):"").concat(t.error?". Error: ".concat(t.error):"")},Xt[tn]=function(t){return"Invalid API Response: Missing required fields in response data: ".concat(t.join(", "))},Xt[qt]=function(t){return"Error Tracking Service initialization failed".concat(t.apiKey?" for API key ".concat(t.apiKey):"").concat(t.error?". Error: ".concat(t.error):"")},Xt[Zt]=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)):"")},Xt.COOKIE_ACCESS_ERROR=function(t,n){return"Cookie Access Error: Failed to ".concat(t).concat(n?" cookie '".concat(n,"'"):" cookies",". This may affect user session persistence.")},Xt.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):"")},Xt),on=function(){var t,n=navigator.userAgent;if(null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands){var i=navigator.userAgentData.brands.find(function(t){return"Google Chrome"===t.brand});if(null==i?void 0:i.version)return i.version}var e=n.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return e?e[2]:"Unknown"},rn=function(){var t,n,i=Nt();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===(n=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===n?void 0:n[0])||"en",browser_version:on(),os:null==i?void 0:i.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:i}},ln=function(t,n,i){return u(void 0,void 0,void 0,function(){var e,o,r,l,a,s,d,u,f,v;return c(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),e=Ht().apiUrl,Ut.log("endpointUrl",o="".concat(e,"/chat/whatsapp/get/")),r={client_user_id:n||null,org_id:t,token:i||void 0,extra_info:{},launcher_info:rn(),phone_no_id:"739739745898120"},[4,fetch(o,{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(r)})];case 1:return(l=c.sent()).ok?[3,3]:[4,l.text()];case 2:throw a=c.sent(),Error(en[Qt](l.status,a));case 3:return[4,l.json()];case 4:if(s=c.sent(),d=function(t){return function(t){var n,i,e,o,r,l,a,s;return!(!(null===(e=null===(i=null===(n=null==t?void 0:t.user)||void 0===n?void 0:n.org_info)||void 0===i?void 0:i.brand_config)||void 0===e?void 0:e.widget)||!(null===(s=null===(a=null===(l=null===(r=null===(o=null==t?void 0:t.user)||void 0===o?void 0:o.org_info)||void 0===r?void 0:r.brand_config)||void 0===l?void 0:l.profile)||void 0===a?void 0:a.qr_code)||void 0===s?void 0:s.chat_link))}(t)?function(t){var n,i,e=null===(i=null===(n=null==t?void 0:t.user)||void 0===n?void 0:n.org_info)||void 0===i?void 0:i.brand_config;return{profile:null==e?void 0:e.profile,widget:null==e?void 0:e.widget,business_profile:null==e?void 0:e.business_profile,display_name:null==e?void 0:e.display_name}}(t):t}(s),!(null===(v=null===(f=null==d?void 0:d.profile)||void 0===f?void 0:f.qr_code)||void 0===v?void 0:v.chat_link)||!(null==d?void 0:d.widget))throw Error(en[tn](["profile","widget"]));return[2,d];case 5:throw u=c.sent(),Vt.trackError(u instanceof Error?u:Error(en[$t]({error:u+""})),"fetchChatbotConfig",{errorCode:u instanceof Error&&u.message.includes("API Request Failed")?Qt:$t,errorType:"API_ERROR",context:{apiKey:t,userId:n,timestamp:Date.now()}}),u;case 6:return[2]}})})},an=function(t){return u(void 0,void 0,void 0,function(){var o,r,l,a,s,u,f,v,h,p,m,g,b,w,x,y,_,I,T,S,E,A,k,R,O,C,z,D,M,j,F,N,L;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,l=!1,r||(r=function(){var t,n="; ".concat(document.cookie).split("; rblyn_anon=");if(2===n.length)return null===(t=n.pop())||void 0===t?void 0:t.split(";").shift()}()||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=16*Math.random()|0;return("x"===t?n:3&n|8).toString(16)}),W=r,(P=new Date).setTime(P.getTime()+31536e6),document.cookie="".concat("rblyn_anon","=").concat(W,";expires=").concat(P.toUTCString(),";path=/"),l=!0),[4,ln(o.api_key,r,o.user_token)];case 1:a=c.sent();try{o.api_key}catch(t){Ut.warn("Failed to inject mock proactive messages",t)}return s=Nt(),u=rn(),U=o.user_profile,f=U?Object.fromEntries(Object.entries(U).map(function(t){var n=t[0],i=t[1];return"boolean"==typeof i||"number"==typeof i?[n,i]:[n,i+""]})):{},v=d(d(d({},s),{__INT_SYS_INFO__:d(d({},s),u)}),f),h=function(t){if("string"==typeof t)return(null==t?void 0:t.trim())||"";var n=null==t?void 0:t.url;return"string"==typeof n&&(null==n?void 0:n.trim())||""}(null===(p=null==a?void 0:a.widget)||void 0===p?void 0:p.launcher_image),[2,{chatbotId:o.api_key,userId:r,token:o.user_token,isAnonymous:l,domain:"",show_launcher:!0,brand_colour:(null===(m=null==a?void 0:a.widget)||void 0===m?void 0:m.brand_color)||"#25D366",image_url:h,userProfile:v,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(g=null==a?void 0:a.widget)||void 0===g?void 0:g.title)||(null==a?void 0:a.display_name)||"",welcome_message:(null===(b=null==a?void 0:a.widget)||void 0===b?void 0:b.subtitle)||"Hey! What can we help you with today?",redirect_url:(null===(x=null===(w=null==a?void 0:a.profile)||void 0===w?void 0:w.qr_code)||void 0===x?void 0:x.chat_link)||""},launcher_type:(null===(y=null==a?void 0:a.widget)||void 0===y?void 0:y.launcher_type)||e.IMAGE,launcher_properties:{text:(null===(_=null==a?void 0:a.widget)||void 0===_?void 0:_.launcher_text)||(null===(I=null==a?void 0:a.widget)||void 0===I?void 0:I.button_content)||""},images:{launcher_image_url:{url:h}},proactive_message_obj:void 0,interface_properties:{position:(null===(T=null==a?void 0:a.widget)||void 0===T?void 0:T.position)||i.RIGHT,side_spacing:(null===(S=null==a?void 0:a.widget)||void 0===S?void 0:S.side_spacing)||20,bottom_spacing:(null===(E=null==a?void 0:a.widget)||void 0===E?void 0:E.bottom_spacing)||20},interface_type:n.WIDGET,launcher_delay:{enabled:!1,delay:0},launcher_size_multiplier:null!==(k=null===(A=null==a?void 0:a.widget)||void 0===A?void 0:A.launcher_size_multiplier)&&void 0!==k?k:1,redirect_chat_link:(null===(O=null===(R=null==a?void 0:a.profile)||void 0===R?void 0:R.qr_code)||void 0===O?void 0:O.chat_link)||"",pre_filled_message:(null===(z=null===(C=null==a?void 0:a.profile)||void 0===C?void 0:C.qr_code)||void 0===z?void 0:z.pre_filled_message)||"",widget_type:(null===(D=null==a?void 0:a.widget)||void 0===D?void 0:D.widget_type)||"quick_launch",widget_title:(null===(M=null==a?void 0:a.widget)||void 0===M?void 0:M.title)||"",widget_subtitle:(null===(j=null==a?void 0:a.widget)||void 0===j?void 0:j.subtitle)||"",title_bar_color:(null===(F=null==a?void 0:a.widget)||void 0===F?void 0:F.title_bar_color)||"#075E54",button_content:(null===(N=null==a?void 0:a.widget)||void 0===N?void 0:N.button_content)||"Chat on WhatsApp",powered_by_robylon:!1!==(null===(L=null==a?void 0:a.widget)||void 0===L?void 0:L.powered_by_robylon)}]}var U,W,P})})},sn="https://cdn.robylon.ai/logos/WhatsApp.svg",dn=function(){function t(t){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.config=t,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return t.prototype.onCloseListener=function(t){t.origin===this.config.domain&&"closeChatbot"===t.data&&this.closeIframe()},t.prototype.validateDomain=function(){var t,n=this.config.domain,i=null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.origin;return Ut.log("expectedDomain, to current domain",n,i,n===i),n===i},t.prototype.createChatBubblContainer=function(){var t,n=this,i=document.createElement("div");i.id="chatbase-message-bubbles",Object.assign(i.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=n.createMessageBubble(t);i.appendChild(e)}),i.appendChild(e),document.body.appendChild(i)},t.prototype.createMessageBubble=function(t){var n=document.createElement("div");this.bubblePromptContainer=n,Object.assign(n.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var i=document.createElement("div");i.classList.add("message"),i.textContent=t,Object.assign(i.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(){n.remove()}),n.appendChild(e),n.appendChild(i),n},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:p(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 n,i,e,o,r,l,a,s,d,u=document.createElement("img"),c=null!==(i=null===(n=this.config)||void 0===n?void 0:n.launcher_size_multiplier)&&void 0!==i?i:1,f="".concat(Math.max(4,Math.round(4*c)),"px"),v=(null===(e=this.config)||void 0===e?void 0:e.launcher_type)?(null===(a=null===(l=null===(r=null===(o=this.config)||void 0===o?void 0:o.images)||void 0===r?void 0:r.launcher_image_url)||void 0===l?void 0:l.url)||void 0===a?void 0:a.trim())||sn:(null===(d=null===(s=this.config)||void 0===s?void 0:s.image_url)||void 0===d?void 0:d.trim())||sn,h=v===sn;u.src=v,u.alt="Chat",Object.assign(u.style,{zIndex:"1000",cursor:"pointer",borderRadius:h?"0":"50%",objectFit:h?"contain":"cover",padding:h?f:"0",boxSizing:"border-box",width:h?"calc(100% - 3px)":"100%",height:h?"calc(100% - 3px)":"100%",margin:h?"4px":"0"}),this.chatBtnImage=u,t.innerHTML="",t.appendChild(u)},t.prototype.createIframe=function(){var t=this;Ut.log("RobylonConfig?.domain====>",this.config.domain);var n=document.createElement("iframe");Object.assign(n.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"}),n.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),Ut.log("iframe.src====>",n.src),document.body.appendChild(n),this.iframe=n;var i=function(){560>(null===window||void 0===window?void 0:window.innerWidth)?Object.assign(n.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(n.style,{width:"26%",minWidth:"400px",right:"32px",bottom:"86px",height:"calc(100vh - 3rem - 10vh)",borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"45rem"})};i(),null===window||void 0===window||window.addEventListener("resize",i),n.addEventListener("load",function(){var i,e,o,r,l;if(t.iframe){var a=new URL(t.iframe.src).origin||t.config.domain;null===(i=n.contentWindow)||void 0===i||i.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=n.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===(l=t.config.userProfile)||void 0===l?void 0:l.__INT_SYS_INFO__)||{}),rn())})}},a)}}),null===window||void 0===window||window.addEventListener("message",function(i){var e,o;if(i.origin===t.config.domain){if("captureSessionData"===i.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===t.config.chatbotId,l={cookies:Lt(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=n.contentWindow)||void 0===o||o.postMessage(l,t.config.domain||"*")}"expand"===i.data&&(t.adjustIframeWidth(),n.style.height="calc(100vh - 120px)",n.style.bottom="86px"),"collapse"===i.data&&Object.assign(n.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;Ut.log("screenWidth",t),this.iframe.style.width=832>t?"".concat(t-64,"px"):"800px"}},t.prototype.loadSvgInline=function(t){var n=document.createElement("div");n.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 i=n.querySelector("svg");t.innerHTML="",i&&t.appendChild(i)},t.prototype.toggleIcon=function(t,n){"block"===n.style.display?this.loadSvgInline(t):this.loadImage(t)},t.prototype.toggleIframe=function(){var t,n;if(Ut.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;Ut.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":(null===(n=this.chatBtnImage)||void 0===n?void 0:n.src)===sn?"contain":"cover",this.bubblePromptContainer&&(this.bubblePromptContainer.style.display="none"),Ut.log("this.bubblePromptContainer",this.bubblePromptContainer)}},t.prototype.closeIframe=function(){var t;this.iframe&&this.logoContainer&&this.chatBtnImage&&(this.iframe.style.display="none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit=(null===(t=this.chatBtnImage)||void 0===t?void 0:t.src)===sn?"contain":"cover")},t.prototype.init=function(){this.createIframe(),this.createFloatingButton()},t}(),un=function(t){var n={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},i=[],e=function(t){n=d(d({},n),t),i.forEach(function(t){return t(n)})};return{getState:function(){return n},initialize:function(){return u(void 0,void 0,void 0,function(){var n,i,o;return c(this,function(r){switch(r.label){case 0:if(!t.api_key)return Vt.trackError(Error(en[Kt](t.api_key)),"ChatbotStateManager",{errorCode:Kt,errorType:nn,context:{timestamp:Date.now()}}),[2];e({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,an(t)];case 2:return n=r.sent(),[4,new Promise(function(t,i){!function(i,o,r){if(i.chatbotId&&i.userId)try{new dn(i),e({isInitialized:!0,chatbotConfig:n}),t(),Ut.log("Robylon SDK initialized successfully.")}catch(t){r(t instanceof Error?t.message:"Failed to initialize SDK")}else r("Incomplete configuration for SDK initialization.")}(n,0,function(t){i(t)})})];case 3:return r.sent(),[3,6];case 4:return i=r.sent(),o=i instanceof Error?i.message:"Failed to initialize chatbot",e({error:o}),Vt.trackError(i instanceof Error?i:Error(o),"ChatbotStateManager",{errorCode:Zt,errorType:nn,context:{timestamp:Date.now()}}),[3,6];case 5:return e({isInitializing:!1}),[7];case 6:return[2]}})})},toggleIframeVisibility:function(){e({isIframeVisible:!n.isIframeVisible})},closeIframe:function(){e({isIframeVisible:!1})},updateState:e,subscribe:function(t){return i.push(t),function(){var n=i.indexOf(t);n>-1&&i.splice(n,1)}},unsubscribe:function(t){var n=i.indexOf(t);n>-1&&i.splice(n,1)}}},cn=function(t){t.api_key,t.user_profile;var n=t.onEvent;return t.chatbotConfig,{emit:function(t,i){var e={type:t,timestamp:Date.now(),data:i};null==n||n(e)},onInternalEvent:function(t,n){}}},fn=function(){function t(t){var n=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.popup=null,this.isDestroyed=!1,this.handleStateChange=function(t){var i,e,o,r,l,a,s,d;if(!n.isDestroyed){var u=t.isInitialized,c=t.error,f=t.chatbotConfig,v=t.isIframeVisible,h="chat_widget"===(null==f?void 0:f.widget_type);if(!c&&f&&u){n.eventEmitter=cn({api_key:n.config.api_key,user_profile:n.config.user_profile,onEvent:n.config.onEvent,chatbotConfig:{isAnonymous:f.isAnonymous,userId:f.userId}}),n.container||(n.container=new zt(f,n.config.position,n.config.sideSpacing,n.config.bottomSpacing)),h&&v?n.popup?n.popup.update({config:f,onCtaClick:n.handlePopupCta}):(n.popup=new Dt({config:f,onCtaClick:n.handlePopupCta}),null===(e=null===(i=n.container)||void 0===i?void 0:i.getElement())||void 0===e||e.prepend(n.popup.getElement())):n.popup&&(n.popup.destroy(),n.popup=null);var p=void 0!==n.config.show_launcher?!!n.config.show_launcher:null===(o=null==f?void 0:f.show_launcher)||void 0===o||o,m=!0===(null===(r=null==f?void 0:f.launcher_delay)||void 0===r?void 0:r.enabled),g=null!==(d=null!==(a=null===(l=null==f?void 0:f.launcher_delay)||void 0===l?void 0:l.seconds)&&void 0!==a?a:null===(s=null==f?void 0:f.launcher_delay)||void 0===s?void 0:s.delay)&&void 0!==d?d:0,b=function(){if(n.floatingButton)n.floatingButton.update({config:f,isIframeVisible:v,position:n.config.position,sideSpacing:n.config.sideSpacing,bottomSpacing:n.config.bottomSpacing,launcher_size:n.config.launcher_size});else if(n.floatingButton=new Ct({config:f,toggleIframe:n.toggleIframe,isIframeVisible:v,onEvent:n.config.onEvent,onInternalEvent:n.eventEmitter.onInternalEvent,position:n.config.position,sideSpacing:n.config.sideSpacing,bottomSpacing:n.config.bottomSpacing,launcher_size:n.config.launcher_size}),n.floatingButton.getElement&&"function"==typeof n.floatingButton.getElement){var t=n.floatingButton.getElement();t&&n.container&&n.container.getElement().appendChild(t)}};n.launcherDelayTimeout&&(clearTimeout(n.launcherDelayTimeout),n.launcherDelayTimeout=null),p?m&&+g>0&&!n.floatingButton?n.launcherDelayTimeout=window.setTimeout(function(){b(),n.launcherDelayTimeout=null},1e3*+g):b():n.floatingButton&&(n.floatingButton.destroy(),n.floatingButton=null)}}},this.toggleIframe=function(){var t,i,e=n.stateManager.getState(),o=null===(t=null==e?void 0:e.chatbotConfig)||void 0===t?void 0:t.redirect_chat_link;"chat_widget"===(null===(i=null==e?void 0:e.chatbotConfig)||void 0===i?void 0:i.widget_type)?(n.stateManager.toggleIframeVisibility(),n.eventEmitter.emit(e.isIframeVisible?v.CHATBOT_CLOSED:v.CHATBOT_BUTTON_CLICKED)):o&&(window.open(o,"_blank","noopener,noreferrer"),n.eventEmitter.emit(v.CHATBOT_BUTTON_CLICKED))},this.handlePopupCta=function(){var t,i=n.stateManager.getState(),e=null===(t=null==i?void 0:i.chatbotConfig)||void 0===t?void 0:t.redirect_chat_link;e&&(window.open(e,"_blank","noopener,noreferrer"),n.eventEmitter.emit(v.CHATBOT_BUTTON_CLICKED)),n.stateManager.closeIframe()};var i=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=i,!t.api_key)throw Vt.trackError(Error(en[Kt](t.api_key)),"RobylonChatbot",{errorCode:Kt,errorType:nn,context:{timestamp:Date.now()}}),Error("API key is required");try{Vt.initialize(t.api_key,t.user_id)}catch(t){Vt.trackError(t instanceof Error?t:Error(t+""),"RobylonChatbot",{errorCode:qt,errorType:nn,context:{timestamp:Date.now()}})}this.stateManager=un({api_key:t.api_key,user_id:t.user_id,user_token:t.user_token,user_profile:t.user_profile}),this.eventEmitter=cn({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(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return n.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return t=n.sent(),Vt.trackError(t instanceof Error?t:Error(t+""),"RobylonChatbot.initialize",{errorCode:Zt,errorType:nn,context:{timestamp:Date.now()}}),[3,3];case 3:return[2]}})})},t.prototype.show=function(){var t,n,i=this.stateManager.getState();if("chat_widget"===(null===(t=null==i?void 0:i.chatbotConfig)||void 0===t?void 0:t.widget_type))i.isIframeVisible||(this.stateManager.toggleIframeVisibility(),this.eventEmitter.emit(v.CHATBOT_BUTTON_CLICKED));else{var e=null===(n=null==i?void 0:i.chatbotConfig)||void 0===n?void 0:n.redirect_chat_link;e&&(window.open(e,"_blank","noopener,noreferrer"),this.eventEmitter.emit(v.CHATBOT_BUTTON_CLICKED))}},t.prototype.hide=function(){var t,n=this.stateManager.getState();"chat_widget"===(null===(t=null==n?void 0:n.chatbotConfig)||void 0===t?void 0:t.widget_type)&&n.isIframeVisible&&(this.stateManager.closeIframe(),this.eventEmitter.emit(v.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.popup&&(this.popup.destroy(),this.popup=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 vn(t){return new fn(t)}if("undefined"!=typeof window){!function(){if("undefined"!=typeof window){var t=window,n=(null==t?void 0:t.RobylonChatbot)||(null==t?void 0:t.R);if(n&&Array.isArray(n.q)){var i=null;n.q.forEach(function(t){var n=t[0];if("init"===n){var e=t[1]||{};i=vn(e)}else i&&"function"==typeof i[n]&&i[n]()}),t.RobylonChatbot=function(t){var n=[].slice.call(arguments,1);return"init"===t?i=vn(n[0]||{}):i&&"function"==typeof i[t]?i[t].apply(i,n):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 hn=window,pn=null==hn?void 0:hn.RobylonChatbot;pn&&!(null==hn?void 0:hn.R)&&(hn.R=pn)}var mn={create:vn,getState:function(){return"initialized"}};t.create=vn,t.default=mn,Object.defineProperty(t,"i",{value:!0})});
1
+ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).RobylonChatbot={})}(this,function(t){"use strict";var n,i,e,o,r,l,a,s,d=function(){return d=Object.assign||function(t){for(var n,i=1,e=arguments.length;e>i;i++)for(var o in n=arguments[i])({}).hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},d.apply(this,arguments)};function u(t,n,i,e){return new(i||(i=Promise))(function(o,r){function l(t){try{s(e.next(t))}catch(t){r(t)}}function a(t){try{s(e.throw(t))}catch(t){r(t)}}function s(t){var n;t.done?o(t.value):(n=t.value,n instanceof i?n:new i(function(t){t(n)})).then(l,a)}s((e=e.apply(t,n||[])).next())})}function c(t,n){var i,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(i)throw new TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(r=0)),r;)try{if(i=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=n.call(t,r)}catch(t){a=[6,t],e=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function f(t,n,i){if(i||2===arguments.length)for(var e,o=0,r=n.length;r>o;o++)!e&&o in n||(e||(e=[].slice.call(n,0,o)),e[o]=n[o]);return t.concat(e||[].slice.call(n))}"function"==typeof SuppressedError&&SuppressedError,function(t){t.WIDGET="WIDGET",t.POPOVER="POPOVER",t.EMBED="EMBED"}(n||(n={})),function(t){t.RIGHT="Right",t.LEFT="Left"}(i||(i={})),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"}(l||(l={})),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"}(a||(a={})),function(t){t.BUTTON="BUTTON",t.TEXT="TEXT"}(s||(s={}));var v,h,p=function(t,n){void 0===n&&(n=.5);var i,e,o,r,l=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(t,n,i,e){return n+n+i+i+e+e});var n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:{r:0,g:0,b:0}}(t);return(i=l.r,e=l.g,o=l.b,.2126*(r=[i,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])>n?"#0E0E0F":"#FFFFFF"};!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"}(v||(v={})),function(t){t.CHAT_MOVED="CHAT_MOVED",t.CHATBOT_TOKEN_EXHAUSTED="CHATBOT_TOKEN_EXHAUSTED"}(h||(h={}));var m,g="system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",b="21px",w="",x=[],y=!1,_=function(){return"undefined"==typeof window?"":window.location.href},I=function(){return _()},T=function(){var t=_();t!==w&&(w=t,x.forEach(function(n){return n(t)}))},S=function(t,n,i,e){var o=n||"",r=_(),l=e||r,s=function(t,n){return-1!==n.indexOf(t)}(o,l);switch(i){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}},E=null,A=function(){return E===I()},k=function(){return!0},R=((m={})[o.WORKING_HOURS]=function(t,n){var i=n.getHours(),e=n.getMinutes();return(i>10||10===i&&e>=0)&&(19>i||19===i&&0===e)},m[o.ALWAYS]=k,m);const{entries:O,setPrototypeOf:C,isFrozen:z,getPrototypeOf:D,getOwnPropertyDescriptor:M}=Object;let{freeze:j,seal:F,create:N}=Object,{apply:L,construct:U}="undefined"!=typeof Reflect&&Reflect;j||(j=function(t){return t}),F||(F=function(t){return t}),L||(L=function(t,n){for(var i=arguments.length,e=Array(i>2?i-2:0),o=2;i>o;o++)e[o-2]=arguments[o];return t.apply(n,e)}),U||(U=function(t){for(var n=arguments.length,i=Array(n>1?n-1:0),e=1;n>e;e++)i[e-1]=arguments[e];return new t(...i)});const W=nt([].forEach),P=nt([].lastIndexOf),B=nt([].pop),H=nt([].push),X=nt([].splice),Y=nt("".toLowerCase),G=nt("".toString),J=nt("".match),V=nt("".replace),K=nt("".indexOf),Z=nt("".trim),q=nt({}.hasOwnProperty),Q=nt(/t/.test),$=(tt=TypeError,function(){for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return U(tt,n)});var tt;function nt(t){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var i=arguments.length,e=Array(i>1?i-1:0),o=1;i>o;o++)e[o-1]=arguments[o];return L(t,n,e)}}function it(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Y;C&&C(t,null);let e=n.length;for(;e--;){let o=n[e];if("string"==typeof o){const t=i(o);t!==o&&(z(n)||(n[e]=t),o=t)}t[o]=!0}return t}function et(t){for(let n=0;n<t.length;n++)q(t,n)||(t[n]=null);return t}function ot(t){const n=N(null);for(const[i,e]of O(t))q(t,i)&&(Array.isArray(e)?n[i]=et(e):e&&"object"==typeof e&&e.constructor===Object?n[i]=ot(e):n[i]=e);return n}function rt(t,n){for(;null!==t;){const i=M(t,n);if(i){if(i.get)return nt(i.get);if("function"==typeof i.value)return nt(i.value)}t=D(t)}return function(){return null}}const lt=j(["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"]),at=j(["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"]),st=j(["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"]),dt=j(["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"]),ut=j(["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"]),ct=j(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ft=j(["#text"]),vt=j(["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"]),ht=j(["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"]),pt=j(["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"]),mt=j(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),gt=F(/\{\{[\w\W]*|[\w\W]*\}\}/gm),bt=F(/<%[\w\W]*|[\w\W]*%>/gm),wt=F(/\$\{[\w\W]*/gm),xt=F(/^data-[\-\w.\u00B7-\uFFFF]+$/),yt=F(/^aria-[\-\w]+$/),_t=F(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),It=F(/^(?:\w+script|data):/i),Tt=F(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),St=F(/^html$/i),Et=F(/^[a-z][.\w]*(-[.\w]+)+$/i);var At=Object.freeze({__proto__:null,ARIA_ATTR:yt,ATTR_WHITESPACE:Tt,CUSTOM_ELEMENT:Et,DATA_ATTR:xt,DOCTYPE_NAME:St,ERB_EXPR:bt,IS_ALLOWED_URI:_t,IS_SCRIPT_OR_DATA:It,MUSTACHE_EXPR:gt,TMPLIT_EXPR:wt});const kt=function(){return"undefined"==typeof window?null:window};var Rt=function t(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:kt();const i=n=>t(n);if(i.version="3.3.3",i.removed=[],!n||!n.document||9!==n.document.nodeType||!n.Element)return i.isSupported=!1,i;let{document:e}=n;const o=e,r=o.currentScript,{DocumentFragment:l,HTMLTemplateElement:a,Node:s,Element:d,NodeFilter:u,NamedNodeMap:c=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:f,DOMParser:v,trustedTypes:h}=n,p=d.prototype,m=rt(p,"cloneNode"),g=rt(p,"remove"),b=rt(p,"nextSibling"),w=rt(p,"childNodes"),x=rt(p,"parentNode");if("function"==typeof a){const t=e.createElement("template");t.content&&t.content.ownerDocument&&(e=t.content.ownerDocument)}let y,_="";const{implementation:I,createNodeIterator:T,createDocumentFragment:S,getElementsByTagName:E}=e,{importNode:A}=o;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof O&&"function"==typeof x&&I&&void 0!==I.createHTMLDocument;const{MUSTACHE_EXPR:R,ERB_EXPR:C,TMPLIT_EXPR:z,DATA_ATTR:D,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:U}=At;let{IS_ALLOWED_URI:tt}=At,nt=null;const et=it({},[...lt,...at,...st,...ut,...ft]);let gt=null;const bt=it({},[...vt,...ht,...pt,...mt]);let wt=Object.seal(N(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}})),xt=null,yt=null;const It=Object.seal(N(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Tt=!0,Et=!0,Rt=!1,Ot=!0,Ct=!1,zt=!0,Dt=!1,Mt=!1,jt=!1,Ft=!1,Nt=!1,Lt=!1,Ut=!0,Wt=!1,Pt=!0,Bt=!1,Ht={},Xt=null;const Yt=it({},["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=it({},["audio","video","img","source","image","track"]);let Vt=null;const Kt=it({},["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,tn=!1,nn=null;const en=it({},[Zt,qt,Qt],G);let on=it({},["mi","mo","mn","ms","mtext"]),rn=it({},["annotation-xml"]);const ln=it({},["title","style","font","a","script"]);let an=null;const sn=["application/xhtml+xml","text/html"];let dn=null,un=null;const cn=e.createElement("form"),fn=function(t){return t instanceof RegExp||t instanceof Function},vn=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!un||un!==t){if(t&&"object"==typeof t||(t={}),t=ot(t),an=-1===sn.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,dn="application/xhtml+xml"===an?G:Y,nt=q(t,"ALLOWED_TAGS")?it({},t.ALLOWED_TAGS,dn):et,gt=q(t,"ALLOWED_ATTR")?it({},t.ALLOWED_ATTR,dn):bt,nn=q(t,"ALLOWED_NAMESPACES")?it({},t.ALLOWED_NAMESPACES,G):en,Vt=q(t,"ADD_URI_SAFE_ATTR")?it(ot(Kt),t.ADD_URI_SAFE_ATTR,dn):Kt,Gt=q(t,"ADD_DATA_URI_TAGS")?it(ot(Jt),t.ADD_DATA_URI_TAGS,dn):Jt,Xt=q(t,"FORBID_CONTENTS")?it({},t.FORBID_CONTENTS,dn):Yt,xt=q(t,"FORBID_TAGS")?it({},t.FORBID_TAGS,dn):ot({}),yt=q(t,"FORBID_ATTR")?it({},t.FORBID_ATTR,dn):ot({}),Ht=!!q(t,"USE_PROFILES")&&t.USE_PROFILES,Tt=!1!==t.ALLOW_ARIA_ATTR,Et=!1!==t.ALLOW_DATA_ATTR,Rt=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Ot=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Ct=t.SAFE_FOR_TEMPLATES||!1,zt=!1!==t.SAFE_FOR_XML,Dt=t.WHOLE_DOCUMENT||!1,Ft=t.RETURN_DOM||!1,Nt=t.RETURN_DOM_FRAGMENT||!1,Lt=t.RETURN_TRUSTED_TYPE||!1,jt=t.FORCE_BODY||!1,Ut=!1!==t.SANITIZE_DOM,Wt=t.SANITIZE_NAMED_PROPS||!1,Pt=!1!==t.KEEP_CONTENT,Bt=t.IN_PLACE||!1,tt=t.ALLOWED_URI_REGEXP||_t,$t=t.NAMESPACE||Qt,on=t.MATHML_TEXT_INTEGRATION_POINTS||on,rn=t.HTML_INTEGRATION_POINTS||rn,wt=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&fn(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(wt.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&fn(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(wt.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(wt.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ct&&(Et=!1),Nt&&(Ft=!0),Ht&&(nt=it({},ft),gt=N(null),!0===Ht.html&&(it(nt,lt),it(gt,vt)),!0===Ht.svg&&(it(nt,at),it(gt,ht),it(gt,mt)),!0===Ht.svgFilters&&(it(nt,st),it(gt,ht),it(gt,mt)),!0===Ht.mathMl&&(it(nt,ut),it(gt,pt),it(gt,mt))),q(t,"ADD_TAGS")||(It.tagCheck=null),q(t,"ADD_ATTR")||(It.attributeCheck=null),t.ADD_TAGS&&("function"==typeof t.ADD_TAGS?It.tagCheck=t.ADD_TAGS:(nt===et&&(nt=ot(nt)),it(nt,t.ADD_TAGS,dn))),t.ADD_ATTR&&("function"==typeof t.ADD_ATTR?It.attributeCheck=t.ADD_ATTR:(gt===bt&&(gt=ot(gt)),it(gt,t.ADD_ATTR,dn))),t.ADD_URI_SAFE_ATTR&&it(Vt,t.ADD_URI_SAFE_ATTR,dn),t.FORBID_CONTENTS&&(Xt===Yt&&(Xt=ot(Xt)),it(Xt,t.FORBID_CONTENTS,dn)),t.ADD_FORBID_CONTENTS&&(Xt===Yt&&(Xt=ot(Xt)),it(Xt,t.ADD_FORBID_CONTENTS,dn)),Pt&&(nt["#text"]=!0),Dt&&it(nt,["html","head","body"]),nt.table&&(it(nt,["tbody"]),delete xt.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw $('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw $('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=t.TRUSTED_TYPES_POLICY,_=y.createHTML("")}else void 0===y&&(y=function(t,n){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let i=null;const e="data-tt-policy-suffix";n&&n.hasAttribute(e)&&(i=n.getAttribute(e));const o="dompurify"+(i?"#"+i:"");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!==y&&"string"==typeof _&&(_=y.createHTML(""));j&&j(t),un=t}},hn=it({},[...at,...st,...dt]),pn=it({},[...ut,...ct]),mn=function(t){H(i.removed,{element:t});try{x(t).removeChild(t)}catch(n){g(t)}},gn=function(t,n){try{H(i.removed,{attribute:n.getAttributeNode(t),from:n})}catch(t){H(i.removed,{attribute:null,from:n})}if(n.removeAttribute(t),"is"===t)if(Ft||Nt)try{mn(n)}catch(t){}else try{n.setAttribute(t,"")}catch(t){}},bn=function(t){let n=null,i=null;if(jt)t="<remove></remove>"+t;else{const n=J(t,/^[\r\n\t ]+/);i=n&&n[0]}"application/xhtml+xml"===an&&$t===Qt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const o=y?y.createHTML(t):t;if($t===Qt)try{n=(new v).parseFromString(o,an)}catch(t){}if(!n||!n.documentElement){n=I.createDocument($t,"template",null);try{n.documentElement.innerHTML=tn?_:o}catch(t){}}const r=n.body||n.documentElement;return t&&i&&r.insertBefore(e.createTextNode(i),r.childNodes[0]||null),$t===Qt?E.call(n,Dt?"html":"body")[0]:Dt?n.documentElement:r},wn=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)},xn=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)},yn=function(t){return"function"==typeof s&&t instanceof s};function _n(t,n,e){W(t,t=>{t.call(i,n,e,un)})}const In=function(t){let n=null;if(_n(k.beforeSanitizeElements,t,null),xn(t))return mn(t),!0;const e=dn(t.nodeName);if(_n(k.uponSanitizeElement,t,{tagName:e,allowedTags:nt}),zt&&t.hasChildNodes()&&!yn(t.firstElementChild)&&Q(/<[/\w!]/g,t.innerHTML)&&Q(/<[/\w!]/g,t.textContent))return mn(t),!0;if(7===t.nodeType)return mn(t),!0;if(zt&&8===t.nodeType&&Q(/<[/\w]/g,t.data))return mn(t),!0;if(!(It.tagCheck instanceof Function&&It.tagCheck(e))&&(!nt[e]||xt[e])){if(!xt[e]&&Sn(e)){if(wt.tagNameCheck instanceof RegExp&&Q(wt.tagNameCheck,e))return!1;if(wt.tagNameCheck instanceof Function&&wt.tagNameCheck(e))return!1}if(Pt&&!Xt[e]){const n=x(t)||t.parentNode,i=w(t)||t.childNodes;if(i&&n)for(let e=i.length-1;e>=0;--e){const o=m(i[e],!0);o.t=(t.t||0)+1,n.insertBefore(o,b(t))}}return mn(t),!0}return t instanceof d&&!function(t){let n=x(t);n&&n.tagName||(n={namespaceURI:$t,tagName:"template"});const i=Y(t.tagName),e=Y(n.tagName);return!!nn[t.namespaceURI]&&(t.namespaceURI===qt?n.namespaceURI===Qt?"svg"===i:n.namespaceURI===Zt?"svg"===i&&("annotation-xml"===e||on[e]):!!hn[i]:t.namespaceURI===Zt?n.namespaceURI===Qt?"math"===i:n.namespaceURI===qt?"math"===i&&rn[e]:!!pn[i]:t.namespaceURI===Qt?!(n.namespaceURI===qt&&!rn[e])&&!(n.namespaceURI===Zt&&!on[e])&&!pn[i]&&(ln[i]||!hn[i]):!("application/xhtml+xml"!==an||!nn[t.namespaceURI]))}(t)?(mn(t),!0):"noscript"!==e&&"noembed"!==e&&"noframes"!==e||!Q(/<\/no(script|embed|frames)/i,t.innerHTML)?(Ct&&3===t.nodeType&&(n=t.textContent,W([R,C,z],t=>{n=V(n,t," ")}),t.textContent!==n&&(H(i.removed,{element:t.cloneNode()}),t.textContent=n)),_n(k.afterSanitizeElements,t,null),!1):(mn(t),!0)},Tn=function(t,n,i){if(yt[n])return!1;if(Ut&&("id"===n||"name"===n)&&(i in e||i in cn))return!1;if(Et&&!yt[n]&&Q(D,n));else if(Tt&&Q(M,n));else if(It.attributeCheck instanceof Function&&It.attributeCheck(n,t));else if(!gt[n]||yt[n]){if(!(Sn(t)&&(wt.tagNameCheck instanceof RegExp&&Q(wt.tagNameCheck,t)||wt.tagNameCheck instanceof Function&&wt.tagNameCheck(t))&&(wt.attributeNameCheck instanceof RegExp&&Q(wt.attributeNameCheck,n)||wt.attributeNameCheck instanceof Function&&wt.attributeNameCheck(n,t))||"is"===n&&wt.allowCustomizedBuiltInElements&&(wt.tagNameCheck instanceof RegExp&&Q(wt.tagNameCheck,i)||wt.tagNameCheck instanceof Function&&wt.tagNameCheck(i))))return!1}else if(Vt[n]);else if(Q(tt,V(i,L,"")));else if("src"!==n&&"xlink:href"!==n&&"href"!==n||"script"===t||0!==K(i,"data:")||!Gt[t])if(Rt&&!Q(F,V(i,L,"")));else if(i)return!1;return!0},Sn=function(t){return"annotation-xml"!==t&&J(t,U)},En=function(t){_n(k.beforeSanitizeAttributes,t,null);const{attributes:n}=t;if(!n||xn(t))return;const e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:gt,forceKeepAttr:void 0};let o=n.length;for(;o--;){const r=n[o],{name:l,namespaceURI:a,value:s}=r,d=dn(l),u=s;let c="value"===l?u:Z(u);if(e.attrName=d,e.attrValue=c,e.keepAttr=!0,e.forceKeepAttr=void 0,_n(k.uponSanitizeAttribute,t,e),c=e.attrValue,!Wt||"id"!==d&&"name"!==d||(gn(l,t),c="user-content-"+c),zt&&Q(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,c)){gn(l,t);continue}if("attributename"===d&&J(c,"href")){gn(l,t);continue}if(e.forceKeepAttr)continue;if(!e.keepAttr){gn(l,t);continue}if(!Ot&&Q(/\/>/i,c)){gn(l,t);continue}Ct&&W([R,C,z],t=>{c=V(c,t," ")});const f=dn(t.nodeName);if(Tn(f,d,c)){if(y&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(a);else switch(h.getAttributeType(f,d)){case"TrustedHTML":c=y.createHTML(c);break;case"TrustedScriptURL":c=y.createScriptURL(c)}if(c!==u)try{a?t.setAttributeNS(a,l,c):t.setAttribute(l,c),xn(t)?mn(t):B(i.removed)}catch(n){gn(l,t)}}else gn(l,t)}_n(k.afterSanitizeAttributes,t,null)},An=function t(n){let i=null;const e=wn(n);for(_n(k.beforeSanitizeShadowDOM,n,null);i=e.nextNode();)_n(k.uponSanitizeShadowNode,i,null),In(i),En(i),i.content instanceof l&&t(i.content);_n(k.afterSanitizeShadowDOM,n,null)};return i.sanitize=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=null,r=null,a=null,d=null;if(tn=!t,tn&&(t="\x3c!--\x3e"),"string"!=typeof t&&!yn(t)){if("function"!=typeof t.toString)throw $("toString is not a function");if("string"!=typeof(t=t.toString()))throw $("dirty is not a string, aborting")}if(!i.isSupported)return t;if(Mt||vn(n),i.removed=[],"string"==typeof t&&(Bt=!1),Bt){if(t.nodeName){const n=dn(t.nodeName);if(!nt[n]||xt[n])throw $("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof s)e=bn("\x3c!----\x3e"),r=e.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?e=r:e.appendChild(r);else{if(!Ft&&!Ct&&!Dt&&-1===t.indexOf("<"))return y&&Lt?y.createHTML(t):t;if(e=bn(t),!e)return Ft?null:Lt?_:""}e&&jt&&mn(e.firstChild);const u=wn(Bt?t:e);for(;a=u.nextNode();)In(a),En(a),a.content instanceof l&&An(a.content);if(Bt)return t;if(Ft){if(Nt)for(d=S.call(e.ownerDocument);e.firstChild;)d.appendChild(e.firstChild);else d=e;return(gt.shadowroot||gt.shadowrootmode)&&(d=A.call(o,d,!0)),d}let c=Dt?e.outerHTML:e.innerHTML;return Dt&&nt["!doctype"]&&e.ownerDocument&&e.ownerDocument.doctype&&e.ownerDocument.doctype.name&&Q(St,e.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+e.ownerDocument.doctype.name+">\n"+c),Ct&&W([R,C,z],t=>{c=V(c,t," ")}),y&&Lt?y.createHTML(c):c},i.setConfig=function(){vn(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Mt=!0},i.clearConfig=function(){un=null,Mt=!1},i.isValidAttribute=function(t,n,i){un||vn({});const e=dn(t),o=dn(n);return Tn(e,o,i)},i.addHook=function(t,n){"function"==typeof n&&H(k[t],n)},i.removeHook=function(t,n){if(void 0!==n){const i=P(k[t],n);return-1===i?void 0:X(k[t],i,1)[0]}return B(k[t])},i.removeHooks=function(t){k[t]=[]},i.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},i}(),Ot="https://cdn.robylon.ai/logos/WhatsApp.svg",Ct=function(){function t(t){var n,i=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(){i.buttonElement.style.opacity="1"})}catch(t){}this.setupResizeListener(),this.renderProactiveIfNeeded(),this.urlUnsubscribe=(n=function(){i.clearProactiveDelays(),i.renderProactiveIfNeeded(!0)},y||function(){if(!y&&"undefined"!=typeof window){y=!0,w=_();var t=function(t){var n=history[t];return function(){for(var t=[],i=0;arguments.length>i;i++)t[i]=arguments[i];var e=n.apply(this,t);return setTimeout(T,0),e}};try{history.pushState=t("pushState"),history.replaceState=t("replaceState")}catch(t){}window.addEventListener("popstate",T),window.addEventListener("hashchange",T);var n=setInterval(function(){T()},1e3);setInterval(function(){0===x.length&&(clearInterval(n),window.removeEventListener("popstate",T),window.removeEventListener("hashchange",T),y=!1)},5e3)}}(),x.push(n),n(_()),function(){var t=x.indexOf(n);t>-1&&x.splice(t,1)})}return t.prototype.render=function(){var t,n,i=this,o=this.config,r=o.config,l=o.isIframeVisible,a=null!==(t=null==r?void 0:r.launcher_size_multiplier)&&void 0!==t?t:1,s=null!==(n=this.config.launcher_size)&&void 0!==n?n: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:g};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(){i.config.toggleIframe(),i.hideProactiveMessages()},this.renderProactiveIfNeeded()},t.prototype.createLauncherElement=function(){var t,n,i,o,r,l,a=this.config,s=a.config,d=a.isIframeVisible,u=null!==(t=null==s?void 0:s.launcher_size_multiplier)&&void 0!==t?t:1,c=null!==(n=this.config.launcher_size)&&void 0!==n?n:48*u,f="".concat(Math.max(4,Math.round(4*u)),"px"),v=(null==s?void 0:s.launcher_type)?(null===(r=null===(o=null===(i=null==s?void 0:s.images)||void 0===i?void 0:i.launcher_image_url)||void 0===o?void 0:o.url)||void 0===r?void 0:r.trim())||Ot:(null===(l=null==s?void 0:s.image_url)||void 0===l?void 0:l.trim())||Ot,h=v===Ot;switch(console.log("config in floating button",s),s.launcher_type){case e.TEXT:return this.createTextLauncher();case e.TEXTUAL_IMAGE:return this.createTextualImageLauncher();case e.IMAGE:default:if(d){var p=Math.round(.5*c),m=document.createElement("div");Object.assign(m.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"});var g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("width",p+""),g.setAttribute("height",p+""),g.setAttribute("viewBox","0 0 24 24"),g.setAttribute("fill","none"),g.setAttribute("xmlns","http://www.w3.org/2000/svg"),g.style.display="block";var b=document.createElementNS("http://www.w3.org/2000/svg","path");return b.setAttribute("d","M19 9L12 16L5 9"),b.setAttribute("stroke","currentColor"),b.setAttribute("stroke-width","1.5"),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round"),g.appendChild(b),m.appendChild(g),m}var w=document.createElement("img");return w.src=v,w.alt="Chat",Object.assign(w.style,{zIndex:"1000",cursor:"pointer",borderRadius:h?"0":"50%",objectFit:h?"contain":"cover",padding:h?f:"0",width:h?"calc(100% - 3px)":"100%",height:h?"calc(100% - 3px)":"100%",margin:h?"4px":"0",boxSizing:"border-box"}),w}},t.prototype.createTextLauncher=function(){var t=this.config.config,n=t.brand_colour,i=t.launcher_properties,e=t.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:n,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:p(n),fontSize:void 0!==a?"".concat(a,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==s?"".concat(s,"px"):b,fontFamily:g,textAlign:"center",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),c.textContent=(null==i?void 0:i.text)||"",u.appendChild(c),d.appendChild(u),d},t.prototype.createTextualImageLauncher=function(){var t,n,i,e,o,r,l,a=this.config.config,s=a.brand_colour,d=a.launcher_properties,u=a.image_url,c=a.launcher_size_multiplier,f=(null===(n=null===(t=null==this?void 0:this.config)||void 0===t?void 0:t.config)||void 0===n?void 0:n.launcher_type)?(null===(l=null===(r=null===(o=null===(e=null===(i=null==this?void 0:this.config)||void 0===i?void 0:i.config)||void 0===e?void 0:e.images)||void 0===o?void 0:o.launcher_image_url)||void 0===r?void 0:r.url)||void 0===l?void 0:l.trim())||Ot:(null==u?void 0:u.trim())||Ot,v=f===Ot,h=null!=c?c:1,m="".concat(Math.max(4,Math.round(4*h)),"px"),w=void 0!==this.config.launcher_size?void 0:174*h,x=void 0!==this.config.launcher_size?void 0:40*h,y=void 0!==this.config.launcher_size?void 0:40*h,_=void 0!==this.config.launcher_size?void 0:14*h,I=void 0!==this.config.launcher_size?void 0:21*h,T=document.createElement("div");Object.assign(T.style,{maxWidth:void 0!==w?"".concat(w,"px"):"13rem",width:"fit-content",height:void 0!==x?"".concat(x,"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 S=document.createElement("div");Object.assign(S.style,{flex:"1",minWidth:"0"});var E=document.createElement("p");Object.assign(E.style,{margin:"0",color:p(s),fontSize:void 0!==_?"".concat(_,"px"):"0.875rem",fontWeight:"600",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:void 0!==I?"".concat(I,"px"):b,fontFamily:g,textAlign:"right",WebkitFontSmoothing:"antialiased",textRendering:"optimizeLegibility",textSizeAdjust:"100%"}),E.textContent=(null==d?void 0:d.text)||"";var A=document.createElement("div");Object.assign(A.style,{width:void 0!==y?"".concat(y,"px"):"40px",height:void 0!==y?"".concat(y,"px"):"40px",borderRadius:"9999px",overflow:"hidden",position:"relative",flexShrink:"0"});var k=document.createElement("img");return k.src=f,k.alt="Chat",Object.assign(k.style,{width:v?"calc(100% - 6px)":"100%",height:v?"calc(100% - 6px)":"100%",margin:v?"3px":"0",borderRadius:v?"0":"50%",objectFit:v?"contain":"cover",padding:v?m:"0",boxSizing:"border-box"}),S.appendChild(E),A.appendChild(k),T.appendChild(S),T.appendChild(A),T},t.prototype.applyResponsiveStyles=function(t){var n,i,e,o,r,l,a,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!==(l=null!==(o=this.config.sideSpacing)&&void 0!==o?o:null===(r=f.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=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?((n={position:"fixed",bottom:"".concat(p,"px")})[v.toLowerCase()]="".concat(h,"px"),n):((i={bottom:"".concat(p,"px")})[v.toLowerCase()]="".concat(h,"px"),i));Object.assign(this.buttonElement.style,m)},t.prototype.handleResize=function(){var t,n,i,o=null!==(n=null===(t=this.config.config)||void 0===t?void 0:t.launcher_size_multiplier)&&void 0!==n?n:1,r=null!==(i=this.config.launcher_size)&&void 0!==i?i: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)},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 n,i;null===(i=(n=t.config).onEvent)||void 0===i||i.call(n,{type:v.CHATBOT_BUTTON_LOADED,timestamp:Date.now()}),t.config.onInternalEvent(v.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,n,i=this;E=I();var e=null===(t=this.proactiveElement)||void 0===t?void 0:t.children[0];if(e){var o="Right"===(this.config.position||(null===(n=this.config.config.interface_properties)||void 0===n?void 0:n.position)||"Right");Array.from(e.children).forEach(function(t){t.className=o?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"}),setTimeout(function(){i.proactiveElement&&i.proactiveElement.parentElement&&i.proactiveElement.parentElement.removeChild(i.proactiveElement),i.proactiveElement=null,i.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(g,' !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 n,i,o,r,a,u,c,v,h,m,w,x,y,I,T,E=this,O=null===(i=null===(n=this.config)||void 0===n?void 0:n.config)||void 0===i?void 0:i.proactive_message_obj;if(!Array.isArray(O)||this.config.isIframeVisible||A())if(this.proactiveElement&&this.proactiveElement.parentElement){var C=this.proactiveElement.children[0],z="Right"===(this.config.position||(null===(o=this.config.config.interface_properties)||void 0===o?void 0:o.position)||"Right");Array.from(C.children).forEach(function(t){t.className=z?"rblyn-proactive-exit-right":"rblyn-proactive-exit-left"}),setTimeout(function(){E.proactiveElement&&E.proactiveElement.parentElement&&E.proactiveElement.parentElement.removeChild(E.proactiveElement),E.proactiveElement=null,E.clearProactiveDelays()},400)}else this.proactiveElement=null,this.clearProactiveDelays();else{if(this.injectAnimationStyles(),!this.proactiveElement){var D=document.createElement("div");D.style.position="fixed";var M=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,j=null!==(h=null!==(c=this.config.sideSpacing)&&void 0!==c?c:null===(v=this.config.config.interface_properties)||void 0===v?void 0:v.side_spacing)&&void 0!==h?h:20,F=this.config.position||(null===(m=this.config.config.interface_properties)||void 0===m?void 0:m.position)||"Right",N=null!==(x=null===(w=this.config.config)||void 0===w?void 0:w.launcher_size_multiplier)&&void 0!==x?x:1,L=null!==(y=this.config.launcher_size)&&void 0!==y?y:48*N,U=this.config.config.launcher_type===e.IMAGE?L:void 0!==this.config.launcher_size?40:40*N;D.style.bottom="".concat(M+U+8,"px"),"Right"===F?D.style.right="".concat(j,"px"):D.style.left="".concat(j,"px"),D.style.maxWidth="22.875rem",D.style.zIndex="2147483646";var W=document.createElement("div");W.style.display="flex",W.style.flexDirection="column",W.style.alignItems="Right"===F?"flex-end":"flex-start";var P=document.createElement("div");P.style.position="absolute",P.style.top="-32px",P.style.width="24px",P.style.height="24px",P.style.borderRadius="50%",P.style.background="#fff",P.style.boxShadow="0 2.667px 2.667px 0 rgba(0, 0, 0, 0.25)",P.style.display="flex",P.style.alignItems="center",P.style.justifyContent="center",P.style.cursor="pointer",P.style.opacity="0",P.style.visibility="hidden","Right"===(this.config.position||(null===(I=this.config.config.interface_properties)||void 0===I?void 0:I.position)||"Right")?(P.style.right="0px",P.style.left="auto",P.style.transform="translateX(120%) scale(0.95)"):(P.style.left="0px",P.style.right="auto",P.style.transform="translateX(-120%) scale(0.95)"),P.onclick=function(t){t.stopPropagation(),E.hideProactiveMessages()},P.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 ',D.appendChild(W),D.appendChild(P),document.body.appendChild(D),this.proactiveElement=D}var B=this.proactiveElement.children[0];B.innerHTML="";var H="Right"===(this.config.position||(null===(T=this.config.config.interface_properties)||void 0===T?void 0:T.position)||"Right");B.style.display="flex",B.style.flexDirection="column",B.style.alignItems=H?"flex-end":"flex-start",this.clearProactiveDelays();var X=function(t){if(!t||A())return[];var n=_(),i=new Date,e=[];return t.forEach(function(t){e.push.apply(e,function(t,n,i){var e=(null==t?void 0:t.send_time_type)||"",o=e?R[e]:k;if(!o||!o(t,i))return[];for(var r=(null==t?void 0:t.content_multiple)||[],a=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=l.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=S(null==b||b.type,(null==b?void 0:b.value)||"",null==b?void 0:b.condition,n);v=null===v?w:h===l.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:a,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,n,i))}),e}(O);f([],X,!0).sort(function(t,n){return t.delayMs!==n.delayMs?t.delayMs-n.delayMs:t.contentIndex-n.contentIndex});var Y=new Map;X.forEach(function(t){var n=Y.get(t.delayMs);n||(n={messageIds:[],groups:new Map},Y.set(t.delayMs,n)),n.groups.has(t.messageId)||(n.messageIds.push(t.messageId),n.groups.set(t.messageId,[])),n.groups.get(t.messageId).push(t)});var G=void 0!==Y.get(0),J=this.proactiveElement.children[1];if(J&&X.length>0){J.style.opacity="0",J.style.visibility="hidden",J.style.transform=H?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var V=function(){if(J){J.style.visibility="visible";var t=B.children.length,n=t>0?10*(t-1):0;J.style.animationDelay="".concat(n,"ms"),J.className=H?"rblyn-proactive-close-enter-right":"rblyn-proactive-close-enter-left"}};if(G){var K=window.setTimeout(V,0);this.delayTimers.push(K)}else{var Z=Math.min.apply(Math,Array.from(Y.keys()));K=window.setTimeout(V,Z),this.delayTimers.push(K)}}else J&&(J.style.opacity="0",J.style.visibility="hidden");var q=0;Y.forEach(function(t,n){var i=t.messageIds,e=t.groups,o=window.setTimeout(function(){var t=B.children.length,o=0,r=[];i.forEach(function(t){var n=e.get(t)||[];f([],n,!0).sort(function(t,n){return t.contentIndex-n.contentIndex}).forEach(function(n){r.push({messageId:t,item:n})}),o+=n.length});var l=n>0?f([],r,!0).reverse():r;l.forEach(function(i,e){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=g,u.style.fontSize="14px",u.style.lineHeight=b+"",u.style.width="fit-content",u.style.maxWidth="100%";var f=0===e,v=e===l.length-1,h=t>0,m=Y.has(0),w=!1;0===n?w=!v||f&&h:f&&(h||m)?w=!0:f||(w=!0),w&&(u.style.marginBottom="16px");var x=10*(t+o-1-(0===n?t+q:q));u.className=H?"rblyn-proactive-enter-right":"rblyn-proactive-enter-left",u.style.animationDelay="".concat(x,"ms"),u.style.opacity="0",u.style.transform=H?"translateX(120%) scale(0.95)":"translateX(-120%) scale(0.95)";var y=document.createElement("div");Object.assign(y.style,{display:"flex",alignItems:"center",gap:"8px"});var _=document.createElement("div");if(_.className="rblyn-proactive-message-content",_.setAttribute("dir",function(t){if(!t||"string"!=typeof t||0===t.trim().length)return"ltr";var n=t.replace(/<[^>]*>/g,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#]/g,"").trim();if(0===n.length)return"ltr";for(var i=/[\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,e=0,o=0,r=0,l=n;r<l.length;r++){var a=l[r];/\s|\d|[.,;:!?()[\]{}'"`\-_=+*/\\|@#$%^&*~]/.test(a)||(o++,i.test(a)&&e++)}return 0===o?"ltr":e/o>.3?"rtl":"ltr"}(a.html)),_.innerHTML=function(t){return t?Rt.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}):""}(a.html),y.appendChild(_),(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:p((null==a?void 0:a.messageBubbleBg)||"#ffffff")});var T=document.createElementNS("http://www.w3.org/2000/svg","g");T.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"),T.appendChild(S),I.appendChild(T),y.appendChild(I)}if(u.appendChild(y),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 t;t={message_id:a.messageId,content_string:a.html||null,content_id:a.contentId||null},d({input_id:null},t),E.config.toggleIframe(),E.hideProactiveMessages();try{window.dispatchEvent(new CustomEvent("rblyn:proactiveClick",{detail:{message_id:a.messageId,content_string:a.html||null,content_id:a.contentId||null}}))}catch(t){}}},0===n)B.appendChild(u);else{B.insertBefore(u,B.firstChild);var A=null===(r=E.proactiveElement)||void 0===r?void 0:r.children[1];if(A&&"visible"===A.style.visibility){var k=B.children.length,R=k>0?10*(k-1):0;A.style.animationDelay="".concat(R,"ms")}}q++})},n);E.delayTimers.push(o)})}},t}(),zt=function(){function t(t,n,i,e){this.resizeObserver=null,this.containerElement=document.createElement("div"),this.handleResizeFunction=this.handleResize.bind(this),this.config={config:t,position:n,sideSpacing:i,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,n,i,e,o,r,l,a,s,u=560>(null===window||void 0===window?void 0:window.innerWidth),c=this.config.position||(null===(i=this.config.config.interface_properties)||void 0===i?void 0:i.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!==(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),((t={bottom:"".concat(v,"px")})[c.toLowerCase()]="".concat(f,"px"),t.alignItems="Right"===c?"flex-end":"flex-start",t)),m=d(d({},h),((n={top:"0"})[c.toLowerCase()]="".concat(f,"px"),n.alignItems="center",n));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}(),Dt=function(){function t(t){this.config=t,this.popupElement=document.createElement("div"),this.render()}return t.prototype.createTitleBar=function(){var t,n,i,e,o,r,l=(null===(n=null===(t=this.config)||void 0===t?void 0:t.config)||void 0===n?void 0:n.title_bar_color)||"#075E54",a=p(l),s=function(t){var n,i;if(null==t?void 0:t.startsWith("#")){var e=t.replace("#",""),o=3===(null==e?void 0:e.length)?null===(i=null===(n=null==e?void 0:e.split(""))||void 0===n?void 0:n.map(function(t){return"".concat(t).concat(t)}))||void 0===i?void 0:i.join(""):e;if(6===(null==o?void 0:o.length)){var r=parseInt(null==o?void 0:o.slice(0,2),16),l=parseInt(null==o?void 0:o.slice(2,4),16),a=parseInt(null==o?void 0:o.slice(4,6),16);return"rgba(".concat(r,", ").concat(l,", ").concat(a,", 0.8)")}}return"#FFFFFF"===t?"rgba(255, 255, 255, 0.8)":"rgba(14, 14, 15, 0.8)"}(a),d=document.createElement("div");Object.assign(d.style,{backgroundColor:l,padding:"16px 18px 14px"});var u=document.createElement("div");u.textContent=(null===(e=null===(i=this.config)||void 0===i?void 0:i.config)||void 0===e?void 0:e.widget_title)||"Hi there",Object.assign(u.style,{color:a,fontSize:"16px",fontWeight:"600",lineHeight:"1.2"});var c=document.createElement("div");return c.textContent=(null===(r=null===(o=this.config)||void 0===o?void 0:o.config)||void 0===r?void 0:r.widget_subtitle)||"We typically reply in minutes",Object.assign(c.style,{color:s,fontSize:"12px",marginTop:"4px"}),d.appendChild(u),d.appendChild(c),d},t.prototype.createContent=function(){var t,n,i,e,o,r,l,a,s=document.createElement("div");Object.assign(s.style,{padding:"20px 16px 16px"});var d=document.createElement("button");Object.assign(d.style,{width:"100%",border:"none",borderRadius:"14px",backgroundColor:(null===(n=null===(t=this.config)||void 0===t?void 0:t.config)||void 0===n?void 0:n.brand_colour)||"#25D366",color:p((null===(e=null===(i=this.config)||void 0===i?void 0:i.config)||void 0===e?void 0:e.brand_colour)||"#25D366"),fontSize:"14px",fontWeight:"600",padding:"10px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",letterSpacing:"0.01em"});var u=document.createElement("img");u.src="https://cdn.robylon.ai/logos/WhatsApp.svg",u.alt="WhatsApp",Object.assign(u.style,{width:"20px",height:"20px",objectFit:"contain"});var c=document.createElement("span");if(c.textContent=(null===(r=null===(o=this.config)||void 0===o?void 0:o.config)||void 0===r?void 0:r.button_content)||"Chat on WhatsApp",d.appendChild(u),d.appendChild(c),d.onclick=this.config.onCtaClick,s.appendChild(d),null===(a=null===(l=this.config)||void 0===l?void 0:l.config)||void 0===a?void 0:a.powered_by_robylon){var f=document.createElement("div");Object.assign(f.style,{textAlign:"center",color:"rgba(14, 14, 15, 0.4)",fontSize:"10px",marginTop:"10px"}),f.appendChild(document.createTextNode("Powered by "));var v=document.createElement("a");v.href="https://www.robylon.ai",v.target="_blank",v.rel="noopener noreferrer",v.textContent="Robylon",Object.assign(v.style,{color:"inherit",textDecoration:"none"}),v.addEventListener("mouseenter",function(){v.style.textDecoration="underline",v.style.color="rgba(14, 14, 15, 0.8)"}),v.addEventListener("mouseleave",function(){v.style.textDecoration="none",v.style.color="inherit"}),f.appendChild(v),s.appendChild(f)}return s},t.prototype.render=function(){this.popupElement.innerHTML="",this.popupElement.className="rblyn-chat-widget-popup",Object.assign(this.popupElement.style,{width:"19rem",maxWidth:"calc(100vw - 19rem)",borderRadius:"22px",overflow:"hidden",backgroundColor:"#fff",boxShadow:"0 16px 40px rgba(14, 14, 15, 0.2)",marginBottom:"14px"});var t=document.createElement("style");t.textContent='\n .rblyn-chat-widget-popup,\n .rblyn-chat-widget-popup * {\n font-family: system-ui, Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif !important;\n }\n ',this.popupElement.appendChild(t),this.popupElement.appendChild(this.createTitleBar()),this.popupElement.appendChild(this.createContent())},t.prototype.getElement=function(){return this.popupElement},t.prototype.update=function(t){this.config=t,this.render()},t.prototype.destroy=function(){var t;(null===(t=this.popupElement)||void 0===t?void 0:t.parentNode)&&this.popupElement.parentNode.removeChild(this.popupElement)},t}(),Mt=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]},jt=function(){var t;if(null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands)for(var n=["Chrome","Firefox","Safari","Edge","Opera"],i=0,e=navigator.userAgentData.brands;i<e.length;i++){var o=e[i];if(n.includes(o.brand))return o.brand}return(/Chrome|Firefox|Safari|Edge|Opera/.exec(navigator.userAgent)||["Unknown"])[0]},Ft=function(){var t,n,i,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===(n=null===document||void 0===document?void 0:document.body)||void 0===n?void 0:n.clientWidth),height:(null===window||void 0===window?void 0:window.innerHeight)||(null===(i=null===document||void 0===document?void 0:document.documentElement)||void 0===i?void 0:i.clientHeight)||(null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.clientHeight)}},Nt=function(){return{platform:"web",os:Mt(),browser:jt(),sdk_version:"1.0.3",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:Ft()};var t},Lt=function(t){var n=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 n=n.split(";").map(function(t){var n=t.split("="),i=n[0],e=n.slice(1).join("=").trim();return{name:i=i.trim(),value:e?decodeURIComponent(e):""}}),n},Ut={log:function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];console.log.apply(console,t)},error:function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];console.error.apply(console,t)},warn:function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];console.warn.apply(console,t)},info:function(){}};Ut.log("Raw API_URL:","https://api.robylon.ai");var Wt={copilotUrl:"https://chatbot.robylon.ai",environment:"production",apiUrl:"https://api.robylon.ai"};Ut.log("CONFIG",Wt);var Pt,Bt=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},Ht=function(){return{copilotUrl:Wt.copilotUrl||"https://app.robylon.ai",environment:Wt.environment||"production",apiUrl:Wt.apiUrl||"https://app.robylon.ai"}};!function(t){t.ERROR="ERROR",t.INFO="INFO"}(Pt||(Pt={}));var Xt,Yt=["@robylon/whatsapp-react-sdk","node_modules/@robylon/whatsapp-react-sdk/"],Gt=function(t){var n=t.filename,i=t.stack,e=t.message;return!!(n||i||e)&&Yt.some(function(t){return(null==n?void 0:n.includes(t))||(null==i?void 0:i.includes(t))||(null==e?void 0:e.includes(t))})},Jt=function(){function t(){var t=this;this.apiKey="",this.userId=null,this.preInitQueue=[],this.isInitialized=!1,this.handleWindowError=function(n){var i,e={filename:n.filename,stack:null===(i=n.error)||void 0===i?void 0:i.stack,message:n.message};Gt(e)&&t.trackError(n.error||n.message,"GlobalErrorHandler",{filename:n.filename,lineNo:n.lineno,colNo:n.colno})},this.handleUnhandledRejection=function(n){var i,e,o={stack:null===(i=n.reason)||void 0===i?void 0:i.stack,message:(null===(e=n.reason)||void 0===e?void 0:e.message)||n.reason+""};Gt(o)&&t.trackError(n.reason||"Unhandled Promise Rejection","GlobalPromiseHandler",{reason:n.reason})},this.setupGlobalHandlers()}return t.prototype.setupGlobalHandlers=function(){Bt()&&(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(){Bt()&&(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,n){void 0===n&&(n=null);try{if(this.preInitQueue.length>0){var i={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:n,timestamp:Date.now()},timestamp:Date.now()},metadata:Nt(),event_type:Pt.ERROR,user_id:n};this.sendLog(i).catch(console.error)}this.apiKey=t,this.userId=n,this.isInitialized=!0,this.processPreInitQueue()}catch(i){Ut.error("Error during ErrorTrackingService initialization:",i),this.preInitQueue.push({error:i instanceof Error?i:Error(i+""),componentName:"ErrorTrackingService",additionalInfo:{apiKey:t,userId:n}})}},t.prototype.processPreInitQueue=function(){return u(this,void 0,void 0,function(){var t,n,i;return c(this,function(e){switch(e.label){case 0:if(!this.preInitQueue.length)return[2];Ut.info("Processing ".concat(this.preInitQueue.length," pre-initialization errors")),t=0,n=this.preInitQueue,e.label=1;case 1:return t<n.length?(i=n[t],[4,this.trackError(i.error,i.componentName,d(d({},i.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 n,i,e,o,r,l;return c(this,function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),n=Ht().apiUrl,[4,fetch("".concat(n,"/users/sdk/record-logs/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:return(i=a.sent()).ok?[3,3]:(o=(e=Ut).error,r=["Failed to send error log:"],[4,i.text()]);case 2:o.apply(e,r.concat([a.sent()])),a.label=3;case 3:return[3,5];case 4:return l=a.sent(),Ut.error("Error sending log:",l),[3,5];case 5:return[2]}})})},t.prototype.trackError=function(t,n,i){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:t instanceof Error?t.message:t,stack:t instanceof Error?t.stack:void 0,componentName:n,additionalInfo:d(d({},i),{preInitError:!0,timestamp:Date.now()}),timestamp:Date.now()},metadata:Nt(),event_type:Pt.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:t,componentName:n,additionalInfo:i}),Ut.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:n,additionalInfo:d(d({},i),{timestamp:Date.now()}),timestamp:Date.now()},r={org_id:this.apiKey||"UNINITALIZED",event_data:o,metadata:Nt(),event_type:Pt.ERROR,user_id:this.userId},[4,this.sendLog(r)];case 6:return l.sent(),[2]}})})},t.prototype.trackInfo=function(t,n,i){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:n,additionalInfo:i,timestamp:Date.now()},o={org_id:this.apiKey,event_data:e,metadata:Nt(),event_type:Pt.INFO,user_id:this.userId},[4,this.sendLog(o)]):(Ut.error("Error tracking not initialized"),[2]);case 1:return r.sent(),[2]}})})},t}(),Vt=Jt.getInstance(),Kt="MISSING_API_KEY",Zt="SDK_INIT_FAILED",qt="ERROR_TRACKING_INIT_FAILED",Qt="API_REQUEST_FAILED",$t="NETWORK_ERROR",tn="INVALID_RESPONSE",nn="INITIALIZATION_ERROR",en=((Xt={})[Kt]=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.")},Xt.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.")},Xt.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):"")},Xt[Qt]=function(t,n,i){return"API Request Failed: Server responded with status ".concat(t," for ").concat(i?"endpoint ".concat(i):"request"," - ").concat(n)},Xt[$t]=function(t){return"Network Error: Failed to communicate with server".concat(t.url?" at ".concat(t.url):"").concat(t.error?" - ".concat(t.error):"")},Xt.IFRAME_LOAD_FAILED=function(t){return"Failed to load chatbot interface".concat(t.src?" from ".concat(t.src):"").concat(t.error?". Error: ".concat(t.error):"")},Xt[tn]=function(t){return"Invalid API Response: Missing required fields in response data: ".concat(t.join(", "))},Xt[qt]=function(t){return"Error Tracking Service initialization failed".concat(t.apiKey?" for API key ".concat(t.apiKey):"").concat(t.error?". Error: ".concat(t.error):"")},Xt[Zt]=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)):"")},Xt.COOKIE_ACCESS_ERROR=function(t,n){return"Cookie Access Error: Failed to ".concat(t).concat(n?" cookie '".concat(n,"'"):" cookies",". This may affect user session persistence.")},Xt.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):"")},Xt),on=function(){var t,n=navigator.userAgent;if(null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands){var i=navigator.userAgentData.brands.find(function(t){return"Google Chrome"===t.brand});if(null==i?void 0:i.version)return i.version}var e=n.match(/(Chrome|Firefox|Safari|Edge|Opera)\/(\d+\.\d+)/);return e?e[2]:"Unknown"},rn=function(){var t,n,i=Nt();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===(n=null===navigator||void 0===navigator?void 0:navigator.languages)||void 0===n?void 0:n[0])||"en",browser_version:on(),os:null==i?void 0:i.os,referral_url:(null===document||void 0===document?void 0:document.referrer)||"",system_info:i}},ln=function(t,n,i){return u(void 0,void 0,void 0,function(){var e,o,r,l,a,s,d,u,f,v;return c(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),e=Ht().apiUrl,Ut.log("endpointUrl",o="".concat(e,"/chat/whatsapp/get/")),r={client_user_id:n||null,org_id:t,token:i||void 0,extra_info:{},launcher_info:rn(),phone_no_id:"739739745898120"},[4,fetch(o,{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(r)})];case 1:return(l=c.sent()).ok?[3,3]:[4,l.text()];case 2:throw a=c.sent(),Error(en[Qt](l.status,a));case 3:return[4,l.json()];case 4:if(s=c.sent(),d=function(t){return function(t){var n,i,e,o,r,l,a,s;return!(!(null===(e=null===(i=null===(n=null==t?void 0:t.user)||void 0===n?void 0:n.org_info)||void 0===i?void 0:i.brand_config)||void 0===e?void 0:e.widget)||!(null===(s=null===(a=null===(l=null===(r=null===(o=null==t?void 0:t.user)||void 0===o?void 0:o.org_info)||void 0===r?void 0:r.brand_config)||void 0===l?void 0:l.profile)||void 0===a?void 0:a.qr_code)||void 0===s?void 0:s.chat_link))}(t)?function(t){var n,i,e=null===(i=null===(n=null==t?void 0:t.user)||void 0===n?void 0:n.org_info)||void 0===i?void 0:i.brand_config;return{profile:null==e?void 0:e.profile,widget:null==e?void 0:e.widget,business_profile:null==e?void 0:e.business_profile,display_name:null==e?void 0:e.display_name}}(t):t}(s),!(null===(v=null===(f=null==d?void 0:d.profile)||void 0===f?void 0:f.qr_code)||void 0===v?void 0:v.chat_link)||!(null==d?void 0:d.widget))throw Error(en[tn](["profile","widget"]));return[2,d];case 5:throw u=c.sent(),Vt.trackError(u instanceof Error?u:Error(en[$t]({error:u+""})),"fetchChatbotConfig",{errorCode:u instanceof Error&&u.message.includes("API Request Failed")?Qt:$t,errorType:"API_ERROR",context:{apiKey:t,userId:n,timestamp:Date.now()}}),u;case 6:return[2]}})})},an=function(t){return u(void 0,void 0,void 0,function(){var o,r,l,a,s,u,f,v,h,p,m,g,b,w,x,y,_,I,T,S,E,A,k,R,O,C,z,D,M,j,F,N,L;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,l=!1,r||(r=function(){var t,n="; ".concat(document.cookie).split("; rblyn_anon=");if(2===n.length)return null===(t=n.pop())||void 0===t?void 0:t.split(";").shift()}()||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=16*Math.random()|0;return("x"===t?n:3&n|8).toString(16)}),W=r,(P=new Date).setTime(P.getTime()+31536e6),document.cookie="".concat("rblyn_anon","=").concat(W,";expires=").concat(P.toUTCString(),";path=/"),l=!0),[4,ln(o.api_key,r,o.user_token)];case 1:a=c.sent();try{o.api_key}catch(t){Ut.warn("Failed to inject mock proactive messages",t)}return s=Nt(),u=rn(),U=o.user_profile,f=U?Object.fromEntries(Object.entries(U).map(function(t){var n=t[0],i=t[1];return"boolean"==typeof i||"number"==typeof i?[n,i]:[n,i+""]})):{},v=d(d(d({},s),{__INT_SYS_INFO__:d(d({},s),u)}),f),h=function(t){if("string"==typeof t)return(null==t?void 0:t.trim())||"";var n=null==t?void 0:t.url;return"string"==typeof n&&(null==n?void 0:n.trim())||""}(null===(p=null==a?void 0:a.widget)||void 0===p?void 0:p.launcher_image),[2,{chatbotId:o.api_key,userId:r,token:o.user_token,isAnonymous:l,domain:"",show_launcher:!0,brand_colour:(null===(m=null==a?void 0:a.widget)||void 0===m?void 0:m.brand_color)||"#25D366",image_url:h,userProfile:v,chat_interface_config:{chat_bubble_prompts:[],display_name:(null===(g=null==a?void 0:a.widget)||void 0===g?void 0:g.title)||(null==a?void 0:a.display_name)||"",welcome_message:(null===(b=null==a?void 0:a.widget)||void 0===b?void 0:b.subtitle)||"Hey! What can we help you with today?",redirect_url:(null===(x=null===(w=null==a?void 0:a.profile)||void 0===w?void 0:w.qr_code)||void 0===x?void 0:x.chat_link)||""},launcher_type:(null===(y=null==a?void 0:a.widget)||void 0===y?void 0:y.launcher_type)||e.IMAGE,launcher_properties:{text:(null===(_=null==a?void 0:a.widget)||void 0===_?void 0:_.launcher_text)||(null===(I=null==a?void 0:a.widget)||void 0===I?void 0:I.button_content)||""},images:{launcher_image_url:{url:h}},proactive_message_obj:void 0,interface_properties:{position:(null===(T=null==a?void 0:a.widget)||void 0===T?void 0:T.position)||i.RIGHT,side_spacing:(null===(S=null==a?void 0:a.widget)||void 0===S?void 0:S.side_spacing)||20,bottom_spacing:(null===(E=null==a?void 0:a.widget)||void 0===E?void 0:E.bottom_spacing)||20},interface_type:n.WIDGET,launcher_delay:{enabled:!1,delay:0},launcher_size_multiplier:null!==(k=null===(A=null==a?void 0:a.widget)||void 0===A?void 0:A.launcher_size_multiplier)&&void 0!==k?k:1,redirect_chat_link:(null===(O=null===(R=null==a?void 0:a.profile)||void 0===R?void 0:R.qr_code)||void 0===O?void 0:O.chat_link)||"",pre_filled_message:(null===(z=null===(C=null==a?void 0:a.profile)||void 0===C?void 0:C.qr_code)||void 0===z?void 0:z.pre_filled_message)||"",widget_type:(null===(D=null==a?void 0:a.widget)||void 0===D?void 0:D.widget_type)||"quick_launch",widget_title:(null===(M=null==a?void 0:a.widget)||void 0===M?void 0:M.title)||"",widget_subtitle:(null===(j=null==a?void 0:a.widget)||void 0===j?void 0:j.subtitle)||"",title_bar_color:(null===(F=null==a?void 0:a.widget)||void 0===F?void 0:F.title_bar_color)||"#075E54",button_content:(null===(N=null==a?void 0:a.widget)||void 0===N?void 0:N.button_content)||"Chat on WhatsApp",powered_by_robylon:!1!==(null===(L=null==a?void 0:a.widget)||void 0===L?void 0:L.powered_by_robylon)}]}var U,W,P})})},sn="https://cdn.robylon.ai/logos/WhatsApp.svg",dn=function(){function t(t){this.logoContainer=null,this.iframe=null,this.bubblePromptContainer=null,this.chatBtnImage=null,this.config=t,this.validateDomain()&&this.init(),null===window||void 0===window||window.addEventListener("message",this.onCloseListener.bind(this),!1)}return t.prototype.onCloseListener=function(t){t.origin===this.config.domain&&"closeChatbot"===t.data&&this.closeIframe()},t.prototype.validateDomain=function(){var t,n=this.config.domain,i=null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.origin;return Ut.log("expectedDomain, to current domain",n,i,n===i),n===i},t.prototype.createChatBubblContainer=function(){var t,n=this,i=document.createElement("div");i.id="chatbase-message-bubbles",Object.assign(i.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=n.createMessageBubble(t);i.appendChild(e)}),i.appendChild(e),document.body.appendChild(i)},t.prototype.createMessageBubble=function(t){var n=document.createElement("div");this.bubblePromptContainer=n,Object.assign(n.style,{display:"flex",position:"relative",justifyContent:"flex-end"});var i=document.createElement("div");i.classList.add("message"),i.textContent=t,Object.assign(i.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(){n.remove()}),n.appendChild(e),n.appendChild(i),n},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:p(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 n,i,e,o,r,l,a,s,d,u=document.createElement("img"),c=null!==(i=null===(n=this.config)||void 0===n?void 0:n.launcher_size_multiplier)&&void 0!==i?i:1,f="".concat(Math.max(4,Math.round(4*c)),"px"),v=(null===(e=this.config)||void 0===e?void 0:e.launcher_type)?(null===(a=null===(l=null===(r=null===(o=this.config)||void 0===o?void 0:o.images)||void 0===r?void 0:r.launcher_image_url)||void 0===l?void 0:l.url)||void 0===a?void 0:a.trim())||sn:(null===(d=null===(s=this.config)||void 0===s?void 0:s.image_url)||void 0===d?void 0:d.trim())||sn,h=v===sn;u.src=v,u.alt="Chat",Object.assign(u.style,{zIndex:"1000",cursor:"pointer",borderRadius:h?"0":"50%",objectFit:h?"contain":"cover",padding:h?f:"0",boxSizing:"border-box",width:h?"calc(100% - 3px)":"100%",height:h?"calc(100% - 3px)":"100%",margin:h?"4px":"0"}),this.chatBtnImage=u,t.innerHTML="",t.appendChild(u)},t.prototype.createIframe=function(){var t=this;Ut.log("RobylonConfig?.domain====>",this.config.domain);var n=document.createElement("iframe");Object.assign(n.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"}),n.src="".concat(this.config.domain,"/chatbot-plugin?id=").concat(this.config.chatbotId),Ut.log("iframe.src====>",n.src),document.body.appendChild(n),this.iframe=n;var i=function(){560>(null===window||void 0===window?void 0:window.innerWidth)?Object.assign(n.style,{width:"100vw",minWidth:"300px",right:"0",bottom:"0",height:"100vh",flexDirection:"column",flexGrow:"1",borderRadius:"0",top:"0",maxHeight:"100%"}):Object.assign(n.style,{width:"26%",minWidth:"400px",right:"32px",bottom:"86px",height:"calc(100vh - 3rem - 10vh)",borderRadius:"1rem",top:"calc(10vh - 32px)",maxHeight:"45rem"})};i(),null===window||void 0===window||window.addEventListener("resize",i),n.addEventListener("load",function(){var i,e,o,r,l;if(t.iframe){var a=new URL(t.iframe.src).origin||t.config.domain;null===(i=n.contentWindow)||void 0===i||i.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=n.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===(l=t.config.userProfile)||void 0===l?void 0:l.__INT_SYS_INFO__)||{}),rn())})}},a)}}),null===window||void 0===window||window.addEventListener("message",function(i){var e,o;if(i.origin===t.config.domain){if("captureSessionData"===i.data){var r="66b33d16-5b38-4693-8772-1a1bd7dd412d"===t.config.chatbotId,l={cookies:Lt(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=n.contentWindow)||void 0===o||o.postMessage(l,t.config.domain||"*")}"expand"===i.data&&(t.adjustIframeWidth(),n.style.height="calc(100vh - 120px)",n.style.bottom="86px"),"collapse"===i.data&&Object.assign(n.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;Ut.log("screenWidth",t),this.iframe.style.width=832>t?"".concat(t-64,"px"):"800px"}},t.prototype.loadSvgInline=function(t){var n=document.createElement("div");n.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 i=n.querySelector("svg");t.innerHTML="",i&&t.appendChild(i)},t.prototype.toggleIcon=function(t,n){"block"===n.style.display?this.loadSvgInline(t):this.loadImage(t)},t.prototype.toggleIframe=function(){var t,n;if(Ut.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;Ut.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":(null===(n=this.chatBtnImage)||void 0===n?void 0:n.src)===sn?"contain":"cover",this.bubblePromptContainer&&(this.bubblePromptContainer.style.display="none"),Ut.log("this.bubblePromptContainer",this.bubblePromptContainer)}},t.prototype.closeIframe=function(){var t;this.iframe&&this.logoContainer&&this.chatBtnImage&&(this.iframe.style.display="none",this.toggleIcon(this.logoContainer,this.iframe),this.chatBtnImage.style.objectFit=(null===(t=this.chatBtnImage)||void 0===t?void 0:t.src)===sn?"contain":"cover")},t.prototype.init=function(){this.createIframe(),this.createFloatingButton()},t}(),un=function(t){var n={isInitialized:!1,isInitializing:!1,error:null,chatbotConfig:null,isIframeVisible:!1},i=[],e=function(t){n=d(d({},n),t),i.forEach(function(t){return t(n)})};return{getState:function(){return n},initialize:function(){return u(void 0,void 0,void 0,function(){var n,i,o;return c(this,function(r){switch(r.label){case 0:if(!t.api_key)return Vt.trackError(Error(en[Kt](t.api_key)),"ChatbotStateManager",{errorCode:Kt,errorType:nn,context:{timestamp:Date.now()}}),[2];e({isInitializing:!0}),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,an(t)];case 2:return n=r.sent(),[4,new Promise(function(t,i){!function(i,o,r){if(i.chatbotId&&i.userId)try{new dn(i),e({isInitialized:!0,chatbotConfig:n}),t(),Ut.log("Robylon SDK initialized successfully.")}catch(t){r(t instanceof Error?t.message:"Failed to initialize SDK")}else r("Incomplete configuration for SDK initialization.")}(n,0,function(t){i(t)})})];case 3:return r.sent(),[3,6];case 4:return i=r.sent(),o=i instanceof Error?i.message:"Failed to initialize chatbot",e({error:o}),Vt.trackError(i instanceof Error?i:Error(o),"ChatbotStateManager",{errorCode:Zt,errorType:nn,context:{timestamp:Date.now()}}),[3,6];case 5:return e({isInitializing:!1}),[7];case 6:return[2]}})})},toggleIframeVisibility:function(){e({isIframeVisible:!n.isIframeVisible})},closeIframe:function(){e({isIframeVisible:!1})},updateState:e,subscribe:function(t){return i.push(t),function(){var n=i.indexOf(t);n>-1&&i.splice(n,1)}},unsubscribe:function(t){var n=i.indexOf(t);n>-1&&i.splice(n,1)}}},cn=function(t){t.api_key,t.user_profile;var n=t.onEvent;return t.chatbotConfig,{emit:function(t,i){var e={type:t,timestamp:Date.now(),data:i};null==n||n(e)},onInternalEvent:function(t,n){}}},fn=function(){function t(t){var n=this;this.container=null,this.floatingButton=null,this.launcherDelayTimeout=null,this.popup=null,this.isDestroyed=!1,this.handleStateChange=function(t){var i,e,o,r,l,a,s,d;if(!n.isDestroyed){var u=t.isInitialized,c=t.error,f=t.chatbotConfig,v=t.isIframeVisible,h="chat_widget"===(null==f?void 0:f.widget_type);if(!c&&f&&u){n.eventEmitter=cn({api_key:n.config.api_key,user_profile:n.config.user_profile,onEvent:n.config.onEvent,chatbotConfig:{isAnonymous:f.isAnonymous,userId:f.userId}}),n.container||(n.container=new zt(f,n.config.position,n.config.sideSpacing,n.config.bottomSpacing)),h&&v?n.popup?n.popup.update({config:f,onCtaClick:n.handlePopupCta}):(n.popup=new Dt({config:f,onCtaClick:n.handlePopupCta}),null===(e=null===(i=n.container)||void 0===i?void 0:i.getElement())||void 0===e||e.prepend(n.popup.getElement())):n.popup&&(n.popup.destroy(),n.popup=null);var p=void 0!==n.config.show_launcher?!!n.config.show_launcher:null===(o=null==f?void 0:f.show_launcher)||void 0===o||o,m=!0===(null===(r=null==f?void 0:f.launcher_delay)||void 0===r?void 0:r.enabled),g=null!==(d=null!==(a=null===(l=null==f?void 0:f.launcher_delay)||void 0===l?void 0:l.seconds)&&void 0!==a?a:null===(s=null==f?void 0:f.launcher_delay)||void 0===s?void 0:s.delay)&&void 0!==d?d:0,b=function(){if(n.floatingButton)n.floatingButton.update({config:f,isIframeVisible:v,position:n.config.position,sideSpacing:n.config.sideSpacing,bottomSpacing:n.config.bottomSpacing,launcher_size:n.config.launcher_size});else if(n.floatingButton=new Ct({config:f,toggleIframe:n.toggleIframe,isIframeVisible:v,onEvent:n.config.onEvent,onInternalEvent:n.eventEmitter.onInternalEvent,position:n.config.position,sideSpacing:n.config.sideSpacing,bottomSpacing:n.config.bottomSpacing,launcher_size:n.config.launcher_size}),n.floatingButton.getElement&&"function"==typeof n.floatingButton.getElement){var t=n.floatingButton.getElement();t&&n.container&&n.container.getElement().appendChild(t)}};n.launcherDelayTimeout&&(clearTimeout(n.launcherDelayTimeout),n.launcherDelayTimeout=null),p?m&&+g>0&&!n.floatingButton?n.launcherDelayTimeout=window.setTimeout(function(){b(),n.launcherDelayTimeout=null},1e3*+g):b():n.floatingButton&&(n.floatingButton.destroy(),n.floatingButton=null)}}},this.toggleIframe=function(){var t,i,e=n.stateManager.getState(),o=null===(t=null==e?void 0:e.chatbotConfig)||void 0===t?void 0:t.redirect_chat_link;"chat_widget"===(null===(i=null==e?void 0:e.chatbotConfig)||void 0===i?void 0:i.widget_type)?(n.stateManager.toggleIframeVisibility(),n.eventEmitter.emit(e.isIframeVisible?v.CHATBOT_CLOSED:v.CHATBOT_BUTTON_CLICKED)):o&&(window.open(o,"_blank","noopener,noreferrer"),n.eventEmitter.emit(v.CHATBOT_BUTTON_CLICKED))},this.handlePopupCta=function(){var t,i=n.stateManager.getState(),e=null===(t=null==i?void 0:i.chatbotConfig)||void 0===t?void 0:t.redirect_chat_link;e&&(window.open(e,"_blank","noopener,noreferrer"),n.eventEmitter.emit(v.CHATBOT_BUTTON_CLICKED)),n.stateManager.closeIframe()};var i=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=i,!t.api_key)throw Vt.trackError(Error(en[Kt](t.api_key)),"RobylonChatbot",{errorCode:Kt,errorType:nn,context:{timestamp:Date.now()}}),Error("API key is required");try{Vt.initialize(t.api_key,t.user_id)}catch(t){Vt.trackError(t instanceof Error?t:Error(t+""),"RobylonChatbot",{errorCode:qt,errorType:nn,context:{timestamp:Date.now()}})}this.stateManager=un({api_key:t.api_key,user_id:t.user_id,user_token:t.user_token,user_profile:t.user_profile}),this.eventEmitter=cn({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(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.stateManager.initialize()];case 1:return n.sent(),this.stateManager.subscribe(this.handleStateChange),this.handleStateChange(this.stateManager.getState()),[3,3];case 2:return t=n.sent(),Vt.trackError(t instanceof Error?t:Error(t+""),"RobylonChatbot.initialize",{errorCode:Zt,errorType:nn,context:{timestamp:Date.now()}}),[3,3];case 3:return[2]}})})},t.prototype.show=function(){var t,n,i=this.stateManager.getState();if("chat_widget"===(null===(t=null==i?void 0:i.chatbotConfig)||void 0===t?void 0:t.widget_type))i.isIframeVisible||(this.stateManager.toggleIframeVisibility(),this.eventEmitter.emit(v.CHATBOT_BUTTON_CLICKED));else{var e=null===(n=null==i?void 0:i.chatbotConfig)||void 0===n?void 0:n.redirect_chat_link;e&&(window.open(e,"_blank","noopener,noreferrer"),this.eventEmitter.emit(v.CHATBOT_BUTTON_CLICKED))}},t.prototype.hide=function(){var t,n=this.stateManager.getState();"chat_widget"===(null===(t=null==n?void 0:n.chatbotConfig)||void 0===t?void 0:t.widget_type)&&n.isIframeVisible&&(this.stateManager.closeIframe(),this.eventEmitter.emit(v.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.popup&&(this.popup.destroy(),this.popup=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 vn(t){return new fn(t)}if("undefined"!=typeof window){!function(){if("undefined"!=typeof window){var t=window,n=(null==t?void 0:t.RobylonChatbot)||(null==t?void 0:t.R);if(n&&Array.isArray(n.q)){var i=null;n.q.forEach(function(t){var n=t[0];if("init"===n){var e=t[1]||{};i=vn(e)}else i&&"function"==typeof i[n]&&i[n]()}),t.RobylonChatbot=function(t){var n=[].slice.call(arguments,1);return"init"===t?i=vn(n[0]||{}):i&&"function"==typeof i[t]?i[t].apply(i,n):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 hn=window,pn=null==hn?void 0:hn.RobylonChatbot;pn&&!(null==hn?void 0:hn.R)&&(hn.R=pn)}var mn={create:vn,getState:function(){return"initialized"}};t.create=vn,t.default=mn,Object.defineProperty(t,"i",{value:!0})});
2
2
  //# sourceMappingURL=robylon-chatbot.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robylon/whatsapp-react-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "React SDK for Robylon WhatsApp",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -28,7 +28,7 @@
28
28
  "trigger:staging": "node scripts/trigger-staging-workflow.js",
29
29
  "trigger:production": "gh workflow run deploy-sdk.yml",
30
30
  "deploy:staging": "npm run version:staging && npm run trigger:staging",
31
- "deploy:production": "npm run version:production && npm run trigger:production",
31
+ "deploy:production": "node scripts/deploy-production.js",
32
32
  "update-changelog": "node scripts/update-changelog.js",
33
33
  "install-hooks": "node scripts/install-hooks.js",
34
34
  "publish:staging": "node scripts/validate-publish.js staging && npm run build:staging:all && npm version prerelease --preid=staging --force && npm publish --tag staging && node scripts/create-version-tag.js",