@meetelise/chat 1.43.34 → 1.43.36

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.
@@ -1212,7 +1212,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
1212
1212
  gap: 12px;
1213
1213
  align-items: center;
1214
1214
  }
1215
- `;class wi{constructor(e,t,n,i){this.org=e,this.building=t,this.chatId=n,this.incomingProcessedLeadSource=i,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){var t;fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:Ci(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const Ci=()=>{var e,t,n,i,r,o;try{const i=new URL(window.location.href).searchParams,r=null!==(n=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==n?n:null,o=i.get("switch_cls[id]"),a=i.get("ilm"),s=i.get("utm_source");return{entrataCampaignSource:o,realpageCampaignSource:a,utmCampaignSource:s,yardiCampaignSource:r,bozzutoAdSource:Cn("bozzuto_ad_source")}}catch(e){const t=document.createElement("iframe");if(t.style.display="none",document.body.appendChild(t),!t.contentWindow)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const n=t.contentWindow.URL;if(!n)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new n(window.location.href).searchParams,s=null!==(o=null===(r=null===(i=window.RCTPCampaign)||void 0===i?void 0:i.CampaignDetails)||void 0===r?void 0:r.Source)&&void 0!==o?o:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:Cn("bozzuto_ad_source")}}};var xi;!function(e){e.error="error",e.info="info",e.warn="warn"}(xi||(xi={}));const Ai=async({logType:e,buildingSlug:t,orgSlug:n,logTitle:i,logData:o})=>{await r().post("https://app.meetelise.com/platformApi/webchat/logging",{...o},{headers:{"Content-Type":"application/json","building-slug":null!=t?t:"","org-slug":null!=n?n:"","log-type":null!=e?e:xi.error,"log-title":i.toUpperCase().replace(/\s/g,"_")}})},Si=async({params:e,sampleRate:t})=>{try{if(Math.random()>=t)return;await r().post("https://app.meetelise.com/platformApi/webchat/log/signal",{...e,website_origin:window.location.origin,website_search:window.location.search})}catch(e){}};function Ei(){return ki()?function(){const e=window.location.search,t={},n=e.split("?").slice(1).join("&");return n.split("&").forEach(e=>{const[n,i]=e.split("=");n&&i&&(t[decodeURIComponent(n)]=decodeURIComponent(i))}),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),n=e.has("utm_source");if(t&&!n){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const ki=()=>(window.location.search.match(/\?/g)||[]).length>1;var Ti=n(2193),_i=n.n(Ti);function Oi(e){return"avb"===e?"AVB Company Website":"windsor"===e?"Windsorcommunities.com":"property-website"}const Pi=class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,n,i,r)=>{const o=Ei();if(this.leadSourceInput={websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:o,referrer:document.referrer,parsedUtmSource:o?o.utm_source:null,campaignSources:Object.values(Ci()).filter(e=>e)},i)return;if(!r){const t=this.getLeadSourceBodyIfValid(e);if(t){if(!wn(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:Rn(t.timestamp)}}}const a={leadSource:t,leadId:n,buildingSlug:e,timestamp:On(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:Rn(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const n=JSON.parse(t);if(n.buildingSlug===e&&n.leadSource&&n.leadId&&n.timestamp&&!wn(Rn(n.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=n.leadSourceInput}catch(e){}return n}}catch(e){return null}return null},this.resetLeadSource=()=>{if(!this.buildingSlug)return!1;const e="com.elise.webchat.leadsource.slug="+this.buildingSlug;return localStorage.removeItem(e),!0}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:t,referrer:n,campaignSources:i}){try{return(await r().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:t,building_slug:e,referrer:n,campaign_sources:i})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:t}){var n,i,o,a,s,l,u;try{if(!this.chatId)return null;if(!this.orgSlug)return null;let c=null,d=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(c=e),d=null===(n=window.dataLayer.find(e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)}))||void 0===n?void 0:n.value}}catch(e){}return await r().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:t,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(i=this.leadSourceInput)||void 0===i?void 0:i.websiteOrigin,website_search:null===(o=this.leadSourceInput)||void 0===o?void 0:o.websiteSearch,query_parameters:null===(a=this.leadSourceInput)||void 0===a?void 0:a.queryParameters,referrer:null===(s=this.leadSourceInput)||void 0===s?void 0:s.referrer,parsed_utm_source:null===(l=this.leadSourceInput)||void 0===l?void 0:l.parsedUtmSource,campaign_sources:null===(u=this.leadSourceInput)||void 0===u?void 0:u.campaignSources,lead_source_output:this.leadSource,google_analytics_client_id:_i()(c)?null:c,extras:null!=d?d:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(i.startsWith(e+"=")){return i.substring((e+"=").length,-1===i.indexOf(";")?void 0:i.indexOf(";"))}}return null}catch(e){}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:n}){try{const i={queryParams:Ei(),buildingSlug:n,referrer:document.referrer,campaignSources:Ci()};let r=!1;const o=n?this.getLeadSourceBodyIfValid(n):null;if(o){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=o.leadSource,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(i);if(!e)return this.leadSource=o.leadSource,this.leadSource;this.leadSource=e,r=!0}}const a=await this.fetchCurrentParsedLeadSource(i);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=n,n&&!a){const e=this.getLeadSourceBodyIfValid(n);if(e)return this.leadSource=e.leadSource,this.leadSource}if(n){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(n,a,e,!t&&!r,r)}return a}catch(e){}return null}},Ii=async(e,t=!1)=>{const n=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${t}`;try{return(await r().get(n)).data.is_enabled}catch(e){return!1}};var Mi,Ni,Di;!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Mi||(Mi={})),function(e){e.UNKNOWN="UNKNOWN",e.SELF_GUIDED="SELF_GUIDED",e.VIRTUAL_SHOWING="VIRTUAL_SHOWING",e.WITH_AGENT="WITH_AGENT",e.MEDIA_TOUR="MEDIA_TOUR",e.OPEN_HOUSE_STUDIO="OPEN_HOUSE_STUDIO",e.OPEN_HOUSE_1BR="OPEN_HOUSE_1BR",e.OPEN_HOUSE_2BR="OPEN_HOUSE_2BR",e.OPEN_HOUSE_3BR="OPEN_HOUSE_3BR",e.OPEN_HOUSE_4BR="OPEN_HOUSE_4BR",e.OPEN_HOUSE_5BR="OPEN_HOUSE_5BR"}(Ni||(Ni={})),function(e){e.LINK="link",e.CLIENT_SCHEDULED="client_scheduled",e.SCHEDULED_BY_ME_MANAGED_BY_ME="scheduled_by_ME_managed_by_ME",e.SCHEDULED_BY_ME_MANAGED_BY_CLIENT="scheduled_by_ME_managed_by_client",e.SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE="scheduled_by_ME_managed_by_concierge"}(Di||(Di={}));const Li=(e,t)=>{if("self"===e){return!["SCHEDULED_BY_ME_MANAGED_BY_ME","SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE","SCHEDULED_BY_ME_MANAGED_BY_CLIENT"].includes(t)}if("virtual"===e){return!["SCHEDULED_BY_ME_MANAGED_BY_CLIENT"].includes(t)}return!1};async function Ui(e,t){var n;const i=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${t}/v2`,o=(await r().get(i)).data;try{o.welcomeMessage=Ri(null!==(n=o.welcomeMessage)&&void 0!==n?n:"",o.userFirstName)}catch(e){}return o}const Ri=(e,t)=>e.replace(/elise/gi,t);var Bi=n(7035),ji=n(6353);function Fi(e,t,n){var i=function(e,t,n){if(n&&!n.code)throw new Error("date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = 'en-US'`");return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,n.timeZone,n.locale);return i.formatToParts?function(e,t){for(var n=e.formatToParts(t),i=n.length-1;i>=0;--i)if("timeZoneName"===n[i].type)return n[i].value}(i,t):function(e,t){var n=e.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(n);return i?i[0].substr(1):""}(i,t)}function Hi(e,t){var n=function(e){if(!zi[e]){var t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;zi[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return zi[e]}(t);return n.formatToParts?function(e,t){try{for(var n=e.formatToParts(t),i=[],r=0;r<n.length;r++){var o=$i[n[r].type];o>=0&&(i[o]=parseInt(n[r].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(n,e):function(e,t){var n=e.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[i[3],i[1],i[2],i[4],i[5],i[6]]}(n,e)}var $i={year:0,month:1,day:2,hour:3,minute:4,second:5};var zi={};function Gi(e,t,n,i,r,o,a){var s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(i,r,o,a),s}var Qi=36e5,qi={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Wi(e,t,n){var i,r,o;if(!e)return 0;if(i=qi.timezoneZ.exec(e))return 0;if(i=qi.timezoneHH.exec(e))return Yi(o=parseInt(i[1],10))?-o*Qi:NaN;if(i=qi.timezoneHHMM.exec(e)){o=parseInt(i[2],10);var a=parseInt(i[3],10);return Yi(o,a)?(r=Math.abs(o)*Qi+6e4*a,"+"===i[1]?-r:r):NaN}if(function(e){if(Ki[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Ki[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var s=n?t:function(e){return Gi(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=Vi(s,e),u=n?l:function(e,t,n){var i=e.getTime(),r=i-t,o=Vi(new Date(r),n);if(t===o)return t;r-=o-t;var a=Vi(new Date(r),n);if(o===a)return o;return Math.max(o,a)}(t,l,e);return-u}return NaN}function Vi(e,t){var n=Hi(e,t),i=Gi(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),r=e.getTime(),o=r%1e3;return i-(r-=o>=0?o:1e3+o)}function Yi(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var Ki={};var Xi={X:function(e,t,n,i){var r=Zi(i.timeZone,e);if(0===r)return"Z";switch(t){case"X":return tr(r);case"XXXX":case"XX":return er(r);default:return er(r,":")}},x:function(e,t,n,i){var r=Zi(i.timeZone,e);switch(t){case"x":return tr(r);case"xxxx":case"xx":return er(r);default:return er(r,":")}},O:function(e,t,n,i){var r=Zi(i.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t){var n=e>0?"-":"+",i=Math.abs(e),r=Math.floor(i/60),o=i%60;if(0===o)return n+String(r);var a=t||"";return n+String(r)+a+Ji(o,2)}(r,":");default:return"GMT"+er(r,":")}},z:function(e,t,n,i){switch(t){case"z":case"zz":case"zzz":return Fi("short",e,i);default:return Fi("long",e,i)}}};function Zi(e,t){var n=e?Wi(e,t,!0)/6e4:t.getTimezoneOffset();if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function Ji(e,t){for(var n=e<0?"-":"",i=Math.abs(e).toString();i.length<t;)i="0"+i;return n+i}function er(e,t){var n=t||"",i=e>0?"-":"+",r=Math.abs(e);return i+Ji(Math.floor(r/60),2)+n+Ji(Math.floor(r%60),2)}function tr(e,t){return e%60==0?(e>0?"-":"+")+Ji(Math.abs(e)/60,2):er(e,t)}const nr=Xi;var ir=n(9784),rr=n(9720);var or=36e5,ar=6e4,sr={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function lr(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);var n=t||{},i=null==n.additionalDigits?2:ir(n.additionalDigits);if(2!==i&&1!==i&&0!==i)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var r=function(e){var t,n={},i=sr.dateTimePattern.exec(e);i?(n.date=i[1],t=i[3]):(i=sr.datePattern.exec(e))?(n.date=i[1],t=i[2]):(n.date=null,t=e);if(t){var r=sr.timeZone.exec(t);r?(n.time=t.replace(r[1],""),n.timeZone=r[1].trim()):n.time=t}return n}(e),o=function(e,t){var n,i=sr.YYY[t],r=sr.YYYYY[t];if(n=sr.YYYY.exec(e)||r.exec(e)){var o=n[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(n=sr.YY.exec(e)||i.exec(e)){var a=n[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}(r.date,i),a=o.year,s=function(e,t){if(null===t)return null;var n,i,r,o;if(0===e.length)return(i=new Date(0)).setUTCFullYear(t),i;if(n=sr.MM.exec(e))return i=new Date(0),pr(t,r=parseInt(n[1],10)-1)?(i.setUTCFullYear(t,r),i):new Date(NaN);if(n=sr.DDD.exec(e)){i=new Date(0);var a=parseInt(n[1],10);return function(e,t){if(t<1)return!1;var n=hr(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,a)?(i.setUTCFullYear(t,0,a),i):new Date(NaN)}if(n=sr.MMDD.exec(e)){i=new Date(0),r=parseInt(n[1],10)-1;var s=parseInt(n[2],10);return pr(t,r,s)?(i.setUTCFullYear(t,r,s),i):new Date(NaN)}if(n=sr.Www.exec(e))return fr(t,o=parseInt(n[1],10)-1)?ur(t,o):new Date(NaN);if(n=sr.WwwD.exec(e)){o=parseInt(n[1],10)-1;var l=parseInt(n[2],10)-1;return fr(t,o,l)?ur(t,o,l):new Date(NaN)}return null}(o.restDateString,a);if(isNaN(s))return new Date(NaN);if(s){var l,u=s.getTime(),c=0;if(r.time&&(c=function(e){var t,n,i;if(t=sr.HH.exec(e))return gr(n=parseFloat(t[1].replace(",",".")))?n%24*or:NaN;if(t=sr.HHMM.exec(e))return gr(n=parseInt(t[1],10),i=parseFloat(t[2].replace(",",".")))?n%24*or+i*ar:NaN;if(t=sr.HHMMSS.exec(e)){n=parseInt(t[1],10),i=parseInt(t[2],10);var r=parseFloat(t[3].replace(",","."));return gr(n,i,r)?n%24*or+i*ar+1e3*r:NaN}return null}(r.time),isNaN(c)))return new Date(NaN);if(r.timeZone||n.timeZone){if(l=Wi(r.timeZone||n.timeZone,new Date(u+c)),isNaN(l))return new Date(NaN)}else l=rr(new Date(u+c)),l=rr(new Date(u+c+l));return new Date(u+c+l)}return new Date(NaN)}function ur(e,t,n){t=t||0,n=n||0;var i=new Date(0);i.setUTCFullYear(e,0,4);var r=7*t+n+1-(i.getUTCDay()||7);return i.setUTCDate(i.getUTCDate()+r),i}var cr=[31,28,31,30,31,30,31,31,30,31,30,31],dr=[31,29,31,30,31,30,31,31,30,31,30,31];function hr(e){return e%400==0||e%4==0&&e%100!=0}function pr(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;var i=hr(e);if(i&&n>dr[t])return!1;if(!i&&n>cr[t])return!1}return!0}function fr(e,t,n){return!(t<0||t>52)&&(null==n||!(n<0||n>6))}function gr(e,t,n){return(null==e||!(e<0||e>=25))&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}var mr=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function yr(e,t,n,i){var r=Bi(i);return r.timeZone=t,r.originalDate=e,function(e,t,n){var i=String(t),r=n||{},o=i.match(mr);if(o){var a=lr(r.originalDate||e,r);i=o.reduce(function(e,t){if("'"===t[0])return e;var n=e.indexOf(t),i="'"===e[n-1],o=e.replace(t,"'"+nr[t[0]](a,t,null,r)+"'");return i?o.substring(0,n-1)+o.substring(n+1):o},i)}return ji(e,i,r)}(function(e,t,n){var i=lr(e,n),r=Wi(t,i,!0),o=new Date(i.getTime()-r),a=new Date(0);return a.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),a.setHours(o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.getUTCMilliseconds()),a}(e,t),n,r)}var br=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let vr=class extends oe{constructor(){super(...arguments),this.tourTypeOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.selfGuidedToursTypeOffered="",this.selfGuidedTourEnabled=!1,this.escortedToursLink="",this.escortedToursTypeOffered="",this.virtualToursLink="",this.virtualToursTypeOffered="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[wr.Guided]:!0,[wr.Self]:!0,[wr.Virtual]:!0},this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.calendarTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone,this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.shouldAllowScheduling=!1,this.shouldAllowScheduleLoading=!0,this.promptForReschedule=!1,this.canceledReschedule=!1,this.leadSources=[],this.orgLegalName="",this.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.primaryColor=Ue,this.backgroundColor=Re,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this._setAvailabilities=async()=>{try{const[e,t]=await Promise.all([Ii(this.buildingId,this.hasDynamicSchedulingEnabled),Kn()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,this.calendarTimeZone=await(async e=>{var t;return null!==(t=(await Vn(e)).calendarTimeZone)&&void 0!==t?t:Intl.DateTimeFormat().resolvedOptions().timeZone})(this.buildingId),Ai({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:xi.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const n=Object.values(t).every(e=>!1===e),i=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(n&&i)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void Ai({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.shouldShowTourType={[wr.Guided]:this.tourTypeOptions.map(e=>e.value).includes("WITH_AGENT")&&(t[wr.Guided]||!!this.escortedToursLink),[wr.Self]:this.tourTypeOptions.map(e=>e.value).includes("SELF_GUIDED")&&(t[wr.Self]||!!this.sgtUrl),[wr.Virtual]:this.tourTypeOptions.map(e=>e.value).includes("VIRTUAL_SHOWING")&&(t[wr.Virtual]||!!this.virtualToursLink)};const r=1===Object.values(this.shouldShowTourType).reduce((e,t)=>!0===t?e+1:e,0);if(this._setDefaultSelectedDateAndTimes(),r&&(this.tourType=Object.keys(this.shouldShowTourType).find(e=>this.shouldShowTourType[e])),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Xn(Cr[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,Ai({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this._setDefaultSelectedDateAndTimes=async(e,t)=>{var n,i,r;const o=await Vn(this.buildingId),a=null!=e?e:this._getHighestRankedTourType(o),s=a?null===(r=null===(i=null===(n=o.availability)||void 0===n?void 0:n[a])||void 0===i?void 0:i.availableTourStartTimes)||void 0===r?void 0:r.filter(e=>{if(!t)return!0;return qt("string"==typeof e?Rn(e):e,t)}):[],l=null==s?void 0:s[0];a&&l&&a!==In.Unknown&&a!==In.MediaTour&&(this.selectedDate=Qt("string"==typeof l?Rn(l):l),this.tourType=xr[a],this.selectedTime="string"==typeof l?Zn(l):(e=>({datetime:Ft(e,"yyyy-MM-dd'T'HH:mm:ss"),offset:Ft(e,"xxx")}))(l))},this._getHighestRankedTourType=e=>{var t;const n=(null!==(t=e.rankOrderedSupportedTourTypes)&&void 0!==t?t:[]).map(t=>{var n,i;return{tourType:t,availabilities:null===(i=null===(n=e.availability)||void 0===n?void 0:n[t])||void 0===i?void 0:i.availableTourStartTimes}}).filter(e=>{if(e.tourType===In.Unknown||e.tourType===In.MediaTour)return!1;const t=xr[e.tourType],n=this._getTourTypeOffered(t);return!!n&&(!Li(t,n)&&e.availabilities&&e.availabilities.length>0)}),i=n[0];return i?i.tourType:null},this._getTourTypeOffered=e=>e===wr.Guided?this.escortedToursTypeOffered:e===wr.Self?this.selfGuidedToursTypeOffered:e===wr.Virtual?this.virtualToursTypeOffered:null,this.firstUpdated=async()=>{await this._setAvailabilities()},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Xn(Cr[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const n=e.target.selectionStart;if(1!==e.key.length||Ne(e)){if("Backspace"===e.key){if(Ne(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,i=this.phoneNumber.slice(0,n).replace(/\D/g,""),r=this.phoneNumber.slice(n).replace(/\D/g,""),o=`${i.slice(0,-1)}${r}`;this.phoneNumber=Pe(o),this.phoneInput.value=this.phoneNumber;const a=n-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Ne(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,n).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,i=n-e>-1?n-e:0;this.phoneInput.setSelectionRange(i,i)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(n).split(/\d+/)[0].length||0)+1,t=n+e<this.phoneNumber.length?n+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,n)+e.key+this.phoneNumber.slice(n);this.phoneNumber=Pe(t.replace(/\D/g,"")),this.phoneInput.value=this.phoneNumber}},this.handlePhoneKeyup=e=>{var t;if(!e.key)return;if(e.key.includes("Arrow")||["Meta","Shift","Control","Alt"].includes(e.key))return;const n=this.phoneInput.selectionStart,i=n?this.phoneInput.value.slice(n).replace(/\D/g,""):"";this.phoneNumber=Pe(this.phoneInput.value);let r=0,o=i.length;for(;o;)(null===(t=this.phoneNumber.at(r))||void 0===t?void 0:t.match(/\d/))&&o--,r++;const a=this.phoneInput.value.length-r+1;this.phoneInput.setSelectionRange(a,a)},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.validators={tourType:()=>null!==this.tourType,dateAndTime:()=>!!this.selectedDate&&!!this.selectedTime,leadInfo:()=>{var e,t,n,i;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&An(null!==(i=null===(n=this.emailInput)||void 0===n?void 0:n.value)&&void 0!==i?i:"")&&!!this.phoneNumber&&14===this.phoneNumber.length&&xn(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,n]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(n)]},this.submit=async()=>{var e,t,n,i,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const x=new URLSearchParams(window.location.search);let A=null;A=this.selectedLeadSource&&this.selectedLeadSource.value&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:this.leadSourceInputValue&&this.leadSourceInputValue.length>0?this.leadSourceInputValue:this.currentLeadSource;const S=[...new Set(A?[A,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=A,ai("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(e=this.phoneNumber.match(/\d/g))||void 0===e?void 0:e.join("")}`,firstName:null!==(n=null===(t=this.firstNameInput)||void 0===t?void 0:t.value)&&void 0!==n?n:this.firstNameInputValue,lastName:null!==(o=null===(i=this.lastNameInput)||void 0===i?void 0:i.value)&&void 0!==o?o:this.lastNameInputValue,tourType:Ar[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:S.find(e=>"property-website"!==e)||null});const E={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(a=this.phoneNumber.match(/\d/g))||void 0===a?void 0:a.join("")}`,building_id:this.buildingId,first_name:null!==(l=null===(s=this.firstNameInput)||void 0===s?void 0:s.value)&&void 0!==l?l:this.firstNameInputValue,last_name:null!==(c=null===(u=this.lastNameInput)||void 0===u?void 0:u.value)&&void 0!==c?c:this.lastNameInputValue,tour_type:Ar[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(A?[A,Oi(this.orgSlug)]:[Oi(this.orgSlug)])],query_params:Object.fromEntries(x.entries()),conversation_tracking_id:null===(d=this.leadSourceClient)||void 0===d?void 0:d.chatId,lead_sources_with_timestamps:(null!==(f=null===(h=this.leadSourceMultitouchClient)||void 0===h?void 0:h.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:(null===(p=this.selectedLeadSource)||void 0===p?void 0:p.value)&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:null}))&&void 0!==f?f:[]).map(e=>gn({...e}))};this.isSubmitting=!0;try{await r().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",E,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"webchatkey-wkjcWAKZjqhLStvP8L6SN8y4FbYmPhdE","org-slug":this.orgSlug}}),null===(g=this.leadSourceClient)||void 0===g||g.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),null===(m=this.leadSourceClient)||void 0===m||m.resetLeadSource(),null===(y=this.leadSourceMultitouchClient)||void 0===y||y.resetLeadSourceTouchpoints(),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,n=(null===(v=null===(b=t.response)||void 0===b?void 0:b.data)||void 0===v?void 0:v.detail)||"Failed to book tour";if(t.response&&t.response.headers&&t.response.headers["funnel-prospect-conflicting-appointment-error"]){if(this.selectedDate&&this.selectedTime){const e=this.availabilitiesGroupedByDay[Ft(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[Ft(this.selectedDate,"yyyy-MM-dd")]=e.filter(e=>e!==this.selectedTime))}}else{if(409===(null===(w=t.response)||void 0===w?void 0:w.status)&&!this.promptForReschedule&&"User already has a tour scheduled for this building"===n)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);if(409===(null===(C=t.response)||void 0===C?void 0:C.status)&&!this.promptForReschedule)return this.isSubmitting=!1,this.tourIsBooked=!1,Wn(),this.availabilitiesGroupedByDay=await Xn(Cr[this.tourType],this.buildingId),void alert("This timeslot is no longer available. Please select a different time.")}alert(n),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>B`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>B`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>B` <action-confirm-button
1215
+ `;class wi{constructor(e,t,n,i){this.org=e,this.building=t,this.chatId=n,this.incomingProcessedLeadSource=i,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){var t;fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:Ci(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const Ci=()=>{var e,t,n,i,r,o;try{const i=new URL(window.location.href).searchParams,r=null!==(n=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==n?n:null,o=i.get("switch_cls[id]"),a=i.get("ilm"),s=i.get("utm_source");return{entrataCampaignSource:o,realpageCampaignSource:a,utmCampaignSource:s,yardiCampaignSource:r,bozzutoAdSource:Cn("bozzuto_ad_source")}}catch(e){const t=document.createElement("iframe");if(t.style.display="none",document.body.appendChild(t),!t.contentWindow)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const n=t.contentWindow.URL;if(!n)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new n(window.location.href).searchParams,s=null!==(o=null===(r=null===(i=window.RCTPCampaign)||void 0===i?void 0:i.CampaignDetails)||void 0===r?void 0:r.Source)&&void 0!==o?o:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:Cn("bozzuto_ad_source")}}};var xi;!function(e){e.error="error",e.info="info",e.warn="warn"}(xi||(xi={}));const Ai=async({logType:e,buildingSlug:t,orgSlug:n,logTitle:i,logData:o})=>{await r().post("https://app.meetelise.com/platformApi/webchat/logging",{...o},{headers:{"Content-Type":"application/json","building-slug":null!=t?t:"","org-slug":null!=n?n:"","log-type":null!=e?e:xi.error,"log-title":i.toUpperCase().replace(/\s/g,"_")}})},Si=async({params:e,sampleRate:t})=>{try{if(Math.random()>=t)return;await r().post("https://app.meetelise.com/platformApi/webchat/log/signal",{...e,website_origin:window.location.origin,website_search:window.location.search})}catch(e){}};function Ei(){return ki()?function(){const e=window.location.search,t={},n=e.split("?").slice(1).join("&");return n.split("&").forEach(e=>{const[n,i]=e.split("=");n&&i&&(t[decodeURIComponent(n)]=decodeURIComponent(i))}),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),n=e.has("utm_source");if(t&&!n){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const ki=()=>(window.location.search.match(/\?/g)||[]).length>1;var Ti=n(2193),_i=n.n(Ti);function Oi(e){return"avb"===e?"AVB Company Website":"windsor"===e?"Windsorcommunities.com":"property-website"}const Pi=class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,n,i,r)=>{const o=Ei();if(this.leadSourceInput={websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:o,referrer:document.referrer,parsedUtmSource:o?o.utm_source:null,campaignSources:Object.values(Ci()).filter(e=>e)},i)return;if(!r){const t=this.getLeadSourceBodyIfValid(e);if(t){if(!wn(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:Rn(t.timestamp)}}}const a={leadSource:t,leadId:n,buildingSlug:e,timestamp:On(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:Rn(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const n=JSON.parse(t);if(n.buildingSlug===e&&n.leadSource&&n.leadId&&n.timestamp&&!wn(Rn(n.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=n.leadSourceInput}catch(e){}return n}}catch(e){return null}return null},this.resetLeadSource=()=>{if(!this.buildingSlug)return!1;const e="com.elise.webchat.leadsource.slug="+this.buildingSlug;return localStorage.removeItem(e),!0}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:t,referrer:n,campaignSources:i}){try{return(await r().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:t,building_slug:e,referrer:n,campaign_sources:i})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:t}){var n,i,o,a,s,l,u;try{if(!this.chatId)return null;if(!this.orgSlug)return null;let c=null,d=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(c=e),d=null===(n=window.dataLayer.find(e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)}))||void 0===n?void 0:n.value}}catch(e){}return await r().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:t,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(i=this.leadSourceInput)||void 0===i?void 0:i.websiteOrigin,website_search:null===(o=this.leadSourceInput)||void 0===o?void 0:o.websiteSearch,query_parameters:null===(a=this.leadSourceInput)||void 0===a?void 0:a.queryParameters,referrer:null===(s=this.leadSourceInput)||void 0===s?void 0:s.referrer,parsed_utm_source:null===(l=this.leadSourceInput)||void 0===l?void 0:l.parsedUtmSource,campaign_sources:null===(u=this.leadSourceInput)||void 0===u?void 0:u.campaignSources,lead_source_output:this.leadSource,google_analytics_client_id:_i()(c)?null:c,extras:null!=d?d:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(i.startsWith(e+"=")){return i.substring((e+"=").length,-1===i.indexOf(";")?void 0:i.indexOf(";"))}}return null}catch(e){}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:n}){try{const i={queryParams:Ei(),buildingSlug:n,referrer:document.referrer,campaignSources:Ci()};let r=!1;const o=n?this.getLeadSourceBodyIfValid(n):null;if(o){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=o.leadSource,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(i);if(!e)return this.leadSource=o.leadSource,this.leadSource;this.leadSource=e,r=!0}}const a=await this.fetchCurrentParsedLeadSource(i);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=n,n&&!a){const e=this.getLeadSourceBodyIfValid(n);if(e)return this.leadSource=e.leadSource,this.leadSource}if(n){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(n,a,e,!t&&!r,r)}return a}catch(e){}return null}},Ii=async(e,t=!1)=>{const n=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${t}`;try{return(await r().get(n)).data.is_enabled}catch(e){return!1}};var Mi,Ni,Di;!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Mi||(Mi={})),function(e){e.UNKNOWN="UNKNOWN",e.SELF_GUIDED="SELF_GUIDED",e.VIRTUAL_SHOWING="VIRTUAL_SHOWING",e.WITH_AGENT="WITH_AGENT",e.MEDIA_TOUR="MEDIA_TOUR",e.OPEN_HOUSE_STUDIO="OPEN_HOUSE_STUDIO",e.OPEN_HOUSE_1BR="OPEN_HOUSE_1BR",e.OPEN_HOUSE_2BR="OPEN_HOUSE_2BR",e.OPEN_HOUSE_3BR="OPEN_HOUSE_3BR",e.OPEN_HOUSE_4BR="OPEN_HOUSE_4BR",e.OPEN_HOUSE_5BR="OPEN_HOUSE_5BR"}(Ni||(Ni={})),function(e){e.LINK="link",e.CLIENT_SCHEDULED="client_scheduled",e.SCHEDULED_BY_ME_MANAGED_BY_ME="scheduled_by_ME_managed_by_ME",e.SCHEDULED_BY_ME_MANAGED_BY_CLIENT="scheduled_by_ME_managed_by_client",e.SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE="scheduled_by_ME_managed_by_concierge"}(Di||(Di={}));const Li=(e,t)=>"link"===(null==t?void 0:t.toLowerCase());async function Ui(e,t){var n;const i=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${t}/v2`,o=(await r().get(i)).data;try{o.welcomeMessage=Ri(null!==(n=o.welcomeMessage)&&void 0!==n?n:"",o.userFirstName)}catch(e){}return o}const Ri=(e,t)=>e.replace(/elise/gi,t);var Bi=n(7035),ji=n(6353);function Fi(e,t,n){var i=function(e,t,n){if(n&&!n.code)throw new Error("date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = 'en-US'`");return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,n.timeZone,n.locale);return i.formatToParts?function(e,t){for(var n=e.formatToParts(t),i=n.length-1;i>=0;--i)if("timeZoneName"===n[i].type)return n[i].value}(i,t):function(e,t){var n=e.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(n);return i?i[0].substr(1):""}(i,t)}function Hi(e,t){var n=function(e){if(!zi[e]){var t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;zi[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return zi[e]}(t);return n.formatToParts?function(e,t){try{for(var n=e.formatToParts(t),i=[],r=0;r<n.length;r++){var o=$i[n[r].type];o>=0&&(i[o]=parseInt(n[r].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(n,e):function(e,t){var n=e.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[i[3],i[1],i[2],i[4],i[5],i[6]]}(n,e)}var $i={year:0,month:1,day:2,hour:3,minute:4,second:5};var zi={};function Gi(e,t,n,i,r,o,a){var s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(i,r,o,a),s}var Qi=36e5,qi={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Wi(e,t,n){var i,r,o;if(!e)return 0;if(i=qi.timezoneZ.exec(e))return 0;if(i=qi.timezoneHH.exec(e))return Yi(o=parseInt(i[1],10))?-o*Qi:NaN;if(i=qi.timezoneHHMM.exec(e)){o=parseInt(i[2],10);var a=parseInt(i[3],10);return Yi(o,a)?(r=Math.abs(o)*Qi+6e4*a,"+"===i[1]?-r:r):NaN}if(function(e){if(Ki[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Ki[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var s=n?t:function(e){return Gi(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=Vi(s,e),u=n?l:function(e,t,n){var i=e.getTime(),r=i-t,o=Vi(new Date(r),n);if(t===o)return t;r-=o-t;var a=Vi(new Date(r),n);if(o===a)return o;return Math.max(o,a)}(t,l,e);return-u}return NaN}function Vi(e,t){var n=Hi(e,t),i=Gi(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),r=e.getTime(),o=r%1e3;return i-(r-=o>=0?o:1e3+o)}function Yi(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var Ki={};var Xi={X:function(e,t,n,i){var r=Zi(i.timeZone,e);if(0===r)return"Z";switch(t){case"X":return tr(r);case"XXXX":case"XX":return er(r);default:return er(r,":")}},x:function(e,t,n,i){var r=Zi(i.timeZone,e);switch(t){case"x":return tr(r);case"xxxx":case"xx":return er(r);default:return er(r,":")}},O:function(e,t,n,i){var r=Zi(i.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t){var n=e>0?"-":"+",i=Math.abs(e),r=Math.floor(i/60),o=i%60;if(0===o)return n+String(r);var a=t||"";return n+String(r)+a+Ji(o,2)}(r,":");default:return"GMT"+er(r,":")}},z:function(e,t,n,i){switch(t){case"z":case"zz":case"zzz":return Fi("short",e,i);default:return Fi("long",e,i)}}};function Zi(e,t){var n=e?Wi(e,t,!0)/6e4:t.getTimezoneOffset();if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function Ji(e,t){for(var n=e<0?"-":"",i=Math.abs(e).toString();i.length<t;)i="0"+i;return n+i}function er(e,t){var n=t||"",i=e>0?"-":"+",r=Math.abs(e);return i+Ji(Math.floor(r/60),2)+n+Ji(Math.floor(r%60),2)}function tr(e,t){return e%60==0?(e>0?"-":"+")+Ji(Math.abs(e)/60,2):er(e,t)}const nr=Xi;var ir=n(9784),rr=n(9720);var or=36e5,ar=6e4,sr={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function lr(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);var n=t||{},i=null==n.additionalDigits?2:ir(n.additionalDigits);if(2!==i&&1!==i&&0!==i)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var r=function(e){var t,n={},i=sr.dateTimePattern.exec(e);i?(n.date=i[1],t=i[3]):(i=sr.datePattern.exec(e))?(n.date=i[1],t=i[2]):(n.date=null,t=e);if(t){var r=sr.timeZone.exec(t);r?(n.time=t.replace(r[1],""),n.timeZone=r[1].trim()):n.time=t}return n}(e),o=function(e,t){var n,i=sr.YYY[t],r=sr.YYYYY[t];if(n=sr.YYYY.exec(e)||r.exec(e)){var o=n[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(n=sr.YY.exec(e)||i.exec(e)){var a=n[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}(r.date,i),a=o.year,s=function(e,t){if(null===t)return null;var n,i,r,o;if(0===e.length)return(i=new Date(0)).setUTCFullYear(t),i;if(n=sr.MM.exec(e))return i=new Date(0),pr(t,r=parseInt(n[1],10)-1)?(i.setUTCFullYear(t,r),i):new Date(NaN);if(n=sr.DDD.exec(e)){i=new Date(0);var a=parseInt(n[1],10);return function(e,t){if(t<1)return!1;var n=hr(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,a)?(i.setUTCFullYear(t,0,a),i):new Date(NaN)}if(n=sr.MMDD.exec(e)){i=new Date(0),r=parseInt(n[1],10)-1;var s=parseInt(n[2],10);return pr(t,r,s)?(i.setUTCFullYear(t,r,s),i):new Date(NaN)}if(n=sr.Www.exec(e))return fr(t,o=parseInt(n[1],10)-1)?ur(t,o):new Date(NaN);if(n=sr.WwwD.exec(e)){o=parseInt(n[1],10)-1;var l=parseInt(n[2],10)-1;return fr(t,o,l)?ur(t,o,l):new Date(NaN)}return null}(o.restDateString,a);if(isNaN(s))return new Date(NaN);if(s){var l,u=s.getTime(),c=0;if(r.time&&(c=function(e){var t,n,i;if(t=sr.HH.exec(e))return gr(n=parseFloat(t[1].replace(",",".")))?n%24*or:NaN;if(t=sr.HHMM.exec(e))return gr(n=parseInt(t[1],10),i=parseFloat(t[2].replace(",",".")))?n%24*or+i*ar:NaN;if(t=sr.HHMMSS.exec(e)){n=parseInt(t[1],10),i=parseInt(t[2],10);var r=parseFloat(t[3].replace(",","."));return gr(n,i,r)?n%24*or+i*ar+1e3*r:NaN}return null}(r.time),isNaN(c)))return new Date(NaN);if(r.timeZone||n.timeZone){if(l=Wi(r.timeZone||n.timeZone,new Date(u+c)),isNaN(l))return new Date(NaN)}else l=rr(new Date(u+c)),l=rr(new Date(u+c+l));return new Date(u+c+l)}return new Date(NaN)}function ur(e,t,n){t=t||0,n=n||0;var i=new Date(0);i.setUTCFullYear(e,0,4);var r=7*t+n+1-(i.getUTCDay()||7);return i.setUTCDate(i.getUTCDate()+r),i}var cr=[31,28,31,30,31,30,31,31,30,31,30,31],dr=[31,29,31,30,31,30,31,31,30,31,30,31];function hr(e){return e%400==0||e%4==0&&e%100!=0}function pr(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;var i=hr(e);if(i&&n>dr[t])return!1;if(!i&&n>cr[t])return!1}return!0}function fr(e,t,n){return!(t<0||t>52)&&(null==n||!(n<0||n>6))}function gr(e,t,n){return(null==e||!(e<0||e>=25))&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}var mr=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function yr(e,t,n,i){var r=Bi(i);return r.timeZone=t,r.originalDate=e,function(e,t,n){var i=String(t),r=n||{},o=i.match(mr);if(o){var a=lr(r.originalDate||e,r);i=o.reduce(function(e,t){if("'"===t[0])return e;var n=e.indexOf(t),i="'"===e[n-1],o=e.replace(t,"'"+nr[t[0]](a,t,null,r)+"'");return i?o.substring(0,n-1)+o.substring(n+1):o},i)}return ji(e,i,r)}(function(e,t,n){var i=lr(e,n),r=Wi(t,i,!0),o=new Date(i.getTime()-r),a=new Date(0);return a.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),a.setHours(o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.getUTCMilliseconds()),a}(e,t),n,r)}var br=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let vr=class extends oe{constructor(){super(...arguments),this.tourTypeOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.selfGuidedToursTypeOffered="",this.selfGuidedTourEnabled=!1,this.escortedToursLink="",this.escortedToursTypeOffered="",this.virtualToursLink="",this.virtualToursTypeOffered="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[wr.Guided]:!0,[wr.Self]:!0,[wr.Virtual]:!0},this.email="",this.phoneNumber="",this.availabilitiesGroupedByDay={},this.calendarTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone,this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.shouldAllowScheduling=!1,this.shouldAllowScheduleLoading=!0,this.promptForReschedule=!1,this.canceledReschedule=!1,this.leadSources=[],this.orgLegalName="",this.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.primaryColor=Ue,this.backgroundColor=Re,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this._setAvailabilities=async()=>{try{const[e,t]=await Promise.all([Ii(this.buildingId,this.hasDynamicSchedulingEnabled),Kn()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,this.calendarTimeZone=await(async e=>{var t;return null!==(t=(await Vn(e)).calendarTimeZone)&&void 0!==t?t:Intl.DateTimeFormat().resolvedOptions().timeZone})(this.buildingId),Ai({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:xi.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const n=Object.values(t).every(e=>!1===e),i=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(n&&i)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void Ai({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.shouldShowTourType={[wr.Guided]:this.tourTypeOptions.map(e=>e.value).includes("WITH_AGENT")&&(t[wr.Guided]||!!this.escortedToursLink),[wr.Self]:this.tourTypeOptions.map(e=>e.value).includes("SELF_GUIDED")&&(t[wr.Self]||!!this.sgtUrl),[wr.Virtual]:this.tourTypeOptions.map(e=>e.value).includes("VIRTUAL_SHOWING")&&(t[wr.Virtual]||!!this.virtualToursLink)};const r=1===Object.values(this.shouldShowTourType).reduce((e,t)=>!0===t?e+1:e,0);if(this._setDefaultSelectedDateAndTimes(),r&&(this.tourType=Object.keys(this.shouldShowTourType).find(e=>this.shouldShowTourType[e])),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Xn(Cr[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,Ai({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this._setDefaultSelectedDateAndTimes=async(e,t)=>{var n,i,r;const o=await Vn(this.buildingId),a=null!=e?e:this._getHighestRankedTourType(o),s=a?null===(r=null===(i=null===(n=o.availability)||void 0===n?void 0:n[a])||void 0===i?void 0:i.availableTourStartTimes)||void 0===r?void 0:r.filter(e=>{if(!t)return!0;return qt("string"==typeof e?Rn(e):e,t)}):[],l=null==s?void 0:s[0];a&&l&&a!==In.Unknown&&a!==In.MediaTour&&(this.selectedDate=Qt("string"==typeof l?Rn(l):l),this.tourType=xr[a],this.selectedTime="string"==typeof l?Zn(l):(e=>({datetime:Ft(e,"yyyy-MM-dd'T'HH:mm:ss"),offset:Ft(e,"xxx")}))(l))},this._getHighestRankedTourType=e=>{var t;const n=(null!==(t=e.rankOrderedSupportedTourTypes)&&void 0!==t?t:[]).map(t=>{var n,i;return{tourType:t,availabilities:null===(i=null===(n=e.availability)||void 0===n?void 0:n[t])||void 0===i?void 0:i.availableTourStartTimes}}).filter(e=>{if(e.tourType===In.Unknown||e.tourType===In.MediaTour)return!1;const t=xr[e.tourType],n=this._getTourTypeOffered(t);return!!n&&(!Li(0,n)&&e.availabilities&&e.availabilities.length>0)}),i=n[0];return i?i.tourType:null},this._getTourTypeOffered=e=>e===wr.Guided?this.escortedToursTypeOffered:e===wr.Self?this.selfGuidedToursTypeOffered:e===wr.Virtual?this.virtualToursTypeOffered:null,this.firstUpdated=async()=>{await this._setAvailabilities()},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Xn(Cr[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const n=e.target.selectionStart;if(1!==e.key.length||Ne(e)){if("Backspace"===e.key){if(Ne(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,i=this.phoneNumber.slice(0,n).replace(/\D/g,""),r=this.phoneNumber.slice(n).replace(/\D/g,""),o=`${i.slice(0,-1)}${r}`;this.phoneNumber=Pe(o),this.phoneInput.value=this.phoneNumber;const a=n-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Ne(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,n).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,i=n-e>-1?n-e:0;this.phoneInput.setSelectionRange(i,i)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(n).split(/\d+/)[0].length||0)+1,t=n+e<this.phoneNumber.length?n+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,n)+e.key+this.phoneNumber.slice(n);this.phoneNumber=Pe(t.replace(/\D/g,"")),this.phoneInput.value=this.phoneNumber}},this.handlePhoneKeyup=e=>{var t;if(!e.key)return;if(e.key.includes("Arrow")||["Meta","Shift","Control","Alt"].includes(e.key))return;const n=this.phoneInput.selectionStart,i=n?this.phoneInput.value.slice(n).replace(/\D/g,""):"";this.phoneNumber=Pe(this.phoneInput.value);let r=0,o=i.length;for(;o;)(null===(t=this.phoneNumber.at(r))||void 0===t?void 0:t.match(/\d/))&&o--,r++;const a=this.phoneInput.value.length-r+1;this.phoneInput.setSelectionRange(a,a)},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.validators={tourType:()=>null!==this.tourType,dateAndTime:()=>!!this.selectedDate&&!!this.selectedTime,leadInfo:()=>{var e,t,n,i;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&An(null!==(i=null===(n=this.emailInput)||void 0===n?void 0:n.value)&&void 0!==i?i:"")&&!!this.phoneNumber&&14===this.phoneNumber.length&&xn(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,n]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(n)]},this.submit=async()=>{var e,t,n,i,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const x=new URLSearchParams(window.location.search);let A=null;A=this.selectedLeadSource&&this.selectedLeadSource.value&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:this.leadSourceInputValue&&this.leadSourceInputValue.length>0?this.leadSourceInputValue:this.currentLeadSource;const S=[...new Set(A?[A,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=A,ai("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(e=this.phoneNumber.match(/\d/g))||void 0===e?void 0:e.join("")}`,firstName:null!==(n=null===(t=this.firstNameInput)||void 0===t?void 0:t.value)&&void 0!==n?n:this.firstNameInputValue,lastName:null!==(o=null===(i=this.lastNameInput)||void 0===i?void 0:i.value)&&void 0!==o?o:this.lastNameInputValue,tourType:Ar[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:S.find(e=>"property-website"!==e)||null});const E={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(a=this.phoneNumber.match(/\d/g))||void 0===a?void 0:a.join("")}`,building_id:this.buildingId,first_name:null!==(l=null===(s=this.firstNameInput)||void 0===s?void 0:s.value)&&void 0!==l?l:this.firstNameInputValue,last_name:null!==(c=null===(u=this.lastNameInput)||void 0===u?void 0:u.value)&&void 0!==c?c:this.lastNameInputValue,tour_type:Ar[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(A?[A,Oi(this.orgSlug)]:[Oi(this.orgSlug)])],query_params:Object.fromEntries(x.entries()),conversation_tracking_id:null===(d=this.leadSourceClient)||void 0===d?void 0:d.chatId,lead_sources_with_timestamps:(null!==(f=null===(h=this.leadSourceMultitouchClient)||void 0===h?void 0:h.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:(null===(p=this.selectedLeadSource)||void 0===p?void 0:p.value)&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:null}))&&void 0!==f?f:[]).map(e=>gn({...e}))};this.isSubmitting=!0;try{await r().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",E,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"webchatkey-wkjcWAKZjqhLStvP8L6SN8y4FbYmPhdE","org-slug":this.orgSlug}}),null===(g=this.leadSourceClient)||void 0===g||g.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),null===(m=this.leadSourceClient)||void 0===m||m.resetLeadSource(),null===(y=this.leadSourceMultitouchClient)||void 0===y||y.resetLeadSourceTouchpoints(),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,n=(null===(v=null===(b=t.response)||void 0===b?void 0:b.data)||void 0===v?void 0:v.detail)||"Failed to book tour";if(t.response&&t.response.headers&&t.response.headers["funnel-prospect-conflicting-appointment-error"]){if(this.selectedDate&&this.selectedTime){const e=this.availabilitiesGroupedByDay[Ft(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[Ft(this.selectedDate,"yyyy-MM-dd")]=e.filter(e=>e!==this.selectedTime))}}else{if(409===(null===(w=t.response)||void 0===w?void 0:w.status)&&!this.promptForReschedule&&"User already has a tour scheduled for this building"===n)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);if(409===(null===(C=t.response)||void 0===C?void 0:C.status)&&!this.promptForReschedule)return this.isSubmitting=!1,this.tourIsBooked=!1,Wn(),this.availabilitiesGroupedByDay=await Xn(Cr[this.tourType],this.buildingId),void alert("This timeslot is no longer available. Please select a different time.")}alert(n),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>B`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>B`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>B` <action-confirm-button
1216
1216
  id="schedule-bttn"
1217
1217
  .onClick=${this.submit}
1218
1218
  .isLoading=${this.isSubmitting}
@@ -1252,7 +1252,7 @@ xmlns="http://www.w3.org/2000/svg"
1252
1252
  .backgroundColor=${this.backgroundColor}
1253
1253
  .foregroundColorOnPrimaryBackgroundColor=${this.foregroundColorOnPrimaryBackgroundColor}
1254
1254
  .foregroundColorOnSecondaryBackgroundColor=${this.foregroundColorOnSecondaryBackgroundColor}
1255
- @click="${async()=>{this.tourType=wr.Guided,ai("tourTypeSelected",{tourType:wr.Guided,buildingId:this.buildingId}),this.escortedToursLink&&window.open(this.escortedToursLink,"_blank"),this.availabilitiesGroupedByDay=await Xn(Cr[wr.Guided]),this._setDefaultSelectedDateAndTimes(Cr[wr.Guided])}}"
1255
+ @click="${async()=>{this.tourType=wr.Guided,ai("tourTypeSelected",{tourType:wr.Guided,buildingId:this.buildingId}),this.escortedToursLink&&Li(wr.Guided,this.escortedToursTypeOffered)&&window.open(this.escortedToursLink,"_blank"),this.availabilitiesGroupedByDay=await Xn(Cr[wr.Guided]),this._setDefaultSelectedDateAndTimes(Cr[wr.Guided])}}"
1256
1256
  @keydown="${e=>{[" ","Enter"].includes(e.key)&&(e.preventDefault(),this.tourType=wr.Guided)}}"
1257
1257
  ?selected="${this.tourType===wr.Guided}"
1258
1258
  >
@@ -1307,7 +1307,7 @@ xmlns="http://www.w3.org/2000/svg"
1307
1307
  <date-picker
1308
1308
  .availabilities=${ei()(this.availabilitiesGroupedByDay,e=>e.map(e=>new Date(e.offset)))}
1309
1309
  .defaultDate=${this.selectedDate}
1310
- @change=${async e=>{if(this.tourType===wr.Self&&this.sgtUrl&&Li(this.tourType,this.selfGuidedToursTypeOffered))window.open(this.sgtUrl,"_blank");else if(this.tourType===wr.Guided&&this.escortedToursLink)window.open(this.escortedToursLink,"_blank");else if(this.tourType===wr.Virtual&&this.virtualToursLink&&Li(this.tourType,this.virtualToursTypeOffered))window.open(this.virtualToursLink,"_blank");else if(e.target instanceof Vt){const t=this.selectedDate;if(this.selectedDate=e.target.selectedDate,!this.tourType)return;if(t&&e.target.selectedDate&&qt(t,e.target.selectedDate))return;e.target.selectedDate&&ai("tourDateSelected",{selectedDate:Ft(e.target.selectedDate,"yyyy-MM-dd"),tourType:this.tourType,buildingId:this.buildingId}),this._setDefaultSelectedDateAndTimes(Cr[this.tourType],e.target.selectedDate)}}}
1310
+ @change=${async e=>{if(this.tourType===wr.Self&&this.sgtUrl&&Li(this.tourType,this.selfGuidedToursTypeOffered))window.open(this.sgtUrl,"_blank");else if(this.tourType===wr.Guided&&this.escortedToursLink&&Li(this.tourType,this.escortedToursTypeOffered))window.open(this.escortedToursLink,"_blank");else if(this.tourType===wr.Virtual&&this.virtualToursLink&&Li(this.tourType,this.virtualToursTypeOffered))window.open(this.virtualToursLink,"_blank");else if(e.target instanceof Vt){const t=this.selectedDate;if(this.selectedDate=e.target.selectedDate,!this.tourType)return;if(t&&e.target.selectedDate&&qt(t,e.target.selectedDate))return;e.target.selectedDate&&ai("tourDateSelected",{selectedDate:Ft(e.target.selectedDate,"yyyy-MM-dd"),tourType:this.tourType,buildingId:this.buildingId}),this._setDefaultSelectedDateAndTimes(Cr[this.tourType],e.target.selectedDate)}}}
1311
1311
  ></date-picker>
1312
1312
  <div>
1313
1313
  <time-picker
@@ -5634,7 +5634,7 @@ xmlns="http://www.w3.org/2000/svg"
5634
5634
  ${kr}
5635
5635
  ${Tr}
5636
5636
  ${_r}
5637
- `,Aa([ue({attribute:!0})],Sa.prototype,"isMinimized",void 0),Aa([ue()],Sa.prototype,"mobileStyles",void 0),Aa([ue({type:Boolean})],Sa.prototype,"isFirstMount",void 0),Aa([ue({attribute:!1})],Sa.prototype,"autoOpenChatWidget",void 0),Aa([ue()],Sa.prototype,"phoneNumber",void 0),Aa([ue({attribute:!0})],Sa.prototype,"buildingName",void 0),Aa([ue({attribute:!0})],Sa.prototype,"chatId",void 0),Aa([ue({attribute:!0})],Sa.prototype,"orgLegalName",void 0),Aa([ue({attribute:!0})],Sa.prototype,"chatCallUsHeader",void 0),Aa([ue({attribute:!1})],Sa.prototype,"buildingId",void 0),Aa([ue({attribute:!0})],Sa.prototype,"buildingSlug",void 0),Aa([ue({attribute:!0})],Sa.prototype,"orgSlug",void 0),Aa([ue({attribute:!0})],Sa.prototype,"sgtUrl",void 0),Aa([ue({attribute:!0})],Sa.prototype,"selfGuidedTourEnabled",void 0),Aa([ue({attribute:!0})],Sa.prototype,"selfGuidedToursTypeOffered",void 0),Aa([ue({attribute:!0})],Sa.prototype,"designConcept",void 0),Aa([ue({attribute:!0})],Sa.prototype,"featureFlagShowDropdown",void 0),Aa([ue({attribute:!1})],Sa.prototype,"leadSources",void 0),Aa([ue({attribute:!0})],Sa.prototype,"currentLeadSource",void 0),Aa([ue({attribute:!0})],Sa.prototype,"escortedToursLink",void 0),Aa([ue({attribute:!0})],Sa.prototype,"escortedToursTypeOffered",void 0),Aa([ue({attribute:!0})],Sa.prototype,"virtualToursLink",void 0),Aa([ue({attribute:!0})],Sa.prototype,"virtualToursTypeOffered",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasChatEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasChatEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasEmailEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasEmailEnabledMobile",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasApplyNowEnabledDesktop",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasApplyNowEnabledMobile",void 0),Aa([ue({attribute:!0})],Sa.prototype,"applicationLink",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasCallUsEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasCallUsEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasTextUsEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasTextUsEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasSSTEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasSSTEnabledMobile",void 0),Aa([ue({attribute:!1})],Sa.prototype,"tourTypeOptions",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasDynamicSchedulingEnabled",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasPricingCalculatorEnabledDesktop",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasPricingCalculatorEnabledMobile",void 0),Aa([ue({attribute:!1})],Sa.prototype,"hasHideMobileFeatures",void 0),Aa([ue({type:Number})],Sa.prototype,"right",void 0),Aa([ue({type:Number})],Sa.prototype,"bottom",void 0),Aa([ue({type:Number})],Sa.prototype,"top",void 0),Aa([ue({type:Number})],Sa.prototype,"left",void 0),Aa([ue({attribute:!0})],Sa.prototype,"showTourNextToChat",void 0),Aa([ue({attribute:!1})],Sa.prototype,"onChatTapped",void 0),Aa([ue({attribute:!0})],Sa.prototype,"onClickMinimize",void 0),Aa([ue({attribute:!0})],Sa.prototype,"onSstClose",void 0),Aa([ue({attribute:!0})],Sa.prototype,"overrideRentgrata",void 0),Aa([ue({attribute:!1})],Sa.prototype,"launcherStyles",void 0),Aa([ue({attribute:!0})],Sa.prototype,"primaryColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"backgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"leadSourceClient",void 0),Aa([ce()],Sa.prototype,"leadSourceMultitouchClient",void 0),Aa([ce()],Sa.prototype,"_isMobile",void 0),Aa([ce()],Sa.prototype,"isEmailWindowOpen",void 0),Aa([ce()],Sa.prototype,"isCallUsWindowOpen",void 0),Aa([ce()],Sa.prototype,"isSSTWindowOpen",void 0),Aa([ce()],Sa.prototype,"isTextUsWindowOpen",void 0),Aa([ce()],Sa.prototype,"isCalculatorWindowOpen",void 0),Aa([ce()],Sa.prototype,"isMobileFeaturesExpanded",void 0),Sa=Aa([se("meetelise-launcher")],Sa);const Ea=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Sa)},ka=["app.meetelise.com","staging.eliseai.com","localhost"],Ta={calculator:{desktop:"calcDesktop",mobile:"calcMobile"},email:{desktop:"emailDesktop",mobile:"emailMobile"},call:{desktop:"callDesktop",mobile:"callMobile"},text:{desktop:"textDesktop",mobile:"textMobile"},sst:{desktop:"sstDesktop",mobile:"sstMobile"}},_a=e=>{const t=window.location.hostname;if(!ka.includes(t))return e;const n=(e=>{if(!e)return{};try{return e.split(",").reduce((e,t)=>{const[n,i]=t.split(":");return n&&i&&n in Ta&&(e[n]="true"===i.toLowerCase()),e},{})}catch(e){return{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(n).length)return e;const i={...e};return Object.entries(n).forEach(([e,t])=>{const n=Ta[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var Oa=n(5072),Pa=n.n(Oa),Ia=n(7825),Ma=n.n(Ia),Na=n(7659),Da=n.n(Na),La=n(5056),Ua=n.n(La),Ra=n(540),Ba=n.n(Ra),ja=n(1113),Fa=n.n(ja),Ha=n(5541),$a={};$a.styleTagTransform=Fa(),$a.setAttributes=Ua(),$a.insert=Da().bind(null,"head"),$a.domAPI=Ma(),$a.insertStyleElement=Ba();Pa()(Ha.A,$a);Ha.A&&Ha.A.locals&&Ha.A.locals;async function za(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${t}/lead-sources`);if(n.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return n.data.filter(t=>e.includes(t))}return Ga(n.data,t)}return[]}catch(e){return[]}}const Ga=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter(e=>{const t=e.toLowerCase();return!n.map(e=>e.toLowerCase()).includes(t)})};var Qa,qa=n(8805),Wa=n.n(qa),Va=new Uint8Array(16);function Ya(){if(!Qa&&!(Qa="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qa(Va)}const Ka=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Xa=function(e){return"string"==typeof e&&Ka.test(e)};for(var Za=[],Ja=0;Ja<256;++Ja)Za.push((Ja+256).toString(16).substr(1));const es=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Za[e[t+0]]+Za[e[t+1]]+Za[e[t+2]]+Za[e[t+3]]+"-"+Za[e[t+4]]+Za[e[t+5]]+"-"+Za[e[t+6]]+Za[e[t+7]]+"-"+Za[e[t+8]]+Za[e[t+9]]+"-"+Za[e[t+10]]+Za[e[t+11]]+Za[e[t+12]]+Za[e[t+13]]+Za[e[t+14]]+Za[e[t+15]]).toLowerCase();if(!Xa(n))throw TypeError("Stringified UUID is invalid");return n};const ts=function(e,t,n){var i=(e=e||{}).random||(e.rng||Ya)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return es(i)},ns=e=>localStorage.removeItem("com.elise.webchat.slug="+e),is=(e,t,n)=>{const i=On(new Date),r=n||`lead_${ts()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Rn(i),buildingSlug:e,initiatedChat:t}},rs=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(os(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},os=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(dn(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!wn(t.timestamp,24)};var as;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(as||(as={}));const ss=e=>e.type===us.text,ls=e=>e.type===us.media;var us;!function(e){e.text="text",e.media="media"}(us||(us={}));const cs=class{constructor(e,t,n,i=null,r,o,a=null,s=au.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=au.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.sessionToken=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;const i={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,i],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==as.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:r}),!r&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=r,"ai_message"===e.message.customType){this.simpleChatMessages.some(e=>e.type===us.text&&e.message.includes("confirmed for your"))&&ai("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.streamingMessageTimeout=null,this.checkAndHandleDelayStreamingMessages=({delayToFetchHistoryInMs:e=1e4}={})=>{this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null);const t=this.simpleChatMessages.some(e=>{if(!ss(e))return!1;const t=e.chunks.find(e=>e.isDone);return!t||e.chunks.length===t.order});t&&(this.streamingMessageTimeout=setTimeout(()=>{Ai({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory()},e))},this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return!1}})(e.message.text))return;ai("leadProvidedEmail",{buildingId:null===(t=this.buildingWebchatView)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===as.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=is(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken(async()=>{var t,n,i,r,o,a,s,l,u;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout(()=>{this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})},9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),this.widgetType===au.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),orgSlug:this.orgSlug}}):(await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),lead_sources_with_timestamps:(null!==(o=null===(r=this.leadSourceMultitouchClient)||void 0===r?void 0:r.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:null}))&&void 0!==o?o:[]).map(e=>gn({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(ai("firstChatMessageSent",{message:e,buildingId:null===(l=this.buildingWebchatView)||void 0===l?void 0:l.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),ai("chatMessageSent",{message:e,buildingId:null===(u=this.buildingWebchatView)||void 0===u?void 0:u.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))}),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.removeDuplicatedRawPubnubMessages=e=>{const t=new Set;return e.filter(e=>{if("lead_message"===e.message.customType||!e.message.stream_id||!e.message.order)return!0;const n=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(n)?(Ai({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(n),!0)})},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return this.removeDuplicatedRawPubnubMessages(e).forEach(e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:us.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:us.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]}),Object.keys(n).forEach(e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),o=r.map(e=>e.message.text).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map(e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}}),type:us.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)}),t.sort((e,t)=>e.timestamp-t.timestamp),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find(e=>e.message.is_done);return!t||e.length===t.message.order},this.buildingSlug=e,this.buildingWebchatView=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=a,this.leadSourceMultitouchClient=o,this.widgetType=s}async initSession(e,t){try{const n=await r().post(`${this.apiHost}/platformApi/webchat/init`,{building_slug:e,org_slug:t});return this.sessionToken=n.data.session_token,this.leadUserId=n.data.lead_id,this.channel=n.data.channel,n.data}catch(e){return this.buildingWebchatView&&Ai({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),null}}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(Wa())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken(()=>new Promise(()=>this.handleChatListeners())),await this.withAuthToken(()=>this.getChannelHistory()),this.pubnub):void 0}async fetchToken(e,t){try{if(this.sessionToken){const e="healthcare"===this.widgetType?"?industry=health_care":"";return(await r().get(`${this.apiHost}/platformApi/webchat/pn/v2/request-token${e}`,{headers:{"X-Session-Token":this.sessionToken}})).data}return(await r().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${t}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await r().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(e){try{await e()}catch(t){if(t instanceof i.AxiosError&&t&&t.response&&403===t.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const t=await this.fetchToken(this.leadUserId,this.channel);if(!t)return;this.pubnub.setAuthKey(t.auth.result.token),await e()}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},(e,t)=>{e.error?o(e):n(t)})}),a=o.channels[this.channel];if(!a)break;if(a.sort((e,t)=>+e.timetoken-+t.timetoken),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach(e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})}),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter(e=>e.message.messageType!==as.noReply))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},ds=(e,t,n)=>{const i=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1"),r=`tel:${i}`,o=`sms:${i}`,a=`whatsapp://send?phone=${i}`,s=`facetime:${i}`,l=`facetime-audio:${i}`,u=/(?:\+1\s)?(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}/g,c=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,d=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let f=!1;const g=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let m=!1,y=!1,b=0;for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE){if(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=p[e].textContent;if(!t)continue;const n=t.replace(u,e=>e.startsWith("+1 ")?`+1 ${g}`:g);t!==n&&(b++,p[e].textContent=n),f=!0,m||(m=!0)}if(p[e].hasAttribute("href")){const t=p[e].getAttribute("href");if(!t)continue;let n="",i=c;t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=d):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r;const u=t.replace(i,n);if(p[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&p[e].setAttribute("href",t.startsWith("tel:")?r:o)}y||(y=!0)}}return m&&Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:g,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t}),y&&Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:g,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t}),f||Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:xi.warn,buildingSlug:n,orgSlug:t}),b};var hs=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let ps=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Ue,this.toExpand=!1}render(){return B`
5637
+ `,Aa([ue({attribute:!0})],Sa.prototype,"isMinimized",void 0),Aa([ue()],Sa.prototype,"mobileStyles",void 0),Aa([ue({type:Boolean})],Sa.prototype,"isFirstMount",void 0),Aa([ue({attribute:!1})],Sa.prototype,"autoOpenChatWidget",void 0),Aa([ue()],Sa.prototype,"phoneNumber",void 0),Aa([ue({attribute:!0})],Sa.prototype,"buildingName",void 0),Aa([ue({attribute:!0})],Sa.prototype,"chatId",void 0),Aa([ue({attribute:!0})],Sa.prototype,"orgLegalName",void 0),Aa([ue({attribute:!0})],Sa.prototype,"chatCallUsHeader",void 0),Aa([ue({attribute:!1})],Sa.prototype,"buildingId",void 0),Aa([ue({attribute:!0})],Sa.prototype,"buildingSlug",void 0),Aa([ue({attribute:!0})],Sa.prototype,"orgSlug",void 0),Aa([ue({attribute:!0})],Sa.prototype,"sgtUrl",void 0),Aa([ue({attribute:!0})],Sa.prototype,"selfGuidedTourEnabled",void 0),Aa([ue({attribute:!0})],Sa.prototype,"selfGuidedToursTypeOffered",void 0),Aa([ue({attribute:!0})],Sa.prototype,"designConcept",void 0),Aa([ue({attribute:!0})],Sa.prototype,"featureFlagShowDropdown",void 0),Aa([ue({attribute:!1})],Sa.prototype,"leadSources",void 0),Aa([ue({attribute:!0})],Sa.prototype,"currentLeadSource",void 0),Aa([ue({attribute:!0})],Sa.prototype,"escortedToursLink",void 0),Aa([ue({attribute:!0})],Sa.prototype,"escortedToursTypeOffered",void 0),Aa([ue({attribute:!0})],Sa.prototype,"virtualToursLink",void 0),Aa([ue({attribute:!0})],Sa.prototype,"virtualToursTypeOffered",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasChatEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasChatEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasEmailEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasEmailEnabledMobile",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasApplyNowEnabledDesktop",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasApplyNowEnabledMobile",void 0),Aa([ue({attribute:!0})],Sa.prototype,"applicationLink",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasCallUsEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasCallUsEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasTextUsEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasTextUsEnabledMobile",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasSSTEnabledDesktop",void 0),Aa([ue({type:Boolean})],Sa.prototype,"hasSSTEnabledMobile",void 0),Aa([ue({attribute:!1})],Sa.prototype,"tourTypeOptions",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasDynamicSchedulingEnabled",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasPricingCalculatorEnabledDesktop",void 0),Aa([ue({attribute:!0})],Sa.prototype,"hasPricingCalculatorEnabledMobile",void 0),Aa([ue({attribute:!1})],Sa.prototype,"hasHideMobileFeatures",void 0),Aa([ue({type:Number})],Sa.prototype,"right",void 0),Aa([ue({type:Number})],Sa.prototype,"bottom",void 0),Aa([ue({type:Number})],Sa.prototype,"top",void 0),Aa([ue({type:Number})],Sa.prototype,"left",void 0),Aa([ue({attribute:!0})],Sa.prototype,"showTourNextToChat",void 0),Aa([ue({attribute:!1})],Sa.prototype,"onChatTapped",void 0),Aa([ue({attribute:!0})],Sa.prototype,"onClickMinimize",void 0),Aa([ue({attribute:!0})],Sa.prototype,"onSstClose",void 0),Aa([ue({attribute:!0})],Sa.prototype,"overrideRentgrata",void 0),Aa([ue({attribute:!1})],Sa.prototype,"launcherStyles",void 0),Aa([ue({attribute:!0})],Sa.prototype,"primaryColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"backgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Aa([ue({attribute:!0})],Sa.prototype,"leadSourceClient",void 0),Aa([ce()],Sa.prototype,"leadSourceMultitouchClient",void 0),Aa([ce()],Sa.prototype,"_isMobile",void 0),Aa([ce()],Sa.prototype,"isEmailWindowOpen",void 0),Aa([ce()],Sa.prototype,"isCallUsWindowOpen",void 0),Aa([ce()],Sa.prototype,"isSSTWindowOpen",void 0),Aa([ce()],Sa.prototype,"isTextUsWindowOpen",void 0),Aa([ce()],Sa.prototype,"isCalculatorWindowOpen",void 0),Aa([ce()],Sa.prototype,"isMobileFeaturesExpanded",void 0),Sa=Aa([se("meetelise-launcher")],Sa);const Ea=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Sa)},ka=["app.meetelise.com","staging.eliseai.com","localhost"],Ta={calculator:{desktop:"calcDesktop",mobile:"calcMobile"},email:{desktop:"emailDesktop",mobile:"emailMobile"},call:{desktop:"callDesktop",mobile:"callMobile"},text:{desktop:"textDesktop",mobile:"textMobile"},sst:{desktop:"sstDesktop",mobile:"sstMobile"}},_a=e=>{const t=window.location.hostname;if(!ka.includes(t))return e;const n=(e=>{if(!e)return{};try{return e.split(",").reduce((e,t)=>{const[n,i]=t.split(":");return n&&i&&n in Ta&&(e[n]="true"===i.toLowerCase()),e},{})}catch(e){return{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(n).length)return e;const i={...e};return Object.entries(n).forEach(([e,t])=>{const n=Ta[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var Oa=n(5072),Pa=n.n(Oa),Ia=n(7825),Ma=n.n(Ia),Na=n(7659),Da=n.n(Na),La=n(5056),Ua=n.n(La),Ra=n(540),Ba=n.n(Ra),ja=n(1113),Fa=n.n(ja),Ha=n(5541),$a={};$a.styleTagTransform=Fa(),$a.setAttributes=Ua(),$a.insert=Da().bind(null,"head"),$a.domAPI=Ma(),$a.insertStyleElement=Ba();Pa()(Ha.A,$a);Ha.A&&Ha.A.locals&&Ha.A.locals;async function za(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${t}/lead-sources`);if(n.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return n.data.filter(t=>e.includes(t))}return Ga(n.data,t)}return[]}catch(e){return[]}}const Ga=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter(e=>{const t=e.toLowerCase();return!n.map(e=>e.toLowerCase()).includes(t)})};var Qa,qa=n(8805),Wa=n.n(qa),Va=new Uint8Array(16);function Ya(){if(!Qa&&!(Qa="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qa(Va)}const Ka=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Xa=function(e){return"string"==typeof e&&Ka.test(e)};for(var Za=[],Ja=0;Ja<256;++Ja)Za.push((Ja+256).toString(16).substr(1));const es=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Za[e[t+0]]+Za[e[t+1]]+Za[e[t+2]]+Za[e[t+3]]+"-"+Za[e[t+4]]+Za[e[t+5]]+"-"+Za[e[t+6]]+Za[e[t+7]]+"-"+Za[e[t+8]]+Za[e[t+9]]+"-"+Za[e[t+10]]+Za[e[t+11]]+Za[e[t+12]]+Za[e[t+13]]+Za[e[t+14]]+Za[e[t+15]]).toLowerCase();if(!Xa(n))throw TypeError("Stringified UUID is invalid");return n};const ts=function(e,t,n){var i=(e=e||{}).random||(e.rng||Ya)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return es(i)},ns=e=>localStorage.removeItem("com.elise.webchat.slug="+e),is=(e,t,n)=>{const i=On(new Date),r=n||`lead_${ts()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Rn(i),buildingSlug:e,initiatedChat:t}},rs=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(os(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},os=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(dn(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!wn(t.timestamp,24)};var as;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(as||(as={}));const ss=e=>e.type===us.text,ls=e=>e.type===us.media;var us;!function(e){e.text="text",e.media="media"}(us||(us={}));const cs=class{constructor(e,t,n,i=null,r,o,a=null,s=lu.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=lu.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.sessionToken=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;const i={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,i],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==as.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:r}),!r&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=r,"ai_message"===e.message.customType){this.simpleChatMessages.some(e=>e.type===us.text&&e.message.includes("confirmed for your"))&&ai("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.streamingMessageTimeout=null,this.checkAndHandleDelayStreamingMessages=({delayToFetchHistoryInMs:e=1e4}={})=>{this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null);const t=this.simpleChatMessages.some(e=>{if(!ss(e))return!1;const t=e.chunks.find(e=>e.isDone);return!t||e.chunks.length===t.order});t&&(this.streamingMessageTimeout=setTimeout(()=>{Ai({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory()},e))},this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return!1}})(e.message.text))return;ai("leadProvidedEmail",{buildingId:null===(t=this.buildingWebchatView)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===as.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=is(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken(async()=>{var t,n,i,r,o,a,s,l,u;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout(()=>{this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})},9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),this.widgetType===lu.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),orgSlug:this.orgSlug}}):(await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),lead_sources_with_timestamps:(null!==(o=null===(r=this.leadSourceMultitouchClient)||void 0===r?void 0:r.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:null}))&&void 0!==o?o:[]).map(e=>gn({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(ai("firstChatMessageSent",{message:e,buildingId:null===(l=this.buildingWebchatView)||void 0===l?void 0:l.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),ai("chatMessageSent",{message:e,buildingId:null===(u=this.buildingWebchatView)||void 0===u?void 0:u.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))}),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.removeDuplicatedRawPubnubMessages=e=>{const t=new Set;return e.filter(e=>{if("lead_message"===e.message.customType||!e.message.stream_id||!e.message.order)return!0;const n=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(n)?(Ai({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(n),!0)})},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return this.removeDuplicatedRawPubnubMessages(e).forEach(e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:us.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:us.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]}),Object.keys(n).forEach(e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),o=r.map(e=>e.message.text).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map(e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}}),type:us.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)}),t.sort((e,t)=>e.timestamp-t.timestamp),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find(e=>e.message.is_done);return!t||e.length===t.message.order},this.buildingSlug=e,this.buildingWebchatView=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=a,this.leadSourceMultitouchClient=o,this.widgetType=s}async initSession(e,t){try{const n=await r().post(`${this.apiHost}/platformApi/webchat/init`,{building_slug:e,org_slug:t});return this.sessionToken=n.data.session_token,this.leadUserId=n.data.lead_id,this.channel=n.data.channel,n.data}catch(e){return this.buildingWebchatView&&Ai({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),null}}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(Wa())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken(()=>new Promise(()=>this.handleChatListeners())),await this.withAuthToken(()=>this.getChannelHistory()),this.pubnub):void 0}async fetchToken(e,t){try{if(this.sessionToken){const e="healthcare"===this.widgetType?"?industry=health_care":"";return(await r().get(`${this.apiHost}/platformApi/webchat/pn/v2/request-token${e}`,{headers:{"X-Session-Token":this.sessionToken}})).data}return(await r().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${t}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await r().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(e){try{await e()}catch(t){if(t instanceof i.AxiosError&&t&&t.response&&403===t.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const t=await this.fetchToken(this.leadUserId,this.channel);if(!t)return;this.pubnub.setAuthKey(t.auth.result.token),await e()}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},(e,t)=>{e.error?o(e):n(t)})}),a=o.channels[this.channel];if(!a)break;if(a.sort((e,t)=>+e.timetoken-+t.timetoken),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach(e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})}),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter(e=>e.message.messageType!==as.noReply))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.buildingWebchatView&&Ai({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},ds=new Set(["8009855990","8338526262","8002221222","8006624357","8002738255","8007997233","8007874889","8006564673","8004224453","8883737888","8006213362","8009506264","8558272736","8008435678","8007862929","8008523836","8007849433","8007729100","8006699777","8006858470","8004322209","8003473735","8008778339","8009552232","8002255342","8009272891","8003049320","8007937724","8002382333","8003353863","8776858878","8003329227","8776554371","8772944357","8772944356","6092925760","6092926735","8007928339","8008329173","8882853036","6092921210","8007929773","8003561561","8003826717","8005727233","8009291040","8888958179","8006879512","8004262537","8773475463","8774149251","8005103102","8889372835","8007010710","8007010720","8774288844","8007929745","8003283838","6092927060","6092928319","8008527899","8662401347","8009923678","8776522873","8776527624","8003313937","8008435437","8776536783","8778392339","8003676274","8006896411"]),hs=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return ds.has(t)},ps=(e,t,n)=>{try{const i=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1"),r=`tel:${i}`,o=`sms:${i}`,a=`whatsapp://send?phone=${i}`,s=`facetime:${i}`,l=`facetime-audio:${i}`,u=/(?:\+1[\s.-]?)?(?:\(\d{3}\)[\s.-]?|\d{3}[\s.-])\d{3}[\s.-]?\d{4}/g,c=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,d=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=/emergency|emergencia/i,f=300,g=e=>!(!e||e.length>f)&&p.test(e),m=e=>{var t,n,i,r;if(g(e.textContent))return!0;if(g(null===(t=e.previousElementSibling)||void 0===t?void 0:t.textContent)||g(null===(n=e.nextElementSibling)||void 0===n?void 0:n.textContent))return!0;const o=e.parentElement;return!(!o||!g(null===(i=o.previousElementSibling)||void 0===i?void 0:i.textContent)&&!g(null===(r=o.nextElementSibling)||void 0===r?void 0:r.textContent))},y=document.body.getElementsByTagName("*");let b=!1;const v=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let w=!1,C=!1,x=0;for(let e=0;e<y.length;e++)if(y[e].nodeType===Node.ELEMENT_NODE&&!m(y[e])){if(1===y[e].childNodes.length&&y[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=y[e].textContent;if(!t)continue;const n=t.replace(u,e=>{if(hs(e))return e;return e.startsWith("+1 ")?`+1 ${v}`:v});t!==n&&(x++,y[e].textContent=n),b=!0,w||(w=!0)}if(y[e].hasAttribute("href")){const t=y[e].getAttribute("href");if(!t)continue;let n="",i=c;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=d):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,hs(t))continue;const u=t.replace(i,n);if(y[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&y[e].setAttribute("href",t.startsWith("tel:")?r:o)}C||(C=!0)}}return w&&Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t}),C&&Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t}),b||Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:xi.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Ai({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:xi.error,buildingSlug:n,orgSlug:t}),0}};var fs=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let gs=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Ue,this.toExpand=!1}render(){return B`
5638
5638
  <button
5639
5639
  class=${this.toExpand?"button-container mini":"button-container"}
5640
5640
  @click=${this.onClick}
@@ -5647,7 +5647,7 @@ xmlns="http://www.w3.org/2000/svg"
5647
5647
  ${this.toExpand?B`<div class="chevron-up">${fa("white")}</div>`:B` <div class="x-icon">${io("white")}</div>`}
5648
5648
  </div>
5649
5649
  </button>
5650
- `}};ps.styles=[u`
5650
+ `}};gs.styles=[u`
5651
5651
  .button-container {
5652
5652
  width: 56px;
5653
5653
  height: 56px;
@@ -5697,7 +5697,7 @@ xmlns="http://www.w3.org/2000/svg"
5697
5697
  cursor: pointer;
5698
5698
  filter: brightness(90%);
5699
5699
  }
5700
- `],hs([ue({attribute:!0})],ps.prototype,"onClick",void 0),hs([ue({attribute:!0})],ps.prototype,"primaryColor",void 0),hs([ue({attribute:!0})],ps.prototype,"toExpand",void 0),ps=hs([se("minimize-expand-button")],ps);const fs=u`
5700
+ `],fs([ue({attribute:!0})],gs.prototype,"onClick",void 0),fs([ue({attribute:!0})],gs.prototype,"primaryColor",void 0),fs([ue({attribute:!0})],gs.prototype,"toExpand",void 0),gs=fs([se("minimize-expand-button")],gs);const ms=u`
5701
5701
  #healthchat-container {
5702
5702
  position: fixed;
5703
5703
 
@@ -5815,7 +5815,7 @@ xmlns="http://www.w3.org/2000/svg"
5815
5815
  .health-bttn-allow-access {
5816
5816
  padding-right: 28px;
5817
5817
  }
5818
- `,gs=u`
5818
+ `,ys=u`
5819
5819
  #pubnub-chat-container {
5820
5820
  position: fixed;
5821
5821
 
@@ -5935,7 +5935,7 @@ xmlns="http://www.w3.org/2000/svg"
5935
5935
  border: none;
5936
5936
  cursor: pointer;
5937
5937
  }
5938
- `,ms=u`
5938
+ `,bs=u`
5939
5939
  #header-text {
5940
5940
  font-size: 12px;
5941
5941
  font-weight: 700;
@@ -6136,7 +6136,7 @@ xmlns="http://www.w3.org/2000/svg"
6136
6136
  .checkbox:hover {
6137
6137
  opacity: 0.5;
6138
6138
  }
6139
- `,{entries:ys,setPrototypeOf:bs,isFrozen:vs,getPrototypeOf:ws,getOwnPropertyDescriptor:Cs}=Object;let{freeze:xs,seal:As,create:Ss}=Object,{apply:Es,construct:ks}="undefined"!=typeof Reflect&&Reflect;xs||(xs=function(e){return e}),As||(As=function(e){return e}),Es||(Es=function(e,t,n){return e.apply(t,n)}),ks||(ks=function(e,t){return new e(...t)});const Ts=$s(Array.prototype.forEach),_s=$s(Array.prototype.lastIndexOf),Os=$s(Array.prototype.pop),Ps=$s(Array.prototype.push),Is=$s(Array.prototype.splice),Ms=$s(String.prototype.toLowerCase),Ns=$s(String.prototype.toString),Ds=$s(String.prototype.match),Ls=$s(String.prototype.replace),Us=$s(String.prototype.indexOf),Rs=$s(String.prototype.trim),Bs=$s(Object.prototype.hasOwnProperty),js=$s(RegExp.prototype.test),Fs=(Hs=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ks(Hs,t)});var Hs;function $s(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return Es(e,t,i)}}function zs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ms;bs&&bs(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(vs(t)||(t[i]=e),r=e)}e[r]=!0}return e}function Gs(e){for(let t=0;t<e.length;t++){Bs(e,t)||(e[t]=null)}return e}function Qs(e){const t=Ss(null);for(const[n,i]of ys(e)){Bs(e,n)&&(Array.isArray(i)?t[n]=Gs(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=Qs(i):t[n]=i)}return t}function qs(e,t){for(;null!==e;){const n=Cs(e,t);if(n){if(n.get)return $s(n.get);if("function"==typeof n.value)return $s(n.value)}e=ws(e)}return function(){return null}}const Ws=xs(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Vs=xs(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ys=xs(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ks=xs(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Xs=xs(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Zs=xs(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Js=xs(["#text"]),el=xs(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),tl=xs(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),nl=xs(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),il=xs(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),rl=As(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ol=As(/<%[\w\W]*|[\w\W]*%>/gm),al=As(/\$\{[\w\W]*/gm),sl=As(/^data-[\-\w.\u00B7-\uFFFF]+$/),ll=As(/^aria-[\-\w]+$/),ul=As(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cl=As(/^(?:\w+script|data):/i),dl=As(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),hl=As(/^html$/i),pl=As(/^[a-z][.\w]*(-[.\w]+)+$/i);var fl=Object.freeze({__proto__:null,ARIA_ATTR:ll,ATTR_WHITESPACE:dl,CUSTOM_ELEMENT:pl,DATA_ATTR:sl,DOCTYPE_NAME:hl,ERB_EXPR:ol,IS_ALLOWED_URI:ul,IS_SCRIPT_OR_DATA:cl,MUSTACHE_EXPR:rl,TMPLIT_EXPR:al});const gl=1,ml=3,yl=7,bl=8,vl=9,wl=function(){return"undefined"==typeof window?null:window};var Cl=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:wl();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==vl||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const r=i,o=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:u,NodeFilter:c,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:p,trustedTypes:f}=t,g=u.prototype,m=qs(g,"cloneNode"),y=qs(g,"remove"),b=qs(g,"nextSibling"),v=qs(g,"childNodes"),w=qs(g,"parentNode");if("function"==typeof s){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let C,x="";const{implementation:A,createNodeIterator:S,createDocumentFragment:E,getElementsByTagName:k}=i,{importNode:T}=r;let _={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof ys&&"function"==typeof w&&A&&void 0!==A.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:P,TMPLIT_EXPR:I,DATA_ATTR:M,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:D,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:U}=fl;let{IS_ALLOWED_URI:R}=fl,B=null;const j=zs({},[...Ws,...Vs,...Ys,...Xs,...Js]);let F=null;const H=zs({},[...el,...tl,...nl,...il]);let $=Object.seal(Ss(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),z=null,G=null,Q=!0,q=!0,W=!1,V=!0,Y=!1,K=!0,X=!1,Z=!1,J=!1,ee=!1,te=!1,ne=!1,ie=!0,re=!1,oe=!0,ae=!1,se={},le=null;const ue=zs({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ce=null;const de=zs({},["audio","video","img","source","image","track"]);let he=null;const pe=zs({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let ye=me,be=!1,ve=null;const we=zs({},[fe,ge,me],Ns);let Ce=zs({},["mi","mo","mn","ms","mtext"]),xe=zs({},["annotation-xml"]);const Ae=zs({},["title","style","font","a","script"]);let Se=null;const Ee=["application/xhtml+xml","text/html"];let ke=null,Te=null;const _e=i.createElement("form"),Oe=function(e){return e instanceof RegExp||e instanceof Function},Pe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Te||Te!==e){if(e&&"object"==typeof e||(e={}),e=Qs(e),Se=-1===Ee.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ke="application/xhtml+xml"===Se?Ns:Ms,B=Bs(e,"ALLOWED_TAGS")?zs({},e.ALLOWED_TAGS,ke):j,F=Bs(e,"ALLOWED_ATTR")?zs({},e.ALLOWED_ATTR,ke):H,ve=Bs(e,"ALLOWED_NAMESPACES")?zs({},e.ALLOWED_NAMESPACES,Ns):we,he=Bs(e,"ADD_URI_SAFE_ATTR")?zs(Qs(pe),e.ADD_URI_SAFE_ATTR,ke):pe,ce=Bs(e,"ADD_DATA_URI_TAGS")?zs(Qs(de),e.ADD_DATA_URI_TAGS,ke):de,le=Bs(e,"FORBID_CONTENTS")?zs({},e.FORBID_CONTENTS,ke):ue,z=Bs(e,"FORBID_TAGS")?zs({},e.FORBID_TAGS,ke):Qs({}),G=Bs(e,"FORBID_ATTR")?zs({},e.FORBID_ATTR,ke):Qs({}),se=!!Bs(e,"USE_PROFILES")&&e.USE_PROFILES,Q=!1!==e.ALLOW_ARIA_ATTR,q=!1!==e.ALLOW_DATA_ATTR,W=e.ALLOW_UNKNOWN_PROTOCOLS||!1,V=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,K=!1!==e.SAFE_FOR_XML,X=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,J=e.FORCE_BODY||!1,ie=!1!==e.SANITIZE_DOM,re=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ae=e.IN_PLACE||!1,R=e.ALLOWED_URI_REGEXP||ul,ye=e.NAMESPACE||me,Ce=e.MATHML_TEXT_INTEGRATION_POINTS||Ce,xe=e.HTML_INTEGRATION_POINTS||xe,$=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Oe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&($.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Oe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&($.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&($.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(q=!1),te&&(ee=!0),se&&(B=zs({},Js),F=[],!0===se.html&&(zs(B,Ws),zs(F,el)),!0===se.svg&&(zs(B,Vs),zs(F,tl),zs(F,il)),!0===se.svgFilters&&(zs(B,Ys),zs(F,tl),zs(F,il)),!0===se.mathMl&&(zs(B,Xs),zs(F,nl),zs(F,il))),e.ADD_TAGS&&(B===j&&(B=Qs(B)),zs(B,e.ADD_TAGS,ke)),e.ADD_ATTR&&(F===H&&(F=Qs(F)),zs(F,e.ADD_ATTR,ke)),e.ADD_URI_SAFE_ATTR&&zs(he,e.ADD_URI_SAFE_ATTR,ke),e.FORBID_CONTENTS&&(le===ue&&(le=Qs(le)),zs(le,e.FORBID_CONTENTS,ke)),oe&&(B["#text"]=!0),X&&zs(B,["html","head","body"]),B.table&&(zs(B,["tbody"]),delete z.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Fs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Fs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=e.TRUSTED_TYPES_POLICY,x=C.createHTML("")}else void 0===C&&(C=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return null}}(f,o)),null!==C&&"string"==typeof x&&(x=C.createHTML(""));xs&&xs(e),Te=e}},Ie=zs({},[...Vs,...Ys,...Ks]),Me=zs({},[...Xs,...Zs]),Ne=function(e){Ps(n.removed,{element:e});try{w(e).removeChild(e)}catch(t){y(e)}},De=function(e,t){try{Ps(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Ps(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Ne(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Le=function(e){let t=null,n=null;if(J)e="<remove></remove>"+e;else{const t=Ds(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Se&&ye===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=C?C.createHTML(e):e;if(ye===me)try{t=(new p).parseFromString(r,Se)}catch(e){}if(!t||!t.documentElement){t=A.createDocument(ye,"template",null);try{t.documentElement.innerHTML=be?x:r}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(i.createTextNode(n),o.childNodes[0]||null),ye===me?k.call(t,X?"html":"body")[0]:X?t.documentElement:o},Ue=function(e){return S.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Re=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Be=function(e){return"function"==typeof l&&e instanceof l};function je(e,t,i){Ts(e,e=>{e.call(n,t,i,Te)})}const Fe=function(e){let t=null;if(je(_.beforeSanitizeElements,e,null),Re(e))return Ne(e),!0;const i=ke(e.nodeName);if(je(_.uponSanitizeElement,e,{tagName:i,allowedTags:B}),K&&e.hasChildNodes()&&!Be(e.firstElementChild)&&js(/<[/\w!]/g,e.innerHTML)&&js(/<[/\w!]/g,e.textContent))return Ne(e),!0;if(e.nodeType===yl)return Ne(e),!0;if(K&&e.nodeType===bl&&js(/<[/\w]/g,e.data))return Ne(e),!0;if(!B[i]||z[i]){if(!z[i]&&$e(i)){if($.tagNameCheck instanceof RegExp&&js($.tagNameCheck,i))return!1;if($.tagNameCheck instanceof Function&&$.tagNameCheck(i))return!1}if(oe&&!le[i]){const t=w(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const r=m(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,b(e))}}}return Ne(e),!0}return e instanceof u&&!function(e){let t=w(e);t&&t.tagName||(t={namespaceURI:ye,tagName:"template"});const n=Ms(e.tagName),i=Ms(t.tagName);return!!ve[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===me?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===i||Ce[i]):Boolean(Ie[n]):e.namespaceURI===fe?t.namespaceURI===me?"math"===n:t.namespaceURI===ge?"math"===n&&xe[i]:Boolean(Me[n]):e.namespaceURI===me?!(t.namespaceURI===ge&&!xe[i])&&!(t.namespaceURI===fe&&!Ce[i])&&!Me[n]&&(Ae[n]||!Ie[n]):!("application/xhtml+xml"!==Se||!ve[e.namespaceURI]))}(e)?(Ne(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!js(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===ml&&(t=e.textContent,Ts([O,P,I],e=>{t=Ls(t,e," ")}),e.textContent!==t&&(Ps(n.removed,{element:e.cloneNode()}),e.textContent=t)),je(_.afterSanitizeElements,e,null),!1):(Ne(e),!0)},He=function(e,t,n){if(ie&&("id"===t||"name"===t)&&(n in i||n in _e))return!1;if(q&&!G[t]&&js(M,t));else if(Q&&js(N,t));else if(!F[t]||G[t]){if(!($e(e)&&($.tagNameCheck instanceof RegExp&&js($.tagNameCheck,e)||$.tagNameCheck instanceof Function&&$.tagNameCheck(e))&&($.attributeNameCheck instanceof RegExp&&js($.attributeNameCheck,t)||$.attributeNameCheck instanceof Function&&$.attributeNameCheck(t))||"is"===t&&$.allowCustomizedBuiltInElements&&($.tagNameCheck instanceof RegExp&&js($.tagNameCheck,n)||$.tagNameCheck instanceof Function&&$.tagNameCheck(n))))return!1}else if(he[t]);else if(js(R,Ls(n,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Us(n,"data:")||!ce[e]){if(W&&!js(D,Ls(n,L,"")));else if(n)return!1}else;return!0},$e=function(e){return"annotation-xml"!==e&&Ds(e,U)},ze=function(e){je(_.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Re(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0};let r=t.length;for(;r--;){const o=t[r],{name:a,namespaceURI:s,value:l}=o,u=ke(a),c=l;let d="value"===a?c:Rs(c);if(i.attrName=u,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,je(_.uponSanitizeAttribute,e,i),d=i.attrValue,!re||"id"!==u&&"name"!==u||(De(a,e),d="user-content-"+d),K&&js(/((--!?|])>)|<\/(style|title)/i,d)){De(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){De(a,e);continue}if(!V&&js(/\/>/i,d)){De(a,e);continue}Y&&Ts([O,P,I],e=>{d=Ls(d,e," ")});const h=ke(e.nodeName);if(He(h,u,d)){if(C&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(s);else switch(f.getAttributeType(h,u)){case"TrustedHTML":d=C.createHTML(d);break;case"TrustedScriptURL":d=C.createScriptURL(d)}if(d!==c)try{s?e.setAttributeNS(s,a,d):e.setAttribute(a,d),Re(e)?Ne(e):Os(n.removed)}catch(t){De(a,e)}}else De(a,e)}je(_.afterSanitizeAttributes,e,null)},Ge=function e(t){let n=null;const i=Ue(t);for(je(_.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)je(_.uponSanitizeShadowNode,n,null),Fe(n),ze(n),n.content instanceof a&&e(n.content);je(_.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,o=null,s=null,u=null;if(be=!e,be&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw Fs("toString is not a function");if("string"!=typeof(e=e.toString()))throw Fs("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Z||Pe(t),n.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=ke(e.nodeName);if(!B[t]||z[t])throw Fs("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=Le("\x3c!----\x3e"),o=i.ownerDocument.importNode(e,!0),o.nodeType===gl&&"BODY"===o.nodeName||"HTML"===o.nodeName?i=o:i.appendChild(o);else{if(!ee&&!Y&&!X&&-1===e.indexOf("<"))return C&&ne?C.createHTML(e):e;if(i=Le(e),!i)return ee?null:ne?x:""}i&&J&&Ne(i.firstChild);const c=Ue(ae?e:i);for(;s=c.nextNode();)Fe(s),ze(s),s.content instanceof a&&Ge(s.content);if(ae)return e;if(ee){if(te)for(u=E.call(i.ownerDocument);i.firstChild;)u.appendChild(i.firstChild);else u=i;return(F.shadowroot||F.shadowrootmode)&&(u=T.call(r,u,!0)),u}let d=X?i.outerHTML:i.innerHTML;return X&&B["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&js(hl,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),Y&&Ts([O,P,I],e=>{d=Ls(d,e," ")}),C&&ne?C.createHTML(d):d},n.setConfig=function(){Pe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},n.clearConfig=function(){Te=null,Z=!1},n.isValidAttribute=function(e,t,n){Te||Pe({});const i=ke(e),r=ke(t);return He(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&Ps(_[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=_s(_[e],t);return-1===n?void 0:Is(_[e],n,1)[0]}return Os(_[e])},n.removeHooks=function(e){_[e]=[]},n.removeAllHooks=function(){_={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),xl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Al=class extends oe{constructor(){super(...arguments),this.spinSpeed=.4}updated(){this.style.setProperty("--spin-duration",`${this.spinSpeed}s`)}render(){return B`<div class="spinner"></div>`}};Al.styles=u`
6139
+ `,{entries:vs,setPrototypeOf:ws,isFrozen:Cs,getPrototypeOf:xs,getOwnPropertyDescriptor:As}=Object;let{freeze:Ss,seal:Es,create:ks}=Object,{apply:Ts,construct:_s}="undefined"!=typeof Reflect&&Reflect;Ss||(Ss=function(e){return e}),Es||(Es=function(e){return e}),Ts||(Ts=function(e,t,n){return e.apply(t,n)}),_s||(_s=function(e,t){return new e(...t)});const Os=Gs(Array.prototype.forEach),Ps=Gs(Array.prototype.lastIndexOf),Is=Gs(Array.prototype.pop),Ms=Gs(Array.prototype.push),Ns=Gs(Array.prototype.splice),Ds=Gs(String.prototype.toLowerCase),Ls=Gs(String.prototype.toString),Us=Gs(String.prototype.match),Rs=Gs(String.prototype.replace),Bs=Gs(String.prototype.indexOf),js=Gs(String.prototype.trim),Fs=Gs(Object.prototype.hasOwnProperty),Hs=Gs(RegExp.prototype.test),$s=(zs=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _s(zs,t)});var zs;function Gs(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return Ts(e,t,i)}}function Qs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ds;ws&&ws(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(Cs(t)||(t[i]=e),r=e)}e[r]=!0}return e}function qs(e){for(let t=0;t<e.length;t++){Fs(e,t)||(e[t]=null)}return e}function Ws(e){const t=ks(null);for(const[n,i]of vs(e)){Fs(e,n)&&(Array.isArray(i)?t[n]=qs(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=Ws(i):t[n]=i)}return t}function Vs(e,t){for(;null!==e;){const n=As(e,t);if(n){if(n.get)return Gs(n.get);if("function"==typeof n.value)return Gs(n.value)}e=xs(e)}return function(){return null}}const Ys=Ss(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ks=Ss(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Xs=Ss(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Zs=Ss(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Js=Ss(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),el=Ss(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),tl=Ss(["#text"]),nl=Ss(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),il=Ss(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),rl=Ss(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ol=Ss(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),al=Es(/\{\{[\w\W]*|[\w\W]*\}\}/gm),sl=Es(/<%[\w\W]*|[\w\W]*%>/gm),ll=Es(/\$\{[\w\W]*/gm),ul=Es(/^data-[\-\w.\u00B7-\uFFFF]+$/),cl=Es(/^aria-[\-\w]+$/),dl=Es(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),hl=Es(/^(?:\w+script|data):/i),pl=Es(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fl=Es(/^html$/i),gl=Es(/^[a-z][.\w]*(-[.\w]+)+$/i);var ml=Object.freeze({__proto__:null,ARIA_ATTR:cl,ATTR_WHITESPACE:pl,CUSTOM_ELEMENT:gl,DATA_ATTR:ul,DOCTYPE_NAME:fl,ERB_EXPR:sl,IS_ALLOWED_URI:dl,IS_SCRIPT_OR_DATA:hl,MUSTACHE_EXPR:al,TMPLIT_EXPR:ll});const yl=1,bl=3,vl=7,wl=8,Cl=9,xl=function(){return"undefined"==typeof window?null:window};var Al=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:xl();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==Cl||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const r=i,o=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:u,NodeFilter:c,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:p,trustedTypes:f}=t,g=u.prototype,m=Vs(g,"cloneNode"),y=Vs(g,"remove"),b=Vs(g,"nextSibling"),v=Vs(g,"childNodes"),w=Vs(g,"parentNode");if("function"==typeof s){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let C,x="";const{implementation:A,createNodeIterator:S,createDocumentFragment:E,getElementsByTagName:k}=i,{importNode:T}=r;let _={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof vs&&"function"==typeof w&&A&&void 0!==A.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:P,TMPLIT_EXPR:I,DATA_ATTR:M,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:D,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:U}=ml;let{IS_ALLOWED_URI:R}=ml,B=null;const j=Qs({},[...Ys,...Ks,...Xs,...Js,...tl]);let F=null;const H=Qs({},[...nl,...il,...rl,...ol]);let $=Object.seal(ks(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),z=null,G=null,Q=!0,q=!0,W=!1,V=!0,Y=!1,K=!0,X=!1,Z=!1,J=!1,ee=!1,te=!1,ne=!1,ie=!0,re=!1,oe=!0,ae=!1,se={},le=null;const ue=Qs({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ce=null;const de=Qs({},["audio","video","img","source","image","track"]);let he=null;const pe=Qs({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let ye=me,be=!1,ve=null;const we=Qs({},[fe,ge,me],Ls);let Ce=Qs({},["mi","mo","mn","ms","mtext"]),xe=Qs({},["annotation-xml"]);const Ae=Qs({},["title","style","font","a","script"]);let Se=null;const Ee=["application/xhtml+xml","text/html"];let ke=null,Te=null;const _e=i.createElement("form"),Oe=function(e){return e instanceof RegExp||e instanceof Function},Pe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Te||Te!==e){if(e&&"object"==typeof e||(e={}),e=Ws(e),Se=-1===Ee.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ke="application/xhtml+xml"===Se?Ls:Ds,B=Fs(e,"ALLOWED_TAGS")?Qs({},e.ALLOWED_TAGS,ke):j,F=Fs(e,"ALLOWED_ATTR")?Qs({},e.ALLOWED_ATTR,ke):H,ve=Fs(e,"ALLOWED_NAMESPACES")?Qs({},e.ALLOWED_NAMESPACES,Ls):we,he=Fs(e,"ADD_URI_SAFE_ATTR")?Qs(Ws(pe),e.ADD_URI_SAFE_ATTR,ke):pe,ce=Fs(e,"ADD_DATA_URI_TAGS")?Qs(Ws(de),e.ADD_DATA_URI_TAGS,ke):de,le=Fs(e,"FORBID_CONTENTS")?Qs({},e.FORBID_CONTENTS,ke):ue,z=Fs(e,"FORBID_TAGS")?Qs({},e.FORBID_TAGS,ke):Ws({}),G=Fs(e,"FORBID_ATTR")?Qs({},e.FORBID_ATTR,ke):Ws({}),se=!!Fs(e,"USE_PROFILES")&&e.USE_PROFILES,Q=!1!==e.ALLOW_ARIA_ATTR,q=!1!==e.ALLOW_DATA_ATTR,W=e.ALLOW_UNKNOWN_PROTOCOLS||!1,V=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,K=!1!==e.SAFE_FOR_XML,X=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,J=e.FORCE_BODY||!1,ie=!1!==e.SANITIZE_DOM,re=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ae=e.IN_PLACE||!1,R=e.ALLOWED_URI_REGEXP||dl,ye=e.NAMESPACE||me,Ce=e.MATHML_TEXT_INTEGRATION_POINTS||Ce,xe=e.HTML_INTEGRATION_POINTS||xe,$=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Oe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&($.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Oe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&($.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&($.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(q=!1),te&&(ee=!0),se&&(B=Qs({},tl),F=[],!0===se.html&&(Qs(B,Ys),Qs(F,nl)),!0===se.svg&&(Qs(B,Ks),Qs(F,il),Qs(F,ol)),!0===se.svgFilters&&(Qs(B,Xs),Qs(F,il),Qs(F,ol)),!0===se.mathMl&&(Qs(B,Js),Qs(F,rl),Qs(F,ol))),e.ADD_TAGS&&(B===j&&(B=Ws(B)),Qs(B,e.ADD_TAGS,ke)),e.ADD_ATTR&&(F===H&&(F=Ws(F)),Qs(F,e.ADD_ATTR,ke)),e.ADD_URI_SAFE_ATTR&&Qs(he,e.ADD_URI_SAFE_ATTR,ke),e.FORBID_CONTENTS&&(le===ue&&(le=Ws(le)),Qs(le,e.FORBID_CONTENTS,ke)),oe&&(B["#text"]=!0),X&&Qs(B,["html","head","body"]),B.table&&(Qs(B,["tbody"]),delete z.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw $s('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw $s('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=e.TRUSTED_TYPES_POLICY,x=C.createHTML("")}else void 0===C&&(C=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return null}}(f,o)),null!==C&&"string"==typeof x&&(x=C.createHTML(""));Ss&&Ss(e),Te=e}},Ie=Qs({},[...Ks,...Xs,...Zs]),Me=Qs({},[...Js,...el]),Ne=function(e){Ms(n.removed,{element:e});try{w(e).removeChild(e)}catch(t){y(e)}},De=function(e,t){try{Ms(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Ms(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Ne(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Le=function(e){let t=null,n=null;if(J)e="<remove></remove>"+e;else{const t=Us(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Se&&ye===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=C?C.createHTML(e):e;if(ye===me)try{t=(new p).parseFromString(r,Se)}catch(e){}if(!t||!t.documentElement){t=A.createDocument(ye,"template",null);try{t.documentElement.innerHTML=be?x:r}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(i.createTextNode(n),o.childNodes[0]||null),ye===me?k.call(t,X?"html":"body")[0]:X?t.documentElement:o},Ue=function(e){return S.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Re=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Be=function(e){return"function"==typeof l&&e instanceof l};function je(e,t,i){Os(e,e=>{e.call(n,t,i,Te)})}const Fe=function(e){let t=null;if(je(_.beforeSanitizeElements,e,null),Re(e))return Ne(e),!0;const i=ke(e.nodeName);if(je(_.uponSanitizeElement,e,{tagName:i,allowedTags:B}),K&&e.hasChildNodes()&&!Be(e.firstElementChild)&&Hs(/<[/\w!]/g,e.innerHTML)&&Hs(/<[/\w!]/g,e.textContent))return Ne(e),!0;if(e.nodeType===vl)return Ne(e),!0;if(K&&e.nodeType===wl&&Hs(/<[/\w]/g,e.data))return Ne(e),!0;if(!B[i]||z[i]){if(!z[i]&&$e(i)){if($.tagNameCheck instanceof RegExp&&Hs($.tagNameCheck,i))return!1;if($.tagNameCheck instanceof Function&&$.tagNameCheck(i))return!1}if(oe&&!le[i]){const t=w(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const r=m(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,b(e))}}}return Ne(e),!0}return e instanceof u&&!function(e){let t=w(e);t&&t.tagName||(t={namespaceURI:ye,tagName:"template"});const n=Ds(e.tagName),i=Ds(t.tagName);return!!ve[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===me?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===i||Ce[i]):Boolean(Ie[n]):e.namespaceURI===fe?t.namespaceURI===me?"math"===n:t.namespaceURI===ge?"math"===n&&xe[i]:Boolean(Me[n]):e.namespaceURI===me?!(t.namespaceURI===ge&&!xe[i])&&!(t.namespaceURI===fe&&!Ce[i])&&!Me[n]&&(Ae[n]||!Ie[n]):!("application/xhtml+xml"!==Se||!ve[e.namespaceURI]))}(e)?(Ne(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!Hs(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===bl&&(t=e.textContent,Os([O,P,I],e=>{t=Rs(t,e," ")}),e.textContent!==t&&(Ms(n.removed,{element:e.cloneNode()}),e.textContent=t)),je(_.afterSanitizeElements,e,null),!1):(Ne(e),!0)},He=function(e,t,n){if(ie&&("id"===t||"name"===t)&&(n in i||n in _e))return!1;if(q&&!G[t]&&Hs(M,t));else if(Q&&Hs(N,t));else if(!F[t]||G[t]){if(!($e(e)&&($.tagNameCheck instanceof RegExp&&Hs($.tagNameCheck,e)||$.tagNameCheck instanceof Function&&$.tagNameCheck(e))&&($.attributeNameCheck instanceof RegExp&&Hs($.attributeNameCheck,t)||$.attributeNameCheck instanceof Function&&$.attributeNameCheck(t))||"is"===t&&$.allowCustomizedBuiltInElements&&($.tagNameCheck instanceof RegExp&&Hs($.tagNameCheck,n)||$.tagNameCheck instanceof Function&&$.tagNameCheck(n))))return!1}else if(he[t]);else if(Hs(R,Rs(n,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Bs(n,"data:")||!ce[e]){if(W&&!Hs(D,Rs(n,L,"")));else if(n)return!1}else;return!0},$e=function(e){return"annotation-xml"!==e&&Us(e,U)},ze=function(e){je(_.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Re(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0};let r=t.length;for(;r--;){const o=t[r],{name:a,namespaceURI:s,value:l}=o,u=ke(a),c=l;let d="value"===a?c:js(c);if(i.attrName=u,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,je(_.uponSanitizeAttribute,e,i),d=i.attrValue,!re||"id"!==u&&"name"!==u||(De(a,e),d="user-content-"+d),K&&Hs(/((--!?|])>)|<\/(style|title)/i,d)){De(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){De(a,e);continue}if(!V&&Hs(/\/>/i,d)){De(a,e);continue}Y&&Os([O,P,I],e=>{d=Rs(d,e," ")});const h=ke(e.nodeName);if(He(h,u,d)){if(C&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(s);else switch(f.getAttributeType(h,u)){case"TrustedHTML":d=C.createHTML(d);break;case"TrustedScriptURL":d=C.createScriptURL(d)}if(d!==c)try{s?e.setAttributeNS(s,a,d):e.setAttribute(a,d),Re(e)?Ne(e):Is(n.removed)}catch(t){De(a,e)}}else De(a,e)}je(_.afterSanitizeAttributes,e,null)},Ge=function e(t){let n=null;const i=Ue(t);for(je(_.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)je(_.uponSanitizeShadowNode,n,null),Fe(n),ze(n),n.content instanceof a&&e(n.content);je(_.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,o=null,s=null,u=null;if(be=!e,be&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw $s("toString is not a function");if("string"!=typeof(e=e.toString()))throw $s("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Z||Pe(t),n.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=ke(e.nodeName);if(!B[t]||z[t])throw $s("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=Le("\x3c!----\x3e"),o=i.ownerDocument.importNode(e,!0),o.nodeType===yl&&"BODY"===o.nodeName||"HTML"===o.nodeName?i=o:i.appendChild(o);else{if(!ee&&!Y&&!X&&-1===e.indexOf("<"))return C&&ne?C.createHTML(e):e;if(i=Le(e),!i)return ee?null:ne?x:""}i&&J&&Ne(i.firstChild);const c=Ue(ae?e:i);for(;s=c.nextNode();)Fe(s),ze(s),s.content instanceof a&&Ge(s.content);if(ae)return e;if(ee){if(te)for(u=E.call(i.ownerDocument);i.firstChild;)u.appendChild(i.firstChild);else u=i;return(F.shadowroot||F.shadowrootmode)&&(u=T.call(r,u,!0)),u}let d=X?i.outerHTML:i.innerHTML;return X&&B["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Hs(fl,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),Y&&Os([O,P,I],e=>{d=Rs(d,e," ")}),C&&ne?C.createHTML(d):d},n.setConfig=function(){Pe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},n.clearConfig=function(){Te=null,Z=!1},n.isValidAttribute=function(e,t,n){Te||Pe({});const i=ke(e),r=ke(t);return He(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&Ms(_[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=Ps(_[e],t);return-1===n?void 0:Ns(_[e],n,1)[0]}return Is(_[e])},n.removeHooks=function(e){_[e]=[]},n.removeAllHooks=function(){_={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Sl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let El=class extends oe{constructor(){super(...arguments),this.spinSpeed=.4}updated(){this.style.setProperty("--spin-duration",`${this.spinSpeed}s`)}render(){return B`<div class="spinner"></div>`}};El.styles=u`
6140
6140
  .spinner {
6141
6141
  border: 2px solid rgba(0, 0, 0, 0.2);
6142
6142
  border-top: 2px solid #c057ff;
@@ -6154,7 +6154,7 @@ xmlns="http://www.w3.org/2000/svg"
6154
6154
  transform: rotate(360deg);
6155
6155
  }
6156
6156
  }
