import{k as e}from"./4.C_rgEAoe.chunk.js";import{g as t,z as n,w as r,u as a,q as i,n as o,k as s,r as u,c as l,A as c,e as d,p,f as h,B as f,v as g,C as m,t as _,D as b,E as v,s as D,F as y,l as w,i as C,G as E,a as k,_ as A,H as F,I as x,j as I,b as S,J as B,h as T}from"./5.D_uKc_ak.chunk.js";import{a as z,g as M,c as P,b as O,h as j,d as R,t as $}from"./6.D_CKFAbE.chunk.js";var q="__test_storage_support__",U=function(e){void 0===e&&(e="local");try{var t="session"===e?window.sessionStorage:window.localStorage;return t.setItem(q,"@@test"),"@@test"!==t.getItem(q)?!1:(t.removeItem(q),!0)}catch(n){return!1}},L=function(){var e=Object.create(null);return{getItem:function(t){var n=e[t];return"string"==typeof n?n:null},setItem:function(t,n){e[t]=n},removeItem:function(t){delete e[t]},clear:function(){e=Object.create(null)}}}();const N=t(e=>(t,n)=>{if(0!==t)return;if("function"!=typeof e)return n(0,()=>{}),void n(2);let r,a=!1;n(0,e=>{a||(a=2===e,a&&"function"==typeof r&&r())}),a||(r=e(e=>{a||n(1,e)},e=>{a||void 0===e||(a=!0,n(2,e))},()=>{a||(a=!0,n(2))}))});var V,H=function(e,t){return e===t};function Z(e){return void 0===e&&(e=H),function(t){return function(n,r){if(0===n){var a,i,o=!1;t(0,(function(t,n){0===t&&(i=n),1===t?o&&e(a,n)?i(1):(o=!0,a=n,r(1,n)):r(t,n)}))}}}}function G(e){return function(t){return function(n,r){if(0===n){var a,i=null,o=function(e,t){if(0!==e)return 1===e?(r(1,t),void i(1)):void(2===e&&(i=null));(i=t)(1)},s=function(e,t){2===e&&null!==i&&i(2,t),a(e,t)};t(0,(function(t,n){if(0===t)return a=n,void r(0,s);if(1!==t){if(2===t){if(r(2,n),null===i)return;i(2,n)}}else{if(null!==i)return;e(n)(0,o)}}))}}}}V="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")();var Y,W,J=("function"==typeof(W=V.Symbol)?W.observable?Y=W.observable:(Y=W("observable"),W.observable=Y):Y="@@observable",Y);const Q=n(Object.freeze(Object.defineProperty({__proto__:null,default:J},Symbol.toStringTag,{value:"Module"}))).default;const X=t(e=>(t,n)=>{if(0!==t)return;let r;n(0,e=>{2===e&&r&&(r.unsubscribe?r.unsubscribe():r())}),e=e[Q]?e[Q]():e,r=e.subscribe({next:e=>n(1,e),error:e=>n(2,e),complete:()=>n(2)})}),K=e=>(t,n)=>{if(0!==t)return;let r=!1;e.then(e=>{r||(n(1,e),r||n(2))},e=>{r||n(2,e)}),n(0,e=>{2===e&&(r=!0)})};const ee=t((function(...e){let t=e[0];for(let n=1,r=e.length;nt=>(n,r)=>{if(0!==n)return;let a;t(0,(t,n)=>{0===t?(a=n,r(0,(e,t)=>{0!==e&&a(e,t)}),r(1,e)):r(t,n)})});const ne=t(e=>t=>(n,r)=>{0===n&&t(0,(t,n)=>{r(t,1===t?e(n):n)})});function re(e){return t=>r(ne(e)(t))}var ae=function(){},ie={};function oe(e){var t,n,r=[],a=!1,i=ie;return function(o,s){if(0===o){if(i!==ie)return s(0,ae),a&&s(1,n),void s(2,i);r.push(s);var u=function(e,n){if(2!==e)i===ie&&t(e,n);else{var a=r.indexOf(s);-1!==a&&r.splice(a,1)}};1!==r.length?(s(0,u),a&&i===ie&&s(1,n)):e(0,(function(e,o){if(0===e)return t=o,void s(0,u);1===e&&(a=!0,n=o);var l=r.slice(0);2===e&&(i=o,r=null),l.forEach((function(t){t(e,o)}))}))}}}const se=t((function(){let e=[];return(t,n)=>{if(0===t){const t=n;e.push(t),t(0,n=>{if(2===n){const n=e.indexOf(t);n>-1&&e.splice(n,1)}})}else{const r=e.slice(0);for(let a,i=0,o=r.length;i-1&&a(t,n)}}})),ue={},le=e=>t=>(n,r)=>{if(0!==n)return;let a,i,o=!1,s=ue;t(0,(t,n)=>{if(0===t)return a=n,e(0,(e,t)=>0===e?(i=t,void i(1)):1===e?(s=void 0,i(2),a(2),void(o&&r(2))):void(2===e&&(i=null,t&&(s=t,a(2),o&&r(e,t))))),o=!0,r(0,(e,t)=>{s===ue&&(2===e&&i&&i(2),a(e,t))}),void(s!==ue&&r(2,s));2===t&&i(2),r(t,n)})},ce=(e,t,n)=>t=>(n,r)=>{0===n&&t(0,(t,n)=>{1===t&&void 0!==n&&e&&e(n),r(t,n)})};function de(e){const t=function(e){try{return window.localStorage}catch(t){return"SecurityError"===t.name&&e?e:U()?window.localStorage:L}}(e);return{setItem:(e,n)=>new Promise(r=>r(t.setItem(e,n))),getItem:e=>new Promise(n=>n(t.getItem(e))),removeItem:e=>new Promise(n=>n(t.removeItem(e)))}}function pe(e,t){return[].concat(...t.map(e))}function he(e){return"object"==typeof e&&null!==e&&!a(e)}function fe(t,n){return e(n).reduce((e,r)=>(e[r]=t(n[r]),e),{})}function ge(e){let t=e.trim();if(0===t.length)return"";if(1===t.length)return t.toLowerCase();if(/^[a-z\d]+$/.test(t))return t;return t!==t.toLowerCase()&&(t=function(e){let t=e,n=!1,r=!1,a=!1;for(let i=0;it.toUpperCase()),t}function me(e){return a(e)?e:[e]}function _e(t){return e(t).map(e=>[e,t[e]])}function be(e,t){for(let n=0;n=0;n--)if(e(t[n]))return t[n]}function ye(e,t,n){for(let r=t;r>=0;r--)if(e(n[r]))return r;return-1}function we(e,t){return ye(e,t.length-1,t)}function Ce(e,t){if(e<=0)return[];const n=[];for(;e--;)n.push(t);return n}function Ee(t,n){return e(n).forEach(e=>{t(n[e],e)})}function ke(){return Math.random().toString(36).substring(2)}function Ae(e){const t=ke();return i(t,e)?Ae(e):t}function Fe(e,t){const n="string"==typeof e?e.split("."):e;let r=0,a=t;for(;a&&r(t[n[e]]=n,t),{})}function Be(e){return e.length>0?e[e.length-1]:void 0}function Te(t,n){return e(n).reduce((e,r)=>(Object.defineProperty(e,t(r),{value:n[r],enumerable:!0}),e),{})}function ze(t,n){return e(n).reduce((e,r)=>(e[r]=t(n[r],r),e),{})}function Me(e,t){if(Ie(t))return e;const n={};return Ee((r,o)=>{if(i(o,t))if(he(e[o])&&he(t[o]))n[o]=Me(e[o],t[o]);else if(a(e[o])&&a(t[o])){const r=Math.max(e[o].length,t[o].length);n[o]=new Array(r);for(let a=0;a{i(r,n)||(n[r]=t[r])},t),n}function Pe(t){return e(t).map(e=>t[e])}function Oe(e,t){const n="function"==typeof e?e:t=>Fe(e,t);return(a(t)?[...t]:Pe(t)).sort((e,t)=>n(e)-n(t))}function je(t,n){return e(n).reduce((e,r)=>(t(n[r],r)||(e[r]=n[r]),e),{})}function Re(e,t){return je((t,n)=>-1!==e.indexOf(n),t)}function $e(e,t){return e.reduce((e,n)=>(e[n]=t[n],e),{})}function qe(t,n){return e(n).reduce((e,r)=>(t(n[r])&&(e[r]=n[r]),e),{})}function Ue(e,t){return e.reduce((e,n)=>(i(n,t)&&(e[n]=t[n]),e),{})}function Le(e,t){return t.filter(t=>!e(t))}function Ne(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function Ve(e,t){if(Ne(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let a=0;ae)break;a+=i.length+1,r.push(i)}return r.join(" ")+"..."}function Ze(e,t,n){const r=ye(t=>!e(t),t,n);return r===t?[]:n.slice(r+1,t+1)}function Ge(e,t){return e===t?0:e{const r=e(t);return-1===n.indexOf(r)&&(n.push(r),!0)})}function Qe(e,t,n){return[...n.slice(0,e),t,...n.slice(e+1,n.length)]}const Xe=/(?:[^:]+:\/\/)?([^/\s]+)/;function Ke(e){const t=e.match(Xe);return t&&t[1]}const et=(e,t)=>z(t)[e],tt=/^(?:https?:)?\/\/[^/]+\/([^?#]+)/,nt=e=>{const t=e.match(tt);return"/"+(t&&t[1]||"")},rt=/^((http(s)?:)?\/\/)/,at=e=>e.replace(rt,""),it=/^((http(s)?:)?\/\/)/,ot=e=>{const t=e.match(it);return t?t[2]:null},st=(e,t)=>{if(0===Object.keys(t).length)return e;const n=M(e),r=nt(e),a=P(e)?z(e):{},i=O({...a,...t});return e.indexOf("#")>-1?""+n+r+"?"+i+"#"+e.split("#")[1]:""+n+r+"?"+i},ut=(e,t)=>{if(-1===e.indexOf("?"))return e;const n=z(e);if(Ie(n))return e;if(Object.keys(n).every(e=>!t.includes(e)))return e;t.forEach(e=>delete n[e]);const[r]=e.split("?"),a=st(r,n);return e.indexOf("#")>-1?a+"#"+e.split("#")[1]:a},lt=e=>"https://"+at(e);function ct(e,t){return t=t||{},new Promise((function(n,r){var a=new XMLHttpRequest,i=[],o=[],s={},u=function(){return{ok:2==(a.status/100|0),statusText:a.statusText,status:a.status,url:a.responseURL,text:function(){return Promise.resolve(a.responseText)},json:function(){return Promise.resolve(a.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([a.response]))},clone:u,headers:{keys:function(){return i},entries:function(){return o},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var l in a.open(t.method||"get",e,!0),a.onload=function(){a.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){i.push(t=t.toLowerCase()),o.push([t,n]),s[t]=s[t]?s[t]+","+n:n})),n(u())},a.onerror=r,a.withCredentials="include"==t.credentials,t.headers)a.setRequestHeader(l,t.headers[l]);a.send(t.body||null)}))}const dt="accept_greeting",pt="cancel_greeting",ht="check_goals",ft="deactivate_chat",gt="delete_chat_properties",mt="delete_event_properties",_t="delete_thread_properties",bt="get_chat",vt="get_customer",Dt="get_form",yt="get_predicted_agent",wt="get_url_info",Ct="list_chats",Et="list_group_statuses",kt="list_threads",At="login",Ft="mark_events_as_seen",xt="resume_chat",It="send_event",St="send_rich_message_postback",Bt="send_sneak_peek",Tt="set_customer_session_fields",zt="start_chat",Mt="update_chat_properties",Pt="update_customer",Ot="update_customer_page",jt="update_event_properties",Rt="update_thread_properties",$t="upload_file",qt="file",Ut="filled_form",Lt="message",Nt="system_message",Vt="custom",Ht="chat_deactivated",Zt="customer_disconnected",Gt="customer_side_storage_updated",Yt="groups_status_updated",Wt="incoming_chat",Jt="incoming_event",Qt="incoming_typing_indicator",Xt="queue_position_updated",Kt="thread_properties_updated",en="user_added_to_chat",tn=Object.freeze(Object.defineProperty({__proto__:null,CHAT_DEACTIVATED:"chat_deactivated",CHAT_PROPERTIES_DELETED:"chat_properties_deleted",CHAT_PROPERTIES_UPDATED:"chat_properties_updated",CHAT_TRANSFERRED:"chat_transferred",CUSTOMER_DISCONNECTED:"customer_disconnected",CUSTOMER_SIDE_STORAGE_UPDATED:"customer_side_storage_updated",CUSTOMER_UPDATED:"customer_updated",EVENTS_MARKED_AS_SEEN:"events_marked_as_seen",EVENT_PROPERTIES_DELETED:"event_properties_deleted",EVENT_PROPERTIES_UPDATED:"event_properties_updated",EVENT_UPDATED:"event_updated",GREETING_ACCEPTED:"greeting_accepted",GREETING_CANCELED:"greeting_canceled",GROUPS_STATUS_UPDATED:"groups_status_updated",INCOMING_CHAT:"incoming_chat",INCOMING_EVENT:"incoming_event",INCOMING_GREETING:"incoming_greeting",INCOMING_MULTICAST:"incoming_multicast",INCOMING_RICH_MESSAGE_POSTBACK:"incoming_rich_message_postback",INCOMING_TYPING_INDICATOR:"incoming_typing_indicator",QUEUE_POSITION_UPDATED:"queue_position_updated",THREAD_PROPERTIES_DELETED:"thread_properties_deleted",THREAD_PROPERTIES_UPDATED:"thread_properties_updated",USER_ADDED_TO_CHAT:"user_added_to_chat",USER_REMOVED_FROM_CHAT:"user_removed_from_chat"},Symbol.toStringTag,{value:"Module"})),nn="customer";function rn(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const an=(e,t)=>{const n=function(n){const r=Object.create(n);r.action=(t,r)=>{const a={type:e,payload:t};r&&(a.meta=r),n.dispatch(a)};for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;oe,n},on=(e,t)=>{const n="REQUEST_"+e,r=an(e,t),a=function(e){for(var a=arguments.length,i=new Array(a>1?a-1:0),s=1;s{const{promise:s,resolve:u,reject:c}=rn();e.dispatch({type:n,payload:{...t,meta:a,resolve:u,reject:c}}),l=s,l.then(()=>{r(e,...i)},o)},t(u,...i),void 0===l)throw new Error("You forgot to call `action` handler in "+n+" creator.");return l};return a.toString=()=>n,{actionMethod:r,requestActionMethod:a}},sn=(e,t)=>{if("object"!=typeof e||null===e||Array.isArray(e))throw new Error("bindActionMethods expects a plain object with actionMethods as values.");return fe(e=>((e,t)=>function(){for(var n=arguments.length,r=new Array(n),a=0;a(t[void 0]&&console.warn(["Reducer contains an 'undefined' action type.","Have you misspelled a constant?"].join("\n")),function(n,r){return void 0===n&&(n=e),i(r.type,t)?t[r.type](n,r.payload):n}),ln=(e,t)=>{if("object"!=typeof e||null===e||Array.isArray(e))throw new Error("bindSelectors expects a plain object with selectors as values.");return fe(e=>((e,t)=>function(){for(var n=arguments.length,r=new Array(n),a=0;at.reduce((e,t)=>t(e,n),e)},dn=Object.freeze({success:!0}),pn=(e,t)=>{const n={id:t.id,authorId:t.author_id,createdAt:t.created_at,threadId:e,properties:t.properties||{}};return void 0!==t.custom_id&&(n.customId=t.custom_id),n},hn=(e,t)=>{let n,r,a,i;t.height>t.width?(n="height",r="width",a=t.height,i=t.width):(n="width",r="height",a=t.width,i=t.height);const o=e/a;return{[n]:Math.ceil(Math.min(a,e)),[r]:Math.ceil(Math.min(o*i,i))}},fn=(e,t)=>void 0!==t.width&&void 0!==t.height?((e,t)=>({...pn(e,t),type:"file",contentType:t.content_type,url:t.url,name:t.name,width:t.width,height:t.height,thumbnails:{default:{url:t.thumbnail_url,...hn(300,t)},high:{url:t.thumbnail2x_url,...hn(600,t)}},...t.alternative_text&&{alternativeText:t.alternative_text}}))(e,t):{...pn(e,t),type:"file",contentType:t.content_type,url:t.url,name:t.name},gn=e=>{const t={};if("string"==typeof e.title&&(t.title=e.title),"string"==typeof e.subtitle&&(t.subtitle=e.subtitle),e.image){const{image:n}=e;t.image={url:n.url,name:n.name,...n.alternative_text&&{alternativeText:n.alternative_text}}}return e.buttons&&(t.buttons=e.buttons.map(e=>{switch(e.type){case"message":case"copy":case"phone":return{type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,value:e.value,role:e.role||"default"};case"cancel":return{type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,role:e.role||"default"};case"url":{const t={type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,value:e.value,role:e.role||"default"};return e.target&&(t.target=e.target),t}case"webview":return{type:e.type,text:e.text,postbackId:e.postback_id,userIds:e.user_ids,value:e.value,role:e.role||"default"};default:return{text:e.text,postbackId:e.postback_id,userIds:e.user_ids,role:e.role||"default"}}})),t},mn=(e,t)=>{switch(t.type){case"file":return fn(e,t);case"form":return((e,t)=>({...pn(e,t),authorId:"system",type:"form",formId:t.form_id,fields:t.fields}))(e,t);case"filled_form":return((e,t)=>({...pn(e,t),type:"filled_form",formId:t.form_id,fields:t.fields.map(e=>{switch(e.type){case"group_chooser":{if(!e.answer)return e;const{group_id:t,...n}=e.answer;return{...e,answer:{...n,groupId:t}}}default:return e}})}))(e,t);case"message":return((e,t)=>({...pn(e,t),type:"message",text:t.text}))(e,t);case"rich_message":return((e,t)=>{switch(t.template_id){case"cards":case"quick_replies":case"sticker":return{...pn(e,t),type:"rich_message",template:t.template_id,elements:t.elements.map(gn)};default:return null}})(e,t);case"system_message":return((e,t)=>{const n={...pn(e,{...t,author_id:"system"}),type:"system_message",text:t.text,systemMessageType:t.system_message_type};return t.text_vars&&(n.textVars=t.text_vars),n})(e,t);case"custom":return((e,t)=>({...pn(e,t),type:"custom",...t.content&&{content:t.content}}))(e,t);default:return null}},_n=e=>({id:e.id,addon:e.addon||null,uniqueId:e.unique_id,displayedFirstTime:e.displayed_first_time,isExitIntent:e.is_exit_intent,accepted:e.accepted||!1,subtype:e.subtype||"greeting",event:mn(null,e.event),agent:{id:e.agent.id,name:e.agent.name,avatar:e.agent.avatar,jobTitle:e.agent.job_title,isBot:e.agent.is_bot||!1}}),bn=function(e){return void 0===e&&(e={}),e.group_ids?{groupIds:e.group_ids}:{}},vn=e=>fe(e=>e.events_seen_up_to?e.events_seen_up_to:null,Se("id",e)),Dn=(e,t)=>{const n=t.properties||{};return{id:t.id,chatId:e,active:t.active,access:bn(t.access),createdAt:t.created_at,userIds:t.user_ids,events:t.events.map(e=>mn(t.id,e)).filter(Boolean),properties:n,previousThreadId:t.previous_thread_id||null,nextThreadId:t.next_thread_id||null,queue:t.queue?Fn(t.queue):null}},yn=e=>({id:e.id,access:bn(e.access),users:e.users.map(xn),properties:e.properties||{},eventsSeenUpToMap:vn(e.users)}),wn=e=>{const t=Ue(["avatar","email","name"],e);return e.session_fields&&(t.sessionFields=e.session_fields.reduce((e,t)=>{const[n]=Object.keys(t);return e[n]=t[n],e},{})),t},Cn=e=>{const t=wn(e);return{id:e.id,type:"customer",...t,sessionFields:t.sessionFields||{}}},En=e=>{const{statistics:t}=e;return{...Cn(e),statistics:{chatsCount:t.chats_count,threadsCount:t.threads_count,visitsCount:t.visits_count,pageViewsCount:t.page_views_count,greetingsShownCount:t.greetings_shown_count,greetingsAcceptedCount:t.greetings_accepted_count}}},kn=e=>{const{agent:t,queue:n}=e;return{agent:{id:t.id,type:"agent",name:t.name,avatar:t.avatar,jobTitle:t.job_title,isBot:t.is_bot},queue:n}},An=e=>({position:e.position,waitTime:e.wait_time}),Fn=e=>({...An(e),queuedAt:e.queued_at}),xn=e=>{return"customer"===e.type?{...Cn(n=e),present:n.present}:{id:(t=e).id,type:"agent",name:t.name,avatar:t.avatar,jobTitle:t.job_title,present:t.present};var t,n},In=e=>"offline"===e?"offline":"online",Sn=e=>({chatId:e.chat_id,properties:e.properties}),Bn=e=>{const t={chatId:e.chat_id,threadId:e.thread_id,transferredTo:{...e.transferred_to.agent_ids&&{agentIds:e.transferred_to.agent_ids},...e.transferred_to.group_ids&&{groupIds:e.transferred_to.group_ids}},queue:e.queue?Fn(e.queue):null};return"manual"===e.reason?{...t,reason:e.reason,requesterId:e.requester_id}:{...t,reason:e.reason}},Tn=e=>({id:e.id,...wn(e)}),zn=e=>({chatId:e.chat_id,threadId:e.thread_id,eventId:e.event_id,properties:e.properties}),Mn=e=>({chatId:e.chat_id,threadId:e.thread_id,eventId:e.event_id,properties:e.properties}),Pn=e=>{const t=e.thread_id;return{chatId:e.chat_id,threadId:t,event:mn(t,e.event)}},On=e=>({chatId:e.chat_id,userId:e.user_id,seenUpTo:e.seen_up_to}),jn=e=>({uniqueId:e.unique_id}),Rn=e=>{const{chat:t}=e;return{chat:{...yn(t),thread:Dn(t.id,t.thread)}}},$n=e=>({chatId:e.chat_id,event:mn(e.thread_id,e.event)}),qn=e=>_n(e),Un=e=>({userId:e.user_id,chatId:e.chat_id,threadId:e.thread_id,eventId:e.event_id,postback:e.postback}),Ln=e=>{const{chat_id:t,typing_indicator:n}=e;return{chatId:t,typingIndicator:{authorId:n.author_id,isTyping:n.is_typing}}},Nn=e=>({chatId:e.chat_id,threadId:e.thread_id,queue:An(e.queue)}),Vn=e=>({chatId:e.chat_id,threadId:e.thread_id,properties:e.properties}),Hn=e=>({chatId:e.chat_id,threadId:e.thread_id,properties:e.properties}),Zn=e=>({chatId:e.chat_id,user:xn(e.user),present:e.user.present}),Gn=e=>({chatId:e.chat_id,userId:e.user_id,reason:e.reason}),Yn=e=>e.map(e=>{switch(e.type){case"group_chooser":return{...e,options:e.options.map(e=>{let{group_id:t,...n}=e;return{...n,groupId:t}})};case"rating":{const{comment_label:t,...n}=e;return{...n,commentLabel:t}}default:return e}}),Wn=e=>{const t=e.map((e,t)=>({...e,id:String(t)}));return Yn(t)},Jn=e=>{const t=!("id"in e.fields[0]);return{id:e.id,fields:t?Wn(e.fields):Yn(e.fields)}},Qn=e=>e.enabled?{...e,form:Jn(e.form)}:e,Xn=e=>{const t={url:e.url};return e.title&&(t.title=e.title),e.description&&(t.description=e.description),e.image_url&&(t.imageUrl="https://"+at(e.image_url),e.image_width&&e.image_height&&(t.imageWidth=e.image_width,t.imageHeight=e.image_height)),t},Kn=e=>{let{online_groups_ids:t,customer_groups:n}=e;if(!t)return"offline";return xe(n.monitoring.id,t)?"online":"offline"},er=e=>{const t=e.chats_summary.map(e=>{let{id:t,active:n,access:r,last_thread_created_at:a,last_thread_id:i,last_event_per_type:o,properties:s={},users:u}=e;const l={id:t,active:n,access:bn(r),properties:s,users:u.map(xn),lastThreadId:i||null,lastThreadCreatedAt:a||null,eventsSeenUpToMap:vn(u)};if(!o)return l;l.lastEventsPerType=fe(e=>mn(e.thread_id,e.event),o);const c=o,d=Be(Object.keys(c).map(e=>c[e]).sort((e,t)=>e.thread_id===t.thread_id?Ge(e.event.created_at,t.event.created_at):Ge(e.thread_created_at,t.thread_created_at)));return d&&l.lastEventsPerType&&(l.lastEvent=l.lastEventsPerType[d.event.type]),l});return{chatsSummary:Oe(e=>{var t;let{lastEvent:n,order:r}=e;return-1*(null!=(t=void 0!==n?n.timestamp:r)?t:0)},t),totalChats:e.total_chats,users:Je(e=>e.id,pe(e=>e.users,t)),previousPageId:e.previous_page_id||null,nextPageId:e.next_page_id||null}},tr=e=>e.groups_status,nr=(e,t)=>({threads:t.threads.map(t=>Dn(e.payload.chat_id,t)),previousPageId:t.previous_page_id||null,nextPageId:t.next_page_id||null}),rr=e=>{const{__priv_dynamic_config:t,chats:n,greeting:r}=e;return{dynamicConfig:t,customer:En(e.customer),availability:Kn(t),chats:n.map(t=>({id:t.chat_id,active:"has_active_thread"in t?t.has_active_thread:e.has_active_thread,hasUnreadEvents:t.has_unread_events})),...r&&{greeting:_n(r)}}},ar=e=>{switch(e.action){case"chat_deactivated":return{action:e.action,payload:{chatId:e.payload.chat_id}};case"chat_properties_deleted":return{action:e.action,payload:(t=e.payload,{chatId:t.chat_id,properties:t.properties})};case"chat_properties_updated":return{action:e.action,payload:Sn(e.payload)};case"chat_transferred":return{action:e.action,payload:Bn(e.payload)};case"customer_side_storage_updated":case"customer_disconnected":return{action:e.action,payload:e.payload};case"customer_updated":return{action:e.action,payload:Tn(e.payload)};case"event_properties_deleted":return{action:e.action,payload:zn(e.payload)};case"event_properties_updated":return{action:e.action,payload:Mn(e.payload)};case"event_updated":return{action:e.action,payload:Pn(e.payload)};case"events_marked_as_seen":return{action:e.action,payload:On(e.payload)};case"greeting_accepted":case"greeting_canceled":return{action:e.action,payload:jn(e.payload)};case"groups_status_updated":return{action:e.action,payload:e.payload};case"incoming_chat":return{action:e.action,payload:Rn(e.payload)};case"incoming_event":return{action:e.action,payload:$n(e.payload)};case"incoming_greeting":return{action:e.action,payload:qn(e.payload)};case"incoming_multicast":return{action:e.action,payload:e.payload};case"incoming_rich_message_postback":return{action:e.action,payload:Un(e.payload)};case"incoming_typing_indicator":return{action:e.action,payload:Ln(e.payload)};case"queue_position_updated":return{action:e.action,payload:Nn(e.payload)};case"thread_properties_deleted":return{action:e.action,payload:Vn(e.payload)};case"thread_properties_updated":return{action:e.action,payload:Hn(e.payload)};case"user_added_to_chat":return{action:e.action,payload:Zn(e.payload)};case"user_removed_from_chat":return{action:e.action,payload:Gn(e.payload)}}var t},ir=e=>{let{request:t,response:n}=e;switch(n.action){case"accept_greeting":case"cancel_greeting":case"delete_chat_properties":case"delete_event_properties":case"delete_thread_properties":return{action:n.action,payload:dn};case"get_chat":return{action:n.action,payload:(r=n.payload,{...yn(r),thread:r.thread?Dn(r.id,r.thread):null})};case"get_customer":return{action:n.action,payload:En(n.payload)};case"get_form":return{action:n.action,payload:Qn(n.payload)};case"get_predicted_agent":return{action:n.action,payload:kn(n.payload)};case"get_url_info":return{action:n.action,payload:Xn(n.payload)};case"list_chats":return{action:n.action,payload:er(n.payload)};case"list_group_statuses":return{action:n.action,payload:tr(n.payload)};case"list_threads":return{action:n.action,payload:nr(t,n.payload)};case"login":return{action:n.action,payload:rr(n.payload)};case"mark_events_as_seen":case"send_sneak_peek":case"set_customer_session_fields":case"send_rich_message_postback":case"update_chat_properties":case"update_customer":case"update_customer_page":case"update_event_properties":case"update_thread_properties":return{action:n.action,payload:dn}}var r},or=e=>({code:e.type.toUpperCase(),message:e.message});var sr,ur,lr,cr,dr,pr,hr,fr,gr,mr;function _r(){return mr?gr:(mr=1,gr=function(e){var t={};t.src_Any=(ur?sr:(ur=1,sr=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/)).source,t.src_Cc=(cr?lr:(cr=1,lr=/[\0-\x1F\x7F-\x9F]/)).source,t.src_Z=(pr?dr:(pr=1,dr=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/)).source,t.src_P=(fr?hr:(fr=1,hr=/[!-#%-\*,-/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E49\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/)).source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");return t.src_pseudo_letter="(?:(?![><|]|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|[><|]|"+t.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|[><|]|[()[\\]{}.,\"'?!\\-]).|\\[(?:(?!"+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-]).|\\.{2,3}[a-zA-Z0-9%/]|\\.(?!"+t.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+t.src_ZCc+").|\\!(?!"+t.src_ZCc+"|[!]).|\\?(?!"+t.src_ZCc+"|[?]).)+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|[><|]|\\(|"+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t})}function br(e){var t=Array.prototype.slice.call(arguments,1);return t.forEach((function(t){t&&Object.keys(t).forEach((function(n){e[n]=t[n]}))})),e}function vr(e){return Object.prototype.toString.call(e)}function Dr(e){return"[object Function]"===vr(e)}function yr(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var wr={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};var Cr={"http:":{validate:function(e,t,n){var r=e.slice(t);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,n){var r=e.slice(t);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?t>=3&&":"===e[t-3]||t>=3&&"/"===e[t-3]?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){var r=e.slice(t);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},Er="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function kr(e){var t=e.re=_r()(e.__opts__),n=e.__tlds__.slice();function r(e){return e.replace("%TLDS%",t.src_tlds)}e.onCompile(),e.__tlds_replaced__||n.push("a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]"),n.push(t.src_xn),t.src_tlds=n.join("|"),t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),"i");var a=[];function i(e,t){throw new Error('(LinkifyIt) Invalid schema "'+e+'": '+t)}e.__compiled__={},Object.keys(e.__schemas__).forEach((function(t){var n=e.__schemas__[t];if(null!==n){var r={validate:null,link:null};if(e.__compiled__[t]=r,"[object Object]"===vr(n))return!function(e){return"[object RegExp]"===vr(e)}(n.validate)?Dr(n.validate)?r.validate=n.validate:i(t,n):r.validate=function(e){return function(t,n){var r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}(n.validate),void(Dr(n.normalize)?r.normalize=n.normalize:n.normalize?i(t,n):r.normalize=function(e,t){t.normalize(e)});!function(e){return"[object String]"===vr(e)}(n)?i(t,n):a.push(t)}})),a.forEach((function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)})),e.__compiled__[""]={validate:null,normalize:function(e,t){t.normalize(e)}};var o=Object.keys(e.__compiled__).filter((function(t){return t.length>0&&e.__compiled__[t]})).map(yr).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),function(e){e.__index__=-1,e.__text_cache__=""}(e)}function Ar(e,t){var n=e.__index__,r=e.__last_index__,a=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=a,this.text=a,this.url=a}function Fr(e,t){var n=new Ar(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function xr(e,t){if(!(this instanceof xr))return new xr(e,t);var n;t||(n=e,Object.keys(n||{}).reduce((function(e,t){return e||wr.hasOwnProperty(t)}),!1)&&(t=e,e={})),this.__opts__=br({},wr,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=br({},Cr,e),this.__compiled__={},this.__tlds__=Er,this.__tlds_replaced__=!1,this.re={},kr(this)}xr.prototype.add=function(e,t){return this.__schemas__[e]=t,kr(this),this},xr.prototype.set=function(e){return this.__opts__=br(this.__opts__,e),this},xr.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,n,r,a,i,o,s,u;if(this.re.schema_test.test(e))for((s=this.re.schema_search).lastIndex=0;null!==(t=s.exec(e));)if(a=this.testSchemaAt(e,t[2],s.lastIndex)){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+a;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(u=e.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||u=0&&null!==(r=e.match(this.re.email_fuzzy))&&(i=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||ithis.__last_index__)&&(this.__schema__="mailto:",this.__index__=i,this.__last_index__=o)),this.__index__>=0},xr.prototype.pretest=function(e){return this.re.pretest.test(e)},xr.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},xr.prototype.match=function(e){var t=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(Fr(this,t)),t=this.__last_index__);for(var r=t?e.slice(t):e;this.test(r);)n.push(Fr(this,t)),r=r.slice(this.__last_index__),t+=this.__last_index__;return n.length?n:null},xr.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter((function(e,t,n){return e!==n[t-1]})).reverse(),kr(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,kr(this),this)},xr.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},xr.prototype.onCompile=function(){};var Ir=xr;const Sr=t(Ir);var Br={exports:{}},Tr=Br.exports=function(){function e(e,t,n){return n&&function(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r={exports:{}};function a(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}r.exports={defaults:{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1},getDefaults:a,changeDefaults:function(e){r.exports.defaults=e}};var i=/[&<>"']/,o=/[&<>"']/g,s=/[<>"']|&(?!#?\w+;)/,u=/[<>"']|&(?!#?\w+;)/g,l={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(e){return l[e]},d=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function p(e){return e.replace(d,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}var h=/(^|[^\[])\^/g,f=/[^\w:]/g,g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,m={},_=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,v=/^([^:]+:\/*[^/]*)[\s\S]*$/;function D(e,t){m[" "+e]||(_.test(e)?m[" "+e]=e+"/":m[" "+e]=y(e,"/",!0));var n=-1===(e=m[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(b,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(v,"$1")+t:e+t}function y(e,t,n){var r=e.length;if(0===r)return"";for(var a=0;a=0&&"\\"===n[a];)r=!r;return r?"|":" |"})).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length1;)1&t&&(n+=e),t>>=1,e+=e;return n+e},z=r.exports.defaults,M=I,P=x,O=w,j=S;function R(e,t,n){var r=t.href,a=t.title?O(t.title):null,i=e[1].replace(/\\([\[\]])/g,"$1");return"!"!==e[0].charAt(0)?{type:"link",raw:n,href:r,title:a,text:i}:{type:"image",raw:n,href:r,title:a,text:O(i)}}var $=function(){function e(e){this.options=e||z}var t=e.prototype;return t.space=function(e){var t=this.rules.block.newline.exec(e);if(t)return t[0].length>1?{type:"space",raw:t[0]}:{raw:"\n"}},t.code=function(e){var t=this.rules.block.code.exec(e);if(t){var n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:M(n,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var n=t[0],r=function(e,t){var n=e.match(/^(\s+)(?:```)/);if(null===n)return t;var r=n[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=r.length?e.slice(r.length):e})).join("\n")}(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim():t[2],text:r}}},t.heading=function(e){var t=this.rules.block.heading.exec(e);if(t){var n=t[2].trim();if(/#$/.test(n)){var r=M(n,"#");this.options.pedantic?n=r.trim():r&&!/ $/.test(r)||(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n}}},t.nptable=function(e){var t=this.rules.block.nptable.exec(e);if(t){var n={type:"table",header:P(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[],raw:t[0]};if(n.header.length===n.align.length){var r,a=n.align.length;for(r=0;r ?/gm,"");return{type:"blockquote",raw:t[0],text:n}}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){var n,r,a,i,o,s,u,l,c,d=t[0],p=t[2],h=p.length>1,f={type:"list",raw:d,ordered:h,start:h?+p.slice(0,-1):"",loose:!1,items:[]},g=t[0].match(this.rules.block.item),m=!1,_=g.length;a=this.rules.block.listItemStart.exec(g[0]);for(var b=0;b<_;b++){if(d=n=g[b],this.options.pedantic||(c=n.match(new RegExp("\\n\\s*\\n {0,"+(a[0].length-1)+"}\\S")))&&(o=n.length-c.index+g.slice(b+1).join("\n").length,f.raw=f.raw.substring(0,f.raw.length-o),d=n=n.substring(0,c.index),_=b+1),b!==_-1){if(i=this.rules.block.listItemStart.exec(g[b+1]),this.options.pedantic?i[1].length>a[1].length:i[1].length>=a[0].length||i[1].length>3){g.splice(b,2,g[b]+(!this.options.pedantic&&i[1].length/i.test(r[0])&&(t=!1),!n&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?n=!0:n&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(n=!1),{type:this.options.sanitize?"text":"html",raw:r[0],inLink:t,inRawBlock:n,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):O(r[0]):r[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var n=t[2].trim();if(!this.options.pedantic&&/^$/.test(n))return;var r=M(n.slice(0,-1),"\\");if((n.length-r.length)%2==0)return}else{var a=j(t[2],"()");if(a>-1){var i=(0===t[0].indexOf("!")?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,i).trim(),t[3]=""}}var o=t[2],s="";if(this.options.pedantic){var u=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);u&&(o=u[1],s=u[3])}else s=t[3]?t[3].slice(1,-1):"";return o=o.trim(),/^$/.test(n)?o.slice(1):o.slice(1,-1)),R(t,{href:o?o.replace(this.rules.inline._escapes,"$1"):o,title:s?s.replace(this.rules.inline._escapes,"$1"):s},t[0])}},t.reflink=function(e,t){var n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){var r=(n[2]||n[1]).replace(/\s+/g," ");if(!(r=t[r.toLowerCase()])||!r.href){var a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return R(n,r,n[0])}},t.emStrong=function(e,t,n){void 0===n&&(n="");var r=this.rules.inline.emStrong.lDelim.exec(e);if(r&&(!r[3]||!n.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var a=r[1]||r[2]||"";if(!a||a&&(""===n||this.rules.inline.punctuation.exec(n))){var i,o,s=r[0].length-1,u=s,l=0,c="*"===r[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+s);null!=(r=c.exec(t));)if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6])if(o=i.length,r[3]||r[4])u+=o;else if(!((r[5]||r[6])&&s%3)||(s+o)%3){if(!((u-=o)>0))return o=Math.min(o,o+u+l),Math.min(s,o)%2?{type:"em",raw:e.slice(0,s+r.index+o+1),text:e.slice(1,s+r.index+o)}:{type:"strong",raw:e.slice(0,s+r.index+o+1),text:e.slice(2,s+r.index+o-1)}}else l+=o}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var n=t[2].replace(/\n/g," "),r=/[^ ]/.test(n),a=/^ /.test(n)&&/ $/.test(n);return r&&a&&(n=n.substring(1,n.length-1)),n=O(n,!0),{type:"codespan",raw:t[0],text:n}}},t.br=function(e){var t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}},t.del=function(e){var t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2]}},t.autolink=function(e,t){var n,r,a=this.rules.inline.autolink.exec(e);if(a)return r="@"===a[2]?"mailto:"+(n=O(this.options.mangle?t(a[1]):a[1])):n=O(a[1]),{type:"link",raw:a[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}},t.url=function(e,t){var n;if(n=this.rules.inline.url.exec(e)){var r,a;if("@"===n[2])a="mailto:"+(r=O(this.options.mangle?t(n[0]):n[0]));else{var i;do{i=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(i!==n[0]);r=O(n[0]),a="www."===n[1]?"http://"+r:r}return{type:"link",raw:n[0],text:r,href:a,tokens:[{type:"text",raw:r,text:r}]}}},t.inlineText=function(e,t,n){var r,a=this.rules.inline.text.exec(e);if(a)return r=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(a[0]):O(a[0]):a[0]:O(this.options.smartypants?n(a[0]):a[0]),{type:"text",raw:a[0],text:r}},e}(),q=A,U=E,L=F,N={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:q,table:q,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};N.def=U(N.def).replace("label",N._label).replace("title",N._title).getRegex(),N.bullet=/(?:[*+-]|\d{1,9}[.)])/,N.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,N.item=U(N.item,"gm").replace(/bull/g,N.bullet).getRegex(),N.listItemStart=U(/^( *)(bull) */).replace("bull",N.bullet).getRegex(),N.list=U(N.list).replace(/bull/g,N.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+N.def.source+")").getRegex(),N._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",N._comment=/|$)/,N.html=U(N.html,"i").replace("comment",N._comment).replace("tag",N._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),N.paragraph=U(N._paragraph).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.blockquote=U(N.blockquote).replace("paragraph",N.paragraph).getRegex(),N.normal=L({},N),N.gfm=L({},N.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),N.gfm.nptable=U(N.gfm.nptable).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.gfm.table=U(N.gfm.table).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.pedantic=L({},N.normal,{html:U("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",N._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:q,paragraph:U(N.normal._paragraph).replace("hr",N.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",N.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var V={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:q,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/\_\_[^_*]*?\*[^_*]*?\_\_|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/\*\*[^_*]*?\_[^_*]*?\*\*|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:q,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~"};V.punctuation=U(V.punctuation).replace(/punctuation/g,V._punctuation).getRegex(),V.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,V.escapedEmSt=/\\\*|\\_/g,V._comment=U(N._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),V.emStrong.lDelim=U(V.emStrong.lDelim).replace(/punct/g,V._punctuation).getRegex(),V.emStrong.rDelimAst=U(V.emStrong.rDelimAst,"g").replace(/punct/g,V._punctuation).getRegex(),V.emStrong.rDelimUnd=U(V.emStrong.rDelimUnd,"g").replace(/punct/g,V._punctuation).getRegex(),V._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,V._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,V._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,V.autolink=U(V.autolink).replace("scheme",V._scheme).replace("email",V._email).getRegex(),V._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,V.tag=U(V.tag).replace("comment",V._comment).replace("attribute",V._attribute).getRegex(),V._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,V._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,V._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,V.link=U(V.link).replace("label",V._label).replace("href",V._href).replace("title",V._title).getRegex(),V.reflink=U(V.reflink).replace("label",V._label).getRegex(),V.reflinkSearch=U(V.reflinkSearch,"g").replace("reflink",V.reflink).replace("nolink",V.nolink).getRegex(),V.normal=L({},V),V.pedantic=L({},V.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:U(/^!?\[(label)\]\((.*?)\)/).replace("label",V._label).getRegex(),reflink:U(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",V._label).getRegex()}),V.gfm=L({},V.normal,{escape:U(V.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(n="x"+n.toString(16)),r+="&#"+n+";";return r}var K=function(){function t(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||G,this.options.tokenizer=this.options.tokenizer||new Z,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var t={block:Y.normal,inline:W.normal};this.options.pedantic?(t.block=Y.pedantic,t.inline=W.pedantic):this.options.gfm&&(t.block=Y.gfm,this.options.breaks?t.inline=W.breaks:t.inline=W.gfm),this.tokenizer.rules=t}t.lex=function(e,n){return new t(n).lex(e)},t.lexInline=function(e,n){return new t(n).inlineTokens(e)};var n=t.prototype;return n.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens},n.blockTokens=function(e,t,n){var r,a,i,o,s,u,l=this;for(void 0===t&&(t=[]),void 0===n&&(n=!0),this.options.pedantic&&(e=e.replace(/^ +$/gm,""));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((function(n){return!!(r=n.call(l,e,t))&&(e=e.substring(r.raw.length),t.push(r),!0)}))))if(r=this.tokenizer.space(e))e=e.substring(r.raw.length),r.type&&t.push(r);else if(r=this.tokenizer.code(e))e=e.substring(r.raw.length),(o=t[t.length-1])&&"paragraph"===o.type?(o.raw+="\n"+r.raw,o.text+="\n"+r.text):t.push(r);else if(r=this.tokenizer.fences(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.heading(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.nptable(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.hr(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.blockquote(e))e=e.substring(r.raw.length),r.tokens=this.blockTokens(r.text,[],n),t.push(r);else if(r=this.tokenizer.list(e)){for(e=e.substring(r.raw.length),i=r.items.length,a=0;a=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}(),n&&(r=this.tokenizer.paragraph(s)))o=t[t.length-1],u&&"paragraph"===o.type?(o.raw+="\n"+r.raw,o.text+="\n"+r.text):t.push(r),u=s.length!==e.length,e=e.substring(r.raw.length);else if(r=this.tokenizer.text(e))e=e.substring(r.raw.length),(o=t[t.length-1])&&"text"===o.type?(o.raw+="\n"+r.raw,o.text+="\n"+r.text):t.push(r);else if(e){var c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}throw new Error(c)}return t},n.inline=function(e){var t,n,r,a,i,o,s=e.length;for(t=0;t0)for(;null!=(u=this.tokenizer.rules.inline.reflinkSearch.exec(d));)p.includes(u[0].slice(u[0].lastIndexOf("[")+1,-1))&&(d=d.slice(0,u.index)+"["+J("a",u[0].length-2)+"]"+d.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(u=this.tokenizer.rules.inline.blockSkip.exec(d));)d=d.slice(0,u.index)+"["+J("a",u[0].length-2)+"]"+d.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(u=this.tokenizer.rules.inline.escapedEmSt.exec(d));)d=d.slice(0,u.index)+"++"+d.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;e;)if(l||(c=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((function(n){return!!(a=n.call(s,e,t))&&(e=e.substring(a.raw.length),t.push(a),!0)}))))if(a=this.tokenizer.escape(e))e=e.substring(a.raw.length),t.push(a);else if(a=this.tokenizer.tag(e,n,r))e=e.substring(a.raw.length),n=a.inLink,r=a.inRawBlock,(i=t[t.length-1])&&"text"===a.type&&"text"===i.type?(i.raw+=a.raw,i.text+=a.text):t.push(a);else if(a=this.tokenizer.link(e))e=e.substring(a.raw.length),"link"===a.type&&(a.tokens=this.inlineTokens(a.text,[],!0,r)),t.push(a);else if(a=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(a.raw.length),i=t[t.length-1],"link"===a.type?(a.tokens=this.inlineTokens(a.text,[],!0,r),t.push(a)):i&&"text"===a.type&&"text"===i.type?(i.raw+=a.raw,i.text+=a.text):t.push(a);else if(a=this.tokenizer.emStrong(e,d,c))e=e.substring(a.raw.length),a.tokens=this.inlineTokens(a.text,[],n,r),t.push(a);else if(a=this.tokenizer.codespan(e))e=e.substring(a.raw.length),t.push(a);else if(a=this.tokenizer.br(e))e=e.substring(a.raw.length),t.push(a);else if(a=this.tokenizer.del(e))e=e.substring(a.raw.length),a.tokens=this.inlineTokens(a.text,[],n,r),t.push(a);else if(a=this.tokenizer.autolink(e,X))e=e.substring(a.raw.length),t.push(a);else if(n||!(a=this.tokenizer.url(e,X))){if(o=e,this.options.extensions&&this.options.extensions.startInline&&function(){var t=1/0,n=e.slice(1),r=void 0;s.options.extensions.startInline.forEach((function(e){"number"==typeof(r=e.call(this,n))&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}(),a=this.tokenizer.inlineText(o,r,Q))e=e.substring(a.raw.length),"_"!==a.raw.slice(-1)&&(c=a.raw.slice(-1)),l=!0,(i=t[t.length-1])&&"text"===i.type?(i.raw+=a.raw,i.text+=a.text):t.push(a);else if(e){var h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}throw new Error(h)}}else e=e.substring(a.raw.length),t.push(a);return t},e(t,0,[{key:"rules",get:function(){return{block:Y,inline:W}}}]),t}(),ee=r.exports.defaults,te=k,ne=w,re=function(){function e(e){this.options=e||ee}var t=e.prototype;return t.code=function(e,t,n){var r=(t||"").match(/\S*/)[0];if(this.options.highlight){var a=this.options.highlight(e,r);null!=a&&a!==e&&(n=!0,e=a)}return e=e.replace(/\n$/,"")+"\n",r?'
'+(n?e:ne(e,!0))+"
\n":"
"+(n?e:ne(e,!0))+"
\n"},t.blockquote=function(e){return"
\n"+e+"
\n"},t.html=function(e){return e},t.heading=function(e,t,n,r){return this.options.headerIds?"'+e+"\n":""+e+"\n"},t.hr=function(){return this.options.xhtml?"
\n":"
\n"},t.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"},t.listitem=function(e){return"
  • "+e+"
  • \n"},t.checkbox=function(e){return" "},t.paragraph=function(e){return"

    "+e+"

    \n"},t.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},t.tablerow=function(e){return"\n"+e+"\n"},t.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"\n"},t.strong=function(e){return""+e+""},t.em=function(e){return""+e+""},t.codespan=function(e){return""+e+""},t.br=function(){return this.options.xhtml?"
    ":"
    "},t.del=function(e){return""+e+""},t.link=function(e,t,n){if(null===(e=te(this.options.sanitize,this.options.baseUrl,e)))return n;var r='"},t.image=function(e,t,n){if(null===(e=te(this.options.sanitize,this.options.baseUrl,e)))return n;var r=''+n+'":">"},t.text=function(e){return e},e}(),ae=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,n){return""+n},t.image=function(e,t,n){return""+n},t.br=function(){return""},e}(),ie=function(){function e(){this.seen={}}var t=e.prototype;return t.serialize=function(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},t.getNextSafeSlug=function(e,t){var n=e,r=0;if(this.seen.hasOwnProperty(n)){r=this.seen[e];do{n=e+"-"+ ++r}while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=r,this.seen[n]=0),n},t.slug=function(e,t){void 0===t&&(t={});var n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)},e}(),oe=re,se=ae,ue=ie,le=r.exports.defaults,ce=C,de=K,pe=function(){function e(e){this.options=e||le,this.options.renderer=this.options.renderer||new oe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new se,this.slugger=new ue}e.parse=function(t,n){return new e(n).parse(t)},e.parseInline=function(t,n){return new e(n).parseInline(t)};var t=e.prototype;return t.parse=function(e,t){void 0===t&&(t=!0);var n,r,a,i,o,s,u,l,c,d,p,h,f,g,m,_,b,v,D,y="",w=e.length;for(n=0;n0&&"text"===m.tokens[0].type?(m.tokens[0].text=v+" "+m.tokens[0].text,m.tokens[0].tokens&&m.tokens[0].tokens.length>0&&"text"===m.tokens[0].tokens[0].type&&(m.tokens[0].tokens[0].text=v+" "+m.tokens[0].tokens[0].text)):m.tokens.unshift({type:"text",text:v}):g+=v),g+=this.parse(m.tokens,f),c+=this.renderer.listitem(g,b,_);y+=this.renderer.list(c,p,h);continue;case"html":y+=this.renderer.html(d.text);continue;case"paragraph":y+=this.renderer.paragraph(this.parseInline(d.tokens));continue;case"text":for(c=d.tokens?this.parseInline(d.tokens):d.text;n+1An error occurred:

    "+ve(u.message+"",!0)+"
    ";throw u}}return Ce.options=Ce.setOptions=function(e){return _e(Ce.defaults,e),ye(Ce.defaults),Ce},Ce.getDefaults=De,Ce.defaults=we,Ce.use=function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;rAn error occurred:

    "+ve(r.message+"",!0)+"
    ";throw r}},Ce.Parser=pe,Ce.parser=pe.parse,Ce.Renderer=fe,Ce.TextRenderer=ge,Ce.Lexer=de,Ce.lexer=de.lex,Ce.Tokenizer=he,Ce.Slugger=me,Ce.parse=Ce,Ce}();const zr=t(Tr),Mr=new Sr,{map:Pr}=Array.prototype,Or=["A","UL","OL","LI","STRONG","EM","BR","DEL","CODE","PRE"],jr=new Tr.Renderer;jr.link=function(e,t,n){const r=Mr.match(n);return r&&r.length>1?n:'
    '+n+""};const Rr=new Tr.Renderer;Object.assign(Rr,jr),Rr.list=function(e,t,n){let r=n;return e.replace($r,()=>t?r+++". ":"- ")},Rr.listitem=function(e){return""+$r+e};const $r="%list-item%",qr=e=>e.replace(/\n+$/,"");function Ur(e,t,n){if(function(e,t){let n=e.parentNode;for(;n;){if(n.nodeName===t)return!0;n=n.parentNode}return!1}(e,"A"))return e.textContent;if(null===e.textContent)return null;const r=Mr.match(e.textContent);if(!r||0===r.length)return e.textContent;const[a]=Array.from(r).reduce((t,a,i)=>{let[o,s]=t;return o.push(e.textContent.slice(s,a.index),u.createElement(null!=n?n:"a",{href:a.url,target:"_blank",rel:"nofollow noopener"},a.text)),i===r.length-1&&o.push(e.textContent.slice(a.lastIndex)),[o,a.lastIndex]},[[],0]);return u.createElement(u.Fragment,{key:t},...a)}function Lr(e){const t=zr(e,{renderer:Rr}),n=new DOMParser,{body:r}=n.parseFromString(t,"text/html");return r?qr(r.textContent||""):""}const Nr=e=>{var t,n;let{template:r,root:a,preserveLists:i,limit:o,linkComponent:s=null}=e;const l=null!=(t=null==a?void 0:a.props)?t:{},c=null!=(n=null==a?void 0:a.component)?n:u.Fragment,d=u.useMemo(()=>{try{const e=new DOMParser,t=qr(zr(r,i?{renderer:Rr}:{renderer:jr})),{body:n}=e.parseFromString(t,"text/html");return n?function(e,t,n){let r=0,a=!1;const i=e=>Pr.call(e,(e,o)=>{if("#text"===e.nodeName)return n?a?null:e.textContent&&e.textContent.length+r{let{id:t,serverId:n=null,active:r=!0,participants:a=[],properties:i}=e;if("string"!=typeof t)throw new Error("Chat ID has to be a string.");if(null!==n&&t!==n)throw new Error('If serverId is given ("'+n+'") it should match id ("'+t+'").');return{id:t,serverId:n,active:r,participants:a,properties:i}},Zr=e=>{let{id:t,type:n,author:r,timestamp:a,own:i,serverId:o=null,thread:s=null,serverTimestamp:u=null,delivered:l=!0,seen:c=!1,failed:d=!1,properties:p={}}=e;if("string"!=typeof t)throw new Error("Event ID has to be a string.");if("string"!=typeof n)throw new Error("Event has to have string `type` property.");if(null!==o&&t!==o)throw new Error('If serverId is given ("'+o+'") it should match id ("'+t+'").');return{id:t,serverId:o,type:n,thread:s,author:r,own:i,timestamp:a,serverTimestamp:u,delivered:l,seen:c,failed:d,properties:p}},Gr=e=>{let{id:t,serverId:n=t,type:r=null,name:a=null,email:i=null,avatar:o=null,properties:s={}}=e;if("string"!=typeof t)throw new Error("User ID has to be a string.");return{id:t,serverId:n,type:r,name:a,email:i,avatar:o,properties:s}};function Yr(e,t){return e===t}function Wr(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,a=0;a1&&void 0!==arguments[1]?arguments[1]:Yr,n=null,r=null;return function(){return Wr(t,n,arguments)||(r=e.apply(null,arguments)),n=arguments,r}}function Qr(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var n=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return t}var Xr=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:{},a=void 0,i=void 0;"function"==typeof n?(console.warn('[re-reselect] Deprecation warning: "selectorCreator" argument is discouraged and will be removed in the upcoming major release. Please use "options.selectorCreator" instead.'),a=new r,i=n):(a=n.cacheObject||new r,i=n.selectorCreator||Xr);var o=function(){var n=e.apply(void 0,arguments);if("string"==typeof n||"number"==typeof n){var r=a.get(n);return void 0===r&&(r=i.apply(void 0,t),a.set(n,r)),r.apply(void 0,arguments)}};return o.getMatchingSelector=function(){var t=e.apply(void 0,arguments);return a.get(t)},o.removeMatchingSelector=function(){var t=e.apply(void 0,arguments);a.remove(t)},o.clearCache=function(){a.clear()},o.resultFunc=t[t.length-1],o}}const ta=(e,t)=>t,na=(e,t)=>Fe(t.replace(/\//gi,"."),e.views),ra=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.views.current,ia=e=>e.session.connectionState,oa=e=>e.entities.chats.byIds,sa=(e,t)=>oa(e)[t],ua=(e,t,n)=>sa(e,t).events.byIds[n],la=(e,t,n)=>ua(e,t,sa(e,t).events.serverIdsMapping[n]),ca=(e,t,n)=>!!ua(e,t,n),da=(e,t)=>sa(e,t).events.byIds,pa=ea([(e,t)=>sa(e,t).events.orderedIds,da],(e,t)=>e.map(e=>t[e]))(ta),ha=ea([sa,pa],(e,t)=>({...e,events:t}))(ta),fa=(e,t)=>!!sa(e,t),ga=e=>fe(t=>{let{id:n}=t;return ha(e,n)},oa(e)),ma=e=>e.entities.users.byIds,_a=e=>ma(e)[(e=>e.session.id)(e)],ba=(e,t)=>ma(e)[t],va=(e,t)=>!!ba(e,t),Da=(e,t)=>{var n;return null==(n=e.views)?void 0:n.Chat[t].timeline},ya=e=>_a(e).id,wa=ea([pa,ya],(e,t)=>De(e=>{let{delivered:n,author:r}=e;return n&&r===t},e))(ta),Ca=ea([pa,ya],(e,t)=>De(e=>{let{seen:n,author:r}=e;return n&&r===t},e))(ta),Ea={boosters:!0,form:!0,system_message:!0},ka=Xr([pa,e=>_a(e).id],(e,t)=>we(e=>{const n=e.author===t&&"message"===e.type,r=!!e.properties&&"file"===e.properties.serverType,a=!0===e.seen&&!Ea[e.type]&&Boolean(e.serverId);return n&&!r||a},e)),Aa=(e,t)=>e.author!==t&&!e.seen&&!Ea[e.type],Fa=(e,t)=>{const n=ka(e,t),r=_a(e).id;return pa(e,t).slice(n+1).filter(e=>Aa(e,r))},xa=(e,t)=>Be(Fa(e,t)),Ia=ea([(e,t)=>sa(e,t).participants,ma],(e,t)=>e.map(e=>t[e]))(ta);function Sa(e,t){if(void 0===t)return e.application;const n=t;return e.application[n]}const Ba=Object.freeze(Object.defineProperty({__proto__:null,getApplicationState:Sa,getChat:ha,getChatByServerId:(e,t)=>ha(e,e.entities.chats.serverIdsMapping[t]),getChatList:e=>{var t;return null==(t=e.views)?void 0:t.ChatList},getChats:ga,getConnectionState:ia,getCurrentView:aa,getDefaultView:ra,getEvent:ua,getEventByServerId:la,getEvents:pa,getIndexedEvents:da,getLastDeliveredEvent:wa,getLastEvent:(e,t)=>Be(pa(e,t)),getLastSeenAgentEvent:(e,t)=>{const n=ka(e,t);if(-1===n)return null;const r=_a(e).id;return be(e=>Aa(e,r),pa(e,t).slice(n+1))},getLastSeenEvent:Ca,getLastUnseenEvent:xa,getParticipants:Ia,getSessionUser:_a,getSessionUserId:ya,getTimeline:Da,getUnseenCount:(e,t)=>Fa(e,t).length,getUser:ba,getUserByServerId:(e,t)=>ba(e,e.entities.users.serverIdsMapping[t]),getUsers:ma,getView:na,hasChat:fa,hasEvent:ca,hasEventByServerId:(e,t,n)=>!!la(e,t,n),hasUser:va,localize:(e,t,n,r)=>{let a=e.localization[t];const i=e.application.language;if(void 0===a)return"";if("object"==typeof a&&i){const e=new Intl.PluralRules(i);if(void 0===r)return a[e.select(1)];const t=e.select(r);if(!(t in a))return"";a=a[t]}return n?Object.keys(n).reduce((e,t)=>e.replace(new RegExp("%"+t+"%","g"),n[t]),a):a}},Symbol.toStringTag,{value:"Module"})),Ta=["delivered","failed","properties","seen","serverTimestamp","thread"],za=(e,t)=>e.forEach(e=>{if(i(e,t))throw new Error("Updating `"+e+"` property is not possible.")}),Ma=an("ADD_VIEW",(function(e,t,n){let{action:r,getState:a}=e;if(void 0===n&&(n={}),na(a(),t))throw new Error('There is already the "'+t+'" view. It has to be unique.');return r({name:t,data:n}),na(a(),t)})),Pa=an("SET_CURRENT_VIEW",(e,t)=>{let{action:n,getState:r}=e;if(!na(r(),t)){const e=ra(r());if(!e)throw new Error('Given view "'+t+"\" doesn't exist.");return n({name:e}),aa(r())}return n({name:t}),aa(r())}),Oa=an("UPDATE_VIEW",(e,t,n)=>{let{action:r,getState:a}=e;if(!na(a(),t))throw new Error('There is no "'+t+'" view. You should add it first.');return r({name:t,data:n}),na(a(),t)}),ja=an("SET_DEFAULT_VIEW",(e,t,n)=>{let{action:r,getState:a}=e;return r({name:n,path:t}),na(a(),t+"/"+n)}),Ra=an("ADD_CHAT",(e,t)=>{let{action:n,getState:r}=e;const{events:a=[],...i}=t;if(i.id&&fa(r(),i.id))throw new Error('There is already a chat with "'+i.id+'" ID. It has to be unique.');const o=be(e=>!va(r(),e),a.map(e=>e.author).concat(i.participants||[]));if(o)throw new Error('Given user ("'+o+"\") doesn't exist. You should add it first.");const s=i.id||Ae(ga(r()));return n({id:s,chat:Hr({...i,id:s}),events:a.map(Zr)}),ha(r(),s)}),$a=an("ADD_EVENT",(e,t,n)=>{var r;let{action:a,getState:i}=e;const{id:o,serverId:s}=n,u=i();if(!o||!s||o===s){if(!fa(u,t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!ca(u,t,o)){if(!va(u,n.author))throw new Error('Specified author ("'+n.author+"\") doesn't exist. You should add it first.");return a({id:o,chat:t,event:Zr({...n,timestamp:null!=(r=n.timestamp)?r:Date.now(),own:n.author===ya(u)})}),ua(i(),t,o)}}}),qa=an("REMOVE_EVENT",(e,t,n)=>{let{action:r,getState:a}=e;const i=a();if(!fa(i,t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!ca(i,t,n))throw new Error('There is no event with "'+n+'" ID in this chat ("'+t+'").');r({id:n,chat:t})}),Ua=an("ADD_HISTORY_EVENTS",(e,t,n)=>{let{action:r,getState:a}=e;const i=a();if(!fa(i,t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');n.forEach(e=>{if(ca(i,t,e.id))throw new Error('There is already an event with "'+e.id+'" ID in this chat ("'+t+'"). It has to be unique.');if(!va(i,e.author))throw new Error('Specified author ("'+e.author+"\") doesn't exist. You should add it first.")});const o=ya(i);r({chat:t,events:n.map(e=>Zr({...e,serverId:e.id,own:e.author===o}))})}),La=an("ADD_PARTICIPANT",(e,t,n)=>{let{action:r,getState:a}=e;if(!fa(a(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!va(a(),n))throw new Error('Given user ("'+n+"\") doesn't exist. You should add it first.");return r({chat:t,user:n}),Ia(a(),t)}),Na=an("ADD_USER",(e,t)=>{let{action:n,getState:r}=e;const{id:a}=t;if(va(r(),a))throw new Error('There is already a user with "'+a+'" ID. It has to be unique.');return n({id:a,user:Gr(t)}),ba(r(),a)}),Va=an("FLUSH_CHAT",(e,t)=>{let{action:n,getState:r}=e;if(!fa(r(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');return n({id:t}),ha(r(),t)}),Ha=an("RECALCULATE_TIMELINE",(e,t)=>{let{action:n,getState:r}=e;if(!fa(r(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');return n({id:t}),Da(r(),t)}),Za=an("REMOVE_PARTICIPANT",(e,t,n)=>{let{action:r,getState:a}=e;if(!fa(a(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!va(a(),n))throw new Error('Given user ("'+n+"\") doesn't exist. You should add it first.");return r({chat:t,user:n}),Ia(a(),t)}),Ga=an("SEND_EVENT",(e,t,n,r)=>{let{action:a,getState:i}=e;if(!fa(i(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(ca(i(),t,n.id))throw new Error('There is already an event with "'+n.id+'" ID in this chat ("'+t+'"). It has to be unique.');const o=n.id||Ae(da(i(),t));return a({id:o,chat:t,event:Zr({...n,author:_a(i()).id,own:!0,id:o,timestamp:Date.now(),delivered:!1})},r),ua(i(),t,o)}),Ya=an("SET_APPLICATION_STATE",(e,t)=>{let{action:n,getApplicationState:r}=e;if(!t||Ie(t))throw new Error("Given data object is empty.");return n(t),r()}),Wa=an("UPDATE_FEATURE",(e,t,n)=>{let{action:r,getApplicationState:a}=e;if(!n||!t||Ie(n))throw new Error("Given data object is empty.");return r({feature:t,data:n}),a()}),Ja=an("SET_CONNECTION_STATE",(e,t)=>{let{action:n,getState:r}=e;return n({connectionState:t}),ia(r())}),Qa=an("SET_CHAT_SERVER_ID",(e,t,n)=>{let{action:r,getState:a}=e;if(!fa(a(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(null!==ha(a(),t).serverId)throw new Error('Chat with "'+t+'" ID has already serverId.');return r({id:t,serverId:n}),ha(a(),t)}),Xa=an("SET_EVENT_DATA",(e,t,n,r)=>{let{action:a,getState:i}=e;if(!fa(i(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!ca(i(),t,n))throw new Error('There is no "'+n+'" event in "'+t+'" chat. You should add it first.');return za(["id","type","own"],r),a({chat:t,id:n,data:{...Ue(Ta.concat("author","serverId","timestamp"),r),own:r.author===ya(i())}}),ua(i(),t,n)}),Ka=an("SET_EVENT_SERVER_ID",(e,t,n,r)=>{let{action:a,getState:i}=e;if(!fa(i(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!ca(i(),t,n))throw new Error('There is no "'+n+'" event in "'+t+'" chat. You should add it first.');if(null!==ua(i(),t,n).serverId)throw new Error('Event with "'+n+'" ID has already serverId.');return a({chat:t,id:n,serverId:r}),ua(i(),t,n)}),ei=an("SET_LOCALIZATION",(e,t)=>{let{action:n}=e;n(t)}),ti=an("SET_USER_SERVER_ID",(e,t,n)=>{let{action:r,getState:a}=e;if(!va(a(),t))throw new Error('There is no "'+t+'" user. You should add it first.');if(null!==ba(a(),t).serverId)throw new Error('User with "'+t+'" ID has already serverId.');return r({id:t,serverId:n}),ba(a(),t)}),{actionMethod:ni,requestActionMethod:ri}=on("SET_USER_PROPERTIES",(e,t,n)=>{let{action:r,getState:a}=e;if(!va(a(),t))throw new Error('There is no user with "'+t+'" ID. You should add it first.');return r({id:t,properties:n}),ba(a(),t)}),{actionMethod:ai,requestActionMethod:ii}=on("UPDATE_CHAT",(e,t,n,r)=>{let{action:a,getState:i}=e;if(!fa(i(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');return za(["id","participants","events"],n),a({id:t,data:Ue(["active","properties"],n)},r),ha(i(),t)}),{actionMethod:oi,requestActionMethod:si}=on("UPDATE_EVENT",(e,t,n,r)=>{let{action:a,getState:i}=e;if(!fa(i(),t))throw new Error('There is no chat with "'+t+'" ID. You should add it first.');if(!ca(i(),t,n))throw new Error('There is no "'+n+'" event in "'+t+'" chat. You should add it first.');return za(["id","type","author","own","timestamp"],r),a({chat:t,id:n,data:Ue(Ta,r)}),ua(i(),t,n)}),{actionMethod:ui,requestActionMethod:li}=on("UPDATE_USER",(e,t,n)=>{let{action:r,getState:a}=e;if(!va(a(),t))throw new Error('There is no user with "'+t+'" ID. You should add it first.');return za(["id","type"],n),r({id:t,data:Ue(["name","email","avatar","properties"],n)}),ba(a(),t)}),ci=Object.freeze(Object.defineProperty({__proto__:null,addChat:Ra,addEvent:$a,addHistoryEvents:Ua,addParticipant:La,addUser:Na,addView:Ma,flushChat:Va,recalculateTimeline:Ha,removeEvent:qa,removeParticipant:Za,requestSetUserProperties:ri,requestUpdateChat:ii,requestUpdateEvent:si,requestUpdateUser:li,sendEvent:Ga,setApplicationState:Ya,setChatServerId:Qa,setConnectionState:Ja,setCurrentView:Pa,setDefaultView:ja,setEventData:Xa,setEventServerId:Ka,setLocalization:ei,setUserProperties:ni,setUserServerId:ti,updateChat:ai,updateEvent:oi,updateFeature:Wa,updateUser:ui,updateView:Oa},Symbol.toStringTag,{value:"Module"}));function di(){}function pi(){}pi.resetWarningCache=di;!function(){function e(e,t,n,r,a,i){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==i){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:pi,resetWarningCache:di};n.PropTypes=n}();var hi=function(e){e()},fi=function(){return hi},gi={exports:{}},mi={}; /** @license React v16.7.0 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ Object.defineProperty(mi,"__esModule",{value:!0});var _i="function"==typeof Symbol&&Symbol.for,bi=_i?Symbol.for("react.element"):60103,vi=_i?Symbol.for("react.portal"):60106,Di=_i?Symbol.for("react.fragment"):60107,yi=_i?Symbol.for("react.strict_mode"):60108,wi=_i?Symbol.for("react.profiler"):60114,Ci=_i?Symbol.for("react.provider"):60109,Ei=_i?Symbol.for("react.context"):60110,ki=_i?Symbol.for("react.async_mode"):60111,Ai=_i?Symbol.for("react.concurrent_mode"):60111,Fi=_i?Symbol.for("react.forward_ref"):60112,xi=_i?Symbol.for("react.suspense"):60113,Ii=_i?Symbol.for("react.memo"):60115,Si=_i?Symbol.for("react.lazy"):60116;function Bi(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case bi:switch(e=e.type){case ki:case Ai:case Di:case wi:case yi:case xi:return e;default:switch(e=e&&e.$$typeof){case Ei:case Fi:case Ci:return e;default:return t}}case Si:case Ii:case vi:return t}}}function Ti(e){return Bi(e)===Ai}mi.typeOf=Bi,mi.AsyncMode=ki,mi.ConcurrentMode=Ai,mi.ContextConsumer=Ei,mi.ContextProvider=Ci,mi.Element=bi,mi.ForwardRef=Fi,mi.Fragment=Di,mi.Lazy=Si,mi.Memo=Ii,mi.Portal=vi,mi.Profiler=wi,mi.StrictMode=yi,mi.Suspense=xi,mi.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===Di||e===Ai||e===wi||e===yi||e===xi||"object"==typeof e&&null!==e&&(e.$$typeof===Si||e.$$typeof===Ii||e.$$typeof===Ci||e.$$typeof===Ei||e.$$typeof===Fi)},mi.isAsyncMode=function(e){return Ti(e)||Bi(e)===ki},mi.isConcurrentMode=Ti,mi.isContextConsumer=function(e){return Bi(e)===Ei},mi.isContextProvider=function(e){return Bi(e)===Ci},mi.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===bi},mi.isForwardRef=function(e){return Bi(e)===Fi},mi.isFragment=function(e){return Bi(e)===Di},mi.isLazy=function(e){return Bi(e)===Si},mi.isMemo=function(e){return Bi(e)===Ii},mi.isPortal=function(e){return Bi(e)===vi},mi.isProfiler=function(e){return Bi(e)===wi},mi.isStrictMode=function(e){return Bi(e)===yi},mi.isSuspense=function(e){return Bi(e)===xi},gi.exports=mi;var zi=gi.exports,Mi={};Mi[zi.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Mi[zi.Memo]={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0};var Pi,Oi={},ji="function"==typeof Symbol&&Symbol.for,Ri=ji?Symbol.for("react.element"):60103,$i=ji?Symbol.for("react.portal"):60106,qi=ji?Symbol.for("react.fragment"):60107,Ui=ji?Symbol.for("react.strict_mode"):60108,Li=ji?Symbol.for("react.profiler"):60114,Ni=ji?Symbol.for("react.provider"):60109,Vi=ji?Symbol.for("react.context"):60110,Hi=ji?Symbol.for("react.async_mode"):60111,Zi=ji?Symbol.for("react.concurrent_mode"):60111,Gi=ji?Symbol.for("react.forward_ref"):60112,Yi=ji?Symbol.for("react.suspense"):60113,Wi=ji?Symbol.for("react.suspense_list"):60120,Ji=ji?Symbol.for("react.memo"):60115,Qi=ji?Symbol.for("react.lazy"):60116,Xi=ji?Symbol.for("react.block"):60121,Ki=ji?Symbol.for("react.fundamental"):60117,eo=ji?Symbol.for("react.responder"):60118,to=ji?Symbol.for("react.scope"):60119; /** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function no(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case Ri:switch(e=e.type){case Hi:case Zi:case qi:case Li:case Ui:case Yi:return e;default:switch(e=e&&e.$$typeof){case Vi:case Gi:case Qi:case Ji:case Ni:return e;default:return t}}case $i:return t}}}function ro(e){return no(e)===Zi}Oi.AsyncMode=Hi,Oi.ConcurrentMode=Zi,Oi.ContextConsumer=Vi,Oi.ContextProvider=Ni,Oi.Element=Ri,Oi.ForwardRef=Gi,Oi.Fragment=qi,Oi.Lazy=Qi,Oi.Memo=Ji,Oi.Portal=$i,Oi.Profiler=Li,Oi.StrictMode=Ui,Oi.Suspense=Yi,Oi.isAsyncMode=function(e){return ro(e)||no(e)===Hi},Oi.isConcurrentMode=ro,Oi.isContextConsumer=function(e){return no(e)===Vi},Oi.isContextProvider=function(e){return no(e)===Ni},Oi.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===Ri},Oi.isForwardRef=function(e){return no(e)===Gi},Oi.isFragment=function(e){return no(e)===qi},Oi.isLazy=function(e){return no(e)===Qi},Oi.isMemo=function(e){return no(e)===Ji},Oi.isPortal=function(e){return no(e)===$i},Oi.isProfiler=function(e){return no(e)===Li},Oi.isStrictMode=function(e){return no(e)===Ui},Oi.isSuspense=function(e){return no(e)===Yi},Oi.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===qi||e===Zi||e===Li||e===Ui||e===Yi||e===Wi||"object"==typeof e&&null!==e&&(e.$$typeof===Qi||e.$$typeof===Ji||e.$$typeof===Ni||e.$$typeof===Vi||e.$$typeof===Gi||e.$$typeof===Ki||e.$$typeof===eo||e.$$typeof===to||e.$$typeof===Xi)},Oi.typeOf=no,Pi=l.unstable_batchedUpdates,hi=Pi;const ao="connected",io="disconnected",oo="fakely_connected",so="reconnecting",uo="scheduled_reconnecting",lo="liveChatChatId",co="openAIChatId",po="email_prompt",ho="message_draft",fo=100,go=20,mo="Invalid `chat.id`",_o="Move chat to mobile",bo={labs:"https://mobile-chat.labs.livechat.com/chat-widget-moment/",staging:"https://mobile-chat.staging.livechat.com/chat-widget-moment/",production:"https://mobile-chat.livechat.com/chat-widget-moment/"},vo=1500,Do=100,yo="before_send_message",wo=/^\s+$/,Co=/^(?:\s+|[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?)*/;function Eo(e){let t=null,n=0;for(;t=Co.exec(e);){const r=t[0];if(e=e.slice(r.length),wo.test(r)||n++,n>3)return!1}return!e}const ko=["xS94WbAZR","pJw7AxJZg"],Ao=["DfltarqcrRoA5ZoZ","UsDoxZQESkzF0qds"];function Fo(e){return ko.includes(e)}function xo(e){return Ao.includes(e)}const Io=(()=>{try{return!1}catch{return!1}})(),So=200,Bo=350,To=100,zo=Io?1:3,Mo="not_ready",Po="ready",Oo="bootstrapped",jo=19196658,Ro=()=>"feade1d6c3f17748ae4c8d917a1e1068",$o=()=>"bb9e5b2f1ab480e4a715977b7b1b4279",qo={whatsapp:"ee631a7ff555f8b6e354705201860c81",messenger:"0e655920289dbafb0376a0f4491372d9",apple:"22cc83ef7905d174b6a0eccb9ce404c0",telegram:"b0c559436b7d82f29d971faab4c6c2aa",twilio:"f14e86a88bd213b7b3717c9f76e5e823",instagram:"506038b7a51013790f6c159967b562ae"},Uo=()=>qo,Lo="chatbotChatId",No="chatbot-agent",Vo=18e5,Ho=Io?100:1e3,Zo=["failed","cancelled","expired"],Go="openai_bot",Yo="https://cdn.files-text.com/api/ow/img/integrations/openai/orb.gif",Wo=6;function Jo(){return(Jo=Object.assign||function(e){for(var t=1;t=0&&a<1?(s=i,u=o):a>=1&&a<2?(s=o,u=i):a>=2&&a<3?(u=i,l=o):a>=3&&a<4?(u=o,l=i):a>=4&&a<5?(s=o,l=i):a>=5&&a<6&&(s=i,l=o);var c=n-i/2;return r(s+c,u+c,l+c)}var us={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var ls=/^#[a-fA-F0-9]{6}$/,cs=/^#[a-fA-F0-9]{8}$/,ds=/^#[a-fA-F0-9]{3}$/,ps=/^#[a-fA-F0-9]{4}$/,hs=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,fs=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i,gs=/^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,ms=/^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;function _s(e){if("string"!=typeof e)throw new as(3);var t=function(e){if("string"!=typeof e)return e;var t=e.toLowerCase();return us[t]?"#"+us[t]:e}(e);if(t.match(ls))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(cs)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(ds))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(ps)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var a=hs.exec(t);if(a)return{red:parseInt(""+a[1],10),green:parseInt(""+a[2],10),blue:parseInt(""+a[3],10)};var i=fs.exec(t);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10),alpha:parseFloat(""+i[4])};var o=gs.exec(t);if(o){var s="rgb("+ss(parseInt(""+o[1],10),parseInt(""+o[2],10)/100,parseInt(""+o[3],10)/100)+")",u=hs.exec(s);if(!u)throw new as(4,t,s);return{red:parseInt(""+u[1],10),green:parseInt(""+u[2],10),blue:parseInt(""+u[3],10)}}var l=ms.exec(t);if(l){var c="rgb("+ss(parseInt(""+l[1],10),parseInt(""+l[2],10)/100,parseInt(""+l[3],10)/100)+")",d=hs.exec(c);if(!d)throw new as(4,t,c);return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:parseFloat(""+l[4])}}throw new as(5)}function bs(e){return function(e){var t,n=e.red/255,r=e.green/255,a=e.blue/255,i=Math.max(n,r,a),o=Math.min(n,r,a),s=(i+o)/2;if(i===o)return void 0!==e.alpha?{hue:0,saturation:0,lightness:s,alpha:e.alpha}:{hue:0,saturation:0,lightness:s};var u=i-o,l=s>.5?u/(2-i-o):u/(i+o);switch(i){case n:t=(r-a)/u+(r=1?Es(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new as(7)}function As(e){if("object"!=typeof e)throw new as(8);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&"number"==typeof e.alpha}(e))return ks(e);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return Es(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&"number"==typeof e.alpha}(e))return function(e,t,n,r){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n&&"number"==typeof r)return"rgba("+ss(e,t,n)+","+r+")";if("object"==typeof e&&void 0===t&&void 0===n&&void 0===r)return e.alpha>=1?Cs(e.hue,e.saturation,e.lightness):"rgba("+ss(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new as(2)}(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return function(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return Cs(e,t,n);if("object"==typeof e&&void 0===t&&void 0===n)return Cs(e.hue,e.saturation,e.lightness);throw new as(1)}(e);throw new as(8)}function Fs(e){return function e(t,n,r){return function(){var a=r.concat(Array.prototype.slice.call(arguments));return a.length>=n?t.apply(this,a):e(t,n,a)}}(e,e.length,[])}function xs(e,t){if("transparent"===t)return t;var n=bs(t);return As(Jo({},n,{hue:n.hue+parseFloat(e)}))}var Is=Fs(xs);function Ss(e,t,n){return Math.max(e,Math.min(t,n))}function Bs(e,t){if("transparent"===t)return t;var n=bs(t);return As(Jo({},n,{lightness:Ss(0,1,n.lightness-parseFloat(e))}))}var Ts=Fs(Bs);function zs(e,t){if("transparent"===t)return t;var n=bs(t);return As(Jo({},n,{saturation:Ss(0,1,n.saturation-parseFloat(e))}))}var Ms=Fs(zs);function Ps(e){if("transparent"===e)return 0;var t=_s(e),n=Object.keys(t).map((function(e){var n=t[e]/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)})),r=n[0],a=n[1],i=n[2];return parseFloat((.2126*r+.7152*a+.0722*i).toFixed(3))}function Os(e,t){var n=Ps(e),r=Ps(t);return parseFloat((n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)).toFixed(2))}function js(e,t){if("transparent"===t)return t;var n=bs(t);return As(Jo({},n,{lightness:Ss(0,1,n.lightness+parseFloat(e))}))}var Rs=Fs(js);function $s(e,t,n){if("transparent"===t)return n;if("transparent"===n)return t;var r=_s(t),a=Jo({},r,{alpha:"number"==typeof r.alpha?r.alpha:1}),i=_s(n),o=Jo({},i,{alpha:"number"==typeof i.alpha?i.alpha:1}),s=a.alpha-o.alpha,u=2*parseFloat(e)-1,l=((u*s==-1?u:u+s)/(1+u*s)+1)/2,c=1-l;return ks({red:Math.floor(a.red*l+o.red*c),green:Math.floor(a.green*l+o.green*c),blue:Math.floor(a.blue*l+o.blue*c),alpha:a.alpha+(o.alpha-a.alpha)*(parseFloat(e)/1)})}var qs=Fs($s);function Us(e,t){return"transparent"===t?t:qs(parseFloat(e),"rgb(0, 0, 0)",t)}var Ls=Fs(Us);function Ns(e,t){return"transparent"===t?t:qs(parseFloat(e),"rgb(255, 255, 255)",t)}var Vs=Fs(Ns);function Hs(e,t){if("transparent"===t)return t;var n=_s(t);return ks(Jo({},n,{alpha:Ss(0,1,(100*("number"==typeof n.alpha?n.alpha:1)-100*parseFloat(e))/100)}))}var Zs=Fs(Hs);function Gs(e){return void 0===e&&(e=-1),function(t){return function(n,r){if(0===n){var a,i=!1,o=e,s=function(e,t){a(e,t)};!function e(){t(0,(function(t,n){return 0===t?(a=n,i?void s(1):(i=!0,void r(0,s))):2===t&&n&&0!==o?(o--,void e()):void r(t,n)}))}()}}}}function Ys(){const e=se();return[e,()=>{const t=new Error("Destroyed.");t.code="DESTROYED",e(2,t)}]}const Ws=ke();let Js=0;const Qs=e=>{const t=document.createElement("a");if(t.href=e,t.origin)return"null"===t.origin?"*":t.origin;const n=t.protocol.length>4?t.protocol:window.location.protocol;let r;return r=t.host.length?"80"===t.port||"443"===t.port?t.hostname:t.host:window.location.host,n+"//"+r};function Xs(e,t){let{frame:n,targetOrigin:r=Qs(n.src),handshakeRetry:a={}}=e;void 0===t&&(t={});const[i,o]=c(t),[s,u]=Ys(),l=Js++,I=n.contentWindow,S=d(),B=(e,t)=>A(Ws,l,e,t),T=e=>{I.postMessage(e,r)},z=p(f(),h(e=>e.owner===Ws&&e.instance===l),le(s),g),M=m(S,z,B,T),P=p(v(z,T,B(x,o),null),b(a.interval||500),Gs(a.count||5),_(1),D(e=>y in e?p(v(z,T,B(F)),C(()=>e.data)):w(()=>e)),le(s),g),O=E(M,S.emit,T,i);return p(P,D(()=>z),k(O)),{api:M,destroy:u,handshake$:P}}function Ks(){return new Promise(e=>{const t=()=>{document.body?e(document.body):setTimeout(t,100)};t()})}function eu(e){const{parentNode:t}=e;t&&t.removeChild(e)}const tu=(e,t)=>{const n=document.createElement("iframe");return e.appendChild(n),n.src=t,n};function nu(e,t){let{onConnected:n,...r}=e;const a=!r.frame,i=(e=>{if(e.frame)return e.frame;const{container:t,url:n}=e;return tu(t,n)})(r),[o,s]=Ys();let u;const l=()=>{a&&eu(i),u?u.destroy():s()};return p(S(i,"load"),D(()=>N((e,n)=>{let a=function(e,t){const{api:n,destroy:r,handshake$:a}=Xs(e,t);return{destroy:r,promise:p(a,C(e=>(n.data=e,n.destroy=r,n)),I)}}({...r,frame:i},t);return a.promise.then(e,n),u=a,a.destroy})),Gs(),le(o),k(e=>{e.destroy=l,e.frame=i,n(e)})),{destroy:l,frame:i}}function ru(){return(ru=Object.assign?Object.assign.bind():function(e){for(var t=1;tn)throw new Error(e+" can not be empty and can only be "+n+" characters long.")},uu=function(e){if("string"!=typeof(e=ou(e)))throw new Error("`text` must be a string or a number.");e=e.trim(),su("`text`",e,1024)},lu=function(e,t){return new Error('Attribute with key "'+e+'" is invalid. '+t)},cu=o,du=Object.freeze({sendMessage:function(e){var t=e.text,n=e.postback;if(uu(t),void 0!==n){if("string"!=typeof n)throw new Error("`postback` must be a string.");su("`postback`",n,1024)}},sendSystemMessage:function(e){var t=e.text,n=e.recipients;if(uu(t),void 0!==n&&-1===iu.indexOf(n))throw new Error("`recipients` can only be one of: "+iu+".")},setAttributes:function(e){if(!e||"object"!=typeof e)throw new Error("`attributes` must be a plain object (with shape such as `{ key: 'value' }`).");var t=Object.keys(e);if(t.length>99)throw new Error("The maximum number of attributes is 99.");t.forEach((function(t){var n=ou(e[t]);if(t=ou(t),!/^[\w-]{1,128}$/.test(t))throw lu(t,"Key must be between 1-128 characters long and can only contain alpha-numeric, underscore and dash characters.");if("string"!=typeof n)throw lu(t,"Value must be a string or a number.");su("Value",n,1024)}))},setExternalLink:function(e){if("string"==typeof e){if(!/^https:\/\//.test(e))throw new Error("`externalLink` has to be a HTTPS URL.")}else if(null!==e)throw new Error("`externalLink` has to be a string or null.")},setIsFragile:function(e){if("boolean"!=typeof e)throw new Error("`setIsFragile` argument value can not be empty and must be a boolean.")},getIdentityTransferToken:function(){},updateCustomerData:function(e){if(!e)throw new Error("`updateUserData` arguments values can not be empty.");if(e.email&&"string"!=typeof e.email)throw new Error("`updateUserData` argument `email` has to be a string.");if(e.name&&"string"!=typeof e.name)throw new Error("`updateUserData` argument `name` has to be a string.")},close:cu,setTitle:function(e){if("string"!=typeof e)throw new Error("`setTitle` argument value has to be a string.");su("`title`",e,1024)}}),pu=function(e){var t=M(e);if(!/chatbot\.com$/.test(t))return e;var n=R($(P(e)));if(!n.p)return e;try{var r=JSON.parse(atob(n.p));return r.url?decodeURIComponent(r.url):e}catch(a){return e}};function hu(e,t){var n,r=pu(e.url),a=B((function(e){return"function"==typeof e}),t),i=a[0],o=a[1],s=ze((function(e,t){return function(){return du[t].apply(du,arguments),e.apply(void 0,arguments)}}),i),u=nu(ru({},e,{targetOrigin:"*"}),ru({},o,s,{supportedMethods:Object.keys(s)})),l=u.destroy,c=u.frame;return c.sandbox=au,{destroy:l,frame:c,title:(n=r,et("moment-title",n)||Ke(n))}}var fu=["aaa","aarp","abarth","abb","abbott","abbvie","abc","able","abogado","abudhabi","ac","academy","accenture","accountant","accountants","aco","active","actor","ad","adac","ads","adult","ae","aeg","aero","aetna","af","afamilycompany","afl","africa","ag","agakhan","agency","ai","aig","aigo","airbus","airforce","airtel","akdn","al","alfaromeo","alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","americanexpress","americanfamily","amex","amfam","amica","amsterdam","analytics","android","anquan","anz","ao","aol","apartments","app","apple","aq","aquarelle","ar","arab","aramco","archi","army","arpa","art","arte","as","asda","asia","associates","at","athleta","attorney","au","auction","audi","audible","audio","auspost","author","auto","autos","avianca","aw","aws","ax","axa","az","azure","ba","baby","baidu","banamex","bananarepublic","band","bank","bar","barcelona","barclaycard","barclays","barefoot","bargains","baseball","basketball","bauhaus","bayern","bb","bbc","bbt","bbva","bcg","bcn","bd","be","beats","beauty","beer","bentley","berlin","best","bestbuy","bet","bf","bg","bh","bharti","bi","bible","bid","bike","bing","bingo","bio","biz","bj","black","blackfriday","blanco","blockbuster","blog","bloomberg","blue","bm","bms","bmw","bn","bnl","bnpparibas","bo","boats","boehringer","bofa","bom","bond","boo","book","booking","bosch","bostik","boston","bot","boutique","box","br","bradesco","bridgestone","broadway","broker","brother","brussels","bs","bt","budapest","bugatti","build","builders","business","buy","buzz","bv","bw","by","bz","bzh","ca","cab","cafe","cal","call","calvinklein","cam","camera","camp","cancerresearch","canon","capetown","capital","capitalone","car","caravan","cards","care","career","careers","cars","cartier","casa","case","caseih","cash","casino","cat","catering","catholic","cba","cbn","cbre","cbs","cc","cd","ceb","center","ceo","cern","cf","cfa","cfd","cg","ch","chanel","channel","chase","chat","cheap","chintai","christmas","chrome","chrysler","church","ci","cipriani","circle","cisco","citadel","citi","citic","city","cityeats","ck","cl","claims","cleaning","click","clinic","clinique","clothing","cloud","club","clubmed","cm","cn","co","coach","codes","coffee","college","cologne","com","comcast","commbank","community","company","compare","computer","comsec","condos","construction","consulting","contact","contractors","cooking","cookingchannel","cool","coop","corsica","country","coupon","coupons","courses","cr","credit","creditcard","creditunion","cricket","crown","crs","cruise","cruises","csc","cu","cuisinella","cv","cw","cx","cy","cymru","cyou","cz","dabur","dad","dance","data","date","dating","datsun","day","dclk","dds","de","deal","dealer","deals","degree","delivery","dell","deloitte","delta","democrat","dental","dentist","desi","design","dev","dhl","diamonds","diet","digital","direct","directory","discount","discover","dish","diy","dj","dk","dm","dnp","do","docs","doctor","dodge","dog","doha","domains","dot","download","drive","dtv","dubai","duck","dunlop","duns","dupont","durban","dvag","dvr","dz","earth","eat","ec","eco","edeka","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","epost","epson","equipment","er","ericsson","erni","es","esq","estate","esurance","et","etisalat","eu","eurovision","eus","events","everbank","exchange","expert","exposed","express","extraspace","fage","fail","fairwinds","faith","family","fan","fans","farm","farmers","fashion","fast","fedex","feedback","ferrari","ferrero","fi","fiat","fidelity","fido","film","final","finance","financial","fire","firestone","firmdale","fish","fishing","fit","fitness","fj","fk","flickr","flights","flir","florist","flowers","fly","fm","fo","foo","food","foodnetwork","football","ford","forex","forsale","forum","foundation","fox","fr","free","fresenius","frl","frogans","frontdoor","frontier","ftr","fujitsu","fujixerox","fun","fund","furniture","futbol","fyi","ga","gal","gallery","gallo","gallup","game","games","gap","garden","gb","gbiz","gd","gdn","ge","gea","gent","genting","george","gf","gg","ggee","gh","gi","gift","gifts","gives","giving","gl","glade","glass","gle","global","globo","gm","gmail","gmbh","gmo","gmx","gn","godaddy","gold","goldpoint","golf","goo","goodhands","goodyear","goog","google","gop","got","gov","gp","gq","gr","grainger","graphics","gratis","green","gripe","grocery","group","gs","gt","gu","guardian","gucci","guge","guide","guitars","guru","gw","gy","hair","hamburg","hangout","haus","hbo","hdfc","hdfcbank","health","healthcare","help","helsinki","here","hermes","hgtv","hiphop","hisamitsu","hitachi","hiv","hk","hkt","hm","hn","hockey","holdings","holiday","homedepot","homegoods","homes","homesense","honda","honeywell","horse","hospital","host","hosting","hot","hoteles","hotels","hotmail","house","how","hr","hsbc","ht","hu","hughes","hyatt","hyundai","ibm","icbc","ice","icu","id","ie","ieee","ifm","ikano","il","im","imamat","imdb","immo","immobilien","in","industries","infiniti","info","ing","ink","institute","insurance","insure","int","intel","international","intuit","investments","io","ipiranga","iq","ir","irish","is","iselect","ismaili","ist","istanbul","it","itau","itv","iveco","iwc","jaguar","java","jcb","jcp","je","jeep","jetzt","jewelry","jio","jlc","jll","jm","jmp","jnj","jo","jobs","joburg","jot","joy","jp","jpmorgan","jprs","juegos","juniper","kaufen","kddi","ke","kerryhotels","kerrylogistics","kerryproperties","kfh","kg","kh","ki","kia","kim","kinder","kindle","kitchen","kiwi","km","kn","koeln","komatsu","kosher","kp","kpmg","kpn","kr","krd","kred","kuokgroup","kw","ky","kyoto","kz","la","lacaixa","ladbrokes","lamborghini","lamer","lancaster","lancia","lancome","land","landrover","lanxess","lasalle","lat","latino","latrobe","law","lawyer","lb","lc","lds","lease","leclerc","lefrak","legal","lego","lexus","lgbt","li","liaison","lidl","life","lifeinsurance","lifestyle","lighting","like","lilly","limited","limo","lincoln","linde","link","lipsy","live","living","lixil","lk","llc","loan","loans","locker","locus","loft","lol","london","lotte","lotto","love","lpl","lplfinancial","lr","ls","lt","ltd","ltda","lu","lundbeck","lupin","luxe","luxury","lv","ly","ma","macys","madrid","maif","maison","makeup","man","management","mango","map","market","marketing","markets","marriott","marshalls","maserati","mattel","mba","mc","mckinsey","md","me","med","media","meet","melbourne","meme","memorial","men","menu","meo","merckmsd","metlife","mg","mh","miami","microsoft","mil","mini","mint","mit","mitsubishi","mk","ml","mlb","mls","mm","mma","mn","mo","mobi","mobile","mobily","moda","moe","moi","mom","monash","money","monster","mopar","mormon","mortgage","moscow","moto","motorcycles","mov","movie","movistar","mp","mq","mr","ms","msd","mt","mtn","mtr","mu","museum","mutual","mv","mw","mx","my","mz","na","nab","nadex","nagoya","name","nationwide","natura","navy","nba","nc","ne","nec","net","netbank","netflix","network","neustar","new","newholland","news","next","nextdirect","nexus","nf","nfl","ng","ngo","nhk","ni","nico","nike","nikon","ninja","nissan","nissay","nl","no","nokia","northwesternmutual","norton","now","nowruz","nowtv","np","nr","nra","nrw","ntt","nu","nyc","nz","obi","observer","off","office","okinawa","olayan","olayangroup","oldnavy","ollo","om","omega","one","ong","onl","online","onyourside","ooo","open","oracle","orange","org","organic","origins","osaka","otsuka","ott","ovh","pa","page","panasonic","panerai","paris","pars","partners","parts","party","passagens","pay","pccw","pe","pet","pf","pfizer","pg","ph","pharmacy","phd","philips","phone","photo","photography","photos","physio","piaget","pics","pictet","pictures","pid","pin","ping","pink","pioneer","pizza","pk","pl","place","play","playstation","plumbing","plus","pm","pn","pnc","pohl","poker","politie","porn","post","pr","pramerica","praxi","press","prime","pro","prod","productions","prof","progressive","promo","properties","property","protection","pru","prudential","ps","pt","pub","pw","pwc","py","qa","qpon","quebec","quest","qvc","racing","radio","raid","re","read","realestate","realtor","realty","recipes","red","redstone","redumbrella","rehab","reise","reisen","reit","reliance","ren","rent","rentals","repair","report","republican","rest","restaurant","review","reviews","rexroth","rich","richardli","ricoh","rightathome","ril","rio","rip","rmit","ro","rocher","rocks","rodeo","rogers","room","rs","rsvp","ru","rugby","ruhr","run","rw","rwe","ryukyu","sa","saarland","safe","safety","sakura","sale","salon","samsclub","samsung","sandvik","sandvikcoromant","sanofi","sap","sapo","sarl","sas","save","saxo","sb","sbi","sbs","sc","sca","scb","schaeffler","schmidt","scholarships","school","schule","schwarz","science","scjohnson","scor","scot","sd","se","search","seat","secure","security","seek","select","sener","services","ses","seven","sew","sex","sexy","sfr","sg","sh","shangrila","sharp","shaw","shell","shia","shiksha","shoes","shop","shopping","shouji","show","showtime","shriram","si","silk","sina","singles","site","sj","sk","ski","skin","sky","skype","sl","sling","sm","smart","smile","sn","sncf","so","soccer","social","softbank","software","sohu","solar","solutions","song","sony","soy","space","spiegel","sport","spot","spreadbetting","sr","srl","srt","st","stada","staples","star","starhub","statebank","statefarm","statoil","stc","stcgroup","stockholm","storage","store","stream","studio","study","style","su","sucks","supplies","supply","support","surf","surgery","suzuki","sv","swatch","swiftcover","swiss","sx","sy","sydney","symantec","systems","sz","tab","taipei","talk","taobao","target","tatamotors","tatar","tattoo","tax","taxi","tc","tci","td","tdk","team","tech","technology","tel","telecity","telefonica","temasek","tennis","teva","tf","tg","th","thd","theater","theatre","tiaa","tickets","tienda","tiffany","tips","tires","tirol","tj","tjmaxx","tjx","tk","tkmaxx","tl","tm","tmall","tn","to","today","tokyo","tools","top","toray","toshiba","total","tours","town","toyota","toys","tr","trade","trading","training","travel","travelchannel","travelers","travelersinsurance","trust","trv","tt","tube","tui","tunes","tushu","tv","tvs","tw","tz","ua","ubank","ubs","uconnect","ug","uk","unicom","university","uno","uol","ups","us","uy","uz","va","vacations","vana","vanguard","vc","ve","vegas","ventures","verisign","versicherung","vet","vg","vi","viajes","video","vig","viking","villas","vin","vip","virgin","visa","vision","vista","vistaprint","viva","vivo","vlaanderen","vn","vodka","volkswagen","volvo","vote","voting","voto","voyage","vu","vuelos","wales","walmart","walter","wang","wanggou","warman","watch","watches","weather","weatherchannel","webcam","weber","website","wed","wedding","weibo","weir","wf","whoswho","wien","wiki","williamhill","win","windows","wine","winners","wme","wolterskluwer","woodside","work","works","world","wow","ws","wtc","wtf","xbox","xerox","xfinity","xihuan","xin","कॉम","セール","佛山","ಭಾರತ","慈善","集团","在线","한국","ଭାରତ","大众汽车","点看","คอม","ভাৰত","ভারত","八卦","موقع","বাংলা","公益","公司","香格里拉","网站","移动","我爱你","москва","қаз","католик","онлайн","сайт","联通","срб","бг","бел","קום","时尚","微博","淡马锡","ファッション","орг","नेट","ストア","삼성","சிங்கப்பூர்","商标","商店","商城","дети","мкд","ею","ポイント","新闻","工行","家電","كوم","中文网","中信","中国","中國","娱乐","谷歌","భారత్","ලංකා","電訊盈科","购物","クラウド","ભારત","通販","भारतम्","भारत","भारोत","网店","संगठन","餐厅","网络","ком","укр","香港","诺基亚","食品","飞利浦","台湾","台灣","手表","手机","мон","الجزائر","عمان","ارامكو","ایران","العليان","اتصالات","امارات","بازار","پاکستان","الاردن","موبايلي","بارت","بھارت","المغرب","ابوظبي","السعودية","ڀارت","كاثوليك","سودان","همراه","عراق","مليسيا","澳門","닷컴","政府","شبكة","بيتك","عرب","გე","机构","组织机构","健康","ไทย","سورية","招聘","рус","рф","珠宝","تونس","大拿","みんな","グーグル","ελ","世界","書籍","ഭാരതം","ਭਾਰਤ","网址","닷넷","コム","天主教","游戏","vermögensberater","vermögensberatung","企业","信息","嘉里大酒店","嘉里","مصر","قطر","广东","இலங்கை","இந்தியா","հայ","新加坡","فلسطين","政务","xperia","xxx","xyz","yachts","yahoo","yamaxun","yandex","ye","yodobashi","yoga","yokohama","you","youtube","yt","yun","za","zappos","zara","zero","zip","zippo","zm","zone","zuerich","zw"];const gu=t(fu),mu=e=>{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)},_u=e=>{navigator.clipboard?navigator.clipboard.writeText(e).catch(mu):mu(e)},bu=e=>{var t,n;const r="feade1d6c3f17748ae4c8d917a1e1068",a=Boolean(null==(t=e.properties.group[r])?void 0:t.forwardTicketFormToHelpdesk),i=!!e.__unsafeProperties.license&&e.__unsafeProperties.license.licenseinboundForwardingToHelpdeskEnabled,o=null==(n=e.properties.license[r])?void 0:n.hdLicenseID;return"number"==typeof o&&o>-1&&(a||i)?"helpdesk":e.__unsafeProperties.group.offlineMessagesEnabled?"offline_message":"livechat"},vu=(e,t)=>e().then(e=>fetch("https://api.helpdesk.com/v1/externalTickets",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+e.accessToken},body:JSON.stringify(t)}).then(e=>e.ok?e.json():Promise.reject()).then(e=>{let{ID:t}=e;return{id:t}})),Du=Io?100:600,yu=300,wu=Io?300:5e3,Cu=304,Eu=338,ku=321,Au=Object.freeze(Object.defineProperty({__proto__:null,def:"6px",lg:"8px",md:"6px",none:"0px",round:"50%",sm:"4px",xl:"12px",xs:"2px",xxl:"16px"},Symbol.toStringTag,{value:"Module"})),Fu={25:"#EDDDBF",50:"#FFFAE5",100:"#F7C56E",500:"#FFD000",700:"#7B664C",800:"#3A352C"},xu={100:"#FF7C6B",500:"#D93311"},Iu={100:"#77Cf9D",500:"#268750"},Su={100:"#FA6681",500:"#E30D34"},Bu="#2000F0",Tu={0:"#FFFFFF",15:"#F6F6F7",25:"#F0F0F0",50:"#F8F8F8",75:"#EDEDED",100:"#E3E3E3",200:"#D5D5D5",300:"#C0C0C0",400:"#B3B3B3",425:"#A6A4A4",450:"#949494",500:"#757575",525:"#707070",550:"#6E6E6E",600:"#575757",625:"#474747",650:"#333333",700:"#2E2E2E",800:"#252525",900:"#111111"},zu=Object.freeze(Object.defineProperty({__proto__:null,accent:"#2000F0",brand:{orange:"#FF5100",black:"#1B1B20"},grayscale:Tu,green:Iu,red:xu,ruby:Su,webkitOutline:"#3B99FC",yellow:Fu},Symbol.toStringTag,{value:"Module"})),Mu={...zu,border:Tu[500],borderSubtle:Tu[100],divider:Tu[100],error:xu[500],errorContrast:Tu[0],subtleFeedback:Fu[50],subtleFeedbackContrast:Tu[900],caution:"#FFAE21",cautionDimmed:"#FFF3D6",cautionContrast:Tu[900],cautionDesaturated:Fu[25],success:Iu[500],successContrast:Tu[0],primaryTextColor:Tu[900],secondaryTextColor:Tu[550],tertiaryTextColor:Tu[400],surface:Tu[0],surfaceVariant:Tu[25],surfaceVariantHover:"#E6E6E6",surfaceInteractive:Tu[50],surfaceInteractivePressed:Tu[600],surfaceDecorative:Tu[100],surfaceDimmed:"#E6E4E1",surfaceFade:Tu[15],hintSurface:Tu[800],floatSurface:Tu[0],pressedElement:Tu[300],notification:Su[500],notificationContrast:Tu[0],widgetBackground:Tu[50],disabled:Tu[100],disabledContrast:Tu[600],inactiveElement:Tu[450],formIconColor:Tu[50],trademarkFooterText:Tu[600],itemHover:Tu[625],successHover:"#2FA763",inactiveElementHover:Tu[425],secondaryButtonBackground:Tu[100],secondaryButtonBackgroundHover:Tu[200],primaryTimelineSurface:Tu[0],decorations:{decorOne:"#FFDAB9",decorTwo:"#D9CCFA",decorThree:"#FACCCC",decorFour:"#F4F791",decorFive:"#F1C9FC"}},Pu={...zu,border:Tu[600],borderSubtle:Tu[650],divider:Tu[700],error:xu[100],errorContrast:Tu[900],subtleFeedback:Fu[800],subtleFeedbackContrast:Fu[100],caution:Fu[100],cautionDimmed:"#322B24",cautionContrast:Tu[900],cautionDesaturated:Fu[700],success:Iu[100],successContrast:Tu[900],primaryTextColor:Tu[0],secondaryTextColor:Tu[400],tertiaryTextColor:Tu[600],surface:Tu[800],surfaceVariant:Tu[700],surfaceVariantHover:"#333333",surfaceInteractive:Tu[700],surfaceInteractivePressed:Tu[400],surfaceDecorative:Tu[700],surfaceDimmed:"#1F1E1D",surfaceFade:Tu[700],hintSurface:Tu[550],floatSurface:Tu[700],pressedElement:Tu[600],notification:Su[100],notificationContrast:Tu[900],widgetBackground:Tu[900],disabled:Tu[700],disabledContrast:Tu[400],inactiveElement:Tu[600],formIconColor:Tu[900],trademarkFooterText:Tu[400],itemHover:Tu[525],successHover:"#99DBB5",inactiveElementHover:Tu[800],secondaryButtonBackground:Tu[650],secondaryButtonBackgroundHover:Tu[625],primaryTimelineSurface:Tu[800],decorations:{decorOne:"#D7650F",decorTwo:"#400CC6",decorThree:"#AF3C3C",decorFour:"#ACB125",decorFive:"#831AA2"}},Ou=Object.freeze(Object.defineProperty({__proto__:null,dark:Pu,light:Mu},Symbol.toStringTag,{value:"Module"})),ju=Io?500:15e3,Ru=Io?100:1e3,$u=Io?100:600,qu=ju,Uu=200,Lu=60,Nu=360,Vu=130,Hu="16px",Zu=(Io?300:5e3)-Ru,Gu=$u+ju,Yu=Io?500:15e3,Wu=Io?100:1e3,Ju=Io?100:600,Qu=Yu,Xu=200,Ku=60,el=360,tl=95,nl="16px",rl=(Io?300:5e3)-Wu,al=Ju+Yu,il=2;function ol(e,t){return ee(X(e),te(e.getState()),ne(t),Z(Ve))}const sl=(e,t)=>ee(ol(e,e=>e.application.readyState),h(e=>e===t),_(1),oe),ul=()=>{if((e=window.matchMedia)&&/native code/.test(String(e))){return!window.matchMedia("(hover: none)").matches}var e;return!0},ll=()=>xe(navigator.platform,["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"])&&/CriOS/.test(navigator.userAgent),cl=()=>/mobile/gi.test(navigator.userAgent)&&!("MacIntel"===navigator.platform&&xe("iPad",navigator.userAgent)),dl=()=>cl()||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>0,pl=()=>xe("Chrome",navigator.userAgent),hl=()=>{const e=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);return e?parseInt(e[2],10):0},fl=()=>/Firefox/.test(navigator.userAgent),gl=()=>!pl()&&/Safari/.test(navigator.userAgent),ml=200,_l=8,bl=8,vl=8,Dl=360,yl=8,wl=20,Cl={recommendations:{width:"392px",height:"286px"},mobileRecommendations:{width:"100%",height:"286px"}},El=(e,t)=>{e.getApplicationState("recommendations").products.length>0||ee(ol(e,e=>e.application.page),ce(t=>id(e,t.url)),ne(()=>Jp(e)),h(e=>e.length>=zo),G(e=>{return K(Promise.all([Promise.resolve(e),(n=t.call,r=e,n("/v1.0/recommendations/match","POST",{pages:r}))]));var n,r}),_(1),re(t=>{let[n,r]=t;return ee(sl(e,"ready"),ne(()=>[n,r]))}),k(t=>{let[n,r]=t;return function(e,t,n){let{products:r,id:a}=t;void 0===n&&(n=!0);const{recommendations:i}=e.getApplicationState(),o=null==i?void 0:i.hiddenIds.includes(a),s={...i,id:a,products:r};if(e.setApplicationState({recommendations:s}),!o){const t=!n;e.setApplicationState({recommendations:{...s,hasSeen:t,isVisible:t}}),ed(e,{},{scheduleRerender:t}),Al(e,"recommendations")}}(e,{products:r,id:"h="+n.join(",")+"&t="+(new Date).getTime()})}))},kl={visitorCounter:-1,recommendations:-1,googleReviews:-1,contactInvitation:-1,chatBotGreeting:-1},Al=(e,t)=>{var n;if("recommendations"===t)return ed(e,{eventsQueue:[t]},{scheduleRerender:!1}),nd(e,{transitionState:"hidden",hidden:!0}),td(e,{transitionState:"hidden",hidden:!0}),rd(e,{transitionState:"hidden",hidden:!0}),void ad(e,{transitionState:"hidden",hidden:!0});const r=null!=(n=e.getView("minimized").eventsQueue)?n:[];ed(e,{eventsQueue:[].concat(r,[t])},{scheduleRerender:!1})},Fl=(e,t)=>{var n;const r=null!=(n=e.getView("minimized").eventsQueue)?n:[];ed(e,{eventsQueue:r.filter(e=>e!==t)},{scheduleRerender:!1})},xl=()=>{Object.values(kl).forEach(e=>window.clearTimeout(e))},Il=(e,t)=>{function n(t){return()=>{e.emit("resize-to-theme-size"),e.once("resize-to-theme-size-done",t)}}xl();const r="visitorCounter"===t&&Boolean(e.getApplicationState("googleReviews")),a=e.getApplicationState("contactInvitation").hasSeen;switch(t){case"visitorCounter":kl.visitorCounter=window.setTimeout(n(()=>{td(e,{transitionState:"shown"}),kl.visitorCounter=window.setTimeout(()=>{td(e,{transitionState:"hidden"})},al)}),r?0:rl);break;case"recommendations":(e=>{const t=cl(),n=t?Cl.mobileRecommendations:Cl.recommendations,r=e.getApplicationState("recommendations");if(r.hidden)return;ed(e,{resizeBubbleAnimation:"shrink"}),e.emit("resize-request",{...n,maximized:!1,ignoreHorizontalOffset:t}),e.once("resize-request-done",()=>e.setApplicationState({recommendations:{...r,isVisible:!0,hasSeen:!0,animation:"show"}}))})(e);break;case"googleReviews":kl.googleReviews=window.setTimeout(n(()=>{nd(e,{transitionState:"shown"}),kl.googleReviews=window.setTimeout(()=>{nd(e,{transitionState:"hidden"})},Gu)}),Zu);break;case"contactInvitation":kl.contactInvitation=window.setTimeout(n(()=>{rd(e,{transitionState:"shown"})}),a?0:wu);break;case"chatBotGreeting":kl.chatBotGreeting=window.setTimeout(n(()=>{ad(e,{transitionState:"shown"})}),0);break;default:return}},Sl=e=>{ee(sl(e,"bootstrapped"),re(()=>ol(e,()=>(e=>{const t=e.getView("minimized").eventsQueue;return null!=t&&t.length?t[0]:null})(e))),h(t=>{if(!t||!Up(e,"minimized"))return!1;const n=e.getApplicationState(t);return!!n&&!n.isVisible}),k(t=>{Il(e,t)})),ee(ol(e,e=>e.application.visibility.state),h(e=>"maximized"===e),k(xl)),ee(ol(e,()=>{var t;return null==(t=e.getApplicationState("visitorCounter"))?void 0:t.transitionState}),h(e=>"hidden"===e),k(()=>{Fl(e,"visitorCounter")})),ee(ol(e,()=>{var t;return null==(t=e.getApplicationState("googleReviews"))?void 0:t.transitionState}),h(e=>"hidden"===e),k(()=>{Fl(e,"googleReviews")})),ee(ol(e,e=>{var t,n;return null!=(t=null==(n=e.application.recommendations)?void 0:n.hiddenIds)?t:[]}),h(t=>{const n=e.getApplicationState("recommendations");return n&&t.includes(n.id)}),k(()=>{Fl(e,"recommendations")})),ee(ol(e,()=>{var t;return null==(t=e.getApplicationState("contactInvitation"))?void 0:t.transitionState}),h(e=>"hidden"===e),k(()=>{Fl(e,"contactInvitation")})),ee(ol(e,()=>{var t;return null==(t=e.getApplicationState("chatBotGreeting"))?void 0:t.transitionState}),h(e=>"hidden"===e),k(()=>{Fl(e,"chatBotGreeting")}))},Bl=U()?window.localStorage:L,Tl=[/sendURLToGuardwareProxy/i,/safari-extension:\/\//],zl=!("true"===Bl.getItem("_livechat_has_visited"));Bl.setItem("_livechat_has_visited","true");const Ml=(e,t,n,r)=>{const{timeZone:a}=(new Intl.DateTimeFormat).resolvedOptions(),i=(null==r?void 0:r.license)||od(),s=sd(),u={type:e+"_"+n,...i?{license:i}:{},...s?{organizationId:s}:{},userAgent:navigator.userAgent,mobile:cl(),timeZone:String(a),logVersion:"2024-11-07",firstTimeVisitor:zl,severity:t,lc_env:"production",...r};if(a){const[e]=a.split("/");e!==a&&(u.timeZoneArea=String(e))}return(e=>{let{type:t,license:n,organizationId:r,...a}=e;if(window.location.href.includes("openwidget.com"))return Promise.resolve();const i={...n?{licence_id:n.toString()}:{},...r?{organization_id:r}:{},event_id:t,message:JSON.stringify(a)};return ct("https://applog.livechatinc.com/logs",{method:"POST",headers:{Accept:"*/*","Content-Type":"application/x-www-form-urlencoded"},body:O(i)}).then(()=>Promise.resolve()).catch(o)})(u)},Pl=function(e,t,n,r){void 0===r&&(r="chat_widget");const a={};var i;if(t instanceof Error?(a.errorMessage=t.message,a.stack=t.stack,a.code=t.code):a.errorMessage=JSON.stringify({error:t}),i=a,!Tl.some(e=>e.test(i.errorMessage+" "+i.stack)))return he(n)||(n={meta:JSON.stringify({info:n})}),Ml(r,"Error",e,{...n,...a})},Ol=function(e,t,n){return void 0===n&&(n="chat_widget"),Ml(n,"Informational",e,t)},jl=e=>Ml("chat_widget","Notice",e),Rl=e=>Ol("chat_started",e),$l=e=>Ol("chat_rated",e),ql=e=>Ol("widget_opened",e),Ul=(e,t)=>Ol("potential_connection_problem_"+e,t),Ll=()=>Fe("webkit.messageHandlers.iosMobileWidget.postMessage",window)?"ios":!!Fe("androidMobileWidget.postMessage",window)&&"android",Nl=e=>window.androidMobileWidget.postMessage(JSON.stringify(e)),Vl=e=>window.webkit.messageHandlers.iosMobileWidget.postMessage(e),Hl=(()=>{const e=Ll();return"android"===e?Nl:"ios"===e?Vl:null})(),Zl=()=>Boolean(Ll()),Gl=e=>{Hl&&(Hl({messageType:"uiReady"}),e.on("add_event",t=>{let{event:n}=t;if("message"!==n.type)return;const r=e.getUser(n.author).name;Hl({messageType:"newMessage",text:n.properties.text,id:n.id,timestamp:n.timestamp,author:{name:r}})}),e.on("mobile_wrapper_minimize_intent",()=>{Hl({messageType:"hideChatWindow"})}))},Yl={light:{maxModifier:.7},dark:{maxModifier:.5}};function Wl(e,t,n){return Os(e,n)>Os(t,n)?e:t}const Jl=function(e,t,n){void 0===n&&(n=0);const r=Os(e,t),a=fd(t),{maxModifier:i}=Yl[a?"light":"dark"];if(n>=5)return e;const o=i-r/4.5*.5;if(r>=4.5)return e;const s=a?Ts(o,e):Rs(o,e);return Os(s,t)>=4.5?s:Jl(s,t,n+1)},Ql=e=>{const t=e.variant||"light",n=Ou[t],r=e.customJson||{},a=gd(e.titlebarBackgroundColor)?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.065)",i=gd(e.agentbarBackgroundColor)?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.05)",o=gd(e.agentbarBackgroundColor)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.2)",s=gd(e.agentbarBackgroundColor)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.1)",u=Pu.primaryTextColor,l=Mu.primaryTextColor,c=Wl(u,l,e.ctaColor),d=Jl(e.ctaColor,n.surface),p=yd(e.agentMessageColorBackground),h=Wl(u,l,e.backgroundColor);return Me({name:e.name,variant:t,iconTheme:e.name,showMessageAvatar:"modern"!==e.name,colors:{agentBarText:e.agentbarText,agentBarBackground:e.agentbarBackgroundColor,cta:e.ctaColor,ctaText:c,minimizedIcon:e.minimizedColorIcon,minimizedBackground:e.minimizedColorBackground,background:e.backgroundColor,visitorMessageText:e.visitorMessageColorText,visitorMessageBackground:e.visitorMessageColorBackground,systemMessage:e.systemMessageColor,agentMessageBackground:e.agentMessageColorBackground,agentMessageText:e.agentMessageColorText,minimizedText:e.minimizedColorText,titleBarText:e.titlebarText,titleBarBackgroundColor:e.titlebarBackgroundColor,quickRepliesColor:d,lighterOppositeTitleBarColor:a,decorativeOppositeAgentBarColor:i,lighterOppositeAgentBarColor:o,codeBlockBackgroundColor:p},AgentBar:{css:{background:e.agentbarBackgroundColor,color:e.agentbarText},IconButton:{css:{background:{default:"transparent",active:o}}}},Form:{IconButton:{css:{background:{default:"rgba(0, 0, 0, 0.05)",active:e.ctaColor},color:{default:n.formIconColor,active:c}}}},ChatSummary:{Icon:{color:e.minimizedColorIcon}},Maximized:{css:{background:e.backgroundColor}},Message:{own:{Bubble:{css:{background:"modern"===e.name?"transparent":e.visitorMessageColorBackground,color:e.visitorMessageColorText}}},system:{Bubble:{css:{color:e.systemMessageColor}}},Bubble:{css:{background:"modern"===e.name?"transparent":e.agentMessageColorBackground,color:e.agentMessageColorText}},css:{color:e.systemMessageColor}},TypingIndicator:{css:{color:e.systemMessageColor}},Minimized:{MinimizedBubble:{css:{color:e.minimizedColorText,backgroundColor:{default:e.minimizedColorBackground,hasAvatar:"transparent"}},Icon:{color:e.minimizedColorIcon}},MinimizedBar:{css:{color:e.minimizedColorText,backgroundColor:e.minimizedColorBackground},Icon:{color:e.minimizedColorIcon}}},TitleBar:{css:{background:"modern"===e.name?e.titlebarBackgroundColor:"transparent",color:"modern"===e.name?e.titlebarText:h},HourGlassLabel:{css:{backgroundColor:i}}},DividerLabel:{css:{color:e.systemMessageColor,borderColor:s}},TextComposer:{css:{background:n.surface},IconButton:{css:{background:{active:e.ctaColor}},active:{Icon:{color:c}}}}},r)},Xl=[0,2,4,6,8,1,3,5,7,9],Kl=e=>e.replace(/\b(?:\d[ -]*?){8,15}((?:\d[ -]*?){4})\b/g,(e,t)=>{const n=e.replace(/(-|\s)/g,"");return(e=>{if(/[^0-9-\s]+/.test(e))return!1;const t=e.replace(/\D/g,"");let n,r=t.length,a=1,i=0;for(;r;)n=parseInt(t.charAt(--r),10),i+=(a^=1)?Xl[n]:n;return i&&i%10==0})(n)?""+(e=>{const t=e%4,n=t?4-t:0,r=Math.floor(e/4)+(t?1:0)-n-1,a=Ce(n,"XXX"),i=Ce(r,"XXXX");return a.concat(i).join("-").concat("-")})(n.length)+t:e}),ec=e=>{let t=0;return e.split("").forEach(e=>{const n=e.charCodeAt(0);t=(t<<5)-t+n,t&=t}),t},tc=(e,t)=>ec(e)%(1/t)==0;(new Sr).tlds(gu);const nc=(e,t,n)=>{const r=ve(t=>t.name===e,n);return-1!==r?Qe(r,{...n[r],defaultValue:t},n):n},rc=(e,t,n)=>{e.addEvent(t,{...n,serverId:n.serverId||null})},ac=(e,t,n)=>{let{systemMessageType:r,textVariables:a,text:i}=n;rc(e,t,{id:Ae(e.getIndexedEvents("liveChatChatId")),serverId:null,type:"system_message",author:"system",seen:!0,properties:T({systemMessageType:r,textVariables:a,defaultText:i})})},ic=e=>{e.updateChat("liveChatChatId",{active:!1,properties:{ended:!0,queued:!1,agentIsTyping:!1}}),e.setApplicationState({greetingsMuted:!1})},oc=e=>{e.setApplicationState({eyeCatcher:{...e.getApplicationState().eyeCatcher,hidden:!0}})},sc=(e,t)=>{const n=e.getApplicationState("lightbox"),r={...n,...t.link&&t.link!==n.link&&{link:t.link},...t.alt&&t.alt!==n.alt&&{alt:t.alt},...t.name&&t.name!==n.name&&{name:t.name},...t.state&&t.state!==n.state&&{state:t.state}};e.setApplicationState({lightbox:r})},uc=e=>{const t=Fp(e);if(!t||!t.properties.uniqueId||xp(e,t))return;const{invitation:n}=e.getApplicationState();var r;e.setApplicationState({invitation:{...n,hiddenIds:[].concat(n.hiddenIds,[t.properties.uniqueId])}}),tc(e.getSessionUser().serverId,.01)&&(r={minimizedType:$d(e),greetingId:t.properties.id,greetingUniqueId:t.properties.uniqueId,greetingType:t.properties.type,greetingSubtype:t.properties.subtype,greetingAddon:t.properties.addon||"none"},Ol("greeting_dismissed",r)),e.emit("render-minimized")},lc=e=>{const t=Fp(e);if(!t||!t.properties.uniqueId||Ip(e))return;const{invitation:n}=e.getApplicationState();e.setApplicationState({invitation:{...n,displayedIds:[].concat(n.displayedIds,[t.properties.uniqueId])}})},cc=function(e,t){let{shouldMaintainModality:n=!0}=void 0===t?{}:t;Up(e,"maximized")||e.setApplicationState({visibility:{...e.getApplicationState("visibility"),state:"maximized",...!n&&{interactionModality:"virtual"}}})},dc=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const{visibility:r,destroyed:a,isMinimizedForcefullyDisabled:i}=e.getApplicationState();!t&&"hidden"===r.state&&r.forced||"minimized"===r.state||(!qp(e)||Zd("liveChatChatId",e)||a||i?e.setApplicationState({visibility:{...e.getApplicationState("visibility"),state:"hidden"}}):n||!e.getView("Moment").show?(e.setApplicationState({visibility:{...e.getApplicationState("visibility"),state:"minimized"}}),ed(e,{bubbleHoverState:!1})):e.emit("request_close_moment"))},pc=e=>{Up(e,"minimized")&&e.setApplicationState({visibility:{state:"hidden"}})},hc=(e,t)=>{let{id:n,active:r=!0,thread:a,previousThread:i,group:o,agent:s,queued:u=!1,timestamp:l}=t;null===e.getChat("liveChatChatId").serverId&&e.setChatServerId("liveChatChatId",n);const c={ended:!1,queued:u,fakeAgentMessageId:null,lastThread:a,previousThread:i,currentAgent:s,timestamp:l};"number"==typeof o&&(c.group=o),oc(e),e.updateChat("liveChatChatId",{active:r,properties:c}),Vc(e),e.setApplicationState({hidden:!1});const{readyState:d}=e.getApplicationState();"not_ready"===d||Up(e,"maximized")||(e.setCurrentView("Chat"),cc(e,{shouldMaintainModality:!1}))},fc=function(e,t,n){void 0===n&&(n={});const r=Bd("creditCardMasking",e).enabled?(e=>Kl(e.replaceAll(/\/\/(\S*):(\S*)@/g,"//****:****@")))(t):t;return{type:Eo(r)?"emoji":"message",thread:Yp(e),properties:T({text:r,...n})}},gc=function(e,t,n,r){void 0===r&&(r=void 0),e.sendEvent(t,fc(e,n,{triggeredBy:r}))},mc=(e,t,n)=>{e.setApplicationState({messageDraft:n,initialMessageDraft:null})},_c=(e,t,n,r)=>{const{quickReplies:a}=n.properties,i=a[r];n.properties.invitation?Wc(e,n.id,i):gc(e,t,i.text,{type:"quick_reply",event:n.id,button:i})},bc=(e,t,n)=>{const r=Pp(e,t);rc(e,t,{...n,seen:!0,type:"message_draft",author:e.getSessionUserId(),id:Ae(e.getIndexedEvents("liveChatChatId"))}),r||Ec(e),e.setCurrentView("Chat")},vc=(e,t)=>{const n=e.getChat(t).active,r=np(e);return Boolean(r&&!n)},Dc=function(e,t,n,r){void 0===r&&(r=void 0);const a=e.getApplicationState("invitation").current,i=e.getEvent(t,a),o=fc(e,n,{triggeredBy:r,...i&&{fromGreeting:{...$e(["id","uniqueId"],i.properties)}}});if(!(Bd("preChatAfterGreeting",e).enabled&&vc(e,t)))return e.setCurrentView("Chat"),void e.sendEvent(t,o);bc(e,t,o)},yc=(e,t,n)=>{if(th(e)&&!Td(e))return;if(!vc(e,t))return void e.setApplicationState({initialMessageDraft:n});const r=fc(e,n);bc(e,t,r)},wc=(e,t,n)=>{let{text:r,recipients:a="all"}=n;e.sendEvent(t,{type:"custom_system_message",thread:Yp(e),properties:{text:r.trim(),recipients:a}})},Cc=(e,t)=>{e.updateChat("liveChatChatId",{properties:{currentAgent:t}})},Ec=e=>{if(!ap(e,"prechat")){const t=e.getView("Chat/prechat");Rc(e,t)}},kc=(e,t)=>{const{properties:{rate:n,rateComment:r}}=e.getChat("liveChatChatId");let{fields:a,...i}=t;n&&(a=nc("rating",n,a)),r&&(a=nc("rateComment",r,a)),Rc(e,{...i,fields:a})},Ac=e=>{const t=Id(e);e.updateChat(t,{properties:{startChatAgainPending:!0}})},Fc=function(e,t,n){let{chatId:r,forced:a}=void 0===n?{}:n;e.updateChat("liveChatChatId",{properties:{startChatAgainPending:!1}}),qc(e);const{properties:{lastThread:i},serverId:o}=e.getChat("liveChatChatId");if(a||!zd(e)||o&&r!==o)e.flushChat(t),r&&e.setChatServerId("liveChatChatId",r);else{Nc(e);const t=Ld(e,"liveChatChatId");t&&e.removeEvent("liveChatChatId",t.id)}e.updateChat(t,{properties:{agentIsTyping:!1,ended:!1,fakeAgentMessageId:null,lastThread:i,loadingHistory:!1,queued:!1,rate:null,rateComment:null,transcriptSentTo:null}}),e.setApplicationState({greetingsMuted:!1})},xc=e=>{e.updateChat("liveChatChatId",{properties:{rate:null,rateComment:null,transcriptSentTo:null}})},Ic=(e,t)=>{const n=t.getApplicationState("config");t.setApplicationState({config:{...n,features:{...n.features,homeScreen:{enabled:_d(e)},utmParams:{enabled:bd(e)},fileSharing:{enabled:"1"===e.properties.license.core["attachments.enable_for_visitors"]},agentAvatar:{enabled:e.__unsafeProperties.group.hasAgentAvatarsEnabled},continuousChat:{enabled:"1"===e.properties.license.core.continuous_chat_widget_enabled},chatHistory:{enabled:"1"===e.properties.license.core.customer_history_enabled},rating:{enabled:e.__unsafeProperties.group.ratingEnabled},emailTranscript:{enabled:e.__unsafeProperties.group.transcriptButtonEnabled},logo:e.__unsafeProperties.group.logo.enabled?{enabled:!0,path:e.__unsafeProperties.group.logo.src}:{enabled:!1,path:void 0},linksPreview:{enabled:e.__unsafeProperties.group.linksUnfurlingEnabled},ticketForm:{enabled:"ticketForm"in e,mode:e.__unsafeProperties.ticketFormMode||bu(e)},queue:{writingInQueueEnabled:md(e)},preChatForm:{enabled:"prechatForm"in e},preChatAfterGreeting:{enabled:e.__unsafeProperties.group.prechatFormAfterGreetingEnabled},creditCardMasking:{enabled:!!e.__unsafeProperties.license&&e.__unsafeProperties.license.creditCardMaskingEnabled},hideTrademark:{enabled:e.__unsafeProperties.group.hasHiddenTrademark||!1===e.isPoweredByEnabled},disableSounds:{enabled:!e.__unsafeProperties.group.hasSoundsEnabled},minimized:{enabled:!e.__unsafeProperties.group.disabledMinimized},mobileMinimized:{enabled:e.__unsafeProperties.group.hasCustomMobileSettings?!e.__unsafeProperties.group.disabledMinimizedOnMobile:!e.__unsafeProperties.group.disabledMinimized},hideOnInit:{enabled:e.__unsafeProperties.group.hideOnInit}},minimizedType:e.__unsafeProperties.group.minimizedType,mobileMinimizedType:e.__unsafeProperties.group.minimizedTypeOnMobile,theme:Me(n.theme,Ql(e.__unsafeProperties.group.theme)),screenPosition:e.__unsafeProperties.group.screenPosition,mobileScreenPosition:e.__unsafeProperties.group.hasCustomMobileSettings?e.__unsafeProperties.group.screenPositionOnMobile:e.__unsafeProperties.group.screenPosition,nonProfitLicense:!!e.__unsafeProperties.license&&e.__unsafeProperties.license.nonProfit,properties:e.properties,screenOffset:{x:e.__unsafeProperties.group.offsetX,y:e.__unsafeProperties.group.offsetY}}}),t.getApplicationState("config").features.disableSounds.enabled&&t.setApplicationState({muted:!0})},Sc=(e,t,n)=>{const r=e.getApplicationState("config");e.setApplicationState({config:{...r,features:Me(r.features,{[t]:n})}})},Bc=(e,t)=>{Sc(e,t,{enabled:!1})},Tc=(e,t,n)=>{Sc(e,t,{enabled:!0,...n})},zc=(e,t)=>{try{const n=JSON.parse(t).filter(e=>{let{template_id:t}=e;return"moment"===t||"links"===t});if(Ie(n))return;Tc(e,"boosters",{items:n.map(e=>{if("links"===e.template_id)return{id:e.id,template:e.template_id,links:e.links};const t={type:e.action.type,label:e.action.label,url:e.action.url};return{id:e.id,template:e.template_id,title:e.title,description:e.description,icon:e.icon,action:t}})})}catch(n){}},Mc=(e,t,n)=>{const r={answered:!0};n&&(r.fields=n.properties.fields,n.id&&e.setEventServerId("liveChatChatId",t,n.id)),e.updateEvent("liveChatChatId",t,{properties:r})},Pc=(e,t)=>{var n;t.properties.receivedFirstTime&&tc(e.getSessionUser().serverId,.01)&&(n={minimizedType:$d(e),greetingId:t.properties.id,greetingUniqueId:t.properties.uniqueId,greetingType:t.properties.type,greetingSubtype:t.properties.subtype,greetingAddon:t.properties.addon||"none"},Ol("greeting_displayed",n))},Oc=(e,t)=>{const{defaultWidget:n,embedded:r,actingAsDirectLink:a,greetingsMuted:i}=e.getApplicationState();Cc(e,t.author),"openwidget"===n&&(e=>{const t=e.getApplicationState("recommendations");xl(),ed(e,{eventsQueue:[]},{scheduleRerender:!1}),nd(e,{transitionState:"hidden",hidden:!0}),td(e,{transitionState:"hidden",hidden:!0}),rd(e,{transitionState:"hidden",hidden:!0}),e.setApplicationState({recommendations:{...t,isVisible:!1,hiddenIds:[].concat(t.hiddenIds,[t.id]),hidden:!0}})})(e),"bar"!==$d(e)&&oc(e),Vc(e),Zc(e);const o=Fp(e);var s,u,l,c,d,p;o&&(p={minimizedType:$d(e),greetingId:null==(s=o.properties)?void 0:s.id,greetingUniqueId:null==(u=o.properties)?void 0:u.uniqueId,greetingType:null==(l=o.properties)?void 0:l.type,greetingSubtype:null==(c=o.properties)?void 0:c.subtype,greetingAddon:(null==(d=o.properties)?void 0:d.addon)||"none"},Ol("greeting_not_canceled",p),e.removeEvent("liveChatChatId",o.id));me(t.properties.cards||t.properties.card).filter(Boolean).forEach(t=>{t.title&&(t.title=hd(e,t.title)),t.subtitle&&(t.subtitle=hd(e,t.subtitle)),t.buttons&&(t.buttons.forEach(e=>e.invitation=!0),r&&!a||t.buttons.filter(e=>"url"===e.type&&"target"in e).forEach(e=>e.target="new"))});const h=Ae(e.getIndexedEvents("liveChatChatId"));rc(e,"liveChatChatId",{...t,seen:!i,id:h,properties:{...t.properties,...t.properties.text&&{text:hd(e,t.properties.text)}}}),e.updateChat("liveChatChatId",{properties:{fakeAgentMessageId:h}}),e.setApplicationState({invitation:{...e.getApplicationState("invitation"),current:h}}),t.properties.receivedFirstTime&&e.setCurrentView("Chat"),Up(e,"maximized")||(xp(e,t)&&t.properties.receivedFirstTime&&!i?cc(e,{shouldMaintainModality:!1}):xp(e,t)||dc(e,!0)),i||Pc(e,t),e.emit("render-minimized")},jc=(e,t)=>{const n=(new Date).toISOString();e.setApplicationState({config:{...e.getApplicationState("config"),features:{...e.getApplicationState("config").features,ticketForm:{...e.getApplicationState("config").features.ticketForm,additionalInfo:{lastDisplayedReason:t,lastDisplayedAt:n}}}}}),Rc(e,e.getView("Chat/ticketForm"))},Rc=(e,t)=>{const n={formType:t.type,formId:t.id,fields:t.fields};if(ap(e)){const{id:t}=e.getLastEvent("liveChatChatId");return e.updateEvent("liveChatChatId",t,{properties:n})}const r=Ae(e.getIndexedEvents("liveChatChatId"));return rc(e,"liveChatChatId",{id:r,type:"form",author:"system",properties:n})},$c=(e,t)=>{const n=e.getView("Moment");if(n.show&&!t.wasTriggeredByGreeting)return n.data.url===t.url?void e.emit("request_expand_moment"):void e.emit("request_expand_moment",{nextMoment:t});Ad(t.url)?(e.updateView("Moment",{show:!0,data:t}),n.show&&e.emit("request_expand_moment")):ac(e,"liveChatChatId",{text:"Link attached to the button is invalid."})},qc=function(e,t){void 0===t&&(t=!1),e.updateView("Moment",{show:!1,data:{}}),t&&dc(e)},Uc=(e,t)=>{e.requestUpdateUser(e.getSessionUser().id,t)},Lc=(e,t)=>{var n;e.setUserServerId(e.getSessionUser().id,t),e.setApplicationState({testGroup:(n=t,ec(n)%2?"A":"B")})},Nc=function(e,t){if(void 0===t&&(t=void 0),ap(e,t)){const{id:t}=e.getLastEvent("liveChatChatId");e.removeEvent("liveChatChatId",t)}},Vc=e=>{Nc(e,"prechat")},Hc=e=>{Nc(e,"postchat")},Zc=e=>{Nc(e,"ticket")},Gc=(e,t,n)=>{const r=Fe("error.details.errors",e);if(!r)return void n();const a=r.reduce((e,n)=>"requester.email"===n.field?{...e,email:t("invalid_email")}:"requester.name"===n.field?{...e,name:n.message}:e,{});Ie(a)?n():n(a)},Yc=e=>{const t="email_prompt",{properties:{lastThread:n}}=e.getChat("liveChatChatId");e.hasEvent("liveChatChatId",t)&&e.removeEvent("liveChatChatId",t);!!wp(e).find(e=>"form"===e.type&&"ask_for_email"===e.properties.formId)||e.addEvent("liveChatChatId",{id:t,serverId:null,seen:!0,type:"email_prompt",author:"system",thread:n})},Wc=function(e,t,n,r){void 0===r&&(r=!1),xe(n.type,["message","webview"])&&cc(e);const a=Id(e);switch(e.emit("rich_greeting_button_clicked",{button:n,event:e.getEvent(a,t)}),n.type){case"message":Dc(e,a,n.text,{event:t,button:n});break;case"webview":$c(e,{url:n.value,wasTriggeredByGreeting:r,source:r?"targeted_message":"rich_message"});break;case"cancel":Kc(e,a,t);break;case"copy":return void _u(n.value)}},Jc=e=>{e.emit("start_thread")},Qc=function(e,t,n){void 0===n&&(n="button");const r=e.getChat("liveChatChatId"),a=xe("image",t.type);(xe(["clipboard","drag"],n)||Math.random()<.1)&&Ol("file_upload_added",{uploadSource:n}),e.sendEvent("liveChatChatId",{type:"file",thread:r.properties.lastThread,properties:{name:t.name.substring(0,255),progress:0,finished:!1,failed:!1,failReason:null,fileType:a?"image":"other",url:a?URL.createObjectURL(t):null,uploadSource:n}},{file:t})},Xc=(e,t)=>{Ip(e)&&Ap(e)&&e.setApplicationState({greetingsMuted:!0}),e.removeEvent("liveChatChatId",t),setTimeout(()=>e.emit("render-minimized"),0)},Kc=(e,t,n)=>{const r=e.getChat(t),{mobile:a}=e.getApplicationState(),i=e.getEvent(t,n);var o;!r.active&&i&&(tc(e.getSessionUser().serverId,.01)&&(o={mobile:a,greetingId:i.properties.id,greetingUniqueId:i.properties.uniqueId,greetingType:i.properties.type,greetingSubtype:i.properties.subtype,greetingAddon:i.properties.addon||"none",minimizedType:$d(e)},Ol("greeting_canceled",o)),e.emit("request_cancel_greeting",i))},ed=function(e,t,n){let{scheduleRerender:r=!0}=void 0===n?{}:n;const a=e.getView("minimized"),i={...a,...t};JSON.stringify(a)!==JSON.stringify(i)&&(e.updateView("minimized",i),r&&setTimeout(()=>e.emit("render-minimized"),0))},td=(e,t)=>{const{session:n,transitionState:r}=t,a={...e.getApplicationState("visitorCounter")||{},...n&&{session:n},transitionState:r,...void 0!==t.hidden?{hidden:t.hidden}:{},isVisible:!!r&&"hidden"!==r};e.setApplicationState({visitorCounter:a}),e.emit("render-minimized")},nd=(e,t)=>{const{transitionState:n}=t,r={...e.getApplicationState("googleReviews"),transitionState:n,...void 0!==t.hidden?{hidden:t.hidden}:{},isVisible:!!n&&"hidden"!==n};e.setApplicationState({googleReviews:r}),e.emit("render-minimized")},rd=(e,t)=>{var n;const r=e.getApplicationState("contactInvitation"),a=null!=(n=t.transitionState)?n:r.transitionState,i={...r,transitionState:a,...void 0!==t.hidden?{hidden:t.hidden}:{},isVisible:!!a&&"hidden"!==a,hasSeen:void 0!==t.hasSeen?t.hasSeen:r.hasSeen};e.setApplicationState({contactInvitation:i}),t.transitionState&&e.emit("render-minimized")},ad=(e,t)=>{var n;const r=e.getApplicationState("chatBotGreeting"),a=null!=(n=t.transitionState)?n:r.transitionState,i={...r,transitionState:a,isVisible:!!a&&"hidden"!==a,text:void 0!==t.text?t.text:r.text,hidden:void 0!==t.hidden?t.hidden:r.hidden,hasSeen:void 0!==t.hasSeen?t.hasSeen:r.hasSeen};e.setApplicationState({chatBotGreeting:i}),t.transitionState&&e.emit("render-minimized")},id=(e,t)=>{const{history:n}=e.getApplicationState("locationHistory"),r=(new Date).getTime();if(n.length&&Be(n)===t)return void e.setApplicationState({locationHistory:{history:n,updatedAt:r}});const a=[].concat(n.slice(-10),[t]);e.setApplicationState({locationHistory:{history:a,updatedAt:r}})},od=()=>{const e=z(window.location.search);return parseInt((()=>{const e=String(window.location).match(/licen(?:s|c)e\/g?(\d+)/);return e?e[1]:null})()||e.license_id,10)},sd=()=>z(window.location.search).organizationId||"",ud=e=>{const t=parseInt(e,10);return t>-1?t:null},ld=e=>"group"in e?ud(e.group):"groups"in e?ud(e.groups):null,cd=()=>"1"===et("unique_groups",window.location.search)||"1"===et("unique_group",window.location.search),dd=e=>{const{name:t}=e.getSessionUser();return t||e.localize("client")},pd=e=>{const t=Sd("liveChatChatId",e);if(!t)throw new Error("Current chat agent is undefined");if(!t.name)throw new Error("Current chat agent name is undefined");return t.name},hd=function(e,t,n){void 0===n&&(n={});const{name:r=dd(e),agent:a=pd(e)}=n;return t.replace(/%name%/g,r).replace(/%agent%/g,a)},fd=e=>Ps(e)>.7,gd=e=>Ps(e)<=.179,md=e=>{var t;return Boolean(null==(t=e.properties.license.bb9e5b2f1ab480e4a715977b7b1b4279)?void 0:t.messaging_in_queue_enabled)},_d=e=>{var t;return Boolean(null==(t=e.properties.group.bb9e5b2f1ab480e4a715977b7b1b4279)?void 0:t.homescreen_enabled)},bd=e=>{var t;return Boolean(null==(t=e.properties.license.bb9e5b2f1ab480e4a715977b7b1b4279)?void 0:t.utm_params_enabled)},vd=e=>"https://"+e+"."+("api"===e?"livechatinc":"livechat")+".com",Dd=()=>{const e=document.createElement("video"),t=document.createElement("canvas");return navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia?navigator.mediaDevices.getDisplayMedia({video:{cursor:"always",displaySurface:"browser"},audio:!1}).then(t=>(e.srcObject=t,e.play())).then(()=>new Promise(e=>{setTimeout(e,150)})).then(()=>{t.width=e.videoWidth,t.height=e.videoHeight;t.getContext("2d").drawImage(e,0,0,e.videoWidth,e.videoHeight);const n=((e,t)=>{const[n,r]=e.split(","),a=n.match(/:(.*?);/)[1],i=atob(r);let o=i.length;const s=new Uint8Array(o);for(;o--;)s[o]=i.charCodeAt(o);return new File([s],t,{type:a})})(t.toDataURL("image/png"),"screenshot.png");return e.srcObject.getTracks().forEach(e=>e.stop()),n}):Promise.reject(new Error("Screen sharing is not supported"))},yd=e=>gd(e)?Ms(.1,Rs(.1,e)):Ms(.2,Ts(.15,e));function wd(e,t,n){if(e.startsWith(n))return e;const r=[e,t],a=JSON.stringify(r),i=btoa(a),o=new URL("/v1.0/t/link",n);return o.searchParams.set("d",i),o.toString()}function Cd(e){return"https://cdn.livechat-files.com/api/file/lc/main/default/logo/sz2tt7jpJ6VJwBo.png"===lt(e)}const Ed=e=>{const{x:t,y:n,width:r,height:a}=e.target.getBoundingClientRect();return{x:t,y:n,width:r,height:a}},kd=(e,t)=>{const{name:n,email:r}=fe(e=>"string"==typeof e?We(e):e,$e(["email","name"],e));return n===t("client")?{email:r}:{email:r,name:n}},Ad=e=>!!e&&(e=>{const t=ot(e);return!t||"https:"===t||!1})(pu(e)),Fd=e=>{var t;return{id:e.id,name:null!=(t=e.title)?t:"",text:e.description,icon:e.icon,action:{label:e.action.label,type:"button",value:e.action.url},properties:{}}},xd=(e,t)=>{var n,r,a,i;const o=Bd("logo",e),s=o.enabled?lt(o.path):"",u=Bd("boosters",e),l=null==(n=u.items)?void 0:n.find(e=>xo(e.id)),c=null==(r=u.items)?void 0:r.find(e=>Fo(e.id)),d=null==(a=u.items)?void 0:a.find(e=>"links"===e.id),p=null==(i=e.getApplicationState("config").properties.license.feade1d6c3f17748ae4c8d917a1e1068)?void 0:i.hdLicenseID,h="number"==typeof p&&p>-1,f=e.getApplicationState("config").properties.group,g={apps:[],channels:[]};l&&g.apps.push({...Fd(l),trademarkLink:"https://www.knowledgebase.com/?utm_source=chat_window&utm_medium=referral&utm_campaign=home_screen",trademarkLinkAnchor:"Powered by KnowledgeBase"}),c&&h&&(g.apps.push(Fd(c)),e.on("send_helpdesk_form",n=>{t(n).then(t=>e.emit("send_helpdesk_form_success",t)).catch(t=>e.emit("send_helpdesk_form_error",t))}),e.addView("HelpdeskTicketForm",{isLoading:!0,hasFetchingError:!1})),Ie(f)||_e(Uo()).forEach(e=>{let[t,n]=e;const r=f[n];r&&g.channels.push({name:t,url:r.button_url_v2})}),e.addView("Homescreen",g),Tc(e,"livechatIntegration",{name:"livechat_integration",enabled:!0,properties:{licenseId:e.getApplicationState().license}}),d&&Tc(e,"links",{enabled:!0,name:"links",properties:{links:d.links}}),e.setApplicationState({header:{text:"",logo:s,backgroundType:"gradient"}})},Id=e=>{const{currentChat:t}=e.getApplicationState();if(!t)throw new Error("Current chat is not set");return t},Sd=(e,t)=>{const n=t.getChat(e).properties.currentAgent;return n?rh(t,n):null},Bd=(e,t)=>t.getApplicationState("config").features[e],Td=e=>Bd("continuousChat",e).enabled,zd=e=>Bd("chatHistory",e).enabled,Md=e=>rp(e)&&!Td(e),Pd=(e,t,n)=>{let{authorPredicate:r,lastSeenPredicate:a}=t;const i=n.getEvents(e),o=Ze(e=>r(e)||!e.seen,we(a,i),i);return Le(r,o)},Od=(e,t,n)=>{const r=n.getSessionUserId();return Pd(e,{authorPredicate:e=>e.author!==r,lastSeenPredicate:e=>(e.serverTimestamp||e.timestamp)<=t},n)},jd=(e,t,n)=>{const r=n.getSessionUserId();return Pd(e,{authorPredicate:e=>e.author===r,lastSeenPredicate:e=>e.timestamp<=t},n)},Rd=(e,t,n)=>{const r=e.getEvent(t,n);if("message_draft"===r.type&&null===r.serverId){const n=De(e=>"message_draft"===e.type,e.getEvents(t));return r.id===(null==n?void 0:n.id)?e.localize("not_sent_yet"):null}if(!r.own)return null;if(r.failed)return"Message not sent";if(r.seen){const r=e.getLastSeenEvent(t);return r&&n===r.id?e.localize("message_read"):null}const a=e.getLastDeliveredEvent(t);return a&&n===a.id?e.localize("message_delivered"):null},$d=e=>{const t=e.getApplicationState("config");return!0===e.getApplicationState("mobile")?t.mobileMinimizedType:t.minimizedType},qd=e=>{const{config:t}=e.getApplicationState();return!0===e.getApplicationState("mobile")?t.mobileScreenPosition:t.screenPosition},Ud=(e,t)=>zd(e)&&e.getChat(t).properties.hasMoreHistory,Ld=(e,t)=>{const{fakeAgentMessageId:n}=e.getChat(t).properties;return n?e.getEvent(t,n):null},Nd=(e,t)=>!!Ld(e,t),Vd=e=>{const{embedded:t,actingAsDirectLink:n,isInCustomContainer:r,isMinimizedForcefullyDisabled:a}=e.getApplicationState();return!(!t||n||r||a)},Hd=(e,t)=>{const{active:n,properties:{queued:r}}=t.getChat("liveChatChatId");if(n||r)return!1;const{availability:a,readyState:i}=t.getApplicationState();return!(!Td(t)&&"online"!==a)&&("not_ready"===i||(!Up(t,"maximized")||Ie(t.getEvents(e))))},Zd=(e,t)=>{if(zd(t))return!1;const{availability:n,embedded:r,actingAsDirectLink:a,isInCustomContainer:i,defaultWidget:o}=t.getApplicationState(),s=t.getChat(e);return"livechat"===o&&r&&!a&&!i&&!s.active&&!s.properties.ended&&"offline"===n&&!rp(t)},Gd=e=>"connected"===e.getConnectionState(),Yd=e=>"disconnected"===e.getConnectionState(),Wd=e=>"reconnecting"===e.getConnectionState()||Yd(e),Jd=(e,t)=>{if(t<0)return null;const n=e[t];return n.own&&"message"===n.type?null:"system_message"===n.type||"rich_message_postback"===n.type?Jd(e,t-1):n.properties.quickReplies?n:null},Qd=(e,t)=>{const n=t.getEvents(e),r=Jd(n,n.length-1);return r&&(r.properties.invitation||t.getChat(e).active)?r:null},Xd=(e,t)=>{const{availability:n}=t.getApplicationState(),{active:r,properties:{queued:a,ended:i}}=t.getChat(e);if(a)return t.localize("embedded_waiting_for_operator");const o=Sd(e,t);return r&&o?t.localize("embedded_chat_with",{operator:o.name}):i?t.localize("embedded_chat_ended"):"online"===n?t.localize("embedded_chat_now"):rp(t)||Td(t)?t.localize("embedded_leave_message"):t.localize("agents_not_available")},Kd=(e,t)=>{var n;const r=e.getChat(t),a=Td(e);if(e.getApplicationState().limitReached)return null;if(mp(e)&&!_p(e))return null;if("chatbotChatId"===t&&!r.properties.ended&&!1===(null==(n=Bd("chatbotIntegration",e))?void 0:n.properties.showTextField))return r.properties.isAnsweringQuestion?"text":null;if(r.active){var i;const n=Ep(e),r=e.getChat(t).properties.currentAgent;return null!=n&&null!=(i=n.properties)&&i.useFixedAnswers&&(null==n?void 0:n.author)===r?null:"text"}return Pp(e,t)||ap(e)?null:!r.properties.ended||a&&!np(e)&&"chatbotChatId"!==t?a||"offline"!==e.getApplicationState().availability?Nd(e,"liveChatChatId")?np(e)&&Bd("preChatAfterGreeting",e).enabled?"requestPrechat":null!=(o=Sd(t,e))&&o.properties.isBot&&!r.properties.starting||ip(e)?"startChat":"text":a?np(e)?"offline"===e.getApplicationState().availability?null:"requestPrechat":"text":a&&r.properties.ended?"text":null:null:"startChatAgain";var o},ep=(e,t)=>!!t.getChat(e).properties.starting,tp=e=>e.getApplicationState("config").theme.name,np=e=>e.getApplicationState().config.features.preChatForm.enabled,rp=e=>e.getApplicationState().config.features.ticketForm.enabled,ap=function(e,t){void 0===t&&(t=void 0);const n=De(e=>"form"===e.type,e.getEvents("liveChatChatId"));if(!n)return!1;const{properties:r}=n;return!r.answered&&"ask_for_email"!==r.formId&&("string"!=typeof t||r.formType===t)},ip=e=>{const{properties:{groupHasProbableQueue:t}}=e.getChat("liveChatChatId");return!!t},op=e=>{const{active:t,properties:{queued:n,ended:r,startChatAgainPending:a,currentAgent:i}}=e.getChat("liveChatChatId"),{availability:o,limitReached:s}=e.getApplicationState(),u=Td(e),l=rp(e);return!(!s||l&&!u)||"offline"===o&&(!(r&&!a)&&(u?!i&&!n:!t&&!n&&!l))},sp=e=>{const t=Id(e);return Boolean(Sd(t,e))&&!("modern"===tp(e)&&ap(e))&&!((e,t)=>!!t.getChat(e).properties.queued)(t,e)&&!op(e)},up=e=>{var t;return Boolean(null==(t=e.getView("Homescreen"))||null==(t=t.apps)?void 0:t.find(e=>Fo(e.id)))},lp=e=>{const t=e.getApplicationState().defaultWidget,n=Id(e);return"openAIChatId"===n||"chatbotChatId"===n?!e.getChat(n).properties.agentIsTyping&&("Chat"===e.getCurrentView()&&Tp(e)):("openwidget"!==t||"Chat"===e.getCurrentView())&&(!(!mp(e)||e.getView("Chat/queue"))||!Mp(e)&&Tp(e))},cp=e=>{const t=e.getLastEvent("liveChatChatId");return!!t&&("form"===t.type&&"ticket"===t.properties.formType&&t.properties.answered)},dp=e=>{const{nonProfitLicense:t}=e.getApplicationState("config");return t},pp=e=>{const{actingAsDirectLink:t,isInCustomContainer:n,mobileWrapper:r,embedded:a}=e.getApplicationState();return!t&&!n&&(r||a)},hp=e=>Boolean(e.getApplicationState("invitation").current),fp=e=>{const{lastThread:t,currentAgent:n,queued:r}=e.getChat("liveChatChatId").properties;if(!Td(e)||n||r)return!1;return!!!De(e=>{let{type:n,thread:r}=e;return"email_prompt"===n&&r===t},e.getEvents("liveChatChatId"))},gp=e=>{const t=wp(e);return e.getChat("liveChatChatId").active&&t.some(e=>e.properties.welcomeMessage&&!e.own)},mp=e=>e.getChat("liveChatChatId").properties.queued,_p=e=>{var t;return Boolean(null==(t=Bd("queue",e))?void 0:t.writingInQueueEnabled)},bp=e=>Bd("fileSharing",e).enabled,vp=e=>{const{active:t}=e.getChat("liveChatChatId");return t&&!Wd(e)},Dp=e=>!Wd(e)&&!e.getApplicationState("disableSendingMessage"),yp=Xr([e=>pa(e,"liveChatChatId"),e=>ha(e,"liveChatChatId").properties.lastThread],(e,t)=>{return Ze(e=>e.thread===t,(n=e).length-1,n);var n}),wp=e=>yp(e.getState()),Cp=Xr([e=>yp(e),e=>ya(e)],(e,t)=>De(e=>"system"!==e.author&&e.author!==t,e)),Ep=e=>Cp(e.getState()),kp=(e,t)=>{if(e.hasEvent("liveChatChatId",t)){const{properties:n}=e.getEvent("liveChatChatId",t);return n.invitation}return!1},Ap=e=>!e.getApplicationState().mobile&&"bar"===$d(e),Fp=e=>{const t=Ld(e,"liveChatChatId");return t&&t.properties.invitation?t:null},xp=function(e,t){void 0===t&&(t=Fp(e));const{availability:n,invitation:r}=e.getApplicationState();return!(("offline"!==n||Td(e))&&!Ap(e))||(!t||Boolean(t&&xe(t.properties.uniqueId,r.hiddenIds)))},Ip=function(e,t){void 0===t&&(t=Fp(e));const{invitation:n}=e.getApplicationState();return Boolean(t&&xe(t.properties.uniqueId,n.displayedIds))},Sp=e=>!wp(e).some(e=>{let{author:t,own:n}=e;return!n&&"system"!==t}),Bp=e=>{const{formType:t,fields:n,answered:r}=e.properties,a=n.filter(e=>e.answer&&e.label);return"ticket"!==t&&r&&Ie(a)},Tp=e=>{const t=Id(e),n=e.getEvents(t);return Ie(n)||n.every(e=>"form"===e.type&&Bp(e))},zp=e=>{const t=e.getEvents("liveChatChatId");return Ie(t)||t.every(e=>"form"===e.type&&Bp(e)||e.properties.invitation||e.properties.welcomeMessage)},Mp=e=>sp(e)||op(e)||mp(e),Pp=(e,t)=>e.getEvents(t).some(e=>"message_draft"===e.type&&null===e.serverId),Op=e=>{const{embedded:t,actingAsDirectLink:n}=e.getApplicationState();return!t||n?"direct_link":"code"},jp=Xr([e=>yp(e)],e=>e.filter(e=>"file"===e.type&&!e.delivered&&!e.properties.canceled)),Rp=e=>jp(e.getState()),$p=e=>e.getChat("liveChatChatId").serverId,qp=e=>{const{mobile:t}=e.getApplicationState();return Bd(t?"mobileMinimized":"minimized",e).enabled},Up=(e,t)=>e.getApplicationState("visibility").state===t,Lp=(e,t)=>{const n=e.getApplicationState("config").properties.license;return Object.keys(n).some(e=>n[e][t])},Np=e=>Bd("hideTrademark",e).enabled||"Shopify"===e.getApplicationState("integrationName"),Vp=(e,t)=>e.getApplicationState("config").properties.license[t],Hp=e=>{const{language:t,isPreview:n}=e.getApplicationState();if("en"!==t||n)return!1;const r=Vp(e,"a9f288b2883da20306d30e179067406f");return Boolean(null==r?void 0:r.transfer_identity_enabled)},Zp=e=>{const t=Vp(e,"632cead4b282481a422dd4e1d1567449");return{url:null==t?void 0:t.widget_message_box_moment_url,height:null==t?void 0:t.widget_message_box_moment_height}},Gp=e=>{var t;const{url:n}=Zp(e);return{disabled:!e.getChat("liveChatChatId").active||!Sd("liveChatChatId",e),visible:Ad(n)&&(null==(t=e.getView("Moment"))||null==(t=t.data)?void 0:t.url)!==n}},Yp=e=>e.getChat("liveChatChatId").active?e.getChat("liveChatChatId").properties.lastThread:null,Wp=e=>e.getView("minimized"),Jp=e=>{const{history:t,updatedAt:n}=e.getApplicationState("locationHistory");return n-(new Date).getTime()>18e5?[]:t},Qp=e=>{var t;return Boolean(null==(t=e.getApplicationState("recommendations"))?void 0:t.isVisible)},Xp=e=>e.localize(e.getApplicationState("limitReached")||!Td(e)?"agents_not_available":"agents_not_available_continuous"),Kp=e=>{const t=e.getView("Chat/queue"),n=t&&t.numberInQueue,r=(e=>{const t=e.localize("user_in_queue"),{fields:n}=e.getView("Chat/prechat");if(!n||Ie(n))return t;const r=n.find(e=>{let{meta:t}=e;return t&&"groupSelect"===t});if(!r||!r.options||Ie(r.options))return t;const a=r.options.find(t=>{let{groupNumber:n}=t;return n===e.getApplicationState("group")});return a&&a.queueTemplate?a.queueTemplate:t})(e),a=r.includes("%minutes%");let i=r.replace(/%number%/g,"**"+n+"**"),o=null;return a&&(o=Math.floor(t.waitingTime/60),i=i.replace(/%minutes%/g,"**"+o+"**")),{message:i,waitingTime:o}},eh=e=>{if(e.getApplicationState("isPreview"))return!1;if(!Bd("rating",e).enabled)return!1;if(Wd(e))return!1;const{active:t,properties:{rate:n}}=e.getChat("liveChatChatId");if(!t||n)return!1;return(e=>{const{properties:{timestamp:t}}=e.getChat("liveChatChatId");if(!t)return 0;const n=wp(e);if(!n||0===(null==n?void 0:n.length))return 0;const r=De(e=>"system_message"!==e.type,n);return r?r.timestamp-t:0})(e)/1e3/60>2&&(e=>wp(e).some(e=>{let{author:t,own:n,properties:r}=e;return!n&&"system"!==t&&!r.invitation&&!r.welcomeMessage}))(e)},th=e=>"offline"===e.getApplicationState("availability"),nh=e=>{if(!Bd("homeScreen",e).enabled)return!1;return!("modern"===tp(e))},rh=(e,t)=>{const n=e.getUser(t);var r;return"openai_bot"===n.id?{...n,avatar:null!=(r=n.avatar)?r:"https://cdn.files-text.com/api/ow/img/integrations/openai/orb.gif"}:n},ah=(e,t)=>{if(!t)return"_blank";if("chatbotChatId"!==Id(e))return"_blank";const{page:n}=e.getApplicationState();return Ke(t)===Ke(n.url)?"_parent":"_blank"},ih=e=>{const t=Fp(e);return t&&t.properties.quickReplies?t:null},oh=e=>Pe(Uo()).some(t=>Boolean(((e,t)=>e.getApplicationState("config").properties.group[t])(e,t))),sh=e=>{const{page:t}=e.getApplicationState(),n=Ke(t.url);return!!n&&("text.com"===n||n.endsWith(".text.com"))},uh={};function lh(e,t){let{query:n={},jsonpParam:r="jsonp",callbackName:a}=void 0===t?{}:t;return new Promise((t,i)=>{Ks().then(o=>{const s=document.createElement("script"),u=a||Ae(uh);uh[u]=!0;const l="__"+u;window[l]=e=>{delete uh[u],delete window[l],eu(s),t(e)},s.src=e+"?"+O({...n,[r]:l}),s.addEventListener("error",()=>{setTimeout(()=>i(new Error("JSONP request failed.")),100)}),o.appendChild(s)})})}const ch=/\.([a-z]{1,})$/i,dh=e=>{let{__priv:t}=e;const n={enabled:!0,x:parseInt(t.group["embedded_chat.eye_grabber.x"])+15,y:parseInt(t.group["embedded_chat.eye_grabber.y"]),src:lt(t.group["embedded_chat.eye_grabber.path"])};if(-1!==n.src.indexOf("/default/eyeCatchers/")){const e=n.src.match(ch)[1];n.srcset={"1x":n.src,"2x":n.src.replace(new RegExp("\\."+e,"i"),"-2x."+e)}}return n},ph=e=>{var t;return{"x-region":null!=(t=e.region)?t:""}},hh=(e,t)=>{const n="get_dynamic_configuration"===e?"v3.6":"v3.5";return(e=>{let{region:t}=e;return"https://api"+(e=>"fra"===e||"eu-west3"===e?"-fra":"")(t)+".livechatinc.com"})(t)+"/"+n+"/customer/action/"+e},fh=e=>{let{licenseId:t,organizationId:n}=e;return lh("https://api.livechatinc.com/global-mapper/"+(t?"lc_license_id/"+t:"organization_id/"+n)+"/region",{callbackName:"lc_region"}).then(e=>e.region).catch(()=>{const e=new Error("Fetch region failed");throw e.code="FETCH_REGION_FAILED",e})},gh=function(e,t){let{validateDefaultWidget:n=!0}=void 0===t?{}:t;return lh(hh("get_dynamic_configuration",e),{query:{...ph(e),...e.organizationId?{organization_id:e.organizationId}:{},...e.licenseId?{license_id:e.licenseId}:{},client_id:null!="c5e4f61e1a6c3b1521b541bc5c5a2ac5"?"c5e4f61e1a6c3b1521b541bc5c5a2ac5":"",url:ut(e.url,["cw_configurator"]),..."number"==typeof e.groupId&&{group_id:e.groupId},...e.channelType&&{channel_type:e.channelType},...e.skipCodeInstallationTracking&&{test:1},...e.productName&&{origin:e.productName},...e.integrationName&&{implementation_type:e.integrationName}}}).then(t=>{if(t.error)switch(t.error.type){case"misdirected_request":return gh({...e,region:t.error.data.region});case"license_not_found":{if("direct_link"===e.channelType){const t=O({utm_source:"expired_chat_link",utm_medium:"referral",utm_campaign:"lc_"+e.licenseId});window.location.replace("https://www.livechat.com/expired-chat-link/?"+t)}const t=new Error("License not found");throw t.code="LICENSE_NOT_FOUND",t}default:{const e=new Error(t.error.message);throw e.code=t.error.type.toUpperCase(),e}}if(19196658!==e.licenseId&&"4c8c0751-837f-4a11-928e-047b2d095307"!==e.organizationId||(t.default_widget="livechat"),n&&"livechat"!==t.default_widget){const e=new Error("The 'default_widget' is not 'livechat', but instead: '"+t.default_widget+"'");throw e.code="DEFAULT_WIDGET_NOT_LIVECHAT",e.organizationId=t.organization_id,e.defaultWidget=t.default_widget,e}if(!t.livechat_active){if("direct_link"===e.channelType){const t=O({utm_source:"expired_chat_link",utm_medium:"referral",utm_campaign:"lc_"+e.licenseId});window.location.replace("https://www.livechat.com/expired-chat-link/?"+t)}const t=new Error("License expired");throw t.code="LICENSE_EXPIRED",t}if(!t.livechat.domain_allowed){const e=new Error("Current domain is not added to the allowlist.");throw e.code="DOMAIN_NOT_ALLOWED",e}return r=t,a=e.region,{organizationId:r.organization_id,groupId:r.livechat.group_id,clientLimitExceeded:r.livechat.client_limit_exceeded,configVersion:r.livechat.config_version,localizationVersion:r.livechat.localization_version,onlineGroupIds:r.livechat.online_group_ids||[],region:a||null,language:r.livechat.language};var r,a})},mh=e=>{var t,n;const r="feade1d6c3f17748ae4c8d917a1e1068",a=Boolean(null==(t=e.properties.group[r])?void 0:t.forwardTicketFormToHelpdesk),i="1"===e.__priv.license["helpdesk.inbound_forwarding"],o=null==(n=e.properties.license[r])?void 0:n.hdLicenseID;return"number"==typeof o&&o>-1&&(a||i)},_h=(e,t)=>t.includes(e)?e:t[0],bh=e=>lh(hh("get_configuration",e),{callbackName:"lc_static_config",query:{organization_id:e.organizationId,version:e.version,...ph(e),..."number"==typeof e.groupId&&{group_id:e.groupId}}}).then(e=>(e=>{const{buttons:t,allowed_domains:n,prechat_form:r,ticket_form:a,__priv:i,properties:o,...s}=e,u="0"===i.group.tickets_enabled,l=!Boolean(i.disable_native_tickets)&&Boolean(a),c=mh(e),d=u||c||l;return{...s,...r&&{prechatForm:Jn(r)},...d&&a&&{ticketForm:Jn(a)},properties:o,buttons:t.map(e=>"image"===e.type?{id:e.id,type:e.type,onlineValue:lt(e.online_value),offlineValue:lt(e.offline_value)}:{id:e.id,type:e.type,onlineValue:e.online_value,offlineValue:e.offline_value}),...n&&{allowedDomains:n},__unsafeProperties:{...i.s&&{s:!0},group:{chatBoosters:i.group.chat_boosters,disabledMinimized:"1"===i.group["chat_window.disable_minimized"],disabledMinimizedOnMobile:"1"===i.group["chat_window.mobile_disable_minimized"],disabledOnMobile:"1"===i.group["chat_window.hide_on_mobile"],eyeCatcher:"1"===i.group["embedded_chat.display_eye_catcher"]?dh(e):{enabled:!1},hasAgentAvatarsEnabled:"1"===i.group["chat_window.display_avatar"],hasCustomMobileSettings:"1"===i.group["chat_window.custom_mobile_settings"],hasHiddenTrademark:"1"===i.group["chat_window.hide_trademark"],hasSoundsEnabled:"0"===i.group["chat_window.disable_sounds"],initiallyHidden:"1"===i.group["chat_window.hide_on_init"]||"1"===i.group["chat_window.disable_minimized"],initiallyHiddenOnMobile:"1"===i.group["chat_window.mobile_hide_on_init"]||"1"===i.group["chat_window.mobile_disable_minimized"],hideOnInit:"1"===i.group["chat_window.hide_on_init"],language:i.group.language,linksUnfurlingEnabled:"1"===i.group.links_unfurling,logo:"1"===i.group["chat_window.display_logo"]?{enabled:!0,src:i.group["chat_window.logo_path"]}:{enabled:!1},minimizedType:_h(i.group["chat_window.theme.minimized"],["circle","bar"]),minimizedTypeOnMobile:i.group["chat_window.mobile_minimized_theme"],offlineMessagesEnabled:u,offsetX:parseInt(i.group["chat_window.offset_x"]),offsetXOnMobile:parseInt(i.group["chat_window.mobile_offset_x"]),offsetY:parseInt(i.group["chat_window.offset_y"]),offsetYOnMobile:parseInt(i.group["chat_window.mobile_offset_y"]),prechatFormAfterGreetingEnabled:"1"===i.group.pre_chat_survey_after_greeting,ratingEnabled:"1"===i.group["rate_me.enabled"],screenPosition:_h(i.group["chat_window.screen_position"],["right","left"]),screenPositionOnMobile:_h(i.group["chat_window.mobile_screen_position"],["right","left"]),transcriptButtonEnabled:"1"===i.group["chat_window.display_transcript_button"],theme:{name:_h(i.group["chat_window.new_theme.name"],["smooth","modern"]),variant:_h(i.group["chat_window.new_theme.variant"],["light","dark"]),customJson:i.group["chat_window.new_theme.custom_json"],agentbarBackgroundColor:i.group["chat_window.new_theme.agentbar_background_color"],agentbarText:i.group["chat_window.new_theme.agentbar_text"],agentMessageColorBackground:i.group["chat_window.new_theme.agent_message_color_background"],agentMessageColorText:i.group["chat_window.new_theme.agent_message_color_text"],backgroundColor:i.group["chat_window.new_theme.background_color"],ctaColor:i.group["chat_window.new_theme.cta_color"],minimizedColorBackground:i.group["chat_window.new_theme.minimized_color_background"],minimizedColorIcon:i.group["chat_window.new_theme.minimized_color_icon"],minimizedColorText:i.group["chat_window.new_theme.minimized_color_text"],systemMessageColor:i.group["chat_window.new_theme.system_message_color"],titlebarBackgroundColor:i.group["chat_window.new_theme.titlebar_background_color"],titlebarText:i.group["chat_window.new_theme.titlebar_text"],visitorMessageColorBackground:i.group["chat_window.new_theme.visitor_message_color_background"],visitorMessageColorText:i.group["chat_window.new_theme.visitor_message_color_text"]}},license:{creditCardMaskingEnabled:"1"===i.license.mask_credit_cards,nonProfit:"1"===i.license.non_profit,licenseinboundForwardingToHelpdeskEnabled:"1"===i.license["helpdesk.inbound_forwarding"]},helpdeskIntegrationEnabled:c,ticketFormMode:(p=e,mh(p)?"helpdesk":"0"===p.__priv.group.tickets_enabled?"offline_message":"livechat")}};var p})(e)),vh=e=>lh(hh("get_localization",e),{callbackName:"lc_localization",query:{organization_id:e.organizationId,version:e.version,language:e.language,...ph(e),..."number"==typeof e.groupId&&{group_id:e.groupId}}}).then(e=>Te(e=>e.toLowerCase(),e));export{Pl as $,K as A,yo as B,ao as C,de as D,sl as E,ha as F,Sa as G,ql as H,Td as I,hp as J,$d as K,lo as L,il as M,Ll as N,cd as O,zd as P,Ud as Q,so as R,uo as S,wp as T,Be as U,nh as V,Rl as W,Ie as X,be as Y,ke as Z,fe as _,st as a,Ga as a$,oe as a0,Z as a1,me as a2,Io as a3,Mo as a4,Gl as a5,dl as a6,Zl as a7,Ue as a8,Ae as a9,Ve as aA,Ou as aB,Wl as aC,Rs as aD,Fe as aE,Nr as aF,cc as aG,dc as aH,Me as aI,Ql as aJ,lt as aK,hd as aL,Ks as aM,zc as aN,xd as aO,up as aP,Ro as aQ,rn as aR,N as aS,he as aT,J as aU,Ra as aV,$a as aW,Na as aX,Va as aY,ii as aZ,si as a_,Cl as aa,xp as ab,pl as ac,Do as ad,xa as ae,np as af,Jc as ag,yc as ah,fa as ai,co as aj,uc as ak,oc as al,xe as am,qp as an,Ol as ao,jl as ap,od as aq,ld as ar,Oo as as,tu as at,eu as au,Xs as av,jo as aw,Bu as ax,Te as ay,Ee as az,rd as b,qs as b$,Ya as b0,Ja as b1,ia as b2,Pa as b3,na as b4,ja as b5,ai as b6,oi as b7,ui as b8,ni as b9,Qe as bA,_a as bB,Oe as bC,De as bD,cn as bE,ze as bF,ln as bG,Ba as bH,sn as bI,ci as bJ,fi as bK,Bl as bL,je as bM,cl as bN,et as bO,Jo as bP,se as bQ,qe as bR,Xo as bS,Qo as bT,Ts as bU,We as bV,Ir as bW,fu as bX,Ps as bY,Ls as bZ,Vs as b_,li as ba,ri as bb,Qa as bc,ua as bd,ba as be,aa as bf,ra as bg,un as bh,Wa as bi,Se as bj,Gr as bk,Pe as bl,qa as bm,Ua as bn,La as bo,ve as bp,Za as bq,Ka as br,Xa as bs,ti as bt,ei as bu,Vr as bv,Oa as bw,Ha as bx,Ma as by,ga as bz,ge as c,tl as c$,Tu as c0,fd as c1,Zs as c2,sc as c3,So as c4,Bo as c5,To as c6,gl as c7,ah as c8,Au as c9,ku as cA,Cu as cB,Eu as cC,yu as cD,Du as cE,Lu as cF,Nu as cG,Hu as cH,Uu as cI,$u as cJ,Ru as cK,qu as cL,Vu as cM,ju as cN,$e as cO,Ke as cP,Dc as cQ,Wp as cR,ed as cS,lc as cT,Wc as cU,Ip as cV,He as cW,qd as cX,Ku as cY,el as cZ,nl as c_,hl as ca,fl as cb,tp as cc,Hp as cd,_o as ce,Ed as cf,$c as cg,pu as ch,bo as ci,vd as cj,hu as ck,nt as cl,qc as cm,Uc as cn,gc as co,Lp as cp,wc as cq,Id as cr,$p as cs,Np as ct,pp as cu,Lr as cv,ul as cw,ad as cx,wd as cy,Bd as cz,Al as d,Md as d$,Yu as d0,Wu as d1,Ju as d2,Xu as d3,Qu as d4,Qp as d5,wl as d6,ml as d7,bl as d8,Dl as d9,sh as dA,eh as dB,op as dC,Xp as dD,mp as dE,zp as dF,ap as dG,Kd as dH,ea as dI,rh as dJ,_c as dK,Ec as dL,ll as dM,Yp as dN,kp as dO,_u as dP,ho as dQ,Qd as dR,sp as dS,at as dT,dp as dU,lp as dV,Fo as dW,Le as dX,ot as dY,xo as dZ,ih as d_,yl as da,vl as db,_l as dc,Fp as dd,Sd as de,Xd as df,bp as dg,vp as dh,vu as di,Xr as dj,U as dk,Rp as dl,jd as dm,Qc as dn,mc as dp,Zp as dq,ac as dr,Wd as ds,Dp as dt,Gp as du,ks as dv,Ac as dw,Lo as dx,Cd as dy,Kp as dz,Tc as e,Yd as e$,Is as e0,_s as e1,kd as e2,Bp as e3,Pp as e4,Rd as e5,Dd as e6,Ep as e7,Yo as e8,Vt as e9,or as eA,ir as eB,ar as eC,$t as eD,kt as eE,Tt as eF,Pt as eG,dt as eH,pt as eI,ft as eJ,gt as eK,mt as eL,_t as eM,vt as eN,Dt as eO,yt as eP,wt as eQ,Et as eR,Ft as eS,St as eT,Bt as eU,Mt as eV,jt as eW,Rt as eX,Vd as eY,ce as eZ,le as e_,Nt as ea,Ut as eb,qt as ec,Lt as ed,It as ee,nn as ef,ht as eg,At as eh,Ot as ei,Zt as ej,Ct as ek,Wt as el,Ht as em,tn as en,en as eo,Qt as ep,Jt as eq,Yt as er,In as es,Gt as et,Kt as eu,Xt as ev,bt as ew,dn as ex,zt as ey,xt as ez,ol as f,Ul as f0,oo as f1,io as f2,Cc as f3,Xc as f4,Zd as f5,pc as f6,Nd as f7,Fc as f8,kc as f9,rc as fA,po as fB,Oc as fC,Hd as fD,fo as fE,Gc as fF,fp as fG,Yc as fH,vo as fI,Eo as fJ,we as fK,bu as fL,Go as fM,Zo as fN,Wo as fO,No as fP,Vo as fQ,Ho as fR,oh as fa,Lc as fb,Gd as fc,Od as fd,Hc as fe,ep as ff,$l as fg,Mc as fh,Bc as fi,mo as fj,xc as fk,rp as fl,cp as fm,Zc as fn,Vc as fo,jc as fp,gp as fq,G as fr,pe as fs,Ld as ft,Op as fu,go as fv,hc as fw,Sp as fx,ic as fy,Pc as fz,nd as g,fh as h,Up as i,gh as j,bh as k,vh as l,ne as m,$o as n,Re as o,ee as p,Sc as q,td as r,Ic as s,Sl as t,ct as u,El as v,_e as w,Po as x,re as y,te as z};