@theymes/sdk 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk.cjs.js +1 -1
- package/dist/sdk.esm.js +1 -1
- package/dist/sdk.js +1 -1
- package/dist/sdk.unity.js +1 -1
- package/dist/utils.d.ts +11 -0
- package/package.json +1 -1
- package/dist/sdk-1.1.6.js +0 -1
- package/dist/sdk-1.latest.js +0 -1
package/dist/sdk.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((o=o.apply(e,t||[])).next())}))}function n(e,t){var n,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,o&&(i=2&a[0]?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,o=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){r.label=a[1];break}if(6===a[0]&&r.label<i[1]){r.label=i[1],i=a;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(a);break}i[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],o=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function o(e,t,n){if(n||2===arguments.length)for(var o,i=0,r=t.length;i<r;i++)!o&&i in t||(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var i={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function r(e,t){i[e].add(t)}function s(e,t){i[e].delete(t)}function a(e,t){i[e].forEach((function(e){return e.apply(void 0,t)}))}var l='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n background: rgb(CSS_TILE_PLACEHOLDER);\n display: flex;\n width: 100%;\n border-bottom: 1px solid rgb(CSS_BORDER_PLACEHOLDER);\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button" onclick="closeTheymesSdk()">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval"\n role="img">\n <g fill="none" fillRule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18">\n <animateTransform attributeName="transform" type="rotate" from="0 18 18" to="360 18 18" dur="1s"\n repeatCount="indefinite" />\n </path>\n </g>\n </g>\n </svg>\n </div>\n </div>\n <script>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n background: rgb(CSS_TILE_PLACEHOLDER);\n display: flex;\n width: 100%;\n border-bottom: 1px solid rgb(CSS_BORDER_PLACEHOLDER);\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button" onclick="closeTheymesSdk()">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text" onclick="notificationClicked()">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button" onclick="closeNotification()">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button" onclick="openWidget()">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </div>\n <script>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n updateUnreadMessageCount();\n\n window.addEventListener(\'message\', iframeSubscriber, false);\n <\/script>\n</body>\n\n</html>',p=function(e,t){return e===t||Boolean(e&&t&&"object"==typeof e&&"object"==typeof t&&Object.keys(e).length===Object.keys(t).length&&Object.entries(e).every((function(e){var n=e[0],o=e[1];return p(o,t[n])})))},g="colors",f="1.1.0b",m="web",h={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},y=360,v=720,b=120,w=48,k=.2,x=.2,T=.2,S={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var t=localStorage.getItem(g);if(t){var n=JSON.parse(t);return e(e({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),n)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null},E=function(e){var t="/help-center";P({path:t,config:e}),R({path:t,config:e})},C=function(){!function(){var e=document.querySelector(h.sdkDialog),t=document.querySelector(h.sdkIframeWrapper);if(e){var n=function(){"widget"!==S.mode||S.forceUpdateSdkDialog?e.remove():e.style.display="none",S.forceUpdateSdkDialog=!1};t?(t.style.opacity="0",t.style.transform=Y({animation:"start"}),setTimeout((function(){n()}),1e3*k)):n()}S.widgetButton&&q();a("close",[])}(),H()},_=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.apply(void 0,e)};function O(t){var n,i,r,s,a,l,c=(null!=t?t:{}).config;if(!S.token||!S.domain||!S.deviceId)return null;var d=null!==(n=null==c?void 0:c.tags)&&void 0!==n?n:[],u=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},p=null!==(s=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:S.language)&&void 0!==s?s:null,g=null!==(a=S.signedMetadataToken)&&void 0!==a?a:null,h=null!==(l=S.player)&&void 0!==l?l:null,y={_platform:m,_sdkVersion:f};S.youngPlayer&&(y._youngPlayer=!0),(S.privacyMode||S.youngPlayer)&&(y._privacyMode=!0);var v=o(o([],Array.from(S.tags),!0),d,!0),b=e(e(e({},S.fields),u),y);return{token:S.token,domain:S.domain,deviceId:S.deviceId,tags:v,fields:b,language:p,signedMetadataToken:g,player:h}}function L(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function I(e){var t,n,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",m).replace("'INSET_TOP_PLACEHOLDER'","".concat(S.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(S.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(S.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(S.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",L(S.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",L(S.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",L(S.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",L(S.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",L(S.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",L(S.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",L(S.colors.notificationText)).replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(n=null===(t=S.fonts.body)||void 0===t?void 0:t.regular)&&void 0!==n?n:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=S.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif")}function A(e){var t,n=e.iframe,o=e.content,i=null===(t=n.contentWindow)||void 0===t?void 0:t.document;i&&(i.open(),i.write(o),i.close())}function R(e){var t,n,o,i=O({config:e.config});if(i){!function(){if(!document.querySelector(h.sdkStylesheet)){var e=document.createElement("style");e.id=h.sdkStylesheet.replace("#",""),e.textContent="\n ".concat(h.sdkDialog," {\n max-width: none !important;\n max-height: none !important;\n }\n\n ").concat(h.sdkDialog,"::backdrop {\n background: transparent !important;\n }\n "),document.body.appendChild(e)}}();var r=null!==(t=document.querySelector(h.sdkDialog))&&void 0!==t?t:document.createElement("div");r.id=h.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="0",r.style.right="0",r.style.bottom="0",r.style.left="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var s=null!==(n=r.querySelector(h.sdkIframeWrapper))&&void 0!==n?n:document.createElement("div");s.id=h.sdkIframeWrapper.replace("#",""),s.style.position="relative",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.opacity="0",s.style.colorScheme="auto",s.style.backgroundColor="rgb(".concat(L(S.colors.background),")"),s.style.transform=Y({animation:"start"}),s.style.transition=(S.mode,"opacity ".concat(k,"s ease-in-out, transform ").concat(k,"s ease-in-out")),"widget"===S.mode&&(s.style.overflow="hidden",s.style.borderRadius="10px",s.style.border="1px solid rgb(".concat(L(S.colors.border),")"));var d=null!==(o=s.querySelector(h.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=h.sdkLoaderIframe.replace("#",""),d.style.position="absolute",d.style.border="none",d.style.width="100%",d.style.height="100%",d.style.top="0",d.style.right="0",d.style.bottom="0",d.style.left="0",d.style.colorScheme="auto";var u=s.querySelector(h.sdkIframe),p=null!=u?u:document.createElement("iframe"),g=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),y())}),500);p.id=h.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!S.networkErrorTimerId||(p.src=function(e){var t=e.path,n=e.supportViewConfig,o="https://".concat(S.domain,"/sdk"),i=new URLSearchParams;i.set("platform",m),i.set("token",n.token),i.set("deviceId",n.deviceId),i.set("mode",S.mode),n.language&&i.set("language",n.language);var r=N({supportViewConfig:n});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(t,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(s),s.appendChild(d),s.appendChild(p),document.body.appendChild(r)),A({iframe:d,content:I({template:l})});var f=!1,y=function(){f||(f=!0,S.networkErrorTimerId=setTimeout((function(){A({iframe:d,content:I({template:c})})}),1e4))};p.onload=y,p.onerror=function(){A({iframe:d,content:I({template:c})})},M(),a("open",[]),setTimeout((function(){s.style.opacity="1",s.style.transform=Y({animation:"end"})}),100)}}function P(e){var t=e.path,n=e.config,o=null!=n?n:null;S.previousPath===t&&p(S.previousConfig,o)||(S.previousPath=t,S.previousConfig=o,D())}function D(){var e=document.querySelector(h.sdkDialog);S.sdkIsOpen?S.forceUpdateSdkDialog=!0:null==e||e.remove()}function N(e){var t=e.supportViewConfig,n={unsigned:{},signed:void 0};return t.player&&(n.unsigned.player=t.player),t.tags&&(n.unsigned.tags=t.tags),t.fields&&(n.unsigned.fields=t.fields),t.signedMetadataToken&&(n.signed=t.signedMetadataToken),n}function M(){var e=document.querySelector(h.sdkDialog);if(e){if("widget"===S.mode){var t=W({type:"widget"}),n=z();e.style.width=n.width,e.style.height=n.height,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top}else if(S.element){var o=S.element.getBoundingClientRect(),i=o.width,r=o.height,s=o.top,a=o.left,l=o.right,c=o.bottom;e.style.width="".concat(i,"px"),e.style.height="".concat(r,"px"),e.style.top="".concat(s,"px"),e.style.left="".concat(a,"px"),e.style.right="".concat(l,"px"),e.style.bottom="".concat(c,"px")}else e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0";requestAnimationFrame(M)}}function B(e){var t=1e3*e;S.eventsNextPollAt=new Date(Date.now()+t),S.eventsPollerTimerId=setTimeout(H,t)}function H(){return t(this,void 0,void 0,(function(){var t,i,r,s,l,c,d,u;return n(this,(function(n){switch(n.label){case 0:if(Z(),!S.token||!S.domain||!S.deviceId)return B(60),[2];t=S.notificationsPaused||S.sdkIsOpen?"true":"false",i="https://".concat(S.domain,"/api/sdk/events"),r=new URLSearchParams(e(e({token:S.token,language:null!==(d=S.language)&&void 0!==d?d:"en",deviceId:S.deviceId,notificationsPaused:t,mode:S.mode},(null===(u=S.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:S.player.id}:{}),S.signedMetadataToken?{signedMetadataToken:S.signedMetadataToken}:{})).toString(),n.label=1;case 1:return n.trys.push([1,6,,7]),[4,fetch("".concat(i,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(s=n.sent()).ok?[3,4]:[4,K(s)];case 3:throw n.sent();case 4:return[4,s.json()];case 5:return l=n.sent(),S.notifications=o(o([],S.notifications,!0),l.notifications,!0),l.notifications.length>0&&F(),l.unansweredMessageCount!==S.unansweredMessageCount&&(S.unansweredMessageCount=l.unansweredMessageCount,a("unansweredMessageCountUpdate",[l.unansweredMessageCount])),l.unreadMessageCount!==S.unreadMessageCount&&(S.unreadMessageCount=l.unreadMessageCount,a("unreadMessageCountUpdate",[l.unreadMessageCount]),ee({action:"unreadMessageCountUpdate",count:l.unreadMessageCount})),B(l.nextPollSeconds),[3,7];case 6:return c=n.sent(),console.error("Error initializing SDK:",c),B(60),[3,7];case 7:return[2]}}))}))}function F(){var e,t,n=S.notifications[0];if(n&&!S.visibleNotification){S.visibleNotification=n;var o=null!==(e=document.querySelector(h.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=h.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(t=o.querySelector(h.notificationIframe))&&void 0!==t?t:document.createElement("iframe");r.id=h.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(T,"s ease-in-out, margin-top ").concat(T,"s ease-in-out"),o.appendChild(r),A({iframe:r,content:(i={text:n.text},I({template:d}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),U(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),n.closeAfterSeconds>0&&setTimeout((function(){j({notification:n})}),1e3*n.closeAfterSeconds)}}function U(){var e,t,n,o=document.querySelector(h.notificationDialog),i=document.querySelector(h.notificationIframe);if(o&&i){var r=(null===(n=null===(t=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===n?void 0:n.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===S.mode){var s=W({type:"widget"}),a=z(),l="calc(".concat(a.width," - 20px)");o.style.width=a.width,o.style.height=a.height,o.style.bottom=s.bottom,o.style.right=s.right,o.style.left=s.left,o.style.top=s.top,i.style.width=l}else if(S.element){var c=S.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px",requestAnimationFrame(U)}}function j(e){if(e.notification&&S.visibleNotification===e.notification){var t=document.querySelector(h.notificationIframe),n=document.querySelector(h.notificationDialog);t&&(t.style.opacity="0",t.style.marginTop="-20px",setTimeout((function(){null==n||n.remove(),S.notifications=S.notifications.slice(1),S.visibleNotification=null,F()}),1e3*T))}}function q(){var e,t=null!==(e=document.querySelector(h.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(t){var n,o=W({type:"button"});t.id=h.sdkButtonIframe.replace("#",""),t.style.position="fixed",t.style.border="none",t.style.width="".concat(b,"px"),t.style.height="".concat(w,"px"),t.style.maxWidth="95%",t.style.maxHeight="95%",t.style.bottom=o.bottom,t.style.right=o.right,t.style.left=o.left,t.style.top=o.top,t.style.margin="0",t.style.padding="0",t.style.zIndex="9997",t.style.backgroundColor="transparent",t.style.opacity="0",t.style.transform="scale(0.8)",t.style.transition="opacity ".concat(x,"s ease-in-out, transform ").concat(x,"s ease-in-out"),setTimeout((function(){t.style.opacity="1",t.style.transform="scale(1)"}),100),document.body.appendChild(t),A({iframe:t,content:(n={unreadMessageCount:S.unreadMessageCount},I({template:u}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(n.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",L(S.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",L(S.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",L(S.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",te()))})}}function G(){var e=S.y;return window.innerWidth>768&&window.innerHeight>v+2*e}function W(e){var t=e.type,n=S.position,o=S.x,i=S.y;return G()||"widget"!==t?"top-left"===n?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===n?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===n?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}:{top:"0",left:"0",right:"0",bottom:"0"}}function z(){return G()?{width:"".concat(y,"px"),height:"".concat(v,"px")}:{width:"100%",height:"100%"}}function Y(e){return"start"===e.animation?"game"===S.mode?"translateY(20%)":"scale(0.8)":"game"===S.mode?"translateY(0)":"scale(1)"}function K(e){return t(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,t.sent()];case 2:t.sent(),t.label=3;case 3:return t.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,t.sent()];case 5:return t.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function X(){return t(this,void 0,void 0,(function(){var e,t,o,i,r,s;return n(this,(function(n){switch(n.label){case 0:if(Q(),S.retryRecordRetentionTimerId&&(clearTimeout(S.retryRecordRetentionTimerId),S.retryRecordRetentionTimerId=null),S.retentionRemainingSeconds=null,S.isRetentionRecordedForSession=!0,!(e=O()))return[2];t="https://".concat(S.domain,"/api/sdk/retention"),o=N({supportViewConfig:e}),i={token:S.token,deviceId:S.deviceId,language:S.language,metadata:o},n.label=1;case 1:return n.trys.push([1,5,,6]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=n.sent()).ok?[3,4]:[4,K(r)];case 3:throw n.sent();case 4:return[3,6];case 5:return s=n.sent(),console.error("Error tracking retention:",s),S.retryRecordRetentionTimerId=setTimeout(X,6e4),[3,6];case 6:return[2]}}))}))}function J(){var e=new Date;if(S.sessionStatus="active",S.sessionResumeOrStartTime=e,S.sessionStartTime){var t=S.sessionStartTime.valueOf()/1e3+S.resetSessionAfterSecs;Date.now()/1e3>t&&V()}else V();if(null!==S.retentionRemainingSeconds&&(S.recordRetentionTimerId=setTimeout(X,1e3*S.retentionRemainingSeconds)),!S.eventsPollerTimerId)if(S.eventsNextPollAt){var n=Math.floor((S.eventsNextPollAt.valueOf()-Date.now())/1e3);n>0?B(n):H()}else H()}function V(){S.sessionStartTime=new Date,S.retentionRemainingSeconds=S.recordRetentionAfterSecs,S.isRetentionRecordedForSession=!1,Q()}function Z(){S.eventsPollerTimerId&&(clearTimeout(S.eventsPollerTimerId),S.eventsPollerTimerId=null)}function Q(){S.recordRetentionTimerId&&(clearTimeout(S.recordRetentionTimerId),S.recordRetentionTimerId=null)}function $(){H(),S.isRetentionRecordedForSession&&X()}function ee(e){var t=document.querySelector(h.sdkButtonIframe);if(t)var n=setInterval((function(){var o,i;"complete"===(null===(o=t.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(n),null===(i=null==t?void 0:t.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function te(){var e,t,n;return null!==(n=null===(e=S.locs.widgetButtonText)||void 0===e?void 0:e[null!==(t=S.language)&&void 0!==t?t:"en"])&&void 0!==n?n:"Support"}function ne(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===S.sessionStatus?J():e||"active"!==S.sessionStatus||function(){if(S.sessionResumeOrStartTime&&S.retentionRemainingSeconds){var e=Math.floor((Date.now()-S.sessionResumeOrStartTime.valueOf())/1e3);S.retentionRemainingSeconds-=e}S.sessionStatus="paused",Z(),Q()}()}document.addEventListener("visibilitychange",ne),window.addEventListener("focus",ne),window.addEventListener("blur",ne),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var t=document.querySelector(h.sdkLoaderIframe),n=document.querySelector(h.sdkIframe);S.networkErrorTimerId&&(clearTimeout(S.networkErrorTimerId),S.networkErrorTimerId=null),n&&(n.style.width="100%",n.style.height="100%"),t&&t.remove()}else if("theymes.close"===e.data.action)C();else if("theymes.closeNotification"===e.data.action)j({notification:S.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:S.visibleNotification},(null==(s=r.notification)?void 0:s.action)&&"OPEN_PAGE"===s.action.type&&(R({path:s.action.path}),j({notification:s}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(h.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*x)),E();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);window.open(e.data.url,o?"_self":"_blank")}var i,r,s}),!1),_("open",(function(){S.sdkIsOpen=!0})),_("close",(function(){S.sdkIsOpen=!1})),exports.addEventListener=_,exports.addField=function(e,t){S.fields[e]=t,D()},exports.addFields=function(t){S.fields=e(e({},S.fields),t),D()},exports.addTag=function(e){S.tags.add(e),D()},exports.addTags=function(e){e.forEach((function(e){return S.tags.add(e)})),D()},exports.close=C,exports.disableLogging=function(){S.loggingEnabled=!1},exports.disableNotifications=function(){S.notificationsPaused=!0},exports.enableLogging=function(){S.loggingEnabled=!0},exports.enableNotifications=function(){S.notificationsPaused=!1,H()},exports.getFields=function(){return S.fields},exports.getLanguage=function(){return S.language},exports.getPlayer=function(){return S.player},exports.getSdkVersion=function(){return f},exports.getSignedMetadataToken=function(){return S.signedMetadataToken},exports.getTags=function(){return Array.from(S.tags)},exports.getUnansweredMessageCount=function(){return S.unansweredMessageCount},exports.getUnreadMessageCount=function(){return S.unreadMessageCount},exports.initialize=function(o,i,r){return t(void 0,void 0,void 0,(function(){var t,s,a,l,c,d,u,p,f,h,y;return n(this,(function(n){switch(n.label){case 0:if(!o||!i||!r.mode)throw new Error("Token, domain, and mode are required");S.token=o,S.domain=i,S.mode=r.mode,S.element="element"in r&&void 0!==r.element?r.element:S.element,S.language=null!==(d=r.language)&&void 0!==d?d:S.language,S.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var t=crypto.randomUUID();return localStorage.setItem("deviceId",t),t}(),S.widgetButton="button"in r&&void 0!==r.button&&null!==(u=r.button)&&void 0!==u?u:S.widgetButton,S.position="position"in r&&void 0!==r.position&&null!==(p=r.position)&&void 0!==p?p:S.position,S.x="x"in r&&void 0!==r.x?r.x:S.x,S.y="y"in r&&void 0!==r.y?r.y:S.y,H(),t="https://".concat(i,"/api/sdk/initialize"),s={token:o,deviceId:S.deviceId,platform:m,mode:S.mode},n.label=1;case 1:return n.trys.push([1,6,,7]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})];case 2:return(a=n.sent()).ok?[3,4]:[4,K(a)];case 3:throw n.sent();case 4:return[4,a.json()];case 5:return l=n.sent(),(null===(f=null==l?void 0:l.branding)||void 0===f?void 0:f.colors)&&(v=l.branding.colors,S.colors=e(e({},S.colors),v),localStorage.setItem(g,JSON.stringify(S.colors))),(null===(h=null==l?void 0:l.branding)||void 0===h?void 0:h.locs)&&(S.locs=l.branding.locs),(null===(y=null==l?void 0:l.branding)||void 0===y?void 0:y.fonts)&&(S.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(S.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(S.resetSessionAfterSecs=l.resetSessionAfterSecs),J(),D(),S.widgetButton&&q(),[3,7];case 6:return c=n.sent(),console.error("Error initializing SDK:",c),[3,7];case 7:return[2]}var v}))}))},exports.isPrivacyMode=function(){return S.privacyMode},exports.isSupported=function(){return!0},exports.isYoungPlayer=function(){return S.youngPlayer},exports.openAssistant=function(e){var t="/assistant";P({path:t,config:e}),R({path:t,config:e})},exports.openResource=function(e,t){var n="/resources/".concat(e);P({path:n,config:t}),R({path:n,config:t})},exports.openSupport=E,exports.recordRetention=function(){S.isRetentionRecordedForSession||X()},exports.removeAllFields=function(){S.fields={},D()},exports.removeAllTags=function(){S.tags.clear(),D()},exports.removeEventListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.apply(void 0,e)},exports.removeField=function(e){delete S.fields[e],D()},exports.removeFields=function(e){e.forEach((function(e){return delete S.fields[e]})),D()},exports.removeTag=function(e){S.tags.delete(e),D()},exports.removeTags=function(e){e.forEach((function(e){return S.tags.delete(e)})),D()},exports.requestNotificationPermission=function(){},exports.reset=function(){S.language=null,S.tags=new Set,S.fields={},S.signedMetadataToken=null,S.player=null,D(),ee({action:"widgetButtonTextUpdate",text:te()})},exports.setFields=function(e){S.fields=e,D()},exports.setLanguage=function(e){var t=S.language!==e;S.language=e,t&&(D(),ee({action:"widgetButtonTextUpdate",text:te()}))},exports.setPlayer=function(e){var t,n=(null===(t=S.player)||void 0===t?void 0:t.id)!==(null==e?void 0:e.id);S.player=e,n&&(D(),$())},exports.setPrivacyMode=function(e){S.privacyMode=e,D()},exports.setSignedMetadataToken=function(e){var t=S.signedMetadataToken!==e;S.signedMetadataToken=e,t&&(D(),$())},exports.setTags=function(e){S.tags=new Set(e),D()},exports.setYoungPlayer=function(e){S.youngPlayer=e,D()};
|
|
1
|
+
"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},e.apply(this,arguments)};function t(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{l(o.next(e))}catch(e){r(e)}}function a(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((o=o.apply(e,t||[])).next())}))}function n(e,t){var n,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(r=0)),r;)try{if(n=1,o&&(i=2&a[0]?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,o=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){r.label=a[1];break}if(6===a[0]&&r.label<i[1]){r.label=i[1],i=a;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(a);break}i[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],o=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function o(e,t,n){if(n||2===arguments.length)for(var o,i=0,r=t.length;i<r;i++)!o&&i in t||(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var i={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function r(e,t){i[e].add(t)}function s(e,t){i[e].delete(t)}function a(e,t){i[e].forEach((function(e){return e.apply(void 0,t)}))}var l='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button" onclick="closeTheymesSdk()">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval" role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg> \n </div>\n </div>\n <script>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button" onclick="closeTheymesSdk()">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text" onclick="notificationClicked()">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button" onclick="closeNotification()">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button" onclick="openWidget()">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </div>\n <script>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n updateUnreadMessageCount();\n\n window.addEventListener(\'message\', iframeSubscriber, false);\n <\/script>\n</body>\n\n</html>',p=function(e,t){return e===t||Boolean(e&&t&&"object"==typeof e&&"object"==typeof t&&Object.keys(e).length===Object.keys(t).length&&Object.entries(e).every((function(e){var n=e[0],o=e[1];return p(o,t[n])})))},g="colors",f="1.1.8",m="web",h={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},y=360,v=720,b=120,w=48,k=.2,x=.2,S=.2,T="theymes_path_on_init",E={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var t=localStorage.getItem(g);if(t){var n=JSON.parse(t);return e(e({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),n)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null},C=function(e){var t="/help-center";N({path:t,config:e}),D({path:t,config:e})},_=function(e){var t="/assistant";N({path:t,config:e}),D({path:t,config:e})},I=function(){!function(){var e=document.querySelector(h.sdkDialog),t=document.querySelector(h.sdkIframeWrapper);if(e){var n=function(){"widget"!==E.mode||E.forceUpdateSdkDialog?e.remove():e.style.display="none",E.forceUpdateSdkDialog=!1};t?(t.style.opacity="0",t.style.transform=K({animation:"start"}),setTimeout((function(){n()}),1e3*k)):n()}E.widgetButton&&W();a("close",[])}(),U()},O=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.apply(void 0,e)};function A(t){var n,i,r,s,a,l,c=(null!=t?t:{}).config;if(!E.token||!E.domain||!E.deviceId)return null;var d=null!==(n=null==c?void 0:c.tags)&&void 0!==n?n:[],u=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},p=null!==(s=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:E.language)&&void 0!==s?s:null,g=null!==(a=E.signedMetadataToken)&&void 0!==a?a:null,h=null!==(l=E.player)&&void 0!==l?l:null,y={_platform:m,_sdkVersion:f};E.youngPlayer&&(y._youngPlayer=!0),(E.privacyMode||E.youngPlayer)&&(y._privacyMode=!0);var v=o(o([],Array.from(E.tags),!0),d,!0),b=e(e(e({},E.fields),u),y);return{token:E.token,domain:E.domain,deviceId:E.deviceId,tags:v,fields:b,language:p,signedMetadataToken:g,player:h}}function L(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function R(e){var t,n,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",m).replace("'INSET_TOP_PLACEHOLDER'","".concat(E.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(E.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(E.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(E.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",L(E.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",L(E.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",L(E.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",L(E.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",L(E.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",L(E.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",L(E.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===E.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(n=null===(t=E.fonts.body)||void 0===t?void 0:t.regular)&&void 0!==n?n:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=E.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif")}function P(e){var t,n=e.iframe,o=e.content,i=null===(t=n.contentWindow)||void 0===t?void 0:t.document;i&&(i.open(),i.write(o),i.close())}function D(e){var t,n,o,i=A({config:e.config});if(i){!function(){if(!document.querySelector(h.sdkStylesheet)){var e=document.createElement("style");e.id=h.sdkStylesheet.replace("#",""),e.textContent="\n ".concat(h.sdkDialog," {\n max-width: none !important;\n max-height: none !important;\n }\n\n ").concat(h.sdkDialog,"::backdrop {\n background: transparent !important;\n }\n "),document.body.appendChild(e)}}();var r=null!==(t=document.querySelector(h.sdkDialog))&&void 0!==t?t:document.createElement("div");r.id=h.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="0",r.style.right="0",r.style.bottom="0",r.style.left="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var s=null!==(n=r.querySelector(h.sdkIframeWrapper))&&void 0!==n?n:document.createElement("div");s.id=h.sdkIframeWrapper.replace("#",""),s.style.position="relative",s.style.width="100%",s.style.height="100%",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.left="0",s.style.opacity="0",s.style.colorScheme="auto",s.style.border="none",s.style.backgroundColor="rgb(".concat(L(E.colors.background),")"),s.style.transform=K({animation:"start"}),s.style.transition=(E.mode,"opacity ".concat(k,"s ease-in-out, transform ").concat(k,"s ease-in-out")),"widget"===E.mode&&(s.style.overflow="hidden");var d=null!==(o=s.querySelector(h.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=h.sdkLoaderIframe.replace("#",""),d.style.position="absolute",d.style.border="none",d.style.width="100%",d.style.height="100%",d.style.top="0",d.style.right="0",d.style.bottom="0",d.style.left="0",d.style.colorScheme="auto";var u=s.querySelector(h.sdkIframe),p=null!=u?u:document.createElement("iframe"),g=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(g),y())}),500);p.id=h.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!E.networkErrorTimerId||(p.src=function(e){var t=e.path,n=e.supportViewConfig,o="https://".concat(E.domain,"/sdk"),i=new URLSearchParams;i.set("platform",m),i.set("token",n.token),i.set("deviceId",n.deviceId),i.set("mode",E.mode),i.set("origin",window.location.origin),n.language&&i.set("language",n.language);var r=B({supportViewConfig:n});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(t,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(s),s.appendChild(d),s.appendChild(p),document.body.appendChild(r)),P({iframe:d,content:R({template:l})});var f=!1,y=function(){f||(f=!0,E.networkErrorTimerId=setTimeout((function(){P({iframe:d,content:R({template:c})})}),1e4))};p.onload=y,p.onerror=function(){P({iframe:d,content:R({template:c})})},H(),a("open",[]),setTimeout((function(){s.style.opacity="1",s.style.transform=K({animation:"end"})}),100)}}function N(e){var t=e.path,n=e.config,o=null!=n?n:null;E.previousPath===t&&p(E.previousConfig,o)||(E.previousPath=t,E.previousConfig=o,M())}function M(){var e=document.querySelector(h.sdkDialog);E.sdkIsOpen?E.forceUpdateSdkDialog=!0:null==e||e.remove()}function B(e){var t=e.supportViewConfig,n={unsigned:{},signed:void 0};return t.player&&(n.unsigned.player=t.player),t.tags&&(n.unsigned.tags=t.tags),t.fields&&(n.unsigned.fields=t.fields),t.signedMetadataToken&&(n.signed=t.signedMetadataToken),n}function H(){var e=document.querySelector(h.sdkDialog),t=document.querySelector(h.sdkIframeWrapper);if(e&&t){if("widget"===E.mode){var n=Y({type:"widget"}),o=J();e.style.width=o.width,e.style.height=o.height,e.style.bottom=n.bottom,e.style.right=n.right,e.style.left=n.left,e.style.top=n.top,z()?(t.style.border="1px solid rgb(".concat(L(E.colors.border),")"),t.style.borderRadius="10px"):(t.style.border="none",t.style.borderRadius="0")}else if(t.style.border="none",t.style.borderRadius="0",E.element){var i=E.element.getBoundingClientRect(),r=i.width,s=i.height,a=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(s,"px"),e.style.top="".concat(a,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0";requestAnimationFrame(H)}}function F(e){var t=1e3*e;E.eventsNextPollAt=new Date(Date.now()+t),E.eventsPollerTimerId=setTimeout(U,t)}function U(){return t(this,void 0,void 0,(function(){var t,i,r,s,l,c,d,u;return n(this,(function(n){switch(n.label){case 0:if($(),!E.token||!E.domain||!E.deviceId)return F(60),[2];t=E.notificationsPaused||E.sdkIsOpen?"true":"false",i="https://".concat(E.domain,"/api/sdk/events"),r=new URLSearchParams(e(e({token:E.token,language:null!==(d=E.language)&&void 0!==d?d:"en",deviceId:E.deviceId,notificationsPaused:t,mode:E.mode},(null===(u=E.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:E.player.id}:{}),E.signedMetadataToken?{signedMetadataToken:E.signedMetadataToken}:{})).toString(),n.label=1;case 1:return n.trys.push([1,6,,7]),[4,fetch("".concat(i,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(s=n.sent()).ok?[3,4]:[4,X(s)];case 3:throw n.sent();case 4:return[4,s.json()];case 5:return l=n.sent(),E.notifications=o(o([],E.notifications,!0),l.notifications,!0),l.notifications.length>0&&j(),l.unansweredMessageCount!==E.unansweredMessageCount&&(E.unansweredMessageCount=l.unansweredMessageCount,a("unansweredMessageCountUpdate",[l.unansweredMessageCount])),l.unreadMessageCount!==E.unreadMessageCount&&(E.unreadMessageCount=l.unreadMessageCount,a("unreadMessageCountUpdate",[l.unreadMessageCount]),ne({action:"unreadMessageCountUpdate",count:l.unreadMessageCount})),F(l.nextPollSeconds),[3,7];case 6:return c=n.sent(),console.error("Error initializing SDK:",c),F(60),[3,7];case 7:return[2]}}))}))}function j(){var e,t,n=E.notifications[0];if(n&&!E.visibleNotification){E.visibleNotification=n;var o=null!==(e=document.querySelector(h.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=h.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(t=o.querySelector(h.notificationIframe))&&void 0!==t?t:document.createElement("iframe");r.id=h.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(S,"s ease-in-out, margin-top ").concat(S,"s ease-in-out"),o.appendChild(r),P({iframe:r,content:(i={text:n.text},R({template:d}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),q(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),n.closeAfterSeconds>0&&setTimeout((function(){G({notification:n})}),1e3*n.closeAfterSeconds)}}function q(){var e,t,n,o=document.querySelector(h.notificationDialog),i=document.querySelector(h.notificationIframe);if(o&&i){var r=(null===(n=null===(t=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===n?void 0:n.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===E.mode){var s=Y({type:"widget"}),a=J(),l="calc(".concat(a.width," - 20px)");o.style.width=a.width,o.style.height=a.height,o.style.bottom=s.bottom,o.style.right=s.right,o.style.left=s.left,o.style.top=s.top,i.style.width=l}else if(E.element){var c=E.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px",requestAnimationFrame(q)}}function G(e){if(e.notification&&E.visibleNotification===e.notification){var t=document.querySelector(h.notificationIframe),n=document.querySelector(h.notificationDialog);t&&(t.style.opacity="0",t.style.marginTop="-20px",setTimeout((function(){null==n||n.remove(),E.notifications=E.notifications.slice(1),E.visibleNotification=null,j()}),1e3*S))}}function W(){var e,t=null!==(e=document.querySelector(h.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(t){var n,o=Y({type:"button"});t.id=h.sdkButtonIframe.replace("#",""),t.style.position="fixed",t.style.border="none",t.style.width="".concat(b,"px"),t.style.height="".concat(w,"px"),t.style.maxWidth="95%",t.style.maxHeight="95%",t.style.bottom=o.bottom,t.style.right=o.right,t.style.left=o.left,t.style.top=o.top,t.style.margin="0",t.style.padding="0",t.style.zIndex="9997",t.style.backgroundColor="transparent",t.style.opacity="0",t.style.transform="scale(0.8)",t.style.transition="opacity ".concat(x,"s ease-in-out, transform ").concat(x,"s ease-in-out"),setTimeout((function(){t.style.opacity="1",t.style.transform="scale(1)"}),100),document.body.appendChild(t),P({iframe:t,content:(n={unreadMessageCount:E.unreadMessageCount},R({template:u}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(n.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",L(E.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",L(E.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",L(E.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",oe()))})}}function z(){var e=E.y;return window.innerWidth>768&&window.innerHeight>v+2*e}function Y(e){var t=e.type,n=E.position,o=E.x,i=E.y;return z()||"widget"!==t?"top-left"===n?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===n?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===n?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}:{top:"0",left:"0",right:"0",bottom:"0"}}function J(){return z()?{width:"".concat(y,"px"),height:"".concat(v,"px")}:{width:"100%",height:"100%"}}function K(e){return"start"===e.animation?"game"===E.mode?"translateY(20%)":"scale(0.8)":"game"===E.mode?"translateY(0)":"scale(1)"}function X(e){return t(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,t.sent()];case 2:t.sent(),t.label=3;case 3:return t.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,t.sent()];case 5:return t.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function V(){return t(this,void 0,void 0,(function(){var e,t,o,i,r,s;return n(this,(function(n){switch(n.label){case 0:if(ee(),E.retryRecordRetentionTimerId&&(clearTimeout(E.retryRecordRetentionTimerId),E.retryRecordRetentionTimerId=null),E.retentionRemainingSeconds=null,E.isRetentionRecordedForSession=!0,!(e=A()))return[2];t="https://".concat(E.domain,"/api/sdk/retention"),o=B({supportViewConfig:e}),i={token:E.token,deviceId:E.deviceId,language:E.language,metadata:o},n.label=1;case 1:return n.trys.push([1,5,,6]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=n.sent()).ok?[3,4]:[4,X(r)];case 3:throw n.sent();case 4:return[3,6];case 5:return s=n.sent(),console.error("Error tracking retention:",s),E.retryRecordRetentionTimerId=setTimeout(V,6e4),[3,6];case 6:return[2]}}))}))}function Z(){var e=new Date;if(E.sessionStatus="active",E.sessionResumeOrStartTime=e,E.sessionStartTime){var t=E.sessionStartTime.valueOf()/1e3+E.resetSessionAfterSecs;Date.now()/1e3>t&&Q()}else Q();if(null!==E.retentionRemainingSeconds&&(E.recordRetentionTimerId=setTimeout(V,1e3*E.retentionRemainingSeconds)),!E.eventsPollerTimerId)if(E.eventsNextPollAt){var n=Math.floor((E.eventsNextPollAt.valueOf()-Date.now())/1e3);n>0?F(n):U()}else U()}function Q(){E.sessionStartTime=new Date,E.retentionRemainingSeconds=E.recordRetentionAfterSecs,E.isRetentionRecordedForSession=!1,ee()}function $(){E.eventsPollerTimerId&&(clearTimeout(E.eventsPollerTimerId),E.eventsPollerTimerId=null)}function ee(){E.recordRetentionTimerId&&(clearTimeout(E.recordRetentionTimerId),E.recordRetentionTimerId=null)}function te(){U(),E.isRetentionRecordedForSession&&V()}function ne(e){var t=document.querySelector(h.sdkButtonIframe);if(t)var n=setInterval((function(){var o,i;"complete"===(null===(o=t.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(n),null===(i=null==t?void 0:t.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function oe(){var e,t,n;return null!==(n=null===(e=E.locs.widgetButtonText)||void 0===e?void 0:e[null!==(t=E.language)&&void 0!==t?t:"en"])&&void 0!==n?n:"Support"}function ie(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===E.sessionStatus?Z():e||"active"!==E.sessionStatus||function(){if(E.sessionResumeOrStartTime&&E.retentionRemainingSeconds){var e=Math.floor((Date.now()-E.sessionResumeOrStartTime.valueOf())/1e3);E.retentionRemainingSeconds-=e}E.sessionStatus="paused",$(),ee()}()}document.addEventListener("visibilitychange",ie),window.addEventListener("focus",ie),window.addEventListener("blur",ie),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var t=document.querySelector(h.sdkLoaderIframe),n=document.querySelector(h.sdkIframe);E.networkErrorTimerId&&(clearTimeout(E.networkErrorTimerId),E.networkErrorTimerId=null),n&&(n.style.width="100%",n.style.height="100%"),t&&t.remove()}else if("theymes.close"===e.data.action)I();else if("theymes.closeNotification"===e.data.action)G({notification:E.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:E.visibleNotification},(null==(s=r.notification)?void 0:s.action)&&"OPEN_PAGE"===s.action.type&&(D({path:s.action.path}),G({notification:s}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(h.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*x)),"support"===E.widgetButtonAction?C():"assistant"===E.widgetButtonAction&&_();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var t=e.key,n=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,s={value:n,expiry:Date.now()+o};r.setItem(t,JSON.stringify(s))}({key:T,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,s}),!1),O("open",(function(){E.sdkIsOpen=!0})),O("close",(function(){E.sdkIsOpen=!1})),exports.addEventListener=O,exports.addField=function(e,t){E.fields[e]=t,M()},exports.addFields=function(t){E.fields=e(e({},E.fields),t),M()},exports.addTag=function(e){E.tags.add(e),M()},exports.addTags=function(e){e.forEach((function(e){return E.tags.add(e)})),M()},exports.close=I,exports.disableLogging=function(){E.loggingEnabled=!1},exports.disableNotifications=function(){E.notificationsPaused=!0},exports.enableLogging=function(){E.loggingEnabled=!0},exports.enableNotifications=function(){E.notificationsPaused=!1,U()},exports.getFields=function(){return E.fields},exports.getLanguage=function(){return E.language},exports.getPlayer=function(){return E.player},exports.getSdkVersion=function(){return f},exports.getSignedMetadataToken=function(){return E.signedMetadataToken},exports.getTags=function(){return Array.from(E.tags)},exports.getUnansweredMessageCount=function(){return E.unansweredMessageCount},exports.getUnreadMessageCount=function(){return E.unreadMessageCount},exports.initialize=function(o,i,r){return t(void 0,void 0,void 0,(function(){var t,s,a,l,c,d,u,p,f,h,y,v,b;return n(this,(function(n){switch(n.label){case 0:if(!o||!i||!r.mode)throw new Error("Token, domain, and mode are required");E.token=o,E.domain=i,E.mode=r.mode,E.element="element"in r&&void 0!==r.element?r.element:E.element,E.language=null!==(u=r.language)&&void 0!==u?u:E.language,E.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var t=crypto.randomUUID();return localStorage.setItem("deviceId",t),t}(),E.widgetButton="button"in r&&void 0!==r.button&&null!==(p=r.button)&&void 0!==p?p:E.widgetButton,E.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(f=r.buttonAction)&&void 0!==f?f:E.widgetButtonAction,E.position="position"in r&&void 0!==r.position&&null!==(h=r.position)&&void 0!==h?h:E.position,E.x="x"in r&&void 0!==r.x?r.x:E.x,E.y="y"in r&&void 0!==r.y?r.y:E.y,U(),t="https://".concat(i,"/api/sdk/initialize"),s={token:o,deviceId:E.deviceId,platform:m,mode:E.mode},n.label=1;case 1:return n.trys.push([1,6,,7]),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})];case 2:return(a=n.sent()).ok?[3,4]:[4,X(a)];case 3:throw n.sent();case 4:return[4,a.json()];case 5:return l=n.sent(),(null===(y=null==l?void 0:l.branding)||void 0===y?void 0:y.colors)&&(w=l.branding.colors,E.colors=e(e({},E.colors),w),localStorage.setItem(g,JSON.stringify(E.colors))),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.locs)&&(E.locs=l.branding.locs),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.fonts)&&(E.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(E.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(E.resetSessionAfterSecs=l.resetSessionAfterSecs),Z(),M(),c=function(e){var t=e.key,n=e.storage,o=void 0===n?sessionStorage:n,i=e.removeItem,r=void 0!==i&&i,s=o.getItem(t);if(!s)return null;var a=JSON.parse(s);return Date.now()>a.expiry?(sessionStorage.removeItem(t),null):(r&&o.removeItem(t),a.value)}({key:T,removeItem:!0}),c?D({path:c}):E.widgetButton&&W(),[3,7];case 6:return d=n.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var w}))}))},exports.isPrivacyMode=function(){return E.privacyMode},exports.isSupported=function(){return!0},exports.isYoungPlayer=function(){return E.youngPlayer},exports.openAssistant=_,exports.openResource=function(e,t){var n="/resources/".concat(e);N({path:n,config:t}),D({path:n,config:t})},exports.openSupport=C,exports.recordRetention=function(){E.isRetentionRecordedForSession||V()},exports.removeAllFields=function(){E.fields={},M()},exports.removeAllTags=function(){E.tags.clear(),M()},exports.removeEventListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.apply(void 0,e)},exports.removeField=function(e){delete E.fields[e],M()},exports.removeFields=function(e){e.forEach((function(e){return delete E.fields[e]})),M()},exports.removeTag=function(e){E.tags.delete(e),M()},exports.removeTags=function(e){e.forEach((function(e){return E.tags.delete(e)})),M()},exports.requestNotificationPermission=function(){},exports.reset=function(){E.language=null,E.tags=new Set,E.fields={},E.signedMetadataToken=null,E.player=null,M(),ne({action:"widgetButtonTextUpdate",text:oe()})},exports.setFields=function(e){E.fields=e,M()},exports.setLanguage=function(e){var t=E.language!==e;E.language=e,t&&(M(),ne({action:"widgetButtonTextUpdate",text:oe()}))},exports.setPlayer=function(e){var t,n=(null===(t=E.player)||void 0===t?void 0:t.id)!==(null==e?void 0:e.id);E.player=e,n&&(M(),te())},exports.setPrivacyMode=function(e){E.privacyMode=e,M()},exports.setSignedMetadataToken=function(e){var t=E.signedMetadataToken!==e;E.signedMetadataToken=e,t&&(M(),te())},exports.setTags=function(e){E.tags=new Set(e),M()},exports.setYoungPlayer=function(e){E.youngPlayer=e,M()};
|
package/dist/sdk.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=function(){return e=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},e.apply(this,arguments)};function n(e,n,t,o){return new(t||(t=Promise))((function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((o=o.apply(e,n||[])).next())}))}function t(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function o(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var i={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function r(e,n){i[e].add(n)}function a(e,n){i[e].delete(n)}function s(e,n){i[e].forEach((function(e){return e.apply(void 0,n)}))}var l='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n background: rgb(CSS_TILE_PLACEHOLDER);\n display: flex;\n width: 100%;\n border-bottom: 1px solid rgb(CSS_BORDER_PLACEHOLDER);\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button" onclick="closeTheymesSdk()">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval"\n role="img">\n <g fill="none" fillRule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18">\n <animateTransform attributeName="transform" type="rotate" from="0 18 18" to="360 18 18" dur="1s"\n repeatCount="indefinite" />\n </path>\n </g>\n </g>\n </svg>\n </div>\n </div>\n <script>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n background: rgb(CSS_TILE_PLACEHOLDER);\n display: flex;\n width: 100%;\n border-bottom: 1px solid rgb(CSS_BORDER_PLACEHOLDER);\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button" onclick="closeTheymesSdk()">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text" onclick="notificationClicked()">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button" onclick="closeNotification()">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button" onclick="openWidget()">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </div>\n <script>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n updateUnreadMessageCount();\n\n window.addEventListener(\'message\', iframeSubscriber, false);\n <\/script>\n</body>\n\n</html>',p=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every((function(e){var t=e[0],o=e[1];return p(o,n[t])})))},f="colors",g="1.1.0b",m="web",h={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},y=360,v=720,b=120,w=48,k=.2,S=.2,T=.2,E={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var n=localStorage.getItem(f);if(n){var t=JSON.parse(n);return e(e({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),t)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null},C=function(o,i,r){return n(void 0,void 0,void 0,(function(){var n,a,s,l,c,d,u,p,g,h,y;return t(this,(function(t){switch(t.label){case 0:if(!o||!i||!r.mode)throw new Error("Token, domain, and mode are required");E.token=o,E.domain=i,E.mode=r.mode,E.element="element"in r&&void 0!==r.element?r.element:E.element,E.language=null!==(d=r.language)&&void 0!==d?d:E.language,E.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=crypto.randomUUID();return localStorage.setItem("deviceId",n),n}(),E.widgetButton="button"in r&&void 0!==r.button&&null!==(u=r.button)&&void 0!==u?u:E.widgetButton,E.position="position"in r&&void 0!==r.position&&null!==(p=r.position)&&void 0!==p?p:E.position,E.x="x"in r&&void 0!==r.x?r.x:E.x,E.y="y"in r&&void 0!==r.y?r.y:E.y,Te(),n="https://".concat(i,"/api/sdk/initialize"),a={token:o,deviceId:E.deviceId,platform:m,mode:E.mode},t.label=1;case 1:return t.trys.push([1,6,,7]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];case 2:return(s=t.sent()).ok?[3,4]:[4,Re(s)];case 3:throw t.sent();case 4:return[4,s.json()];case 5:return l=t.sent(),(null===(g=null==l?void 0:l.branding)||void 0===g?void 0:g.colors)&&(v=l.branding.colors,E.colors=e(e({},E.colors),v),localStorage.setItem(f,JSON.stringify(E.colors))),(null===(h=null==l?void 0:l.branding)||void 0===h?void 0:h.locs)&&(E.locs=l.branding.locs),(null===(y=null==l?void 0:l.branding)||void 0===y?void 0:y.fonts)&&(E.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(E.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(E.resetSessionAfterSecs=l.resetSessionAfterSecs),Pe(),be(),E.widgetButton&&_e(),[3,7];case 6:return c=t.sent(),console.error("Error initializing SDK:",c),[3,7];case 7:return[2]}var v}))}))},x=function(e){var n="/help-center";ve({path:n,config:e}),ye({path:n,config:e})},_=function(e){var n="/assistant";ve({path:n,config:e}),ye({path:n,config:e})},O=function(e,n){var t="/resources/".concat(e);ve({path:t,config:n}),ye({path:t,config:n})},I=function(){!function(){var e=document.querySelector(h.sdkDialog),n=document.querySelector(h.sdkIframeWrapper);if(e){var t=function(){"widget"!==E.mode||E.forceUpdateSdkDialog?e.remove():e.style.display="none",E.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=Le({animation:"start"}),setTimeout((function(){t()}),1e3*k)):t()}E.widgetButton&&_e();s("close",[])}(),Te()},A=function(){return E.language},L=function(e){var n=E.language!==e;E.language=e,n&&(be(),Fe({action:"widgetButtonTextUpdate",text:Ue()}))},R=function(){return E.signedMetadataToken},D=function(e){var n=E.signedMetadataToken!==e;E.signedMetadataToken=e,n&&(be(),He())},P=function(){return E.player},N=function(e){var n,t=(null===(n=E.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);E.player=e,t&&(be(),He())},B=function(){return Array.from(E.tags)},M=function(e){E.tags=new Set(e),be()},H=function(e){E.tags.add(e),be()},F=function(e){e.forEach((function(e){return E.tags.add(e)})),be()},U=function(e){E.tags.delete(e),be()},j=function(e){e.forEach((function(e){return E.tags.delete(e)})),be()},q=function(){E.tags.clear(),be()},G=function(){return E.fields},W=function(e){E.fields=e,be()},z=function(e,n){E.fields[e]=n,be()},Y=function(n){E.fields=e(e({},E.fields),n),be()},K=function(e){delete E.fields[e],be()},X=function(e){e.forEach((function(e){return delete E.fields[e]})),be()},J=function(){E.fields={},be()},V=function(){E.loggingEnabled=!0},Z=function(){E.loggingEnabled=!1},Q=function(){return E.youngPlayer},$=function(e){E.youngPlayer=e,be()},ee=function(){return E.privacyMode},ne=function(e){E.privacyMode=e,be()},te=function(){return!0},oe=function(){},ie=function(){E.notificationsPaused=!1,Te()},re=function(){E.notificationsPaused=!0},ae=function(){return E.unreadMessageCount},se=function(){return E.unansweredMessageCount},le=function(){return g},ce=function(){E.language=null,E.tags=new Set,E.fields={},E.signedMetadataToken=null,E.player=null,be(),Fe({action:"widgetButtonTextUpdate",text:Ue()})},de=function(){E.isRetentionRecordedForSession||De()},ue=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(void 0,e)},pe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function fe(n){var t,i,r,a,s,l,c=(null!=n?n:{}).config;if(!E.token||!E.domain||!E.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],u=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},p=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:E.language)&&void 0!==a?a:null,f=null!==(s=E.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=E.player)&&void 0!==l?l:null,y={_platform:m,_sdkVersion:g};E.youngPlayer&&(y._youngPlayer=!0),(E.privacyMode||E.youngPlayer)&&(y._privacyMode=!0);var v=o(o([],Array.from(E.tags),!0),d,!0),b=e(e(e({},E.fields),u),y);return{token:E.token,domain:E.domain,deviceId:E.deviceId,tags:v,fields:b,language:p,signedMetadataToken:f,player:h}}function ge(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function me(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",m).replace("'INSET_TOP_PLACEHOLDER'","".concat(E.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(E.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(E.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(E.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",ge(E.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",ge(E.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",ge(E.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",ge(E.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",ge(E.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",ge(E.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",ge(E.colors.notificationText)).replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(t=null===(n=E.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=E.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif")}function he(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function ye(e){var n,t,o,i=fe({config:e.config});if(i){!function(){if(!document.querySelector(h.sdkStylesheet)){var e=document.createElement("style");e.id=h.sdkStylesheet.replace("#",""),e.textContent="\n ".concat(h.sdkDialog," {\n max-width: none !important;\n max-height: none !important;\n }\n\n ").concat(h.sdkDialog,"::backdrop {\n background: transparent !important;\n }\n "),document.body.appendChild(e)}}();var r=null!==(n=document.querySelector(h.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=h.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="0",r.style.right="0",r.style.bottom="0",r.style.left="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(h.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=h.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.backgroundColor="rgb(".concat(ge(E.colors.background),")"),a.style.transform=Le({animation:"start"}),a.style.transition=(E.mode,"opacity ".concat(k,"s ease-in-out, transform ").concat(k,"s ease-in-out")),"widget"===E.mode&&(a.style.overflow="hidden",a.style.borderRadius="10px",a.style.border="1px solid rgb(".concat(ge(E.colors.border),")"));var d=null!==(o=a.querySelector(h.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=h.sdkLoaderIframe.replace("#",""),d.style.position="absolute",d.style.border="none",d.style.width="100%",d.style.height="100%",d.style.top="0",d.style.right="0",d.style.bottom="0",d.style.left="0",d.style.colorScheme="auto";var u=a.querySelector(h.sdkIframe),p=null!=u?u:document.createElement("iframe"),f=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(f),y())}),500);p.id=h.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!E.networkErrorTimerId||(p.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(E.domain,"/sdk"),i=new URLSearchParams;i.set("platform",m),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",E.mode),t.language&&i.set("language",t.language);var r=we({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(a),a.appendChild(d),a.appendChild(p),document.body.appendChild(r)),he({iframe:d,content:me({template:l})});var g=!1,y=function(){g||(g=!0,E.networkErrorTimerId=setTimeout((function(){he({iframe:d,content:me({template:c})})}),1e4))};p.onload=y,p.onerror=function(){he({iframe:d,content:me({template:c})})},ke(),s("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=Le({animation:"end"})}),100)}}function ve(e){var n=e.path,t=e.config,o=null!=t?t:null;E.previousPath===n&&p(E.previousConfig,o)||(E.previousPath=n,E.previousConfig=o,be())}function be(){var e=document.querySelector(h.sdkDialog);E.sdkIsOpen?E.forceUpdateSdkDialog=!0:null==e||e.remove()}function we(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function ke(){var e=document.querySelector(h.sdkDialog);if(e){if("widget"===E.mode){var n=Ie({type:"widget"}),t=Ae();e.style.width=t.width,e.style.height=t.height,e.style.bottom=n.bottom,e.style.right=n.right,e.style.left=n.left,e.style.top=n.top}else if(E.element){var o=E.element.getBoundingClientRect(),i=o.width,r=o.height,a=o.top,s=o.left,l=o.right,c=o.bottom;e.style.width="".concat(i,"px"),e.style.height="".concat(r,"px"),e.style.top="".concat(a,"px"),e.style.left="".concat(s,"px"),e.style.right="".concat(l,"px"),e.style.bottom="".concat(c,"px")}else e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0";requestAnimationFrame(ke)}}function Se(e){var n=1e3*e;E.eventsNextPollAt=new Date(Date.now()+n),E.eventsPollerTimerId=setTimeout(Te,n)}function Te(){return n(this,void 0,void 0,(function(){var n,i,r,a,l,c,d,u;return t(this,(function(t){switch(t.label){case 0:if(Be(),!E.token||!E.domain||!E.deviceId)return Se(60),[2];n=E.notificationsPaused||E.sdkIsOpen?"true":"false",i="https://".concat(E.domain,"/api/sdk/events"),r=new URLSearchParams(e(e({token:E.token,language:null!==(d=E.language)&&void 0!==d?d:"en",deviceId:E.deviceId,notificationsPaused:n,mode:E.mode},(null===(u=E.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:E.player.id}:{}),E.signedMetadataToken?{signedMetadataToken:E.signedMetadataToken}:{})).toString(),t.label=1;case 1:return t.trys.push([1,6,,7]),[4,fetch("".concat(i,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(a=t.sent()).ok?[3,4]:[4,Re(a)];case 3:throw t.sent();case 4:return[4,a.json()];case 5:return l=t.sent(),E.notifications=o(o([],E.notifications,!0),l.notifications,!0),l.notifications.length>0&&Ee(),l.unansweredMessageCount!==E.unansweredMessageCount&&(E.unansweredMessageCount=l.unansweredMessageCount,s("unansweredMessageCountUpdate",[l.unansweredMessageCount])),l.unreadMessageCount!==E.unreadMessageCount&&(E.unreadMessageCount=l.unreadMessageCount,s("unreadMessageCountUpdate",[l.unreadMessageCount]),Fe({action:"unreadMessageCountUpdate",count:l.unreadMessageCount})),Se(l.nextPollSeconds),[3,7];case 6:return c=t.sent(),console.error("Error initializing SDK:",c),Se(60),[3,7];case 7:return[2]}}))}))}function Ee(){var e,n,t=E.notifications[0];if(t&&!E.visibleNotification){E.visibleNotification=t;var o=null!==(e=document.querySelector(h.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=h.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(h.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=h.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(T,"s ease-in-out, margin-top ").concat(T,"s ease-in-out"),o.appendChild(r),he({iframe:r,content:(i={text:t.text},me({template:d}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),Ce(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),t.closeAfterSeconds>0&&setTimeout((function(){xe({notification:t})}),1e3*t.closeAfterSeconds)}}function Ce(){var e,n,t,o=document.querySelector(h.notificationDialog),i=document.querySelector(h.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===E.mode){var a=Ie({type:"widget"}),s=Ae(),l="calc(".concat(s.width," - 20px)");o.style.width=s.width,o.style.height=s.height,o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,i.style.width=l}else if(E.element){var c=E.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px",requestAnimationFrame(Ce)}}function xe(e){if(e.notification&&E.visibleNotification===e.notification){var n=document.querySelector(h.notificationIframe),t=document.querySelector(h.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),E.notifications=E.notifications.slice(1),E.visibleNotification=null,Ee()}),1e3*T))}}function _e(){var e,n=null!==(e=document.querySelector(h.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=Ie({type:"button"});n.id=h.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(b,"px"),n.style.height="".concat(w,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(S,"s ease-in-out, transform ").concat(S,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),he({iframe:n,content:(t={unreadMessageCount:E.unreadMessageCount},me({template:u}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",ge(E.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",ge(E.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",ge(E.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",Ue()))})}}function Oe(){var e=E.y;return window.innerWidth>768&&window.innerHeight>v+2*e}function Ie(e){var n=e.type,t=E.position,o=E.x,i=E.y;return Oe()||"widget"!==n?"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}:{top:"0",left:"0",right:"0",bottom:"0"}}function Ae(){return Oe()?{width:"".concat(y,"px"),height:"".concat(v,"px")}:{width:"100%",height:"100%"}}function Le(e){return"start"===e.animation?"game"===E.mode?"translateY(20%)":"scale(0.8)":"game"===E.mode?"translateY(0)":"scale(1)"}function Re(e){return n(this,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function De(){return n(this,void 0,void 0,(function(){var e,n,o,i,r,a;return t(this,(function(t){switch(t.label){case 0:if(Me(),E.retryRecordRetentionTimerId&&(clearTimeout(E.retryRecordRetentionTimerId),E.retryRecordRetentionTimerId=null),E.retentionRemainingSeconds=null,E.isRetentionRecordedForSession=!0,!(e=fe()))return[2];n="https://".concat(E.domain,"/api/sdk/retention"),o=we({supportViewConfig:e}),i={token:E.token,deviceId:E.deviceId,language:E.language,metadata:o},t.label=1;case 1:return t.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=t.sent()).ok?[3,4]:[4,Re(r)];case 3:throw t.sent();case 4:return[3,6];case 5:return a=t.sent(),console.error("Error tracking retention:",a),E.retryRecordRetentionTimerId=setTimeout(De,6e4),[3,6];case 6:return[2]}}))}))}function Pe(){var e=new Date;if(E.sessionStatus="active",E.sessionResumeOrStartTime=e,E.sessionStartTime){var n=E.sessionStartTime.valueOf()/1e3+E.resetSessionAfterSecs;Date.now()/1e3>n&&Ne()}else Ne();if(null!==E.retentionRemainingSeconds&&(E.recordRetentionTimerId=setTimeout(De,1e3*E.retentionRemainingSeconds)),!E.eventsPollerTimerId)if(E.eventsNextPollAt){var t=Math.floor((E.eventsNextPollAt.valueOf()-Date.now())/1e3);t>0?Se(t):Te()}else Te()}function Ne(){E.sessionStartTime=new Date,E.retentionRemainingSeconds=E.recordRetentionAfterSecs,E.isRetentionRecordedForSession=!1,Me()}function Be(){E.eventsPollerTimerId&&(clearTimeout(E.eventsPollerTimerId),E.eventsPollerTimerId=null)}function Me(){E.recordRetentionTimerId&&(clearTimeout(E.recordRetentionTimerId),E.recordRetentionTimerId=null)}function He(){Te(),E.isRetentionRecordedForSession&&De()}function Fe(e){var n=document.querySelector(h.sdkButtonIframe);if(n)var t=setInterval((function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function Ue(){var e,n,t;return null!==(t=null===(e=E.locs.widgetButtonText)||void 0===e?void 0:e[null!==(n=E.language)&&void 0!==n?n:"en"])&&void 0!==t?t:"Support"}function je(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===E.sessionStatus?Pe():e||"active"!==E.sessionStatus||function(){if(E.sessionResumeOrStartTime&&E.retentionRemainingSeconds){var e=Math.floor((Date.now()-E.sessionResumeOrStartTime.valueOf())/1e3);E.retentionRemainingSeconds-=e}E.sessionStatus="paused",Be(),Me()}()}document.addEventListener("visibilitychange",je),window.addEventListener("focus",je),window.addEventListener("blur",je),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(h.sdkLoaderIframe),t=document.querySelector(h.sdkIframe);E.networkErrorTimerId&&(clearTimeout(E.networkErrorTimerId),E.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)I();else if("theymes.closeNotification"===e.data.action)xe({notification:E.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:E.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(ye({path:a.action.path}),xe({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(h.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*S)),x();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),ue("open",(function(){E.sdkIsOpen=!0})),ue("close",(function(){E.sdkIsOpen=!1}));export{ue as addEventListener,z as addField,Y as addFields,H as addTag,F as addTags,I as close,Z as disableLogging,re as disableNotifications,V as enableLogging,ie as enableNotifications,G as getFields,A as getLanguage,P as getPlayer,le as getSdkVersion,R as getSignedMetadataToken,B as getTags,se as getUnansweredMessageCount,ae as getUnreadMessageCount,C as initialize,ee as isPrivacyMode,te as isSupported,Q as isYoungPlayer,_ as openAssistant,O as openResource,x as openSupport,de as recordRetention,J as removeAllFields,q as removeAllTags,pe as removeEventListener,K as removeField,X as removeFields,U as removeTag,j as removeTags,oe as requestNotificationPermission,ce as reset,W as setFields,L as setLanguage,N as setPlayer,ne as setPrivacyMode,D as setSignedMetadataToken,M as setTags,$ as setYoungPlayer};
|
|
1
|
+
var e=function(){return e=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},e.apply(this,arguments)};function n(e,n,t,o){return new(t||(t=Promise))((function(i,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((o=o.apply(e,n||[])).next())}))}function t(e,n){var t,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(t=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e],o=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function o(e,n,t){if(t||2===arguments.length)for(var o,i=0,r=n.length;i<r;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var i={unreadMessageCountUpdate:new Set,unansweredMessageCountUpdate:new Set,open:new Set,close:new Set};function r(e,n){i[e].add(n)}function a(e,n){i[e].delete(n)}function s(e,n){i[e].forEach((function(e){return e.apply(void 0,n)}))}var l='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .loader-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .loader {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 2rem;\n height: 2rem;\n animation: spin 1s linear infinite;\n transform-origin: center;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button" onclick="closeTheymesSdk()">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="loader-wrapper">\n <svg class="loader" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" fill="none" data-test-name="oval" role="img">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity="0.5" cx="18" cy="18" r="18" />\n <path d="M36 18c0-9.94-8.06-18-18-18" />\n </g>\n </g>\n </svg> \n </div>\n </div>\n <script>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',c='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n font-size: CSS_FONT_SIZE_PLACEHOLDER;\n }\n\n html,\n body {\n background: rgb(CSS_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n padding-top: \'INSET_TOP_PLACEHOLDER\';\n padding-right: \'INSET_RIGHT_PLACEHOLDER\';\n padding-bottom: \'INSET_BOTTOM_PLACEHOLDER\';\n padding-left: \'INSET_LEFT_PLACEHOLDER\';\n }\n\n .top-bar {\n flex: 0 0 auto;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: flex-end;\n }\n\n .close-button {\n padding: 0.5rem 1rem;\n cursor: pointer;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n width: 1.75rem;\n height: 1.75rem;\n }\n\n .error-wrapper {\n flex: 1 0 0%;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n align-items: center;\n justify-content: center;\n text-align: center;\n gap: 12px;\n padding: 12px;\n }\n\n h1 {\n font-size: 18px;\n font-weight: 400;\n color: rgb(CSS_TEXT_PLACEHOLDER);\n }\n\n svg.error-icon {\n stroke: rgb(CSS_ACCENT_PLACEHOLDER);\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="wrapper">\n <div class="top-bar">\n <div class="close-button" onclick="closeTheymesSdk()">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\n </div>\n </div>\n <div class="error-wrapper">\n <svg class="error-icon" width="91" height="91" viewBox="0 0 91 91" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path\n d="M45.1079 89.1321C50.7158 89.1321 55.2618 84.5859 55.2618 78.9783C55.2618 73.3707 50.7158 68.8245 45.1079 68.8245C39.5001 68.8245 34.9541 73.3707 34.9541 78.9783C34.9541 84.5859 39.5001 89.1321 45.1079 89.1321Z"\n stroke="#FFB547" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />\n <path d="M24.7637 58.6355C35.9988 47.4005 54.2144 47.4005 65.4492 58.6355" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M12.7988 46.6689C22.1436 37.3241 34.529 32.8731 46.7703 33.3159" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M1.1084 34.4283C11.6674 23.9971 25.012 18.0833 38.7295 16.6868" stroke="#FFB547" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round" />\n <path d="M89.1082 1.13208L62.0312 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n <path d="M62.0312 1.13208L89.1082 28.209" stroke="#FFB547" stroke-width="2" stroke-linecap="round"\n stroke-linejoin="round" />\n </svg>\n <div>\n <h1>Connection error</h1>\n </div>\n </div>\n </div>\n <script>\n function closeTheymesSdk() {\n parent.postMessage({ action: \'theymes.close\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',d='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <link rel="preload" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback" as="font"\n type="font/woff2" crossorigin>\n <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=fallback">\n <title>Theymes</title>\n <style>\n * {\n box-sizing: border-box;\n }\n\n html {\n font-family: \'Poppins\', sans-serif;\n }\n\n html,\n body {\n width: 100%;\n height: auto;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .close-button svg {\n display: block;\n stroke: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n width: 1.25rem;\n height: 1.25rem;\n }\n\n .notification {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: rgb(CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: auto;\n margin: 0;\n padding: 12px;\n border-radius: 6px;\n color: rgb(CSS_NOTIFICATION_TEXT_PLACEHOLDER);\n }\n\n .notification-text {\n flex: 1 0 0%;\n font-size: 0.875rem;\n /* 14/16 */\n line-height: 1.2;\n display: -webkit-box;\n line-clamp: 2;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n\n .close-button {\n flex: 0 0 auto;\n padding-left: 10px;\n cursor: pointer;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div class="notification">\n <div class="notification-text" onclick="notificationClicked()">NOTIFICATION_TEXT_PLACEHOLDER</div>\n <div class="close-button" onclick="closeNotification()">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"\n stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 6 6 18"></path>\n <path d="m6 6 12 12"></path>\n </svg>\n </div>\n </div>\n <script>\n function closeNotification() {\n parent.postMessage({ action: \'theymes.closeNotification\' }, \'*\');\n }\n\n function notificationClicked() {\n parent.postMessage({ action: \'theymes.handleNotificationAction\' }, \'*\');\n }\n <\/script>\n</body>\n\n</html>',u='<!DOCTYPE html>\n<html lang="en">\n\n<head>\n <meta charset="utf-8" />\n <meta name="viewport"\n content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <meta name="theme-color" content="#000000" />\n <meta name="robots" content="noindex" />\n <link rel="preconnect" href="https://fonts.googleapis.com">\n <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n <title>Theymes</title>\n <style>\n @font-face {\n font-family: \'TheymesBody\';\n src: CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER;\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n\n * {\n box-sizing: border-box;\n }\n\n html,\n body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n touch-action: none;\n }\n\n .sdk-button {\n display: flex;\n font-family: \'TheymesBody\', CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER;\n background: rgb(CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER);\n width: 100%;\n height: 100%;\n align-items: center;\n justify-content: center;\n color: rgb(CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER);\n font-size: 14px;\n font-weight: 700;\n cursor: pointer;\n text-align: center;\n padding: 0 12px;\n border: none;\n outline: none;\n border-radius: 999px;\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n position: relative;\n }\n\n .sdk-button-badge {\n position: absolute;\n top: 0;\n right: 0;\n background: rgb(CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER);\n width: 12px;\n height: 12px;\n border-radius: 999px;\n display: none;\n }\n </style>\n</head>\n\n<body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <button class="sdk-button" onclick="openWidget()">\n <span class="sdk-button-text">WIDGET_BUTTON_TEXT_PLACEHOLDER</span>\n <span class="sdk-button-badge"></span>\n </div>\n <script>\n let unreadMessageCount = UNREAD_MESSAGE_COUNT_PLACEHOLDER;\n\n function openWidget() {\n parent.postMessage({ action: \'theymes.sdkButtonClicked\' }, \'*\');\n }\n\n function iframeSubscriber(e) {\n if (e.data.action === \'unreadMessageCountUpdate\') {\n unreadMessageCount = e.data.count;\n updateUnreadMessageCount()\n } else if (e.data.action === \'widgetButtonTextUpdate\') {\n document.querySelector(\'.sdk-button-text\').textContent = e.data.text;\n }\n }\n\n function updateUnreadMessageCount() {\n if (unreadMessageCount > 0) {\n document.querySelector(\'.sdk-button-badge\').style.display = \'block\';\n } else {\n document.querySelector(\'.sdk-button-badge\').style.display = \'none\';\n }\n }\n\n updateUnreadMessageCount();\n\n window.addEventListener(\'message\', iframeSubscriber, false);\n <\/script>\n</body>\n\n</html>',p=function(e,n){return e===n||Boolean(e&&n&&"object"==typeof e&&"object"==typeof n&&Object.keys(e).length===Object.keys(n).length&&Object.entries(e).every((function(e){var t=e[0],o=e[1];return p(o,n[t])})))},f="colors",g="1.1.8",m="web",h={sdkDialog:"#theymes-sdk-dialog",sdkIframeWrapper:"#theymes-sdk-wrapper",sdkIframe:"#theymes-sdk",sdkLoaderIframe:"#theymes-sdk-loader",notificationDialog:"#theymes-sdk-notification-dialog",notificationIframe:"#theymes-sdk-notification",sdkButtonIframe:"#theymes-sdk-button",sdkStylesheet:"#theymes-sdk-stylesheet"},y=360,v=720,b=120,w=48,k=.2,S=.2,T=.2,E="theymes_path_on_init",C={token:null,domain:null,mode:"game",deviceId:null,position:"bottom-right",widgetButton:!1,widgetButtonAction:"support",x:20,y:20,loggingEnabled:!1,element:null,language:null,tags:new Set,fields:{},youngPlayer:!1,privacyMode:!1,signedMetadataToken:null,player:null,sdkIsOpen:!1,forceUpdateSdkDialog:!1,recordRetentionAfterSecs:null,resetSessionAfterSecs:28800,sessionStatus:"waiting",sessionStartTime:null,sessionResumeOrStartTime:null,retentionRemainingSeconds:null,isRetentionRecordedForSession:!1,recordRetentionTimerId:null,retryRecordRetentionTimerId:null,networkErrorTimerId:null,colors:function(){var n=localStorage.getItem(f);if(n){var t=JSON.parse(n);return e(e({},{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}),t)}return{text:{r:255,g:255,b:255},border:{r:51,g:54,b:71},background:{r:12,g:15,b:20},tile:{r:20,g:23,b:29},accent:{r:255,g:181,b:71},notificationBackground:{r:20,g:23,b:29},notificationText:{r:255,g:255,b:255},widgetButtonBackground:{r:12,g:15,b:20},widgetButtonText:{r:12,g:15,b:20},widgetButtonActionPending:{r:255,g:65,b:65}}}(),locs:{widgetButtonText:{}},fonts:{body:void 0},eventsNextPollAt:null,eventsPollerTimerId:null,notificationsPaused:!0,notifications:[],visibleNotification:null,unreadMessageCount:0,unansweredMessageCount:0,insets:{top:0,bottom:0,left:0,right:0},previousPath:null,previousConfig:null},x=function(o,i,r){return n(void 0,void 0,void 0,(function(){var n,a,s,l,c,d,u,p,g,h,y,v,b;return t(this,(function(t){switch(t.label){case 0:if(!o||!i||!r.mode)throw new Error("Token, domain, and mode are required");C.token=o,C.domain=i,C.mode=r.mode,C.element="element"in r&&void 0!==r.element?r.element:C.element,C.language=null!==(u=r.language)&&void 0!==u?u:C.language,C.deviceId=function(){var e=localStorage.getItem("deviceId");if(e)return e;var n=crypto.randomUUID();return localStorage.setItem("deviceId",n),n}(),C.widgetButton="button"in r&&void 0!==r.button&&null!==(p=r.button)&&void 0!==p?p:C.widgetButton,C.widgetButtonAction="buttonAction"in r&&void 0!==r.buttonAction&&null!==(g=r.buttonAction)&&void 0!==g?g:C.widgetButtonAction,C.position="position"in r&&void 0!==r.position&&null!==(h=r.position)&&void 0!==h?h:C.position,C.x="x"in r&&void 0!==r.x?r.x:C.x,C.y="y"in r&&void 0!==r.y?r.y:C.y,Ee(),n="https://".concat(i,"/api/sdk/initialize"),a={token:o,deviceId:C.deviceId,platform:m,mode:C.mode},t.label=1;case 1:return t.trys.push([1,6,,7]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})];case 2:return(s=t.sent()).ok?[3,4]:[4,De(s)];case 3:throw t.sent();case 4:return[4,s.json()];case 5:return l=t.sent(),(null===(y=null==l?void 0:l.branding)||void 0===y?void 0:y.colors)&&(w=l.branding.colors,C.colors=e(e({},C.colors),w),localStorage.setItem(f,JSON.stringify(C.colors))),(null===(v=null==l?void 0:l.branding)||void 0===v?void 0:v.locs)&&(C.locs=l.branding.locs),(null===(b=null==l?void 0:l.branding)||void 0===b?void 0:b.fonts)&&(C.fonts=l.branding.fonts),"number"==typeof(null==l?void 0:l.recordRetentionAfterSecs)&&(C.recordRetentionAfterSecs=l.recordRetentionAfterSecs),"number"==typeof(null==l?void 0:l.resetSessionAfterSecs)&&(C.resetSessionAfterSecs=l.resetSessionAfterSecs),Ne(),we(),c=function(e){var n=e.key,t=e.storage,o=void 0===t?sessionStorage:t,i=e.removeItem,r=void 0!==i&&i,a=o.getItem(n);if(!a)return null;var s=JSON.parse(a);return Date.now()>s.expiry?(sessionStorage.removeItem(n),null):(r&&o.removeItem(n),s.value)}({key:E,removeItem:!0}),c?ve({path:c}):C.widgetButton&&Ie(),[3,7];case 6:return d=t.sent(),console.error("Error initializing SDK:",d),[3,7];case 7:return[2]}var w}))}))},_=function(e){var n="/help-center";be({path:n,config:e}),ve({path:n,config:e})},I=function(e){var n="/assistant";be({path:n,config:e}),ve({path:n,config:e})},O=function(e,n){var t="/resources/".concat(e);be({path:t,config:n}),ve({path:t,config:n})},A=function(){!function(){var e=document.querySelector(h.sdkDialog),n=document.querySelector(h.sdkIframeWrapper);if(e){var t=function(){"widget"!==C.mode||C.forceUpdateSdkDialog?e.remove():e.style.display="none",C.forceUpdateSdkDialog=!1};n?(n.style.opacity="0",n.style.transform=Re({animation:"start"}),setTimeout((function(){t()}),1e3*k)):t()}C.widgetButton&&Ie();s("close",[])}(),Ee()},L=function(){return C.language},R=function(e){var n=C.language!==e;C.language=e,n&&(we(),Ue({action:"widgetButtonTextUpdate",text:je()}))},D=function(){return C.signedMetadataToken},P=function(e){var n=C.signedMetadataToken!==e;C.signedMetadataToken=e,n&&(we(),Fe())},N=function(){return C.player},B=function(e){var n,t=(null===(n=C.player)||void 0===n?void 0:n.id)!==(null==e?void 0:e.id);C.player=e,t&&(we(),Fe())},M=function(){return Array.from(C.tags)},H=function(e){C.tags=new Set(e),we()},F=function(e){C.tags.add(e),we()},U=function(e){e.forEach((function(e){return C.tags.add(e)})),we()},j=function(e){C.tags.delete(e),we()},q=function(e){e.forEach((function(e){return C.tags.delete(e)})),we()},G=function(){C.tags.clear(),we()},W=function(){return C.fields},z=function(e){C.fields=e,we()},Y=function(e,n){C.fields[e]=n,we()},J=function(n){C.fields=e(e({},C.fields),n),we()},K=function(e){delete C.fields[e],we()},X=function(e){e.forEach((function(e){return delete C.fields[e]})),we()},V=function(){C.fields={},we()},Z=function(){C.loggingEnabled=!0},Q=function(){C.loggingEnabled=!1},$=function(){return C.youngPlayer},ee=function(e){C.youngPlayer=e,we()},ne=function(){return C.privacyMode},te=function(e){C.privacyMode=e,we()},oe=function(){return!0},ie=function(){},re=function(){C.notificationsPaused=!1,Ee()},ae=function(){C.notificationsPaused=!0},se=function(){return C.unreadMessageCount},le=function(){return C.unansweredMessageCount},ce=function(){return g},de=function(){C.language=null,C.tags=new Set,C.fields={},C.signedMetadataToken=null,C.player=null,we(),Ue({action:"widgetButtonTextUpdate",text:je()})},ue=function(){C.isRetentionRecordedForSession||Pe()},pe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(void 0,e)},fe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];a.apply(void 0,e)};function ge(n){var t,i,r,a,s,l,c=(null!=n?n:{}).config;if(!C.token||!C.domain||!C.deviceId)return null;var d=null!==(t=null==c?void 0:c.tags)&&void 0!==t?t:[],u=null!==(i=null==c?void 0:c.fields)&&void 0!==i?i:{},p=null!==(a=null!==(r=null==c?void 0:c.language)&&void 0!==r?r:C.language)&&void 0!==a?a:null,f=null!==(s=C.signedMetadataToken)&&void 0!==s?s:null,h=null!==(l=C.player)&&void 0!==l?l:null,y={_platform:m,_sdkVersion:g};C.youngPlayer&&(y._youngPlayer=!0),(C.privacyMode||C.youngPlayer)&&(y._privacyMode=!0);var v=o(o([],Array.from(C.tags),!0),d,!0),b=e(e(e({},C.fields),u),y);return{token:C.token,domain:C.domain,deviceId:C.deviceId,tags:v,fields:b,language:p,signedMetadataToken:f,player:h}}function me(e){return"".concat(e.r," ").concat(e.g," ").concat(e.b)}function he(e){var n,t,o,i;return e.template.replace("PLATFORM_PLACEHOLDER",m).replace("'INSET_TOP_PLACEHOLDER'","".concat(C.insets.top,"px")).replace("'INSET_BOTTOM_PLACEHOLDER'","".concat(C.insets.bottom,"px")).replace("'INSET_LEFT_PLACEHOLDER'","".concat(C.insets.left,"px")).replace("'INSET_RIGHT_PLACEHOLDER'","".concat(C.insets.right,"px")).replaceAll("CSS_TEXT_PLACEHOLDER",me(C.colors.text)).replaceAll("CSS_BORDER_PLACEHOLDER",me(C.colors.border)).replaceAll("CSS_BACKGROUND_PLACEHOLDER",me(C.colors.background)).replaceAll("CSS_TILE_PLACEHOLDER",me(C.colors.tile)).replaceAll("CSS_ACCENT_PLACEHOLDER",me(C.colors.accent)).replaceAll("CSS_NOTIFICATION_BACKGROUND_PLACEHOLDER",me(C.colors.notificationBackground)).replaceAll("CSS_NOTIFICATION_TEXT_PLACEHOLDER",me(C.colors.notificationText)).replaceAll("CSS_FONT_SIZE_PLACEHOLDER","game"===C.mode?"16px":"14px").replaceAll("CSS_BODY_FONT_NORMAL_SRC_PLACEHOLDER",null!==(t=null===(n=C.fonts.body)||void 0===n?void 0:n.regular)&&void 0!==t?t:"").replaceAll("CSS_BODY_FALLBACK_FONT_FAMILY_PLACEHOLDER",null!==(i=null===(o=C.fonts.body)||void 0===o?void 0:o.fallback)&&void 0!==i?i:"ui-sans-serif, system-ui, sans-serif")}function ye(e){var n,t=e.iframe,o=e.content,i=null===(n=t.contentWindow)||void 0===n?void 0:n.document;i&&(i.open(),i.write(o),i.close())}function ve(e){var n,t,o,i=ge({config:e.config});if(i){!function(){if(!document.querySelector(h.sdkStylesheet)){var e=document.createElement("style");e.id=h.sdkStylesheet.replace("#",""),e.textContent="\n ".concat(h.sdkDialog," {\n max-width: none !important;\n max-height: none !important;\n }\n\n ").concat(h.sdkDialog,"::backdrop {\n background: transparent !important;\n }\n "),document.body.appendChild(e)}}();var r=null!==(n=document.querySelector(h.sdkDialog))&&void 0!==n?n:document.createElement("div");r.id=h.sdkDialog.replace("#",""),r.style.display="block",r.style.position="fixed",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="0",r.style.right="0",r.style.bottom="0",r.style.left="0",r.style.margin="0",r.style.padding="0",r.style.zIndex="9998",r.style.overflow="hidden",r.style.backgroundColor="transparent";var a=null!==(t=r.querySelector(h.sdkIframeWrapper))&&void 0!==t?t:document.createElement("div");a.id=h.sdkIframeWrapper.replace("#",""),a.style.position="relative",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.left="0",a.style.opacity="0",a.style.colorScheme="auto",a.style.border="none",a.style.backgroundColor="rgb(".concat(me(C.colors.background),")"),a.style.transform=Re({animation:"start"}),a.style.transition=(C.mode,"opacity ".concat(k,"s ease-in-out, transform ").concat(k,"s ease-in-out")),"widget"===C.mode&&(a.style.overflow="hidden");var d=null!==(o=a.querySelector(h.sdkLoaderIframe))&&void 0!==o?o:document.createElement("iframe");d.id=h.sdkLoaderIframe.replace("#",""),d.style.position="absolute",d.style.border="none",d.style.width="100%",d.style.height="100%",d.style.top="0",d.style.right="0",d.style.bottom="0",d.style.left="0",d.style.colorScheme="auto";var u=a.querySelector(h.sdkIframe),p=null!=u?u:document.createElement("iframe"),f=setInterval((function(){var e;"complete"===(null===(e=p.contentDocument)||void 0===e?void 0:e.readyState)&&(clearInterval(f),y())}),500);p.id=h.sdkIframe.replace("#",""),p.style.position="absolute",p.style.border="none",p.style.top="0",p.style.right="0",p.style.bottom="0",p.style.left="0",p.style.colorScheme="auto",u&&!C.networkErrorTimerId||(p.src=function(e){var n=e.path,t=e.supportViewConfig,o="https://".concat(C.domain,"/sdk"),i=new URLSearchParams;i.set("platform",m),i.set("token",t.token),i.set("deviceId",t.deviceId),i.set("mode",C.mode),i.set("origin",window.location.origin),t.language&&i.set("language",t.language);var r=ke({supportViewConfig:t});return i.set("metadata",JSON.stringify(r)),"".concat(o).concat(n,"?").concat(i.toString())}({path:e.path,supportViewConfig:i}),p.style.width="0",p.style.height="0",r.appendChild(a),a.appendChild(d),a.appendChild(p),document.body.appendChild(r)),ye({iframe:d,content:he({template:l})});var g=!1,y=function(){g||(g=!0,C.networkErrorTimerId=setTimeout((function(){ye({iframe:d,content:he({template:c})})}),1e4))};p.onload=y,p.onerror=function(){ye({iframe:d,content:he({template:c})})},Se(),s("open",[]),setTimeout((function(){a.style.opacity="1",a.style.transform=Re({animation:"end"})}),100)}}function be(e){var n=e.path,t=e.config,o=null!=t?t:null;C.previousPath===n&&p(C.previousConfig,o)||(C.previousPath=n,C.previousConfig=o,we())}function we(){var e=document.querySelector(h.sdkDialog);C.sdkIsOpen?C.forceUpdateSdkDialog=!0:null==e||e.remove()}function ke(e){var n=e.supportViewConfig,t={unsigned:{},signed:void 0};return n.player&&(t.unsigned.player=n.player),n.tags&&(t.unsigned.tags=n.tags),n.fields&&(t.unsigned.fields=n.fields),n.signedMetadataToken&&(t.signed=n.signedMetadataToken),t}function Se(){var e=document.querySelector(h.sdkDialog),n=document.querySelector(h.sdkIframeWrapper);if(e&&n){if("widget"===C.mode){var t=Ae({type:"widget"}),o=Le();e.style.width=o.width,e.style.height=o.height,e.style.bottom=t.bottom,e.style.right=t.right,e.style.left=t.left,e.style.top=t.top,Oe()?(n.style.border="1px solid rgb(".concat(me(C.colors.border),")"),n.style.borderRadius="10px"):(n.style.border="none",n.style.borderRadius="0")}else if(n.style.border="none",n.style.borderRadius="0",C.element){var i=C.element.getBoundingClientRect(),r=i.width,a=i.height,s=i.top,l=i.left,c=i.right,d=i.bottom;e.style.width="".concat(r,"px"),e.style.height="".concat(a,"px"),e.style.top="".concat(s,"px"),e.style.left="".concat(l,"px"),e.style.right="".concat(c,"px"),e.style.bottom="".concat(d,"px")}else e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0";requestAnimationFrame(Se)}}function Te(e){var n=1e3*e;C.eventsNextPollAt=new Date(Date.now()+n),C.eventsPollerTimerId=setTimeout(Ee,n)}function Ee(){return n(this,void 0,void 0,(function(){var n,i,r,a,l,c,d,u;return t(this,(function(t){switch(t.label){case 0:if(Me(),!C.token||!C.domain||!C.deviceId)return Te(60),[2];n=C.notificationsPaused||C.sdkIsOpen?"true":"false",i="https://".concat(C.domain,"/api/sdk/events"),r=new URLSearchParams(e(e({token:C.token,language:null!==(d=C.language)&&void 0!==d?d:"en",deviceId:C.deviceId,notificationsPaused:n,mode:C.mode},(null===(u=C.player)||void 0===u?void 0:u.id)?{unsignedPlayerId:C.player.id}:{}),C.signedMetadataToken?{signedMetadataToken:C.signedMetadataToken}:{})).toString(),t.label=1;case 1:return t.trys.push([1,6,,7]),[4,fetch("".concat(i,"?").concat(r),{method:"GET",headers:{"Content-Type":"application/json"}})];case 2:return(a=t.sent()).ok?[3,4]:[4,De(a)];case 3:throw t.sent();case 4:return[4,a.json()];case 5:return l=t.sent(),C.notifications=o(o([],C.notifications,!0),l.notifications,!0),l.notifications.length>0&&Ce(),l.unansweredMessageCount!==C.unansweredMessageCount&&(C.unansweredMessageCount=l.unansweredMessageCount,s("unansweredMessageCountUpdate",[l.unansweredMessageCount])),l.unreadMessageCount!==C.unreadMessageCount&&(C.unreadMessageCount=l.unreadMessageCount,s("unreadMessageCountUpdate",[l.unreadMessageCount]),Ue({action:"unreadMessageCountUpdate",count:l.unreadMessageCount})),Te(l.nextPollSeconds),[3,7];case 6:return c=t.sent(),console.error("Error initializing SDK:",c),Te(60),[3,7];case 7:return[2]}}))}))}function Ce(){var e,n,t=C.notifications[0];if(t&&!C.visibleNotification){C.visibleNotification=t;var o=null!==(e=document.querySelector(h.notificationDialog))&&void 0!==e?e:document.createElement("div");o.id=h.notificationDialog.replace("#",""),o.style.position="fixed",o.style.border="none",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.right="0",o.style.bottom="0",o.style.left="0",o.style.margin="0",o.style.padding="0",o.style.zIndex="9999",o.style.colorScheme="auto",o.style.backgroundColor="transparent",o.style.pointerEvents="none",o.style.overflow="hidden",document.body.appendChild(o);var i,r=null!==(n=o.querySelector(h.notificationIframe))&&void 0!==n?n:document.createElement("iframe");r.id=h.notificationIframe.replace("#",""),r.style.position="absolute",r.style.border="none",r.style.width="0",r.style.height="0",r.style.top="-20px",r.style.left="0",r.style.colorScheme="auto",r.style.pointerEvents="auto",r.style.marginTop="-20px",r.style.opacity="0",r.style.transition="opacity ".concat(T,"s ease-in-out, margin-top ").concat(T,"s ease-in-out"),o.appendChild(r),ye({iframe:r,content:(i={text:t.text},he({template:d}).replaceAll("NOTIFICATION_TEXT_PLACEHOLDER",i.text))}),xe(),setTimeout((function(){r.style.opacity="1",r.style.marginTop="0px"}),500),t.closeAfterSeconds>0&&setTimeout((function(){_e({notification:t})}),1e3*t.closeAfterSeconds)}}function xe(){var e,n,t,o=document.querySelector(h.notificationDialog),i=document.querySelector(h.notificationIframe);if(o&&i){var r=(null===(t=null===(n=null===(e=i.contentWindow)||void 0===e?void 0:e.document)||void 0===n?void 0:n.body)||void 0===t?void 0:t.scrollHeight)?"".concat(i.contentWindow.document.body.scrollHeight,"px"):"0";if("widget"===C.mode){var a=Ae({type:"widget"}),s=Le(),l="calc(".concat(s.width," - 20px)");o.style.width=s.width,o.style.height=s.height,o.style.bottom=a.bottom,o.style.right=a.right,o.style.left=a.left,o.style.top=a.top,i.style.width=l}else if(C.element){var c=C.element.getBoundingClientRect();l="".concat(c.width-20,"px");o.style.width="".concat(c.width,"px"),o.style.height="".concat(c.height,"px"),o.style.top="".concat(c.top,"px"),o.style.left="".concat(c.left,"px"),o.style.right="".concat(c.right,"px"),o.style.bottom="".concat(c.bottom,"px"),i.style.width=l}else{l="calc(100% - 20px)";o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",i.style.width=l}i.style.height=r,i.style.top="10px",i.style.left="10px",requestAnimationFrame(xe)}}function _e(e){if(e.notification&&C.visibleNotification===e.notification){var n=document.querySelector(h.notificationIframe),t=document.querySelector(h.notificationDialog);n&&(n.style.opacity="0",n.style.marginTop="-20px",setTimeout((function(){null==t||t.remove(),C.notifications=C.notifications.slice(1),C.visibleNotification=null,Ce()}),1e3*T))}}function Ie(){var e,n=null!==(e=document.querySelector(h.sdkButtonIframe))&&void 0!==e?e:document.createElement("iframe");if(n){var t,o=Ae({type:"button"});n.id=h.sdkButtonIframe.replace("#",""),n.style.position="fixed",n.style.border="none",n.style.width="".concat(b,"px"),n.style.height="".concat(w,"px"),n.style.maxWidth="95%",n.style.maxHeight="95%",n.style.bottom=o.bottom,n.style.right=o.right,n.style.left=o.left,n.style.top=o.top,n.style.margin="0",n.style.padding="0",n.style.zIndex="9997",n.style.backgroundColor="transparent",n.style.opacity="0",n.style.transform="scale(0.8)",n.style.transition="opacity ".concat(S,"s ease-in-out, transform ").concat(S,"s ease-in-out"),setTimeout((function(){n.style.opacity="1",n.style.transform="scale(1)"}),100),document.body.appendChild(n),ye({iframe:n,content:(t={unreadMessageCount:C.unreadMessageCount},he({template:u}).replaceAll("UNREAD_MESSAGE_COUNT_PLACEHOLDER","".concat(t.unreadMessageCount)).replaceAll("CSS_WIDGET_BUTTON_BACKGROUND_PLACEHOLDER",me(C.colors.widgetButtonBackground)).replaceAll("CSS_WIDGET_BUTTON_TEXT_PLACEHOLDER",me(C.colors.widgetButtonText)).replaceAll("CSS_WIDGET_BUTTON_ACTION_PENDING_PLACEHOLDER",me(C.colors.widgetButtonActionPending)).replaceAll("WIDGET_BUTTON_TEXT_PLACEHOLDER",je()))})}}function Oe(){var e=C.y;return window.innerWidth>768&&window.innerHeight>v+2*e}function Ae(e){var n=e.type,t=C.position,o=C.x,i=C.y;return Oe()||"widget"!==n?"top-left"===t?{top:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",bottom:"auto"}:"top-right"===t?{top:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",bottom:"auto"}:"bottom-left"===t?{bottom:"".concat(o,"px"),left:"".concat(i,"px"),right:"auto",top:"auto"}:{bottom:"".concat(o,"px"),right:"".concat(i,"px"),left:"auto",top:"auto"}:{top:"0",left:"0",right:"0",bottom:"0"}}function Le(){return Oe()?{width:"".concat(y,"px"),height:"".concat(v,"px")}:{width:"100%",height:"100%"}}function Re(e){return"start"===e.animation?"game"===C.mode?"translateY(20%)":"scale(0.8)":"game"===C.mode?"translateY(0)":"scale(1)"}function De(e){return n(this,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,n.sent()];case 2:n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,n.sent()];case 5:return n.sent(),[2,void 0];case 6:return[3,7];case 7:return[2]}}))}))}function Pe(){return n(this,void 0,void 0,(function(){var e,n,o,i,r,a;return t(this,(function(t){switch(t.label){case 0:if(He(),C.retryRecordRetentionTimerId&&(clearTimeout(C.retryRecordRetentionTimerId),C.retryRecordRetentionTimerId=null),C.retentionRemainingSeconds=null,C.isRetentionRecordedForSession=!0,!(e=ge()))return[2];n="https://".concat(C.domain,"/api/sdk/retention"),o=ke({supportViewConfig:e}),i={token:C.token,deviceId:C.deviceId,language:C.language,metadata:o},t.label=1;case 1:return t.trys.push([1,5,,6]),[4,fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})];case 2:return(r=t.sent()).ok?[3,4]:[4,De(r)];case 3:throw t.sent();case 4:return[3,6];case 5:return a=t.sent(),console.error("Error tracking retention:",a),C.retryRecordRetentionTimerId=setTimeout(Pe,6e4),[3,6];case 6:return[2]}}))}))}function Ne(){var e=new Date;if(C.sessionStatus="active",C.sessionResumeOrStartTime=e,C.sessionStartTime){var n=C.sessionStartTime.valueOf()/1e3+C.resetSessionAfterSecs;Date.now()/1e3>n&&Be()}else Be();if(null!==C.retentionRemainingSeconds&&(C.recordRetentionTimerId=setTimeout(Pe,1e3*C.retentionRemainingSeconds)),!C.eventsPollerTimerId)if(C.eventsNextPollAt){var t=Math.floor((C.eventsNextPollAt.valueOf()-Date.now())/1e3);t>0?Te(t):Ee()}else Ee()}function Be(){C.sessionStartTime=new Date,C.retentionRemainingSeconds=C.recordRetentionAfterSecs,C.isRetentionRecordedForSession=!1,He()}function Me(){C.eventsPollerTimerId&&(clearTimeout(C.eventsPollerTimerId),C.eventsPollerTimerId=null)}function He(){C.recordRetentionTimerId&&(clearTimeout(C.recordRetentionTimerId),C.recordRetentionTimerId=null)}function Fe(){Ee(),C.isRetentionRecordedForSession&&Pe()}function Ue(e){var n=document.querySelector(h.sdkButtonIframe);if(n)var t=setInterval((function(){var o,i;"complete"===(null===(o=n.contentDocument)||void 0===o?void 0:o.readyState)&&(clearInterval(t),null===(i=null==n?void 0:n.contentWindow)||void 0===i||i.postMessage(e,"*"))}),100)}function je(){var e,n,t;return null!==(t=null===(e=C.locs.widgetButtonText)||void 0===e?void 0:e[null!==(n=C.language)&&void 0!==n?n:"en"])&&void 0!==t?t:"Support"}function qe(){var e="visible"===document.visibilityState&&document.hasFocus();e&&"paused"===C.sessionStatus?Ne():e||"active"!==C.sessionStatus||function(){if(C.sessionResumeOrStartTime&&C.retentionRemainingSeconds){var e=Math.floor((Date.now()-C.sessionResumeOrStartTime.valueOf())/1e3);C.retentionRemainingSeconds-=e}C.sessionStatus="paused",Me(),He()}()}document.addEventListener("visibilitychange",qe),window.addEventListener("focus",qe),window.addEventListener("blur",qe),window.addEventListener("message",(function(e){if("theymes.ready"===e.data.action){var n=document.querySelector(h.sdkLoaderIframe),t=document.querySelector(h.sdkIframe);C.networkErrorTimerId&&(clearTimeout(C.networkErrorTimerId),C.networkErrorTimerId=null),t&&(t.style.width="100%",t.style.height="100%"),n&&n.remove()}else if("theymes.close"===e.data.action)A();else if("theymes.closeNotification"===e.data.action)_e({notification:C.visibleNotification});else if("theymes.handleNotificationAction"===e.data.action)r={notification:C.visibleNotification},(null==(a=r.notification)?void 0:a.action)&&"OPEN_PAGE"===a.action.type&&(ve({path:a.action.path}),_e({notification:a}));else if("theymes.sdkButtonClicked"===e.data.action)(i=document.querySelector(h.sdkButtonIframe))&&(i.style.opacity="0",i.style.transform="scale(0.8)",setTimeout((function(){i.remove()}),1e3*S)),"support"===C.widgetButtonAction?_():"assistant"===C.widgetButtonAction&&I();else if("theymes.openExternalPage"===e.data.action){var o=e.data.url.startsWith(window.location.origin);o&&function(e){var n=e.key,t=e.value,o=e.ttlMs,i=e.storage,r=void 0===i?sessionStorage:i,a={value:t,expiry:Date.now()+o};r.setItem(n,JSON.stringify(a))}({key:E,value:e.data.path,ttlMs:1e4}),window.open(e.data.url,o?"_self":"_blank")}var i,r,a}),!1),pe("open",(function(){C.sdkIsOpen=!0})),pe("close",(function(){C.sdkIsOpen=!1}));export{pe as addEventListener,Y as addField,J as addFields,F as addTag,U as addTags,A as close,Q as disableLogging,ae as disableNotifications,Z as enableLogging,re as enableNotifications,W as getFields,L as getLanguage,N as getPlayer,ce as getSdkVersion,D as getSignedMetadataToken,M as getTags,le as getUnansweredMessageCount,se as getUnreadMessageCount,x as initialize,ne as isPrivacyMode,oe as isSupported,$ as isYoungPlayer,I as openAssistant,O as openResource,_ as openSupport,ue as recordRetention,V as removeAllFields,G as removeAllTags,fe as removeEventListener,K as removeField,X as removeFields,j as removeTag,q as removeTags,ie as requestNotificationPermission,de as reset,z as setFields,R as setLanguage,B as setPlayer,te as setPrivacyMode,P as setSignedMetadataToken,H as setTags,ee as setYoungPlayer};
|