@commversion/libs 0.18.3 → 0.18.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lc-attribution.js +1 -1
- package/dist/lc-channel-widgets.js +51 -4
- package/package.json +1 -1
- package/pnpm-workspace.yaml +1 -0
package/dist/lc-attribution.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var o=class e{constructor(e={}){r(this,`dependencies`,void 0),this.dependencies=e}provide(t){return new e(a(a({},this.dependencies),t(this.dependencies)))}},s=class e{constructor(e,t,n,i,a,o){r(this,`bus`,void 0),r(this,`pageData`,void 0),r(this,`registry`,void 0),r(this,`channelClick`,void 0),r(this,`exitIntent`,void 0),r(this,`form`,void 0),this.bus=e,this.pageData=t,this.registry=n,this.channelClick=i,this.exitIntent=a,this.form=o}static build(t){let{bus:n,pageData:r,registry:i,channelClick:a,exitIntent:o,form:s}=t;return{app:new e(n,r,i,a,o,s)}}init(){this.pageData.init(),this.registry.init(),this.channelClick.init(),this.exitIntent.init(),this.form.init(),this.bus.dispatch(`commversion:attribution-ready`,{})}destroy(){this.registry.destroy(),this.channelClick.destroy(),this.exitIntent.destroy(),this.form.destroy()}},c=class e{constructor(e){r(this,`target`,void 0),this.target=e}on(e,t){let n=e=>{e instanceof CustomEvent&&t(e.detail)};return this.target.addEventListener(e,n),()=>this.target.removeEventListener(e,n)}dispatch(e,t){this.target.dispatchEvent(new CustomEvent(e,{detail:t}))}static build(){return{bus:new e(window)}}},l=class e{constructor(e,t){r(this,`bus`,void 0),r(this,`registry`,void 0),r(this,`unsubscribe`,void 0),this.bus=e,this.registry=t}static build(t){let{bus:n,registry:r}=t;return{channelClick:new e(n,r)}}init(){this.unsubscribe=this.bus.on(`commversion:channel-clicked`,({channel:e})=>{let{sessionVariables:t}=window.LiveChatWidget.get(`customer_data`);this.registry.patchOne(e,{chat_start_url:window.location.href,chat_start_time:new Date().toISOString(),session_variables:t})})}destroy(){var e;(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=void 0}},u=class e{constructor(e,t,n){r(this,`registry`,void 0),r(this,`debounceMs`,void 0),r(this,`margin`,void 0),r(this,`isMouseInside`,!0),r(this,`leaveTimeout`,void 0),r(this,`onMouseEnter`,()=>{this.registry.patchAll({exit_intent:!1})}),r(this,`onMouseLeave`,()=>{this.isBrowsing()&&this.registry.patchAll({exit_intent:!0})}),r(this,`onMouseMove`,e=>{this.checkBounds(e.clientX,e.clientY)?this.isMouseInside?(clearTimeout(this.leaveTimeout),this.leaveTimeout=void 0):(this.isMouseInside=!0,this.registry.patchAll({exit_intent:!1})):this.isMouseInside&&(this.isMouseInside=!1,this.leaveTimeout=setTimeout(()=>{this.leaveTimeout=void 0,this.isBrowsing()&&this.registry.patchAll({exit_intent:!0})},this.debounceMs))}),this.registry=e,this.debounceMs=t,this.margin=n}init(){window.addEventListener(`mouseenter`,this.onMouseEnter),window.addEventListener(`mouseleave`,this.onMouseLeave),window.addEventListener(`mousemove`,this.onMouseMove)}static build(t){let{registry:n,config:r}=t,{exitIntentDebounceMs:i=1500,exitIntentMargin:a=10}=r;return{exitIntent:new e(n,i,a)}}destroy(){window.removeEventListener(`mouseenter`,this.onMouseEnter),window.removeEventListener(`mouseleave`,this.onMouseLeave),window.removeEventListener(`mousemove`,this.onMouseMove)}checkBounds(e,t){let n=window.innerWidth,r=window.innerHeight;return e>=this.margin&&e<=n-this.margin&&t>=this.margin&&t<=r-this.margin}isBrowsing(){try{return window.LiveChatWidget.get(`customer_data`).status===`browsing`}catch(e){return!1}}},d=class e{constructor(e,t,n,i){r(this,`registry`,void 0),r(this,`abandonmentSelector`,void 0),r(this,`abandonmentDelaySeconds`,void 0),r(this,`submissionSelector`,void 0),r(this,`formAbandonmentTimeout`,void 0),r(this,`abandonmentForms`,void 0),r(this,`submissionForms`,void 0),r(this,`inputs`,void 0),r(this,`onChange`,()=>{clearTimeout(this.formAbandonmentTimeout),this.formAbandonmentTimeout=setTimeout(()=>{this.registry.patchAll({form_abandoned:!0})},this.abandonmentDelaySeconds*1e3)}),r(this,`onAbandonmentFormSubmit`,()=>{clearTimeout(this.formAbandonmentTimeout)}),r(this,`onSubmit`,()=>{this.registry.patchAll({form_submission:!0})}),r(this,`onInvalid`,()=>{this.registry.patchAll({input_error:!0})}),this.registry=e,this.abandonmentSelector=t,this.abandonmentDelaySeconds=n,this.submissionSelector=i}static build(t){let{registry:n,config:r}=t,{formAbandonmentSelector:i=`form`,formAbandonmentDelay:a=10,formSubmissionSelector:o=`form`}=r;return{form:new e(n,i,a,o)}}init(){this.abandonmentForms=document.querySelectorAll(this.abandonmentSelector),this.submissionForms=document.querySelectorAll(this.submissionSelector),this.inputs=document.querySelectorAll(`input`);for(let e of this.abandonmentForms)e.addEventListener(`change`,this.onChange),e.addEventListener(`submit`,this.onAbandonmentFormSubmit);for(let e of this.submissionForms)e.addEventListener(`submit`,this.onSubmit);for(let e of this.inputs)e.addEventListener(`invalid`,this.onInvalid)}destroy(){var e,t,n;for(let t of(e=this.abandonmentForms)==null?[]:e)t.removeEventListener(`change`,this.onChange),t.removeEventListener(`submit`,this.onAbandonmentFormSubmit);for(let e of(t=this.submissionForms)==null?[]:t)e.removeEventListener(`submit`,this.onSubmit);for(let e of(n=this.inputs)==null?[]:n)e.removeEventListener(`invalid`,this.onInvalid)}};function f(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){f(a,r,i,o,s,`next`,e)}function s(e){f(a,r,i,o,s,`throw`,e)}o(void 0)})}}var m=class e{constructor(e){r(this,`url`,void 0),this.url=e}static build(t){let{url:n}=t;return{http:new e(n)}}post(e){var t=this;return p(function*(){let n=yield fetch(t.url,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`POST ${t.url} failed with ${n.status}`);return yield n.json()})()}patch(e){var t=this;return p(function*(){yield fetch(t.url,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),keepalive:!0})})()}},h;function g(e,t,n){var r;function i(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=s.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let a=(r=n==null?void 0:n.Parent)==null?Object:r;class o extends a{}Object.defineProperty(o,"name",{value:e});function s(e){var t;let r=n!=null&&n.Parent?new o:this;i(r,e),(t=r._zod).deferred!=null||(t.deferred=[]);for(let e of r._zod.deferred)e();return r}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>{var r;return n!=null&&n.Parent&&t instanceof n.Parent?!0:t==null||(r=t._zod)==null||(r=r.traits)==null?void 0:r.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var _=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};(h=globalThis).__zod_globalConfig!=null||(h.__zod_globalConfig={});var v=globalThis.__zod_globalConfig;function y(e){return e&&Object.assign(v,e),v}function b(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function x(e,t){if(e==null)return{};var n,r,i=b(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var ee=[`inst`,`continue`,`input`];function te(e,t){return typeof t==`bigint`?t.toString():t}function ne(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}var S=Symbol(`evaluating`);function C(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==S)return r===void 0&&(r=S,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}var w=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ie(e,t,n){let r=new e._zod.constr(t==null?e._zod.def:t);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function T(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?a(a({},t),{},{error:()=>t.error}):t}function ae(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function E(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++){var n;if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0}return!1}function D(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++){var n;if(((n=e.issues[r])==null?void 0:n.continue)===!1)return!0}return!1}function O(e,t){return t.map(t=>{var n;return(n=t).path!=null||(n.path=[]),t.path.unshift(e),t})}function k(e){return typeof e==`string`?e:e==null?void 0:e.message}function A(e,t,n){var r,i,a,o,s,c,l,u,d;let f=e.message?e.message:(r=(i=(a=(o=k((s=e.inst)==null||(s=s._zod.def)==null||(c=s.error)==null?void 0:c.call(s,e)))==null?k(t==null||(l=t.error)==null?void 0:l.call(t,e)):o)==null?k((u=n.customError)==null?void 0:u.call(n,e)):a)==null?k((d=n.localeError)==null?void 0:d.call(n,e)):i)==null?`Invalid input`:r,{inst:p,continue:m,input:h}=e,g=x(e,ee);return g.path!=null||(g.path=[]),g.message=f,t!=null&&t.reportInput&&(g.input=h),g}var j=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,te,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},oe=g(`$ZodError`,j),M=g(`$ZodError`,j,{Parent:Error}),se=(e=>(t,n,r,i)=>{let o=r?a(a({},r),{},{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new _;if(s.issues.length){var c;let t=new((c=i==null?void 0:i.Err)==null?e:c)(s.issues.map(e=>A(e,o,y())));throw w(t,i==null?void 0:i.callee),t}return s.value})(M),ce=(e=>function(){var t=p(function*(t,n,r,i){let o=r?a(a({},r),{},{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=yield s),s.issues.length){var c;let t=new((c=i==null?void 0:i.Err)==null?e:c)(s.issues.map(e=>A(e,o,y())));throw w(t,i==null?void 0:i.callee),t}return s.value});return function(e,n,r,i){return t.apply(this,arguments)}}())(M),N=(e=>(t,n,r)=>{let i=r?a(a({},r),{},{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new _;return o.issues.length?{success:!1,error:new(e==null?oe:e)(o.issues.map(e=>A(e,i,y())))}:{success:!0,data:o.value}})(M),P=(e=>function(){var t=p(function*(t,n,r){let i=r?a(a({},r),{},{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=yield o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>A(e,i,y())))}:{success:!0,data:o.value}});return function(e,n,r){return t.apply(this,arguments)}}())(M),le=/^https?$/,F=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;`${F}`;function ue(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function I(e){let t=ue({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${F}T(?:${r})$`)}var L=e=>{var t,n;let r=e?`[\\s\\S]{${(t=e==null?void 0:e.minimum)==null?0:t},${(n=e==null?void 0:e.maximum)==null?``:n}}`:`[\\s\\S]*`;return RegExp(`^${r}$`)},R=g(`$ZodCheck`,(e,t)=>{var n;e._zod!=null||(e._zod={}),e._zod.def=t,(n=e._zod).onattach!=null||(n.onattach=[])}),z=g(`$ZodCheckStringFormat`,(e,t)=>{var n,r;R.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns!=null||(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check!=null||(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push(a(a({origin:`string`,code:`invalid_format`,format:t.format,input:n.value},t.pattern?{pattern:t.pattern.toString()}:{}),{},{inst:e,continue:!t.abort}))}):(r=e._zod).check!=null||(r.check=()=>{})}),B={major:4,minor:4,patch:3},V=g(`$ZodType`,(e,t)=>{var n,r;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=B;let i=[...(n=e._zod.def.checks)==null?[]:n];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0){var o;(r=e._zod).deferred!=null||(r.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse})}else{let t=(e,t,n)=>{let r=E(e),i;for(let o of t){if(o._zod.def.when){if(D(e)||!o._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&(n==null?void 0:n.async)===!1)throw new _;if(i||s instanceof Promise){var a;i=((a=i)==null?Promise.resolve():a).then(p(function*(){yield s,e.issues.length!==t&&(r||(r=E(e,t)))}))}else{if(e.issues.length===t)continue;r||(r=E(e,t))}}return i?i.then(()=>e):e},n=(n,r,a)=>{if(E(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new _;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,o)=>{if(o.skipChecks)return e._zod.parse(r,o);if(o.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},a(a({},o),{},{skipChecks:!0}));return t instanceof Promise?t.then(e=>n(e,r,o)):n(t,r,o)}let s=e._zod.parse(r,o);if(s instanceof Promise){if(o.async===!1)throw new _;return s.then(e=>t(e,i,o))}return t(s,i,o)}}C(e,`~standard`,()=>({validate:t=>{try{var n;let r=N(e,t);return r.success?{value:r.data}:{issues:(n=r.error)==null?void 0:n.issues}}catch(n){return P(e,t).then(e=>{var t;return e.success?{value:e.data}:{issues:(t=e.error)==null?void 0:t.issues}})}},vendor:`zod`,version:1}))}),H=g(`$ZodString`,(e,t)=>{var n,r,i;V.init(e,t),e._zod.pattern=(n=[...(r=e==null||(i=e._zod.bag)==null?void 0:i.patterns)==null?[]:r].pop())==null?L(e._zod.bag):n,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(e){}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),U=g(`$ZodStringFormat`,(e,t)=>{z.init(e,t),H.init(e,t)}),de=g(`$ZodURL`,(e,t)=>{U.init(e,t),e._zod.check=n=>{try{var r;let i=n.value.trim();if(!t.normalize&&((r=t.protocol)==null?void 0:r.source)===le.source&&!/^https?:\/\//i.test(i)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let a=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(`:`)?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=a.href:n.value=i;return}catch(r){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),fe=g(`$ZodISODateTime`,(e,t)=>{t.pattern!=null||(t.pattern=I(t)),U.init(e,t)}),pe=g(`$ZodNever`,(e,t)=>{V.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function W(e,t,n){e.issues.length&&t.issues.push(...O(n,e.issues)),t.value[n]=e.value}var me=g(`$ZodArray`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>W(t,n,e))):W(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function G(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...O(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function he(e){let t=Object.keys(e.shape);for(let r of t){var n;if(!(!((n=e.shape)==null||(n=n[r])==null||(n=n._zod)==null||(n=n.traits)==null)&&n.has(`$ZodType`)))throw Error(`Invalid element at key "${r}": expected a Zod schema`)}let r=ae(e.shape);return a(a({},e),{},{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)})}function ge(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>G(e,n,i,t,u,d))):G(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var _e=g(`$ZodObject`,(e,t)=>{V.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`);if(!(n!=null&&n.get)){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n=a({},e);return Object.defineProperty(t,"shape",{value:n}),n}})}let r=ne(()=>he(t));C(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]!=null||(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let i=re,o=t.catchall,s;e._zod.parse=(t,n)=>{s!=null||(s=r.value);let a=t.value;if(!i(a))return t.issues.push({expected:`object`,code:`invalid_type`,input:a,inst:e}),t;t.value={};let c=[],l=s.shape;for(let e of s.keys){let r=l[e],i=r._zod.optin===`optional`,o=r._zod.optout===`optional`,s=r._zod.run({value:a[e],issues:[]},n);s instanceof Promise?c.push(s.then(n=>G(n,t,e,a,i,o))):G(s,t,e,a,i,o)}return o?ge(c,a,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}});function ve(e,t){return new e(a({type:`string`},T(t)))}function ye(e,t){return new e(a({type:`string`,format:`url`,check:`string_format`,abort:!1},T(t)))}function be(e,t){return new e(a({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null},T(t)))}function xe(e,t){return new e(a({type:`never`},T(t)))}var K=g(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);V.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>se(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>N(e,t,n),e.parseAsync=function(){var t=p(function*(t,n){return ce(e,t,n,{callee:e.parseAsync})});return function(e,n){return t.apply(this,arguments)}}(),e.safeParseAsync=function(){var t=p(function*(t,n){return P(e,t,n)});return function(e,n){return t.apply(this,arguments)}}(),e.check=(...n)=>{var r;return e.clone(a(a({},t),{},{checks:[...(r=t.checks)==null?[]:r,...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},e.with=e.check,e.clone=(t,n)=>ie(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),q=g(`ZodMiniString`,(e,t)=>{H.init(e,t),K.init(e,t)});function J(e){return ve(q,e)}var Y=g(`ZodMiniStringFormat`,(e,t)=>{U.init(e,t),q.init(e,t)}),Se=g(`ZodMiniURL`,(e,t)=>{de.init(e,t),Y.init(e,t)});function X(e){return ye(Se,e)}var Ce=g(`ZodMiniNever`,(e,t)=>{pe.init(e,t),K.init(e,t)});function we(e){return xe(Ce,e)}var Te=g(`ZodMiniArray`,(e,t)=>{me.init(e,t),K.init(e,t)});function Ee(e,t){return new Te(a({type:`array`,element:e},T(t)))}var De=g(`ZodMiniObject`,(e,t)=>{_e.init(e,t),K.init(e,t),C(e,`shape`,()=>t.shape)});function Z(e,t){return new De(a({type:`object`,shape:e,catchall:we()},T(t)))}var Oe=g(`ZodMiniISODateTime`,(e,t)=>{fe.init(e,t),Y.init(e,t)});function ke(e){return be(Oe,e)}var Ae=e=>{let t={};for(let n of e.split(/;\s*/)){if(!n)continue;let e=n.indexOf(`=`);if(e<0)continue;let r=n.slice(0,e).trim();if(!r)continue;let i=n.slice(e+1).trim();try{t[r]=decodeURIComponent(i)}catch(e){t[r]=i}}return t},je=Z({referrer:J(),landing_page:X(),browsing_history:Ee(Z({opened_at:ke(),url:X(),title:J()}))}),Q=`lc_browsing_history_data`,Me=`screen and (max-width: 992px) and (pointer: coarse)`,Ne=class e{constructor(e){r(this,`sessionVariables`,void 0),r(this,`data`,void 0),this.sessionVariables=e}static build(t){let{sessionVariables:n}=t;return{pageData:new e(n)}}init(){this.data=Pe(this.sessionVariables)}get(){if(this.data===void 0)throw Error(`PageDataCollector.get called before init`);return this.data}},Pe=e=>{let t=new URLSearchParams(window.location.search);return a(a(a({session_variables:e,device:window.matchMedia(Me).matches?`mobile`:`desktop`},Fe(t,e)),Ie(t)),Le())},Fe=(e,t)=>{var n,r,i;let a={};if(window.gaGlobal===void 0)return a;let o=Ae(document.cookie),s=Object.entries(o),c=(n=window.analytics)==null?void 0:n.user(),l=window.gaGlobal.vid,u=s.filter(([e])=>e.startsWith(`_ga_`)).map(e=>{var t;return(t=e[1])==null?``:t}),d=e.get(`gclid`)||((r=s.find(([e])=>e.startsWith(`_gcl_aw`)))==null?void 0:r[1])||t.gclid,f=e.get(`dclid`)||o._gcl_dc||t.dclid,p=t.fbc||o._fbc,m=t.fbp||o._fbp,h=e.get(`ttclid`)||o._ttp,g=e.get(`li_fat_id`)||o.li_fat_id,_=(c==null?void 0:c.anonymousId())||window.localStorage.getItem(`ajs_anonymous_id`),v=(c==null?void 0:c.id())||window.localStorage.getItem(`ajs_user_id`),y=(i=s.find(([e])=>e.startsWith(`bid_`)))==null?void 0:i[1];return l&&(a.ga_session=l),u.length>0&&(a.ga_session_id=u),d&&(a.gclid=d),f&&(a.dclid=f),p&&(a.fbc=p),m&&(a.fbp=m),h&&(a.ttclid=h),g&&(a.li_fat_id=g),_&&(a.segment_anonymous_id=_),v&&(a.segment_user_id=v),y&&(a.sitecore_browser_id=y),a},Ie=e=>{let t={},n=e.get(`utm_id`),r=e.get(`utm_source`),i=e.get(`utm_medium`),a=e.get(`utm_campaign`),o=e.get(`utm_term`),s=e.get(`utm_content`);return n&&(t.utm_id=n),r&&(t.utm_source=r),i&&(t.utm_medium=i),a&&(t.utm_campaign=a),o&&(t.utm_term=o),s&&(t.utm_content=s),t},Le=()=>{let e=$(),t=new Date;t.setDate(t.getDate()-30);let n=e.browsing_history.filter(e=>new Date(e.opened_at)>t),r={opened_at:new Date().toISOString(),url:window.location.href,title:document.title},i=n.length===0?{referrer:document.referrer,landing_page:r.url,browsing_history:[r]}:a(a({},e),{},{browsing_history:[...n,r].slice(-50)});return window.localStorage.setItem(Q,JSON.stringify(i)),i},$=()=>{let e=window.localStorage.getItem(Q);if(!e)return{referrer:``,landing_page:``,browsing_history:[]};try{return je.parse(JSON.parse(e))}catch(t){return console.error(`Error parsing ${Q}:`,{content:e},t),{referrer:``,landing_page:``,browsing_history:[]}}},Re=class e{constructor(e,t,n,i){r(this,`bus`,void 0),r(this,`http`,void 0),r(this,`pageData`,void 0),r(this,`clientId`,void 0),r(this,`shortCodes`,{whatsapp:void 0,sms:void 0,facebook:void 0}),r(this,`unsubscribe`,void 0),this.bus=e,this.http=t,this.pageData=n,this.clientId=i}static build(t){let{bus:n,http:r,pageData:i,config:a}=t;return{registry:new e(n,r,i,a.clientId)}}init(){this.unsubscribe=this.bus.on(`commversion:channels-registered`,({channels:e})=>{for(let t of e)this.shortCodes[t]===void 0&&(this.shortCodes[t]=this.startChannel(t),this.shortCodes[t].catch(e=>console.error(e)))})}destroy(){var e;(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=void 0}patchAll(e){for(let t of Object.values(this.shortCodes))t==null||t.then(t=>this.http.patch(a({short_code:t},e)).catch(e=>console.error(e)),()=>{})}patchOne(e,t){var n;(n=this.shortCodes[e])==null||n.then(e=>this.http.patch(a({short_code:e},t)).catch(e=>console.error(e)),()=>{})}startChannel(e){var t=this;return p(function*(){try{let{short_code:n}=yield t.http.post(a(a({},t.pageData.get()),{},{client_id:t.clientId,channel:e,exit_intent:!1}));return t.bus.dispatch(`commversion:shortcode-resolved`,{channel:e,shortCode:n}),n}catch(n){let r=n instanceof Error?n.message:String(n);throw t.bus.dispatch(`commversion:shortcode-failed`,{channel:e,error:r}),n}})()}},ze=`https://api.cht-srvc.net/attribution`,Be=e=>{var t;let n,r=(t=e.attributionUrl)==null?ze:t;return Object.assign(({customerData:t})=>{n=new o({config:e,url:r,sessionVariables:t.sessionVariables}).provide(c.build).provide(m.build).provide(Ne.build).provide(Re.build).provide(l.build).provide(u.build).provide(d.build).provide(s.build).dependencies.app,n.init()},{destroy:()=>{n==null||n.destroy(),n=void 0}})};window.commversion=window.commversion||{};var Ve=Be(window.commversion);window.LiveChatWidget.once(`ready`,Ve)})();
|
|
1
|
+
(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var o=class e{constructor(e={}){r(this,`dependencies`,void 0),this.dependencies=e}provide(t){return new e(a(a({},this.dependencies),t(this.dependencies)))}},s=class e{constructor(e,t,n,i,a,o,s){r(this,`bus`,void 0),r(this,`pageData`,void 0),r(this,`shortCodeStore`,void 0),r(this,`registry`,void 0),r(this,`channelClick`,void 0),r(this,`exitIntent`,void 0),r(this,`form`,void 0),this.bus=e,this.pageData=t,this.shortCodeStore=n,this.registry=i,this.channelClick=a,this.exitIntent=o,this.form=s}static build(t){let{bus:n,pageData:r,shortCodeStore:i,registry:a,channelClick:o,exitIntent:s,form:c}=t;return{app:new e(n,r,i,a,o,s,c)}}init(){this.pageData.init(),this.pageData.isNewSession()&&this.shortCodeStore.clear(),this.shortCodeStore.init(),this.registry.init(),this.channelClick.init(),this.exitIntent.init(),this.form.init(),this.bus.dispatch(`commversion:attribution-ready`,{})}destroy(){this.registry.destroy(),this.channelClick.destroy(),this.exitIntent.destroy(),this.form.destroy()}},c=class e{constructor(e){r(this,`target`,void 0),this.target=e}on(e,t){let n=e=>{e instanceof CustomEvent&&t(e.detail)};return this.target.addEventListener(e,n),()=>this.target.removeEventListener(e,n)}dispatch(e,t){this.target.dispatchEvent(new CustomEvent(e,{detail:t}))}static build(){return{bus:new e(window)}}},l=class e{constructor(e,t){r(this,`bus`,void 0),r(this,`registry`,void 0),r(this,`unsubscribe`,void 0),this.bus=e,this.registry=t}static build(t){let{bus:n,registry:r}=t;return{channelClick:new e(n,r)}}init(){this.unsubscribe=this.bus.on(`commversion:channel-clicked`,({channel:e})=>{let{sessionVariables:t}=window.LiveChatWidget.get(`customer_data`);this.registry.patchOne(e,{chat_start_url:window.location.href,chat_start_time:new Date().toISOString(),session_variables:t})})}destroy(){var e;(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=void 0}},u=class e{constructor(e,t,n){r(this,`registry`,void 0),r(this,`debounceMs`,void 0),r(this,`margin`,void 0),r(this,`isMouseInside`,!0),r(this,`leaveTimeout`,void 0),r(this,`onMouseEnter`,()=>{this.registry.patchAll({exit_intent:!1})}),r(this,`onMouseLeave`,()=>{this.isBrowsing()&&this.registry.patchAll({exit_intent:!0})}),r(this,`onMouseMove`,e=>{this.checkBounds(e.clientX,e.clientY)?this.isMouseInside?(clearTimeout(this.leaveTimeout),this.leaveTimeout=void 0):(this.isMouseInside=!0,this.registry.patchAll({exit_intent:!1})):this.isMouseInside&&(this.isMouseInside=!1,this.leaveTimeout=setTimeout(()=>{this.leaveTimeout=void 0,this.isBrowsing()&&this.registry.patchAll({exit_intent:!0})},this.debounceMs))}),this.registry=e,this.debounceMs=t,this.margin=n}init(){window.addEventListener(`mouseenter`,this.onMouseEnter),window.addEventListener(`mouseleave`,this.onMouseLeave),window.addEventListener(`mousemove`,this.onMouseMove)}static build(t){let{registry:n,config:r}=t,{exitIntentDebounceMs:i=1500,exitIntentMargin:a=10}=r;return{exitIntent:new e(n,i,a)}}destroy(){window.removeEventListener(`mouseenter`,this.onMouseEnter),window.removeEventListener(`mouseleave`,this.onMouseLeave),window.removeEventListener(`mousemove`,this.onMouseMove)}checkBounds(e,t){let n=window.innerWidth,r=window.innerHeight;return e>=this.margin&&e<=n-this.margin&&t>=this.margin&&t<=r-this.margin}isBrowsing(){try{return window.LiveChatWidget.get(`customer_data`).status===`browsing`}catch(e){return!1}}},d=class e{constructor(e,t,n,i){r(this,`registry`,void 0),r(this,`abandonmentSelector`,void 0),r(this,`abandonmentDelaySeconds`,void 0),r(this,`submissionSelector`,void 0),r(this,`formAbandonmentTimeout`,void 0),r(this,`abandonmentForms`,void 0),r(this,`submissionForms`,void 0),r(this,`inputs`,void 0),r(this,`onChange`,()=>{clearTimeout(this.formAbandonmentTimeout),this.formAbandonmentTimeout=setTimeout(()=>{this.registry.patchAll({form_abandoned:!0})},this.abandonmentDelaySeconds*1e3)}),r(this,`onAbandonmentFormSubmit`,()=>{clearTimeout(this.formAbandonmentTimeout)}),r(this,`onSubmit`,()=>{this.registry.patchAll({form_submission:!0})}),r(this,`onInvalid`,()=>{this.registry.patchAll({input_error:!0})}),this.registry=e,this.abandonmentSelector=t,this.abandonmentDelaySeconds=n,this.submissionSelector=i}static build(t){let{registry:n,config:r}=t,{formAbandonmentSelector:i=`form`,formAbandonmentDelay:a=10,formSubmissionSelector:o=`form`}=r;return{form:new e(n,i,a,o)}}init(){this.abandonmentForms=document.querySelectorAll(this.abandonmentSelector),this.submissionForms=document.querySelectorAll(this.submissionSelector),this.inputs=document.querySelectorAll(`input`);for(let e of this.abandonmentForms)e.addEventListener(`change`,this.onChange),e.addEventListener(`submit`,this.onAbandonmentFormSubmit);for(let e of this.submissionForms)e.addEventListener(`submit`,this.onSubmit);for(let e of this.inputs)e.addEventListener(`invalid`,this.onInvalid)}destroy(){var e,t,n;for(let t of(e=this.abandonmentForms)==null?[]:e)t.removeEventListener(`change`,this.onChange),t.removeEventListener(`submit`,this.onAbandonmentFormSubmit);for(let e of(t=this.submissionForms)==null?[]:t)e.removeEventListener(`submit`,this.onSubmit);for(let e of(n=this.inputs)==null?[]:n)e.removeEventListener(`invalid`,this.onInvalid)}};function f(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){f(a,r,i,o,s,`next`,e)}function s(e){f(a,r,i,o,s,`throw`,e)}o(void 0)})}}var m=class e{constructor(e){r(this,`url`,void 0),this.url=e}static build(t){let{url:n}=t;return{http:new e(n)}}post(e){var t=this;return p(function*(){let n=yield fetch(t.url,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`POST ${t.url} failed with ${n.status}`);return yield n.json()})()}patch(e){var t=this;return p(function*(){yield fetch(t.url,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),keepalive:!0})})()}},h;function g(e,t,n){var r;function i(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=s.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let a=(r=n==null?void 0:n.Parent)==null?Object:r;class o extends a{}Object.defineProperty(o,"name",{value:e});function s(e){var t;let r=n!=null&&n.Parent?new o:this;i(r,e),(t=r._zod).deferred!=null||(t.deferred=[]);for(let e of r._zod.deferred)e();return r}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>{var r;return n!=null&&n.Parent&&t instanceof n.Parent?!0:t==null||(r=t._zod)==null||(r=r.traits)==null?void 0:r.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var _=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};(h=globalThis).__zod_globalConfig!=null||(h.__zod_globalConfig={});var v=globalThis.__zod_globalConfig;function y(e){return e&&Object.assign(v,e),v}function ee(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function b(e,t){if(e==null)return{};var n,r,i=ee(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var te=[`inst`,`continue`,`input`];function x(e,t){return typeof t==`bigint`?t.toString():t}function ne(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}var S=Symbol(`evaluating`);function C(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==S)return r===void 0&&(r=S,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}var w=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function T(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function re(e){if(T(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(T(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ie(e,t,n){let r=new e._zod.constr(t==null?e._zod.def:t);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function E(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?a(a({},t),{},{error:()=>t.error}):t}function ae(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function D(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++){var n;if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0}return!1}function oe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++){var n;if(((n=e.issues[r])==null?void 0:n.continue)===!1)return!0}return!1}function O(e,t){return t.map(t=>{var n;return(n=t).path!=null||(n.path=[]),t.path.unshift(e),t})}function k(e){return typeof e==`string`?e:e==null?void 0:e.message}function A(e,t,n){var r,i,a,o,s,c,l,u,d;let f=e.message?e.message:(r=(i=(a=(o=k((s=e.inst)==null||(s=s._zod.def)==null||(c=s.error)==null?void 0:c.call(s,e)))==null?k(t==null||(l=t.error)==null?void 0:l.call(t,e)):o)==null?k((u=n.customError)==null?void 0:u.call(n,e)):a)==null?k((d=n.localeError)==null?void 0:d.call(n,e)):i)==null?`Invalid input`:r,{inst:p,continue:m,input:h}=e,g=b(e,te);return g.path!=null||(g.path=[]),g.message=f,t!=null&&t.reportInput&&(g.input=h),g}var j=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,x,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},se=g(`$ZodError`,j),M=g(`$ZodError`,j,{Parent:Error}),ce=(e=>(t,n,r,i)=>{let o=r?a(a({},r),{},{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new _;if(s.issues.length){var c;let t=new((c=i==null?void 0:i.Err)==null?e:c)(s.issues.map(e=>A(e,o,y())));throw w(t,i==null?void 0:i.callee),t}return s.value})(M),le=(e=>function(){var t=p(function*(t,n,r,i){let o=r?a(a({},r),{},{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=yield s),s.issues.length){var c;let t=new((c=i==null?void 0:i.Err)==null?e:c)(s.issues.map(e=>A(e,o,y())));throw w(t,i==null?void 0:i.callee),t}return s.value});return function(e,n,r,i){return t.apply(this,arguments)}}())(M),N=(e=>(t,n,r)=>{let i=r?a(a({},r),{},{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new _;return o.issues.length?{success:!1,error:new(e==null?se:e)(o.issues.map(e=>A(e,i,y())))}:{success:!0,data:o.value}})(M),P=(e=>function(){var t=p(function*(t,n,r){let i=r?a(a({},r),{},{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=yield o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>A(e,i,y())))}:{success:!0,data:o.value}});return function(e,n,r){return t.apply(this,arguments)}}())(M),ue=/^https?$/,F=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;`${F}`;function de(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function fe(e){let t=de({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${F}T(?:${r})$`)}var pe=e=>{var t,n;let r=e?`[\\s\\S]{${(t=e==null?void 0:e.minimum)==null?0:t},${(n=e==null?void 0:e.maximum)==null?``:n}}`:`[\\s\\S]*`;return RegExp(`^${r}$`)},me=/^-?\d+(?:\.\d+)?$/,he=g(`$ZodCheck`,(e,t)=>{var n;e._zod!=null||(e._zod={}),e._zod.def=t,(n=e._zod).onattach!=null||(n.onattach=[])}),I=g(`$ZodCheckStringFormat`,(e,t)=>{var n,r;he.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns!=null||(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check!=null||(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push(a(a({origin:`string`,code:`invalid_format`,format:t.format,input:n.value},t.pattern?{pattern:t.pattern.toString()}:{}),{},{inst:e,continue:!t.abort}))}):(r=e._zod).check!=null||(r.check=()=>{})}),L={major:4,minor:4,patch:3},R=g(`$ZodType`,(e,t)=>{var n,r;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=L;let i=[...(n=e._zod.def.checks)==null?[]:n];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0){var o;(r=e._zod).deferred!=null||(r.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse})}else{let t=(e,t,n)=>{let r=D(e),i;for(let o of t){if(o._zod.def.when){if(oe(e)||!o._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&(n==null?void 0:n.async)===!1)throw new _;if(i||s instanceof Promise){var a;i=((a=i)==null?Promise.resolve():a).then(p(function*(){yield s,e.issues.length!==t&&(r||(r=D(e,t)))}))}else{if(e.issues.length===t)continue;r||(r=D(e,t))}}return i?i.then(()=>e):e},n=(n,r,a)=>{if(D(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new _;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,o)=>{if(o.skipChecks)return e._zod.parse(r,o);if(o.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},a(a({},o),{},{skipChecks:!0}));return t instanceof Promise?t.then(e=>n(e,r,o)):n(t,r,o)}let s=e._zod.parse(r,o);if(s instanceof Promise){if(o.async===!1)throw new _;return s.then(e=>t(e,i,o))}return t(s,i,o)}}C(e,`~standard`,()=>({validate:t=>{try{var n;let r=N(e,t);return r.success?{value:r.data}:{issues:(n=r.error)==null?void 0:n.issues}}catch(n){return P(e,t).then(e=>{var t;return e.success?{value:e.data}:{issues:(t=e.error)==null?void 0:t.issues}})}},vendor:`zod`,version:1}))}),z=g(`$ZodString`,(e,t)=>{var n,r,i;R.init(e,t),e._zod.pattern=(n=[...(r=e==null||(i=e._zod.bag)==null?void 0:i.patterns)==null?[]:r].pop())==null?pe(e._zod.bag):n,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(e){}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),B=g(`$ZodStringFormat`,(e,t)=>{I.init(e,t),z.init(e,t)}),ge=g(`$ZodURL`,(e,t)=>{B.init(e,t),e._zod.check=n=>{try{var r;let i=n.value.trim();if(!t.normalize&&((r=t.protocol)==null?void 0:r.source)===ue.source&&!/^https?:\/\//i.test(i)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let a=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(`:`)?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=a.href:n.value=i;return}catch(r){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),_e=g(`$ZodISODateTime`,(e,t)=>{t.pattern!=null||(t.pattern=fe(t)),B.init(e,t)}),ve=g(`$ZodNever`,(e,t)=>{R.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function V(e,t,n){e.issues.length&&t.issues.push(...O(n,e.issues)),t.value[n]=e.value}var ye=g(`$ZodArray`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>V(t,n,e))):V(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function H(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...O(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function be(e){let t=Object.keys(e.shape);for(let r of t){var n;if(!(!((n=e.shape)==null||(n=n[r])==null||(n=n._zod)==null||(n=n.traits)==null)&&n.has(`$ZodType`)))throw Error(`Invalid element at key "${r}": expected a Zod schema`)}let r=ae(e.shape);return a(a({},e),{},{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)})}function xe(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>H(e,n,i,t,u,d))):H(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Se=g(`$ZodObject`,(e,t)=>{R.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`);if(!(n!=null&&n.get)){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n=a({},e);return Object.defineProperty(t,"shape",{value:n}),n}})}let r=ne(()=>be(t));C(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]!=null||(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let i=T,o=t.catchall,s;e._zod.parse=(t,n)=>{s!=null||(s=r.value);let a=t.value;if(!i(a))return t.issues.push({expected:`object`,code:`invalid_type`,input:a,inst:e}),t;t.value={};let c=[],l=s.shape;for(let e of s.keys){let r=l[e],i=r._zod.optin===`optional`,o=r._zod.optout===`optional`,s=r._zod.run({value:a[e],issues:[]},n);s instanceof Promise?c.push(s.then(n=>H(n,t,e,a,i,o))):H(s,t,e,a,i,o)}return o?xe(c,a,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),Ce=g(`$ZodRecord`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!re(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let c=new Set;for(let s of o)if(typeof s==`string`||typeof s==`number`||typeof s==`symbol`){c.add(typeof s==`number`?s.toString():s);let o=t.keyType._zod.run({value:s,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>A(e,r,y())),input:s,path:[s],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[s],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...O(s,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...O(s,u.issues)),n.value[l]=u.value)}let l;for(let e in i)if(!c.has(e)){var s;l=(s=l)==null?[]:s,l.push(e)}l&&l.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:l})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&me.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>A(e,r,y())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...O(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...O(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}});function we(e,t){return new e(a({type:`string`},E(t)))}function Te(e,t){return new e(a({type:`string`,format:`url`,check:`string_format`,abort:!1},E(t)))}function Ee(e,t){return new e(a({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null},E(t)))}function De(e,t){return new e(a({type:`never`},E(t)))}var U=g(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);R.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>ce(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>N(e,t,n),e.parseAsync=function(){var t=p(function*(t,n){return le(e,t,n,{callee:e.parseAsync})});return function(e,n){return t.apply(this,arguments)}}(),e.safeParseAsync=function(){var t=p(function*(t,n){return P(e,t,n)});return function(e,n){return t.apply(this,arguments)}}(),e.check=(...n)=>{var r;return e.clone(a(a({},t),{},{checks:[...(r=t.checks)==null?[]:r,...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},e.with=e.check,e.clone=(t,n)=>ie(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),W=g(`ZodMiniString`,(e,t)=>{z.init(e,t),U.init(e,t)});function G(e){return we(W,e)}var K=g(`ZodMiniStringFormat`,(e,t)=>{B.init(e,t),W.init(e,t)}),Oe=g(`ZodMiniURL`,(e,t)=>{ge.init(e,t),K.init(e,t)});function q(e){return Te(Oe,e)}var ke=g(`ZodMiniNever`,(e,t)=>{ve.init(e,t),U.init(e,t)});function Ae(e){return De(ke,e)}var je=g(`ZodMiniArray`,(e,t)=>{ye.init(e,t),U.init(e,t)});function Me(e,t){return new je(a({type:`array`,element:e},E(t)))}var Ne=g(`ZodMiniObject`,(e,t)=>{Se.init(e,t),U.init(e,t),C(e,`shape`,()=>t.shape)});function J(e,t){return new Ne(a({type:`object`,shape:e,catchall:Ae()},E(t)))}var Y=g(`ZodMiniRecord`,(e,t)=>{Ce.init(e,t),U.init(e,t)});function Pe(e,t,n){return!t||!t._zod?new Y(a({type:`record`,keyType:G(),valueType:e},E(t))):new Y(a({type:`record`,keyType:e,valueType:t},E(n)))}var Fe=g(`ZodMiniISODateTime`,(e,t)=>{_e.init(e,t),K.init(e,t)});function Ie(e){return Ee(Fe,e)}var Le=e=>{let t={};for(let n of e.split(/;\s*/)){if(!n)continue;let e=n.indexOf(`=`);if(e<0)continue;let r=n.slice(0,e).trim();if(!r)continue;let i=n.slice(e+1).trim();try{t[r]=decodeURIComponent(i)}catch(e){t[r]=i}}return t},Re=J({referrer:G(),landing_page:q(),browsing_history:Me(J({opened_at:Ie(),url:q(),title:G()}))}),X=`lc_browsing_history_data`,ze=`screen and (max-width: 992px) and (pointer: coarse)`,Be=class e{constructor(e){r(this,`sessionVariables`,void 0),r(this,`data`,void 0),this.sessionVariables=e}static build(t){let{sessionVariables:n}=t;return{pageData:new e(n)}}init(){this.data=Ve(this.sessionVariables)}get(){if(this.data===void 0)throw Error(`PageDataCollector.get called before init`);return this.data}isNewSession(){if(this.data===void 0)throw Error(`PageDataCollector.isNewSession called before init`);return this.data.wasReset}},Ve=e=>{let t=new URLSearchParams(window.location.search);return a(a(a({session_variables:e,device:window.matchMedia(ze).matches?`mobile`:`desktop`},He(t,e)),Ue(t)),Z())},He=(e,t)=>{var n,r,i;let a={};if(window.gaGlobal===void 0)return a;let o=Le(document.cookie),s=Object.entries(o),c=(n=window.analytics)==null?void 0:n.user(),l=window.gaGlobal.vid,u=s.filter(([e])=>e.startsWith(`_ga_`)).map(e=>{var t;return(t=e[1])==null?``:t}),d=e.get(`gclid`)||((r=s.find(([e])=>e.startsWith(`_gcl_aw`)))==null?void 0:r[1])||t.gclid,f=e.get(`dclid`)||o._gcl_dc||t.dclid,p=t.fbc||o._fbc,m=t.fbp||o._fbp,h=e.get(`ttclid`)||o._ttp,g=e.get(`li_fat_id`)||o.li_fat_id,_=(c==null?void 0:c.anonymousId())||window.localStorage.getItem(`ajs_anonymous_id`),v=(c==null?void 0:c.id())||window.localStorage.getItem(`ajs_user_id`),y=(i=s.find(([e])=>e.startsWith(`bid_`)))==null?void 0:i[1];return l&&(a.ga_session=l),u.length>0&&(a.ga_session_id=u),d&&(a.gclid=d),f&&(a.dclid=f),p&&(a.fbc=p),m&&(a.fbp=m),h&&(a.ttclid=h),g&&(a.li_fat_id=g),_&&(a.segment_anonymous_id=_),v&&(a.segment_user_id=v),y&&(a.sitecore_browser_id=y),a},Ue=e=>{let t={},n=e.get(`utm_id`),r=e.get(`utm_source`),i=e.get(`utm_medium`),a=e.get(`utm_campaign`),o=e.get(`utm_term`),s=e.get(`utm_content`);return n&&(t.utm_id=n),r&&(t.utm_source=r),i&&(t.utm_medium=i),a&&(t.utm_campaign=a),o&&(t.utm_term=o),s&&(t.utm_content=s),t},Z=()=>{let e=We(),t=new Date;t.setDate(t.getDate()-30);let n=e.browsing_history.filter(e=>new Date(e.opened_at)>t),r={opened_at:new Date().toISOString(),url:window.location.href,title:document.title},i=n.length===0,o=i?{referrer:document.referrer,landing_page:r.url,browsing_history:[r]}:a(a({},e),{},{browsing_history:[...n,r].slice(-50)});return window.localStorage.setItem(X,JSON.stringify(o)),a(a({},o),{},{wasReset:i})},We=()=>{let e=window.localStorage.getItem(X);if(!e)return{referrer:``,landing_page:``,browsing_history:[]};try{return Re.parse(JSON.parse(e))}catch(t){return console.error(`Error parsing ${X}:`,{content:e},t),{referrer:``,landing_page:``,browsing_history:[]}}},Ge=[`wasReset`],Ke=class e{constructor(e,t,n,i,a){r(this,`bus`,void 0),r(this,`http`,void 0),r(this,`pageData`,void 0),r(this,`shortCodeStore`,void 0),r(this,`clientId`,void 0),r(this,`shortCodes`,{whatsapp:void 0,sms:void 0,facebook:void 0}),r(this,`unsubscribe`,void 0),this.bus=e,this.http=t,this.pageData=n,this.shortCodeStore=i,this.clientId=a}static build(t){let{bus:n,http:r,pageData:i,shortCodeStore:a,config:o}=t;return{registry:new e(n,r,i,a,o.clientId)}}init(){this.unsubscribe=this.bus.on(`commversion:channels-registered`,({channels:e})=>{for(let t of e){if(this.shortCodes[t]!==void 0)continue;let e=this.shortCodeStore.get(t);if(e!==void 0){this.shortCodes[t]=Promise.resolve(e),this.bus.dispatch(`commversion:shortcode-resolved`,{channel:t,shortCode:e}),this.http.patch(a(a({},Q(this.pageData.get())),{},{short_code:e,exit_intent:!1})).catch(e=>console.error(e));continue}this.shortCodes[t]=this.startChannel(t),this.shortCodes[t].catch(e=>console.error(e))}})}destroy(){var e;(e=this.unsubscribe)==null||e.call(this),this.unsubscribe=void 0}patchAll(e){for(let t of Object.values(this.shortCodes))t==null||t.then(t=>this.http.patch(a({short_code:t},e)).catch(e=>console.error(e)),()=>{})}patchOne(e,t){var n;(n=this.shortCodes[e])==null||n.then(e=>this.http.patch(a({short_code:e},t)).catch(e=>console.error(e)),()=>{})}startChannel(e){var t=this;return p(function*(){try{let{short_code:n}=yield t.http.post(a(a({},Q(t.pageData.get())),{},{client_id:t.clientId,channel:e,exit_intent:!1}));return t.shortCodeStore.set(e,n),t.bus.dispatch(`commversion:shortcode-resolved`,{channel:e,shortCode:n}),n}catch(n){let r=n instanceof Error?n.message:String(n);throw t.bus.dispatch(`commversion:shortcode-failed`,{channel:e,error:r}),n}})()}},Q=e=>{let{wasReset:t}=e;return b(e,Ge)},$=`lc_attribution_short_codes`,qe=Pe(G(),G()),Je=class e{constructor(){r(this,`codes`,{})}static build(){return{shortCodeStore:new e}}init(){this.codes=Ye()}get(e){return this.codes[e]}set(e,t){this.codes=a(a({},this.codes),{},{[e]:t}),window.localStorage.setItem($,JSON.stringify(this.codes))}clear(){this.codes={},window.localStorage.removeItem($)}},Ye=()=>{let e=window.localStorage.getItem($);if(!e)return{};try{return qe.parse(JSON.parse(e))}catch(t){return console.error(`Error parsing ${$}:`,{content:e},t),{}}},Xe=`https://api.cht-srvc.net/attribution`,Ze=e=>{var t;let n,r=(t=e.attributionUrl)==null?Xe:t;return Object.assign(({customerData:t})=>{n=new o({config:e,url:r,sessionVariables:t.sessionVariables}).provide(c.build).provide(m.build).provide(Be.build).provide(Je.build).provide(Ke.build).provide(l.build).provide(u.build).provide(d.build).provide(s.build).dependencies.app,n.init()},{destroy:()=>{n==null||n.destroy(),n=void 0}})};window.commversion=window.commversion||{};var Qe=Ze(window.commversion);window.LiveChatWidget.once(`ready`,Qe)})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var lcChannelWidgets=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function r(e){var r=n(e,`string`);return t(r)==`symbol`?r:r+``}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?a(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var s={whatsapp:{label:`WhatsApp`,icon:`<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 509 511.514"><path fill="#fff" d="M434.762 74.334C387.553 26.81 323.245 0 256.236 0h-.768C115.795.001 2.121 113.696 2.121 253.456l.001.015a253.516 253.516 0 0033.942 126.671L0 511.514l134.373-35.269a253.416 253.416 0 00121.052 30.9h.003.053C395.472 507.145 509 393.616 509 253.626c0-67.225-26.742-131.727-74.252-179.237l.014-.055zM255.555 464.453c-37.753 0-74.861-10.22-107.293-29.479l-7.72-4.602-79.741 20.889 21.207-77.726-4.984-7.975c-21.147-33.606-32.415-72.584-32.415-112.308 0-116.371 94.372-210.743 210.741-210.743 56.011 0 109.758 22.307 149.277 61.98a210.93 210.93 0 0161.744 149.095c0 116.44-94.403 210.869-210.844 210.869h.028zm115.583-157.914c-6.363-3.202-37.474-18.472-43.243-20.593-5.769-2.121-10.01-3.202-14.315 3.203-4.305 6.404-16.373 20.593-20.063 24.855-3.69 4.263-7.401 4.815-13.679 1.612-6.278-3.202-26.786-9.883-50.899-31.472a192.748 192.748 0 01-35.411-43.867c-3.712-6.363-.404-9.777 2.82-12.873 3.224-3.096 6.363-7.381 9.48-11.092a41.58 41.58 0 006.357-10.597 11.678 11.678 0 00-.508-11.09c-1.718-3.18-14.444-34.357-19.534-47.06-5.09-12.703-10.37-10.603-14.272-10.901-3.902-.297-7.911-.19-12.089-.19a23.322 23.322 0 00-16.964 7.911c-5.707 6.298-22.1 21.673-22.1 52.849s22.671 61.249 25.852 65.532c3.182 4.284 44.663 68.227 108.288 95.649 15.099 6.489 26.891 10.392 36.053 13.403a87.504 87.504 0 0025.216 3.718c4.905 0 9.82-.416 14.65-1.237 12.174-1.782 37.453-15.291 42.776-30.073s5.303-27.57 3.711-30.093c-1.591-2.524-5.704-4.369-12.088-7.615l-.038.021z"/></svg>`,backgroundColor:`#25D366`,prefilledmessage:`Hi, I'd like to learn more.`,mobile:{enabled:!1,url:`https://wa.me/{number}[?text={prefilledmessage}]`},desktop:{enabled:!1,url:`https://web.whatsapp.com/send?phone={number}[&text={prefilledmessage}]`}},sms:{label:`SMS`,icon:`<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 13H6v-2h2v2zm5 0h-2v-2h2v2zm5 0h-2v-2h2v2z"/></svg>`,backgroundColor:`#3478F6`,prefilledmessage:`Hi, I'd like to learn more.`,mobile:{enabled:!1,url:`sms:{number}[?body={prefilledmessage}]`},desktop:{enabled:!1,url:`sms:{number}[?body={prefilledmessage}]`},popover:{title:`Text us — we're available 24/7`,description:`US numbers only. Msg & carrier rates may apply. Reply STOP to opt out.`,buttonLabel:`Start Conversation`}}},c=new Set([`prefilledmessage`]),l=new Map,u=new Map,d=new Map,f=new Set,p=new Set;function m(e,t){let n=u.get(e);n||(n=new Set,u.set(e,n)),n.add(t)}function h(e){let t=u.get(e);if(t)for(let e of t)e.isConnected||t.delete(e)}function g(e,t,n){return t?e?`${e} (ref ${t})`:(p.has(n)||(p.add(n),console.warn(`[lc-channel-widgets] ${n}Config.defaultMessage is empty; emitting bare ref`)),`(ref ${t})`):e||``}function _(e,t){var n,r;let i=((n=window.commversion)==null?void 0:n[`${e}Config`])||void 0;if(i&&t&&i.buttonMessages){let e=i.buttonMessages[t];if(typeof e==`string`)return e}if(i&&typeof i.defaultMessage==`string`)return i.defaultMessage;let a=(r=s[e])==null?void 0:r.prefilledmessage;return typeof a==`string`?a:``}function v(e){var t;let n=e.__lcChannelType,r=d.get(n);if(!(r!=null&&r.urlTemplate)){e.href=`#`;return}let i=g((t=e.__lcBaseMessage)==null?``:t,l.get(n),n),a=o(o({},r.channelData),{},{prefilledmessage:i});e.href=ee(r.urlTemplate,a)}function y(e){window.dispatchEvent(new CustomEvent(`commversion:channel-clicked`,{detail:{channel:e}}))}function b(){let e=Array.from(f);e.length!==0&&window.dispatchEvent(new CustomEvent(`commversion:channels-registered`,{detail:{channels:e}}))}function x(e){var t;let n=((t=window.commversion)==null?void 0:t[`${e.type}Config`])||void 0;if(n!=null&&n.buttonMessages)for(let t of Object.keys(n.buttonMessages)){let n;try{n=document.querySelectorAll(t)}catch(e){console.warn(`[lc-channel-widgets] invalid buttonMessages selector "${t}":`,e);continue}n.forEach(n=>{if(!n.__lcChannelAttached){if(!(n instanceof HTMLAnchorElement)){console.warn(`[lc-channel-widgets] buttonMessages selector "${t}" matched non-<a> element; skipping`);return}n.__lcChannelAttached=e.type,n.__lcChannelType=e.type,n.__lcBaseMessage=_(e.type,t),n.setAttribute(`target`,`_blank`),n.setAttribute(`rel`,`noopener noreferrer`),v(n),m(e.type,n),n.addEventListener(`click`,()=>y(e.type))}})}}window.addEventListener(`commversion:attribution-ready`,()=>{b()}),window.addEventListener(`commversion:shortcode-resolved`,e=>{let{channel:t,shortCode:n}=e.detail||{};if(!t||typeof n!=`string`)return;l.set(t,n),h(t);let r=u.get(t);if(r)for(let e of r)v(e)}),window.addEventListener(`commversion:shortcode-failed`,()=>{});function ee(e,t){return e.replace(/\[([^\]]*)\]/g,(e,n)=>{for(let[,e]of n.matchAll(/\{(\w+)\}/g)){let n=t[e];if(n==null||n===``)return``}return n}).replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];if(r==null)return``;let i=String(r);return c.has(n)?encodeURIComponent(i):i})}var S=e=>e&&typeof e.enabled==`boolean`?{enabled:e.enabled}:{},te=e=>e===!0?!0:e&&typeof e==`object`?e.enabled===!0:!1,C={title:60,description:140,buttonLabel:24},ne=(e,t)=>{if(!e||e===!0||typeof e!=`object`)return{};let n={};return Object.keys(C).forEach(r=>{if(typeof e[r]!=`string`)return;let i=C[r];if(i!=null&&e[r].length>i){console.warn(`[lc-channel-widgets] ${t} popover.${r} exceeds ${i} chars (got ${e[r].length}); using registry default`);return}n[r]=e[r]}),n};function re(e,t){if(!e||typeof e.type!=`string`)return null;let n=s[e.type];if(!n)return null;let r=n[t]||{};return{type:e.type,label:n.label,icon:n.icon,backgroundColor:n.backgroundColor,mobile:o(o({},n.mobile),S(e.mobile)),desktop:o(o({},n.desktop),S(e.desktop)),popover:n.popover&&te(e.popover)?o(o({},n.popover),ne(e.popover,e.type)):void 0,urlTemplate:r.url||``,channelData:e}}var ie=`screen and (max-width: 992px) and (pointer: coarse)`,ae=()=>window.matchMedia(ie).matches?`mobile`:`desktop`,w=[];function T(){for(let e=w.length-1;e>=0;e--){let t=w[e];t!=null&&t.parentNode&&t.remove(),w.splice(e,1)}}var E=!1;function oe(){E||(E=!0,document.addEventListener(`click`,e=>{for(let t of w)t.__isOpen&&!t.contains(e.target)&&J(t)}))}function se(){if(window.__lcHistoryPatched)return;window.__lcHistoryPatched=!0,window.__lcLastUrl=window.__lcLastUrl||location.href;let e=e=>{let t=window.__lcLastUrl,n=location.href,r=t!==n;window.__lcLastUrl=n,!(!r&&e!==`popstate`)&&window.dispatchEvent(new Event(`lc:locationchange`))},t=history.pushState;typeof t==`function`&&(history.pushState=function(...n){let r=t.apply(this,n);return e(`pushState`),r});let n=history.replaceState;typeof n==`function`&&(history.replaceState=function(...t){let r=n.apply(this,t);return e(`replaceState`),r}),window.addEventListener(`popstate`,()=>e(`popstate`)),window.addEventListener(`hashchange`,()=>e(`hashchange`))}function D(e){var t;if(document.__lcVisibilityBound&&!e)return!0;if(typeof((t=window.LiveChatWidget)==null?void 0:t.on)!=`function`)return!1;let n=document.__lcVisibilityCb;if(n&&typeof window.LiveChatWidget.off==`function`)try{window.LiveChatWidget.off(`visibility_changed`,n)}catch(e){}let r=e=>{var t,n,r,i;let a=document.__lcStack;a!=null&&a.isConnected&&(e&&typeof e.visibility==`string`&&(a.__lcVisibility=e.visibility),(t=(n=document).__lcCurrentRebind)==null||t.call(n),(r=(i=document).__lcCurrentSync)==null||r.call(i))};return window.LiveChatWidget.on(`visibility_changed`,r),document.__lcVisibilityCb=r,document.__lcVisibilityBound=!0,!0}function ce(e){if(D(e)||document.__lcVisibilityPolling)return;document.__lcVisibilityPolling=!0;let t=0,n=setInterval(()=>{(D(e)||++t>=200)&&(clearInterval(n),document.__lcVisibilityPolling=!1)},200)}function O(){document.__lcBodyMutationObs||typeof MutationObserver>`u`||(document.__lcBodyMutationObs=new MutationObserver(e=>{let t=document.__lcStack;if(t){for(let{removedNodes:r}of e)if(!(!r||r.length===0))for(let e of r){var n;if(e.nodeType===1&&(e===t||(n=e.contains)!=null&&n.call(e,t))){let e=document.__lcChannelWidgetsConfig;e&&j(e);return}}}}),document.__lcBodyMutationObs.observe(document.body,{childList:!0,subtree:!0}))}var k=null,A=null;function j(e){A=e,!k&&(k=setTimeout(()=>{k=null;let e=A;A=null,$(e)},100))}var M=`#chat-widget-minimized`,N=`#chat-overlay-container`,le=`#chat-overlay-button`,ue=[M,N],P=15,F=100,I=150;function L(e){return{width:e.width,height:e.height,fromLeft:e.left,fromRight:window.innerWidth-e.right,fromTop:e.top,fromBottom:window.innerHeight-e.bottom}}function R(e){let t=e.fromLeft<=e.fromRight,n=e.fromTop<=e.fromBottom,r=t?e.fromLeft:window.innerWidth-e.fromRight-e.width,i=n?e.fromTop:window.innerHeight-e.fromBottom-e.height;return{left:r,top:i,right:r+e.width,bottom:i+e.height,width:e.width,height:e.height}}var z=60;function B(e){let t=window.innerWidth-e.right<=e.left,n=e.bottom,r=n-z,i=t?e.right:e.left+z;return{left:i-z,right:i,top:r,bottom:n,width:z,height:z}}var V=200,H=150;function U(e,t,{interval:n=V,maxRetries:r=H}={}){let i=0,a=setInterval(()=>{let n=document.querySelector(e);if(n){clearInterval(a),t(n);return}++i>=r&&clearInterval(a)},n)}function W(){if(document.getElementById(`lc-channel-widgets-style`))return;let e=document.createElement(`style`);e.id=`lc-channel-widgets-style`,e.textContent=`
|
|
1
|
+
var lcChannelWidgets=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function r(e){var r=n(e,`string`);return t(r)==`symbol`?r:r+``}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?a(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var s={whatsapp:{label:`WhatsApp`,icon:`<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 509 511.514"><path fill="#fff" d="M434.762 74.334C387.553 26.81 323.245 0 256.236 0h-.768C115.795.001 2.121 113.696 2.121 253.456l.001.015a253.516 253.516 0 0033.942 126.671L0 511.514l134.373-35.269a253.416 253.416 0 00121.052 30.9h.003.053C395.472 507.145 509 393.616 509 253.626c0-67.225-26.742-131.727-74.252-179.237l.014-.055zM255.555 464.453c-37.753 0-74.861-10.22-107.293-29.479l-7.72-4.602-79.741 20.889 21.207-77.726-4.984-7.975c-21.147-33.606-32.415-72.584-32.415-112.308 0-116.371 94.372-210.743 210.741-210.743 56.011 0 109.758 22.307 149.277 61.98a210.93 210.93 0 0161.744 149.095c0 116.44-94.403 210.869-210.844 210.869h.028zm115.583-157.914c-6.363-3.202-37.474-18.472-43.243-20.593-5.769-2.121-10.01-3.202-14.315 3.203-4.305 6.404-16.373 20.593-20.063 24.855-3.69 4.263-7.401 4.815-13.679 1.612-6.278-3.202-26.786-9.883-50.899-31.472a192.748 192.748 0 01-35.411-43.867c-3.712-6.363-.404-9.777 2.82-12.873 3.224-3.096 6.363-7.381 9.48-11.092a41.58 41.58 0 006.357-10.597 11.678 11.678 0 00-.508-11.09c-1.718-3.18-14.444-34.357-19.534-47.06-5.09-12.703-10.37-10.603-14.272-10.901-3.902-.297-7.911-.19-12.089-.19a23.322 23.322 0 00-16.964 7.911c-5.707 6.298-22.1 21.673-22.1 52.849s22.671 61.249 25.852 65.532c3.182 4.284 44.663 68.227 108.288 95.649 15.099 6.489 26.891 10.392 36.053 13.403a87.504 87.504 0 0025.216 3.718c4.905 0 9.82-.416 14.65-1.237 12.174-1.782 37.453-15.291 42.776-30.073s5.303-27.57 3.711-30.093c-1.591-2.524-5.704-4.369-12.088-7.615l-.038.021z"/></svg>`,backgroundColor:`#25D366`,prefilledmessage:`Hi, I'd like to learn more.`,mobile:{enabled:!1,url:`https://wa.me/{number}[?text={prefilledmessage}]`},desktop:{enabled:!1,url:`https://web.whatsapp.com/send?phone={number}[&text={prefilledmessage}]`}},sms:{label:`SMS`,icon:`<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 13H6v-2h2v2zm5 0h-2v-2h2v2zm5 0h-2v-2h2v2z"/></svg>`,backgroundColor:`#3478F6`,prefilledmessage:`Hi, I'd like to learn more.`,mobile:{enabled:!1,url:`sms:{number}[?body={prefilledmessage}]`},desktop:{enabled:!1,url:`sms:{number}[?body={prefilledmessage}]`},popover:{title:`Text us — we're available 24/7`,description:`US numbers only. Msg & carrier rates may apply. Reply STOP to opt out.`,buttonLabel:`Start Conversation`}}},c=new Set([`prefilledmessage`]),l=e=>typeof e==`string`&&/^https?:\/\//i.test(e),u=new Map,d=new Map,f=new Map,p=new Set,m=new Set;function h(e,t){let n=d.get(e);n||(n=new Set,d.set(e,n)),n.add(t)}function g(e){let t=d.get(e);if(t)for(let e of t)e.isConnected||t.delete(e)}function _(e,t,n){return t?e?`${e} (ref ${t})`:(m.has(n)||(m.add(n),console.warn(`[lc-channel-widgets] ${n}Config.defaultMessage is empty; emitting bare ref`)),`(ref ${t})`):e||``}function v(e,t){var n,r;let i=((n=window.commversion)==null?void 0:n[`${e}Config`])||void 0;if(i&&t&&i.buttonMessages){let e=i.buttonMessages[t];if(typeof e==`string`)return e}if(i&&typeof i.defaultMessage==`string`)return i.defaultMessage;let a=(r=s[e])==null?void 0:r.prefilledmessage;return typeof a==`string`?a:``}function y(e){var t;let n=e.__lcChannelType,r=f.get(n);if(!(r!=null&&r.urlTemplate)){e.href=`#`;return}let i=_((t=e.__lcBaseMessage)==null?``:t,u.get(n),n),a=o(o({},r.channelData),{},{prefilledmessage:i});e.href=te(r.urlTemplate,a)}function b(e){window.dispatchEvent(new CustomEvent(`commversion:channel-clicked`,{detail:{channel:e}}))}function x(){let e=Array.from(p);e.length!==0&&window.dispatchEvent(new CustomEvent(`commversion:channels-registered`,{detail:{channels:e}}))}function ee(e){var t;let n=((t=window.commversion)==null?void 0:t[`${e.type}Config`])||void 0;if(n!=null&&n.buttonMessages)for(let t of Object.keys(n.buttonMessages)){let n;try{n=document.querySelectorAll(t)}catch(e){console.warn(`[lc-channel-widgets] invalid buttonMessages selector "${t}":`,e);continue}n.forEach(n=>{if(!n.__lcChannelAttached){if(!(n instanceof HTMLAnchorElement)){console.warn(`[lc-channel-widgets] buttonMessages selector "${t}" matched non-<a> element; skipping`);return}n.__lcChannelAttached=e.type,S(n,e,t)}})}}function S(e,t,n){l(t.urlTemplate)&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)),e.__lcChannelType=t.type,e.__lcBaseMessage=v(t.type,n),y(e),h(t.type,e),e.addEventListener(`click`,()=>b(t.type))}window.addEventListener(`commversion:attribution-ready`,()=>{x()}),window.addEventListener(`commversion:shortcode-resolved`,e=>{let{channel:t,shortCode:n}=e.detail||{};if(!t||typeof n!=`string`)return;u.set(t,n),g(t);let r=d.get(t);if(r)for(let e of r)y(e)}),window.addEventListener(`commversion:shortcode-failed`,()=>{});function te(e,t){return e.replace(/\[([^\]]*)\]/g,(e,n)=>{for(let[,e]of n.matchAll(/\{(\w+)\}/g)){let n=t[e];if(n==null||n===``)return``}return n}).replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];if(r==null)return``;let i=String(r);return c.has(n)?encodeURIComponent(i):i})}var C=e=>e&&typeof e.enabled==`boolean`?{enabled:e.enabled}:{},ne=e=>e===!0?!0:e&&typeof e==`object`?e.enabled===!0:!1,w={title:60,description:140,buttonLabel:24},re=(e,t)=>{if(!e||e===!0||typeof e!=`object`)return{};let n={};return Object.keys(w).forEach(r=>{if(typeof e[r]!=`string`)return;let i=w[r];if(i!=null&&e[r].length>i){console.warn(`[lc-channel-widgets] ${t} popover.${r} exceeds ${i} chars (got ${e[r].length}); using registry default`);return}n[r]=e[r]}),n};function ie(e,t){if(!e||typeof e.type!=`string`)return null;let n=s[e.type];if(!n)return null;let r=n[t]||{};return{type:e.type,label:n.label,icon:n.icon,backgroundColor:n.backgroundColor,mobile:o(o({},n.mobile),C(e.mobile)),desktop:o(o({},n.desktop),C(e.desktop)),popover:n.popover&&ne(e.popover)?o(o({},n.popover),re(e.popover,e.type)):void 0,urlTemplate:r.url||``,channelData:e}}var ae=`screen and (max-width: 992px) and (pointer: coarse)`,oe=()=>window.matchMedia(ae).matches?`mobile`:`desktop`,T=[];function E(){for(let e=T.length-1;e>=0;e--){let t=T[e];t!=null&&t.parentNode&&t.remove(),T.splice(e,1)}}var D=new Set;function O(e,t){D.has(e)||(D.add(e),document.addEventListener(e,t))}function se(){O(`click`,e=>{for(let t of T)t.__isOpen&&!t.contains(e.target)&&q(t,{restoreFocus:!1})})}function ce(){O(`keydown`,e=>{if(e.key===`Escape`){for(let e of T)if(e.__isOpen){q(e);return}}})}var le=0;function k(e,t){if(!e)return;let n=t?`true`:`false`;e.getAttribute(`aria-expanded`)!==n&&e.setAttribute(`aria-expanded`,n)}function ue(){if(window.__lcHistoryPatched)return;window.__lcHistoryPatched=!0,window.__lcLastUrl=window.__lcLastUrl||location.href;let e=e=>{let t=window.__lcLastUrl,n=location.href,r=t!==n;window.__lcLastUrl=n,!(!r&&e!==`popstate`)&&window.dispatchEvent(new Event(`lc:locationchange`))},t=history.pushState;typeof t==`function`&&(history.pushState=function(...n){let r=t.apply(this,n);return e(`pushState`),r});let n=history.replaceState;typeof n==`function`&&(history.replaceState=function(...t){let r=n.apply(this,t);return e(`replaceState`),r}),window.addEventListener(`popstate`,()=>e(`popstate`)),window.addEventListener(`hashchange`,()=>e(`hashchange`))}function A(e){var t;if(document.__lcVisibilityBound&&!e)return!0;if(typeof((t=window.LiveChatWidget)==null?void 0:t.on)!=`function`)return!1;let n=document.__lcVisibilityCb;if(n&&typeof window.LiveChatWidget.off==`function`)try{window.LiveChatWidget.off(`visibility_changed`,n)}catch(e){}let r=e=>{var t,n,r,i;let a=document.__lcStack;a!=null&&a.isConnected&&(e&&typeof e.visibility==`string`&&(a.__lcVisibility=e.visibility),(t=(n=document).__lcCurrentRebind)==null||t.call(n),(r=(i=document).__lcCurrentSync)==null||r.call(i))};return window.LiveChatWidget.on(`visibility_changed`,r),document.__lcVisibilityCb=r,document.__lcVisibilityBound=!0,!0}function j(e){if(A(e)||document.__lcVisibilityPolling)return;document.__lcVisibilityPolling=!0;let t=0,n=setInterval(()=>{(A(e)||++t>=200)&&(clearInterval(n),document.__lcVisibilityPolling=!1)},200)}function de(){document.__lcBodyMutationObs||typeof MutationObserver>`u`||(document.__lcBodyMutationObs=new MutationObserver(e=>{let t=document.__lcStack;if(t){for(let{removedNodes:r}of e)if(!(!r||r.length===0))for(let e of r){var n;if(e.nodeType===1&&(e===t||(n=e.contains)!=null&&n.call(e,t))){let e=document.__lcChannelWidgetsConfig;e&&P(e);return}}}}),document.__lcBodyMutationObs.observe(document.body,{childList:!0,subtree:!0}))}var M=null,N=null;function P(e){N=e,!M&&(M=setTimeout(()=>{M=null;let e=N;N=null,$(e)},100))}var F=`#chat-widget-minimized`,I=`#chat-overlay-container`,fe=`#chat-overlay-button`,pe=[F,I],L=15,R=100,z=150;function me(e){return{width:e.width,height:e.height,fromLeft:e.left,fromRight:window.innerWidth-e.right,fromTop:e.top,fromBottom:window.innerHeight-e.bottom}}function B(e){let t=e.fromLeft<=e.fromRight,n=e.fromTop<=e.fromBottom,r=t?e.fromLeft:window.innerWidth-e.fromRight-e.width,i=n?e.fromTop:window.innerHeight-e.fromBottom-e.height;return{left:r,top:i,right:r+e.width,bottom:i+e.height,width:e.width,height:e.height}}var V=60;function he(e){let t=window.innerWidth-e.right<=e.left,n=e.bottom,r=n-V,i=t?e.right:e.left+V;return{left:i-V,right:i,top:r,bottom:n,width:V,height:V}}var ge=200,_e=150;function H(e,t,{interval:n=ge,maxRetries:r=_e}={}){let i=0,a=setInterval(()=>{let n=document.querySelector(e);if(n){clearInterval(a),t(n);return}++i>=r&&clearInterval(a)},n)}function U(){if(document.getElementById(`lc-channel-widgets-style`))return;let e=document.createElement(`style`);e.id=`lc-channel-widgets-style`,e.textContent=`
|
|
2
2
|
.lc-channel-stack {
|
|
3
3
|
position: fixed;
|
|
4
4
|
top: 0;
|
|
@@ -58,6 +58,15 @@ var lcChannelWidgets=(function(e){Object.defineProperty(e,Symbol.toStringTag,{va
|
|
|
58
58
|
justify-content: center;
|
|
59
59
|
align-items: center;
|
|
60
60
|
border-radius: 50%;
|
|
61
|
+
/* Resets for the popover-trigger variant which is a native <button>:
|
|
62
|
+
inline style.backgroundColor (set per element) overrides the
|
|
63
|
+
transparent default, so visual output is identical for both the
|
|
64
|
+
<a> (non-popover) and <button> (popover) paths. */
|
|
65
|
+
border: 0;
|
|
66
|
+
padding: 0;
|
|
67
|
+
background: transparent;
|
|
68
|
+
font: inherit;
|
|
69
|
+
appearance: none;
|
|
61
70
|
}
|
|
62
71
|
|
|
63
72
|
.lc-channel-icon {
|
|
@@ -111,6 +120,19 @@ var lcChannelWidgets=(function(e){Object.defineProperty(e,Symbol.toStringTag,{va
|
|
|
111
120
|
font-weight: 600;
|
|
112
121
|
cursor: pointer;
|
|
113
122
|
}
|
|
123
|
+
/* Host pages commonly style \`a:hover { color: ... }\` with specificity
|
|
124
|
+
(0,1,1), which outranks a plain class selector (0,1,0) — that's why
|
|
125
|
+
the popover button would flip to the host's link color on hover.
|
|
126
|
+
Pinning every anchor state on the class (specificity 0,2,0) keeps the
|
|
127
|
+
button white regardless of the host stylesheet. */
|
|
128
|
+
.lc-channel-popover-button:link,
|
|
129
|
+
.lc-channel-popover-button:visited,
|
|
130
|
+
.lc-channel-popover-button:hover,
|
|
131
|
+
.lc-channel-popover-button:active,
|
|
132
|
+
.lc-channel-popover-button:focus {
|
|
133
|
+
color: #fff;
|
|
134
|
+
text-decoration: none;
|
|
135
|
+
}
|
|
114
136
|
.lc-channel-popover-close {
|
|
115
137
|
position: absolute;
|
|
116
138
|
top: 6px;
|
|
@@ -119,9 +141,34 @@ var lcChannelWidgets=(function(e){Object.defineProperty(e,Symbol.toStringTag,{va
|
|
|
119
141
|
border: none;
|
|
120
142
|
font-size: 18px;
|
|
121
143
|
line-height: 1;
|
|
122
|
-
|
|
144
|
+
/* #888 against #fff is only 3.54:1 — passes 1.4.11 non-text contrast
|
|
145
|
+
but fails 1.4.3 (text 4.5:1). Treating the × as a text glyph, #555
|
|
146
|
+
lifts contrast to ~7.5:1 and clears AA with comfortable margin. */
|
|
147
|
+
color: #555;
|
|
123
148
|
cursor: pointer;
|
|
124
|
-
padding:
|
|
149
|
+
padding: 6px 8px;
|
|
150
|
+
/* WCAG 2.5.8 Target Size (Minimum) — guarantee ≥24×24 CSS px hit area
|
|
151
|
+
regardless of the × glyph's intrinsic width. */
|
|
152
|
+
min-width: 24px;
|
|
153
|
+
min-height: 24px;
|
|
154
|
+
}
|
|
155
|
+
/* WCAG 2.4.7 Focus Visible — explicit rings so users don't rely on
|
|
156
|
+
per-browser defaults that may have low contrast against our colored
|
|
157
|
+
backgrounds. White ring contrasts the channel buttons (#128C45,
|
|
158
|
+
#0A4FCC both clear 3:1 vs white). Dark ring contrasts the close
|
|
159
|
+
button (which sits on the white popover bg). The CTA inset ring
|
|
160
|
+
avoids overlapping the rounded popover edge. */
|
|
161
|
+
.lc-channel-button:focus-visible {
|
|
162
|
+
outline: 2px solid #fff;
|
|
163
|
+
outline-offset: 2px;
|
|
164
|
+
}
|
|
165
|
+
.lc-channel-popover-button:focus-visible {
|
|
166
|
+
outline: 2px solid #fff;
|
|
167
|
+
outline-offset: -4px;
|
|
168
|
+
}
|
|
169
|
+
.lc-channel-popover-close:focus-visible {
|
|
170
|
+
outline: 2px solid #1a1a1a;
|
|
171
|
+
outline-offset: 2px;
|
|
125
172
|
}
|
|
126
173
|
/* Directional arrow. 12px square rotated 45° so half sits outside
|
|
127
174
|
the popover as a triangular tip. Inline left/top is set per open
|
|
@@ -142,4 +189,4 @@ var lcChannelWidgets=(function(e){Object.defineProperty(e,Symbol.toStringTag,{va
|
|
|
142
189
|
top: -6px;
|
|
143
190
|
box-shadow: -3px -3px 6px rgba(0, 0, 0, 0.06);
|
|
144
191
|
}
|
|
145
|
-
`,document.head.appendChild(e)}function de(e,t){if(typeof e!=`string`||e.length===0)return null;if(/^(data:|https?:\/\/)/.test(e)){let n=document.createElement(`img`);return n.className=`lc-channel-icon`,n.alt=t||``,n.src=e,n}let n=document.createElement(`span`);n.className=`lc-channel-icon`,n.setAttribute(`aria-hidden`,`true`),n.innerHTML=e;let r=n.querySelector(`svg`);return r&&(r.setAttribute(`width`,`100%`),r.setAttribute(`height`,`100%`),r.style.display=`block`),n}function G(e,t,n){let r=e.left+e.width/2,i=e.top-n-12,a=`bottom`;i<8&&(i=e.bottom+12,a=`top`),i+n>window.innerHeight-8&&(i=window.innerHeight-n-8),i<8&&(i=8);let o=r-t/2;o<8&&(o=8),o+t>window.innerWidth-8&&(o=window.innerWidth-t-8);let s=Math.max(18,t-18),c=Math.max(18,Math.min(s,r-o));return{tx:o,ty:i,arrowSide:a,arrowOffset:c}}function K(e,t,n){e.__appliedArrowSide!==t&&(e.classList.remove(`lc-channel-popover--arrow-top`,`lc-channel-popover--arrow-bottom`),e.classList.add(`lc-channel-popover--arrow-${t}`),e.__appliedArrowSide=t),e.__arrowEl.style.left=`${n-6}px`}function q(e){let t=e.getBoundingClientRect(),n=t.width>0?t.width:e.__cachedWidth,r=t.height>0?t.height:e.__cachedHeight,i=G(e.__trigger.getBoundingClientRect(),n,r);e.style.transform=`translate3d(${i.tx}px,${i.ty}px,0)`,K(e,i.arrowSide,i.arrowOffset)}function J(e){e.__isOpen=!1,e.style.opacity=`0`,e.style.pointerEvents=`none`,requestAnimationFrame(()=>{e.setAttribute(`aria-hidden`,`true`)})}function fe(e){w.forEach(t=>{t!==e&&t.__isOpen&&J(t)}),e.__cachedTransform?(e.style.transform=e.__cachedTransform,e.__arrowSide&&e.__arrowEl&&K(e,e.__arrowSide,e.__arrowOffset)):e.__trigger&&q(e),e.style.opacity=`1`,e.style.pointerEvents=`auto`,requestAnimationFrame(()=>{e.removeAttribute(`aria-hidden`)}),e.__isOpen=!0}function pe(e){let t=e.popover,n=document.createElement(`div`);if(n.className=`lc-channel-popover`,n.dataset.popoverChannelId=e.type,t.title){let e=document.createElement(`h3`);e.className=`lc-channel-popover-title`,e.textContent=t.title,n.appendChild(e)}if(t.description){let e=document.createElement(`p`);e.className=`lc-channel-popover-description`,e.textContent=t.description,n.appendChild(e)}let r=document.createElement(`a`);r.className=`lc-channel-popover-button`,r.setAttribute(`target`,`_blank`),r.setAttribute(`rel`,`noopener noreferrer`),r.style.textDecoration=`none`,r.style.display=`block`,r.style.textAlign=`center`,r.style.boxSizing=`border-box`,r.textContent=t.buttonLabel||`Start Conversation`,r.style.backgroundColor=e.backgroundColor||`#1a1a1a`,r.__lcChannelType=e.type,r.__lcBaseMessage=_(e.type),v(r),m(e.type,r),r.addEventListener(`click`,t=>{t.stopPropagation(),y(e.type),J(n)}),n.appendChild(r);let i=document.createElement(`button`);i.type=`button`,i.className=`lc-channel-popover-close`,i.setAttribute(`aria-label`,`Close`),i.textContent=`×`,i.onclick=e=>{e.stopPropagation(),J(n)},n.appendChild(i);let a=document.createElement(`div`);a.className=`lc-channel-popover-arrow`,n.appendChild(a),n.__arrowEl=a,n.__isOpen=!1,n.style.opacity=`0`,n.style.pointerEvents=`none`,n.setAttribute(`aria-hidden`,`true`),n.style.transform=`translate3d(0,0,0)`,document.body.appendChild(n);let o=n.getBoundingClientRect();return n.__cachedWidth=o.width>0?o.width:280,n.__cachedHeight=o.height,w.push(n),oe(),n}function Y(e){let t=!!e.popover,n=document.createElement(t?`div`:`a`);n.className=`lc-channel-button`,n.dataset.channelId=e.type,e.label&&n.setAttribute(`aria-label`,e.label),e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor);let r=t?pe(e):null;n.__popoverEl=r,r&&(r.__trigger=n),t?n.onclick=e=>{e.stopPropagation(),r.__isOpen?J(r):fe(r)}:(n.setAttribute(`target`,`_blank`),n.setAttribute(`rel`,`noopener noreferrer`),n.style.textDecoration=`none`,n.__lcChannelType=e.type,n.__lcBaseMessage=_(e.type),v(n),m(e.type,n),n.addEventListener(`click`,()=>y(e.type)));let i=de(e.icon,e.label||e.type);return i&&n.appendChild(i),n}function me(e,t){let n=e==null?void 0:e[t];return n&&typeof n.enabled==`boolean`?n.enabled:t===`mobile`}function X(e,t){let n=Math.max(e.width,e.height),r=Math.min(n,t);return{measured:n,buttonSize:r,iconSize:Math.round(r*.5)}}function Z(e,t){let n=[];return e.forEach(e=>{let r=re(e,t);if(!r){console.warn(`[lc-channel-widgets] unknown or invalid channel — skipping:`,e);return}d.set(r.type,r),f.add(r.type),x(r),me(r,t)&&n.push(r)}),b(),n}function he(e){let{deviceType:t,chatWidgetSelector:n,channels:r,bubbleSelector:i}=e,a=e[t];if(!document.querySelector(n))return;let o=()=>document.querySelector(n),s=Z(r,t);if(s.length===0)return;W();let c=document.body.querySelector(`:scope > .lc-channel-stack`);c||(T(),c=document.createElement(`div`),c.className=`lc-channel-stack lc-channel-stack--horizontal`,c.style.gap=a.gap,c.setAttribute(`role`,`group`),c.setAttribute(`aria-label`,`Contact channels`),document.body.appendChild(c)),document.__lcStack=c,s.forEach(e=>{c.querySelector(`[data-channel-id="${CSS.escape(e.type)}"]`)||c.appendChild(Y(e))});let l=Number.parseInt(a.gapBelow,10)||8,u=()=>{let e=o();for(let t of i){let n=(e==null?void 0:e.querySelector(t))||document.querySelector(t);if(!n)continue;let r=n.getBoundingClientRect();if(r.width>0&&r.height>0)return r}return null},d=()=>{let e=o(),t=[];for(let n of i){let r=e?e.querySelector(n):null,i=document.querySelector(n);r&&!t.includes(r)&&t.push(r),i&&i!==r&&!t.includes(i)&&t.push(i)}return e&&!t.includes(e)&&t.push(e),t},f=`minimized`;try{var p,m;let e=(p=window.LiveChatWidget)==null||(m=p.get)==null||(m=m.call(p,`state`))==null?void 0:m.visibility;typeof e==`string`&&(f=e)}catch(e){}c.__lcVisibility=f;let h=()=>{let e=u();e&&c.__lcVisibility===`minimized`&&e.width<=F&&e.height<=F&&window.innerHeight-e.bottom<=I&&(document.__lcBubbleAnchor=L(e));let n=null,r=null;if(c.__lcVisibility===`minimized`)e&&(n=e,r=e);else if(c.__lcVisibility===`maximized`&&t!==`mobile`){let e=o();if(e){let t=e.getBoundingClientRect();t.width>0&&t.height>0&&(n=t,r=document.__lcBubbleAnchor?R(document.__lcBubbleAnchor):B(t))}}if(!n||!r){for(let e of w)e.__isOpen&&J(e);c.style.display=`none`;return}c.style.display=`flex`;let{buttonSize:i,iconSize:a}=X(r,t===`mobile`?60:40),s=c.__lcLastButtonSize!==i;s&&(c.style.setProperty(`--lc-channel-size`,`${i}px`),c.style.setProperty(`--lc-channel-icon-size`,`${a}px`),c.__lcCachedDims=null,c.__lcLastButtonSize=i);let d=c.children.length,f=c.__lcLastButtonCount!==d;f&&(c.__lcCachedDims=null);let p=c.__lcCachedDims||c.getBoundingClientRect();c.__lcCachedDims=p,c.__lcLastButtonCount=d;let m,h;if(t===`mobile`){let e=r,t=Math.min(e.height,e.width,80),n=e.left<window.innerWidth-e.right?e.left+t/2:e.right-t/2,i=p.width/2;n-i<8&&(n=i+8),n+i>window.innerWidth-8&&(n=window.innerWidth-i-8),m=n-p.width/2,h=e.bottom+l-P}else{let e=n.left+n.width/2<window.innerWidth/2,t=p.height/2,i=r.top+r.height/2;i-t<8&&(i=t+8),i+t>window.innerHeight-8&&(i=window.innerHeight-t-8);let a=-t,o,s;e?(o=n.right+l,o+p.width>window.innerWidth-8&&(o=window.innerWidth-p.width-8),s=0):(o=n.left-l,o-p.width<8&&(o=p.width+8),s=-p.width),m=o+s,h=i+a}let g=`translate(${m}px, ${h}px)`;g===c.__lcLastTransform&&!s&&!f||(c.style.transform=g,c.__lcLastTransform=g,c.__lcTransitionActivated||requestAnimationFrame(()=>{c.classList.add(`lc-stack-ready`),c.__lcTransitionActivated=!0}),c.querySelectorAll(`.lc-channel-button`).forEach(e=>{let t=m+e.offsetLeft,n=h+e.offsetTop,r=e.offsetWidth,i=e.offsetHeight;if(e.__cachedRect={left:t,top:n,right:t+r,bottom:n+i,width:r,height:i},e.__popoverEl){let t=e.__popoverEl,{tx:n,ty:r,arrowSide:i,arrowOffset:a}=G(e.__cachedRect,t.__cachedWidth,t.__cachedHeight),o=`translate3d(${n}px,${r}px,0)`;t.__cachedTransform=o,t.__arrowSide=i,t.__arrowOffset=a,t.__isOpen&&(t.style.transform=o,K(t,i,a))}}))},g=0,_=()=>{g||(g=requestAnimationFrame(()=>{g=0,h()}))};h(),document.__lcCurrentSync=_,document.__lcWindowListenersBound||(window.addEventListener(`resize`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)}),window.addEventListener(`orientationchange`,()=>{var e,t;document.__lcBubbleAnchor=null,(e=(t=document).__lcCurrentSync)==null||e.call(t)}),window.visualViewport&&(window.visualViewport.addEventListener(`resize`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)}),window.visualViewport.addEventListener(`scroll`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)})),window.addEventListener(`scroll`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)},!0),document.__lcWindowListenersBound=!0),typeof ResizeObserver<`u`&&!c.__lcResizeObserved&&(new ResizeObserver(_).observe(c),c.__lcResizeObserved=!0);let v=()=>{let e=d();if(e.length===0)return;let t=c.__lcObservedBubbles||[];e.length===t.length&&e.every((e,n)=>e===t[n])||(c.__lcBubbleObserver&&c.__lcBubbleObserver.disconnect(),c.__lcObservedBubbles=e,typeof ResizeObserver<`u`&&(c.__lcBubbleObserver=new ResizeObserver(_),e.forEach(e=>c.__lcBubbleObserver.observe(e))))};v(),(!c.__lcObservedBubbles||c.__lcObservedBubbles.length===0)&&i.forEach(e=>{U(e,()=>{v(),h()})}),document.__lcCurrentRebind=v,document.__lcVisibilityBound=!1,ce(!0)}function ge(e){if(e.style.right&&e.style.right!==`auto`)return`right`;if(e.style.left&&e.style.left!==`auto`)return`left`;let t=window.getComputedStyle(e);return t.right===`auto`?t.left===`auto`?`right`:`left`:`right`}function _e(){document.__lcPopoverVvBound||window.visualViewport&&(document.__lcPopoverVvBound=!0,window.visualViewport.addEventListener(`resize`,()=>{for(let e of w)e.__isOpen&&e.__trigger&&q(e)}))}function Q(e,t,n){if(!e||e.querySelector(`:scope > .lc-channel-stack--in-lc`))return;e.style.overflow=`unset`;let r=document.createElement(`div`);r.className=`lc-channel-stack lc-channel-stack--horizontal lc-channel-stack--in-lc`,r.setAttribute(`role`,`group`),r.setAttribute(`aria-label`,`Contact channels`),r.style.gap=n.mobile.gap;let i=ge(e),a=Number.parseInt(n.mobile.gapBelow,10),o=Number.isFinite(a)?a:0,s=Number.parseInt(n.mobile.gapSide,10),c=Number.isFinite(s)?s:8;if(i===`left`?(r.style.left=`${c}px`,r.style.right=`auto`):(r.style.right=`${c}px`,r.style.left=`auto`),t.forEach(e=>{r.appendChild(Y(e))}),e.appendChild(r),typeof ResizeObserver>`u`)return;let l=()=>e.querySelector(M)||e.querySelector(le),u=t=>{r.style.marginTop=``;let n=()=>{let n=t.getBoundingClientRect(),{measured:i,buttonSize:a,iconSize:s}=X(n,60);if(i===0){r.style.display=`none`;return}r.style.display=`flex`,r.style.setProperty(`--lc-channel-size`,`${a}px`),r.style.setProperty(`--lc-channel-icon-size`,`${s}px`);let c=e.getBoundingClientRect();r.style.top=`${n.bottom-c.top+o}px`};n(),new ResizeObserver(n).observe(t)},d=l();if(d){u(d);return}r.style.top=`100%`,r.style.marginTop=`${o}px`;let f=!1,p=()=>{if(f)return;let t=l();if(t){f=!0,m.disconnect(),u(t);return}let{measured:n,buttonSize:i,iconSize:a}=X(e.getBoundingClientRect(),60);n!==0&&(r.style.setProperty(`--lc-channel-size`,`${i}px`),r.style.setProperty(`--lc-channel-icon-size`,`${a}px`))},m=new ResizeObserver(p);p(),f||m.observe(e)}function ve(e){let t=Z(e.channels,`mobile`);t.length!==0&&(W(),_e(),U(e.chatWidgetSelector,n=>{Q(n,t,e),U(N,n=>Q(n,t,e),{interval:200,maxRetries:15})}))}function $(e={}){let t=e.channelWidgetsConfig||{},n={chatWidgetSelector:t.chatWidgetSelector||`#chat-widget-container`,bubbleSelector:ue,channels:Array.isArray(t.channels)?t.channels:[],mobile:o(o({},{gap:`4px`,gapBelow:`0px`,gapSide:`8px`}),t.mobile),desktop:o(o({},{gap:`8px`,gapBelow:`8px`}),t.desktop)},r=ae();if(n.deviceType=r,n.channels.length===0)return;document.__lcChannelWidgetsConfig=e,r===`mobile`?ve(n):U(n.chatWidgetSelector,()=>{he(n),O()});let i=()=>{document.__lcBubbleAnchor=null,document.__lcVisibilityBound=!1,T();let e=document.__lcChannelWidgetsConfig;e&&j(e)};document.__lcChannelWidgetsSpaBound||(se(),window.addEventListener(`lc:locationchange`,i),document.__lcChannelWidgetsSpaBound=!0),document.__lcChannelWidgetsTurbolinksBound||(document.addEventListener(`turbolinks:load`,i),document.__lcChannelWidgetsTurbolinksBound=!0)}return window.commversion=window.commversion||{},window.LiveChatWidget.on(`ready`,()=>$(window.commversion)),e.lcAddChannelWidgets=$,e})({});
|
|
192
|
+
`,document.head.appendChild(e)}function ve(e,t){if(typeof e!=`string`||e.length===0)return null;if(/^(data:|https?:\/\/)/.test(e)){let n=document.createElement(`img`);return n.className=`lc-channel-icon`,n.alt=t||``,n.src=e,n}let n=document.createElement(`span`);n.className=`lc-channel-icon`,n.setAttribute(`aria-hidden`,`true`),n.innerHTML=e;let r=n.querySelector(`svg`);return r&&(r.setAttribute(`width`,`100%`),r.setAttribute(`height`,`100%`),r.style.display=`block`),n}function W(e,t,n){let r=e.left+e.width/2,i=e.top-n-12,a=`bottom`;i<8&&(i=e.bottom+12,a=`top`),i+n>window.innerHeight-8&&(i=window.innerHeight-n-8),i<8&&(i=8);let o=r-t/2;o<8&&(o=8),o+t>window.innerWidth-8&&(o=window.innerWidth-t-8);let s=Math.max(18,t-18),c=Math.max(18,Math.min(s,r-o));return{tx:o,ty:i,arrowSide:a,arrowOffset:c}}function G(e,t,n){e.__appliedArrowSide!==t&&(e.classList.remove(`lc-channel-popover--arrow-top`,`lc-channel-popover--arrow-bottom`),e.classList.add(`lc-channel-popover--arrow-${t}`),e.__appliedArrowSide=t),e.__arrowEl.style.left=`${n-6}px`}function K(e){let t=e.getBoundingClientRect(),n=t.width>0?t.width:e.__cachedWidth,r=t.height>0?t.height:e.__cachedHeight,i=W(e.__trigger.getBoundingClientRect(),n,r);e.style.transform=`translate3d(${i.tx}px,${i.ty}px,0)`,G(e,i.arrowSide,i.arrowOffset)}function q(e,{restoreFocus:t=!0}={}){e.__isOpen&&(e.__isOpen=!1,e.style.opacity=`0`,e.style.pointerEvents=`none`,requestAnimationFrame(()=>{var n;e.setAttribute(`aria-hidden`,`true`),k(e.__trigger,!1),t&&(n=e.__trigger)!=null&&n.isConnected&&e.__trigger.focus({preventScroll:!0})}))}function J({restoreFocus:e=!0}={}){for(let t of T)t.__isOpen&&q(t,{restoreFocus:e})}function ye(e){T.forEach(t=>{t!==e&&t.__isOpen&&q(t)}),e.__cachedTransform?(e.style.transform=e.__cachedTransform,e.__arrowSide&&e.__arrowEl&&G(e,e.__arrowSide,e.__arrowOffset)):e.__trigger&&K(e),e.style.opacity=`1`,e.style.pointerEvents=`auto`,requestAnimationFrame(()=>{var t;e.removeAttribute(`aria-hidden`),k(e.__trigger,!0),(t=e.__cta)==null||t.focus({preventScroll:!0})}),e.__isOpen=!0}function be(e){let t=e.popover,n=document.createElement(`div`);n.className=`lc-channel-popover`,n.dataset.popoverChannelId=e.type,n.setAttribute(`role`,`dialog`),n.setAttribute(`aria-modal`,`false`);let r=`lc-channel-popover-${e.type}-${++le}`;if(n.id=r,t.title){let e=document.createElement(`h3`);e.className=`lc-channel-popover-title`,e.id=`${r}-title`,e.textContent=t.title,n.appendChild(e),n.setAttribute(`aria-labelledby`,e.id)}if(t.description){let e=document.createElement(`p`);e.className=`lc-channel-popover-description`,e.id=`${r}-desc`,e.textContent=t.description,n.appendChild(e),n.setAttribute(`aria-describedby`,e.id)}let i=document.createElement(`a`);i.className=`lc-channel-popover-button`,i.style.textDecoration=`none`,i.style.display=`block`,i.style.textAlign=`center`,i.style.boxSizing=`border-box`,i.textContent=t.buttonLabel||`Start Conversation`,i.style.backgroundColor=e.backgroundColor||`#1a1a1a`,S(i,e),i.addEventListener(`click`,e=>{e.stopPropagation(),q(n)}),n.appendChild(i),n.__cta=i;let a=document.createElement(`button`);a.type=`button`,a.className=`lc-channel-popover-close`,a.setAttribute(`aria-label`,`Close`),a.textContent=`×`,a.onclick=e=>{e.stopPropagation(),q(n)},n.appendChild(a);let o=document.createElement(`div`);o.className=`lc-channel-popover-arrow`,n.appendChild(o),n.__arrowEl=o,n.__isOpen=!1,n.style.opacity=`0`,n.style.pointerEvents=`none`,n.setAttribute(`aria-hidden`,`true`),n.style.transform=`translate3d(0,0,0)`,document.body.appendChild(n);let s=n.getBoundingClientRect();return n.__cachedWidth=s.width>0?s.width:280,n.__cachedHeight=s.height,T.push(n),se(),ce(),n}function Y(e){let t=!!e.popover,n=document.createElement(t?`button`:`a`);n.className=`lc-channel-button`,n.dataset.channelId=e.type,t&&(n.type=`button`,n.setAttribute(`aria-haspopup`,`dialog`),k(n,!1)),e.label&&n.setAttribute(`aria-label`,e.label),e.backgroundColor&&(n.style.backgroundColor=e.backgroundColor);let r=t?be(e):null;n.__popoverEl=r,r&&(r.__trigger=n),t?n.onclick=e=>{e.stopPropagation(),r.__isOpen?q(r):ye(r)}:(n.style.textDecoration=`none`,S(n,e));let i=ve(e.icon,e.label||e.type);return i&&n.appendChild(i),n}function xe(e,t){let n=e==null?void 0:e[t];return n&&typeof n.enabled==`boolean`?n.enabled:t===`mobile`}function X(e,t){let n=Math.max(e.width,e.height),r=Math.min(n,t);return{measured:n,buttonSize:r,iconSize:Math.round(r*.5)}}function Z(e,t){let n=[];return e.forEach(e=>{let r=ie(e,t);if(!r){console.warn(`[lc-channel-widgets] unknown or invalid channel — skipping:`,e);return}f.set(r.type,r),p.add(r.type),ee(r),xe(r,t)&&n.push(r)}),x(),n}function Se(e){let{deviceType:t,chatWidgetSelector:n,channels:r,bubbleSelector:i}=e,a=e[t];if(!document.querySelector(n))return;let o=()=>document.querySelector(n),s=Z(r,t);if(s.length===0)return;U();let c=document.body.querySelector(`:scope > .lc-channel-stack`);c||(E(),c=document.createElement(`div`),c.className=`lc-channel-stack lc-channel-stack--horizontal`,c.style.gap=a.gap,c.setAttribute(`role`,`group`),c.setAttribute(`aria-label`,`Contact channels`),document.body.appendChild(c)),document.__lcStack=c,s.forEach(e=>{c.querySelector(`[data-channel-id="${CSS.escape(e.type)}"]`)||c.appendChild(Y(e))});let l=Number.parseInt(a.gapBelow,10)||8,u=()=>{let e=o();for(let t of i){let n=(e==null?void 0:e.querySelector(t))||document.querySelector(t);if(!n)continue;let r=n.getBoundingClientRect();if(r.width>0&&r.height>0)return r}return null},d=()=>{let e=o(),t=[];for(let n of i){let r=e?e.querySelector(n):null,i=document.querySelector(n);r&&!t.includes(r)&&t.push(r),i&&i!==r&&!t.includes(i)&&t.push(i)}return e&&!t.includes(e)&&t.push(e),t},f=`minimized`;try{var p,m;let e=(p=window.LiveChatWidget)==null||(m=p.get)==null||(m=m.call(p,`state`))==null?void 0:m.visibility;typeof e==`string`&&(f=e)}catch(e){}c.__lcVisibility=f;let h=()=>{let e=u();e&&c.__lcVisibility===`minimized`&&e.width<=R&&e.height<=R&&window.innerHeight-e.bottom<=z&&(document.__lcBubbleAnchor=me(e));let n=null,r=null;if(c.__lcVisibility===`minimized`)e&&(n=e,r=e);else if(c.__lcVisibility===`maximized`&&t!==`mobile`){let e=o();if(e){let t=e.getBoundingClientRect();t.width>0&&t.height>0&&(n=t,r=document.__lcBubbleAnchor?B(document.__lcBubbleAnchor):he(t))}}if(!n||!r){J({restoreFocus:!1}),c.style.display=`none`;return}c.style.display=`flex`;let{buttonSize:i,iconSize:a}=X(r,t===`mobile`?60:40),s=c.__lcLastButtonSize!==i;s&&(c.style.setProperty(`--lc-channel-size`,`${i}px`),c.style.setProperty(`--lc-channel-icon-size`,`${a}px`),c.__lcCachedDims=null,c.__lcLastButtonSize=i);let d=c.children.length,f=c.__lcLastButtonCount!==d;f&&(c.__lcCachedDims=null);let p=c.__lcCachedDims||c.getBoundingClientRect();c.__lcCachedDims=p,c.__lcLastButtonCount=d;let m,h;if(t===`mobile`){let e=r,t=Math.min(e.height,e.width,80),n=e.left<window.innerWidth-e.right?e.left+t/2:e.right-t/2,i=p.width/2;n-i<8&&(n=i+8),n+i>window.innerWidth-8&&(n=window.innerWidth-i-8),m=n-p.width/2,h=e.bottom+l-L}else{let e=n.left+n.width/2<window.innerWidth/2,t=p.height/2,i=r.top+r.height/2;i-t<8&&(i=t+8),i+t>window.innerHeight-8&&(i=window.innerHeight-t-8);let a=-t,o,s;e?(o=n.right+l,o+p.width>window.innerWidth-8&&(o=window.innerWidth-p.width-8),s=0):(o=n.left-l,o-p.width<8&&(o=p.width+8),s=-p.width),m=o+s,h=i+a}let g=`translate(${m}px, ${h}px)`;g===c.__lcLastTransform&&!s&&!f||(c.style.transform=g,c.__lcLastTransform=g,c.__lcTransitionActivated||requestAnimationFrame(()=>{c.classList.add(`lc-stack-ready`),c.__lcTransitionActivated=!0}),c.querySelectorAll(`.lc-channel-button`).forEach(e=>{let t=m+e.offsetLeft,n=h+e.offsetTop,r=e.offsetWidth,i=e.offsetHeight;if(e.__cachedRect={left:t,top:n,right:t+r,bottom:n+i,width:r,height:i},e.__popoverEl){let t=e.__popoverEl,{tx:n,ty:r,arrowSide:i,arrowOffset:a}=W(e.__cachedRect,t.__cachedWidth,t.__cachedHeight),o=`translate3d(${n}px,${r}px,0)`;t.__cachedTransform=o,t.__arrowSide=i,t.__arrowOffset=a,t.__isOpen&&(t.style.transform=o,G(t,i,a))}}))},g=0,_=()=>{g||(g=requestAnimationFrame(()=>{g=0,h()}))};h(),document.__lcCurrentSync=_,document.__lcWindowListenersBound||(window.addEventListener(`resize`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)}),window.addEventListener(`orientationchange`,()=>{var e,t;document.__lcBubbleAnchor=null,(e=(t=document).__lcCurrentSync)==null||e.call(t)}),window.visualViewport&&(window.visualViewport.addEventListener(`resize`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)}),window.visualViewport.addEventListener(`scroll`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)})),window.addEventListener(`scroll`,()=>{var e,t;return(e=(t=document).__lcCurrentSync)==null?void 0:e.call(t)},!0),document.__lcWindowListenersBound=!0),typeof ResizeObserver<`u`&&!c.__lcResizeObserved&&(new ResizeObserver(_).observe(c),c.__lcResizeObserved=!0);let v=()=>{let e=d();if(e.length===0)return;let t=c.__lcObservedBubbles||[];e.length===t.length&&e.every((e,n)=>e===t[n])||(c.__lcBubbleObserver&&c.__lcBubbleObserver.disconnect(),c.__lcObservedBubbles=e,typeof ResizeObserver<`u`&&(c.__lcBubbleObserver=new ResizeObserver(_),e.forEach(e=>c.__lcBubbleObserver.observe(e))))};v(),(!c.__lcObservedBubbles||c.__lcObservedBubbles.length===0)&&i.forEach(e=>{H(e,()=>{v(),h()})}),document.__lcCurrentRebind=v,document.__lcVisibilityBound=!1,j(!0)}function Ce(e){if(e.style.right&&e.style.right!==`auto`)return`right`;if(e.style.left&&e.style.left!==`auto`)return`left`;let t=window.getComputedStyle(e);return t.right===`auto`?t.left===`auto`?`right`:`left`:`right`}function we(){document.__lcPopoverVvBound||window.visualViewport&&(document.__lcPopoverVvBound=!0,window.visualViewport.addEventListener(`resize`,()=>{for(let e of T)e.__isOpen&&e.__trigger&&K(e)}))}function Q(e,t,n){if(!e||e.querySelector(`:scope > .lc-channel-stack--in-lc`))return;e.style.overflow=`unset`;let r=document.createElement(`div`);r.className=`lc-channel-stack lc-channel-stack--horizontal lc-channel-stack--in-lc`,r.setAttribute(`role`,`group`),r.setAttribute(`aria-label`,`Contact channels`),r.style.gap=n.mobile.gap;let i=Ce(e),a=Number.parseInt(n.mobile.gapBelow,10),o=Number.isFinite(a)?a:0,s=Number.parseInt(n.mobile.gapSide,10),c=Number.isFinite(s)?s:8;if(i===`left`?(r.style.left=`${c}px`,r.style.right=`auto`):(r.style.right=`${c}px`,r.style.left=`auto`),t.forEach(e=>{r.appendChild(Y(e))}),e.appendChild(r),typeof ResizeObserver>`u`)return;let l=()=>e.querySelector(F)||e.querySelector(fe),u=t=>{r.style.marginTop=``;let n=()=>{let n=t.getBoundingClientRect(),{measured:i,buttonSize:a,iconSize:s}=X(n,60);if(i===0){J({restoreFocus:!1}),r.style.display=`none`;return}r.style.display=`flex`,r.style.setProperty(`--lc-channel-size`,`${a}px`),r.style.setProperty(`--lc-channel-icon-size`,`${s}px`);let c=e.getBoundingClientRect();r.style.top=`${n.bottom-c.top+o}px`};n(),new ResizeObserver(n).observe(t)},d=l();if(d){u(d);return}r.style.top=`100%`,r.style.marginTop=`${o}px`;let f=!1,p=()=>{if(f)return;let t=l();if(t){f=!0,m.disconnect(),u(t);return}let{measured:n,buttonSize:i,iconSize:a}=X(e.getBoundingClientRect(),60);n!==0&&(r.style.setProperty(`--lc-channel-size`,`${i}px`),r.style.setProperty(`--lc-channel-icon-size`,`${a}px`))},m=new ResizeObserver(p);p(),f||m.observe(e)}function Te(e){let t=Z(e.channels,`mobile`);t.length!==0&&(U(),we(),H(e.chatWidgetSelector,n=>{Q(n,t,e),H(I,n=>Q(n,t,e),{interval:200,maxRetries:15})}))}function $(e={}){let t=e.channelWidgetsConfig||{},n={chatWidgetSelector:t.chatWidgetSelector||`#chat-widget-container`,bubbleSelector:pe,channels:Array.isArray(t.channels)?t.channels:[],mobile:o(o({},{gap:`4px`,gapBelow:`0px`,gapSide:`8px`}),t.mobile),desktop:o(o({},{gap:`8px`,gapBelow:`8px`}),t.desktop)},r=oe();if(n.deviceType=r,n.channels.length===0)return;document.__lcChannelWidgetsConfig=e,r===`mobile`?Te(n):H(n.chatWidgetSelector,()=>{Se(n),de()});let i=()=>{document.__lcBubbleAnchor=null,document.__lcVisibilityBound=!1,E();let e=document.__lcChannelWidgetsConfig;e&&P(e)};document.__lcChannelWidgetsSpaBound||(ue(),window.addEventListener(`lc:locationchange`,i),document.__lcChannelWidgetsSpaBound=!0),document.__lcChannelWidgetsTurbolinksBound||(document.addEventListener(`turbolinks:load`,i),document.__lcChannelWidgetsTurbolinksBound=!0)}return window.commversion=window.commversion||{},window.LiveChatWidget.on(`ready`,()=>$(window.commversion)),e.lcAddChannelWidgets=$,e})({});
|
package/package.json
CHANGED
package/pnpm-workspace.yaml
CHANGED