@inappstory/js-sdk 3.7.0-rc.0 → 3.7.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import*as e from"@inappstory/react-sdk";import*as t from"react/jsx-runtime";import*as r from"react-dom/client";import*as n from"react";import*as o from"react-dom";var a={432:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),o=r.n(n)()((function(e){return e[1]}));o.push([e.id,".favorite-story-list-modal--xWjHA{position:fixed;inset:0px;z-index:1090}.favorite-story-list-modal--xWjHA .container--GZBjv{width:100%;height:100%;background:var(--storiesFavoriteBackgroundColor, #333333);display:flex;flex-direction:column;position:relative;overflow-y:auto}.favorite-story-list-modal--xWjHA .header--TjHMD{display:flex;align-content:center;justify-content:center;align-items:center;flex-shrink:0;position:-webkit-sticky;position:sticky;top:0;z-index:100;background:var(--storiesFavoriteTitleBackgroundColor, #333333);box-shadow:0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12),0 1px 3px 0 rgba(0,0,0,.2);padding-top:var(--storiesFavoriteHeaderTopOffset, 0px);margin-bottom:25px}.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:1rem;margin-bottom:1rem;font-size:1.2em;color:var(--storiesFavoriteTitleColor, white);font-family:var(--storiesFavoriteTitleFontFamily);font-weight:normal;font-size:1.4rem;line-height:normal;font:var(--storiesFavoriteTitleFont, normal)}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:25px;margin-bottom:25px}}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD{margin-bottom:50px}}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:50%;transform:translateY(-50%);z-index:1140;pointer-events:all;cursor:pointer;outline:none;right:10px;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-:focus{outline:none}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm- svg{overflow:visible}.favorite-story-list-modal--xWjHA .footer--edEpn{width:100%;height:25px}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .footer--edEpn{height:50px}}.favorite-story-list-modal--xWjHA .bottom-offset--baiTh{position:-webkit-sticky;position:sticky;z-index:100;background:inherit;bottom:0;width:100%;height:var(--storiesFavoriteBottomOffset, 0px)}.favorite-story-list-modal--xWjHA .content--qCPkX{display:flex;justify-content:center;width:100%;padding:0 25px 25px;box-sizing:border-box}.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{width:100%}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:640px}}@media(min-width: 768px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:768px}}@media(min-width: 1024px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1024px}}@media(min-width: 1280px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1280px}}",""]),o.locals={"favorite-story-list-modal":"favorite-story-list-modal--xWjHA",container:"container--GZBjv",header:"header--TjHMD",title:"title--Dk04x","header__close-btn":"header__close-btn--Jojm-",footer:"footer--edEpn","bottom-offset":"bottom-offset--baiTh",content:"content--qCPkX","favorite-story-list":"favorite-story-list--MISMx"};const a=o},935:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var a=0;a<this.length;a++){var i=this[a][0];null!=i&&(o[i]=!0)}for(var s=0;s<e.length;s++){var l=[].concat(e[s]);n&&o[l[0]]||(r&&(l[2]?l[2]="".concat(r," and ").concat(l[2]):l[2]=r),t.push(l))}},t}},46:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}g(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,o,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var i=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var o,a,i,c;if(s(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),i=a[t]),void 0===i)i=a[t]=r,++e._eventsCount;else if("function"==typeof i?i=a[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=l(e))>0&&i.length>o&&!i.warned){i.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=i.length,c=d,console&&console.warn&&console.warn(c)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=d.bind(n);return o.listener=r,n.wrapFn=o,o}function p(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):f(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(a){n.once&&e.removeEventListener(t,o),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,a=this._events;if(void 0!==a)o=o&&void 0===a.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var l=a[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var c=l.length,d=f(l,c);for(r=0;r<c;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return c(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return c(this,e,t,!0)},a.prototype.once=function(e,t){return s(t),this.on(e,u(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,u(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,o,a,i;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){i=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(o=a[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},a.prototype.listenerCount=h,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},650:(e,t,r)=>{var n=r(942).Symbol;e.exports=n},379:(e,t,r)=>{var n=r(650),o=r(870),a=r(5),i=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):a(e)}},967:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},870:(e,t,r)=>{var n=r(650),o=Object.prototype,a=o.hasOwnProperty,i=o.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var o=i.call(e);return n&&(t?e[s]=r:delete e[s]),o}},5:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},942:(e,t,r)=>{var n=r(967),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},655:(e,t,r)=>{var n=r(379),o=r(580);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},591:(e,t,r)=>{var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),i=[];function s(e){for(var t=-1,r=0;r<i.length;r++)if(i[r].identifier===e){t=r;break}return t}function l(e,t){for(var r={},n=[],o=0;o<e.length;o++){var a=e[o],l=t.base?a[0]+t.base:a[0],c=r[l]||0,d="".concat(l," ").concat(c);r[l]=c+1;var u=s(d),p={css:a[1],media:a[2],sourceMap:a[3]};-1!==u?(i[u].references++,i[u].updater(p)):i.push({identifier:d,updater:y(p,t),references:1}),n.push(d)}return n}function c(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=r.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function p(e,t,r,n){var o=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=u(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function h(e,t,r){var n=r.css,o=r.media,a=r.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var f=null,g=0;function y(e,t){var r,n,o;if(t.singleton){var a=g++;r=f||(f=c(t)),n=p.bind(null,r,a,!1),o=p.bind(null,r,a,!0)}else r=c(t),n=h.bind(null,r,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var r=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var o=s(r[n]);i[o].references--}for(var a=l(e,t),c=0;c<r.length;c++){var d=s(r[c]);0===i[d].references&&(i[d].updater(),i.splice(d,1))}r=a}}}}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={id:e,exports:{}};return a[e](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.nc=void 0;var l={};(()=>{s.d(l,{KL:()=>a.AppearanceManager,Yb:()=>a.CloseButtonPosition,lV:()=>a.GoodsWidgetRenderingType,IV:()=>a.IamCheckDisplayTimeRangeError,tP:()=>a.IamFrequencyLimitError,h8:()=>a.IamMessageLimitExceededError,Xz:()=>a.IamMessageOpenError,wS:()=>a.IamNotFoundByEventError,VS:()=>a.IamNotFoundByIdError,oC:()=>a.IamNotFoundLimitError,L8:()=>a.IamOtherReaderIsOpenError,NL:()=>a.IamShowOnlyIfLoadedError,Ez:()=>a.IasNetworkError,Hp:()=>V,SK:()=>a.StoriesListCardCoverQuality,tI:()=>a.StoriesListCardTitlePosition,Uy:()=>a.StoriesListCardTitleTextAlign,SP:()=>a.StoriesListCardViewVariant,Jj:()=>a.StoriesListDirection,qz:()=>a.StoryReaderSwipeStyle});const a=(e=>{var t={};return s.d(t,e),t})({AppearanceManager:()=>e.AppearanceManager,AppearanceManagerEvents:()=>e.AppearanceManagerEvents,CloseButtonPosition:()=>e.CloseButtonPosition,FavoriteStoryList:()=>e.FavoriteStoryList,GoodsWidgetRenderingType:()=>e.GoodsWidgetRenderingType,IASContainer:()=>e.IASContainer,IamCheckDisplayTimeRangeError:()=>e.IamCheckDisplayTimeRangeError,IamFrequencyLimitError:()=>e.IamFrequencyLimitError,IamMessageLimitExceededError:()=>e.IamMessageLimitExceededError,IamMessageOpenError:()=>e.IamMessageOpenError,IamNotFoundByEventError:()=>e.IamNotFoundByEventError,IamNotFoundByIdError:()=>e.IamNotFoundByIdError,IamNotFoundLimitError:()=>e.IamNotFoundLimitError,IamOtherReaderIsOpenError:()=>e.IamOtherReaderIsOpenError,IamShowOnlyIfLoadedError:()=>e.IamShowOnlyIfLoadedError,IasNetworkError:()=>e.IasNetworkError,StackedStoryListViewModel:()=>e.StackedStoryListViewModel,StoriesListCardCoverQuality:()=>e.StoriesListCardCoverQuality,StoriesListCardTitlePosition:()=>e.StoriesListCardTitlePosition,StoriesListCardTitleTextAlign:()=>e.StoriesListCardTitleTextAlign,StoriesListCardViewVariant:()=>e.StoriesListCardViewVariant,StoriesListDirection:()=>e.StoriesListDirection,StoryFeedType:()=>e.StoryFeedType,StoryList:()=>e.StoryList,StoryReaderSwipeStyle:()=>e.StoryReaderSwipeStyle,UGCFeedSlug:()=>e.UGCFeedSlug,UGCStoryList:()=>e.UGCStoryList,__IAS_INTERNAL_API__:()=>e.__IAS_INTERNAL_API__,storyManager:()=>e.storyManager});class i extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`),this.name="IasAppearanceManagerTypeofError"}}const c=e=>{if(null==e||"object"!=typeof e)throw new i(null==e?"null":typeof e)};class d extends Error{constructor(){super("[IAS]: The <StoryManager> instance has been destroyed, you must create a new instance"),this.name="IasInAppStoryManagerReferenceError"}}class u extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}var p=s(46);class h extends p.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._mountPoint=this.getMountPoint(e),this.app.addItem(this).catch(console.error)}get mountPoint(){return this._mountPoint}get mountSelector(){return this._mountSelector}destroy(){this.app.removeItem(this)}getMountPoint(e){const t=document.querySelector(e);if(!t)throw new u(e);return t}}class f extends h{constructor(e,t,r,n){super(e,r),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),c(t)}get appearanceManager(){return this._appearanceManager}get type(){return a.StoryFeedType.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){var e;return null===(e=this.params)||void 0===e?void 0:e.feed}get testKey(){var e;return null===(e=this.params)||void 0===e?void 0:e.testKey}get useUgcCard(){var e;return Boolean(null===(e=this.params)||void 0===e?void 0:e.useUgcCard)}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}set api(e){this._api=e}async reload(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}}class g extends f{constructor(e,t,r,n){super(e,t,r,{feed:a.UGCFeedSlug,testKey:null==n?void 0:n.testKey,useUgcCard:null==n?void 0:n.useUgcCard}),Object.defineProperty(this,"ugcParams",{enumerable:!0,configurable:!0,writable:!0,value:n}),c(t)}get type(){return a.StoryFeedType.UGC}get filter(){var e;return null===(e=this.ugcParams)||void 0===e?void 0:e.filter}}const y=(e=>{var t={};return s.d(t,e),t})({jsx:()=>t.jsx,jsxs:()=>t.jsxs});const m=(e=>{var t={};return s.d(t,e),t})({createRoot:()=>r.createRoot});const v=(e=>{var t={};return s.d(t,e),t})({useEffect:()=>n.useEffect,useLayoutEffect:()=>n.useLayoutEffect,useRef:()=>n.useRef,useState:()=>n.useState});var b=s(591),S=s.n(b),M=s(432),L={insert:"head",singleton:!1};S()(M.A,L);const C=M.A.locals||{};var w;!function(e){e.LTR="ltr",e.RTL="rtl"}(w||(w={}));const E=({open:e,options:t,storyListOptions:r,onClose:n})=>{var o,i;(0,v.useLayoutEffect)((()=>{if(!e)return;const t=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=t}}),[e]);return e?(0,y.jsx)("div",{className:C["favorite-story-list-modal"],style:(()=>{var e,r,n,o;return{"--storiesFavoriteTitleColor":t.title.color,"--storiesFavoriteTitleFontFamily":"InternalPrimaryFont","--storiesFavoriteTitleFont":t.title.font,"--storiesFavoriteTitleBackgroundColor":t.title.backgroundColor,"--storiesFavoriteHeaderTopOffset":parseFloat(null!==(r=null===(e=t.headerTopOffset)||void 0===e?void 0:e.toString())&&void 0!==r?r:"0")+"px","--storiesFavoriteBottomOffset":parseFloat(null!==(o=null===(n=t.bottomOffset)||void 0===n?void 0:n.toString())&&void 0!==o?o:"0")+"px","--storiesFavoriteBackgroundColor":t.backgroundColor}})(),children:(0,y.jsxs)("div",{className:C.container,children:[(0,y.jsxs)("div",{className:C.header,children:[(0,y.jsx)("p",{className:C.title,children:t.title.content}),(0,y.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:C["header__close-btn"],style:(()=>{var e;const r="start"===t.closeButtonPosition||"left"===t.closeButtonPosition,n=(null===(e=a.storyManager.getConfig())||void 0===e?void 0:e.dir)===w.LTR;return{[r&&n||!r&&!n?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(i=null===(o=t.closeButton)||void 0===o?void 0:o.svgSrc.baseState)&&void 0!==i?i:""}})]}),(0,y.jsx)("div",{className:C.content,children:(0,y.jsx)("div",{className:C["favorite-story-list"],children:(0,y.jsx)(a.FavoriteStoryList,{options:Object.assign(Object.assign(Object.assign({},r),{sidePadding:0}),{direction:a.StoriesListDirection.COLUMN,layout:{height:"auto"}})})})}),(0,y.jsx)("div",{className:C.footer}),(0,y.jsx)("div",{className:C["bottom-offset"]})]})}):null};const x=(e=>{var t={};return s.d(t,e),t})({createPortal:()=>o.createPortal}),O=e=>{(0,v.useEffect)((()=>{const t=e.mountPoint,r=()=>{console.warn(`[IAS]: The node has been removed from DOM. Unsafe destruction of story feed ${e.mountSelector}`),e.destroy()};if(!document.body.contains(t))return void r();const n=new MutationObserver((()=>{document.body.contains(t)||(r(),n.disconnect())}));return n.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect()}}),[e])};var I;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(I||(I={}));const A=({storyList:e,onStoryCardClick:t,onFavoriteCardClick:r})=>{const[n,o]=(0,v.useState)(e.appearanceManager.storiesListOptions),i=(0,v.useRef)(null);return O(e),(0,v.useEffect)((()=>{e.api=i.current}),[]),(0,v.useEffect)((()=>(e.appearanceManager.on(a.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o),()=>{e.appearanceManager.off(a.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o)})),[e.appearanceManager]),(0,x.createPortal)((0,y.jsx)(a.StoryList,{ref:i,options:n,hasFavorite:e.appearanceManager.commonOptions.hasFavorite,testKey:e.testKey,useUgcCard:e.useUgcCard,feedSlug:e.feedSlug,onLoadStart:()=>{e.emit(I.START_LOADER)},onLoadEnd:t=>{e.emit(I.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()},onFavoriteCardClick:r,onStoryCardClick:t}),e.mountPoint)};var j;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(j||(j={}));const _=({ugcStoryList:e,onStoryCardClick:t})=>{const[r,n]=(0,v.useState)(e.appearanceManager.storiesListOptions),o=(0,v.useRef)(null);return O(e),(0,v.useEffect)((()=>{e.api=o.current}),[]),(0,v.useEffect)((()=>(e.appearanceManager.on(a.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,n),()=>{e.appearanceManager.off(a.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,n)})),[e.appearanceManager]),(0,x.createPortal)((0,y.jsx)(a.UGCStoryList,{ref:o,options:r,filter:e.filter,testKey:e.testKey,useUgcCard:e.useUgcCard,onStoryCardClick:t,onLoadStart:()=>{e.emit(j.START_LOADER)},onLoadEnd:t=>{e.emit(j.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()}}),e.mountPoint)},T=e=>{const[t,r]=(0,v.useState)(!1);return(0,y.jsxs)(a.IASContainer,{config:e.storyManagerConfigDto,storyReaderOptions:e.appearanceManager.storyReaderOptions,commonOptions:e.appearanceManager.commonOptions,gameReaderOptions:e.appearanceManager.gameReaderOptions,goodsWidgetOptions:e.appearanceManager.goodsWidgetOptions,children:[e.items.map((t=>t instanceof g?(0,y.jsx)(_,{ugcStoryList:t,onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)}},t.mountSelector):t instanceof f?(0,y.jsx)(A,{onFavoriteCardClick:()=>{r(!0)},onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)},storyList:t},t.mountSelector):void 0)),(0,y.jsx)(E,{open:t,onClose:()=>r(!1),options:e.appearanceManager.storyFavoriteReaderOptions,storyListOptions:e.appearanceManager.storiesListOptions})]})};class P{constructor(){Object.defineProperty(this,"_items",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get items(){return this._items}addItem(e){this._items.push(e)}removeItem(e){const t=this._items.findIndex((t=>t===e));-1!==t&&this._items.splice(t,1)}destroy(){this._items=[]}}class R{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new a.AppearanceManager}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"appItemManager",{enumerable:!0,configurable:!0,writable:!0,value:new P}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}async addItem(e){try{this.appItemManager.addItem(e),await this.storyManager.waitStoryManagerConfig(),this.render()}catch(t){throw this.removeItem(e),t}}async removeItem(e){this.appItemManager.removeItem(e),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){c(e),this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){var e;null===(e=this.root)||void 0===e||e.render((0,y.jsx)(T,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,items:this.appItemManager.items.slice(),onAppearanceManagerChange:this.setAppearanceManager}))}destroy(){this.rootElement&&this.root&&(this.appItemManager.destroy(),this.unscubscribeToAppearanceManagerEvents(),this.root.unmount(),document.body.removeChild(this.rootElement),this.rootElement=null,this.root=null)}createAppRoot(){this.rootElement=document.createElement("div"),this.rootElement.id="ias-app",document.body.append(this.rootElement),this.root=(0,m.createRoot)(this.rootElement)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(a.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(a.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}var k,N=s(655),D=s.n(N);!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(k||(k={}));class F extends p.EventEmitter{constructor(e,t,r,n,o){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:o}),c(t),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(e,t)}async showSharePage(e,t){try{this.app.setAppearanceManager(t),this.handleStartLoad(),await this.storyManager.showSharePage(e),this.storyManager.once("closeStoryReader",this.handleCloseStoryReader),this.handleEndLoad(!0)}catch(e){this.handleEndLoad(!1)}}async closeStoryReader(){this.storyManager.closeStoryReader()}handleStartLoad(){setTimeout((()=>{var e;this.emit(k.START_LOADING),D()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(k.END_LOADING,{result:e}),D()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if(D()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(k.CLOSE_STORY_READER)>0)try{D()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(k.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}class U extends p.EventEmitter{constructor(e,t,r,n){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),c(e),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new a.StackedStoryListViewModel(this.options),this.stackedStoryListViewModel.on("update",this.handleUpdate),this.loadStories().catch(console.error)}get stories(){return this.stackedStoryListViewModel.stories}get length(){return this.stackedStoryListViewModel.length}get activeIndex(){return this.stackedStoryListViewModel.activeIndex}get feedCoverSrc(){return this.stackedStoryListViewModel.feedCoverSrc}get top(){return this.stackedStoryListViewModel.top}async reload(){return this.stackedStoryListViewModel.reload()}destroy(){this.stackedStoryListViewModel.destroy(),this.stackedStoryListViewModel.removeAllListeners()}showStory(e){this.app.setAppearanceManager(this.appearanceManager),this.stackedStoryListViewModel.showStory(e)}on(e,t){return"update"===e?super.on(e,t):(this.stackedStoryListViewModel.on(e,t),this)}once(e,t){return this.stackedStoryListViewModel.once(e,t),this}off(e,t){return this.stackedStoryListViewModel.off(e,t),this}handleUpdate(e){this.emit("update",{id:e.id,title:e.title,titleColor:e.titleColor,hasAudio:e.hasAudio,hasSwipeUp:e.hasSwipeUp,isOpened:e.isOpened,deeplink:e.deeplink,gameInstanceId:e.gameInstanceId,hideInReader:e.hideInReader,hide_timeline:e.hideTimeline,cover:e.getCover(this.appearanceManager.storiesListOptions.card.coverQuality)})}async loadStories(){await this.storyManager.waitStoryManagerConfig(),this.stackedStoryListViewModel.loadStories()}}const H=()=>{if(!V.instance)throw new d};class V{constructor(e){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"__IAS_INTERNAL_API__",{enumerable:!0,configurable:!0,writable:!0,value:a.__IAS_INTERNAL_API__}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new R(a.storyManager)}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends f{constructor(e,t,r){H(),super(e,t,V.instance.app,r)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends g{constructor(e,t,r){H(),super(e,t,V.instance.app,r)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends F{constructor(e,t,r){H(),super(e,t,a.storyManager,V.instance.app,r)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends U{constructor(e,t){H(),super(e,a.storyManager,V.instance.app,t)}}}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:a.storyManager.inAppMessaging}),V.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),V.instance):(a.storyManager.setUserAgent(`InAppStoryJSSDK/${this.sdkVersionCode}`),V.instance=this,this.app.setStoryManagerConfig(e),V.instance)}get sdkVersionName(){return"3.7.0-rc.0"}get sdkVersionCode(){return parseInt(30700)}set storyLinkClickHandler(e){a.storyManager.storyLinkClickHandler=e}static getInstance(){return V.instance?V.instance:null}static use(e,t){e.install({INTERNAL_API:a.__IAS_INTERNAL_API__,HOST:V},t)}getConfig(){return a.storyManager.getConfig()}async showOnboardingStories(e,t){return H(),this.app.setAppearanceManager(e),a.storyManager.showOnboardingStories(t)}async showStory(e,t){H(),this.app.setAppearanceManager(t),await a.storyManager.showStory(e)}async showStoryOnce(e,t){return H(),this.app.setAppearanceManager(t),a.storyManager.showStoryOnce(e)}async showSharePage(e,t){return H(),this.app.setAppearanceManager(t),a.storyManager.showSharePage(e)}closeAllReaders(){a.storyManager.closeAllReaders()}async openGame(e,t,r={}){return H(),this.app.setAppearanceManager(t),a.storyManager.openGame(e,r)}async closeGame(){return a.storyManager.closeGame()}async closeStoryReader(){return a.storyManager.closeStoryReader()}getUgcEditorConfig(){return a.storyManager.getUgcEditorConfig()}closeGoodsWidget(){a.storyManager.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}getNonce(){return a.storyManager.getNonce()}async setUserId(e,t){H(),this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async userLogoug(){return this.setUserId("")}setTags(e){H(),this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){H(),this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){H(),this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(e,t){return a.storyManager.on(e,t),this}once(e,t){return a.storyManager.once(e,t),this}off(e,t){return a.storyManager.off(e,t),this}destroy(){null!=V.instance&&(V.instance=null,this.closeAllReaders(),this.app.destroy())}}})();var c=l.KL,d=l.Yb,u=l.lV,p=l.IV,h=l.tP,f=l.h8,g=l.Xz,y=l.wS,m=l.VS,v=l.oC,b=l.L8,S=l.NL,M=l.Ez,L=l.Hp,C=l.SK,w=l.tI,E=l.Uy,x=l.SP,O=l.Jj,I=l.qz;export{c as AppearanceManager,d as CloseButtonPosition,u as GoodsWidgetRenderingType,p as IamCheckDisplayTimeRangeError,h as IamFrequencyLimitError,f as IamMessageLimitExceededError,g as IamMessageOpenError,y as IamNotFoundByEventError,m as IamNotFoundByIdError,v as IamNotFoundLimitError,b as IamOtherReaderIsOpenError,S as IamShowOnlyIfLoadedError,M as IasNetworkError,L as InAppStoryManager,C as StoriesListCardCoverQuality,w as StoriesListCardTitlePosition,E as StoriesListCardTitleTextAlign,x as StoriesListCardViewVariant,O as StoriesListDirection,I as StoryReaderSwipeStyle};
1
+ import*as e from"@inappstory/react-sdk";import*as t from"react/jsx-runtime";import*as r from"react-dom/client";import*as n from"react";import*as o from"react-dom";var a={432:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),o=r.n(n)()((function(e){return e[1]}));o.push([e.id,".favorite-story-list-modal--xWjHA{position:fixed;inset:0px;z-index:1090}.favorite-story-list-modal--xWjHA .container--GZBjv{width:100%;height:100%;background:var(--storiesFavoriteBackgroundColor, #333333);display:flex;flex-direction:column;position:relative;overflow-y:auto}.favorite-story-list-modal--xWjHA .header--TjHMD{display:flex;align-content:center;justify-content:center;align-items:center;flex-shrink:0;position:-webkit-sticky;position:sticky;top:0;z-index:100;background:var(--storiesFavoriteTitleBackgroundColor, #333333);box-shadow:0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12),0 1px 3px 0 rgba(0,0,0,.2);padding-top:var(--storiesFavoriteHeaderTopOffset, 0px);margin-bottom:25px}.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:1rem;margin-bottom:1rem;font-size:1.2em;color:var(--storiesFavoriteTitleColor, white);font-family:var(--storiesFavoriteTitleFontFamily);font-weight:normal;font-size:1.4rem;line-height:normal;font:var(--storiesFavoriteTitleFont, normal)}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:25px;margin-bottom:25px}}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD{margin-bottom:50px}}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:50%;transform:translateY(-50%);z-index:1140;pointer-events:all;cursor:pointer;outline:none;right:10px;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-:focus{outline:none}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm- svg{overflow:visible}.favorite-story-list-modal--xWjHA .footer--edEpn{width:100%;height:25px}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .footer--edEpn{height:50px}}.favorite-story-list-modal--xWjHA .bottom-offset--baiTh{position:-webkit-sticky;position:sticky;z-index:100;background:inherit;bottom:0;width:100%;height:var(--storiesFavoriteBottomOffset, 0px)}.favorite-story-list-modal--xWjHA .content--qCPkX{display:flex;justify-content:center;width:100%;padding:0 25px 25px;box-sizing:border-box}.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{width:100%}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:640px}}@media(min-width: 768px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:768px}}@media(min-width: 1024px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1024px}}@media(min-width: 1280px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1280px}}",""]),o.locals={"favorite-story-list-modal":"favorite-story-list-modal--xWjHA",container:"container--GZBjv",header:"header--TjHMD",title:"title--Dk04x","header__close-btn":"header__close-btn--Jojm-",footer:"footer--edEpn","bottom-offset":"bottom-offset--baiTh",content:"content--qCPkX","favorite-story-list":"favorite-story-list--MISMx"};const a=o},935:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var a=0;a<this.length;a++){var i=this[a][0];null!=i&&(o[i]=!0)}for(var s=0;s<e.length;s++){var l=[].concat(e[s]);n&&o[l[0]]||(r&&(l[2]?l[2]="".concat(r," and ").concat(l[2]):l[2]=r),t.push(l))}},t}},46:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}g(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,o,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var i=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var o,a,i,c;if(s(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),i=a[t]),void 0===i)i=a[t]=r,++e._eventsCount;else if("function"==typeof i?i=a[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=l(e))>0&&i.length>o&&!i.warned){i.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=i.length,c=d,console&&console.warn&&console.warn(c)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=d.bind(n);return o.listener=r,n.wrapFn=o,o}function p(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):f(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(a){n.once&&e.removeEventListener(t,o),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,a=this._events;if(void 0!==a)o=o&&void 0===a.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var l=a[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var c=l.length,d=f(l,c);for(r=0;r<c;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return c(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return c(this,e,t,!0)},a.prototype.once=function(e,t){return s(t),this.on(e,u(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,u(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,o,a,i;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){i=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(o=a[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},a.prototype.listenerCount=h,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},650:(e,t,r)=>{var n=r(942).Symbol;e.exports=n},379:(e,t,r)=>{var n=r(650),o=r(870),a=r(5),i=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):a(e)}},967:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},870:(e,t,r)=>{var n=r(650),o=Object.prototype,a=o.hasOwnProperty,i=o.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var o=i.call(e);return n&&(t?e[s]=r:delete e[s]),o}},5:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},942:(e,t,r)=>{var n=r(967),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},655:(e,t,r)=>{var n=r(379),o=r(580);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},591:(e,t,r)=>{var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),i=[];function s(e){for(var t=-1,r=0;r<i.length;r++)if(i[r].identifier===e){t=r;break}return t}function l(e,t){for(var r={},n=[],o=0;o<e.length;o++){var a=e[o],l=t.base?a[0]+t.base:a[0],c=r[l]||0,d="".concat(l," ").concat(c);r[l]=c+1;var u=s(d),p={css:a[1],media:a[2],sourceMap:a[3]};-1!==u?(i[u].references++,i[u].updater(p)):i.push({identifier:d,updater:y(p,t),references:1}),n.push(d)}return n}function c(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=r.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function p(e,t,r,n){var o=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=u(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function h(e,t,r){var n=r.css,o=r.media,a=r.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var f=null,g=0;function y(e,t){var r,n,o;if(t.singleton){var a=g++;r=f||(f=c(t)),n=p.bind(null,r,a,!1),o=p.bind(null,r,a,!0)}else r=c(t),n=h.bind(null,r,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var r=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var o=s(r[n]);i[o].references--}for(var a=l(e,t),c=0;c<r.length;c++){var d=s(r[c]);0===i[d].references&&(i[d].updater(),i.splice(d,1))}r=a}}}}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={id:e,exports:{}};return a[e](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.nc=void 0;var l={};(()=>{s.d(l,{KL:()=>a.AppearanceManager,Yb:()=>a.CloseButtonPosition,lV:()=>a.GoodsWidgetRenderingType,IV:()=>a.IamCheckDisplayTimeRangeError,tP:()=>a.IamFrequencyLimitError,h8:()=>a.IamMessageLimitExceededError,Xz:()=>a.IamMessageOpenError,wS:()=>a.IamNotFoundByEventError,VS:()=>a.IamNotFoundByIdError,oC:()=>a.IamNotFoundLimitError,L8:()=>a.IamOtherReaderIsOpenError,NL:()=>a.IamShowOnlyIfLoadedError,Ez:()=>a.IasNetworkError,Hp:()=>V,SK:()=>a.StoriesListCardCoverQuality,tI:()=>a.StoriesListCardTitlePosition,Uy:()=>a.StoriesListCardTitleTextAlign,SP:()=>a.StoriesListCardViewVariant,Jj:()=>a.StoriesListDirection,qz:()=>a.StoryReaderSwipeStyle});const a=(e=>{var t={};return s.d(t,e),t})({AppearanceManager:()=>e.AppearanceManager,AppearanceManagerEvents:()=>e.AppearanceManagerEvents,CloseButtonPosition:()=>e.CloseButtonPosition,FavoriteStoryList:()=>e.FavoriteStoryList,GoodsWidgetRenderingType:()=>e.GoodsWidgetRenderingType,IASContainer:()=>e.IASContainer,IamCheckDisplayTimeRangeError:()=>e.IamCheckDisplayTimeRangeError,IamFrequencyLimitError:()=>e.IamFrequencyLimitError,IamMessageLimitExceededError:()=>e.IamMessageLimitExceededError,IamMessageOpenError:()=>e.IamMessageOpenError,IamNotFoundByEventError:()=>e.IamNotFoundByEventError,IamNotFoundByIdError:()=>e.IamNotFoundByIdError,IamNotFoundLimitError:()=>e.IamNotFoundLimitError,IamOtherReaderIsOpenError:()=>e.IamOtherReaderIsOpenError,IamShowOnlyIfLoadedError:()=>e.IamShowOnlyIfLoadedError,IasNetworkError:()=>e.IasNetworkError,StackedStoryListViewModel:()=>e.StackedStoryListViewModel,StoriesListCardCoverQuality:()=>e.StoriesListCardCoverQuality,StoriesListCardTitlePosition:()=>e.StoriesListCardTitlePosition,StoriesListCardTitleTextAlign:()=>e.StoriesListCardTitleTextAlign,StoriesListCardViewVariant:()=>e.StoriesListCardViewVariant,StoriesListDirection:()=>e.StoriesListDirection,StoryFeedType:()=>e.StoryFeedType,StoryList:()=>e.StoryList,StoryReaderSwipeStyle:()=>e.StoryReaderSwipeStyle,UGCFeedSlug:()=>e.UGCFeedSlug,UGCStoryList:()=>e.UGCStoryList,__IAS_INTERNAL_API__:()=>e.__IAS_INTERNAL_API__,storyManager:()=>e.storyManager});class i extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`),this.name="IasAppearanceManagerTypeofError"}}const c=e=>{if(null==e||"object"!=typeof e)throw new i(null==e?"null":typeof e)};class d extends Error{constructor(){super("[IAS]: The <StoryManager> instance has been destroyed, you must create a new instance"),this.name="IasInAppStoryManagerReferenceError"}}class u extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}var p=s(46);class h extends p.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._mountPoint=this.getMountPoint(e),this.app.addItem(this).catch(console.error)}get mountPoint(){return this._mountPoint}get mountSelector(){return this._mountSelector}destroy(){this.app.removeItem(this)}getMountPoint(e){const t=document.querySelector(e);if(!t)throw new u(e);return t}}class f extends h{constructor(e,t,r,n){super(e,r),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),c(t)}get appearanceManager(){return this._appearanceManager}get type(){return a.StoryFeedType.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){var e;return null===(e=this.params)||void 0===e?void 0:e.feed}get testKey(){var e;return null===(e=this.params)||void 0===e?void 0:e.testKey}get useUgcCard(){var e;return Boolean(null===(e=this.params)||void 0===e?void 0:e.useUgcCard)}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}set api(e){this._api=e}async reload(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}}class g extends f{constructor(e,t,r,n){super(e,t,r,{feed:a.UGCFeedSlug,testKey:null==n?void 0:n.testKey,useUgcCard:null==n?void 0:n.useUgcCard}),Object.defineProperty(this,"ugcParams",{enumerable:!0,configurable:!0,writable:!0,value:n}),c(t)}get type(){return a.StoryFeedType.UGC}get filter(){var e;return null===(e=this.ugcParams)||void 0===e?void 0:e.filter}}const y=(e=>{var t={};return s.d(t,e),t})({jsx:()=>t.jsx,jsxs:()=>t.jsxs});const m=(e=>{var t={};return s.d(t,e),t})({createRoot:()=>r.createRoot});const v=(e=>{var t={};return s.d(t,e),t})({useEffect:()=>n.useEffect,useLayoutEffect:()=>n.useLayoutEffect,useRef:()=>n.useRef,useState:()=>n.useState});var b=s(591),S=s.n(b),M=s(432),L={insert:"head",singleton:!1};S()(M.A,L);const C=M.A.locals||{};var w;!function(e){e.LTR="ltr",e.RTL="rtl"}(w||(w={}));const E=({open:e,options:t,storyListOptions:r,onClose:n})=>{var o,i;(0,v.useLayoutEffect)((()=>{if(!e)return;const t=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=t}}),[e]);return e?(0,y.jsx)("div",{className:C["favorite-story-list-modal"],style:(()=>{var e,r,n,o;return{"--storiesFavoriteTitleColor":t.title.color,"--storiesFavoriteTitleFontFamily":"InternalPrimaryFont","--storiesFavoriteTitleFont":t.title.font,"--storiesFavoriteTitleBackgroundColor":t.title.backgroundColor,"--storiesFavoriteHeaderTopOffset":parseFloat(null!==(r=null===(e=t.headerTopOffset)||void 0===e?void 0:e.toString())&&void 0!==r?r:"0")+"px","--storiesFavoriteBottomOffset":parseFloat(null!==(o=null===(n=t.bottomOffset)||void 0===n?void 0:n.toString())&&void 0!==o?o:"0")+"px","--storiesFavoriteBackgroundColor":t.backgroundColor}})(),children:(0,y.jsxs)("div",{className:C.container,children:[(0,y.jsxs)("div",{className:C.header,children:[(0,y.jsx)("p",{className:C.title,children:t.title.content}),(0,y.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:C["header__close-btn"],style:(()=>{var e;const r="start"===t.closeButtonPosition||"left"===t.closeButtonPosition,n=(null===(e=a.storyManager.getConfig())||void 0===e?void 0:e.dir)===w.LTR;return{[r&&n||!r&&!n?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(i=null===(o=t.closeButton)||void 0===o?void 0:o.svgSrc.baseState)&&void 0!==i?i:""}})]}),(0,y.jsx)("div",{className:C.content,children:(0,y.jsx)("div",{className:C["favorite-story-list"],children:(0,y.jsx)(a.FavoriteStoryList,{options:Object.assign(Object.assign(Object.assign({},r),{sidePadding:0}),{direction:a.StoriesListDirection.COLUMN,layout:{height:"auto"}})})})}),(0,y.jsx)("div",{className:C.footer}),(0,y.jsx)("div",{className:C["bottom-offset"]})]})}):null};const x=(e=>{var t={};return s.d(t,e),t})({createPortal:()=>o.createPortal}),O=e=>{(0,v.useEffect)((()=>{const t=e.mountPoint,r=()=>{console.warn(`[IAS]: The node has been removed from DOM. Unsafe destruction of story feed ${e.mountSelector}`),e.destroy()};if(!document.body.contains(t))return void r();const n=new MutationObserver((()=>{document.body.contains(t)||(r(),n.disconnect())}));return n.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect()}}),[e])};var I;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(I||(I={}));const A=({storyList:e,onStoryCardClick:t,onFavoriteCardClick:r})=>{const[n,o]=(0,v.useState)(e.appearanceManager.storiesListOptions),i=(0,v.useRef)(null);return O(e),(0,v.useEffect)((()=>{e.api=i.current}),[]),(0,v.useEffect)((()=>(e.appearanceManager.on(a.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o),()=>{e.appearanceManager.off(a.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o)})),[e.appearanceManager]),(0,x.createPortal)((0,y.jsx)(a.StoryList,{ref:i,options:n,hasFavorite:e.appearanceManager.commonOptions.hasFavorite,testKey:e.testKey,useUgcCard:e.useUgcCard,feedSlug:e.feedSlug,onLoadStart:()=>{e.emit(I.START_LOADER)},onLoadEnd:t=>{e.emit(I.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()},onFavoriteCardClick:r,onStoryCardClick:t}),e.mountPoint)};var j;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(j||(j={}));const _=({ugcStoryList:e,onStoryCardClick:t})=>{const[r,n]=(0,v.useState)(e.appearanceManager.storiesListOptions),o=(0,v.useRef)(null);return O(e),(0,v.useEffect)((()=>{e.api=o.current}),[]),(0,v.useEffect)((()=>(e.appearanceManager.on(a.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,n),()=>{e.appearanceManager.off(a.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,n)})),[e.appearanceManager]),(0,x.createPortal)((0,y.jsx)(a.UGCStoryList,{ref:o,options:r,filter:e.filter,testKey:e.testKey,useUgcCard:e.useUgcCard,onStoryCardClick:t,onLoadStart:()=>{e.emit(j.START_LOADER)},onLoadEnd:t=>{e.emit(j.END_LOADER,t)},onUgcCardClick:()=>{e.ugcCardClickHandler()}}),e.mountPoint)},T=e=>{const[t,r]=(0,v.useState)(!1);return(0,y.jsxs)(a.IASContainer,{config:e.storyManagerConfigDto,storyReaderOptions:e.appearanceManager.storyReaderOptions,commonOptions:e.appearanceManager.commonOptions,gameReaderOptions:e.appearanceManager.gameReaderOptions,goodsWidgetOptions:e.appearanceManager.goodsWidgetOptions,children:[e.items.map((t=>t instanceof g?(0,y.jsx)(_,{ugcStoryList:t,onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)}},t.mountSelector):t instanceof f?(0,y.jsx)(A,{onFavoriteCardClick:()=>{r(!0)},onStoryCardClick:()=>{e.onAppearanceManagerChange(t.appearanceManager)},storyList:t},t.mountSelector):void 0)),(0,y.jsx)(E,{open:t,onClose:()=>r(!1),options:e.appearanceManager.storyFavoriteReaderOptions,storyListOptions:e.appearanceManager.storiesListOptions})]})};class P{constructor(){Object.defineProperty(this,"_items",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get items(){return this._items}addItem(e){this._items.push(e)}removeItem(e){const t=this._items.findIndex((t=>t===e));-1!==t&&this._items.splice(t,1)}destroy(){this._items=[]}}class R{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new a.AppearanceManager}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"appItemManager",{enumerable:!0,configurable:!0,writable:!0,value:new P}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}async addItem(e){try{this.appItemManager.addItem(e),await this.storyManager.waitStoryManagerConfig(),this.render()}catch(t){throw this.removeItem(e),t}}async removeItem(e){this.appItemManager.removeItem(e),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){c(e),this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){var e;null===(e=this.root)||void 0===e||e.render((0,y.jsx)(T,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,items:this.appItemManager.items.slice(),onAppearanceManagerChange:this.setAppearanceManager}))}destroy(){this.rootElement&&this.root&&(this.appItemManager.destroy(),this.unscubscribeToAppearanceManagerEvents(),this.root.unmount(),document.body.removeChild(this.rootElement),this.rootElement=null,this.root=null)}createAppRoot(){this.rootElement=document.createElement("div"),this.rootElement.id="ias-app",document.body.append(this.rootElement),this.root=(0,m.createRoot)(this.rootElement)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(a.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(a.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}var k,N=s(655),D=s.n(N);!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(k||(k={}));class F extends p.EventEmitter{constructor(e,t,r,n,o){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:o}),c(t),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(e,t)}async showSharePage(e,t){try{this.app.setAppearanceManager(t),this.handleStartLoad(),await this.storyManager.showSharePage(e),this.storyManager.once("closeStoryReader",this.handleCloseStoryReader),this.handleEndLoad(!0)}catch(e){this.handleEndLoad(!1)}}async closeStoryReader(){this.storyManager.closeStoryReader()}handleStartLoad(){setTimeout((()=>{var e;this.emit(k.START_LOADING),D()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(k.END_LOADING,{result:e}),D()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if(D()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(k.CLOSE_STORY_READER)>0)try{D()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(k.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}class U extends p.EventEmitter{constructor(e,t,r,n){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),c(e),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new a.StackedStoryListViewModel(this.options),this.stackedStoryListViewModel.on("update",this.handleUpdate),this.loadStories().catch(console.error)}get stories(){return this.stackedStoryListViewModel.stories}get length(){return this.stackedStoryListViewModel.length}get activeIndex(){return this.stackedStoryListViewModel.activeIndex}get feedCoverSrc(){return this.stackedStoryListViewModel.feedCoverSrc}get top(){return this.stackedStoryListViewModel.top}async reload(){return this.stackedStoryListViewModel.reload()}destroy(){this.stackedStoryListViewModel.destroy(),this.stackedStoryListViewModel.removeAllListeners()}showStory(e){this.app.setAppearanceManager(this.appearanceManager),this.stackedStoryListViewModel.showStory(e)}on(e,t){return"update"===e?super.on(e,t):(this.stackedStoryListViewModel.on(e,t),this)}once(e,t){return this.stackedStoryListViewModel.once(e,t),this}off(e,t){return this.stackedStoryListViewModel.off(e,t),this}handleUpdate(e){this.emit("update",{id:e.id,title:e.title,titleColor:e.titleColor,hasAudio:e.hasAudio,hasSwipeUp:e.hasSwipeUp,isOpened:e.isOpened,deeplink:e.deeplink,gameInstanceId:e.gameInstanceId,hideInReader:e.hideInReader,hide_timeline:e.hideTimeline,cover:e.getCover(this.appearanceManager.storiesListOptions.card.coverQuality)})}async loadStories(){await this.storyManager.waitStoryManagerConfig(),this.stackedStoryListViewModel.loadStories()}}const H=()=>{if(!V.instance)throw new d};class V{constructor(e){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"__IAS_INTERNAL_API__",{enumerable:!0,configurable:!0,writable:!0,value:a.__IAS_INTERNAL_API__}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new R(a.storyManager)}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends f{constructor(e,t,r){H(),super(e,t,V.instance.app,r)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends g{constructor(e,t,r){H(),super(e,t,V.instance.app,r)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends F{constructor(e,t,r){H(),super(e,t,a.storyManager,V.instance.app,r)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends U{constructor(e,t){H(),super(e,a.storyManager,V.instance.app,t)}}}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:a.storyManager.inAppMessaging}),V.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),V.instance):(a.storyManager.setUserAgent(`InAppStoryJSSDK/${this.sdkVersionCode}`),V.instance=this,this.app.setStoryManagerConfig(e),V.instance)}get sdkVersionName(){return"3.7.0-rc.1"}get sdkVersionCode(){return parseInt(30700)}set storyLinkClickHandler(e){a.storyManager.storyLinkClickHandler=e}static getInstance(){return V.instance?V.instance:null}static use(e,t){e.install({INTERNAL_API:a.__IAS_INTERNAL_API__,HOST:V},t)}getConfig(){return a.storyManager.getConfig()}async showOnboardingStories(e,t){return H(),this.app.setAppearanceManager(e),a.storyManager.showOnboardingStories(t)}async showStory(e,t){H(),this.app.setAppearanceManager(t),await a.storyManager.showStory(e)}async showStoryOnce(e,t){return H(),this.app.setAppearanceManager(t),a.storyManager.showStoryOnce(e)}async showSharePage(e,t){return H(),this.app.setAppearanceManager(t),a.storyManager.showSharePage(e)}closeAllReaders(){a.storyManager.closeAllReaders()}async openGame(e,t,r={}){return H(),this.app.setAppearanceManager(t),a.storyManager.openGame(e,r)}async closeGame(){return a.storyManager.closeGame()}async closeStoryReader(){return a.storyManager.closeStoryReader()}getUgcEditorConfig(){return a.storyManager.getUgcEditorConfig()}closeGoodsWidget(){a.storyManager.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}getNonce(){return a.storyManager.getNonce()}async setUserId(e,t){H(),this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async userLogoug(){return this.setUserId("")}setTags(e){H(),this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){H(),this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){H(),this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(e,t){return a.storyManager.on(e,t),this}once(e,t){return a.storyManager.once(e,t),this}off(e,t){return a.storyManager.off(e,t),this}destroy(){null!=V.instance&&(V.instance=null,this.closeAllReaders(),this.app.destroy())}}})();var c=l.KL,d=l.Yb,u=l.lV,p=l.IV,h=l.tP,f=l.h8,g=l.Xz,y=l.wS,m=l.VS,v=l.oC,b=l.L8,S=l.NL,M=l.Ez,L=l.Hp,C=l.SK,w=l.tI,E=l.Uy,x=l.SP,O=l.Jj,I=l.qz;export{c as AppearanceManager,d as CloseButtonPosition,u as GoodsWidgetRenderingType,p as IamCheckDisplayTimeRangeError,h as IamFrequencyLimitError,f as IamMessageLimitExceededError,g as IamMessageOpenError,y as IamNotFoundByEventError,m as IamNotFoundByIdError,v as IamNotFoundLimitError,b as IamOtherReaderIsOpenError,S as IamShowOnlyIfLoadedError,M as IasNetworkError,L as InAppStoryManager,C as StoriesListCardCoverQuality,w as StoriesListCardTitlePosition,E as StoriesListCardTitleTextAlign,x as StoriesListCardViewVariant,O as StoriesListDirection,I as StoryReaderSwipeStyle};
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom"));else if("function"==typeof define&&define.amd)define(["@inappstory/react-sdk","react/jsx-runtime","react-dom/client","react","react-dom"],t);else{var r="object"==typeof exports?t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom")):t(e["@inappstory/react-sdk"],e["react/jsx-runtime"],e["react-dom/client"],e.react,e["react-dom"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n,o)=>(()=>{var a={432:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(935),o=r.n(n)()((function(e){return e[1]}));o.push([e.id,".favorite-story-list-modal--xWjHA{position:fixed;inset:0px;z-index:1090}.favorite-story-list-modal--xWjHA .container--GZBjv{width:100%;height:100%;background:var(--storiesFavoriteBackgroundColor, #333333);display:flex;flex-direction:column;position:relative;overflow-y:auto}.favorite-story-list-modal--xWjHA .header--TjHMD{display:flex;align-content:center;justify-content:center;align-items:center;flex-shrink:0;position:-webkit-sticky;position:sticky;top:0;z-index:100;background:var(--storiesFavoriteTitleBackgroundColor, #333333);box-shadow:0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12),0 1px 3px 0 rgba(0,0,0,.2);padding-top:var(--storiesFavoriteHeaderTopOffset, 0px);margin-bottom:25px}.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:1rem;margin-bottom:1rem;font-size:1.2em;color:var(--storiesFavoriteTitleColor, white);font-family:var(--storiesFavoriteTitleFontFamily);font-weight:normal;font-size:1.4rem;line-height:normal;font:var(--storiesFavoriteTitleFont, normal)}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:25px;margin-bottom:25px}}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD{margin-bottom:50px}}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:50%;transform:translateY(-50%);z-index:1140;pointer-events:all;cursor:pointer;outline:none;right:10px;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-:focus{outline:none}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm- svg{overflow:visible}.favorite-story-list-modal--xWjHA .footer--edEpn{width:100%;height:25px}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .footer--edEpn{height:50px}}.favorite-story-list-modal--xWjHA .bottom-offset--baiTh{position:-webkit-sticky;position:sticky;z-index:100;background:inherit;bottom:0;width:100%;height:var(--storiesFavoriteBottomOffset, 0px)}.favorite-story-list-modal--xWjHA .content--qCPkX{display:flex;justify-content:center;width:100%;padding:0 25px 25px;box-sizing:border-box}.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{width:100%}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:640px}}@media(min-width: 768px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:768px}}@media(min-width: 1024px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1024px}}@media(min-width: 1280px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1280px}}",""]),o.locals={"favorite-story-list-modal":"favorite-story-list-modal--xWjHA",container:"container--GZBjv",header:"header--TjHMD",title:"title--Dk04x","header__close-btn":"header__close-btn--Jojm-",footer:"footer--edEpn","bottom-offset":"bottom-offset--baiTh",content:"content--qCPkX","favorite-story-list":"favorite-story-list--MISMx"};const a=o},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var a=0;a<this.length;a++){var i=this[a][0];null!=i&&(o[i]=!0)}for(var s=0;s<e.length;s++){var c=[].concat(e[s]);n&&o[c[0]]||(r&&(c[2]?c[2]="".concat(r," and ").concat(c[2]):c[2]=r),t.push(c))}},t}},46:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}g(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,o,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var i=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var o,a,i,l;if(s(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),i=a[t]),void 0===i)i=a[t]=r,++e._eventsCount;else if("function"==typeof i?i=a[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=c(e))>0&&i.length>o&&!i.warned){i.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=i.length,l=d,console&&console.warn&&console.warn(l)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=d.bind(n);return o.listener=r,n.wrapFn=o,o}function p(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):h(o,o.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(a){n.once&&e.removeEventListener(t,o),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return c(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,a=this._events;if(void 0!==a)o=o&&void 0===a.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var c=a[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,d=h(c,l);for(r=0;r<l;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)},a.prototype.once=function(e,t){return s(t),this.on(e,u(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,u(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,o,a,i;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){i=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(o=a[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},a.prototype.listenerCount=f,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},650:(e,t,r)=>{var n=r(942).Symbol;e.exports=n},379:(e,t,r)=>{var n=r(650),o=r(870),a=r(5),i=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):a(e)}},967:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},870:(e,t,r)=>{var n=r(650),o=Object.prototype,a=o.hasOwnProperty,i=o.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var o=i.call(e);return n&&(t?e[s]=r:delete e[s]),o}},5:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},942:(e,t,r)=>{var n=r(967),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},655:(e,t,r)=>{var n=r(379),o=r(580);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},591:(e,t,r)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),i=[];function s(e){for(var t=-1,r=0;r<i.length;r++)if(i[r].identifier===e){t=r;break}return t}function c(e,t){for(var r={},n=[],o=0;o<e.length;o++){var a=e[o],c=t.base?a[0]+t.base:a[0],l=r[c]||0,d="".concat(c," ").concat(l);r[c]=l+1;var u=s(d),p={css:a[1],media:a[2],sourceMap:a[3]};-1!==u?(i[u].references++,i[u].updater(p)):i.push({identifier:d,updater:y(p,t),references:1}),n.push(d)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=r.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function p(e,t,r,n){var o=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=u(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function f(e,t,r){var n=r.css,o=r.media,a=r.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var h=null,g=0;function y(e,t){var r,n,o;if(t.singleton){var a=g++;r=h||(h=l(t)),n=p.bind(null,r,a,!1),o=p.bind(null,r,a,!0)}else r=l(t),n=f.bind(null,r,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var r=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var o=s(r[n]);i[o].references--}for(var a=c(e,t),l=0;l<r.length;l++){var d=s(r[l]);0===i[d].references&&(i[d].updater(),i.splice(d,1))}r=a}}}},494:t=>{"use strict";t.exports=e},155:e=>{"use strict";e.exports=n},514:e=>{"use strict";e.exports=o},236:e=>{"use strict";e.exports=r},272:e=>{"use strict";e.exports=t}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={id:e,exports:{}};return a[e](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nc=void 0;var c={};return(()=>{"use strict";s.r(c),s.d(c,{AppearanceManager:()=>e.AppearanceManager,CloseButtonPosition:()=>e.CloseButtonPosition,GoodsWidgetRenderingType:()=>e.GoodsWidgetRenderingType,IamCheckDisplayTimeRangeError:()=>e.IamCheckDisplayTimeRangeError,IamFrequencyLimitError:()=>e.IamFrequencyLimitError,IamMessageLimitExceededError:()=>e.IamMessageLimitExceededError,IamMessageOpenError:()=>e.IamMessageOpenError,IamNotFoundByEventError:()=>e.IamNotFoundByEventError,IamNotFoundByIdError:()=>e.IamNotFoundByIdError,IamNotFoundLimitError:()=>e.IamNotFoundLimitError,IamOtherReaderIsOpenError:()=>e.IamOtherReaderIsOpenError,IamShowOnlyIfLoadedError:()=>e.IamShowOnlyIfLoadedError,IasNetworkError:()=>e.IasNetworkError,InAppStoryManager:()=>D,StoriesListCardCoverQuality:()=>e.StoriesListCardCoverQuality,StoriesListCardTitlePosition:()=>e.StoriesListCardTitlePosition,StoriesListCardTitleTextAlign:()=>e.StoriesListCardTitleTextAlign,StoriesListCardViewVariant:()=>e.StoriesListCardViewVariant,StoriesListDirection:()=>e.StoriesListDirection,StoryReaderSwipeStyle:()=>e.StoryReaderSwipeStyle});var e=s(494);class t extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`),this.name="IasAppearanceManagerTypeofError"}}const r=e=>{if(null==e||"object"!=typeof e)throw new t(null==e?"null":typeof e)};class n extends Error{constructor(){super("[IAS]: The <StoryManager> instance has been destroyed, you must create a new instance"),this.name="IasInAppStoryManagerReferenceError"}}class o extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}var a=s(46);class i extends a.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._mountPoint=this.getMountPoint(e),this.app.addItem(this).catch(console.error)}get mountPoint(){return this._mountPoint}get mountSelector(){return this._mountSelector}destroy(){this.app.removeItem(this)}getMountPoint(e){const t=document.querySelector(e);if(!t)throw new o(e);return t}}class l extends i{constructor(e,t,n,o){super(e,n),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t)}get appearanceManager(){return this._appearanceManager}get type(){return e.StoryFeedType.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){var e;return null===(e=this.params)||void 0===e?void 0:e.feed}get testKey(){var e;return null===(e=this.params)||void 0===e?void 0:e.testKey}get useUgcCard(){var e;return Boolean(null===(e=this.params)||void 0===e?void 0:e.useUgcCard)}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}set api(e){this._api=e}async reload(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}}class d extends l{constructor(t,n,o,a){super(t,n,o,{feed:e.UGCFeedSlug,testKey:null==a?void 0:a.testKey,useUgcCard:null==a?void 0:a.useUgcCard}),Object.defineProperty(this,"ugcParams",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(n)}get type(){return e.StoryFeedType.UGC}get filter(){var e;return null===(e=this.ugcParams)||void 0===e?void 0:e.filter}}var u=s(272),p=s(236),f=s(155),h=s(591),g=s.n(h),y=s(432),v={insert:"head",singleton:!1};g()(y.A,v);const m=y.A.locals||{};var b;!function(e){e.LTR="ltr",e.RTL="rtl"}(b||(b={}));const S=({open:t,options:r,storyListOptions:n,onClose:o})=>{var a,i;(0,f.useLayoutEffect)((()=>{if(!t)return;const e=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=e}}),[t]);return t?(0,u.jsx)("div",{className:m["favorite-story-list-modal"],style:(()=>{var e,t,n,o;return{"--storiesFavoriteTitleColor":r.title.color,"--storiesFavoriteTitleFontFamily":"InternalPrimaryFont","--storiesFavoriteTitleFont":r.title.font,"--storiesFavoriteTitleBackgroundColor":r.title.backgroundColor,"--storiesFavoriteHeaderTopOffset":parseFloat(null!==(t=null===(e=r.headerTopOffset)||void 0===e?void 0:e.toString())&&void 0!==t?t:"0")+"px","--storiesFavoriteBottomOffset":parseFloat(null!==(o=null===(n=r.bottomOffset)||void 0===n?void 0:n.toString())&&void 0!==o?o:"0")+"px","--storiesFavoriteBackgroundColor":r.backgroundColor}})(),children:(0,u.jsxs)("div",{className:m.container,children:[(0,u.jsxs)("div",{className:m.header,children:[(0,u.jsx)("p",{className:m.title,children:r.title.content}),(0,u.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),o()},className:m["header__close-btn"],style:(()=>{var t;const n="start"===r.closeButtonPosition||"left"===r.closeButtonPosition,o=(null===(t=e.storyManager.getConfig())||void 0===t?void 0:t.dir)===b.LTR;return{[n&&o||!n&&!o?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(i=null===(a=r.closeButton)||void 0===a?void 0:a.svgSrc.baseState)&&void 0!==i?i:""}})]}),(0,u.jsx)("div",{className:m.content,children:(0,u.jsx)("div",{className:m["favorite-story-list"],children:(0,u.jsx)(e.FavoriteStoryList,{options:Object.assign(Object.assign(Object.assign({},n),{sidePadding:0}),{direction:e.StoriesListDirection.COLUMN,layout:{height:"auto"}})})})}),(0,u.jsx)("div",{className:m.footer}),(0,u.jsx)("div",{className:m["bottom-offset"]})]})}):null};var M=s(514);const w=e=>{(0,f.useEffect)((()=>{const t=e.mountPoint,r=()=>{console.warn(`[IAS]: The node has been removed from DOM. Unsafe destruction of story feed ${e.mountSelector}`),e.destroy()};if(!document.body.contains(t))return void r();const n=new MutationObserver((()=>{document.body.contains(t)||(r(),n.disconnect())}));return n.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect()}}),[e])};var x;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(x||(x={}));const C=({storyList:t,onStoryCardClick:r,onFavoriteCardClick:n})=>{const[o,a]=(0,f.useState)(t.appearanceManager.storiesListOptions),i=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=i.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a)})),[t.appearanceManager]),(0,M.createPortal)((0,u.jsx)(e.StoryList,{ref:i,options:o,hasFavorite:t.appearanceManager.commonOptions.hasFavorite,testKey:t.testKey,useUgcCard:t.useUgcCard,feedSlug:t.feedSlug,onLoadStart:()=>{t.emit(x.START_LOADER)},onLoadEnd:e=>{t.emit(x.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()},onFavoriteCardClick:n,onStoryCardClick:r}),t.mountPoint)};var L;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(L||(L={}));const E=({ugcStoryList:t,onStoryCardClick:r})=>{const[n,o]=(0,f.useState)(t.appearanceManager.storiesListOptions),a=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=a.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o)})),[t.appearanceManager]),(0,M.createPortal)((0,u.jsx)(e.UGCStoryList,{ref:a,options:n,filter:t.filter,testKey:t.testKey,useUgcCard:t.useUgcCard,onStoryCardClick:r,onLoadStart:()=>{t.emit(L.START_LOADER)},onLoadEnd:e=>{t.emit(L.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()}}),t.mountPoint)},O=t=>{const[r,n]=(0,f.useState)(!1);return(0,u.jsxs)(e.IASContainer,{config:t.storyManagerConfigDto,storyReaderOptions:t.appearanceManager.storyReaderOptions,commonOptions:t.appearanceManager.commonOptions,gameReaderOptions:t.appearanceManager.gameReaderOptions,goodsWidgetOptions:t.appearanceManager.goodsWidgetOptions,children:[t.items.map((e=>e instanceof d?(0,u.jsx)(E,{ugcStoryList:e,onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)}},e.mountSelector):e instanceof l?(0,u.jsx)(C,{onFavoriteCardClick:()=>{n(!0)},onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)},storyList:e},e.mountSelector):void 0)),(0,u.jsx)(S,{open:r,onClose:()=>n(!1),options:t.appearanceManager.storyFavoriteReaderOptions,storyListOptions:t.appearanceManager.storiesListOptions})]})};class j{constructor(){Object.defineProperty(this,"_items",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get items(){return this._items}addItem(e){this._items.push(e)}removeItem(e){const t=this._items.findIndex((t=>t===e));-1!==t&&this._items.splice(t,1)}destroy(){this._items=[]}}class A{constructor(t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new e.AppearanceManager}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"appItemManager",{enumerable:!0,configurable:!0,writable:!0,value:new j}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}async addItem(e){try{this.appItemManager.addItem(e),await this.storyManager.waitStoryManagerConfig(),this.render()}catch(t){throw this.removeItem(e),t}}async removeItem(e){this.appItemManager.removeItem(e),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){r(e),this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){var e;null===(e=this.root)||void 0===e||e.render((0,u.jsx)(O,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,items:this.appItemManager.items.slice(),onAppearanceManagerChange:this.setAppearanceManager}))}destroy(){this.rootElement&&this.root&&(this.appItemManager.destroy(),this.unscubscribeToAppearanceManagerEvents(),this.root.unmount(),document.body.removeChild(this.rootElement),this.rootElement=null,this.root=null)}createAppRoot(){this.rootElement=document.createElement("div"),this.rootElement.id="ias-app",document.body.append(this.rootElement),this.root=(0,p.createRoot)(this.rootElement)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}var _,I=s(655),T=s.n(I);!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(_||(_={}));class P extends a.EventEmitter{constructor(e,t,n,o,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(t),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(e,t)}async showSharePage(e,t){try{this.app.setAppearanceManager(t),this.handleStartLoad(),await this.storyManager.showSharePage(e),this.storyManager.once("closeStoryReader",this.handleCloseStoryReader),this.handleEndLoad(!0)}catch(e){this.handleEndLoad(!1)}}async closeStoryReader(){this.storyManager.closeStoryReader()}handleStartLoad(){setTimeout((()=>{var e;this.emit(_.START_LOADING),T()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(_.END_LOADING,{result:e}),T()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if(T()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(_.CLOSE_STORY_READER)>0)try{T()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(_.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}class k extends a.EventEmitter{constructor(t,n,o,a){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new e.StackedStoryListViewModel(this.options),this.stackedStoryListViewModel.on("update",this.handleUpdate),this.loadStories().catch(console.error)}get stories(){return this.stackedStoryListViewModel.stories}get length(){return this.stackedStoryListViewModel.length}get activeIndex(){return this.stackedStoryListViewModel.activeIndex}get feedCoverSrc(){return this.stackedStoryListViewModel.feedCoverSrc}get top(){return this.stackedStoryListViewModel.top}async reload(){return this.stackedStoryListViewModel.reload()}destroy(){this.stackedStoryListViewModel.destroy(),this.stackedStoryListViewModel.removeAllListeners()}showStory(e){this.app.setAppearanceManager(this.appearanceManager),this.stackedStoryListViewModel.showStory(e)}on(e,t){return"update"===e?super.on(e,t):(this.stackedStoryListViewModel.on(e,t),this)}once(e,t){return this.stackedStoryListViewModel.once(e,t),this}off(e,t){return this.stackedStoryListViewModel.off(e,t),this}handleUpdate(e){this.emit("update",{id:e.id,title:e.title,titleColor:e.titleColor,hasAudio:e.hasAudio,hasSwipeUp:e.hasSwipeUp,isOpened:e.isOpened,deeplink:e.deeplink,gameInstanceId:e.gameInstanceId,hideInReader:e.hideInReader,hide_timeline:e.hideTimeline,cover:e.getCover(this.appearanceManager.storiesListOptions.card.coverQuality)})}async loadStories(){await this.storyManager.waitStoryManagerConfig(),this.stackedStoryListViewModel.loadStories()}}const R=()=>{if(!D.instance)throw new n};class D{constructor(t){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"__IAS_INTERNAL_API__",{enumerable:!0,configurable:!0,writable:!0,value:e.__IAS_INTERNAL_API__}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new A(e.storyManager)}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends l{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends d{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends P{constructor(t,r,n){R(),super(t,r,e.storyManager,D.instance.app,n)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends k{constructor(t,r){R(),super(t,e.storyManager,D.instance.app,r)}}}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:e.storyManager.inAppMessaging}),D.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),D.instance):(e.storyManager.setUserAgent(`InAppStoryJSSDK/${this.sdkVersionCode}`),D.instance=this,this.app.setStoryManagerConfig(t),D.instance)}get sdkVersionName(){return"3.7.0-rc.0"}get sdkVersionCode(){return parseInt(30700)}set storyLinkClickHandler(t){e.storyManager.storyLinkClickHandler=t}static getInstance(){return D.instance?D.instance:null}static use(t,r){t.install({INTERNAL_API:e.__IAS_INTERNAL_API__,HOST:D},r)}getConfig(){return e.storyManager.getConfig()}async showOnboardingStories(t,r){return R(),this.app.setAppearanceManager(t),e.storyManager.showOnboardingStories(r)}async showStory(t,r){R(),this.app.setAppearanceManager(r),await e.storyManager.showStory(t)}async showStoryOnce(t,r){return R(),this.app.setAppearanceManager(r),e.storyManager.showStoryOnce(t)}async showSharePage(t,r){return R(),this.app.setAppearanceManager(r),e.storyManager.showSharePage(t)}closeAllReaders(){e.storyManager.closeAllReaders()}async openGame(t,r,n={}){return R(),this.app.setAppearanceManager(r),e.storyManager.openGame(t,n)}async closeGame(){return e.storyManager.closeGame()}async closeStoryReader(){return e.storyManager.closeStoryReader()}getUgcEditorConfig(){return e.storyManager.getUgcEditorConfig()}closeGoodsWidget(){e.storyManager.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}getNonce(){return e.storyManager.getNonce()}async setUserId(e,t){R(),this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async userLogoug(){return this.setUserId("")}setTags(e){R(),this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){R(),this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){R(),this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(t,r){return e.storyManager.on(t,r),this}once(t,r){return e.storyManager.once(t,r),this}off(t,r){return e.storyManager.off(t,r),this}destroy(){null!=D.instance&&(D.instance=null,this.closeAllReaders(),this.app.destroy())}}})(),c})()));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom"));else if("function"==typeof define&&define.amd)define(["@inappstory/react-sdk","react/jsx-runtime","react-dom/client","react","react-dom"],t);else{var r="object"==typeof exports?t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom")):t(e["@inappstory/react-sdk"],e["react/jsx-runtime"],e["react-dom/client"],e.react,e["react-dom"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n,o)=>(()=>{var a={432:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(935),o=r.n(n)()((function(e){return e[1]}));o.push([e.id,".favorite-story-list-modal--xWjHA{position:fixed;inset:0px;z-index:1090}.favorite-story-list-modal--xWjHA .container--GZBjv{width:100%;height:100%;background:var(--storiesFavoriteBackgroundColor, #333333);display:flex;flex-direction:column;position:relative;overflow-y:auto}.favorite-story-list-modal--xWjHA .header--TjHMD{display:flex;align-content:center;justify-content:center;align-items:center;flex-shrink:0;position:-webkit-sticky;position:sticky;top:0;z-index:100;background:var(--storiesFavoriteTitleBackgroundColor, #333333);box-shadow:0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12),0 1px 3px 0 rgba(0,0,0,.2);padding-top:var(--storiesFavoriteHeaderTopOffset, 0px);margin-bottom:25px}.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:1rem;margin-bottom:1rem;font-size:1.2em;color:var(--storiesFavoriteTitleColor, white);font-family:var(--storiesFavoriteTitleFontFamily);font-weight:normal;font-size:1.4rem;line-height:normal;font:var(--storiesFavoriteTitleFont, normal)}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:25px;margin-bottom:25px}}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD{margin-bottom:50px}}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:50%;transform:translateY(-50%);z-index:1140;pointer-events:all;cursor:pointer;outline:none;right:10px;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-:focus{outline:none}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm- svg{overflow:visible}.favorite-story-list-modal--xWjHA .footer--edEpn{width:100%;height:25px}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .footer--edEpn{height:50px}}.favorite-story-list-modal--xWjHA .bottom-offset--baiTh{position:-webkit-sticky;position:sticky;z-index:100;background:inherit;bottom:0;width:100%;height:var(--storiesFavoriteBottomOffset, 0px)}.favorite-story-list-modal--xWjHA .content--qCPkX{display:flex;justify-content:center;width:100%;padding:0 25px 25px;box-sizing:border-box}.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{width:100%}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:640px}}@media(min-width: 768px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:768px}}@media(min-width: 1024px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1024px}}@media(min-width: 1280px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1280px}}",""]),o.locals={"favorite-story-list-modal":"favorite-story-list-modal--xWjHA",container:"container--GZBjv",header:"header--TjHMD",title:"title--Dk04x","header__close-btn":"header__close-btn--Jojm-",footer:"footer--edEpn","bottom-offset":"bottom-offset--baiTh",content:"content--qCPkX","favorite-story-list":"favorite-story-list--MISMx"};const a=o},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var a=0;a<this.length;a++){var i=this[a][0];null!=i&&(o[i]=!0)}for(var s=0;s<e.length;s++){var c=[].concat(e[s]);n&&o[c[0]]||(r&&(c[2]?c[2]="".concat(r," and ").concat(c[2]):c[2]=r),t.push(c))}},t}},46:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}g(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,o,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var i=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var o,a,i,l;if(s(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),i=a[t]),void 0===i)i=a[t]=r,++e._eventsCount;else if("function"==typeof i?i=a[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=c(e))>0&&i.length>o&&!i.warned){i.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=i.length,l=d,console&&console.warn&&console.warn(l)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=d.bind(n);return o.listener=r,n.wrapFn=o,o}function p(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):h(o,o.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(a){n.once&&e.removeEventListener(t,o),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return c(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,a=this._events;if(void 0!==a)o=o&&void 0===a.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var c=a[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,d=h(c,l);for(r=0;r<l;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)},a.prototype.once=function(e,t){return s(t),this.on(e,u(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,u(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,o,a,i;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){i=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(o=a[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},a.prototype.listenerCount=f,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},650:(e,t,r)=>{var n=r(942).Symbol;e.exports=n},379:(e,t,r)=>{var n=r(650),o=r(870),a=r(5),i=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):a(e)}},967:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},870:(e,t,r)=>{var n=r(650),o=Object.prototype,a=o.hasOwnProperty,i=o.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var o=i.call(e);return n&&(t?e[s]=r:delete e[s]),o}},5:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},942:(e,t,r)=>{var n=r(967),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},655:(e,t,r)=>{var n=r(379),o=r(580);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},591:(e,t,r)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),i=[];function s(e){for(var t=-1,r=0;r<i.length;r++)if(i[r].identifier===e){t=r;break}return t}function c(e,t){for(var r={},n=[],o=0;o<e.length;o++){var a=e[o],c=t.base?a[0]+t.base:a[0],l=r[c]||0,d="".concat(c," ").concat(l);r[c]=l+1;var u=s(d),p={css:a[1],media:a[2],sourceMap:a[3]};-1!==u?(i[u].references++,i[u].updater(p)):i.push({identifier:d,updater:y(p,t),references:1}),n.push(d)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=r.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function p(e,t,r,n){var o=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=u(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function f(e,t,r){var n=r.css,o=r.media,a=r.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var h=null,g=0;function y(e,t){var r,n,o;if(t.singleton){var a=g++;r=h||(h=l(t)),n=p.bind(null,r,a,!1),o=p.bind(null,r,a,!0)}else r=l(t),n=f.bind(null,r,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var r=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var o=s(r[n]);i[o].references--}for(var a=c(e,t),l=0;l<r.length;l++){var d=s(r[l]);0===i[d].references&&(i[d].updater(),i.splice(d,1))}r=a}}}},494:t=>{"use strict";t.exports=e},155:e=>{"use strict";e.exports=n},514:e=>{"use strict";e.exports=o},236:e=>{"use strict";e.exports=r},272:e=>{"use strict";e.exports=t}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={id:e,exports:{}};return a[e](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nc=void 0;var c={};return(()=>{"use strict";s.r(c),s.d(c,{AppearanceManager:()=>e.AppearanceManager,CloseButtonPosition:()=>e.CloseButtonPosition,GoodsWidgetRenderingType:()=>e.GoodsWidgetRenderingType,IamCheckDisplayTimeRangeError:()=>e.IamCheckDisplayTimeRangeError,IamFrequencyLimitError:()=>e.IamFrequencyLimitError,IamMessageLimitExceededError:()=>e.IamMessageLimitExceededError,IamMessageOpenError:()=>e.IamMessageOpenError,IamNotFoundByEventError:()=>e.IamNotFoundByEventError,IamNotFoundByIdError:()=>e.IamNotFoundByIdError,IamNotFoundLimitError:()=>e.IamNotFoundLimitError,IamOtherReaderIsOpenError:()=>e.IamOtherReaderIsOpenError,IamShowOnlyIfLoadedError:()=>e.IamShowOnlyIfLoadedError,IasNetworkError:()=>e.IasNetworkError,InAppStoryManager:()=>D,StoriesListCardCoverQuality:()=>e.StoriesListCardCoverQuality,StoriesListCardTitlePosition:()=>e.StoriesListCardTitlePosition,StoriesListCardTitleTextAlign:()=>e.StoriesListCardTitleTextAlign,StoriesListCardViewVariant:()=>e.StoriesListCardViewVariant,StoriesListDirection:()=>e.StoriesListDirection,StoryReaderSwipeStyle:()=>e.StoryReaderSwipeStyle});var e=s(494);class t extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`),this.name="IasAppearanceManagerTypeofError"}}const r=e=>{if(null==e||"object"!=typeof e)throw new t(null==e?"null":typeof e)};class n extends Error{constructor(){super("[IAS]: The <StoryManager> instance has been destroyed, you must create a new instance"),this.name="IasInAppStoryManagerReferenceError"}}class o extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}var a=s(46);class i extends a.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._mountPoint=this.getMountPoint(e),this.app.addItem(this).catch(console.error)}get mountPoint(){return this._mountPoint}get mountSelector(){return this._mountSelector}destroy(){this.app.removeItem(this)}getMountPoint(e){const t=document.querySelector(e);if(!t)throw new o(e);return t}}class l extends i{constructor(e,t,n,o){super(e,n),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t)}get appearanceManager(){return this._appearanceManager}get type(){return e.StoryFeedType.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){var e;return null===(e=this.params)||void 0===e?void 0:e.feed}get testKey(){var e;return null===(e=this.params)||void 0===e?void 0:e.testKey}get useUgcCard(){var e;return Boolean(null===(e=this.params)||void 0===e?void 0:e.useUgcCard)}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}set api(e){this._api=e}async reload(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}}class d extends l{constructor(t,n,o,a){super(t,n,o,{feed:e.UGCFeedSlug,testKey:null==a?void 0:a.testKey,useUgcCard:null==a?void 0:a.useUgcCard}),Object.defineProperty(this,"ugcParams",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(n)}get type(){return e.StoryFeedType.UGC}get filter(){var e;return null===(e=this.ugcParams)||void 0===e?void 0:e.filter}}var u=s(272),p=s(236),f=s(155),h=s(591),g=s.n(h),y=s(432),v={insert:"head",singleton:!1};g()(y.A,v);const m=y.A.locals||{};var b;!function(e){e.LTR="ltr",e.RTL="rtl"}(b||(b={}));const S=({open:t,options:r,storyListOptions:n,onClose:o})=>{var a,i;(0,f.useLayoutEffect)((()=>{if(!t)return;const e=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=e}}),[t]);return t?(0,u.jsx)("div",{className:m["favorite-story-list-modal"],style:(()=>{var e,t,n,o;return{"--storiesFavoriteTitleColor":r.title.color,"--storiesFavoriteTitleFontFamily":"InternalPrimaryFont","--storiesFavoriteTitleFont":r.title.font,"--storiesFavoriteTitleBackgroundColor":r.title.backgroundColor,"--storiesFavoriteHeaderTopOffset":parseFloat(null!==(t=null===(e=r.headerTopOffset)||void 0===e?void 0:e.toString())&&void 0!==t?t:"0")+"px","--storiesFavoriteBottomOffset":parseFloat(null!==(o=null===(n=r.bottomOffset)||void 0===n?void 0:n.toString())&&void 0!==o?o:"0")+"px","--storiesFavoriteBackgroundColor":r.backgroundColor}})(),children:(0,u.jsxs)("div",{className:m.container,children:[(0,u.jsxs)("div",{className:m.header,children:[(0,u.jsx)("p",{className:m.title,children:r.title.content}),(0,u.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),o()},className:m["header__close-btn"],style:(()=>{var t;const n="start"===r.closeButtonPosition||"left"===r.closeButtonPosition,o=(null===(t=e.storyManager.getConfig())||void 0===t?void 0:t.dir)===b.LTR;return{[n&&o||!n&&!o?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(i=null===(a=r.closeButton)||void 0===a?void 0:a.svgSrc.baseState)&&void 0!==i?i:""}})]}),(0,u.jsx)("div",{className:m.content,children:(0,u.jsx)("div",{className:m["favorite-story-list"],children:(0,u.jsx)(e.FavoriteStoryList,{options:Object.assign(Object.assign(Object.assign({},n),{sidePadding:0}),{direction:e.StoriesListDirection.COLUMN,layout:{height:"auto"}})})})}),(0,u.jsx)("div",{className:m.footer}),(0,u.jsx)("div",{className:m["bottom-offset"]})]})}):null};var M=s(514);const w=e=>{(0,f.useEffect)((()=>{const t=e.mountPoint,r=()=>{console.warn(`[IAS]: The node has been removed from DOM. Unsafe destruction of story feed ${e.mountSelector}`),e.destroy()};if(!document.body.contains(t))return void r();const n=new MutationObserver((()=>{document.body.contains(t)||(r(),n.disconnect())}));return n.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect()}}),[e])};var x;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(x||(x={}));const C=({storyList:t,onStoryCardClick:r,onFavoriteCardClick:n})=>{const[o,a]=(0,f.useState)(t.appearanceManager.storiesListOptions),i=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=i.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a)})),[t.appearanceManager]),(0,M.createPortal)((0,u.jsx)(e.StoryList,{ref:i,options:o,hasFavorite:t.appearanceManager.commonOptions.hasFavorite,testKey:t.testKey,useUgcCard:t.useUgcCard,feedSlug:t.feedSlug,onLoadStart:()=>{t.emit(x.START_LOADER)},onLoadEnd:e=>{t.emit(x.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()},onFavoriteCardClick:n,onStoryCardClick:r}),t.mountPoint)};var L;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(L||(L={}));const E=({ugcStoryList:t,onStoryCardClick:r})=>{const[n,o]=(0,f.useState)(t.appearanceManager.storiesListOptions),a=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=a.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o)})),[t.appearanceManager]),(0,M.createPortal)((0,u.jsx)(e.UGCStoryList,{ref:a,options:n,filter:t.filter,testKey:t.testKey,useUgcCard:t.useUgcCard,onStoryCardClick:r,onLoadStart:()=>{t.emit(L.START_LOADER)},onLoadEnd:e=>{t.emit(L.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()}}),t.mountPoint)},O=t=>{const[r,n]=(0,f.useState)(!1);return(0,u.jsxs)(e.IASContainer,{config:t.storyManagerConfigDto,storyReaderOptions:t.appearanceManager.storyReaderOptions,commonOptions:t.appearanceManager.commonOptions,gameReaderOptions:t.appearanceManager.gameReaderOptions,goodsWidgetOptions:t.appearanceManager.goodsWidgetOptions,children:[t.items.map((e=>e instanceof d?(0,u.jsx)(E,{ugcStoryList:e,onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)}},e.mountSelector):e instanceof l?(0,u.jsx)(C,{onFavoriteCardClick:()=>{n(!0)},onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)},storyList:e},e.mountSelector):void 0)),(0,u.jsx)(S,{open:r,onClose:()=>n(!1),options:t.appearanceManager.storyFavoriteReaderOptions,storyListOptions:t.appearanceManager.storiesListOptions})]})};class j{constructor(){Object.defineProperty(this,"_items",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get items(){return this._items}addItem(e){this._items.push(e)}removeItem(e){const t=this._items.findIndex((t=>t===e));-1!==t&&this._items.splice(t,1)}destroy(){this._items=[]}}class A{constructor(t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new e.AppearanceManager}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"appItemManager",{enumerable:!0,configurable:!0,writable:!0,value:new j}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}async addItem(e){try{this.appItemManager.addItem(e),await this.storyManager.waitStoryManagerConfig(),this.render()}catch(t){throw this.removeItem(e),t}}async removeItem(e){this.appItemManager.removeItem(e),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){r(e),this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){var e;null===(e=this.root)||void 0===e||e.render((0,u.jsx)(O,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,items:this.appItemManager.items.slice(),onAppearanceManagerChange:this.setAppearanceManager}))}destroy(){this.rootElement&&this.root&&(this.appItemManager.destroy(),this.unscubscribeToAppearanceManagerEvents(),this.root.unmount(),document.body.removeChild(this.rootElement),this.rootElement=null,this.root=null)}createAppRoot(){this.rootElement=document.createElement("div"),this.rootElement.id="ias-app",document.body.append(this.rootElement),this.root=(0,p.createRoot)(this.rootElement)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}var _,I=s(655),T=s.n(I);!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(_||(_={}));class P extends a.EventEmitter{constructor(e,t,n,o,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(t),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(e,t)}async showSharePage(e,t){try{this.app.setAppearanceManager(t),this.handleStartLoad(),await this.storyManager.showSharePage(e),this.storyManager.once("closeStoryReader",this.handleCloseStoryReader),this.handleEndLoad(!0)}catch(e){this.handleEndLoad(!1)}}async closeStoryReader(){this.storyManager.closeStoryReader()}handleStartLoad(){setTimeout((()=>{var e;this.emit(_.START_LOADING),T()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(_.END_LOADING,{result:e}),T()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if(T()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(_.CLOSE_STORY_READER)>0)try{T()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(_.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}class k extends a.EventEmitter{constructor(t,n,o,a){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new e.StackedStoryListViewModel(this.options),this.stackedStoryListViewModel.on("update",this.handleUpdate),this.loadStories().catch(console.error)}get stories(){return this.stackedStoryListViewModel.stories}get length(){return this.stackedStoryListViewModel.length}get activeIndex(){return this.stackedStoryListViewModel.activeIndex}get feedCoverSrc(){return this.stackedStoryListViewModel.feedCoverSrc}get top(){return this.stackedStoryListViewModel.top}async reload(){return this.stackedStoryListViewModel.reload()}destroy(){this.stackedStoryListViewModel.destroy(),this.stackedStoryListViewModel.removeAllListeners()}showStory(e){this.app.setAppearanceManager(this.appearanceManager),this.stackedStoryListViewModel.showStory(e)}on(e,t){return"update"===e?super.on(e,t):(this.stackedStoryListViewModel.on(e,t),this)}once(e,t){return this.stackedStoryListViewModel.once(e,t),this}off(e,t){return this.stackedStoryListViewModel.off(e,t),this}handleUpdate(e){this.emit("update",{id:e.id,title:e.title,titleColor:e.titleColor,hasAudio:e.hasAudio,hasSwipeUp:e.hasSwipeUp,isOpened:e.isOpened,deeplink:e.deeplink,gameInstanceId:e.gameInstanceId,hideInReader:e.hideInReader,hide_timeline:e.hideTimeline,cover:e.getCover(this.appearanceManager.storiesListOptions.card.coverQuality)})}async loadStories(){await this.storyManager.waitStoryManagerConfig(),this.stackedStoryListViewModel.loadStories()}}const R=()=>{if(!D.instance)throw new n};class D{constructor(t){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"__IAS_INTERNAL_API__",{enumerable:!0,configurable:!0,writable:!0,value:e.__IAS_INTERNAL_API__}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new A(e.storyManager)}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends l{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends d{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends P{constructor(t,r,n){R(),super(t,r,e.storyManager,D.instance.app,n)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends k{constructor(t,r){R(),super(t,e.storyManager,D.instance.app,r)}}}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:e.storyManager.inAppMessaging}),D.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),D.instance):(e.storyManager.setUserAgent(`InAppStoryJSSDK/${this.sdkVersionCode}`),D.instance=this,this.app.setStoryManagerConfig(t),D.instance)}get sdkVersionName(){return"3.7.0-rc.1"}get sdkVersionCode(){return parseInt(30700)}set storyLinkClickHandler(t){e.storyManager.storyLinkClickHandler=t}static getInstance(){return D.instance?D.instance:null}static use(t,r){t.install({INTERNAL_API:e.__IAS_INTERNAL_API__,HOST:D},r)}getConfig(){return e.storyManager.getConfig()}async showOnboardingStories(t,r){return R(),this.app.setAppearanceManager(t),e.storyManager.showOnboardingStories(r)}async showStory(t,r){R(),this.app.setAppearanceManager(r),await e.storyManager.showStory(t)}async showStoryOnce(t,r){return R(),this.app.setAppearanceManager(r),e.storyManager.showStoryOnce(t)}async showSharePage(t,r){return R(),this.app.setAppearanceManager(r),e.storyManager.showSharePage(t)}closeAllReaders(){e.storyManager.closeAllReaders()}async openGame(t,r,n={}){return R(),this.app.setAppearanceManager(r),e.storyManager.openGame(t,n)}async closeGame(){return e.storyManager.closeGame()}async closeStoryReader(){return e.storyManager.closeStoryReader()}getUgcEditorConfig(){return e.storyManager.getUgcEditorConfig()}closeGoodsWidget(){e.storyManager.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}getNonce(){return e.storyManager.getNonce()}async setUserId(e,t){R(),this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async userLogoug(){return this.setUserId("")}setTags(e){R(),this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){R(),this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){R(),this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(t,r){return e.storyManager.on(t,r),this}once(t,r){return e.storyManager.once(t,r),this}off(t,r){return e.storyManager.off(t,r),this}destroy(){null!=D.instance&&(D.instance=null,this.closeAllReaders(),this.app.destroy())}}})(),c})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inappstory/js-sdk",
3
- "version": "3.7.0-rc.0",
3
+ "version": "3.7.0-rc.1",
4
4
  "description": "JS SDK",
5
5
  "keywords": [
6
6
  "stories",
@@ -58,7 +58,7 @@
58
58
  "Samsung >= 5"
59
59
  ],
60
60
  "dependencies": {
61
- "@inappstory/react-sdk": "^1.8.0-rc.0",
61
+ "@inappstory/react-sdk": "^1.8.0-rc.1",
62
62
  "react": "^18.2.0",
63
63
  "react-dom": "^18.2.0"
64
64
  },
@@ -1 +1 @@
1
- import*as e from"react/jsx-runtime";import*as t from"react";import*as r from"mobx-react-lite";import*as n from"classnames";import*as i from"mobx";import*as a from"uuid";import*as s from"react-dom/client";import*as o from"@inappstory/slide-api";var l={371:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".banner--EtvvP{width:100%;height:100%;position:relative;border-radius:var(--banner-border-radius, 0px);overflow:hidden}.banner-slides--3xhGF{position:relative;width:100%;height:100%;display:block}",""]),i.locals={banner:"banner--EtvvP","banner-slides":"banner-slides--3xhGF"};const a=i},369:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".banner-place--6ZUZe{width:100%;height:100%;position:relative}.banner-slider__slider_visible--1nA2b{border:solid 1px green}",""]),i.locals={"banner-place":"banner-place--6ZUZe","banner-slider__slider_visible":"banner-slider__slider_visible--1nA2b"};const a=i},41:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider--ggy2P{width:100%;height:100%;overflow:hidden;position:relative;justify-content:center}.slider__track--JSOcI{display:flex;transition:transform .3s ease;width:100%;height:100%;will-change:transform}.slider__slide--oGmUT{width:100%;height:100%;flex-shrink:0;position:relative;display:flex;align-items:center;justify-content:center;transform:translateZ(0)}",""]),i.locals={slider:"slider--ggy2P",slider__track:"slider__track--JSOcI",slider__slide:"slider__slide--oGmUT"};const a=i},379:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider__controls-btn--HubN5{position:absolute;top:50%;z-index:1;width:24px;height:24px;margin-top:-9px;transition:all .2s ease-in-out;cursor:pointer;padding:0;background-color:rgba(0,0,0,0);color:#0c62f3;border:0;outline:0}.slider__controls-btn--prev--kfXCq{left:1.5rem}.slider__controls-btn--next--Jzq3Q{right:1.5rem}.slider__controls-btn--HubN5{transition:opacity .3s ease-in-out}.slider__controls-btn--disabled--m1P4q{opacity:0;pointer-events:none}",""]),i.locals={"slider__controls-btn":"slider__controls-btn--HubN5","slider__controls-btn--prev":"slider__controls-btn--prev--kfXCq","slider__controls-btn--next":"slider__controls-btn--next--Jzq3Q","slider__controls-btn--disabled":"slider__controls-btn--disabled--m1P4q"};const a=i},55:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider-bullets--XDc5n{position:absolute;z-index:2;bottom:1.5rem;left:50%;display:inline-flex;list-style:none;transform:translate3d(-50%, 0, 0)}.slider-bullets__bullet--83aBh{background-color:rgba(255,255,255,.5);width:9px;height:9px;padding:0;border-radius:50%;border:2px solid rgba(0,0,0,0);cursor:pointer;line-height:0;box-shadow:0 .25em .5em 0 rgba(0,0,0,.1);margin:0 .25em;transition:transform 100ms ease-in;transform:scale(0.8)}.slider-bullets__bullet--active--RDBez{background-color:#0c62f3;transform:scale(1)}",""]),i.locals={"slider-bullets":"slider-bullets--XDc5n","slider-bullets__bullet":"slider-bullets__bullet--83aBh","slider-bullets__bullet--active":"slider-bullets__bullet--active--RDBez"};const a=i},126:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".loader--4uMcs{position:absolute;z-index:10001;top:0;bottom:0;left:0;right:0;display:flex;justify-content:center;align-items:center;background:var(--loader-background, black)}.loader--4uMcs .loader__refresh-btn--5nwxY{color:#fff;cursor:pointer;position:absolute;left:50%;top:50%;transform:translate3d(-50%, -50%, 0);pointer-events:auto;padding:20px;width:32px;height:32px;box-sizing:content-box}.loader--4uMcs .loader__spinner--NRm8E{-ms-flex-negative:0;flex-shrink:0;display:inline-block;width:32px;height:32px;border-radius:50%;border:solid 2px var(--loaderBackgroundColor, white);border-color:var(--loaderBackgroundAccentColor, transparent) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white);-webkit-animation:loading-spinner--LnXd0 .6s infinite linear;animation:loading-spinner--LnXd0 .6s infinite linear}@keyframes loading-spinner--LnXd0{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}",""]),i.locals={loader:"loader--4uMcs","loader__refresh-btn":"loader__refresh-btn--5nwxY",loader__spinner:"loader__spinner--NRm8E","loading-spinner":"loading-spinner--LnXd0"};const a=i},81:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".icon--5RBkn{width:2rem;height:2rem}",""]),i.locals={icon:"icon--5RBkn"};const a=i},935:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(n)for(var a=0;a<this.length;a++){var s=this[a][0];null!=s&&(i[s]=!0)}for(var o=0;o<e.length;o++){var l=[].concat(e[o]);n&&i[l[0]]||(r&&(l[2]?l[2]="".concat(r," and ").concat(l[2]):l[2]=r),t.push(l))}},t}},46:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}f(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&f(e,"error",t,{once:!0})}(e,i)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var s=10;function o(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var i,a,s,c;if(o(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),s=a[t]),void 0===s)s=a[t]=r,++e._eventsCount;else if("function"==typeof s?s=a[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=l(e))>0&&s.length>i&&!s.warned){s.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=s.length,c=d,console&&console.warn&&console.warn(c)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function u(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):b(i,i.length)}function p(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function f(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(a){n.once&&e.removeEventListener(t,i),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,a=this._events;if(void 0!==a)i=i&&void 0===a.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var l=a[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var c=l.length,d=b(l,c);for(r=0;r<c;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return c(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return c(this,e,t,!0)},a.prototype.once=function(e,t){return o(t),this.on(e,h(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return o(t),this.prependListener(e,h(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,i,a,s;if(o(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){s=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return u(this,e,!0)},a.prototype.rawListeners=function(e){return u(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},591:(e,t,r)=>{var n,i=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),a=[];function s(e){for(var t=-1,r=0;r<a.length;r++)if(a[r].identifier===e){t=r;break}return t}function o(e,t){for(var r={},n=[],i=0;i<e.length;i++){var o=e[i],l=t.base?o[0]+t.base:o[0],c=r[l]||0,d="".concat(l," ").concat(c);r[l]=c+1;var h=s(d),u={css:o[1],media:o[2],sourceMap:o[3]};-1!==h?(a[h].references++,a[h].updater(u)):a.push({identifier:d,updater:f(u,t),references:1}),n.push(d)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var a=r.nc;a&&(n.nonce=a)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var s=i(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var c,d=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function h(e,t,r,n){var i=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=d(t,i);else{var a=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}function u(e,t,r){var n=r.css,i=r.media,a=r.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var p=null,b=0;function f(e,t){var r,n,i;if(t.singleton){var a=b++;r=p||(p=l(t)),n=h.bind(null,r,a,!1),i=h.bind(null,r,a,!0)}else r=l(t),n=u.bind(null,r,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n));var r=o(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var i=s(r[n]);a[i].references--}for(var l=o(e,t),c=0;c<r.length;c++){var d=s(r[c]);0===a[d].references&&(a[d].updater(),a.splice(d,1))}r=l}}}},968:(e,t,r)=>{const n=document.querySelector("[nonce]");n&&(r.nc=n.nonce||n.getAttribute("nonce"))}},c={};function d(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={id:e,exports:{}};return l[e](r,r.exports,d),r.exports}d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.nc=void 0;var h={};(()=>{d.d(h,{RE:()=>je,Sr:()=>Ie,YL:()=>Qt,Ay:()=>Jt}),d(968);const l=(e=>{var t={};return d.d(t,e),t})({jsx:()=>e.jsx,jsxs:()=>e.jsxs}),c=(e=>{var t={};return d.d(t,e),t})({useEffect:()=>t.useEffect,useLayoutEffect:()=>t.useLayoutEffect,useRef:()=>t.useRef,useState:()=>t.useState}),u=(e=>{var t={};return d.d(t,e),t})({observer:()=>r.observer});var p=d(591),b=d.n(p),f=d(371);b()(f.A,{insert:"head",singleton:!1});const m=f.A.locals||{};var v=d(126);b()(v.A,{insert:"head",singleton:!1});const g=v.A.locals||{};var y=d(81);b()(y.A,{insert:"head",singleton:!1});const w=y.A.locals||{},_=(e=>{var t={};return d.d(t,e),t})({default:()=>n.default}),S=({onClick:e,className:t})=>(0,l.jsx)("div",{className:(0,_.default)(w.icon,t),onClick:e,children:(0,l.jsx)("svg",{viewBox:"0 0 24 24",children:(0,l.jsx)("path",{fill:"currentColor",d:"M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z"})})}),P=(0,u.observer)((e=>{const t=e.needShowErrorScreen,r=e.needShowLoaderScreen;return r||t?(0,l.jsx)("div",{className:(0,_.default)(g.loader),style:{"--loader-background":e.background,"--loaderBackgroundColor":e.color},onClick:e=>{e.preventDefault()},children:t?(0,l.jsx)(S,{className:g["loader__refresh-btn"],onClick:t=>{t.stopPropagation(),e.onReload()}}):r&&(0,l.jsx)("div",{className:g.loader__spinner})}):null})),E=()=>null!==d.nc&&void 0!==d.nc?d.nc:"";class x extends HTMLElement{constructor(){super(...arguments),Object.defineProperty(this,"styleElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"handleClick",{enumerable:!0,configurable:!0,writable:!0,value:e=>{var t;this.shadowRoot&&"true"===this.shadowRoot.host.getAttribute("allow-click")&&(null===(t=this.banner)||void 0===t||t.activeSlide.onClick({event:e,currentTarget:this.shadowRoot.host}))}})}setBanner(e){this.banner=e}setStyle(e){var t;this.styleElement&&this.styleElement.parentNode&&this.styleElement.parentNode.removeChild(this.styleElement);const r=document.createElement("style");r.textContent=e,r.setAttribute("nonce",E()),this.styleElement=r,null===(t=this.shadowRoot)||void 0===t||t.prepend(r)}async init(){this.mountPoint&&this.banner&&(this.mountPoint.addEventListener("click",this.handleClick),await this.banner.attachRoot(this.mountPoint))}destroy(){var e,t;null===(e=this.banner)||void 0===e||e.detachRoot(),null===(t=this.mountPoint)||void 0===t||t.removeEventListener("click",this.handleClick)}connectedCallback(){if(this.shadowRoot)return;const e=this.attachShadow({mode:"open"});this.mountPoint=document.createElement("div"),this.mountPoint.style.height="100%",this.mountPoint.style.width="100%",e.appendChild(this.mountPoint)}disconnectedCallback(){}}function T(e){const t=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)$/i);if(t){const[e,r,n,i]=t.map(Number);return(299*r+587*n+114*i)/1e3>128}if(e.startsWith("#")){const t=e.slice(1);let r,n,i;if(3===t.length)r=parseInt(t[0]+t[0],16),n=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16);else{if(6!==t.length)return!1;r=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16)}return(299*r+587*n+114*i)/1e3>128}return!0}customElements.get("banner-slides-container")||customElements.define("banner-slides-container",x);const O=(0,u.observer)((e=>{var{banner:t}=e,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["banner"]);const n=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,c.useLayoutEffect)((()=>{n.current&&n.current.setStyle(t.context.style)}),[t.context.style]),(0,c.useLayoutEffect)((()=>{if(!n.current)return;const e=n.current;return e.setBanner(t),e.init(),()=>{e.destroy()}}),[t]),(0,c.useEffect)((()=>{if(r.isActive&&t.canBeShown)return t.start(),()=>{t.stop()}}),[t,r.isActive,t.canBeShown]),(0,l.jsxs)("div",{className:(0,_.default)(m.banner,"ias-banner",r.className),ref:i,style:{height:t.width/t.contentRatio+"px",opacity:t.canBeShown?1:0,background:t.appearance.background,"--banner-border-radius":`${r.clientAppearance.borderRadius}px`},children:[(0,l.jsx)("banner-slides-container",{class:m["banner-slides"],ref:n,"allow-click":r.allowClick.toString(),dir:t.dir}),(0,l.jsx)(P,{needShowErrorScreen:t.needShowErrorScreen,needShowLoaderScreen:t.needShowLoaderScreen,onReload:async()=>{t.activeSlide.restart()},background:t.appearance.background,color:T(t.appearance.background)?"black":"white"})]})}));var j=d(369);b()(j.A,{insert:"head",singleton:!1});const I=j.A.locals||{},L=(e=>{var t={};return d.d(t,e),t})({action:()=>i.action,computed:()=>i.computed,observable:()=>i.observable,reaction:()=>i.reaction});var C=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let k=(()=>{var e,t;let r,n=[],i=[];return e=class{get _context(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _context(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}constructor(e){t.set(this,C(this,n,void 0)),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:C(this,i)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayFrom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayTo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_wasShown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_frequencyLimit",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_openTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_isOnceOpened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.id=e.id,this.name=e.name,this.displayFrom=e.displayFrom,this.displayTo=e.displayTo,this.slides=e.slides,this._context=e.context,this.appearance=e.appearance}get context(){return this._context}get withinDisplayTimeRange(){return(!this.displayFrom||Date.now()>=this.displayFrom)&&(!this.displayTo||Date.now()<=this.displayTo)}get wasShown(){return this._wasShown}get frequencyLimitTimeExceeded(){return null===this._frequencyLimit?this._isOnceOpened:0!==this._frequencyLimit&&Math.trunc(this.timeSinceLastShow/1e3)<=this._frequencyLimit}get timeSinceLastShow(){return Date.now()-this._openTime}get openTime(){return this._openTime}updatePlaceholders(e){for(const t of this.slides)t.updatePlaceholders(e)}markWasShown(){this._wasShown=!0}markAsOpened(){this._openTime=Date.now(),this._isOnceOpened=!0}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[L.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_context",static:!1,private:!1,access:{has:e=>"_context"in e,get:e=>e._context,set:(e,t)=>{e._context=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class A{constructor(e){var t;Object.defineProperty(this,"contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.contentRatio=null!==(t=e.content_ratio)&&void 0!==t?t:1,this.background=this.mapBackgroundDtoToModel(e.background)}mapBackgroundDtoToModel(e){if(!e||0===e.alpha)return"transparent";if("solid"in e)return this.applyAlphaToColor(e.solid,e.alpha);if("linear_gradient"in e){const{angle:t,color_step_list:r}=e.linear_gradient;return`linear-gradient(${t}deg, ${r.map((t=>`${this.applyAlphaToColor(t.color,e.alpha)} ${t.position}%`)).join(", ")})`}return"transparent"}applyAlphaToColor(e,t){if(e.startsWith("#")){const r=e.slice(1),n=3===r.length;return`rgba(${parseInt(n?r[0]+r[0]:r.slice(0,2),16)}, ${parseInt(n?r[1]+r[1]:r.slice(2,4),16)}, ${parseInt(n?r[2]+r[2]:r.slice(4,6),16)}, ${t})`}return e}}class B{constructor(e,t){Object.defineProperty(this,"widgetsData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.style=t.style,this.widgetsData=this.mapBannerContextDto(e,t)}mapBannerContextDto(e,t){var r;const n={},i=null!==(r=t.widgetsData)&&void 0!==r?r:{};for(const t in i)Array.isArray(i[t])||(n[t]=i[t][e]);return n}updateNarrativeSavedData(e){this.widgetsData._narrative_saved_data=e}}function M(e,t,r){return String(e).replace(new RegExp(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),(()=>r))}var R=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let D=(()=>{var e,t;let r,n=[],i=[];return e=class{get _html(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _html(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}get html(){return this._html}constructor(e){t.set(this,R(this,n,void 0)),R(this,i),this._html=this.replaceSlideNonce(e.html)}updatePlaceholders(e){let t=this._html;for(const r of e)t=M(t,`%${r.key}%`,r.value);this._html=t}replaceSlideNonce(e){var t;return M(e,"{{nonce}}",null!==(t=E())&&void 0!==t?t:"")}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[L.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_html",static:!1,private:!1,access:{has:e=>"_html"in e,get:e=>e._html,set:(e,t)=>{e._html=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var N=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let z=(()=>{var e,t;let r,n=[],i=[];return e=class{get _banners(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _banners(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}constructor(e){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,N(this,n,[])),N(this,i),this.id=e.id,this._banners=e.banners,this.style=e.style,this.updatePlaceholders(e.placeholders)}get banners(){return this._banners}updatePlaceholders(e){for(const t of this._banners)t.updatePlaceholders(e)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[L.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();const W=(e,t)=>{if("number"==typeof e)return e;if("string"==typeof e){const t=parseFloat(e);if(!isNaN(t))return t}return t};var F=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},V=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},U=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},q=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let $=(()=>{var e,t;let r,n=[],i=[];return e=class{get borderRadius(){return U(this,t,"f")}set borderRadius(e){q(this,t,e,"f")}update(e){this.borderRadius=W(null==e?void 0:e.borderRadius,this.borderRadius)}constructor(){t.set(this,V(this,n,12)),V(this,i)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[L.observable],F(e,null,r,{kind:"accessor",name:"borderRadius",static:!1,private:!1,access:{has:e=>"borderRadius"in e,get:e=>e.borderRadius,set:(e,t)=>{e.borderRadius=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})(),G=(()=>{var e,t,r,n,i,a,s,o;let l,c,d,h,u,p,b,f=[],m=[],v=[],g=[],y=[],w=[],_=[],S=[],P=[],E=[],x=[],T=[],O=[],j=[];return e=class{get loop(){return U(this,t,"f")}set loop(e){q(this,t,e,"f")}get gap(){return U(this,r,"f")}set gap(e){q(this,r,e,"f")}get autoplay(){return U(this,n,"f")}set autoplay(e){q(this,n,e,"f")}get animationSpeed(){return U(this,i,"f")}set animationSpeed(e){q(this,i,e,"f")}get slidesPerView(){return U(this,a,"f")}set slidesPerView(e){q(this,a,e,"f")}get navigation(){return U(this,s,"f")}set navigation(e){q(this,s,e,"f")}get pagination(){return U(this,o,"f")}set pagination(e){q(this,o,e,"f")}constructor(e){t.set(this,V(this,f,!0)),r.set(this,(V(this,m),V(this,v,16))),n.set(this,(V(this,g),V(this,y,!1))),i.set(this,(V(this,w),V(this,_,300))),a.set(this,(V(this,S),V(this,P,1))),s.set(this,(V(this,E),V(this,x,{enabled:!0}))),o.set(this,(V(this,T),V(this,O,{enabled:!0}))),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:(V(this,j),new $)}),e&&this.update(e)}update(e){var t,r,n,i,a,s;this.loop=null!==(t=null==e?void 0:e.loop)&&void 0!==t?t:this.loop,this.gap=W(null==e?void 0:e.gap,this.gap),this.autoplay=null!==(r=null==e?void 0:e.autoplay)&&void 0!==r?r:this.autoplay,this.animationSpeed=W(null==e?void 0:e.animationSpeed,this.animationSpeed),this.slidesPerView=Math.max(W(null==e?void 0:e.slidesPerView,this.slidesPerView),0),this.navigation={enabled:null!==(i=null===(n=null==e?void 0:e.navigation)||void 0===n?void 0:n.enabled)&&void 0!==i?i:this.navigation.enabled},this.pagination={enabled:null!==(s=null===(a=null==e?void 0:e.pagination)||void 0===a?void 0:a.enabled)&&void 0!==s?s:this.pagination.enabled},this.banner.update(e.banner)}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,o=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;l=[L.observable],c=[L.observable],d=[L.observable],h=[L.observable],u=[L.observable],p=[L.observable],b=[L.observable],F(e,null,l,{kind:"accessor",name:"loop",static:!1,private:!1,access:{has:e=>"loop"in e,get:e=>e.loop,set:(e,t)=>{e.loop=t}},metadata:t},f,m),F(e,null,c,{kind:"accessor",name:"gap",static:!1,private:!1,access:{has:e=>"gap"in e,get:e=>e.gap,set:(e,t)=>{e.gap=t}},metadata:t},v,g),F(e,null,d,{kind:"accessor",name:"autoplay",static:!1,private:!1,access:{has:e=>"autoplay"in e,get:e=>e.autoplay,set:(e,t)=>{e.autoplay=t}},metadata:t},y,w),F(e,null,h,{kind:"accessor",name:"animationSpeed",static:!1,private:!1,access:{has:e=>"animationSpeed"in e,get:e=>e.animationSpeed,set:(e,t)=>{e.animationSpeed=t}},metadata:t},_,S),F(e,null,u,{kind:"accessor",name:"slidesPerView",static:!1,private:!1,access:{has:e=>"slidesPerView"in e,get:e=>e.slidesPerView,set:(e,t)=>{e.slidesPerView=t}},metadata:t},P,E),F(e,null,p,{kind:"accessor",name:"navigation",static:!1,private:!1,access:{has:e=>"navigation"in e,get:e=>e.navigation,set:(e,t)=>{e.navigation=t}},metadata:t},x,T),F(e,null,b,{kind:"accessor",name:"pagination",static:!1,private:!1,access:{has:e=>"pagination"in e,get:e=>e.pagination,set:(e,t)=>{e.pagination=t}},metadata:t},O,j),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();const H=(e=>{var t={};return d.d(t,e),t})({v4:()=>a.v4});class X{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"eventId",{enumerable:!0,configurable:!0,writable:!0,value:(0,H.v4)()})}get type(){return"view"}toQueryParams(){return{ei:this.eventId,ii:this.payload.iterationId,si:this.payload.slideIndex,st:this.payload.slideTotal}}}class Y{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"eventId",{enumerable:!0,configurable:!0,writable:!0,value:(0,H.v4)()})}get type(){return this.payload.type}toQueryParams(){return Object.assign({ei:this.eventId,ii:this.payload.iterationId,si:this.payload.slideIndex,st:this.payload.slideTotal,d:this.payload.durationMs},this.payload.widgetPayload)}}var Q=d(46);class J{constructor(){Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:{isPaused:function(){return!1},resume:function(){},pause:function(){},start:function(){},stop:function(){},setDelay:function(){}}})}updateSize(){}enableHorizontalSwipeGesture(){}disableHorizontalSwipeGesture(){}getTotalPages(){return 1}getActiveIndex(){return 0}toNextSlide(){}toPrevSlide(){}slideTo(e,t){}}var Z,K=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},ee=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},te=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},re=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};!function(e){e.Play="play",e.Stop="stop",e.LoadStart="loadStart",e.LoadEnd="loadEnd",e.LoadError="loadError",e.ActiveIndexChange="activeIndexChange"}(Z||(Z={}));let ne=(()=>{var e,t,r,n,i;let a,s,o,l,c=Q.EventEmitter,d=[],h=[],u=[],p=[],b=[],f=[],m=[],v=[];return e=class extends c{get _banners(){return te(this,t,"f")}set _banners(e){re(this,t,e,"f")}get _bannerPlace(){return te(this,r,"f")}set _bannerPlace(e){re(this,r,e,"f")}get _isLoading(){return te(this,n,"f")}set _isLoading(e){re(this,n,e,"f")}get _isLoaded(){return te(this,i,"f")}set _isLoaded(e){re(this,i,e,"f")}constructor(e,a,s,o,l){super(),Object.defineProperty(this,"placeId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"bannerViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:l}),t.set(this,ee(this,d,[])),r.set(this,(ee(this,h),ee(this,u,null))),n.set(this,(ee(this,p),ee(this,b,!1))),i.set(this,(ee(this,f),ee(this,m,!1))),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:(ee(this,v),new G)}),Object.defineProperty(this,"sliderController",{enumerable:!0,configurable:!0,writable:!0,value:new J}),this.ctx.addBannerPlace(this)}get id(){return this.placeId}get banners(){return this._banners}get contentRatio(){const e=this._banners.map((e=>e.contentRatio));return this.median(e)}get isLoaded(){return this._isLoaded}get isLoading(){return this._isLoading}get slider(){return this.sliderController}get activeIndex(){return this.sliderController.getActiveIndex()}refreshSizes(){this._banners.forEach((e=>e.refreshSizes()))}setSliderController(e){this.sliderController=e}updateAppearance(e){this.appearance.update(e)}play(){for(const e of this._banners)e.resume()}stop(){for(const e of this._banners)e.pause()}resume(){if(this.appearance.autoplay){this.slider.autoplay.resume();for(const e of this._banners)e.resumeByUser()}}pause(){if(this.appearance.autoplay){this.slider.autoplay.pause();for(const e of this._banners)e.pauseByUser()}}async reload(){this.bannerStore.removeBannerPlaceById(this.id),await Promise.all(this._banners.map((e=>e.destroy()))),this._banners=[],await this.fetchBanners()}destroy(){this.sliderController=new J;for(const e of this._banners)e.destroy();this._banners=[],this.ctx.removeBannerPlace(this)}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}async fetchBanners(){try{return this._isLoading?[]:(this._isLoading=!0,this._isLoaded=!1,this.emit(Z.LoadStart),this._bannerPlace=await this.bannerStore.getBannerPlaceById({placeId:this.placeId}),this._banners=this.filterBannersByTimeRange(this._bannerPlace.banners).map((e=>this.bannerViewModelFactory.create(this,e))),await Promise.allSettled(this._banners.map((e=>e.waitInit()))),this._isLoaded=!0,this._banners)}catch(e){throw this.emit(Z.LoadError,e),e}finally{this.emit(Z.LoadEnd),this._isLoading=!1}}filterBannersByTimeRange(e){return e.filter((e=>e.withinDisplayTimeRange))}median(e){const t=[...e].sort(((e,t)=>e-t)),r=Math.floor(t.length/2);return t.length%2==0?(t[r-1]+t[r])/2:t[r]}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=c[Symbol.metadata])&&void 0!==t?t:null):void 0;a=[L.observable],s=[L.observable],o=[L.observable],l=[L.observable],K(e,null,a,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:r},d,h),K(e,null,s,{kind:"accessor",name:"_bannerPlace",static:!1,private:!1,access:{has:e=>"_bannerPlace"in e,get:e=>e._bannerPlace,set:(e,t)=>{e._bannerPlace=t}},metadata:r},u,p),K(e,null,o,{kind:"accessor",name:"_isLoading",static:!1,private:!1,access:{has:e=>"_isLoading"in e,get:e=>e._isLoading,set:(e,t)=>{e._isLoading=t}},metadata:r},b,f),K(e,null,l,{kind:"accessor",name:"_isLoaded",static:!1,private:!1,access:{has:e=>"_isLoaded"in e,get:e=>e._isLoaded,set:(e,t)=>{e._isLoaded=t}},metadata:r},m,v),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();const ie=e=>((0,c.useEffect)((()=>(e.onLoadStart&&e.bannerPlace.on(Z.LoadStart,e.onLoadStart),e.onLoadEnd&&e.bannerPlace.on(Z.LoadEnd,e.onLoadEnd),e.onLoadError&&e.bannerPlace.on(Z.LoadError,e.onLoadError),()=>{e.onLoadStart&&e.bannerPlace.off(Z.LoadStart,e.onLoadStart),e.onLoadEnd&&e.bannerPlace.off(Z.LoadEnd,e.onLoadEnd),e.onLoadError&&e.bannerPlace.off(Z.LoadError,e.onLoadError)})),[e.bannerPlace,e.onLoadStart,e.onLoadError,e.onLoadEnd]),(0,c.useEffect)((()=>{(async e=>{try{await e.fetchBanners()}catch(e){console.error(e)}})(e.bannerPlace)}),[e.bannerPlace]),e.bannerPlace.banners);class ae{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e})}isPaused(){return this.slider.autoplay.paused}resume(){this.slider.autoplay.resume()}pause(){this.slider.autoplay.pause()}start(){this.slider.autoplay.start()}setDelay(e){this.slider.autoplay.setDelay(e)}stop(){this.slider.autoplay.stop()}}class se{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:new ae(this.slider)})}getTotalPages(){return this.slider.totalPages}getActiveIndex(){return this.slider.realIndex}toNextSlide(){this.slider.toNextSlide()}toPrevSlide(){this.slider.toPrevSlide()}slideTo(e,t){this.slider.slideToLoop(e,t)}enableHorizontalSwipeGesture(){this.slider.enableHorizontalSwipeGesture()}disableHorizontalSwipeGesture(){this.slider.disableHorizontalSwipeGesture()}updateSize(){this.slider.updateSize()}}var oe=d(55);b()(oe.A,{insert:"head",singleton:!1});const le=oe.A.locals||{},ce=e=>{const[t,r]=(0,c.useState)(-1);return(0,c.useEffect)((()=>{e.activeIndex===t&&r(-1)}),[e.activeIndex,t]),e.totalPages>1&&(0,l.jsx)("div",{className:(0,_.default)(le["slider-bullets"],"ias-slider-bullets"),children:Array.from({length:e.totalPages}).map(((t,n)=>(0,l.jsx)("div",{className:(0,_.default)("ias-slider-bullets__bullet",le["slider-bullets__bullet"],{[le["slider-bullets__bullet--active"]]:n===e.activeIndex,"ias-slider-bullets__bullet--active":n===e.activeIndex}),onClick:()=>(t=>{r(t),e.onClick(t)})(n)},n)))})};var de=d(41);b()(de.A,{insert:"head",singleton:!1});const he=de.A.locals||{};var ue=d(379);b()(ue.A,{insert:"head",singleton:!1});const pe=ue.A.locals||{},be=e=>(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{onClick:e.onPrevClick,className:(0,_.default)("ias-slider__controls-btn","ias-slider__controls-btn--prev",pe["slider__controls-btn"],pe["slider__controls-btn--prev"],{[pe["slider__controls-btn--disabled"]]:e.prevDisabled,"ias-slider__controls-btn--disabled":e.prevDisabled}),children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M0 12l10.975 11 2.848-2.828-6.176-6.176H24v-3.992H7.646l6.176-6.176L10.975 1 0 12z",fill:"currentColor"})})}),(0,l.jsx)("button",{onClick:e.onNextClick,className:(0,_.default)("ias-slider__controls-btn","ias-slider__controls-btn--next",pe["slider__controls-btn"],pe["slider__controls-btn--next"],{[pe["slider__controls-btn--disabled"]]:e.nextDisabled,"ias-slider__controls-btn--disabled":e.nextDisabled}),children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M13.025 1l-2.847 2.828 6.176 6.176h-16.354v3.992h16.354l-6.176 6.176 2.847 2.828 10.975-11z",fill:"currentColor"})})})]});class fe{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_enabled",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get enabled(){return this._enabled}update(){const e=this.slider.options.loop&&this.canUseLoop();this._enabled?e||(this._enabled=!1,this.destroy()):e&&(this._enabled=!0)}applyLoopFix({targetIndex:e,direction:t}){if(!this.enabled)return!1;const r="next"===t||!t,n="prev"!==t&&t?[]:this.getPrependSlidesIndexes(e),i=r?this.getAppendSlidesIndexes(e):[];return this.moveSlides(n,i),this.adjustPosition(n,i),n.length>0||i.length>0}destroy(){this.resetSlidesOrder()}resetSlidesOrder(){const e=[];this.slider.slides.forEach((t=>{const r=+t.dataset.index;e[r]=t})),e.forEach((e=>{this.slider.track.append(e)}))}canUseLoop(){return!(this.slider.slides.length<this.slider.options.slidesPerView+1&&(console.warn("IAS Banners Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView parameters"),1))}getPrependSlidesIndexes(e){const t=this.slider.track.children,r=[];if(e<1)for(let n=0;n<1-e;n++){const e=t.length-n-1;r.push(e)}return r}getAppendSlidesIndexes(e){const t=[];if(e+this.slider.options.slidesPerView>this.slider.slides.length-1){const r=Math.max(e-(this.slider.slides.length-2),1);for(let e=0;e<r;e++){const r=e;t.push(r)}}return t}moveSlides(e,t){const r=this.slider.track,n=this.slider.slides.slice();e.forEach((e=>{r.prepend(n[e])})),t.forEach((e=>{r.append(n[e])}))}adjustPosition(e,t){e.length>0?this.slider.slideTo(this.slider.activeIndex+e.length,0):t.length>0&&this.slider.slideTo(this.slider.activeIndex-t.length,0)}}var me,ve;!function(e){e.TouchStart="touchStart",e.TouchMove="touchMove",e.TouchEnd="touchEnd",e.ReachStart="reachStart",e.ReachEnd="reachEnd",e.ActiveIndexChange="activeIndexChange",e.RealIndexChnage="realIndexChange",e.TransitionStart="transitionStart",e.TransitionEnd="transitionend",e.Resize="resize",e.SlidesUpdated="slidesUpdated"}(me||(me={}));class ge{constructor(e,t){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"startX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"startTranslateX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"isTouched",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isMoved",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"startDirection",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"onTouchStart",{enumerable:!0,configurable:!0,writable:!0,value:e=>{!this.slider.animating&&this._enabled&&(e.stopPropagation(),this.startX=e instanceof MouseEvent?e.pageX:e.touches[0].clientX,this.startTranslateX=this.slider.currentTranslateX,this.isTouched=!0,this.setGrabCursor(!1))}}),Object.defineProperty(this,"onTouchMove",{enumerable:!0,configurable:!0,writable:!0,value:e=>{if(!this.isTouched)return;e.stopPropagation();let t=(e instanceof MouseEvent?e.pageX:e.touches[0].clientX)-this.startX;if(t*=1,!(Math.abs(t)>20||this._isMoved))return;this.setGrabCursor(!0),this._isMoved||(this.slider.emit(me.TouchStart),this.slider.autoplay.pause(),this.slider.lockActiveIndex(),this.startDirection=this.getSwipeDirection(t)),this._isMoved=!0;const r="next"===this.startDirection?20:-20;this.slider.emit(me.TouchMove);let n=this.startTranslateX+t+r;this.applyLoopFix(n),n=this.startTranslateX+t+r,this.setTranslate(n)}}),Object.defineProperty(this,"onTouchEnd",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.isTouched&&(this.slider.unlockActiveIndex(),this.updateActiveIndex(),this.unsetGrabCursor(),this.isTouched=!1,this._isMoved=!1,this.slider.emit(me.TouchEnd),this.slider.autoplay.resume())}}),this.slider.track.addEventListener("mousedown",this.onTouchStart,{passive:!0}),document.addEventListener("mousemove",this.onTouchMove,{passive:!0}),document.addEventListener("mouseup",this.onTouchEnd),this.slider.track.addEventListener("touchstart",this.onTouchStart,{passive:!0}),document.addEventListener("touchmove",this.onTouchMove,{passive:!0}),document.addEventListener("touchend",this.onTouchEnd)}get isMoved(){return this._isMoved}enableHorizontalSwipeGesture(){this._enabled=!0}disableHorizontalSwipeGesture(){this._enabled=!1}destroy(){this.slider.track.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd),this.slider.track.removeEventListener("mousedown",this.onTouchStart),document.removeEventListener("mousemove",this.onTouchMove),document.removeEventListener("mouseup",this.onTouchEnd)}setTranslate(e){e=this.applyEdgeResistance(e),this.slider.setTranslate(e)}applyLoopFix(e){if(!this.loopModule.enabled)return;e=-e;const t=this.slider.slideWidth+this.slider.options.spaceBetween,r=this.slider.getMinTranslate(),n=Math.abs(this.slider.getSlideOffset(this.slider.slides.length-this.slider.options.slidesPerView));e<r?this.loopModule.applyLoopFix({targetIndex:0,direction:"prev"})&&(this.startTranslateX-=t):e>n&&this.loopModule.applyLoopFix({targetIndex:this.slider.slides.length-this.slider.options.slidesPerView,direction:"next"})&&(this.startTranslateX+=t)}updateActiveIndex(){var e;if(!this.slider.slides.length)return;const{currentTranslateX:t,slides:r,options:n}=this.slider,i=(null===(e=r[0])||void 0===e?void 0:e.clientWidth)+n.spaceBetween;let a=-Math.round(t/i);const s=this.slider.totalPages-1;a=Math.min(s,Math.max(0,a)),this.slider.slideTo(a)}setGrabCursor(e){this.slider.track.style.cursor="move",this.slider.track.style.cursor=e?"grabbing":"grab"}unsetGrabCursor(){this.slider.track.style.cursor=""}getResistanceCoeff(e){const t=Math.min(Math.abs(e)/(.5*this.slider.slides[0].clientWidth),1);return.3+.7*Math.exp(3*-t)}applyEdgeResistance(e){if(this.loopModule.enabled)return e;e=-e;const t=this.slider.getMinTranslate(),r=-this.slider.getMaxTranslate();if(e>r){const t=e-r;e=r+t*this.getResistanceCoeff(t)}else if(e<t){const r=t-e;e=t-r*this.getResistanceCoeff(r)}return-e}getSwipeDirection(e){return e>0?"prev":"next"}}!function(e){e.Start="start",e.Stop="stop",e.Pause="pause",e.Resume="resume",e.Progress="progress",e.Complete="complete"}(ve||(ve={}));class ye extends Q.EventEmitter{constructor(){super(...arguments),Object.defineProperty(this,"timerId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"currentProgress",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"progressBeforePause",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timerPaused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"isCompleted",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"rafId",{enumerable:!0,configurable:!0,writable:!0,value:0})}get started(){return!this.isCompleted}get paused(){return this.timerPaused}setTimer(e){0!==e?(this.timerId=setTimeout((()=>this.complete({})),e),this.currentProgress=0,this.runTimerTicks(e)):this.forceEnd()}start(e){this.timerPaused||(this.stop(),this.progressBeforePause=0,this.timeout=e,this.enabled&&(this.isCompleted=!1,this.emit(ve.Start),this.setTimer(e)))}restart(){this.stop(),this.start(this.timeout)}stop(){this.isCompleted||(this.clearTimer(),this.emit(ve.Stop),this.isCompleted=!0,this.timerPaused=!1)}pause(){this.isCompleted||(this.timerPaused=!0,this.clearTimer(),this.progressBeforePause=this.currentProgress,this.emit(ve.Pause))}resume(){if(!this.timerPaused)return;this.timerPaused=!1;const e=1-this.progressBeforePause,t=this.timeout*e;this.setTimer(t),this.emit(ve.Resume)}forceEnd(){this.complete({forceEnd:!0})}disable(){this.enabled=!1,this.stop()}enable(){this.enabled=!0,this.start(this.timeout)}complete({forceEnd:e=!1}){this.isCompleted=!0,this.progressBeforePause=0,this.clearTimer(),this.emit(ve.Complete,{forceEnd:e})}clearTimer(){cancelAnimationFrame(this.rafId),null!==this.timerId&&(clearTimeout(this.timerId),this.timerId=null)}updateProgress(e){const t=1-this.progressBeforePause;this.currentProgress=this.progressBeforePause+e*t;const r=100*this.currentProgress;this.emit(ve.Progress,r)}runTimerTicks(e){let t=performance.now();const r=n=>{let i=(n-t)/e;i>1&&(i=1);let a=i;this.updateProgress(a),i<1&&(this.rafId=requestAnimationFrame(r))};this.rafId=requestAnimationFrame(r)}}class we{constructor(e,t){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:new ye}),Object.defineProperty(this,"delay",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"handleTimerComplete",{enumerable:!0,configurable:!0,writable:!0,value:async()=>{this.slider.reachEnd&&!this.loopModule.enabled?this.slider.slideTo(0):this.slider.toNextSlide()}}),Object.defineProperty(this,"handleVisibilityChange",{enumerable:!0,configurable:!0,writable:!0,value:()=>{document.hidden?this.pause():this.resume()}}),this.timer.on("complete",this.handleTimerComplete),document.addEventListener("visibilitychange",this.handleVisibilityChange)}get paused(){return this.timer.paused}start(){this.stop(),this.slider.options.autoplay&&this.timer.start(this.delay)}stop(){this.timer.stop()}pause(){this.timer.pause()}resume(){this.timer.resume()}setDelay(e){this.delay=e}destroy(){this.timer.off("complete",this.handleTimerComplete),document.removeEventListener("visibilitychange",this.handleVisibilityChange),this.stop()}}class _e extends Q.EventEmitter{constructor(e,t={}){super(),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:{autoplay:!1,speed:300,delay:3e3,loop:!1,slidesPerView:1,spaceBetween:0,initialSlide:0,updateOnWindowResize:!0}}),Object.defineProperty(this,"isAnimating",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_activeIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_realIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_currentTranslateX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_reachEnd",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_reachStart",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"touchModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_slideWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_activeIndexLocked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"handleResize",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.updateSize(),this.emit(me.Resize)}}),this.track=e,this.container=e.parentElement,this.loopModule=new fe(this),this.touchModule=new ge(this,this.loopModule),this.autoplay=new we(this,this.loopModule),this.options.updateOnWindowResize&&window.addEventListener("resize",this.handleResize),this.collectSlides(),this.update(t)}get activeIndex(){return this._activeIndex}get realIndex(){return this._realIndex}get reachEnd(){return this._reachEnd}get reachStart(){return this._reachStart}get slidesEl(){return this.track}get slides(){return Array.from(this.track.children)}get allSlides(){return this.slides}get animating(){return this.isAnimating}get currentTranslateX(){return this._currentTranslateX}get isMoved(){return this.touchModule.isMoved}get slideWidth(){return this._slideWidth}get totalPages(){return this.loopModule.enabled?this.slides.length:Math.max(this.slides.length-this.options.slidesPerView+1,1)}async slideToLoop(e,t=this.options.speed){if(!this.loopModule.enabled)return this.slideTo(e,t);if(this.isAnimating)return;const r=this.getPhysicalIndexByRealIndex(e),n=this.slides.length-r<this.options.slidesPerView,i=r-this._activeIndex-1<this.options.slidesPerView?"next":"prev";if(n){const e="next"===i?r+1:r-this.slides.length+1;this.loopModule.applyLoopFix({targetIndex:e,direction:i})}const a=this.getPhysicalIndexByRealIndex(e);requestAnimationFrame((()=>this.slideTo(a)))}async slideTo(e,t=this.options.speed){e=this.clamp(e,0,this.totalPages-1),this.isAnimating||(this.isAnimating=!0,await this.performTranslateToSlide(e,t),this._activeIndexLocked||this.updateIndexes(e),this.isAnimating=!1)}lockActiveIndex(){this._activeIndexLocked=!0}unlockActiveIndex(){this._activeIndexLocked=!1}toNextSlide(){this.isAnimating||(this.loopModule.enabled?this.toNextSlideByLoop():this.slideTo(this.normalizeIndex(this._realIndex+1)))}toPrevSlide(){this.isAnimating||(this.loopModule.enabled?this.toPrevSlideByLoop():this.slideTo(this.normalizeIndex(this._realIndex-1)))}update(e){this.options=this.normalizeOptions(Object.assign(Object.assign({},this.options),e)),this.setupTrackStyles();const t=this.slideWidth;this.calculateSlideWidths(),t!==this.slideWidth&&this.emit(me.SlidesUpdated),this.loopModule.update(),this.slideTo(this._activeIndex,0),this.testAttraction()}destroy(){window.removeEventListener("resize",this.handleResize),this.autoplay.destroy(),this.touchModule.destroy(),this.track.removeAttribute("style"),this._activeIndex=0,this._activeIndexLocked=!1,this.isAnimating=!1}isSlideVisible(e){const t=this.getPhysicalIndexByRealIndex(e);return t>=this._activeIndex&&t<this._activeIndex+this.options.slidesPerView}getVisibleSlideIndexes(){return this.slides.slice(this._activeIndex,this._activeIndex+this.options.slidesPerView).map((e=>+e.dataset.index))}getPhysicalIndexByRealIndex(e){const t=this.normalizeIndex(e);return this.slides.findIndex((e=>e.dataset.index===t.toString()))}getMinTranslate(){return 0}getMaxTranslate(){return this.getSlideOffset(this.totalPages-1)}setTranslate(e){this.track.style.transform=`translate3d(${e}px, 0px, 0px)`,this._currentTranslateX=e,this.testAttraction()}enableHorizontalSwipeGesture(){this.touchModule.enableHorizontalSwipeGesture()}disableHorizontalSwipeGesture(){this.touchModule.disableHorizontalSwipeGesture()}getSlideOffset(e){return this.slides.length?-e*(this.slides[0].clientWidth+this.options.spaceBetween):0}updateSize(){const e=this.slideWidth;this.calculateSlideWidths(),e!==this.slideWidth&&this.emit(me.SlidesUpdated),this.slideTo(this._activeIndex,0)}getTrackWidth(){return this.track.clientWidth-this.options.spaceBetween*(this.options.slidesPerView-1)}toNextSlideByLoop(){this.isAnimating||(this.loopModule.applyLoopFix({targetIndex:this._activeIndex,direction:"next"}),requestAnimationFrame((()=>this.slideTo(this._activeIndex+1))))}toPrevSlideByLoop(){this.isAnimating||(this.loopModule.applyLoopFix({targetIndex:this._activeIndex,direction:"prev"}),requestAnimationFrame((()=>this.slideTo(this._activeIndex-1))))}updateIndexes(e){if(!this.slides.length)return;const t=+this.slides[e].dataset.index,r=this._realIndex,n=this._activeIndex;this._realIndex=t,this._activeIndex=e,r!==t&&this.emit(me.RealIndexChnage,t),n!==e&&this.emit(me.ActiveIndexChange,e)}setupTrackStyles(){Object.assign(this.track.style,{display:"flex",transition:`transform ${this.options.speed}ms ease`,gap:`${this.options.spaceBetween}px`}),this.container.style.overflow="hidden"}collectSlides(){this.slides.forEach(((e,t)=>{e.dataset.index=t.toString()}))}calculateSlideWidths(){this._slideWidth=Math.ceil(this.getTrackWidth()/this.options.slidesPerView),this.slides.forEach((e=>{e.style.width=`${this._slideWidth}px`}))}translateSlidesTrack(e,t){this.track.style.transitionDuration=`${t}ms`,this.setTranslate(this.getSlideOffset(e))}async performTranslateToSlide(e,t){if(0===t)this.translateSlidesTrack(e,0);else{if(this._activeIndex===e&&!this.touchModule.isMoved)return;this.translateSlidesTrack(e,t),this.emit(me.TransitionStart),await this.waitTransitionEnd(),this.emit(me.TransitionEnd)}}waitTransitionEnd(){return new Promise((e=>{this.track.addEventListener("transitionend",(t=>{"transform"===t.propertyName&&(this.track.style.transitionDuration="0ms",e())}),{once:!0})}))}testAttraction(){const e=this.getMinTranslate(),t=this.getMaxTranslate(),r=!this.loopModule.enabled&&this._currentTranslateX>=e,n=!this.loopModule.enabled&&this._currentTranslateX<=t;r!==this._reachStart&&(this._reachStart=r,this.emit(me.ReachStart,r)),n!==this._reachEnd&&(this._reachEnd=n,this.emit(me.ReachEnd,n))}normalizeOptions(e){var t,r,n,i,a,s,o,l;return{autoplay:null!==(t=e.autoplay)&&void 0!==t?t:this.options.autoplay,speed:null!==(r=e.speed)&&void 0!==r?r:this.options.speed,delay:null!==(n=e.delay)&&void 0!==n?n:this.options.delay,loop:null!==(i=e.loop)&&void 0!==i?i:this.options.loop,slidesPerView:Math.max(Math.min(this.track.children.length,null!==(a=e.slidesPerView)&&void 0!==a?a:this.options.slidesPerView),0),spaceBetween:null!==(s=e.spaceBetween)&&void 0!==s?s:this.options.spaceBetween,initialSlide:null!==(o=e.initialSlide)&&void 0!==o?o:this.options.initialSlide,updateOnWindowResize:null!==(l=e.updateOnWindowResize)&&void 0!==l?l:this.options.updateOnWindowResize}}normalizeIndex(e){const t=this.slides.length;return(e%t+t)%t}clamp(e,t,r){return Math.max(t,Math.min(e,r))}}const Se=(0,u.observer)((e=>{const[t,r]=(0,c.useState)(null),n=(0,c.useRef)(null);return(0,c.useEffect)((()=>{if(!n.current||!e.slidesCount)return;const t=new _e(n.current,{autoplay:e.autoplay,speed:e.speed,loop:e.loop,slidesPerView:e.slidesPerView,spaceBetween:e.spaceBetween});return e.onInit(t),r(t),()=>{null==t||t.destroy()}}),[e.slidesCount]),(0,c.useEffect)((()=>{t&&t.update({autoplay:e.autoplay,speed:e.speed,loop:e.loop,slidesPerView:e.slidesPerView,spaceBetween:e.spaceBetween})}),[t,e.autoplay,e.speed,e.loop,e.slidesPerView,e.spaceBetween,e.slidesCount]),(0,l.jsxs)("div",{className:he.slider,style:{"--slider-border-radius":`${e.borderRadius}px`},children:[(0,l.jsx)("div",{ref:n,className:he.slider__track,children:e.children}),t&&e.pagination.enabled&&(0,l.jsx)(ce,{totalPages:t.totalPages,activeIndex:t.realIndex,onClick:r=>{e.loop?t.slideToLoop(r):t.slideTo(r)}}),t&&e.navigation.enabled&&(0,l.jsx)(be,{onPrevClick:()=>{t.toPrevSlide()},onNextClick:()=>{t.toNextSlide()},nextDisabled:t.reachEnd,prevDisabled:t.reachStart})]})})),Pe=e=>(0,l.jsx)("div",{className:(0,_.default)(he.slider__slide,e.className),style:e.style,children:e.children}),Ee=(0,u.observer)((e=>{const t=ie(e),r=(0,c.useRef)(null);return(0,l.jsx)("div",{className:I["banner-slot"],ref:r,children:t.length?(0,l.jsx)(O,{index:0,isActive:!0,canBeInited:!0,banner:t[0],allowClick:!0,clientAppearance:e.bannerPlace.appearance.banner}):(0,l.jsx)(P,{needShowErrorScreen:!1,needShowLoaderScreen:!0,onReload:()=>{}})})})),xe=(0,u.observer)((e=>{const t=(0,c.useRef)(null),r=ie(e);var n;n=e,(0,c.useEffect)((()=>{n.appearance&&n.bannerPlace.updateAppearance(n.appearance)}),[n.bannerPlace,JSON.stringify(n.appearance)]);const{realIndex:i,allowClick:a,slider:s,isAnimating:o,setSlider:d,isMoved:h}=(e=>{const t=(0,c.useRef)(null),[r,n]=(0,c.useState)(!1),[i,a]=(0,c.useState)(!1),[s,o]=(0,c.useState)(!1),[l,d]=(0,c.useState)(!0),[h,u]=(0,c.useState)(null),[p,b]=(0,c.useState)(0),[f,m]=(0,c.useState)(0),[v,g]=(0,c.useState)(!0),[y,w]=(0,c.useState)(!0),_=()=>{clearTimeout(t.current),d(!1),o(!0),((e,t)=>{e.getVisibleSlideIndexes().map((e=>t.banners[e])).forEach((e=>e.pause()))})(h,e)},S=()=>{t.current=setTimeout((()=>d(!0)),100),o(!1),((e,t)=>{t.banners.forEach((e=>e.resume()))})(0,e)},P=()=>{a(!0),d(!1)},E=()=>{a(!1),d(!0)},x=t=>{m(t),e.emit(Z.ActiveIndexChange,t)},T=e=>{b(e)},O=()=>{h&&g(h.reachStart)},j=()=>{h&&w(h.reachEnd)},I=()=>{},L=()=>{e.refreshSizes(),requestAnimationFrame((()=>{e.refreshSizes(),n((e=>!e))}))};return(0,c.useEffect)((()=>{if(!h)return;const t=new se(h);e.setSliderController(t)}),[e,h]),(0,c.useEffect)((()=>{h&&e&&e.banners[h.realIndex].markAsOpened()}),[e,h]),(0,c.useEffect)((()=>{if(h)return h.on(me.TouchStart,_),h.on(me.TouchEnd,S),h.on(me.TransitionStart,P),h.on(me.TransitionEnd,E),h.on(me.RealIndexChnage,x),h.on(me.ActiveIndexChange,T),h.on(me.ReachStart,O),h.on(me.ReachEnd,j),h.on(me.Resize,I),h.on(me.SlidesUpdated,L),O(),j(),()=>{h.off(me.TouchStart,_),h.off(me.TouchEnd,S),h.off(me.TransitionStart,P),h.off(me.TransitionEnd,E),h.off(me.RealIndexChnage,x),h.off(me.ActiveIndexChange,T),h.off(me.ReachStart,O),h.off(me.ReachEnd,j),h.off(me.Resize,I),h.off(me.SlidesUpdated,L)}}),[e,h]),{reachStart:v,reachEnd:y,activeIndex:p,realIndex:f,isMoved:s,isAnimating:i,slider:h,setSlider:u,allowClick:l}})(e.bannerPlace);(({bannerPlace:e,bannerPlaceRef:t,slider:r})=>{const[n,i]=(0,c.useState)(!1);(0,c.useEffect)((()=>((async(e=5e3)=>new Promise(((r,n)=>{const i=setTimeout((()=>{n(new Error("[IAS]: Timeout while waiting for BannerPlace clientWidth"))}),e),a=()=>{if(t.current&&t.current.clientWidth>0)return clearTimeout(i),void r();requestAnimationFrame(a)};requestAnimationFrame(a)})))().then((()=>{i(!0)})).catch(console.error),()=>{i(!1)})),[e.isLoaded]),(0,c.useEffect)((()=>{r&&n&&(r.updateSize(),e.refreshSizes(),requestAnimationFrame((()=>{e.refreshSizes()})))}),[r,e,n])})({bannerPlace:e.bannerPlace,slider:s,bannerPlaceRef:t});const u=e.bannerPlace.appearance;return(0,l.jsx)("div",{className:(0,_.default)(I["banner-place"],e.className),style:e.style,ref:t,children:(0,l.jsx)(Se,{onInit:d,autoplay:u.autoplay,speed:u.animationSpeed,loop:u.loop,slidesPerView:u.slidesPerView,spaceBetween:u.gap,slidesCount:r.length,navigation:u.navigation,pagination:u.pagination,children:r.map(((e,t)=>{const r=Boolean(null==s?void 0:s.isSlideVisible(t));return(0,l.jsx)(Pe,{children:(0,l.jsx)(O,{index:t,isActive:r,canBeInited:r,banner:e,className:I["banner-slider__slide"],allowClick:a,clientAppearance:u.banner})},e.id)}))})})})),Te=(e=>{var t={};return d.d(t,e),t})({createRoot:()=>s.createRoot});class Oe{constructor(e,t,r){Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.rootElement=document.createElement("div"),this.rootElement.style.width="100%",this.rootElement.style.height="100%",e.appendChild(this.rootElement),this.root=(0,Te.createRoot)(this.rootElement)}get isLoaded(){return this.bannerPlace.isLoaded}get id(){return this.bannerPlace.id}get banners(){return this.bannerPlace.banners}get appearance(){return this.bannerPlace.appearance}get contentRatio(){return this.bannerPlace.contentRatio}get isLoading(){return this.bannerPlace.isLoading}get slider(){return this.bannerPlace.slider}refreshSizes(){}emit(e,...t){}setSliderController(e){this.bannerPlace.setSliderController(e)}updateAppearance(e){this.bannerPlace.updateAppearance(e)}play(){this.bannerPlace.play()}stop(){this.bannerPlace.stop()}resume(){this.bannerPlace.resume()}pause(){this.bannerPlace.pause()}reload(){return this.bannerPlace.reload()}destroy(){setTimeout((()=>{this.root.unmount()})),this.mountPoint.removeChild(this.rootElement),this.bannerPlace.destroy()}fetchBanners(){return this.bannerPlace.fetchBanners()}updateUserData(e){return Promise.resolve()}on(e,t){return this.bannerPlace.on(e,t),this}once(e,t){return this.bannerPlace.once(e,t),this}off(e,t){return this.bannerPlace.off(e,t),this}render(){var e;this.root.render((0,l.jsx)(xe,{appearance:null===(e=this.params)||void 0===e?void 0:e.appearance,bannerPlace:this.bannerPlace}))}}const je=e=>{const[t,r]=(0,c.useState)(null);return(0,c.useEffect)((()=>{var t;const n=Xt().createBannerPlace(e.placeId);return r(n),null===(t=e.onReady)||void 0===t||t.call(e,n),()=>{n.destroy()}}),[e.placeId]),t?(0,l.jsx)(xe,Object.assign({bannerPlace:t},e)):null},Ie=e=>{const[t,r]=(0,c.useState)(null);return(0,c.useEffect)((()=>{var t;const n=Xt().createBannerPreviewPlace(e.bannerId);return r(n),null===(t=e.onReady)||void 0===t||t.call(e,n),()=>{n.destroy()}}),[e.bannerId]),t?(0,l.jsx)(Ee,Object.assign({bannerPlace:t},e)):null};var Le=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},Ce=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},ke=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Ae=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Be=(()=>{var e,t,r,n;let i,a,s,o=Q.EventEmitter,l=[],c=[],d=[],h=[],u=[],p=[];return e=class extends o{get _banners(){return ke(this,t,"f")}set _banners(e){Ae(this,t,e,"f")}get _isLoading(){return ke(this,r,"f")}set _isLoading(e){Ae(this,r,e,"f")}get _isLoaded(){return ke(this,n,"f")}set _isLoaded(e){Ae(this,n,e,"f")}constructor(e,i,a,s){super(),Object.defineProperty(this,"bannerId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"bannerViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:s}),t.set(this,Ce(this,l,[])),r.set(this,(Ce(this,c),Ce(this,d,!1))),n.set(this,(Ce(this,h),Ce(this,u,!1))),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:(Ce(this,p),new G)}),this.ctx.addBannerPlace(this)}get id(){return"__BANNER_PREVIEW__"}get slider(){return new J}get banners(){return this._banners}get isLoading(){return this._isLoading}get isLoaded(){return this._isLoaded}get contentRatio(){var e,t;return null!==(t=null===(e=this._banners[0])||void 0===e?void 0:e.contentRatio)&&void 0!==t?t:1}refreshSizes(){this._banners.forEach((e=>e.refreshSizes()))}setSliderController(e){}updateAppearance(e){this.appearance.update(e)}play(){for(const e of this._banners)e.resume()}stop(){for(const e of this._banners)e.pause()}resume(){for(const e of this._banners)e.resume()}pause(){for(const e of this._banners)e.pause()}async reload(){this.bannerStore.removeBannerPlaceById(this.id),await Promise.all(this._banners.map((e=>e.destroy()))),this._banners=[],await this.fetchBanners()}destroy(){for(const e of this._banners)e.destroy();this._banners=[],this.ctx.removeBannerPlace(this)}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}async fetchBanners(){try{if(this._isLoading)return[];this._isLoading=!0,this._isLoaded=!1,this.emit(Z.LoadStart);const e=await this.bannerStore.getBannerById(this.bannerId);return this._banners=[this.bannerViewModelFactory.create(this,e)],this._isLoaded=!0,this._banners}catch(e){throw this.emit(Z.LoadError,e),e}finally{this.emit(Z.LoadEnd),this._isLoading=!1}}},t=new WeakMap,r=new WeakMap,n=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=o[Symbol.metadata])&&void 0!==t?t:null):void 0;i=[L.observable],a=[L.observable],s=[L.observable],Le(e,null,i,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:r},l,c),Le(e,null,a,{kind:"accessor",name:"_isLoading",static:!1,private:!1,access:{has:e=>"_isLoading"in e,get:e=>e._isLoading,set:(e,t)=>{e._isLoading=t}},metadata:r},d,h),Le(e,null,s,{kind:"accessor",name:"_isLoaded",static:!1,private:!1,access:{has:e=>"_isLoaded"in e,get:e=>e._isLoaded,set:(e,t)=>{e._isLoaded=t}},metadata:r},u,p),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class Me{constructor(e){Object.defineProperty(this,"bannerStatisticApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}async sendViewEvent(e,t){const r=new X(t);await this.bannerStatisticApi.sendViewEvent(e,r)}async sendWidgetEvent(e,t){const r=new Y(t);await this.bannerStatisticApi.sendWidgetEvent(e,r)}}class Re{constructor(){Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:{}})}set(e,t){this.cache[e]=t}clear(){this.cache={}}get(e){return this.cache[e]}}class De{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlaceViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){try{const t=this.storyManager.gameReader;await t.openGame(e.gameInstanceId),this.bannerPlaceViewModel.stop(),t.once("close",(()=>{this.bannerPlaceViewModel.play()}))}catch(e){console.error(e)}}}var Ne,ze,We,Fe,Ve,Ue,qe,$e,Ge,He,Xe,Ye,Qe,Je,Ze,Ke,et,tt,rt;!function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(Ne||(Ne={})),Ne.END,function(e){e.DEFAULT="default",e.CUSTOM_CARD="customCard"}(ze||(ze={})),ze.DEFAULT,ze.DEFAULT,function(e){e.CENTER="center",e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(We||(We={})),function(e){e.CIRCLE="circle",e.QUAD="quad",e.RECTANGLE="rectangle"}(Fe||(Fe={})),function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end",e.CENTER="center"}(Ve||(Ve={})),function(e){e.CARD_INSIDE_BOTTOM="cardInsideBottom",e.CARD_OUTSIDE_TOP="cardOutsideTop",e.CARD_OUTSIDE_BOTTOM="cardOutsideBottom"}(Ue||(Ue={})),function(e){e.Medium="medium",e.High="high"}(qe||(qe={})),function(e){e.COLUMN="vertical",e.ROW="horizontal"}($e||($e={})),function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(Ge||(Ge={})),$e.ROW,Ve.START,Ue.CARD_INSIDE_BOTTOM,qe.High,Fe.RECTANGLE,Ve.START,Ue.CARD_INSIDE_BOTTOM,qe.High,Fe.CIRCLE,We.START,Ve.START,Ue.CARD_INSIDE_BOTTOM,qe.High,Fe.CIRCLE,function(e){e.STORY_LIST="storyList",e.STORY_READER="storyReader",e.GAME_READER="gameReader",e.STACK_STORY_LIST="stackStoryList",e.IAM_READER="iamReader",e.BANNERS="banners"}(He||(He={})),function(e){e.FLAT="flat",e.COVER="cover",e.CUBE="cube"}(Xe||(Xe={})),function(e){e.Classic="classic",e.Modern="modern"}(Ye||(Ye={})),Xe.FLAT,Ye.Classic,function(e){e.STYLE_CIRCLE="circle",e.STYLE_QUAD="quad",e.STYLE_RECTANGLE="rectangle",e.SWIPE_CUBE="cube",e.SWIPE_FLAT="flat",e.SWIPE_COVER="cover",e.CLOSE_BUTTON_LEFT="left",e.CLOSE_BUTTON_RIGHT="right"}(Qe||(Qe={})),function(e){e.direct="direct",e.onboarding="onboarding",e.list="list",e.favorite="favorite"}(Je||(Je={})),function(e){e[e.default=0]="default",e[e.favorite=1]="favorite",e[e.stacked=2]="stacked"}(Ze||(Ze={})),function(e){e[e.default=0]="default",e[e.onboarding=1]="onboarding",e[e.favorite=2]="favorite",e[e.direct=3]="direct"}(Ke||(Ke={})),function(e){e.list="list",e.favorite="favorite"}(et||(et={})),function(e){e.CLICK_ON_STORY="clickOnStoryLink"}(tt||(tt={})),function(e){e.LTR="ltr",e.RTL="rtl"}(rt||(rt={}));class nt{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){try{const t=decodeURIComponent(e.linkTarget);this.emitWidgetLinkEvent(t,e),this.handleClickOnButton({id:this.banner.id,index:this.banner.activeSlideIndex,url:t,elementId:e.elementId,dataForSending:null,label:""})}catch(t){t instanceof URIError?console.error(`[Banners]: the URL <${e.linkTarget}> has an invalid format`):console.error(t)}}emitWidgetLinkEvent(e,t){}async handleClickOnButton(e){const t={src:He.BANNERS,data:e};this.storyManager.emit("clickOnButton",t)}}class it{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){try{await this.emitClickOnButtonEvent({id:0,index:0,url:"",elementId:"",dataForSending:null,label:""}),this.bannerPlace.stop(),await this.storyManager.storyReader.showStory(e.storyId),this.storyManager.storyReader.once("closeStoryReader",(()=>{this.bannerPlace.play()}))}catch(e){console.error(e)}}async emitClickOnButtonEvent(e){const t={src:He.BANNERS,data:e};this.storyManager.emit("clickOnButton",t)}}let at;const st=e=>{!function(e){at=document.createElement("textarea"),at.value=e,document.body.appendChild(at)}(e),function(){let e,t;/ipad|iphone/i.test(navigator.userAgent)?(e=document.createRange(),at&&e.selectNodeContents(at),t=window.getSelection(),t&&(t.removeAllRanges(),t.addRange(e)),at&&at.setSelectionRange(0,999999)):null==at||at.select()}(),document.execCommand("copy"),at&&document.body.removeChild(at)};let ot;ot=function(){};class lt{constructor(e){Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:e})}manageTimer(e,t){if(!this.bannerPlace.slider)return;const r=this.bannerPlace.slider.autoplay;switch(e){case"start":this.startTimer(r,t);break;case"pause":r.pause();break;case"stop":case"before_start":r.stop()}}startTimer(e,t){e.isPaused()?e.resume():(e.setDelay(t),e.start())}}class ct{constructor(e,t,r,n){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"sessionNarrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new Re}),Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new Re})}updateCardServerDataLocally(e){this.banner.context.updateNarrativeSavedData(e)}updateTimeline(e,t,r,n,i,a){[...arguments].join(", "),this.banner.id,i?this.banner.showLoaderScreen():this.banner.activeSlide.inited&&this.banner.hideLoaderScreen(),a?this.banner.showErrorScreen():this.banner.hideErrorScreen(),new lt(this.bannerPlace).manageTimer(t,n)}clearNarrativeSessionDataCache(){this.sessionNarrativeDataCache.clear()}disableVerticalSwipeGesture(){}enableVerticalSwipeGesture(){}disableHorizontalSwipeGesture(){this.bannerPlace.slider.disableHorizontalSwipeGesture()}enableHorizontalSwipeGesture(){this.bannerPlace.slider.enableHorizontalSwipeGesture()}async getCardLocalData(){const e=this.narrativeDataCache.get(`banner_${this.banner.id}_data_${this.storyManager.rootStore.sessionStore.userId}`);return e?JSON.parse(e):{}}setCardLocalData(e,t){const r=JSON.stringify(e);this.narrativeDataCache.set(`banner_${this.banner.id}_data_${this.storyManager.rootStore.sessionStore.userId}`,r),this.banner.context.updateNarrativeSavedData(r),t&&this.banner.updateUserData(r).catch(console.error)}getCardServerData(e){var t;return null!==(t=this.banner.context.widgetsData._narrative_saved_data)&&void 0!==t?t:null}getSlideDuration(e,t){var r,n;return null!==(n=null===(r=this.banner.context.widgetsData._narrative_slides_duration)||void 0===r?void 0:r[t])&&void 0!==n?n:null}pauseUI(){this.banner.pause()}resumeUI(){this.banner.resume()}showCardTextInput(e,t){}setCardSessionValue(e,t){this.sessionNarrativeDataCache.set(e,t)}getCardSessionValue(e){return this.sessionNarrativeDataCache.get(e)}getWidgetsSharedData(e,t){const r=this.banner.context.widgetsData;switch(t){case"rangeSlider":return r._narrative_range_slider_data;case"poll":return r._narrative_poll_data;case"vote":return r._narrative_vote_data}return null}async sendApiRequest(e,t,r,n,i,a){var s,o,l;try{const a=await this.storyManager.httpClient.request({url:e,method:t,params:null!=r?r:{},headers:null!=n?n:{},data:null!=i?i:{}});return{status:a.status,headers:a.headers,data:a.data}}catch(e){if(e instanceof Error&&"IasNetworkError"===e.name)return{status:null!==(s=e.networkStatus)&&void 0!==s?s:400,headers:null===(o=e.response)||void 0===o?void 0:o.headers,data:null===(l=e.response)||void 0===l?void 0:l.data}}}share(e,t){}shareSlideScreenshot(e,t,r){}showLayer(e){this.banner.showLayerByIndex(e)}showCardSlide(e){this.bannerPlace.slider.slideTo(e)}cardShowNext(){this.bannerPlace.slider.toNextSlide()}showNextSlide(){this.bannerPlace.slider.toNextSlide()}sendStatisticEvent(e,t,r,n){this.bannerStatisticService.sendWidgetEvent(this.banner.id,{iterationId:this.banner.iterationId,type:e,slideIndex:this.banner.activeSlideIndex,slideTotal:this.banner.slides.length,durationMs:this.banner.durationMs,widgetPayload:t})}async resetCard(e){this.updateCardServerDataLocally({}),this.setCardLocalData({},!0),this.showCardSlide(0),this.showLayer(0)}getCardFonts(){var e,t;return null!==(t=null===(e=this.storyManager.rootStore.sessionStore.session)||void 0===e?void 0:e.fontsResources)&&void 0!==t?t:[]}showToast(e){this.banner.showToast({content:e})}closeCard(e){}openStory(e,t){new it(this.storyManager,this.bannerPlace,this.banner).handle({storyId:e,slideIndex:t})}openGame(e){new De(this.storyManager,this.bannerPlace,this.banner).handle({gameInstanceId:e})}writeToClipboard(e){st(e.textValue)}openUrl(e){"swipeUpItems"!==e.type&&new nt(this.storyManager,this.banner).handle({elementId:e.elementId,linkTarget:e.link.target})}}var dt;!function(e){e.Top="top",e.Bottom="bottom"}(dt||(dt={}));const ht=dt.Bottom;class ut{constructor(e){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timeoutId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:3e3}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"position",{enumerable:!0,configurable:!0,writable:!0,value:ht}),Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"toastContainer",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.initializeOptions(e),this.mountPoint=e.mountPoint}show(e){return this.content=e,this.destroy(),this.createAndShowToast(),!0}hide(){return!!this.toastContainer&&(clearTimeout(this.timeoutId),this.toastContainer.className+=" toast_fadeout",this.addAnimationEndListeners(this.toastContainer,(()=>{var e,t;null===(t=null===(e=this.toastContainer)||void 0===e?void 0:e.parentNode)||void 0===t||t.removeChild(this.toastContainer),this.toastContainer=null})),!0)}destroy(){var e;this.toastContainer&&(clearTimeout(this.timeoutId),null===(e=this.toastContainer.parentNode)||void 0===e||e.removeChild(this.toastContainer),this.toastContainer=null)}initializeOptions(e){if(e.duration&&(this.duration="string"==typeof e.duration?parseFloat(e.duration):e.duration),e.position){const t=e.position.toLowerCase();this.position="top"===t||"bottom"===t?t:ht}}createAndShowToast(){const e=this.createToastContainer(),t=this.createToastElement(),r=this.createToastTextElement();t.appendChild(r),e.appendChild(t),this.mountPoint.appendChild(e),this.timeoutId=window.setTimeout((()=>this.hide()),this.duration),this.toastContainer=e}createToastContainer(){const e=document.createElement("div");return e.id="toast_container",e.className="toast_fadein",e.style.zIndex="1130",e}createToastElement(){const e=document.createElement("div");return e.id="toast",e}createToastTextElement(){const e=document.createElement("span");return e.innerHTML=this.content,e}addAnimationEndListeners(e,t){["animationend","webkitAnimationEnd","msAnimationEnd","oAnimationEnd"].forEach((r=>{e.addEventListener(r,t,{once:!0})}))}}const pt=(e=>{var t={};return d.d(t,e),t})({SlideApi:()=>o.SlideApi}),bt=(new Error("timeout while waiting for mutex to become available"),new Error("mutex already locked"),new Error("request for lock canceled"));class ft{constructor(e,t=bt){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise(((r,n)=>{const i={resolve:r,reject:n,weight:e,priority:t},a=mt(this._queue,(e=>t<=e.priority));-1===a&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)}))}runExclusive(e){return function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))}(this,arguments,void 0,(function*(e,t=1,r=0){const[n,i]=yield this.acquire(t,r);try{return yield e(n)}finally{i()}}))}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise((r=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),function(e,t){const r=mt(e,(e=>t.priority<=e.priority));e.splice(r+1,0,t)}(this._weightedWaiters[e-1],{resolve:r,priority:t})}))}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach((e=>e.reject(this._cancelError))),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(0===this._queue.length)for(let e=this._value;e>0;e--){const t=this._weightedWaiters[e-1];t&&(t.forEach((e=>e.resolve())),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let t=this._value;t>0;t--){const r=this._weightedWaiters[t-1];if(!r)continue;const n=r.findIndex((t=>t.priority<=e));(-1===n?r:r.splice(0,n)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(0===this._queue.length||this._queue[0].priority<t)&&e<=this._value}}function mt(e,t){for(let r=e.length-1;r>=0;r--)if(t(e[r]))return r;return-1}class vt{constructor(e){this._semaphore=new ft(1,e)}acquire(){return function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))}(this,arguments,void 0,(function*(e=0){const[,t]=yield this._semaphore.acquire(1,e);return t}))}runExclusive(e,t=0){return this._semaphore.runExclusive((()=>e()),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class gt{constructor(e,t,r){Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerSlide",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"mutex",{enumerable:!0,configurable:!0,writable:!0,value:new vt}),Object.defineProperty(this,"_inited",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get html(){return this.bannerSlide.html}get state(){return this.slideApi.state}get inited(){return this._inited}async init(){const e=await this.mutex.acquire();if(this._inited)return;let t=this.banner.needShowLoaderScreen,r=Date.now();const n=setTimeout((()=>{this.banner.showLoaderScreen(),t=!0,r=Date.now()}),500);try{this.banner.id,await this.slideApi.showSlide(this.html),this._inited=!0}catch(e){throw this.handleSlideError(e),e}finally{clearTimeout(n),await this.cleanupLoaderIfNeeded(Date.now()-r,t),e()}}async start(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideStart({muted:!0})}catch(e){this.handleSlideError(e)}finally{e()}}async restart(){const e=await this.mutex.acquire();try{this.banner.hideErrorScreen(),this.banner.showLoaderScreen(),await this.slideApi.slideRestart({muted:!0})}catch(e){this.handleSlideError(e)}finally{this.banner.hideLoaderScreen(),e()}}async resume(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideAppResume()}catch(e){this.handleSlideError(e)}finally{e()}}async pause(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideAppPause()}catch(e){this.handleSlideError(e)}finally{e()}}async pauseByUser(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideUserPause()}catch(e){this.handleSlideError(e)}finally{e()}}async resumeByUser(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideUserResume()}catch(e){this.handleSlideError(e)}finally{e()}}async stop(e){const t=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideStop(e)}catch(e){this.handleSlideError(e)}finally{t()}}refreshSizes(){this.slideApi.refreshSizes()}onClick({event:e,currentTarget:t}){if(e.target)try{e.preventDefault(),e.stopPropagation();const r=this.getNavigationDirection(e,t);this.slideApi.slideClickHandler(e.target,r>0?"forward":"backward")}catch(e){console.error(e)}}async destroy(){await this.stop({prepareForRestart:2})}showLayerByIndex(e){this.slideApi.showLayer(e)}handleSlideError(e){console.error(e),this.banner.showErrorScreen()}getNavigationDirection(e,t){const r=this.getClickPosition(e,t),n="ltr"===this.slideApi.layoutDirection?1:-1;return r>=.3?n:-n}getClickPosition(e,t){const r=t.getBoundingClientRect(),n=r.width;if(n<=0)return 0;let i;if(e instanceof MouseEvent)i=e.pageX-r.left;else{if(!(e.touches&&e.touches.length>0))return 0;i=e.touches[0].pageX-r.left}return Math.max(0,Math.min(1,i/n))}delay(e){return new Promise((t=>setTimeout(t,e)))}async cleanupLoaderIfNeeded(e,t){t&&await this.delay(Math.max(500-e,0)),this.banner.hideLoaderScreen()}}class yt{get html(){return""}get state(){return 0}async init(){}async start(){}async restart(){}async resume(){}async pause(){}async resumeByUser(){}async pauseByUser(){}async stop(e){}onClick({event:e,currentTarget:t}){}async destroy(){}showLayerByIndex(e){}refreshSizes(){}}var wt=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},_t=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},St=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Pt=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Et=(()=>{var e,t,r,n,i,a;let s,o,l,c,d,h,u,p,b,f,m,v,g=[],y=[],w=[],_=[],S=[],P=[],x=[],T=[],O=[],j=[],I=[];return e=class{get _$root(){return St(this,t,"f")}set _$root(e){Pt(this,t,e,"f")}get _needShowErrorScreen(){return St(this,r,"f")}set _needShowErrorScreen(e){Pt(this,r,e,"f")}get _needShowLoaderScreen(){return St(this,n,"f")}set _needShowLoaderScreen(e){Pt(this,n,e,"f")}get _width(){return St(this,i,"f")}set _width(e){Pt(this,i,e,"f")}get _slides(){return St(this,a,"f")}set _slides(e){Pt(this,a,e,"f")}constructor(e,s,o,l,c){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(wt(this,g),e)}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:c}),t.set(this,wt(this,y,null)),r.set(this,(wt(this,w),wt(this,_,!1))),n.set(this,(wt(this,S),wt(this,P,!1))),i.set(this,(wt(this,x),wt(this,T,0))),a.set(this,(wt(this,O),wt(this,j,[]))),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:(wt(this,I),null)}),Object.defineProperty(this,"slideApiImpl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"locked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"toast",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_iterationId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_startTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_initPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_initPromiseResolver",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"attachRoot",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{this._$root||(this._$root=e,this.slideApi=this.createSlideApi(e),this._slides=[new gt(this,this.banner.slides[0],this.slideApi)],await this.init())}}),Object.defineProperty(this,"handleVisibilityChange",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.locked||("hidden"===document.visibilityState&&this.pause(),"visible"===document.visibilityState&&this.resume())}}),this.slideApiImpl=new ct(this.storyManager,this.bannerPlace,this,this.bannerStatisticService),this._initPromise=new Promise((e=>{this._initPromiseResolver=e}))}get id(){return this.banner.id}get context(){return this.banner.context}get appearance(){return this.banner.appearance}get contentRatio(){return this.banner.appearance.contentRatio}get name(){return this.banner.name}get dir(){return this.storyManager.config.dir}get slides(){return this._slides}get activeSlideIndex(){return 0}get width(){return this._width}get activeSlide(){var e;return null!==(e=this._slides[this.activeSlideIndex])&&void 0!==e?e:new yt}get needShowErrorScreen(){return this._needShowErrorScreen}get needShowLoaderScreen(){return this._needShowLoaderScreen}get canBeShown(){return Boolean(this._$root)}get iterationId(){return this._iterationId}get durationMs(){return Date.now()-this._startTime}async init(){this.showLoaderScreen(),await this.activeSlide.init(),this._initPromiseResolver()}async start(){if(!this._$root)throw new Error(`[IAS]: Slide API mount point not found for banner with ID ${this.id}`);document.addEventListener("visibilitychange",this.handleVisibilityChange),await this.activeSlide.start(),this._startTime=Date.now(),this.markAsOpened()}refreshSizes(){this.activeSlide.refreshSizes()}async restart(){await this.activeSlide.restart()}async resume(){await this.activeSlide.resume()}async pause(){await this.activeSlide.pause()}async resumeByUser(){await this.activeSlide.resumeByUser()}async pauseByUser(){await this.activeSlide.pauseByUser()}async stop(){var e;this.slideApiImpl.clearNarrativeSessionDataCache(),document.removeEventListener("visibilitychange",this.handleVisibilityChange),null===(e=this.toast)||void 0===e||e.destroy(),await this.activeSlide.stop({prepareForRestart:1})}async destroy(){var e,t;document.removeEventListener("visibilitychange",this.handleVisibilityChange);const r=this.activeSlide;this._slides=[],this._$root=null,await r.destroy(),null===(e=this.slideApi)||void 0===e||e.destroy(),null===(t=this.toast)||void 0===t||t.destroy()}showLayerByIndex(e){this.activeSlide.showLayerByIndex(e)}showToast(e){if(!this._$root)return;const t=this._$root;this.toast=new ut(Object.assign({mountPoint:t},e)),this.toast.show(e.content)}detachRoot(){var e;this._$root=null,null===(e=this.slideApi)||void 0===e||e.destroy()}showErrorScreen(){this._needShowErrorScreen=!0}showLoaderScreen(){this._needShowLoaderScreen=!0}hideLoaderScreen(){this._needShowLoaderScreen=!1}hideErrorScreen(){this._needShowErrorScreen=!1}markAsOpened(){this._iterationId=(0,H.v4)(),this.banner.markAsOpened(),this.markWasShown()}waitInit(){return this._initPromise}async markWasShown(){!this.banner.wasShown&&this._iterationId&&(this.banner.markWasShown(),this.bannerStatisticService.sendViewEvent(this.id,{iterationId:this._iterationId,slideIndex:this.activeSlideIndex,slideTotal:this.banner.slides.length}))}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}createSlideApi(e){return new pt.SlideApi(this.slideApiImpl,{root:e,slideRatio:this.banner.appearance.contentRatio,isFullscreen:!1,nonce:E(),viewport:window,userResizeHandler:e=>{this._width=e.viewportWidth},VODPlayer:this.storyManager.globalProperties.$videoOnDemand,overlappingActionBarHeight:0})}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,a=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;s=[L.observable],o=[L.observable],l=[L.observable],c=[L.observable],d=[L.observable],h=[L.computed],u=[L.computed],p=[L.computed],b=[L.action],f=[L.action],m=[L.action],v=[L.action],_t(e,null,s,{kind:"accessor",name:"_$root",static:!1,private:!1,access:{has:e=>"_$root"in e,get:e=>e._$root,set:(e,t)=>{e._$root=t}},metadata:t},y,w),_t(e,null,o,{kind:"accessor",name:"_needShowErrorScreen",static:!1,private:!1,access:{has:e=>"_needShowErrorScreen"in e,get:e=>e._needShowErrorScreen,set:(e,t)=>{e._needShowErrorScreen=t}},metadata:t},_,S),_t(e,null,l,{kind:"accessor",name:"_needShowLoaderScreen",static:!1,private:!1,access:{has:e=>"_needShowLoaderScreen"in e,get:e=>e._needShowLoaderScreen,set:(e,t)=>{e._needShowLoaderScreen=t}},metadata:t},P,x),_t(e,null,c,{kind:"accessor",name:"_width",static:!1,private:!1,access:{has:e=>"_width"in e,get:e=>e._width,set:(e,t)=>{e._width=t}},metadata:t},T,O),_t(e,null,d,{kind:"accessor",name:"_slides",static:!1,private:!1,access:{has:e=>"_slides"in e,get:e=>e._slides,set:(e,t)=>{e._slides=t}},metadata:t},j,I),_t(e,null,h,{kind:"getter",name:"activeSlide",static:!1,private:!1,access:{has:e=>"activeSlide"in e,get:e=>e.activeSlide},metadata:t},null,g),_t(e,null,u,{kind:"getter",name:"needShowLoaderScreen",static:!1,private:!1,access:{has:e=>"needShowLoaderScreen"in e,get:e=>e.needShowLoaderScreen},metadata:t},null,g),_t(e,null,p,{kind:"getter",name:"canBeShown",static:!1,private:!1,access:{has:e=>"canBeShown"in e,get:e=>e.canBeShown},metadata:t},null,g),_t(e,null,b,{kind:"method",name:"showErrorScreen",static:!1,private:!1,access:{has:e=>"showErrorScreen"in e,get:e=>e.showErrorScreen},metadata:t},null,g),_t(e,null,f,{kind:"method",name:"showLoaderScreen",static:!1,private:!1,access:{has:e=>"showLoaderScreen"in e,get:e=>e.showLoaderScreen},metadata:t},null,g),_t(e,null,m,{kind:"method",name:"hideLoaderScreen",static:!1,private:!1,access:{has:e=>"hideLoaderScreen"in e,get:e=>e.hideLoaderScreen},metadata:t},null,g),_t(e,null,v,{kind:"method",name:"hideErrorScreen",static:!1,private:!1,access:{has:e=>"hideErrorScreen"in e,get:e=>e.hideErrorScreen},metadata:t},null,g),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class xt{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e,t){return new Et(this.storyManager,e,t,this.bannerStatisticService,this.bannerStore)}}function Tt(e,t){let r=null;return async function(...t){return r||(r=(async()=>{try{return await e.apply(this,t)}catch(e){throw e}finally{r=null}})(),r)}}class Ot extends Error{constructor(e){super(`[IAS]: Banner with ID ${e} not found`),this.name="IasBannerNotFoundError"}}class jt extends Error{constructor(e){super(`[IAS]: Banner slot with ID ${e} not found`),this.name="IasBannerPlaceNotFoundError"}}var It=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},Lt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0};let Ct=(()=>{var e;let t,r,n,i,a=[];return e=class{constructor(e){Object.defineProperty(this,"httpClient",{enumerable:!0,configurable:!0,writable:!0,value:(It(this,a),e)})}async fetchBannerPlaceById(e){const t=await this.httpClient.get(`banner/place/${e.placeId}`,{expand:"banners.slides",tags:e.tags.join(",")});if(t.data)return t.data;throw new jt(e.placeId)}async fetchBannerById(e){const t=await this.httpClient.get(`banner/${e}`,{expand:"slides"});if(t.data)return t.data;throw new Ot(e)}async fetchContextWithStyles({needFetchStyles:e}){return(await this.httpClient.get("banner/context",{fields:"widgetsData"+(e?",style":"")})).data}async updateUserData(e,t){try{await this.httpClient.request({url:`banner/${e}/data`,method:"put",data:{data:t}})}catch(e){console.error(e)}}},(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Tt],r=[Tt],n=[Tt],i=[Tt],Lt(e,null,t,{kind:"method",name:"fetchBannerPlaceById",static:!1,private:!1,access:{has:e=>"fetchBannerPlaceById"in e,get:e=>e.fetchBannerPlaceById},metadata:s},null,a),Lt(e,null,r,{kind:"method",name:"fetchBannerById",static:!1,private:!1,access:{has:e=>"fetchBannerById"in e,get:e=>e.fetchBannerById},metadata:s},null,a),Lt(e,null,n,{kind:"method",name:"fetchContextWithStyles",static:!1,private:!1,access:{has:e=>"fetchContextWithStyles"in e,get:e=>e.fetchContextWithStyles},metadata:s},null,a),Lt(e,null,i,{kind:"method",name:"updateUserData",static:!1,private:!1,access:{has:e=>"updateUserData"in e,get:e=>e.updateUserData},metadata:s},null,a),s&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})})(),e})();class kt{constructor(e,t){Object.defineProperty(this,"httpClient",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t})}async sendShowBannerEvent(e){throw new Error("Method not implemented.")}async sendClickOnBannerEvent(e){throw new Error("Method not implemented.")}async sendBannerCTREvent(e){throw new Error("Method not implemented.")}async sendViewEvent(e,t){await this.sendStatisticsEvent(e,t)}async sendWidgetEvent(e,t){await this.sendStatisticsEvent(e,t)}async sendStatisticsEvent(e,t){try{if(this.storyManager.isStatisticsDisabled)return void console.log("[BANNER STATISTICS]",Object.assign({bannerId:e,type:t.type},t.toQueryParams()));await this.httpClient.post(`/banner/${e}/event/${t.type}`,{},t.toQueryParams())}catch(e){console.error(e)}}}var At;!function(e){e[e.Base=0]="Base",e[e.Dynamic=1]="Dynamic",e[e.Game=2]="Game",e[e.Story=3]="Story",e[e.IAM=4]="IAM"}(At||(At={}));var Bt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0};(()=>{var e;let t,r,n=[];e=class{async fetchBannerPlaceById(e){return{id:"default",appearance:{single_banner_aspect_ratio:2,banners_gap:16,corner_radius:16,loop:!0,autoplay:!0,autoplay_delay:1e3,animation_speed:300},banners:[]}}async fetchContext(){return{style:"",widgetsData:{}}}updateUserData(e,t){throw new Error("Method not implemented.")}fetchBannerById(e){throw new Error("Method not implemented.")}constructor(){!function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e)}(this,n)}},(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Tt],r=[Tt],Bt(e,null,t,{kind:"method",name:"fetchBannerPlaceById",static:!1,private:!1,access:{has:e=>"fetchBannerPlaceById"in e,get:e=>e.fetchBannerPlaceById},metadata:i},null,n),Bt(e,null,r,{kind:"method",name:"fetchContext",static:!1,private:!1,access:{has:e=>"fetchContext"in e,get:e=>e.fetchContext},metadata:i},null,n),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})()})();class Mt{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:t})}createBannerPlace(e,t){var r;const n=new kt(this.storyManager.httpClient,this.storyManager),i=new Me(n),a=new xt(this.storyManager,this.bannerStore,i);return new ne(null!==(r=null==t?void 0:t.toString())&&void 0!==r?r:"default",e,i,this.bannerStore,a)}createBannerPreviewPlace(e,t){const r=new kt(this.storyManager.httpClient,this.storyManager),n=new Me(r),i=new xt(this.storyManager,this.bannerStore,n);return new Be(t.toString(),e,this.bannerStore,i)}}class Rt{static toDomain(e,t){return new k({id:e.id,name:e.name,slides:e.slides.map((e=>new D({html:e.html,duration:e.duration}))),displayFrom:e.display_from,displayTo:e.display_to,appearance:new A(e.appearance),context:new B(e.id,t),frequencyLimit:e.frequency_limit})}}class Dt{static toDomain(e,t,r){const n=e.banners.map((e=>Rt.toDomain(e,t)));return new z({id:e.id,banners:n,placeholders:r,style:t.style})}}var Nt=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},zt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},Wt=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Ft=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Vt=(()=>{var e,t,r;let n,i,a,s,o=[],l=[],c=[],d=[],h=[];return e=class{get _bannerPlaces(){return Wt(this,t,"f")}set _bannerPlaces(e){Ft(this,t,e,"f")}get _banners(){return Wt(this,r,"f")}set _banners(e){Ft(this,r,e,"f")}constructor(e,n){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Nt(this,o),e)}),Object.defineProperty(this,"bannerApi",{enumerable:!0,configurable:!0,writable:!0,value:n}),t.set(this,Nt(this,l,L.observable.map())),r.set(this,(Nt(this,c),Nt(this,d,L.observable.map()))),Object.defineProperty(this,"bannerCSS",{enumerable:!0,configurable:!0,writable:!0,value:(Nt(this,h),"")}),(0,L.reaction)((()=>e.rootStore.placeholderStore.placeholders),(e=>{for(const t of this._bannerPlaces.values())t.updatePlaceholders(e)}))}get bannerPlaces(){return Array.from(this._bannerPlaces.values())}async getBannerById(e){if(this._banners.has(e))return this._banners.get(e);await this.storyManager.waitStoryManagerConfig();const t=await this.fetchBannerContext(),r=await this.bannerApi.fetchBannerById(e);return this.addBanner(r,t)}async getBannerPlaceById(e){if(this._bannerPlaces.has(e.placeId))return this._bannerPlaces.get(e.placeId);await this.storyManager.waitStoryManagerConfig();const t=await this.fetchBannerContext(),r=await this.bannerApi.fetchBannerPlaceById({placeId:e.placeId,tags:this.storyManager.config.tags});return this.addBannerPlace(r,t)}clearCache(){this._bannerPlaces=L.observable.map(),this._banners=L.observable.map()}removeBannerPlaceById(e){this._bannerPlaces.delete(e)}async updateBannerUserData(e,t){if(!this.storyManager.isStatisticsDisabled)return this.bannerApi.updateUserData(e,t);console.log("[IAM]: update user data",{bannerId:e,payload:t})}async fetchBannerContext(){await this.storyManager.rootStore.sessionStore.open();const e=await this.bannerApi.fetchContextWithStyles({needFetchStyles:!this.bannerCSS});return this.bannerCSS&&(e.style=this.bannerCSS),e}addBannerPlace(e,t){const r=this.storyManager.rootStore.placeholderStore.placeholders,n=Dt.toDomain(e,t,r);return this._bannerPlaces.set(e.id,n),n}addBanner(e,t){const r=this.storyManager.rootStore.placeholderStore.placeholders,n=Rt.toDomain(e,t);return n.updatePlaceholders(r),this._banners.set(n.id,n),n}},t=new WeakMap,r=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;n=[L.observable],i=[L.observable],a=[L.computed],s=[Tt],zt(e,null,n,{kind:"accessor",name:"_bannerPlaces",static:!1,private:!1,access:{has:e=>"_bannerPlaces"in e,get:e=>e._bannerPlaces,set:(e,t)=>{e._bannerPlaces=t}},metadata:t},l,c),zt(e,null,i,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:t},d,h),zt(e,null,a,{kind:"getter",name:"bannerPlaces",static:!1,private:!1,access:{has:e=>"bannerPlaces"in e,get:e=>e.bannerPlaces},metadata:t},null,o),zt(e,null,s,{kind:"method",name:"getBannerPlaceById",static:!1,private:!1,access:{has:e=>"getBannerPlaceById"in e,get:e=>e.getBannerPlaceById},metadata:t},null,o),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Ut{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=new Ct(e.httpClient);this.bannerStore=new Vt(this.storyManager,t)}}class qt extends Error{constructor(){super("[IAS]: you must create an instance of BannersProvider"),this.name="IasBannersProviderReferenceError"}}class $t extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}class Gt extends Oe{render(){this.root.render((0,l.jsx)(Ee,{bannerPlace:this.bannerPlace}))}}class Ht{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlaces",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"bannerPlaceViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reloadAllBanners",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.rootStore.bannerStore.clearCache(),this.bannerPlaces.forEach((e=>{e.reload().catch(console.error)}))}}),this.rootStore=new Ut(e),this.bannerPlaceViewModelFactory=new Mt(e,this.rootStore.bannerStore),this.storyManager.rootStore.storyManagerConfigStore.waitStoryManagerConfig().then((()=>{this.storyManager.config.on("requestSDKReload",this.reloadAllBanners)}))}addBannerPlace(e){this.bannerPlaces.push(e)}removeBannerPlace(e){const t=this.bannerPlaces.indexOf(e);-1!==t&&this.bannerPlaces.splice(t,1)}clear(){for(const e of this.bannerPlaces)e.destroy();this.bannerPlaces=[]}createBannerPlace(e){return this.bannerPlaceViewModelFactory.createBannerPlace(this,e)}createBannerPreviewPlace(e){return this.bannerPlaceViewModelFactory.createBannerPreviewPlace(this,e)}static create(e){return Ht.instance||(Ht.instance=new Ht(e)),Ht.instance}mountBannerPlace(e,t){const r=document.querySelector(e);if(!r)throw new $t(e);const n=this.createBannerPlace(null==t?void 0:t.placeId),i=new Oe(r,n,t);return i.render(),i}mountBannerPreviewPlace(e,t){const r=document.querySelector(e);if(!r)throw new $t(e);const n=this.createBannerPreviewPlace(t.bannerId),i=new Gt(r,n);return i.render(),i}}const Xt=()=>{if(!Ht.instance)throw new qt;return Ht.instance},Yt=Ht;class Qt{constructor(){Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ias-banners"})}install(e){const t=Yt.create(e.INTERNAL_API);e.HOST.prototype.banners=t}uninstall(){}}const Jt=new Qt})();var u=h.RE,p=h.Sr,b=h.YL,f=h.Ay;export{u as IasBannerPlace,p as IasBannerPreview,b as IasBannersPlugin,f as default};
1
+ import*as e from"react/jsx-runtime";import*as t from"react";import*as r from"mobx-react-lite";import*as n from"classnames";import*as i from"mobx";import*as a from"uuid";import*as s from"react-dom/client";import*as o from"@inappstory/slide-api";var l={371:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".banner--EtvvP{width:100%;height:100%;position:relative;border-radius:var(--banner-border-radius, 0px);overflow:hidden}.banner-slides--3xhGF{position:relative;width:100%;height:100%;display:block}",""]),i.locals={banner:"banner--EtvvP","banner-slides":"banner-slides--3xhGF"};const a=i},369:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".banner-place--6ZUZe{width:100%;height:100%;position:relative}.banner-slider__slider_visible--1nA2b{border:solid 1px green}",""]),i.locals={"banner-place":"banner-place--6ZUZe","banner-slider__slider_visible":"banner-slider__slider_visible--1nA2b"};const a=i},41:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider--ggy2P{width:100%;height:100%;overflow:hidden;position:relative;justify-content:center}.slider__track--JSOcI{display:flex;transition:transform .3s ease;width:100%;height:100%;will-change:transform}.slider__slide--oGmUT{width:100%;height:100%;flex-shrink:0;position:relative;display:flex;align-items:center;justify-content:center;transform:translateZ(0)}",""]),i.locals={slider:"slider--ggy2P",slider__track:"slider__track--JSOcI",slider__slide:"slider__slide--oGmUT"};const a=i},379:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider__controls-btn--HubN5{position:absolute;top:50%;z-index:1;width:24px;height:24px;margin-top:-9px;transition:all .2s ease-in-out;cursor:pointer;padding:0;background-color:rgba(0,0,0,0);color:#0c62f3;border:0;outline:0}.slider__controls-btn--prev--kfXCq{left:1.5rem}.slider__controls-btn--next--Jzq3Q{right:1.5rem}.slider__controls-btn--HubN5{transition:opacity .3s ease-in-out}.slider__controls-btn--disabled--m1P4q{opacity:0;pointer-events:none}",""]),i.locals={"slider__controls-btn":"slider__controls-btn--HubN5","slider__controls-btn--prev":"slider__controls-btn--prev--kfXCq","slider__controls-btn--next":"slider__controls-btn--next--Jzq3Q","slider__controls-btn--disabled":"slider__controls-btn--disabled--m1P4q"};const a=i},55:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".slider-bullets--XDc5n{position:absolute;z-index:2;bottom:1.5rem;left:50%;display:inline-flex;list-style:none;transform:translate3d(-50%, 0, 0)}.slider-bullets__bullet--83aBh{background-color:rgba(255,255,255,.5);width:9px;height:9px;padding:0;border-radius:50%;border:2px solid rgba(0,0,0,0);cursor:pointer;line-height:0;box-shadow:0 .25em .5em 0 rgba(0,0,0,.1);margin:0 .25em;transition:transform 100ms ease-in;transform:scale(0.8)}.slider-bullets__bullet--active--RDBez{background-color:#0c62f3;transform:scale(1)}",""]),i.locals={"slider-bullets":"slider-bullets--XDc5n","slider-bullets__bullet":"slider-bullets__bullet--83aBh","slider-bullets__bullet--active":"slider-bullets__bullet--active--RDBez"};const a=i},126:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".loader--4uMcs{position:absolute;z-index:10001;top:0;bottom:0;left:0;right:0;display:flex;justify-content:center;align-items:center;background:var(--loader-background, black)}.loader--4uMcs .loader__refresh-btn--5nwxY{color:#fff;cursor:pointer;position:absolute;left:50%;top:50%;transform:translate3d(-50%, -50%, 0);pointer-events:auto;padding:20px;width:32px;height:32px;box-sizing:content-box}.loader--4uMcs .loader__spinner--NRm8E{-ms-flex-negative:0;flex-shrink:0;display:inline-block;width:32px;height:32px;border-radius:50%;border:solid 2px var(--loaderBackgroundColor, white);border-color:var(--loaderBackgroundAccentColor, transparent) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white) var(--loaderBackgroundColor, white);-webkit-animation:loading-spinner--LnXd0 .6s infinite linear;animation:loading-spinner--LnXd0 .6s infinite linear}@keyframes loading-spinner--LnXd0{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}",""]),i.locals={loader:"loader--4uMcs","loader__refresh-btn":"loader__refresh-btn--5nwxY",loader__spinner:"loader__spinner--NRm8E","loading-spinner":"loading-spinner--LnXd0"};const a=i},81:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(935),i=r.n(n)()((function(e){return e[1]}));i.push([e.id,".icon--5RBkn{width:2rem;height:2rem}",""]),i.locals={icon:"icon--5RBkn"};const a=i},935:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(n)for(var a=0;a<this.length;a++){var s=this[a][0];null!=s&&(i[s]=!0)}for(var o=0;o<e.length;o++){var l=[].concat(e[o]);n&&i[l[0]]||(r&&(l[2]?l[2]="".concat(r," and ").concat(l[2]):l[2]=r),t.push(l))}},t}},46:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}f(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&f(e,"error",t,{once:!0})}(e,i)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var s=10;function o(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var i,a,s,c;if(o(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),s=a[t]),void 0===s)s=a[t]=r,++e._eventsCount;else if("function"==typeof s?s=a[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=l(e))>0&&s.length>i&&!s.warned){s.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=s.length,c=d,console&&console.warn&&console.warn(c)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function u(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):b(i,i.length)}function p(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function f(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(a){n.once&&e.removeEventListener(t,i),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,a=this._events;if(void 0!==a)i=i&&void 0===a.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var l=a[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var c=l.length,d=b(l,c);for(r=0;r<c;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return c(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return c(this,e,t,!0)},a.prototype.once=function(e,t){return o(t),this.on(e,h(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return o(t),this.prependListener(e,h(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,i,a,s;if(o(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){s=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return u(this,e,!0)},a.prototype.rawListeners=function(e){return u(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},591:(e,t,r)=>{var n,i=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),a=[];function s(e){for(var t=-1,r=0;r<a.length;r++)if(a[r].identifier===e){t=r;break}return t}function o(e,t){for(var r={},n=[],i=0;i<e.length;i++){var o=e[i],l=t.base?o[0]+t.base:o[0],c=r[l]||0,d="".concat(l," ").concat(c);r[l]=c+1;var h=s(d),u={css:o[1],media:o[2],sourceMap:o[3]};-1!==h?(a[h].references++,a[h].updater(u)):a.push({identifier:d,updater:f(u,t),references:1}),n.push(d)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var a=r.nc;a&&(n.nonce=a)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var s=i(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var c,d=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function h(e,t,r,n){var i=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=d(t,i);else{var a=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}function u(e,t,r){var n=r.css,i=r.media,a=r.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var p=null,b=0;function f(e,t){var r,n,i;if(t.singleton){var a=b++;r=p||(p=l(t)),n=h.bind(null,r,a,!1),i=h.bind(null,r,a,!0)}else r=l(t),n=u.bind(null,r,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n));var r=o(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var i=s(r[n]);a[i].references--}for(var l=o(e,t),c=0;c<r.length;c++){var d=s(r[c]);0===a[d].references&&(a[d].updater(),a.splice(d,1))}r=l}}}},968:(e,t,r)=>{const n=document.querySelector("[nonce]");n&&(r.nc=n.nonce||n.getAttribute("nonce"))}},c={};function d(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={id:e,exports:{}};return l[e](r,r.exports,d),r.exports}d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.nc=void 0;var h={};(()=>{d.d(h,{RE:()=>je,Sr:()=>Ie,YL:()=>Qt,Ay:()=>Jt}),d(968);const l=(e=>{var t={};return d.d(t,e),t})({jsx:()=>e.jsx,jsxs:()=>e.jsxs}),c=(e=>{var t={};return d.d(t,e),t})({useEffect:()=>t.useEffect,useLayoutEffect:()=>t.useLayoutEffect,useRef:()=>t.useRef,useState:()=>t.useState}),u=(e=>{var t={};return d.d(t,e),t})({observer:()=>r.observer});var p=d(591),b=d.n(p),f=d(371);b()(f.A,{insert:"head",singleton:!1});const m=f.A.locals||{};var v=d(126);b()(v.A,{insert:"head",singleton:!1});const y=v.A.locals||{};var g=d(81);b()(g.A,{insert:"head",singleton:!1});const w=g.A.locals||{},_=(e=>{var t={};return d.d(t,e),t})({default:()=>n.default}),S=({onClick:e,className:t})=>(0,l.jsx)("div",{className:(0,_.default)(w.icon,t),onClick:e,children:(0,l.jsx)("svg",{viewBox:"0 0 24 24",children:(0,l.jsx)("path",{fill:"currentColor",d:"M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z"})})}),P=(0,u.observer)((e=>{const t=e.needShowErrorScreen,r=e.needShowLoaderScreen;return r||t?(0,l.jsx)("div",{className:(0,_.default)(y.loader),style:{"--loader-background":e.background,"--loaderBackgroundColor":e.color},onClick:e=>{e.preventDefault()},children:t?(0,l.jsx)(S,{className:y["loader__refresh-btn"],onClick:t=>{t.stopPropagation(),e.onReload()}}):r&&(0,l.jsx)("div",{className:y.loader__spinner})}):null})),E=()=>null!==d.nc&&void 0!==d.nc?d.nc:"";class x extends HTMLElement{constructor(){super(...arguments),Object.defineProperty(this,"styleElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"handleClick",{enumerable:!0,configurable:!0,writable:!0,value:e=>{var t;this.shadowRoot&&"true"===this.shadowRoot.host.getAttribute("allow-click")&&(null===(t=this.banner)||void 0===t||t.activeSlide.onClick({event:e,currentTarget:this.shadowRoot.host}))}})}setBanner(e){this.banner=e}setStyle(e){var t;this.styleElement&&this.styleElement.parentNode&&this.styleElement.parentNode.removeChild(this.styleElement);const r=document.createElement("style");r.textContent=e,r.setAttribute("nonce",E()),this.styleElement=r,null===(t=this.shadowRoot)||void 0===t||t.prepend(r)}async init(){this.mountPoint&&this.banner&&(this.mountPoint.addEventListener("click",this.handleClick),await this.banner.attachRoot(this.mountPoint))}destroy(){var e,t;null===(e=this.banner)||void 0===e||e.detachRoot(),null===(t=this.mountPoint)||void 0===t||t.removeEventListener("click",this.handleClick)}connectedCallback(){if(this.shadowRoot)return;const e=this.attachShadow({mode:"open"});this.mountPoint=document.createElement("div"),this.mountPoint.style.height="100%",this.mountPoint.style.width="100%",e.appendChild(this.mountPoint)}disconnectedCallback(){}}function T(e){const t=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)$/i);if(t){const[e,r,n,i]=t.map(Number);return(299*r+587*n+114*i)/1e3>128}if(e.startsWith("#")){const t=e.slice(1);let r,n,i;if(3===t.length)r=parseInt(t[0]+t[0],16),n=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16);else{if(6!==t.length)return!1;r=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16)}return(299*r+587*n+114*i)/1e3>128}return!0}customElements.get("banner-slides-container")||customElements.define("banner-slides-container",x);const O=(0,u.observer)((e=>{var{banner:t}=e,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["banner"]);const n=(0,c.useRef)(null),i=(0,c.useRef)(null);return(0,c.useLayoutEffect)((()=>{n.current&&n.current.setStyle(t.context.style)}),[t.context.style]),(0,c.useLayoutEffect)((()=>{if(!n.current)return;const e=n.current;return e.setBanner(t),e.init(),()=>{e.destroy()}}),[t]),(0,c.useEffect)((()=>{if(r.isActive&&t.canBeShown)return t.start(),()=>{t.stop()}}),[t,r.isActive,t.canBeShown]),(0,l.jsxs)("div",{className:(0,_.default)(m.banner,"ias-banner",r.className),ref:i,style:{height:t.width/t.contentRatio+"px",opacity:t.canBeShown?1:0,background:t.appearance.background,"--banner-border-radius":`${r.clientAppearance.borderRadius}px`},children:[(0,l.jsx)("banner-slides-container",{class:m["banner-slides"],ref:n,"allow-click":r.allowClick.toString(),dir:t.dir}),(0,l.jsx)(P,{needShowErrorScreen:t.needShowErrorScreen,needShowLoaderScreen:t.needShowLoaderScreen,onReload:async()=>{t.activeSlide.restart()},background:t.appearance.background,color:T(t.appearance.background)?"black":"white"})]})}));var j=d(369);b()(j.A,{insert:"head",singleton:!1});const I=j.A.locals||{},L=(e=>{var t={};return d.d(t,e),t})({action:()=>i.action,computed:()=>i.computed,observable:()=>i.observable,reaction:()=>i.reaction});var C=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let k=(()=>{var e,t;let r,n=[],i=[];return e=class{get _context(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _context(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}constructor(e){t.set(this,C(this,n,void 0)),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:C(this,i)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayFrom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayTo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_wasShown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_frequencyLimit",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_openTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_isOnceOpened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.id=e.id,this.name=e.name,this.displayFrom=e.displayFrom,this.displayTo=e.displayTo,this.slides=e.slides,this._context=e.context,this.appearance=e.appearance}get context(){return this._context}get withinDisplayTimeRange(){return(!this.displayFrom||Date.now()>=this.displayFrom)&&(!this.displayTo||Date.now()<=this.displayTo)}get wasShown(){return this._wasShown}get frequencyLimitTimeExceeded(){return null===this._frequencyLimit?this._isOnceOpened:0!==this._frequencyLimit&&Math.trunc(this.timeSinceLastShow/1e3)<=this._frequencyLimit}get timeSinceLastShow(){return Date.now()-this._openTime}get openTime(){return this._openTime}updatePlaceholders(e){for(const t of this.slides)t.updatePlaceholders(e)}markWasShown(){this._wasShown=!0}markAsOpened(){this._openTime=Date.now(),this._isOnceOpened=!0}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[L.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_context",static:!1,private:!1,access:{has:e=>"_context"in e,get:e=>e._context,set:(e,t)=>{e._context=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class A{constructor(e){var t;Object.defineProperty(this,"contentRatio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.contentRatio=null!==(t=e.content_ratio)&&void 0!==t?t:1,this.background=this.mapBackgroundDtoToModel(e.background)}mapBackgroundDtoToModel(e){if(!e||0===e.alpha)return"transparent";if("solid"in e)return this.applyAlphaToColor(e.solid,e.alpha);if("linear_gradient"in e){const{angle:t,color_step_list:r}=e.linear_gradient;return`linear-gradient(${t}deg, ${r.map((t=>`${this.applyAlphaToColor(t.color,e.alpha)} ${t.position}%`)).join(", ")})`}return"transparent"}applyAlphaToColor(e,t){if(e.startsWith("#")){const r=e.slice(1),n=3===r.length;return`rgba(${parseInt(n?r[0]+r[0]:r.slice(0,2),16)}, ${parseInt(n?r[1]+r[1]:r.slice(2,4),16)}, ${parseInt(n?r[2]+r[2]:r.slice(4,6),16)}, ${t})`}return e}}class B{constructor(e,t){Object.defineProperty(this,"widgetsData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.style=t.style,this.widgetsData=this.mapBannerContextDto(e,t)}mapBannerContextDto(e,t){var r;const n={},i=null!==(r=t.widgetsData)&&void 0!==r?r:{};for(const t in i)Array.isArray(i[t])||(n[t]=i[t][e]);return n}updateNarrativeSavedData(e){this.widgetsData._narrative_saved_data=e}}function M(e,t,r){return String(e).replace(new RegExp(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(t),"g"),(()=>r))}var R=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let D=(()=>{var e,t;let r,n=[],i=[];return e=class{get _html(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _html(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}get html(){return this._html}constructor(e){t.set(this,R(this,n,void 0)),R(this,i),this._html=this.replaceSlideNonce(e.html)}updatePlaceholders(e){let t=this._html;for(const r of e)t=M(t,`%${r.key}%`,r.value);this._html=t}replaceSlideNonce(e){var t;return M(e,"{{nonce}}",null!==(t=E())&&void 0!==t?t:"")}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[L.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_html",static:!1,private:!1,access:{has:e=>"_html"in e,get:e=>e._html,set:(e,t)=>{e._html=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();var N=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0};let z=(()=>{var e,t;let r,n=[],i=[];return e=class{get _banners(){return function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,t,"f")}set _banners(e){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,t,e,"f")}constructor(e){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),t.set(this,N(this,n,[])),N(this,i),this.id=e.id,this._banners=e.banners,this.style=e.style,this.updatePlaceholders(e.placeholders)}get banners(){return this._banners}updatePlaceholders(e){for(const t of this._banners)t.updatePlaceholders(e)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[L.observable],function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0}(e,null,r,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();const W=(e,t)=>{if("number"==typeof e)return e;if("string"==typeof e){const t=parseFloat(e);if(!isNaN(t))return t}return t};var F=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},U=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},V=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},q=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let $=(()=>{var e,t;let r,n=[],i=[];return e=class{get borderRadius(){return V(this,t,"f")}set borderRadius(e){q(this,t,e,"f")}update(e){this.borderRadius=W(null==e?void 0:e.borderRadius,this.borderRadius)}constructor(){t.set(this,U(this,n,12)),U(this,i)}},t=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;r=[L.observable],F(e,null,r,{kind:"accessor",name:"borderRadius",static:!1,private:!1,access:{has:e=>"borderRadius"in e,get:e=>e.borderRadius,set:(e,t)=>{e.borderRadius=t}},metadata:t},n,i),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})(),G=(()=>{var e,t,r,n,i,a,s,o;let l,c,d,h,u,p,b,f=[],m=[],v=[],y=[],g=[],w=[],_=[],S=[],P=[],E=[],x=[],T=[],O=[],j=[];return e=class{get loop(){return V(this,t,"f")}set loop(e){q(this,t,e,"f")}get gap(){return V(this,r,"f")}set gap(e){q(this,r,e,"f")}get autoplay(){return V(this,n,"f")}set autoplay(e){q(this,n,e,"f")}get animationSpeed(){return V(this,i,"f")}set animationSpeed(e){q(this,i,e,"f")}get slidesPerView(){return V(this,a,"f")}set slidesPerView(e){q(this,a,e,"f")}get navigation(){return V(this,s,"f")}set navigation(e){q(this,s,e,"f")}get pagination(){return V(this,o,"f")}set pagination(e){q(this,o,e,"f")}constructor(e){t.set(this,U(this,f,!0)),r.set(this,(U(this,m),U(this,v,16))),n.set(this,(U(this,y),U(this,g,!0))),i.set(this,(U(this,w),U(this,_,300))),a.set(this,(U(this,S),U(this,P,1))),s.set(this,(U(this,E),U(this,x,{enabled:!0}))),o.set(this,(U(this,T),U(this,O,{enabled:!0}))),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:(U(this,j),new $)}),e&&this.update(e)}update(e){var t,r,n,i,a,s;this.loop=null!==(t=null==e?void 0:e.loop)&&void 0!==t?t:this.loop,this.gap=W(null==e?void 0:e.gap,this.gap),this.autoplay=null!==(r=null==e?void 0:e.autoplay)&&void 0!==r?r:this.autoplay,this.animationSpeed=W(null==e?void 0:e.animationSpeed,this.animationSpeed),this.slidesPerView=Math.max(W(null==e?void 0:e.slidesPerView,this.slidesPerView),0),this.navigation={enabled:null!==(i=null===(n=null==e?void 0:e.navigation)||void 0===n?void 0:n.enabled)&&void 0!==i?i:this.navigation.enabled},this.pagination={enabled:null!==(s=null===(a=null==e?void 0:e.pagination)||void 0===a?void 0:a.enabled)&&void 0!==s?s:this.pagination.enabled},this.banner.update(e.banner)}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,a=new WeakMap,s=new WeakMap,o=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;l=[L.observable],c=[L.observable],d=[L.observable],h=[L.observable],u=[L.observable],p=[L.observable],b=[L.observable],F(e,null,l,{kind:"accessor",name:"loop",static:!1,private:!1,access:{has:e=>"loop"in e,get:e=>e.loop,set:(e,t)=>{e.loop=t}},metadata:t},f,m),F(e,null,c,{kind:"accessor",name:"gap",static:!1,private:!1,access:{has:e=>"gap"in e,get:e=>e.gap,set:(e,t)=>{e.gap=t}},metadata:t},v,y),F(e,null,d,{kind:"accessor",name:"autoplay",static:!1,private:!1,access:{has:e=>"autoplay"in e,get:e=>e.autoplay,set:(e,t)=>{e.autoplay=t}},metadata:t},g,w),F(e,null,h,{kind:"accessor",name:"animationSpeed",static:!1,private:!1,access:{has:e=>"animationSpeed"in e,get:e=>e.animationSpeed,set:(e,t)=>{e.animationSpeed=t}},metadata:t},_,S),F(e,null,u,{kind:"accessor",name:"slidesPerView",static:!1,private:!1,access:{has:e=>"slidesPerView"in e,get:e=>e.slidesPerView,set:(e,t)=>{e.slidesPerView=t}},metadata:t},P,E),F(e,null,p,{kind:"accessor",name:"navigation",static:!1,private:!1,access:{has:e=>"navigation"in e,get:e=>e.navigation,set:(e,t)=>{e.navigation=t}},metadata:t},x,T),F(e,null,b,{kind:"accessor",name:"pagination",static:!1,private:!1,access:{has:e=>"pagination"in e,get:e=>e.pagination,set:(e,t)=>{e.pagination=t}},metadata:t},O,j),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();const H=(e=>{var t={};return d.d(t,e),t})({v4:()=>a.v4});class X{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"eventId",{enumerable:!0,configurable:!0,writable:!0,value:(0,H.v4)()})}get type(){return"view"}toQueryParams(){return{ei:this.eventId,ii:this.payload.iterationId,si:this.payload.slideIndex,st:this.payload.slideTotal}}}class Y{constructor(e){Object.defineProperty(this,"payload",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"eventId",{enumerable:!0,configurable:!0,writable:!0,value:(0,H.v4)()})}get type(){return this.payload.type}toQueryParams(){return Object.assign({ei:this.eventId,ii:this.payload.iterationId,si:this.payload.slideIndex,st:this.payload.slideTotal,d:this.payload.durationMs},this.payload.widgetPayload)}}var Q=d(46);class J{constructor(){Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:{isPaused:function(){return!1},resume:function(){},pause:function(){},start:function(){},stop:function(){},setDelay:function(){}}})}updateSize(){}enableHorizontalSwipeGesture(){}disableHorizontalSwipeGesture(){}getTotalPages(){return 1}getActiveIndex(){return 0}toNextSlide(){}toPrevSlide(){}slideTo(e,t){}}var Z,K=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},ee=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},te=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},re=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};!function(e){e.Play="play",e.Stop="stop",e.LoadStart="loadStart",e.LoadEnd="loadEnd",e.LoadError="loadError",e.ActiveIndexChange="activeIndexChange",e.AutoplayTimeLeft="autoplayTimeLeft"}(Z||(Z={}));let ne=(()=>{var e,t,r,n,i;let a,s,o,l,c=Q.EventEmitter,d=[],h=[],u=[],p=[],b=[],f=[],m=[],v=[];return e=class extends c{get _banners(){return te(this,t,"f")}set _banners(e){re(this,t,e,"f")}get _bannerPlace(){return te(this,r,"f")}set _bannerPlace(e){re(this,r,e,"f")}get _isLoading(){return te(this,n,"f")}set _isLoading(e){re(this,n,e,"f")}get _isLoaded(){return te(this,i,"f")}set _isLoaded(e){re(this,i,e,"f")}constructor(e,a,s,o,l){super(),Object.defineProperty(this,"placeId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"bannerViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:l}),t.set(this,ee(this,d,[])),r.set(this,(ee(this,h),ee(this,u,null))),n.set(this,(ee(this,p),ee(this,b,!1))),i.set(this,(ee(this,f),ee(this,m,!1))),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:(ee(this,v),new G)}),Object.defineProperty(this,"sliderController",{enumerable:!0,configurable:!0,writable:!0,value:new J}),this.ctx.addBannerPlace(this)}get id(){return this.placeId}get banners(){return this._banners}get contentRatio(){const e=this._banners.map((e=>e.contentRatio));return this.median(e)}get isLoaded(){return this._isLoaded}get isLoading(){return this._isLoading}get slider(){return this.sliderController}get activeIndex(){return this.sliderController.getActiveIndex()}get activeBanner(){return this._banners[this.activeIndex]}refreshSizes(){this._banners.forEach((e=>e.refreshSizes()))}setSliderController(e){this.sliderController=e}updateAppearance(e){this.appearance.update(e)}play(){for(const e of this._banners)e.resume()}stop(){for(const e of this._banners)e.pause()}resume(){if(this.appearance.autoplay){this.slider.autoplay.resume();for(const e of this._banners)e.resumeByUser()}}pause(){if(this.appearance.autoplay){this.slider.autoplay.pause();for(const e of this._banners)e.pauseByUser()}}async reload(){this.bannerStore.removeBannerPlaceById(this.id),await Promise.all(this._banners.map((e=>e.destroy()))),this._banners=[],await this.fetchBanners()}destroy(){this.sliderController=new J;for(const e of this._banners)e.destroy();this._banners=[],this.ctx.removeBannerPlace(this)}notifyTimerEnd(){var e;null===(e=this.activeBanner)||void 0===e||e.notifyTimerEnd()}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}async fetchBanners(){try{return this._isLoading?[]:(this._isLoading=!0,this._isLoaded=!1,this.emit(Z.LoadStart),this._bannerPlace=await this.bannerStore.getBannerPlaceById({placeId:this.placeId}),this._banners=this.filterBannersByTimeRange(this._bannerPlace.banners).map((e=>this.bannerViewModelFactory.create(this,e))),await Promise.allSettled(this._banners.map((e=>e.waitInit()))),this._isLoaded=!0,this._banners)}catch(e){throw this.emit(Z.LoadError,e),e}finally{this.emit(Z.LoadEnd),this._isLoading=!1}}filterBannersByTimeRange(e){return e.filter((e=>e.withinDisplayTimeRange))}median(e){const t=[...e].sort(((e,t)=>e-t)),r=Math.floor(t.length/2);return t.length%2==0?(t[r-1]+t[r])/2:t[r]}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=c[Symbol.metadata])&&void 0!==t?t:null):void 0;a=[L.observable],s=[L.observable],o=[L.observable],l=[L.observable],K(e,null,a,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:r},d,h),K(e,null,s,{kind:"accessor",name:"_bannerPlace",static:!1,private:!1,access:{has:e=>"_bannerPlace"in e,get:e=>e._bannerPlace,set:(e,t)=>{e._bannerPlace=t}},metadata:r},u,p),K(e,null,o,{kind:"accessor",name:"_isLoading",static:!1,private:!1,access:{has:e=>"_isLoading"in e,get:e=>e._isLoading,set:(e,t)=>{e._isLoading=t}},metadata:r},b,f),K(e,null,l,{kind:"accessor",name:"_isLoaded",static:!1,private:!1,access:{has:e=>"_isLoaded"in e,get:e=>e._isLoaded,set:(e,t)=>{e._isLoaded=t}},metadata:r},m,v),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();const ie=e=>((0,c.useEffect)((()=>(e.onLoadStart&&e.bannerPlace.on(Z.LoadStart,e.onLoadStart),e.onLoadEnd&&e.bannerPlace.on(Z.LoadEnd,e.onLoadEnd),e.onLoadError&&e.bannerPlace.on(Z.LoadError,e.onLoadError),()=>{e.onLoadStart&&e.bannerPlace.off(Z.LoadStart,e.onLoadStart),e.onLoadEnd&&e.bannerPlace.off(Z.LoadEnd,e.onLoadEnd),e.onLoadError&&e.bannerPlace.off(Z.LoadError,e.onLoadError)})),[e.bannerPlace,e.onLoadStart,e.onLoadError,e.onLoadEnd]),(0,c.useEffect)((()=>{(async e=>{try{await e.fetchBanners()}catch(e){console.error(e)}})(e.bannerPlace)}),[e.bannerPlace]),e.bannerPlace.banners);class ae{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e})}isPaused(){return this.slider.autoplay.paused}resume(){this.slider.autoplay.resume()}pause(){this.slider.autoplay.pause()}start(){this.slider.autoplay.start()}setDelay(e){this.slider.autoplay.setDelay(e)}stop(){this.slider.autoplay.stop()}}class se{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:new ae(this.slider)})}getTotalPages(){return this.slider.totalPages}getActiveIndex(){return this.slider.realIndex}toNextSlide(){this.slider.toNextSlide()}toPrevSlide(){this.slider.toPrevSlide()}slideTo(e,t){this.slider.slideToLoop(e,t)}enableHorizontalSwipeGesture(){this.slider.enableHorizontalSwipeGesture()}disableHorizontalSwipeGesture(){this.slider.disableHorizontalSwipeGesture()}updateSize(){this.slider.updateSize()}}var oe=d(55);b()(oe.A,{insert:"head",singleton:!1});const le=oe.A.locals||{},ce=e=>{const[t,r]=(0,c.useState)(-1);return(0,c.useEffect)((()=>{e.activeIndex===t&&r(-1)}),[e.activeIndex,t]),e.totalPages>1&&(0,l.jsx)("div",{className:(0,_.default)(le["slider-bullets"],"ias-slider-bullets"),children:Array.from({length:e.totalPages}).map(((t,n)=>(0,l.jsx)("div",{className:(0,_.default)("ias-slider-bullets__bullet",le["slider-bullets__bullet"],{[le["slider-bullets__bullet--active"]]:n===e.activeIndex,"ias-slider-bullets__bullet--active":n===e.activeIndex}),onClick:()=>(t=>{r(t),e.onClick(t)})(n)},n)))})};var de=d(41);b()(de.A,{insert:"head",singleton:!1});const he=de.A.locals||{};var ue=d(379);b()(ue.A,{insert:"head",singleton:!1});const pe=ue.A.locals||{},be=e=>(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{onClick:e.onPrevClick,className:(0,_.default)("ias-slider__controls-btn","ias-slider__controls-btn--prev",pe["slider__controls-btn"],pe["slider__controls-btn--prev"],{[pe["slider__controls-btn--disabled"]]:e.prevDisabled,"ias-slider__controls-btn--disabled":e.prevDisabled}),children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M0 12l10.975 11 2.848-2.828-6.176-6.176H24v-3.992H7.646l6.176-6.176L10.975 1 0 12z",fill:"currentColor"})})}),(0,l.jsx)("button",{onClick:e.onNextClick,className:(0,_.default)("ias-slider__controls-btn","ias-slider__controls-btn--next",pe["slider__controls-btn"],pe["slider__controls-btn--next"],{[pe["slider__controls-btn--disabled"]]:e.nextDisabled,"ias-slider__controls-btn--disabled":e.nextDisabled}),children:(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M13.025 1l-2.847 2.828 6.176 6.176h-16.354v3.992h16.354l-6.176 6.176 2.847 2.828 10.975-11z",fill:"currentColor"})})})]});class fe{constructor(e){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_enabled",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get enabled(){return this._enabled}update(){const e=this.slider.options.loop&&this.canUseLoop();this._enabled?e||(this._enabled=!1,this.destroy()):e&&(this._enabled=!0)}applyLoopFix({targetIndex:e,direction:t}){if(!this.enabled)return!1;const r="next"===t||!t,n="prev"!==t&&t?[]:this.getPrependSlidesIndexes(e),i=r?this.getAppendSlidesIndexes(e):[];return this.moveSlides(n,i),this.adjustPosition(n,i),n.length>0||i.length>0}destroy(){this.resetSlidesOrder()}resetSlidesOrder(){const e=[];this.slider.slides.forEach((t=>{const r=+t.dataset.index;e[r]=t})),e.forEach((e=>{this.slider.track.append(e)}))}canUseLoop(){return!(this.slider.slides.length<this.slider.options.slidesPerView+1&&(console.warn("IAS Banners Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView parameters"),1))}getPrependSlidesIndexes(e){const t=this.slider.track.children,r=[];if(e<1)for(let n=0;n<1-e;n++){const e=t.length-n-1;r.push(e)}return r}getAppendSlidesIndexes(e){const t=[];if(e+this.slider.options.slidesPerView>this.slider.slides.length-1){const r=Math.max(e-(this.slider.slides.length-2),1);for(let e=0;e<r;e++){const r=e;t.push(r)}}return t}moveSlides(e,t){const r=this.slider.track,n=this.slider.slides.slice();e.forEach((e=>{r.prepend(n[e])})),t.forEach((e=>{r.append(n[e])}))}adjustPosition(e,t){e.length>0?this.slider.slideTo(this.slider.activeIndex+e.length,0):t.length>0&&this.slider.slideTo(this.slider.activeIndex-t.length,0)}}var me,ve;!function(e){e.TouchStart="touchStart",e.TouchMove="touchMove",e.TouchEnd="touchEnd",e.ReachStart="reachStart",e.ReachEnd="reachEnd",e.ActiveIndexChange="activeIndexChange",e.RealIndexChnage="realIndexChange",e.TransitionStart="transitionStart",e.TransitionEnd="transitionend",e.Resize="resize",e.SlidesUpdated="slidesUpdated",e.AutoplayTimeLeft="autoplayTimeLeft"}(me||(me={}));class ye{constructor(e,t){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"startX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"startTranslateX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"isTouched",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isMoved",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"startDirection",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"onTouchStart",{enumerable:!0,configurable:!0,writable:!0,value:e=>{!this.slider.animating&&this._enabled&&(e.stopPropagation(),this.startX=e instanceof MouseEvent?e.pageX:e.touches[0].clientX,this.startTranslateX=this.slider.currentTranslateX,this.isTouched=!0,this.setGrabCursor(!1))}}),Object.defineProperty(this,"onTouchMove",{enumerable:!0,configurable:!0,writable:!0,value:e=>{if(!this.isTouched)return;e.stopPropagation();let t=(e instanceof MouseEvent?e.pageX:e.touches[0].clientX)-this.startX;if(t*=1,!(Math.abs(t)>20||this._isMoved))return;this.setGrabCursor(!0),this._isMoved||(this.slider.emit(me.TouchStart),this.slider.autoplay.pause(),this.slider.lockActiveIndex(),this.startDirection=this.getSwipeDirection(t)),this._isMoved=!0;const r="next"===this.startDirection?20:-20;this.slider.emit(me.TouchMove);let n=this.startTranslateX+t+r;this.applyLoopFix(n),n=this.startTranslateX+t+r,this.setTranslate(n)}}),Object.defineProperty(this,"onTouchEnd",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.isTouched&&(this.slider.unlockActiveIndex(),this.updateActiveIndex(),this.unsetGrabCursor(),this.isTouched=!1,this._isMoved=!1,this.slider.emit(me.TouchEnd),this.slider.autoplay.resume())}}),this.slider.track.addEventListener("mousedown",this.onTouchStart,{passive:!0}),document.addEventListener("mousemove",this.onTouchMove,{passive:!0}),document.addEventListener("mouseup",this.onTouchEnd),this.slider.track.addEventListener("touchstart",this.onTouchStart,{passive:!0}),document.addEventListener("touchmove",this.onTouchMove,{passive:!0}),document.addEventListener("touchend",this.onTouchEnd)}get isMoved(){return this._isMoved}enableHorizontalSwipeGesture(){this._enabled=!0}disableHorizontalSwipeGesture(){this._enabled=!1}destroy(){this.slider.track.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd),this.slider.track.removeEventListener("mousedown",this.onTouchStart),document.removeEventListener("mousemove",this.onTouchMove),document.removeEventListener("mouseup",this.onTouchEnd)}setTranslate(e){e=this.applyEdgeResistance(e),this.slider.setTranslate(e)}applyLoopFix(e){if(!this.loopModule.enabled)return;e=-e;const t=this.slider.slideWidth+this.slider.options.spaceBetween,r=this.slider.getMinTranslate(),n=Math.abs(this.slider.getSlideOffset(this.slider.slides.length-this.slider.options.slidesPerView));e<r?this.loopModule.applyLoopFix({targetIndex:0,direction:"prev"})&&(this.startTranslateX-=t):e>n&&this.loopModule.applyLoopFix({targetIndex:this.slider.slides.length-this.slider.options.slidesPerView,direction:"next"})&&(this.startTranslateX+=t)}updateActiveIndex(){var e;if(!this.slider.slides.length)return;const{currentTranslateX:t,slides:r,options:n}=this.slider,i=(null===(e=r[0])||void 0===e?void 0:e.clientWidth)+n.spaceBetween;let a=-Math.round(t/i);const s=this.slider.totalPages-1;a=Math.min(s,Math.max(0,a)),this.slider.slideTo(a)}setGrabCursor(e){this.slider.track.style.cursor="move",this.slider.track.style.cursor=e?"grabbing":"grab"}unsetGrabCursor(){this.slider.track.style.cursor=""}getResistanceCoeff(e){const t=Math.min(Math.abs(e)/(.5*this.slider.slides[0].clientWidth),1);return.3+.7*Math.exp(3*-t)}applyEdgeResistance(e){if(this.loopModule.enabled)return e;e=-e;const t=this.slider.getMinTranslate(),r=-this.slider.getMaxTranslate();if(e>r){const t=e-r;e=r+t*this.getResistanceCoeff(t)}else if(e<t){const r=t-e;e=t-r*this.getResistanceCoeff(r)}return-e}getSwipeDirection(e){return e>0?"prev":"next"}}!function(e){e.Start="start",e.Stop="stop",e.Pause="pause",e.Resume="resume",e.Progress="progress",e.Complete="complete"}(ve||(ve={}));class ge extends Q.EventEmitter{constructor(){super(...arguments),Object.defineProperty(this,"timerId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"currentProgress",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"progressBeforePause",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timerPaused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"isCompleted",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"enabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"rafId",{enumerable:!0,configurable:!0,writable:!0,value:0})}get started(){return!this.isCompleted}get paused(){return this.timerPaused}setTimer(e){0!==e?(this.timerId=setTimeout((()=>this.complete({})),e),this.currentProgress=0,this.runTimerTicks(e)):this.forceEnd()}start(e){this.timerPaused||(this.stop(),this.progressBeforePause=0,this.timeout=e,this.enabled&&(this.isCompleted=!1,this.emit(ve.Start),this.setTimer(e)))}restart(){this.stop(),this.start(this.timeout)}stop(){this.isCompleted||(this.clearTimer(),this.emit(ve.Stop),this.isCompleted=!0,this.timerPaused=!1)}pause(){this.isCompleted||(this.timerPaused=!0,this.clearTimer(),this.progressBeforePause=this.currentProgress,this.emit(ve.Pause))}resume(){if(!this.timerPaused)return;this.timerPaused=!1;const e=1-this.progressBeforePause,t=this.timeout*e;this.setTimer(t),this.emit(ve.Resume)}forceEnd(){this.complete({forceEnd:!0})}disable(){this.enabled=!1,this.stop()}enable(){this.enabled=!0,this.start(this.timeout)}complete({forceEnd:e=!1}){this.isCompleted=!0,this.progressBeforePause=0,this.clearTimer(),this.emit(ve.Complete,{forceEnd:e})}clearTimer(){cancelAnimationFrame(this.rafId),null!==this.timerId&&(clearTimeout(this.timerId),this.timerId=null)}updateProgress(e){const t=1-this.progressBeforePause;this.currentProgress=this.progressBeforePause+e*t;const r=100*this.currentProgress;this.emit(ve.Progress,r)}runTimerTicks(e){let t=performance.now();const r=n=>{let i=(n-t)/e;i>1&&(i=1);let a=i;this.updateProgress(a),i<1&&(this.rafId=requestAnimationFrame(r))};this.rafId=requestAnimationFrame(r)}}class we{constructor(e,t){Object.defineProperty(this,"slider",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:new ge}),Object.defineProperty(this,"delay",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"handleTimerComplete",{enumerable:!0,configurable:!0,writable:!0,value:async({forceEnd:e})=>{e||this.slider.emit(me.AutoplayTimeLeft)}}),this.timer.on("complete",this.handleTimerComplete)}get paused(){return this.timer.paused}start(){this.slider.options.autoplay&&(this.stop(),this.timer.start(this.delay))}stop(){this.timer.stop()}pause(){this.slider.options.autoplay&&this.timer.pause()}resume(){this.slider.options.autoplay&&this.timer.resume()}setDelay(e){this.delay=e}destroy(){this.timer.off("complete",this.handleTimerComplete),this.stop()}}class _e extends Q.EventEmitter{constructor(e,t={}){super(),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:{autoplay:!1,speed:300,delay:3e3,loop:!1,slidesPerView:1,spaceBetween:0,initialSlide:0,updateOnWindowResize:!0}}),Object.defineProperty(this,"isAnimating",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_activeIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_realIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_currentTranslateX",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_reachEnd",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_reachStart",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"loopModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"touchModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_slideWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"autoplay",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_activeIndexLocked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"handleResize",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.updateSize(),this.emit(me.Resize)}}),this.track=e,this.container=e.parentElement,this.loopModule=new fe(this),this.touchModule=new ye(this,this.loopModule),this.autoplay=new we(this,this.loopModule),this.options.updateOnWindowResize&&window.addEventListener("resize",this.handleResize),this.collectSlides(),this.update(t)}get activeIndex(){return this._activeIndex}get realIndex(){return this._realIndex}get reachEnd(){return this._reachEnd}get reachStart(){return this._reachStart}get slidesEl(){return this.track}get slides(){return Array.from(this.track.children)}get allSlides(){return this.slides}get animating(){return this.isAnimating}get currentTranslateX(){return this._currentTranslateX}get isMoved(){return this.touchModule.isMoved}get slideWidth(){return this._slideWidth}get totalPages(){return this.loopModule.enabled?this.slides.length:Math.max(this.slides.length-this.options.slidesPerView+1,1)}async slideToLoop(e,t=this.options.speed){if(!this.loopModule.enabled)return this.slideTo(e,t);if(this.isAnimating)return;const r=this.getPhysicalIndexByRealIndex(e),n=this.slides.length-r<this.options.slidesPerView,i=r-this._activeIndex-1<this.options.slidesPerView?"next":"prev";if(n){const e="next"===i?r+1:r-this.slides.length+1;this.loopModule.applyLoopFix({targetIndex:e,direction:i})}const a=this.getPhysicalIndexByRealIndex(e);requestAnimationFrame((()=>this.slideTo(a)))}async slideTo(e,t=this.options.speed){e=this.clamp(e,0,this.totalPages-1),this.isAnimating||(this.isAnimating=!0,await this.performTranslateToSlide(e,t),this._activeIndexLocked||this.updateIndexes(e),this.isAnimating=!1)}lockActiveIndex(){this._activeIndexLocked=!0}unlockActiveIndex(){this._activeIndexLocked=!1}toNextSlide(){this.isAnimating||(this.loopModule.enabled?this.toNextSlideByLoop():this.slideTo(this.normalizeIndex(this._realIndex+1)))}toPrevSlide(){this.isAnimating||(this.loopModule.enabled?this.toPrevSlideByLoop():this.slideTo(this.normalizeIndex(this._realIndex-1)))}update(e){this.options=this.normalizeOptions(Object.assign(Object.assign({},this.options),e)),this.setupTrackStyles();const t=this.slideWidth;this.calculateSlideWidths(),t!==this.slideWidth&&this.emit(me.SlidesUpdated),this.loopModule.update(),this.slideTo(this._activeIndex,0),this.testAttraction()}destroy(){window.removeEventListener("resize",this.handleResize),this.autoplay.destroy(),this.touchModule.destroy(),this.track.removeAttribute("style"),this._activeIndex=0,this._activeIndexLocked=!1,this.isAnimating=!1}isSlideVisible(e){const t=this.getPhysicalIndexByRealIndex(e);return t>=this._activeIndex&&t<this._activeIndex+this.options.slidesPerView}getVisibleSlideIndexes(){return this.slides.slice(this._activeIndex,this._activeIndex+this.options.slidesPerView).map((e=>+e.dataset.index))}getPhysicalIndexByRealIndex(e){const t=this.normalizeIndex(e);return this.slides.findIndex((e=>e.dataset.index===t.toString()))}getMinTranslate(){return 0}getMaxTranslate(){return this.getSlideOffset(this.totalPages-1)}setTranslate(e){this.track.style.transform=`translate3d(${e}px, 0px, 0px)`,this._currentTranslateX=e,this.testAttraction()}enableHorizontalSwipeGesture(){this.touchModule.enableHorizontalSwipeGesture()}disableHorizontalSwipeGesture(){this.touchModule.disableHorizontalSwipeGesture()}getSlideOffset(e){return this.slides.length?-e*(this.slides[0].clientWidth+this.options.spaceBetween):0}updateSize(){const e=this.slideWidth;this.calculateSlideWidths(),e!==this.slideWidth&&this.emit(me.SlidesUpdated),this.slideTo(this._activeIndex,0)}getTrackWidth(){return this.track.clientWidth-this.options.spaceBetween*(this.options.slidesPerView-1)}toNextSlideByLoop(){this.isAnimating||(this.loopModule.applyLoopFix({targetIndex:this._activeIndex,direction:"next"}),requestAnimationFrame((()=>this.slideTo(this._activeIndex+1))))}toPrevSlideByLoop(){this.isAnimating||(this.loopModule.applyLoopFix({targetIndex:this._activeIndex,direction:"prev"}),requestAnimationFrame((()=>this.slideTo(this._activeIndex-1))))}updateIndexes(e){if(!this.slides.length)return;const t=+this.slides[e].dataset.index,r=this._realIndex,n=this._activeIndex;this._realIndex=t,this._activeIndex=e,r!==t&&this.emit(me.RealIndexChnage,t),n!==e&&this.emit(me.ActiveIndexChange,e)}setupTrackStyles(){Object.assign(this.track.style,{display:"flex",transition:`transform ${this.options.speed}ms ease`,gap:`${this.options.spaceBetween}px`}),this.container.style.overflow="hidden"}collectSlides(){this.slides.forEach(((e,t)=>{e.dataset.index=t.toString()}))}calculateSlideWidths(){this._slideWidth=Math.ceil(this.getTrackWidth()/this.options.slidesPerView),this.slides.forEach((e=>{e.style.width=`${this._slideWidth}px`}))}translateSlidesTrack(e,t){this.track.style.transitionDuration=`${t}ms`,this.setTranslate(this.getSlideOffset(e))}async performTranslateToSlide(e,t){if(0===t)this.translateSlidesTrack(e,0);else{if(this._activeIndex===e&&!this.touchModule.isMoved)return;this.translateSlidesTrack(e,t),this.emit(me.TransitionStart),await this.waitTransitionEnd(),this.emit(me.TransitionEnd)}}waitTransitionEnd(){return new Promise((e=>{this.track.addEventListener("transitionend",(t=>{"transform"===t.propertyName&&(this.track.style.transitionDuration="0ms",e())}),{once:!0})}))}testAttraction(){const e=this.getMinTranslate(),t=this.getMaxTranslate(),r=!this.loopModule.enabled&&this._currentTranslateX>=e,n=!this.loopModule.enabled&&this._currentTranslateX<=t;r!==this._reachStart&&(this._reachStart=r,this.emit(me.ReachStart,r)),n!==this._reachEnd&&(this._reachEnd=n,this.emit(me.ReachEnd,n))}normalizeOptions(e){var t,r,n,i,a,s,o,l;return{autoplay:null!==(t=e.autoplay)&&void 0!==t?t:this.options.autoplay,speed:null!==(r=e.speed)&&void 0!==r?r:this.options.speed,delay:null!==(n=e.delay)&&void 0!==n?n:this.options.delay,loop:null!==(i=e.loop)&&void 0!==i?i:this.options.loop,slidesPerView:Math.max(Math.min(this.track.children.length,null!==(a=e.slidesPerView)&&void 0!==a?a:this.options.slidesPerView),0),spaceBetween:null!==(s=e.spaceBetween)&&void 0!==s?s:this.options.spaceBetween,initialSlide:null!==(o=e.initialSlide)&&void 0!==o?o:this.options.initialSlide,updateOnWindowResize:null!==(l=e.updateOnWindowResize)&&void 0!==l?l:this.options.updateOnWindowResize}}normalizeIndex(e){const t=this.slides.length;return(e%t+t)%t}clamp(e,t,r){return Math.max(t,Math.min(e,r))}}const Se=(0,u.observer)((e=>{const[t,r]=(0,c.useState)(null),n=(0,c.useRef)(null);return(0,c.useEffect)((()=>{if(!n.current||!e.slidesCount)return;const t=new _e(n.current,{autoplay:e.autoplay,speed:e.speed,loop:e.loop,slidesPerView:e.slidesPerView,spaceBetween:e.spaceBetween});return e.onInit(t),r(t),()=>{null==t||t.destroy()}}),[e.slidesCount]),(0,c.useEffect)((()=>{t&&t.update({autoplay:e.autoplay,speed:e.speed,loop:e.loop,slidesPerView:e.slidesPerView,spaceBetween:e.spaceBetween})}),[t,e.autoplay,e.speed,e.loop,e.slidesPerView,e.spaceBetween,e.slidesCount]),(0,l.jsxs)("div",{className:he.slider,style:{"--slider-border-radius":`${e.borderRadius}px`},children:[(0,l.jsx)("div",{ref:n,className:he.slider__track,children:e.children}),t&&e.pagination.enabled&&(0,l.jsx)(ce,{totalPages:t.totalPages,activeIndex:t.realIndex,onClick:r=>{e.loop?t.slideToLoop(r):t.slideTo(r)}}),t&&e.navigation.enabled&&(0,l.jsx)(be,{onPrevClick:()=>{t.toPrevSlide()},onNextClick:()=>{t.toNextSlide()},nextDisabled:t.reachEnd,prevDisabled:t.reachStart})]})})),Pe=e=>(0,l.jsx)("div",{className:(0,_.default)(he.slider__slide,e.className),style:e.style,children:e.children}),Ee=(0,u.observer)((e=>{const t=ie(e),r=(0,c.useRef)(null);return(0,l.jsx)("div",{className:I["banner-place"],ref:r,children:t.length?(0,l.jsx)(O,{index:0,isActive:!0,canBeInited:!0,banner:t[0],allowClick:!0,clientAppearance:e.bannerPlace.appearance.banner}):(0,l.jsx)(P,{needShowErrorScreen:!1,needShowLoaderScreen:!0,onReload:()=>{}})})})),xe=(0,u.observer)((e=>{const t=(0,c.useRef)(null),r=ie(e);var n;n=e,(0,c.useEffect)((()=>{n.appearance&&n.bannerPlace.updateAppearance(n.appearance)}),[n.bannerPlace,JSON.stringify(n.appearance)]);const{realIndex:i,allowClick:a,slider:s,isAnimating:o,setSlider:d,isMoved:h}=(e=>{const t=(0,c.useRef)(null),[r,n]=(0,c.useState)(!1),[i,a]=(0,c.useState)(!1),[s,o]=(0,c.useState)(!1),[l,d]=(0,c.useState)(!0),[h,u]=(0,c.useState)(null),[p,b]=(0,c.useState)(0),[f,m]=(0,c.useState)(0),[v,y]=(0,c.useState)(!0),[g,w]=(0,c.useState)(!0),_=()=>{clearTimeout(t.current),d(!1),o(!0),((e,t)=>{e.getVisibleSlideIndexes().map((e=>t.banners[e])).forEach((e=>e.pause()))})(h,e)},S=()=>{t.current=setTimeout((()=>d(!0)),100),o(!1),((e,t)=>{t.banners.forEach((e=>e.resume()))})(0,e)},P=()=>{a(!0),d(!1)},E=()=>{a(!1),d(!0)},x=t=>{m(t),e.emit(Z.ActiveIndexChange,t)},T=e=>{b(e)},O=()=>{h&&y(h.reachStart)},j=()=>{h&&w(h.reachEnd)},I=()=>{},L=()=>{e.refreshSizes(),requestAnimationFrame((()=>{e.refreshSizes(),n((e=>!e))}))},C=()=>{e.emit(Z.AutoplayTimeLeft),e.notifyTimerEnd()};return(0,c.useEffect)((()=>{if(!h)return;const t=new se(h);e.setSliderController(t)}),[e,h]),(0,c.useEffect)((()=>{h&&e&&e.banners[h.realIndex].markAsOpened()}),[e,h]),(0,c.useEffect)((()=>{if(h)return h.on(me.TouchStart,_),h.on(me.TouchEnd,S),h.on(me.TransitionStart,P),h.on(me.TransitionEnd,E),h.on(me.RealIndexChnage,x),h.on(me.ActiveIndexChange,T),h.on(me.ReachStart,O),h.on(me.ReachEnd,j),h.on(me.Resize,I),h.on(me.SlidesUpdated,L),h.on(me.AutoplayTimeLeft,C),O(),j(),()=>{h.off(me.TouchStart,_),h.off(me.TouchEnd,S),h.off(me.TransitionStart,P),h.off(me.TransitionEnd,E),h.off(me.RealIndexChnage,x),h.off(me.ActiveIndexChange,T),h.off(me.ReachStart,O),h.off(me.ReachEnd,j),h.off(me.Resize,I),h.off(me.SlidesUpdated,L),h.off(me.AutoplayTimeLeft,C)}}),[e,h]),{reachStart:v,reachEnd:g,activeIndex:p,realIndex:f,isMoved:s,isAnimating:i,slider:h,setSlider:u,allowClick:l}})(e.bannerPlace);(({bannerPlace:e,bannerPlaceRef:t,slider:r})=>{const[n,i]=(0,c.useState)(!1);(0,c.useEffect)((()=>((async(e=5e3)=>new Promise(((r,n)=>{const i=setTimeout((()=>{n(new Error("[IAS]: Timeout while waiting for BannerPlace clientWidth"))}),e),a=()=>{if(t.current&&t.current.clientWidth>0)return clearTimeout(i),void r();requestAnimationFrame(a)};requestAnimationFrame(a)})))().then((()=>{i(!0)})).catch(console.error),()=>{i(!1)})),[e.isLoaded]),(0,c.useEffect)((()=>{r&&n&&(r.updateSize(),e.refreshSizes(),requestAnimationFrame((()=>{e.refreshSizes()})))}),[r,e,n])})({bannerPlace:e.bannerPlace,slider:s,bannerPlaceRef:t});const u=e.bannerPlace.appearance;return(0,l.jsx)("div",{className:(0,_.default)(I["banner-place"],e.className),style:e.style,ref:t,children:(0,l.jsx)(Se,{onInit:d,autoplay:u.autoplay,speed:u.animationSpeed,loop:u.loop,slidesPerView:u.slidesPerView,spaceBetween:u.gap,slidesCount:r.length,navigation:u.navigation,pagination:u.pagination,children:r.map(((e,t)=>{const r=Boolean(null==s?void 0:s.isSlideVisible(t));return(0,l.jsx)(Pe,{children:(0,l.jsx)(O,{index:t,isActive:r,canBeInited:r,banner:e,className:I["banner-slider__slide"],allowClick:a,clientAppearance:u.banner})},e.id)}))})})})),Te=(e=>{var t={};return d.d(t,e),t})({createRoot:()=>s.createRoot});class Oe{constructor(e,t,r){Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.rootElement=document.createElement("div"),this.rootElement.style.width="100%",this.rootElement.style.height="100%",e.appendChild(this.rootElement),this.root=(0,Te.createRoot)(this.rootElement)}get isLoaded(){return this.bannerPlace.isLoaded}get id(){return this.bannerPlace.id}get banners(){return this.bannerPlace.banners}get appearance(){return this.bannerPlace.appearance}get contentRatio(){return this.bannerPlace.contentRatio}get isLoading(){return this.bannerPlace.isLoading}get slider(){return this.bannerPlace.slider}refreshSizes(){}emit(e,...t){}setSliderController(e){this.bannerPlace.setSliderController(e)}updateAppearance(e){this.bannerPlace.updateAppearance(e)}play(){this.bannerPlace.play()}stop(){this.bannerPlace.stop()}resume(){this.bannerPlace.resume()}pause(){this.bannerPlace.pause()}reload(){return this.bannerPlace.reload()}destroy(){setTimeout((()=>{this.root.unmount()})),this.mountPoint.removeChild(this.rootElement),this.bannerPlace.destroy()}fetchBanners(){return this.bannerPlace.fetchBanners()}updateUserData(e){return Promise.resolve()}notifyTimerEnd(){}on(e,t){return this.bannerPlace.on(e,t),this}once(e,t){return this.bannerPlace.once(e,t),this}off(e,t){return this.bannerPlace.off(e,t),this}render(){var e;this.root.render((0,l.jsx)(xe,{appearance:null===(e=this.params)||void 0===e?void 0:e.appearance,bannerPlace:this.bannerPlace}))}}const je=e=>{const[t,r]=(0,c.useState)(null);return(0,c.useEffect)((()=>{var t;const n=Xt().createBannerPlace(e.placeId);return r(n),null===(t=e.onReady)||void 0===t||t.call(e,n),()=>{n.destroy()}}),[e.placeId]),t?(0,l.jsx)(xe,Object.assign({bannerPlace:t},e)):null},Ie=e=>{const[t,r]=(0,c.useState)(null);return(0,c.useEffect)((()=>{var t;const n=Xt().createBannerPreviewPlace(e.bannerId);return r(n),null===(t=e.onReady)||void 0===t||t.call(e,n),()=>{n.destroy()}}),[e.bannerId]),t?(0,l.jsx)(Ee,Object.assign({bannerPlace:t},e)):null};var Le=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},Ce=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},ke=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Ae=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Be=(()=>{var e,t,r,n;let i,a,s,o=Q.EventEmitter,l=[],c=[],d=[],h=[],u=[],p=[];return e=class extends o{get _banners(){return ke(this,t,"f")}set _banners(e){Ae(this,t,e,"f")}get _isLoading(){return ke(this,r,"f")}set _isLoading(e){Ae(this,r,e,"f")}get _isLoaded(){return ke(this,n,"f")}set _isLoaded(e){Ae(this,n,e,"f")}constructor(e,i,a,s){super(),Object.defineProperty(this,"bannerId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"bannerViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:s}),t.set(this,Ce(this,l,[])),r.set(this,(Ce(this,c),Ce(this,d,!1))),n.set(this,(Ce(this,h),Ce(this,u,!1))),Object.defineProperty(this,"appearance",{enumerable:!0,configurable:!0,writable:!0,value:(Ce(this,p),new G)}),this.ctx.addBannerPlace(this)}get id(){return"__BANNER_PREVIEW__"}get slider(){return new J}get banners(){return this._banners}get isLoading(){return this._isLoading}get isLoaded(){return this._isLoaded}get contentRatio(){var e,t;return null!==(t=null===(e=this._banners[0])||void 0===e?void 0:e.contentRatio)&&void 0!==t?t:1}refreshSizes(){this._banners.forEach((e=>e.refreshSizes()))}setSliderController(e){}updateAppearance(e){this.appearance.update(e)}play(){for(const e of this._banners)e.resume()}stop(){for(const e of this._banners)e.pause()}resume(){for(const e of this._banners)e.resume()}pause(){for(const e of this._banners)e.pause()}async reload(){this.bannerStore.removeBannerPlaceById(this.id),await Promise.all(this._banners.map((e=>e.destroy()))),this._banners=[],await this.fetchBanners()}destroy(){for(const e of this._banners)e.destroy();this._banners=[],this.ctx.removeBannerPlace(this)}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}notifyTimerEnd(){}async fetchBanners(){try{if(this._isLoading)return[];this._isLoading=!0,this._isLoaded=!1,this.emit(Z.LoadStart);const e=await this.bannerStore.getBannerById(this.bannerId);return this._banners=[this.bannerViewModelFactory.create(this,e)],this._isLoaded=!0,this._banners}catch(e){throw this.emit(Z.LoadError,e),e}finally{this.emit(Z.LoadEnd),this._isLoading=!1}}},t=new WeakMap,r=new WeakMap,n=new WeakMap,(()=>{var t;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(t=o[Symbol.metadata])&&void 0!==t?t:null):void 0;i=[L.observable],a=[L.observable],s=[L.observable],Le(e,null,i,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:r},l,c),Le(e,null,a,{kind:"accessor",name:"_isLoading",static:!1,private:!1,access:{has:e=>"_isLoading"in e,get:e=>e._isLoading,set:(e,t)=>{e._isLoading=t}},metadata:r},d,h),Le(e,null,s,{kind:"accessor",name:"_isLoaded",static:!1,private:!1,access:{has:e=>"_isLoaded"in e,get:e=>e._isLoaded,set:(e,t)=>{e._isLoaded=t}},metadata:r},u,p),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();class Me{constructor(e){Object.defineProperty(this,"bannerStatisticApi",{enumerable:!0,configurable:!0,writable:!0,value:e})}async sendViewEvent(e,t){const r=new X(t);await this.bannerStatisticApi.sendViewEvent(e,r)}async sendWidgetEvent(e,t){const r=new Y(t);await this.bannerStatisticApi.sendWidgetEvent(e,r)}}class Re{constructor(){Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:{}})}set(e,t){this.cache[e]=t}clear(){this.cache={}}get(e){return this.cache[e]}}class De{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlaceViewModel",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){try{const t=this.storyManager.gameReader;await t.openGame(e.gameInstanceId),this.bannerPlaceViewModel.stop(),t.once("close",(()=>{this.bannerPlaceViewModel.play()}))}catch(e){console.error(e)}}}var Ne,ze,We,Fe,Ue,Ve,qe,$e,Ge,He,Xe,Ye,Qe,Je,Ze,Ke,et,tt,rt;!function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(Ne||(Ne={})),Ne.END,function(e){e.DEFAULT="default",e.CUSTOM_CARD="customCard"}(ze||(ze={})),ze.DEFAULT,ze.DEFAULT,function(e){e.CENTER="center",e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end"}(We||(We={})),function(e){e.CIRCLE="circle",e.QUAD="quad",e.RECTANGLE="rectangle"}(Fe||(Fe={})),function(e){e.LEFT="left",e.RIGHT="right",e.START="start",e.END="end",e.CENTER="center"}(Ue||(Ue={})),function(e){e.CARD_INSIDE_BOTTOM="cardInsideBottom",e.CARD_OUTSIDE_TOP="cardOutsideTop",e.CARD_OUTSIDE_BOTTOM="cardOutsideBottom"}(Ve||(Ve={})),function(e){e.Medium="medium",e.High="high"}(qe||(qe={})),function(e){e.COLUMN="vertical",e.ROW="horizontal"}($e||($e={})),function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(Ge||(Ge={})),$e.ROW,Ue.START,Ve.CARD_INSIDE_BOTTOM,qe.High,Fe.RECTANGLE,Ue.START,Ve.CARD_INSIDE_BOTTOM,qe.High,Fe.CIRCLE,We.START,Ue.START,Ve.CARD_INSIDE_BOTTOM,qe.High,Fe.CIRCLE,function(e){e.STORY_LIST="storyList",e.STORY_READER="storyReader",e.GAME_READER="gameReader",e.STACK_STORY_LIST="stackStoryList",e.IAM_READER="iamReader",e.BANNERS="banners"}(He||(He={})),function(e){e.FLAT="flat",e.COVER="cover",e.CUBE="cube"}(Xe||(Xe={})),function(e){e.Classic="classic",e.Modern="modern"}(Ye||(Ye={})),Xe.FLAT,Ye.Classic,function(e){e.STYLE_CIRCLE="circle",e.STYLE_QUAD="quad",e.STYLE_RECTANGLE="rectangle",e.SWIPE_CUBE="cube",e.SWIPE_FLAT="flat",e.SWIPE_COVER="cover",e.CLOSE_BUTTON_LEFT="left",e.CLOSE_BUTTON_RIGHT="right"}(Qe||(Qe={})),function(e){e.direct="direct",e.onboarding="onboarding",e.list="list",e.favorite="favorite"}(Je||(Je={})),function(e){e[e.default=0]="default",e[e.favorite=1]="favorite",e[e.stacked=2]="stacked"}(Ze||(Ze={})),function(e){e[e.default=0]="default",e[e.onboarding=1]="onboarding",e[e.favorite=2]="favorite",e[e.direct=3]="direct"}(Ke||(Ke={})),function(e){e.list="list",e.favorite="favorite"}(et||(et={})),function(e){e.CLICK_ON_STORY="clickOnStoryLink"}(tt||(tt={})),function(e){e.LTR="ltr",e.RTL="rtl"}(rt||(rt={}));class nt{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:t})}handle(e){try{const t=decodeURIComponent(e.linkTarget);this.emitWidgetLinkEvent(t,e),this.handleClickOnButton({id:this.banner.id,index:this.banner.activeSlideIndex,url:t,elementId:e.elementId,dataForSending:null,label:""})}catch(t){t instanceof URIError?console.error(`[Banners]: the URL <${e.linkTarget}> has an invalid format`):console.error(t)}}emitWidgetLinkEvent(e,t){}async handleClickOnButton(e){const t={src:He.BANNERS,data:e};this.storyManager.emit("clickOnButton",t)}}class it{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r})}async handle(e){try{await this.emitClickOnButtonEvent({id:0,index:0,url:"",elementId:"",dataForSending:null,label:""}),this.bannerPlace.stop(),await this.storyManager.storyReader.showStory(e.storyId),this.storyManager.storyReader.once("closeStoryReader",(()=>{this.bannerPlace.play()}))}catch(e){console.error(e)}}async emitClickOnButtonEvent(e){const t={src:He.BANNERS,data:e};this.storyManager.emit("clickOnButton",t)}}let at;const st=e=>{!function(e){at=document.createElement("textarea"),at.value=e,document.body.appendChild(at)}(e),function(){let e,t;/ipad|iphone/i.test(navigator.userAgent)?(e=document.createRange(),at&&e.selectNodeContents(at),t=window.getSelection(),t&&(t.removeAllRanges(),t.addRange(e)),at&&at.setSelectionRange(0,999999)):null==at||at.select()}(),document.execCommand("copy"),at&&document.body.removeChild(at)};let ot;ot=function(){};class lt{constructor(e){Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:e})}manageTimer(e,t){if(!this.bannerPlace.slider)return;const r=this.bannerPlace.slider.autoplay;switch(e){case"start":this.startTimer(r,t);break;case"pause":r.pause();break;case"stop":case"before_start":r.stop()}}startTimer(e,t){e.isPaused()?e.resume():(e.setDelay(t),e.start())}}class ct{constructor(e,t,r,n){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"sessionNarrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new Re}),Object.defineProperty(this,"narrativeDataCache",{enumerable:!0,configurable:!0,writable:!0,value:new Re})}updateCardServerDataLocally(e){this.banner.context.updateNarrativeSavedData(e)}updateTimeline(e,t,r,n,i,a){[...arguments].join(", "),this.banner.id,"before_start"!==t&&(i?this.banner.showLoaderScreen():this.banner.activeSlide.inited&&this.banner.hideLoaderScreen(),a?this.banner.showErrorScreen():this.banner.hideErrorScreen()),new lt(this.bannerPlace).manageTimer(t,n)}clearNarrativeSessionDataCache(){this.sessionNarrativeDataCache.clear()}disableVerticalSwipeGesture(){}enableVerticalSwipeGesture(){}disableHorizontalSwipeGesture(){this.bannerPlace.slider.disableHorizontalSwipeGesture()}enableHorizontalSwipeGesture(){this.bannerPlace.slider.enableHorizontalSwipeGesture()}async getCardLocalData(){const e=this.narrativeDataCache.get(`banner_${this.banner.id}_data_${this.storyManager.rootStore.sessionStore.userId}`);return e?JSON.parse(e):{}}setCardLocalData(e,t){const r=JSON.stringify(e);this.narrativeDataCache.set(`banner_${this.banner.id}_data_${this.storyManager.rootStore.sessionStore.userId}`,r),this.banner.context.updateNarrativeSavedData(r),t&&this.banner.updateUserData(r).catch(console.error)}getCardServerData(e){var t;return null!==(t=this.banner.context.widgetsData._narrative_saved_data)&&void 0!==t?t:null}getSlideDuration(e,t){var r,n;return null!==(n=null===(r=this.banner.context.widgetsData._narrative_slides_duration)||void 0===r?void 0:r[t])&&void 0!==n?n:null}pauseUI(){this.banner.pause()}resumeUI(){this.banner.resume()}showCardTextInput(e,t){}setCardSessionValue(e,t){this.sessionNarrativeDataCache.set(e,t)}getCardSessionValue(e){return this.sessionNarrativeDataCache.get(e)}getWidgetsSharedData(e,t){const r=this.banner.context.widgetsData;switch(t){case"rangeSlider":return r._narrative_range_slider_data;case"poll":return r._narrative_poll_data;case"vote":return r._narrative_vote_data}return null}async sendApiRequest(e,t,r,n,i,a){var s,o,l;try{const a=await this.storyManager.httpClient.request({url:e,method:t,params:null!=r?r:{},headers:null!=n?n:{},data:null!=i?i:{}});return{status:a.status,headers:a.headers,data:a.data}}catch(e){if(e instanceof Error&&"IasNetworkError"===e.name)return{status:null!==(s=e.networkStatus)&&void 0!==s?s:400,headers:null===(o=e.response)||void 0===o?void 0:o.headers,data:null===(l=e.response)||void 0===l?void 0:l.data}}}share(e,t){}shareSlideScreenshot(e,t,r){}showLayer(e){this.banner.showLayerByIndex(e)}showCardSlide(e){this.bannerPlace.slider.slideTo(e)}cardShowNext(){this.bannerPlace.slider.toNextSlide()}showNextSlide(){this.bannerPlace.slider.toNextSlide()}sendStatisticEvent(e,t,r,n){this.bannerStatisticService.sendWidgetEvent(this.banner.id,{iterationId:this.banner.iterationId,type:e,slideIndex:this.banner.activeSlideIndex,slideTotal:this.banner.slides.length,durationMs:this.banner.durationMs,widgetPayload:t})}async resetCard(e){this.updateCardServerDataLocally({}),this.setCardLocalData({},!0),this.showCardSlide(0),this.showLayer(0)}getCardFonts(){var e,t;return null!==(t=null===(e=this.storyManager.rootStore.sessionStore.session)||void 0===e?void 0:e.fontsResources)&&void 0!==t?t:[]}showToast(e){this.banner.showToast({content:e})}closeCard(e){}openStory(e,t){new it(this.storyManager,this.bannerPlace,this.banner).handle({storyId:e,slideIndex:t})}openGame(e){new De(this.storyManager,this.bannerPlace,this.banner).handle({gameInstanceId:e})}writeToClipboard(e){st(e.textValue)}openUrl(e){"swipeUpItems"!==e.type&&new nt(this.storyManager,this.banner).handle({elementId:e.elementId,linkTarget:e.link.target})}}var dt;!function(e){e.Top="top",e.Bottom="bottom"}(dt||(dt={}));const ht=dt.Bottom;class ut{constructor(e){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"timeoutId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"duration",{enumerable:!0,configurable:!0,writable:!0,value:3e3}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"position",{enumerable:!0,configurable:!0,writable:!0,value:ht}),Object.defineProperty(this,"mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"toastContainer",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.initializeOptions(e),this.mountPoint=e.mountPoint}show(e){return this.content=e,this.destroy(),this.createAndShowToast(),!0}hide(){return!!this.toastContainer&&(clearTimeout(this.timeoutId),this.toastContainer.className+=" toast_fadeout",this.addAnimationEndListeners(this.toastContainer,(()=>{var e,t;null===(t=null===(e=this.toastContainer)||void 0===e?void 0:e.parentNode)||void 0===t||t.removeChild(this.toastContainer),this.toastContainer=null})),!0)}destroy(){var e;this.toastContainer&&(clearTimeout(this.timeoutId),null===(e=this.toastContainer.parentNode)||void 0===e||e.removeChild(this.toastContainer),this.toastContainer=null)}initializeOptions(e){if(e.duration&&(this.duration="string"==typeof e.duration?parseFloat(e.duration):e.duration),e.position){const t=e.position.toLowerCase();this.position="top"===t||"bottom"===t?t:ht}}createAndShowToast(){const e=this.createToastContainer(),t=this.createToastElement(),r=this.createToastTextElement();t.appendChild(r),e.appendChild(t),this.mountPoint.appendChild(e),this.timeoutId=window.setTimeout((()=>this.hide()),this.duration),this.toastContainer=e}createToastContainer(){const e=document.createElement("div");return e.id="toast_container",e.className="toast_fadein",e.style.zIndex="1130",e}createToastElement(){const e=document.createElement("div");return e.id="toast",e}createToastTextElement(){const e=document.createElement("span");return e.innerHTML=this.content,e}addAnimationEndListeners(e,t){["animationend","webkitAnimationEnd","msAnimationEnd","oAnimationEnd"].forEach((r=>{e.addEventListener(r,t,{once:!0})}))}}const pt=(e=>{var t={};return d.d(t,e),t})({SlideApi:()=>o.SlideApi}),bt=(new Error("timeout while waiting for mutex to become available"),new Error("mutex already locked"),new Error("request for lock canceled"));class ft{constructor(e,t=bt){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise(((r,n)=>{const i={resolve:r,reject:n,weight:e,priority:t},a=mt(this._queue,(e=>t<=e.priority));-1===a&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)}))}runExclusive(e){return function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))}(this,arguments,void 0,(function*(e,t=1,r=0){const[n,i]=yield this.acquire(t,r);try{return yield e(n)}finally{i()}}))}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise((r=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),function(e,t){const r=mt(e,(e=>t.priority<=e.priority));e.splice(r+1,0,t)}(this._weightedWaiters[e-1],{resolve:r,priority:t})}))}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach((e=>e.reject(this._cancelError))),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(0===this._queue.length)for(let e=this._value;e>0;e--){const t=this._weightedWaiters[e-1];t&&(t.forEach((e=>e.resolve())),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let t=this._value;t>0;t--){const r=this._weightedWaiters[t-1];if(!r)continue;const n=r.findIndex((t=>t.priority<=e));(-1===n?r:r.splice(0,n)).forEach((e=>e.resolve()))}}}_couldLockImmediately(e,t){return(0===this._queue.length||this._queue[0].priority<t)&&e<=this._value}}function mt(e,t){for(let r=e.length-1;r>=0;r--)if(t(e[r]))return r;return-1}class vt{constructor(e){this._semaphore=new ft(1,e)}acquire(){return function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))}(this,arguments,void 0,(function*(e=0){const[,t]=yield this._semaphore.acquire(1,e);return t}))}runExclusive(e,t=0){return this._semaphore.runExclusive((()=>e()),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class yt{constructor(e,t,r){Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerSlide",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"mutex",{enumerable:!0,configurable:!0,writable:!0,value:new vt}),Object.defineProperty(this,"_inited",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get html(){return this.bannerSlide.html}get state(){return this.slideApi.state}get inited(){return this._inited}notifyTimerEnd(){this.slideApi.slideTimerEnd()}async init(){const e=await this.mutex.acquire();if(this._inited)return;let t=this.banner.needShowLoaderScreen,r=Date.now();const n=setTimeout((()=>{this.banner.showLoaderScreen(),t=!0,r=Date.now()}),500);try{this.banner.id,await this.slideApi.showSlide(this.html),this._inited=!0}catch(e){throw this.handleSlideError(e),e}finally{clearTimeout(n),await this.cleanupLoaderIfNeeded(Date.now()-r,t),e()}}async start(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideStart({muted:!0})}catch(e){this.handleSlideError(e)}finally{e()}}async restart(){const e=await this.mutex.acquire();try{this.banner.hideErrorScreen(),this.banner.showLoaderScreen(),await this.slideApi.slideRestart({muted:!0})}catch(e){this.handleSlideError(e)}finally{this.banner.hideLoaderScreen(),e()}}async resume(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideAppResume()}catch(e){this.handleSlideError(e)}finally{e()}}async pause(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideAppPause()}catch(e){this.handleSlideError(e)}finally{e()}}async pauseByUser(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideUserPause()}catch(e){this.handleSlideError(e)}finally{e()}}async resumeByUser(){const e=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideUserResume()}catch(e){this.handleSlideError(e)}finally{e()}}async stop(e){const t=await this.mutex.acquire();try{this.banner.id,await this.slideApi.slideStop(e)}catch(e){this.handleSlideError(e)}finally{t()}}refreshSizes(){this.slideApi.refreshSizes()}onClick({event:e,currentTarget:t}){if(e.target)try{e.preventDefault(),e.stopPropagation();const r=this.getNavigationDirection(e,t);this.slideApi.slideClickHandler(e.target,r>0?"forward":"backward")}catch(e){console.error(e)}}async destroy(){await this.stop({prepareForRestart:2})}showLayerByIndex(e){this.slideApi.showLayer(e)}handleSlideError(e){console.error(e),this.banner.showErrorScreen()}getNavigationDirection(e,t){const r=this.getClickPosition(e,t),n="ltr"===this.slideApi.layoutDirection?1:-1;return r>=.3?n:-n}getClickPosition(e,t){const r=t.getBoundingClientRect(),n=r.width;if(n<=0)return 0;let i;if(e instanceof MouseEvent)i=e.pageX-r.left;else{if(!(e.touches&&e.touches.length>0))return 0;i=e.touches[0].pageX-r.left}return Math.max(0,Math.min(1,i/n))}delay(e){return new Promise((t=>setTimeout(t,e)))}async cleanupLoaderIfNeeded(e,t){t&&await this.delay(Math.max(500-e,0)),this.banner.hideLoaderScreen()}}class gt{get html(){return""}get state(){return 0}async init(){}async start(){}async restart(){}async resume(){}async pause(){}async resumeByUser(){}async pauseByUser(){}async stop(e){}onClick({event:e,currentTarget:t}){}async destroy(){}showLayerByIndex(e){}refreshSizes(){}notifyTimerEnd(){}}var wt=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},_t=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},St=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Pt=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Et=(()=>{var e,t,r,n,i,a;let s,o,l,c,d,h,u,p,b,f,m,v,y=[],g=[],w=[],_=[],S=[],P=[],x=[],T=[],O=[],j=[],I=[];return e=class{get _$root(){return St(this,t,"f")}set _$root(e){Pt(this,t,e,"f")}get _needShowErrorScreen(){return St(this,r,"f")}set _needShowErrorScreen(e){Pt(this,r,e,"f")}get _needShowLoaderScreen(){return St(this,n,"f")}set _needShowLoaderScreen(e){Pt(this,n,e,"f")}get _width(){return St(this,i,"f")}set _width(e){Pt(this,i,e,"f")}get _slides(){return St(this,a,"f")}set _slides(e){Pt(this,a,e,"f")}constructor(e,s,o,l,c){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(wt(this,y),e)}),Object.defineProperty(this,"bannerPlace",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"banner",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:c}),t.set(this,wt(this,g,null)),r.set(this,(wt(this,w),wt(this,_,!1))),n.set(this,(wt(this,S),wt(this,P,!1))),i.set(this,(wt(this,x),wt(this,T,0))),a.set(this,(wt(this,O),wt(this,j,[]))),Object.defineProperty(this,"slideApi",{enumerable:!0,configurable:!0,writable:!0,value:(wt(this,I),null)}),Object.defineProperty(this,"slideApiImpl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"locked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"toast",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_iterationId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_startTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_initPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_initPromiseResolver",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"attachRoot",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{this._$root||(this._$root=e,this.slideApi=this.createSlideApi(e),this._slides=[new yt(this,this.banner.slides[0],this.slideApi)],await this.init())}}),Object.defineProperty(this,"handleVisibilityChange",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.locked||("hidden"===document.visibilityState&&this.pause(),"visible"===document.visibilityState&&this.resume())}}),this.slideApiImpl=new ct(this.storyManager,this.bannerPlace,this,this.bannerStatisticService),this._initPromise=new Promise((e=>{this._initPromiseResolver=e}))}get id(){return this.banner.id}get context(){return this.banner.context}get appearance(){return this.banner.appearance}get contentRatio(){return this.banner.appearance.contentRatio}get name(){return this.banner.name}get dir(){return this.storyManager.config.dir}get slides(){return this._slides}get activeSlideIndex(){return 0}get width(){return this._width}get activeSlide(){var e;return null!==(e=this._slides[this.activeSlideIndex])&&void 0!==e?e:new gt}get needShowErrorScreen(){return this._needShowErrorScreen}get needShowLoaderScreen(){return this._needShowLoaderScreen}get canBeShown(){return Boolean(this._$root)}get iterationId(){return this._iterationId}get durationMs(){return Date.now()-this._startTime}async init(){this.showLoaderScreen(),await this.activeSlide.init(),this._initPromiseResolver()}async start(){if(!this._$root)throw new Error(`[IAS]: Slide API mount point not found for banner with ID ${this.id}`);document.addEventListener("visibilitychange",this.handleVisibilityChange),await this.activeSlide.start(),this._startTime=Date.now(),this.markAsOpened()}refreshSizes(){this.activeSlide.refreshSizes()}async restart(){await this.activeSlide.restart()}async resume(){await this.activeSlide.resume()}async pause(){await this.activeSlide.pause()}async resumeByUser(){await this.activeSlide.resumeByUser()}async pauseByUser(){await this.activeSlide.pauseByUser()}async stop(){var e;this.slideApiImpl.clearNarrativeSessionDataCache(),document.removeEventListener("visibilitychange",this.handleVisibilityChange),null===(e=this.toast)||void 0===e||e.destroy(),await this.activeSlide.stop({prepareForRestart:1})}async destroy(){var e,t;document.removeEventListener("visibilitychange",this.handleVisibilityChange);const r=this.activeSlide;this._slides=[],this._$root=null,await r.destroy(),null===(e=this.slideApi)||void 0===e||e.destroy(),null===(t=this.toast)||void 0===t||t.destroy()}showLayerByIndex(e){this.activeSlide.showLayerByIndex(e)}showToast(e){if(!this._$root)return;const t=this._$root;this.toast=new ut(Object.assign({mountPoint:t},e)),this.toast.show(e.content)}detachRoot(){var e;this._$root=null,null===(e=this.slideApi)||void 0===e||e.destroy()}showErrorScreen(){this._needShowErrorScreen=!0}showLoaderScreen(){this._needShowLoaderScreen=!0}hideLoaderScreen(){this._needShowLoaderScreen=!1}hideErrorScreen(){this._needShowErrorScreen=!1}markAsOpened(){this._iterationId=(0,H.v4)(),this.banner.markAsOpened(),this.markWasShown()}waitInit(){return this._initPromise}notifyTimerEnd(){this.activeSlide.notifyTimerEnd()}async markWasShown(){!this.banner.wasShown&&this._iterationId&&(this.banner.markWasShown(),this.bannerStatisticService.sendViewEvent(this.id,{iterationId:this._iterationId,slideIndex:this.activeSlideIndex,slideTotal:this.banner.slides.length}))}async updateUserData(e){return this.bannerStore.updateBannerUserData(this.id,e)}createSlideApi(e){return new pt.SlideApi(this.slideApiImpl,{root:e,slideRatio:this.banner.appearance.contentRatio,isFullscreen:!1,nonce:E(),viewport:window,userResizeHandler:e=>{this._width=e.viewportWidth},VODPlayer:this.storyManager.globalProperties.$videoOnDemand,overlappingActionBarHeight:0})}},t=new WeakMap,r=new WeakMap,n=new WeakMap,i=new WeakMap,a=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;s=[L.observable],o=[L.observable],l=[L.observable],c=[L.observable],d=[L.observable],h=[L.computed],u=[L.computed],p=[L.computed],b=[L.action],f=[L.action],m=[L.action],v=[L.action],_t(e,null,s,{kind:"accessor",name:"_$root",static:!1,private:!1,access:{has:e=>"_$root"in e,get:e=>e._$root,set:(e,t)=>{e._$root=t}},metadata:t},g,w),_t(e,null,o,{kind:"accessor",name:"_needShowErrorScreen",static:!1,private:!1,access:{has:e=>"_needShowErrorScreen"in e,get:e=>e._needShowErrorScreen,set:(e,t)=>{e._needShowErrorScreen=t}},metadata:t},_,S),_t(e,null,l,{kind:"accessor",name:"_needShowLoaderScreen",static:!1,private:!1,access:{has:e=>"_needShowLoaderScreen"in e,get:e=>e._needShowLoaderScreen,set:(e,t)=>{e._needShowLoaderScreen=t}},metadata:t},P,x),_t(e,null,c,{kind:"accessor",name:"_width",static:!1,private:!1,access:{has:e=>"_width"in e,get:e=>e._width,set:(e,t)=>{e._width=t}},metadata:t},T,O),_t(e,null,d,{kind:"accessor",name:"_slides",static:!1,private:!1,access:{has:e=>"_slides"in e,get:e=>e._slides,set:(e,t)=>{e._slides=t}},metadata:t},j,I),_t(e,null,h,{kind:"getter",name:"activeSlide",static:!1,private:!1,access:{has:e=>"activeSlide"in e,get:e=>e.activeSlide},metadata:t},null,y),_t(e,null,u,{kind:"getter",name:"needShowLoaderScreen",static:!1,private:!1,access:{has:e=>"needShowLoaderScreen"in e,get:e=>e.needShowLoaderScreen},metadata:t},null,y),_t(e,null,p,{kind:"getter",name:"canBeShown",static:!1,private:!1,access:{has:e=>"canBeShown"in e,get:e=>e.canBeShown},metadata:t},null,y),_t(e,null,b,{kind:"method",name:"showErrorScreen",static:!1,private:!1,access:{has:e=>"showErrorScreen"in e,get:e=>e.showErrorScreen},metadata:t},null,y),_t(e,null,f,{kind:"method",name:"showLoaderScreen",static:!1,private:!1,access:{has:e=>"showLoaderScreen"in e,get:e=>e.showLoaderScreen},metadata:t},null,y),_t(e,null,m,{kind:"method",name:"hideLoaderScreen",static:!1,private:!1,access:{has:e=>"hideLoaderScreen"in e,get:e=>e.hideLoaderScreen},metadata:t},null,y),_t(e,null,v,{kind:"method",name:"hideErrorScreen",static:!1,private:!1,access:{has:e=>"hideErrorScreen"in e,get:e=>e.hideErrorScreen},metadata:t},null,y),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class xt{constructor(e,t,r){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"bannerStatisticService",{enumerable:!0,configurable:!0,writable:!0,value:r})}create(e,t){return new Et(this.storyManager,e,t,this.bannerStatisticService,this.bannerStore)}}function Tt(e,t){let r=null;return async function(...t){return r||(r=(async()=>{try{return await e.apply(this,t)}catch(e){throw e}finally{r=null}})(),r)}}class Ot extends Error{constructor(e){super(`[IAS]: Banner with ID ${e} not found`),this.name="IasBannerNotFoundError"}}class jt extends Error{constructor(e){super(`[IAS]: Banner slot with ID ${e} not found`),this.name="IasBannerPlaceNotFoundError"}}var It=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},Lt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0};let Ct=(()=>{var e;let t,r,n,i,a=[];return e=class{constructor(e){Object.defineProperty(this,"httpClient",{enumerable:!0,configurable:!0,writable:!0,value:(It(this,a),e)})}async fetchBannerPlaceById(e){const t=await this.httpClient.get(`banner/place/${e.placeId}`,{expand:"banners.slides",tags:e.tags.join(",")});if(t.data)return t.data;throw new jt(e.placeId)}async fetchBannerById(e){const t=await this.httpClient.get(`banner/${e}`,{expand:"slides"});if(t.data)return t.data;throw new Ot(e)}async fetchContextWithStyles({needFetchStyles:e}){return(await this.httpClient.get("banner/context",{fields:"widgetsData"+(e?",style":"")})).data}async updateUserData(e,t){try{await this.httpClient.request({url:`banner/${e}/data`,method:"put",data:{data:t}})}catch(e){console.error(e)}}},(()=>{const s="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Tt],r=[Tt],n=[Tt],i=[Tt],Lt(e,null,t,{kind:"method",name:"fetchBannerPlaceById",static:!1,private:!1,access:{has:e=>"fetchBannerPlaceById"in e,get:e=>e.fetchBannerPlaceById},metadata:s},null,a),Lt(e,null,r,{kind:"method",name:"fetchBannerById",static:!1,private:!1,access:{has:e=>"fetchBannerById"in e,get:e=>e.fetchBannerById},metadata:s},null,a),Lt(e,null,n,{kind:"method",name:"fetchContextWithStyles",static:!1,private:!1,access:{has:e=>"fetchContextWithStyles"in e,get:e=>e.fetchContextWithStyles},metadata:s},null,a),Lt(e,null,i,{kind:"method",name:"updateUserData",static:!1,private:!1,access:{has:e=>"updateUserData"in e,get:e=>e.updateUserData},metadata:s},null,a),s&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})})(),e})();class kt{constructor(e,t){Object.defineProperty(this,"httpClient",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t})}async sendShowBannerEvent(e){throw new Error("Method not implemented.")}async sendClickOnBannerEvent(e){throw new Error("Method not implemented.")}async sendBannerCTREvent(e){throw new Error("Method not implemented.")}async sendViewEvent(e,t){await this.sendStatisticsEvent(e,t)}async sendWidgetEvent(e,t){await this.sendStatisticsEvent(e,t)}async sendStatisticsEvent(e,t){try{if(this.storyManager.isStatisticsDisabled)return void console.log("[BANNER STATISTICS]",Object.assign({bannerId:e,type:t.type},t.toQueryParams()));await this.httpClient.post(`/banner/${e}/event/${t.type}`,{},t.toQueryParams())}catch(e){console.error(e)}}}var At;!function(e){e[e.Base=0]="Base",e[e.Dynamic=1]="Dynamic",e[e.Game=2]="Game",e[e.Story=3]="Story",e[e.IAM=4]="IAM"}(At||(At={}));var Bt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0};(()=>{var e;let t,r,n=[];e=class{async fetchBannerPlaceById(e){return{id:"default",appearance:{single_banner_aspect_ratio:2,banners_gap:16,corner_radius:16,loop:!0,autoplay:!0,autoplay_delay:1e3,animation_speed:300},banners:[]}}async fetchContext(){return{style:"",widgetsData:{}}}updateUserData(e,t){throw new Error("Method not implemented.")}fetchBannerById(e){throw new Error("Method not implemented.")}constructor(){!function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e)}(this,n)}},(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[Tt],r=[Tt],Bt(e,null,t,{kind:"method",name:"fetchBannerPlaceById",static:!1,private:!1,access:{has:e=>"fetchBannerPlaceById"in e,get:e=>e.fetchBannerPlaceById},metadata:i},null,n),Bt(e,null,r,{kind:"method",name:"fetchContext",static:!1,private:!1,access:{has:e=>"fetchContext"in e,get:e=>e.fetchContext},metadata:i},null,n),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})()})();class Mt{constructor(e,t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:t})}createBannerPlace(e,t){var r;const n=new kt(this.storyManager.httpClient,this.storyManager),i=new Me(n),a=new xt(this.storyManager,this.bannerStore,i);return new ne(null!==(r=null==t?void 0:t.toString())&&void 0!==r?r:"default",e,i,this.bannerStore,a)}createBannerPreviewPlace(e,t){const r=new kt(this.storyManager.httpClient,this.storyManager),n=new Me(r),i=new xt(this.storyManager,this.bannerStore,n);return new Be(t.toString(),e,this.bannerStore,i)}}class Rt{static toDomain(e,t){return new k({id:e.id,name:e.name,slides:e.slides.map((e=>new D({html:e.html,duration:e.duration}))),displayFrom:e.display_from,displayTo:e.display_to,appearance:new A(e.appearance),context:new B(e.id,t),frequencyLimit:e.frequency_limit})}}class Dt{static toDomain(e,t,r){const n=e.banners.map((e=>Rt.toDomain(e,t)));return new z({id:e.id,banners:n,placeholders:r,style:t.style})}}var Nt=function(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0},zt=function(e,t,r,n,i,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?n.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),u=!1,p=r.length-1;p>=0;p--){var b={};for(var f in n)b[f]="access"===f?{}:n[f];for(var f in n.access)b.access[f]=n.access[f];b.addInitializer=function(e){if(u)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var m=(0,r[p])("accessor"===l?{get:h.get,set:h.set}:h[c],b);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(o=s(m.get))&&(h.get=o),(o=s(m.set))&&(h.set=o),(o=s(m.init))&&i.unshift(o)}else(o=s(m))&&("field"===l?i.unshift(o):h[c]=o)}d&&Object.defineProperty(d,n.name,h),u=!0},Wt=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},Ft=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let Ut=(()=>{var e,t,r;let n,i,a,s,o=[],l=[],c=[],d=[],h=[];return e=class{get _bannerPlaces(){return Wt(this,t,"f")}set _bannerPlaces(e){Ft(this,t,e,"f")}get _banners(){return Wt(this,r,"f")}set _banners(e){Ft(this,r,e,"f")}constructor(e,n){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:(Nt(this,o),e)}),Object.defineProperty(this,"bannerApi",{enumerable:!0,configurable:!0,writable:!0,value:n}),t.set(this,Nt(this,l,L.observable.map())),r.set(this,(Nt(this,c),Nt(this,d,L.observable.map()))),Object.defineProperty(this,"bannerCSS",{enumerable:!0,configurable:!0,writable:!0,value:(Nt(this,h),"")}),(0,L.reaction)((()=>e.rootStore.placeholderStore.placeholders),(e=>{for(const t of this._bannerPlaces.values())t.updatePlaceholders(e)}))}get bannerPlaces(){return Array.from(this._bannerPlaces.values())}async getBannerById(e){if(this._banners.has(e))return this._banners.get(e);await this.storyManager.waitStoryManagerConfig();const t=await this.fetchBannerContext(),r=await this.bannerApi.fetchBannerById(e);return this.addBanner(r,t)}async getBannerPlaceById(e){if(this._bannerPlaces.has(e.placeId))return this._bannerPlaces.get(e.placeId);await this.storyManager.waitStoryManagerConfig();const t=await this.fetchBannerContext(),r=await this.bannerApi.fetchBannerPlaceById({placeId:e.placeId,tags:this.storyManager.config.tags});return this.addBannerPlace(r,t)}clearCache(){this._bannerPlaces=L.observable.map(),this._banners=L.observable.map()}removeBannerPlaceById(e){this._bannerPlaces.delete(e)}async updateBannerUserData(e,t){if(!this.storyManager.isStatisticsDisabled)return this.bannerApi.updateUserData(e,t);console.log("[IAM]: update user data",{bannerId:e,payload:t})}async fetchBannerContext(){await this.storyManager.rootStore.sessionStore.open();const e=await this.bannerApi.fetchContextWithStyles({needFetchStyles:!this.bannerCSS});return this.bannerCSS&&(e.style=this.bannerCSS),e}addBannerPlace(e,t){const r=this.storyManager.rootStore.placeholderStore.placeholders,n=Dt.toDomain(e,t,r);return this._bannerPlaces.set(e.id,n),n}addBanner(e,t){const r=this.storyManager.rootStore.placeholderStore.placeholders,n=Rt.toDomain(e,t);return n.updatePlaceholders(r),this._banners.set(n.id,n),n}},t=new WeakMap,r=new WeakMap,(()=>{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;n=[L.observable],i=[L.observable],a=[L.computed],s=[Tt],zt(e,null,n,{kind:"accessor",name:"_bannerPlaces",static:!1,private:!1,access:{has:e=>"_bannerPlaces"in e,get:e=>e._bannerPlaces,set:(e,t)=>{e._bannerPlaces=t}},metadata:t},l,c),zt(e,null,i,{kind:"accessor",name:"_banners",static:!1,private:!1,access:{has:e=>"_banners"in e,get:e=>e._banners,set:(e,t)=>{e._banners=t}},metadata:t},d,h),zt(e,null,a,{kind:"getter",name:"bannerPlaces",static:!1,private:!1,access:{has:e=>"bannerPlaces"in e,get:e=>e.bannerPlaces},metadata:t},null,o),zt(e,null,s,{kind:"method",name:"getBannerPlaceById",static:!1,private:!1,access:{has:e=>"getBannerPlaceById"in e,get:e=>e.getBannerPlaceById},metadata:t},null,o),t&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})})(),e})();class Vt{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=new Ct(e.httpClient);this.bannerStore=new Ut(this.storyManager,t)}}class qt extends Error{constructor(){super("[IAS]: you must create an instance of BannersProvider"),this.name="IasBannersProviderReferenceError"}}class $t extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}class Gt extends Oe{render(){this.root.render((0,l.jsx)(Ee,{bannerPlace:this.bannerPlace}))}}class Ht{constructor(e){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"bannerPlaces",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"bannerPlaceViewModelFactory",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rootStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reloadAllBanners",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.rootStore.bannerStore.clearCache(),this.bannerPlaces.forEach((e=>{e.reload().catch(console.error)}))}}),this.rootStore=new Vt(e),this.bannerPlaceViewModelFactory=new Mt(e,this.rootStore.bannerStore),this.storyManager.rootStore.storyManagerConfigStore.waitStoryManagerConfig().then((()=>{this.storyManager.config.on("requestSDKReload",this.reloadAllBanners)}))}addBannerPlace(e){this.bannerPlaces.push(e)}removeBannerPlace(e){const t=this.bannerPlaces.indexOf(e);-1!==t&&this.bannerPlaces.splice(t,1)}clear(){for(const e of this.bannerPlaces)e.destroy();this.bannerPlaces=[]}createBannerPlace(e){return this.bannerPlaceViewModelFactory.createBannerPlace(this,e)}createBannerPreviewPlace(e){return this.bannerPlaceViewModelFactory.createBannerPreviewPlace(this,e)}static create(e){return Ht.instance||(Ht.instance=new Ht(e)),Ht.instance}mountBannerPlace(e,t){const r=document.querySelector(e);if(!r)throw new $t(e);const n=this.createBannerPlace(null==t?void 0:t.placeId),i=new Oe(r,n,t);return i.render(),i}mountBannerPreviewPlace(e,t){const r=document.querySelector(e);if(!r)throw new $t(e);const n=this.createBannerPreviewPlace(t.bannerId),i=new Gt(r,n);return i.render(),i}}const Xt=()=>{if(!Ht.instance)throw new qt;return Ht.instance},Yt=Ht;class Qt{constructor(){Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ias-banners"})}install(e){const t=Yt.create(e.INTERNAL_API);e.HOST.prototype.banners=t}uninstall(){}}const Jt=new Qt})();var u=h.RE,p=h.Sr,b=h.YL,f=h.Ay;export{u as IasBannerPlace,p as IasBannerPreview,b as IasBannersPlugin,f as default};