6157
- `,xl([ue({type:Number})],Al.prototype,"spinSpeed",void 0),Al=xl([se("mini-loader")],Al);var Sl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let El=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=au.Default}isMessageStillStreamingChunks(){if(!this.message)return!1;const e=this.message.chunks.find(e=>e.isDone);return!e||this.message.chunks.length===e.order}updated(e){if(this.onMount(),!e.has("message"))return;if(!this.message)return;const{hyperlinks:t,markedText:n}=this.mapAndMarkHyperLinks(this.message.message),i=/(https?:\/\/[^\s]+)/g,r=[],o=[];this.parsedMessage=B`${n.trim().split("\n").map(e=>{const n=this.sanitizeMarkdownText(e),a=this.preserveHTMLTags(n);return a?B`${a.map(e=>{if(t.find(t=>t.id===e)){const n=t.find(t=>t.id===e);if(!n)return;return o.push({redirectTo:null==n?void 0:n.link,source:null==n?void 0:n.link}),B`<a
6157
+ `,Sl([ue({type:Number})],El.prototype,"spinSpeed",void 0),El=Sl([se("mini-loader")],El);var kl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Tl=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=lu.Default}isMessageStillStreamingChunks(){if(!this.message)return!1;const e=this.message.chunks.find(e=>e.isDone);return!e||this.message.chunks.length===e.order}updated(e){if(this.onMount(),!e.has("message"))return;if(!this.message)return;const{hyperlinks:t,markedText:n}=this.mapAndMarkHyperLinks(this.message.message),i=/(https?:\/\/[^\s]+)/g,r=[],o=[];this.parsedMessage=B`${n.trim().split("\n").map(e=>{const n=this.sanitizeMarkdownText(e),a=this.preserveHTMLTags(n);return a?B`${a.map(e=>{if(t.find(t=>t.id===e)){const n=t.find(t=>t.id===e);if(!n)return;return o.push({redirectTo:null==n?void 0:n.link,source:null==n?void 0:n.link}),B`<a
6158
6158
  class="redirect-link"
6159
6159
  href="${null==n?void 0:n.link}"
6160
6160
  target="_blank"
@@ -6166,10 +6166,10 @@ xmlns="http://www.w3.org/2000/svg"
6166
6166
  target="_blank"
6167
6167
  rel="noopener noreferrer"
6168
6168
  >${t}
6169
- </a>`}return B`${li(Cl.sanitize(e))} `})}<br />`:B``})}`,this.imagesToDisplay=o,Promise.all(r).then(e=>{this.websitePreviewInfo=e})}preserveHTMLTags(e){var t;const n=e.match(/(<\/?[a-z][^>]*>[^<]*<\/?[a-z]*>|[^\s]+[.,?!]?|\S)/gi);return null!==(t=null==n?void 0:n.filter(e=>""!==e.trim()))&&void 0!==t?t:[]}sanitizeMarkdownText(e){return e.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim,"<b>$1</b>").replace(/\*(.*?)\*/gim,"<i>$1</i>").trim()}removeTrailingPunctuation(e){return[".",",","!","?",":",";"].includes(e[e.length-1])?this.removeTrailingPunctuation(e.slice(0,-1)):e}mapAndMarkHyperLinks(e){const t=Array.from(e.matchAll(/<https?:\/\/[^|]+\|[^>]+>|<a href="[^"]+"(?: target="[^"]*")?>[^<]+<\/a>|\[.*?\]\([^)]*\.[^)]*\)/g)),n=[],i=t.map(t=>{const n=t[0];if(void 0===t.index)return;const i=e[t.index-1],r=e[t.index+n.length];if(n.startsWith("<https")||n.startsWith("<http"))return{matchedLink:n,link:n.split("|")[0].replace("<",""),hyperlink:n.split("|")[1].replace(">",""),addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)};if(n.startsWith("<a href=")){const e=n.match(/href="([^"]+)"/),t=n.match(/>[^<]+</);return{matchedLink:n,link:e?e[1]:"",hyperlink:t?t[0].slice(1,-1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}{const[e,t]=n.split("](");return{matchedLink:n,link:t?t.slice(0,-1):"",hyperlink:e?e.slice(1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}});return i.forEach(t=>{if(t&&t.link&&t.hyperlink){const i=ts().replace(/-/g,"");n.push({link:this.removeTrailingPunctuation(t.link),hyperlink:this.removeTrailingPunctuation(t.hyperlink),mark:t.matchedLink,id:i}),e=e.replace(t.matchedLink,`${t.addSpaceBefore?" ":""}${i}${t.addSpaceAfter?" ":""}`)}}),{hyperlinks:n,markedText:e}}async getLinkData(e){var t,n,i,o;try{const a=(await r().get(e)).data,s=(new DOMParser).parseFromString(a,"text/html");return s?{title:null!==(n=null===(t=s.querySelector("title"))||void 0===t?void 0:t.textContent)&&void 0!==n?n:null,description:(null===(i=s.querySelector('meta[name="description"]'))||void 0===i?void 0:i.getAttribute("content"))||null,image:(null===(o=s.querySelector('meta[property="og:image"]'))||void 0===o?void 0:o.getAttribute("content"))||null,favicon:null,link:e}:{title:null,description:null,image:null,favicon:null,link:e}}catch(t){return{title:null,description:null,image:null,favicon:null,link:e}}}render(){return this.message?B`<div class="message-inner-body">
6169
+ </a>`}return B`${li(Al.sanitize(e))} `})}<br />`:B``})}`,this.imagesToDisplay=o,Promise.all(r).then(e=>{this.websitePreviewInfo=e})}preserveHTMLTags(e){var t;const n=e.match(/(<\/?[a-z][^>]*>[^<]*<\/?[a-z]*>|[^\s]+[.,?!]?|\S)/gi);return null!==(t=null==n?void 0:n.filter(e=>""!==e.trim()))&&void 0!==t?t:[]}sanitizeMarkdownText(e){return e.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim,"<b>$1</b>").replace(/\*(.*?)\*/gim,"<i>$1</i>").trim()}removeTrailingPunctuation(e){return[".",",","!","?",":",";"].includes(e[e.length-1])?this.removeTrailingPunctuation(e.slice(0,-1)):e}mapAndMarkHyperLinks(e){const t=Array.from(e.matchAll(/<https?:\/\/[^|]+\|[^>]+>|<a href="[^"]+"(?: target="[^"]*")?>[^<]+<\/a>|\[.*?\]\([^)]*\.[^)]*\)/g)),n=[],i=t.map(t=>{const n=t[0];if(void 0===t.index)return;const i=e[t.index-1],r=e[t.index+n.length];if(n.startsWith("<https")||n.startsWith("<http"))return{matchedLink:n,link:n.split("|")[0].replace("<",""),hyperlink:n.split("|")[1].replace(">",""),addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)};if(n.startsWith("<a href=")){const e=n.match(/href="([^"]+)"/),t=n.match(/>[^<]+</);return{matchedLink:n,link:e?e[1]:"",hyperlink:t?t[0].slice(1,-1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}{const[e,t]=n.split("](");return{matchedLink:n,link:t?t.slice(0,-1):"",hyperlink:e?e.slice(1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}});return i.forEach(t=>{if(t&&t.link&&t.hyperlink){const i=ts().replace(/-/g,"");n.push({link:this.removeTrailingPunctuation(t.link),hyperlink:this.removeTrailingPunctuation(t.hyperlink),mark:t.matchedLink,id:i}),e=e.replace(t.matchedLink,`${t.addSpaceBefore?" ":""}${i}${t.addSpaceAfter?" ":""}`)}}),{hyperlinks:n,markedText:e}}async getLinkData(e){var t,n,i,o;try{const a=(await r().get(e)).data,s=(new DOMParser).parseFromString(a,"text/html");return s?{title:null!==(n=null===(t=s.querySelector("title"))||void 0===t?void 0:t.textContent)&&void 0!==n?n:null,description:(null===(i=s.querySelector('meta[name="description"]'))||void 0===i?void 0:i.getAttribute("content"))||null,image:(null===(o=s.querySelector('meta[property="og:image"]'))||void 0===o?void 0:o.getAttribute("content"))||null,favicon:null,link:e}:{title:null,description:null,image:null,favicon:null,link:e}}catch(t){return{title:null,description:null,image:null,favicon:null,link:e}}}render(){return this.message?B`<div class="message-inner-body">
6170
6170
  ${this.isMessageStillStreamingChunks()?B`<div class="message-loader"><mini-loader></mini-loader></div>`:""}
