!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SpinSport=t()}(this,(function(){"use strict";var e=function(){},t=function(e,t){this.ErrorBody=t,this.ErrorCode=e},s=function(){function e(e){this.dataSubscriptionManager=e,this.IsBodyRequired=!0}return e.prototype.processMessage=function(e){var s=this;return new Promise((function(n,r){e.Body.SubscriptionId?(s.dataSubscriptionManager.endSubscription(e.Body.SubscriptionId,e.Body.Reason),n(null)):r(new t(1003,"SubscriptionId is required."))}))},e}(),n=function(){function e(e){this.dataSubscriptionManager=e,this.IsBodyRequired=!0}return e.prototype.processMessage=function(e){var t=this;return new Promise((function(s){t.dataSubscriptionManager.datasetUpdated(e.Body),s(null)}))},e}(),r=function(){function e(e){this.registry=new Map([["DATASET_UPDATED",new n(e)],["DATASET_SUBSCRIPTION_ENDED",new s(e)]])}return e.prototype.addProcessorForMessage=function(e,t){this.registry.has(e)||this.registry.set(e,t)},e.prototype.getProcessorForMessage=function(e){return this.registry.get(e)},e}(),i=function(){function e(){this.map=new Map,this.validEventsList=new Array}return e.prototype.addListener=function(e,t){var s=e.toLowerCase();if(!(this.validEventsList.indexOf(s)<0)){var n=this.map.get(e);n||(n=new Set,this.map.set(s,n)),n.has(t)||n.add(t)}},e.prototype.removeListener=function(e,t){var s=e.toLowerCase(),n=this.map.get(s);n&&n.has(t)&&n.delete(t)},e.prototype.invoke=function(e,t){var s=e.toLowerCase(),n=this.map.get(s);n&&n.forEach((function(e){e(t)}))},e.prototype.contains=function(e,t){var s=e.toLowerCase(),n=this.map.get(s);return!!n&&n.has(t)},e.prototype.addEventName=function(e){this.validEventsList.push(e.toLowerCase())},e}(),o=function(){function e(e,t,s){this.eventListenerMap=e,this.eventName=t,this.messageName=s,this.IsBodyRequired=!1}return e.prototype.processMessage=function(e){var t=this;return new Promise((function(s){e.Name===t.messageName&&t.eventListenerMap.invoke(t.eventName,e.Body),s(null)}))},e}(),a=function(){function e(e,t){this.messageProcessorRegistry=e,this.eventListenerMap=t,this.map=new Map}return e.prototype.addEventMessage=function(e,t){this.map.has(e)||(this.map.set(e,t),this.messageProcessorRegistry.addProcessorForMessage(e,new o(this.eventListenerMap,t,e)),this.eventListenerMap.addEventName(t))},e}(),u=function(){function e(e,t){var s=this;this.requestHandler=e,this.responseHandler=t,this.isInitialised=!1,this.handleMessageReceived=function(e){var t=s.parseMessage(e);t&&t.Id&&t.Name&&t.Type&&("RESPONSE"===t.Type?s.responseHandler.handleMessage(t):"REQUEST"===t.Type&&s.requestHandler.handleMessage(t))},this.parseMessage=function(e){try{return JSON.parse(e.data)}catch(e){return null}}}return e.prototype.initialise=function(e){e&&!this.isInitialised&&(e.addEventListener("message",this.handleMessageReceived),this.isInitialised=!0)},e}(),c=(new(function(){function e(){var e=this;this.createGuid=function(){var t=e.getRandom(),s=e.getRandom(),n=e.getRandom(),r=e.getRandom();return e.hexMap[255&t]+e.hexMap[t>>8&255]+e.hexMap[t>>16&255]+e.hexMap[t>>24&255]+"-"+e.hexMap[255&s]+e.hexMap[s>>8&255]+"-"+e.hexMap[s>>16&15|64]+e.hexMap[s>>24&255]+"-"+e.hexMap[63&n|128]+e.hexMap[n>>8&255]+"-"+e.hexMap[n>>16&255]+e.hexMap[n>>24&255]+e.hexMap[255&r]+e.hexMap[r>>8&255]+e.hexMap[r>>16&255]+e.hexMap[r>>24&255]},this.hexMap=new Array(256);for(var t=0;t<256;++t)this.hexMap[t]=(t<16?"0":"")+t.toString(16)}return e.prototype.getRandom=function(){return 4294967295*Math.random()|0},e}())).createGuid,d=function(){function t(e,t,s,n){this.requestStore=e,this.messageTargetRegistry=t,this.origin=s,this.senderId=n}return t.prototype.sendMessage=function(e,t){var s=this.messageTargetRegistry.getTarget(t);s&&s(JSON.stringify(e),"*")},t.prototype.createMessage=function(t,s,n,r){var i=new e;return i.Id=r||c(),i.Name=t,i.Type=s,i.SenderId=this.senderId,i.Origin=this.origin,i.Body=n,i},t.prototype.sendRequestMessage=function(e,t,s){var n=this,r=this.createMessage(e,"REQUEST",s);return new Promise((function(e,s){n.requestStore.registerRequest(r,e,s),n.sendMessage(r,t)}))},t.prototype.sendResponseMessage=function(e,t){var s=this.createMessage(e.Name,"RESPONSE",t,e.Id);this.sendMessage(s,e.SenderId)},t.prototype.sendErrorResponseMessage=function(e,t,s){var n=this.createMessage(e.Name,"RESPONSE",null,e.Id);n.Error={ErrorCode:t,ErrorBody:s},this.sendMessage(n,e.SenderId)},t}(),g=function(){function e(){this.map=new Map}return e.prototype.addMessageTarget=function(e,t){this.map.has(e)||this.map.set(e,t)},e.prototype.getTarget=function(e){return this.map.get(e)},e}();
/*! *****************************************************************************
    Copyright (c) Microsoft Corporation.

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    PERFORMANCE OF THIS SOFTWARE.
    ***************************************************************************** */
function p(e,t,s,n){return new(s||(s=Promise))((function(r,i){function o(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))}function h(e,t){var s,n,r,i,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(s)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(o=0)),o;)try{if(s=1,n&&(r=2&a[0]?n.return:a[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;switch(n=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{s=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}"function"==typeof SuppressedError&&SuppressedError;var f=function(){function e(e,t){this.messageProcessorRegistry=e,this.messageSender=t}return e.prototype.handleMessage=function(e){return p(this,void 0,void 0,(function(){var t,s,n;return h(this,(function(r){switch(r.label){case 0:if(!(t=this.messageProcessorRegistry.getProcessorForMessage(e.Name)))return this.messageSender.sendErrorResponseMessage(e,1e3,"Message '".concat(e.Name,"' not recognised")),[2];if(t.IsBodyRequired&&!e.Body)return this.messageSender.sendErrorResponseMessage(e,1005,"Message Body required"),[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.processMessage(e)];case 2:return s=r.sent(),this.messageSender.sendResponseMessage(e,s),[3,4];case 3:return n=r.sent(),this.messageSender.sendErrorResponseMessage(e,n.ErrorCode,n.ErrorBody),[3,4];case 4:return[2]}}))}))},e}(),S=function(e,t,s){this.messageId=e,this.resolve=t,this.reject=s},m=function(){function e(){this.messages=new Map}return e.prototype.registerRequest=function(e,t,s){this.messages.set(e.Id,new S(e.Id,t,s))},e.prototype.fetchRequest=function(e){return this.messages.get(e)},e.prototype.removeRequest=function(e){this.messages.delete(e)},e}(),y=function(){function e(e){this.requestStore=e}return e.prototype.handleMessage=function(e){var t=this.requestStore.fetchRequest(e.Id);t&&(e.Error?t.reject(e.Error):t.resolve(e.Body),this.requestStore.removeRequest(e.Id))},e}(),T=function(){function e(e,t,s,n,r,i,o,a){this.eventListenerMap=e,this.messageSender=t,this.dataSubscriptionManager=s,this.processorRegistry=n,this.eventMessageRegistry=r,this.targetName=i,this.hostOrigin=o,this.frameName=a}return e.prototype.initialise=function(){this.sendBridgeApiReady()},e.prototype.subscribeToData=function(e,t){return this.dataSubscriptionManager.subscribeToData(e,this.targetName,t)},e.prototype.addEventListener=function(e,t){this.eventListenerMap.addListener(e,t)},e.prototype.removeEventListener=function(e,t){this.eventListenerMap.removeListener(e,t)},e.prototype.sendRequestMessage=function(e,t){return this.messageSender.sendRequestMessage(e,this.targetName,t)},e.prototype.registerMessageProcessor=function(e,t){this.processorRegistry.addProcessorForMessage(e,t)},e.prototype.registerEventMessage=function(e,t){this.eventMessageRegistry.addEventMessage(e,t)},e.prototype.sendBridgeApiReady=function(){var e={HostOrigin:this.hostOrigin,FrameName:this.frameName};this.messageSender.sendRequestMessage("BRIDGE_API_READY",this.targetName,e).catch((function(){}))},e}(),R=function(){var e=this;this.updateDataset=function(t){var s=e.buffer.get(t.SubscriptionId);s&&s.SequenceNumber>t.SequenceNumber||e.buffer.set(t.SubscriptionId,t)},this.getDataset=function(t){var s=t.Dataset,n=t.SubscriptionId,r=e.buffer.get(n);return r&&r.SequenceNumber>t.SequenceNumber?r.Dataset:(e.buffer.set(n,t),s)},this.clearDataset=function(t){e.buffer.delete(t)},this.buffer=new Map},M=function(e,t,s,n){var r=this;this.initialDataset=t,this.messageSender=s,this.target=n,this.updateDataset=function(e){r.onChangeHandler&&e&&r.onChangeHandler(e)},this.endSubscription=function(e){r.onSubscriptionEndHandler&&r.onSubscriptionEndHandler(e)},this.unsubscribe=function(){r.messageSender.sendRequestMessage("UNSUBSCRIBE_FROM_DATASET",r.target,{SubscriptionId:r.Id})},this.onChange=function(e){r.onChangeHandler=e,r.updateDataset(r.initialDataset)},this.onSubscriptionEnd=function(e){r.onSubscriptionEndHandler=e},this.Id=e},E=function(e,t){this.DatasetKey=e,this.SubscriptionRequestModel=t||{},this.SubscriptionRequestModel.DatasetKey=e},l=function(){function e(e,t,s){this.messageSender=e,this.dataSubscriptionBuffer=t,this.dataSubscriptionStore=s}return e.prototype.subscribeToData=function(e,t,s){var n=this;return new Promise((function(r,i){var o=new E(e,s);n.messageSender.sendRequestMessage("SUBSCRIBE_TO_DATASET",t,o).then((function(e){var s=n.dataSubscriptionBuffer.getDataset(e),i=new M(e.SubscriptionId,s,n.messageSender,t);n.dataSubscriptionStore.storeSubscription(i),r(i)})).catch((function(e){i(e instanceof Error?e:new Error("string"==typeof e?e:JSON.stringify(e)))}))}))},e.prototype.datasetUpdated=function(e){var t=this.dataSubscriptionStore.getSubscription(e.SubscriptionId);if(t){var s=this.dataSubscriptionBuffer.getDataset(e);t.updateDataset(s)}else this.dataSubscriptionBuffer.updateDataset(e)},e.prototype.endSubscription=function(e,t){var s=this.dataSubscriptionStore.getSubscription(e);this.dataSubscriptionBuffer.clearDataset(e),s&&(s.endSubscription(t),this.dataSubscriptionStore.removeSubscription(e))},e}(),O=function(){function e(){var e=this;this.storeSubscription=function(t){t&&!e.isInvalidSubscriptionId(t.Id)&&e.subscriptions.set(t.Id,t)},this.getSubscription=function(t){if(!e.isInvalidSubscriptionId(t))return e.subscriptions.get(t)},this.removeSubscription=function(t){e.isInvalidSubscriptionId(t)||e.subscriptions.delete(t)},this.subscriptions=new Map}return e.prototype.isInvalidSubscriptionId=function(e){return!e||0===e.trim().length},e}(),_=function(){function e(e,t){this.senderId=t,this.targetInstanceMap=new Map;var s=new m,n=new y(s);this.messageTargetRegistry=new g,this.eventListenerMap=new i,this.messageSender=new d(s,this.messageTargetRegistry,e,t),this.dataSubscriptionManager=new l(this.messageSender,new R,new O),this.messageProcessorRegistry=new r(this.dataSubscriptionManager),this.eventMessageRegistry=new a(this.messageProcessorRegistry,this.eventListenerMap);var o=new f(this.messageProcessorRegistry,this.messageSender);this.messageListener=new u(o,n)}return e.prototype.initialise=function(e,t){var s=this.targetInstanceMap.get(t);return s||(this.messageListener.initialise(window),this.messageTargetRegistry.addMessageTarget(t,e),s=new T(this.eventListenerMap,this.messageSender,this.dataSubscriptionManager,this.messageProcessorRegistry,this.eventMessageRegistry,t,window.location.host,this.senderId),this.targetInstanceMap.set(t,s),s)},e}(),I=function(){function e(e){this.frameResizeService=e,this.IsBodyRequired=!0}return e.prototype.processMessage=function(e){var t=this;return new Promise((function(s){e.Body.IsContentResizeTrackingEnabled?t.frameResizeService.start():t.frameResizeService.stop(),s(null)}))},e}(),v=function(e,t){var s=this;this.messageSender=e,this.window=t,this.start=function(){s.intervalReference>=0||s.window.self!==s.window.top&&(s.intervalReference=s.window.setInterval(s.checkDocumentSize,100))},this.stop=function(){s.intervalReference<0||(s.window.clearInterval(s.intervalReference),s.intervalReference=-1)},this.checkDocumentSize=function(){if(document.getElementsByTagName("body")[0]){var e=s.window.getComputedStyle(document.documentElement),t=parseFloat(e.height||"50");s.hasHeightChanged(t)&&s.handleHeightChanged(t)}},this.hasHeightChanged=function(e){return e!==s.lastHeight},this.handleHeightChanged=function(e){s.lastHeight=e,s.messageSender.sendRequestMessage("EMBEDDED_CONTENT_SIZE_CHANGED",{DocumentHeight:e})},this.intervalReference=-1,this.lastHeight=0},b=function(){function e(e){this.messagingFacade=e}return e.prototype.getBannerTags=function(){return this.messagingFacade.sendRequestMessage("GET_BANNER_TAGS")},e.prototype.getCredentials=function(){return this.messagingFacade.sendRequestMessage("GET_CREDENTIALS")},e.prototype.getLaunchToken=function(){return this.messagingFacade.sendRequestMessage("GET_LAUNCH_TOKEN")},e.prototype.getLoginStatus=function(){return this.messagingFacade.sendRequestMessage("GET_LOGIN_STATUS")},e.prototype.getUserSettings=function(){return this.messagingFacade.sendRequestMessage("GET_USER_SETTINGS")},e.prototype.logUserIn=function(e,t){return this.messagingFacade.sendRequestMessage("LOG_USER_IN",{Username:e,Password:t})},e.prototype.logUserInWithToken=function(e){return this.messagingFacade.sendRequestMessage("LOG_USER_IN",{LaunchToken:e})},e.prototype.logUserOut=function(){return this.messagingFacade.sendRequestMessage("LOG_USER_OUT")},e.prototype.notifyRegistrationCompleted=function(e,t,s){return this.messagingFacade.sendRequestMessage("REGISTRATION_COMPLETED",{Status:e,Username:t,Password:s})},e.prototype.notifyRegistrationCompletedWithToken=function(e,t){return this.messagingFacade.sendRequestMessage("REGISTRATION_COMPLETED_WITH_TOKEN",{Status:e,LaunchToken:t})},e.prototype.promptForLogin=function(){return this.messagingFacade.sendRequestMessage("PROMPT_FOR_LOGIN")},e.prototype.refreshCustomerInfo=function(){return this.messagingFacade.sendRequestMessage("REFRESH_CUSTOMER_INFO")},e}(),w=function(){function e(e){this.messageSender=e}return e.prototype.vibrate=function(){return this.messageSender.sendRequestMessage("VIBRATE")},e}(),N=function(){function e(e){this.messageSender=e}return e.prototype.goToCategory=function(e,t){return this.messageSender.sendRequestMessage("GO_TO_GAME_HUB_CATEGORY",{LobbyKey:e,CategoryKey:t})},e.prototype.goToGame=function(e){return this.messageSender.sendRequestMessage("GO_TO_GAME_HUB_GAME",{GameKey:e})},e}(),q=function(){function e(e){this.messageSender=e}return e.prototype.closeFullScreenIntegration=function(){return this.messageSender.sendRequestMessage("CLOSE_FULL_SCREEN_INTEGRATION")},e.prototype.closeIntegration=function(){return this.messageSender.sendRequestMessage("CLOSE_APPLICATION")},e.prototype.goToCashOut=function(){return this.messageSender.sendRequestMessage("GO_TO_CASH_OUT")},e.prototype.goToDeposit=function(){return this.messageSender.sendRequestMessage("GO_TO_DEPOSITS")},e.prototype.goToDynamicPage=function(e){return this.messageSender.sendRequestMessage("GO_TO_DYNAMIC_PAGE",{DynamicPageId:e})},e.prototype.goToExternalIntegration=function(e){return this.messageSender.sendRequestMessage("GO_TO_EXTERNAL_INTEGRATION",{ExternalIntegrationKey:e})},e.prototype.goToExternalLink=function(e,t){return this.messageSender.sendRequestMessage("GO_TO_EXTERNAL_LINK",{Url:e,ApplicationType:t})},e.prototype.goToGameHistory=function(){return this.messageSender.sendRequestMessage("GO_TO_GAME_HISTORY")},e.prototype.goToLobby=function(e){return this.messageSender.sendRequestMessage("GO_TO_LOBBY",{LobbyKey:e})},e.prototype.goToSearch=function(){return this.messageSender.sendRequestMessage("GO_TO_SEARCH")},e.prototype.goToMyBets=function(){return this.messageSender.sendRequestMessage("GO_TO_MY_BETS")},e.prototype.goToPreviousPage=function(){return this.messageSender.sendRequestMessage("GO_TO_PREVIOUS_PAGE")},e.prototype.goToRegistration=function(){return this.messageSender.sendRequestMessage("GO_TO_REGISTRATION")},e.prototype.goToResponsibleGaming=function(){return this.messageSender.sendRequestMessage("GO_TO_RESPONSIBLE_GAMING")},e.prototype.goToWithdrawals=function(){return this.messageSender.sendRequestMessage("GO_TO_WITHDRAWALS")},e.prototype.hideBottomBar=function(){return this.messageSender.sendRequestMessage("HIDE_BOTTOM_BAR")},e.prototype.showBottomBar=function(){return this.messageSender.sendRequestMessage("SHOW_BOTTOM_BAR")},e.prototype.showChatWidget=function(){return this.messageSender.sendRequestMessage("OPEN_CHAT")},e}(),A=function(e){if("string"==typeof e){var t=Number.parseInt(e,10);if(Number.isNaN(t))return;return t}return"number"!=typeof e||Number.isInteger(e)?e:Math.trunc(e)},C=function(){function e(e){this.messageSender=e}return e.prototype.addMultipleOutcomesToBetslip=function(e){"string"==typeof e&&(e=e.split(",").map(Number));return this.messageSender.sendRequestMessage("ADD_MULTIPLE_OUTCOMES_TO_BETSLIP",{OutcomeIds:e})},e.prototype.addOutcomeToBetslip=function(e,t){return e=A(e),t=A(t),this.messageSender.sendRequestMessage("ADD_OUTCOME_TO_BETSLIP",{OutcomeId:e,Stake:t})},e.prototype.addOrRemoveBetslipOutcome=function(e){return e=A(e),this.messageSender.sendRequestMessage("ADD_OR_REMOVE_BETSLIP_OUTCOME",{OutcomeId:e})},e.prototype.getOutcomesInBetslip=function(){return this.messageSender.sendRequestMessage("GET_OUTCOMES_IN_BETSLIP",null)},e.prototype.getDynamicFooterContent=function(){return this.messageSender.sendRequestMessage("GET_DYNAMIC_FOOTER_CONTENT",null)},e.prototype.updateFollowProxy=function(e,t){return this.messageSender.sendRequestMessage("UPDATE_FOLLOW_PROXY",{Identifier:e,Type:t})},e.prototype.goToTipsterVideoPost=function(e,t,s){return void 0===s&&(s=[]),this.messageSender.sendRequestMessage("GO_TO_TIPSTER_VIDEO_POST",{VideoId:e,VideoPostContext:t,RecommendedVideoIds:s})},e.prototype.goToCategory=function(e){return this.messageSender.sendRequestMessage("GO_TO_SPORTS_CATEGORY",{CategoryKey:e})},e.prototype.goToCoupon=function(e,t){return this.messageSender.sendRequestMessage("GO_TO_SPORTS_COUPON",{CategoryKey:e,CouponId:t})},e.prototype.goToEvent=function(e){return this.messageSender.sendRequestMessage("GO_TO_SPORTS_EVENT",{EventId:e})},e.prototype.goToGroup=function(e,t,s){return this.messageSender.sendRequestMessage("GO_TO_SPORTS_GROUP",{CategoryKey:e,SubCategoryKey:t,GroupKey:s})},e.prototype.goToMarket=function(e,t){return this.messageSender.sendRequestMessage("GO_TO_SPORTS_MARKET",{EventId:e,MarketId:t})},e.prototype.goToOutcome=function(e){return e=A(e),this.messageSender.sendRequestMessage("GO_TO_SPORTS_OUTCOME",{OutcomeId:e})},e.prototype.goToSubcategory=function(e,t){return this.messageSender.sendRequestMessage("GO_TO_SPORTS_SUBCATEGORY",{CategoryKey:e,SubCategoryName:t})},e.prototype.subscribeToEvent=function(e){return e=A(e),this.messageSender.subscribeToData("event",{EventId:e})},e.prototype.subscribeToMarket=function(e){return e=A(e),this.messageSender.subscribeToData("market",{MarketId:e})},e}(),G=function(){function e(e){this.messageSender=e}return e.prototype.getApplicationConfiguration=function(){return this.messageSender.sendRequestMessage("GET_APPLICATION_CONFIGURATION")},e}(),L=function(){function e(e){this.messageSender=e}return e.prototype.reportUserActivity=function(e,t,s){return this.messageSender.sendRequestMessage("REPORT_USER_ACTIVITY",{ActivityName:e,ActivityData:t,ActivityDataVersion:s})},e}(),P=function(){function e(e){this.messageSender=e}return e.prototype.hideLoading=function(){return this.messageSender.sendRequestMessage("HIDE_LOADING_MASK")},e.prototype.scrollToTop=function(e){return this.messageSender.sendRequestMessage("SCROLL_TO_TOP",{ScrollHost:e})},e.prototype.setPageTitle=function(e,t){return this.messageSender.sendRequestMessage("SET_PAGE_TITLE",{PageTitle:e,PageSubTitle:t})},e.prototype.showContent=function(e){return this.messageSender.sendRequestMessage("SHOW_CONTENT",{ContentName:e})},e.prototype.showLoading=function(){return this.messageSender.sendRequestMessage("SHOW_LOADING_MASK")},e.prototype.askPushNotificationPermission=function(){return this.messageSender.sendRequestMessage("ASK_PUSH_NOTIFICATION_PERMISSION")},e}(),D=function(){function e(e){this.messageSender=e}return e.prototype.notifyCriticalErrorOccurred=function(){return this.messageSender.sendRequestMessage("CRITICAL_ERROR_OCCURED")},e.prototype.suppressTriggeredDisplay=function(){return this.messageSender.sendRequestMessage("SUPPRESS_TRIGGERED_INTEGRATION_LAUNCH")},e}(),B=function(){function e(e){this.messageFacade=e,this.Authentication=new b(e),this.Navigation=new q(e),this.Sports=new C(e),this.GameHub=new N(e),this.Device=new w(e),this.UI=new P(e),this.System=new G(e),this.Workflow=new D(e),this.Telemetry=new L(e)}return e.prototype.addEventListener=function(e,t){this.messageFacade.addEventListener(e,t)},e.prototype.removeEventListener=function(e,t){this.messageFacade.removeEventListener(e,t)},e}(),U=new Map([["ORIENTATION_CHANGED","orientation-changed"],["USER_LOGGED_IN","user-logged-in"],["USER_LOGGED_OUT","user-logged-out"],["USER_SETTINGS_CHANGED","user-settings-changed"],["BET_PLACED","bet-placed"],["CONTEXT_CHANGED","context-changed"]]),H=function(){function e(e,t){var s=this;this.window=e,this.messagingFactory=t,this.tryAutoInitialise=function(){var e=document.getElementsByTagName("script"),t=Array.from(e).find((function(e){return e.src.includes("hostapi/hostapi.js")}));if(t&&!((null==t?void 0:t.src.lastIndexOf("initialise=true"))<0)){var n=function(){"complete"===document.readyState&&s.initialise()};document.addEventListener("readystatechange",(function(){n()})),n()}},this.postMessage=this.postMessage.bind(this),this.tryAutoInitialise()}return e.prototype.initialise=function(){if(this.instance)return this.instance;var e=this.isTopWindow()?function(){}:this.postMessage,t=this.messagingFactory.initialise(e,"SpinSportApplication");return this.frameResizeService=new v(t,this.window),t.registerMessageProcessor("UPDATE_INTEGRATOR_CONFIGURATION",new I(this.frameResizeService)),this.addEventHandlers(t),this.instance=new B(t),t.initialise(),this.instance},e.prototype.isTopWindow=function(){return this.window===this.window.top},e.prototype.addEventHandlers=function(e){U.forEach((function(t,s){e.registerEventMessage(s,t)}))},e.prototype.postMessage=function(e,t){this.isTopWindow()||this.window.parent.postMessage(e,t)},e}();return function(){function e(){}return e.HostApi=new H(window,new _("HostedApplication",window.name)),e}()}));
