@meetelise/chat 1.51.13 → 1.51.14

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.
@@ -1,4 +1,4 @@
1
1
  export declare const insertLeadSourceIntoSchedulerLinks: (leadSource: string) => void;
2
- export declare const replaceSSTLinkWithTourWidgetTrigger: (handleTourClicked: (e: MouseEvent) => void) => void;
2
+ export declare const replaceSSTLinkWithTourWidgetTrigger: (handleTourClicked: (e: MouseEvent) => void, orgSlug: string, buildingSlug: string, isWidgetMounted: () => boolean) => void;
3
3
  export declare const replacePageRedirectElementWithTourWidgetTrigger: (handleTourClicked: (e: MouseEvent) => void) => void;
4
4
  export declare const replaceTourTriggerElementWithTourWidgetTrigger: (handleTourClicked: (e: MouseEvent) => void) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.51.13",
3
+ "version": "1.51.14",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -6044,7 +6044,7 @@ xmlns="http://www.w3.org/2000/svg"
6044
6044
  ${Wa}
6045
6045
  ${Va}
6046
6046
  ${qa}
6047
- `,Hl([ue({attribute:!0})],Gl.prototype,"isMinimized",void 0),Hl([ue()],Gl.prototype,"mobileStyles",void 0),Hl([ue({type:Boolean})],Gl.prototype,"isFirstMount",void 0),Hl([ue({attribute:!1})],Gl.prototype,"autoOpenChatWidget",void 0),Hl([ue()],Gl.prototype,"phoneNumber",void 0),Hl([ue({attribute:!0})],Gl.prototype,"buildingName",void 0),Hl([ue({attribute:!0})],Gl.prototype,"chatId",void 0),Hl([ue({attribute:!0})],Gl.prototype,"orgLegalName",void 0),Hl([ue({attribute:!1})],Gl.prototype,"country",void 0),Hl([ue({attribute:!0})],Gl.prototype,"chatCallUsHeader",void 0),Hl([ue({attribute:!1})],Gl.prototype,"buildingId",void 0),Hl([ue({type:Number})],Gl.prototype,"orgId",void 0),Hl([ue({attribute:!1})],Gl.prototype,"leadSourceParams",void 0),Hl([ue({attribute:!0})],Gl.prototype,"buildingSlug",void 0),Hl([ue({attribute:!0})],Gl.prototype,"orgSlug",void 0),Hl([ue({attribute:!0})],Gl.prototype,"sgtUrl",void 0),Hl([ue({attribute:!0})],Gl.prototype,"selfGuidedTourEnabled",void 0),Hl([ue({attribute:!0})],Gl.prototype,"selfGuidedToursTypeOffered",void 0),Hl([ue({attribute:!0})],Gl.prototype,"designConcept",void 0),Hl([ue({attribute:!0})],Gl.prototype,"featureFlagShowDropdown",void 0),Hl([ue({attribute:!1})],Gl.prototype,"leadSources",void 0),Hl([ue({attribute:!0})],Gl.prototype,"currentLeadSource",void 0),Hl([ue({attribute:!0})],Gl.prototype,"escortedToursLink",void 0),Hl([ue({attribute:!0})],Gl.prototype,"escortedToursTypeOffered",void 0),Hl([ue({attribute:!0})],Gl.prototype,"virtualToursLink",void 0),Hl([ue({attribute:!0})],Gl.prototype,"virtualToursTypeOffered",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasChatEnabledDesktop",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasChatEnabledMobile",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasEmailEnabledDesktop",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasEmailEnabledMobile",void 0),Hl([ue({attribute:!0})],Gl.prototype,"hasApplyNowEnabledDesktop",void 0),Hl([ue({attribute:!0})],Gl.prototype,"hasApplyNowEnabledMobile",void 0),Hl([ue({attribute:!0})],Gl.prototype,"applicationLink",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasCallUsEnabledDesktop",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasCallUsEnabledMobile",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasTextUsEnabledDesktop",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasTextUsEnabledMobile",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasSSTEnabledDesktop",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasSSTEnabledMobile",void 0),Hl([ue({attribute:!1})],Gl.prototype,"tourTypeOptions",void 0),Hl([ue({attribute:!1})],Gl.prototype,"layoutOptions",void 0),Hl([ue({attribute:!0})],Gl.prototype,"bedroomPreferenceRequired",void 0),Hl([ue({attribute:!0})],Gl.prototype,"hasDynamicSchedulingEnabled",void 0),Hl([ue({attribute:!0})],Gl.prototype,"hasPricingCalculatorEnabledDesktop",void 0),Hl([ue({attribute:!0})],Gl.prototype,"hasPricingCalculatorEnabledMobile",void 0),Hl([ue({attribute:!1})],Gl.prototype,"hasHideMobileFeatures",void 0),Hl([ue({type:Number})],Gl.prototype,"right",void 0),Hl([ue({type:Number})],Gl.prototype,"bottom",void 0),Hl([ue({type:Number})],Gl.prototype,"top",void 0),Hl([ue({type:Number})],Gl.prototype,"left",void 0),Hl([ue({attribute:!0})],Gl.prototype,"showTourNextToChat",void 0),Hl([ue({attribute:!1})],Gl.prototype,"onChatTapped",void 0),Hl([ue({attribute:!0})],Gl.prototype,"onClickMinimize",void 0),Hl([ue({attribute:!0})],Gl.prototype,"onSstClose",void 0),Hl([ue({attribute:!0})],Gl.prototype,"overrideRentgrata",void 0),Hl([ue({attribute:!1})],Gl.prototype,"launcherStyles",void 0),Hl([ue({attribute:!0})],Gl.prototype,"primaryColor",void 0),Hl([ue({attribute:!0})],Gl.prototype,"backgroundColor",void 0),Hl([ue({attribute:!0})],Gl.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Hl([ue({attribute:!0})],Gl.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Hl([ue({attribute:!0})],Gl.prototype,"leadSourceClient",void 0),Hl([de()],Gl.prototype,"leadSourceMultitouchClient",void 0),Hl([de()],Gl.prototype,"_isMobile",void 0),Hl([de()],Gl.prototype,"isEmailWindowOpen",void 0),Hl([de()],Gl.prototype,"isCallUsWindowOpen",void 0),Hl([de()],Gl.prototype,"isSSTWindowOpen",void 0),Hl([de()],Gl.prototype,"isTextUsWindowOpen",void 0),Hl([de()],Gl.prototype,"isCalculatorWindowOpen",void 0),Hl([de()],Gl.prototype,"isMobileFeaturesExpanded",void 0),Gl=Hl([se("meetelise-launcher")],Gl);const zl=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Gl)},Ql=["app.meetelise.com","staging.eliseai.com","localhost"],Wl={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"}},Vl=e=>{const t=window.location.hostname;if(!Ql.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 Wl&&(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=Wl[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var ql=n(5072),Yl=n.n(ql),Kl=n(7825),Xl=n.n(Kl),Zl=n(7659),Jl=n.n(Zl),eu=n(5056),tu=n.n(eu),nu=n(540),iu=n.n(nu),ru=n(1113),ou=n.n(ru),au=n(5541),su={};su.styleTagTransform=ou(),su.setAttributes=tu(),su.insert=Jl().bind(null,"head"),su.domAPI=Xl(),su.insertStyleElement=iu();Yl()(au.A,su);au.A&&au.A.locals&&au.A.locals;async function lu(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 uu(n.data,t)}return[]}catch(e){return[]}}const uu=(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 du(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 cu,hu=n(8805),pu=n.n(hu),fu=new Uint8Array(16);function gu(){if(!cu&&!(cu="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 cu(fu)}const mu=/^(?:[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 yu=function(e){return"string"==typeof e&&mu.test(e)};for(var bu=[],vu=0;vu<256;++vu)bu.push((vu+256).toString(16).substr(1));const wu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(bu[e[t+0]]+bu[e[t+1]]+bu[e[t+2]]+bu[e[t+3]]+"-"+bu[e[t+4]]+bu[e[t+5]]+"-"+bu[e[t+6]]+bu[e[t+7]]+"-"+bu[e[t+8]]+bu[e[t+9]]+"-"+bu[e[t+10]]+bu[e[t+11]]+bu[e[t+12]]+bu[e[t+13]]+bu[e[t+14]]+bu[e[t+15]]).toLowerCase();if(!yu(n))throw TypeError("Stringified UUID is invalid");return n};const Cu=function(e,t,n){var i=(e=e||{}).random||(e.rng||gu)();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 wu(i)},xu=e=>localStorage.removeItem("com.elise.webchat.slug="+e),$u=(e,t,n)=>{const i=Br(new Date),r=n||`lead_${Cu()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Vr(i),buildingSlug:e,initiatedChat:t}},Su=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(Au(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Au=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if($r(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!Ir(t.timestamp,24)};var Eu;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(Eu||(Eu={}));const Tu=e=>e.type===_u.text,ku=e=>e.type===_u.media;var _u;!function(e){e.text="text",e.media="media"}(_u||(_u={}));const Ou=class{constructor(e,t,n,i=null,r,o,a=null,s=Ic.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.firedScheduledTourConfirmationIds=new Set,this.widgetType=Ic.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;const n={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,n],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==Eu.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const i="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:i}),!i&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=i,"ai_message"===e.message.customType){const t=e.message.stream_id,n=null!=t?t:String(+e.timetoken);(t?this.reconstructStreamText(t):e.message.text).includes("confirmed for your")&&this.fireScheduledTourEventOnce(n,e.message)}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=new Map;this.rawPubnubMessages.forEach(e=>{var n;const i=e.message.stream_id;i&&t.set(i,[...null!==(n=t.get(i))&&void 0!==n?n:[],e])});const n=[...t.entries()].filter(([,e])=>!this.isStreamComplete(e)).map(([e])=>e);n.length>0&&(this.streamingMessageTimeout=setTimeout(()=>{Ho({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:Fo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory().then(()=>n.forEach(e=>this.checkAndFireTourConfirmationForStream(e)))},e))},this.isStreamComplete=e=>{var t;const n=e.find(e=>e.message.is_done);if(!n)return!1;const i=new Set(e.map(e=>{var t;return null!==(t=e.message.order)&&void 0!==t?t:0}));for(let e=0;e<=(null!==(t=n.message.order)&&void 0!==t?t:0);e++)if(!i.has(e))return!1;return!0},this.getStreamChunks=e=>this.removeDuplicatedRawPubnubMessages(this.rawPubnubMessages).filter(t=>t.message.stream_id===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)}),this.reconstructStreamText=e=>this.getStreamChunks(e).map(e=>e.message.text).join(""),this.fireScheduledTourEventOnce=(e,t)=>{var n;this.firedScheduledTourConfirmationIds.has(e)||(this.firedScheduledTourConfirmationIds.add(e),$o("scheduledTourEvent",{tourDetails:t,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.checkAndFireTourConfirmationForStream=e=>{var t;if(this.reconstructStreamText(e).includes("confirmed for your")){const n=this.getStreamChunks(e);this.fireScheduledTourEventOnce(e,null===(t=n[n.length-1])||void 0===t?void 0:t.message)}},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;$o("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)===Eu.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&&Ho({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:Fo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},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=$u(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&&Ho({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:Fo.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===Ic.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=>Tr({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||($o("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),$o("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)?(Ho({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:Fo.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:_u.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:_u.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:_u.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&&Ho({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:Fo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e}),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(pu())({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&&Ho({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:Fo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Ho({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:Fo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Ho({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:Fo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}}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!==Eu.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&&Ho({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:Fo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},Pu=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"]),Iu=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return Pu.has(t)},Nu=(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.-]?)?(?:\([2-9]\d{2}\)[\s.-]?|[2-9]\d{2}[\s.-])[2-9]\d{2}[\s.-]?\d{4}/g,d=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,c=/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(Iu(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=d;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=c):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,Iu(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&&Ho({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:Fo.info,buildingSlug:n,orgSlug:t}),C&&Ho({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:Fo.info,buildingSlug:n,orgSlug:t}),b||Ho({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:Fo.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Ho({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:Fo.error,buildingSlug:n,orgSlug:t,error:e}),0}};var Mu=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 Du=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=qn,this.foregroundColorOnPrimaryBackgroundColor="white",this.toExpand=!1}render(){return R`
6047
+ `,Hl([ue({attribute:!0})],Gl.prototype,"isMinimized",void 0),Hl([ue()],Gl.prototype,"mobileStyles",void 0),Hl([ue({type:Boolean})],Gl.prototype,"isFirstMount",void 0),Hl([ue({attribute:!1})],Gl.prototype,"autoOpenChatWidget",void 0),Hl([ue()],Gl.prototype,"phoneNumber",void 0),Hl([ue({attribute:!0})],Gl.prototype,"buildingName",void 0),Hl([ue({attribute:!0})],Gl.prototype,"chatId",void 0),Hl([ue({attribute:!0})],Gl.prototype,"orgLegalName",void 0),Hl([ue({attribute:!1})],Gl.prototype,"country",void 0),Hl([ue({attribute:!0})],Gl.prototype,"chatCallUsHeader",void 0),Hl([ue({attribute:!1})],Gl.prototype,"buildingId",void 0),Hl([ue({type:Number})],Gl.prototype,"orgId",void 0),Hl([ue({attribute:!1})],Gl.prototype,"leadSourceParams",void 0),Hl([ue({attribute:!0})],Gl.prototype,"buildingSlug",void 0),Hl([ue({attribute:!0})],Gl.prototype,"orgSlug",void 0),Hl([ue({attribute:!0})],Gl.prototype,"sgtUrl",void 0),Hl([ue({attribute:!0})],Gl.prototype,"selfGuidedTourEnabled",void 0),Hl([ue({attribute:!0})],Gl.prototype,"selfGuidedToursTypeOffered",void 0),Hl([ue({attribute:!0})],Gl.prototype,"designConcept",void 0),Hl([ue({attribute:!0})],Gl.prototype,"featureFlagShowDropdown",void 0),Hl([ue({attribute:!1})],Gl.prototype,"leadSources",void 0),Hl([ue({attribute:!0})],Gl.prototype,"currentLeadSource",void 0),Hl([ue({attribute:!0})],Gl.prototype,"escortedToursLink",void 0),Hl([ue({attribute:!0})],Gl.prototype,"escortedToursTypeOffered",void 0),Hl([ue({attribute:!0})],Gl.prototype,"virtualToursLink",void 0),Hl([ue({attribute:!0})],Gl.prototype,"virtualToursTypeOffered",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasChatEnabledDesktop",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasChatEnabledMobile",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasEmailEnabledDesktop",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasEmailEnabledMobile",void 0),Hl([ue({attribute:!0})],Gl.prototype,"hasApplyNowEnabledDesktop",void 0),Hl([ue({attribute:!0})],Gl.prototype,"hasApplyNowEnabledMobile",void 0),Hl([ue({attribute:!0})],Gl.prototype,"applicationLink",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasCallUsEnabledDesktop",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasCallUsEnabledMobile",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasTextUsEnabledDesktop",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasTextUsEnabledMobile",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasSSTEnabledDesktop",void 0),Hl([ue({type:Boolean})],Gl.prototype,"hasSSTEnabledMobile",void 0),Hl([ue({attribute:!1})],Gl.prototype,"tourTypeOptions",void 0),Hl([ue({attribute:!1})],Gl.prototype,"layoutOptions",void 0),Hl([ue({attribute:!0})],Gl.prototype,"bedroomPreferenceRequired",void 0),Hl([ue({attribute:!0})],Gl.prototype,"hasDynamicSchedulingEnabled",void 0),Hl([ue({attribute:!0})],Gl.prototype,"hasPricingCalculatorEnabledDesktop",void 0),Hl([ue({attribute:!0})],Gl.prototype,"hasPricingCalculatorEnabledMobile",void 0),Hl([ue({attribute:!1})],Gl.prototype,"hasHideMobileFeatures",void 0),Hl([ue({type:Number})],Gl.prototype,"right",void 0),Hl([ue({type:Number})],Gl.prototype,"bottom",void 0),Hl([ue({type:Number})],Gl.prototype,"top",void 0),Hl([ue({type:Number})],Gl.prototype,"left",void 0),Hl([ue({attribute:!0})],Gl.prototype,"showTourNextToChat",void 0),Hl([ue({attribute:!1})],Gl.prototype,"onChatTapped",void 0),Hl([ue({attribute:!0})],Gl.prototype,"onClickMinimize",void 0),Hl([ue({attribute:!0})],Gl.prototype,"onSstClose",void 0),Hl([ue({attribute:!0})],Gl.prototype,"overrideRentgrata",void 0),Hl([ue({attribute:!1})],Gl.prototype,"launcherStyles",void 0),Hl([ue({attribute:!0})],Gl.prototype,"primaryColor",void 0),Hl([ue({attribute:!0})],Gl.prototype,"backgroundColor",void 0),Hl([ue({attribute:!0})],Gl.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Hl([ue({attribute:!0})],Gl.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Hl([ue({attribute:!0})],Gl.prototype,"leadSourceClient",void 0),Hl([de()],Gl.prototype,"leadSourceMultitouchClient",void 0),Hl([de()],Gl.prototype,"_isMobile",void 0),Hl([de()],Gl.prototype,"isEmailWindowOpen",void 0),Hl([de()],Gl.prototype,"isCallUsWindowOpen",void 0),Hl([de()],Gl.prototype,"isSSTWindowOpen",void 0),Hl([de()],Gl.prototype,"isTextUsWindowOpen",void 0),Hl([de()],Gl.prototype,"isCalculatorWindowOpen",void 0),Hl([de()],Gl.prototype,"isMobileFeaturesExpanded",void 0),Gl=Hl([se("meetelise-launcher")],Gl);const zl=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Gl)},Ql=["app.meetelise.com","staging.eliseai.com","localhost"],Wl={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"}},Vl=e=>{const t=window.location.hostname;if(!Ql.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 Wl&&(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=Wl[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var ql=n(5072),Yl=n.n(ql),Kl=n(7825),Xl=n.n(Kl),Zl=n(7659),Jl=n.n(Zl),eu=n(5056),tu=n.n(eu),nu=n(540),iu=n.n(nu),ru=n(1113),ou=n.n(ru),au=n(5541),su={};su.styleTagTransform=ou(),su.setAttributes=tu(),su.insert=Jl().bind(null,"head"),su.domAPI=Xl(),su.insertStyleElement=iu();Yl()(au.A,su);au.A&&au.A.locals&&au.A.locals;async function lu(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 uu(n.data,t)}return[]}catch(e){return[]}}const uu=(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 du(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 cu,hu=n(8805),pu=n.n(hu),fu=new Uint8Array(16);function gu(){if(!cu&&!(cu="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 cu(fu)}const mu=/^(?:[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 yu=function(e){return"string"==typeof e&&mu.test(e)};for(var bu=[],vu=0;vu<256;++vu)bu.push((vu+256).toString(16).substr(1));const wu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(bu[e[t+0]]+bu[e[t+1]]+bu[e[t+2]]+bu[e[t+3]]+"-"+bu[e[t+4]]+bu[e[t+5]]+"-"+bu[e[t+6]]+bu[e[t+7]]+"-"+bu[e[t+8]]+bu[e[t+9]]+"-"+bu[e[t+10]]+bu[e[t+11]]+bu[e[t+12]]+bu[e[t+13]]+bu[e[t+14]]+bu[e[t+15]]).toLowerCase();if(!yu(n))throw TypeError("Stringified UUID is invalid");return n};const Cu=function(e,t,n){var i=(e=e||{}).random||(e.rng||gu)();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 wu(i)},xu=e=>localStorage.removeItem("com.elise.webchat.slug="+e),$u=(e,t,n)=>{const i=Br(new Date),r=n||`lead_${Cu()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Vr(i),buildingSlug:e,initiatedChat:t}},Su=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(Au(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Au=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if($r(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!Ir(t.timestamp,24)};var Eu;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(Eu||(Eu={}));const Tu=e=>e.type===_u.text,ku=e=>e.type===_u.media;var _u;!function(e){e.text="text",e.media="media"}(_u||(_u={}));const Ou=class{constructor(e,t,n,i=null,r,o,a=null,s=Nc.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.firedScheduledTourConfirmationIds=new Set,this.widgetType=Nc.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;const n={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,n],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==Eu.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const i="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:i}),!i&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=i,"ai_message"===e.message.customType){const t=e.message.stream_id,n=null!=t?t:String(+e.timetoken);(t?this.reconstructStreamText(t):e.message.text).includes("confirmed for your")&&this.fireScheduledTourEventOnce(n,e.message)}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=new Map;this.rawPubnubMessages.forEach(e=>{var n;const i=e.message.stream_id;i&&t.set(i,[...null!==(n=t.get(i))&&void 0!==n?n:[],e])});const n=[...t.entries()].filter(([,e])=>!this.isStreamComplete(e)).map(([e])=>e);n.length>0&&(this.streamingMessageTimeout=setTimeout(()=>{Ho({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:Fo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory().then(()=>n.forEach(e=>this.checkAndFireTourConfirmationForStream(e)))},e))},this.isStreamComplete=e=>{var t;const n=e.find(e=>e.message.is_done);if(!n)return!1;const i=new Set(e.map(e=>{var t;return null!==(t=e.message.order)&&void 0!==t?t:0}));for(let e=0;e<=(null!==(t=n.message.order)&&void 0!==t?t:0);e++)if(!i.has(e))return!1;return!0},this.getStreamChunks=e=>this.removeDuplicatedRawPubnubMessages(this.rawPubnubMessages).filter(t=>t.message.stream_id===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)}),this.reconstructStreamText=e=>this.getStreamChunks(e).map(e=>e.message.text).join(""),this.fireScheduledTourEventOnce=(e,t)=>{var n;this.firedScheduledTourConfirmationIds.has(e)||(this.firedScheduledTourConfirmationIds.add(e),$o("scheduledTourEvent",{tourDetails:t,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.checkAndFireTourConfirmationForStream=e=>{var t;if(this.reconstructStreamText(e).includes("confirmed for your")){const n=this.getStreamChunks(e);this.fireScheduledTourEventOnce(e,null===(t=n[n.length-1])||void 0===t?void 0:t.message)}},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;$o("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)===Eu.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&&Ho({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:Fo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},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=$u(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&&Ho({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:Fo.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===Nc.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=>Tr({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||($o("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),$o("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)?(Ho({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:Fo.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:_u.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:_u.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:_u.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&&Ho({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:Fo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e}),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(pu())({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&&Ho({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:Fo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Ho({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:Fo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Ho({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:Fo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}}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!==Eu.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&&Ho({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:Fo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},Pu=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"]),Iu=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return Pu.has(t)},Nu=(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.-]?)?(?:\([2-9]\d{2}\)[\s.-]?|[2-9]\d{2}[\s.-])[2-9]\d{2}[\s.-]?\d{4}/g,d=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,c=/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(Iu(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=d;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=c):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,Iu(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&&Ho({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:Fo.info,buildingSlug:n,orgSlug:t}),C&&Ho({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:Fo.info,buildingSlug:n,orgSlug:t}),b||Ho({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:Fo.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Ho({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:Fo.error,buildingSlug:n,orgSlug:t,error:e}),0}},Mu=(e,t,n,i)=>{document.querySelectorAll("a").forEach(function(r){const o=r.getAttribute("href");o&&o.startsWith("https://app.meetelise.com/")&&((e,t,n)=>{const[i,r,o,...a]=new URL(e).pathname.split("/").filter(Boolean).map(e=>e.toLowerCase());return 0===a.length&&"tour"===o&&i===t.toLowerCase()&&r===n.toLowerCase()})(o,t,n)&&r.addEventListener("click",t=>{i()&&(t.preventDefault(),e(t))})})};var Du=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.onClick=()=>{},this.primaryColor=qn,this.foregroundColorOnPrimaryBackgroundColor="white",this.toExpand=!1}render(){return R`
6048
6048
  <button
6049
6049
  class=${this.toExpand?"button-container mini":"button-container"}
6050
6050
  @click=${this.onClick}
@@ -6061,7 +6061,7 @@ xmlns="http://www.w3.org/2000/svg"
6061
6061
  </div>`}
6062
6062
  </div>
6063
6063
  </button>
6064
- `}};Du.styles=[u`
6064
+ `}};Lu.styles=[u`
6065
6065
  .button-container {
6066
6066
  width: 56px;
6067
6067
  height: 56px;
@@ -6111,7 +6111,7 @@ xmlns="http://www.w3.org/2000/svg"
6111
6111
  cursor: pointer;
6112
6112
  filter: brightness(90%);
6113
6113
  }
6114
- `],Mu([ue({attribute:!0})],Du.prototype,"onClick",void 0),Mu([ue({attribute:!0})],Du.prototype,"primaryColor",void 0),Mu([ue({attribute:!0})],Du.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Mu([ue({attribute:!0})],Du.prototype,"toExpand",void 0),Du=Mu([se("minimize-expand-button")],Du);const Lu=u`
6114
+ `],Du([ue({attribute:!0})],Lu.prototype,"onClick",void 0),Du([ue({attribute:!0})],Lu.prototype,"primaryColor",void 0),Du([ue({attribute:!0})],Lu.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Du([ue({attribute:!0})],Lu.prototype,"toExpand",void 0),Lu=Du([se("minimize-expand-button")],Lu);const Uu=u`
6115
6115
  #healthchat-container {
6116
6116
  position: fixed;
6117
6117
 
@@ -6229,7 +6229,7 @@ xmlns="http://www.w3.org/2000/svg"
6229
6229
  .health-bttn-allow-access {
6230
6230
  padding-right: 28px;
6231
6231
  }
6232
- `,Uu=u`
6232
+ `,Ru=u`
6233
6233
  #pubnub-chat-container {
6234
6234
  position: fixed;
6235
6235
 
@@ -6349,7 +6349,7 @@ xmlns="http://www.w3.org/2000/svg"
6349
6349
  border: none;
6350
6350
  cursor: pointer;
6351
6351
  }
6352
- `,Ru=u`
6352
+ `,Bu=u`
6353
6353
  #header-text {
6354
6354
  font-size: 12px;
6355
6355
  font-weight: 700;
@@ -6550,7 +6550,7 @@ xmlns="http://www.w3.org/2000/svg"
6550
6550
  .checkbox:hover {
6551
6551
  opacity: 0.5;
6552
6552
  }
6553
- `,{entries:Bu,setPrototypeOf:ju,isFrozen:Fu,getPrototypeOf:Hu,getOwnPropertyDescriptor:Gu}=Object;let{freeze:zu,seal:Qu,create:Wu}=Object,{apply:Vu,construct:qu}="undefined"!=typeof Reflect&&Reflect;zu||(zu=function(e){return e}),Qu||(Qu=function(e){return e}),Vu||(Vu=function(e,t,n){return e.apply(t,n)}),qu||(qu=function(e,t){return new e(...t)});const Yu=dd(Array.prototype.forEach),Ku=dd(Array.prototype.lastIndexOf),Xu=dd(Array.prototype.pop),Zu=dd(Array.prototype.push),Ju=dd(Array.prototype.splice),ed=dd(String.prototype.toLowerCase),td=dd(String.prototype.toString),nd=dd(String.prototype.match),id=dd(String.prototype.replace),rd=dd(String.prototype.indexOf),od=dd(String.prototype.trim),ad=dd(Object.prototype.hasOwnProperty),sd=dd(RegExp.prototype.test),ld=(ud=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return qu(ud,t)});var ud;function dd(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 Vu(e,t,i)}}function cd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ed;ju&&ju(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(Fu(t)||(t[i]=e),r=e)}e[r]=!0}return e}function hd(e){for(let t=0;t<e.length;t++){ad(e,t)||(e[t]=null)}return e}function pd(e){const t=Wu(null);for(const[n,i]of Bu(e)){ad(e,n)&&(Array.isArray(i)?t[n]=hd(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=pd(i):t[n]=i)}return t}function fd(e,t){for(;null!==e;){const n=Gu(e,t);if(n){if(n.get)return dd(n.get);if("function"==typeof n.value)return dd(n.value)}e=Hu(e)}return function(){return null}}const gd=zu(["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"]),md=zu(["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"]),yd=zu(["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"]),bd=zu(["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"]),vd=zu(["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"]),wd=zu(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Cd=zu(["#text"]),xd=zu(["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"]),$d=zu(["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"]),Sd=zu(["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"]),Ad=zu(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ed=Qu(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Td=Qu(/<%[\w\W]*|[\w\W]*%>/gm),kd=Qu(/\$\{[\w\W]*/gm),_d=Qu(/^data-[\-\w.\u00B7-\uFFFF]+$/),Od=Qu(/^aria-[\-\w]+$/),Pd=Qu(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Id=Qu(/^(?:\w+script|data):/i),Nd=Qu(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Md=Qu(/^html$/i),Dd=Qu(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ld=Object.freeze({__proto__:null,ARIA_ATTR:Od,ATTR_WHITESPACE:Nd,CUSTOM_ELEMENT:Dd,DATA_ATTR:_d,DOCTYPE_NAME:Md,ERB_EXPR:Td,IS_ALLOWED_URI:Pd,IS_SCRIPT_OR_DATA:Id,MUSTACHE_EXPR:Ed,TMPLIT_EXPR:kd});const Ud=1,Rd=3,Bd=7,jd=8,Fd=9,Hd=function(){return"undefined"==typeof window?null:window};var Gd=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Hd();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==Fd||!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:d,NamedNodeMap:c=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:p,trustedTypes:f}=t,g=u.prototype,m=fd(g,"cloneNode"),y=fd(g,"remove"),b=fd(g,"nextSibling"),v=fd(g,"childNodes"),w=fd(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:$,createNodeIterator:S,createDocumentFragment:A,getElementsByTagName:E}=i,{importNode:T}=r;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof Bu&&"function"==typeof w&&$&&void 0!==$.createHTMLDocument;const{MUSTACHE_EXPR:_,ERB_EXPR:O,TMPLIT_EXPR:P,DATA_ATTR:I,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:M,ATTR_WHITESPACE:D,CUSTOM_ELEMENT:L}=Ld;let{IS_ALLOWED_URI:U}=Ld,R=null;const B=cd({},[...gd,...md,...yd,...vd,...Cd]);let j=null;const F=cd({},[...xd,...$d,...Sd,...Ad]);let H=Object.seal(Wu(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}})),G=null,z=null,Q=!0,W=!0,V=!1,q=!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=cd({},["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 de=null;const ce=cd({},["audio","video","img","source","image","track"]);let he=null;const pe=cd({},["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=cd({},[fe,ge,me],td);let Ce=cd({},["mi","mo","mn","ms","mtext"]),xe=cd({},["annotation-xml"]);const $e=cd({},["title","style","font","a","script"]);let Se=null;const Ae=["application/xhtml+xml","text/html"];let Ee=null,Te=null;const ke=i.createElement("form"),_e=function(e){return e instanceof RegExp||e instanceof Function},Oe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Te||Te!==e){if(e&&"object"==typeof e||(e={}),e=pd(e),Se=-1===Ae.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ee="application/xhtml+xml"===Se?td:ed,R=ad(e,"ALLOWED_TAGS")?cd({},e.ALLOWED_TAGS,Ee):B,j=ad(e,"ALLOWED_ATTR")?cd({},e.ALLOWED_ATTR,Ee):F,ve=ad(e,"ALLOWED_NAMESPACES")?cd({},e.ALLOWED_NAMESPACES,td):we,he=ad(e,"ADD_URI_SAFE_ATTR")?cd(pd(pe),e.ADD_URI_SAFE_ATTR,Ee):pe,de=ad(e,"ADD_DATA_URI_TAGS")?cd(pd(ce),e.ADD_DATA_URI_TAGS,Ee):ce,le=ad(e,"FORBID_CONTENTS")?cd({},e.FORBID_CONTENTS,Ee):ue,G=ad(e,"FORBID_TAGS")?cd({},e.FORBID_TAGS,Ee):pd({}),z=ad(e,"FORBID_ATTR")?cd({},e.FORBID_ATTR,Ee):pd({}),se=!!ad(e,"USE_PROFILES")&&e.USE_PROFILES,Q=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,V=e.ALLOW_UNKNOWN_PROTOCOLS||!1,q=!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,U=e.ALLOWED_URI_REGEXP||Pd,ye=e.NAMESPACE||me,Ce=e.MATHML_TEXT_INTEGRATION_POINTS||Ce,xe=e.HTML_INTEGRATION_POINTS||xe,H=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_e(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_e(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(H.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(W=!1),te&&(ee=!0),se&&(R=cd({},Cd),j=[],!0===se.html&&(cd(R,gd),cd(j,xd)),!0===se.svg&&(cd(R,md),cd(j,$d),cd(j,Ad)),!0===se.svgFilters&&(cd(R,yd),cd(j,$d),cd(j,Ad)),!0===se.mathMl&&(cd(R,vd),cd(j,Sd),cd(j,Ad))),e.ADD_TAGS&&(R===B&&(R=pd(R)),cd(R,e.ADD_TAGS,Ee)),e.ADD_ATTR&&(j===F&&(j=pd(j)),cd(j,e.ADD_ATTR,Ee)),e.ADD_URI_SAFE_ATTR&&cd(he,e.ADD_URI_SAFE_ATTR,Ee),e.FORBID_CONTENTS&&(le===ue&&(le=pd(le)),cd(le,e.FORBID_CONTENTS,Ee)),oe&&(R["#text"]=!0),X&&cd(R,["html","head","body"]),R.table&&(cd(R,["tbody"]),delete G.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw ld('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw ld('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(""));zu&&zu(e),Te=e}},Pe=cd({},[...md,...yd,...bd]),Ie=cd({},[...vd,...wd]),Ne=function(e){Zu(n.removed,{element:e});try{w(e).removeChild(e)}catch(t){y(e)}},Me=function(e,t){try{Zu(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Zu(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){}},De=function(e){let t=null,n=null;if(J)e="<remove></remove>"+e;else{const t=nd(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Se&&ye===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=C?C.createHTML(e):e;if(ye===me)try{t=(new p).parseFromString(r,Se)}catch(e){}if(!t||!t.documentElement){t=$.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?E.call(t,X?"html":"body")[0]:X?t.documentElement:o},Le=function(e){return S.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Ue=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof c)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Re=function(e){return"function"==typeof l&&e instanceof l};function Be(e,t,i){Yu(e,e=>{e.call(n,t,i,Te)})}const je=function(e){let t=null;if(Be(k.beforeSanitizeElements,e,null),Ue(e))return Ne(e),!0;const i=Ee(e.nodeName);if(Be(k.uponSanitizeElement,e,{tagName:i,allowedTags:R}),K&&e.hasChildNodes()&&!Re(e.firstElementChild)&&sd(/<[/\w!]/g,e.innerHTML)&&sd(/<[/\w!]/g,e.textContent))return Ne(e),!0;if(e.nodeType===Bd)return Ne(e),!0;if(K&&e.nodeType===jd&&sd(/<[/\w]/g,e.data))return Ne(e),!0;if(!R[i]||G[i]){if(!G[i]&&He(i)){if(H.tagNameCheck instanceof RegExp&&sd(H.tagNameCheck,i))return!1;if(H.tagNameCheck instanceof Function&&H.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=ed(e.tagName),i=ed(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(Pe[n]):e.namespaceURI===fe?t.namespaceURI===me?"math"===n:t.namespaceURI===ge?"math"===n&&xe[i]:Boolean(Ie[n]):e.namespaceURI===me?!(t.namespaceURI===ge&&!xe[i])&&!(t.namespaceURI===fe&&!Ce[i])&&!Ie[n]&&($e[n]||!Pe[n]):!("application/xhtml+xml"!==Se||!ve[e.namespaceURI]))}(e)?(Ne(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!sd(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===Rd&&(t=e.textContent,Yu([_,O,P],e=>{t=id(t,e," ")}),e.textContent!==t&&(Zu(n.removed,{element:e.cloneNode()}),e.textContent=t)),Be(k.afterSanitizeElements,e,null),!1):(Ne(e),!0)},Fe=function(e,t,n){if(ie&&("id"===t||"name"===t)&&(n in i||n in ke))return!1;if(W&&!z[t]&&sd(I,t));else if(Q&&sd(N,t));else if(!j[t]||z[t]){if(!(He(e)&&(H.tagNameCheck instanceof RegExp&&sd(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&sd(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t))||"is"===t&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&sd(H.tagNameCheck,n)||H.tagNameCheck instanceof Function&&H.tagNameCheck(n))))return!1}else if(he[t]);else if(sd(U,id(n,D,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==rd(n,"data:")||!de[e]){if(V&&!sd(M,id(n,D,"")));else if(n)return!1}else;return!0},He=function(e){return"annotation-xml"!==e&&nd(e,L)},Ge=function(e){Be(k.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Ue(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0};let r=t.length;for(;r--;){const o=t[r],{name:a,namespaceURI:s,value:l}=o,u=Ee(a),d=l;let c="value"===a?d:od(d);if(i.attrName=u,i.attrValue=c,i.keepAttr=!0,i.forceKeepAttr=void 0,Be(k.uponSanitizeAttribute,e,i),c=i.attrValue,!re||"id"!==u&&"name"!==u||(Me(a,e),c="user-content-"+c),K&&sd(/((--!?|])>)|<\/(style|title)/i,c)){Me(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){Me(a,e);continue}if(!q&&sd(/\/>/i,c)){Me(a,e);continue}Y&&Yu([_,O,P],e=>{c=id(c,e," ")});const h=Ee(e.nodeName);if(Fe(h,u,c)){if(C&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(s);else switch(f.getAttributeType(h,u)){case"TrustedHTML":c=C.createHTML(c);break;case"TrustedScriptURL":c=C.createScriptURL(c)}if(c!==d)try{s?e.setAttributeNS(s,a,c):e.setAttribute(a,c),Ue(e)?Ne(e):Xu(n.removed)}catch(t){Me(a,e)}}else Me(a,e)}Be(k.afterSanitizeAttributes,e,null)},ze=function e(t){let n=null;const i=Le(t);for(Be(k.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)Be(k.uponSanitizeShadowNode,n,null),je(n),Ge(n),n.content instanceof a&&e(n.content);Be(k.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&&!Re(e)){if("function"!=typeof e.toString)throw ld("toString is not a function");if("string"!=typeof(e=e.toString()))throw ld("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Z||Oe(t),n.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=Ee(e.nodeName);if(!R[t]||G[t])throw ld("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=De("\x3c!----\x3e"),o=i.ownerDocument.importNode(e,!0),o.nodeType===Ud&&"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=De(e),!i)return ee?null:ne?x:""}i&&J&&Ne(i.firstChild);const d=Le(ae?e:i);for(;s=d.nextNode();)je(s),Ge(s),s.content instanceof a&&ze(s.content);if(ae)return e;if(ee){if(te)for(u=A.call(i.ownerDocument);i.firstChild;)u.appendChild(i.firstChild);else u=i;return(j.shadowroot||j.shadowrootmode)&&(u=T.call(r,u,!0)),u}let c=X?i.outerHTML:i.innerHTML;return X&&R["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&sd(Md,i.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+c),Y&&Yu([_,O,P],e=>{c=id(c,e," ")}),C&&ne?C.createHTML(c):c},n.setConfig=function(){Oe(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||Oe({});const i=Ee(e),r=Ee(t);return Fe(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&Zu(k[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=Ku(k[e],t);return-1===n?void 0:Ju(k[e],n,1)[0]}return Xu(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),zd=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 Qd=class extends oe{constructor(){super(...arguments),this.spinSpeed=.4}updated(){this.style.setProperty("--spin-duration",`${this.spinSpeed}s`)}render(){return R`<div class="spinner"></div>`}};Qd.styles=u`
6553
+ `,{entries:ju,setPrototypeOf:Fu,isFrozen:Hu,getPrototypeOf:Gu,getOwnPropertyDescriptor:zu}=Object;let{freeze:Qu,seal:Wu,create:Vu}=Object,{apply:qu,construct:Yu}="undefined"!=typeof Reflect&&Reflect;Qu||(Qu=function(e){return e}),Wu||(Wu=function(e){return e}),qu||(qu=function(e,t,n){return e.apply(t,n)}),Yu||(Yu=function(e,t){return new e(...t)});const Ku=cd(Array.prototype.forEach),Xu=cd(Array.prototype.lastIndexOf),Zu=cd(Array.prototype.pop),Ju=cd(Array.prototype.push),ed=cd(Array.prototype.splice),td=cd(String.prototype.toLowerCase),nd=cd(String.prototype.toString),id=cd(String.prototype.match),rd=cd(String.prototype.replace),od=cd(String.prototype.indexOf),ad=cd(String.prototype.trim),sd=cd(Object.prototype.hasOwnProperty),ld=cd(RegExp.prototype.test),ud=(dd=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Yu(dd,t)});var dd;function cd(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 qu(e,t,i)}}function hd(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:td;Fu&&Fu(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(Hu(t)||(t[i]=e),r=e)}e[r]=!0}return e}function pd(e){for(let t=0;t<e.length;t++){sd(e,t)||(e[t]=null)}return e}function fd(e){const t=Vu(null);for(const[n,i]of ju(e)){sd(e,n)&&(Array.isArray(i)?t[n]=pd(i):i&&"object"==typeof i&&i.constructor===Object?t[n]=fd(i):t[n]=i)}return t}function gd(e,t){for(;null!==e;){const n=zu(e,t);if(n){if(n.get)return cd(n.get);if("function"==typeof n.value)return cd(n.value)}e=Gu(e)}return function(){return null}}const md=Qu(["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"]),yd=Qu(["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"]),bd=Qu(["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"]),vd=Qu(["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"]),wd=Qu(["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"]),Cd=Qu(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xd=Qu(["#text"]),$d=Qu(["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"]),Sd=Qu(["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"]),Ad=Qu(["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"]),Ed=Qu(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Td=Wu(/\{\{[\w\W]*|[\w\W]*\}\}/gm),kd=Wu(/<%[\w\W]*|[\w\W]*%>/gm),_d=Wu(/\$\{[\w\W]*/gm),Od=Wu(/^data-[\-\w.\u00B7-\uFFFF]+$/),Pd=Wu(/^aria-[\-\w]+$/),Id=Wu(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Nd=Wu(/^(?:\w+script|data):/i),Md=Wu(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Dd=Wu(/^html$/i),Ld=Wu(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ud=Object.freeze({__proto__:null,ARIA_ATTR:Pd,ATTR_WHITESPACE:Md,CUSTOM_ELEMENT:Ld,DATA_ATTR:Od,DOCTYPE_NAME:Dd,ERB_EXPR:kd,IS_ALLOWED_URI:Id,IS_SCRIPT_OR_DATA:Nd,MUSTACHE_EXPR:Td,TMPLIT_EXPR:_d});const Rd=1,Bd=3,jd=7,Fd=8,Hd=9,Gd=function(){return"undefined"==typeof window?null:window};var zd=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gd();const n=t=>e(t);if(n.version="3.2.6",n.removed=[],!t||!t.document||t.document.nodeType!==Hd||!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:d,NamedNodeMap:c=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:p,trustedTypes:f}=t,g=u.prototype,m=gd(g,"cloneNode"),y=gd(g,"remove"),b=gd(g,"nextSibling"),v=gd(g,"childNodes"),w=gd(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:$,createNodeIterator:S,createDocumentFragment:A,getElementsByTagName:E}=i,{importNode:T}=r;let k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof ju&&"function"==typeof w&&$&&void 0!==$.createHTMLDocument;const{MUSTACHE_EXPR:_,ERB_EXPR:O,TMPLIT_EXPR:P,DATA_ATTR:I,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:M,ATTR_WHITESPACE:D,CUSTOM_ELEMENT:L}=Ud;let{IS_ALLOWED_URI:U}=Ud,R=null;const B=hd({},[...md,...yd,...bd,...wd,...xd]);let j=null;const F=hd({},[...$d,...Sd,...Ad,...Ed]);let H=Object.seal(Vu(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}})),G=null,z=null,Q=!0,W=!0,V=!1,q=!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=hd({},["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 de=null;const ce=hd({},["audio","video","img","source","image","track"]);let he=null;const pe=hd({},["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=hd({},[fe,ge,me],nd);let Ce=hd({},["mi","mo","mn","ms","mtext"]),xe=hd({},["annotation-xml"]);const $e=hd({},["title","style","font","a","script"]);let Se=null;const Ae=["application/xhtml+xml","text/html"];let Ee=null,Te=null;const ke=i.createElement("form"),_e=function(e){return e instanceof RegExp||e instanceof Function},Oe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Te||Te!==e){if(e&&"object"==typeof e||(e={}),e=fd(e),Se=-1===Ae.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ee="application/xhtml+xml"===Se?nd:td,R=sd(e,"ALLOWED_TAGS")?hd({},e.ALLOWED_TAGS,Ee):B,j=sd(e,"ALLOWED_ATTR")?hd({},e.ALLOWED_ATTR,Ee):F,ve=sd(e,"ALLOWED_NAMESPACES")?hd({},e.ALLOWED_NAMESPACES,nd):we,he=sd(e,"ADD_URI_SAFE_ATTR")?hd(fd(pe),e.ADD_URI_SAFE_ATTR,Ee):pe,de=sd(e,"ADD_DATA_URI_TAGS")?hd(fd(ce),e.ADD_DATA_URI_TAGS,Ee):ce,le=sd(e,"FORBID_CONTENTS")?hd({},e.FORBID_CONTENTS,Ee):ue,G=sd(e,"FORBID_TAGS")?hd({},e.FORBID_TAGS,Ee):fd({}),z=sd(e,"FORBID_ATTR")?hd({},e.FORBID_ATTR,Ee):fd({}),se=!!sd(e,"USE_PROFILES")&&e.USE_PROFILES,Q=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,V=e.ALLOW_UNKNOWN_PROTOCOLS||!1,q=!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,U=e.ALLOWED_URI_REGEXP||Id,ye=e.NAMESPACE||me,Ce=e.MATHML_TEXT_INTEGRATION_POINTS||Ce,xe=e.HTML_INTEGRATION_POINTS||xe,H=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_e(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_e(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(H.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(W=!1),te&&(ee=!0),se&&(R=hd({},xd),j=[],!0===se.html&&(hd(R,md),hd(j,$d)),!0===se.svg&&(hd(R,yd),hd(j,Sd),hd(j,Ed)),!0===se.svgFilters&&(hd(R,bd),hd(j,Sd),hd(j,Ed)),!0===se.mathMl&&(hd(R,wd),hd(j,Ad),hd(j,Ed))),e.ADD_TAGS&&(R===B&&(R=fd(R)),hd(R,e.ADD_TAGS,Ee)),e.ADD_ATTR&&(j===F&&(j=fd(j)),hd(j,e.ADD_ATTR,Ee)),e.ADD_URI_SAFE_ATTR&&hd(he,e.ADD_URI_SAFE_ATTR,Ee),e.FORBID_CONTENTS&&(le===ue&&(le=fd(le)),hd(le,e.FORBID_CONTENTS,Ee)),oe&&(R["#text"]=!0),X&&hd(R,["html","head","body"]),R.table&&(hd(R,["tbody"]),delete G.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw ud('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw ud('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(""));Qu&&Qu(e),Te=e}},Pe=hd({},[...yd,...bd,...vd]),Ie=hd({},[...wd,...Cd]),Ne=function(e){Ju(n.removed,{element:e});try{w(e).removeChild(e)}catch(t){y(e)}},Me=function(e,t){try{Ju(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Ju(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){}},De=function(e){let t=null,n=null;if(J)e="<remove></remove>"+e;else{const t=id(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Se&&ye===me&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=C?C.createHTML(e):e;if(ye===me)try{t=(new p).parseFromString(r,Se)}catch(e){}if(!t||!t.documentElement){t=$.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?E.call(t,X?"html":"body")[0]:X?t.documentElement:o},Le=function(e){return S.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Ue=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof c)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Re=function(e){return"function"==typeof l&&e instanceof l};function Be(e,t,i){Ku(e,e=>{e.call(n,t,i,Te)})}const je=function(e){let t=null;if(Be(k.beforeSanitizeElements,e,null),Ue(e))return Ne(e),!0;const i=Ee(e.nodeName);if(Be(k.uponSanitizeElement,e,{tagName:i,allowedTags:R}),K&&e.hasChildNodes()&&!Re(e.firstElementChild)&&ld(/<[/\w!]/g,e.innerHTML)&&ld(/<[/\w!]/g,e.textContent))return Ne(e),!0;if(e.nodeType===jd)return Ne(e),!0;if(K&&e.nodeType===Fd&&ld(/<[/\w]/g,e.data))return Ne(e),!0;if(!R[i]||G[i]){if(!G[i]&&He(i)){if(H.tagNameCheck instanceof RegExp&&ld(H.tagNameCheck,i))return!1;if(H.tagNameCheck instanceof Function&&H.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=td(e.tagName),i=td(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(Pe[n]):e.namespaceURI===fe?t.namespaceURI===me?"math"===n:t.namespaceURI===ge?"math"===n&&xe[i]:Boolean(Ie[n]):e.namespaceURI===me?!(t.namespaceURI===ge&&!xe[i])&&!(t.namespaceURI===fe&&!Ce[i])&&!Ie[n]&&($e[n]||!Pe[n]):!("application/xhtml+xml"!==Se||!ve[e.namespaceURI]))}(e)?(Ne(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!ld(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&e.nodeType===Bd&&(t=e.textContent,Ku([_,O,P],e=>{t=rd(t,e," ")}),e.textContent!==t&&(Ju(n.removed,{element:e.cloneNode()}),e.textContent=t)),Be(k.afterSanitizeElements,e,null),!1):(Ne(e),!0)},Fe=function(e,t,n){if(ie&&("id"===t||"name"===t)&&(n in i||n in ke))return!1;if(W&&!z[t]&&ld(I,t));else if(Q&&ld(N,t));else if(!j[t]||z[t]){if(!(He(e)&&(H.tagNameCheck instanceof RegExp&&ld(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&ld(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t))||"is"===t&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&ld(H.tagNameCheck,n)||H.tagNameCheck instanceof Function&&H.tagNameCheck(n))))return!1}else if(he[t]);else if(ld(U,rd(n,D,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==od(n,"data:")||!de[e]){if(V&&!ld(M,rd(n,D,"")));else if(n)return!1}else;return!0},He=function(e){return"annotation-xml"!==e&&id(e,L)},Ge=function(e){Be(k.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Ue(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0};let r=t.length;for(;r--;){const o=t[r],{name:a,namespaceURI:s,value:l}=o,u=Ee(a),d=l;let c="value"===a?d:ad(d);if(i.attrName=u,i.attrValue=c,i.keepAttr=!0,i.forceKeepAttr=void 0,Be(k.uponSanitizeAttribute,e,i),c=i.attrValue,!re||"id"!==u&&"name"!==u||(Me(a,e),c="user-content-"+c),K&&ld(/((--!?|])>)|<\/(style|title)/i,c)){Me(a,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){Me(a,e);continue}if(!q&&ld(/\/>/i,c)){Me(a,e);continue}Y&&Ku([_,O,P],e=>{c=rd(c,e," ")});const h=Ee(e.nodeName);if(Fe(h,u,c)){if(C&&"object"==typeof f&&"function"==typeof f.getAttributeType)if(s);else switch(f.getAttributeType(h,u)){case"TrustedHTML":c=C.createHTML(c);break;case"TrustedScriptURL":c=C.createScriptURL(c)}if(c!==d)try{s?e.setAttributeNS(s,a,c):e.setAttribute(a,c),Ue(e)?Ne(e):Zu(n.removed)}catch(t){Me(a,e)}}else Me(a,e)}Be(k.afterSanitizeAttributes,e,null)},ze=function e(t){let n=null;const i=Le(t);for(Be(k.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)Be(k.uponSanitizeShadowNode,n,null),je(n),Ge(n),n.content instanceof a&&e(n.content);Be(k.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&&!Re(e)){if("function"!=typeof e.toString)throw ud("toString is not a function");if("string"!=typeof(e=e.toString()))throw ud("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Z||Oe(t),n.removed=[],"string"==typeof e&&(ae=!1),ae){if(e.nodeName){const t=Ee(e.nodeName);if(!R[t]||G[t])throw ud("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)i=De("\x3c!----\x3e"),o=i.ownerDocument.importNode(e,!0),o.nodeType===Rd&&"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=De(e),!i)return ee?null:ne?x:""}i&&J&&Ne(i.firstChild);const d=Le(ae?e:i);for(;s=d.nextNode();)je(s),Ge(s),s.content instanceof a&&ze(s.content);if(ae)return e;if(ee){if(te)for(u=A.call(i.ownerDocument);i.firstChild;)u.appendChild(i.firstChild);else u=i;return(j.shadowroot||j.shadowrootmode)&&(u=T.call(r,u,!0)),u}let c=X?i.outerHTML:i.innerHTML;return X&&R["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ld(Dd,i.ownerDocument.doctype.name)&&(c="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+c),Y&&Ku([_,O,P],e=>{c=rd(c,e," ")}),C&&ne?C.createHTML(c):c},n.setConfig=function(){Oe(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||Oe({});const i=Ee(e),r=Ee(t);return Fe(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&Ju(k[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=Xu(k[e],t);return-1===n?void 0:ed(k[e],n,1)[0]}return Zu(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}(),Qd=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 Wd=class extends oe{constructor(){super(...arguments),this.spinSpeed=.4}updated(){this.style.setProperty("--spin-duration",`${this.spinSpeed}s`)}render(){return R`<div class="spinner"></div>`}};Wd.styles=u`
6554
6554
  .spinner {
6555
6555
  border: 2px solid rgba(0, 0, 0, 0.2);
6556
6556
  border-top: 2px solid #c057ff;
@@ -6568,7 +6568,7 @@ xmlns="http://www.w3.org/2000/svg"
6568
6568
  transform: rotate(360deg);
6569
6569
  }
6570
6570
  }
6571
- `,zd([ue({type:Number})],Qd.prototype,"spinSpeed",void 0),Qd=zd([se("mini-loader")],Qd);var Wd=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 Vd=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=Ic.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=R`${n.trim().split("\n").map(e=>{const n=this.sanitizeMarkdownText(e),a=this.preserveHTMLTags(n);return a?R`${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}),R`<a
6571
+ `,Qd([ue({type:Number})],Wd.prototype,"spinSpeed",void 0),Wd=Qd([se("mini-loader")],Wd);var Vd=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 qd=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=Nc.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=R`${n.trim().split("\n").map(e=>{const n=this.sanitizeMarkdownText(e),a=this.preserveHTMLTags(n);return a?R`${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}),R`<a
6572
6572
  class="redirect-link"
6573
6573
  href="${null==n?void 0:n.link}"
6574
6574
  target="_blank"
@@ -6580,10 +6580,10 @@ xmlns="http://www.w3.org/2000/svg"
6580
6580
  target="_blank"
6581
6581
  rel="noopener noreferrer"
6582
6582
  >${t}
6583
- </a>`}return R`${Ao(Gd.sanitize(e))} `})}<br />`:R``})}`,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=Cu().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?R`<div class="message-inner-body">
6583
+ </a>`}return R`${Ao(zd.sanitize(e))} `})}<br />`:R``})}`,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=Cu().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?R`<div class="message-inner-body">
6584
6584
  ${this.isMessageStillStreamingChunks()?R`<div class="message-loader"><mini-loader></mini-loader></div>`:""}
6585
6585
  <p
6586
- class=${ye({"message-text":this.widgetType!==Ic.Utilities,"message-text-large":this.widgetType===Ic.Utilities,"webchat-font__desktop":!Or(),"webchat-font__mobile":Or()})}
6586
+ class=${ye({"message-text":this.widgetType!==Nc.Utilities,"message-text-large":this.widgetType===Nc.Utilities,"webchat-font__desktop":!Or(),"webchat-font__mobile":Or()})}
6587
6587
  >
6588
6588
  ${this.parsedMessage}
6589
6589
  </p>
@@ -6614,16 +6614,16 @@ xmlns="http://www.w3.org/2000/svg"
6614
6614
  />`:""}
6615
6615
 
6616
6616
  <div class="website-preview-body">
6617
- <p class=${ye({"message-text":this.widgetType!==Ic.Utilities,"message-text-large":this.widgetType===Ic.Utilities,"website-preview-title":!0,"webchat-font__desktop":!Or(),"webchat-font__mobile":Or()})}>${e.title}</p>
6617
+ <p class=${ye({"message-text":this.widgetType!==Nc.Utilities,"message-text-large":this.widgetType===Nc.Utilities,"website-preview-title":!0,"webchat-font__desktop":!Or(),"webchat-font__mobile":Or()})}>${e.title}</p>
6618
6618
  ${e.description?R`<p
6619
- class=${ye({"message-text":this.widgetType!==Ic.Utilities,"message-text-large":this.widgetType===Ic.Utilities,"website-preview-description":!0,"webchat-font__desktop":!Or(),"webchat-font__mobile":Or()})}
6619
+ class=${ye({"message-text":this.widgetType!==Nc.Utilities,"message-text-large":this.widgetType===Nc.Utilities,"website-preview-description":!0,"webchat-font__desktop":!Or(),"webchat-font__mobile":Or()})}
6620
6620
  >
6621
6621
  ${e.description}
6622
6622
  </p>`:""}
6623
6623
  </div>
6624
6624
  </div>
6625
6625
  </a></div> `})}
6626
- </div>`:R``}};Vd.styles=[Oe,Ru,u`
6626
+ </div>`:R``}};qd.styles=[Oe,Bu,u`
6627
6627
  .message-inner-body {
6628
6628
  position: relative;
6629
6629
  }
@@ -6632,7 +6632,7 @@ xmlns="http://www.w3.org/2000/svg"
6632
6632
  bottom: -2px;
6633
6633
  right: -2px;
6634
6634
  }
6635
- `],Wd([ue({attribute:!0})],Vd.prototype,"buildingSlug",void 0),Wd([ue({attribute:!0})],Vd.prototype,"message",void 0),Wd([ue({attribute:!0})],Vd.prototype,"myPubnub",void 0),Wd([ue({attribute:!0})],Vd.prototype,"onMount",void 0),Wd([de()],Vd.prototype,"loadingPreviews",void 0),Wd([de()],Vd.prototype,"parsedMessage",void 0),Wd([de()],Vd.prototype,"websitePreviewInfo",void 0),Wd([de()],Vd.prototype,"imagesToDisplay",void 0),Wd([de()],Vd.prototype,"imageUrlError",void 0),Wd([ue({type:Boolean})],Vd.prototype,"isLeadMessage",void 0),Wd([ue({attribute:!0})],Vd.prototype,"widgetType",void 0),Vd=Wd([se("pubnub-message")],Vd);var qd=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 Yd=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?R`<div class="message-inner-body">
6635
+ `],Vd([ue({attribute:!0})],qd.prototype,"buildingSlug",void 0),Vd([ue({attribute:!0})],qd.prototype,"message",void 0),Vd([ue({attribute:!0})],qd.prototype,"myPubnub",void 0),Vd([ue({attribute:!0})],qd.prototype,"onMount",void 0),Vd([de()],qd.prototype,"loadingPreviews",void 0),Vd([de()],qd.prototype,"parsedMessage",void 0),Vd([de()],qd.prototype,"websitePreviewInfo",void 0),Vd([de()],qd.prototype,"imagesToDisplay",void 0),Vd([de()],qd.prototype,"imageUrlError",void 0),Vd([ue({type:Boolean})],qd.prototype,"isLeadMessage",void 0),Vd([ue({attribute:!0})],qd.prototype,"widgetType",void 0),qd=Vd([se("pubnub-message")],qd);var Yd=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 Kd=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?R`<div class="message-inner-body">
6636
6636
  <div class="carousel">
6637
6637
  <div
6638
6638
  class="image-container"
@@ -6673,7 +6673,7 @@ xmlns="http://www.w3.org/2000/svg"
6673
6673
  rel="noopener noreferrer"
6674
6674
  ><img class=${"displayed-message-image"} src=${e.url} alt=""
6675
6675
  /></a>`)}
6676
- </div>`:R``}};Yd.styles=[Oe,Ru,u`
6676
+ </div>`:R``}};Kd.styles=[Oe,Bu,u`
6677
6677
  .carousel {
6678
6678
  position: relative;
6679
6679
  max-width: 400px;
@@ -6765,7 +6765,7 @@ xmlns="http://www.w3.org/2000/svg"
6765
6765
  max-height: 200px;
6766
6766
  overflow-y: auto;
6767
6767
  }
6768
- `],qd([ue({attribute:!0})],Yd.prototype,"message",void 0),qd([ue({attribute:!0})],Yd.prototype,"myPubnub",void 0),qd([ue({attribute:!0})],Yd.prototype,"onMount",void 0),qd([de()],Yd.prototype,"showMediaAsCarousel",void 0),qd([de()],Yd.prototype,"activeIndex",void 0),Yd=qd([se("pubnub-media")],Yd);function Kd(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 Xd(e,t){ii(2,arguments);var n=ri(e),i=ri(t),r=Kd(n,i),o=Math.abs(function(e,t){ii(2,arguments);var n=rr(e),i=rr(t),r=n.getTime()-zi(n),o=i.getTime()-zi(i);return Math.round((r-o)/864e5)}(n,i));n.setDate(n.getDate()-r*o);var a=r*(o-Number(Kd(n,i)===-r));return 0===a?0:a}const Zd=u`
6768
+ `],Yd([ue({attribute:!0})],Kd.prototype,"message",void 0),Yd([ue({attribute:!0})],Kd.prototype,"myPubnub",void 0),Yd([ue({attribute:!0})],Kd.prototype,"onMount",void 0),Yd([de()],Kd.prototype,"showMediaAsCarousel",void 0),Yd([de()],Kd.prototype,"activeIndex",void 0),Kd=Yd([se("pubnub-media")],Kd);function Xd(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 Zd(e,t){ii(2,arguments);var n=ri(e),i=ri(t),r=Xd(n,i),o=Math.abs(function(e,t){ii(2,arguments);var n=rr(e),i=rr(t),r=n.getTime()-zi(n),o=i.getTime()-zi(i);return Math.round((r-o)/864e5)}(n,i));n.setDate(n.getDate()-r*o);var a=r*(o-Number(Xd(n,i)===-r));return 0===a?0:a}const Jd=u`
6769
6769
  #utilities-container {
6770
6770
  position: fixed;
6771
6771
 
@@ -6874,17 +6874,17 @@ xmlns="http://www.w3.org/2000/svg"
6874
6874
  .health-bttn-allow-access {
6875
6875
  padding-right: 28px;
6876
6876
  }
6877
- `,Jd=(e="black")=>B`
6877
+ `,ec=(e="black")=>B`
6878
6878
  <svg aria-hidden="true" focusable="false" width="32" height="32" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
6879
6879
  <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}"/>
6880
6880
  <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}"/>
6881
6881
  </svg>
6882
- `,ec=(e="black")=>B`
6882
+ `,tc=(e="black")=>B`
6883
6883
  <svg aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
6884
6884
  <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}"/>
6885
6885
  <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}"/>
6886
6886
  </svg>
6887
- `;var tc,nc=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 ic=tc=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=Ic.Default,this.primaryColor=qn,this.backgroundColor=Yn,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this._isMobile=Or(),this.shouldAutoScroll=!0,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.shouldAutoScroll=!0,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:_u.text}]),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e)))},this.scrollToChatBottom=()=>{this.shouldAutoScroll&&this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"auto"})},this.handleConversationScroll=e=>{const t=e.currentTarget,n=t.scrollHeight-t.clientHeight-t.scrollTop;this.shouldAutoScroll=n<=tc.AUTO_SCROLL_THRESHOLD_PX},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=Pr(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;Xd(new Date,new Date(r))<7&&o===No?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,d,c,h,p,f,g,m,y,b,v,w,C,x;if(!this.buildingSlug)return R``;const $=null===(e=this.building)||void 0===e?void 0:e.id;let S={};if(S=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===$&&(S={...S,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===Ic.Utilities)return R`
6887
+ `;var nc,ic=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 rc=nc=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=Nc.Default,this.primaryColor=qn,this.backgroundColor=Yn,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this._isMobile=Or(),this.shouldAutoScroll=!0,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.shouldAutoScroll=!0,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:_u.text}]),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e)))},this.scrollToChatBottom=()=>{this.shouldAutoScroll&&this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"auto"})},this.handleConversationScroll=e=>{const t=e.currentTarget,n=t.scrollHeight-t.clientHeight-t.scrollTop;this.shouldAutoScroll=n<=nc.AUTO_SCROLL_THRESHOLD_PX},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=Pr(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;Zd(new Date,new Date(r))<7&&o===No?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,d,c,h,p,f,g,m,y,b,v,w,C,x;if(!this.buildingSlug)return R``;const $=null===(e=this.building)||void 0===e?void 0:e.id;let S={};if(S=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===$&&(S={...S,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===Nc.Utilities)return R`
6888
6888
  <div
6889
6889
  id="utilities-container"
6890
6890
  class=${ye({"pubnub-container__mobile":this._isMobile,"utilities-container__desktop":!this._isMobile})}
@@ -6990,12 +6990,12 @@ xmlns="http://www.w3.org/2000/svg"
6990
6990
  class=${ye({"health-bttn-allow-access":this._isMobile})}
6991
6991
  @click=${()=>this.sendMessage(this.messageInput.value)}
6992
6992
  >
6993
- ${Jd("black")}
6993
+ ${ec("black")}
6994
6994
  </button>
6995
6995
  </div>
6996
6996
  </div>
6997
6997
  </div>
6998
- `;if(this.widgetType===Ic.Healthcare)return R`
6998
+ `;if(this.widgetType===Nc.Healthcare)return R`
6999
6999
  <div
7000
7000
  id="healthchat-container"
7001
7001
  class=${ye({"pubnub-container__mobile":this._isMobile,"healthchat-container__desktop":!this._isMobile})}
@@ -7106,7 +7106,7 @@ xmlns="http://www.w3.org/2000/svg"
7106
7106
  class=${ye({"health-bttn-allow-access":this._isMobile})}
7107
7107
  @click=${()=>this.sendMessage(this.messageInput.value)}
7108
7108
  >
7109
- ${this._isMobile?Jd("black"):ec("black")}
7109
+ ${this._isMobile?ec("black"):tc("black")}
7110
7110
  </button>
7111
7111
  </div>
7112
7112
  </div>
@@ -7219,11 +7219,11 @@ xmlns="http://www.w3.org/2000/svg"
7219
7219
  aria-label="Send message"
7220
7220
  aria-describedby="Send message"
7221
7221
  >
7222
- ${Jn(this.building.orgId,this.building.id)&&this.primaryColor!==qn?ec("black"):ec("white")}
7222
+ ${Jn(this.building.orgId,this.building.id)&&this.primaryColor!==qn?tc("black"):tc("white")}
7223
7223
  </button>
7224
7224
  </div>
7225
7225
  </div>
7226
- `}};ic.AUTO_SCROLL_THRESHOLD_PX=32,ic.styles=[Oe,Ru,Uu,Lu,Zd],nc([ue({type:Number})],ic.prototype,"right",void 0),nc([ue({type:Number})],ic.prototype,"bottom",void 0),nc([ue({type:Number})],ic.prototype,"top",void 0),nc([ue({type:Number})],ic.prototype,"left",void 0),nc([ue({attribute:!0})],ic.prototype,"onMount",void 0),nc([ue({attribute:!0})],ic.prototype,"channel",void 0),nc([ue({attribute:!0})],ic.prototype,"isHealthChat",void 0),nc([ue({attribute:!0})],ic.prototype,"myPubnub",void 0),nc([ue({attribute:!0})],ic.prototype,"orgSlug",void 0),nc([ue({attribute:!0})],ic.prototype,"buildingSlug",void 0),nc([ue({attribute:!0})],ic.prototype,"widgetType",void 0),nc([ue({attribute:!0})],ic.prototype,"building",void 0),nc([ue({attribute:!0})],ic.prototype,"primaryColor",void 0),nc([ue({attribute:!0})],ic.prototype,"backgroundColor",void 0),nc([ue({attribute:!0})],ic.prototype,"onClickExit",void 0),nc([ue({attribute:!0})],ic.prototype,"requiresConsent",void 0),nc([ce("#message-input",!0)],ic.prototype,"messageInput",void 0),nc([ce("#conversation-body",!0)],ic.prototype,"messageBody",void 0),nc([de()],ic.prototype,"_isMobile",void 0),nc([de()],ic.prototype,"messages",void 0),nc([de()],ic.prototype,"isLoadingMessages",void 0),nc([de()],ic.prototype,"hasReceivedConsent",void 0),nc([de()],ic.prototype,"privacyPolicyUrl",void 0),nc([de()],ic.prototype,"websitePreviewMapping",void 0),ic=tc=nc([se("pubnub-chat")],ic);const rc="cdn.skypack.dev/@meetelise/chat",oc="cdn.eliseai.com/@meetelise/chat",ac=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(rc)||n.includes(rc))return"skypack";if(e.includes(oc)||n.includes(oc))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){}},sc=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,lc={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},uc="https://applications.eliseai.com",dc=["Check Availability","Apply Now"],cc=(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&&dc.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"),Ho({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:Fo.info,buildingSlug:i,orgSlug:n}),!0},hc=(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&&cc(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)cc(s[e],t,n,i)}},pc=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)cc(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)hc(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class fc{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Br(jr(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=bo();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(jo()).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:Br(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:Br(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Ho({logType:Fo.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=Wo(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:Br(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Br(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Vr(e.timestampInitiallyLogged).getTime()-Vr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Br(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:Br(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=>Vr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var gc,mc=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 yc=gc=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.centralConvo=!1,this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=Or(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=go.always,this.bedroomPreferenceRequired=!1,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=Ic.Default,this.onWidgetLoaded=jl(),this.onSstClose=jl(),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=Ee(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.orgSlug)return;if(!this.centralConvo&&!this.buildingSlug)return;const e=this.centralConvo?await async function(e){const t=`https://app.meetelise.com/api/pub/v1/organization/${e}/webchat/v2`,n=await r().get(t);return ea(n.data)}(this.orgSlug):await Jo(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{ac(this.orgSlug,this.buildingSlug)}catch(e){}await Qa(e,this.buildingSlug,this.orgSlug)&&(Go({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,d,c,h,p,f,g,m,y,b,v,w,C,x,$,S,A,E,T,k,_,O,P,I,N,M,D,L,U,R,B,j,F,H,G,z,Q,W,V,q,Y;const K=this.buildingWebchatView;if(!K)return;K&&this.orgSlug&&vc(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;var te;te=wo.includes(K.orgId),xo=te;const[ne,ie,re,oe]=await Promise.all([lu(this.orgSlug,this.buildingSlug),mo(this.buildingSlug),du(this.buildingSlug),yo(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Gn(K.phoneNumber),this.buildingWebchatView.isAip=re),this.leadSources=ne,this.featureFlagShowDropdown=X,this.bedroomPreferenceRequired=oe;const ae=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 Ho({logType:Fo.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t},error:t}),null}return null})(this.buildingSlug),se=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,le=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,ue={callDesktop:null!==(d=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(h=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.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)&&!!ae)&&void 0!==x&&x,textMobile:null!==(S=(null===($=this.buildingWebchatView)||void 0===$?void 0:$.shouldShowTextMobile)&&!!ae)&&void 0!==S&&S,sstDesktop:null!==(E=null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowSstDesktop)&&void 0!==E&&E,sstMobile:null!==(k=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==k&&k,calcDesktop:se,calcMobile:le};var de,ce;this.enabledChatWidgets=Vl(ue),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(ce=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(),ce(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===(_=this.LeadSourceClient)||void 0===_?void 0:_.leadSource)&&(de=null!==(P=null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&void 0!==P?P: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(de)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(I=this.buildingWebchatView.primaryColor)&&void 0!==I?I:null,this.backgroundColor=null!==(N=this.buildingWebchatView.secondaryColor)&&void 0!==N?N:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(M=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==M?M:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==D?D:null,this.webchatConfigHasAutoOpenChat=null!==(L=this.buildingWebchatView.autoOpenChat)&&void 0!==L&&L,this.requiresConsent=null!==(U=this.buildingWebchatView.requiresConsentForChat)&&void 0!==U&&U,this.hideMobileFeatures=null!==(R=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==R&&R,this.privacyPolicyUrl=null!==(B=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==B?B:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Yo.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Yo.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Yo.EMOJI&&(this.designConcept=Yo.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=qn),null===this.backgroundColor&&(this.backgroundColor=Yn);const he=null!==(F=null===(j=this.buildingWebchatView)||void 0===j?void 0:j.phoneNumber)&&void 0!==F?F:"";let pe=null;if(Z&&(pe=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:Gn(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(G=null===(H=this.LeadSourceClient)||void 0===H?void 0:H.leadSource)&&void 0!==G?G:null),pe&&!pe.isMatch&&(pe.number=he)),J&&(null==pe?void 0:pe.number)){const e=Nu(pe.number,this.orgSlug,this.buildingSlug);e>0&&Go({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const fe=localStorage.getItem("eliseai_phone_number_devtest");fe&&Nu(fe,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=pe||{number:he,isMatch:!1,isPropertyWebsiteCatchall:!0};const ge=null!==(Q=null===(z=this.LeadSourceClient)||void 0===z?void 0:z.leadSource)&&void 0!==Q?Q:null;ge&&(this.leadSources.includes(ge)||this.leadSources.push(ge)),ro(K.id);if((ie||(null===(W=this.buildingWebchatView)||void 0===W?void 0:W.isAip))&&(null===(V=this.buildingWebchatView)||void 0===V?void 0:V.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=sc(o,e);l.setAttribute("href",s),a++,Ho({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:Fo.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Ho({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:Fo.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&Go({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=lc[e];if(!t)return 0;const n=`${uc}/building/${t}/units`,i=`${uc}/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===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&pc(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 d=Su(this.buildingSlug),c=Au(this.buildingSlug,d),h=c?d:$u(this.buildingSlug,!1);if(!h.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new Vo,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new fc(this.orgSlug,this.buildingSlug),this.myPubnub=new Ou(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,c&&null!==(n=h.leadId)&&void 0!==n?n:void 0);p&&$u(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"!==Wo(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:Wo(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=Su(this.buildingSlug);g.initiatedChat&&await this.myPubnub.initializePubnub(g)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!zr(Vr(t)));return!!e&&!!n&&!Or()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",Br(function(e,t){return ii(2,arguments),wi(e,6e4*vi(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 d=[];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&&d.push(...this.collectFocusableElements(e)),t&&d.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&&(d=this.collectFocusableElements(e))}if(0===d.length)return;e.preventDefault();const c=this.getDeepActiveElement(),h=d.findIndex(e=>e===c);d[e.shiftKey?(h-1+d.length)%d.length:(h+1)%d.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 Bo(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(),xu(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=Pr(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(gc.FOCUSABLE_SELECTOR)&&gc.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){Ho({logType:Fo.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,d,c,h,p,f,g,m,y,b,v,w,C,x,$,S,A,E,T,k,_,O,P,I,N,M,D,L,U,B,j,F,H,G,z,Q;zl();const W=this.hideLauncher&&!this.isLoading&&!this._isMobile;return R`
7226
+ `}};rc.AUTO_SCROLL_THRESHOLD_PX=32,rc.styles=[Oe,Bu,Ru,Uu,Jd],ic([ue({type:Number})],rc.prototype,"right",void 0),ic([ue({type:Number})],rc.prototype,"bottom",void 0),ic([ue({type:Number})],rc.prototype,"top",void 0),ic([ue({type:Number})],rc.prototype,"left",void 0),ic([ue({attribute:!0})],rc.prototype,"onMount",void 0),ic([ue({attribute:!0})],rc.prototype,"channel",void 0),ic([ue({attribute:!0})],rc.prototype,"isHealthChat",void 0),ic([ue({attribute:!0})],rc.prototype,"myPubnub",void 0),ic([ue({attribute:!0})],rc.prototype,"orgSlug",void 0),ic([ue({attribute:!0})],rc.prototype,"buildingSlug",void 0),ic([ue({attribute:!0})],rc.prototype,"widgetType",void 0),ic([ue({attribute:!0})],rc.prototype,"building",void 0),ic([ue({attribute:!0})],rc.prototype,"primaryColor",void 0),ic([ue({attribute:!0})],rc.prototype,"backgroundColor",void 0),ic([ue({attribute:!0})],rc.prototype,"onClickExit",void 0),ic([ue({attribute:!0})],rc.prototype,"requiresConsent",void 0),ic([ce("#message-input",!0)],rc.prototype,"messageInput",void 0),ic([ce("#conversation-body",!0)],rc.prototype,"messageBody",void 0),ic([de()],rc.prototype,"_isMobile",void 0),ic([de()],rc.prototype,"messages",void 0),ic([de()],rc.prototype,"isLoadingMessages",void 0),ic([de()],rc.prototype,"hasReceivedConsent",void 0),ic([de()],rc.prototype,"privacyPolicyUrl",void 0),ic([de()],rc.prototype,"websitePreviewMapping",void 0),rc=nc=ic([se("pubnub-chat")],rc);const oc="cdn.skypack.dev/@meetelise/chat",ac="cdn.eliseai.com/@meetelise/chat",sc=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(oc)||n.includes(oc))return"skypack";if(e.includes(ac)||n.includes(ac))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){}},lc=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,uc={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},dc="https://applications.eliseai.com",cc=["Check Availability","Apply Now"],hc=(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&&cc.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"),Ho({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:Fo.info,buildingSlug:i,orgSlug:n}),!0},pc=(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&&hc(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)hc(s[e],t,n,i)}},fc=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)hc(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)pc(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class gc{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Br(jr(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=bo();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(jo()).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:Br(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:Br(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Ho({logType:Fo.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=Wo(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:Br(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Br(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Vr(e.timestampInitiallyLogged).getTime()-Vr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Br(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:Br(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=>Vr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var mc,yc=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 bc=mc=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.centralConvo=!1,this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=Or(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=go.always,this.bedroomPreferenceRequired=!1,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=Nc.Default,this.onWidgetLoaded=jl(),this.onSstClose=jl(),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=Ee(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.orgSlug)return;if(!this.centralConvo&&!this.buildingSlug)return;const e=this.centralConvo?await async function(e){const t=`https://app.meetelise.com/api/pub/v1/organization/${e}/webchat/v2`,n=await r().get(t);return ea(n.data)}(this.orgSlug):await Jo(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{sc(this.orgSlug,this.buildingSlug)}catch(e){}await Qa(e,this.buildingSlug,this.orgSlug)&&(Go({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,d,c,h,p,f,g,m,y,b,v,w,C,x,$,S,A,E,T,k,_,O,P,I,N,M,D,L,U,R,B,j,F,H,G,z,Q,W,V,q,Y;const K=this.buildingWebchatView;if(!K)return;K&&this.orgSlug&&wc(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;var te;te=wo.includes(K.orgId),xo=te;const[ne,ie,re,oe]=await Promise.all([lu(this.orgSlug,this.buildingSlug),mo(this.buildingSlug),du(this.buildingSlug),yo(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Gn(K.phoneNumber),this.buildingWebchatView.isAip=re),this.leadSources=ne,this.featureFlagShowDropdown=X,this.bedroomPreferenceRequired=oe;const ae=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 Ho({logType:Fo.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t},error:t}),null}return null})(this.buildingSlug),se=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,le=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,ue={callDesktop:null!==(d=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(h=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.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)&&!!ae)&&void 0!==x&&x,textMobile:null!==(S=(null===($=this.buildingWebchatView)||void 0===$?void 0:$.shouldShowTextMobile)&&!!ae)&&void 0!==S&&S,sstDesktop:null!==(E=null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowSstDesktop)&&void 0!==E&&E,sstMobile:null!==(k=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==k&&k,calcDesktop:se,calcMobile:le};var de,ce;this.enabledChatWidgets=Vl(ue),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(Mu(this.handleTourClicked,this.orgSlug,this.buildingSlug,()=>this.isConnected),ee&&(ce=this.handleTourClicked,document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(e=>{e&&e.addEventListener("click",e=>{e.preventDefault(),ce(e)})})),"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===(_=this.LeadSourceClient)||void 0===_?void 0:_.leadSource)&&(de=null!==(P=null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&void 0!==P?P: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(de)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(I=this.buildingWebchatView.primaryColor)&&void 0!==I?I:null,this.backgroundColor=null!==(N=this.buildingWebchatView.secondaryColor)&&void 0!==N?N:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(M=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==M?M:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==D?D:null,this.webchatConfigHasAutoOpenChat=null!==(L=this.buildingWebchatView.autoOpenChat)&&void 0!==L&&L,this.requiresConsent=null!==(U=this.buildingWebchatView.requiresConsentForChat)&&void 0!==U&&U,this.hideMobileFeatures=null!==(R=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==R&&R,this.privacyPolicyUrl=null!==(B=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==B?B:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===Yo.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===Yo.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===Yo.EMOJI&&(this.designConcept=Yo.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=qn),null===this.backgroundColor&&(this.backgroundColor=Yn);const he=null!==(F=null===(j=this.buildingWebchatView)||void 0===j?void 0:j.phoneNumber)&&void 0!==F?F:"";let pe=null;if(Z&&(pe=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:Gn(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(G=null===(H=this.LeadSourceClient)||void 0===H?void 0:H.leadSource)&&void 0!==G?G:null),pe&&!pe.isMatch&&(pe.number=he)),J&&(null==pe?void 0:pe.number)){const e=Nu(pe.number,this.orgSlug,this.buildingSlug);e>0&&Go({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const fe=localStorage.getItem("eliseai_phone_number_devtest");fe&&Nu(fe,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=pe||{number:he,isMatch:!1,isPropertyWebsiteCatchall:!0};const ge=null!==(Q=null===(z=this.LeadSourceClient)||void 0===z?void 0:z.leadSource)&&void 0!==Q?Q:null;ge&&(this.leadSources.includes(ge)||this.leadSources.push(ge)),ro(K.id);if((ie||(null===(W=this.buildingWebchatView)||void 0===W?void 0:W.isAip))&&(null===(V=this.buildingWebchatView)||void 0===V?void 0:V.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=lc(o,e);l.setAttribute("href",s),a++,Ho({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:Fo.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Ho({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:Fo.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&Go({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=uc[e];if(!t)return 0;const n=`${dc}/building/${t}/units`,i=`${dc}/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===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&fc(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 d=Su(this.buildingSlug),c=Au(this.buildingSlug,d),h=c?d:$u(this.buildingSlug,!1);if(!h.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new Vo,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new gc(this.orgSlug,this.buildingSlug),this.myPubnub=new Ou(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,c&&null!==(n=h.leadId)&&void 0!==n?n:void 0);p&&$u(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"!==Wo(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:Wo(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=Su(this.buildingSlug);g.initiatedChat&&await this.myPubnub.initializePubnub(g)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!zr(Vr(t)));return!!e&&!!n&&!Or()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",Br(function(e,t){return ii(2,arguments),wi(e,6e4*vi(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 d=[];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&&d.push(...this.collectFocusableElements(e)),t&&d.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&&(d=this.collectFocusableElements(e))}if(0===d.length)return;e.preventDefault();const c=this.getDeepActiveElement(),h=d.findIndex(e=>e===c);d[e.shiftKey?(h-1+d.length)%d.length:(h+1)%d.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 Bo(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(),xu(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=Pr(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(mc.FOCUSABLE_SELECTOR)&&mc.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){Ho({logType:Fo.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,d,c,h,p,f,g,m,y,b,v,w,C,x,$,S,A,E,T,k,_,O,P,I,N,M,D,L,U,B,j,F,H,G,z,Q;zl();const W=this.hideLauncher&&!this.isLoading&&!this._isMobile;return R`
7227
7227
  <meta name="viewport" content="width=device-width, initial-scale=1">
7228
7228
  ${this.displayPubnubChat?R`
7229
7229
  <pubnub-chat
@@ -7232,7 +7232,7 @@ xmlns="http://www.w3.org/2000/svg"
7232
7232
  .myPubnub=${this.myPubnub}
7233
7233
  .orgSlug=${this.orgSlug}
7234
7234
  .buildingSlug=${this.buildingSlug}
7235
- .widgetType=${Ic.Default}
7235
+ .widgetType=${Nc.Default}
7236
7236
  .building=${this.buildingWebchatView}
7237
7237
  .primaryColor=${this.primaryColor}
7238
7238
  .backgroundColor=${this.backgroundColor}
@@ -7337,7 +7337,7 @@ xmlns="http://www.w3.org/2000/svg"
7337
7337
  </meetelise-launcher>`:""}
7338
7338
  </div>
7339
7339
  </meta>
7340
- `}};yc.styles=u`
7340
+ `}};bc.styles=u`
7341
7341
  :host {
7342
7342
  all: initial;
7343
7343
  }
@@ -7386,7 +7386,7 @@ xmlns="http://www.w3.org/2000/svg"
7386
7386
  position: fixed;
7387
7387
  bottom: 0;
7388
7388
  }
7389
- `,yc.FOCUSABLE_SELECTOR="a[href]:not([tabindex='-1']), input:not([disabled]), button:not([disabled]), textarea, [tabindex]:not([tabindex='-1'])",mc([ue({type:String})],yc.prototype,"buildingSlug",void 0),mc([ue({type:String})],yc.prototype,"orgSlug",void 0),mc([ue({type:Boolean})],yc.prototype,"centralConvo",void 0),mc([ue({type:Object})],yc.prototype,"launcherStyles",void 0),mc([ue()],yc.prototype,"mobileStyles",void 0),mc([ue({type:Boolean})],yc.prototype,"isMinimized",void 0),mc([ue({type:String})],yc.prototype,"primaryColor",void 0),mc([ue({type:String})],yc.prototype,"backgroundColor",void 0),mc([ue({type:String})],yc.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),mc([ue({type:String})],yc.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),mc([de()],yc.prototype,"_isMobile",void 0),mc([de()],yc.prototype,"chatId",void 0),mc([de()],yc.prototype,"analytics",void 0),mc([de()],yc.prototype,"launcher",void 0),mc([de()],yc.prototype,"buildingWebchatView",void 0),mc([de()],yc.prototype,"designConcept",void 0),mc([de()],yc.prototype,"leadSources",void 0),mc([de()],yc.prototype,"currentLeadSource",void 0),mc([de()],yc.prototype,"featureFlagShowDropdown",void 0),mc([de()],yc.prototype,"bedroomPreferenceRequired",void 0),mc([de()],yc.prototype,"phoneNumberForSource",void 0),mc([de()],yc.prototype,"hasMounted",void 0),mc([de()],yc.prototype,"hideLauncher",void 0),mc([de()],yc.prototype,"isLoading",void 0),mc([de()],yc.prototype,"showTourNextToChat",void 0),mc([de()],yc.prototype,"displayPubnubChat",void 0),mc([de()],yc.prototype,"myPubnub",void 0),mc([de()],yc.prototype,"LeadSourceClient",void 0),mc([de()],yc.prototype,"LeadSourceMultitouchClient",void 0),mc([de()],yc.prototype,"sampleRateToUse",void 0),mc([ue({type:Number})],yc.prototype,"right",void 0),mc([ue({type:Number})],yc.prototype,"bottom",void 0),mc([ue({type:Number})],yc.prototype,"top",void 0),mc([ue({type:Number})],yc.prototype,"left",void 0),mc([ue({attribute:!0})],yc.prototype,"overrideRentgrata",void 0),mc([ue({attribute:!0})],yc.prototype,"widgetType",void 0),mc([ue()],yc.prototype,"onWidgetLoaded",void 0),mc([ue({attribute:!0})],yc.prototype,"onSstClose",void 0),mc([de()],yc.prototype,"enabledChatWidgets",void 0),mc([de()],yc.prototype,"webchatConfigHasAutoOpenChat",void 0),mc([de()],yc.prototype,"requiresConsent",void 0),mc([de()],yc.prototype,"hideMobileFeatures",void 0),mc([de()],yc.prototype,"privacyPolicyUrl",void 0),yc=gc=mc([se("me-chat")],yc);const bc=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},vc=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(fo(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=bc(["myContactForm","contactus","fpa-myContactForm"]);let u;if(!(l&&l instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&wc(i,e,"Could not find form",t?{id:t.id}:void 0))}try{if(l.parentElement&&"scheduleTourForm"===l.parentElement.id)return wc(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 wc(i,e,"Could not find submit button");const d=()=>({firstName:bc(["firstname","txtName","fpa-firstname","Form_FirstName"]),lastName:bc(["lastname","txtName2","fpa-lastname","Form_LastName"]),email:bc(["email","txtEmail","fpa-email","Form_Email"]),phone:bc(["phonenumber","txtPhone","fpa-phonenumber","Form_Phone"]),message:bc(["message","txtComments","fpa-email","Form_Message"])});if(Object.values(d()).some(e=>null===e)){const t=Object.entries(d()).filter(([,e])=>null===e).map(([e])=>e);return wc(i,e,"Missing the following form elements: "+t.join(", "))}const c=u.textContent,h=u.cloneNode(!0);null===(a=u.parentNode)||void 0===a||a.replaceChild(h,u),h&&Go({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(d()).forEach(e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")}),!Object.values(d()).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(d()).forEach(([e,t])=>n[e]=null==t?void 0:t.value);const r=await Jo(e,i);if(!r)return wc(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,Wo(e)]:[Wo(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(d()).forEach(e=>{e&&(e.disabled=!0)}),h.textContent="Submitted",h.disabled=!0,e.json()}).catch(()=>{h.textContent=c})}},wc=(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})},Cc=u`
7389
+ `,bc.FOCUSABLE_SELECTOR="a[href]:not([tabindex='-1']), input:not([disabled]), button:not([disabled]), textarea, [tabindex]:not([tabindex='-1'])",yc([ue({type:String})],bc.prototype,"buildingSlug",void 0),yc([ue({type:String})],bc.prototype,"orgSlug",void 0),yc([ue({type:Boolean})],bc.prototype,"centralConvo",void 0),yc([ue({type:Object})],bc.prototype,"launcherStyles",void 0),yc([ue()],bc.prototype,"mobileStyles",void 0),yc([ue({type:Boolean})],bc.prototype,"isMinimized",void 0),yc([ue({type:String})],bc.prototype,"primaryColor",void 0),yc([ue({type:String})],bc.prototype,"backgroundColor",void 0),yc([ue({type:String})],bc.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),yc([ue({type:String})],bc.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),yc([de()],bc.prototype,"_isMobile",void 0),yc([de()],bc.prototype,"chatId",void 0),yc([de()],bc.prototype,"analytics",void 0),yc([de()],bc.prototype,"launcher",void 0),yc([de()],bc.prototype,"buildingWebchatView",void 0),yc([de()],bc.prototype,"designConcept",void 0),yc([de()],bc.prototype,"leadSources",void 0),yc([de()],bc.prototype,"currentLeadSource",void 0),yc([de()],bc.prototype,"featureFlagShowDropdown",void 0),yc([de()],bc.prototype,"bedroomPreferenceRequired",void 0),yc([de()],bc.prototype,"phoneNumberForSource",void 0),yc([de()],bc.prototype,"hasMounted",void 0),yc([de()],bc.prototype,"hideLauncher",void 0),yc([de()],bc.prototype,"isLoading",void 0),yc([de()],bc.prototype,"showTourNextToChat",void 0),yc([de()],bc.prototype,"displayPubnubChat",void 0),yc([de()],bc.prototype,"myPubnub",void 0),yc([de()],bc.prototype,"LeadSourceClient",void 0),yc([de()],bc.prototype,"LeadSourceMultitouchClient",void 0),yc([de()],bc.prototype,"sampleRateToUse",void 0),yc([ue({type:Number})],bc.prototype,"right",void 0),yc([ue({type:Number})],bc.prototype,"bottom",void 0),yc([ue({type:Number})],bc.prototype,"top",void 0),yc([ue({type:Number})],bc.prototype,"left",void 0),yc([ue({attribute:!0})],bc.prototype,"overrideRentgrata",void 0),yc([ue({attribute:!0})],bc.prototype,"widgetType",void 0),yc([ue()],bc.prototype,"onWidgetLoaded",void 0),yc([ue({attribute:!0})],bc.prototype,"onSstClose",void 0),yc([de()],bc.prototype,"enabledChatWidgets",void 0),yc([de()],bc.prototype,"webchatConfigHasAutoOpenChat",void 0),yc([de()],bc.prototype,"requiresConsent",void 0),yc([de()],bc.prototype,"hideMobileFeatures",void 0),yc([de()],bc.prototype,"privacyPolicyUrl",void 0),bc=mc=yc([se("me-chat")],bc);const vc=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},wc=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(fo(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=vc(["myContactForm","contactus","fpa-myContactForm"]);let u;if(!(l&&l instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&Cc(i,e,"Could not find form",t?{id:t.id}:void 0))}try{if(l.parentElement&&"scheduleTourForm"===l.parentElement.id)return Cc(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 Cc(i,e,"Could not find submit button");const d=()=>({firstName:vc(["firstname","txtName","fpa-firstname","Form_FirstName"]),lastName:vc(["lastname","txtName2","fpa-lastname","Form_LastName"]),email:vc(["email","txtEmail","fpa-email","Form_Email"]),phone:vc(["phonenumber","txtPhone","fpa-phonenumber","Form_Phone"]),message:vc(["message","txtComments","fpa-email","Form_Message"])});if(Object.values(d()).some(e=>null===e)){const t=Object.entries(d()).filter(([,e])=>null===e).map(([e])=>e);return Cc(i,e,"Missing the following form elements: "+t.join(", "))}const c=u.textContent,h=u.cloneNode(!0);null===(a=u.parentNode)||void 0===a||a.replaceChild(h,u),h&&Go({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(d()).forEach(e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")}),!Object.values(d()).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(d()).forEach(([e,t])=>n[e]=null==t?void 0:t.value);const r=await Jo(e,i);if(!r)return Cc(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,Wo(e)]:[Wo(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(d()).forEach(e=>{e&&(e.disabled=!0)}),h.textContent="Submitted",h.disabled=!0,e.json()}).catch(()=>{h.textContent=c})}},Cc=(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})},xc=u`
7390
7390
  .chat-launcher {
7391
7391
  position: fixed;
7392
7392
  }
@@ -7417,7 +7417,7 @@ xmlns="http://www.w3.org/2000/svg"
7417
7417
  filter: brightness(1.1);
7418
7418
  }
7419
7419
  }
7420
- `;var xc=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 $c=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?R`
7420
+ `;var $c=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 Sc=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?R`
7421
7421
  <div
7422
7422
  class="chat-launcher"
7423
7423
  style=${Vn({top:Or()||isNaN(this.top)?void 0:`${this.top+432}px`,bottom:Or()||isNaN(this.bottom)?"72px":this.bottom-60+"px",left:Or()||isNaN(this.left)?void 0:`${this.left}px`,right:Or()||isNaN(this.right)?"18px":`${this.right}px`})}
@@ -7471,12 +7471,12 @@ xmlns="http://www.w3.org/2000/svg"
7471
7471
  />
7472
7472
  </svg>
7473
7473
  </button>
7474
- </div>`}};$c.styles=[Cc],xc([ue({type:Number})],$c.prototype,"right",void 0),xc([ue({type:Number})],$c.prototype,"bottom",void 0),xc([ue({type:Number})],$c.prototype,"top",void 0),xc([ue({type:Number})],$c.prototype,"left",void 0),xc([ue({attribute:!0})],$c.prototype,"isChatOpen",void 0),xc([ue({attribute:!0})],$c.prototype,"onClickCloseChat",void 0),xc([ue({attribute:!0})],$c.prototype,"onClickOpenChat",void 0),$c=xc([se("simple-launcher")],$c);var Sc=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 Ac=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=Ee(),this.firstUpdated=async()=>{await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=Su(this.healthcareId),t=Au(this.healthcareId,e)?e:$u(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new Ou(this.healthcareId,null,"",this.currentLeadSource,t.leadId,null,null,Ic.Healthcare),t.initiatedChat&&await this.myPubnub.initializePubnub(e),Or()||(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(),xu(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 zl(),this.isLoading?R``:R`
7474
+ </div>`}};Sc.styles=[xc],$c([ue({type:Number})],Sc.prototype,"right",void 0),$c([ue({type:Number})],Sc.prototype,"bottom",void 0),$c([ue({type:Number})],Sc.prototype,"top",void 0),$c([ue({type:Number})],Sc.prototype,"left",void 0),$c([ue({attribute:!0})],Sc.prototype,"isChatOpen",void 0),$c([ue({attribute:!0})],Sc.prototype,"onClickCloseChat",void 0),$c([ue({attribute:!0})],Sc.prototype,"onClickOpenChat",void 0),Sc=$c([se("simple-launcher")],Sc);var Ac=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 Ec=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=Ee(),this.firstUpdated=async()=>{await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=Su(this.healthcareId),t=Au(this.healthcareId,e)?e:$u(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new Ou(this.healthcareId,null,"",this.currentLeadSource,t.leadId,null,null,Nc.Healthcare),t.initiatedChat&&await this.myPubnub.initializePubnub(e),Or()||(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(),xu(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 zl(),this.isLoading?R``:R`
7475
7475
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
7476
7476
  ${this.displayPubnubChat?R`
7477
7477
  <pubnub-chat
7478
7478
  id="pubnub-chat"
7479
- .widgetType=${Ic.Healthcare}
7479
+ .widgetType=${Nc.Healthcare}
7480
7480
  .channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
7481
7481
  .myPubnub=${this.myPubnub}
7482
7482
  .buildingSlug=${this.healthcareId}
@@ -7502,7 +7502,7 @@ xmlns="http://www.w3.org/2000/svg"
7502
7502
  ></simple-launcher>
7503
7503
 
7504
7504
  </meta>
7505
- `}};Ac.styles=u`
7505
+ `}};Ec.styles=u`
7506
7506
  :host {
7507
7507
  all: initial;
7508
7508
  }
@@ -7555,13 +7555,13 @@ xmlns="http://www.w3.org/2000/svg"
7555
7555
  line-height: 150%;
7556
7556
  font-size: 16px;
7557
7557
  }
7558
- `,Sc([ue({type:String})],Ac.prototype,"healthcareId",void 0),Sc([ue({type:Number})],Ac.prototype,"right",void 0),Sc([ue({type:Number})],Ac.prototype,"bottom",void 0),Sc([ue({type:Number})],Ac.prototype,"top",void 0),Sc([ue({type:Number})],Ac.prototype,"left",void 0),Sc([de()],Ac.prototype,"launcher",void 0),Sc([de()],Ac.prototype,"currentLeadSource",void 0),Sc([de()],Ac.prototype,"displayPubnubChat",void 0),Sc([de()],Ac.prototype,"myPubnub",void 0),Sc([de()],Ac.prototype,"requiresConsent",void 0),Sc([de()],Ac.prototype,"privacyPolicyUrl",void 0),Sc([de()],Ac.prototype,"isLoading",void 0),Ac=Sc([se("health-chat")],Ac);var Ec=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 Tc=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=Ee(),this.firstUpdated=async()=>{(await async function(e){if(!e)return!1;const t="e2e-test-yardi-building";try{return(await r().get(fo(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=Su(this.orgSlug),t=Au(this.orgSlug,e)?e:$u(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new Ou(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,null,Ic.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),Or()||(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(),xu(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 zl(),this.isLoading?R``:R`
7558
+ `,Ac([ue({type:String})],Ec.prototype,"healthcareId",void 0),Ac([ue({type:Number})],Ec.prototype,"right",void 0),Ac([ue({type:Number})],Ec.prototype,"bottom",void 0),Ac([ue({type:Number})],Ec.prototype,"top",void 0),Ac([ue({type:Number})],Ec.prototype,"left",void 0),Ac([de()],Ec.prototype,"launcher",void 0),Ac([de()],Ec.prototype,"currentLeadSource",void 0),Ac([de()],Ec.prototype,"displayPubnubChat",void 0),Ac([de()],Ec.prototype,"myPubnub",void 0),Ac([de()],Ec.prototype,"requiresConsent",void 0),Ac([de()],Ec.prototype,"privacyPolicyUrl",void 0),Ac([de()],Ec.prototype,"isLoading",void 0),Ec=Ac([se("health-chat")],Ec);var Tc=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 kc=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=Ee(),this.firstUpdated=async()=>{(await async function(e){if(!e)return!1;const t="e2e-test-yardi-building";try{return(await r().get(fo(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=Su(this.orgSlug),t=Au(this.orgSlug,e)?e:$u(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new Ou(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,null,Nc.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),Or()||(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(),xu(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 zl(),this.isLoading?R``:R`
7559
7559
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
7560
7560
  ${this.displayPubnubChat?R`
7561
7561
  <pubnub-chat
7562
7562
  id="pubnub-chat"
7563
7563
  .channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
7564
- .widgetType=${Ic.Utilities}
7564
+ .widgetType=${Nc.Utilities}
7565
7565
  .myPubnub=${this.myPubnub}
7566
7566
  .buildingSlug=${this.orgSlug}
7567
7567
  .onClickExit=${()=>{this.displayPubnubChat=!1}}
@@ -7585,7 +7585,7 @@ xmlns="http://www.w3.org/2000/svg"
7585
7585
 
7586
7586
  ></simple-launcher>
7587
7587
  </meta>
7588
- `}};Tc.styles=u`
7588
+ `}};kc.styles=u`
7589
7589
  :host {
7590
7590
  all: initial;
7591
7591
  }
@@ -7638,4 +7638,4 @@ xmlns="http://www.w3.org/2000/svg"
7638
7638
  line-height: 150%;
7639
7639
  font-size: 16px;
7640
7640
  }
7641
- `,Ec([ue({type:String})],Tc.prototype,"orgSlug",void 0),Ec([ue({type:Number})],Tc.prototype,"right",void 0),Ec([ue({type:Number})],Tc.prototype,"bottom",void 0),Ec([ue({type:Number})],Tc.prototype,"top",void 0),Ec([ue({type:Number})],Tc.prototype,"left",void 0),Ec([de()],Tc.prototype,"launcher",void 0),Ec([de()],Tc.prototype,"currentLeadSource",void 0),Ec([de()],Tc.prototype,"displayPubnubChat",void 0),Ec([de()],Tc.prototype,"myPubnub",void 0),Ec([de()],Tc.prototype,"requiresConsent",void 0),Ec([de()],Tc.prototype,"privacyPolicyUrl",void 0),Ec([de()],Tc.prototype,"isLoading",void 0),Tc=Ec([se("utilities-chat")],Tc);const kc=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&&Ho({logType:i&&i.data?Fo.info:Fo.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},_c=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 Oc{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}),Nc();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),Oc.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}),Nc(),e.studio&&!e.building)return void this.handleStudioContext(e);let d=null;switch(e.widgetType){case Ic.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case Ic.Default:d=document.createElement("me-chat");break;case Ic.Utilities:d=document.createElement("utilities-chat");break;default:d=document.createElement("me-chat")}if(!d)throw new Error("Invalid widget type");d.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),d.setAttribute("widgetType",e.widgetType||Ic.Default),d.setAttribute("class","meetelise-chat"),d.setAttribute("role","region"),d.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,d.setAttribute("primaryColor",((e,t)=>{const n=Kn(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 Xn(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),d instanceof yc&&(e.centralConvo?d.setAttribute("centralConvo","true"):this.handleBuildingslug(d,e.organization,e.building,e),e.launcherStyles&&(d.launcherStyles=e.launcherStyles),e.mobileStyles&&(d.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(d.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await _c("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),d.overrideRentgrata=!0),e.onSstClose&&(d.onSstClose=e.onSstClose)),e.position&&(d.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),d.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),d.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),d.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(d),d instanceof yc&&(Oc.meChat=d),d instanceof Tc&&(Oc.utilitiesChat=d)}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),Oc.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 Ho({logType:Fo.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:t.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});const i=Pc(e.organization),r=Pc(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 kc(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,kc(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&&Ho({logType:n&&n.data?Fo.info:Fo.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&&Ho({logType:i&&i.data===e?Fo.info:Fo.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 Pc(e){return"string"!=typeof e?"":e.trim()}var Ic;Oc.meChat=null,Oc.healthChat=null,Oc.utilitiesChat=null,Oc.orgSlug="",Oc.mutationObserver=null,Oc.previousUrl="",Oc.hasBuildingSlug=null,Oc.brandColor="",Oc.backgroundColor="",Oc.healthcareId="",Oc.activeStudioOrgSlug="",Oc.activeStudioBuildingSlug="",Oc.activeStudioSessionScopeKey="",Oc.activeStudioOptions=null,Oc.studioUpdateToken=0,Oc.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(Ic||(Ic={}));const Nc=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{Ic as WidgetType,Oc as default};
7641
+ `,Tc([ue({type:String})],kc.prototype,"orgSlug",void 0),Tc([ue({type:Number})],kc.prototype,"right",void 0),Tc([ue({type:Number})],kc.prototype,"bottom",void 0),Tc([ue({type:Number})],kc.prototype,"top",void 0),Tc([ue({type:Number})],kc.prototype,"left",void 0),Tc([de()],kc.prototype,"launcher",void 0),Tc([de()],kc.prototype,"currentLeadSource",void 0),Tc([de()],kc.prototype,"displayPubnubChat",void 0),Tc([de()],kc.prototype,"myPubnub",void 0),Tc([de()],kc.prototype,"requiresConsent",void 0),Tc([de()],kc.prototype,"privacyPolicyUrl",void 0),Tc([de()],kc.prototype,"isLoading",void 0),kc=Tc([se("utilities-chat")],kc);const _c=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&&Ho({logType:i&&i.data?Fo.info:Fo.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},Oc=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 Pc{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}),Mc();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),Pc.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}),Mc(),e.studio&&!e.building)return void this.handleStudioContext(e);let d=null;switch(e.widgetType){case Nc.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case Nc.Default:d=document.createElement("me-chat");break;case Nc.Utilities:d=document.createElement("utilities-chat");break;default:d=document.createElement("me-chat")}if(!d)throw new Error("Invalid widget type");d.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),d.setAttribute("widgetType",e.widgetType||Nc.Default),d.setAttribute("class","meetelise-chat"),d.setAttribute("role","region"),d.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,d.setAttribute("primaryColor",((e,t)=>{const n=Kn(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 Xn(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),d instanceof bc&&(e.centralConvo?d.setAttribute("centralConvo","true"):this.handleBuildingslug(d,e.organization,e.building,e),e.launcherStyles&&(d.launcherStyles=e.launcherStyles),e.mobileStyles&&(d.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(d.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await Oc("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),d.overrideRentgrata=!0),e.onSstClose&&(d.onSstClose=e.onSstClose)),e.position&&(d.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),d.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),d.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),d.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(d),d instanceof bc&&(Pc.meChat=d),d instanceof kc&&(Pc.utilitiesChat=d)}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),Pc.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 Ho({logType:Fo.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:t.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});const i=Ic(e.organization),r=Ic(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 _c(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,_c(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&&Ho({logType:n&&n.data?Fo.info:Fo.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&&Ho({logType:i&&i.data===e?Fo.info:Fo.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 Ic(e){return"string"!=typeof e?"":e.trim()}var Nc;Pc.meChat=null,Pc.healthChat=null,Pc.utilitiesChat=null,Pc.orgSlug="",Pc.mutationObserver=null,Pc.previousUrl="",Pc.hasBuildingSlug=null,Pc.brandColor="",Pc.backgroundColor="",Pc.healthcareId="",Pc.activeStudioOrgSlug="",Pc.activeStudioBuildingSlug="",Pc.activeStudioSessionScopeKey="",Pc.activeStudioOptions=null,Pc.studioUpdateToken=0,Pc.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(Nc||(Nc={}));const Mc=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{Nc as WidgetType,Pc as default};
@@ -424,7 +424,12 @@ export class MEChat extends LitElement {
424
424
  this.enabledChatWidgets.sstMobile ||
425
425
  this.orgSlug === "radco"
426
426
  ) {
427
- replaceSSTLinkWithTourWidgetTrigger(this.handleTourClicked);
427
+ replaceSSTLinkWithTourWidgetTrigger(
428
+ this.handleTourClicked,
429
+ this.orgSlug,
430
+ this.buildingSlug,
431
+ () => this.isConnected
432
+ );
428
433
  if (featureFlagReplaceScheduleTourCtaWebsite) {
429
434
  replacePageRedirectElementWithTourWidgetTrigger(this.handleTourClicked);
430
435
  }
@@ -0,0 +1,216 @@
1
+ import { expect } from "@esm-bundle/chai";
2
+ import {
3
+ replacePageRedirectElementWithTourWidgetTrigger,
4
+ replaceSSTLinkWithTourWidgetTrigger,
5
+ replaceTourTriggerElementWithTourWidgetTrigger,
6
+ } from "./insertLeadSourceIntoSchedulerLinks";
7
+
8
+ const APP = "https://app.meetelise.com";
9
+ const ORG = "test-org";
10
+ const BUILDING = "test-building";
11
+
12
+ const render = (hrefs: string[]): HTMLAnchorElement[] => {
13
+ document.body.innerHTML = hrefs
14
+ .map((href) => `<a href="${href}">link</a>`)
15
+ .join("");
16
+ return Array.from(document.querySelectorAll("a"));
17
+ };
18
+
19
+ // Returns whether the widget cancelled the click. The document listener runs
20
+ // after the link's own listeners, then cancels navigation so the test page stays.
21
+ const click = (element: Element): boolean => {
22
+ let defaultPrevented = false;
23
+ const recordAndCancel = (event: Event) => {
24
+ defaultPrevented = event.defaultPrevented;
25
+ event.preventDefault();
26
+ };
27
+ document.addEventListener("click", recordAndCancel);
28
+ element.dispatchEvent(
29
+ new MouseEvent("click", { bubbles: true, cancelable: true })
30
+ );
31
+ document.removeEventListener("click", recordAndCancel);
32
+ return defaultPrevented;
33
+ };
34
+
35
+ const clickAll = (links: HTMLAnchorElement[]): Record<string, boolean> =>
36
+ Object.fromEntries(
37
+ links.map((link) => [link.getAttribute("href") ?? "", click(link)])
38
+ );
39
+
40
+ const allEqual = (hrefs: string[], value: boolean): Record<string, boolean> =>
41
+ Object.fromEntries(hrefs.map((href) => [href, value]));
42
+
43
+ describe("replaceSSTLinkWithTourWidgetTrigger", () => {
44
+ let opened: MouseEvent[];
45
+ const install = (orgSlug = ORG, buildingSlug = BUILDING): void =>
46
+ replaceSSTLinkWithTourWidgetTrigger(
47
+ (event) => opened.push(event),
48
+ orgSlug,
49
+ buildingSlug,
50
+ () => true
51
+ );
52
+
53
+ beforeEach(() => {
54
+ opened = [];
55
+ });
56
+
57
+ afterEach(() => {
58
+ document.body.innerHTML = "";
59
+ });
60
+
61
+ it("opens the scheduler only for the current building's tour link on a portfolio page", () => {
62
+ const [ownTour, otherTour, contactUs] = render([
63
+ `${APP}/${ORG}/${BUILDING}/tour`,
64
+ `${APP}/${ORG}/other-building/tour`,
65
+ `${APP}/${ORG}/${BUILDING}/contactUs`,
66
+ ]);
67
+
68
+ install();
69
+
70
+ expect({
71
+ ownTour: click(ownTour),
72
+ otherTour: click(otherTour),
73
+ contactUs: click(contactUs),
74
+ }).to.deep.equal({ ownTour: true, otherTour: false, contactUs: false });
75
+ expect(opened).to.have.length(1);
76
+ });
77
+
78
+ it("matches the current building's tour link with query strings, fragments, trailing slashes and any casing", () => {
79
+ const hrefs = [
80
+ `${APP}/${ORG}/${BUILDING}/tour/`,
81
+ `${APP}/${ORG}/${BUILDING}/tour?utm_source=website`,
82
+ `${APP}/${ORG}/${BUILDING}/tour/?hideScrollBars=true`,
83
+ `${APP}/${ORG}/${BUILDING}/tour?stateId=abc123`,
84
+ `${APP}/${ORG}/${BUILDING}/tour#schedule`,
85
+ `${APP}/${ORG}//${BUILDING}/tour`,
86
+ `${APP}/Test-Org/Test-Building/Tour`,
87
+ ];
88
+ const links = render(hrefs);
89
+
90
+ install();
91
+
92
+ expect(clickAll(links)).to.deep.equal(allEqual(hrefs, true));
93
+ expect(opened).to.have.length(hrefs.length);
94
+ });
95
+
96
+ it("matches when the widget was started with differently cased slugs", () => {
97
+ const [link] = render([`${APP}/${ORG}/${BUILDING}/tour`]);
98
+
99
+ install("Test-Org", "TEST-BUILDING");
100
+
101
+ expect(click(link)).to.equal(true);
102
+ });
103
+
104
+ it("keeps default navigation for every other app.meetelise.com link", () => {
105
+ const hrefs = [
106
+ `${APP}/other-org/${BUILDING}/tour`,
107
+ `${APP}/${ORG}/${BUILDING}-2/tour`,
108
+ `${APP}/${ORG}/${BUILDING}/tour-2`,
109
+ `${APP}/${ORG}/${BUILDING}/tour/extra`,
110
+ `${APP}/${ORG}/${BUILDING}/contactUs?utm_source=website`,
111
+ `${APP}/${ORG}/${BUILDING}`,
112
+ `${APP}/${ORG}/tour`,
113
+ `${APP}/${BUILDING}/tour`,
114
+ `${APP}/settings/widgets`,
115
+ `${APP}/`,
116
+ ];
117
+ const links = render(hrefs);
118
+
119
+ install();
120
+
121
+ expect(clickAll(links)).to.deep.equal(allEqual(hrefs, false));
122
+ expect(opened).to.have.length(0);
123
+ });
124
+
125
+ it("never intercepts links outside https://app.meetelise.com", () => {
126
+ const hrefs = [
127
+ `/${ORG}/${BUILDING}/tour`,
128
+ `http://app.meetelise.com/${ORG}/${BUILDING}/tour`,
129
+ `https://www.example.com/${ORG}/${BUILDING}/tour`,
130
+ ];
131
+ const links = render(hrefs);
132
+
133
+ install();
134
+
135
+ expect(clickAll(links)).to.deep.equal(allEqual(hrefs, false));
136
+ });
137
+
138
+ it("lets a removed widget's tour link navigate after the widget switches buildings", () => {
139
+ const [firstTour, secondTour] = render([
140
+ `${APP}/${ORG}/${BUILDING}/tour`,
141
+ `${APP}/${ORG}/other-building/tour`,
142
+ ]);
143
+ const openedByFirst: MouseEvent[] = [];
144
+ const openedBySecond: MouseEvent[] = [];
145
+ let firstMounted = true;
146
+ replaceSSTLinkWithTourWidgetTrigger(
147
+ (event) => openedByFirst.push(event),
148
+ ORG,
149
+ BUILDING,
150
+ () => firstMounted
151
+ );
152
+
153
+ // Studio removes the first widget and starts one for another building.
154
+ firstMounted = false;
155
+ replaceSSTLinkWithTourWidgetTrigger(
156
+ (event) => openedBySecond.push(event),
157
+ ORG,
158
+ "other-building",
159
+ () => true
160
+ );
161
+
162
+ expect({
163
+ firstTour: click(firstTour),
164
+ secondTour: click(secondTour),
165
+ }).to.deep.equal({ firstTour: false, secondTour: true });
166
+ expect(openedByFirst).to.have.length(0);
167
+ expect(openedBySecond).to.have.length(1);
168
+ });
169
+
170
+ it("intercepts nothing when the building slug is missing", () => {
171
+ const hrefs = [`${APP}/${ORG}/${BUILDING}/tour`, `${APP}/${ORG}//tour`];
172
+ const links = render(hrefs);
173
+
174
+ install(ORG, "");
175
+
176
+ expect(clickAll(links)).to.deep.equal(allEqual(hrefs, false));
177
+ expect(opened).to.have.length(0);
178
+ });
179
+ });
180
+
181
+ describe("site schedule-a-tour hooks", () => {
182
+ let opened: MouseEvent[];
183
+
184
+ beforeEach(() => {
185
+ opened = [];
186
+ });
187
+
188
+ afterEach(() => {
189
+ document.body.innerHTML = "";
190
+ });
191
+
192
+ it("opens the scheduler from links ending in schedule-a-tour", () => {
193
+ const [link] = render(["/apartments/oh/westerville/schedule-a-tour"]);
194
+
195
+ replacePageRedirectElementWithTourWidgetTrigger((event) =>
196
+ opened.push(event)
197
+ );
198
+
199
+ expect(click(link)).to.equal(true);
200
+ expect(opened).to.have.length(1);
201
+ });
202
+
203
+ it("replaces #leaseleads-tour-open links with a scheduler trigger", () => {
204
+ render(["#leaseleads-tour-open"]);
205
+
206
+ replaceTourTriggerElementWithTourWidgetTrigger((event) =>
207
+ opened.push(event)
208
+ );
209
+
210
+ const trigger = document.querySelector("a");
211
+ expect(trigger?.hasAttribute("href")).to.equal(false);
212
+ expect(trigger?.textContent).to.equal("link");
213
+ expect(click(trigger as HTMLAnchorElement)).to.equal(true);
214
+ expect(opened).to.have.length(1);
215
+ });
216
+ });
@@ -18,14 +18,43 @@ export const insertLeadSourceIntoSchedulerLinks = (
18
18
  });
19
19
  };
20
20
 
21
+ // Mirrors the web-app's /:organization/:building/tour route, which ignores
22
+ // empty path segments. Case-insensitive so slug casing differences still match.
23
+ const isBuildingTourLink = (
24
+ href: string,
25
+ orgSlug: string,
26
+ buildingSlug: string
27
+ ): boolean => {
28
+ const [org, building, page, ...rest] = new URL(href).pathname
29
+ .split("/")
30
+ .filter(Boolean)
31
+ .map((segment) => segment.toLowerCase());
32
+ return (
33
+ rest.length === 0 &&
34
+ page === "tour" &&
35
+ org === orgSlug.toLowerCase() &&
36
+ building === buildingSlug.toLowerCase()
37
+ );
38
+ };
39
+
21
40
  export const replaceSSTLinkWithTourWidgetTrigger = (
22
- handleTourClicked: (e: MouseEvent) => void
41
+ handleTourClicked: (e: MouseEvent) => void,
42
+ orgSlug: string,
43
+ buildingSlug: string,
44
+ isWidgetMounted: () => boolean
23
45
  ): void => {
24
46
  const sstRedirectElements = document.querySelectorAll("a");
25
47
  sstRedirectElements.forEach(function (element) {
26
48
  const href = element.getAttribute("href");
27
- if (href && href.startsWith("https://app.meetelise.com/")) {
49
+ if (
50
+ href &&
51
+ href.startsWith("https://app.meetelise.com/") &&
52
+ isBuildingTourLink(href, orgSlug, buildingSlug)
53
+ ) {
28
54
  element.addEventListener("click", (event) => {
55
+ // Studio can swap the widget for another building's. A removed
56
+ // widget's listener must let the link navigate, not swallow the click.
57
+ if (!isWidgetMounted()) return;
29
58
  event.preventDefault(); // Prevents the default href redirect
30
59
  handleTourClicked(event as MouseEvent);
31
60
  });