import{k as e}from"./5.C_rgEAoe.chunk.js";import{f as t,s as i,m as n,R as o,n as a,L as r,p as s,q as l,r as c,t as d,u,v as m,w as p,x as g,y as f,z as h,A as v,l as w,C as y,D as b,E as z,F as S,N as k,G as _,j as I,H as E,I as A,d as x,h as P,J as C,K as T,c as O,M as F,O as L,P as M,S as N,T as G,U as V,V as D,W as R,X as q,Y as W,Z as j,_ as B,$ as H,a0 as U,B as J}from"./3.BctvFFo8.chunk.js";import{g as Y,a as K,d as X}from"./6.CoSZoCaB.chunk.js";import{c as $}from"./8.Bm-j6nQo.chunk.js";import{m as Q,p as Z,l as ee,n as te,f as ie,o as ne,q as oe,r as ae,t as re,v as se,w as le,x as ce,y as de,z as ue,B as me,C as pe,D as ge,E as fe,F as he,G as ve,I as we,R as ye,J as be,K as ze,L as Se,N as ke,O as _e}from"./2.AnQoi521.chunk.js";import{g as Ie,b as Ee,d as Ae,c as xe,m as Pe,l as Ce,f as Te,t as Oe,a as Fe,n as Le,r as Me,e as Ne}from"./4.DsIPCrft.chunk.js";import{d as Ge}from"./12.Gv78iMd6.chunk.js";import{i as Ve}from"./13.BAgQZlxx.chunk.js";const De={};const Re=Ie((...e)=>(t,i)=>{if(0!==t)return;const n=e.length;if(0===n)return i(0,()=>{}),i(1,[]),void i(2);let o=n,a=n,r=n;const s=new Array(n),l=new Array(n),c=(e,t)=>{if(0!==e)for(let i=0;i{s[t]=De,e(0,(e,d)=>{if(0===e)l[t]=d,0==--o&&i(0,c);else if(1===e){const e=a?s[t]===De?--a:a:0;if(s[t]=d,0===e){const e=new Array(n);for(let t=0;t(t,i)=>{if(0!==t)return;let n=!1;e.then(e=>{n||(i(1,e),n||i(2))},e=>{n||i(2,e)}),i(0,e=>{2===e&&(n=!0)})};function je(e){return t=>Ee(Q(e)(t))}var Be=function(){},He={};function Ue(e){var t,i,n=[],o=!1,a=He;return function(r,s){if(0===r){if(a!==He)return s(0,Be),o&&s(1,i),void s(2,a);n.push(s);var l=function(e,i){if(2!==e)a===He&&t(e,i);else{var o=n.indexOf(s);-1!==o&&n.splice(o,1)}};1!==n.length?(s(0,l),o&&a===He&&s(1,i)):e(0,(function(e,r){if(0===e)return t=r,void s(0,l);1===e&&(o=!0,i=r);var c=n.slice(0);2===e&&(a=r,n=null),c.forEach((function(t){t(e,r)}))}))}}}const Je=Ie(e=>t=>(i,n)=>{if(0!==i)return;let o,a=0;t(0,(t,i)=>{0===t?(o=i,n(t,i)):1===t&&a[e,t[e]])}const Xe=e=>{let{code:t,message:i}=e;const n=new Error(i);return n.code=t,n},$e=(e,i)=>t(""+((e,t)=>"https://accounts.livechatinc.com"+(e=>{let{uniqueGroups:t,organizationId:i,groupId:n}=e;return t?"/v2/customer/"+i+"/"+n+"/token":"/v2/customer/token"})(e))(e),{method:"POST",credentials:"include",body:JSON.stringify({response_type:"token",grant_type:"cookie",client_id:e.clientId,organization_id:e.organizationId,redirect_uri:Y(String(window.location))+window.location.pathname})}).then(e=>e.json()).then(t=>((e,t)=>{if("identity_exception"in e)throw Xe({code:"SSO_IDENTITY_EXCEPTION",message:e.identity_exception});if("oauth_exception"in e)throw Xe({code:"SSO_OAUTH_EXCEPTION",message:e.oauth_exception});return{accessToken:e.access_token,entityId:e.entity_id,expiresIn:1e3*e.expires_in,tokenType:e.token_type,creationDate:Date.now(),organizationId:t}})(t,e.organizationId)),Qe=e=>{let{organizationId:t,clientId:i}=e;if("string"!=typeof t||"string"!=typeof i)throw new Error("You need to pass valid configuration object: { organizationId, clientId }.")},Ze=(e,t,n)=>{Qe(e);const o=e.tokenStoragePrefix||"@@lc_auth_token:",a=""+o+t+(e.uniqueGroups?":"+e.groupId:""),r=""+o+e.organizationId+(e.uniqueGroups?":"+e.groupId:"");let s=null,l=null,c=i.getItem(a).then(e=>{if(null!==c)return c=null,e?i.setItem(r,e).then(()=>i.removeItem(a).then(()=>{l=JSON.parse(e)})):i.removeItem(a).then(()=>i.getItem(r).then(e=>{e&&(l=JSON.parse(e))}))});const d=()=>(s=$e(e).then(e=>(s=null,i.setItem(r,JSON.stringify(e)),l=e,e),e=>{throw s=null,e}),s),u=()=>s||(l&&!(e=>{let{creationDate:t,expiresIn:i}=e;return Date.now()>=t+i})(l)?Promise.resolve(l):c?c.then(u):d()),m=()=>c?c.then(m):Promise.resolve(!!l);return{getFreshToken:d,getToken:u,hasToken:m,invalidate:()=>(l=null,c=null,i.removeItem(r))}},et=(e,t)=>n(e,"visibility").state===t,tt=(e,t)=>Z(ie(e,e=>e.application.readyState),Te(e=>e===t),Oe(1),Ue),it=e=>g(e).some(e=>{if("form"!==e.type)return!1;const{fields:t}=e.properties;return t.some(e=>"group_chooser"===e.type)}),nt=e=>{const t=Z(ie(e,e=>et(e,"maximized")),Je(1),Te(Boolean));Z(t,Oe(1),Te(()=>!Math.floor(1e3*Math.random())),Fe(()=>(e=>{ne({isMessagingModeEnabled:s(e),isCustomerInvited:l(e),groupAvailability:e.getApplicationState().availability,minimizedType:c(e)})})(e))),Z((e=>Z(tt(e,o),je(()=>Z(ie(e,e=>a(e,r).active),Je(1),Te(Boolean)))))(e),Fe(()=>(e=>{const{s:t,embedded:i,testGroup:n,actingAsDirectLink:o,config:a,language:s,integrationName:h,clientChatNumber:v,clientVisitNumber:w}=e.getApplicationState(),y=a&&a.theme&&a.theme.name,b=d()||"none",z=u(),S=m(e),k=!!p(e,r),_=!!e.getSessionUser().email,I=l(e)?"invitation":"other",E=c(e),A=g(e),x=A.find(e=>!!e.properties.invitation),P=f(A.filter(e=>"message"===e.type||"message_draft"===e.type));oe({s:t,embedded:i,themeName:y,testGroup:n,uniqueGroups:z,minimizedType:E,language:s||"unknown",integrationName:h||"none",mobileBridgeType:b,chatHistoryEnabled:S,hasPreviousChatThreads:k,hasGroupChooser:String(it(e)),hasBeenImmediatelyQueued:String(e.getChat(r).properties.queued),isCustomerEmailSet:_,actingAsDirectLink:o,chatWidgetWidth:window.innerWidth,chatWidgetHeight:window.innerHeight,clientChatNumber:v+1,clientVisitNumber:w,chatSource:I,fromGreeting:!!ae(!1,"properties.fromGreeting",P),..."invitation"===I&&x&&{greetingId:x.properties.id,greetingUniqueId:x.properties.uniqueId,greetingType:x.properties.type,greetingSubtype:x.properties.subtype,greetingAddon:x.properties.addon||"none"}})})(e)))};window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_js_loaded");const ot=e=>new Promise(t=>{const i=performance.getEntriesByName(e);if(!h(i))return void t(i[0]);if("undefined"==typeof PerformanceObserver)return void t(null);const n=setTimeout(()=>{o.disconnect(),t(null)},6e4),o=new PerformanceObserver(i=>{const a=v(t=>t.name===e,i.getEntries());a&&(o.disconnect(),clearTimeout(n),t(a))});o.observe({entryTypes:["paint"]})}),at=()=>{const e="lc_get_time_"+w();window.performance&&"function"==typeof window.performance.mark&&window.performance.mark(e);const[{startTime:t}]=performance.getEntriesByName(e);return performance.clearMarks(e),t},rt=()=>{if("undefined"==typeof PerformanceObserver)return null;const e=at(),t=[],i=new PerformanceObserver(e=>{t.push.apply(t,e.getEntries())});i.observe({entryTypes:["longtask"]});const n=()=>{const i=f(t);return i?(n=i,at()-n.startTime+n.duration):at()-e;var n};return{disconnect:()=>i.disconnect(),getLongTasks:()=>[].concat(t),waitForIdle:e=>new Promise(o=>{const a=()=>{t.push.apply(t,i.takeRecords());const r=n();r>=e?o():setTimeout(a,Math.ceil(e-r))};a()})}},st=(e,t)=>{if(!e||!t)return null;const i=f(e);return i?Math.max(i.startTime+i.duration,t.startTime):t.startTime},lt=()=>{if(Math.floor(1e3*Math.random()))return;const e=function(e){const t=rt();return t?ot(e).then(e=>e?t.waitForIdle(5e3).then(()=>(t.disconnect(),t.getLongTasks())):null):Promise.resolve(null)}("first-paint");return{getLogs:()=>Promise.all([e,ot("first-paint")]).then(e=>{let[t,i]=e;return y(e=>{return e&&(t=2,Number(e.toFixed(t)));var t},{totalBlockingTime:t&&(n=t.map(e=>e.duration),n.reduce(Ye,0)),firstContentfulPaint:null==i?void 0:i.startTime,timeToInteractive:st(t,i)});var n})}},ct=new RegExp("("+["BetterJsPop","LOCAL_STORAGE is null","Can't find variable: auto","Can't find variable: ext","Can't find variable: $","_avast_submit","No license found in the URL.","getNewsReadStatus4Vivo","is banned!","Object Not Found Matching Id"].join("|")+")"),dt=new RegExp("("+["chrome-extension://","https://www.smybeds.com/"].join("|")+")"),ut=e=>!!(e.message&&ct.test(e.message)||e.stack&&dt.test(e.stack));window.addEventListener("error",e=>{let{error:t}=e;if(t)if(t.message&&-1!==t.message.indexOf("evaluating 'document.getElementById('view-chat').innerHTML'")){const e=b();if(10095588===e||7243681===e)return;z("custom_mobile_hacks",t)}else if(!ut(t))if(t.message&&-1!==t.message.indexOf("Incorrect locale information provided")){const e=navigator.language||navigator.userLanguage||"en-US";z("onerror",t,{"navigator.language":navigator.language,"navigator.userLanguage":navigator.userLanguage,locale:e,err:(()=>{try{return new Intl.Locale(e),!1}catch(t){return!0}})()})}else z("onerror",t)}),window.addEventListener("unhandledrejection",e=>{e&&e.reason&&(ut(e.reason)||z("unhandledrejection",e.reason))});const mt=e=>e.some(se),pt=(e,t)=>{const i=Z(function(){const e=Ce(()=>!!document.hasFocus&&document.hasFocus()),t=Q(()=>!0)(xe(window,"focus")),i=Q(()=>!1)(xe(window,"blur"));return Pe(e,t,i)}(),Ue);if(!t)return void Z(i,Fe(t=>{e.setApplicationState({pageFocused:t,applicationFocused:t})}));const n=(o=t,Z(Ae(()=>We(Promise.race([o.call("isFocused"),new Promise(e=>{return i="focus",n=e,void(t=o).on(i,(function e(o){t.off(i,e),n(o)}));var t,i,n})]))),je(e=>Z(ee(o,"focus"),te(e)))));var o;Z(i,Fe(i=>{e.setApplicationState({applicationFocused:i}),t.emit("focus",i)})),Z(Re(i,n),Ge(50),Q(mt),re(),Fe(t=>{e.setApplicationState({pageFocused:t})}))},gt=e=>"function"==typeof e.start&&"function"==typeof e.stop,ft=e=>{gt(e)?e.start(0):e.noteOn(0)},ht=()=>{const e=new(window.AudioContext||window.webkitAudioContext);let t=!0,i=[];const n=t=>new Promise((i,n)=>{e.decodeAudioData(t,i,n)}),o=t=>({play:()=>{const i=e.createBufferSource();i.connect(e.destination),i.buffer=t;return{playback:new Promise((t,n)=>{if(i.onended=()=>t(),ft(i),"running"!==e.state){const t=new Error("Playback failed, AudioContext is in incorrect state '"+e.state+"'");t.name="PlaybackError",n(t)}}),stop(){(e=>{gt(e)?e.stop(0):e.noteOff(0)})(i)}}}});return{preload:e=>(e=>new Promise((t,i)=>{const n=new XMLHttpRequest;n.onload=()=>{t(n.response)},n.onerror=i,n.open("GET",e),n.responseType="arraybuffer",n.send()}))(e).then(n).then(o),playSound:e=>{const n=e.play();return t&&i.push(n),n.playback},unlock:()=>new Promise(n=>{const o=()=>{document.removeEventListener("click",o,!0),t&&(i.forEach(e=>{e.stop()}),i=[],t=!1),e.resume(),(()=>{const t=e.createBuffer(1,1,22050),i=e.createBufferSource();i.buffer=t,i.connect(e.destination),ft(i)})(),n()};document.addEventListener("click",o,!0)})}},vt=/\.(\w+)$/i,wt=new Audio,yt={mp3:"audio/mpeg",ogg:"audio/ogg"},bt=e=>{const t=(e=>{const t=e.match(vt);return t?t[1].toLowerCase():""})(e);return t in yt&&""!==wt.canPlayType(yt[t])},zt=()=>"function"==typeof window.webkitAudioContext||"function"==typeof window.AudioContext,St=e=>new Promise((t,i)=>{const n=new Audio(e);n.onloadeddata=()=>{t(n)},n.onerror=i}),kt=e=>{const t=e.play();return(i=t)&&"function"==typeof i.then?t:Promise.resolve();var i},_t=()=>zt()?(()=>{const e=ht(),t=le(t=>{const i=e.preload(t);return i.catch(Le),i});return{play:i=>{const n=t(i).then(e.playSound);return n.catch(Le),n},preload:t,unlock:()=>e.unlock()}})():(()=>{const e=le(St);return{play:t=>e(t).then(kt),preload:e,unlock:()=>Promise.resolve()}})(),It=e=>{const t=_t(),i=(e=>Object.keys(e).reduce((t,i)=>{const n=v(e=>bt(e),S(e[i]));return t[i]=n,t},{}))(e);return{play:e=>{const n=i[e];t.play(n).then(Le,Le)},preload:e=>{const n=i[e];t.preload(n).then(Le,Le)},unlock:()=>t.unlock()}},Et=()=>{const e=It({new_message:["https://cdn.livechatinc.com/widget/static/media/new_message.CTorF0S8.ogg","https://cdn.livechatinc.com/widget/static/media/new_message.C32z5SiC.mp3"]});return e.unlock().then(()=>function(e,t){let i=0;return function(){const n=Date.now();n-i>=e&&(i=Date.now(),t(...arguments))}}(2e3,t=>{e.play(t)}))};function At(e,t,i,n,o,a){let{adapterOptions:r,props:{onError:s=Le,...l},onBootstrap:c=Le}=t;Promise.resolve().then(()=>{o({...r,model:n?n.model:{}},e,i,a);const t=i=>{let{readyState:o}=i;if(o===k)return;window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_sdk_ready"),e.off("set_application_state",t),e.getApplicationState("embedded")||(e=>{Z(ie(e,()=>e.localize("welcome_title")),Fe(e=>{document.title=e}))})(e),e.getApplicationState("embedded")&&!zt()||(e=>{let t=!1;e.on("bridge_sound_unlocked",()=>t=!0),Et().then(i=>{t||(e.emit("iframe_sound_unlocked"),e.on("add_event",t=>{let{event:n}=t;const{muted:o}=e.getApplicationState();if(o)return;((e,t)=>"system"!==e.author&&!e.properties.welcomeMessage&&e.author!==t&&"custom"!==e.type)(n,e.getSessionUserId())&&i("new_message")}),e.on("reaction_received",t=>{let{event:n}=t;const{muted:o}=e.getApplicationState();if(o)return;e.getSessionUserId()===n.author&&i("new_message")}))})})(e),_(e),nt(e),pt(e,n);const a=document.getElementById("root");ce(a,{...l,onError:(e,t)=>{let{componentStack:i}=t;z("react_error",e,{componentStack:i}),Me.render(null,a),s()},store:e},n,de),window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_bootstrap_end"),c(e)};e.on("set_application_state",t)})}const xt=(e,t,i)=>{const{organizationId:n}=t,{license:o,group:a,requestedGroup:r}=e,{language:s}=t.__unsafeProperties.group,l=pe({application:{organizationId:n,license:o,group:a,requestedGroup:r,region:t.region,rtl:ge(s),language:s,embedded:!1,mobileWrapper:d(),page:{title:document.title,url:String(document.location),referrer:document.referrer}}},{persistKey:i(e)}),{clientLimitExceededLifted:c}=l.getApplicationState(),u=!c&&t.clientLimitExceeded;return l.setApplicationState({visibility:{...l.getApplicationState("visibility"),state:"maximized"},clientLimitExceeded:u}),l.updateUser(l.getSessionUserId(),(()=>{const e=K(window.location.search),t=C(["name","email"],e);return e.params&&(t.properties=y(e=>String(e),X(e.params))),t})()),e.initialView&&!l.getCurrentView()&&l.setCurrentView(e.initialView),l};function Pt(e,t,i){window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_config_request");const{license:n,group:o,adapter:a}=e;var r;(r={licenseId:n,groupId:o,url:ue(String(document.location)),channelType:"direct_link"},x(r).then(e=>{const t=e.groupId;return Promise.all([e,P({organizationId:e.organizationId,licenseId:r.licenseId,groupId:t,region:e.region,version:e.configVersion})]).then(e=>{let[t,i]=e;return{...t,...i}})})).then(r=>{window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_server_config");const s=r.groupId,l=r.region,c=r.organizationId;me(r.__unsafeProperties.group.language);const d=xt({...e,group:s,requestedGroup:o},r,i);I({organizationId:c,licenseId:n,region:l,groupId:s,version:r.localizationVersion,language:r.__unsafeProperties.group.language}).then(d.setLocalization);const u={adapterOptions:{...e,organizationId:c,group:s,requestedGroup:o,region:l,mobile:E()},props:{},onBootstrap:t};A()&&(u.props.onMinimizeButtonPress=()=>d.emit("mobile_wrapper_minimize_intent")),At(d,u,r,null,a,n)})} /** @livechat/postmate - A powerful, simple, promise-based postMessage library @version v3.0.4 @link https://github.com/dollarshaveclub/postmate @author Jacob Kelley @license MIT **/var Ct="application/x-postmate-v1+json",Tt=0,Ot={handshake:1,"handshake-reply":1,call:1,emit:1,reply:1,request:1},Ft=function(e,t){return("string"!=typeof t||e.origin===t)&&(!!e.data&&("object"==typeof e.data&&("postmate"in e.data&&(e.data.type===Ct&&!!Ot[e.data.postmate]))))},Lt=function(){function e(e){var t=this;this.parent=e.parent,this.frame=e.frame,this.child=e.child,this.childOrigin=e.childOrigin,this.events={},this.listener=function(e){if(!Ft(e,t.childOrigin))return!1;var i=((e||{}).data||{}).value||{},n=i.data,o=i.name;"emit"===e.data.postmate&&o in t.events&&t.events[o].call(t,n)},this.parent.addEventListener("message",this.listener,!1)}var t=e.prototype;return t.get=function(e){var t=this;return new Nt.Promise((function(i){var n=++Tt;t.parent.addEventListener("message",(function e(o){o.data.uid===n&&"reply"===o.data.postmate&&(t.parent.removeEventListener("message",e,!1),i(o.data.value))}),!1),t.child.postMessage({postmate:"request",type:Ct,property:e,uid:n},t.childOrigin)}))},t.call=function(e,t){this.child.postMessage({postmate:"call",type:Ct,property:e,data:t},this.childOrigin)},t.on=function(e,t){this.events[e]=t},t.destroy=function(){window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame)},e}(),Mt=function(){function e(e){var t=this;this.model=e.model,this.parent=e.parent,this.parentOrigin=e.parentOrigin,this.child=e.child,this.child.addEventListener("message",(function(e){if(Ft(e,t.parentOrigin)){var i=e.data,n=i.property,o=i.uid,a=i.data;"call"!==e.data.postmate?function(e,t){var i="function"==typeof e[t]?e[t]():e[t];return Nt.Promise.resolve(i)}(t.model,n).then((function(t){return e.source.postMessage({property:n,postmate:"reply",type:Ct,uid:o,value:t},e.origin)})):n in t.model&&"function"==typeof t.model[n]&&t.model[n].call(t,a)}}))}return e.prototype.emit=function(e,t){this.parent.postMessage({postmate:"emit",type:Ct,value:{name:e,data:t}},this.parentOrigin)},e}(),Nt=function(){function e(e){var t=e.container,i=void 0===t?void 0!==i?i:document.body:t,n=e.model,o=e.url,a=e.iframeAllowedProperties;return this.parent=window,this.frame=document.createElement("iframe"),a&&(this.frame.allow=a),i.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=n||{},this.sendHandshake(o)}return e.prototype.sendHandshake=function(t){var i,n=this,o=function(e){var t=document.createElement("a");t.href=e;var i=t.protocol.length>4?t.protocol:window.location.protocol,n=t.host.length?"80"===t.port||"443"===t.port?t.hostname:t.host:window.location.host;return t.origin||i+"//"+n}(t),a=0;return new e.Promise((function(e,r){n.parent.addEventListener("message",(function t(a){return!!Ft(a,o)&&("handshake-reply"===a.data.postmate?(clearInterval(i),n.parent.removeEventListener("message",t,!1),n.childOrigin=a.origin,e(new Lt(n))):r("Failed handshake"))}),!1);var s=function(){a++,n.child.postMessage({postmate:"handshake",type:Ct,model:n.model},o),5===a&&clearInterval(i)},l=function(){s(),i=setInterval(s,500)};n.frame.attachEvent?n.frame.attachEvent("onload",l):n.frame.addEventListener("load",l),n.frame.src=t}))},e}();Nt.debug=!1,Nt.Promise=function(){try{return window?window.Promise:Promise}catch(e){return null}}(),Nt.Model=function(){function e(e){return this.child=window,this.model=e,this.parent=this.child.parent,this.sendHandshakeReply()}return e.prototype.sendHandshakeReply=function(){var e=this;return new Nt.Promise((function(t,i){e.child.addEventListener("message",(function n(o){if(o.data.postmate){if("handshake"===o.data.postmate){e.child.removeEventListener("message",n,!1),o.source.postMessage({postmate:"handshake-reply",type:Ct},o.origin),e.parentOrigin=o.origin;var a=o.data.model;return a&&Object.keys(a).forEach((function(t){e.model[t]=a[t]})),t(new Mt(e))}return i("Handshake Reply Failed")}}),!1)}))},e}();const Gt=Nt.Model;Nt.Model=function(){return function(e){const t=Ne(),i={};return e.resolveRemoteCall=e=>{let{id:t,value:n}=e;const o=i[t];delete i[t],o(n)},e.emitEvent=e=>{let{event:i,data:n}=e;t.emit(i,n)},new Gt(e).then(n=>(n.call=function(e){for(var t=arguments.length,o=new Array(t>1?t-1:0),a=1;a{const a=T(i);i[a]=t,n.emit("remote-call",{id:a,method:e,args:o})})},e.remoteCall=t=>{let{id:i,method:o,args:a}=t;const r="function"==typeof e[o]?e[o].apply(n,a):void 0;r&&"function"==typeof r.then?r.then(e=>{n.call("resolveRemoteCall",{id:i,value:e})}):n.call("resolveRemoteCall",{id:i,value:r})},n.on=t.on,n.off=t.off,n))}}();const Vt={minimizedContainerSize:void 0,minimizedVisibility:void 0,maximizedVisibility:void 0,viewAnimated:void 0,viewNotAnimated:void 0,resizeToDimensions:void 0},Dt={bar:{width:"281px",height:"63px"},bubble:{width:"84px",height:"84px"},bubblePulse:{width:"90px",height:"90px"},visitorCounter:{width:ve+"px",height:"95px"},mobileVisitorCounter:{width:"100%",height:"95px"},mobileGreetingFull:{width:"100%",height:"50%"},full:{width:"100%",height:"100%"},googleReviews:{width:we+"px",height:"130px"},mobileGoogleReviews:{width:"100%",height:"130px"},...ye},Rt=e=>/px$/.test(e)?Math.ceil(parseFloat(e))+"px":e,qt=e=>ie(e,e=>e.application.visibility.state),Wt=e=>{const t=Vt[e];t&&clearTimeout(t)},jt=(e,t)=>e.call("resize",(e=>({...e,width:Rt(e.width),height:Rt(e.height)}))(t)),Bt=(e,t)=>e.call("getMinimizedDimensions").then(i=>{"minimized"===t.getApplicationState().visibility.state&&jt(e,{...i,ignoreHorizontalOffset:t.getApplicationState("mobile")})}),Ht=(e,t,i)=>{let{transient:n}=i;Wt("minimizedContainerSize"),Wt("resizeToDimensions");const o=t.getApplicationState("mobile"),a=i=>{jt(e,i).then(()=>Bt(e,t))};if(O(t,"maximized"))return void jt(e,o?{...Dt.full,maximized:!0}:{...fe(t.getApplicationState().config.theme.name),maximized:!0});const r="bar"===c(t),s=!F(t),l=t.getApplicationState().config.theme.name,d=t.getApplicationState().defaultWidget,u=L(t),m=M(t),p=N(t),g=t.getView("minimized"),f=g.recommendations,h=()=>{var i;return(e=>{let{isBar:t,isMobile:i,isVisitorCounter:n,isGoogleReviews:o,isContactInvitation:a,isBubblePulse:r,hasGreeting:s,productRecommendationsState:l,themeName:c,callResize:d,resizeMinimizedWithGreeting:u,getWindowSizeForTheme:m,dimensions:p,defaultWidget:g,resizeToDimensions:f}=e;if("livechat"===g&&(i?s?u(p.mobileGreetingFull):d(t?p.bar:p.bubble):t?d(p.bar):s?u(m(c)):d(p.bubble)),"openwidget"===g){if(n)return void d({...i?p.mobileVisitorCounter:p.visitorCounter,ignoreHorizontalOffset:i});if(o)return void d({...i?p.mobileGoogleReviews:p.googleReviews,ignoreHorizontalOffset:i});if(l.visible||l.animation)return l.animation?void d({...i?p.mobileProductRecommendations:p.productRecommendations,ignoreHorizontalOffset:i}):void f();if(a)return void u(m("smooth"));if(r)return void d(p.bubblePulse);d(p.bubble)}})({isBar:r,isMobile:o,hasGreeting:s,isBubblePulse:g.showPulseAnimation,productRecommendationsState:{visible:!(null==f||!f.visible),animation:null!=(i=null==f?void 0:f.animation)?i:null},isVisitorCounter:u,isGoogleReviews:m,isContactInvitation:p,themeName:l,dimensions:Dt,resizeMinimizedWithGreeting:a,getWindowSizeForTheme:fe,defaultWidget:d,callResize:t=>jt(e,t),resizeToDimensions:()=>Bt(e,t)})};n?Vt.minimizedContainerSize=setTimeout(h,300):h()},Ut=(e,t,i)=>{let{transient:n}=i;if(Wt("minimizedVisibility"),Wt("maximizedVisibility"),O(t,"maximized"))e.call("applyFramesStyle",{minimizedFrameStyle:{display:"none"},maximizedFrameStyle:{display:"block"}}),G()&&(Vt.maximizedVisibility=setTimeout(()=>{e.call("applyFramesStyle",{minimizedFrameStyle:{},maximizedFrameStyle:{visibility:"visible"}})},V));else{const t=()=>{e.call("applyFramesStyle",{minimizedFrameStyle:{display:"block"},maximizedFrameStyle:{display:"none",...G()&&{visibility:"hidden"}}})};n?Vt.minimizedVisibility=setTimeout(t,300):t()}},Jt={faq:"FAQ","form-contact":"Form-contact","form-feedback":"Form-feedback","form-bugreport":"Form-bugreport",chat:"Chat"},Yt=(e,t,i)=>{e.hasChat(t)?be(e,t,i):Z(ie(e,e=>R(e,t)),Fe(n=>n&&be(e,t,i)))},Kt=(e,t)=>{const i=e.getApplicationState("defaultWidget"),n="openwidget"===i,o=((e,t)=>{if("chatbot"===t)throw new Error('Widget type "chatbot" is not supported.');const i="openwidget"===t,n="object"==typeof e&&null!==e?e:{},o=i?["feature","messageDraft"]:["messageDraft"];for(const r in n)if(!o.includes(r)){throw new Error((i?"OpenWidget:":"[LivechatWidget]")+" You cannot combine "+r+' argument with "maximize" method. You can only use: '+o.join(", "))}const a="messageDraft"in n&&"string"==typeof n.messageDraft?n.messageDraft:void 0;if(i){return{feature:"feature"in n&&"string"==typeof n.feature?n.feature:void 0,messageDraft:a}}return{messageDraft:a}})(t,i);n?((e,t)=>{var i;const{feature:n,messageDraft:o}=t;if(!n)return;if("string"!=typeof n)throw new Error("OpenWidget: Feature name must be a string.");const a=Jt[n];if(!a)throw new Error("OpenWidget: You cannot combine "+n+" feature with 'maximize' method. You can only use: "+Object.keys(Jt).join(", ")+".");const s=e.getView("Homescreen"),l=Ve(s),c=null==(i=s.features.livechat_integration)?void 0:i.enabled,d=c||l,u="Chat"===a;if(!e.getView(a)||u&&!d)throw new Error("OpenWidget: Feature "+n+" is not enabled.");if(u&&o){Yt(e,c?r:q,o)}e.setCurrentView(a)})(e,o):((e,t)=>{const{messageDraft:i}=t;i&&("Chat"!==e.getCurrentView()&&e.setCurrentView("Chat"),Yt(e,r,i))})(e,o)};const Xt=(e,t,i,n)=>{const o=e.getApplicationState("visibility");return n&&"maximized"!==o.state?{state:"hidden",forced:!0}:i?{state:"maximized"}:t?{state:"minimized"}:o};function $t(e,t,i){const{license:n,group:o,uniqueGroups:a,isIdentityProviderEnabled:s,adapter:l}=e,c=pe({application:{license:n,group:o}},{persistKey:i(e)}),d=function(e){return{hide(){O(e,"hidden")||e.setApplicationState({visibility:{state:"hidden",forced:!0}})},hideGreeting(){ze(e)},hideEyeCatcher(){Se(e)},isFocused:()=>!!document.hasFocus&&document.hasFocus(),maximize(t,i){try{Kt(e,i)}catch(r){return void console.error(r.message)}const n=t&&W(t,["click","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend"]),o=e.getApplicationState("visibility").interactionModality,a=n?o:"virtual";e.setApplicationState({visibility:{...e.getApplicationState("visibility"),state:"maximized",interactionModality:a}})},minimize(){e.setApplicationState({visibility:{...e.getApplicationState("visibility"),state:j(e)?"minimized":"hidden",interactionModality:"virtual"}})},startStateSync(){e.startStateSync(this)},storeMethod(t){let[i,...n]=t;e[i].apply(e,n)},logInfo(){B.apply(void 0,arguments)},logError(){z.apply(void 0,arguments)},logNotice(){H.apply(void 0,arguments)},crossFrameEvent(e,t){ke(e,{...JSON.parse(t),stopPropagation:Le,preventDefault:Le})},setInteractionModality(t){e.setApplicationState({visibility:{...e.getApplicationState("visibility"),interactionModality:t}})}}}(c);new Nt.Model(d).then(e=>Promise.all([e,c.syncing()])).then(i=>{let[d]=i;window.performance&&"function"==typeof window.performance.mark&&window.performance.mark("lc_postmate_ready");const{clientLimitExceeded:u,customer:m,requestedGroup:p,hidden:g,integrationName:f,isInCustomContainer:h,page:v,region:w,serverConfig:y,actingAsDirectLink:b,initMaximized:z,parentWidth:S,parentHeight:k,defaultWidget:_}=d.model,I=c.getApplicationState("mobile"),A="livechat"===_?y.__unsafeProperties.group.language:y.language,x=b||h||z,{organizationId:P}=y;me(A),c.updateUser(c.getSessionUserId(),m),c.setApplicationState({organizationId:P,clientLimitExceeded:!c.getApplicationState("clientLimitExceededLifted")&&u,actingAsDirectLink:b,embedded:!0,region:w,isInCustomContainer:h,mobileWrapper:null,page:v,rtl:ge(A),language:A,integrationName:f,requestedGroup:p,visibility:Xt(c,I,x,g),clientWidth:S,clientHeight:k,defaultWidget:_}),e.initialView&&!c.getCurrentView()&&c.setCurrentView(e.initialView);const C={onAnimationEnd:()=>c.emit("animation_end"),onError:()=>{d.call("kill")},onMinimizedRef:e=>{d.minimizedRef=e}};At(c,{adapterOptions:{organizationId:P,group:o,requestedGroup:p,region:w,uniqueGroups:a,mobile:E(),...s&&{identityProvider:()=>({getToken:()=>d.call("callIdentityProvider","getToken"),getFreshToken:()=>d.call("callIdentityProvider","getFreshToken"),hasToken:()=>d.call("callIdentityProvider","hasToken"),invalidate:()=>d.call("callIdentityProvider","invalidate")})}},props:C,onBootstrap:()=>{_e(d,c);const{visibility:e}=c.getApplicationState();(x||"hidden"!==e.state)&&d.call("show"),((e,t)=>{Z(qt(t),te(null),he,Te(e=>{let[t,i]=e;return"maximized"===t&&"minimized"===i}),Fe(()=>{Wt("viewNotAnimated");const i=e=>{t.updateView("minimized",{...t.getView("minimized"),animated:e}),t.emit("render-minimized")};i(!0);const{interactionModality:n}=t.getApplicationState("visibility");Vt.viewNotAnimated=setTimeout(()=>{i(!1),"keyboard"===n&&e.call("focusMinimized")},500)})),Z(qt(t),Je(1),Fe(()=>Ut(e,t,{transient:!0}))),Z(ie(t,e=>e.application.ready),Je(1),Te(Boolean),Fe(()=>requestAnimationFrame(()=>Ut(e,t,{transient:!0})))),Ut(e,t,{transient:!1})})(d,c),((e,t)=>{Z(qt(t),Je(1),Fe(()=>Ht(e,t,{transient:!0}))),Z(ie(t,e=>e.application.invitation.hiddenIds.length),Je(1),Fe(()=>Ht(e,t,{transient:!0}))),t.on("render-minimized",()=>Ht(e,t,{transient:!0})),e.on("minimized_frame_fonts_ready",()=>Ht(e,t,{transient:!1})),t.on("resize-request",i=>jt(e,i).then(()=>t.emit("resize-request-done"))),t.on("resize-to-dimensions",()=>Bt(e,t)),t.on("resize-to-theme-size",()=>{const i=t.getApplicationState().config.theme.name,n=t.getApplicationState("mobile");return jt(e,{...n?Dt.mobileGreetingFull:fe(i),ignoreHorizontalOffset:n}).then(()=>t.emit("resize-to-theme-size-done"))}),Ht(e,t,{transient:!1})})(d,c),((e,t)=>{Z(ie(t,e=>D(e,r)),Fe(i=>{const n=null==i?void 0:i.author;if(n&&t.hasUser(n)){const i=t.getUser(n),o=t.localize("embedded_new_message",{operator:i.name});e.call("setTitleNotification",o)}else e.call("setTitleNotification",null)}))})(d,c),"hidden"!==c.getApplicationState("visibility").state&&d.call("show"),t(c)}},y,d,l,n)})}const Qt=(e,t)=>t.filter(t=>Date.now()-t.t{try{const t=((e,t)=>{let i=t.filter(t=>t.id!==e);return i.length>=5&&(i=i.slice(0,4)),[].concat(i,[{id:e,t:Date.now()}])})(e,(()=>{const e=localStorage.getItem("@@lc_ids");if(!e)return;return JSON.parse(e)})()||[]);if((e=>{const t=JSON.stringify(e);localStorage.setItem("@@lc_ids",t)})(t),Math.random()<=1e-4){const e={d7:Qt(1008e4,t),d30:Qt(504e4,t),l:t.map(e=>e.id).join(",")};B("license_data",e)}}catch(t){}};var ei,ti;const ii=K(window.location.search),ni=b(),oi=null!=(ei=ii.organizationId)?ei:"",ai=U(ii),ri=u(),si=null!=(ti=ii.initial_view)?ti:null,li="1"===ii.custom_identity_provider;if(!ni&&!oi)throw new Error("No license found in the URL.");function ci(e,t){const i={license:ni,organizationId:oi,group:ai,uniqueGroups:ri,isIdentityProviderEnabled:li,initialView:si,adapter:e},n=lt(),o=e=>{e.setApplicationState({readyState:J}),li&&B("custom_identity_provider_enabled",{}),Zt(ni),n&&n.getLogs().then(e=>{B("iframe_vitals",$({...e,isEmbedded:!!ii.embedded}))})};ii.embedded?$t(i,o,t):Pt(i,o,t)}export{tt as a,Je as b,Ze as c,Ke as d,qe as e,We as f,et as h,ci as i,Ue as r,je as s,Qe as v};