@meetelise/chat 1.40.2 → 1.40.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import "./tour-type-option.ts";
3
3
  import "./date-picker.ts";
4
4
  import "./time-picker.ts";
5
5
  import "../me-select.ts";
6
+ import { TourAvailabilityResponse, TourAvailabilityResponseRankOrderedSupportedTourTypesEnum } from "../../types/rest-sdk.types";
6
7
  import { MESelect } from "../me-select";
7
8
  import { LabeledOption } from "../../fetchBuildingInfo";
8
9
  export declare class TourScheduler extends LitElement {
@@ -14,6 +15,7 @@ export declare class TourScheduler extends LitElement {
14
15
  selfGuidedToursTypeOffered: string;
15
16
  selfGuidedTourEnabled: boolean;
16
17
  escortedToursLink: string;
18
+ escortedToursTypeOffered: string;
17
19
  virtualToursLink: string;
18
20
  virtualToursTypeOffered: string;
19
21
  orgSlug: string;
@@ -56,6 +58,8 @@ export declare class TourScheduler extends LitElement {
56
58
  leadSourceInputValue: string;
57
59
  errorGettingAvailabilities: boolean;
58
60
  _setAvailabilities: () => Promise<void>;
61
+ _getHighestRankedTourType: (availabilities: TourAvailabilityResponse) => TourAvailabilityResponseRankOrderedSupportedTourTypesEnum;
62
+ _getTourTypeOffered: (tourType: TourType) => string | null;
59
63
  firstUpdated: () => Promise<void>;
60
64
  protected willUpdate: (_changedProperties: PropertyValueMap<{
61
65
  tourType: TourType;
@@ -29,6 +29,7 @@ export declare class Launcher extends LitElement {
29
29
  leadSources: string[];
30
30
  currentLeadSource: string;
31
31
  escortedToursLink: string;
32
+ escortedToursTypeOffered: string;
32
33
  virtualToursLink: string;
33
34
  virtualToursTypeOffered: string;
34
35
  hasChatEnabledDesktop: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.40.2",
3
+ "version": "1.40.3",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -1179,7 +1179,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
1179
1179
  gap: 12px;
1180
1180
  align-items: center;
1181
1181
  }
1182
- `;class wn{constructor(e,t,i,n){this.org=e,this.building=t,this.chatId=i,this.incomingProcessedLeadSource=n,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:Cn(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const Cn=()=>{var e,t,i,n,o,r;try{const n=new URL(window.location.href).searchParams,o=null!==(i=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==i?i:null,r=n.get("switch_cls[id]"),a=n.get("ilm");return{entrataCampaignSource:r,realpageCampaignSource:a,utmCampaignSource:n.get("utm_source"),yardiCampaignSource:o,bozzutoAdSource:yi("bozzuto_ad_source")}}catch(e){console.warn(`Couldnt get campaign sources from url, error: ${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 i=t.contentWindow.URL;if(!i)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new i(window.location.href).searchParams,s=null!==(r=null===(o=null===(n=window.RCTPCampaign)||void 0===n?void 0:n.CampaignDetails)||void 0===o?void 0:o.Source)&&void 0!==r?r:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:yi("bozzuto_ad_source")}}};var xn;!function(e){e.error="error",e.info="info",e.warn="warn"}(xn||(xn={}));const An=async({logType:e,buildingSlug:i,orgSlug:n,logTitle:o,logData:r})=>{await t().post("https://app.meetelise.com/platformApi/webchat/logging",{...r},{headers:{"Content-Type":"application/json","building-slug":null!=i?i:"","org-slug":null!=n?n:"","log-type":null!=e?e:xn.error,"log-title":o.toUpperCase().replace(/\s/g,"_")}})},Sn=async({params:e,sampleRate:i})=>{try{if(Math.random()>=i)return;await t().post("https://app.meetelise.com/platformApi/webchat/log/signal",{...e,website_origin:window.location.origin,website_search:window.location.search})}catch(e){console.warn(e)}};function kn(){return Tn()?function(){const e=window.location.search,t={};return e.split("?").slice(1).join("&").split("&").forEach((e=>{const[i,n]=e.split("=");i&&n&&(t[decodeURIComponent(i)]=decodeURIComponent(n))})),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),i=e.has("utm_source");if(t&&!i){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const Tn=()=>(window.location.search.match(/\?/g)||[]).length>1;var En=i(8367),_n=i.n(En);function On(e){return"avb"===e?"AVB Company Website":"windsor"===e?"Windsorcommunities.com":"property-website"}const Pn=async(e,i=!1)=>{const n=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${i}`;try{return(await t().get(n)).data.is_enabled}catch(e){return!1}};var Nn,Mn,In;!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Nn||(Nn={})),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"}(Mn||(Mn={})),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"}(In||(In={}));const Dn=(e,t)=>"self"===e?!["SCHEDULED_BY_ME_MANAGED_BY_ME","SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE"].includes(t):"virtual"!==e||!["SCHEDULED_BY_ME_MANAGED_BY_CLIENT"].includes(t);async function Un(e,i){var n;const o=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${i}/v2`,r=(await t().get(o)).data;try{r.welcomeMessage=Ln(null!==(n=r.welcomeMessage)&&void 0!==n?n:"",r.userFirstName)}catch(e){console.error(e)}return r}const Ln=(e,t)=>e.replace(/elise/gi,t);var Rn=i(6420),Bn=i(5616);function jn(e,t,i){var n=function(e,t,i){if(i&&!i.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(i?[i.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,i.timeZone,i.locale);return n.formatToParts?function(e,t){for(var i=e.formatToParts(t),n=i.length-1;n>=0;--n)if("timeZoneName"===i[n].type)return i[n].value}(n,t):function(e,t){var i=e.format(t).replace(/\u200E/g,""),n=/ [\w-+ ]+$/.exec(i);return n?n[0].substr(1):""}(n,t)}var Hn={year:0,month:1,day:2,hour:3,minute:4,second:5},Fn={};function $n(e,t,i,n,o,r,a){var s=new Date(0);return s.setUTCFullYear(e,t,i),s.setUTCHours(n,o,r,a),s}var zn=36e5,Qn={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Gn(e,t,i){var n,o,r;if(!e)return 0;if(n=Qn.timezoneZ.exec(e))return 0;if(n=Qn.timezoneHH.exec(e))return Wn(r=parseInt(n[1],10))?-r*zn:NaN;if(n=Qn.timezoneHHMM.exec(e)){r=parseInt(n[2],10);var a=parseInt(n[3],10);return Wn(r,a)?(o=Math.abs(r)*zn+6e4*a,"+"===n[1]?-o:o):NaN}if(function(e){if(Vn[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Vn[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var s=i?t:function(e){return $n(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=qn(s,e),u=i?l:function(e,t,i){var n=e.getTime()-t,o=qn(new Date(n),i);if(t===o)return t;n-=o-t;var r=qn(new Date(n),i);return o===r?o:Math.max(o,r)}(t,l,e);return-u}return NaN}function qn(e,t){var i=function(e,t){var i=function(e){if(!Fn[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")),i="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;Fn[e]=i?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 Fn[e]}(t);return i.formatToParts?function(e,t){try{for(var i=e.formatToParts(t),n=[],o=0;o<i.length;o++){var r=Hn[i[o].type];r>=0&&(n[r]=parseInt(i[o].value,10))}return n}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(i,e):function(e,t){var i=e.format(t),n=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(i);return[n[3],n[1],n[2],n[4],n[5],n[6]]}(i,e)}(e,t),n=$n(i[0],i[1]-1,i[2],i[3]%24,i[4],i[5],0).getTime(),o=e.getTime(),r=o%1e3;return n-(o-(r>=0?r:1e3+r))}function Wn(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var Vn={},Yn={X:function(e,t,i,n){var o=Kn(n.timeZone,e);if(0===o)return"Z";switch(t){case"X":return Jn(o);case"XXXX":case"XX":return Zn(o);default:return Zn(o,":")}},x:function(e,t,i,n){var o=Kn(n.timeZone,e);switch(t){case"x":return Jn(o);case"xxxx":case"xx":return Zn(o);default:return Zn(o,":")}},O:function(e,t,i,n){var o=Kn(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t){var i=e>0?"-":"+",n=Math.abs(e),o=Math.floor(n/60),r=n%60;if(0===r)return i+String(o);return i+String(o)+":"+Xn(r,2)}(o);default:return"GMT"+Zn(o,":")}},z:function(e,t,i,n){switch(t){case"z":case"zz":case"zzz":return jn("short",e,n);default:return jn("long",e,n)}}};function Kn(e,t){var i=e?Gn(e,t,!0)/6e4:t.getTimezoneOffset();if(Number.isNaN(i))throw new RangeError("Invalid time zone specified: "+e);return i}function Xn(e,t){for(var i=e<0?"-":"",n=Math.abs(e).toString();n.length<t;)n="0"+n;return i+n}function Zn(e,t){var i=t||"",n=e>0?"-":"+",o=Math.abs(e);return n+Xn(Math.floor(o/60),2)+i+Xn(Math.floor(o%60),2)}function Jn(e,t){return e%60==0?(e>0?"-":"+")+Xn(Math.abs(e)/60,2):Zn(e,t)}const eo=Yn;var to=i(2084),io=i(3561),no=36e5,oo={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 ro(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 i=t||{},n=null==i.additionalDigits?2:to(i.additionalDigits);if(2!==n&&1!==n&&0!==n)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 o=ao(e),r=so(o.date,n),a=r.year,s=r.restDateString,l=lo(s,a);if(isNaN(l))return new Date(NaN);if(l){var u,c=l.getTime(),d=0;if(o.time&&(d=uo(o.time),isNaN(d)))return new Date(NaN);if(o.timeZone||i.timeZone){if(u=Gn(o.timeZone||i.timeZone,new Date(c+d)),isNaN(u))return new Date(NaN)}else u=io(new Date(c+d)),u=io(new Date(c+d+u));return new Date(c+d+u)}return new Date(NaN)}function ao(e){var t,i={},n=oo.dateTimePattern.exec(e);if(n?(i.date=n[1],t=n[3]):(n=oo.datePattern.exec(e))?(i.date=n[1],t=n[2]):(i.date=null,t=e),t){var o=oo.timeZone.exec(t);o?(i.time=t.replace(o[1],""),i.timeZone=o[1].trim()):i.time=t}return i}function so(e,t){var i,n=oo.YYY[t],o=oo.YYYYY[t];if(i=oo.YYYY.exec(e)||o.exec(e)){var r=i[1];return{year:parseInt(r,10),restDateString:e.slice(r.length)}}if(i=oo.YY.exec(e)||n.exec(e)){var a=i[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}function lo(e,t){if(null===t)return null;var i,n,o,r;if(0===e.length)return(n=new Date(0)).setUTCFullYear(t),n;if(i=oo.MM.exec(e))return n=new Date(0),go(t,o=parseInt(i[1],10)-1)?(n.setUTCFullYear(t,o),n):new Date(NaN);if(i=oo.DDD.exec(e)){n=new Date(0);var a=parseInt(i[1],10);return function(e,t){if(t<1)return!1;var i=fo(e);return!(i&&t>366)&&!(!i&&t>365)}(t,a)?(n.setUTCFullYear(t,0,a),n):new Date(NaN)}if(i=oo.MMDD.exec(e)){n=new Date(0),o=parseInt(i[1],10)-1;var s=parseInt(i[2],10);return go(t,o,s)?(n.setUTCFullYear(t,o,s),n):new Date(NaN)}if(i=oo.Www.exec(e))return mo(0,r=parseInt(i[1],10)-1)?co(t,r):new Date(NaN);if(i=oo.WwwD.exec(e)){r=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return mo(0,r,l)?co(t,r,l):new Date(NaN)}return null}function uo(e){var t,i,n;if(t=oo.HH.exec(e))return bo(i=parseFloat(t[1].replace(",",".")))?i%24*no:NaN;if(t=oo.HHMM.exec(e))return bo(i=parseInt(t[1],10),n=parseFloat(t[2].replace(",",".")))?i%24*no+6e4*n:NaN;if(t=oo.HHMMSS.exec(e)){i=parseInt(t[1],10),n=parseInt(t[2],10);var o=parseFloat(t[3].replace(",","."));return bo(i,n,o)?i%24*no+6e4*n+1e3*o:NaN}return null}function co(e,t,i){t=t||0,i=i||0;var n=new Date(0);n.setUTCFullYear(e,0,4);var o=7*t+i+1-(n.getUTCDay()||7);return n.setUTCDate(n.getUTCDate()+o),n}var ho=[31,28,31,30,31,30,31,31,30,31,30,31],po=[31,29,31,30,31,30,31,31,30,31,30,31];function fo(e){return e%400==0||e%4==0&&e%100!=0}function go(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var n=fo(e);if(n&&i>po[t])return!1;if(!n&&i>ho[t])return!1}return!0}function mo(e,t,i){return!(t<0||t>52||null!=i&&(i<0||i>6))}function bo(e,t,i){return!(null!=e&&(e<0||e>=25)||null!=t&&(t<0||t>=60)||null!=i&&(i<0||i>=60))}var vo=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function yo(e,t,i,n){var o=Rn(n);return o.timeZone=t,o.originalDate=e,function(e,t,i){var n=String(t),o=i||{},r=n.match(vo);if(r){var a=ro(o.originalDate||e,o);n=r.reduce((function(e,t){if("'"===t[0])return e;var i=e.indexOf(t),n="'"===e[i-1],r=e.replace(t,"'"+eo[t[0]](a,t,null,o)+"'");return n?r.substring(0,i-1)+r.substring(i+1):r}),n)}return Bn(e,n,o)}(function(e,t,i){var n=ro(e,void 0),o=Gn(t,n,!0),r=new Date(n.getTime()-o),a=new Date(0);return a.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),a.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),a}(e,t),i,o)}var wo=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Co=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.virtualToursLink="",this.virtualToursTypeOffered="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.leadSourceClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[xo.Guided]:!0,[xo.Self]:!0,[xo.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=Ie,this.backgroundColor=De,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this._setAvailabilities=async()=>{var e,t,i,n;try{const[o,r]=await Promise.all([Pn(this.buildingId,this.hasDynamicSchedulingEnabled),Yi()]);this.shouldAllowScheduling=o,this.shouldAllowScheduleLoading=!1,this.calendarTimeZone=await(async e=>{var t;return null!==(t=(await Wi(e)).calendarTimeZone)&&void 0!==t?t:Intl.DateTimeFormat().resolvedOptions().timeZone})(this.buildingId),An({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:r,logType:xn.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const a=Object.values(r).every((e=>!1===e)),s=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(a&&s)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void An({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:xn.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.shouldShowTourType={[xo.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&(r[xo.Guided]||!!this.escortedToursLink),[xo.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&(r[xo.Self]||!!this.sgtUrl),[xo.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&(r[xo.Virtual]||!!this.virtualToursLink)};const l=1===Object.values(this.shouldShowTourType).reduce(((e,t)=>!0===t?e+1:e),0),u=await Wi(this.buildingId),c=null===(e=u.rankOrderedSupportedTourTypes)||void 0===e?void 0:e[0],d=c?null===(i=null===(t=u.availability)||void 0===t?void 0:t[c])||void 0===i?void 0:i.availableTourStartTimes:[],h=null==d?void 0:d[0];if(c&&h&&c!==Ti.Unknown&&c!==Ti.MediaTour&&(this.selectedDate=pi("string"==typeof h?Ni(h):h),this.tourType=So[c],this.selectedTime="string"==typeof h?Xi(h):{datetime:$t(n=h,"yyyy-MM-dd'T'HH:mm:ss"),offset:$t(n,"xxx")}),l&&(this.tourType=Object.keys(this.shouldShowTourType).find((e=>this.shouldShowTourType[e]))),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,An({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:xn.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.firstUpdated=async()=>{await this._setAvailabilities()},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const i=e.target.selectionStart;if(1!==e.key.length||Pe(e)){if("Backspace"===e.key){if(Pe(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,n=this.phoneNumber.slice(0,i).replace(/\D/g,""),o=this.phoneNumber.slice(i).replace(/\D/g,""),r=`${n.slice(0,-1)}${o}`;this.phoneNumber=Ee(r),this.phoneInput.value=this.phoneNumber;const a=i-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Pe(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,i).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,n=i-e>-1?i-e:0;this.phoneInput.setSelectionRange(n,n)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(i).split(/\d+/)[0].length||0)+1,t=i+e<this.phoneNumber.length?i+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,i)+e.key+this.phoneNumber.slice(i);this.phoneNumber=Ee(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 i=this.phoneInput.selectionStart,n=i?this.phoneInput.value.slice(i).replace(/\D/g,""):"";this.phoneNumber=Ee(this.phoneInput.value);let o=0,r=n.length;for(;r;)(null===(t=this.phoneNumber.at(o))||void 0===t?void 0:t.match(/\d/))&&r--,o++;const a=this.phoneInput.value.length-o+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,i;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&(null===(i=this.emailInput)||void 0===i?void 0:i.value.includes("@"))&&!!this.phoneNumber&&14===this.phoneNumber.length&&wi(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,i]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(i)]},this.submit=async()=>{var e,i,n,o,r,a,s,l,u,c,d,h,p,f,g,m;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const b=new URLSearchParams(window.location.search);let v=null;v=this.selectedLeadSource&&this.selectedLeadSource.value&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:this.leadSourceInputValue&&this.leadSourceInputValue.length>0?this.leadSourceInputValue:this.currentLeadSource;const y=[...new Set(v?[v,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=v,cn("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(e=this.phoneNumber.match(/\d/g))||void 0===e?void 0:e.join("")}`,firstName:null!==(n=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==n?n:this.firstNameInputValue,lastName:null!==(r=null===(o=this.lastNameInput)||void 0===o?void 0:o.value)&&void 0!==r?r:this.lastNameInputValue,tourType:ko[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:y.find((e=>"property-website"!==e))||null});const w={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:ko[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(v?[v,On(this.orgSlug)]:[On(this.orgSlug)])],query_params:Object.fromEntries(b.entries()),conversation_tracking_id:null===(d=this.leadSourceClient)||void 0===d?void 0:d.chatId};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",w,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),null===(h=this.leadSourceClient)||void 0===h||h.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,i=(null===(f=null===(p=t.response)||void 0===p?void 0:p.data)||void 0===f?void 0:f.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[$t(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[$t(this.selectedDate,"yyyy-MM-dd")]=e.filter((e=>e!==this.selectedTime)))}}else{if(409===(null===(g=t.response)||void 0===g?void 0:g.status)&&!this.promptForReschedule&&"User already has a tour scheduled for this building"===i)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);if(409===(null===(m=t.response)||void 0===m?void 0:m.status)&&!this.promptForReschedule)return this.isSubmitting=!1,this.tourIsBooked=!1,qi(),this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType],this.buildingId),void alert("This timeslot is no longer available. Please select a different time.")}alert(i),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>R` <action-confirm-button
1182
+ `;class wn{constructor(e,t,i,n){this.org=e,this.building=t,this.chatId=i,this.incomingProcessedLeadSource=n,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:Cn(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const Cn=()=>{var e,t,i,n,o,r;try{const n=new URL(window.location.href).searchParams,o=null!==(i=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==i?i:null,r=n.get("switch_cls[id]"),a=n.get("ilm");return{entrataCampaignSource:r,realpageCampaignSource:a,utmCampaignSource:n.get("utm_source"),yardiCampaignSource:o,bozzutoAdSource:yi("bozzuto_ad_source")}}catch(e){console.warn(`Couldnt get campaign sources from url, error: ${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 i=t.contentWindow.URL;if(!i)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new i(window.location.href).searchParams,s=null!==(r=null===(o=null===(n=window.RCTPCampaign)||void 0===n?void 0:n.CampaignDetails)||void 0===o?void 0:o.Source)&&void 0!==r?r:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:yi("bozzuto_ad_source")}}};var xn;!function(e){e.error="error",e.info="info",e.warn="warn"}(xn||(xn={}));const An=async({logType:e,buildingSlug:i,orgSlug:n,logTitle:o,logData:r})=>{await t().post("https://app.meetelise.com/platformApi/webchat/logging",{...r},{headers:{"Content-Type":"application/json","building-slug":null!=i?i:"","org-slug":null!=n?n:"","log-type":null!=e?e:xn.error,"log-title":o.toUpperCase().replace(/\s/g,"_")}})},Sn=async({params:e,sampleRate:i})=>{try{if(Math.random()>=i)return;await t().post("https://app.meetelise.com/platformApi/webchat/log/signal",{...e,website_origin:window.location.origin,website_search:window.location.search})}catch(e){console.warn(e)}};function kn(){return Tn()?function(){const e=window.location.search,t={};return e.split("?").slice(1).join("&").split("&").forEach((e=>{const[i,n]=e.split("=");i&&n&&(t[decodeURIComponent(i)]=decodeURIComponent(n))})),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),i=e.has("utm_source");if(t&&!i){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const Tn=()=>(window.location.search.match(/\?/g)||[]).length>1;var En=i(8367),_n=i.n(En);function On(e){return"avb"===e?"AVB Company Website":"windsor"===e?"Windsorcommunities.com":"property-website"}const Pn=async(e,i=!1)=>{const n=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${i}`;try{return(await t().get(n)).data.is_enabled}catch(e){return!1}};var Nn,Mn,In;!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Nn||(Nn={})),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"}(Mn||(Mn={})),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"}(In||(In={}));const Dn=(e,t)=>"self"===e?!["SCHEDULED_BY_ME_MANAGED_BY_ME","SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE"].includes(t):"virtual"===e&&!["SCHEDULED_BY_ME_MANAGED_BY_CLIENT"].includes(t);async function Un(e,i){var n;const o=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${i}/v2`,r=(await t().get(o)).data;try{r.welcomeMessage=Ln(null!==(n=r.welcomeMessage)&&void 0!==n?n:"",r.userFirstName)}catch(e){console.error(e)}return r}const Ln=(e,t)=>e.replace(/elise/gi,t);var Rn=i(6420),Bn=i(5616);function jn(e,t,i){var n=function(e,t,i){if(i&&!i.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(i?[i.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,i.timeZone,i.locale);return n.formatToParts?function(e,t){for(var i=e.formatToParts(t),n=i.length-1;n>=0;--n)if("timeZoneName"===i[n].type)return i[n].value}(n,t):function(e,t){var i=e.format(t).replace(/\u200E/g,""),n=/ [\w-+ ]+$/.exec(i);return n?n[0].substr(1):""}(n,t)}var Hn={year:0,month:1,day:2,hour:3,minute:4,second:5},Fn={};function $n(e,t,i,n,o,r,a){var s=new Date(0);return s.setUTCFullYear(e,t,i),s.setUTCHours(n,o,r,a),s}var zn=36e5,Qn={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Gn(e,t,i){var n,o,r;if(!e)return 0;if(n=Qn.timezoneZ.exec(e))return 0;if(n=Qn.timezoneHH.exec(e))return Wn(r=parseInt(n[1],10))?-r*zn:NaN;if(n=Qn.timezoneHHMM.exec(e)){r=parseInt(n[2],10);var a=parseInt(n[3],10);return Wn(r,a)?(o=Math.abs(r)*zn+6e4*a,"+"===n[1]?-o:o):NaN}if(function(e){if(Vn[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Vn[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var s=i?t:function(e){return $n(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=qn(s,e),u=i?l:function(e,t,i){var n=e.getTime()-t,o=qn(new Date(n),i);if(t===o)return t;n-=o-t;var r=qn(new Date(n),i);return o===r?o:Math.max(o,r)}(t,l,e);return-u}return NaN}function qn(e,t){var i=function(e,t){var i=function(e){if(!Fn[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")),i="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;Fn[e]=i?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 Fn[e]}(t);return i.formatToParts?function(e,t){try{for(var i=e.formatToParts(t),n=[],o=0;o<i.length;o++){var r=Hn[i[o].type];r>=0&&(n[r]=parseInt(i[o].value,10))}return n}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(i,e):function(e,t){var i=e.format(t),n=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(i);return[n[3],n[1],n[2],n[4],n[5],n[6]]}(i,e)}(e,t),n=$n(i[0],i[1]-1,i[2],i[3]%24,i[4],i[5],0).getTime(),o=e.getTime(),r=o%1e3;return n-(o-(r>=0?r:1e3+r))}function Wn(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var Vn={},Yn={X:function(e,t,i,n){var o=Kn(n.timeZone,e);if(0===o)return"Z";switch(t){case"X":return Jn(o);case"XXXX":case"XX":return Zn(o);default:return Zn(o,":")}},x:function(e,t,i,n){var o=Kn(n.timeZone,e);switch(t){case"x":return Jn(o);case"xxxx":case"xx":return Zn(o);default:return Zn(o,":")}},O:function(e,t,i,n){var o=Kn(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t){var i=e>0?"-":"+",n=Math.abs(e),o=Math.floor(n/60),r=n%60;if(0===r)return i+String(o);return i+String(o)+":"+Xn(r,2)}(o);default:return"GMT"+Zn(o,":")}},z:function(e,t,i,n){switch(t){case"z":case"zz":case"zzz":return jn("short",e,n);default:return jn("long",e,n)}}};function Kn(e,t){var i=e?Gn(e,t,!0)/6e4:t.getTimezoneOffset();if(Number.isNaN(i))throw new RangeError("Invalid time zone specified: "+e);return i}function Xn(e,t){for(var i=e<0?"-":"",n=Math.abs(e).toString();n.length<t;)n="0"+n;return i+n}function Zn(e,t){var i=t||"",n=e>0?"-":"+",o=Math.abs(e);return n+Xn(Math.floor(o/60),2)+i+Xn(Math.floor(o%60),2)}function Jn(e,t){return e%60==0?(e>0?"-":"+")+Xn(Math.abs(e)/60,2):Zn(e,t)}const eo=Yn;var to=i(2084),io=i(3561),no=36e5,oo={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 ro(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 i=t||{},n=null==i.additionalDigits?2:to(i.additionalDigits);if(2!==n&&1!==n&&0!==n)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 o=ao(e),r=so(o.date,n),a=r.year,s=r.restDateString,l=lo(s,a);if(isNaN(l))return new Date(NaN);if(l){var u,c=l.getTime(),d=0;if(o.time&&(d=uo(o.time),isNaN(d)))return new Date(NaN);if(o.timeZone||i.timeZone){if(u=Gn(o.timeZone||i.timeZone,new Date(c+d)),isNaN(u))return new Date(NaN)}else u=io(new Date(c+d)),u=io(new Date(c+d+u));return new Date(c+d+u)}return new Date(NaN)}function ao(e){var t,i={},n=oo.dateTimePattern.exec(e);if(n?(i.date=n[1],t=n[3]):(n=oo.datePattern.exec(e))?(i.date=n[1],t=n[2]):(i.date=null,t=e),t){var o=oo.timeZone.exec(t);o?(i.time=t.replace(o[1],""),i.timeZone=o[1].trim()):i.time=t}return i}function so(e,t){var i,n=oo.YYY[t],o=oo.YYYYY[t];if(i=oo.YYYY.exec(e)||o.exec(e)){var r=i[1];return{year:parseInt(r,10),restDateString:e.slice(r.length)}}if(i=oo.YY.exec(e)||n.exec(e)){var a=i[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}function lo(e,t){if(null===t)return null;var i,n,o,r;if(0===e.length)return(n=new Date(0)).setUTCFullYear(t),n;if(i=oo.MM.exec(e))return n=new Date(0),go(t,o=parseInt(i[1],10)-1)?(n.setUTCFullYear(t,o),n):new Date(NaN);if(i=oo.DDD.exec(e)){n=new Date(0);var a=parseInt(i[1],10);return function(e,t){if(t<1)return!1;var i=fo(e);return!(i&&t>366)&&!(!i&&t>365)}(t,a)?(n.setUTCFullYear(t,0,a),n):new Date(NaN)}if(i=oo.MMDD.exec(e)){n=new Date(0),o=parseInt(i[1],10)-1;var s=parseInt(i[2],10);return go(t,o,s)?(n.setUTCFullYear(t,o,s),n):new Date(NaN)}if(i=oo.Www.exec(e))return mo(0,r=parseInt(i[1],10)-1)?co(t,r):new Date(NaN);if(i=oo.WwwD.exec(e)){r=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return mo(0,r,l)?co(t,r,l):new Date(NaN)}return null}function uo(e){var t,i,n;if(t=oo.HH.exec(e))return bo(i=parseFloat(t[1].replace(",",".")))?i%24*no:NaN;if(t=oo.HHMM.exec(e))return bo(i=parseInt(t[1],10),n=parseFloat(t[2].replace(",",".")))?i%24*no+6e4*n:NaN;if(t=oo.HHMMSS.exec(e)){i=parseInt(t[1],10),n=parseInt(t[2],10);var o=parseFloat(t[3].replace(",","."));return bo(i,n,o)?i%24*no+6e4*n+1e3*o:NaN}return null}function co(e,t,i){t=t||0,i=i||0;var n=new Date(0);n.setUTCFullYear(e,0,4);var o=7*t+i+1-(n.getUTCDay()||7);return n.setUTCDate(n.getUTCDate()+o),n}var ho=[31,28,31,30,31,30,31,31,30,31,30,31],po=[31,29,31,30,31,30,31,31,30,31,30,31];function fo(e){return e%400==0||e%4==0&&e%100!=0}function go(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var n=fo(e);if(n&&i>po[t])return!1;if(!n&&i>ho[t])return!1}return!0}function mo(e,t,i){return!(t<0||t>52||null!=i&&(i<0||i>6))}function bo(e,t,i){return!(null!=e&&(e<0||e>=25)||null!=t&&(t<0||t>=60)||null!=i&&(i<0||i>=60))}var vo=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function yo(e,t,i,n){var o=Rn(n);return o.timeZone=t,o.originalDate=e,function(e,t,i){var n=String(t),o=i||{},r=n.match(vo);if(r){var a=ro(o.originalDate||e,o);n=r.reduce((function(e,t){if("'"===t[0])return e;var i=e.indexOf(t),n="'"===e[i-1],r=e.replace(t,"'"+eo[t[0]](a,t,null,o)+"'");return n?r.substring(0,i-1)+r.substring(i+1):r}),n)}return Bn(e,n,o)}(function(e,t,i){var n=ro(e,void 0),o=Gn(t,n,!0),r=new Date(n.getTime()-o),a=new Date(0);return a.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),a.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),a}(e,t),i,o)}var wo=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Co=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.buildingName="",this.tourType=null,this.shouldShowTourType={[xo.Guided]:!0,[xo.Self]:!0,[xo.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=Ie,this.backgroundColor=De,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this._setAvailabilities=async()=>{var e,t,i;try{const[n,o]=await Promise.all([Pn(this.buildingId,this.hasDynamicSchedulingEnabled),Yi()]);this.shouldAllowScheduling=n,this.shouldAllowScheduleLoading=!1,this.calendarTimeZone=await(async e=>{var t;return null!==(t=(await Wi(e)).calendarTimeZone)&&void 0!==t?t:Intl.DateTimeFormat().resolvedOptions().timeZone})(this.buildingId),An({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:o,logType:xn.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const r=Object.values(o).every((e=>!1===e)),a=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(r&&a)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void An({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:xn.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.shouldShowTourType={[xo.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&(o[xo.Guided]||!!this.escortedToursLink),[xo.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&(o[xo.Self]||!!this.sgtUrl),[xo.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&(o[xo.Virtual]||!!this.virtualToursLink)};const s=1===Object.values(this.shouldShowTourType).reduce(((e,t)=>!0===t?e+1:e),0),l=await Wi(this.buildingId),u=this._getHighestRankedTourType(l),c=u?null===(t=null===(e=l.availability)||void 0===e?void 0:e[u])||void 0===t?void 0:t.availableTourStartTimes:[],d=null==c?void 0:c[0];if(u&&d&&u!==Ti.Unknown&&u!==Ti.MediaTour&&(this.selectedDate=pi("string"==typeof d?Ni(d):d),this.tourType=So[u],this.selectedTime="string"==typeof d?Xi(d):{datetime:$t(i=d,"yyyy-MM-dd'T'HH:mm:ss"),offset:$t(i,"xxx")}),s&&(this.tourType=Object.keys(this.shouldShowTourType).find((e=>this.shouldShowTourType[e]))),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,An({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:xn.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this._getHighestRankedTourType=e=>{var t;const i=(null!==(t=e.rankOrderedSupportedTourTypes)&&void 0!==t?t:[]).map((t=>{var i,n;return{tourType:t,availabilities:null===(n=null===(i=e.availability)||void 0===i?void 0:i[t])||void 0===n?void 0:n.availableTourStartTimes}})).filter((e=>{if(e.tourType===Ti.Unknown||e.tourType===Ti.MediaTour)return!1;const t=So[e.tourType],i=this._getTourTypeOffered(t);return!!i&&!Dn(t,i)&&e.availabilities&&e.availabilities.length>0}));return i[0].tourType},this._getTourTypeOffered=e=>e===xo.Guided?this.escortedToursTypeOffered:e===xo.Self?this.selfGuidedToursTypeOffered:e===xo.Virtual?this.virtualToursTypeOffered:null,this.firstUpdated=async()=>{await this._setAvailabilities()},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const i=e.target.selectionStart;if(1!==e.key.length||Pe(e)){if("Backspace"===e.key){if(Pe(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,n=this.phoneNumber.slice(0,i).replace(/\D/g,""),o=this.phoneNumber.slice(i).replace(/\D/g,""),r=`${n.slice(0,-1)}${o}`;this.phoneNumber=Ee(r),this.phoneInput.value=this.phoneNumber;const a=i-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Pe(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,i).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,n=i-e>-1?i-e:0;this.phoneInput.setSelectionRange(n,n)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(i).split(/\d+/)[0].length||0)+1,t=i+e<this.phoneNumber.length?i+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,i)+e.key+this.phoneNumber.slice(i);this.phoneNumber=Ee(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 i=this.phoneInput.selectionStart,n=i?this.phoneInput.value.slice(i).replace(/\D/g,""):"";this.phoneNumber=Ee(this.phoneInput.value);let o=0,r=n.length;for(;r;)(null===(t=this.phoneNumber.at(o))||void 0===t?void 0:t.match(/\d/))&&r--,o++;const a=this.phoneInput.value.length-o+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,i;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&(null===(i=this.emailInput)||void 0===i?void 0:i.value.includes("@"))&&!!this.phoneNumber&&14===this.phoneNumber.length&&wi(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,i]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(i)]},this.submit=async()=>{var e,i,n,o,r,a,s,l,u,c,d,h,p,f,g,m;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const b=new URLSearchParams(window.location.search);let v=null;v=this.selectedLeadSource&&this.selectedLeadSource.value&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:this.leadSourceInputValue&&this.leadSourceInputValue.length>0?this.leadSourceInputValue:this.currentLeadSource;const y=[...new Set(v?[v,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=v,cn("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(e=this.phoneNumber.match(/\d/g))||void 0===e?void 0:e.join("")}`,firstName:null!==(n=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==n?n:this.firstNameInputValue,lastName:null!==(r=null===(o=this.lastNameInput)||void 0===o?void 0:o.value)&&void 0!==r?r:this.lastNameInputValue,tourType:ko[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:y.find((e=>"property-website"!==e))||null});const w={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:ko[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(v?[v,On(this.orgSlug)]:[On(this.orgSlug)])],query_params:Object.fromEntries(b.entries()),conversation_tracking_id:null===(d=this.leadSourceClient)||void 0===d?void 0:d.chatId};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",w,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),null===(h=this.leadSourceClient)||void 0===h||h.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,i=(null===(f=null===(p=t.response)||void 0===p?void 0:p.data)||void 0===f?void 0:f.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[$t(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[$t(this.selectedDate,"yyyy-MM-dd")]=e.filter((e=>e!==this.selectedTime)))}}else{if(409===(null===(g=t.response)||void 0===g?void 0:g.status)&&!this.promptForReschedule&&"User already has a tour scheduled for this building"===i)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);if(409===(null===(m=t.response)||void 0===m?void 0:m.status)&&!this.promptForReschedule)return this.isSubmitting=!1,this.tourIsBooked=!1,qi(),this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType],this.buildingId),void alert("This timeslot is no longer available. Please select a different time.")}alert(i),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>R` <action-confirm-button
1183
1183
  id="schedule-bttn"
1184
1184
  .onClick=${this.submit}
1185
1185
  .isLoading=${this.isSubmitting}
@@ -1652,7 +1652,7 @@ xmlns="http://www.w3.org/2000/svg"
1652
1652
  </div>
1653
1653
  `}
1654
1654
  </div>
1655
- `}};var xo;Co.styles=[yn,xi],wo([le({attribute:!1})],Co.prototype,"tourTypeOptions",void 0),wo([le({attribute:!0})],Co.prototype,"chatId",void 0),wo([le({type:Number})],Co.prototype,"buildingId",void 0),wo([le({attribute:!0})],Co.prototype,"buildingSlug",void 0),wo([le({attribute:!0})],Co.prototype,"sgtUrl",void 0),wo([le({attribute:!0})],Co.prototype,"selfGuidedToursTypeOffered",void 0),wo([le({attribute:!0})],Co.prototype,"selfGuidedTourEnabled",void 0),wo([le({attribute:!0})],Co.prototype,"escortedToursLink",void 0),wo([le({attribute:!0})],Co.prototype,"virtualToursLink",void 0),wo([le({attribute:!0})],Co.prototype,"virtualToursTypeOffered",void 0),wo([le({attribute:!0})],Co.prototype,"orgSlug",void 0),wo([le({attribute:!0})],Co.prototype,"hasDynamicSchedulingEnabled",void 0),wo([le({attribute:!0})],Co.prototype,"leadSourceClient",void 0),wo([le({attribute:!0})],Co.prototype,"buildingName",void 0),wo([ue()],Co.prototype,"tourType",void 0),wo([ue()],Co.prototype,"shouldShowTourType",void 0),wo([ue()],Co.prototype,"email",void 0),wo([ue()],Co.prototype,"phoneNumber",void 0),wo([ue()],Co.prototype,"availabilitiesGroupedByDay",void 0),wo([ue()],Co.prototype,"calendarTimeZone",void 0),wo([ue()],Co.prototype,"waitingForAvailabilities",void 0),wo([ue()],Co.prototype,"selectedDate",void 0),wo([ue()],Co.prototype,"selectedTime",void 0),wo([ue()],Co.prototype,"mobilePageIndex",void 0),wo([ue()],Co.prototype,"isSubmitting",void 0),wo([ue()],Co.prototype,"tourIsBooked",void 0),wo([ue()],Co.prototype,"shouldAllowScheduling",void 0),wo([ue()],Co.prototype,"shouldAllowScheduleLoading",void 0),wo([ue()],Co.prototype,"promptForReschedule",void 0),wo([ue()],Co.prototype,"canceledReschedule",void 0),wo([le({attribute:!1})],Co.prototype,"leadSources",void 0),wo([le({attribute:!0})],Co.prototype,"orgLegalName",void 0),wo([le({attribute:!0})],Co.prototype,"currentLeadSource",void 0),wo([le({attribute:!0})],Co.prototype,"featureFlagShowDropdown",void 0),wo([le({attribute:!0})],Co.prototype,"compactDesign",void 0),wo([le({attribute:!0})],Co.prototype,"primaryColor",void 0),wo([le({attribute:!0})],Co.prototype,"backgroundColor",void 0),wo([le({attribute:!0})],Co.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),wo([le({attribute:!0})],Co.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),wo([ce(".nameContainer#firstName input")],Co.prototype,"firstNameInput",void 0),wo([ce(".nameContainer#lastName input")],Co.prototype,"lastNameInput",void 0),wo([ce(".inputContainer#email input")],Co.prototype,"emailInput",void 0),wo([ce(".inputContainer#phone input")],Co.prototype,"phoneInput",void 0),wo([ce("me-select#leadSource")],Co.prototype,"selectedLeadSource",void 0),wo([ue()],Co.prototype,"firstNameInputValue",void 0),wo([ue()],Co.prototype,"lastNameInputValue",void 0),wo([ue()],Co.prototype,"leadSourceInputValue",void 0),wo([ue()],Co.prototype,"errorGettingAvailabilities",void 0),Co=wo([ae("tour-scheduler")],Co),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(xo||(xo={}));const Ao={[xo.Guided]:Ti.WithAgent,[xo.Self]:Ti.SelfGuided,[xo.Virtual]:Ti.VirtualShowing},So={[Ti.WithAgent]:xo.Guided,[Ti.SelfGuided]:xo.Self,[Ti.VirtualShowing]:xo.Virtual},ko={[xo.Guided]:"escorted-tour",[xo.Self]:"self-guided-tour",[xo.Virtual]:"live-virtual-tour"};var To;async function Eo(e){try{return(await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/ab-test-type`)).data}catch(e){return null}}!function(e){e.ConceptEmoji="Concept 2 (Blue/White)"}(To||(To={}));const _o=(e,t,i=!0,n=!1,o,r=.01)=>Sn({params:{org_slug:e,building_slug:t,is_pixel_on_site:i,is_any_webchat_showing:n,extra_data:{webchat_no_show_reason:o}},sampleRate:r}),Oo=l`
1655
+ `}};var xo;Co.styles=[yn,xi],wo([le({attribute:!1})],Co.prototype,"tourTypeOptions",void 0),wo([le({attribute:!0})],Co.prototype,"chatId",void 0),wo([le({type:Number})],Co.prototype,"buildingId",void 0),wo([le({attribute:!0})],Co.prototype,"buildingSlug",void 0),wo([le({attribute:!0})],Co.prototype,"sgtUrl",void 0),wo([le({attribute:!0})],Co.prototype,"selfGuidedToursTypeOffered",void 0),wo([le({attribute:!0})],Co.prototype,"selfGuidedTourEnabled",void 0),wo([le({attribute:!0})],Co.prototype,"escortedToursLink",void 0),wo([le({attribute:!0})],Co.prototype,"escortedToursTypeOffered",void 0),wo([le({attribute:!0})],Co.prototype,"virtualToursLink",void 0),wo([le({attribute:!0})],Co.prototype,"virtualToursTypeOffered",void 0),wo([le({attribute:!0})],Co.prototype,"orgSlug",void 0),wo([le({attribute:!0})],Co.prototype,"hasDynamicSchedulingEnabled",void 0),wo([le({attribute:!0})],Co.prototype,"leadSourceClient",void 0),wo([le({attribute:!0})],Co.prototype,"buildingName",void 0),wo([ue()],Co.prototype,"tourType",void 0),wo([ue()],Co.prototype,"shouldShowTourType",void 0),wo([ue()],Co.prototype,"email",void 0),wo([ue()],Co.prototype,"phoneNumber",void 0),wo([ue()],Co.prototype,"availabilitiesGroupedByDay",void 0),wo([ue()],Co.prototype,"calendarTimeZone",void 0),wo([ue()],Co.prototype,"waitingForAvailabilities",void 0),wo([ue()],Co.prototype,"selectedDate",void 0),wo([ue()],Co.prototype,"selectedTime",void 0),wo([ue()],Co.prototype,"mobilePageIndex",void 0),wo([ue()],Co.prototype,"isSubmitting",void 0),wo([ue()],Co.prototype,"tourIsBooked",void 0),wo([ue()],Co.prototype,"shouldAllowScheduling",void 0),wo([ue()],Co.prototype,"shouldAllowScheduleLoading",void 0),wo([ue()],Co.prototype,"promptForReschedule",void 0),wo([ue()],Co.prototype,"canceledReschedule",void 0),wo([le({attribute:!1})],Co.prototype,"leadSources",void 0),wo([le({attribute:!0})],Co.prototype,"orgLegalName",void 0),wo([le({attribute:!0})],Co.prototype,"currentLeadSource",void 0),wo([le({attribute:!0})],Co.prototype,"featureFlagShowDropdown",void 0),wo([le({attribute:!0})],Co.prototype,"compactDesign",void 0),wo([le({attribute:!0})],Co.prototype,"primaryColor",void 0),wo([le({attribute:!0})],Co.prototype,"backgroundColor",void 0),wo([le({attribute:!0})],Co.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),wo([le({attribute:!0})],Co.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),wo([ce(".nameContainer#firstName input")],Co.prototype,"firstNameInput",void 0),wo([ce(".nameContainer#lastName input")],Co.prototype,"lastNameInput",void 0),wo([ce(".inputContainer#email input")],Co.prototype,"emailInput",void 0),wo([ce(".inputContainer#phone input")],Co.prototype,"phoneInput",void 0),wo([ce("me-select#leadSource")],Co.prototype,"selectedLeadSource",void 0),wo([ue()],Co.prototype,"firstNameInputValue",void 0),wo([ue()],Co.prototype,"lastNameInputValue",void 0),wo([ue()],Co.prototype,"leadSourceInputValue",void 0),wo([ue()],Co.prototype,"errorGettingAvailabilities",void 0),Co=wo([ae("tour-scheduler")],Co),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(xo||(xo={}));const Ao={[xo.Guided]:Ti.WithAgent,[xo.Self]:Ti.SelfGuided,[xo.Virtual]:Ti.VirtualShowing},So={[Ti.WithAgent]:xo.Guided,[Ti.SelfGuided]:xo.Self,[Ti.VirtualShowing]:xo.Virtual},ko={[xo.Guided]:"escorted-tour",[xo.Self]:"self-guided-tour",[xo.Virtual]:"live-virtual-tour"};var To;async function Eo(e){try{return(await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/ab-test-type`)).data}catch(e){return null}}!function(e){e.ConceptEmoji="Concept 2 (Blue/White)"}(To||(To={}));const _o=(e,t,i=!0,n=!1,o,r=.01)=>Sn({params:{org_slug:e,building_slug:t,is_pixel_on_site:i,is_any_webchat_showing:n,extra_data:{webchat_no_show_reason:o}},sampleRate:r}),Oo=l`
1656
1656
  * {
1657
1657
  font-family: "Helvetica Neue", Arial;
1658
1658
  font-size: 14px;
@@ -4913,7 +4913,7 @@ xmlns="http://www.w3.org/2000/svg"
4913
4913
  <path d="M6 6C7.65685 6 9 4.65685 9 3C9 1.34315 7.65685 0 6 0C4.34315 0 3 1.34315 3 3C3 4.65685 4.34315 6 6 6ZM8 3C8 4.10457 7.10457 5 6 5C4.89543 5 4 4.10457 4 3C4 1.89543 4.89543 1 6 1C7.10457 1 8 1.89543 8 3Z" fill="${e}"/>
4914
4914
  <path d="M12 11C12 12 11 12 11 12H1C1 12 0 12 0 11C0 10 1 7 6 7C11 7 12 10 12 11ZM11 10.9965C10.9986 10.7497 10.8462 10.0104 10.1679 9.33211C9.51563 8.67985 8.2891 8 5.99999 8C3.71088 8 2.48435 8.67985 1.8321 9.33211C1.15375 10.0104 1.00142 10.7497 1 10.9965H11Z" fill="${e}"/>
4915
4915
  </svg>
4916
- `;var ya=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let wa=class extends oe{constructor(){super(...arguments),this.isMinimized=!1,this.mobileStyles={},this.isFirstMount=!1,this.autoOpenChatWidget=!1,this.phoneNumber="",this.buildingName="",this.chatId="",this.orgLegalName="",this.chatCallUsHeader="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.sgtUrl="",this.selfGuidedTourEnabled=!1,this.selfGuidedToursTypeOffered="",this.designConcept="",this.featureFlagShowDropdown="",this.leadSources=[],this.currentLeadSource="",this.escortedToursLink="",this.virtualToursLink="",this.virtualToursTypeOffered="",this.hasChatEnabledDesktop=!1,this.hasChatEnabledMobile=!1,this.hasEmailEnabledDesktop=!1,this.hasEmailEnabledMobile=!1,this.hasApplyNowEnabledDesktop=!1,this.hasApplyNowEnabledMobile=!1,this.applicationLink="",this.hasCallUsEnabledDesktop=!1,this.hasCallUsEnabledMobile=!1,this.hasTextUsEnabledDesktop=!1,this.hasTextUsEnabledMobile=!1,this.hasSSTEnabledDesktop=!1,this.hasSSTEnabledMobile=!1,this.tourTypeOptions=[],this.hasDynamicSchedulingEnabled=!1,this.hasPricingCalculatorEnabledDesktop=!1,this.hasPricingCalculatorEnabledMobile=!1,this.onExitChat=()=>{},this.hasHideMobileFeatures=!1,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.showTourNextToChat=!1,this.onChatTapped=()=>{},this.onClickMinimize=()=>{},this.onSstClose=ba(),this.overrideRentgrata=!1,this.launcherStyles={},this.primaryColor=Ie,this.backgroundColor=De,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",this.leadSourceClient=null,this.isEmailWindowOpen=!1,this.isCallUsWindowOpen=!1,this.isSSTWindowOpen=!1,this.isTextUsWindowOpen=!1,this.isCalculatorWindowOpen=!1,this.isMobileFeaturesExpanded=!1,this.getNumCallToActions=()=>[this.hasEmailEnabledDesktop||this.hasEmailEnabledMobile,!!this.phoneNumber&&(this.hasCallUsEnabledDesktop||this.hasCallUsEnabledMobile),this.hasSSTEnabledDesktop||this.hasSSTEnabledMobile,this.hasTextUsEnabledDesktop||this.hasTextUsEnabledMobile,this.hasApplyNowEnabledDesktop||this.hasApplyNowEnabledMobile,this.hasPricingCalculatorEnabledDesktop||this.hasPricingCalculatorEnabledMobile].filter((e=>e)).length,this.emailUsWindowRef=Ae(),this.tourSchedulerRef=Ae(),this.calculatorWindowRef=Ae(),this.updated=async()=>{this.attachOnClickToEmailUsWindow(),this.attachOnClickToSSTWindow(),this.attachOnClickToCalculatorWindow(),(this.isEmailWindowOpen||this.isCallUsWindowOpen)&&this.isSSTWindowOpen&&this.onCloseSSTWindow()},this.attachOnClickToEmailUsWindow=()=>{const e=this.emailUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseEmailWindow)},this.attachOnClickToSSTWindow=()=>{const e=this.tourSchedulerRef.value;e&&(e.onCloseClicked=this.onCloseSSTWindow)},this.attachOnClickToCalculatorWindow=()=>{const e=this.calculatorWindowRef.value;e&&(e.onCloseClicked=this.onCloseCalculatorWindow,e.onClickEmailOption=this.onClickEmailOption,e.onClickPhoneOption=this.onClickPhoneOption,e.onClickSSTOption=this.onClickSSTOption,e.onClickTextUsOption=this.onClickTextUsOption)},this.onClickEmailOption=e=>{e.preventDefault(),e.stopPropagation(),fa(),this.isEmailWindowOpen=!0},this.onCloseEmailWindow=()=>{this.isEmailWindowOpen=!1},this.onClickPhoneOption=e=>{e.preventDefault(),e.stopPropagation(),fa(),this.isCallUsWindowOpen=!0},this.onClickApplyNowOption=e=>{e.preventDefault(),e.stopPropagation(),fa(),window.open(this.applicationLink,"_blank")},this.onClickPriceCalculatorOption=e=>{e.preventDefault(),e.stopPropagation(),fa(),this.isCalculatorWindowOpen=!0},this.onClosePhoneWindow=()=>{this.isCallUsWindowOpen=!1},this.onClickSSTOption=e=>{e.preventDefault(),e.stopPropagation(),fa(),qi(),Wi(this.buildingId),this.isSSTWindowOpen=!0},this.onCloseSSTWindow=()=>{this.onSstClose(),this.isSSTWindowOpen=!1,this.showTourNextToChat&&this.dispatchEvent(new CustomEvent("closeShowTourNextToChat",{bubbles:!0}))},this.onCloseCalculatorWindow=()=>{this.isCalculatorWindowOpen=!1},this.onClickTextUsOption=e=>{e.preventDefault(),e.stopPropagation(),this.isTextUsWindowOpen=!0},this.isCallToActionWindowOpen=()=>1===[this.isEmailWindowOpen,this.isCallUsWindowOpen,this.isSSTWindowOpen,this.isTextUsWindowOpen,this.isCalculatorWindowOpen].filter((e=>e)).length,this.toggleMobileFeatures=()=>{this.isMobileFeaturesExpanded=!this.isMobileFeaturesExpanded},this.renderActionPills=()=>bi()||this.isMinimized||this.designConcept===Nn.MINIMIZED?R` ${this.hasHideMobileFeatures&&bi()?R`<collapse-expand-button
4916
+ `;var ya=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let wa=class extends oe{constructor(){super(...arguments),this.isMinimized=!1,this.mobileStyles={},this.isFirstMount=!1,this.autoOpenChatWidget=!1,this.phoneNumber="",this.buildingName="",this.chatId="",this.orgLegalName="",this.chatCallUsHeader="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.sgtUrl="",this.selfGuidedTourEnabled=!1,this.selfGuidedToursTypeOffered="",this.designConcept="",this.featureFlagShowDropdown="",this.leadSources=[],this.currentLeadSource="",this.escortedToursLink="",this.escortedToursTypeOffered="",this.virtualToursLink="",this.virtualToursTypeOffered="",this.hasChatEnabledDesktop=!1,this.hasChatEnabledMobile=!1,this.hasEmailEnabledDesktop=!1,this.hasEmailEnabledMobile=!1,this.hasApplyNowEnabledDesktop=!1,this.hasApplyNowEnabledMobile=!1,this.applicationLink="",this.hasCallUsEnabledDesktop=!1,this.hasCallUsEnabledMobile=!1,this.hasTextUsEnabledDesktop=!1,this.hasTextUsEnabledMobile=!1,this.hasSSTEnabledDesktop=!1,this.hasSSTEnabledMobile=!1,this.tourTypeOptions=[],this.hasDynamicSchedulingEnabled=!1,this.hasPricingCalculatorEnabledDesktop=!1,this.hasPricingCalculatorEnabledMobile=!1,this.onExitChat=()=>{},this.hasHideMobileFeatures=!1,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.showTourNextToChat=!1,this.onChatTapped=()=>{},this.onClickMinimize=()=>{},this.onSstClose=ba(),this.overrideRentgrata=!1,this.launcherStyles={},this.primaryColor=Ie,this.backgroundColor=De,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",this.leadSourceClient=null,this.isEmailWindowOpen=!1,this.isCallUsWindowOpen=!1,this.isSSTWindowOpen=!1,this.isTextUsWindowOpen=!1,this.isCalculatorWindowOpen=!1,this.isMobileFeaturesExpanded=!1,this.getNumCallToActions=()=>[this.hasEmailEnabledDesktop||this.hasEmailEnabledMobile,!!this.phoneNumber&&(this.hasCallUsEnabledDesktop||this.hasCallUsEnabledMobile),this.hasSSTEnabledDesktop||this.hasSSTEnabledMobile,this.hasTextUsEnabledDesktop||this.hasTextUsEnabledMobile,this.hasApplyNowEnabledDesktop||this.hasApplyNowEnabledMobile,this.hasPricingCalculatorEnabledDesktop||this.hasPricingCalculatorEnabledMobile].filter((e=>e)).length,this.emailUsWindowRef=Ae(),this.tourSchedulerRef=Ae(),this.calculatorWindowRef=Ae(),this.updated=async()=>{this.attachOnClickToEmailUsWindow(),this.attachOnClickToSSTWindow(),this.attachOnClickToCalculatorWindow(),(this.isEmailWindowOpen||this.isCallUsWindowOpen)&&this.isSSTWindowOpen&&this.onCloseSSTWindow()},this.attachOnClickToEmailUsWindow=()=>{const e=this.emailUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseEmailWindow)},this.attachOnClickToSSTWindow=()=>{const e=this.tourSchedulerRef.value;e&&(e.onCloseClicked=this.onCloseSSTWindow)},this.attachOnClickToCalculatorWindow=()=>{const e=this.calculatorWindowRef.value;e&&(e.onCloseClicked=this.onCloseCalculatorWindow,e.onClickEmailOption=this.onClickEmailOption,e.onClickPhoneOption=this.onClickPhoneOption,e.onClickSSTOption=this.onClickSSTOption,e.onClickTextUsOption=this.onClickTextUsOption)},this.onClickEmailOption=e=>{e.preventDefault(),e.stopPropagation(),fa(),this.isEmailWindowOpen=!0},this.onCloseEmailWindow=()=>{this.isEmailWindowOpen=!1},this.onClickPhoneOption=e=>{e.preventDefault(),e.stopPropagation(),fa(),this.isCallUsWindowOpen=!0},this.onClickApplyNowOption=e=>{e.preventDefault(),e.stopPropagation(),fa(),window.open(this.applicationLink,"_blank")},this.onClickPriceCalculatorOption=e=>{e.preventDefault(),e.stopPropagation(),fa(),this.isCalculatorWindowOpen=!0},this.onClosePhoneWindow=()=>{this.isCallUsWindowOpen=!1},this.onClickSSTOption=e=>{e.preventDefault(),e.stopPropagation(),fa(),qi(),Wi(this.buildingId),this.isSSTWindowOpen=!0},this.onCloseSSTWindow=()=>{this.onSstClose(),this.isSSTWindowOpen=!1,this.showTourNextToChat&&this.dispatchEvent(new CustomEvent("closeShowTourNextToChat",{bubbles:!0}))},this.onCloseCalculatorWindow=()=>{this.isCalculatorWindowOpen=!1},this.onClickTextUsOption=e=>{e.preventDefault(),e.stopPropagation(),this.isTextUsWindowOpen=!0},this.isCallToActionWindowOpen=()=>1===[this.isEmailWindowOpen,this.isCallUsWindowOpen,this.isSSTWindowOpen,this.isTextUsWindowOpen,this.isCalculatorWindowOpen].filter((e=>e)).length,this.toggleMobileFeatures=()=>{this.isMobileFeaturesExpanded=!this.isMobileFeaturesExpanded},this.renderActionPills=()=>bi()||this.isMinimized||this.designConcept===Nn.MINIMIZED?R` ${this.hasHideMobileFeatures&&bi()?R`<collapse-expand-button
4917
4917
  .toExpand=${this.isMobileFeaturesExpanded}
4918
4918
  .primaryColor=${this.primaryColor}
4919
4919
  .onClick=${this.toggleMobileFeatures}
@@ -5304,6 +5304,7 @@ xmlns="http://www.w3.org/2000/svg"
5304
5304
  selfGuidedTourEnabled="${this.selfGuidedTourEnabled}"
5305
5305
  selfGuidedToursTypeOffered="${this.selfGuidedToursTypeOffered}"
5306
5306
  escortedToursLink="${this.escortedToursLink}"
5307
+ .escortedToursTypeOffered="${this.escortedToursTypeOffered}"
5307
5308
  virtualToursLink="${this.virtualToursLink}"
5308
5309
  virtualToursTypeOffered="${this.virtualToursTypeOffered}"
5309
5310
  currentLeadSource="${this.currentLeadSource}"
@@ -5370,7 +5371,7 @@ xmlns="http://www.w3.org/2000/svg"
5370
5371
  ${Oo}
5371
5372
  ${Po}
5372
5373
  ${No}
5373
- `,ya([le({attribute:!0})],wa.prototype,"isMinimized",void 0),ya([le()],wa.prototype,"mobileStyles",void 0),ya([le({type:Boolean})],wa.prototype,"isFirstMount",void 0),ya([le({attribute:!1})],wa.prototype,"autoOpenChatWidget",void 0),ya([le()],wa.prototype,"phoneNumber",void 0),ya([le({attribute:!0})],wa.prototype,"buildingName",void 0),ya([le({attribute:!0})],wa.prototype,"chatId",void 0),ya([le({attribute:!0})],wa.prototype,"orgLegalName",void 0),ya([le({attribute:!0})],wa.prototype,"chatCallUsHeader",void 0),ya([le({attribute:!1})],wa.prototype,"buildingId",void 0),ya([le({attribute:!0})],wa.prototype,"buildingSlug",void 0),ya([le({attribute:!0})],wa.prototype,"orgSlug",void 0),ya([le({attribute:!0})],wa.prototype,"sgtUrl",void 0),ya([le({attribute:!0})],wa.prototype,"selfGuidedTourEnabled",void 0),ya([le({attribute:!0})],wa.prototype,"selfGuidedToursTypeOffered",void 0),ya([le({attribute:!0})],wa.prototype,"designConcept",void 0),ya([le({attribute:!0})],wa.prototype,"featureFlagShowDropdown",void 0),ya([le({attribute:!1})],wa.prototype,"leadSources",void 0),ya([le({attribute:!0})],wa.prototype,"currentLeadSource",void 0),ya([le({attribute:!0})],wa.prototype,"escortedToursLink",void 0),ya([le({attribute:!0})],wa.prototype,"virtualToursLink",void 0),ya([le({attribute:!0})],wa.prototype,"virtualToursTypeOffered",void 0),ya([le({type:Boolean})],wa.prototype,"hasChatEnabledDesktop",void 0),ya([le({type:Boolean})],wa.prototype,"hasChatEnabledMobile",void 0),ya([le({type:Boolean})],wa.prototype,"hasEmailEnabledDesktop",void 0),ya([le({type:Boolean})],wa.prototype,"hasEmailEnabledMobile",void 0),ya([le({attribute:!0})],wa.prototype,"hasApplyNowEnabledDesktop",void 0),ya([le({attribute:!0})],wa.prototype,"hasApplyNowEnabledMobile",void 0),ya([le({attribute:!0})],wa.prototype,"applicationLink",void 0),ya([le({type:Boolean})],wa.prototype,"hasCallUsEnabledDesktop",void 0),ya([le({type:Boolean})],wa.prototype,"hasCallUsEnabledMobile",void 0),ya([le({type:Boolean})],wa.prototype,"hasTextUsEnabledDesktop",void 0),ya([le({type:Boolean})],wa.prototype,"hasTextUsEnabledMobile",void 0),ya([le({type:Boolean})],wa.prototype,"hasSSTEnabledDesktop",void 0),ya([le({type:Boolean})],wa.prototype,"hasSSTEnabledMobile",void 0),ya([le({attribute:!1})],wa.prototype,"tourTypeOptions",void 0),ya([le({attribute:!0})],wa.prototype,"hasDynamicSchedulingEnabled",void 0),ya([le({attribute:!0})],wa.prototype,"hasPricingCalculatorEnabledDesktop",void 0),ya([le({attribute:!0})],wa.prototype,"hasPricingCalculatorEnabledMobile",void 0),ya([le({attribute:!1})],wa.prototype,"hasHideMobileFeatures",void 0),ya([le({type:Number})],wa.prototype,"right",void 0),ya([le({type:Number})],wa.prototype,"bottom",void 0),ya([le({type:Number})],wa.prototype,"top",void 0),ya([le({type:Number})],wa.prototype,"left",void 0),ya([le({attribute:!0})],wa.prototype,"showTourNextToChat",void 0),ya([le({attribute:!1})],wa.prototype,"onChatTapped",void 0),ya([le({attribute:!0})],wa.prototype,"onClickMinimize",void 0),ya([le({attribute:!0})],wa.prototype,"onSstClose",void 0),ya([le({attribute:!0})],wa.prototype,"overrideRentgrata",void 0),ya([le({attribute:!1})],wa.prototype,"launcherStyles",void 0),ya([le({attribute:!0})],wa.prototype,"primaryColor",void 0),ya([le({attribute:!0})],wa.prototype,"backgroundColor",void 0),ya([le({attribute:!0})],wa.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),ya([le({attribute:!0})],wa.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),ya([le({attribute:!0})],wa.prototype,"leadSourceClient",void 0),ya([ue()],wa.prototype,"isEmailWindowOpen",void 0),ya([ue()],wa.prototype,"isCallUsWindowOpen",void 0),ya([ue()],wa.prototype,"isSSTWindowOpen",void 0),ya([ue()],wa.prototype,"isTextUsWindowOpen",void 0),ya([ue()],wa.prototype,"isCalculatorWindowOpen",void 0),ya([ue()],wa.prototype,"isMobileFeaturesExpanded",void 0),wa=ya([ae("meetelise-launcher")],wa);const Ca=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",wa)},xa=["app.meetelise.com","staging.eliseai.com","localhost"],Aa={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"}};var Sa=i(3379),ka=i.n(Sa),Ta=i(7795),Ea=i.n(Ta),_a=i(569),Oa=i.n(_a),Pa=i(3565),Na=i.n(Pa),Ma=i(9216),Ia=i.n(Ma),Da=i(4589),Ua=i.n(Da),La=i(3631),Ra={};async function Ba(e,i){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${i}/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 ja(n.data,i)}return[]}catch(e){return[]}}Ra.styleTagTransform=Ua(),Ra.setAttributes=Na(),Ra.insert=Oa().bind(null,"head"),Ra.domAPI=Ea(),Ra.insertStyleElement=Ia(),ka()(La.Z,Ra),La.Z&&La.Z.locals&&La.Z.locals;const ja=(e,t)=>{let i=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":i=["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":i=["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:i=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!i.map((e=>e.toLowerCase())).includes(t)}))};var Ha,Fa=i(9594),$a=i.n(Fa),za=new Uint8Array(16);function Qa(){if(!Ha&&!(Ha="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 Ha(za)}const Ga=/^(?:[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,qa=function(e){return"string"==typeof e&&Ga.test(e)};for(var Wa=[],Va=0;Va<256;++Va)Wa.push((Va+256).toString(16).substr(1));const Ya=function(e,t,i){var n=(e=e||{}).random||(e.rng||Qa)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(var o=0;o<16;++o)t[i+o]=n[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(Wa[e[t+0]]+Wa[e[t+1]]+Wa[e[t+2]]+Wa[e[t+3]]+"-"+Wa[e[t+4]]+Wa[e[t+5]]+"-"+Wa[e[t+6]]+Wa[e[t+7]]+"-"+Wa[e[t+8]]+Wa[e[t+9]]+"-"+Wa[e[t+10]]+Wa[e[t+11]]+Wa[e[t+12]]+Wa[e[t+13]]+Wa[e[t+14]]+Wa[e[t+15]]).toLowerCase();if(!qa(i))throw TypeError("Stringified UUID is invalid");return i}(n)},Ka=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Xa=(e,t,i)=>{const n=ki(new Date),o=i||`lead_${Ya()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:o,timestamp:n,initiatedChat:t})),{leadId:o,timestamp:Ni(n),buildingSlug:e,initiatedChat:t}},Za=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const i=JSON.parse(t),n={leadId:i.leadId,timestamp:new Date(i.timestamp),buildingSlug:i.buildingSlug,initiatedChat:i.initiatedChat};if(Ja(e,n))return n}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Ja=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(hi(t.timestamp,e))return!1}}catch(e){console.warn("Error checking chat storage key validity")}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp||vi(t.timestamp,24))};var es;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(es||(es={}));const ts=e=>e.type===ns.text,is=e=>e.type===ns.media;var ns;!function(e){e.text="text",e.media="media"}(ns||(ns={}));const os=class{constructor(e,t,i,n=null,o,r=null,a=Qs.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=Qs.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,i;const n={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,n],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter((e=>e.message.messageType!==es.noReply)),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const o="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:o}),!o&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=o,"ai_message"===e.message.customType&&this.simpleChatMessages.some((e=>e.type===ns.text&&e.message.includes("confirmed for your tour")))&&cn("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.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(!ts(e))return!1;const t=e.chunks.find((e=>e.isDone));return!t||e.chunks.length===t.order}));t&&(this.streamingMessageTimeout=setTimeout((()=>{An({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:xn.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),console.warn(`PUBNUB_WARN_DELAYED_STREAMING_MESSAGES: ${e}`),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 console.warn("Error checking if message contains email",e),!1}})(e.message.text))return;cn("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,i;for(let n=e.length-1;n>=0;n--){const o=null===(t=e[n])||void 0===t?void 0:t.message,r=n>0&&(null===(i=e[n-1])||void 0===i?void 0:i.message);(null==o?void 0:o.messageType)===es.noReply&&r&&(r.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&&An({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:xn.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=Xa(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,i,n,o,r;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),this.buildingWebchatView&&An({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:xn.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===Qs.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===(i=this.buildingWebchatView)||void 0===i?void 0:i.id,buildingSlug:this.buildingSlug,userId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState()}}),this.isFirstChatMessageSent||(cn("firstChatMessageSent",{message:e,buildingId:null===(o=this.buildingWebchatView)||void 0===o?void 0:o.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),cn("chatMessageSent",{message:e,buildingId:null===(r=this.buildingWebchatView)||void 0===r?void 0:r.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 i=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(i)?(An({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:xn.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(i),!0)}))},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],i={};return this.removeDuplicatedRawPubnubMessages(e).forEach((e=>{var n;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(n=e.message.media)&&void 0!==n?n:[],isLeadMessage:this.isLeadMessage(e),type:ns.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:ns.text}):i[e.message.stream_id]?i[e.message.stream_id].push(e):i[e.message.stream_id]=[e]})),Object.keys(i).forEach((e=>{const n=i[e],o=this.getConsecutiveChunks(n.sort(((e,t)=>{var i,n;return(null!==(i=e.message.order)&&void 0!==i?i:0)-(null!==(n=t.message.order)&&void 0!==n?n:0)}))),r=o.map((e=>e.message.text)).join(""),a=o[0],s={timestamp:a.timetoken,message:r,isLeadMessage:this.isLeadMessage(a),chunks:o.map((e=>{var t,i;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(i=e.message.is_done)&&void 0!==i&&i}})),type:ns.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(o),t.push(s)})),t.sort(((e,t)=>e.timestamp-t.timestamp)),t},this.getConsecutiveChunks=e=>{var t,i;const n=e.sort(((e,t)=>{var i,n;return(null!==(i=e.message.order)&&void 0!==i?i:0)-(null!==(n=t.message.order)&&void 0!==n?n:0)})),o=[];let r=null!==(t=n[0].message.order)&&void 0!==t?t:0;for(const e of n){if((null!==(i=e.message.order)&&void 0!==i?i:-1)!==r)break;o.push(e),r++}return o},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=i,this.leadSource=n,this.leadUserId=o,this.channel=`webchat_${o}`,this.leadSourceClient=r,this.widgetType=a}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($a())({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,i){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${i}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&An({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:xn.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&An({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:xn.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(i){if(i instanceof e.AxiosError&&i&&i.response&&403===i.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){this.buildingWebchatView&&An({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:xn.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let i=[],n=null;const o=100;for(let t=0;t<e;t+=o){const r=await new Promise(((i,r)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(o,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=n?n:void 0},((e,t)=>{e.error?r(e):i(t)}))})),a=r.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(r.channels).length){const e=r.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),i=i.concat(t.filter((e=>e.message.messageType!==es.noReply)))}if(n=a[0].timetoken,i.length>=e||a.length<o)break}this.rawPubnubMessages=i.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&&An({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:xn.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},rs=(e,t,i)=>{const n=`tel:${e}`,o=`sms:${e}`,r=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,l=/(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}/g,u=/(tel|sms):(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}/g,c=/whatsapp:\/\/send\?phone=\d+/g,d=/(facetime|facetime-audio):\d+/g,h=document.body.getElementsByTagName("*");let p=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let g=!1,m=!1,b=0;for(let e=0;e<h.length;e++)if(h[e].nodeType===Node.ELEMENT_NODE){if(1===h[e].childNodes.length&&h[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=h[e].innerHTML,i=t.replace(l,f);t!==i&&b++,h[e].innerHTML=i,p=!0,g||(g=!0)}if(h[e].hasAttribute("href")){const t=h[e].getAttribute("href");if(!t)continue;let i="",l=u;t.startsWith("sms:")?i=o:t.startsWith("whatsapp:")?(i=r,l=c):t.startsWith("facetime:")?(i=a,l=d):t.startsWith("facetime-audio:")?(i=s,l=d):i=n;const p=t.replace(l,i);h[e].setAttribute("href",p),m||(m=!0)}}return g&&An({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:f,website:window.location.href},logType:xn.info,buildingSlug:i,orgSlug:t}),m&&An({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:f,website:window.location.href},logType:xn.info,buildingSlug:i,orgSlug:t}),p||An({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:xn.warn,buildingSlug:i,orgSlug:t}),b};var as=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let ss=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Ie,this.toExpand=!1}render(){return R`
5374
+ `,ya([le({attribute:!0})],wa.prototype,"isMinimized",void 0),ya([le()],wa.prototype,"mobileStyles",void 0),ya([le({type:Boolean})],wa.prototype,"isFirstMount",void 0),ya([le({attribute:!1})],wa.prototype,"autoOpenChatWidget",void 0),ya([le()],wa.prototype,"phoneNumber",void 0),ya([le({attribute:!0})],wa.prototype,"buildingName",void 0),ya([le({attribute:!0})],wa.prototype,"chatId",void 0),ya([le({attribute:!0})],wa.prototype,"orgLegalName",void 0),ya([le({attribute:!0})],wa.prototype,"chatCallUsHeader",void 0),ya([le({attribute:!1})],wa.prototype,"buildingId",void 0),ya([le({attribute:!0})],wa.prototype,"buildingSlug",void 0),ya([le({attribute:!0})],wa.prototype,"orgSlug",void 0),ya([le({attribute:!0})],wa.prototype,"sgtUrl",void 0),ya([le({attribute:!0})],wa.prototype,"selfGuidedTourEnabled",void 0),ya([le({attribute:!0})],wa.prototype,"selfGuidedToursTypeOffered",void 0),ya([le({attribute:!0})],wa.prototype,"designConcept",void 0),ya([le({attribute:!0})],wa.prototype,"featureFlagShowDropdown",void 0),ya([le({attribute:!1})],wa.prototype,"leadSources",void 0),ya([le({attribute:!0})],wa.prototype,"currentLeadSource",void 0),ya([le({attribute:!0})],wa.prototype,"escortedToursLink",void 0),ya([le({attribute:!0})],wa.prototype,"escortedToursTypeOffered",void 0),ya([le({attribute:!0})],wa.prototype,"virtualToursLink",void 0),ya([le({attribute:!0})],wa.prototype,"virtualToursTypeOffered",void 0),ya([le({type:Boolean})],wa.prototype,"hasChatEnabledDesktop",void 0),ya([le({type:Boolean})],wa.prototype,"hasChatEnabledMobile",void 0),ya([le({type:Boolean})],wa.prototype,"hasEmailEnabledDesktop",void 0),ya([le({type:Boolean})],wa.prototype,"hasEmailEnabledMobile",void 0),ya([le({attribute:!0})],wa.prototype,"hasApplyNowEnabledDesktop",void 0),ya([le({attribute:!0})],wa.prototype,"hasApplyNowEnabledMobile",void 0),ya([le({attribute:!0})],wa.prototype,"applicationLink",void 0),ya([le({type:Boolean})],wa.prototype,"hasCallUsEnabledDesktop",void 0),ya([le({type:Boolean})],wa.prototype,"hasCallUsEnabledMobile",void 0),ya([le({type:Boolean})],wa.prototype,"hasTextUsEnabledDesktop",void 0),ya([le({type:Boolean})],wa.prototype,"hasTextUsEnabledMobile",void 0),ya([le({type:Boolean})],wa.prototype,"hasSSTEnabledDesktop",void 0),ya([le({type:Boolean})],wa.prototype,"hasSSTEnabledMobile",void 0),ya([le({attribute:!1})],wa.prototype,"tourTypeOptions",void 0),ya([le({attribute:!0})],wa.prototype,"hasDynamicSchedulingEnabled",void 0),ya([le({attribute:!0})],wa.prototype,"hasPricingCalculatorEnabledDesktop",void 0),ya([le({attribute:!0})],wa.prototype,"hasPricingCalculatorEnabledMobile",void 0),ya([le({attribute:!1})],wa.prototype,"hasHideMobileFeatures",void 0),ya([le({type:Number})],wa.prototype,"right",void 0),ya([le({type:Number})],wa.prototype,"bottom",void 0),ya([le({type:Number})],wa.prototype,"top",void 0),ya([le({type:Number})],wa.prototype,"left",void 0),ya([le({attribute:!0})],wa.prototype,"showTourNextToChat",void 0),ya([le({attribute:!1})],wa.prototype,"onChatTapped",void 0),ya([le({attribute:!0})],wa.prototype,"onClickMinimize",void 0),ya([le({attribute:!0})],wa.prototype,"onSstClose",void 0),ya([le({attribute:!0})],wa.prototype,"overrideRentgrata",void 0),ya([le({attribute:!1})],wa.prototype,"launcherStyles",void 0),ya([le({attribute:!0})],wa.prototype,"primaryColor",void 0),ya([le({attribute:!0})],wa.prototype,"backgroundColor",void 0),ya([le({attribute:!0})],wa.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),ya([le({attribute:!0})],wa.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),ya([le({attribute:!0})],wa.prototype,"leadSourceClient",void 0),ya([ue()],wa.prototype,"isEmailWindowOpen",void 0),ya([ue()],wa.prototype,"isCallUsWindowOpen",void 0),ya([ue()],wa.prototype,"isSSTWindowOpen",void 0),ya([ue()],wa.prototype,"isTextUsWindowOpen",void 0),ya([ue()],wa.prototype,"isCalculatorWindowOpen",void 0),ya([ue()],wa.prototype,"isMobileFeaturesExpanded",void 0),wa=ya([ae("meetelise-launcher")],wa);const Ca=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",wa)},xa=["app.meetelise.com","staging.eliseai.com","localhost"],Aa={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"}};var Sa=i(3379),ka=i.n(Sa),Ta=i(7795),Ea=i.n(Ta),_a=i(569),Oa=i.n(_a),Pa=i(3565),Na=i.n(Pa),Ma=i(9216),Ia=i.n(Ma),Da=i(4589),Ua=i.n(Da),La=i(3631),Ra={};async function Ba(e,i){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${i}/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 ja(n.data,i)}return[]}catch(e){return[]}}Ra.styleTagTransform=Ua(),Ra.setAttributes=Na(),Ra.insert=Oa().bind(null,"head"),Ra.domAPI=Ea(),Ra.insertStyleElement=Ia(),ka()(La.Z,Ra),La.Z&&La.Z.locals&&La.Z.locals;const ja=(e,t)=>{let i=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":i=["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":i=["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:i=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!i.map((e=>e.toLowerCase())).includes(t)}))};var Ha,Fa=i(9594),$a=i.n(Fa),za=new Uint8Array(16);function Qa(){if(!Ha&&!(Ha="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 Ha(za)}const Ga=/^(?:[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,qa=function(e){return"string"==typeof e&&Ga.test(e)};for(var Wa=[],Va=0;Va<256;++Va)Wa.push((Va+256).toString(16).substr(1));const Ya=function(e,t,i){var n=(e=e||{}).random||(e.rng||Qa)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(var o=0;o<16;++o)t[i+o]=n[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(Wa[e[t+0]]+Wa[e[t+1]]+Wa[e[t+2]]+Wa[e[t+3]]+"-"+Wa[e[t+4]]+Wa[e[t+5]]+"-"+Wa[e[t+6]]+Wa[e[t+7]]+"-"+Wa[e[t+8]]+Wa[e[t+9]]+"-"+Wa[e[t+10]]+Wa[e[t+11]]+Wa[e[t+12]]+Wa[e[t+13]]+Wa[e[t+14]]+Wa[e[t+15]]).toLowerCase();if(!qa(i))throw TypeError("Stringified UUID is invalid");return i}(n)},Ka=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Xa=(e,t,i)=>{const n=ki(new Date),o=i||`lead_${Ya()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:o,timestamp:n,initiatedChat:t})),{leadId:o,timestamp:Ni(n),buildingSlug:e,initiatedChat:t}},Za=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const i=JSON.parse(t),n={leadId:i.leadId,timestamp:new Date(i.timestamp),buildingSlug:i.buildingSlug,initiatedChat:i.initiatedChat};if(Ja(e,n))return n}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Ja=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(hi(t.timestamp,e))return!1}}catch(e){console.warn("Error checking chat storage key validity")}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp||vi(t.timestamp,24))};var es;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(es||(es={}));const ts=e=>e.type===ns.text,is=e=>e.type===ns.media;var ns;!function(e){e.text="text",e.media="media"}(ns||(ns={}));const os=class{constructor(e,t,i,n=null,o,r=null,a=Qs.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=Qs.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,i;const n={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,n],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter((e=>e.message.messageType!==es.noReply)),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const o="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:o}),!o&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=o,"ai_message"===e.message.customType&&this.simpleChatMessages.some((e=>e.type===ns.text&&e.message.includes("confirmed for your tour")))&&cn("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.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(!ts(e))return!1;const t=e.chunks.find((e=>e.isDone));return!t||e.chunks.length===t.order}));t&&(this.streamingMessageTimeout=setTimeout((()=>{An({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:xn.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),console.warn(`PUBNUB_WARN_DELAYED_STREAMING_MESSAGES: ${e}`),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 console.warn("Error checking if message contains email",e),!1}})(e.message.text))return;cn("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,i;for(let n=e.length-1;n>=0;n--){const o=null===(t=e[n])||void 0===t?void 0:t.message,r=n>0&&(null===(i=e[n-1])||void 0===i?void 0:i.message);(null==o?void 0:o.messageType)===es.noReply&&r&&(r.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&&An({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:xn.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=Xa(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,i,n,o,r;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),this.buildingWebchatView&&An({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:xn.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===Qs.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===(i=this.buildingWebchatView)||void 0===i?void 0:i.id,buildingSlug:this.buildingSlug,userId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState()}}),this.isFirstChatMessageSent||(cn("firstChatMessageSent",{message:e,buildingId:null===(o=this.buildingWebchatView)||void 0===o?void 0:o.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),cn("chatMessageSent",{message:e,buildingId:null===(r=this.buildingWebchatView)||void 0===r?void 0:r.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 i=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(i)?(An({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:xn.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(i),!0)}))},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],i={};return this.removeDuplicatedRawPubnubMessages(e).forEach((e=>{var n;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(n=e.message.media)&&void 0!==n?n:[],isLeadMessage:this.isLeadMessage(e),type:ns.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:ns.text}):i[e.message.stream_id]?i[e.message.stream_id].push(e):i[e.message.stream_id]=[e]})),Object.keys(i).forEach((e=>{const n=i[e],o=this.getConsecutiveChunks(n.sort(((e,t)=>{var i,n;return(null!==(i=e.message.order)&&void 0!==i?i:0)-(null!==(n=t.message.order)&&void 0!==n?n:0)}))),r=o.map((e=>e.message.text)).join(""),a=o[0],s={timestamp:a.timetoken,message:r,isLeadMessage:this.isLeadMessage(a),chunks:o.map((e=>{var t,i;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(i=e.message.is_done)&&void 0!==i&&i}})),type:ns.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(o),t.push(s)})),t.sort(((e,t)=>e.timestamp-t.timestamp)),t},this.getConsecutiveChunks=e=>{var t,i;const n=e.sort(((e,t)=>{var i,n;return(null!==(i=e.message.order)&&void 0!==i?i:0)-(null!==(n=t.message.order)&&void 0!==n?n:0)})),o=[];let r=null!==(t=n[0].message.order)&&void 0!==t?t:0;for(const e of n){if((null!==(i=e.message.order)&&void 0!==i?i:-1)!==r)break;o.push(e),r++}return o},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=i,this.leadSource=n,this.leadUserId=o,this.channel=`webchat_${o}`,this.leadSourceClient=r,this.widgetType=a}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($a())({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,i){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${i}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&An({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:xn.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&An({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:xn.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(i){if(i instanceof e.AxiosError&&i&&i.response&&403===i.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){this.buildingWebchatView&&An({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:xn.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let i=[],n=null;const o=100;for(let t=0;t<e;t+=o){const r=await new Promise(((i,r)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(o,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=n?n:void 0},((e,t)=>{e.error?r(e):i(t)}))})),a=r.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(r.channels).length){const e=r.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),i=i.concat(t.filter((e=>e.message.messageType!==es.noReply)))}if(n=a[0].timetoken,i.length>=e||a.length<o)break}this.rawPubnubMessages=i.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&&An({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:xn.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},rs=(e,t,i)=>{const n=`tel:${e}`,o=`sms:${e}`,r=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,l=/(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}/g,u=/(tel|sms):(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}/g,c=/whatsapp:\/\/send\?phone=\d+/g,d=/(facetime|facetime-audio):\d+/g,h=document.body.getElementsByTagName("*");let p=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let g=!1,m=!1,b=0;for(let e=0;e<h.length;e++)if(h[e].nodeType===Node.ELEMENT_NODE){if(1===h[e].childNodes.length&&h[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=h[e].innerHTML,i=t.replace(l,f);t!==i&&b++,h[e].innerHTML=i,p=!0,g||(g=!0)}if(h[e].hasAttribute("href")){const t=h[e].getAttribute("href");if(!t)continue;let i="",l=u;t.startsWith("sms:")?i=o:t.startsWith("whatsapp:")?(i=r,l=c):t.startsWith("facetime:")?(i=a,l=d):t.startsWith("facetime-audio:")?(i=s,l=d):i=n;const p=t.replace(l,i);h[e].setAttribute("href",p),m||(m=!0)}}return g&&An({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:f,website:window.location.href},logType:xn.info,buildingSlug:i,orgSlug:t}),m&&An({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:f,website:window.location.href},logType:xn.info,buildingSlug:i,orgSlug:t}),p||An({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:xn.warn,buildingSlug:i,orgSlug:t}),b};var as=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let ss=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Ie,this.toExpand=!1}render(){return R`
5374
5375
  <div
5375
5376
  class=${this.toExpand?"button-container mini":"button-container"}
5376
5377
  @click=${this.onClick}
@@ -6580,6 +6581,7 @@ xmlns="http://www.w3.org/2000/svg"
6580
6581
  featureFlagShowDropdown="${this.featureFlagShowDropdown}"
6581
6582
  .leadSources="${null!==(O=this.leadSources)&&void 0!==O?O:[]}"
6582
6583
  escortedToursLink="${null!==(N=null===(P=this.buildingWebchatView)||void 0===P?void 0:P.escortedToursLink)&&void 0!==N?N:""}"
6584
+ .escortedToursTypeOffered="${this.buildingWebchatView.escortedToursTypeOffered}"
6583
6585
  virtualToursLink="${null!==(I=null===(M=this.buildingWebchatView)||void 0===M?void 0:M.virtualToursLink)&&void 0!==I?I:""}"
6584
6586
  virtualToursTypeOffered="${null!==(D=this.buildingWebchatView.virtualToursTypeOffered)&&void 0!==D?D:""}"
6585
6587
  .showTourNextToChat="${null!==(U=this.showTourNextToChat)&&void 0!==U?U:""}"
@@ -19,7 +19,10 @@ import {
19
19
  getTimezoneForBuilding,
20
20
  resetAvailabilitiesCache,
21
21
  } from "../../getAvailabilities";
22
- import { TourAvailabilityResponseRankOrderedSupportedTourTypesEnum } from "../../types/rest-sdk.types";
22
+ import {
23
+ TourAvailabilityResponse,
24
+ TourAvailabilityResponseRankOrderedSupportedTourTypesEnum,
25
+ } from "../../types/rest-sdk.types";
23
26
  import { format } from "date-fns";
24
27
  import { DatePicker } from "./date-picker";
25
28
  import { MESelect } from "../me-select";
@@ -70,6 +73,8 @@ export class TourScheduler extends LitElement {
70
73
  @property({ attribute: true })
71
74
  escortedToursLink = "";
72
75
  @property({ attribute: true })
76
+ escortedToursTypeOffered = "";
77
+ @property({ attribute: true })
73
78
  virtualToursLink = "";
74
79
  @property({ attribute: true })
75
80
  virtualToursTypeOffered = "";
@@ -240,7 +245,7 @@ export class TourScheduler extends LitElement {
240
245
 
241
246
  const availabilities = await getRawAvailabilities(this.buildingId);
242
247
  const highestRankedTourType =
243
- availabilities.rankOrderedSupportedTourTypes?.[0];
248
+ this._getHighestRankedTourType(availabilities);
244
249
  const availableTimesForHighestRankedTourType = highestRankedTourType
245
250
  ? availabilities.availability?.[highestRankedTourType]
246
251
  ?.availableTourStartTimes
@@ -309,6 +314,56 @@ export class TourScheduler extends LitElement {
309
314
  }
310
315
  };
311
316
 
317
+ _getHighestRankedTourType = (
318
+ availabilities: TourAvailabilityResponse
319
+ ): TourAvailabilityResponseRankOrderedSupportedTourTypesEnum => {
320
+ const rankedTourTypeToAvailabilities = (
321
+ availabilities.rankOrderedSupportedTourTypes ?? []
322
+ )
323
+ .map((tt) => {
324
+ return {
325
+ tourType: tt,
326
+ availabilities:
327
+ availabilities.availability?.[tt]?.availableTourStartTimes,
328
+ };
329
+ })
330
+ .filter((rtt) => {
331
+ if (
332
+ rtt.tourType ===
333
+ TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.Unknown ||
334
+ rtt.tourType ===
335
+ TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.MediaTour
336
+ ) {
337
+ return false;
338
+ }
339
+ const convertedTourType = rankedOrderTourTypeToTourType[rtt.tourType];
340
+ const tourTypeOffered = this._getTourTypeOffered(convertedTourType);
341
+
342
+ if (!tourTypeOffered) {
343
+ return false;
344
+ }
345
+ return (
346
+ !shouldOpenTourLink(convertedTourType, tourTypeOffered) &&
347
+ rtt.availabilities &&
348
+ rtt.availabilities.length > 0
349
+ );
350
+ });
351
+
352
+ const highestRankedTourType = rankedTourTypeToAvailabilities[0];
353
+ return highestRankedTourType.tourType;
354
+ };
355
+
356
+ _getTourTypeOffered = (tourType: TourType): string | null => {
357
+ if (tourType === TourType.Guided) {
358
+ return this.escortedToursTypeOffered;
359
+ } else if (tourType === TourType.Self) {
360
+ return this.selfGuidedToursTypeOffered;
361
+ } else if (tourType === TourType.Virtual) {
362
+ return this.virtualToursTypeOffered;
363
+ }
364
+ return null;
365
+ };
366
+
312
367
  firstUpdated = async (): Promise<void> => {
313
368
  await this._setAvailabilities();
314
369
  };
@@ -99,6 +99,8 @@ export class Launcher extends LitElement {
99
99
  @property({ attribute: true })
100
100
  escortedToursLink = "";
101
101
  @property({ attribute: true })
102
+ escortedToursTypeOffered = "";
103
+ @property({ attribute: true })
102
104
  virtualToursLink = "";
103
105
  @property({ attribute: true })
104
106
  virtualToursTypeOffered = "";
@@ -1201,6 +1203,7 @@ export class Launcher extends LitElement {
1201
1203
  selfGuidedTourEnabled="${this.selfGuidedTourEnabled}"
1202
1204
  selfGuidedToursTypeOffered="${this.selfGuidedToursTypeOffered}"
1203
1205
  escortedToursLink="${this.escortedToursLink}"
1206
+ .escortedToursTypeOffered="${this.escortedToursTypeOffered}"
1204
1207
  virtualToursLink="${this.virtualToursLink}"
1205
1208
  virtualToursTypeOffered="${this.virtualToursTypeOffered}"
1206
1209
  currentLeadSource="${this.currentLeadSource}"
@@ -924,6 +924,8 @@ export class MEChat extends LitElement {
924
924
  .leadSources="${this.leadSources ?? []}"
925
925
  escortedToursLink="${this.buildingWebchatView
926
926
  ?.escortedToursLink ?? ""}"
927
+ .escortedToursTypeOffered="${this.buildingWebchatView
928
+ .escortedToursTypeOffered}"
927
929
  virtualToursLink="${this.buildingWebchatView
928
930
  ?.virtualToursLink ?? ""}"
929
931
  virtualToursTypeOffered="${this.buildingWebchatView
@@ -45,7 +45,7 @@ export const shouldOpenTourLink = (
45
45
  return !shouldntOpenTourTypesOffered.includes(tourTypeOffered);
46
46
  }
47
47
 
48
- return true;
48
+ return false;
49
49
  };
50
50
 
51
51
  export interface LayoutOption {