6171
6171
  <p
6172
- class=${ye({"message-text":this.widgetType!==au.Utilities,"message-text-large":this.widgetType===au.Utilities,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}
6172
+ class=${ye({"message-text":this.widgetType!==lu.Utilities,"message-text-large":this.widgetType===lu.Utilities,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}
6173
6173
  >
6174
6174
  ${this.parsedMessage}
6175
6175
  </p>
@@ -6200,16 +6200,16 @@ xmlns="http://www.w3.org/2000/svg"
6200
6200
  />`:""}
6201
6201
 
6202
6202
  <div class="website-preview-body">
6203
- <p class=${ye({"message-text":this.widgetType!==au.Utilities,"message-text-large":this.widgetType===au.Utilities,"website-preview-title":!0,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}>${e.title}</p>
6203
+ <p class=${ye({"message-text":this.widgetType!==lu.Utilities,"message-text-large":this.widgetType===lu.Utilities,"website-preview-title":!0,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}>${e.title}</p>
6204
6204
  ${e.description?B`<p
6205
- class=${ye({"message-text":this.widgetType!==au.Utilities,"message-text-large":this.widgetType===au.Utilities,"website-preview-description":!0,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}
6205
+ class=${ye({"message-text":this.widgetType!==lu.Utilities,"message-text-large":this.widgetType===lu.Utilities,"website-preview-description":!0,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}
6206
6206
  >
6207
6207
  ${e.description}
6208
6208
  </p>`:""}
6209
6209
  </div>
6210
6210
  </div>
6211
6211
  </a></div> `})}
6212
- </div>`:B``}};El.styles=[kn,ms,u`
6212
+ </div>`:B``}};Tl.styles=[kn,bs,u`
6213
6213
  .message-inner-body {
6214
6214
  position: relative;
6215
6215
  }
@@ -6218,7 +6218,7 @@ xmlns="http://www.w3.org/2000/svg"
6218
6218
  bottom: -2px;
6219
6219
  right: -2px;
6220
6220
  }
6221
- `],Sl([ue({attribute:!0})],El.prototype,"buildingSlug",void 0),Sl([ue({attribute:!0})],El.prototype,"message",void 0),Sl([ue({attribute:!0})],El.prototype,"myPubnub",void 0),Sl([ue({attribute:!0})],El.prototype,"onMount",void 0),Sl([ce()],El.prototype,"loadingPreviews",void 0),Sl([ce()],El.prototype,"parsedMessage",void 0),Sl([ce()],El.prototype,"websitePreviewInfo",void 0),Sl([ce()],El.prototype,"imagesToDisplay",void 0),Sl([ce()],El.prototype,"imageUrlError",void 0),Sl([ue({type:Boolean})],El.prototype,"isLeadMessage",void 0),Sl([ue({attribute:!0})],El.prototype,"widgetType",void 0),El=Sl([se("pubnub-message")],El);var kl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Tl=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.showMediaAsCarousel=!0,this.activeIndex=0}updated(e){this.onMount(),e.has("message")}prevImage(){this.message&&(0===this.activeIndex?this.activeIndex=this.message.media.length-1:this.activeIndex-=1)}nextImage(){this.message&&(this.activeIndex===this.message.media.length-1?this.activeIndex=0:this.activeIndex+=1)}render(){return this.message?this.showMediaAsCarousel?B`<div class="message-inner-body">
6221
+ `],kl([ue({attribute:!0})],Tl.prototype,"buildingSlug",void 0),kl([ue({attribute:!0})],Tl.prototype,"message",void 0),kl([ue({attribute:!0})],Tl.prototype,"myPubnub",void 0),kl([ue({attribute:!0})],Tl.prototype,"onMount",void 0),kl([ce()],Tl.prototype,"loadingPreviews",void 0),kl([ce()],Tl.prototype,"parsedMessage",void 0),kl([ce()],Tl.prototype,"websitePreviewInfo",void 0),kl([ce()],Tl.prototype,"imagesToDisplay",void 0),kl([ce()],Tl.prototype,"imageUrlError",void 0),kl([ue({type:Boolean})],Tl.prototype,"isLeadMessage",void 0),kl([ue({attribute:!0})],Tl.prototype,"widgetType",void 0),Tl=kl([se("pubnub-message")],Tl);var _l=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Ol=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.showMediaAsCarousel=!0,this.activeIndex=0}updated(e){this.onMount(),e.has("message")}prevImage(){this.message&&(0===this.activeIndex?this.activeIndex=this.message.media.length-1:this.activeIndex-=1)}nextImage(){this.message&&(this.activeIndex===this.message.media.length-1?this.activeIndex=0:this.activeIndex+=1)}render(){return this.message?this.showMediaAsCarousel?B`<div class="message-inner-body">
6222
6222
  <div class="carousel">
6223
6223
  <div
6224
6224
  class="image-container"
@@ -6259,7 +6259,7 @@ xmlns="http://www.w3.org/2000/svg"
6259
6259
  rel="noopener noreferrer"
6260
6260
  ><img class=${"displayed-message-image"} src=${e.url} alt=""
6261
6261
  /></a>`)}
6262
- </div>`:B``}};Tl.styles=[kn,ms,u`
6262
+ </div>`:B``}};Ol.styles=[kn,bs,u`
6263
6263
  .carousel {
6264
6264
  position: relative;
6265
6265
  max-width: 400px;
@@ -6351,7 +6351,7 @@ xmlns="http://www.w3.org/2000/svg"
6351
6351
  max-height: 200px;
6352
6352
  overflow-y: auto;
6353
6353
  }
6354
- `],kl([ue({attribute:!0})],Tl.prototype,"message",void 0),kl([ue({attribute:!0})],Tl.prototype,"myPubnub",void 0),kl([ue({attribute:!0})],Tl.prototype,"onMount",void 0),kl([ce()],Tl.prototype,"showMediaAsCarousel",void 0),kl([ce()],Tl.prototype,"activeIndex",void 0),Tl=kl([se("pubnub-media")],Tl);function _l(e,t){var n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function Ol(e,t){Ge(2,arguments);var n=Qe(e),i=Qe(t),r=_l(n,i),o=Math.abs(function(e,t){Ge(2,arguments);var n=Qt(e),i=Qt(t),r=n.getTime()-It(n),o=i.getTime()-It(i);return Math.round((r-o)/864e5)}(n,i));n.setDate(n.getDate()-r*o);var a=r*(o-Number(_l(n,i)===-r));return 0===a?0:a}const Pl=u`
6354
+ `],_l([ue({attribute:!0})],Ol.prototype,"message",void 0),_l([ue({attribute:!0})],Ol.prototype,"myPubnub",void 0),_l([ue({attribute:!0})],Ol.prototype,"onMount",void 0),_l([ce()],Ol.prototype,"showMediaAsCarousel",void 0),_l([ce()],Ol.prototype,"activeIndex",void 0),Ol=_l([se("pubnub-media")],Ol);function Pl(e,t){var n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function Il(e,t){Ge(2,arguments);var n=Qe(e),i=Qe(t),r=Pl(n,i),o=Math.abs(function(e,t){Ge(2,arguments);var n=Qt(e),i=Qt(t),r=n.getTime()-It(n),o=i.getTime()-It(i);return Math.round((r-o)/864e5)}(n,i));n.setDate(n.getDate()-r*o);var a=r*(o-Number(Pl(n,i)===-r));return 0===a?0:a}const Ml=u`
6355
6355
  #utilities-container {
6356
6356
  position: fixed;
6357
6357
 
@@ -6460,17 +6460,17 @@ xmlns="http://www.w3.org/2000/svg"
6460
6460
  .health-bttn-allow-access {
6461
6461
  padding-right: 28px;
6462
6462
  }
6463
- `,Il=(e="black")=>j`
6463
+ `,Nl=(e="black")=>j`
6464
6464
  <svg width="32" height="32" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
6465
6465
  <path fill-rule="evenodd" clip-rule="evenodd" d="M15 0C17.7614 0 20 2.23858 20 5V15C20 17.7614 17.7614 20 15 20H5C2.23858 20 0 17.7614 0 15V5C0 2.23858 2.23858 0 5 0H15ZM18 5C18 3.34315 16.6569 2 15 2H5C3.34315 2 2 3.34315 2 5V15C2 16.6569 3.34315 18 5 18H15C16.6569 18 18 16.6569 18 15V5Z" fill="${e}"/>
6466
6466
  <path d="M12.1893 9.25L10.4697 7.53033C10.1768 7.23744 10.1768 6.76256 10.4697 6.46967C10.7626 6.17678 11.2374 6.17678 11.5303 6.46967L13.8232 8.76256C14.5066 9.44598 14.5066 10.554 13.8232 11.2374L11.5303 13.5303C11.2374 13.8232 10.7626 13.8232 10.4697 13.5303C10.1768 13.2374 10.1768 12.7626 10.4697 12.4697L12.1893 10.75L6 10.75C5.58579 10.75 5.25 10.4142 5.25 10C5.25 9.58579 5.58579 9.25 6 9.25L12.1893 9.25Z" fill="${e}"/>
6467
6467
  </svg>
6468
- `,Ml=(e="black")=>j`
6468
+ `,Dl=(e="black")=>j`
6469
6469
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
6470
6470
  <path fill-rule="evenodd" clip-rule="evenodd" d="M15 0C17.7614 0 20 2.23858 20 5V15C20 17.7614 17.7614 20 15 20H5C2.23858 20 0 17.7614 0 15V5C0 2.23858 2.23858 0 5 0H15ZM18 5C18 3.34315 16.6569 2 15 2H5C3.34315 2 2 3.34315 2 5V15C2 16.6569 3.34315 18 5 18H15C16.6569 18 18 16.6569 18 15V5Z" fill="${e}"/>
6471
6471
  <path d="M12.1893 9.25L10.4697 7.53033C10.1768 7.23744 10.1768 6.76256 10.4697 6.46967C10.7626 6.17678 11.2374 6.17678 11.5303 6.46967L13.8232 8.76256C14.5066 9.44598 14.5066 10.554 13.8232 11.2374L11.5303 13.5303C11.2374 13.8232 10.7626 13.8232 10.4697 13.5303C10.1768 13.2374 10.1768 12.7626 10.4697 12.4697L12.1893 10.75L6 10.75C5.58579 10.75 5.25 10.4142 5.25 10C5.25 9.58579 5.58579 9.25 6 9.25L12.1893 9.25Z" fill="${e}"/>
6472
6472
  </svg>
6473
- `;var Nl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Dl=class extends oe{constructor(){super(...arguments),this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.onMount=()=>({}),this.isHealthChat=!1,this.widgetType=au.Default,this.primaryColor=Ue,this.backgroundColor=Re,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this._isMobile=bn(),this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;0!==e.length&&(this.messageInput.value="",this.autoResizeMessageInput(),0===this.messages.length&&(this.messages=[{timestamp:0,message:e,isLeadMessage:!0,chunks:[{text:e,order:0,isDone:!0}],type:us.text}]),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e)))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>this.requiresConsent&&!this.hasReceivedConsent}get consentKey(){return`${this.orgSlug}Consent`}connectedCallback(){super.connectedCallback(),this._cleanupMobileListener=vn(e=>{this._isMobile=e})}disconnectedCallback(){var e;null===(e=this._cleanupMobileListener)||void 0===e||e.call(this),super.disconnectedCallback()}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.simpleChatMessages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener(e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading}),this.onMount();const n=localStorage.getItem(this.consentKey);if(!n)return void(this.hasReceivedConsent=!1);const i=JSON.parse(n),{timestamp:r,consentId:o}=i;Ol(new Date,new Date(r))<7&&o===fi?this.hasReceivedConsent=!0:(this.hasReceivedConsent=!1,localStorage.removeItem(this.consentKey))}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){}}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f;if(!this.buildingSlug)return B``;const g=null===(e=this.building)||void 0===e?void 0:e.id;let m={};if(m=this._isMobile?{top:void 0,bottom:0,left:void 0,right:0}:{top:void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:void 0===this.bottom||isNaN(this.bottom)?"130px":`${this.bottom}px`,left:void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:void 0===this.right||isNaN(this.right)?"18px":`${this.right}px`},22320===g&&(m={...m,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===au.Utilities)return B`
6473
+ `;var Ll=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Ul=class extends oe{constructor(){super(...arguments),this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.onMount=()=>({}),this.isHealthChat=!1,this.widgetType=lu.Default,this.primaryColor=Ue,this.backgroundColor=Re,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this._isMobile=bn(),this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;0!==e.length&&(this.messageInput.value="",this.autoResizeMessageInput(),0===this.messages.length&&(this.messages=[{timestamp:0,message:e,isLeadMessage:!0,chunks:[{text:e,order:0,isDone:!0}],type:us.text}]),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e)))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>this.requiresConsent&&!this.hasReceivedConsent}get consentKey(){return`${this.orgSlug}Consent`}connectedCallback(){super.connectedCallback(),this._cleanupMobileListener=vn(e=>{this._isMobile=e})}disconnectedCallback(){var e;null===(e=this._cleanupMobileListener)||void 0===e||e.call(this),super.disconnectedCallback()}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.simpleChatMessages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener(e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading}),this.onMount();const n=localStorage.getItem(this.consentKey);if(!n)return void(this.hasReceivedConsent=!1);const i=JSON.parse(n),{timestamp:r,consentId:o}=i;Il(new Date,new Date(r))<7&&o===fi?this.hasReceivedConsent=!0:(this.hasReceivedConsent=!1,localStorage.removeItem(this.consentKey))}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){}}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f;if(!this.buildingSlug)return B``;const g=null===(e=this.building)||void 0===e?void 0:e.id;let m={};if(m=this._isMobile?{top:void 0,bottom:0,left:void 0,right:0}:{top:void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:void 0===this.bottom||isNaN(this.bottom)?"130px":`${this.bottom}px`,left:void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:void 0===this.right||isNaN(this.right)?"18px":`${this.right}px`},22320===g&&(m={...m,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===lu.Utilities)return B`
6474
6474
  <div
6475
6475
  id="utilities-container"
6476
6476
  class=${ye({"pubnub-container__mobile":this._isMobile,"utilities-container__desktop":!this._isMobile})}
@@ -6575,12 +6575,12 @@ xmlns="http://www.w3.org/2000/svg"
6575
6575
  class=${ye({"health-bttn-allow-access":this._isMobile})}
6576
6576
  @click=${()=>this.sendMessage(this.messageInput.value)}
6577
6577
  >
6578
- ${Il("black")}
6578
+ ${Nl("black")}
6579
6579
  </button>
6580
6580
  </div>
6581
6581
  </div>
6582
6582
  </div>
6583
- `;if(this.widgetType===au.Healthcare)return B`
6583
+ `;if(this.widgetType===lu.Healthcare)return B`
6584
6584
  <div
6585
6585
  id="healthchat-container"
6586
6586
  class=${ye({"pubnub-container__mobile":this._isMobile,"healthchat-container__desktop":!this._isMobile})}
@@ -6690,7 +6690,7 @@ xmlns="http://www.w3.org/2000/svg"
6690
6690
  class=${ye({"health-bttn-allow-access":this._isMobile})}
6691
6691
  @click=${()=>this.sendMessage(this.messageInput.value)}
6692
6692
  >
6693
- ${this._isMobile?Il("black"):Ml("black")}
6693
+ ${this._isMobile?Nl("black"):Dl("black")}
6694
6694
  </button>
6695
6695
  </div>
6696
6696
  </div>
@@ -6802,11 +6802,11 @@ xmlns="http://www.w3.org/2000/svg"
6802
6802
  aria-label="Send message"
6803
6803
  aria-describedby="Send message"
6804
6804
  >
6805
- ${He(this.building.orgId,this.building.id)&&this.primaryColor!==Ue?Ml("black"):Ml("white")}
6805
+ ${He(this.building.orgId,this.building.id)&&this.primaryColor!==Ue?Dl("black"):Dl("white")}
6806
6806
  </button>
6807
6807
  </div>
6808
6808
  </div>
6809
- `}};Dl.styles=[kn,ms,gs,fs,Pl],Nl([ue({type:Number})],Dl.prototype,"right",void 0),Nl([ue({type:Number})],Dl.prototype,"bottom",void 0),Nl([ue({type:Number})],Dl.prototype,"top",void 0),Nl([ue({type:Number})],Dl.prototype,"left",void 0),Nl([ue({attribute:!0})],Dl.prototype,"onMount",void 0),Nl([ue({attribute:!0})],Dl.prototype,"channel",void 0),Nl([ue({attribute:!0})],Dl.prototype,"isHealthChat",void 0),Nl([ue({attribute:!0})],Dl.prototype,"myPubnub",void 0),Nl([ue({attribute:!0})],Dl.prototype,"orgSlug",void 0),Nl([ue({attribute:!0})],Dl.prototype,"buildingSlug",void 0),Nl([ue({attribute:!0})],Dl.prototype,"widgetType",void 0),Nl([ue({attribute:!0})],Dl.prototype,"building",void 0),Nl([ue({attribute:!0})],Dl.prototype,"primaryColor",void 0),Nl([ue({attribute:!0})],Dl.prototype,"backgroundColor",void 0),Nl([ue({attribute:!0})],Dl.prototype,"onClickExit",void 0),Nl([ue({attribute:!0})],Dl.prototype,"requiresConsent",void 0),Nl([de("#message-input",!0)],Dl.prototype,"messageInput",void 0),Nl([de("#conversation-body",!0)],Dl.prototype,"messageBody",void 0),Nl([ce()],Dl.prototype,"_isMobile",void 0),Nl([ce()],Dl.prototype,"messages",void 0),Nl([ce()],Dl.prototype,"isLoadingMessages",void 0),Nl([ce()],Dl.prototype,"hasReceivedConsent",void 0),Nl([ce()],Dl.prototype,"privacyPolicyUrl",void 0),Nl([ce()],Dl.prototype,"websitePreviewMapping",void 0),Dl=Nl([se("pubnub-chat")],Dl);const Ll="cdn.skypack.dev/@meetelise/chat",Ul="cdn.eliseai.com/@meetelise/chat",Rl=async(e,t)=>{try{if(Math.random()>=.15)return;const n=(()=>{try{const e=document.getElementsByTagName("script");for(const t of e){const e=t.src||"",n=t.textContent||"";if(e.includes(Ll)||n.includes(Ll))return"skypack";if(e.includes(Ul)||n.includes(Ul))return"eliseai"}return"unknown"}catch(e){return"unknown"}})();await r().post("https://app.meetelise.com/platformApi/webchat/cdn-version",{cdn_version:n},{params:{cdn_version:n},headers:{"Content-Type":"application/json","building-slug":t,"org-slug":e}})}catch(e){}},Bl=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?`${t}/units`:t,jl=["Check Availability","Apply Now"],Fl=(e,t,n,i)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const n=e.getElementsByTagName("span");if(1!==n.length)return!1;const i=null===(t=n[0].textContent)||void 0===t?void 0:t.trim();return null!=i&&jl.includes(i)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),Ai({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:xi.info,buildingSlug:i,orgSlug:n}),!0},Hl=(e,t,n,i)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&Fl(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)Fl(s[e],t,n,i)}},$l=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)Fl(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)Hl(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class zl{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>On(Pn(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=Ei();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Ci()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),n=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}]};localStorage.setItem(n,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Ai({logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),n=Oi(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:On(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Rn(e.timestampInitiallyLogged).getTime()-Rn(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:On(new Date),r=[{timestampInitiallyLogged:i,leadSourceValue:n,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>Rn(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var Gl,Ql=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let ql=Gl=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=bn(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=ri.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.LeadSourceMultitouchClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=au.Default,this.onWidgetLoaded=Ca(),this.onSstClose=Ca(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=ke(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Ui(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,t)=>{const n=window.rentgrata;if(!n)return;const i=n.Widget;if(!i)return;const o=i.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}try{Rl(this.orgSlug,this.buildingSlug)}catch(e){}await Er(e,this.buildingSlug,this.orgSlug)&&(Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,M,N,D,L,U,R,B,j,F,H,$,z,G,Q,q,W,V;const Y=this.buildingWebchatView;if(!Y)return;Y&&this.orgSlug&&Vl(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null);const K=Y.featureFlagWebchatMarketingSourceDropdownConfiguration,X=Y.featureFlagWebchatUseDniPhoneNumberBySource,Z=Y.featureFlagInsertDniIntoWebsite,J=Y.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite,[ee,te]=await Promise.all([za(this.orgSlug,this.buildingSlug),oi(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Ie(Y.phoneNumber)),this.leadSources=ee,this.featureFlagShowDropdown=K;const ne=Y.textWithUsPhoneNumber?Y.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",n=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return Ai({logType:xi.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),ie=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,re=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,oe={callDesktop:null!==(c=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==c&&c,callMobile:null!==(h=null===(d=this.buildingWebchatView)||void 0===d?void 0:d.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(b=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==b&&b,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!ne)&&void 0!==x&&x,textMobile:null!==(S=(null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowTextMobile)&&!!ne)&&void 0!==S&&S,sstDesktop:null!==(k=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(_=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==_&&_,calcDesktop:ie,calcMobile:re};var ae,se;this.enabledChatWidgets=_a(oe),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(se=this.handleTourClicked,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",e=>{e.preventDefault(),se(e)})}),J&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(t=>{t&&t.addEventListener("click",t=>{t.preventDefault(),e(t)})})})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var n;if(!t)return;const i=document.createElement("a");i.textContent=t.textContent,i.style.cursor="pointer",i.addEventListener("click",t=>{t.preventDefault(),e(t)}),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)})})(this.handleTourClicked)):(null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&(ae=null!==(I=null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&void 0!==I?I:null,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(ae)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(N=this.buildingWebchatView.secondaryColor)&&void 0!==N?N:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==D?D:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==L?L:null,this.webchatConfigHasAutoOpenChat=null!==(U=this.buildingWebchatView.autoOpenChat)&&void 0!==U&&U,this.requiresConsent=null!==(R=this.buildingWebchatView.requiresConsentForChat)&&void 0!==R&&R,this.hideMobileFeatures=null!==(B=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==B&&B,this.privacyPolicyUrl=null!==(j=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==j?j:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Mi.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Mi.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Mi.EMOJI&&(this.designConcept=Mi.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Ue),null===this.backgroundColor&&(this.backgroundColor=Re);const le=null!==(H=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==H?H:"";let ue=null;if(X&&(ue=await async function(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return n.data?{number:Ie(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(z=null===($=this.LeadSourceClient)||void 0===$?void 0:$.leadSource)&&void 0!==z?z:null),ue&&!ue.isMatch&&(ue.number=le)),Z&&(null==ue?void 0:ue.number)){const e=ds(ue.number,this.orgSlug,this.buildingSlug);e>0&&Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const ce=localStorage.getItem("eliseai_phone_number_devtest");ce&&ds(ce,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=ue||{number:le,isMatch:!1,isPropertyWebsiteCatchall:!0};const de=null!==(Q=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==Q?Q:null;if(de&&(this.leadSources.includes(de)||this.leadSources.push(de)),Vn(Y.id),te&&this.buildingSlug&&(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)){const e=((e,t,n)=>{var i;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(i=l.textContent)||void 0===i?void 0:i.toLowerCase())||"",s=Bl(o,e);l.setAttribute("href",s),a++,Ai({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Ai({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:xi.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}this.buildingSlug&&(null===(W=this.buildingWebchatView)||void 0===W?void 0:W.isLiveOnApplications)&&(null===(V=this.buildingWebchatView)||void 0===V?void 0:V.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&$l(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a;if(!this.buildingWebchatView)return;const s=rs(this.buildingSlug),l=os(this.buildingSlug,s),u=l?s:is(this.buildingSlug,!1);if(!u.leadId)throw new Error("Lead ID is null");if(this.LeadSourceClient=new Pi,this.LeadSourceMultitouchClient=new zl(this.orgSlug,this.buildingSlug),this.myPubnub=new cs(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,u.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType),!l){const e=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug);e&&is(this.buildingSlug,!1,e.lead_id)}this.LeadSourceClient.chatId=this.myPubnub.channel;const c=await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(n=null===(t=this.myPubnub)||void 0===t?void 0:t.leadUserId)&&void 0!==n?n:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));c&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(c),"property-website"!==Oi(this.orgSlug)?this.myPubnub.leadSource=null!==(r=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==r?r:Oi(this.orgSlug):this.myPubnub.leadSource=null!==(a=null===(o=this.LeadSourceClient)||void 0===o?void 0:o.leadSource)&&void 0!==a?a:null,u.initiatedChat&&await this.myPubnub.initializePubnub(s)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Dn(Rn(t)));return!!e&&!!n&&!bn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",On(function(e,t){return Ge(2,arguments),st(e,6e4*at(t))}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s;if("Tab"===e.key){const l=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot,u=this.displayPubnubChat?null===(o=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat"))||void 0===r?void 0:r.shadowRoot)||void 0===o?void 0:o.getElementById("pubnub-chat-container"):null!==(s=null!==(a=null==l?void 0:l.getElementById("email-us-window"))&&void 0!==a?a:null==l?void 0:l.getElementById("tour-scheduler-window"))&&void 0!==s?s:null==l?void 0:l.getElementById("call-us-window");if(!u)return;e.preventDefault();const c=this.displayPubnubChat?Array.from(u.querySelectorAll(Gl.FOCUSABLE_SELECTOR)):this.collectFocusableElements(u),d=this.getDeepActiveElement(),h=c.findIndex(e=>e===d);c[e.shiftKey?(h-1+c.length)%c.length:(h+1)%c.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new wi(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ns(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab),this._cleanupMobileListener=vn(e=>{this._isMobile=e})}static isFocusable(e){return!("disabled"in e)||!e.disabled}collectFocusableElements(e){const t=[];e instanceof Element&&e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));const n=e.querySelectorAll("*");for(const e of Array.from(n))e.matches(Gl.FOCUSABLE_SELECTOR)&&Gl.isFocusable(e)&&t.push(e),e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));return t}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){Ai({logType:xi.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,M,N,D,L,U;Ea();const R=this.hideLauncher&&!this.isLoading&&!this._isMobile;return B`
6809
+ `}};Ul.styles=[kn,bs,ys,ms,Ml],Ll([ue({type:Number})],Ul.prototype,"right",void 0),Ll([ue({type:Number})],Ul.prototype,"bottom",void 0),Ll([ue({type:Number})],Ul.prototype,"top",void 0),Ll([ue({type:Number})],Ul.prototype,"left",void 0),Ll([ue({attribute:!0})],Ul.prototype,"onMount",void 0),Ll([ue({attribute:!0})],Ul.prototype,"channel",void 0),Ll([ue({attribute:!0})],Ul.prototype,"isHealthChat",void 0),Ll([ue({attribute:!0})],Ul.prototype,"myPubnub",void 0),Ll([ue({attribute:!0})],Ul.prototype,"orgSlug",void 0),Ll([ue({attribute:!0})],Ul.prototype,"buildingSlug",void 0),Ll([ue({attribute:!0})],Ul.prototype,"widgetType",void 0),Ll([ue({attribute:!0})],Ul.prototype,"building",void 0),Ll([ue({attribute:!0})],Ul.prototype,"primaryColor",void 0),Ll([ue({attribute:!0})],Ul.prototype,"backgroundColor",void 0),Ll([ue({attribute:!0})],Ul.prototype,"onClickExit",void 0),Ll([ue({attribute:!0})],Ul.prototype,"requiresConsent",void 0),Ll([de("#message-input",!0)],Ul.prototype,"messageInput",void 0),Ll([de("#conversation-body",!0)],Ul.prototype,"messageBody",void 0),Ll([ce()],Ul.prototype,"_isMobile",void 0),Ll([ce()],Ul.prototype,"messages",void 0),Ll([ce()],Ul.prototype,"isLoadingMessages",void 0),Ll([ce()],Ul.prototype,"hasReceivedConsent",void 0),Ll([ce()],Ul.prototype,"privacyPolicyUrl",void 0),Ll([ce()],Ul.prototype,"websitePreviewMapping",void 0),Ul=Ll([se("pubnub-chat")],Ul);const Rl="cdn.skypack.dev/@meetelise/chat",Bl="cdn.eliseai.com/@meetelise/chat",jl=async(e,t)=>{try{if(Math.random()>=.15)return;const n=(()=>{try{const e=document.getElementsByTagName("script");for(const t of e){const e=t.src||"",n=t.textContent||"";if(e.includes(Rl)||n.includes(Rl))return"skypack";if(e.includes(Bl)||n.includes(Bl))return"eliseai"}return"unknown"}catch(e){return"unknown"}})();await r().post("https://app.meetelise.com/platformApi/webchat/cdn-version",{cdn_version:n},{params:{cdn_version:n},headers:{"Content-Type":"application/json","building-slug":t,"org-slug":e}})}catch(e){}},Fl=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?`${t}/units`:t,Hl=["Check Availability","Apply Now"],$l=(e,t,n,i)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const n=e.getElementsByTagName("span");if(1!==n.length)return!1;const i=null===(t=n[0].textContent)||void 0===t?void 0:t.trim();return null!=i&&Hl.includes(i)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),Ai({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:xi.info,buildingSlug:i,orgSlug:n}),!0},zl=(e,t,n,i)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&$l(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)$l(s[e],t,n,i)}},Gl=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)$l(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)zl(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class Ql{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>On(Pn(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=Ei();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Ci()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),n=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}]};localStorage.setItem(n,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Ai({logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),n=Oi(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:On(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Rn(e.timestampInitiallyLogged).getTime()-Rn(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:On(new Date),r=[{timestampInitiallyLogged:i,leadSourceValue:n,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>Rn(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var ql,Wl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Vl=ql=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=bn(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=ri.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.LeadSourceMultitouchClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=lu.Default,this.onWidgetLoaded=Ca(),this.onSstClose=Ca(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=ke(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Ui(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,t)=>{const n=window.rentgrata;if(!n)return;const i=n.Widget;if(!i)return;const o=i.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}try{jl(this.orgSlug,this.buildingSlug)}catch(e){}await Er(e,this.buildingSlug,this.orgSlug)&&(Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,M,N,D,L,U,R,B,j,F,H,$,z,G,Q,q,W,V;const Y=this.buildingWebchatView;if(!Y)return;Y&&this.orgSlug&&Kl(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null);const K=Y.featureFlagWebchatMarketingSourceDropdownConfiguration,X=Y.featureFlagWebchatUseDniPhoneNumberBySource,Z=Y.featureFlagInsertDniIntoWebsite,J=Y.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite,[ee,te]=await Promise.all([za(this.orgSlug,this.buildingSlug),oi(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Ie(Y.phoneNumber)),this.leadSources=ee,this.featureFlagShowDropdown=K;const ne=Y.textWithUsPhoneNumber?Y.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",n=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return Ai({logType:xi.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),ie=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,re=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,oe={callDesktop:null!==(c=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==c&&c,callMobile:null!==(h=null===(d=this.buildingWebchatView)||void 0===d?void 0:d.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(b=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==b&&b,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!ne)&&void 0!==x&&x,textMobile:null!==(S=(null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowTextMobile)&&!!ne)&&void 0!==S&&S,sstDesktop:null!==(k=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(_=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==_&&_,calcDesktop:ie,calcMobile:re};var ae,se;this.enabledChatWidgets=_a(oe),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(se=this.handleTourClicked,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",e=>{e.preventDefault(),se(e)})}),J&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(t=>{t&&t.addEventListener("click",t=>{t.preventDefault(),e(t)})})})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var n;if(!t)return;const i=document.createElement("a");i.textContent=t.textContent,i.style.cursor="pointer",i.addEventListener("click",t=>{t.preventDefault(),e(t)}),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)})})(this.handleTourClicked)):(null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&(ae=null!==(I=null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&void 0!==I?I:null,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(ae)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(N=this.buildingWebchatView.secondaryColor)&&void 0!==N?N:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==D?D:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==L?L:null,this.webchatConfigHasAutoOpenChat=null!==(U=this.buildingWebchatView.autoOpenChat)&&void 0!==U&&U,this.requiresConsent=null!==(R=this.buildingWebchatView.requiresConsentForChat)&&void 0!==R&&R,this.hideMobileFeatures=null!==(B=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==B&&B,this.privacyPolicyUrl=null!==(j=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==j?j:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Mi.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Mi.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Mi.EMOJI&&(this.designConcept=Mi.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Ue),null===this.backgroundColor&&(this.backgroundColor=Re);const le=null!==(H=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==H?H:"";let ue=null;if(X&&(ue=await async function(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return n.data?{number:Ie(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(z=null===($=this.LeadSourceClient)||void 0===$?void 0:$.leadSource)&&void 0!==z?z:null),ue&&!ue.isMatch&&(ue.number=le)),Z&&(null==ue?void 0:ue.number)){const e=ps(ue.number,this.orgSlug,this.buildingSlug);e>0&&Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const ce=localStorage.getItem("eliseai_phone_number_devtest");ce&&ps(ce,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=ue||{number:le,isMatch:!1,isPropertyWebsiteCatchall:!0};const de=null!==(Q=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==Q?Q:null;if(de&&(this.leadSources.includes(de)||this.leadSources.push(de)),Vn(Y.id),te&&this.buildingSlug&&(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)){const e=((e,t,n)=>{var i;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(i=l.textContent)||void 0===i?void 0:i.toLowerCase())||"",s=Fl(o,e);l.setAttribute("href",s),a++,Ai({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:xi.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Ai({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:xi.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&Si({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}this.buildingSlug&&(null===(W=this.buildingWebchatView)||void 0===W?void 0:W.isLiveOnApplications)&&(null===(V=this.buildingWebchatView)||void 0===V?void 0:V.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&Gl(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a;if(!this.buildingWebchatView)return;const s=rs(this.buildingSlug),l=os(this.buildingSlug,s),u=l?s:is(this.buildingSlug,!1);if(!u.leadId)throw new Error("Lead ID is null");if(this.LeadSourceClient=new Pi,this.LeadSourceMultitouchClient=new Ql(this.orgSlug,this.buildingSlug),this.myPubnub=new cs(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,u.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType),!l){const e=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug);e&&is(this.buildingSlug,!1,e.lead_id)}this.LeadSourceClient.chatId=this.myPubnub.channel;const c=await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(n=null===(t=this.myPubnub)||void 0===t?void 0:t.leadUserId)&&void 0!==n?n:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));c&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(c),"property-website"!==Oi(this.orgSlug)?this.myPubnub.leadSource=null!==(r=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==r?r:Oi(this.orgSlug):this.myPubnub.leadSource=null!==(a=null===(o=this.LeadSourceClient)||void 0===o?void 0:o.leadSource)&&void 0!==a?a:null,u.initiatedChat&&await this.myPubnub.initializePubnub(s)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Dn(Rn(t)));return!!e&&!!n&&!bn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",On(function(e,t){return Ge(2,arguments),st(e,6e4*at(t))}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s;if("Tab"===e.key){const l=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot,u=this.displayPubnubChat?null===(o=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat"))||void 0===r?void 0:r.shadowRoot)||void 0===o?void 0:o.getElementById("pubnub-chat-container"):null!==(s=null!==(a=null==l?void 0:l.getElementById("email-us-window"))&&void 0!==a?a:null==l?void 0:l.getElementById("tour-scheduler-window"))&&void 0!==s?s:null==l?void 0:l.getElementById("call-us-window");if(!u)return;e.preventDefault();const c=this.displayPubnubChat?Array.from(u.querySelectorAll(ql.FOCUSABLE_SELECTOR)):this.collectFocusableElements(u),d=this.getDeepActiveElement(),h=c.findIndex(e=>e===d);c[e.shiftKey?(h-1+c.length)%c.length:(h+1)%c.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new wi(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ns(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab),this._cleanupMobileListener=vn(e=>{this._isMobile=e})}static isFocusable(e){return!("disabled"in e)||!e.disabled}collectFocusableElements(e){const t=[];e instanceof Element&&e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));const n=e.querySelectorAll("*");for(const e of Array.from(n))e.matches(ql.FOCUSABLE_SELECTOR)&&ql.isFocusable(e)&&t.push(e),e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));return t}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){Ai({logType:xi.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,M,N,D,L,U;Ea();const R=this.hideLauncher&&!this.isLoading&&!this._isMobile;return B`
6810
6810
  <meta name="viewport" content="width=device-width, initial-scale=1">
6811
6811
  <div id="aria-describe-info" style="display: none;">
6812
6812
  EliseAI widget that allows you to chat with a virtual assistant, book
@@ -6821,7 +6821,7 @@ xmlns="http://www.w3.org/2000/svg"
6821
6821
  .myPubnub=${this.myPubnub}
6822
6822
  .orgSlug=${this.orgSlug}
6823
6823
  .buildingSlug=${this.buildingSlug}
6824
- .widgetType=${au.Default}
6824
+ .widgetType=${lu.Default}
6825
6825
  .building=${this.buildingWebchatView}
6826
6826
  .primaryColor=${this.primaryColor}
6827
6827
  .backgroundColor=${this.backgroundColor}
@@ -6921,7 +6921,7 @@ xmlns="http://www.w3.org/2000/svg"
6921
6921
  </meetelise-launcher>`:""}
6922
6922
  </div>
6923
6923
  </meta>
6924
- `}};ql.styles=u`
6924
+ `}};Vl.styles=u`
6925
6925
  :host {
6926
6926
  all: initial;
6927
6927
  }
@@ -6970,7 +6970,7 @@ xmlns="http://www.w3.org/2000/svg"
6970
6970
  position: fixed;
6971
6971
  bottom: 0;
6972
6972
  }
6973
- `,ql.FOCUSABLE_SELECTOR="input:not([disabled]), button:not([disabled]), me-select, textarea, action-confirm-button, [tabindex]:not([tabindex='-1'])",Ql([ue({type:String})],ql.prototype,"buildingSlug",void 0),Ql([ue({type:String})],ql.prototype,"orgSlug",void 0),Ql([ue({type:Object})],ql.prototype,"launcherStyles",void 0),Ql([ue()],ql.prototype,"mobileStyles",void 0),Ql([ue({type:Boolean})],ql.prototype,"isMinimized",void 0),Ql([ue({type:String})],ql.prototype,"primaryColor",void 0),Ql([ue({type:String})],ql.prototype,"backgroundColor",void 0),Ql([ue({type:String})],ql.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Ql([ue({type:String})],ql.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Ql([ce()],ql.prototype,"_isMobile",void 0),Ql([ce()],ql.prototype,"chatId",void 0),Ql([ce()],ql.prototype,"analytics",void 0),Ql([ce()],ql.prototype,"launcher",void 0),Ql([ce()],ql.prototype,"buildingWebchatView",void 0),Ql([ce()],ql.prototype,"designConcept",void 0),Ql([ce()],ql.prototype,"leadSources",void 0),Ql([ce()],ql.prototype,"currentLeadSource",void 0),Ql([ce()],ql.prototype,"featureFlagShowDropdown",void 0),Ql([ce()],ql.prototype,"phoneNumberForSource",void 0),Ql([ce()],ql.prototype,"hasMounted",void 0),Ql([ce()],ql.prototype,"hideLauncher",void 0),Ql([ce()],ql.prototype,"isLoading",void 0),Ql([ce()],ql.prototype,"showTourNextToChat",void 0),Ql([ce()],ql.prototype,"displayPubnubChat",void 0),Ql([ce()],ql.prototype,"myPubnub",void 0),Ql([ce()],ql.prototype,"LeadSourceClient",void 0),Ql([ce()],ql.prototype,"LeadSourceMultitouchClient",void 0),Ql([ce()],ql.prototype,"sampleRateToUse",void 0),Ql([ue({type:Number})],ql.prototype,"right",void 0),Ql([ue({type:Number})],ql.prototype,"bottom",void 0),Ql([ue({type:Number})],ql.prototype,"top",void 0),Ql([ue({type:Number})],ql.prototype,"left",void 0),Ql([ue({attribute:!0})],ql.prototype,"overrideRentgrata",void 0),Ql([ue({attribute:!0})],ql.prototype,"widgetType",void 0),Ql([ue()],ql.prototype,"onWidgetLoaded",void 0),Ql([ue({attribute:!0})],ql.prototype,"onSstClose",void 0),Ql([ce()],ql.prototype,"enabledChatWidgets",void 0),Ql([ce()],ql.prototype,"webchatConfigHasAutoOpenChat",void 0),Ql([ce()],ql.prototype,"requiresConsent",void 0),Ql([ce()],ql.prototype,"hideMobileFeatures",void 0),Ql([ce()],ql.prototype,"privacyPolicyUrl",void 0),ql=Gl=Ql([se("me-chat")],ql);const Wl=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},Vl=async(e,t,n,i,o)=>{var a;if(!i||!e)return;const s=await async function(e){if(!e)return!1;try{return(await r().get(ii(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-override-contact-us-form",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(i);if(!s)return;const l=Wl(["myContactForm","contactus","fpa-myContactForm"]);let u;if(!(l&&l instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&Yl(i,e,"Could not find form",t?{id:t.id}:void 0))}try{if(l.parentElement&&"scheduleTourForm"===l.parentElement.id)return Yl(i,e,"Form is apart of schedule tour form!")}catch(e){}for(let e=0;e<l.elements.length;e++){const t=l.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){u=t;break}if("fpa-contact-submit"===t.getAttribute("id")){u=t;break}}if(!u)return Yl(i,e,"Could not find submit button");const c=()=>({firstName:Wl(["firstname","txtName","fpa-firstname","Form_FirstName"]),lastName:Wl(["lastname","txtName2","fpa-lastname","Form_LastName"]),email:Wl(["email","txtEmail","fpa-email","Form_Email"]),phone:Wl(["phonenumber","txtPhone","fpa-phonenumber","Form_Phone"]),message:Wl(["message","txtComments","fpa-email","Form_Message"])});if(Object.values(c()).some(e=>null===e)){const t=Object.entries(c()).filter(([,e])=>null===e).map(([e])=>e);return Yl(i,e,"Missing the following form elements: "+t.join(", "))}const d=u.textContent,h=u.cloneNode(!0);null===(a=u.parentNode)||void 0===a||a.replaceChild(h,u),h&&Si({params:{chat_id:t,org_slug:e,building_slug:i,is_form_override_success:!0},sampleRate:n}),h.onclick=async function(t){if(Object.values(c()).forEach(e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")}),!Object.values(c()).every(e=>null!==e&&!("true"===e.getAttribute("aria-required")&&!e.value)&&("email"!==e.id&&"phonenumber"!==e.id||"true"!==e.getAttribute("aria-invalid"))))return;t.preventDefault(),h.textContent="Processing request...",h.disabled=!0;const n={};Object.entries(c()).forEach(([e,t])=>n[e]=null==t?void 0:t.value);const r=await Ui(e,i);if(!r)return Yl(i,e,"Could not find building"),null;const a={email_address:n.email,first_name:n.firstName,last_name:n.lastName,phone_number:n.phone,first_message:n.message,building_id:r.id,is_external_form:!0,lead_sources:[...new Set(o?[o,Oi(e)]:[Oi(e)])]},s=JSON.stringify(a);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":i,"org-slug":e},body:s}).then(e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return l&&l.reset(),Object.values(c()).forEach(e=>{e&&(e.disabled=!0)}),h.textContent="Submitted",h.disabled=!0,e.json()}).catch(()=>{h.textContent=d})}},Yl=(e,t,n,i)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n,url:window.location.href,formIdInfo:i});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:r})},Kl=u`
6973
+ `,Vl.FOCUSABLE_SELECTOR="input:not([disabled]), button:not([disabled]), me-select, textarea, action-confirm-button, [tabindex]:not([tabindex='-1'])",Wl([ue({type:String})],Vl.prototype,"buildingSlug",void 0),Wl([ue({type:String})],Vl.prototype,"orgSlug",void 0),Wl([ue({type:Object})],Vl.prototype,"launcherStyles",void 0),Wl([ue()],Vl.prototype,"mobileStyles",void 0),Wl([ue({type:Boolean})],Vl.prototype,"isMinimized",void 0),Wl([ue({type:String})],Vl.prototype,"primaryColor",void 0),Wl([ue({type:String})],Vl.prototype,"backgroundColor",void 0),Wl([ue({type:String})],Vl.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Wl([ue({type:String})],Vl.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Wl([ce()],Vl.prototype,"_isMobile",void 0),Wl([ce()],Vl.prototype,"chatId",void 0),Wl([ce()],Vl.prototype,"analytics",void 0),Wl([ce()],Vl.prototype,"launcher",void 0),Wl([ce()],Vl.prototype,"buildingWebchatView",void 0),Wl([ce()],Vl.prototype,"designConcept",void 0),Wl([ce()],Vl.prototype,"leadSources",void 0),Wl([ce()],Vl.prototype,"currentLeadSource",void 0),Wl([ce()],Vl.prototype,"featureFlagShowDropdown",void 0),Wl([ce()],Vl.prototype,"phoneNumberForSource",void 0),Wl([ce()],Vl.prototype,"hasMounted",void 0),Wl([ce()],Vl.prototype,"hideLauncher",void 0),Wl([ce()],Vl.prototype,"isLoading",void 0),Wl([ce()],Vl.prototype,"showTourNextToChat",void 0),Wl([ce()],Vl.prototype,"displayPubnubChat",void 0),Wl([ce()],Vl.prototype,"myPubnub",void 0),Wl([ce()],Vl.prototype,"LeadSourceClient",void 0),Wl([ce()],Vl.prototype,"LeadSourceMultitouchClient",void 0),Wl([ce()],Vl.prototype,"sampleRateToUse",void 0),Wl([ue({type:Number})],Vl.prototype,"right",void 0),Wl([ue({type:Number})],Vl.prototype,"bottom",void 0),Wl([ue({type:Number})],Vl.prototype,"top",void 0),Wl([ue({type:Number})],Vl.prototype,"left",void 0),Wl([ue({attribute:!0})],Vl.prototype,"overrideRentgrata",void 0),Wl([ue({attribute:!0})],Vl.prototype,"widgetType",void 0),Wl([ue()],Vl.prototype,"onWidgetLoaded",void 0),Wl([ue({attribute:!0})],Vl.prototype,"onSstClose",void 0),Wl([ce()],Vl.prototype,"enabledChatWidgets",void 0),Wl([ce()],Vl.prototype,"webchatConfigHasAutoOpenChat",void 0),Wl([ce()],Vl.prototype,"requiresConsent",void 0),Wl([ce()],Vl.prototype,"hideMobileFeatures",void 0),Wl([ce()],Vl.prototype,"privacyPolicyUrl",void 0),Vl=ql=Wl([se("me-chat")],Vl);const Yl=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},Kl=async(e,t,n,i,o)=>{var a;if(!i||!e)return;const s=await async function(e){if(!e)return!1;try{return(await r().get(ii(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-override-contact-us-form",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(i);if(!s)return;const l=Yl(["myContactForm","contactus","fpa-myContactForm"]);let u;if(!(l&&l instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&Xl(i,e,"Could not find form",t?{id:t.id}:void 0))}try{if(l.parentElement&&"scheduleTourForm"===l.parentElement.id)return Xl(i,e,"Form is apart of schedule tour form!")}catch(e){}for(let e=0;e<l.elements.length;e++){const t=l.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){u=t;break}if("fpa-contact-submit"===t.getAttribute("id")){u=t;break}}if(!u)return Xl(i,e,"Could not find submit button");const c=()=>({firstName:Yl(["firstname","txtName","fpa-firstname","Form_FirstName"]),lastName:Yl(["lastname","txtName2","fpa-lastname","Form_LastName"]),email:Yl(["email","txtEmail","fpa-email","Form_Email"]),phone:Yl(["phonenumber","txtPhone","fpa-phonenumber","Form_Phone"]),message:Yl(["message","txtComments","fpa-email","Form_Message"])});if(Object.values(c()).some(e=>null===e)){const t=Object.entries(c()).filter(([,e])=>null===e).map(([e])=>e);return Xl(i,e,"Missing the following form elements: "+t.join(", "))}const d=u.textContent,h=u.cloneNode(!0);null===(a=u.parentNode)||void 0===a||a.replaceChild(h,u),h&&Si({params:{chat_id:t,org_slug:e,building_slug:i,is_form_override_success:!0},sampleRate:n}),h.onclick=async function(t){if(Object.values(c()).forEach(e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")}),!Object.values(c()).every(e=>null!==e&&!("true"===e.getAttribute("aria-required")&&!e.value)&&("email"!==e.id&&"phonenumber"!==e.id||"true"!==e.getAttribute("aria-invalid"))))return;t.preventDefault(),h.textContent="Processing request...",h.disabled=!0;const n={};Object.entries(c()).forEach(([e,t])=>n[e]=null==t?void 0:t.value);const r=await Ui(e,i);if(!r)return Xl(i,e,"Could not find building"),null;const a={email_address:n.email,first_name:n.firstName,last_name:n.lastName,phone_number:n.phone,first_message:n.message,building_id:r.id,is_external_form:!0,lead_sources:[...new Set(o?[o,Oi(e)]:[Oi(e)])]},s=JSON.stringify(a);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":i,"org-slug":e},body:s}).then(e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return l&&l.reset(),Object.values(c()).forEach(e=>{e&&(e.disabled=!0)}),h.textContent="Submitted",h.disabled=!0,e.json()}).catch(()=>{h.textContent=d})}},Xl=(e,t,n,i)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n,url:window.location.href,formIdInfo:i});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:r})},Zl=u`
6974
6974
  .chat-launcher {
6975
6975
  position: fixed;
6976
6976
  }
@@ -7001,7 +7001,7 @@ xmlns="http://www.w3.org/2000/svg"
7001
7001
  filter: brightness(1.1);
7002
7002
  }
7003
7003
  }
7004
- `;var Xl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Zl=class extends oe{constructor(){super(...arguments),this.right=0,this.bottom=0,this.top=0,this.left=0,this.isChatOpen=!1,this.onClickCloseChat=()=>({}),this.onClickOpenChat=()=>({})}render(){return this.isChatOpen?B`
7004
+ `;var Jl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let eu=class extends oe{constructor(){super(...arguments),this.right=0,this.bottom=0,this.top=0,this.left=0,this.isChatOpen=!1,this.onClickCloseChat=()=>({}),this.onClickOpenChat=()=>({})}render(){return this.isChatOpen?B`
7005
7005
  <div
7006
7006
  class="chat-launcher"
7007
7007
  style=${Le({top:bn()||isNaN(this.top)?void 0:`${this.top+432}px`,bottom:bn()||isNaN(this.bottom)?"72px":this.bottom-60+"px",left:bn()||isNaN(this.left)?void 0:`${this.left}px`,right:bn()||isNaN(this.right)?"18px":`${this.right}px`})}
@@ -7051,7 +7051,7 @@ xmlns="http://www.w3.org/2000/svg"
7051
7051
  />
7052
7052
  </svg>
7053
7053
  </button>
7054
- </div>`}};Zl.styles=[Kl],Xl([ue({type:Number})],Zl.prototype,"right",void 0),Xl([ue({type:Number})],Zl.prototype,"bottom",void 0),Xl([ue({type:Number})],Zl.prototype,"top",void 0),Xl([ue({type:Number})],Zl.prototype,"left",void 0),Xl([ue({attribute:!0})],Zl.prototype,"isChatOpen",void 0),Xl([ue({attribute:!0})],Zl.prototype,"onClickCloseChat",void 0),Xl([ue({attribute:!0})],Zl.prototype,"onClickOpenChat",void 0),Zl=Xl([se("simple-launcher")],Zl);var Jl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let eu=class extends oe{constructor(){super(...arguments),this.healthcareId="",this.right=0,this.bottom=0,this.top=0,this.left=0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=rs(this.healthcareId),t=os(this.healthcareId,e)?e:is(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new cs(this.healthcareId,null,"",this.currentLeadSource,t.leadId,null,null,au.Healthcare),t.initiatedChat&&await this.myPubnub.initializePubnub(e),bn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ns(this.healthcareId),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return Ea(),this.isLoading?B``:B`
7054
+ </div>`}};eu.styles=[Zl],Jl([ue({type:Number})],eu.prototype,"right",void 0),Jl([ue({type:Number})],eu.prototype,"bottom",void 0),Jl([ue({type:Number})],eu.prototype,"top",void 0),Jl([ue({type:Number})],eu.prototype,"left",void 0),Jl([ue({attribute:!0})],eu.prototype,"isChatOpen",void 0),Jl([ue({attribute:!0})],eu.prototype,"onClickCloseChat",void 0),Jl([ue({attribute:!0})],eu.prototype,"onClickOpenChat",void 0),eu=Jl([se("simple-launcher")],eu);var tu=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let nu=class extends oe{constructor(){super(...arguments),this.healthcareId="",this.right=0,this.bottom=0,this.top=0,this.left=0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=rs(this.healthcareId),t=os(this.healthcareId,e)?e:is(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new cs(this.healthcareId,null,"",this.currentLeadSource,t.leadId,null,null,lu.Healthcare),t.initiatedChat&&await this.myPubnub.initializePubnub(e),bn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ns(this.healthcareId),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return Ea(),this.isLoading?B``:B`
7055
7055
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
7056
7056
  <div id="aria-describe-info" style="display: none;">
7057
7057
  EliseAI widget that allows you to chat with a virtual assistant, book
@@ -7060,7 +7060,7 @@ xmlns="http://www.w3.org/2000/svg"
7060
7060
  ${this.displayPubnubChat?B`
7061
7061
  <pubnub-chat
7062
7062
  id="pubnub-chat"
7063
- .widgetType=${au.Healthcare}
7063
+ .widgetType=${lu.Healthcare}
7064
7064
  .channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
7065
7065
  .myPubnub=${this.myPubnub}
7066
7066
  .buildingSlug=${this.healthcareId}
@@ -7086,7 +7086,7 @@ xmlns="http://www.w3.org/2000/svg"
7086
7086
  ></simple-launcher>
7087
7087
 
7088
7088
  </meta>
7089
- `}};eu.styles=u`
7089
+ `}};nu.styles=u`
7090
7090
  :host {
7091
7091
  all: initial;
7092
7092
  }
@@ -7139,7 +7139,7 @@ xmlns="http://www.w3.org/2000/svg"
7139
7139
  line-height: 150%;
7140
7140
  font-size: 16px;
7141
7141
  }
7142
- `,Jl([ue({type:String})],eu.prototype,"healthcareId",void 0),Jl([ue({type:Number})],eu.prototype,"right",void 0),Jl([ue({type:Number})],eu.prototype,"bottom",void 0),Jl([ue({type:Number})],eu.prototype,"top",void 0),Jl([ue({type:Number})],eu.prototype,"left",void 0),Jl([ce()],eu.prototype,"launcher",void 0),Jl([ce()],eu.prototype,"currentLeadSource",void 0),Jl([ce()],eu.prototype,"displayPubnubChat",void 0),Jl([ce()],eu.prototype,"myPubnub",void 0),Jl([ce()],eu.prototype,"requiresConsent",void 0),Jl([ce()],eu.prototype,"privacyPolicyUrl",void 0),Jl([ce()],eu.prototype,"isLoading",void 0),eu=Jl([se("health-chat")],eu);var tu=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let nu=class extends oe{constructor(){super(...arguments),this.orgSlug="",this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{(await async function(e){if(!e)return!1;const t="e2e-test-yardi-building";try{return(await r().get(ii(t),{params:{building_slug:t,flag_type:"bool",feature_flag:"enable-show-utilities-webchat",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(this.orgSlug)||location.href.includes("demo/utilities"))&&await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=rs(this.orgSlug),t=os(this.orgSlug,e)?e:is(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new cs(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,null,au.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),bn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ns(this.orgSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return Ea(),this.isLoading?B``:B`
7142
+ `,tu([ue({type:String})],nu.prototype,"healthcareId",void 0),tu([ue({type:Number})],nu.prototype,"right",void 0),tu([ue({type:Number})],nu.prototype,"bottom",void 0),tu([ue({type:Number})],nu.prototype,"top",void 0),tu([ue({type:Number})],nu.prototype,"left",void 0),tu([ce()],nu.prototype,"launcher",void 0),tu([ce()],nu.prototype,"currentLeadSource",void 0),tu([ce()],nu.prototype,"displayPubnubChat",void 0),tu([ce()],nu.prototype,"myPubnub",void 0),tu([ce()],nu.prototype,"requiresConsent",void 0),tu([ce()],nu.prototype,"privacyPolicyUrl",void 0),tu([ce()],nu.prototype,"isLoading",void 0),nu=tu([se("health-chat")],nu);var iu=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let ru=class extends oe{constructor(){super(...arguments),this.orgSlug="",this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{(await async function(e){if(!e)return!1;const t="e2e-test-yardi-building";try{return(await r().get(ii(t),{params:{building_slug:t,flag_type:"bool",feature_flag:"enable-show-utilities-webchat",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(this.orgSlug)||location.href.includes("demo/utilities"))&&await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=rs(this.orgSlug),t=os(this.orgSlug,e)?e:is(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new cs(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,null,lu.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),bn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),ns(this.orgSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return Ea(),this.isLoading?B``:B`
7143
7143
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
7144
7144
  <div id="aria-describe-info" style="display: none;">
7145
7145
  EliseAI widget that allows you to chat with a virtual assistant, book
@@ -7151,7 +7151,7 @@ xmlns="http://www.w3.org/2000/svg"
7151
7151
  <pubnub-chat
7152
7152
  id="pubnub-chat"
7153
7153
  .channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
7154
- .widgetType=${au.Utilities}
7154
+ .widgetType=${lu.Utilities}
7155
7155
  .myPubnub=${this.myPubnub}
7156
7156
  .buildingSlug=${this.orgSlug}
7157
7157
  .onClickExit=${()=>{this.displayPubnubChat=!1}}
@@ -7175,7 +7175,7 @@ xmlns="http://www.w3.org/2000/svg"
7175
7175
 
7176
7176
  ></simple-launcher>
7177
7177
  </meta>
7178
- `}};nu.styles=u`
7178
+ `}};ru.styles=u`
7179
7179
  :host {
7180
7180
  all: initial;
7181
7181
  }
@@ -7228,4 +7228,4 @@ xmlns="http://www.w3.org/2000/svg"
7228
7228
  line-height: 150%;
7229
7229
  font-size: 16px;
7230
7230
  }
7231
- `,tu([ue({type:String})],nu.prototype,"orgSlug",void 0),tu([ue({type:Number})],nu.prototype,"right",void 0),tu([ue({type:Number})],nu.prototype,"bottom",void 0),tu([ue({type:Number})],nu.prototype,"top",void 0),tu([ue({type:Number})],nu.prototype,"left",void 0),tu([ce()],nu.prototype,"launcher",void 0),tu([ce()],nu.prototype,"currentLeadSource",void 0),tu([ce()],nu.prototype,"displayPubnubChat",void 0),tu([ce()],nu.prototype,"myPubnub",void 0),tu([ce()],nu.prototype,"requiresConsent",void 0),tu([ce()],nu.prototype,"privacyPolicyUrl",void 0),tu([ce()],nu.prototype,"isLoading",void 0),nu=tu([se("utilities-chat")],nu);const iu=async e=>{const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":e}});return Math.random()<.2&&Ai({logType:i&&i.data?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:e,givenBuildingSlug:null,reason:i&&i.data?null:"No match found"}}),i.data},ru=async(e,t=5e3)=>new Promise((n,i)=>{const r=new MutationObserver((t,i)=>{const r=document.getElementById(e);r&&(i.disconnect(),n(r))});r.observe(document.body,{childList:!0,subtree:!0});const o=setTimeout(()=>{r.disconnect(),i(new Error(`Element ${e} did not appear within ${t}ms`))},t),a=document.querySelector(e);a&&(clearTimeout(o),r.disconnect(),n(a))});class ou{static healthcareStart(e,t=!0){var n,i,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),su();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","dialog"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("aria-describedby","aria-describe-info"),a.setAttribute("aria-modal","true"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(n=e.right)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("bottom",(null===(i=e.bottom)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("top",(null===(r=e.top)||void 0===r?void 0:r.toString())||"unset"),a.setAttribute("left",(null===(o=e.left)||void 0===o?void 0:o.toString())||"unset"),document.body.appendChild(a),ou.healthChat=a}static start(e,t=!0){var n,i,r,o,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization,this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.right,bottom:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.bottom,top:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.top,left:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.left}),su();let c=null;switch(e.widgetType){case au.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case au.Default:c=document.createElement("me-chat");break;case au.Utilities:c=document.createElement("utilities-chat");break;default:c=document.createElement("me-chat")}if(!c)throw new Error("Invalid widget type");c.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization),c.setAttribute("widgetType",e.widgetType||au.Default),c.setAttribute("class","meetelise-chat"),c.setAttribute("role","dialog"),c.setAttribute("aria-label","EliseAI Widget"),c.setAttribute("aria-describedby","aria-describe-info"),c.setAttribute("aria-modal","true"),e.brandColor&&(this.brandColor=e.brandColor,c.setAttribute("primaryColor",((e,t)=>{const n=Be(e),i=0,r=0,o=0,a={r:n.r+Math.round((i-n.r)*t),g:n.g+Math.round((r-n.g)*t),b:n.b+Math.round((o-n.b)*t)};return je(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),c instanceof ql&&(this.handleBuildingslug(c,e.organization,e.building,e),e.launcherStyles&&(c.launcherStyles=e.launcherStyles),e.mobileStyles&&(c.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(c.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await ru("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),c.overrideRentgrata=!0),e.onSstClose&&(c.onSstClose=e.onSstClose)),e.position&&(c.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),c.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),c.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),c.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(c),c instanceof ql&&(ou.meChat=c),c instanceof nu&&(ou.utilitiesChat=c)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),ou.meChat=null)}static async handleBuildingslug(e,t,n,i){if(n)return void e.setAttribute("buildingSlug",n);if(this.mutationObserver)return;if(!t)return;const r=await iu(t);if(r){const e={...i,organization:t,building:r};this.start(e,!1)}this.previousUrl=window.location.href,document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,iu(t).then(e=>{if(!e)return;const n={...i,organization:t,building:e};this.start(n,!1)}))})},!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,t=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,n=await r().get(t,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&Ai({logType:n&&n.data?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:e,orgSlug:this.orgSlug,givenBuildingSlug:null,reason:n&&n.data?null:"No match found"}}),!n||!n.data)return;const i={organization:this.orgSlug,building:n.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(i,!1)}static async calculateBuildingSlugForLogging(e){const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&Ai({logType:i&&i.data===e?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i&&i.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:i&&i.data===e?null:i&&!i.data?"No match found":i&&i.data!==e?"Mismatch":"No match found"}}),i&&i.data}}var au;ou.meChat=null,ou.healthChat=null,ou.utilitiesChat=null,ou.orgSlug="",ou.mutationObserver=null,ou.previousUrl="",ou.hasBuildingSlug=null,ou.brandColor="",ou.backgroundColor="",ou.healthcareId="",ou.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(au||(au={}));const su=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{au as WidgetType,ou as default};
7231
+ `,iu([ue({type:String})],ru.prototype,"orgSlug",void 0),iu([ue({type:Number})],ru.prototype,"right",void 0),iu([ue({type:Number})],ru.prototype,"bottom",void 0),iu([ue({type:Number})],ru.prototype,"top",void 0),iu([ue({type:Number})],ru.prototype,"left",void 0),iu([ce()],ru.prototype,"launcher",void 0),iu([ce()],ru.prototype,"currentLeadSource",void 0),iu([ce()],ru.prototype,"displayPubnubChat",void 0),iu([ce()],ru.prototype,"myPubnub",void 0),iu([ce()],ru.prototype,"requiresConsent",void 0),iu([ce()],ru.prototype,"privacyPolicyUrl",void 0),iu([ce()],ru.prototype,"isLoading",void 0),ru=iu([se("utilities-chat")],ru);const ou=async e=>{const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":e}});return Math.random()<.2&&Ai({logType:i&&i.data?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:e,givenBuildingSlug:null,reason:i&&i.data?null:"No match found"}}),i.data},au=async(e,t=5e3)=>new Promise((n,i)=>{const r=new MutationObserver((t,i)=>{const r=document.getElementById(e);r&&(i.disconnect(),n(r))});r.observe(document.body,{childList:!0,subtree:!0});const o=setTimeout(()=>{r.disconnect(),i(new Error(`Element ${e} did not appear within ${t}ms`))},t),a=document.querySelector(e);a&&(clearTimeout(o),r.disconnect(),n(a))});class su{static healthcareStart(e,t=!0){var n,i,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),uu();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","dialog"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("aria-describedby","aria-describe-info"),a.setAttribute("aria-modal","true"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(n=e.right)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("bottom",(null===(i=e.bottom)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("top",(null===(r=e.top)||void 0===r?void 0:r.toString())||"unset"),a.setAttribute("left",(null===(o=e.left)||void 0===o?void 0:o.toString())||"unset"),document.body.appendChild(a),su.healthChat=a}static start(e,t=!0){var n,i,r,o,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization,this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.right,bottom:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.bottom,top:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.top,left:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.left}),uu();let c=null;switch(e.widgetType){case lu.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case lu.Default:c=document.createElement("me-chat");break;case lu.Utilities:c=document.createElement("utilities-chat");break;default:c=document.createElement("me-chat")}if(!c)throw new Error("Invalid widget type");c.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization),c.setAttribute("widgetType",e.widgetType||lu.Default),c.setAttribute("class","meetelise-chat"),c.setAttribute("role","dialog"),c.setAttribute("aria-label","EliseAI Widget"),c.setAttribute("aria-describedby","aria-describe-info"),c.setAttribute("aria-modal","true"),e.brandColor&&(this.brandColor=e.brandColor,c.setAttribute("primaryColor",((e,t)=>{const n=Be(e),i=0,r=0,o=0,a={r:n.r+Math.round((i-n.r)*t),g:n.g+Math.round((r-n.g)*t),b:n.b+Math.round((o-n.b)*t)};return je(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),c instanceof Vl&&(this.handleBuildingslug(c,e.organization,e.building,e),e.launcherStyles&&(c.launcherStyles=e.launcherStyles),e.mobileStyles&&(c.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(c.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await au("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),c.overrideRentgrata=!0),e.onSstClose&&(c.onSstClose=e.onSstClose)),e.position&&(c.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),c.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),c.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),c.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(c),c instanceof Vl&&(su.meChat=c),c instanceof ru&&(su.utilitiesChat=c)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),su.meChat=null)}static async handleBuildingslug(e,t,n,i){if(n)return void e.setAttribute("buildingSlug",n);if(this.mutationObserver)return;if(!t)return;const r=await ou(t);if(r){const e={...i,organization:t,building:r};this.start(e,!1)}this.previousUrl=window.location.href,document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,ou(t).then(e=>{if(!e)return;const n={...i,organization:t,building:e};this.start(n,!1)}))})},!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,t=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,n=await r().get(t,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&Ai({logType:n&&n.data?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:e,orgSlug:this.orgSlug,givenBuildingSlug:null,reason:n&&n.data?null:"No match found"}}),!n||!n.data)return;const i={organization:this.orgSlug,building:n.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(i,!1)}static async calculateBuildingSlugForLogging(e){const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&Ai({logType:i&&i.data===e?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i&&i.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:i&&i.data===e?null:i&&!i.data?"No match found":i&&i.data!==e?"Mismatch":"No match found"}}),i&&i.data}}var lu;su.meChat=null,su.healthChat=null,su.utilitiesChat=null,su.orgSlug="",su.mutationObserver=null,su.previousUrl="",su.hasBuildingSlug=null,su.brandColor="",su.backgroundColor="",su.healthcareId="",su.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(lu||(lu={}));const uu=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{lu as WidgetType,su as default};