@meetelise/chat 1.48.4 → 1.49.0

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.
@@ -0,0 +1,12 @@
1
+ export interface WebchatClientContext {
2
+ page_url?: string;
3
+ referrer?: string;
4
+ document_title?: string;
5
+ screen_width?: number;
6
+ screen_height?: number;
7
+ device_pixel_ratio?: number;
8
+ timezone?: string;
9
+ campaign_sources?: string;
10
+ ga_client_id?: string;
11
+ }
12
+ export declare const collectClientContext: () => WebchatClientContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.48.4",
3
+ "version": "1.49.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -5814,7 +5814,7 @@ xmlns="http://www.w3.org/2000/svg"
5814
5814
  ${_r}
5815
5815
  ${Or}
5816
5816
  ${Pr}
5817
- `,Ea([ue({attribute:!0})],ka.prototype,"isMinimized",void 0),Ea([ue()],ka.prototype,"mobileStyles",void 0),Ea([ue({type:Boolean})],ka.prototype,"isFirstMount",void 0),Ea([ue({attribute:!1})],ka.prototype,"autoOpenChatWidget",void 0),Ea([ue()],ka.prototype,"phoneNumber",void 0),Ea([ue({attribute:!0})],ka.prototype,"buildingName",void 0),Ea([ue({attribute:!0})],ka.prototype,"chatId",void 0),Ea([ue({attribute:!0})],ka.prototype,"orgLegalName",void 0),Ea([ue({attribute:!0})],ka.prototype,"chatCallUsHeader",void 0),Ea([ue({attribute:!1})],ka.prototype,"buildingId",void 0),Ea([ue({type:Number})],ka.prototype,"orgId",void 0),Ea([ue({attribute:!1})],ka.prototype,"leadSourceParams",void 0),Ea([ue({attribute:!0})],ka.prototype,"buildingSlug",void 0),Ea([ue({attribute:!0})],ka.prototype,"orgSlug",void 0),Ea([ue({attribute:!0})],ka.prototype,"sgtUrl",void 0),Ea([ue({attribute:!0})],ka.prototype,"selfGuidedTourEnabled",void 0),Ea([ue({attribute:!0})],ka.prototype,"selfGuidedToursTypeOffered",void 0),Ea([ue({attribute:!0})],ka.prototype,"designConcept",void 0),Ea([ue({attribute:!0})],ka.prototype,"featureFlagShowDropdown",void 0),Ea([ue({attribute:!1})],ka.prototype,"leadSources",void 0),Ea([ue({attribute:!0})],ka.prototype,"currentLeadSource",void 0),Ea([ue({attribute:!0})],ka.prototype,"escortedToursLink",void 0),Ea([ue({attribute:!0})],ka.prototype,"escortedToursTypeOffered",void 0),Ea([ue({attribute:!0})],ka.prototype,"virtualToursLink",void 0),Ea([ue({attribute:!0})],ka.prototype,"virtualToursTypeOffered",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasChatEnabledDesktop",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasChatEnabledMobile",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasEmailEnabledDesktop",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasEmailEnabledMobile",void 0),Ea([ue({attribute:!0})],ka.prototype,"hasApplyNowEnabledDesktop",void 0),Ea([ue({attribute:!0})],ka.prototype,"hasApplyNowEnabledMobile",void 0),Ea([ue({attribute:!0})],ka.prototype,"applicationLink",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasCallUsEnabledDesktop",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasCallUsEnabledMobile",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasTextUsEnabledDesktop",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasTextUsEnabledMobile",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasSSTEnabledDesktop",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasSSTEnabledMobile",void 0),Ea([ue({attribute:!1})],ka.prototype,"tourTypeOptions",void 0),Ea([ue({attribute:!1})],ka.prototype,"layoutOptions",void 0),Ea([ue({attribute:!0})],ka.prototype,"hasDynamicSchedulingEnabled",void 0),Ea([ue({attribute:!0})],ka.prototype,"hasPricingCalculatorEnabledDesktop",void 0),Ea([ue({attribute:!0})],ka.prototype,"hasPricingCalculatorEnabledMobile",void 0),Ea([ue({attribute:!1})],ka.prototype,"hasHideMobileFeatures",void 0),Ea([ue({type:Number})],ka.prototype,"right",void 0),Ea([ue({type:Number})],ka.prototype,"bottom",void 0),Ea([ue({type:Number})],ka.prototype,"top",void 0),Ea([ue({type:Number})],ka.prototype,"left",void 0),Ea([ue({attribute:!0})],ka.prototype,"showTourNextToChat",void 0),Ea([ue({attribute:!1})],ka.prototype,"onChatTapped",void 0),Ea([ue({attribute:!0})],ka.prototype,"onClickMinimize",void 0),Ea([ue({attribute:!0})],ka.prototype,"onSstClose",void 0),Ea([ue({attribute:!0})],ka.prototype,"overrideRentgrata",void 0),Ea([ue({attribute:!1})],ka.prototype,"launcherStyles",void 0),Ea([ue({attribute:!0})],ka.prototype,"primaryColor",void 0),Ea([ue({attribute:!0})],ka.prototype,"backgroundColor",void 0),Ea([ue({attribute:!0})],ka.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Ea([ue({attribute:!0})],ka.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Ea([ue({attribute:!0})],ka.prototype,"leadSourceClient",void 0),Ea([ce()],ka.prototype,"leadSourceMultitouchClient",void 0),Ea([ce()],ka.prototype,"_isMobile",void 0),Ea([ce()],ka.prototype,"isEmailWindowOpen",void 0),Ea([ce()],ka.prototype,"isCallUsWindowOpen",void 0),Ea([ce()],ka.prototype,"isSSTWindowOpen",void 0),Ea([ce()],ka.prototype,"isTextUsWindowOpen",void 0),Ea([ce()],ka.prototype,"isCalculatorWindowOpen",void 0),Ea([ce()],ka.prototype,"isMobileFeaturesExpanded",void 0),ka=Ea([se("meetelise-launcher")],ka);const Ta=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",ka)},_a=["app.meetelise.com","staging.eliseai.com","localhost"],Oa={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"}},Pa=e=>{const t=window.location.hostname;if(!_a.includes(t))return e;const n=(e=>{if(!e)return{};try{return e.split(",").reduce((e,t)=>{const[n,i]=t.split(":");return n&&i&&n in Oa&&(e[n]="true"===i.toLowerCase()),e},{})}catch(e){return{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(n).length)return e;const i={...e};return Object.entries(n).forEach(([e,t])=>{const n=Oa[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var Ia=n(5072),Ma=n.n(Ia),Na=n(7825),Da=n.n(Na),La=n(7659),Ua=n.n(La),Ra=n(5056),Ba=n.n(Ra),ja=n(540),Fa=n.n(ja),Ha=n(1113),$a=n.n(Ha),za=n(5541),Ga={};Ga.styleTagTransform=$a(),Ga.setAttributes=Ba(),Ga.insert=Ua().bind(null,"head"),Ga.domAPI=Da(),Ga.insertStyleElement=Fa();Ma()(za.A,Ga);za.A&&za.A.locals&&za.A.locals;async function Qa(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${t}/lead-sources`);if(n.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return n.data.filter(t=>e.includes(t))}return Wa(n.data,t)}return[]}catch(e){return[]}}const Wa=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter(e=>{const t=e.toLowerCase();return!n.map(e=>e.toLowerCase()).includes(t)})};async function qa(e){var t,n;if(!e)return!1;try{return null!==(n=null===(t=(await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/aip`)).data)||void 0===t?void 0:t.is_aip)&&void 0!==n&&n}catch(e){return!1}}var Va,Ya=n(8805),Ka=n.n(Ya),Xa=new Uint8Array(16);function Za(){if(!Va&&!(Va="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 Va(Xa)}const Ja=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const es=function(e){return"string"==typeof e&&Ja.test(e)};for(var ts=[],ns=0;ns<256;++ns)ts.push((ns+256).toString(16).substr(1));const is=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(ts[e[t+0]]+ts[e[t+1]]+ts[e[t+2]]+ts[e[t+3]]+"-"+ts[e[t+4]]+ts[e[t+5]]+"-"+ts[e[t+6]]+ts[e[t+7]]+"-"+ts[e[t+8]]+ts[e[t+9]]+"-"+ts[e[t+10]]+ts[e[t+11]]+ts[e[t+12]]+ts[e[t+13]]+ts[e[t+14]]+ts[e[t+15]]).toLowerCase();if(!es(n))throw TypeError("Stringified UUID is invalid");return n};const rs=function(e,t,n){var i=(e=e||{}).random||(e.rng||Za)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return is(i)},os=e=>localStorage.removeItem("com.elise.webchat.slug="+e),as=(e,t,n)=>{const i=On(new Date),r=n||`lead_${rs()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Rn(i),buildingSlug:e,initiatedChat:t}},ss=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(ls(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},ls=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(dn(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!wn(t.timestamp,24)};var us;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(us||(us={}));const cs=e=>e.type===hs.text,ds=e=>e.type===hs.media;var hs;!function(e){e.text="text",e.media="media"}(hs||(hs={}));const ps=class{constructor(e,t,n,i=null,r,o,a=null,s=fu.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=fu.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.sessionToken=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;const i={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,i],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==us.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:r}),!r&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=r,"ai_message"===e.message.customType){this.simpleChatMessages.some(e=>e.type===hs.text&&e.message.includes("confirmed for your"))&&li("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.streamingMessageTimeout=null,this.checkAndHandleDelayStreamingMessages=({delayToFetchHistoryInMs:e=1e4}={})=>{this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null);const t=this.simpleChatMessages.some(e=>{if(!cs(e))return!1;const t=e.chunks.find(e=>e.isDone);return!t||e.chunks.length===t.order});t&&(this.streamingMessageTimeout=setTimeout(()=>{Ei({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:Ai.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory()},e))},this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return!1}})(e.message.text))return;li("leadProvidedEmail",{buildingId:null===(t=this.buildingWebchatView)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===us.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.buildingWebchatView&&Ei({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:Ai.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=as(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken(async()=>{var t,n,i,r,o,a,s,l,u;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout(()=>{this.buildingWebchatView&&Ei({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:Ai.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===fu.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),orgSlug:this.orgSlug}}):(await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),lead_sources_with_timestamps:(null!==(o=null===(r=this.leadSourceMultitouchClient)||void 0===r?void 0:r.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:null}))&&void 0!==o?o:[]).map(e=>gn({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(li("firstChatMessageSent",{message:e,buildingId:null===(l=this.buildingWebchatView)||void 0===l?void 0:l.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),li("chatMessageSent",{message:e,buildingId:null===(u=this.buildingWebchatView)||void 0===u?void 0:u.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))}),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.removeDuplicatedRawPubnubMessages=e=>{const t=new Set;return e.filter(e=>{if("lead_message"===e.message.customType||!e.message.stream_id||!e.message.order)return!0;const n=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(n)?(Ei({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:Ai.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(n),!0)})},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return this.removeDuplicatedRawPubnubMessages(e).forEach(e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:hs.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:hs.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]}),Object.keys(n).forEach(e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),o=r.map(e=>e.message.text).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map(e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}}),type:hs.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)}),t.sort((e,t)=>e.timestamp-t.timestamp),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find(e=>e.message.is_done);return!t||e.length===t.message.order},this.buildingSlug=e,this.buildingWebchatView=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=a,this.leadSourceMultitouchClient=o,this.widgetType=s}async initSession(e,t,n){try{const i={building_slug:e,org_slug:t};n&&(i.lead_id=n);const o=await r().post(`${this.apiHost}/platformApi/webchat/init`,i);return this.sessionToken=o.data.session_token,this.leadUserId=o.data.lead_id,this.channel=o.data.channel,o.data}catch(e){return this.buildingWebchatView&&Ei({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:Ai.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),null}}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(Ka())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken(()=>new Promise(()=>this.handleChatListeners())),await this.withAuthToken(()=>this.getChannelHistory()),this.pubnub):void 0}async fetchToken(e,t){try{if(this.sessionToken){const e="healthcare"===this.widgetType?"?industry=health_care":"";return(await r().get(`${this.apiHost}/platformApi/webchat/pn/v2/request-token${e}`,{headers:{"X-Session-Token":this.sessionToken}})).data}return(await r().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${t}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&Ei({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:Ai.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await r().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&Ei({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:Ai.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(e){try{await e()}catch(t){if(t instanceof i.AxiosError&&t&&t.response&&403===t.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const t=await this.fetchToken(this.leadUserId,this.channel);if(!t)return;this.pubnub.setAuthKey(t.auth.result.token),await e()}catch(e){this.buildingWebchatView&&Ei({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:Ai.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},(e,t)=>{e.error?o(e):n(t)})}),a=o.channels[this.channel];if(!a)break;if(a.sort((e,t)=>+e.timetoken-+t.timetoken),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach(e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})}),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter(e=>e.message.messageType!==us.noReply))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.buildingWebchatView&&Ei({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:Ai.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},fs=new Set(["8009855990","8338526262","8002221222","8006624357","8002738255","8007997233","8007874889","8006564673","8004224453","8883737888","8006213362","8009506264","8558272736","8008435678","8007862929","8008523836","8007849433","8007729100","8006699777","8006858470","8004322209","8003473735","8008778339","8009552232","8002255342","8009272891","8003049320","8007937724","8002382333","8003353863","8776858878","8003329227","8776554371","8772944357","8772944356","6092925760","6092926735","8007928339","8008329173","8882853036","6092921210","8007929773","8003561561","8003826717","8005727233","8009291040","8888958179","8006879512","8004262537","8773475463","8774149251","8005103102","8889372835","8007010710","8007010720","8774288844","8007929745","8003283838","6092927060","6092928319","8008527899","8662401347","8009923678","8776522873","8776527624","8003313937","8008435437","8776536783","8778392339","8003676274","8006896411"]),gs=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return fs.has(t)},ms=(e,t,n)=>{try{const i=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1"),r=`tel:${i}`,o=`sms:${i}`,a=`whatsapp://send?phone=${i}`,s=`facetime:${i}`,l=`facetime-audio:${i}`,u=/(?:\+1[\s.-]?)?(?:\(\d{3}\)[\s.-]?|\d{3}[\s.-])\d{3}[\s.-]?\d{4}/g,c=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,d=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=/emergency|emergencia/i,f=300,g=e=>!(!e||e.length>f)&&p.test(e),m=e=>{var t,n,i,r;if(g(e.textContent))return!0;if(g(null===(t=e.previousElementSibling)||void 0===t?void 0:t.textContent)||g(null===(n=e.nextElementSibling)||void 0===n?void 0:n.textContent))return!0;const o=e.parentElement;return!(!o||!g(null===(i=o.previousElementSibling)||void 0===i?void 0:i.textContent)&&!g(null===(r=o.nextElementSibling)||void 0===r?void 0:r.textContent))},y=document.body.getElementsByTagName("*");let b=!1;const v=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let w=!1,C=!1,x=0;for(let e=0;e<y.length;e++)if(y[e].nodeType===Node.ELEMENT_NODE&&!m(y[e])){if(1===y[e].childNodes.length&&y[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=y[e].textContent;if(!t)continue;const n=t.replace(u,e=>{if(gs(e))return e;return e.startsWith("+1 ")?`+1 ${v}`:v});t!==n&&(x++,y[e].textContent=n),b=!0,w||(w=!0)}if(y[e].hasAttribute("href")){const t=y[e].getAttribute("href");if(!t)continue;let n="",i=c;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=d):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,gs(t))continue;const u=t.replace(i,n);if(y[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&y[e].setAttribute("href",t.startsWith("tel:")?r:o)}C||(C=!0)}}return w&&Ei({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:Ai.info,buildingSlug:n,orgSlug:t}),C&&Ei({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:Ai.info,buildingSlug:n,orgSlug:t}),b||Ei({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:Ai.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Ei({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:Ai.error,buildingSlug:n,orgSlug:t}),0}};var ys=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let bs=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Ue,this.toExpand=!1}render(){return B`
5817
+ `,Ea([ue({attribute:!0})],ka.prototype,"isMinimized",void 0),Ea([ue()],ka.prototype,"mobileStyles",void 0),Ea([ue({type:Boolean})],ka.prototype,"isFirstMount",void 0),Ea([ue({attribute:!1})],ka.prototype,"autoOpenChatWidget",void 0),Ea([ue()],ka.prototype,"phoneNumber",void 0),Ea([ue({attribute:!0})],ka.prototype,"buildingName",void 0),Ea([ue({attribute:!0})],ka.prototype,"chatId",void 0),Ea([ue({attribute:!0})],ka.prototype,"orgLegalName",void 0),Ea([ue({attribute:!0})],ka.prototype,"chatCallUsHeader",void 0),Ea([ue({attribute:!1})],ka.prototype,"buildingId",void 0),Ea([ue({type:Number})],ka.prototype,"orgId",void 0),Ea([ue({attribute:!1})],ka.prototype,"leadSourceParams",void 0),Ea([ue({attribute:!0})],ka.prototype,"buildingSlug",void 0),Ea([ue({attribute:!0})],ka.prototype,"orgSlug",void 0),Ea([ue({attribute:!0})],ka.prototype,"sgtUrl",void 0),Ea([ue({attribute:!0})],ka.prototype,"selfGuidedTourEnabled",void 0),Ea([ue({attribute:!0})],ka.prototype,"selfGuidedToursTypeOffered",void 0),Ea([ue({attribute:!0})],ka.prototype,"designConcept",void 0),Ea([ue({attribute:!0})],ka.prototype,"featureFlagShowDropdown",void 0),Ea([ue({attribute:!1})],ka.prototype,"leadSources",void 0),Ea([ue({attribute:!0})],ka.prototype,"currentLeadSource",void 0),Ea([ue({attribute:!0})],ka.prototype,"escortedToursLink",void 0),Ea([ue({attribute:!0})],ka.prototype,"escortedToursTypeOffered",void 0),Ea([ue({attribute:!0})],ka.prototype,"virtualToursLink",void 0),Ea([ue({attribute:!0})],ka.prototype,"virtualToursTypeOffered",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasChatEnabledDesktop",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasChatEnabledMobile",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasEmailEnabledDesktop",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasEmailEnabledMobile",void 0),Ea([ue({attribute:!0})],ka.prototype,"hasApplyNowEnabledDesktop",void 0),Ea([ue({attribute:!0})],ka.prototype,"hasApplyNowEnabledMobile",void 0),Ea([ue({attribute:!0})],ka.prototype,"applicationLink",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasCallUsEnabledDesktop",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasCallUsEnabledMobile",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasTextUsEnabledDesktop",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasTextUsEnabledMobile",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasSSTEnabledDesktop",void 0),Ea([ue({type:Boolean})],ka.prototype,"hasSSTEnabledMobile",void 0),Ea([ue({attribute:!1})],ka.prototype,"tourTypeOptions",void 0),Ea([ue({attribute:!1})],ka.prototype,"layoutOptions",void 0),Ea([ue({attribute:!0})],ka.prototype,"hasDynamicSchedulingEnabled",void 0),Ea([ue({attribute:!0})],ka.prototype,"hasPricingCalculatorEnabledDesktop",void 0),Ea([ue({attribute:!0})],ka.prototype,"hasPricingCalculatorEnabledMobile",void 0),Ea([ue({attribute:!1})],ka.prototype,"hasHideMobileFeatures",void 0),Ea([ue({type:Number})],ka.prototype,"right",void 0),Ea([ue({type:Number})],ka.prototype,"bottom",void 0),Ea([ue({type:Number})],ka.prototype,"top",void 0),Ea([ue({type:Number})],ka.prototype,"left",void 0),Ea([ue({attribute:!0})],ka.prototype,"showTourNextToChat",void 0),Ea([ue({attribute:!1})],ka.prototype,"onChatTapped",void 0),Ea([ue({attribute:!0})],ka.prototype,"onClickMinimize",void 0),Ea([ue({attribute:!0})],ka.prototype,"onSstClose",void 0),Ea([ue({attribute:!0})],ka.prototype,"overrideRentgrata",void 0),Ea([ue({attribute:!1})],ka.prototype,"launcherStyles",void 0),Ea([ue({attribute:!0})],ka.prototype,"primaryColor",void 0),Ea([ue({attribute:!0})],ka.prototype,"backgroundColor",void 0),Ea([ue({attribute:!0})],ka.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Ea([ue({attribute:!0})],ka.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Ea([ue({attribute:!0})],ka.prototype,"leadSourceClient",void 0),Ea([ce()],ka.prototype,"leadSourceMultitouchClient",void 0),Ea([ce()],ka.prototype,"_isMobile",void 0),Ea([ce()],ka.prototype,"isEmailWindowOpen",void 0),Ea([ce()],ka.prototype,"isCallUsWindowOpen",void 0),Ea([ce()],ka.prototype,"isSSTWindowOpen",void 0),Ea([ce()],ka.prototype,"isTextUsWindowOpen",void 0),Ea([ce()],ka.prototype,"isCalculatorWindowOpen",void 0),Ea([ce()],ka.prototype,"isMobileFeaturesExpanded",void 0),ka=Ea([se("meetelise-launcher")],ka);const Ta=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",ka)},_a=["app.meetelise.com","staging.eliseai.com","localhost"],Oa={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"}},Pa=e=>{const t=window.location.hostname;if(!_a.includes(t))return e;const n=(e=>{if(!e)return{};try{return e.split(",").reduce((e,t)=>{const[n,i]=t.split(":");return n&&i&&n in Oa&&(e[n]="true"===i.toLowerCase()),e},{})}catch(e){return{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(n).length)return e;const i={...e};return Object.entries(n).forEach(([e,t])=>{const n=Oa[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var Ia=n(5072),Ma=n.n(Ia),Na=n(7825),Da=n.n(Na),La=n(7659),Ua=n.n(La),Ra=n(5056),Ba=n.n(Ra),ja=n(540),Fa=n.n(ja),Ha=n(1113),$a=n.n(Ha),za=n(5541),Ga={};Ga.styleTagTransform=$a(),Ga.setAttributes=Ba(),Ga.insert=Ua().bind(null,"head"),Ga.domAPI=Da(),Ga.insertStyleElement=Fa();Ma()(za.A,Ga);za.A&&za.A.locals&&za.A.locals;async function Qa(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${t}/lead-sources`);if(n.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return n.data.filter(t=>e.includes(t))}return Wa(n.data,t)}return[]}catch(e){return[]}}const Wa=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter(e=>{const t=e.toLowerCase();return!n.map(e=>e.toLowerCase()).includes(t)})};async function qa(e){var t,n;if(!e)return!1;try{return null!==(n=null===(t=(await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/aip`)).data)||void 0===t?void 0:t.is_aip)&&void 0!==n&&n}catch(e){return!1}}var Va,Ya=n(8805),Ka=n.n(Ya),Xa=new Uint8Array(16);function Za(){if(!Va&&!(Va="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 Va(Xa)}const Ja=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const es=function(e){return"string"==typeof e&&Ja.test(e)};for(var ts=[],ns=0;ns<256;++ns)ts.push((ns+256).toString(16).substr(1));const is=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(ts[e[t+0]]+ts[e[t+1]]+ts[e[t+2]]+ts[e[t+3]]+"-"+ts[e[t+4]]+ts[e[t+5]]+"-"+ts[e[t+6]]+ts[e[t+7]]+"-"+ts[e[t+8]]+ts[e[t+9]]+"-"+ts[e[t+10]]+ts[e[t+11]]+ts[e[t+12]]+ts[e[t+13]]+ts[e[t+14]]+ts[e[t+15]]).toLowerCase();if(!es(n))throw TypeError("Stringified UUID is invalid");return n};const rs=function(e,t,n){var i=(e=e||{}).random||(e.rng||Za)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return is(i)},os=e=>localStorage.removeItem("com.elise.webchat.slug="+e),as=(e,t,n)=>{const i=On(new Date),r=n||`lead_${rs()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Rn(i),buildingSlug:e,initiatedChat:t}},ss=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(ls(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},ls=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(dn(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!wn(t.timestamp,24)},us=()=>{const e={};try{e.page_url=window.location.href,document.referrer&&(e.referrer=document.referrer),document.title&&(e.document_title=document.title),window.screen&&(e.screen_width=window.screen.width,e.screen_height=window.screen.height),e.device_pixel_ratio=window.devicePixelRatio,e.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,e.campaign_sources=JSON.stringify(Si());const t=Cn("_ga");t&&(e.ga_client_id=t)}catch(e){}return e};var cs;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(cs||(cs={}));const ds=e=>e.type===ps.text,hs=e=>e.type===ps.media;var ps;!function(e){e.text="text",e.media="media"}(ps||(ps={}));const fs=class{constructor(e,t,n,i=null,r,o,a=null,s=gu.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=gu.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.sessionToken=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;const i={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,i],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==cs.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:r}),!r&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=r,"ai_message"===e.message.customType){this.simpleChatMessages.some(e=>e.type===ps.text&&e.message.includes("confirmed for your"))&&li("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.streamingMessageTimeout=null,this.checkAndHandleDelayStreamingMessages=({delayToFetchHistoryInMs:e=1e4}={})=>{this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null);const t=this.simpleChatMessages.some(e=>{if(!ds(e))return!1;const t=e.chunks.find(e=>e.isDone);return!t||e.chunks.length===t.order});t&&(this.streamingMessageTimeout=setTimeout(()=>{Ei({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:Ai.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory()},e))},this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return!1}})(e.message.text))return;li("leadProvidedEmail",{buildingId:null===(t=this.buildingWebchatView)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===cs.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.buildingWebchatView&&Ei({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:Ai.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=as(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken(async()=>{var t,n,i,r,o,a,s,l,u;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout(()=>{this.buildingWebchatView&&Ei({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:Ai.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===gu.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),orgSlug:this.orgSlug}}):(await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),lead_sources_with_timestamps:(null!==(o=null===(r=this.leadSourceMultitouchClient)||void 0===r?void 0:r.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:null}))&&void 0!==o?o:[]).map(e=>gn({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(li("firstChatMessageSent",{message:e,buildingId:null===(l=this.buildingWebchatView)||void 0===l?void 0:l.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),li("chatMessageSent",{message:e,buildingId:null===(u=this.buildingWebchatView)||void 0===u?void 0:u.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))}),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.removeDuplicatedRawPubnubMessages=e=>{const t=new Set;return e.filter(e=>{if("lead_message"===e.message.customType||!e.message.stream_id||!e.message.order)return!0;const n=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(n)?(Ei({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:Ai.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(n),!0)})},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return this.removeDuplicatedRawPubnubMessages(e).forEach(e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:ps.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:ps.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]}),Object.keys(n).forEach(e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),o=r.map(e=>e.message.text).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map(e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}}),type:ps.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)}),t.sort((e,t)=>e.timestamp-t.timestamp),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find(e=>e.message.is_done);return!t||e.length===t.message.order},this.buildingSlug=e,this.buildingWebchatView=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=a,this.leadSourceMultitouchClient=o,this.widgetType=s}async initSession(e,t,n){try{const i={building_slug:e,org_slug:t,client_context:us()};n&&(i.lead_id=n);const o=await r().post(`${this.apiHost}/platformApi/webchat/init`,i);return this.sessionToken=o.data.session_token,this.leadUserId=o.data.lead_id,this.channel=o.data.channel,o.data}catch(e){return this.buildingWebchatView&&Ei({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:Ai.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),null}}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(Ka())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken(()=>new Promise(()=>this.handleChatListeners())),await this.withAuthToken(()=>this.getChannelHistory()),this.pubnub):void 0}async fetchToken(e,t){try{if(this.sessionToken){const e="healthcare"===this.widgetType?"?industry=health_care":"";return(await r().get(`${this.apiHost}/platformApi/webchat/pn/v2/request-token${e}`,{headers:{"X-Session-Token":this.sessionToken}})).data}return(await r().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${t}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&Ei({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:Ai.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await r().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&Ei({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:Ai.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(e){try{await e()}catch(t){if(t instanceof i.AxiosError&&t&&t.response&&403===t.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const t=await this.fetchToken(this.leadUserId,this.channel);if(!t)return;this.pubnub.setAuthKey(t.auth.result.token),await e()}catch(e){this.buildingWebchatView&&Ei({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:Ai.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},(e,t)=>{e.error?o(e):n(t)})}),a=o.channels[this.channel];if(!a)break;if(a.sort((e,t)=>+e.timetoken-+t.timetoken),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach(e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})}),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter(e=>e.message.messageType!==cs.noReply))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.buildingWebchatView&&Ei({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:Ai.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},gs=new Set(["8009855990","8338526262","8002221222","8006624357","8002738255","8007997233","8007874889","8006564673","8004224453","8883737888","8006213362","8009506264","8558272736","8008435678","8007862929","8008523836","8007849433","8007729100","8006699777","8006858470","8004322209","8003473735","8008778339","8009552232","8002255342","8009272891","8003049320","8007937724","8002382333","8003353863","8776858878","8003329227","8776554371","8772944357","8772944356","6092925760","6092926735","8007928339","8008329173","8882853036","6092921210","8007929773","8003561561","8003826717","8005727233","8009291040","8888958179","8006879512","8004262537","8773475463","8774149251","8005103102","8889372835","8007010710","8007010720","8774288844","8007929745","8003283838","6092927060","6092928319","8008527899","8662401347","8009923678","8776522873","8776527624","8003313937","8008435437","8776536783","8778392339","8003676274","8006896411"]),ms=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return gs.has(t)},ys=(e,t,n)=>{try{const i=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1"),r=`tel:${i}`,o=`sms:${i}`,a=`whatsapp://send?phone=${i}`,s=`facetime:${i}`,l=`facetime-audio:${i}`,u=/(?:\+1[\s.-]?)?(?:\(\d{3}\)[\s.-]?|\d{3}[\s.-])\d{3}[\s.-]?\d{4}/g,c=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,d=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=/emergency|emergencia/i,f=300,g=e=>!(!e||e.length>f)&&p.test(e),m=e=>{var t,n,i,r;if(g(e.textContent))return!0;if(g(null===(t=e.previousElementSibling)||void 0===t?void 0:t.textContent)||g(null===(n=e.nextElementSibling)||void 0===n?void 0:n.textContent))return!0;const o=e.parentElement;return!(!o||!g(null===(i=o.previousElementSibling)||void 0===i?void 0:i.textContent)&&!g(null===(r=o.nextElementSibling)||void 0===r?void 0:r.textContent))},y=document.body.getElementsByTagName("*");let b=!1;const v=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let w=!1,C=!1,x=0;for(let e=0;e<y.length;e++)if(y[e].nodeType===Node.ELEMENT_NODE&&!m(y[e])){if(1===y[e].childNodes.length&&y[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=y[e].textContent;if(!t)continue;const n=t.replace(u,e=>{if(ms(e))return e;return e.startsWith("+1 ")?`+1 ${v}`:v});t!==n&&(x++,y[e].textContent=n),b=!0,w||(w=!0)}if(y[e].hasAttribute("href")){const t=y[e].getAttribute("href");if(!t)continue;let n="",i=c;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=d):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,ms(t))continue;const u=t.replace(i,n);if(y[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&y[e].setAttribute("href",t.startsWith("tel:")?r:o)}C||(C=!0)}}return w&&Ei({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:Ai.info,buildingSlug:n,orgSlug:t}),C&&Ei({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:Ai.info,buildingSlug:n,orgSlug:t}),b||Ei({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:Ai.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Ei({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:Ai.error,buildingSlug:n,orgSlug:t}),0}};var bs=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let vs=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Ue,this.toExpand=!1}render(){return B`
5818
5818
  <button
5819
5819
  class=${this.toExpand?"button-container mini":"button-container"}
5820
5820
  @click=${this.onClick}
@@ -5827,7 +5827,7 @@ xmlns="http://www.w3.org/2000/svg"
5827
5827
  ${this.toExpand?B`<div class="chevron-up">${ma("white")}</div>`:B` <div class="x-icon">${oo("white")}</div>`}
5828
5828
  </div>
5829
5829
  </button>
5830
- `}};bs.styles=[u`
5830
+ `}};vs.styles=[u`
5831
5831
  .button-container {
5832
5832
  width: 56px;
5833
5833
  height: 56px;
@@ -5877,7 +5877,7 @@ xmlns="http://www.w3.org/2000/svg"
5877
5877
  cursor: pointer;
5878
5878
  filter: brightness(90%);
5879
5879
  }
5880
- `],ys([ue({attribute:!0})],bs.prototype,"onClick",void 0),ys([ue({attribute:!0})],bs.prototype,"primaryColor",void 0),ys([ue({attribute:!0})],bs.prototype,"toExpand",void 0),bs=ys([se("minimize-expand-button")],bs);const vs=u`
5880
+ `],bs([ue({attribute:!0})],vs.prototype,"onClick",void 0),bs([ue({attribute:!0})],vs.prototype,"primaryColor",void 0),bs([ue({attribute:!0})],vs.prototype,"toExpand",void 0),vs=bs([se("minimize-expand-button")],vs);const ws=u`
5881
5881
  #healthchat-container {
5882
5882
  position: fixed;
5883
5883
 
@@ -5995,7 +5995,7 @@ xmlns="http://www.w3.org/2000/svg"
5995
5995
  .health-bttn-allow-access {
5996
5996
  padding-right: 28px;
5997
5997
  }
5998
- `,ws=u`
5998
+ `,Cs=u`
5999
5999
  #pubnub-chat-container {
6000
6000
  position: fixed;
6001
6001
 
@@ -6115,7 +6115,7 @@ xmlns="http://www.w3.org/2000/svg"
6115
6115
  border: none;
6116
6116
  cursor: pointer;
6117
6117
  }
6118
- `,Cs=u`
6118
+ `,xs=u`
6119
6119
  #header-text {
6120
6120
  font-size: 12px;
6121
6121
  font-weight: 700;
@@ -6316,7 +6316,7 @@ xmlns="http://www.w3.org/2000/svg"
6316
6316
  .checkbox:hover {
6317
6317
  opacity: 0.5;
6318
6318
  }
6319
- `,{entries:xs,setPrototypeOf:Ss,isFrozen:As,getPrototypeOf:Es,getOwnPropertyDescriptor:ks}=Object;let{freeze:Ts,seal:_s,create:Os}=Object,{apply:Ps,construct:Is}="undefined"!=typeof Reflect&&Reflect;Ts||(Ts=function(e){return e}),_s||(_s=function(e){return e}),Ps||(Ps=function(e,t,n){return e.apply(t,n)}),Is||(Is=function(e,t){return new e(...t)});const Ms=qs(Array.prototype.forEach),Ns=qs(Array.prototype.lastIndexOf),Ds=qs(Array.prototype.pop),Ls=qs(Array.prototype.push),Us=qs(Array.prototype.splice),Rs=qs(String.prototype.toLowerCase),Bs=qs(String.prototype.toString),js=qs(String.prototype.match),Fs=qs(String.prototype.replace),Hs=qs(String.prototype.indexOf),$s=qs(String.prototype.trim),zs=qs(Object.prototype.hasOwnProperty),Gs=qs(RegExp.prototype.test),Qs=(Ws=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Is(Ws,t)});var Ws;function qs(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return Ps(e,t,i)}}function Vs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Rs;Ss&&Ss(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(As(t)||(t[i]=e),r=e)}e[r]=!0}return e}function Ys(e){for(let t=0;t<e.length;t++){zs(e,t)||(e[t]=null)}return e}function Ks(e){const t=Os(null);for(const[n,i]of xs(e)){zs(e,n)&&(Array.isArray(i)?t[n]=Ys(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=Ks(i):t[n]=i)}return t}function Xs(e,t){for(;null!==e;){const n=ks(e,t);if(n){if(n.get)return qs(n.get);if("function"==typeof n.value)return qs(n.value)}e=Es(e)}return function(){return null}}const Zs=Ts(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Js=Ts(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),el=Ts(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),tl=Ts(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),nl=Ts(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),il=Ts(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),rl=Ts(["#text"]),ol=Ts(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),al=Ts(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),sl=Ts(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ll=Ts(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ul=_s(/\{\{[\w\W]*|[\w\W]*\}\}/gm),cl=_s(/<%[\w\W]*|[\w\W]*%>/gm),dl=_s(/\$\{[\w\W]*/gm),hl=_s(/^data-[\-\w.\u00B7-\uFFFF]+$/),pl=_s(/^aria-[\-\w]+$/),fl=_s(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),gl=_s(/^(?:\w+script|data):/i),ml=_s(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),yl=_s(/^html$/i),bl=_s(/^[a-z][.\w]*(-[.\w]+)+$/i);var vl=Object.freeze({__proto__:null,ARIA_ATTR:pl,ATTR_WHITESPACE:ml,CUSTOM_ELEMENT:bl,DATA_ATTR:hl,DOCTYPE_NAME:yl,ERB_EXPR:cl,IS_ALLOWED_URI:fl,IS_SCRIPT_OR_DATA:gl,MUSTACHE_EXPR:ul,TMPLIT_EXPR:dl});const wl=1,Cl=3,xl=7,Sl=8,Al=9,El=function(){return"undefined"==typeof window?null:window};var kl=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:El();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==Al||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const r=i,o=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:u,NodeFilter:c,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:p,trustedTypes:f}=t,g=u.prototype,m=Xs(g,"cloneNode"),y=Xs(g,"remove"),b=Xs(g,"nextSibling"),v=Xs(g,"childNodes"),w=Xs(g,"parentNode");if("function"==typeof s){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let C,x="";const{implementation:S,createNodeIterator:A,createDocumentFragment:E,getElementsByTagName:k}=i,{importNode:T}=r;let _={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof xs&&"function"==typeof w&&S&&void 0!==S.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:P,TMPLIT_EXPR:I,DATA_ATTR:M,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:D,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:U}=vl;let{IS_ALLOWED_URI:R}=vl,B=null;const j=Vs({},[...Zs,...Js,...el,...nl,...rl]);let F=null;const H=Vs({},[...ol,...al,...sl,...ll]);let $=Object.seal(Os(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),z=null,G=null,Q=!0,W=!0,q=!1,V=!0,Y=!1,K=!0,X=!1,Z=!1,J=!1,ee=!1,te=!1,ne=!1,ie=!0,re=!1,oe=!0,ae=!1,se={},le=null;const ue=Vs({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ce=null;const de=Vs({},["audio","video","img","source","image","track"]);let he=null;const pe=Vs({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let ye=me,be=!1,ve=null;const we=Vs({},[fe,ge,me],Bs);let Ce=Vs({},["mi","mo","mn","ms","mtext"]),xe=Vs({},["annotation-xml"]);const Se=Vs({},["title","style","font","a","script"]);let Ae=null;const Ee=["application/xhtml+xml","text/html"];let ke=null,Te=null;const _e=i.createElement("form"),Oe=function(e){return e instanceof RegExp||e instanceof Function},Pe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Te||Te!==e){if(e&&"object"==typeof e||(e={}),e=Ks(e),Ae=-1===Ee.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ke="application/xhtml+xml"===Ae?Bs:Rs,B=zs(e,"ALLOWED_TAGS")?Vs({},e.ALLOWED_TAGS,ke):j,F=zs(e,"ALLOWED_ATTR")?Vs({},e.ALLOWED_ATTR,ke):H,ve=zs(e,"ALLOWED_NAMESPACES")?Vs({},e.ALLOWED_NAMESPACES,Bs):we,he=zs(e,"ADD_URI_SAFE_ATTR")?Vs(Ks(pe),e.ADD_URI_SAFE_ATTR,ke):pe,ce=zs(e,"ADD_DATA_URI_TAGS")?Vs(Ks(de),e.ADD_DATA_URI_TAGS,ke):de,le=zs(e,"FORBID_CONTENTS")?Vs({},e.FORBID_CONTENTS,ke):ue,z=zs(e,"FORBID_TAGS")?Vs({},e.FORBID_TAGS,ke):Ks({}),G=zs(e,"FORBID_ATTR")?Vs({},e.FORBID_ATTR,ke):Ks({}),se=!!zs(e,"USE_PROFILES")&&e.USE_PROFILES,Q=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,V=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,K=!1!==e.SAFE_FOR_XML,X=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,J=e.FORCE_BODY||!1,ie=!1!==e.SANITIZE_DOM,re=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ae=e.IN_PLACE||!1,R=e.ALLOWED_URI_REGEXP||fl,ye=e.NAMESPACE||me,Ce=e.MATHML_TEXT_INTEGRATION_POINTS||Ce,xe=e.HTML_INTEGRATION_POINTS||xe,$=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Oe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&($.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Oe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&($.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&($.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(W=!1),te&&(ee=!0),se&&(B=Vs({},rl),F=[],!0===se.html&&(Vs(B,Zs),Vs(F,ol)),!0===se.svg&&(Vs(B,Js),Vs(F,al),Vs(F,ll)),!0===se.svgFilters&&(Vs(B,el),Vs(F,al),Vs(F,ll)),!0===se.mathMl&&(Vs(B,nl),Vs(F,sl),Vs(F,ll))),e.ADD_TAGS&&(B===j&&(B=Ks(B)),Vs(B,e.ADD_TAGS,ke)),e.ADD_ATTR&&(F===H&&(F=Ks(F)),Vs(F,e.ADD_ATTR,ke)),e.ADD_URI_SAFE_ATTR&&Vs(he,e.ADD_URI_SAFE_ATTR,ke),e.FORBID_CONTENTS&&(le===ue&&(le=Ks(le)),Vs(le,e.FORBID_CONTENTS,ke)),oe&&(B["#text"]=!0),X&&Vs(B,["html","head","body"]),B.table&&(Vs(B,["tbody"]),delete z.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Qs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Qs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=e.TRUSTED_TYPES_POLICY,x=C.createHTML("")}else void 0===C&&(C=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return null}}(f,o)),null!==C&&"string"==typeof x&&(x=C.createHTML(""));Ts&&Ts(e),Te=e}},Ie=Vs({},[...Js,...el,...tl]),Me=Vs({},[...nl,...il]),Ne=function(e){Ls(n.removed,{element:e});try{w(e).removeChild(e)}catch(t){y(e)}},De=function(e,t){try{Ls(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Ls(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Ne(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Le=function(e){let t=null,n=null;if(J)e="<remove></remove>"+e;else{const t=js(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Ae&&ye===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=C?C.createHTML(e):e;if(ye===me)try{t=(new p).parseFromString(r,Ae)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(ye,"template",null);try{t.documentElement.innerHTML=be?x:r}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(i.createTextNode(n),o.childNodes[0]||null),ye===me?k.call(t,X?"html":"body")[0]:X?t.documentElement:o},Ue=function(e){return A.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Re=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Be=function(e){return"function"==typeof l&&e instanceof l};function je(e,t,i){Ms(e,e=>{e.call(n,t,i,Te)})}const Fe=function(e){let t=null;if(je(_.beforeSanitizeElements,e,null),Re(e))return Ne(e),!0;const i=ke(e.nodeName);if(je(_.uponSanitizeElement,e,{tagName:i,allowedTags:B}),K&&e.hasChildNodes()&&!Be(e.firstElementChild)&&Gs(/<[/\w!]/g,e.innerHTML)&&Gs(/<[/\w!]/g,e.textContent))return Ne(e),!0;if(e.nodeType===xl)return Ne(e),!0;if(K&&e.nodeType===Sl&&Gs(/<[/\w]/g,e.data))return Ne(e),!0;if(!B[i]||z[i]){if(!z[i]&&$e(i)){if($.tagNameCheck instanceof RegExp&&Gs($.tagNameCheck,i))return!1;if($.tagNameCheck instanceof Function&&$.tagNameCheck(i))return!1}if(oe&&!le[i]){const t=w(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const r=m(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,b(e))}}}return Ne(e),!0}return e instanceof u&&!function(e){let t=w(e);t&&t.tagName||(t={namespaceURI:ye,tagName:"template"});const n=Rs(e.tagName),i=Rs(t.tagName);return!!ve[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===me?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===i||Ce[i]):Boolean(Ie[n]):e.namespaceURI===fe?t.namespaceURI===me?"math"===n:t.namespaceURI===ge?"math"===n&&xe[i]:Boolean(Me[n]):e.namespaceURI===me?!(t.namespaceURI===ge&&!xe[i])&&!(t.namespaceURI===fe&&!Ce[i])&&!Me[n]&&(Se[n]||!Ie[n]):!("application/xhtml+xml"!==Ae||!ve[e.namespaceURI]))}(e)?(Ne(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!Gs(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===Cl&&(t=e.textContent,Ms([O,P,I],e=>{t=Fs(t,e," ")}),e.textContent!==t&&(Ls(n.removed,{element:e.cloneNode()}),e.textContent=t)),je(_.afterSanitizeElements,e,null),!1):(Ne(e),!0)},He=function(e,t,n){if(ie&&("id"===t||"name"===t)&&(n in i||n in _e))return!1;if(W&&!G[t]&&Gs(M,t));else if(Q&&Gs(N,t));else if(!F[t]||G[t]){if(!($e(e)&&($.tagNameCheck instanceof RegExp&&Gs($.tagNameCheck,e)||$.tagNameCheck instanceof Function&&$.tagNameCheck(e))&&($.attributeNameCheck instanceof RegExp&&Gs($.attributeNameCheck,t)||$.attributeNameCheck instanceof Function&&$.attributeNameCheck(t))||"is"===t&&$.allowCustomizedBuiltInElements&&($.tagNameCheck instanceof RegExp&&Gs($.tagNameCheck,n)||$.tagNameCheck instanceof Function&&$.tagNameCheck(n))))return!1}else if(he[t]);else if(Gs(R,Fs(n,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Hs(n,"data:")||!ce[e]){if(q&&!Gs(D,Fs(n,L,"")));else if(n)return!1}else;return!0},$e=function(e){return"annotation-xml"!==e&&js(e,U)},ze=function(e){je(_.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Re(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0};let r=t.length;for(;r--;){const o=t[r],{name:a,namespaceURI:s,value:l}=o,u=ke(a),c=l;let d="value"===a?c:$s(c);if(i.attrName=u,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,je(_.uponSanitizeAttribute,e,i),d=i.attrValue,!re||"id"!==u&&"name"!==u||(De(a,e),d="user-content-"+d),K&&Gs(/((--!?|])>)|<\/(style|title)/i,d)){De(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){De(a,e);continue}if(!V&&Gs(/\/>/i,d)){De(a,e);continue}Y&&Ms([O,P,I],e=>{d=Fs(d,e," ")});const h=ke(e.nodeName);if(He(h,u,d)){if(C&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(s);else switch(f.getAttributeType(h,u)){case"TrustedHTML":d=C.createHTML(d);break;case"TrustedScriptURL":d=C.createScriptURL(d)}if(d!==c)try{s?e.setAttributeNS(s,a,d):e.setAttribute(a,d),Re(e)?Ne(e):Ds(n.removed)}catch(t){De(a,e)}}else De(a,e)}je(_.afterSanitizeAttributes,e,null)},Ge=function e(t){let n=null;const i=Ue(t);for(je(_.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)je(_.uponSanitizeShadowNode,n,null),Fe(n),ze(n),n.content instanceof a&&e(n.content);je(_.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,o=null,s=null,u=null;if(be=!e,be&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw Qs("toString is not a function");if("string"!=typeof(e=e.toString()))throw Qs("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Z||Pe(t),n.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=ke(e.nodeName);if(!B[t]||z[t])throw Qs("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=Le("\x3c!----\x3e"),o=i.ownerDocument.importNode(e,!0),o.nodeType===wl&&"BODY"===o.nodeName||"HTML"===o.nodeName?i=o:i.appendChild(o);else{if(!ee&&!Y&&!X&&-1===e.indexOf("<"))return C&&ne?C.createHTML(e):e;if(i=Le(e),!i)return ee?null:ne?x:""}i&&J&&Ne(i.firstChild);const c=Ue(ae?e:i);for(;s=c.nextNode();)Fe(s),ze(s),s.content instanceof a&&Ge(s.content);if(ae)return e;if(ee){if(te)for(u=E.call(i.ownerDocument);i.firstChild;)u.appendChild(i.firstChild);else u=i;return(F.shadowroot||F.shadowrootmode)&&(u=T.call(r,u,!0)),u}let d=X?i.outerHTML:i.innerHTML;return X&&B["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Gs(yl,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),Y&&Ms([O,P,I],e=>{d=Fs(d,e," ")}),C&&ne?C.createHTML(d):d},n.setConfig=function(){Pe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},n.clearConfig=function(){Te=null,Z=!1},n.isValidAttribute=function(e,t,n){Te||Pe({});const i=ke(e),r=ke(t);return He(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&Ls(_[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=Ns(_[e],t);return-1===n?void 0:Us(_[e],n,1)[0]}return Ds(_[e])},n.removeHooks=function(e){_[e]=[]},n.removeAllHooks=function(){_={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Tl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let _l=class extends oe{constructor(){super(...arguments),this.spinSpeed=.4}updated(){this.style.setProperty("--spin-duration",`${this.spinSpeed}s`)}render(){return B`<div class="spinner"></div>`}};_l.styles=u`
6319
+ `,{entries:Ss,setPrototypeOf:As,isFrozen:Es,getPrototypeOf:ks,getOwnPropertyDescriptor:Ts}=Object;let{freeze:_s,seal:Os,create:Ps}=Object,{apply:Is,construct:Ms}="undefined"!=typeof Reflect&&Reflect;_s||(_s=function(e){return e}),Os||(Os=function(e){return e}),Is||(Is=function(e,t,n){return e.apply(t,n)}),Ms||(Ms=function(e,t){return new e(...t)});const Ns=Vs(Array.prototype.forEach),Ds=Vs(Array.prototype.lastIndexOf),Ls=Vs(Array.prototype.pop),Us=Vs(Array.prototype.push),Rs=Vs(Array.prototype.splice),Bs=Vs(String.prototype.toLowerCase),js=Vs(String.prototype.toString),Fs=Vs(String.prototype.match),Hs=Vs(String.prototype.replace),$s=Vs(String.prototype.indexOf),zs=Vs(String.prototype.trim),Gs=Vs(Object.prototype.hasOwnProperty),Qs=Vs(RegExp.prototype.test),Ws=(qs=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Ms(qs,t)});var qs;function Vs(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return Is(e,t,i)}}function Ys(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Bs;As&&As(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(Es(t)||(t[i]=e),r=e)}e[r]=!0}return e}function Ks(e){for(let t=0;t<e.length;t++){Gs(e,t)||(e[t]=null)}return e}function Xs(e){const t=Ps(null);for(const[n,i]of Ss(e)){Gs(e,n)&&(Array.isArray(i)?t[n]=Ks(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=Xs(i):t[n]=i)}return t}function Zs(e,t){for(;null!==e;){const n=Ts(e,t);if(n){if(n.get)return Vs(n.get);if("function"==typeof n.value)return Vs(n.value)}e=ks(e)}return function(){return null}}const Js=_s(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),el=_s(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),tl=_s(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),nl=_s(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),il=_s(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),rl=_s(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ol=_s(["#text"]),al=_s(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),sl=_s(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ll=_s(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ul=_s(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),cl=Os(/\{\{[\w\W]*|[\w\W]*\}\}/gm),dl=Os(/<%[\w\W]*|[\w\W]*%>/gm),hl=Os(/\$\{[\w\W]*/gm),pl=Os(/^data-[\-\w.\u00B7-\uFFFF]+$/),fl=Os(/^aria-[\-\w]+$/),gl=Os(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ml=Os(/^(?:\w+script|data):/i),yl=Os(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bl=Os(/^html$/i),vl=Os(/^[a-z][.\w]*(-[.\w]+)+$/i);var wl=Object.freeze({__proto__:null,ARIA_ATTR:fl,ATTR_WHITESPACE:yl,CUSTOM_ELEMENT:vl,DATA_ATTR:pl,DOCTYPE_NAME:bl,ERB_EXPR:dl,IS_ALLOWED_URI:gl,IS_SCRIPT_OR_DATA:ml,MUSTACHE_EXPR:cl,TMPLIT_EXPR:hl});const Cl=1,xl=3,Sl=7,Al=8,El=9,kl=function(){return"undefined"==typeof window?null:window};var Tl=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:kl();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==El||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const r=i,o=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:u,NodeFilter:c,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:p,trustedTypes:f}=t,g=u.prototype,m=Zs(g,"cloneNode"),y=Zs(g,"remove"),b=Zs(g,"nextSibling"),v=Zs(g,"childNodes"),w=Zs(g,"parentNode");if("function"==typeof s){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let C,x="";const{implementation:S,createNodeIterator:A,createDocumentFragment:E,getElementsByTagName:k}=i,{importNode:T}=r;let _={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Ss&&"function"==typeof w&&S&&void 0!==S.createHTMLDocument;const{MUSTACHE_EXPR:O,ERB_EXPR:P,TMPLIT_EXPR:I,DATA_ATTR:M,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:D,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:U}=wl;let{IS_ALLOWED_URI:R}=wl,B=null;const j=Ys({},[...Js,...el,...tl,...il,...ol]);let F=null;const H=Ys({},[...al,...sl,...ll,...ul]);let $=Object.seal(Ps(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),z=null,G=null,Q=!0,W=!0,q=!1,V=!0,Y=!1,K=!0,X=!1,Z=!1,J=!1,ee=!1,te=!1,ne=!1,ie=!0,re=!1,oe=!0,ae=!1,se={},le=null;const ue=Ys({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ce=null;const de=Ys({},["audio","video","img","source","image","track"]);let he=null;const pe=Ys({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let ye=me,be=!1,ve=null;const we=Ys({},[fe,ge,me],js);let Ce=Ys({},["mi","mo","mn","ms","mtext"]),xe=Ys({},["annotation-xml"]);const Se=Ys({},["title","style","font","a","script"]);let Ae=null;const Ee=["application/xhtml+xml","text/html"];let ke=null,Te=null;const _e=i.createElement("form"),Oe=function(e){return e instanceof RegExp||e instanceof Function},Pe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Te||Te!==e){if(e&&"object"==typeof e||(e={}),e=Xs(e),Ae=-1===Ee.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ke="application/xhtml+xml"===Ae?js:Bs,B=Gs(e,"ALLOWED_TAGS")?Ys({},e.ALLOWED_TAGS,ke):j,F=Gs(e,"ALLOWED_ATTR")?Ys({},e.ALLOWED_ATTR,ke):H,ve=Gs(e,"ALLOWED_NAMESPACES")?Ys({},e.ALLOWED_NAMESPACES,js):we,he=Gs(e,"ADD_URI_SAFE_ATTR")?Ys(Xs(pe),e.ADD_URI_SAFE_ATTR,ke):pe,ce=Gs(e,"ADD_DATA_URI_TAGS")?Ys(Xs(de),e.ADD_DATA_URI_TAGS,ke):de,le=Gs(e,"FORBID_CONTENTS")?Ys({},e.FORBID_CONTENTS,ke):ue,z=Gs(e,"FORBID_TAGS")?Ys({},e.FORBID_TAGS,ke):Xs({}),G=Gs(e,"FORBID_ATTR")?Ys({},e.FORBID_ATTR,ke):Xs({}),se=!!Gs(e,"USE_PROFILES")&&e.USE_PROFILES,Q=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,V=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,K=!1!==e.SAFE_FOR_XML,X=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,ne=e.RETURN_TRUSTED_TYPE||!1,J=e.FORCE_BODY||!1,ie=!1!==e.SANITIZE_DOM,re=e.SANITIZE_NAMED_PROPS||!1,oe=!1!==e.KEEP_CONTENT,ae=e.IN_PLACE||!1,R=e.ALLOWED_URI_REGEXP||gl,ye=e.NAMESPACE||me,Ce=e.MATHML_TEXT_INTEGRATION_POINTS||Ce,xe=e.HTML_INTEGRATION_POINTS||xe,$=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Oe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&($.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Oe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&($.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&($.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(W=!1),te&&(ee=!0),se&&(B=Ys({},ol),F=[],!0===se.html&&(Ys(B,Js),Ys(F,al)),!0===se.svg&&(Ys(B,el),Ys(F,sl),Ys(F,ul)),!0===se.svgFilters&&(Ys(B,tl),Ys(F,sl),Ys(F,ul)),!0===se.mathMl&&(Ys(B,il),Ys(F,ll),Ys(F,ul))),e.ADD_TAGS&&(B===j&&(B=Xs(B)),Ys(B,e.ADD_TAGS,ke)),e.ADD_ATTR&&(F===H&&(F=Xs(F)),Ys(F,e.ADD_ATTR,ke)),e.ADD_URI_SAFE_ATTR&&Ys(he,e.ADD_URI_SAFE_ATTR,ke),e.FORBID_CONTENTS&&(le===ue&&(le=Xs(le)),Ys(le,e.FORBID_CONTENTS,ke)),oe&&(B["#text"]=!0),X&&Ys(B,["html","head","body"]),B.table&&(Ys(B,["tbody"]),delete z.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Ws('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Ws('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=e.TRUSTED_TYPES_POLICY,x=C.createHTML("")}else void 0===C&&(C=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return null}}(f,o)),null!==C&&"string"==typeof x&&(x=C.createHTML(""));_s&&_s(e),Te=e}},Ie=Ys({},[...el,...tl,...nl]),Me=Ys({},[...il,...rl]),Ne=function(e){Us(n.removed,{element:e});try{w(e).removeChild(e)}catch(t){y(e)}},De=function(e,t){try{Us(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Us(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Ne(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Le=function(e){let t=null,n=null;if(J)e="<remove></remove>"+e;else{const t=Fs(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Ae&&ye===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=C?C.createHTML(e):e;if(ye===me)try{t=(new p).parseFromString(r,Ae)}catch(e){}if(!t||!t.documentElement){t=S.createDocument(ye,"template",null);try{t.documentElement.innerHTML=be?x:r}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(i.createTextNode(n),o.childNodes[0]||null),ye===me?k.call(t,X?"html":"body")[0]:X?t.documentElement:o},Ue=function(e){return A.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Re=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Be=function(e){return"function"==typeof l&&e instanceof l};function je(e,t,i){Ns(e,e=>{e.call(n,t,i,Te)})}const Fe=function(e){let t=null;if(je(_.beforeSanitizeElements,e,null),Re(e))return Ne(e),!0;const i=ke(e.nodeName);if(je(_.uponSanitizeElement,e,{tagName:i,allowedTags:B}),K&&e.hasChildNodes()&&!Be(e.firstElementChild)&&Qs(/<[/\w!]/g,e.innerHTML)&&Qs(/<[/\w!]/g,e.textContent))return Ne(e),!0;if(e.nodeType===Sl)return Ne(e),!0;if(K&&e.nodeType===Al&&Qs(/<[/\w]/g,e.data))return Ne(e),!0;if(!B[i]||z[i]){if(!z[i]&&$e(i)){if($.tagNameCheck instanceof RegExp&&Qs($.tagNameCheck,i))return!1;if($.tagNameCheck instanceof Function&&$.tagNameCheck(i))return!1}if(oe&&!le[i]){const t=w(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const r=m(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,b(e))}}}return Ne(e),!0}return e instanceof u&&!function(e){let t=w(e);t&&t.tagName||(t={namespaceURI:ye,tagName:"template"});const n=Bs(e.tagName),i=Bs(t.tagName);return!!ve[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===me?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===i||Ce[i]):Boolean(Ie[n]):e.namespaceURI===fe?t.namespaceURI===me?"math"===n:t.namespaceURI===ge?"math"===n&&xe[i]:Boolean(Me[n]):e.namespaceURI===me?!(t.namespaceURI===ge&&!xe[i])&&!(t.namespaceURI===fe&&!Ce[i])&&!Me[n]&&(Se[n]||!Ie[n]):!("application/xhtml+xml"!==Ae||!ve[e.namespaceURI]))}(e)?(Ne(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!Qs(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===xl&&(t=e.textContent,Ns([O,P,I],e=>{t=Hs(t,e," ")}),e.textContent!==t&&(Us(n.removed,{element:e.cloneNode()}),e.textContent=t)),je(_.afterSanitizeElements,e,null),!1):(Ne(e),!0)},He=function(e,t,n){if(ie&&("id"===t||"name"===t)&&(n in i||n in _e))return!1;if(W&&!G[t]&&Qs(M,t));else if(Q&&Qs(N,t));else if(!F[t]||G[t]){if(!($e(e)&&($.tagNameCheck instanceof RegExp&&Qs($.tagNameCheck,e)||$.tagNameCheck instanceof Function&&$.tagNameCheck(e))&&($.attributeNameCheck instanceof RegExp&&Qs($.attributeNameCheck,t)||$.attributeNameCheck instanceof Function&&$.attributeNameCheck(t))||"is"===t&&$.allowCustomizedBuiltInElements&&($.tagNameCheck instanceof RegExp&&Qs($.tagNameCheck,n)||$.tagNameCheck instanceof Function&&$.tagNameCheck(n))))return!1}else if(he[t]);else if(Qs(R,Hs(n,L,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==$s(n,"data:")||!ce[e]){if(q&&!Qs(D,Hs(n,L,"")));else if(n)return!1}else;return!0},$e=function(e){return"annotation-xml"!==e&&Fs(e,U)},ze=function(e){je(_.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Re(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0};let r=t.length;for(;r--;){const o=t[r],{name:a,namespaceURI:s,value:l}=o,u=ke(a),c=l;let d="value"===a?c:zs(c);if(i.attrName=u,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,je(_.uponSanitizeAttribute,e,i),d=i.attrValue,!re||"id"!==u&&"name"!==u||(De(a,e),d="user-content-"+d),K&&Qs(/((--!?|])>)|<\/(style|title)/i,d)){De(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){De(a,e);continue}if(!V&&Qs(/\/>/i,d)){De(a,e);continue}Y&&Ns([O,P,I],e=>{d=Hs(d,e," ")});const h=ke(e.nodeName);if(He(h,u,d)){if(C&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(s);else switch(f.getAttributeType(h,u)){case"TrustedHTML":d=C.createHTML(d);break;case"TrustedScriptURL":d=C.createScriptURL(d)}if(d!==c)try{s?e.setAttributeNS(s,a,d):e.setAttribute(a,d),Re(e)?Ne(e):Ls(n.removed)}catch(t){De(a,e)}}else De(a,e)}je(_.afterSanitizeAttributes,e,null)},Ge=function e(t){let n=null;const i=Ue(t);for(je(_.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)je(_.uponSanitizeShadowNode,n,null),Fe(n),ze(n),n.content instanceof a&&e(n.content);je(_.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,o=null,s=null,u=null;if(be=!e,be&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Be(e)){if("function"!=typeof e.toString)throw Ws("toString is not a function");if("string"!=typeof(e=e.toString()))throw Ws("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Z||Pe(t),n.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=ke(e.nodeName);if(!B[t]||z[t])throw Ws("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=Le("\x3c!----\x3e"),o=i.ownerDocument.importNode(e,!0),o.nodeType===Cl&&"BODY"===o.nodeName||"HTML"===o.nodeName?i=o:i.appendChild(o);else{if(!ee&&!Y&&!X&&-1===e.indexOf("<"))return C&&ne?C.createHTML(e):e;if(i=Le(e),!i)return ee?null:ne?x:""}i&&J&&Ne(i.firstChild);const c=Ue(ae?e:i);for(;s=c.nextNode();)Fe(s),ze(s),s.content instanceof a&&Ge(s.content);if(ae)return e;if(ee){if(te)for(u=E.call(i.ownerDocument);i.firstChild;)u.appendChild(i.firstChild);else u=i;return(F.shadowroot||F.shadowrootmode)&&(u=T.call(r,u,!0)),u}let d=X?i.outerHTML:i.innerHTML;return X&&B["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Qs(bl,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),Y&&Ns([O,P,I],e=>{d=Hs(d,e," ")}),C&&ne?C.createHTML(d):d},n.setConfig=function(){Pe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Z=!0},n.clearConfig=function(){Te=null,Z=!1},n.isValidAttribute=function(e,t,n){Te||Pe({});const i=ke(e),r=ke(t);return He(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&Us(_[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=Ds(_[e],t);return-1===n?void 0:Rs(_[e],n,1)[0]}return Ls(_[e])},n.removeHooks=function(e){_[e]=[]},n.removeAllHooks=function(){_={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),_l=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Ol=class extends oe{constructor(){super(...arguments),this.spinSpeed=.4}updated(){this.style.setProperty("--spin-duration",`${this.spinSpeed}s`)}render(){return B`<div class="spinner"></div>`}};Ol.styles=u`
6320
6320
  .spinner {
6321
6321
  border: 2px solid rgba(0, 0, 0, 0.2);
6322
6322
  border-top: 2px solid #c057ff;
@@ -6334,7 +6334,7 @@ xmlns="http://www.w3.org/2000/svg"
6334
6334
  transform: rotate(360deg);
6335
6335
  }
6336
6336
  }
6337
- `,Tl([ue({type:Number})],_l.prototype,"spinSpeed",void 0),_l=Tl([se("mini-loader")],_l);var Ol=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Pl=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=fu.Default}isMessageStillStreamingChunks(){if(!this.message)return!1;const e=this.message.chunks.find(e=>e.isDone);return!e||this.message.chunks.length===e.order}updated(e){if(this.onMount(),!e.has("message"))return;if(!this.message)return;const{hyperlinks:t,markedText:n}=this.mapAndMarkHyperLinks(this.message.message),i=/(https?:\/\/[^\s]+)/g,r=[],o=[];this.parsedMessage=B`${n.trim().split("\n").map(e=>{const n=this.sanitizeMarkdownText(e),a=this.preserveHTMLTags(n);return a?B`${a.map(e=>{if(t.find(t=>t.id===e)){const n=t.find(t=>t.id===e);if(!n)return;return o.push({redirectTo:null==n?void 0:n.link,source:null==n?void 0:n.link}),B`<a
6337
+ `,_l([ue({type:Number})],Ol.prototype,"spinSpeed",void 0),Ol=_l([se("mini-loader")],Ol);var Pl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Il=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=gu.Default}isMessageStillStreamingChunks(){if(!this.message)return!1;const e=this.message.chunks.find(e=>e.isDone);return!e||this.message.chunks.length===e.order}updated(e){if(this.onMount(),!e.has("message"))return;if(!this.message)return;const{hyperlinks:t,markedText:n}=this.mapAndMarkHyperLinks(this.message.message),i=/(https?:\/\/[^\s]+)/g,r=[],o=[];this.parsedMessage=B`${n.trim().split("\n").map(e=>{const n=this.sanitizeMarkdownText(e),a=this.preserveHTMLTags(n);return a?B`${a.map(e=>{if(t.find(t=>t.id===e)){const n=t.find(t=>t.id===e);if(!n)return;return o.push({redirectTo:null==n?void 0:n.link,source:null==n?void 0:n.link}),B`<a
6338
6338
  class="redirect-link"
6339
6339
  href="${null==n?void 0:n.link}"
6340
6340
  target="_blank"
@@ -6346,10 +6346,10 @@ xmlns="http://www.w3.org/2000/svg"
6346
6346
  target="_blank"
6347
6347
  rel="noopener noreferrer"
6348
6348
  >${t}
6349
- </a>`}return B`${ci(kl.sanitize(e))} `})}<br />`:B``})}`,this.imagesToDisplay=o,Promise.all(r).then(e=>{this.websitePreviewInfo=e})}preserveHTMLTags(e){var t;const n=e.match(/(<\/?[a-z][^>]*>[^<]*<\/?[a-z]*>|[^\s]+[.,?!]?|\S)/gi);return null!==(t=null==n?void 0:n.filter(e=>""!==e.trim()))&&void 0!==t?t:[]}sanitizeMarkdownText(e){return e.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim,"<b>$1</b>").replace(/\*(.*?)\*/gim,"<i>$1</i>").trim()}removeTrailingPunctuation(e){return[".",",","!","?",":",";"].includes(e[e.length-1])?this.removeTrailingPunctuation(e.slice(0,-1)):e}mapAndMarkHyperLinks(e){const t=Array.from(e.matchAll(/<https?:\/\/[^|]+\|[^>]+>|<a href="[^"]+"(?: target="[^"]*")?>[^<]+<\/a>|\[.*?\]\([^)]*\.[^)]*\)/g)),n=[],i=t.map(t=>{const n=t[0];if(void 0===t.index)return;const i=e[t.index-1],r=e[t.index+n.length];if(n.startsWith("<https")||n.startsWith("<http"))return{matchedLink:n,link:n.split("|")[0].replace("<",""),hyperlink:n.split("|")[1].replace(">",""),addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)};if(n.startsWith("<a href=")){const e=n.match(/href="([^"]+)"/),t=n.match(/>[^<]+</);return{matchedLink:n,link:e?e[1]:"",hyperlink:t?t[0].slice(1,-1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}{const[e,t]=n.split("](");return{matchedLink:n,link:t?t.slice(0,-1):"",hyperlink:e?e.slice(1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}});return i.forEach(t=>{if(t&&t.link&&t.hyperlink){const i=rs().replace(/-/g,"");n.push({link:this.removeTrailingPunctuation(t.link),hyperlink:this.removeTrailingPunctuation(t.hyperlink),mark:t.matchedLink,id:i}),e=e.replace(t.matchedLink,`${t.addSpaceBefore?" ":""}${i}${t.addSpaceAfter?" ":""}`)}}),{hyperlinks:n,markedText:e}}async getLinkData(e){var t,n,i,o;try{const a=(await r().get(e)).data,s=(new DOMParser).parseFromString(a,"text/html");return s?{title:null!==(n=null===(t=s.querySelector("title"))||void 0===t?void 0:t.textContent)&&void 0!==n?n:null,description:(null===(i=s.querySelector('meta[name="description"]'))||void 0===i?void 0:i.getAttribute("content"))||null,image:(null===(o=s.querySelector('meta[property="og:image"]'))||void 0===o?void 0:o.getAttribute("content"))||null,favicon:null,link:e}:{title:null,description:null,image:null,favicon:null,link:e}}catch(t){return{title:null,description:null,image:null,favicon:null,link:e}}}render(){return this.message?B`<div class="message-inner-body">
6349
+ </a>`}return B`${ci(Tl.sanitize(e))} `})}<br />`:B``})}`,this.imagesToDisplay=o,Promise.all(r).then(e=>{this.websitePreviewInfo=e})}preserveHTMLTags(e){var t;const n=e.match(/(<\/?[a-z][^>]*>[^<]*<\/?[a-z]*>|[^\s]+[.,?!]?|\S)/gi);return null!==(t=null==n?void 0:n.filter(e=>""!==e.trim()))&&void 0!==t?t:[]}sanitizeMarkdownText(e){return e.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim,"<b>$1</b>").replace(/\*(.*?)\*/gim,"<i>$1</i>").trim()}removeTrailingPunctuation(e){return[".",",","!","?",":",";"].includes(e[e.length-1])?this.removeTrailingPunctuation(e.slice(0,-1)):e}mapAndMarkHyperLinks(e){const t=Array.from(e.matchAll(/<https?:\/\/[^|]+\|[^>]+>|<a href="[^"]+"(?: target="[^"]*")?>[^<]+<\/a>|\[.*?\]\([^)]*\.[^)]*\)/g)),n=[],i=t.map(t=>{const n=t[0];if(void 0===t.index)return;const i=e[t.index-1],r=e[t.index+n.length];if(n.startsWith("<https")||n.startsWith("<http"))return{matchedLink:n,link:n.split("|")[0].replace("<",""),hyperlink:n.split("|")[1].replace(">",""),addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)};if(n.startsWith("<a href=")){const e=n.match(/href="([^"]+)"/),t=n.match(/>[^<]+</);return{matchedLink:n,link:e?e[1]:"",hyperlink:t?t[0].slice(1,-1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}{const[e,t]=n.split("](");return{matchedLink:n,link:t?t.slice(0,-1):"",hyperlink:e?e.slice(1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}});return i.forEach(t=>{if(t&&t.link&&t.hyperlink){const i=rs().replace(/-/g,"");n.push({link:this.removeTrailingPunctuation(t.link),hyperlink:this.removeTrailingPunctuation(t.hyperlink),mark:t.matchedLink,id:i}),e=e.replace(t.matchedLink,`${t.addSpaceBefore?" ":""}${i}${t.addSpaceAfter?" ":""}`)}}),{hyperlinks:n,markedText:e}}async getLinkData(e){var t,n,i,o;try{const a=(await r().get(e)).data,s=(new DOMParser).parseFromString(a,"text/html");return s?{title:null!==(n=null===(t=s.querySelector("title"))||void 0===t?void 0:t.textContent)&&void 0!==n?n:null,description:(null===(i=s.querySelector('meta[name="description"]'))||void 0===i?void 0:i.getAttribute("content"))||null,image:(null===(o=s.querySelector('meta[property="og:image"]'))||void 0===o?void 0:o.getAttribute("content"))||null,favicon:null,link:e}:{title:null,description:null,image:null,favicon:null,link:e}}catch(t){return{title:null,description:null,image:null,favicon:null,link:e}}}render(){return this.message?B`<div class="message-inner-body">
6350
6350
  ${this.isMessageStillStreamingChunks()?B`<div class="message-loader"><mini-loader></mini-loader></div>`:""}
6351
6351
  <p
6352
- class=${ye({"message-text":this.widgetType!==fu.Utilities,"message-text-large":this.widgetType===fu.Utilities,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}
6352
+ class=${ye({"message-text":this.widgetType!==gu.Utilities,"message-text-large":this.widgetType===gu.Utilities,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}
6353
6353
  >
6354
6354
  ${this.parsedMessage}
6355
6355
  </p>
@@ -6380,16 +6380,16 @@ xmlns="http://www.w3.org/2000/svg"
6380
6380
  />`:""}
6381
6381
 
6382
6382
  <div class="website-preview-body">
6383
- <p class=${ye({"message-text":this.widgetType!==fu.Utilities,"message-text-large":this.widgetType===fu.Utilities,"website-preview-title":!0,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}>${e.title}</p>
6383
+ <p class=${ye({"message-text":this.widgetType!==gu.Utilities,"message-text-large":this.widgetType===gu.Utilities,"website-preview-title":!0,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}>${e.title}</p>
6384
6384
  ${e.description?B`<p
6385
- class=${ye({"message-text":this.widgetType!==fu.Utilities,"message-text-large":this.widgetType===fu.Utilities,"website-preview-description":!0,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}
6385
+ class=${ye({"message-text":this.widgetType!==gu.Utilities,"message-text-large":this.widgetType===gu.Utilities,"website-preview-description":!0,"webchat-font__desktop":!bn(),"webchat-font__mobile":bn()})}
6386
6386
  >
6387
6387
  ${e.description}
6388
6388
  </p>`:""}
6389
6389
  </div>
6390
6390
  </div>
6391
6391
  </a></div> `})}
6392
- </div>`:B``}};Pl.styles=[kn,Cs,u`
6392
+ </div>`:B``}};Il.styles=[kn,xs,u`
6393
6393
  .message-inner-body {
6394
6394
  position: relative;
6395
6395
  }
@@ -6398,7 +6398,7 @@ xmlns="http://www.w3.org/2000/svg"
6398
6398
  bottom: -2px;
6399
6399
  right: -2px;
6400
6400
  }
6401
- `],Ol([ue({attribute:!0})],Pl.prototype,"buildingSlug",void 0),Ol([ue({attribute:!0})],Pl.prototype,"message",void 0),Ol([ue({attribute:!0})],Pl.prototype,"myPubnub",void 0),Ol([ue({attribute:!0})],Pl.prototype,"onMount",void 0),Ol([ce()],Pl.prototype,"loadingPreviews",void 0),Ol([ce()],Pl.prototype,"parsedMessage",void 0),Ol([ce()],Pl.prototype,"websitePreviewInfo",void 0),Ol([ce()],Pl.prototype,"imagesToDisplay",void 0),Ol([ce()],Pl.prototype,"imageUrlError",void 0),Ol([ue({type:Boolean})],Pl.prototype,"isLeadMessage",void 0),Ol([ue({attribute:!0})],Pl.prototype,"widgetType",void 0),Pl=Ol([se("pubnub-message")],Pl);var Il=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Ml=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.showMediaAsCarousel=!0,this.activeIndex=0}updated(e){this.onMount(),e.has("message")}prevImage(){this.message&&(0===this.activeIndex?this.activeIndex=this.message.media.length-1:this.activeIndex-=1)}nextImage(){this.message&&(this.activeIndex===this.message.media.length-1?this.activeIndex=0:this.activeIndex+=1)}render(){return this.message?this.showMediaAsCarousel?B`<div class="message-inner-body">
6401
+ `],Pl([ue({attribute:!0})],Il.prototype,"buildingSlug",void 0),Pl([ue({attribute:!0})],Il.prototype,"message",void 0),Pl([ue({attribute:!0})],Il.prototype,"myPubnub",void 0),Pl([ue({attribute:!0})],Il.prototype,"onMount",void 0),Pl([ce()],Il.prototype,"loadingPreviews",void 0),Pl([ce()],Il.prototype,"parsedMessage",void 0),Pl([ce()],Il.prototype,"websitePreviewInfo",void 0),Pl([ce()],Il.prototype,"imagesToDisplay",void 0),Pl([ce()],Il.prototype,"imageUrlError",void 0),Pl([ue({type:Boolean})],Il.prototype,"isLeadMessage",void 0),Pl([ue({attribute:!0})],Il.prototype,"widgetType",void 0),Il=Pl([se("pubnub-message")],Il);var Ml=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Nl=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.showMediaAsCarousel=!0,this.activeIndex=0}updated(e){this.onMount(),e.has("message")}prevImage(){this.message&&(0===this.activeIndex?this.activeIndex=this.message.media.length-1:this.activeIndex-=1)}nextImage(){this.message&&(this.activeIndex===this.message.media.length-1?this.activeIndex=0:this.activeIndex+=1)}render(){return this.message?this.showMediaAsCarousel?B`<div class="message-inner-body">
6402
6402
  <div class="carousel">
6403
6403
  <div
6404
6404
  class="image-container"
@@ -6439,7 +6439,7 @@ xmlns="http://www.w3.org/2000/svg"
6439
6439
  rel="noopener noreferrer"
6440
6440
  ><img class=${"displayed-message-image"} src=${e.url} alt=""
6441
6441
  /></a>`)}
6442
- </div>`:B``}};Ml.styles=[kn,Cs,u`
6442
+ </div>`:B``}};Nl.styles=[kn,xs,u`
6443
6443
  .carousel {
6444
6444
  position: relative;
6445
6445
  max-width: 400px;
@@ -6531,7 +6531,7 @@ xmlns="http://www.w3.org/2000/svg"
6531
6531
  max-height: 200px;
6532
6532
  overflow-y: auto;
6533
6533
  }
6534
- `],Il([ue({attribute:!0})],Ml.prototype,"message",void 0),Il([ue({attribute:!0})],Ml.prototype,"myPubnub",void 0),Il([ue({attribute:!0})],Ml.prototype,"onMount",void 0),Il([ce()],Ml.prototype,"showMediaAsCarousel",void 0),Il([ce()],Ml.prototype,"activeIndex",void 0),Ml=Il([se("pubnub-media")],Ml);function Nl(e,t){var n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function Dl(e,t){Ge(2,arguments);var n=Qe(e),i=Qe(t),r=Nl(n,i),o=Math.abs(function(e,t){Ge(2,arguments);var n=Qt(e),i=Qt(t),r=n.getTime()-It(n),o=i.getTime()-It(i);return Math.round((r-o)/864e5)}(n,i));n.setDate(n.getDate()-r*o);var a=r*(o-Number(Nl(n,i)===-r));return 0===a?0:a}const Ll=u`
6534
+ `],Ml([ue({attribute:!0})],Nl.prototype,"message",void 0),Ml([ue({attribute:!0})],Nl.prototype,"myPubnub",void 0),Ml([ue({attribute:!0})],Nl.prototype,"onMount",void 0),Ml([ce()],Nl.prototype,"showMediaAsCarousel",void 0),Ml([ce()],Nl.prototype,"activeIndex",void 0),Nl=Ml([se("pubnub-media")],Nl);function Dl(e,t){var n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function Ll(e,t){Ge(2,arguments);var n=Qe(e),i=Qe(t),r=Dl(n,i),o=Math.abs(function(e,t){Ge(2,arguments);var n=Qt(e),i=Qt(t),r=n.getTime()-It(n),o=i.getTime()-It(i);return Math.round((r-o)/864e5)}(n,i));n.setDate(n.getDate()-r*o);var a=r*(o-Number(Dl(n,i)===-r));return 0===a?0:a}const Ul=u`
6535
6535
  #utilities-container {
6536
6536
  position: fixed;
6537
6537
 
@@ -6640,17 +6640,17 @@ xmlns="http://www.w3.org/2000/svg"
6640
6640
  .health-bttn-allow-access {
6641
6641
  padding-right: 28px;
6642
6642
  }
6643
- `,Ul=(e="black")=>j`
6643
+ `,Rl=(e="black")=>j`
6644
6644
  <svg width="32" height="32" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
6645
6645
  <path fill-rule="evenodd" clip-rule="evenodd" d="M15 0C17.7614 0 20 2.23858 20 5V15C20 17.7614 17.7614 20 15 20H5C2.23858 20 0 17.7614 0 15V5C0 2.23858 2.23858 0 5 0H15ZM18 5C18 3.34315 16.6569 2 15 2H5C3.34315 2 2 3.34315 2 5V15C2 16.6569 3.34315 18 5 18H15C16.6569 18 18 16.6569 18 15V5Z" fill="${e}"/>
6646
6646
  <path d="M12.1893 9.25L10.4697 7.53033C10.1768 7.23744 10.1768 6.76256 10.4697 6.46967C10.7626 6.17678 11.2374 6.17678 11.5303 6.46967L13.8232 8.76256C14.5066 9.44598 14.5066 10.554 13.8232 11.2374L11.5303 13.5303C11.2374 13.8232 10.7626 13.8232 10.4697 13.5303C10.1768 13.2374 10.1768 12.7626 10.4697 12.4697L12.1893 10.75L6 10.75C5.58579 10.75 5.25 10.4142 5.25 10C5.25 9.58579 5.58579 9.25 6 9.25L12.1893 9.25Z" fill="${e}"/>
6647
6647
  </svg>
6648
- `,Rl=(e="black")=>j`
6648
+ `,Bl=(e="black")=>j`
6649
6649
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
6650
6650
  <path fill-rule="evenodd" clip-rule="evenodd" d="M15 0C17.7614 0 20 2.23858 20 5V15C20 17.7614 17.7614 20 15 20H5C2.23858 20 0 17.7614 0 15V5C0 2.23858 2.23858 0 5 0H15ZM18 5C18 3.34315 16.6569 2 15 2H5C3.34315 2 2 3.34315 2 5V15C2 16.6569 3.34315 18 5 18H15C16.6569 18 18 16.6569 18 15V5Z" fill="${e}"/>
6651
6651
  <path d="M12.1893 9.25L10.4697 7.53033C10.1768 7.23744 10.1768 6.76256 10.4697 6.46967C10.7626 6.17678 11.2374 6.17678 11.5303 6.46967L13.8232 8.76256C14.5066 9.44598 14.5066 10.554 13.8232 11.2374L11.5303 13.5303C11.2374 13.8232 10.7626 13.8232 10.4697 13.5303C10.1768 13.2374 10.1768 12.7626 10.4697 12.4697L12.1893 10.75L6 10.75C5.58579 10.75 5.25 10.4142 5.25 10C5.25 9.58579 5.58579 9.25 6 9.25L12.1893 9.25Z" fill="${e}"/>
6652
6652
  </svg>
6653
- `;var Bl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let jl=class extends oe{constructor(){super(...arguments),this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.onMount=()=>({}),this.isHealthChat=!1,this.widgetType=fu.Default,this.primaryColor=Ue,this.backgroundColor=Re,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this._isMobile=bn(),this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;0!==e.length&&(this.messageInput.value="",this.autoResizeMessageInput(),0===this.messages.length&&(this.messages=[{timestamp:0,message:e,isLeadMessage:!0,chunks:[{text:e,order:0,isDone:!0}],type:hs.text}]),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e)))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>this.requiresConsent&&!this.hasReceivedConsent}get consentKey(){return`${this.orgSlug}Consent`}connectedCallback(){super.connectedCallback(),this._cleanupMobileListener=vn(e=>{this._isMobile=e})}disconnectedCallback(){var e;null===(e=this._cleanupMobileListener)||void 0===e||e.call(this),super.disconnectedCallback()}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.simpleChatMessages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener(e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading}),this.onMount();const n=localStorage.getItem(this.consentKey);if(!n)return void(this.hasReceivedConsent=!1);const i=JSON.parse(n),{timestamp:r,consentId:o}=i;Dl(new Date,new Date(r))<7&&o===mi?this.hasReceivedConsent=!0:(this.hasReceivedConsent=!1,localStorage.removeItem(this.consentKey))}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){}}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f;if(!this.buildingSlug)return B``;const g=null===(e=this.building)||void 0===e?void 0:e.id;let m={};if(m=this._isMobile?{top:void 0,bottom:0,left:void 0,right:0}:{top:void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:void 0===this.bottom||isNaN(this.bottom)?"130px":`${this.bottom}px`,left:void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:void 0===this.right||isNaN(this.right)?"18px":`${this.right}px`},22320===g&&(m={...m,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===fu.Utilities)return B`
6653
+ `;var jl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Fl=class extends oe{constructor(){super(...arguments),this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.onMount=()=>({}),this.isHealthChat=!1,this.widgetType=gu.Default,this.primaryColor=Ue,this.backgroundColor=Re,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this._isMobile=bn(),this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;0!==e.length&&(this.messageInput.value="",this.autoResizeMessageInput(),0===this.messages.length&&(this.messages=[{timestamp:0,message:e,isLeadMessage:!0,chunks:[{text:e,order:0,isDone:!0}],type:ps.text}]),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e)))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>this.requiresConsent&&!this.hasReceivedConsent}get consentKey(){return`${this.orgSlug}Consent`}connectedCallback(){super.connectedCallback(),this._cleanupMobileListener=vn(e=>{this._isMobile=e})}disconnectedCallback(){var e;null===(e=this._cleanupMobileListener)||void 0===e||e.call(this),super.disconnectedCallback()}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.simpleChatMessages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener(e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading}),this.onMount();const n=localStorage.getItem(this.consentKey);if(!n)return void(this.hasReceivedConsent=!1);const i=JSON.parse(n),{timestamp:r,consentId:o}=i;Ll(new Date,new Date(r))<7&&o===mi?this.hasReceivedConsent=!0:(this.hasReceivedConsent=!1,localStorage.removeItem(this.consentKey))}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){}}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f;if(!this.buildingSlug)return B``;const g=null===(e=this.building)||void 0===e?void 0:e.id;let m={};if(m=this._isMobile?{top:void 0,bottom:0,left:void 0,right:0}:{top:void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:void 0===this.bottom||isNaN(this.bottom)?"130px":`${this.bottom}px`,left:void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:void 0===this.right||isNaN(this.right)?"18px":`${this.right}px`},22320===g&&(m={...m,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===gu.Utilities)return B`
6654
6654
  <div
6655
6655
  id="utilities-container"
6656
6656
  class=${ye({"pubnub-container__mobile":this._isMobile,"utilities-container__desktop":!this._isMobile})}
@@ -6704,15 +6704,15 @@ xmlns="http://www.w3.org/2000/svg"
6704
6704
  key=${e.timestamp}
6705
6705
  tabindex="0"
6706
6706
  role="article"
6707
- aria-label="${e.isLeadMessage?"You":"Elise"}: ${cs(e)?e.message:"Media message"}"
6707
+ aria-label="${e.isLeadMessage?"You":"Elise"}: ${ds(e)?e.message:"Media message"}"
6708
6708
  >
6709
- ${ds(e)?B` <pubnub-media
6709
+ ${hs(e)?B` <pubnub-media
6710
6710
  .message=${e}
6711
6711
  .myPubnub=${this.myPubnub}
6712
6712
  .onMount=${()=>this.scrollToChatBottom()}
6713
6713
  >
6714
6714
  </pubnub-media>`:""}
6715
- ${cs(e)?B` <pubnub-message
6715
+ ${ds(e)?B` <pubnub-message
6716
6716
  .message=${e}
6717
6717
  .myPubnub=${this.myPubnub}
6718
6718
  .onMount=${()=>this.scrollToChatBottom()}
@@ -6755,12 +6755,12 @@ xmlns="http://www.w3.org/2000/svg"
6755
6755
  class=${ye({"health-bttn-allow-access":this._isMobile})}
6756
6756
  @click=${()=>this.sendMessage(this.messageInput.value)}
6757
6757
  >
6758
- ${Ul("black")}
6758
+ ${Rl("black")}
6759
6759
  </button>
6760
6760
  </div>
6761
6761
  </div>
6762
6762
  </div>
6763
- `;if(this.widgetType===fu.Healthcare)return B`
6763
+ `;if(this.widgetType===gu.Healthcare)return B`
6764
6764
  <div
6765
6765
  id="healthchat-container"
6766
6766
  class=${ye({"pubnub-container__mobile":this._isMobile,"healthchat-container__desktop":!this._isMobile})}
@@ -6819,15 +6819,15 @@ xmlns="http://www.w3.org/2000/svg"
6819
6819
  key=${e.timestamp}
6820
6820
  tabindex="0"
6821
6821
  role="article"
6822
- aria-label="${e.isLeadMessage?"You":"Elise"}: ${cs(e)?e.message:"Media message"}"
6822
+ aria-label="${e.isLeadMessage?"You":"Elise"}: ${ds(e)?e.message:"Media message"}"
6823
6823
  >
6824
- ${ds(e)?B` <pubnub-media
6824
+ ${hs(e)?B` <pubnub-media
6825
6825
  .message=${e}
6826
6826
  .myPubnub=${this.myPubnub}
6827
6827
  .onMount=${()=>this.scrollToChatBottom()}
6828
6828
  >
6829
6829
  </pubnub-media>`:""}
6830
- ${cs(e)?B` <pubnub-message
6830
+ ${ds(e)?B` <pubnub-message
6831
6831
  .message=${e}
6832
6832
  .myPubnub=${this.myPubnub}
6833
6833
  .onMount=${()=>this.scrollToChatBottom()}
@@ -6870,7 +6870,7 @@ xmlns="http://www.w3.org/2000/svg"
6870
6870
  class=${ye({"health-bttn-allow-access":this._isMobile})}
6871
6871
  @click=${()=>this.sendMessage(this.messageInput.value)}
6872
6872
  >
6873
- ${this._isMobile?Ul("black"):Rl("black")}
6873
+ ${this._isMobile?Rl("black"):Bl("black")}
6874
6874
  </button>
6875
6875
  </div>
6876
6876
  </div>
@@ -6931,15 +6931,15 @@ xmlns="http://www.w3.org/2000/svg"
6931
6931
  key=${e.timestamp}
6932
6932
  tabindex="0"
6933
6933
  role="article"
6934
- aria-label="${e.isLeadMessage?"You":"Elise"}: ${cs(e)?e.message:"Media message"}"
6934
+ aria-label="${e.isLeadMessage?"You":"Elise"}: ${ds(e)?e.message:"Media message"}"
6935
6935
  >
6936
- ${ds(e)?B` <pubnub-media
6936
+ ${hs(e)?B` <pubnub-media
6937
6937
  .message=${e}
6938
6938
  .myPubnub=${this.myPubnub}
6939
6939
  .onMount=${()=>this.scrollToChatBottom()}
6940
6940
  >
6941
6941
  </pubnub-media>`:""}
6942
- ${cs(e)?B` <pubnub-message
6942
+ ${ds(e)?B` <pubnub-message
6943
6943
  .message=${e}
6944
6944
  .myPubnub=${this.myPubnub}
6945
6945
  .onMount=${()=>this.scrollToChatBottom()}
@@ -6982,11 +6982,11 @@ xmlns="http://www.w3.org/2000/svg"
6982
6982
  aria-label="Send message"
6983
6983
  aria-describedby="Send message"
6984
6984
  >
6985
- ${He(this.building.orgId,this.building.id)&&this.primaryColor!==Ue?Rl("black"):Rl("white")}
6985
+ ${He(this.building.orgId,this.building.id)&&this.primaryColor!==Ue?Bl("black"):Bl("white")}
6986
6986
  </button>
6987
6987
  </div>
6988
6988
  </div>
6989
- `}};jl.styles=[kn,Cs,ws,vs,Ll],Bl([ue({type:Number})],jl.prototype,"right",void 0),Bl([ue({type:Number})],jl.prototype,"bottom",void 0),Bl([ue({type:Number})],jl.prototype,"top",void 0),Bl([ue({type:Number})],jl.prototype,"left",void 0),Bl([ue({attribute:!0})],jl.prototype,"onMount",void 0),Bl([ue({attribute:!0})],jl.prototype,"channel",void 0),Bl([ue({attribute:!0})],jl.prototype,"isHealthChat",void 0),Bl([ue({attribute:!0})],jl.prototype,"myPubnub",void 0),Bl([ue({attribute:!0})],jl.prototype,"orgSlug",void 0),Bl([ue({attribute:!0})],jl.prototype,"buildingSlug",void 0),Bl([ue({attribute:!0})],jl.prototype,"widgetType",void 0),Bl([ue({attribute:!0})],jl.prototype,"building",void 0),Bl([ue({attribute:!0})],jl.prototype,"primaryColor",void 0),Bl([ue({attribute:!0})],jl.prototype,"backgroundColor",void 0),Bl([ue({attribute:!0})],jl.prototype,"onClickExit",void 0),Bl([ue({attribute:!0})],jl.prototype,"requiresConsent",void 0),Bl([de("#message-input",!0)],jl.prototype,"messageInput",void 0),Bl([de("#conversation-body",!0)],jl.prototype,"messageBody",void 0),Bl([ce()],jl.prototype,"_isMobile",void 0),Bl([ce()],jl.prototype,"messages",void 0),Bl([ce()],jl.prototype,"isLoadingMessages",void 0),Bl([ce()],jl.prototype,"hasReceivedConsent",void 0),Bl([ce()],jl.prototype,"privacyPolicyUrl",void 0),Bl([ce()],jl.prototype,"websitePreviewMapping",void 0),jl=Bl([se("pubnub-chat")],jl);const Fl="cdn.skypack.dev/@meetelise/chat",Hl="cdn.eliseai.com/@meetelise/chat",$l=async(e,t)=>{try{if(Math.random()>=.15)return;const n=(()=>{try{const e=document.getElementsByTagName("script");for(const t of e){const e=t.src||"",n=t.textContent||"";if(e.includes(Fl)||n.includes(Fl))return"skypack";if(e.includes(Hl)||n.includes(Hl))return"eliseai"}return"unknown"}catch(e){return"unknown"}})();await r().post("https://app.meetelise.com/platformApi/webchat/cdn-version",{cdn_version:n},{params:{cdn_version:n},headers:{"Content-Type":"application/json","building-slug":t,"org-slug":e}})}catch(e){}},zl=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,Gl={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},Ql="https://applications.eliseai.com",Wl=["Check Availability","Apply Now"],ql=(e,t,n,i)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const n=e.getElementsByTagName("span");if(1!==n.length)return!1;const i=null===(t=n[0].textContent)||void 0===t?void 0:t.trim();return null!=i&&Wl.includes(i)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),Ei({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:Ai.info,buildingSlug:i,orgSlug:n}),!0},Vl=(e,t,n,i)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&ql(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)ql(s[e],t,n,i)}},Yl=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)ql(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)Vl(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class Kl{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>On(Pn(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=ai();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Si()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),n=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}]};localStorage.setItem(n,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Ei({logType:Ai.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),n=Oi(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:On(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Rn(e.timestampInitiallyLogged).getTime()-Rn(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:On(new Date),r=[{timestampInitiallyLogged:i,leadSourceValue:n,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>Rn(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var Xl,Zl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Jl=Xl=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=bn(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=ri.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.LeadSourceMultitouchClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=fu.Default,this.onWidgetLoaded=Sa(),this.onSstClose=Sa(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=ke(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Ui(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,t)=>{const n=window.rentgrata;if(!n)return;const i=n.Widget;if(!i)return;const o=i.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}try{$l(this.orgSlug,this.buildingSlug)}catch(e){}await Tr(e,this.buildingSlug,this.orgSlug)&&(ki({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,S,A,E,k,T,_,O,P,I,M,N,D,L,U,R,B,j,F,H,$,z,G,Q,W,q,V,Y;const K=this.buildingWebchatView;if(!K)return;K&&this.orgSlug&&tu(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null);const X=K.featureFlagWebchatMarketingSourceDropdownConfiguration,Z=K.featureFlagWebchatUseDniPhoneNumberBySource,J=K.featureFlagInsertDniIntoWebsite,ee=K.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite,[te,ne,ie]=await Promise.all([Qa(this.orgSlug,this.buildingSlug),oi(this.buildingSlug),qa(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Ie(K.phoneNumber),this.buildingWebchatView.isAip=ie),this.leadSources=te,this.featureFlagShowDropdown=X;const re=K.textWithUsPhoneNumber?K.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",n=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return Ei({logType:Ai.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),oe=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,ae=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,se={callDesktop:null!==(c=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==c&&c,callMobile:null!==(h=null===(d=this.buildingWebchatView)||void 0===d?void 0:d.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(b=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==b&&b,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!re)&&void 0!==x&&x,textMobile:null!==(A=(null===(S=this.buildingWebchatView)||void 0===S?void 0:S.shouldShowTextMobile)&&!!re)&&void 0!==A&&A,sstDesktop:null!==(k=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(_=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==_&&_,calcDesktop:oe,calcMobile:ae};var le,ue;this.enabledChatWidgets=Pa(se),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(ue=this.handleTourClicked,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",e=>{e.preventDefault(),ue(e)})}),ee&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(t=>{t&&t.addEventListener("click",t=>{t.preventDefault(),e(t)})})})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var n;if(!t)return;const i=document.createElement("a");i.textContent=t.textContent,i.style.cursor="pointer",i.addEventListener("click",t=>{t.preventDefault(),e(t)}),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)})})(this.handleTourClicked)):(null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&(le=null!==(I=null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&void 0!==I?I:null,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(le)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(N=this.buildingWebchatView.secondaryColor)&&void 0!==N?N:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==D?D:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==L?L:null,this.webchatConfigHasAutoOpenChat=null!==(U=this.buildingWebchatView.autoOpenChat)&&void 0!==U&&U,this.requiresConsent=null!==(R=this.buildingWebchatView.requiresConsentForChat)&&void 0!==R&&R,this.hideMobileFeatures=null!==(B=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==B&&B,this.privacyPolicyUrl=null!==(j=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==j?j:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Mi.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Mi.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Mi.EMOJI&&(this.designConcept=Mi.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Ue),null===this.backgroundColor&&(this.backgroundColor=Re);const ce=null!==(H=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==H?H:"";let de=null;if(Z&&(de=await async function(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return n.data?{number:Ie(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(z=null===($=this.LeadSourceClient)||void 0===$?void 0:$.leadSource)&&void 0!==z?z:null),de&&!de.isMatch&&(de.number=ce)),J&&(null==de?void 0:de.number)){const e=ms(de.number,this.orgSlug,this.buildingSlug);e>0&&ki({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const he=localStorage.getItem("eliseai_phone_number_devtest");he&&ms(he,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=de||{number:ce,isMatch:!1,isPropertyWebsiteCatchall:!0};const pe=null!==(Q=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==Q?Q:null;pe&&(this.leadSources.includes(pe)||this.leadSources.push(pe)),Vn(K.id);if((ne||(null===(W=this.buildingWebchatView)||void 0===W?void 0:W.isAip))&&(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)&&this.buildingSlug){const e=((e,t,n)=>{var i;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/content\/apply/,/\/apply-now/,/\/apply/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(i=l.textContent)||void 0===i?void 0:i.toLowerCase())||"",s=zl(o,e);l.setAttribute("href",s),a++,Ei({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:Ai.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Ei({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:Ai.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&ki({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}if(this.buildingSlug&&this.orgSlug)try{(e=>{const t=Gl[e];if(!t)return 0;const n=`${Ql}/building/${t}/units`,i=`${Ql}/building/${e}/units`,r=new RegExp(`https://applications\\.eliseai\\.com/building/${t}/units`,"g");let o=0;const a=document.body.getElementsByTagName("a");for(let e=0;e<a.length;e++){const t=a[e],s=t.getAttribute("href");if(!s||!s.includes(n))continue;const l=s.replace(r,i);l!==s&&(t.setAttribute("href",l),o++)}document.body.querySelectorAll("[onclick]").forEach(e=>{const t=e.getAttribute("onclick");if(!t||!t.includes(n))return;const a=t.replace(r,i);a!==t&&(e.setAttribute("onclick",a),o++)})})(this.buildingSlug)}catch{}this.buildingSlug&&(null===(V=this.buildingWebchatView)||void 0===V?void 0:V.isLiveOnApplications)&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&Yl(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a,s,l,u;if(!this.buildingWebchatView)return;const c=ss(this.buildingSlug),d=ls(this.buildingSlug,c),h=d?c:as(this.buildingSlug,!1);if(!h.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new Pi,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new Kl(this.orgSlug,this.buildingSlug),this.myPubnub=new ps(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,h.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType);const p=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug,d&&null!==(n=h.leadId)&&void 0!==n?n:void 0);p&&as(this.buildingSlug,h.initiatedChat,p.lead_id),this.LeadSourceClient.chatId=this.myPubnub.channel;const f=await(null===(i=this.LeadSourceClient)||void 0===i?void 0:i.generateUserLeadSource({leadId:null!==(o=null===(r=this.myPubnub)||void 0===r?void 0:r.leadUserId)&&void 0!==o?o:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));f&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(f),"property-website"!==Oi(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:Oi(this.orgSlug):this.myPubnub.leadSource=null!==(u=null===(l=this.LeadSourceClient)||void 0===l?void 0:l.leadSource)&&void 0!==u?u:null;const g=ss(this.buildingSlug);g.initiatedChat&&await this.myPubnub.initializePubnub(g)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Dn(Rn(t)));return!!e&&!!n&&!bn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",On(function(e,t){return Ge(2,arguments),st(e,6e4*at(t))}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s,l;if("Tab"!==e.key)return;const u=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot;let c=[];if(this.displayPubnubChat){const e=null===(o=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat"))||void 0===r?void 0:r.shadowRoot)||void 0===o?void 0:o.getElementById("pubnub-chat-container"),t=null===(a=this.shadowRoot)||void 0===a?void 0:a.getElementById("chatAdditionalActionsPubnub");e&&c.push(...this.collectFocusableElements(e)),t&&c.push(...this.collectFocusableElements(t))}else{const e=null!==(l=null!==(s=null==u?void 0:u.getElementById("email-us-window"))&&void 0!==s?s:null==u?void 0:u.getElementById("tour-scheduler-window"))&&void 0!==l?l:null==u?void 0:u.getElementById("call-us-window");e&&(c=this.collectFocusableElements(e))}if(0===c.length)return;e.preventDefault();const d=this.getDeepActiveElement(),h=c.findIndex(e=>e===d);c[e.shiftKey?(h-1+c.length)%c.length:(h+1)%c.length].focus()},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new xi(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),os(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab),this._cleanupMobileListener=vn(e=>{this._isMobile=e})}static isFocusable(e){return!("disabled"in e)||!e.disabled}collectFocusableElements(e){const t=[];e instanceof Element&&e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));const n=e.querySelectorAll("*");for(const e of Array.from(n))e.matches(Xl.FOCUSABLE_SELECTOR)&&Xl.isFocusable(e)&&t.push(e),e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));return t}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){Ei({logType:Ai.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,S,A,E,k,T,_,O,P,I,M,N,D,L,U,R,j,F,H,$,z;Ta();const G=this.hideLauncher&&!this.isLoading&&!this._isMobile;return B`
6989
+ `}};Fl.styles=[kn,xs,Cs,ws,Ul],jl([ue({type:Number})],Fl.prototype,"right",void 0),jl([ue({type:Number})],Fl.prototype,"bottom",void 0),jl([ue({type:Number})],Fl.prototype,"top",void 0),jl([ue({type:Number})],Fl.prototype,"left",void 0),jl([ue({attribute:!0})],Fl.prototype,"onMount",void 0),jl([ue({attribute:!0})],Fl.prototype,"channel",void 0),jl([ue({attribute:!0})],Fl.prototype,"isHealthChat",void 0),jl([ue({attribute:!0})],Fl.prototype,"myPubnub",void 0),jl([ue({attribute:!0})],Fl.prototype,"orgSlug",void 0),jl([ue({attribute:!0})],Fl.prototype,"buildingSlug",void 0),jl([ue({attribute:!0})],Fl.prototype,"widgetType",void 0),jl([ue({attribute:!0})],Fl.prototype,"building",void 0),jl([ue({attribute:!0})],Fl.prototype,"primaryColor",void 0),jl([ue({attribute:!0})],Fl.prototype,"backgroundColor",void 0),jl([ue({attribute:!0})],Fl.prototype,"onClickExit",void 0),jl([ue({attribute:!0})],Fl.prototype,"requiresConsent",void 0),jl([de("#message-input",!0)],Fl.prototype,"messageInput",void 0),jl([de("#conversation-body",!0)],Fl.prototype,"messageBody",void 0),jl([ce()],Fl.prototype,"_isMobile",void 0),jl([ce()],Fl.prototype,"messages",void 0),jl([ce()],Fl.prototype,"isLoadingMessages",void 0),jl([ce()],Fl.prototype,"hasReceivedConsent",void 0),jl([ce()],Fl.prototype,"privacyPolicyUrl",void 0),jl([ce()],Fl.prototype,"websitePreviewMapping",void 0),Fl=jl([se("pubnub-chat")],Fl);const Hl="cdn.skypack.dev/@meetelise/chat",$l="cdn.eliseai.com/@meetelise/chat",zl=async(e,t)=>{try{if(Math.random()>=.15)return;const n=(()=>{try{const e=document.getElementsByTagName("script");for(const t of e){const e=t.src||"",n=t.textContent||"";if(e.includes(Hl)||n.includes(Hl))return"skypack";if(e.includes($l)||n.includes($l))return"eliseai"}return"unknown"}catch(e){return"unknown"}})();await r().post("https://app.meetelise.com/platformApi/webchat/cdn-version",{cdn_version:n},{params:{cdn_version:n},headers:{"Content-Type":"application/json","building-slug":t,"org-slug":e}})}catch(e){}},Gl=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,Ql={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},Wl="https://applications.eliseai.com",ql=["Check Availability","Apply Now"],Vl=(e,t,n,i)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const n=e.getElementsByTagName("span");if(1!==n.length)return!1;const i=null===(t=n[0].textContent)||void 0===t?void 0:t.trim();return null!=i&&ql.includes(i)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),Ei({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:Ai.info,buildingSlug:i,orgSlug:n}),!0},Yl=(e,t,n,i)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&Vl(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)Vl(s[e],t,n,i)}},Kl=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)Vl(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)Yl(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class Xl{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>On(Pn(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=ai();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Si()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),n=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}]};localStorage.setItem(n,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Ei({logType:Ai.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),n=Oi(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:On(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Rn(e.timestampInitiallyLogged).getTime()-Rn(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:On(new Date),r=[{timestampInitiallyLogged:i,leadSourceValue:n,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:On(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>Rn(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var Zl,Jl=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let eu=Zl=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=bn(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=ri.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.LeadSourceMultitouchClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=gu.Default,this.onWidgetLoaded=Sa(),this.onSstClose=Sa(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=ke(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Ui(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,t)=>{const n=window.rentgrata;if(!n)return;const i=n.Widget;if(!i)return;const o=i.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}try{zl(this.orgSlug,this.buildingSlug)}catch(e){}await Tr(e,this.buildingSlug,this.orgSlug)&&(ki({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,S,A,E,k,T,_,O,P,I,M,N,D,L,U,R,B,j,F,H,$,z,G,Q,W,q,V,Y;const K=this.buildingWebchatView;if(!K)return;K&&this.orgSlug&&nu(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null);const X=K.featureFlagWebchatMarketingSourceDropdownConfiguration,Z=K.featureFlagWebchatUseDniPhoneNumberBySource,J=K.featureFlagInsertDniIntoWebsite,ee=K.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite,[te,ne,ie]=await Promise.all([Qa(this.orgSlug,this.buildingSlug),oi(this.buildingSlug),qa(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Ie(K.phoneNumber),this.buildingWebchatView.isAip=ie),this.leadSources=te,this.featureFlagShowDropdown=X;const re=K.textWithUsPhoneNumber?K.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",n=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return Ei({logType:Ai.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),oe=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,ae=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,se={callDesktop:null!==(c=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==c&&c,callMobile:null!==(h=null===(d=this.buildingWebchatView)||void 0===d?void 0:d.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(b=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==b&&b,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!re)&&void 0!==x&&x,textMobile:null!==(A=(null===(S=this.buildingWebchatView)||void 0===S?void 0:S.shouldShowTextMobile)&&!!re)&&void 0!==A&&A,sstDesktop:null!==(k=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(_=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==_&&_,calcDesktop:oe,calcMobile:ae};var le,ue;this.enabledChatWidgets=Pa(se),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(ue=this.handleTourClicked,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",e=>{e.preventDefault(),ue(e)})}),ee&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(t=>{t&&t.addEventListener("click",t=>{t.preventDefault(),e(t)})})})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var n;if(!t)return;const i=document.createElement("a");i.textContent=t.textContent,i.style.cursor="pointer",i.addEventListener("click",t=>{t.preventDefault(),e(t)}),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)})})(this.handleTourClicked)):(null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&(le=null!==(I=null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&void 0!==I?I:null,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(le)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(N=this.buildingWebchatView.secondaryColor)&&void 0!==N?N:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==D?D:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==L?L:null,this.webchatConfigHasAutoOpenChat=null!==(U=this.buildingWebchatView.autoOpenChat)&&void 0!==U&&U,this.requiresConsent=null!==(R=this.buildingWebchatView.requiresConsentForChat)&&void 0!==R&&R,this.hideMobileFeatures=null!==(B=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==B&&B,this.privacyPolicyUrl=null!==(j=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==j?j:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Mi.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Mi.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Mi.EMOJI&&(this.designConcept=Mi.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Ue),null===this.backgroundColor&&(this.backgroundColor=Re);const ce=null!==(H=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==H?H:"";let de=null;if(Z&&(de=await async function(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return n.data?{number:Ie(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(z=null===($=this.LeadSourceClient)||void 0===$?void 0:$.leadSource)&&void 0!==z?z:null),de&&!de.isMatch&&(de.number=ce)),J&&(null==de?void 0:de.number)){const e=ys(de.number,this.orgSlug,this.buildingSlug);e>0&&ki({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const he=localStorage.getItem("eliseai_phone_number_devtest");he&&ys(he,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=de||{number:ce,isMatch:!1,isPropertyWebsiteCatchall:!0};const pe=null!==(Q=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==Q?Q:null;pe&&(this.leadSources.includes(pe)||this.leadSources.push(pe)),Vn(K.id);if((ne||(null===(W=this.buildingWebchatView)||void 0===W?void 0:W.isAip))&&(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)&&this.buildingSlug){const e=((e,t,n)=>{var i;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/content\/apply/,/\/apply-now/,/\/apply/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(i=l.textContent)||void 0===i?void 0:i.toLowerCase())||"",s=Gl(o,e);l.setAttribute("href",s),a++,Ei({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:Ai.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Ei({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:Ai.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&ki({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}if(this.buildingSlug&&this.orgSlug)try{(e=>{const t=Ql[e];if(!t)return 0;const n=`${Wl}/building/${t}/units`,i=`${Wl}/building/${e}/units`,r=new RegExp(`https://applications\\.eliseai\\.com/building/${t}/units`,"g");let o=0;const a=document.body.getElementsByTagName("a");for(let e=0;e<a.length;e++){const t=a[e],s=t.getAttribute("href");if(!s||!s.includes(n))continue;const l=s.replace(r,i);l!==s&&(t.setAttribute("href",l),o++)}document.body.querySelectorAll("[onclick]").forEach(e=>{const t=e.getAttribute("onclick");if(!t||!t.includes(n))return;const a=t.replace(r,i);a!==t&&(e.setAttribute("onclick",a),o++)})})(this.buildingSlug)}catch{}this.buildingSlug&&(null===(V=this.buildingWebchatView)||void 0===V?void 0:V.isLiveOnApplications)&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&Kl(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a,s,l,u;if(!this.buildingWebchatView)return;const c=ss(this.buildingSlug),d=ls(this.buildingSlug,c),h=d?c:as(this.buildingSlug,!1);if(!h.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new Pi,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new Xl(this.orgSlug,this.buildingSlug),this.myPubnub=new fs(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,h.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType);const p=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug,d&&null!==(n=h.leadId)&&void 0!==n?n:void 0);p&&as(this.buildingSlug,h.initiatedChat,p.lead_id),this.LeadSourceClient.chatId=this.myPubnub.channel;const f=await(null===(i=this.LeadSourceClient)||void 0===i?void 0:i.generateUserLeadSource({leadId:null!==(o=null===(r=this.myPubnub)||void 0===r?void 0:r.leadUserId)&&void 0!==o?o:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));f&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(f),"property-website"!==Oi(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:Oi(this.orgSlug):this.myPubnub.leadSource=null!==(u=null===(l=this.LeadSourceClient)||void 0===l?void 0:l.leadSource)&&void 0!==u?u:null;const g=ss(this.buildingSlug);g.initiatedChat&&await this.myPubnub.initializePubnub(g)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Dn(Rn(t)));return!!e&&!!n&&!bn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",On(function(e,t){return Ge(2,arguments),st(e,6e4*at(t))}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s,l;if("Tab"!==e.key)return;const u=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot;let c=[];if(this.displayPubnubChat){const e=null===(o=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat"))||void 0===r?void 0:r.shadowRoot)||void 0===o?void 0:o.getElementById("pubnub-chat-container"),t=null===(a=this.shadowRoot)||void 0===a?void 0:a.getElementById("chatAdditionalActionsPubnub");e&&c.push(...this.collectFocusableElements(e)),t&&c.push(...this.collectFocusableElements(t))}else{const e=null!==(l=null!==(s=null==u?void 0:u.getElementById("email-us-window"))&&void 0!==s?s:null==u?void 0:u.getElementById("tour-scheduler-window"))&&void 0!==l?l:null==u?void 0:u.getElementById("call-us-window");e&&(c=this.collectFocusableElements(e))}if(0===c.length)return;e.preventDefault();const d=this.getDeepActiveElement(),h=c.findIndex(e=>e===d);c[e.shiftKey?(h-1+c.length)%c.length:(h+1)%c.length].focus()},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new xi(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),os(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab),this._cleanupMobileListener=vn(e=>{this._isMobile=e})}static isFocusable(e){return!("disabled"in e)||!e.disabled}collectFocusableElements(e){const t=[];e instanceof Element&&e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));const n=e.querySelectorAll("*");for(const e of Array.from(n))e.matches(Zl.FOCUSABLE_SELECTOR)&&Zl.isFocusable(e)&&t.push(e),e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));return t}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){Ei({logType:Ai.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,S,A,E,k,T,_,O,P,I,M,N,D,L,U,R,j,F,H,$,z;Ta();const G=this.hideLauncher&&!this.isLoading&&!this._isMobile;return B`
6990
6990
  <meta name="viewport" content="width=device-width, initial-scale=1">
6991
6991
  ${this.displayPubnubChat?B`
6992
6992
  <pubnub-chat
@@ -6995,7 +6995,7 @@ xmlns="http://www.w3.org/2000/svg"
6995
6995
  .myPubnub=${this.myPubnub}
6996
6996
  .orgSlug=${this.orgSlug}
6997
6997
  .buildingSlug=${this.buildingSlug}
6998
- .widgetType=${fu.Default}
6998
+ .widgetType=${gu.Default}
6999
6999
  .building=${this.buildingWebchatView}
7000
7000
  .primaryColor=${this.primaryColor}
7001
7001
  .backgroundColor=${this.backgroundColor}
@@ -7098,7 +7098,7 @@ xmlns="http://www.w3.org/2000/svg"
7098
7098
  </meetelise-launcher>`:""}
7099
7099
  </div>
7100
7100
  </meta>
7101
- `}};Jl.styles=u`
7101
+ `}};eu.styles=u`
7102
7102
  :host {
7103
7103
  all: initial;
7104
7104
  }
@@ -7147,7 +7147,7 @@ xmlns="http://www.w3.org/2000/svg"
7147
7147
  position: fixed;
7148
7148
  bottom: 0;
7149
7149
  }
7150
- `,Jl.FOCUSABLE_SELECTOR="a[href]:not([tabindex='-1']), input:not([disabled]), button:not([disabled]), textarea, [tabindex]:not([tabindex='-1'])",Zl([ue({type:String})],Jl.prototype,"buildingSlug",void 0),Zl([ue({type:String})],Jl.prototype,"orgSlug",void 0),Zl([ue({type:Object})],Jl.prototype,"launcherStyles",void 0),Zl([ue()],Jl.prototype,"mobileStyles",void 0),Zl([ue({type:Boolean})],Jl.prototype,"isMinimized",void 0),Zl([ue({type:String})],Jl.prototype,"primaryColor",void 0),Zl([ue({type:String})],Jl.prototype,"backgroundColor",void 0),Zl([ue({type:String})],Jl.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Zl([ue({type:String})],Jl.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Zl([ce()],Jl.prototype,"_isMobile",void 0),Zl([ce()],Jl.prototype,"chatId",void 0),Zl([ce()],Jl.prototype,"analytics",void 0),Zl([ce()],Jl.prototype,"launcher",void 0),Zl([ce()],Jl.prototype,"buildingWebchatView",void 0),Zl([ce()],Jl.prototype,"designConcept",void 0),Zl([ce()],Jl.prototype,"leadSources",void 0),Zl([ce()],Jl.prototype,"currentLeadSource",void 0),Zl([ce()],Jl.prototype,"featureFlagShowDropdown",void 0),Zl([ce()],Jl.prototype,"phoneNumberForSource",void 0),Zl([ce()],Jl.prototype,"hasMounted",void 0),Zl([ce()],Jl.prototype,"hideLauncher",void 0),Zl([ce()],Jl.prototype,"isLoading",void 0),Zl([ce()],Jl.prototype,"showTourNextToChat",void 0),Zl([ce()],Jl.prototype,"displayPubnubChat",void 0),Zl([ce()],Jl.prototype,"myPubnub",void 0),Zl([ce()],Jl.prototype,"LeadSourceClient",void 0),Zl([ce()],Jl.prototype,"LeadSourceMultitouchClient",void 0),Zl([ce()],Jl.prototype,"sampleRateToUse",void 0),Zl([ue({type:Number})],Jl.prototype,"right",void 0),Zl([ue({type:Number})],Jl.prototype,"bottom",void 0),Zl([ue({type:Number})],Jl.prototype,"top",void 0),Zl([ue({type:Number})],Jl.prototype,"left",void 0),Zl([ue({attribute:!0})],Jl.prototype,"overrideRentgrata",void 0),Zl([ue({attribute:!0})],Jl.prototype,"widgetType",void 0),Zl([ue()],Jl.prototype,"onWidgetLoaded",void 0),Zl([ue({attribute:!0})],Jl.prototype,"onSstClose",void 0),Zl([ce()],Jl.prototype,"enabledChatWidgets",void 0),Zl([ce()],Jl.prototype,"webchatConfigHasAutoOpenChat",void 0),Zl([ce()],Jl.prototype,"requiresConsent",void 0),Zl([ce()],Jl.prototype,"hideMobileFeatures",void 0),Zl([ce()],Jl.prototype,"privacyPolicyUrl",void 0),Jl=Xl=Zl([se("me-chat")],Jl);const eu=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},tu=async(e,t,n,i,o)=>{var a;if(!i||!e)return;const s=await async function(e){if(!e)return!1;try{return(await r().get(ii(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-override-contact-us-form",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(i);if(!s)return;const l=eu(["myContactForm","contactus","fpa-myContactForm"]);let u;if(!(l&&l instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&nu(i,e,"Could not find form",t?{id:t.id}:void 0))}try{if(l.parentElement&&"scheduleTourForm"===l.parentElement.id)return nu(i,e,"Form is apart of schedule tour form!")}catch(e){}for(let e=0;e<l.elements.length;e++){const t=l.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){u=t;break}if("fpa-contact-submit"===t.getAttribute("id")){u=t;break}}if(!u)return nu(i,e,"Could not find submit button");const c=()=>({firstName:eu(["firstname","txtName","fpa-firstname","Form_FirstName"]),lastName:eu(["lastname","txtName2","fpa-lastname","Form_LastName"]),email:eu(["email","txtEmail","fpa-email","Form_Email"]),phone:eu(["phonenumber","txtPhone","fpa-phonenumber","Form_Phone"]),message:eu(["message","txtComments","fpa-email","Form_Message"])});if(Object.values(c()).some(e=>null===e)){const t=Object.entries(c()).filter(([,e])=>null===e).map(([e])=>e);return nu(i,e,"Missing the following form elements: "+t.join(", "))}const d=u.textContent,h=u.cloneNode(!0);null===(a=u.parentNode)||void 0===a||a.replaceChild(h,u),h&&ki({params:{chat_id:t,org_slug:e,building_slug:i,is_form_override_success:!0},sampleRate:n}),h.onclick=async function(t){if(Object.values(c()).forEach(e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")}),!Object.values(c()).every(e=>null!==e&&!("true"===e.getAttribute("aria-required")&&!e.value)&&("email"!==e.id&&"phonenumber"!==e.id||"true"!==e.getAttribute("aria-invalid"))))return;t.preventDefault(),h.textContent="Processing request...",h.disabled=!0;const n={};Object.entries(c()).forEach(([e,t])=>n[e]=null==t?void 0:t.value);const r=await Ui(e,i);if(!r)return nu(i,e,"Could not find building"),null;const a={email_address:n.email,first_name:n.firstName,last_name:n.lastName,phone_number:n.phone,first_message:n.message,building_id:r.id,is_external_form:!0,lead_sources:[...new Set(o?[o,Oi(e)]:[Oi(e)])]},s=JSON.stringify(a);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":i,"org-slug":e},body:s}).then(e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return l&&l.reset(),Object.values(c()).forEach(e=>{e&&(e.disabled=!0)}),h.textContent="Submitted",h.disabled=!0,e.json()}).catch(()=>{h.textContent=d})}},nu=(e,t,n,i)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n,url:window.location.href,formIdInfo:i});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:r})},iu=u`
7150
+ `,eu.FOCUSABLE_SELECTOR="a[href]:not([tabindex='-1']), input:not([disabled]), button:not([disabled]), textarea, [tabindex]:not([tabindex='-1'])",Jl([ue({type:String})],eu.prototype,"buildingSlug",void 0),Jl([ue({type:String})],eu.prototype,"orgSlug",void 0),Jl([ue({type:Object})],eu.prototype,"launcherStyles",void 0),Jl([ue()],eu.prototype,"mobileStyles",void 0),Jl([ue({type:Boolean})],eu.prototype,"isMinimized",void 0),Jl([ue({type:String})],eu.prototype,"primaryColor",void 0),Jl([ue({type:String})],eu.prototype,"backgroundColor",void 0),Jl([ue({type:String})],eu.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Jl([ue({type:String})],eu.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Jl([ce()],eu.prototype,"_isMobile",void 0),Jl([ce()],eu.prototype,"chatId",void 0),Jl([ce()],eu.prototype,"analytics",void 0),Jl([ce()],eu.prototype,"launcher",void 0),Jl([ce()],eu.prototype,"buildingWebchatView",void 0),Jl([ce()],eu.prototype,"designConcept",void 0),Jl([ce()],eu.prototype,"leadSources",void 0),Jl([ce()],eu.prototype,"currentLeadSource",void 0),Jl([ce()],eu.prototype,"featureFlagShowDropdown",void 0),Jl([ce()],eu.prototype,"phoneNumberForSource",void 0),Jl([ce()],eu.prototype,"hasMounted",void 0),Jl([ce()],eu.prototype,"hideLauncher",void 0),Jl([ce()],eu.prototype,"isLoading",void 0),Jl([ce()],eu.prototype,"showTourNextToChat",void 0),Jl([ce()],eu.prototype,"displayPubnubChat",void 0),Jl([ce()],eu.prototype,"myPubnub",void 0),Jl([ce()],eu.prototype,"LeadSourceClient",void 0),Jl([ce()],eu.prototype,"LeadSourceMultitouchClient",void 0),Jl([ce()],eu.prototype,"sampleRateToUse",void 0),Jl([ue({type:Number})],eu.prototype,"right",void 0),Jl([ue({type:Number})],eu.prototype,"bottom",void 0),Jl([ue({type:Number})],eu.prototype,"top",void 0),Jl([ue({type:Number})],eu.prototype,"left",void 0),Jl([ue({attribute:!0})],eu.prototype,"overrideRentgrata",void 0),Jl([ue({attribute:!0})],eu.prototype,"widgetType",void 0),Jl([ue()],eu.prototype,"onWidgetLoaded",void 0),Jl([ue({attribute:!0})],eu.prototype,"onSstClose",void 0),Jl([ce()],eu.prototype,"enabledChatWidgets",void 0),Jl([ce()],eu.prototype,"webchatConfigHasAutoOpenChat",void 0),Jl([ce()],eu.prototype,"requiresConsent",void 0),Jl([ce()],eu.prototype,"hideMobileFeatures",void 0),Jl([ce()],eu.prototype,"privacyPolicyUrl",void 0),eu=Zl=Jl([se("me-chat")],eu);const tu=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},nu=async(e,t,n,i,o)=>{var a;if(!i||!e)return;const s=await async function(e){if(!e)return!1;try{return(await r().get(ii(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-override-contact-us-form",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(i);if(!s)return;const l=tu(["myContactForm","contactus","fpa-myContactForm"]);let u;if(!(l&&l instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&iu(i,e,"Could not find form",t?{id:t.id}:void 0))}try{if(l.parentElement&&"scheduleTourForm"===l.parentElement.id)return iu(i,e,"Form is apart of schedule tour form!")}catch(e){}for(let e=0;e<l.elements.length;e++){const t=l.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){u=t;break}if("fpa-contact-submit"===t.getAttribute("id")){u=t;break}}if(!u)return iu(i,e,"Could not find submit button");const c=()=>({firstName:tu(["firstname","txtName","fpa-firstname","Form_FirstName"]),lastName:tu(["lastname","txtName2","fpa-lastname","Form_LastName"]),email:tu(["email","txtEmail","fpa-email","Form_Email"]),phone:tu(["phonenumber","txtPhone","fpa-phonenumber","Form_Phone"]),message:tu(["message","txtComments","fpa-email","Form_Message"])});if(Object.values(c()).some(e=>null===e)){const t=Object.entries(c()).filter(([,e])=>null===e).map(([e])=>e);return iu(i,e,"Missing the following form elements: "+t.join(", "))}const d=u.textContent,h=u.cloneNode(!0);null===(a=u.parentNode)||void 0===a||a.replaceChild(h,u),h&&ki({params:{chat_id:t,org_slug:e,building_slug:i,is_form_override_success:!0},sampleRate:n}),h.onclick=async function(t){if(Object.values(c()).forEach(e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")}),!Object.values(c()).every(e=>null!==e&&!("true"===e.getAttribute("aria-required")&&!e.value)&&("email"!==e.id&&"phonenumber"!==e.id||"true"!==e.getAttribute("aria-invalid"))))return;t.preventDefault(),h.textContent="Processing request...",h.disabled=!0;const n={};Object.entries(c()).forEach(([e,t])=>n[e]=null==t?void 0:t.value);const r=await Ui(e,i);if(!r)return iu(i,e,"Could not find building"),null;const a={email_address:n.email,first_name:n.firstName,last_name:n.lastName,phone_number:n.phone,first_message:n.message,building_id:r.id,is_external_form:!0,lead_sources:[...new Set(o?[o,Oi(e)]:[Oi(e)])]},s=JSON.stringify(a);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":i,"org-slug":e},body:s}).then(e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return l&&l.reset(),Object.values(c()).forEach(e=>{e&&(e.disabled=!0)}),h.textContent="Submitted",h.disabled=!0,e.json()}).catch(()=>{h.textContent=d})}},iu=(e,t,n,i)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n,url:window.location.href,formIdInfo:i});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:r})},ru=u`
7151
7151
  .chat-launcher {
7152
7152
  position: fixed;
7153
7153
  }
@@ -7178,7 +7178,7 @@ xmlns="http://www.w3.org/2000/svg"
7178
7178
  filter: brightness(1.1);
7179
7179
  }
7180
7180
  }
7181
- `;var ru=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let ou=class extends oe{constructor(){super(...arguments),this.right=0,this.bottom=0,this.top=0,this.left=0,this.isChatOpen=!1,this.onClickCloseChat=()=>({}),this.onClickOpenChat=()=>({})}render(){return this.isChatOpen?B`
7181
+ `;var ou=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let au=class extends oe{constructor(){super(...arguments),this.right=0,this.bottom=0,this.top=0,this.left=0,this.isChatOpen=!1,this.onClickCloseChat=()=>({}),this.onClickOpenChat=()=>({})}render(){return this.isChatOpen?B`
7182
7182
  <div
7183
7183
  class="chat-launcher"
7184
7184
  style=${Le({top:bn()||isNaN(this.top)?void 0:`${this.top+432}px`,bottom:bn()||isNaN(this.bottom)?"72px":this.bottom-60+"px",left:bn()||isNaN(this.left)?void 0:`${this.left}px`,right:bn()||isNaN(this.right)?"18px":`${this.right}px`})}
@@ -7228,12 +7228,12 @@ xmlns="http://www.w3.org/2000/svg"
7228
7228
  />
7229
7229
  </svg>
7230
7230
  </button>
7231
- </div>`}};ou.styles=[iu],ru([ue({type:Number})],ou.prototype,"right",void 0),ru([ue({type:Number})],ou.prototype,"bottom",void 0),ru([ue({type:Number})],ou.prototype,"top",void 0),ru([ue({type:Number})],ou.prototype,"left",void 0),ru([ue({attribute:!0})],ou.prototype,"isChatOpen",void 0),ru([ue({attribute:!0})],ou.prototype,"onClickCloseChat",void 0),ru([ue({attribute:!0})],ou.prototype,"onClickOpenChat",void 0),ou=ru([se("simple-launcher")],ou);var au=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let su=class extends oe{constructor(){super(...arguments),this.healthcareId="",this.right=0,this.bottom=0,this.top=0,this.left=0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=ss(this.healthcareId),t=ls(this.healthcareId,e)?e:as(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new ps(this.healthcareId,null,"",this.currentLeadSource,t.leadId,null,null,fu.Healthcare),t.initiatedChat&&await this.myPubnub.initializePubnub(e),bn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),os(this.healthcareId),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return Ta(),this.isLoading?B``:B`
7231
+ </div>`}};au.styles=[ru],ou([ue({type:Number})],au.prototype,"right",void 0),ou([ue({type:Number})],au.prototype,"bottom",void 0),ou([ue({type:Number})],au.prototype,"top",void 0),ou([ue({type:Number})],au.prototype,"left",void 0),ou([ue({attribute:!0})],au.prototype,"isChatOpen",void 0),ou([ue({attribute:!0})],au.prototype,"onClickCloseChat",void 0),ou([ue({attribute:!0})],au.prototype,"onClickOpenChat",void 0),au=ou([se("simple-launcher")],au);var su=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let lu=class extends oe{constructor(){super(...arguments),this.healthcareId="",this.right=0,this.bottom=0,this.top=0,this.left=0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=ss(this.healthcareId),t=ls(this.healthcareId,e)?e:as(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new fs(this.healthcareId,null,"",this.currentLeadSource,t.leadId,null,null,gu.Healthcare),t.initiatedChat&&await this.myPubnub.initializePubnub(e),bn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),os(this.healthcareId),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return Ta(),this.isLoading?B``:B`
7232
7232
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
7233
7233
  ${this.displayPubnubChat?B`
7234
7234
  <pubnub-chat
7235
7235
  id="pubnub-chat"
7236
- .widgetType=${fu.Healthcare}
7236
+ .widgetType=${gu.Healthcare}
7237
7237
  .channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
7238
7238
  .myPubnub=${this.myPubnub}
7239
7239
  .buildingSlug=${this.healthcareId}
@@ -7259,7 +7259,7 @@ xmlns="http://www.w3.org/2000/svg"
7259
7259
  ></simple-launcher>
7260
7260
 
7261
7261
  </meta>
7262
- `}};su.styles=u`
7262
+ `}};lu.styles=u`
7263
7263
  :host {
7264
7264
  all: initial;
7265
7265
  }
@@ -7312,13 +7312,13 @@ xmlns="http://www.w3.org/2000/svg"
7312
7312
  line-height: 150%;
7313
7313
  font-size: 16px;
7314
7314
  }
7315
- `,au([ue({type:String})],su.prototype,"healthcareId",void 0),au([ue({type:Number})],su.prototype,"right",void 0),au([ue({type:Number})],su.prototype,"bottom",void 0),au([ue({type:Number})],su.prototype,"top",void 0),au([ue({type:Number})],su.prototype,"left",void 0),au([ce()],su.prototype,"launcher",void 0),au([ce()],su.prototype,"currentLeadSource",void 0),au([ce()],su.prototype,"displayPubnubChat",void 0),au([ce()],su.prototype,"myPubnub",void 0),au([ce()],su.prototype,"requiresConsent",void 0),au([ce()],su.prototype,"privacyPolicyUrl",void 0),au([ce()],su.prototype,"isLoading",void 0),su=au([se("health-chat")],su);var lu=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let uu=class extends oe{constructor(){super(...arguments),this.orgSlug="",this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{(await async function(e){if(!e)return!1;const t="e2e-test-yardi-building";try{return(await r().get(ii(t),{params:{building_slug:t,flag_type:"bool",feature_flag:"enable-show-utilities-webchat",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(this.orgSlug)||location.href.includes("demo/utilities"))&&await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=ss(this.orgSlug),t=ls(this.orgSlug,e)?e:as(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new ps(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,null,fu.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),bn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),os(this.orgSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return Ta(),this.isLoading?B``:B`
7315
+ `,su([ue({type:String})],lu.prototype,"healthcareId",void 0),su([ue({type:Number})],lu.prototype,"right",void 0),su([ue({type:Number})],lu.prototype,"bottom",void 0),su([ue({type:Number})],lu.prototype,"top",void 0),su([ue({type:Number})],lu.prototype,"left",void 0),su([ce()],lu.prototype,"launcher",void 0),su([ce()],lu.prototype,"currentLeadSource",void 0),su([ce()],lu.prototype,"displayPubnubChat",void 0),su([ce()],lu.prototype,"myPubnub",void 0),su([ce()],lu.prototype,"requiresConsent",void 0),su([ce()],lu.prototype,"privacyPolicyUrl",void 0),su([ce()],lu.prototype,"isLoading",void 0),lu=su([se("health-chat")],lu);var uu=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let cu=class extends oe{constructor(){super(...arguments),this.orgSlug="",this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{(await async function(e){if(!e)return!1;const t="e2e-test-yardi-building";try{return(await r().get(ii(t),{params:{building_slug:t,flag_type:"bool",feature_flag:"enable-show-utilities-webchat",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(this.orgSlug)||location.href.includes("demo/utilities"))&&await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=ss(this.orgSlug),t=ls(this.orgSlug,e)?e:as(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new fs(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,null,gu.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),bn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),os(this.orgSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return Ta(),this.isLoading?B``:B`
7316
7316
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
7317
7317
  ${this.displayPubnubChat?B`
7318
7318
  <pubnub-chat
7319
7319
  id="pubnub-chat"
7320
7320
  .channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
7321
- .widgetType=${fu.Utilities}
7321
+ .widgetType=${gu.Utilities}
7322
7322
  .myPubnub=${this.myPubnub}
7323
7323
  .buildingSlug=${this.orgSlug}
7324
7324
  .onClickExit=${()=>{this.displayPubnubChat=!1}}
@@ -7342,7 +7342,7 @@ xmlns="http://www.w3.org/2000/svg"
7342
7342
 
7343
7343
  ></simple-launcher>
7344
7344
  </meta>
7345
- `}};uu.styles=u`
7345
+ `}};cu.styles=u`
7346
7346
  :host {
7347
7347
  all: initial;
7348
7348
  }
@@ -7395,4 +7395,4 @@ xmlns="http://www.w3.org/2000/svg"
7395
7395
  line-height: 150%;
7396
7396
  font-size: 16px;
7397
7397
  }
7398
- `,lu([ue({type:String})],uu.prototype,"orgSlug",void 0),lu([ue({type:Number})],uu.prototype,"right",void 0),lu([ue({type:Number})],uu.prototype,"bottom",void 0),lu([ue({type:Number})],uu.prototype,"top",void 0),lu([ue({type:Number})],uu.prototype,"left",void 0),lu([ce()],uu.prototype,"launcher",void 0),lu([ce()],uu.prototype,"currentLeadSource",void 0),lu([ce()],uu.prototype,"displayPubnubChat",void 0),lu([ce()],uu.prototype,"myPubnub",void 0),lu([ce()],uu.prototype,"requiresConsent",void 0),lu([ce()],uu.prototype,"privacyPolicyUrl",void 0),lu([ce()],uu.prototype,"isLoading",void 0),uu=lu([se("utilities-chat")],uu);const cu=async e=>{const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":e}});return Math.random()<.2&&Ei({logType:i&&i.data?Ai.info:Ai.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:e,givenBuildingSlug:null,reason:i&&i.data?null:"No match found"}}),i.data},du=async(e,t=5e3)=>new Promise((n,i)=>{const r=new MutationObserver((t,i)=>{const r=document.getElementById(e);r&&(i.disconnect(),n(r))});r.observe(document.body,{childList:!0,subtree:!0});const o=setTimeout(()=>{r.disconnect(),i(new Error(`Element ${e} did not appear within ${t}ms`))},t),a=document.querySelector(e);a&&(clearTimeout(o),r.disconnect(),n(a))});class hu{static healthcareStart(e,t=!0){var n,i,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),gu();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","region"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(n=e.right)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("bottom",(null===(i=e.bottom)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("top",(null===(r=e.top)||void 0===r?void 0:r.toString())||"unset"),a.setAttribute("left",(null===(o=e.left)||void 0===o?void 0:o.toString())||"unset"),document.body.appendChild(a),hu.healthChat=a}static start(e,t=!0){var n,i,r,o,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;if(t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||"",this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.right,bottom:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.bottom,top:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.top,left:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.left}),gu(),e.studio&&!e.building)return void this.handleStudioContext(e);let c=null;switch(e.widgetType){case fu.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case fu.Default:c=document.createElement("me-chat");break;case fu.Utilities:c=document.createElement("utilities-chat");break;default:c=document.createElement("me-chat")}if(!c)throw new Error("Invalid widget type");c.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),c.setAttribute("widgetType",e.widgetType||fu.Default),c.setAttribute("class","meetelise-chat"),c.setAttribute("role","region"),c.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,c.setAttribute("primaryColor",((e,t)=>{const n=Be(e),i=0,r=0,o=0,a={r:n.r+Math.round((i-n.r)*t),g:n.g+Math.round((r-n.g)*t),b:n.b+Math.round((o-n.b)*t)};return je(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),c instanceof Jl&&(this.handleBuildingslug(c,e.organization,e.building,e),e.launcherStyles&&(c.launcherStyles=e.launcherStyles),e.mobileStyles&&(c.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(c.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await du("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),c.overrideRentgrata=!0),e.onSstClose&&(c.onSstClose=e.onSstClose)),e.position&&(c.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),c.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),c.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),c.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(c),c instanceof Jl&&(hu.meChat=c),c instanceof uu&&(hu.utilitiesChat=c)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.studioUpdateToken+=1,await this.removeWidget(),this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.activeStudioOptions=null}static async removeWidget(){var e;if(!this.meChat)return;const t=this.meChat;await t.remove(),null===(e=t.parentNode)||void 0===e||e.removeChild(t),hu.meChat=null}static handleStudioContext(e){e.studio&&(this.activeStudioOptions=e)}static updateStudioContext(e){const t=this.activeStudioOptions;if(!(null==t?void 0:t.studio))return;const n=++this.studioUpdateToken;if(e.siteId&&e.siteId!==t.studio.siteId)return void Ei({logType:Ai.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:t.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});const i=pu(e.organization),r=pu(e.building);if(!i||!r)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const o=function(e,t){if(!(null==e?void 0:e.key))return`building:${t}`;return e.key}(e.sessionScope,r),a=function(e){return"Pacific Urban Residential"===e?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e}(i);this.activeStudioOrgSlug===a&&this.activeStudioBuildingSlug===r&&this.activeStudioSessionScopeKey===o||this.removeWidget().then(()=>{n===this.studioUpdateToken&&(this.activeStudioOrgSlug=a,this.activeStudioBuildingSlug=r,this.activeStudioSessionScopeKey=o,this.orgSlug=a,this.start({...t,organization:i,building:r},!1))})}static clearStudioContext(e){this.studioUpdateToken+=1,this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.removeWidget()}static async handleBuildingslug(e,t,n,i){if(n)return void e.setAttribute("buildingSlug",n);if(this.mutationObserver)return;if(!t)return;const r=await cu(t);if(r){const e={...i,organization:t,building:r};this.start(e,!1)}this.previousUrl=window.location.href,document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,cu(t).then(e=>{if(!e)return;const n={...i,organization:t,building:e};this.start(n,!1)}))})},!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,t=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,n=await r().get(t,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&Ei({logType:n&&n.data?Ai.info:Ai.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:e,orgSlug:this.orgSlug,givenBuildingSlug:null,reason:n&&n.data?null:"No match found"}}),!n||!n.data)return;const i={organization:this.orgSlug,building:n.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(i,!1)}static async calculateBuildingSlugForLogging(e){const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&Ei({logType:i&&i.data===e?Ai.info:Ai.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i&&i.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:i&&i.data===e?null:i&&!i.data?"No match found":i&&i.data!==e?"Mismatch":"No match found"}}),i&&i.data}}function pu(e){return"string"!=typeof e?"":e.trim()}var fu;hu.meChat=null,hu.healthChat=null,hu.utilitiesChat=null,hu.orgSlug="",hu.mutationObserver=null,hu.previousUrl="",hu.hasBuildingSlug=null,hu.brandColor="",hu.backgroundColor="",hu.healthcareId="",hu.activeStudioOrgSlug="",hu.activeStudioBuildingSlug="",hu.activeStudioSessionScopeKey="",hu.activeStudioOptions=null,hu.studioUpdateToken=0,hu.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(fu||(fu={}));const gu=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{fu as WidgetType,hu as default};
7398
+ `,uu([ue({type:String})],cu.prototype,"orgSlug",void 0),uu([ue({type:Number})],cu.prototype,"right",void 0),uu([ue({type:Number})],cu.prototype,"bottom",void 0),uu([ue({type:Number})],cu.prototype,"top",void 0),uu([ue({type:Number})],cu.prototype,"left",void 0),uu([ce()],cu.prototype,"launcher",void 0),uu([ce()],cu.prototype,"currentLeadSource",void 0),uu([ce()],cu.prototype,"displayPubnubChat",void 0),uu([ce()],cu.prototype,"myPubnub",void 0),uu([ce()],cu.prototype,"requiresConsent",void 0),uu([ce()],cu.prototype,"privacyPolicyUrl",void 0),uu([ce()],cu.prototype,"isLoading",void 0),cu=uu([se("utilities-chat")],cu);const du=async e=>{const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":e}});return Math.random()<.2&&Ei({logType:i&&i.data?Ai.info:Ai.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:e,givenBuildingSlug:null,reason:i&&i.data?null:"No match found"}}),i.data},hu=async(e,t=5e3)=>new Promise((n,i)=>{const r=new MutationObserver((t,i)=>{const r=document.getElementById(e);r&&(i.disconnect(),n(r))});r.observe(document.body,{childList:!0,subtree:!0});const o=setTimeout(()=>{r.disconnect(),i(new Error(`Element ${e} did not appear within ${t}ms`))},t),a=document.querySelector(e);a&&(clearTimeout(o),r.disconnect(),n(a))});class pu{static healthcareStart(e,t=!0){var n,i,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),mu();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","region"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(n=e.right)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("bottom",(null===(i=e.bottom)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("top",(null===(r=e.top)||void 0===r?void 0:r.toString())||"unset"),a.setAttribute("left",(null===(o=e.left)||void 0===o?void 0:o.toString())||"unset"),document.body.appendChild(a),pu.healthChat=a}static start(e,t=!0){var n,i,r,o,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;if(t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||"",this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.right,bottom:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.bottom,top:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.top,left:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.left}),mu(),e.studio&&!e.building)return void this.handleStudioContext(e);let c=null;switch(e.widgetType){case gu.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case gu.Default:c=document.createElement("me-chat");break;case gu.Utilities:c=document.createElement("utilities-chat");break;default:c=document.createElement("me-chat")}if(!c)throw new Error("Invalid widget type");c.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),c.setAttribute("widgetType",e.widgetType||gu.Default),c.setAttribute("class","meetelise-chat"),c.setAttribute("role","region"),c.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,c.setAttribute("primaryColor",((e,t)=>{const n=Be(e),i=0,r=0,o=0,a={r:n.r+Math.round((i-n.r)*t),g:n.g+Math.round((r-n.g)*t),b:n.b+Math.round((o-n.b)*t)};return je(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),c instanceof eu&&(this.handleBuildingslug(c,e.organization,e.building,e),e.launcherStyles&&(c.launcherStyles=e.launcherStyles),e.mobileStyles&&(c.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(c.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await hu("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),c.overrideRentgrata=!0),e.onSstClose&&(c.onSstClose=e.onSstClose)),e.position&&(c.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),c.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),c.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),c.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(c),c instanceof eu&&(pu.meChat=c),c instanceof cu&&(pu.utilitiesChat=c)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.studioUpdateToken+=1,await this.removeWidget(),this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.activeStudioOptions=null}static async removeWidget(){var e;if(!this.meChat)return;const t=this.meChat;await t.remove(),null===(e=t.parentNode)||void 0===e||e.removeChild(t),pu.meChat=null}static handleStudioContext(e){e.studio&&(this.activeStudioOptions=e)}static updateStudioContext(e){const t=this.activeStudioOptions;if(!(null==t?void 0:t.studio))return;const n=++this.studioUpdateToken;if(e.siteId&&e.siteId!==t.studio.siteId)return void Ei({logType:Ai.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:t.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});const i=fu(e.organization),r=fu(e.building);if(!i||!r)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const o=function(e,t){if(!(null==e?void 0:e.key))return`building:${t}`;return e.key}(e.sessionScope,r),a=function(e){return"Pacific Urban Residential"===e?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e}(i);this.activeStudioOrgSlug===a&&this.activeStudioBuildingSlug===r&&this.activeStudioSessionScopeKey===o||this.removeWidget().then(()=>{n===this.studioUpdateToken&&(this.activeStudioOrgSlug=a,this.activeStudioBuildingSlug=r,this.activeStudioSessionScopeKey=o,this.orgSlug=a,this.start({...t,organization:i,building:r},!1))})}static clearStudioContext(e){this.studioUpdateToken+=1,this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.removeWidget()}static async handleBuildingslug(e,t,n,i){if(n)return void e.setAttribute("buildingSlug",n);if(this.mutationObserver)return;if(!t)return;const r=await du(t);if(r){const e={...i,organization:t,building:r};this.start(e,!1)}this.previousUrl=window.location.href,document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,du(t).then(e=>{if(!e)return;const n={...i,organization:t,building:e};this.start(n,!1)}))})},!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,t=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,n=await r().get(t,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&Ei({logType:n&&n.data?Ai.info:Ai.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:e,orgSlug:this.orgSlug,givenBuildingSlug:null,reason:n&&n.data?null:"No match found"}}),!n||!n.data)return;const i={organization:this.orgSlug,building:n.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(i,!1)}static async calculateBuildingSlugForLogging(e){const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&Ei({logType:i&&i.data===e?Ai.info:Ai.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i&&i.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:i&&i.data===e?null:i&&!i.data?"No match found":i&&i.data!==e?"Mismatch":"No match found"}}),i&&i.data}}function fu(e){return"string"!=typeof e?"":e.trim()}var gu;pu.meChat=null,pu.healthChat=null,pu.utilitiesChat=null,pu.orgSlug="",pu.mutationObserver=null,pu.previousUrl="",pu.hasBuildingSlug=null,pu.brandColor="",pu.backgroundColor="",pu.healthcareId="",pu.activeStudioOrgSlug="",pu.activeStudioBuildingSlug="",pu.activeStudioSessionScopeKey="",pu.activeStudioOptions=null,pu.studioUpdateToken=0,pu.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(gu||(gu={}));const mu=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{gu as WidgetType,pu as default};
package/src/MyPubnub.ts CHANGED
@@ -7,6 +7,10 @@ import { ChatStorageKey, createChatStorageKey } from "./handleChatId";
7
7
  import LeadSourceClient from "./WebComponent/LeadSourceClient";
8
8
  import { pushGtmEvent } from "./gtm";
9
9
  import { isContainingEmail, snakify } from "./utils";
10
+ import {
11
+ collectClientContext,
12
+ WebchatClientContext,
13
+ } from "./collectClientContext";
10
14
  import { WidgetType } from "./main/MEChat";
11
15
  import { BuildingWebchatView } from "./fetchBuildingWebchatView";
12
16
  import { LeadSourceMultitouchClient } from "./WebComponent/LeadSourceMultitouchClient";
@@ -218,9 +222,15 @@ class MyPubnub {
218
222
  expires_in_seconds: number;
219
223
  } | null> {
220
224
  try {
221
- const payload: Record<string, string> = {
225
+ const payload: {
226
+ building_slug: string;
227
+ org_slug: string;
228
+ lead_id?: string;
229
+ client_context?: WebchatClientContext;
230
+ } = {
222
231
  building_slug: buildingSlug,
223
232
  org_slug: orgSlug,
233
+ client_context: collectClientContext(),
224
234
  };
225
235
  if (existingLeadId) {
226
236
  payload.lead_id = existingLeadId;
@@ -0,0 +1,42 @@
1
+ import { getCampaignSources } from "./analytics";
2
+ import { getCookieValue } from "./utils";
3
+
4
+ export interface WebchatClientContext {
5
+ page_url?: string;
6
+ referrer?: string;
7
+ document_title?: string;
8
+ screen_width?: number;
9
+ screen_height?: number;
10
+ device_pixel_ratio?: number;
11
+ timezone?: string;
12
+ campaign_sources?: string;
13
+ ga_client_id?: string;
14
+ }
15
+
16
+ export const collectClientContext = (): WebchatClientContext => {
17
+ const context: WebchatClientContext = {};
18
+ try {
19
+ context.page_url = window.location.href;
20
+ if (document.referrer) {
21
+ context.referrer = document.referrer;
22
+ }
23
+ if (document.title) {
24
+ context.document_title = document.title;
25
+ }
26
+ if (window.screen) {
27
+ context.screen_width = window.screen.width;
28
+ context.screen_height = window.screen.height;
29
+ }
30
+ context.device_pixel_ratio = window.devicePixelRatio;
31
+ context.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
32
+ context.campaign_sources = JSON.stringify(getCampaignSources());
33
+ const gaClientId = getCookieValue("_ga");
34
+ if (gaClientId) {
35
+ context.ga_client_id = gaClientId;
36
+ }
37
+ } catch (e) {
38
+ // eslint-disable-next-line no-console
39
+ console.warn(`Couldnt collect webchat client context, error: ${e}`);
40
+ }
41
+ return context;
42
+ };