/** * body-scroll-lock * * Copyright (c) 2018 Will Po * @license Licensed under MIT license * * You can obtain a copy of the License at * gis.goinstore.com/static-common/licenses/MIT-License.txt */ var gisAppLib= gisAppLib || {}; !function(e,o){var t={};o(t),e.bodyScrollLock=t}(gisAppLib,function(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=!1;if("undefined"!=typeof window){var e={get passive(){t=!0}};window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}function d(o){return s.some(function(e){return!(!e.options.allowTouchMove||!e.options.allowTouchMove(o))})}function l(e){var o=e||window.event;return!!d(o.target)||(1c)return!1;var d=a.indexOf(";",c+1);return d=0>d?a.length:d,a.slice(c+m,d)},setCookie:function(a){b.cookie=l+"="+a}};var o=a._LTracker,p=new d;if(o&&o.length){var q=0,r=o.length;for(q=0;r>q;q++)p.push(o[q])}a._LTracker=p,a.LogglyTracker=d}(window,document); /** * post-robot * * Copyright 2016 PayPal * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ var gisAppLib= gisAppLib || {}; !function(n,e){n.postRobot=e()}(gisAppLib,(function(){return function(n){var e={};function t(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=n,t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:r})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)t.d(r,o,function(e){return n[e]}.bind(null,o));return r},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return{}.hasOwnProperty.call(n,e)},t.p="",t(t.s=0)}([function(n,e,t){"use strict";function r(n){return"[object RegExp]"==={}.toString.call(n)}t.r(e),t.d(e,"Promise",(function(){return A})),t.d(e,"TYPES",(function(){return Zn})),t.d(e,"ProxyWindow",(function(){return En})),t.d(e,"setup",(function(){return Kn})),t.d(e,"destroy",(function(){return Yn})),t.d(e,"serializeMessage",(function(){return Bn})),t.d(e,"deserializeMessage",(function(){return Jn})),t.d(e,"createProxyWindow",(function(){return Hn})),t.d(e,"toProxyWindow",(function(){return Un})),t.d(e,"on",(function(){return Ln})),t.d(e,"once",(function(){return qn})),t.d(e,"send",(function(){return Fn})),t.d(e,"markWindowKnown",(function(){return ln})),t.d(e,"cleanUpWindow",(function(){return $n})),t.d(e,"bridge",(function(){}));var o="Call was rejected by callee.\r\n";function i(n){return void 0===n&&(n=window),"about:"===n.location.protocol}function a(n){if(void 0===n&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch(n){}}function u(n){if(void 0===n&&(n=window),n&&!a(n))try{return n.opener}catch(n){}}function c(n){try{return!0}catch(n){}return!1}function s(n){void 0===n&&(n=window);var e=n.location;if(!e)throw new Error("Can not read window location");var t=e.protocol;if(!t)throw new Error("Can not read window protocol");if("file:"===t)return"file://";if("about:"===t){var r=a(n);return r&&c()?s(r):"about://"}var o=e.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function f(n){void 0===n&&(n=window);var e=s(n);return e&&n.mockDomain&&0===n.mockDomain.indexOf("mock:")?n.mockDomain:e}function d(n){if(!function(n){try{if(n===window)return!0}catch(n){}try{var e=Object.getOwnPropertyDescriptor(n,"location");if(e&&!1===e.enumerable)return!1}catch(n){}try{if(i(n)&&c())return!0}catch(n){}try{if(s(n)===s(window))return!0}catch(n){}return!1}(n))return!1;try{if(n===window)return!0;if(i(n)&&c())return!0;if(f(window)===f(n))return!0}catch(n){}return!1}function l(n){if(!d(n))throw new Error("Expected window to be same domain");return n}function h(n,e){if(!n||!e)return!1;var t=a(e);return t?t===n:-1!==function(n){var e=[];try{for(;n.parent!==n;)e.push(n.parent),n=n.parent}catch(n){}return e}(e).indexOf(n)}function w(n){var e,t,r=[];try{e=n.frames}catch(t){e=n}try{t=e.length}catch(n){}if(0===t)return r;if(t){for(var o=0;o>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var n=new WeakMap,e={};return Object.freeze(e),n.set(e,"__testvalue__"),"__testvalue__"===n.get(e)}catch(n){return!1}}())try{this.weakmap=new WeakMap}catch(n){}this.keys=[],this.values=[]}var e=n.prototype;return e._cleanupClosedWindows=function(){for(var n=this.weakmap,e=this.keys,t=0;t=3)return"stringifyError stack overflow";try{if(!n)return"";if("string"==typeof n)return n;if(n instanceof Error){var t=n&&n.stack,r=n&&n.message;if(t&&r)return-1!==t.indexOf(r)?t:r+"\n"+t;if(t)return t;if(r)return r}return n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}catch(n){return"Error while stringifying error: "+H(n,e+1)}}function U(n){return"string"==typeof n?n:n&&n.toString&&"function"==typeof n.toString?n.toString():{}.toString.call(n)}function K(n){return"[object RegExp]"==={}.toString.call(n)}function Y(n,e,t){if(n.hasOwnProperty(e))return n[e];var r=t();return n[e]=r,r}function Z(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function $(){return Boolean(document.body)&&"complete"===document.readyState}function G(){return Boolean(document.body)&&"interactive"===document.readyState}F.clear=function(){q=L},F((function(n){if(Object.values)return Object.values(n);var e=[];for(var t in n)n.hasOwnProperty(t)&&e.push(n[t]);return e})),Error,F((function(){return new A((function(n){if($()||G())return n();var e=setInterval((function(){if($()||G())return clearInterval(e),n()}),10)}))}));var Q="undefined"!=typeof document?document.currentScript:null,V=F((function(){if(Q)return Q;if(Q=function(){try{var n=function(){try{throw new Error("_")}catch(n){return n.stack||""}}(),e=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n),t=e&&e[1];if(!t)return;for(var r=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();r { ... }":"<"+typeof n+">"})).join(", ")+") failed\n\n")+n.stack),n}))})).then((function(n){return{result:n,id:o,name:i}}))}))}));var c=t.__id__||M();n=En.unwrap(n);var s=t.__name__||t.name||r;return"string"==typeof s&&"function"==typeof s.indexOf&&0===s.indexOf("anonymous::")&&(s=s.replace("anonymous::",r+"::")),En.isProxyWindow(n)?(xn(c,t,s,n,e),n.awaitWindow().then((function(n){xn(c,t,s,n,e)}))):xn(c,t,s,n,e),pn("cross_domain_function",{id:c,name:s})}function kn(n,e,t,r){var o,i=r.on,a=r.send;return function(n,e){void 0===e&&(e=yn);var t=JSON.stringify(n,(function(n){var t=this[n];if(hn(this))return t;var r=wn(t);if(!r)return t;var o=e[r]||vn[r];return o?o(t,n):t}));return void 0===t?"undefined":t}(t,((o={}).promise=function(t,r){return function(n,e,t,r,o){return pn("cross_domain_zalgo_promise",{then:jn(n,e,(function(n,e){return t.then(n,e)}),r,{on:o.on,send:o.send})})}(n,e,t,r,{on:i,send:a})},o.function=function(t,r){return jn(n,e,t,r,{on:i,send:a})},o.object=function(n){return _(n)||En.isProxyWindow(n)?pn("cross_domain_window",En.serialize(n,{send:a})):n},o))}function On(n,e,t,r){var o,i=r.send;return function(n,e){if(void 0===e&&(e=_n),"undefined"!==n)return JSON.parse(n,(function(n,t){if(hn(this))return t;var r,o;if(hn(t)?(r=t.__type__,o=t.__val__):(r=wn(t),o=t),!r)return o;var i=e[r]||gn[r];return i?i(o,n):o}))}(t,((o={}).cross_domain_zalgo_promise=function(n){return function(n,e,t){return new A(t.then)}(0,0,n)},o.cross_domain_function=function(t){return function(n,e,t,r){var o=t.id,i=t.name,a=r.send,u=function(t){function r(){var u=arguments;return En.toProxyWindow(n,{send:a}).awaitWindow().then((function(n){var c=Sn(n,o);if(c&&c.val!==r)return c.val.apply({source:window,origin:f()},u);var s=[].slice.call(u);return t.fireAndForget?a(n,"postrobot_method",{id:o,name:i,args:s},{domain:e,fireAndForget:!0}):a(n,"postrobot_method",{id:o,name:i,args:s},{domain:e,fireAndForget:!1}).then((function(n){return n.data.result}))})).catch((function(n){throw n}))}return void 0===t&&(t={}),r.__name__=i,r.__origin__=e,r.__source__=n,r.__id__=o,r.origin=e,r},c=u();return c.fireAndForget=u({fireAndForget:!0}),c}(n,e,t,{send:i})},o.cross_domain_window=function(n){return En.deserialize(n,{send:i})},o))}var Pn={};function An(n,e,t,r){var o=r.on,i=r.send;return A.try((function(){var r=un().getOrSet(n,(function(){return{}}));return r.buffer=r.buffer||[],r.buffer.push(t),r.flush=r.flush||A.flush().then((function(){if(v(n))throw new Error("Window is closed");var t,a=kn(n,e,((t={}).__post_robot_10_0_44__=r.buffer||[],t),{on:o,send:i});delete r.buffer;for(var u=Object.keys(Pn),c=[],s=0;s=A.oneToOneEngagement.reshowDuration)&&A.oneToOneEngagement&&A.oneToOneEngagement.enabled&&function(e){if(autoPlayService.isAutoPlaySetup()||!e)return;autoPlayService.setupAutoplay(e,f,{playerInitialize:function(){t.hide()},playerClicked:function(){"replay_engagement"==e.autoPlayType?replayCtrl.playReplay(e):"call"==e.autoPlayType&&(autoPlayService.storeAutoPlayReshowTimestamp(e),callCtrl.startCallJourney({routingKey:null,type:GIS_CONSTANTS.CALL_TYPES.STANDARD}))},playerDismissed:function(){window.dispatchEvent(new GisCustomEvent("gisUIClosed")),t.show()},playerPlay:function(){("call"==e.autoPlayType||"replay_engagement"==e.autoPlayType&&e.config.announcementChannel.enabled)&&autoPlayService.storeAutoPlayReshowTimestamp(e)}})}(function(e){var n=A.oneToOneEngagement,t=stateService.getOneToOneAutoPlay();{if(n.src.serviceIntro&&t&&t.config.ctaAutoPlay.enabled&&(!v(t)||L(t)))return t;if(n.src.replay&&e)return e.autoPlayType="replay_engagement",e}return null}(e))}function _(e){t.setMode('replay',e,A.persistentCta,!1),g(function(){e.config.announcementChannel.enabled&&autoPlayService.storeAutoPlayReshowTimestamp(e),replayCtrl.playReplay(e)}),e.config.ctaAutoPlay.enabled&&(autoPlayService.isAutoPlaySetup()||autoPlayService.setupAutoplay(e,f,{playerInitialize:function(){t.hide()},playerClicked:function(){replayCtrl.playReplay(e)},playerDismissed:function(){window.dispatchEvent(new GisCustomEvent("gisUIClosed")),t.show()},playerPlay:function(){e.config.announcementChannel.enabled&&autoPlayService.storeAutoPlayReshowTimestamp(e)}}))}function v(e){var n=clientStorageService.getItem(clientStorageService.storageKeys.VIDEO_VIEWED);return n&&n[e.id]}function L(e){var n=e.config,t=clientStorageService.getItem(clientStorageService.storageKeys.VIDEO_VIEWED);return t&&t[e.id]&&n.announcementChannel.reshow.enabled&&utilitiesService.dateDifferenceInDays(Date.parse(t[e.id]),new Date)>=n.announcementChannel.reshow.reshowDuration}return t="tab"===e?ctaTabDOMProc:ctaRoundelDOMProc,{init:function(){window.addEventListener("gisUIClosed",function(e){stateService.setUIActive(!1),!pollingService.isPollingTimeExpiredForEvent(pollingService.BASE_EVENTS.CLERK_AVAILABILITY_POLLING)&&A.persistentCta&&(pollingService.subscribe(pollingService.BASE_EVENTS.CLERK_AVAILABILITY_POLLING,GISAPP.Sym_Sys.clerkIsAvailable,GISAPP.Sym_Sys.clerkIsNotAvailable),pollingService.startPollingEvent(pollingService.BASE_EVENTS.CLERK_AVAILABILITY_POLLING)),e.detail&&e.detail.action===GIS_CONSTANTS.ACTIONS.BROADCAST_SCREEN_CLOSED?gisService.getBroadcasts(null,"broadcastCallback"):n()}),window.addEventListener("gisUIOpen",function(e){stateService.setUIActive(!0),T(),autoPlayService.destroyAutoPlay()})},updateCTA:n,showCTA:S,hideCTA:T,setOnClick:g}};GISAPP.broadcastCtrl=function(callCtrl,serverInjectionService,activityLoggerService,gaService,browserInfoService,deviceInfoService,stateService,eventLoggerService,retailerFunctionalityCtrl,hlsCtrl,chatInputDOMProc,broadcastDOMProc,callUserService,pageUnloadService,utilitiesService,gisService,emailSubmitComponent,preCallScreen,uiUtilitiesService,modalComponent,modalContentComponent,clientStorageService,buttonComponent,contactCaptureCtrl,GIS_CONSTANTS,pollingService,gisPlayerScreen,shopStreamService,urlUtilitiesService,callService,eventService,playerUtilService){'use strict';var t,a,n,i,s,l,r,A,E,o={},S={},T={NAVIGATE:"navigate"},u=!1,c=!1,e="AVAILABLE",C="UNAVAILABLE",_="NONE",I=_,d=!1,O=!1,L=!1,N=!1;function g(t,e,n){pollingService.registerPollingEvent(pollingService.BASE_EVENTS.SCHEDULED_BROADCAST_POLLING,{poll:gisService.getBroadcastsEvent,pollArguments:[utilitiesService.utf8ToBase64(e),null,"broadcastCallback"],pollWithOnSuccessAndFailure:!1,interval:n||null}),pollingService.subscribe(pollingService.BASE_EVENTS.SCHEDULED_BROADCAST_POLLING,function(){},function(){}),pollingService.startPollingEvent(pollingService.BASE_EVENTS.SCHEDULED_BROADCAST_POLLING),d=!0}function D(){pollingService.stopPollingEvent(pollingService.BASE_EVENTS.SCHEDULED_BROADCAST_POLLING),pollingService.events.scheduledBroadcastPolling=null,d=!1}function B(){o.broadcastContactCaptureData={broadcastId:S.id,viewDuration:b()||0},gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.BROADCAST_DURATION,{duration:b()})}function R(){serverInjectionService.getSystemConfig().oneToOneCta.broadcast&&i.config.oneToOneInBroadcast&&(I=_,pollingService.subscribe(pollingService.BASE_EVENTS.CLERK_AVAILABILITY_POLLING,f,V),pollingService.startPollingEvent(pollingService.BASE_EVENTS.CLERK_AVAILABILITY_POLLING))}function f(){if(I!==e){I=e;var t=serverInjectionService.getSystemConfig();stateService.setClerkAvailability(!0),p(t.persistentCta,!0)}}function V(){if(I!==C){I=C;var t=serverInjectionService.getSystemConfig();stateService.setClerkAvailability(!1),p(t.persistentCta,!1)}}function p(t,e){broadcastDOMProc.setOneToOneCtaOnBroadcast(t,e);var n=(performance.now()-window.gisProfilingStartTime).toFixed(3);e?(eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.CALL_CTA_SHOWN_ON_BROADCAST,{timeElapsed:n}),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.CALL_CTA_SHOWN_ON_BROADCAST)):!e&&t&&(eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.CALL_CTA_SHOWN_ON_BROADCAST_UNAVAILABLE,{timeElapsed:n}),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.CALL_CTA_SHOWN_ON_BROADCAST_UNAVAILABLE)),function(e){if(!e||'function'!=typeof e)return;broadcastDOMProc.setOnCtaClickEvent(function(t){e(t)})}(function(t){callCtrl.startCallJourney({routingKey:null,type:GIS_CONSTANTS.CALL_TYPES.STANDARD},t),e?(eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.CALL_CTA_CLICK_FROM_BROADCAST,{channelId:i.channelId}),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.CALL_CTA_CLICK_FROM_BROADCAST)):(eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.CALL_CTA_CLICK_UNAVAILABLE_ON_BROADCAST,{channelId:i.channelId}),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.CALL_CTA_CLICK_UNAVAILABLE_ON_BROADCAST)),c||callService.isRedirectJourney()?stateService.setCallUUID(null):broadcastDOMProc.hide()})}function v(){eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.SHOP_STREAM_USER_DURATION,{viewDuration:b(),callUUID:m(),broadcastId:i.id,shopStreamType:"broadcast",channelId:i.channelId})}function P(){t?broadcastDOMProc.stopVideo():(hlsCtrl.destroy(),S=null)}function m(){return S&&S.callUUID?S.callUUID:""}function U(){utilitiesService.supportsHLS()&&!utilitiesService.supportsMediaSource()?(broadcastDOMProc.getVideoElement().src=S.urls[0],y()):(hlsCtrl.registerOnManifestParsed(y),hlsCtrl.registerOnErrorFunction(W),hlsCtrl.loadHls(H))}function b(){return playerUtilService.getWatchedTime()}function G(t){var e=serverInjectionService.getSystemConfig();if(stateService.setCurrentPhase(stateService.phase.BROADCAST_END),B(),pageUnloadService.unregisterFunction(G),P(),chatInputDOMProc.dispose(),stateService.setCallStartTime(0),a&&a(),stateService.setCurrentPhase(stateService.phase.READY),e&&e.captureInfo&&e.captureInfo.views&&!0===e.captureInfo.views.broadcast&&"object"==typeof t&&"click"===t.type&&1<=o.broadcastContactCaptureData.viewDuration){var n=clientStorageService.getItem(clientStorageService.storageKeys.BROADCAST_CONTACT_CAPTURE)||{};n&&!n[o.broadcastContactCaptureData.broadcastId]&&contactCaptureCtrl.init("broadcast",o.broadcastContactCaptureData)}stateService.setCallUUID(null),I=_,e.oneToOneCta.broadcast&&i.config.oneToOneInBroadcast&&pollingService.unSubscribe(pollingService.BASE_EVENTS.CLERK_AVAILABILITY_POLLING,f,V),pollingService.startPollingEvent(pollingService.BASE_EVENTS.BROADCAST_POLLING),pollingService.stopPollingEvent(pollingService.BASE_EVENTS.BROADCAST_VIEW_DURATION_POLLING),v(),eventLoggerService.logEvent(eventLoggerService.GIS_VIEWS.BROADCAST+eventLoggerService.GIS_ACTIONS.CLOSED,{url:urlUtilitiesService.getUrlWithoutParamsWithLimit(500),broadcastId:i.id,callUUID:stateService.getCallUUID()}),0,null,u=!1,deviceInfoService.isIos()&&broadcastDOMProc.clearIntervalOnVideoElement(),pollingService.stopPollingEvent(pollingService.BASE_EVENTS.PRODUCTS_FOR_CAROUSEL_POLLING)}function y(){deviceInfoService.isMobileDevice()?broadcastDOMProc.setOnClickPlay(h):h()}function h(){stateService.setCallStartTime((new Date).getTime()),broadcastDOMProc.playVideo(),stateService.setCurrentPhase(stateService.phase.BROADCAST_PLAYING)}function w(){(new Date).getTime(),eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.SHOP_STREAM_PAUSE_BUTTON_CLICKED,{callUUID:m(),shopStreamType:"broadcast",videoPauseTime:broadcastDOMProc.getVideoElement().currentTime}),pollingService.stopPollingEvent(pollingService.BASE_EVENTS.BROADCAST_VIEW_DURATION_POLLING),deviceInfoService.isIos()&&broadcastDOMProc.clearIntervalOnVideoElement(),u=!1}function W(t){t.type===Hls.ErrorTypes.NETWORK_ERROR?K():t.fatal&&pollingService.stopPollingEvent(pollingService.BASE_EVENTS.BROADCAST_VIEW_DURATION_POLLING)}function K(){S?gisService.isBroadcastActiveByBroadcastId(S.id,"GISAPP.broadcastCtrl.broadcastHasEnded",function(){broadcastDOMProc.hide()}):broadcastDOMProc.hide()}function H(t){t&&hlsCtrl.playUrl(broadcastDOMProc.getVideoElement(),S.urls[0])}function k(){eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.SHOP_STREAM_PLAY_BUTTON_CLICKED,{callUUID:m(),shopStreamType:"broadcast",videoPlayTime:broadcastDOMProc.getVideoElement().currentTime,channelId:i.channelId}),u||(u=!0,pollingService.startPollingEvent(pollingService.BASE_EVENTS.BROADCAST_VIEW_DURATION_POLLING),deviceInfoService.isIos()&&broadcastDOMProc.setIntervalOnVideoElement(K))}function M(){pollingService.registerPollingEvent(pollingService.BASE_EVENTS.PRODUCTS_FOR_CAROUSEL_POLLING,{poll:Y,pollWithOnSuccessAndFailure:!1,pollArguments:[]}),pollingService.subscribe(pollingService.BASE_EVENTS.PRODUCTS_FOR_CAROUSEL_POLLING,function(){},function(){}),pollingService.startPollingEvent(pollingService.BASE_EVENTS.PRODUCTS_FOR_CAROUSEL_POLLING)}function Y(){var t=broadcastDOMProc.getCarouselVersion();gisService.isProductCarouselVersionUpdated(i.id,"gisCallbacks.checkCarouselUpdatedCallback",t)}return shopStreamService.isShopStreamEnabled()&&(broadcastDOMProc=new gisPlayerScreen({onPlay:k,onPause:w})),broadcastDOMProc.onVideoPlay(k),broadcastDOMProc.onVideoPause(w),{playBroadcast:function(t,e){return stateService.setCurrentPhase(stateService.phase.BROADCAST_START),pollingService.stopPollingEvent(pollingService.BASE_EVENTS.BROADCAST_POLLING),d&&D(),O&&(O=!1),S&&P(),t?(i=S=t,e&&(a=e),stateService.setCallUUID(m()),!shopStreamService.isChatTypeQuestion(S)&&shopStreamService.isShopStreamEnabled()||callUserService.add(S.type),function(){eventLoggerService.logEvent(eventLoggerService.GIS_VIEWS.BROADCAST+eventLoggerService.GIS_ACTIONS.SHOWN,{url:urlUtilitiesService.getUrlWithoutParamsWithLimit(500),broadcastId:i.id,callUUID:stateService.getCallUUID()});var t=serverInjectionService.getSystemConfig().oneToOneCta.broadcast&&i.config.oneToOneInBroadcast;shopStreamService.isShopStreamEnabled()?broadcastDOMProc.show(t,i):broadcastDOMProc.show(),broadcastDOMProc.extendPlayer(playerUtilService.setup),broadcastDOMProc.setOnClickClose(G),function(){var t=serverInjectionService.getSystemConfig(),e=t.goToShopBtn;e&&e.url&&broadcastDOMProc.setOnClickShop(function(){eventLoggerService.logEvent(eventLoggerService.GIS_VIEWS.BROADCAST+eventLoggerService.GIS_VIEWS.LINK+eventLoggerService.GIS_ACTIONS.CLICKED,{url:e.url}),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.BROADCAST_LINK_CLICK,{url:e.url}),window.open(e.url,e.redirect===T.NAVIGATE?'_self':'_blank')});var n=t.specificPageBtn;n&&n.url&&broadcastDOMProc.setOnClickSpecificShop(function(){eventLoggerService.logEvent(eventLoggerService.GIS_VIEWS.BROADCAST+eventLoggerService.GIS_VIEWS.LINK2+eventLoggerService.GIS_ACTIONS.CLICKED,{url:n.url}),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.BROADCAST_LINK2_CLICK,{url:n.url}),window.open(n.url,n.redirect===T.NAVIGATE?'_self':'_blank')}),broadcastDOMProc.setOnClickRetailerCustomButton(function(){activityLoggerService.logBroadcastLink2Click("RetailerCustomButton"),eventLoggerService.logEvent(eventLoggerService.GIS_VIEWS.BROADCAST+eventLoggerService.GIS_VIEWS.LINK2+eventLoggerService.GIS_ACTIONS.CLICKED,{url:"RetailerCustomButton"}),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.BROADCAST_LINK2_CLICK,{url:"RetailerCustomButton"})});var a=S.config?S.config:null;a&&a.button1&&broadcastDOMProc.setupExtraButton(1,a.button1.label,function(){eventLoggerService.logEvent(eventLoggerService.GIS_VIEWS.BROADCAST+eventLoggerService.GIS_VIEWS.EXTRABTN1+eventLoggerService.GIS_ACTIONS.CLICKED,{url:a.button1.url}),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.BROADCAST_EXTRABTN1_CLICK,{url:a.button1.url}),window.open(a.button1.url,a.button1.redirect===T.NAVIGATE?'_self':'_blank')}),a&&a.button2&&broadcastDOMProc.setupExtraButton(2,a.button2.label,function(){eventLoggerService.logEvent(eventLoggerService.GIS_VIEWS.BROADCAST+eventLoggerService.GIS_VIEWS.EXTRABTN2+eventLoggerService.GIS_ACTIONS.CLICKED,{url:a.button2.url}),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.BROADCAST_EXTRABTN2_CLICK,{url:a.button2.url}),window.open(a.button2.url,a.button2.redirect===T.NAVIGATE?'_self':'_blank')})}(),R(),i&&1==i.status&&U()}(),pageUnloadService.registerFunction(G),pollingService.registerPollingEvent(pollingService.BASE_EVENTS.BROADCAST_VIEW_DURATION_POLLING,{poll:v,pollArguments:[]},!0),pollingService.subscribe(pollingService.BASE_EVENTS.BROADCAST_VIEW_DURATION_POLLING,function(){},function(){}),eventService.subscribe(GIS_CONSTANTS.EVENT_NAMES.CHECK_FOR_CAROUSEL_UPDATE,M),0):-1},startDirectLinkBroadcast:function(){var t=utilitiesService.getUrlParamsLowerCase()[GIS_CONSTANTS.QUERY_PARAM.GIS_CHANNEL_PARAM],e=utilitiesService.getUrlParamsLowerCase()[GIS_CONSTANTS.QUERY_PARAM.GIS_EVENT_PARAM],n=t||e;if(utilitiesService.isEncodedUri(n)&&(n=decodeURIComponent(n)),null!=n||""!=n)if(t)gisService.getBroadcasts(utilitiesService.utf8ToBase64(n),"broadcastCallback");else if(e){var a=utilitiesService.getUrlParamsLowerCase().giskey;utilitiesService.isEncodedUri(a)&&(a=decodeURIComponent(a)),gisService.getBroadcastsEvent(utilitiesService.utf8ToBase64(n),a?utilitiesService.utf8ToBase64(a):null,"broadcastCallback")}},broadcastHasEnded:function(t){t||(hlsCtrl.destroy(),pollingService.stopPollingEvent(pollingService.BASE_EVENTS.BROADCAST_VIEW_DURATION_POLLING),deviceInfoService.isIos()&&broadcastDOMProc.clearIntervalOnVideoElement(),broadcastDOMProc.broadcastEnded(),'function'==typeof n&&n())},setupEmbedBroadcast:function(t,e){if(pollingService.stopPollingEvent(pollingService.BASE_EVENTS.BROADCAST_POLLING),c=!0,S&&P(),!t)return-1;i=S=t,e&&(n=e),stateService.setCallUUID(m()),callUserService.add(t.type),R(),U(),pageUnloadService.registerFunction(B)},getBroadcastView:function(){var t=broadcastDOMProc.getView();return uiUtilitiesService.removeClass(t,'gis-modal-wrap'),t},pauseVideo:function(){broadcastDOMProc.pauseVideo()},playVideo:function(){broadcastDOMProc.playVideo()},toggleMute:function(){broadcastDOMProc.toggleMute()},showNoBroadcastView:function(t){var e,n,a=utilitiesService.getUrlParams()[GIS_CONSTANTS.QUERY_PARAM.GIS_EVENT_PARAM];if(shopStreamService.isShopStreamEnabled()&&a&&t&&t.broadcastEventHoldTimeStamp&&(n=a,(e=t).status===GIS_CONSTANTS.BROADCAST_STATUS.BROADCAST_CREATED?(s&&s.getTime()!==new Date(e.broadcastEventHoldTimeStamp).getTime()&&(broadcastDOMProc.updateTimeOnHoldingScreen(new Date(e.broadcastEventHoldTimeStamp)),clearTimeout(l),D()),s=new Date(e.broadcastEventHoldTimeStamp),function t(e,n){if(i=new Date,(r=new Date(s)).setMinutes(s.getMinutes()-10),i.getTime()=r.getTime()&&o.getTime()<=A.getTime()){if(d&&L)return;g(0,n),N=!(L=!0)}else if(a=new Date,(E=new Date(s)).setMinutes(s.getMinutes()+25),a.getTime()>=A.getTime()&&a.getTime()<=E.getTime()){if(d&&N)return;d&&L&&D(),g(0,n,3e4),N=!(L=!1)}else(new Date).getTime()>E.getTime()&&d&&(D(),clearTimeout(l),N=L=!1);var a,o,i}(e,n)):e.status===GIS_CONSTANTS.BROADCAST_STATUS.BROADCAST_ENDED&&d&&D()),!O){stateService.setCurrentPhase(stateService.phase.NO_BROADCAST_AVAILABLE),O=!0,i=t;var o=serverInjectionService.getSystemConfig().oneToOneCta.broadcast&&i&&i.config&&i.config.oneToOneInBroadcast;!i||void 0===i.status||0!==i.status&&10!==i.status?broadcastDOMProc.show(!1,i):broadcastDOMProc.show(o,i),i&&(0===i.status||10===i.status)&&o&&R()}}}};GISAPP.callCtrl=function(logService,serverInjectionService,stateService,mediaService,browserInfoService,activityLoggerService,systemInfoService,uiUtilitiesService,gisService,otService,callUserService,gaService,pageUnloadService,utilitiesService,callDOMProc,preCallScreen,surveyScreen,modalComponent,eventLoggerService,overrideService,callService,GIS_CONSTANTS,bookingService,callScreen,streamService,chatLogoutService,addToCartService,addAPersonService,clientStorageService){'use strict';var o,e,a,t={},r="callCtrl",A=!1,E=serverInjectionService.getSystemConfig().skipMicShare,n=serverInjectionService.getSystemConfig().isNewCallScreen||serverInjectionService.getSystemConfig().oneToOne.isShopStreamCall.enabled,i=0,l=0,s=!0,C=function(e,t,i){};t.addProductToBasket=C;var c,d,T,S,I,_,otSession,otPublisher,g=null,L=!1,u=browserInfoService.isChrome()?'https://support.google.com/chrome/answer/2693767?hl=en':'https://support.mozilla.org/en-US/questions/1168156',N=GIS_CONSTANTS.CALL_STATUS.NOT_CONNECTED,h=[],D=!1,O=!1,y=!1,v=!1,f=!1,M=!1,p=!1,V=!1,R=0,m=0,P=!0,Y={},b=!1,w=!1,U=[],G={mic:{isMute:E,onClick:ve},speaker:{isMute:A,onClick:fe},cameraToggle:{isMute:P,onClick:Ye,isEnabled:serverInjectionService.getSystemConfig().oneToOne.twoWayVideo.enabled},cameraSwitch:{isMute:!1,onClick:be},onLeaveButtonClick:K};function k(e,t,i){if(window.dispatchEvent(new GisCustomEvent("gisCallInitiated")),stateService.getCurrentPhase()===stateService.phase.READY||stateService.getCurrentPhase()===stateService.phase.EMBED_CALL_INITIATED){stateService.getCanceledOnConnectingScreen()&&stateService.setCallInitiatedWhileCanceling(!0),stateService.setCurrentPhase(stateService.phase.CALL_INITIATING),oe();var n=e&&"string"==typeof e?e:stateService.getRoutingKey();stateService.setActiveCallRoutingKey(n),d=utilitiesService.isDirectCall()||utilitiesService.isDepartmentCall()?GIS_CONSTANTS.CALL_TYPES.DIRECT:GIS_CONSTANTS.CALL_TYPES.STANDARD,gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.CALL_MADE,{CallType:d}),systemInfoService.requiresSSLCall()?gisService.getSecurityToken("gisCallbacks.onSecurityTokenReceived"):(utilitiesService.isMeeting()?gisService.initiateMeetingCall("gisCallbacks.onCallInitiation",d,a):addAPersonService.isAddAPersonCall()?W(t.data):(V=i,gisService.initiateCall("gisCallbacks.onCallInitiation",d)),c&&clearTimeout(c),c=setTimeout(Me,4e4))}else logService.warn(r,"Tried to initiate call procedure when phase is "+stateService.getCurrentPhase())}function H(){c&&clearTimeout(c),uiUtilitiesService.redirectToHttp(),stateService.setCallUUID(""),stateService.setActiveCallRoutingKey(""),N=GIS_CONSTANTS.CALL_STATUS.NOT_CONNECTED,w=V=!1,me(),"function"==typeof S&&S()}function W(t){logService.debug(r,"Call initiation received",stateService.getCallUUID());try{if(stateService.getCallUUID()||stateService.getCurrentPhase()!==stateService.phase.CALL_INITIATING)return void logService.warn(r,"Received call initiation but call has already been initiated or has been canceled");stateService.setCurrentPhase(stateService.phase.CALL_INITIATED),t.callUUID&&stateService.setCallUUID(t.callUUID),t.sessionId&&stateService.setSessionId(t.sessionId),t.token&&stateService.setToken(t.token),t.sessionId&&t.sessionId,t.apiKey&&(e=t.apiKey),t.surveyId&&t.surveyId,t.apiKey&&stateService.setTokBoxApiKey(e),clearTimeout(c),c=null,callUserService.add("call"),V?Ce():ae()}catch(e){logService.error(r,"Exception on server callback, onCallInitiation.",e,{callId:t.callUUID})}}function B(e,t,i,n,o,a,l,s,C,c){C&&'string'==typeof C&&(C=JSON.parse(C));try{if(Re(t))return;callDOMProc.setupClerkProfile(n,o),logService.log(r,"Session Connected"),N=GIS_CONSTANTS.CALL_STATUS.CONNECTED,stateService.setCurrentPhase(stateService.phase.IN_CALL),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.CALL_ACCEPTED),utilitiesService.isDirectCall()?gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.DIRECT_CALL):gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.STANDARD_CALL),g=new Date,c||(I.hide(!0),callDOMProc.show({isMicSetupRequired:serverInjectionService.getSystemConfig().skipMicShare,isBookingCall:utilitiesService.isMeeting(),isArchivingEnabled:b,chatOnlyCall:{enabled:V,startCallOnClick:we}}),GISAPP.chatUserNameService.setCallDOMProc(callDOMProc)),callDOMProc.changeMicIcon(E),callDOMProc.changeSpeakerIcon(A),(utilitiesService.isMeeting()&&bookingService.isTwoWayVideoCallEnabled()||!utilitiesService.isMeeting()&&callService.isTwoWayVideoCall()&&Y.video&&Y.video.isAllowed)&&(callDOMProc.setOnCameraSwitch(be),callDOMProc.setOnCamClick(Ye),callDOMProc.changeCamIcon(P)),callDOMProc.hideMicShareOverlay(),activityLoggerService.logActivity(activityLoggerService.GIS_ACTIVITY_TYPES.CALL_UI_LOADED);var d={routingKey:stateService.getRoutingKey()};C&&(d.routing=C),eventLoggerService.logEvent(eventLoggerService.GIS_VIEWS.CALL+eventLoggerService.GIS_ACTIONS.SHOWN,d),callDOMProc.displayControls(),serverInjectionService.getSystemConfig().skipMicShare&&setTimeout(function(){otPublisher.getPublisher()||de()},3e3),callDOMProc.setOnMicClick(ve),callDOMProc.setOnSpeakerClick(fe),callDOMProc.setOnEndCallClick(K),callDOMProc.setOnHelpUnblockClick(function(){window.open(u,'_blank')}),V||Ne()}catch(e){logService.error(r,"Exception on server callback, postConnect.",e)}}function K(){M=!0,utilitiesService.isMeeting()&&activityLoggerService.logActivity(activityLoggerService.GIS_ACTIVITY_TYPES.BOOKING_CUSTOMER_LEFT),stateService.setCurrentPhase(stateService.phase.CALL_END),N===GIS_CONSTANTS.CALL_STATUS.CONNECTED&&(activityLoggerService.logActivity(activityLoggerService.GIS_ACTIVITY_TYPES.CALL_DISCONNECTED_BY_CONSUMER),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.CALL_ENDED,{CallEndReason:GIS_CONSTANTS.CALL_END_REASONS.CONSUMER})),N===GIS_CONSTANTS.CALL_STATUS.CONNECTING&&(activityLoggerService.logActivity(activityLoggerService.GIS_ACTIVITY_TYPES.CALL_CONNECTING_CANCELLED),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.CALL_CONNECTING_CANCELLED)),Pe(),callDOMProc.destroyEventListeners(),V=!1}callDOMProc=n?new callScreen(G):callDOMProc,pageUnloadService.registerFunction(function(){switch(N){case GIS_CONSTANTS.CALL_STATUS.CONNECTING:setTimeout(function(){activityLoggerService.logActivity(activityLoggerService.GIS_ACTIVITY_TYPES.CALL_ABORT_BY_CONSUMER),gaService.sendAnalyticsEvent(gaService.ANALYTICS_EVENTS.CALL_ABORTED)},0);break;case GIS_CONSTANTS.CALL_STATUS.CONNECTED:setTimeout(function(){activityLoggerService.logActivity(activityLoggerService.GIS_ACTIVITY_ENDPOINTS.CALL_FINISHED_PAGE_UNLOAD),stateService.getChatInitialized()&&chatLogoutService.logout()},0)}}),window.addEventListener("orientationchange",function(){otPublisher&&otPublisher.getPublisher()&&setTimeout(function(){callDOMProc.changeVideoDimension(callDOMProc.getMainVideoStreamId())},2e3)},!1),overrideService.override(r,t),t.addProductToBasket!==C&&addToCartService.overrideATC(t.addProductToBasket);var F=function(e){N!==GIS_CONSTANTS.CALL_STATUS.CONNECTING||f||(f=!0,utilitiesService.isMeeting()||addAPersonService.isAddAPersonCall()?B(0,stateService.getCallUUID(),0,null,null,0,0,0,null,!0):utilitiesService.isDepartmentCall()?gisService.connectAutoLaunchCall(stateService.getAutoLaunchId(),stateService.getCallUUID(),stateService.getPageMetadata()):gisService.connectCall(stateService.getCallUUID(),stateService.getRoutingKey(),o,stateService.getPageMetadata(),ne()),window.dispatchEvent(new GisCustomEvent("gisCallConnecting")),I.getChild().setConnecting(L,ne()))},J=function(e){"CONSUMER"===JSON.parse(e.stream.connection.data).userType&&stateService.addStreamToConsumerMap(e.stream.connection.id),'camera'===e.stream.videoType&&l++,i++,e&&e.stream&&(e.stream.connection&&(otService.log('streamCreated - connectionId: '+e.stream.connection.connectionId),otService.log('streamCreated - connectionData: '+e.stream.connection.data)),function(e){if(e.connection.connectionId===otSession.getConnection().connectionId)return;var t=callDOMProc.addStream(e),otSubscriber=otSession.subscribe(e,t.id,{showControls:!1,width:"100%",height:"100%"});otSubscriber.setVideoDisableWarningHandler(function(){callDOMProc.showPoorConnectionMessage()}),otSubscriber.setVideoDisableWarningLiftedHandler(function(){callDOMProc.hidePoorConnectionMessage()}),otSubscriber.setVideoDisabledHandler(function(e){'quality'===e.reason&&callDOMProc.showVideoDisabledMessage()}),otSubscriber.setVideoEnabledHandler(function(){callDOMProc.hideVideoDisabledMessage()}),A?otSubscriber.setAudioVolume(0):otSubscriber.setAudioVolume(100);callDOMProc.changeVideoDimension(e.streamId)}(e.stream)),O||(activityLoggerService.logActivity(activityLoggerService.GIS_ACTIVITY_TYPES.CALL_CLERK_STREAM_RECEIVED),eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.CALL_CLERK_STREAM_RECEIVED),O=!0,D&&(activityLoggerService.logActivity(activityLoggerService.GIS_ACTIVITY_ENDPOINTS.CALL_STARTED),pe())),callDOMProc.hideCallStatusDialog(),(utilitiesService.isMeeting()&&bookingService.isTwoWayVideoCallEnabled()||!utilitiesService.isMeeting()&&callService.isTwoWayVideoCall())&&callDOMProc.setupTapToFocus(),callDOMProc.hideCallController(),callDOMProc.setCallControllerAnimation(),callDOMProc.updateConnectionCount(l),Ve(e.stream)},x=function(e){"CONSUMER"===JSON.parse(e.stream.connection.data).userType&&stateService.removeStreamFromConsumerMap(e.stream.connection.id),1<=i&&(callDOMProc.removeVideoWhenClerkLeave(e.stream.id),callDOMProc.changeVideoDimension(callDOMProc.getMainVideoStreamId())),'camera'===e.stream.videoType&&l--,i--,callDOMProc.updateConnectionCount(l)},z=function(e){"hasVideo"===e.changedProperty&&(1Waiting for the host to start call.";var l=document.createElement('div');l.innerHTML="
Please Wait...",l.id='loading-gis-v3-button',l.className='loading-gis-v3-button',l.style.display='flex';var i=document.getElementById('gis-v3-button');i.classList.add('gis-hideAll'),i.classList.add('gis-v3-dc-btn'),e.parentNode.insertBefore(l,e.nextSibling),e.parentNode.insertBefore(t,e.nextSibling)}}function C(){null!==document.getElementById("loading-gis-v3-button")&&document.getElementById('loading-gis-v3-button').remove();null!==document.getElementById("loading-gis-v3-wait-text")&&document.getElementById('loading-gis-v3-wait-text').remove();if(null==document.getElementById("gis-v3-button'")){var e=document.getElementById('gis-v3-button');e.classList.add('gis-v3-dc-btn'),e.classList.remove('gis-hideAll')}}return{init:function(e){var t;e===GIS_CONSTANTS.DIRECT_CALL_TYPE.CLERK_CALL?u():e===GIS_CONSTANTS.DIRECT_CALL_TYPE.DEPARTMENT_CALL&&(t=utilitiesService.getUrlParams().giscallcategory,stateService.setAutoLaunchId(t),pollingService.registerPollingEvent(pollingService.BASE_EVENTS.AUTO_LAUNCH_CALL_POLLING,{poll:gisService.checkAutoLaunchClerkIsAvailable,pollArguments:[t]}),pollingService.subscribe(pollingService.BASE_EVENTS.AUTO_LAUNCH_CALL_POLLING,c,s),pollingService.startPollingEvent(pollingService.BASE_EVENTS.AUTO_LAUNCH_CALL_POLLING))},clerkIsNotAvailable:function(e){try{var t="";if(e&&(t=e.code),t==a)return clearTimeout(l),void callCtrl.startCallJourney({routingKey:null,type:GIS_CONSTANTS.CALL_TYPES.DIRECT,isInvalidUrl:!0});if(t==r)return eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.CALL_USER_BLOCKED,{referrer:document.referrer||""}),void clearTimeout(l);'true'===serverInjectionService.isAutoStartDirectCallEnabled()?(o||d(GIS_CONSTANTS.DIRECT_CALL_TYPE.CLERK_CALL),L()):(o||d(GIS_CONSTANTS.DIRECT_CALL_TYPE.CLERK_CALL),L(),l=setTimeout(u,3e3))}catch(e){n.error(i,"Exception while processing directCall clerkIsNotAvailable Response.",e)}},clerkIsAvailable:function(){o||d(GIS_CONSTANTS.DIRECT_CALL_TYPE.CLERK_CALL);try{'true'!==serverInjectionService.isAutoStartDirectCallEnabled()||utilitiesService.isHttpsPageRedirected()?(C(),l=setTimeout(u,3e3)):callCtrl.initiateCallProcedure()}catch(e){n.error(i,"Exception on directCall server callback, clerkIsAvailable.",e)}},autoLaunchClerkIsAvailable:gisCallbacks.autoLaunchClerkIsAvailable=c,autoLaunchClerkIsNotAvailable:gisCallbacks.autoLaunchClerkIsNotAvailable=s}};GISAPP.embedCtrl=function(broadcastCtrl,chatInputDOMProc,stateService,overrideService,uiUtilitiesService,globalObjectService,pollingService){var a,s,n,e={},i=!1;e.LOGTAG='embedCtrl';var t="";function d(){globalObjectService.getWindow().dispatchEvent(new GisCustomEvent('GisBroadcastEnded',{detail:{broadcastView:s,chatView:n}}))}return e.init=function(){pollingService.subscribe(pollingService.BASE_EVENTS.BROADCAST_POLLING,function(){},function(){}),pollingService.startPollingEvent(pollingService.BASE_EVENTS.BROADCAST_POLLING),s=broadcastCtrl.getBroadcastView(),n=chatInputDOMProc.render(),uiUtilitiesService.addClass(s.querySelector('#gis-broadcast-video'),'gis-embed'),uiUtilitiesService.addClass(s.querySelector('.gis-modal-content.broadcast-video'),'gis-embed'),uiUtilitiesService.addClass(s,'gis-embed'),uiUtilitiesService.addClass(n,'gis-embed'),globalObjectService.getWindow().addEventListener("gisUIClosed",function(e){stateService.setUIActive(!1),stateService.getCurrentPhase()!==stateService.phase.IN_CALL&&stateService.getCurrentPhase()!==stateService.phase.CALL_END&&(stateService.setCallUUID(a.callUUID),stateService.setCurrentPhase(t)),broadcastCtrl.playVideo()}),globalObjectService.getWindow().addEventListener("gisUIOpen",function(e){stateService.setUIActive(!0),broadcastCtrl.pauseVideo(),stateService.getCurrentPhase()!==stateService.phase.IN_CALL&&stateService.getCurrentPhase()!==stateService.phase.CALL_END&&(stateService.setCallUUID(null),t=stateService.getCurrentPhase(),stateService.setCurrentPhase(stateService.phase.EMBED_CALL_INITIATED))})},e._isEmbed=function(){return!1},overrideService.override(e.LOGTAG,e),{init:e.init,isEmbed:e._isEmbed,startBroadcast:function(e){var t=e.broadcasts;0!==t.length&&(a=function(e){for(var t=0;t"};function V(e){w=e.chatOnlyCall&&e.chatOnlyCall.enabled||!1,v=function(){{if(callService.isShopStreamCallEnabled()){l=new baseCallLayoutComponent,L=new baseShopStreamLayoutComponent({player:l.render()}),c=L.render();var e=new productPopupComponent({type:null,payload:null,popUpContainer:c.querySelector('#gis-ss-player-popup')});return eventService.subscribe(GIS_CONSTANTS.EVENT_NAMES.SHOW_PRODUCT_DETAILS_POPUP,e.triggerDetailsPopup),w&&uiUtilitiesService.addClass(c.querySelector('#gis-ss-left-pane'),'gis-hide'),c}return uiUtilitiesService.processView(serverInjectionService.getViews().callScreenView)}}(),i=callService.getElementReference(v,'#gis-std-call-view'),r=callService.getElementReference(v,'#gis-cs-signal-container'),function(){t.switchToFullScreen=de,t.switchToNormalScreen=ue,callService.isShopStreamCallEnabled()&&(t.controlLess=!0);n=new standardCallComponent(t),i.appendChild(n.render()),callService.isShopStreamCallEnabled()&&l.setBottomControls(n.getControlsView())}(),function(){if(!function(){if(w)return!0;if(deviceInfoService.isMobileDevice()&&callService.isShopStreamCallProductCarouselEnabled())return!0;return!1}())return;var e=v.querySelector('#gis-ss-right-pane'),t=uiUtilitiesService.processView(serverInjectionService.getViews().shopStreamChatCarouselToggle);Y(t),e.insertBefore(t,e.firstChild),W()?function(){if(!deviceInfoService.isMobileDevice()&&!w||deviceInfoService.isIPad()&&!w||!callService.isShopStreamCallEnabled()||!callService.isShopStreamCallProductCarouselEnabled()||!callService.isInCallChatEnabled())return;T=!0;var e=v.querySelector('#gis-ss-right-pane');uiUtilitiesService.addClass(e,'gis-toggle-enabled');var t=v.querySelector('#gis-ss-rightpane-header');!deviceInfoService.isMobileDevice()&&w||Y(t);var i=t.querySelector('#gis-ss-chat-tab');i.querySelector('#gis-ss-tab-text-chat').innerHTML=serverInjectionService.getLabels().oto_chat_toggle_label;var n=t.querySelector('#gis-ss-carousel-tab'),s=n.querySelector('#gis-ss-tab-text-carousel');s.innerHTML=serverInjectionService.getLabels().oto_carousel_toggle_label+' ',s.innerHTML=s.innerHTML+'('+(carouselService.getTiles().length-1)+')',carouselService.addTileToCarouselCallback(function(){s.querySelector('#gis-ss-carousel-count').innerHTML='('+(carouselService.getTiles().length-1)+')'}),e.insertBefore(t,e.firstChild),n.onclick=J,i.onclick=z}():uiUtilitiesService.addClass(t.querySelector('#gis-ss-wrapper-tab'),'gis-ss-hide')}(),callService.isShopStreamCallEnabled()&&(!function(){callService.isShopStreamCallProductCarouselEnabled()&&(g=new controlButtonComponent({config:{states:{on:{image:' ',onclick:function(){deviceInfoService.isMobileDevice()&&!deviceInfoService.isIPad()?se('carousel','carousel'):L.showLeftBottomContainer(),l.updateControlType("normal"),eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.PRODUCT_CAROUSEL_OPENED)},stateTransition:"off",style:"background: rgba(255, 255, 255, 0.63); border-radius: 25px; width: 40px; height: 40px; padding: 10px; order:2"},off:{image:' ',onclick:function(){deviceInfoService.isMobileDevice()&&!deviceInfoService.isIPad()||L.hideLeftBottomContainer(),l.updateControlType("compact"),eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.PRODUCT_CAROUSEL_HIDDEN)},stateTransition:"on",style:"order: 2"}},order:2,defaultState:"off"}}),(u=g.render()).setAttribute('id','gis-shop-stream-carousel-control'),l.addSideControls(u));var e;(utilitiesService.isMeeting()&&(bookingService.isMultiParticipantEnabled()||bookingService.isAddAPersonEnabled())||!utilitiesService.isMeeting()&&callService.isAddAPersonEnabled())&&((e=new controlButtonComponent({config:{states:{on:{image:'',onclick:function(){var e=new productPopupComponent({type:GIS_CONSTANTS.PRODUCT_POPUP_TYPES.CTA,payload:{type:GIS_CONSTANTS.PRODUCT_POPUP_TYPES.CTA_TYPES.ADD_A_PERSON},popUpContainer:c.querySelector('#gis-ss-player-popup'),isMultiParty:utilitiesService.isMeeting()&&bookingService.isMultiParticipantEnabled(),isOneToOneCall:!utilitiesService.isMeeting()});e.render(),eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.ADD_A_PERSON_BUTTON_CLICKED,{isMultiParty:bookingService.isMultiParticipantEnabled(),isAddAPerson:bookingService.isAddAPersonEnabled(),isOneToOneCall:!utilitiesService.isMeeting()})},stateTransition:"on",style:"order: 3"}},order:3,defaultState:"on"}}).render()).setAttribute('id','gis-shop-stream-add-a-person-control'),l.addSideControls(e))}(),callService.isShopStreamCallProductCarouselEnabled()&&(uiUtilitiesService.removeClass(v.querySelector('#gis-ss-carousel-content'),'gis-ss-hide'),S=carouselService.getCarouselComponentView({scrollEvent:eventLoggerService.GIS_EVENTS.PRODUCT_CAROUSEL_SCROLLED}),carouselService.updateOrientation("horizontal","horizontal"),uiUtilitiesService.addClass(S.querySelector('#gis-slider-content-container'),"gis-slider-x-scroll"),carouselService.addTileToCarousel({customTile:!0,image:'',title:serverInjectionService.getLabels().product_tile_recommended_label}),L.setupLeftBottomContainer(S),carouselService.addTileToCarouselCallback(function(e,t){if(carouselService.getSliderInstance().slideToEnd(),c.querySelector("#gis-ss-left-bottom-pane").classList.contains('gis-ss-hide')){if(deviceInfoService.isMobileDevice()&&t.isRecommendedByClerk)return;u.click()}}))),uiUtilitiesService.showModal(v),w&&function(e){uiUtilitiesService.addClass(v.querySelector('#gis-ss-container'),"gis-chatfirst-call"),deviceInfoService.isMobileDevice()?uiUtilitiesService.addClass(v.querySelector('#gis-ss-container'),"gis-mobile"):(!function(){uiUtilitiesService.addClass(v.querySelector('#gis-ss-chat-close-btn'),'gis-hide');var e=uiUtilitiesService.createElementWithAttributes("div","gis-chatfirst-logo-header","gis-chatfirst-logo-header","background-image: "+uiUtilitiesService.getImageUrl("retailer-logo-dark.png"));v.querySelector('#gis-ss-header-content').append(e)}(),function(){var e=uiUtilitiesService.createElementWithAttributes("div","gis-chatfirst-callendcta","gis-chatfirst-callendcta");e.innerHTML=D.CLOSE_DESKTOP,e.onclick=k;var t=serverInjectionService.getUiConfig();t.theme&&(e.style.background=t.theme.mainColor);v.querySelector('#gis-ss-container').append(e)}(),uiUtilitiesService.addClass(v.querySelector('#gis-ss-right-pane'),'gis-chatFirstCall-compact-view'),uiUtilitiesService.addClass(v.querySelector('.gis-shop-stream-mobile-view'),'gis-row-full-width'),uiUtilitiesService.removeClass(v.querySelector('.gis-shop-stream-mobile-view'),'gis-shop-stream-row-compact'));callService.isShopStreamCallProductCarouselEnabled()&&j();(function(e){var t=uiUtilitiesService.createElementWithAttributes("div","gis-start-call-cta-label","gis-start-call-cta-label");t.innerHTML=serverInjectionService.getLabels().chat_to_call_transition_cta_label,v.querySelector('#gis-ss-start-call-btn').append(t);var i=Z(),n=serverInjectionService.getUiConfig();n.theme&&(v.querySelector('#gis-ss-start-call-btn').style.background=n.theme.mainColor);v.querySelector('#gis-ss-start-call-btn').append(i),te(),se('chat','chat'),'function'==typeof e.chatOnlyCall.startCallOnClick&&(v.querySelector("#gis-ss-start-call-btn").onclick=function(){f||function(e){if(M===O.START_CALL)return;M!==O.NONE&&x();clearTimeout(m);var t=eventLoggerService.GIS_VIEWS.CHAT_CALL_START_POPUP,i=new popup({type:GIS_CONSTANTS.POPUP_TYPE.START_CALL_PROMPT,position:'center',backgroundClass:'gis-chat-inactivity-notification-bg',popupContent:{image:Z(),mainText:serverInjectionService.getLabels().chat_to_call_transition_popup_title,subMainText:serverInjectionService.getLabels().chat_to_call_transition_popup_subtitle,primaryBtn:{label:serverInjectionService.getLabels().chat_to_call_transition_popup_primary_btn_label,onclick:function(){eventService.unsubscribe(GIS_CONSTANTS.EVENT_NAMES.CHAT_INACTIVITY_TIMEOUT_REACHED,H),eventService.unsubscribe(GIS_CONSTANTS.EVENT_NAMES.CHAT_INACTIVITY_TIMEOUT_CLEARED,R),clearTimeout(m),e.chatOnlyCall.startCallOnClick(),uiUtilitiesService.removeNode(v.querySelector('#gis-popup-wrapper')),M=O.NONE},eventName:t+"_START_CALL_BUTTON"},secondaryBtn:{label:serverInjectionService.getLabels().chat_to_call_transition_popup_secondary_btn_label,onclick:x,eventName:t+"_CANCEL_BUTTON"}}});eventLoggerService.logEvent(t+eventLoggerService.GIS_ACTIONS.SHOWN),v.querySelector('#gis-ss-container').append(i.render()),M=O.START_CALL}(e)})})(e),v.querySelector('#gis-ss-wrapper-content').style.removeProperty('height'),v.querySelector('#gis-ss-container').append(v.querySelector('#gis-ss-player-popup')),eventService.subscribe(GIS_CONSTANTS.EVENT_NAMES.COMETCHAT_LOGGED_IN,q)}(e),deviceInfoService.isMobileDevice()&&uiUtilitiesService.addClass(v.querySelector('#gis-ss-container'),"gis-mobile"),e.isArchivingEnabled?n.showRecordingTooltip():n.hideRecordingTooltip(),n.setUserProfileInfo({userDisplayName:o,userImageName:a}),B(),eventService.subscribe(GIS_CONSTANTS.EVENT_NAMES.CHAT_INACTIVITY_TIMEOUT_REACHED,H),eventService.subscribe(GIS_CONSTANTS.EVENT_NAMES.CHAT_INACTIVITY_TIMEOUT_CLEARED,R)}function q(e){var t=v.querySelector("iframe");null===(E=t.contentWindow.document.querySelector(".main__chat .chat__header"))?(!e||e<60)&&setTimeout(q.bind(null,e?e+1:1),250):E.style.display="none"}function U(){w=!1,uiUtilitiesService.removeClass(v.querySelector('#gis-ss-container'),"gis-chatfirst-call"),uiUtilitiesService.removeClass(v.querySelector('#gis-ss-right-pane'),'gis-chatFirstCall-compact-view'),uiUtilitiesService.removeClass(v.querySelector('.gis-shop-stream-mobile-view'),'gis-row-full-width'),uiUtilitiesService.addClass(v.querySelector('.gis-shop-stream-mobile-view'),'gis-shop-stream-row-compact'),v.querySelector('#gis-ss-player-view').append(v.querySelector('#gis-ss-player-popup')),deviceInfoService.isMobileDevice()||(E.style.display="flex",v.querySelector('#gis-ss-header-content').style.display="none",uiUtilitiesService.removeClass(v.querySelector('#gis-ss-right-pane'),'gis-toggle-enabled'),callService.isShopStreamCallProductCarouselEnabled()&&X())}function H(){if(M!==O.CHAT_INACTIVITY){M!==O.NONE&&x();var e=eventLoggerService.GIS_VIEWS.CHAT_CALL_INACTIVITY_POPUP,t=new popup({type:GIS_CONSTANTS.POPUP_TYPE.CHAT_INACTIVITY_PROMPT,position:'center',backgroundClass:'gis-chat-inactivity-notification-bg',popupContent:{mainText:serverInjectionService.getLabels().chat_inactivity_popup_title,subMainText:serverInjectionService.getLabels().chat_inactivity_popup_subtitle,primaryBtn:{label:serverInjectionService.getLabels().chat_inactivity_popup_primary_button_label,onclick:G.bind(null,!1),eventName:e+"_CALL_LEAVE_BUTTON"},secondaryBtn:{label:serverInjectionService.getLabels().chat_inactivity_popup_secondary_button_label,onclick:R,eventName:e+"_CANCEL_BUTTON"}}});eventLoggerService.logEvent(e+eventLoggerService.GIS_ACTIONS.SHOWN),v.querySelector('#gis-ss-container').append(t.render()),M=O.CHAT_INACTIVITY,m=setTimeout(G.bind(null,!0),1e3*P)}}function R(){clearTimeout(m),x()}function k(){if(M!==O.END_CALL){M!==O.NONE&&x();var e=eventLoggerService.GIS_VIEWS.CHAT_END_CALL_POPUP,t=new popup({type:GIS_CONSTANTS.POPUP_TYPE.END_CALL_PROMPT,position:'center',backgroundClass:'gis-chat-inactivity-notification-bg',popupContent:{image:Z(),mainText:serverInjectionService.getLabels().end_call_popup_title,subMainText:serverInjectionService.getLabels().end_call_popup_subtitle,primaryBtn:{label:serverInjectionService.getLabels().end_call_popup_primary_btn_label,onclick:function(){G(!1),uiUtilitiesService.removeNode(v.querySelector('#gis-popup-wrapper')),M=O.NONE},eventName:e+"_LEAVE_CALL_BUTTON"},secondaryBtn:{label:serverInjectionService.getLabels().end_call_popup_secondary_btn_label,onclick:function(){x()},eventName:e+"_CANCEL_BUTTON"}}});eventLoggerService.logEvent(e+eventLoggerService.GIS_ACTIONS.SHOWN),v.querySelector('#gis-ss-container').append(t.render()),M=O.END_CALL}}function x(){uiUtilitiesService.removeNode(v.querySelector('#gis-popup-wrapper')),M===O.START_CALL?eventLoggerService.logEvent(eventLoggerService.GIS_VIEWS.CHAT_CALL_START_POPUP+eventLoggerService.GIS_ACTIONS.CLOSED):M===O.INCOMING_CALL?eventLoggerService.logEvent(eventLoggerService.GIS_VIEWS.INCOMING_CALL_PROMPT+eventLoggerService.GIS_ACTIONS.CLOSED):M===O.CHAT_INACTIVITY&&eventLoggerService.logEvent(eventLoggerService.GIS_VIEWS.CHAT_CALL_INACTIVITY_POPUP+eventLoggerService.GIS_ACTIONS.CLOSED),M=O.NONE}function Z(){var e=serverInjectionService.getUiConfig(),t=new ctaComponent({ctaMode:"humanized",position:"right",roundelColor:e.theme&&e.theme.mainColor,roundelImage:"cta-logo.png",isCtaOnBroadcast:!0,isFloater:!0,shopStream:!0}).render();return uiUtilitiesService.addClass(t.querySelector("#gis-cta"),"gis-circle-animate-show"),t}function G(e){R(),$(),t.onLeaveButtonClick(),e&&(eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.CALL_ENDED_DUE_TO_CONSUMER_INACTIVITY),activityLoggerService.logActivity(activityLoggerService.GIS_ACTIVITY_TYPES.CALL_ENDED_DUE_TO_CONSUMER_INACTIVITY))}function B(){stateService.getInputAlignment()===GIS_CONSTANTS.INPUT_ALIGNMENT.RTL&&uiUtilitiesService.addClass(v.querySelector('#gis-cs-user-form-input'),'gis-rtl')}function W(){return(deviceInfoService.isMobileDevice()||w)&&callService.isShopStreamCallProductCarouselEnabled()&&callService.isInCallChatEnabled()}function Y(e){e.querySelector('#gis-ss-chat-close-btn').onclick=function(){w?k():T?W()?se(!1,!1):se(!1,'chat'):'off'===g.getCurrentState().stateTransition?se(!1,'carousel'):(g.updateState(null,"off"),se(!1,'chat'))}}function F(){uiUtilitiesService.removeClassOnList(v.querySelectorAll('.gis-ss-rightpane-tab'),'gis-ss-active-tab'),uiUtilitiesService.removeClass(v.querySelector('#gis-ss-right-pane'),'gis-ss-chat-active'),uiUtilitiesService.removeClass(v.querySelector('#gis-ss-right-pane'),'gis-ss-carousel-active'),''}function z(){F(),uiUtilitiesService.addClass(v.querySelector('.gis-ss-chat-tab'),'gis-ss-active-tab'),uiUtilitiesService.addClass(v.querySelector('#gis-ss-right-pane'),'gis-ss-chat-active'),'chat',C&&C()}function J(){F(),uiUtilitiesService.addClass(v.querySelector('.gis-ss-carousel-tab'),'gis-ss-active-tab'),uiUtilitiesService.addClass(v.querySelector('#gis-ss-right-pane'),'gis-ss-carousel-active'),'carousel'}function K(e){e.match(/landscape/)?uiUtilitiesService.addClass(c.querySelector("#gis-ss-left-bottom-pane"),'gis-ss-hide'):uiUtilitiesService.removeClass(c.querySelector("#gis-ss-left-bottom-pane"),'gis-ss-hide'),carouselService.refresh()}function j(){v.querySelector('.gis-ss-carousel-content').appendChild(S),carouselService.updateOrientation('mobile','horizontal mobile'),uiUtilitiesService.removeClass(S.querySelector('#gis-slider-content-container'),"gis-slider-x-scroll"),carouselService.refresh()}function X(){L.setupLeftBottomContainer(S),carouselService.updateOrientation('horizontal','horizontal'),uiUtilitiesService.addClass(S.querySelector('#gis-slider-content-container'),"gis-slider-x-scroll"),carouselService.refresh()}function Q(){}function $(){globalObjectService.getWindow().removeEventListener('messageReceived',ie),T=!1,n.destroy(),uiUtilitiesService.removeNode(v),uiUtilitiesService.hideModal()}function ee(e){return'none'===globalObjectService.getWindow().getComputedStyle(e).display}var te=utilitiesService.callOncePerSession(function(){callService.isInCallChatEnabled()&&(callService.isShopStreamCallEnabled()?(uiUtilitiesService.removeClass(v.querySelector('#gis-ss-chat-content'),"gis-ss-hide"),(d=(N=new controlButtonComponent({config:{states:{on:{image:' ',onclick:function(){b=0,d.setAttribute('data-counter',b),uiUtilitiesService.removeClass(d,'gis-counter'),se('chat','chat')},stateTransition:"off",style:"background: rgba(255, 255, 255, 0.63); border-radius: 25px; width: 40px; height: 40px; padding: 10px; order:1"},off:{image:' ',onclick:function(){uiUtilitiesService.removeClass(d,'gis-counter'),se(!1,'chat')},stateTransition:"on",style:"order: 1"}},order:1,defaultState:"off"}})).render()).setAttribute('id',"gis-shop-stream-chat-control"),globalObjectService.getWindow().addEventListener("messageReceived",ie),l.addSideControls(d),le()):function(){var e=v.querySelector('#gis-cs-container');e.style.display='flex',e.style['flex-direction']='row';var t=uiUtilitiesService.createElementWithAttributes('img','','init-chat-icon');t.src=uiUtilitiesService.getImageUrl('init_chat_icon.png',!0);var i=uiUtilitiesService.createElementWithAttributes('div',I,I);i.append(t),callService.getElementReference(v,'#gis-cs-right-pane').style.display='none';var n=uiUtilitiesService.createElementWithAttributes('span',A,A,'display: none');i.append(n),v.querySelector('#gis-cs-left-pane').append(i),le()}(),B())},stateService.getCallUUID);function ie(e){"off"!==N.getCurrentState().stateTransition&&(++b<=9?d.setAttribute('data-counter',b):d.setAttribute('data-counter',y),uiUtilitiesService.addClass(d,'gis-counter'))}var ne=utilitiesService.once(function(){deviceInfoService.isMobileDevice()&&!deviceInfoService.isIPad()&&(L.showLeftBottomContainer(),function(e,t){var i=globalObjectService.getWindow().matchMedia(e);try{i.addEventListener('change',t)}catch(e){try{i.addListener(t)}catch(e){console.error(e)}}return i}("(orientation: portrait)",function(e){e.matches?K('portrait'):K('landscape')}).matches?K('portrait'):K('landscape'))});function se(e,t){e?(uiUtilitiesService.removeClass(c.querySelector(".gis-shop-stream-right-chat-compact"),"gis-rightpane-disabled"),L.showRightContainer(),callService.isShopStreamCallProductCarouselEnabled()&&deviceInfoService.isMobileDevice()&&!deviceInfoService.isIPad()&&j(),'string'==typeof e&&T&&('carousel'===e?v.querySelector('#gis-ss-carousel-tab').click():v.querySelector('#gis-ss-chat-tab').click()),t&&'carousel'===t?g.updateState(null,"on",!0):(C(),N.updateState(null,"on",!0))):('',uiUtilitiesService.addClass(c.querySelector(".gis-shop-stream-right-chat-compact"),"gis-rightpane-disabled"),L.hideRightContainer(),callService.isShopStreamCallProductCarouselEnabled()&&deviceInfoService.isMobileDevice()&&!deviceInfoService.isIPad()&&X(),t&&'carousel'===t?g.updateState(null,"off",!0):t&&'chat'===t?N.updateState(null,"off",!0):(g&&g.updateState(null,"off",!0),N&&N.updateState(null,"off",!0)))}function ae(e){var t=document.querySelector(callService.getElementReference(null,'#gis-cs-right-pane',!0));stateService.getChatInitialized()||(callService.isShopStreamCallEnabled()&&(t=t.querySelector('#gis-ss-chat-content')),chatLoadService.loadChatInIframe(t,ce,e,w||(deviceInfoService.isMobileDevice()||deviceInfoService.isIPad())&&!callService.isShopStreamCallProductCarouselEnabled()&&callService.isInCallChatEnabled()||!deviceInfoService.isMobileDevice()&&!deviceInfoService.isIPad()&&callService.isInCallChatEnabled()),stateService.setChatInitialized(!0)),uiUtilitiesService.show(callService.getElementReference(null,'#gis-cs-right-pane',!0).replace("#",""))}function oe(e,t,i,n,s,a){var o=v.querySelector('.'+I);GIS_CONSTANTS.CHAT.CURRENT_NUM_OF_USERS<=GIS_CONSTANTS.CHAT.MAX_NUM_OF_USERS?(C=function(e,t,i,n,s,a){eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.ONE_TO_ONE_CHAT_BUTTON_CLICKED),GISAPP.chatUserNameService.isNameConfigured()?ae(!1):GISAPP.chatUserNameService.openEnterUserForm(e,t,i,n,s,null,a,ce,!1,w),eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.CHAT_SHOWN_ON_ONE_TO_ONE)}.bind(null,e,t,i,n,s,a),o&&(o.onclick=C)):o.addEventListener('click',re)}function le(e){var o=callService.getElementReference(v,'#gis-cs-right-pane');v.querySelector('#gis-user-title')||(o.querySelector('.gis-ss-chat-content')?o.querySelector('.gis-ss-chat-content'):o).appendChild((new chatUserFormComponent).render());var t,i,n,s,a,l=o.getAttribute('id'),r=v.querySelector('#gis-user-title'),c=v.querySelector('#gis-user-secondary-title'),C=v.querySelector('#gis-cs-user-error-msg'),d=v.querySelector('#gis-cs-user-form-input'),u=v.querySelector('#gis-cs-submit-user-form-btn'),g=v.querySelector('.'+I),p=v.querySelector('#gis-cs-user-form-container').getAttribute('id'),h=u.getAttribute('id'),S=d.getAttribute('id'),_=C.getAttribute('id'),m=g?g.getAttribute('id'):null,E=serverInjectionService.getLabels().chat_userName_title,T=serverInjectionService.getLabels().chat_userName_instructions,f=serverInjectionService.getLabels().chat_userName_firstInput,b=serverInjectionService.getLabels().chat_joinChat_button,y=serverInjectionService.getLabels().chat_userName_secondary_title;r.innerHTML=E,c.innerHTML=y,C.innerHTML=T,u.innerHTML=b,d.innerHTML='',d.setAttribute("data-placeholder",f),callService.isShopStreamCallEnabled()||globalObjectService.getWindow().addEventListener('messageReceived',function(e){var t,i,n,s,a;e.detail[0].sender.uid!==stateService.getCallUserUUID()&&(t=e,i=A,n=o,s=v.querySelector('#'+A),a=0,ee(n)&&ee(s)&&uiUtilitiesService.show(i,'flex'),t.detail.forEach(function(e){'text'===e.type&&a++}),s.innerHTML=a)}),e?(t=l,i=p,n=h,s=S,a=_,callService.isShopStreamCallEnabled()&&(L.showRightContainer(),N.updateState(N.states,"on",!0)),GISAPP.chatUserNameService.isNameConfigured()?ae(!0):GISAPP.chatUserNameService.openEnterUserForm(t,i,n,s,null,"signal:CHAT_INITIATED",a,ce,!1,w)):oe(l,p,h,S,m,_)}function re(){logService.debug(e,'Amount of users reached its limitations')}function ce(){stateService.getChatInitialized()&&(callService.isShopStreamCallEnabled()?d?d.onclick():document.getElementById("gis-shop-stream-chat-control").onclick():uiUtilitiesService.hide(callService.getElementReference(null,'#gis-cs-right-pane',!0).replace("#",""))),callService.isShopStreamCallEnabled()||(uiUtilitiesService.show(I,'flex'),uiUtilitiesService.hide(A),stateService.setUpdateMessageId(!0))}function Ce(e,t){a=e,o=t}function de(){callService.isShopStreamCallEnabled()?L.showFullScreen():(v.querySelector('#gis-cs-left-pane').style.width='100%',v.querySelector('#gis-cs-left-pane').style.height='100%',v.querySelector('#gis-cs-container').classList.add('fullScreen-pane')),globalObjectService.getWindow().dispatchEvent(new GisCustomEvent(GIS_CONSTANTS.CALLSCREEN_MODE.GIS_CHAT_FULL_SCREEN))}function ue(){callService.isShopStreamCallEnabled()?L.hideFullScreen():(v.querySelector('#gis-cs-left-pane').style.removeProperty('width'),v.querySelector('#gis-cs-left-pane').style.removeProperty('height'),v.querySelector('#gis-cs-container').classList.contains('fullScreen-pane')&&v.querySelector('#gis-cs-container').classList.remove('fullScreen-pane')),globalObjectService.getWindow().dispatchEvent(new GisCustomEvent(GIS_CONSTANTS.CALLSCREEN_MODE.GIS_CHAT_NORMAL_SCREEN))}function ge(){p.updateState(null,"off",!0)}return{render:V,show:function(e){V(e)},hide:$,enableChat:ae,setOnMicClick:Q,setOnSpeakerClick:Q,setOnEndCallClick:Q,setOnHelpUnblockClick:Q,changeMicIcon:Q,changeSpeakerIcon:Q,setupClerkProfile:Ce,updateMessage:Q,hideMicShareOverlay:Q,displayControls:Q,disableChat:ce,enableControlSlide:Q,updateOverlayTo:Q,overlayStages:Q,showNoVideoImage:function(e){n.showNoVideoImage(e)},hideNoVideoImage:function(e){n.hideNoVideoImage(e)},showReconnectingMessage:function(){n.showReconnectingMessage()},showDisconnectedMessage:function(e){n.showDisconnectedMessage(e)},updateCallScreenOverlayStatus:function(){n.updateCallScreenOverlayStatus()},hideCallStatusDialog:function(){n.hideCallStatusDialog()},setPublishedVideo:function(e){return n.addVideo(e)},disableCamMuteMuteBtn:Q,setOnCamClick:function(){n.setCameraToggle()},setOnCameraSwitch:function(){n.setOnCameraSwitch()},changeCamIcon:Q,setupTapToFocus:Q,hideCallController:Q,setCallControllerAnimation:Q,destroyEventListeners:Q,showRecordingTooltip:function(){n&&n.showRecordingTooltip()},hideRecordingTooltip:function(){n&&n.hideRecordingTooltip()},updateConnectionCount:function(e){n.updateConnectionCount(e)},hideVideoOfClerk:Q,showVideoOfClerk:Q,addStream:function(e){w||te(),globalObjectService.getWindow().dispatchEvent(new GisCustomEvent(GIS_CONSTANTS.CALLSCREEN_MODE.NORMAL_SCREEN));var t=JSON.parse(e.connection.data);return t.isIVREnabled&&function(e){if(_=v.querySelector('#gis-dial-pad-main-container'),uiUtilitiesService.hasChildNodes(_))s.showDialPad();else if(s=new dialPadComponent({resetDialPadZIndex:function(){_.style.zIndex='1'},sessionId:stateService.getSessionId(),connectionId:e,onCloseCallback:callService.isShopStreamCallEnabled()?ge:Q}),_.style.display='block',_.style.zIndex='11',_.appendChild(s.render()),callService.isShopStreamCallEnabled())p=new controlButtonComponent({config:{states:{on:{image:' ',onclick:function(){s.showDialPad(),_.style.display='block',_.style.zIndex='11',uiUtilitiesService.addClass(i,'gis-ivrActive')},stateTransition:"off",style:"background: rgba(255, 255, 255, 0.63); border-radius: 25px; width: 40px; height: 40px; padding: 10px;"},off:{image:' ',onclick:function(){s.hideDialPad(),_.style.display='none',_.style.zIndex='1',uiUtilitiesService.removeClass(i,'gis-ivrActive')},stateTransition:"on"}},order:20,defaultState:"on"}}),(h=p.render()).setAttribute('id','gis-shop-stream-ivr-control'),l.addSideControls(h);else{var t=v.querySelector('#gis-dial-pad-icon');t.style.display='flex',t.onclick=function(){s.showDialPad(),_.style.zIndex='11',uiUtilitiesService.addClass(i,'gis-ivrActive')}}}(e.connection.connectionId),"CLERK"===t.userType&&t.publisher?(Ce(t.publisher.imgName,t.publisher.displayName),n.setUserProfileInfo({userDisplayName:o,userImageName:a})):"CONSUMER"===t.userType&&(Ce(null,n.getDisplayNameFromStream(e)),n.setUserProfileInfo({userDisplayName:n.getDisplayNameFromStream(e),userImageName:null})),n.addStream(e)},getMainVideoStreamId:function(){return n.getMainVideoStreamId()},removeVideoWhenClerkLeave:function(e){n.removeVideoWhenClerkLeave(e)},changeVideoDimension:function(e){n.changeVideoDimension(e)},setSubscriberVideoState:Q,showSignalMessage:function(e,t,i){var n=JSON.parse(e.data),s=JSON.parse(e.from.data).publisher,a={data:n,onAccept:t,onReject:i,exit:function(){r.style.display='none',r.innerHTML=''},clerkImageURL:uiUtilitiesService.getClerkImageUrl(s.imgName||'clerk-default'),clerkName:s.displayName};if(callService.isShopStreamCallEnabled()&&callService.isShopStreamCallProductCarouselEnabled())a.type=GIS_CONSTANTS.PRODUCT_POPUP_TYPES.CTA_TYPES.SHARED,a.data.id=a.data.productCode,a.data.onAccept=a.onAccept,new productPopupComponent({type:GIS_CONSTANTS.PRODUCT_POPUP_TYPES.CTA,payload:a,popUpContainer:c.querySelector('#gis-ss-player-popup')}).render(),ne();else{var o=new addToBasketRequestComponent(a);if(r.innerHTML='',r.appendChild(o.render()),callService.isShopStreamCallEnabled()&&!callService.isShopStreamCallProductCarouselEnabled()){var l=r.children[0];uiUtilitiesService.addClass(l,"gis-ss-carousel-prompt"),l.style.background="white",l.style.height="auto",l.style.padding="15px 0",l.style.top="0",l.style.display="flex",l.style.flexDirection="column",l.style.bottom="auto",uiUtilitiesService.removeClass(r,"gis-ss-hide")}else r.style.animation='1s gis-call-signal-container-show forwards';r.style.display='block'}},showAssistantIsJoining:function(){n.showAssistantIsJoining()},showConnectingToLobby:function(){n.showConnectingToLobby()},showWaitingForAssistant:function(){n.showWaitingForAssistant()},setCallStatus:function(e){n.setCallStatus(e)},showPoorConnectionMessage:function(){n.showPoorConnectionMessage()},showVideoDisabledMessage:function(){n.showVideoDisabledMessage()},hideVideoDisabledMessage:function(){n.hideVideoDisabledMessage()},hidePoorConnectionMessage:function(){n.hidePoorConnectionMessage()},checkChatInitiationType:le,addRecommendedProduct:function(e){if(callService.isShopStreamCallEnabled()&&callService.isShopStreamCallProductCarouselEnabled()&&(carouselService.addTileToCarousel(e),deviceInfoService.isMobileDevice())){var t=carouselService.getTileFromCarousel(e.productCode).render();t&&(new productPopupComponent({type:GIS_CONSTANTS.PRODUCT_POPUP_TYPES.INFO,payload:{type:GIS_CONSTANTS.PRODUCT_POPUP_TYPES.INFO_TYPES.CAROUSEL_PROMPT},popUpContainer:c.querySelector('#gis-ss-player-popup'),productTile:t}).render(),ne())}},showAVCallView:function(){M!==O.NONE&&x(),uiUtilitiesService.removeClass(c.querySelector('#gis-ss-left-pane'),'gis-hide'),v.querySelector("#gis-ss-start-call-btn").style.display='none',ce(),U()},showIncomingCallPopUp:function(e,t){if(M!==O.INCOMING_CALL){M!==O.NONE&&x(),f=!0,clearTimeout(m);var i=eventLoggerService.GIS_VIEWS.CHAT_INCOMING_CALL_POPUP,n=new popup({type:GIS_CONSTANTS.POPUP_TYPE.INCOMING_CALL_PROMPT,position:'center',backgroundClass:'gis-chat-inactivity-notification-bg',popupContent:{image:Z(),mainText:serverInjectionService.getLabels().incoming_call_popup_title,primaryBtn:{label:serverInjectionService.getLabels().incoming_call_popup_primary_btn_label,onclick:function(){f=!1,eventService.unsubscribe(GIS_CONSTANTS.EVENT_NAMES.CHAT_INACTIVITY_TIMEOUT_REACHED,H),eventService.unsubscribe(GIS_CONSTANTS.EVENT_NAMES.CHAT_INACTIVITY_TIMEOUT_CLEARED,R),e(),uiUtilitiesService.removeNode(v.querySelector('#gis-popup-wrapper')),M=O.NONE},eventName:i+"_ACCEPT_CALL_BUTTON"},secondaryBtn:{label:serverInjectionService.getLabels().incoming_call_popup_secondary_btn_label,onclick:function(){f=!1,t(),x()},eventName:i+"_DECLINE_BUTTON"}}});eventLoggerService.logEvent(i+eventLoggerService.GIS_ACTIONS.SHOWN),v.querySelector('#gis-ss-container').append(n.render()),M=O.INCOMING_CALL}},showCallDeclinedNotification:function(){var e=eventLoggerService.GIS_VIEWS.CHAT_OUTGOING_CALL_DECLINED;deviceInfoService.isMobileDevice()?function(e){M!==O.NONE&&x(),clearTimeout(m);var t=new toastComponent({description:serverInjectionService.getLabels().call_declined_toast_message});v.querySelector('#gis-ss-container').append(t.render()),t.show()}():function(e){if(M!==O.CALL_DECLINED){M!==O.NONE&&x(),clearTimeout(m);var t=new popup({type:GIS_CONSTANTS.POPUP_TYPE.OUTGOING_CALL_DECLINED,position:'center',backgroundClass:'gis-chat-inactivity-notification-bg',popupContent:{mainText:serverInjectionService.getLabels().call_declined_popup_title,subMainText:serverInjectionService.getLabels().call_declined_popup_text,primaryBtn:{label:serverInjectionService.getLabels().call_declined_popup_primary_btn_label,onclick:function(){uiUtilitiesService.removeNode(v.querySelector('#gis-popup-wrapper')),M=O.NONE},eventName:e+"_CALL_DECLINED_POPUP_BUTTON"}}});v.querySelector('#gis-ss-container').append(t.render()),M=O.CALL_DECLINED}}(e),eventLoggerService.logEvent(e+eventLoggerService.GIS_ACTIONS.SHOWN)},revertChatFirstCallLayout:U}}};GISAPP.connectingScreen=function(systemInfoService,logService,gisService,uiUtilitiesService,serverInjectionService,deviceInfoService,validationUtilitiesService,eventLoggerService,emailSubmitComponent,buttonComponent,stateService,overrideService,modalVideoComponent,modalContentComponent,bookingService){return function(t){'use strict';var o={};function n(e,n,t){o.components.contentContainer.subviews.connectingFooter.style.display='none',uiUtilitiesService.appendView(o.components.contentContainer.subviews.contentContainer,t),o.components.contentContainer.subviews.mainText.innerHTML=e,o.components.contentContainer.subviews.secondaryText.innerHTML=n}return o.components={},o.LOGTAG="connectingScreen",o.props=t,o.serverInjectionService=serverInjectionService,o.labels=o.serverInjectionService.getLabels(),o.awaitingPhase=!1,o.isNoClerkAvailableShown=!1,o.isSubmissionInProgress=!1,o.connectingVideo="/connecting.mp4",o.EVENT_LOGTAG=eventLoggerService.GIS_VIEWS.CONNECTING,o.render=function(){return o.isNoClerkAvailableShown=!1,o.view=uiUtilitiesService.processView(" ",{},!0),o.videoContainer=new modalVideoComponent({video:o.connectingVideo}),o.components.videoContainer=o.videoContainer.render(),uiUtilitiesService.appendView(o.view,o.components.videoContainer),o.components.contentContainer=new modalContentComponent({enterAnimation:"fullscreen",mainText:{text:o.labels.connecting_v2_mainText1},connectingScreenDisclaimerText:o.labels.connectingScreen_v2_disclaimer}),uiUtilitiesService.appendView(o.view,o.components.contentContainer.render()),uiUtilitiesService.addClass(o.components.contentContainer.subviews.connectingFooter,'gis-connectingv3-footer'),uiUtilitiesService.removeClass(o.components.contentContainer.subviews.connectingFooter,'gis-hide'),t.hideFooter&&t.hideFooter(),t.extendOnClose(o._hide),o.components.contentContainer.subviews.mainText.style.fontWeight="400",o.components.contentContainer.subviews.mainText.style.fontSize="16px",o.components.contentContainer.subviews.mainText.style.fontStyle="normal",o.components.contentContainer.subviews.mainText.style.lineHeight="19px",o.components.contentContainer.subviews.mainText.style.letterSpacing="0px",o.components.contentContainer.subviews.mainText.style.textAlign="center",deviceInfoService.isMobileDevice()&&(o.components.videoContainer.style.width="100vw",o.components.contentContainer.subviews.content.style.bottom="0"),setTimeout(function(){o.components.videoContainer.style.display="block"},2e3),setTimeout(function(){o.components.contentContainer.subviews.mainText.style.animation="1s gis-fade-out forwards",setTimeout(function(){t.extraProps&&t.extraProps.noClerkAvailable?o._setNoClerkAvailableUI():(o.awaitingPhase=!0,o._setConnectingUI(),o.components.contentContainer.setup({mainText:t.extraProps.isChatFirstCall?{text:o.labels.connecting_v2_chatText}:{text:o.labels.connecting_v2_mainText2},topImage:"connecting.svg",connectingScreenDisclaimerText:o.labels.connectingScreen_v2_disclaimer}),o.components.contentContainer.subviews.mainText.style.animation="1s gis-fade-in forwards",uiUtilitiesService.addClass(o.components.contentContainer.subviews.topImage,"gis-rotate"))},1500)},6e3),o.view},o.setNoClerkAvailable=function(){o.isNoClerkAvailableShown=!0,o.awaitingPhase?(clearTimeout(o.animationTimeout),o.components.contentContainer.subviews.mainText.style.animation="1s gis-fade-out forwards",o.animationTimeout=setTimeout(function(){o._setNoClerkAvailableUI()},1500)):(t.extraProps||(t.extraProps={}),t.extraProps.noClerkAvailable=!0);var e=o.serverInjectionService.getSystemConfig();e&&e.noOneAvailableBlock&&e.noOneAvailableBlock.enable&&(GISAPP.noClerkAvailableScreenShown=!0)},o._setConnectingUI=function(){o.animationTimeout=setTimeout(function(){o.components.contentContainer.subviews.mainText.style.animation="1s gis-fade-out forwards",o.animationTimeout=setTimeout(function(){o.components.contentContainer.subviews.mainText.innerHTML=o.labels.connecting_v2_mainText3,o.components.contentContainer.subviews.mainText.style.animation="1s gis-fade-in forwards",eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.RESPECT_MESSAGE_DISPLAYED_ON_CONNECTING_SCREEN),o.animationTimeout=setTimeout(function(){o.components.contentContainer.subviews.mainText.style.animation="1s gis-fade-out forwards",o.animationTimeout=setTimeout(function(){o.components.contentContainer.subviews.mainText.innerHTML=o.labels.connecting_v2_mainText4,o.components.contentContainer.subviews.mainText.style.animation="1s gis-fade-in forwards"},1500)},7e3)},1500)},7e3)},o._setNoClerkAvailableUI=function(){o.EVENT_LOGTAG=eventLoggerService.GIS_VIEWS.NO_CLERK_AVAILABLE;var e=o.serverInjectionService.getSystemConfig();bookingService.isBookingEnabled()?(o.button=new buttonComponent({buttonLabel:serverInjectionService.getLabels().schedule_booking_button_label,onClick:function(){t.extraProps.setBookingWidget()},eventName:o.EVENT_LOGTAG+eventLoggerService.GIS_VIEWS.BOOKING_SCHEDULE_BUTTON,buttonClass:"gis-secondary-button"}),n(o.labels.connecting_v2_noClerk_booking_mainText,o.labels.connecting_v2_noClerk_booking_secondaryText,o.button.render())):e&&e.captureInfo&&e.captureInfo.views&&!0===e.captureInfo.views.clerkUnavailable?(o.emailTextBox=new emailSubmitComponent({textBoxPlaceHolder:o.labels.noClerkAvailableScreen_emailFieldLabel,textBoxLabel:o.labels.noClerkAvailableScreen_emailErrorLabel,buttonClick:o._submitContact}),n(o.labels.connecting_v2_noClerkCaptureInfo_mainText,o.labels.connecting_v2_noClerkCaptureInfo_secondaryText,o.emailTextBox.render())):(o.button=new buttonComponent({buttonLabel:o.labels.connecting_v2_noClerk_buttonLabel,onClick:t.closeButton.onclick}),n(o.labels.connecting_v2_noClerk_mainText,o.labels.connecting_v2_noClerk_secondaryText,o.button.render())),o.components.contentContainer.subviews.secondaryText.style.visibility="hidden",o.components.contentContainer.subviews.secondaryText.style.display="block",o.components.contentContainer.subviews.topImage.style.display="none",o.components.contentContainer.subviews.mainText.style.animation="2s gis-fade-in forwards",o.components.contentContainer.subviews.secondaryText.style.animation="2s gis-fade-in forwards",o.components.contentContainer.subviews.secondaryText.style.visibility="visible",o.components.contentContainer.subviews.mainText.style.fontWeight="700",o.components.contentContainer.subviews.mainText.style.fontSize="20px",o.components.contentContainer.subviews.mainText.style.fontStyle="normal",o.components.contentContainer.subviews.mainText.style.lineHeight="23px",o.components.contentContainer.subviews.mainText.style.letterSpacing="0px",o.components.contentContainer.subviews.mainText.style.textAlign="center",eventLoggerService.logEvent(o.EVENT_LOGTAG+eventLoggerService.GIS_ACTIONS.SHOWN,{routingKey:stateService.getRoutingKey()})},o._submitContact=function(){if(!o.isSubmissionInProgress){o.isSubmissionInProgress=!0,o.emailTextBox.disableButton();var e={source:"connecting-v2",contact:{email:o.emailTextBox.getText().toLowerCase().trim()}},n=btoa(JSON.stringify(e));gisService.submitContactDetails(n,function(){o.isSubmissionInProgress=!1,o.emailTextBox.enableButton(),t.closeButton.onclick()},function(){o.isSubmissionInProgress=!1,logService.error(o.LOGTAG,"Error on submitting contact info from ConnectingV2."),o.emailTextBox.enableButton(),o.emailTextBox.showError("Failed to submit email address.")})}},o._hide=function(){eventLoggerService.logEvent(o.EVENT_LOGTAG+eventLoggerService.GIS_ACTIONS.CLOSED,{routingKey:stateService.getRoutingKey()}),o.isSubmissionInProgress=!1,o.emailTextBox&&o.emailTextBox.enableButton(),stateService.setCanceledOnConnectingScreen(!0),t.extraProps.isChatFirstCall||t.ctrlFunctions.endCall()},overrideService.override(o.LOGTAG,o),{render:o.render,setNoClerkAvailable:o.setNoClerkAvailable}}};GISAPP.gisPlayerScreen=function(serverInjectionService,globalObjectService,logService,GIS_CONSTANTS,stateService,uiUtilitiesService,videoPlayerComponent,deviceInfoService,shopStreamVideoHeaderComponent,eventService,ctaComponent,chatInputDOMProc,clientStorageService,iframeService,sliderComponent,productCarouselTileComponent,gisService,shopStreamService,utilitiesService,eventLoggerService,layoutService,productPopupComponent,carouselService,addToCartService,systemInfoService,chatGroupService,chatUserNameService,chatComponent){return function(s){var l,y,b,T,i,r,O,t,a,o,n,d,c,g,u,f,C,h,p,S,m,E,v,e,_,A,D,P,L,N,I,R,M,U,H,k,V,q,w=!1,x=!1,F='gisPlayerScreen',B=globalObjectService.getWindow().screen,G=[],W=[],z={BROADCAST_FOUND:0,BROADCAST_NOT_FOUND:1,INVALID_ALIAS:2},Q=serverInjectionService.getLabels().mobile_product_toggle_label,Y=serverInjectionService.getUiConfig(),K=serverInjectionService.getSystemConfig(),j=K.shopStream,J=!1,X=!1,Z={},$=!1,ee=!1,se=!1,ie=!1,te=!1,ae=!1;function oe(){if(X=!1,y=uiUtilitiesService.processView(serverInjectionService.getViews().gisPlayerView,{}),o=y.querySelector('#gis-player-close-button-container'),n=y.querySelector('#gis-player-close-button'),A=y.querySelector('#gis-mobile-portrait-player-header'),a=y.querySelector('#gis-player-video-header'),r=y.querySelector('#gis-player-video-container'),T=y.querySelector('#gis-player-right-pane'),t=y.querySelector('#gis-player-left-pane'),I=carouselService.getCarouselComponentView({hiddenArrowsLogic:function(){return deviceInfoService.isMobileDevice()||deviceInfoService.isIPad()&&layoutService.getOrientation().match(/portrait/)}}),(i=y.querySelector('#gis-product-carousel-container')).appendChild(I),O=y.querySelector('#gis-player-container'),g=y.querySelector('#gis-player-secondary-cta-container'),f=y.querySelector('#gis-player-chat-container'),p=y.querySelector('#gis-player-overlay-message'),stateService.getInputAlignment()===GIS_CONSTANTS.INPUT_ALIGNMENT.RTL&&uiUtilitiesService.addClass(p,'gis-rtl'),gisCallbacks.productsForBroadcastCallback=ue,gisCallbacks.checkCarouselUpdatedCallback=We,gisCallbacks.updateCarousel=ze,E=new videoPlayerComponent({width:'100%',height:'100%',onFullScreen:Ee,initialScreen:De,onChatClick:me,onProductClick:ve,onPlay:s.onPlay,onPause:s.onPause}),l=E.render(),se=deviceInfoService.isMobileDevice()?(E.hideControl(GIS_CONSTANTS.VIDEO_CONTROLS.CHAT),E.hideControl(GIS_CONSTANTS.VIDEO_CONTROLS.PRODUCT),ee=!1):(ee=!!shopStreamService.isChatEnabledForShopStream(b)||(E.hideControl(GIS_CONSTANTS.VIDEO_CONTROLS.CHAT),!1),!!shopStreamService.isProductCarouselEnabledForShopStream()||(E.hideControl(GIS_CONSTANTS.VIDEO_CONTROLS.PRODUCT),!1)),ke(),C=l.querySelector('#gis-vc-chat'),h=l.querySelector('#gis-vc-product'),u=y.querySelector('#gis-player-cta-container'),d=y.querySelector('#gis-player-cta'),(deviceInfoService.isMobileDevice()||X)&&(Me(),uiUtilitiesService.addClass(a,'gis-mobile'),uiUtilitiesService.addClass(i,'gis-hide'),de()),deviceInfoService.isMobileDevice()&&layoutService.applyIf(Se.bind(null,'landscape'),Se.bind(null,'portrait'),[function(){return layoutService.getOrientation().match(/landscape/)}]),n.onclick=Ge,layoutService.resizeCallback(be),layoutService.resizeCallback(Te),deviceInfoService.isIPad()?layoutService.orientationChangeCallback(le.bind(null,!1),!0):deviceInfoService.isMobileDevice()||layoutService.resizeCallback(le.bind(null,!1),!0),r.appendChild(l),m=y.querySelector('#gis-video'),uiUtilitiesService.showModal(y),b&&0===b.status?(uiUtilitiesService.addClass(i,'gis-hide'),uiUtilitiesService.addClass(f,'gis-hide'),l.querySelector('#gis-video-controls-container').style.display='none'):(function(){if(!shopStreamService.isChatEnabledForShopStream(b)||!b||10===b.status&&'replay'!==b.type)return uiUtilitiesService.addClass(f,'gis-hide');var e=b.config&&b.config.chat&&b.config.chat.type||j.chat.type;if('replay'===b.type&&b.isChatProcessed&&'group'===e){var s=new chatComponent({type:e,videoPlayer:E,broadcast:b,onChatClick:E.internalToggleChat}),i=s.render();return t=i,uiUtilitiesService.removeClass(T,'gis-hide'),uiUtilitiesService.removeClass(f,'gis-hide'),uiUtilitiesService.removeClass(O,'gis-video'),uiUtilitiesService.addClass(O,'gis-video-chat'),f.appendChild(t),X||deviceInfoService.isMobileDevice()||E.showControl(GIS_CONSTANTS.VIDEO_CONTROLS.CHAT),E.internalToggleChat(!0),le(!(ee=!0))}var t;var a=y.querySelector('#gis-user-title'),o=y.querySelector('#gis-user-secondary-title'),l=y.querySelector('#gis-user-error-msg'),r=y.querySelector('#gis-user-form-input'),n=y.querySelector('#gis-submit-user-form-btn'),d=y.querySelector('#gis-player-right-pane').getAttribute('id'),c=y.querySelector('#gis-user-form-container').getAttribute('id'),g=n.getAttribute('id'),u=r.getAttribute('id'),C=l.getAttribute('id'),h=serverInjectionService.getLabels().chat_userName_title,p=serverInjectionService.getLabels().chat_userName_secondary_title,S=chatUserNameService.isNameConfigured()?chatUserNameService.getUserName():serverInjectionService.getLabels().chat_userName_firstInput,m=serverInjectionService.getLabels().chat_joinChat_button;a.innerHTML=h,o.innerHTML=p,n.innerHTML=m,r.innerHTML='',r.setAttribute("data-placeholder",S),E.internalToggleChat(!1),E.hideControl(GIS_CONSTANTS.VIDEO_CONTROLS.CHAT),deviceInfoService.isMobileDevice()&&!deviceInfoService.isIos()&&(r.addEventListener('focus',function(){J=!0}),r.addEventListener('blur',function(){J=!1,Oe()}));if('question'===e)X||deviceInfoService.isMobileDevice()||E.showControl(GIS_CONSTANTS.VIDEO_CONTROLS.CHAT),f.appendChild(((v=chatInputDOMProc.render()).querySelector('#gis-convo').style.height='auto',v.querySelector('#gis-broadcast-close').style.display='none',v.style.width='100%',v)),E.internalToggleChat(!0);else{if('group'!==e)return uiUtilitiesService.addClass(f,'gis-hide');chatGroupService.getGroupCount(b.callUUID,function(e,s){if(e||s)return te=!(ee=!1),(deviceInfoService.isMobileDevice()||X)&&0!==G.length&&(uiUtilitiesService.removeClass(R,"gis-enabled"),uiUtilitiesService.removeClass(T,"gis-toggle-exists"),ge()),X=!X,void le(!1);X||deviceInfoService.isMobileDevice()||E.showControl(GIS_CONSTANTS.VIDEO_CONTROLS.CHAT),E.internalToggleChat(!0),chatUserNameService.openEnterUserForm(d,c,g,u,null,null,C,E.callChatButtonOnClick,!0),globalObjectService.getWindow().addEventListener('messageReceived',function(e){var s,i;e.detail[0].sender.uid!==stateService.getCallUserUUID()&&(s=e,i=0,f.className.match(/gis-hide/)&&E.showMessageIndicator(),s.detail.forEach(function(e){'text'===e.type&&i++}),E.updateMessageIndicatorCounter(i))})})}var v;deviceInfoService.isMobileDevice()||eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.CHAT_SHOWN_ON_SHOP_STREAM)}(),shopStreamService.isProductCarouselEnabledForShopStream()?b&&gisService.getProductsForBroadcast(b.id,'gisCallbacks.productsForBroadcastCallback'):uiUtilitiesService.addClass(i,'gis-hide')),ye(),ke(),u=y.querySelector('#gis-player-cta-container'),d=y.querySelector('#gis-player-cta'),Le(),xe(),uiUtilitiesService.enableBodyScroll(),gisAppLib.bodyScrollLock.disableBodyScroll(y),uiUtilitiesService.hasClass(i,"gis-hide")||eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.PRODUCT_CAROUSEL_SHOWN_ON_SHOP_STREAM),H=new productPopupComponent({type:null,payload:null,popUpContainer:y.querySelector('#gis-ss-player-popup'),labels:{product_details_popup_label:serverInjectionService.getLabels().product_popup_details_label,product_popup_view_details_label:serverInjectionService.getLabels().product_popup_more_info_label},repeatableATC:!0}),eventService.subscribe(GIS_CONSTANTS.EVENT_NAMES.SHOW_PRODUCT_DETAILS_POPUP,H.triggerDetailsPopup),deviceInfoService.isIPad()?(layoutService.applyIf(function(){layoutService.applyFullScreenHeight(y)},function(){layoutService.removeFullScreenHeight(y)},[ne]),uiUtilitiesService.addClass(O,'gis-ipad-landscape')):layoutService.applyIf(function(){layoutService.applyFullScreenHeight(y)},function(){layoutService.removeFullScreenHeight(y)},[{selector:"<",breakpoint:{type:null,maxWidth:1025}},ne]),b&&1===b.status&&(E.hideProgressBar(),deviceInfoService.isMobileDevice())){var e=l.querySelectorAll('.gis-desktop');uiUtilitiesService.removeClassOnList(e,'gis-desktop'),uiUtilitiesService.addClassOnList(e,'gis-mobile')}le(!0)}function le(e){var s=layoutService.getWindowSize();deviceInfoService.isIPad()?layoutService.getOrientation().match(/portrait/)&&s.WIDTH<1025&&!X?re(!0,e):layoutService.getOrientation().match(/landscape/)&&1024s.WIDTH&&X&&s.WIDTH<1025&&layoutService.getOrientation().match(/landscape/)&&!$&&(re(!($=!0),e),setTimeout(function(){$=!1},2e3)):deviceInfoService.isMobileDevice()||deviceInfoService.isIPad()||(s.WIDTH<1025&&!X?re(!0,e):1025<=s.WIDTH&&X&&re(!1,e))}function re(e,s){(!s||s&&e||s&&!e&&deviceInfoService.isIPad())&&((X=e)?(uiUtilitiesService.removeClass(O,'gis-ipad-landscape'),uiUtilitiesService.addClass(O,'gis-ipad-portrait'),E.hideControl(GIS_CONSTANTS.VIDEO_CONTROLS.CHAT),E.hideControl(GIS_CONSTANTS.VIDEO_CONTROLS.PRODUCT),uiUtilitiesService.addClass(a,'gis-mobile'),uiUtilitiesService.addClass(i,'gis-hide'),Ve(),Me(),E.setupUiForMobile(),b&&0!==b.status&&(de(),uiUtilitiesService.removeClass(T,'gis-hide'),be(),ye())):(uiUtilitiesService.removeClass(O,'gis-ipad-portrait'),deviceInfoService.isIPad()&&uiUtilitiesService.addClass(O,'gis-ipad-landscape'),de(),shopStreamService.isChatEnabledForShopStream(b)&&ee&&b&&b.status!==GIS_CONSTANTS.BROADCAST_STATUS.BROADCAST_CREATED?(E.showControl(GIS_CONSTANTS.VIDEO_CONTROLS.CHAT),C.classList.contains('gis-disabled')?E.internalToggleChat(!1):uiUtilitiesService.removeClass(T,'gis-hide')):E.internalToggleChat(!1),shopStreamService.isProductCarouselEnabledForShopStream()&&se&&b&&0!==b.status?(E.showControl(GIS_CONSTANTS.VIDEO_CONTROLS.PRODUCT),h.classList.contains('gis-disabled')?E.internalToggleProduct(!1):uiUtilitiesService.removeClass(i,'gis-hide'),be()):E.internalToggleProduct(!1),uiUtilitiesService.removeClass(a,'gis-mobile'),Ue(),qe(),Z&&Z.showAvailabilityIndicator&&Z.isAvailable&&(Le(),Ne(Z.showAvailabilityIndicator,Z.isAvailable)),Z&&Z.onclick&&Be(Z.onclick),fe(),E.setupUiForDesktop(),ye(),carouselService.refresh()),w&&Ee())}function ne(){return w}function de(){R=y.querySelector("#gis-chat-carousel-toggle-container"),M=y.querySelector("#gis-chat-toggle"),U=y.querySelector("#gis-product-toggle"),deviceInfoService.isMobileDevice()||X?(shopStreamService.isProductCarouselEnabledForShopStream()&&(uiUtilitiesService.removeNode(i),T.appendChild(i)),!shopStreamService.isProductCarouselEnabledForShopStream()||0===G.length||!shopStreamService.isChatEnabledForShopStream(b)||te||!ae&&10===b.status?(uiUtilitiesService.removeClass(R,"gis-enabled"),uiUtilitiesService.removeClass(T,"gis-toggle-exists"),shopStreamService.isChatEnabledForShopStream(b)&&!te&&ee&&(10!==b.status||ae&&10===b.status)?ce():shopStreamService.isProductCarouselEnabledForShopStream()&&ie&&(10!==b.status||!ae&&10===b.status)&&ge()):(uiUtilitiesService.removeClass(R,'gis-hide'),uiUtilitiesService.addClass(T,"gis-toggle-exists"),Q||(Q=serverInjectionService.getLabels().mobile_product_toggle_label),M.innerHTML=serverInjectionService.getLabels().mobile_chat_toggle_label,U.innerHTML||(U.innerHTML=Q),uiUtilitiesService.addClass(R,"gis-enabled"),M.addEventListener("click",function(){eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.SHOP_STREAM_CHAT_BUTTON_CLICKED),ce()}),U.addEventListener("click",function(){eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.SHOP_STREAM_PRODUCT_CAROUSEL_BUTTON_CLICKED),ge()})),shopStreamService.isChatEnabledForShopStream(b)&&!te&&(10!==b.status||ae&&10===b.status)?ce():shopStreamService.isProductCarouselEnabledForShopStream()&&ie&&(10!==b.status||!ae&&10===b.status)&&ge()):(shopStreamService.isProductCarouselEnabledForShopStream()&&be(),uiUtilitiesService.removeClass(R,"gis-enabled"),uiUtilitiesService.removeClass(T,"gis-toggle-exists"),E.internalToggleProduct(!0),E.internalToggleChat(!0))}function ce(){uiUtilitiesService.removeClass(U,"gis-active"),uiUtilitiesService.addClass(i,"gis-hide"),eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.PRODUCT_CAROUSEL_HIDDEN_ON_SHOP_STREAM),uiUtilitiesService.removeClass(f,"gis-hide"),uiUtilitiesService.addClass(M,"gis-active"),eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.CHAT_SHOWN_ON_SHOP_STREAM)}function ge(){uiUtilitiesService.removeClass(M,"gis-active"),uiUtilitiesService.addClass(f,"gis-hide"),eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.CHAT_HIDDEN_ON_SHOP_STREAM),uiUtilitiesService.removeClass(i,"gis-hide"),uiUtilitiesService.addClass(U,"gis-active"),S&&(deviceInfoService.isMobileDevice()||X)&&gisAppLib.bodyScrollLock.disableBodyScroll(S),eventLoggerService.logEvent(eventLoggerService.GIS_EVENTS.PRODUCT_CAROUSEL_SHOWN_ON_SHOP_STREAM)}function ue(e){if(e.version&&(q=e.version,eventService.publish(GIS_CONSTANTS.EVENT_NAMES.CHECK_FOR_CAROUSEL_UPDATE)),0===e.productCarousel.length)return uiUtilitiesService.addClass(i,'gis-hide'),E.hideControl(GIS_CONSTANTS.VIDEO_CONTROLS.PRODUCT),ie=se=!1,void ye();ie=!0,"none"===h.style.display||deviceInfoService.isMobileDevice()||X||(E.showControl(GIS_CONSTANTS.VIDEO_CONTROLS.PRODUCT),se=!0),uiUtilitiesService.removeClass(i,'gis-hide'),ye(),Ce(he(e)),be()}function Ce(e){S=I.querySelector('#gis-slider-content'),e.forEach(function(e){if(e.id&&addToCartService.isAddToCartConfigured())carouselService.addTileToCarousel(e);else{var s=new productCarouselTileComponent({title:e.title,imageUrl:e.imageUrl,price:e.price,currency:e.currency,productUrl:e.productUrl,alignment:'horizontal',id:e.id,sku:e.sku});W.push(s),I.querySelector('#gis-slider-content').appendChild(s.render()),carouselService.refresh()}}),S&&(deviceInfoService.isMobileDevice()||X)&&gisAppLib.bodyScrollLock.disableBodyScroll(S)}function he(e){var s=e.productCarousel;return s.forEach(function(e){e.id=e.productSku,e.onAccept=addToCartService.onAddToBasketTriggered.bind(null,e)}),G=s,(deviceInfoService.isMobileDevice()||X)&&de(),G&&0",t.style.lineHeight=t.height+"px",i.addEventListener('click',o.bind(null,Pe)),p.addEventListener('click',o.bind(null,e)),p.style.pointerEvents="none",t.appendChild(a),k.appendChild(t)}function xe(){if(!b||'replay'!==b.type){var e=stateService.getBroadcastResponse().status,s=void 0===e||e==z.BROADCAST_FOUND;if((utilitiesService.getUrlParams()[GIS_CONSTANTS.QUERY_PARAM.GIS_CHANNEL_PARAM]||utilitiesService.getUrlParams()[GIS_CONSTANTS.QUERY_PARAM.GIS_EVENT_PARAM]||10==b.status)&&(!s||!(utilitiesService.getUrlParams()[GIS_CONSTANTS.QUERY_PARAM.GIS_CHANNEL_PARAM]&&10!=b.status||utilitiesService.getUrlParams()[GIS_CONSTANTS.QUERY_PARAM.GIS_EVENT_PARAM]&&1==b.status))){var i=y.querySelector('#gis-player-overlay-message'),t=y.querySelector('#gis-player-msg-title'),a=y.querySelector('#gis-player-msg-subtitle');L=y.querySelector('#gis-player-msg-text'),P=r.querySelector('#gis-video-controls-container'),w&&De(),P.querySelector("#gis-vc-left")&&P.querySelectorAll("#gis-vc-left > *").forEach(function(e){e.style.display="none"}),P.querySelector("#gis-vc-fs")&&(P.querySelector("#gis-vc-fs").style.display="none"),P.querySelector('#gis-video-controls')&&(P.querySelector('#gis-video-controls').style.zIndex="2"),(deviceInfoService.isMobileDevice()||X)&&(uiUtilitiesService.addClass(t,'gis-mobile'),uiUtilitiesService.addClass(a,'gis-mobile'),uiUtilitiesService.addClass(L,'gis-mobile'),shopStreamService.isChatTypeQuestion(b)&&chatInputDOMProc.disableChat(),a.style.fontSize='11px'),b&&10!==b.status||(se&&E.internalToggleProduct(!1),ee&&E.internalToggleChat(!1),!utilitiesService.getUrlParams()[GIS_CONSTANTS.QUERY_PARAM.GIS_CHANNEL_PARAM]&&!utilitiesService.getUrlParams()[GIS_CONSTANTS.QUERY_PARAM.GIS_EVENT_PARAM]||ae||(P.querySelector('#gis-video-seek-bar-wrapper')&&(P.querySelector('#gis-video-seek-bar-wrapper').style.display="none"),de(),b||(E.hideControl(GIS_CONSTANTS.VIDEO_CONTROLS.PRODUCT),E.internalToggleProduct(!1),se=!1),E.hideControl(GIS_CONSTANTS.VIDEO_CONTROLS.CHAT),E.internalToggleChat(!1),ee=!1,ye(),fe())),m.src&&(m.src='',l.querySelector('#gis-vc-play').onclick()),m.style.background='#37373E',uiUtilitiesService.removeClass(i,'gis-hide'),k&&uiUtilitiesService.addClass(k,'gis-hide');var o=function(e){var s={firstText:'',secondText:'',thirdText:''},i=serverInjectionService.getLabels();if(e==z.BROADCAST_NOT_FOUND)s.firstText=i.broadcastViewer_broadcastNotFoundText1,s.secondText=i.broadcastViewer_broadcastNotFoundText2;else if(e==z.INVALID_ALIAS)s.firstText=i.broadcastViewer_invalidBroadcastUrlText1,s.secondText=i.broadcastViewer_invalidBroadcastUrlText2;else if(e==z.BROADCAST_FOUND&&10==b.status)s.firstText=i.broadcastViewer_broadcastEventEnded1,s.secondText=i.broadcastViewer_broadcastEventEnded2;else if(e==z.BROADCAST_FOUND&&0==b.status){s.firstText=i.broadcastViewer_broadcastEventToBegin,s.secondText=b.name;var t=new Date(b.broadcastEventHoldTimeStamp);s.thirdText=Fe(t)}return s}(e);e==z.BROADCAST_NOT_FOUND||e==z.INVALID_ALIAS?(uiUtilitiesService.addClass(a,'gis-content-align'),a.innerHTML=o.firstText+'
'+o.secondText):(t.innerHTML=o.firstText,a.innerHTML=o.secondText,L.innerHTML=o.thirdText)}}}function Fe(e){var s='';return s+=e.toLocaleDateString('en-US',{weekday:'long'})+', ',s+=e.toLocaleDateString('en-US',{month:'short'})+' ',s+=e.toLocaleDateString('en-US',{day:'numeric'})+', ',s+=e.toLocaleTimeString('en-US',{hour:'2-digit',minute:'2-digit'})}function Be(s){c&&'function'==typeof s&&(Z.onclick=s,u&&(u.onclick=function(e){s.call(this,e)}),g.onclick=function(e){s.call(this,e)})}function Ge(e){w&&De(),x=!1,_&&_(e),B.orientation&&B.orientation.removeEventListener('change',pe),E.dispose(),uiUtilitiesService.clearView(uiUtilitiesService.getInnerPanel()),uiUtilitiesService.hideModal(!1,GIS_CONSTANTS.ACTIONS.BROADCAST_SCREEN_CLOSED),uiUtilitiesService.enableBodyScroll(),G=[],delete gisCallbacks.productsForBroadcastCallback,delete gisCallbacks.checkCarouselUpdatedCallback,delete gisCallbacks.updateCarousel,eventService.unsubscribe(GIS_CONSTANTS.EVENT_NAMES.SHOW_PRODUCT_DETAILS_POPUP,H.triggerDetailsPopup)}function We(e){e&&e.isVersionChanged&&gisService.getProductsForBroadcast(b.id,'gisCallbacks.updateCarousel')}function ze(e){if(q=e.version,0for after sales support with your order, delivery, returns, repairs & more, please click here",button:n}),a.hideFooter(),c.subviews.contentContainer=c.components.contentContainer.render(),uiUtilitiesService.appendView(c.subviews.split1,c.subviews.imageContainer),uiUtilitiesService.appendView(c.subviews.split2,c.subviews.contentContainer),eventLoggerService.logEvent(l+eventLoggerService.GIS_ACTIONS.SHOWN),utilitiesService.isRedirectedFromSocialWebview()&&c.triggerAutoConnect()},c.invalidDirectCallScreen=function(){l=eventLoggerService.GIS_VIEWS.INVALID_DIRECT_CALL,c.subviews.split1.innerHTML="",c.subviews.split2.innerHTML="",uiUtilitiesService.addClass(c.subviews.split1,"gis-humanized"),c.components.imageContainer=new modalImageComponent({mainImage:{filename:"direct-call-broken-link.png",width:"100%",backgroundSize:"cover"}}),c.subviews.imageContainer=c.components.imageContainer.render(),c.components.imageContainer.setImageToFullCover(),c.components.contentContainer=new modalContentComponent({mainText:{text:"Sorry, your Live Video Link is invalid.",class:"gis-humanized"},secondaryText:"
Check if you have correctly entered the complete invite URL.
Contact your in-store associate to request a new link.
",linkText:"What is this?",footerText:"for after sales support with your order, delivery, returns, repairs & more, please click here",button:{label:"OK",eventName:eventLoggerService.GIS_VIEWS.INVALID_DIRECT_CALL+eventLoggerService.GIS_VIEWS.INVALID_DIRECT_CALL_BTN,eventData:{source:"directCall"},onclick:a.closeButton.onclick,buttonClass:"gis-humanized"}}),a.hideFooter(),c.subviews.contentContainer=c.components.contentContainer.render(),uiUtilitiesService.appendView(c.subviews.split1,c.subviews.imageContainer),uiUtilitiesService.appendView(c.subviews.split2,c.subviews.contentContainer),eventLoggerService.logEvent(l+eventLoggerService.GIS_ACTIONS.SHOWN)},c.browserUnsupported=function(){l=eventLoggerService.GIS_VIEWS.BROWSER_UNSUPPORTED,c.subviews.split1.innerHTML="",c.subviews.split2.innerHTML="",a.showFooter(),uiUtilitiesService.removeClass(c.subviews.split1,"gis-humanized"),c.components.imageContainer.setup({mainImage:{filename:"unsupported-browser.png",backgroundSize:"80%"}}),uiUtilitiesService.appendView(c.subviews.split1,c.components.imageContainer.render()),c.components.contentContainer2=new modalContentComponent({mainText:{text:"Your browser doesn't support this experience"},secondaryText:"Open the page in an up to date supported browser and start again.",button:{label:"Got it",onclick:a.closeButton.onclick}}),a.hideInfoButton(),uiUtilitiesService.appendView(c.subviews.split2,c.components.contentContainer2.render()),eventLoggerService.logEvent(l+eventLoggerService.GIS_ACTIONS.SHOWN)},c.noMic=function(){l=eventLoggerService.GIS_VIEWS.NO_MIC,c.subviews.split1.innerHTML="",c.subviews.split2.innerHTML="",a.showFooter(),uiUtilitiesService.removeClass(c.subviews.split1,"gis-humanized"),c.components.imageContainer.setup({mainImage:{filename:"No-Mic-Detected.png"}}),uiUtilitiesService.appendView(c.subviews.split1,c.components.imageContainer.render()),c.components.contentContainer2=new modalContentComponent({mainText:{text:"Your mic isn't
connected"},secondaryText:"Check your mic is connected [USB / Bluetooth], turned on, and unmuted, then start again.",button:{label:"Got it",onclick:a.closeButton.onclick}}),a.hideInfoButton(),uiUtilitiesService.appendView(c.subviews.split2,c.components.contentContainer2.render()),eventLoggerService.logEvent(l+eventLoggerService.GIS_ACTIONS.SHOWN)},c.setConnecting=function(e,n,t){l=eventLoggerService.GIS_VIEWS.CONNECTING,2===serverInjectionService.getUiConfig().micSetupVersion?(i=e,c.components.contentContainer2&&(c.components.contentContainer2.setup({centerImage:{filename:"mic_ok.png",height:deviceInfoService.isMobileDevice()&&!deviceInfoService.isIPad()?"100px":"160px"},secondaryText:"Microphone enabled"}),c.components.contentContainer2.components.button2.hide()),c.timeouts.push(setTimeout(function(){a.steps&&a.steps.hide(),a.setTitle(""),a.updateChild(connectingScreen,{noClerkAvailable:i,setBookingWidget:c.setBookingWidget,isChatFirstCall:n})},2e3))):a.updateChild(connectingScreen,{noClerkAvailable:i,setBookingWidget:c.setBookingWidget,isChatFirstCall:n}),n&&t&&a.hideCloseButton(),a.hideInfoButton(),eventLoggerService.logEvent(l+eventLoggerService.GIS_ACTIONS.SHOWN,{routingKey:stateService.getRoutingKey()})},c.setNoClerkAvailable=function(){i=!0},c.micBlocked=function(){l=eventLoggerService.GIS_VIEWS.MIC_BLOCKED,c.subviews.split1.style.width="",c.subviews.split1.style.height="",c.subviews.split1.innerHTML="",c.subviews.split2.innerHTML="",a.setTitle(""),c.components.imageContainer.setup({mainImage:{filename:"mic-denied.png"}}),uiUtilitiesService.appendView(c.subviews.split1,c.components.imageContainer.render()),c.components.contentContainer2=new modalContentComponent({mainText:{text:"Oops, you blocked your microphone"},secondaryText:"To talk to us you need to unblock your mic via address bar or settings.",button:{label:"OK",onclick:a.closeButton.onclick}}),uiUtilitiesService.appendView(c.subviews.split2,c.components.contentContainer2.render()),a.hideInfoButton(),eventLoggerService.logEvent(l+eventLoggerService.GIS_ACTIONS.SHOWN)},c.meetingConnectScreenWaiting=function(e){l=eventLoggerService.GIS_VIEWS.MEETING_CONNECT;var n=new Date(e.data.startTime),t=serverInjectionService.getLabels(),i=[{text:t.meetingScreen_Title,type:"title"},{text:t.meetingScreen_subMainText,type:"subTitle"},{text:t.meetingScreen_infoText,type:"subTitle"},{value:r(),type:"other"},{label:t.meetingScreen_connectBtnLabel,image:mediaService.isMicAllowed()?"":"mic.svg",isResponsive:!0,responseLabel:t.meetingScreen_waiting,onClick:c.connectClick,eventName:eventLoggerService.GIS_VIEWS.MEETING_CONNECT+eventLoggerService.GIS_VIEWS.MEETING_CONNECT_BTN,eventData:{source:"meetingCall"},buttonClass:"gis-humanized",type:"button"},{text:t.meetingScreen_startTimeText+" "+utilitiesService.getFormattedTime(n),type:"subTitle"},{text:t.meetingScreen_startDateText+" "+utilitiesService.getFormattedDate(n),type:"subTitle"}];u(l,"meeting-connect-image.png",i);var o=new Date((new Date).setMinutes((new Date).getMinutes()+3));if(ofor after sales support with your order, delivery, returns, repairs & more, please click here",button:{label:"Join Call",image:mediaService.isMicAllowed()?"":"mic.svg",isResponsive:!0,responseLabel:"Please Wait...",onclick:function(){c.connectClick(e)},eventName:eventLoggerService.GIS_VIEWS.ADD_A_PERSON_VIEW+eventLoggerService.GIS_VIEWS.ADD_A_PERSON_CALL_BUTTON,eventData:{source:"addAPersonCall"},buttonClass:"gis-humanized"}}),a.hideFooter(),c.subviews.contentContainer=c.components.contentContainer.render(),uiUtilitiesService.appendView(c.subviews.split1,c.subviews.imageContainer),uiUtilitiesService.appendView(c.subviews.split2,c.subviews.contentContainer),eventLoggerService.logEvent(l+eventLoggerService.GIS_ACTIONS.SHOWN),utilitiesService.isRedirectedFromSocialWebview()&&c.triggerAutoConnect(e)},c.setCallEndedScreenForAddAPerson=function(){addAPersonService.addAPersonEndCallScreenShown(),l=eventLoggerService.GIS_VIEWS.ADD_A_PERSON_CALL_ENDED_VIEW,c.subviews.split1.innerHTML="",c.subviews.split2.innerHTML="";var e={mainText:{text:serverInjectionService.getLabels().add_a_person_call_has_ended_main_text,class:"gis-humanized"},mainSubText:serverInjectionService.getLabels().add_a_person_call_has_ended_sub_main_text,button:{label:serverInjectionService.getLabels().add_a_person_start_new_call_button_text,image:mediaService.isMicAllowed()?"":"mic.svg",isResponsive:!0,responseLabel:serverInjectionService.getLabels().directCallScreen_v3_waiting,onclick:c.connectClick,eventName:eventLoggerService.GIS_VIEWS.ADD_A_PERSON_CALL_ENDED_VIEW+eventLoggerService.GIS_VIEWS.ADD_A_PERSON_CALL_ENDED_BUTTON,eventData:{source:"standard"},buttonClass:"gis-humanized"}};bookingService.isBookingEnabled()?(serverInjectionService.getUiConfig().supportInfoLink&&a.showInfoButton(),e.secondaryButton={label:serverInjectionService.getLabels().schedule_booking_button_label,onclick:c.setBookingWidget,eventName:eventLoggerService.GIS_VIEWS.CONNECT+eventLoggerService.GIS_VIEWS.BOOKING_SCHEDULE_BUTTON,eventData:{source:"standard"},class:"gis-secondary-button"}):e.linkText=serverInjectionService.getLabels().support_info_text;uiUtilitiesService.addClass(c.subviews.split1,"gis-humanized"),c.components.imageContainer=new modalImageComponent({mainImage:{filename:"call-has-ended-connect-screen.jpg",width:"100%",backgroundSize:"cover"}}),c.subviews.imageContainer=c.components.imageContainer.render(),c.components.imageContainer.setImageToFullCover(),c.components.contentContainer=new modalContentComponent(e),a.hideFooter(),c.subviews.contentContainer=c.components.contentContainer.render(),deviceInfoService.isMobileDevice()?(c.components.contentContainer.subviews.mainSubText.style.paddingTop="23px",c.components.contentContainer.subviews.mainSubText.style.paddingBottom="34px"):(c.components.contentContainer.subviews.mainSubText.style.paddingTop="37px",c.components.contentContainer.subviews.mainSubText.style.paddingBottom="147px"),uiUtilitiesService.appendView(c.subviews.split1,c.subviews.imageContainer),uiUtilitiesService.appendView(c.subviews.split2,c.subviews.contentContainer),eventLoggerService.logEvent(l+eventLoggerService.GIS_ACTIONS.SHOWN)},c.setMeetingMissed=function(){l=eventLoggerService.GIS_VIEWS.MEETING_MISSED;var e=serverInjectionService.getLabels(),n=[{text:e.meetingScreen_Title,type:"title"},{text:e.meetingScreen_missedText,type:"subTitle"},{value:r(),type:"other"},{label:e.schedule_booking_button_label,onClick:c.setBookingWidget,eventName:l+eventLoggerService.GIS_VIEWS.BOOKING_SCHEDULE_BUTTON,class:"gis-secondary-button",type:"button"}];u(l,"meeting-connect-image.png",n)},c.setMeetingEnded=function(){l=eventLoggerService.GIS_VIEWS.MEETING_ENDED;var e=serverInjectionService.getLabels(),n=[{text:e.meetingScreen_ended,type:"title"},{label:e.schedule_booking_button_label,onClick:c.setBookingWidget,eventName:l+eventLoggerService.GIS_VIEWS.BOOKING_SCHEDULE_BUTTON,class:"gis-secondary-button",type:"button"}];u(l,"meeting-connect-image.png",n)},c.setMeetingCancelled=function(){l=eventLoggerService.GIS_VIEWS.MEETING_CANCELED;var e=serverInjectionService.getLabels(),n=[{text:e.meetingScreen_Title,type:"title"},{text:e.meetingScreen_canceledText,type:"subTitle"},{value:r(),type:"other"},{label:e.schedule_booking_button_label,onClick:c.setBookingWidget,eventName:l+eventLoggerService.GIS_VIEWS.BOOKING_SCHEDULE_BUTTON,class:"gis-secondary-button",type:"button"}];u(l,"meeting-connect-image.png",n)},c.setBookingWidget=function(){var e=l;if(l=eventLoggerService.GIS_VIEWS.BOOKING,bookingService.isOpenBookingWidgetInNewTab())bookingService.openBookingPage();else{a.hideFooter(),a.hideInfoButton(),a.hideCloseButton();var n=a.modalContainer.querySelector("#gis-modal-content"),t=uiUtilitiesService.processView(serverInjectionService.getViews().bookingWidgetView,{},!1);uiUtilitiesService.clearView(n),n.appendChild(t);var i=t.querySelector("#gis-booking-widget-back-button-container");e?(t.querySelector('#gis-booking-widget-back-button-message').innerText=serverInjectionService.getLabels().bookingWidget_back_button_message,i.onclick=function(){switch(uiUtilitiesService.clearView(n),n.appendChild(c.render().querySelector('#gis-splitLayout')),a.showCloseButton(),e){case eventLoggerService.GIS_VIEWS.CONNECT:c.setHumanizedConnectScreen();break;case eventLoggerService.GIS_VIEWS.CLERK_UNAVAILABLE_CONNECT:c.setClerkUnavailableConnectScreen();break;case eventLoggerService.GIS_VIEWS.MEETING_CANCELED:c.setMeetingCancelled();break;case eventLoggerService.GIS_VIEWS.MEETING_ENDED:c.setMeetingEnded();break;case eventLoggerService.GIS_VIEWS.MEETING_MISSED:c.setMeetingMissed();break;case eventLoggerService.GIS_VIEWS.MEETING_ERROR:c.setMeetingSomethingWrong();break;case eventLoggerService.GIS_VIEWS.CONNECTING:c.setHumanizedConnectScreen()}}):i.style.visibility='hidden',t.querySelector("#gis-booking-widget-close-button-container").onclick=function(){a.hide()},iframeService.initializeSourceLessIframeWithScriptInjection('gis-booking-widget',t.querySelector('#gis-booking-widget-body'),bookingService.getScheduleCallButtonUrl(),{isSrc:!0,isCrossCommunication:!1}),eventLoggerService.logEvent(l+eventLoggerService.GIS_ACTIONS.SHOWN)}},c.setInformationScreen=function(e){l=eventLoggerService.GIS_VIEWS.ADD_A_PERSON_SESSION_IS_FULL_VIEW,a.hideFooter(),a.hideInfoButton(),a.hideCloseButton();var n=a.modalContainer.querySelector("#gis-modal-content"),t=uiUtilitiesService.processView(serverInjectionService.getViews().informationView,{},!1);uiUtilitiesService.clearView(n),n.appendChild(t),t.querySelector('#gis-connectv3-mainText').innerText=e,t.querySelector("#gis-information-close-button-container").onclick=function(){a.hide()},eventLoggerService.logEvent(l+eventLoggerService.GIS_ACTIONS.SHOWN)},c.setMeetingSomethingWrong=function(){l=eventLoggerService.GIS_VIEWS.MEETING_ERROR;var e=serverInjectionService.getLabels(),n=[{text:e.meetingScreen_Title,type:"title"},{text:e.meetingScreen_somethingWentWrongText,type:"subTitle"},{value:r(),type:"other"},{label:e.schedule_booking_button_label,onClick:c.setBookingWidget,eventName:l+eventLoggerService.GIS_VIEWS.BOOKING_SCHEDULE_BUTTON,class:"gis-secondary-button",type:"button"}];u(l,"meeting-connect-image.png",n)},c.triggerAutoConnect=function(e,n){var t=c.subviews.split2?c.subviews.split2.querySelector('#gis-connectv3-content .gis-v3-button'):null;t&&"function(){}"!==t.onclick.toString()?t.onclick(e||null):t&&(!n||n<9)?setTimeout(c.triggerAutoConnect.bind(null,e||null,n?n+1:1),100):c.connectClick(e||null)},c._hide=function(){c.timeouts=uiUtilitiesService.clearTimeouts(c.timeouts),eventLoggerService.logEvent(l+eventLoggerService.GIS_ACTIONS.CLOSED),stateService.getCurrentPhase===stateService.phase.READY||"function"!=typeof c.props.ctrlFunctions.isChatFirstCall||c.props.ctrlFunctions.isChatFirstCall()||c.props.ctrlFunctions.handlePostCallEvents()},c.connectClick=function(e,n){if(stateService.isAndroidSocialBrowser()){var t=utilitiesService.getSocialTrackableURL(utilitiesService.getPageUrl(!0),userService.getUserUUID()+"__"+utilitiesService.getBrowserShortcode(stateService.getBrowser()));globalObjectService.getWindow().location.replace(urlUtilitiesService.getExternalDeepLinkForAndroidWebviews(t))}else!function(e,n){if(bookingService.isAddAPersonEnabled()&&utilitiesService.isMeeting()||addAPersonService.isAddAPersonCall()&&callService.isAddAPersonEnabled()){var t=otService.initSession(stateService.getTokBoxApiKey(),stateService.getSessionId(),function(e){e&&logService.error("PRE-CALL-SCREEN","Error on initiating OT session",e)}),i=0,o=0;t.setConnectionCreatedHandler(function(e){var n=JSON.parse(e.connection.data),t=n&&n.userType;o++,'CONSUMER'===t&&i++}),t.connect(stateService.getToken(),function(){}),setTimeout(function(){t.off(),t.disconnect(),3